浏览代码

观影人订单-抖音订单/携程订单-退款提示

gcz 9 月之前
父节点
当前提交
373bc902a7
共有 1 个文件被更改,包括 76 次插入49 次删除
  1. 76 49
      src/views/order/viewers/index.vue

+ 76 - 49
src/views/order/viewers/index.vue

@@ -708,59 +708,86 @@ export default {
     },
     /**  打开弹窗  */
     openRefundSubmitModel(data, type) {
-      this.refundSubmitSuccess = []
-      this.refundSubmitError = []
-      let list = []
-      data.forEach((item,index)=>{
-        let flog = false
-        let indexNew = null
-        list.forEach((item1,index1)=>{
-          if(item.orderId == item1.orderId) {
-            flog = true
-            indexNew = index1
-          }
+        if(data.some(item => item.source === 20 || item.source === 3)) {
+        // 弹出确认框
+        this.$confirm(`请确认在OTA平台中已完成对应订单的退款操作流程,否则修改后无法恢复,请谨慎修改!`, '警告', {
+          confirmButtonText: '确认退款',
+          cancelButtonText: '取消',
+          type: 'warning'
         })
-        if(!flog){
-          list.push({
-            "orderId": item.orderId,
-            "refundReason": null,
-            "remark": null,
-            "refundAmount": 0,
-            "refundPeople": 0,
-            "ifDirectRefund": 1,
-            "errorRemark": '',
-            "viewerList": [
-              {
-                "viewerId": item.id,
-                "salePrice": item.realPrice?item.realPrice:0
+        .then(() => {
+          // 用户点击了确认退款,执行以下逻辑
+
+          // 初始化变量
+          this.refundSubmitSuccess = []
+          this.refundSubmitError = []
+          let list = []
+
+          // 构建订单列表
+          data.forEach((item,index)=>{
+            let flog = false
+            let indexNew = null
+            list.forEach((item1,index1)=>{
+              if(item.orderId == item1.orderId) {
+                flog = true
+                indexNew = index1
               }
-            ]
-          })
-        }else {
-          list[indexNew].viewerList.push({
-            "viewerId": item.id,
-            "salePrice": item.realPrice?item.realPrice:0
+            })
+            if(!flog){
+              list.push({
+                "orderId": item.orderId,
+                "refundReason": null,
+                "remark": null,
+                "refundAmount": 0,
+                "refundPeople": 0,
+                "ifDirectRefund": 1,
+                "errorRemark": '',
+                "viewerList": [
+                  {
+                    "viewerId": item.id,
+                    "salePrice": item.realPrice ? item.realPrice : 0
+                  }
+                ]
+              })
+            } else {
+              list[indexNew].viewerList.push({
+                "viewerId": item.id,
+                "salePrice": item.realPrice ? item.realPrice : 0
+              })
+            }
           })
-        }
-      })
-      let refundAmountAll = 0
-      let refundPeople = 0
-      list.forEach((item,index)=>{
-        if(item.viewerList && item.viewerList.length > 0){
-          let refundAmount = 0
-          refundPeople = refundPeople + item.viewerList.length
-          item.viewerList.forEach((item1,index1)=>{
-            refundAmount = mathM.format(Number(refundAmount) + Number(item1.salePrice),10)
-            refundAmountAll = mathM.format(Number(refundAmountAll) + Number(item1.salePrice),10)
+
+          // 计算退款总额和人数
+          let refundAmountAll = 0
+          let refundPeople = 0
+          list.forEach((item,index)=>{
+            if(item.viewerList && item.viewerList.length > 0){
+              let refundAmount = 0
+              refundPeople = refundPeople + item.viewerList.length
+              item.viewerList.forEach((item1,index1)=>{
+                refundAmount = mathM.format(Number(refundAmount) + Number(item1.salePrice),10)
+                refundAmountAll = mathM.format(Number(refundAmountAll) + Number(item1.salePrice),10)
+              })
+              list[index].refundAmount = refundAmount
+            }
           })
-          list[index].refundAmount = refundAmount
-        }
-      })
-      this.tkRuleForm['refundAmountAll'] = refundAmountAll
-      this.tkRuleForm['refundPeople'] = refundPeople
-      this.tkSelectList = JSON.parse(JSON.stringify(list))
-      console.log("dfsfdsfsdfds====",this.tkSelectList)
-      this.tkDialogVisible = true
+
+          // 更新表单数据和列表数据
+          this.tkRuleForm['refundAmountAll'] = refundAmountAll
+          this.tkRuleForm['refundPeople'] = refundPeople
+          this.tkSelectList = JSON.parse(JSON.stringify(list))
+          console.log("dfsfdsfsdfds====",this.tkSelectList)
+          this.tkDialogVisible = true
+        })
+        .catch(() => {
+          // 用户点击了取消,给出取消信息
+          this.$message({
+            type: 'info',
+            message: '已取消'
+          });
+        });
+        return
+      };
     },
     deleteSelect(index,row){
       let refundAmountAll = 0