Quellcode durchsuchen

bugfix:处理砍价记录、支付问题

leo vor 1 Jahr
Ursprung
Commit
2578bc446d

+ 7 - 1
pages/claimCloudPhone/components/bargainingAssistance.vue

@@ -76,9 +76,15 @@
               >
                 <div class="bargaining-record-item_info">
                   <div>{{ item.surfaceName }}</div>
-                  <div>
+                  <div v-if="item.assistType === 1">
                     道具砍掉<span>{{ item.assistPrice }}元</span>
                   </div>
+                  <div v-else-if="item.assistType === 2 || item.assistType === 3">
+                    为您砍价<span>{{ item.assistPrice }}元</span>
+                  </div>
+                  <div v-else>
+                    为您加油打气
+                  </div>
                 </div>
               </div>
             </template>

+ 57 - 12
pages/claimCloudPhone/confirmation.vue

@@ -2,12 +2,15 @@
   <div class="confirmation">
     <div class="confirmation-bg">
       <div class="confirmation-tips">
-        <template v-if="status === 1">
-          <van-icon name="passed" />下单成功
+        <template v-if="status[currentStatus]">
+          <van-icon
+            :name="status[currentStatus].key"
+            v-if="status[currentStatus].key"
+          />
+          {{ status[currentStatus].name }}
         </template>
-        <template v-else> <van-icon name="close" /> 下单失败 </template>
       </div>
-      <div class="confirmation-obtain" v-if="status === 1">
+      <div class="confirmation-obtain" v-if="currentStatus !== 2">
         3大权益已开通&nbsp;&nbsp;云机已到账
       </div>
     </div>
