Kaynağa Gözat

fix: "非已付款,线下订单要隐藏按钮"

Ritchie 2 yıl önce
ebeveyn
işleme
8687547d26
1 değiştirilmiş dosya ile 23 ekleme ve 37 silme
  1. 23 37
      src/views/orderCenter/index.vue

+ 23 - 37
src/views/orderCenter/index.vue

@@ -211,14 +211,10 @@
               <span class="info4">{{ refundObject.refundAmount }}</span>
             </div>
             <!-- 发起退款 -->
-            <!-- TODO: 线下订单隐藏退款按钮,当前海外都是线下,后续加上 isAir 判断 -->
-            <van-button 
-              size="small" 
-              v-if="refundObject.status === 1 && disRefund === 1" 
-              @click="noticeClk(refundObject)" 
-              round
-              type="primary" 
-              style="margin-top: 20px;">
+            <!-- 非已付款订单,线下订单要隐藏按钮 -->
+            <van-button size="small"
+              v-if="(refundObject.status === 1 && user.ifForeign === '0') || (refundObject.status === 1 && user.ifForeign === '1' && refundObject.isAir === '1')"
+              @click="noticeClk(refundObject)" round type="primary" style="margin-top: 20px;">
               {{ $t('orderCenter.initiateRefund') }}
             </van-button>
           </div>
@@ -339,21 +335,18 @@ export default {
     }
     // 点击弹出退款弹窗
     const noticeClk = (row) => {
-      // console.log('row', row)
       if (row.orderDetails.length > 0) {
         isChecked.value = [];
         orderDetails.value = [];
         refundNum.value = [];
         checkedAll.value = false;
         totalRefund.value = 0;
-        // console.log("isChecked", isChecked.value);
         // cofficentForm.price = row.price;
         // cofficentForm.maxPrice = row.price;
         cofficentForm.id = row.id;
         // cofficentForm.maxNumber = row.productNumber;
         // cofficentForm.productNumber = row.productNumber;
         row.orderDetails.forEach(item => {
-          // console.log(item)
           if (item.refundStatus == '1' || item.refundStatus == '2') {
             orderDetails.value.push(item);
             if (item.refundQuantity != null) {
@@ -365,7 +358,6 @@ export default {
         });
         // 根据orderDetails的长度,向isChecked添加相应数量的false
         isChecked.value = Array.from({ length: orderDetails.value.length }, () => false);
-        // console.log(refundNum.value);
         kDialogRef.value.openDialog();
       } else {
         Toast("请联系管理员");
@@ -447,14 +439,22 @@ export default {
     // 订单商品图片路径处理
     const showSugerPhoto = (row) => {
       // let imgId = "";
-      if (row.orderDetails.length > 0) {
-        // orderDetails.value = row.orderDetails
-        // console.log("orderDetails:", row.orderDetails[0].productNo);
-        return require(`../../assets/order/spunSugar/goods/${row.orderDetails[0].productNo}.png`);
-      } else {
-        if (row.productNo != null) {
-          return require(`../../assets/order/spunSugar/goods/${row.productNo}.png`);
+      if (row.orderDetails != null) {
+        if (row.orderDetails.length > 0) {
+          // orderDetails.value = row.orderDetails
+          // console.log("orderDetails:", row.orderDetails[0].productNo);
+          return require(`../../assets/order/spunSugar/goods/${row.orderDetails[0].productNo}.png`);
+        } else {
+          if (row.productNo != null) {
+            return require(`../../assets/order/spunSugar/goods/${row.productNo}.png`);
+          }
+          if (row.machineType == null || row.machineType == '0') {
+            return require(`../../assets/order/spunSugar/goods/A01.png`);
+          } else {
+            return require(`../../assets/order/spunSugar/goods/B01.png`);
+          }
         }
+      } else {
         if (row.machineType == null || row.machineType == '0') {
           return require(`../../assets/order/spunSugar/goods/A01.png`);
         } else {
@@ -481,7 +481,6 @@ export default {
     const loading = ref(true);
     const error = ref(false);
     const finished = ref(false);
-    const isAir = ref("0"); // 默认不是云汇,线下
     // 滚动加载
     const onLoad = () => {
       if (!finished.value) {
@@ -490,18 +489,6 @@ export default {
       }
     };
 
-    // 禁用退款按钮
-    const disRefund = ref(false);
-    const checkDisRefund = async () => {
-      try {
-        // 如果是海外 并且 不是线上的空中云汇
-        if (user.ifForeign === '1' && isAir.value != '1') { 
-          disRefund.value = true;
-        }
-      } catch (error) {
-        console.error(error);
-      }
-    }
 
     // 页面列表查询参数
     let searchParams = reactive({
@@ -522,8 +509,8 @@ export default {
       status: "",//支付状态
       companyType: "", // 公司平台
       machineType: "", // 设备类型
-      isAir: "", // 是否空中云汇线上订单 0或null:线下 1:线上
     });
+
     let chartType = "day";
     // 获取订单列表数据
     const getList = async () => {
@@ -550,7 +537,6 @@ export default {
 
       // 获取订单列表
       const { data } = await getOrderList(Object.assign({}, params));
-      console.log("获取订单 data 结果" + data.data);
       if (data.code === "00000") {
         if (params.current === 1) {
           orderList.value = [];
@@ -625,7 +611,7 @@ export default {
           adminId: user.id,
         });
         if (data.code === '00000') {
-          if(data.data != null) {
+          if (data.data != null) {
             huifuId.value = data.data.huifuId;
           }
         }
@@ -647,7 +633,7 @@ export default {
 
     // 查询是否有退款权限
     const isRefund = user.menuCodeList.some((item) => {
-        return item === "M16";
+      return item === "M16";
     });
 
     // 跳转订单导出
@@ -798,6 +784,7 @@ export default {
       }
     };
     return {
+      user,
       loading,
       error,
       finished,
@@ -843,7 +830,6 @@ export default {
       minusRefundGood,
       isLoading,
       isRefund,
-      checkDisRefund
     };
   },
 };