lex-xin преди 5 месеца
родител
ревизия
a7349eaae0
променени са 1 файла, в които са добавени 14 реда и са изтрити 11 реда
  1. 14 11
      src/views/order-detail/index.tsx

+ 14 - 11
src/views/order-detail/index.tsx

@@ -175,7 +175,6 @@ export default defineComponent({
 
     this.orderAmount = orderStatus.orderObject.actualPrice || 0
     this.orderPrice = orderStatus.orderObject.actualPrice || 0
-    console.log(this.orderAmount, this.orderPrice, 'orderPrice')
 
     this.disabledCoupon = orderStatus.orderObject.orderNo ? true : false
     this.dataLoading = false
@@ -443,7 +442,6 @@ export default defineComponent({
       resestState()
     },
     onCouponSelect(item: any) {
-      console.log('onCouponSelect', item)
       let discountCount = 0
       ;(item || []).forEach((item: any) => {
         discountCount += Number(item.discountPrice)
@@ -631,12 +629,17 @@ export default defineComponent({
                     item.discountPrice
                   )
 
-                  this.orderGoodsType.forEach((item: any)=> {
-                    if(item.orderType !== 'DISCOUNT') {
-                      item.price = numberToTwoUp(item.price - Number(item.discountPrice))
+                  this.orderGoodsType.forEach((child: any)=> {
+                    if(child.orderType !== 'DISCOUNT') {
+                      child.price = numberToTwoUp(child.price - Number(item.discountPrice))
                     }
                   })
 
+                  // 更新优惠券列表
+                  const useCouponRef: any =  this.$refs.useCouponRef
+                  if(useCouponRef) {
+                    useCouponRef.resetCouponList()
+                  }
                   this.orderPrice = Number(
                     numberToTwoUp(
                       Number(this.orderAmount) -
@@ -666,9 +669,9 @@ export default defineComponent({
                     orderStatus.orderObject.discountCardPrice = Number(
                       item.discountPrice
                     )
-                    this.orderGoodsType.forEach((item: any)=> {
-                      if(item.orderType !== 'DISCOUNT') {
-                        item.price = numberToTwoUp(item.price - Number(item.discountPrice))
+                    this.orderGoodsType.forEach((child: any)=> {
+                      if(child.orderType !== 'DISCOUNT') {
+                        child.price = numberToTwoUp(child.price - Number(item.discountPrice))
                       }
                     })
                     if (index === -1) {
@@ -692,9 +695,9 @@ export default defineComponent({
                     if (index !== -1) {
                       this.selectGoods.splice(index, 1)
                       this.orderAmount = this.orderAmount - item.salePrice
-                      this.orderGoodsType.forEach((item: any)=> {
-                        if(item.orderType !== 'DISCOUNT') {
-                          item.price = item.basePrice
+                      this.orderGoodsType.forEach((child: any)=> {
+                        if(child.orderType !== 'DISCOUNT') {
+                          child.price = child.basePrice
                         }
                       })
                       const typeIndex = tempType.findIndex((child: any) => child.orderType === item.vipType)