@@ -54,8 +57,23 @@ export default {
   components: {},
   data() {
     return {
-      status: '',
       bargainingStatusInfo: {},
+      status: {
+        1: {
+          name: '支付成功',
+          key: 'passed',
+        },
+        2: {
+          name: '支付中...',
+          key: 0,
+        },
+        3: {
+          name: '支付失败',
+          key: 'close',
+        },
+      },
+      currentStatus: '',
+      index: 1,
     };
   },
   mounted() {
@@ -65,18 +83,44 @@ export default {
     );
   },
   methods: {
-    getPayStatus() {
-      console.log(456789);
+    getPayStatus(bool = true) {
+      if (bool) {
+        this.$toast.loading({
+          message: '加载中...',
+          forbidClick: true,
+          duration: 0,
+        });
+      }
       this.$axios
         .$get('pay/v1/alipay/h5/spend/getPayStatus', {
           params: {
-            myOrderNum: localStorage.getItem('myOrderNum'),
+            myOrderNum: localStorage.getItem('activityPurchaseMyOrderNum'),
           },
         })
         .then((res) => {
           if (res.success) {
-            this.status = res.data;
+            this.currentStatus = res.data;
+            console.log(this.currentStatus, 123456)
+            if (+res.data === 2) {
+              if (this.index === 2) {
+                this.currentStatus = 3;
+                this.$set(
+                  this.status[this.currentStatus],
+                  'name',
+                  '去app查看结果',
+                );
+                this.index = 1;
+                return;
+              }
+              this.index++;
+              setTimeout(() => {
+                this.getPayStatus(false);
+              }, 2000);
+            }
           }
+        })
+        .finally(() => {
+          this.$toast.clear();
         });
     },
     download() {
@@ -84,9 +128,10 @@ export default {
         ? this.bargainingStatusInfo.downloadAndroidUrl
         : 'https://www.androidscloud.com';
     },
-    toH5(){
-      location.href = 'http://gntest.phone.androidscloud.com:1280/cloud/phone/web/#/'
-    }
+    toH5() {
+      location.href =
+        'http://gntest.phone.androidscloud.com:1280/cloud/phone/web/#/';
+    },
   },
 };
 </script>

+ 37 - 7
pages/claimCloudPhone/purchase.vue

@@ -1,5 +1,10 @@
 <template>
-  <layout bgImgName="purchase-img" bgColor="#FDF2E3" bgHeight="188" @goBack="goBack">
+  <layout
+    bgImgName="purchase-img"
+    bgColor="#FDF2E3"
+    bgHeight="188"
+    @goBack="goBack"
+  >
     <div class="purchase">
       <div class="purchase-privilege">
         <div>
@@ -37,7 +42,8 @@
                 <span>¥</span>{{ currentData.actualPrice }}
               </div>
               <div class="payment-container-info_name">
-                {{ packageType[currentData.phoneType] }}{{ currentData.day }}天卡
+                {{ packageType[currentData.phoneType]
+                }}{{ currentData.day }}天卡
               </div>
             </div>
           </div>
@@ -57,7 +63,10 @@
                   :class="{ active: active === item.key }"
                   @click="active = item.key"
                 >
-                  <img :src="active === item.key ? item.activeImg : item.img" alt="" />
+                  <img
+                    :src="active === item.key ? item.activeImg : item.img"
+                    alt=""
+                  />
                   {{ item.name }}
                 </div>
               </template>
@@ -81,6 +90,11 @@
           </div>
         </div>
       </van-popup>
+
+      <van-dialog v-model="activityPurchaseVisible" @cancel="confirm(false)" @confirm="confirm(true)" show-cancel-button confirmButtonText="“已完成支付" confirmButtonColor="#3367d1">
+        <div style="font-size: 18px; font-weight: bold;text-align: center;padding-top: 10px;">如果您已支付成功</div>
+        <div style="font-size: 18px; font-weight: bold;text-align: center;padding-bottom: 10px;">请点击"已完成支付"按钮</div>
+      </van-dialog>
     </div>
   </layout>
 </template>
@@ -114,17 +128,18 @@ export default {
         {
           name: '微信',
           img: require('@/assets/image/claimCloudPhone/weChat.png'),
-          activeImg:  require('@/assets/image/claimCloudPhone/weChatActvie.png'),
+          activeImg: require('@/assets/image/claimCloudPhone/weChatActvie.png'),
           key: 'wxPay',
         },
         {
           name: '支付宝',
           img: require('@/assets/image/claimCloudPhone/alipay.png'),
-          activeImg:  require('@/assets/image/claimCloudPhone/alipayActive.png'),
+          activeImg: require('@/assets/image/claimCloudPhone/alipayActive.png'),
           key: 'aliPay',
         },
       ],
       btnLoading: false,
+      activityPurchaseVisible: false,
     };
   },
   mounted() {
@@ -138,6 +153,11 @@ export default {
       sessionStorage.removeItem('active');
       sessionStorage.removeItem('stepper');
     }
+    if (localStorage.getItem('activityPurchaseVisible')) {
+      this.activityPurchaseVisible = true;
+      localStorage.removeItem('activityPurchaseVisible');
+    }
+
     this.getActivitySortRuleAndActivityMealList({
       personnelMealType: 2,
     });
@@ -177,7 +197,7 @@ export default {
           };
 
           if (res.success) {
-            localStorage.setItem('myOrderNum', res.data.myOrderNum);
+            localStorage.setItem('activityPurchaseMyOrderNum', res.data.myOrderNum);
             const data = {
               myOrderNum: res.data.myOrderNum,
             };
@@ -193,6 +213,11 @@ export default {
                   div.innerHTML = res.data;
                   document.body.appendChild(div);
                   document.forms[0].submit();
+                  // 这个是为了兼容安卓支付宝没有跳转页面
+                  localStorage.setItem('activityPurchaseVisible', 1);
+                  setTimeout(() => {
+                    this.activityPurchaseVisible = true;
+                  }, 3000);
                   div.remove();
                 } else {
                   window.location.replace(res.data);
@@ -251,7 +276,12 @@ export default {
       );
     },
     goBack() {
-      this.$router.push('/claimCloudPhone/inviteeExits')
+      this.$router.push('/claimCloudPhone/inviteeExits');
+    },
+    confirm(bool) {
+      if(bool) return this.$router.replace('/claimCloudPhone/confirmation')
+      this.activityPurchaseVisible = false;
+      localStorage.removeItem('activityPurchaseVisible');
     }
   },
 };

+ 6 - 2
pages/claimCloudPhone/secondReward.vue

@@ -29,7 +29,7 @@
         <img
           src="@/assets/image/claimCloudPhone/claim-mobile-phone-btn.png"
           class="details-btn"
-          @click="$router.push('/claimCloudPhone/purchase')"
+          @click="toPurchase"
         />
       </div>
     </div>
@@ -60,7 +60,7 @@ export default {
       adaptedModels: [1], // 适配机型
       isSelectBool: false,
       imgName: '',
-      IMG_URL: process.env.IMG_URL
+      IMG_URL: process.env.IMG_URL,
     };
   },
   components: { layout },
@@ -78,6 +78,10 @@ export default {
       if (this.isSelectBool) return (this.isSelectBool = false);
       this.$router.go(-1);
     },
+    toPurchase() {
+      localStorage.removeItem('activityPurchaseVisible');
+      this.$router.push('/claimCloudPhone/purchase');
+    },
   },
 };
 </script>