|
@@ -57,20 +57,10 @@
|
|
|
placeholder="0"
|
|
placeholder="0"
|
|
|
v-model="res.refundCount"
|
|
v-model="res.refundCount"
|
|
|
placeholder-style="color:#ccc"
|
|
placeholder-style="color:#ccc"
|
|
|
- @focus="clearRefundCount(res)" />
|
|
|
|
|
|
|
+ @focus="clearRefundCount(res)"
|
|
|
|
|
+ @input="onRefundCountInput" />
|
|
|
<text class="unit-label">份</text>
|
|
<text class="unit-label">份</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="input-item">
|
|
|
|
|
- <text class="input-label">单价</text>
|
|
|
|
|
- <input
|
|
|
|
|
- class="refund-input-compact"
|
|
|
|
|
- type="digit"
|
|
|
|
|
- placeholder="0.00"
|
|
|
|
|
- v-model="res.perPrice"
|
|
|
|
|
- placeholder-style="color:#ccc"
|
|
|
|
|
- @focus="clearPerPrice(res)" />
|
|
|
|
|
- <text class="unit-label">元</text>
|
|
|
|
|
- </view>
|
|
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -94,20 +84,10 @@
|
|
|
placeholder="0"
|
|
placeholder="0"
|
|
|
v-model="res.refundCount"
|
|
v-model="res.refundCount"
|
|
|
placeholder-style="color:#ccc"
|
|
placeholder-style="color:#ccc"
|
|
|
- @focus="clearRefundCount(res)" />
|
|
|
|
|
|
|
+ @focus="clearRefundCount(res)"
|
|
|
|
|
+ @input="onRefundCountInput" />
|
|
|
<text class="unit-label">{{res.unitName}}</text>
|
|
<text class="unit-label">{{res.unitName}}</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="input-item">
|
|
|
|
|
- <text class="input-label">单价</text>
|
|
|
|
|
- <input
|
|
|
|
|
- class="refund-input-compact"
|
|
|
|
|
- type="digit"
|
|
|
|
|
- placeholder="0.00"
|
|
|
|
|
- v-model="res.perPrice"
|
|
|
|
|
- placeholder-style="color:#ccc"
|
|
|
|
|
- @focus="clearPerPrice(res)" />
|
|
|
|
|
- <text class="unit-label">元</text>
|
|
|
|
|
- </view>
|
|
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -229,6 +209,10 @@
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+/**
|
|
|
|
|
+ * 花店订单售后页:选择退货商品、填写退款金额并提交。
|
|
|
|
|
+ * 退货单价直接取订单原单价,只需填数量。
|
|
|
|
|
+ */
|
|
|
import { getDetail,refund } from "@/api/order/index";
|
|
import { getDetail,refund } from "@/api/order/index";
|
|
|
import ModalModule from "@/components/plugin/modal";
|
|
import ModalModule from "@/components/plugin/modal";
|
|
|
export default {
|
|
export default {
|
|
@@ -260,28 +244,26 @@ export default {
|
|
|
// 金额比较按 2 位小数对齐,避免浮点误差
|
|
// 金额比较按 2 位小数对齐,避免浮点误差
|
|
|
return refundMoney.toFixed(2) === couldRefund.toFixed(2)
|
|
return refundMoney.toFixed(2) === couldRefund.toFixed(2)
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按退货数量 × 商品原单价汇总金额,并回填退款金额。
|
|
|
|
|
+ * 单价不再手填,避免漏填导致退款金额为 0。
|
|
|
|
|
+ */
|
|
|
refundPrice(){
|
|
refundPrice(){
|
|
|
let price = 0
|
|
let price = 0
|
|
|
if(!this.$util.isEmpty(this.goodsInfoList)){
|
|
if(!this.$util.isEmpty(this.goodsInfoList)){
|
|
|
for (const item of this.goodsInfoList) {
|
|
for (const item of this.goodsInfoList) {
|
|
|
if(Number(item.refundCount)>0){
|
|
if(Number(item.refundCount)>0){
|
|
|
- let currentPrice = Number(item.refundCount)*Number(item.perPrice)
|
|
|
|
|
- currentPrice.toFixed(2)
|
|
|
|
|
|
|
+ let currentPrice = Number(item.refundCount)*Number(item.unitPrice)
|
|
|
price = Number(price) + Number(currentPrice)
|
|
price = Number(price) + Number(currentPrice)
|
|
|
- price.toFixed(2)
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(!this.$util.isEmpty(this.itemInfoList)){
|
|
if(!this.$util.isEmpty(this.itemInfoList)){
|
|
|
for (const item of this.itemInfoList) {
|
|
for (const item of this.itemInfoList) {
|
|
|
if(Number(item.refundCount)>0){
|
|
if(Number(item.refundCount)>0){
|
|
|
- let currentPrice = Number(item.refundCount)*Number(item.perPrice)
|
|
|
|
|
- currentPrice.toFixed(2)
|
|
|
|
|
|
|
+ let currentPrice = Number(item.refundCount)*Number(item.unitPrice)
|
|
|
price = Number(price) + Number(currentPrice)
|
|
price = Number(price) + Number(currentPrice)
|
|
|
- price.toFixed(2)
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
this.refundMoney = parseFloat(price.toFixed(2))
|
|
this.refundMoney = parseFloat(price.toFixed(2))
|
|
@@ -309,9 +291,16 @@ export default {
|
|
|
},
|
|
},
|
|
|
clearRefundCount(item) {
|
|
clearRefundCount(item) {
|
|
|
this.$set(item, 'refundCount', '');
|
|
this.$set(item, 'refundCount', '');
|
|
|
|
|
+ this.onRefundCountInput()
|
|
|
},
|
|
},
|
|
|
- clearPerPrice(item) {
|
|
|
|
|
- this.$set(item, 'perPrice', '');
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 退货数量变化后读取 refundPrice,按原单价回填退款金额。
|
|
|
|
|
+ * 计算属性默认懒求值,不主动读取就不会更新退款金额。
|
|
|
|
|
+ */
|
|
|
|
|
+ onRefundCountInput() {
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ void this.refundPrice
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
clearRefundMoney() {
|
|
clearRefundMoney() {
|
|
|
this.refundMoney = '';
|
|
this.refundMoney = '';
|
|
@@ -354,12 +343,7 @@ export default {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
if(Number(ele.refundCount)>0){
|
|
if(Number(ele.refundCount)>0){
|
|
|
- if(Number(ele.perPrice)>Number(ele.unitPrice)){
|
|
|
|
|
- uni.showToast({title:ele.name+' 退款单价不能大于原价',icon:'none'})
|
|
|
|
|
- hasError = true;
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- selectProduct.push({"productId":ele.goodsId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.perPrice || ele.unitPrice,property:0})
|
|
|
|
|
|
|
+ selectProduct.push({"productId":ele.goodsId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.unitPrice,property:0})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -377,12 +361,7 @@ export default {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
if(Number(ele.refundCount)>0){
|
|
if(Number(ele.refundCount)>0){
|
|
|
- if(Number(ele.perPrice)>Number(ele.unitPrice)){
|
|
|
|
|
- uni.showToast({title:ele.name+' 退款单价不能大于原价',icon:'none'})
|
|
|
|
|
- hasError = true;
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- selectProduct.push({"productId":ele.itemId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.perPrice || ele.unitPrice,property:1})
|
|
|
|
|
|
|
+ selectProduct.push({"productId":ele.itemId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.unitPrice,property:1})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -416,14 +395,14 @@ export default {
|
|
|
if(!this.$util.isEmpty(this.goodsInfoList)){
|
|
if(!this.$util.isEmpty(this.goodsInfoList)){
|
|
|
this.goodsInfoList.forEach(ele=>{
|
|
this.goodsInfoList.forEach(ele=>{
|
|
|
if(Number(ele.refundCount)>0){
|
|
if(Number(ele.refundCount)>0){
|
|
|
- selectProduct.push({"productId":ele.goodsId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.perPrice || ele.unitPrice,property:0})
|
|
|
|
|
|
|
+ selectProduct.push({"productId":ele.goodsId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.unitPrice,property:0})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
if(!this.$util.isEmpty(this.itemInfoList)){
|
|
if(!this.$util.isEmpty(this.itemInfoList)){
|
|
|
this.itemInfoList.forEach(ele=>{
|
|
this.itemInfoList.forEach(ele=>{
|
|
|
if(Number(ele.refundCount)>0){
|
|
if(Number(ele.refundCount)>0){
|
|
|
- selectProduct.push({"productId":ele.itemId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.perPrice || ele.unitPrice,property:1})
|
|
|
|
|
|
|
+ selectProduct.push({"productId":ele.itemId,"num":ele.refundCount,"unitType":ele.unitType,unitName:ele.unitName,unitPrice:ele.unitPrice,property:1})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -499,10 +478,10 @@ export default {
|
|
|
this.coundRefundPrice = parseFloat(this.coundRefundPrice)
|
|
this.coundRefundPrice = parseFloat(this.coundRefundPrice)
|
|
|
|
|
|
|
|
this.goodsInfoList = res.data.goodsInfoList.map(ele=>{
|
|
this.goodsInfoList = res.data.goodsInfoList.map(ele=>{
|
|
|
- return {...ele,refundCount:null,perPrice:''}
|
|
|
|
|
|
|
+ return {...ele,refundCount:null}
|
|
|
})
|
|
})
|
|
|
this.itemInfoList = res.data.itemInfoList.map(ele=>{
|
|
this.itemInfoList = res.data.itemInfoList.map(ele=>{
|
|
|
- return {...ele,refundCount:null,perPrice:''}
|
|
|
|
|
|
|
+ return {...ele,refundCount:null}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|