shish 4 лет назад
Родитель
Сommit
4599ce2797
1 измененных файлов с 27 добавлено и 21 удалено
  1. 27 21
      ghsApp/src/pagesOrder/refund.vue

+ 27 - 21
ghsApp/src/pagesOrder/refund.vue

@@ -146,7 +146,7 @@
 <script>
 import stepStatus from "./components/stepStatus";
 import TuiListCell from "@/components/plugin/list-cell";
-import { getDetail,debtPay,hasPay, freeShipping,refund } from "@/api/order/index";
+import { getDetail,refund } from "@/api/order/index";
 import { ORDER_STATUS } from "@/utils/declare";
 export default {
 	name: "orderDetail",
@@ -158,8 +158,8 @@ export default {
 		return {
 			ORDER_STATUS,
 			isMonitor:true,
-			product:'',
-			refundMoney:null,
+			product:[],
+			refundMoney:0,
 			refundType:1,
 			remark:'',
 			refundPrice:0,
@@ -170,24 +170,30 @@ export default {
 	onShow() {
 	},
 	computed:{
-		refundMoneyFun(){
-			if(this.refundType == 2){
-				return
-			}
-			this.refundPrice = 0
-			if(!this.$util.isEmpty(this.product)){
-				this.product.forEach(ele=>{
-					let unitPrice = ele.unitPrice;
-					let big = ele.big * unitPrice;
-					let small = (ele.small * ele.smallUnitPrice).toFixed(2);
-					this.refundPrice = (Number(this.refundPrice) + big + Number(small)).toFixed(2);
-				})
-			}
-			this.refundMoney = parseFloat((this.refundPrice * this.discount).toFixed(2))
-			if(Number(this.refundMoney) > Number(this.orderInfo.realPrice)){
-				this.refundMoney = parseFloat(this.orderInfo.realPrice)
-			}
-		},
+	},
+	watch:{
+		product: {
+			handler(newVal) {
+				if(this.refundType == 2){
+					return
+				}
+				this.refundPrice = 0
+				if(!this.$util.isEmpty(newVal)){
+					newVal.forEach(ele=>{
+						let unitPrice = ele.unitPrice;
+						let big = ele.big * unitPrice;
+						let small = (ele.small * ele.smallUnitPrice).toFixed(2);
+						this.refundPrice = (Number(this.refundPrice) + big + Number(small)).toFixed(2);
+					})
+				}
+				let mayRefundMoney = parseFloat((this.refundPrice * this.discount).toFixed(2))
+				if(Number(mayRefundMoney) > Number(this.orderInfo.realPrice)){
+					mayRefundMoney = parseFloat(this.orderInfo.realPrice)
+				}
+				this.refundMoney = Number(mayRefundMoney) == 0 ? null : Number(mayRefundMoney)
+			},
+			deep: true
+		}
 	},
 	methods: {
 		retreatPage(){