shish 1 day ago
parent
commit
05a70d00b6
1 changed files with 39 additions and 13 deletions
  1. 39 13
      ghsApp/src/admin/billing/freeRefundConfirm.vue

+ 39 - 13
ghsApp/src/admin/billing/freeRefundConfirm.vue

@@ -39,7 +39,7 @@
                 返回修改
                 返回修改
               </view>
               </view>
               <view class="describe-view">
               <view class="describe-view">
-                <text>合计 ¥{{ allPrice }}</text>
+                <text>合计 ¥{{ refundTotalPrice }}</text>
                 <text>,{{ selectList.length }}种</text>
                 <text>,{{ selectList.length }}种</text>
                 <text v-if="Number(totalItemNum.big) > 0">,{{ parseFloat(totalItemNum.big) }}扎</text>
                 <text v-if="Number(totalItemNum.big) > 0">,{{ parseFloat(totalItemNum.big) }}扎</text>
                 <text v-if="Number(totalItemNum.small) > 0">,{{ parseFloat(totalItemNum.small) }}支</text>
                 <text v-if="Number(totalItemNum.small) > 0">,{{ parseFloat(totalItemNum.small) }}支</text>
@@ -90,16 +90,12 @@
             </view>
             </view>
           </tui-list-cell>
           </tui-list-cell>
         </view>
         </view>
-
-        <view class="tip-box">
-          无关联销售单。「退款方式」表示线下原路通道;确认后可在成功页选择「我已线下转账」或「返充到客户余额」。
-        </view>
       </view>
       </view>
 
 
       <view class="under-bar">
       <view class="under-bar">
         <view class="price-view">
         <view class="price-view">
           <text class="price-title"></text>
           <text class="price-title"></text>
-          <text class="price-number"><text class="large">¥{{ form.price || '0' }}</text></text>
+          <text class="price-number"><text class="large">¥{{ form.price || refundTotalPrice || '0' }}</text></text>
         </view>
         </view>
         <button class="admin-button-com blue big" @click="onSubmitTap">确认退款</button>
         <button class="admin-button-com blue big" @click="onSubmitTap">确认退款</button>
       </view>
       </view>
@@ -127,10 +123,10 @@ export default {
         { name: '现金', id: 4 },
         { name: '现金', id: 4 },
         { name: '银行卡', id: 5 }
         { name: '银行卡', id: 5 }
       ],
       ],
-      // 0库存不退(默认) 1库存退回
+      // 0库存不退 1库存退回;无默认,须选手选
       returnWayList: [
       returnWayList: [
-        { name: '库存不退', id: 0 },
-        { name: '库存退回', id: 1 }
+        { name: '库存不退', id: 0 },
+        { name: '库存退回', id: 1 }
       ],
       ],
       form: {
       form: {
         customId: '',
         customId: '',
@@ -138,7 +134,7 @@ export default {
         price: '',
         price: '',
         remark: '',
         remark: '',
         payWay: -1,
         payWay: -1,
-        returnWay: 0
+        returnWay: -1
       }
       }
     }
     }
   },
   },
@@ -154,6 +150,20 @@ export default {
         })
         })
       }
       }
       return { big, small }
       return { big, small }
+    },
+    /**
+     * 确认页合计:直接用已选花材单价×数量,不走 mixin allPrice。
+     * 原因:mixin 的 allPrice 要查 globalItemData,本页未加载花材目录会得到 0。
+     */
+    refundTotalPrice() {
+      let price = 0
+      if (!this.selectList) {
+        return 0
+      }
+      this.selectList.forEach((item) => {
+        price += Number(this.getLineAmount(item)) || 0
+      })
+      return Math.round(price * 100) / 100
     }
     }
   },
   },
   onLoad(option) {
   onLoad(option) {
@@ -169,7 +179,7 @@ export default {
       uni.setNavigationBarTitle({ title: '退款确认' })
       uni.setNavigationBarTitle({ title: '退款确认' })
     }
     }
     this.$nextTick(() => {
     this.$nextTick(() => {
-      this.form.price = this.allPrice > 0 ? String(this.allPrice) : ''
+      this.syncRefundPrice()
     })
     })
   },
   },
   methods: {
   methods: {
@@ -184,11 +194,16 @@ export default {
       const small = Number(item.smallCount) || 0
       const small = Number(item.smallCount) || 0
       return ((big + small) * unit).toFixed(2)
       return ((big + small) * unit).toFixed(2)
     },
     },
+    /** 用已选花材合计回填退款金额 */
+    syncRefundPrice() {
+      const total = this.refundTotalPrice
+      this.form.price = total > 0 ? String(total) : ''
+    },
     gobackEvent() {
     gobackEvent() {
       uni.navigateBack({})
       uni.navigateBack({})
     },
     },
     /**
     /**
-     * 校验选项后提交;资金三态在成功页落地
+     * 校验选项后弹框确认,再提交;资金三态在成功页落地
      */
      */
     onSubmitTap() {
     onSubmitTap() {
       if (this.$util.isEmpty(this.selectList)) {
       if (this.$util.isEmpty(this.selectList)) {
@@ -208,7 +223,18 @@ export default {
         this.$msg('请选择退款方式')
         this.$msg('请选择退款方式')
         return
         return
       }
       }
-      this.submitFreeRefund()
+      if (this.form.returnWay === -1 || this.form.returnWay === '' || this.form.returnWay === null) {
+        this.$msg('请选择退货方式')
+        return
+      }
+      const that = this
+      const returnLabel = Number(this.form.returnWay) === 1 ? '库存退回' : '库存不退'
+      that.$util.confirmModal({
+        title: '确认退款',
+        content: `退款 ¥${price},${returnLabel},确认提交?`
+      }, () => {
+        that.submitFreeRefund()
+      })
     },
     },
     /** 组装明细并调用 create-free-refund,跳转成功页待选资金动作 */
     /** 组装明细并调用 create-free-refund,跳转成功页待选资金动作 */
     submitFreeRefund() {
     submitFreeRefund() {