Browse Source

Merge branch 'develop' of http://192.168.32.253:3000/Software/android-cloud-H5 into develop

heyang 2 years ago
parent
commit
e1c96f8fa8
3 changed files with 77 additions and 21 deletions
  1. 2 1
      .eslintignore
  2. 74 20
      pages/activity/lottery/index.vue
  3. 1 0
      plugins/uni.js

+ 2 - 1
.eslintignore

@@ -2,4 +2,5 @@ node_modules/
 .nuxt/
 .nuxt/
 static/
 static/
 dist/
 dist/
-plugins/wx_rsa
+plugins/wx_rsa
+plugins/uni

+ 74 - 20
pages/activity/lottery/index.vue

@@ -1,9 +1,9 @@
 <template>
 <template>
   <div class="lottery-container">
   <div class="lottery-container">
-    <van-swipe :autoplay="3000" class="lottery-swipe" vertical :show-indicators="false">
+    <van-swipe v-if="carousel.length" :autoplay="3000" class="lottery-swipe" vertical :show-indicators="false">
       <van-swipe-item v-for="item in carousel" :key="item.mealId">有{{item.count}}个用户 {{['', '抽奖', '购买'][item.type]}}{{item.title}}</van-swipe-item>
       <van-swipe-item v-for="item in carousel" :key="item.mealId">有{{item.count}}个用户 {{['', '抽奖', '购买'][item.type]}}{{item.title}}</van-swipe-item>
     </van-swipe>
     </van-swipe>
-    <img class="w51h26" src="~/assets/image/activity/lottery/rule.png" alt="" @click="showRule=true">
+    <img class="w51h26" src="~/assets/image/activity/lottery/rule.png" alt="" @click="showRule=true;makePoint('activity_购买协议')">
     <div class="roulette">
     <div class="roulette">
       <div class="arrow" @click="startRotation"></div>
       <div class="arrow" @click="startRotation"></div>
       <img class="start-btn" src="~/assets/image/activity/lottery/start-btn.png" alt="" @click="startRotation">
       <img class="start-btn" src="~/assets/image/activity/lottery/start-btn.png" alt="" @click="startRotation">
@@ -27,14 +27,14 @@
           <div class="txt4">年卡(已获得)</div>
           <div class="txt4">年卡(已获得)</div>
           <img class="w253h73" src="~/assets/image/activity/lottery/coupon-1.png" alt="">
           <img class="w253h73" src="~/assets/image/activity/lottery/coupon-1.png" alt="">
         </div>
         </div>
-        <div v-for="item in mealList" :key="item.id" :class="selMealId===item.id ? 'coupon-2 active' : 'coupon-2'" @click="selMealId=item.id">
+        <div v-for="item in mealList" :key="item.id" :class="selMealId===item.id ? 'coupon-2 active' : 'coupon-2'" @click="selMealId=item.id;makePoint(item.day === 30 ? 'activity_38月卡' : 'activity_268年卡')">
           <img v-if="selMealId===item.id" class="coupon-select-icon" src="~/assets/image/activity/lottery/select-icon.png" alt="">
           <img v-if="selMealId===item.id" class="coupon-select-icon" src="~/assets/image/activity/lottery/select-icon.png" alt="">
           <img v-else class="coupon-select-icon" src="~/assets/image/activity/lottery/unselect-icon.png" alt="">
           <img v-else class="coupon-select-icon" src="~/assets/image/activity/lottery/unselect-icon.png" alt="">
           <div class="coupon-title"><span class="txt2">{{item.actualPrice}}</span><span>会员</span></div>
           <div class="coupon-title"><span class="txt2">{{item.actualPrice}}</span><span>会员</span></div>
           <div class="txt4">{{item.day === 30 ? '月卡' : '年卡'}}</div>
           <div class="txt4">{{item.day === 30 ? '月卡' : '年卡'}}</div>
           <img class="w111h73" src="~/assets/image/activity/lottery/coupon-2.png" alt="">
           <img class="w111h73" src="~/assets/image/activity/lottery/coupon-2.png" alt="">
         </div>
         </div>
-        <div v-for="item in paySupportType" :key="item" class="fnbc" @click="payType = item">
+        <div v-for="item in paySupportType" :key="item" class="fnbc" @click="payType = item;makePoint(item === 'aliPay' ? 'activity_支付宝' : 'activity_微信')">
           <div v-if="item === 'aliPay'" class="fnc">
           <div v-if="item === 'aliPay'" class="fnc">
             <van-icon class="icon-pay" :name="require('~/assets/image/activity/lottery/alipay.png')" />
             <van-icon class="icon-pay" :name="require('~/assets/image/activity/lottery/alipay.png')" />
             <span class="txt5">支付宝支付</span>
             <span class="txt5">支付宝支付</span>
@@ -46,10 +46,10 @@
           <van-icon :name="payType === item ? require('~/assets/image/activity/lottery/select-round-icon.png') : require('~/assets/image/activity/lottery/unselect-round-icon.png')" size="24" />
           <van-icon :name="payType === item ? require('~/assets/image/activity/lottery/select-round-icon.png') : require('~/assets/image/activity/lottery/unselect-round-icon.png')" size="24" />
         </div>
         </div>
         <img class="w304h62" src="~/assets/image/activity/lottery/pay-btn.png" alt="" @click="createOrder">
         <img class="w304h62" src="~/assets/image/activity/lottery/pay-btn.png" alt="" @click="createOrder">
-        <div class="txt6">开通前阅读并同意<a @click="showRule=true">购买协议</a></div>
+        <div class="txt6">开通前阅读并同意<a @click="showRule=true;makePoint('activity_购买协议')">购买协议</a></div>
       </div>
       </div>
     </van-popup>
     </van-popup>
-    <van-popup v-model="show" closeable close-icon-position="top-right" round>
+    <van-popup v-model="show" closeable close-icon-position="top-right" round @closed="makePoint('activity_关闭弹窗')">
       <div class="popup-view popup-view-leave">
       <div class="popup-view popup-view-leave">
         <div class="txt1">确定离开吗</div>
         <div class="txt1">确定离开吗</div>
         <div class="txt6">离开后您将失去{{actualPrice}}年卡,24小时付款有效</div>
         <div class="txt6">离开后您将失去{{actualPrice}}年卡,24小时付款有效</div>
@@ -60,7 +60,7 @@
           <img class="w253h73" src="~/assets/image/activity/lottery/coupon-1.png" alt="">
           <img class="w253h73" src="~/assets/image/activity/lottery/coupon-1.png" alt="">
         </div>
         </div>
         <div class="fnbc">
         <div class="fnbc">
-          <div class="btn-leave" @click="show=false">狠心离开</div>
+          <div class="btn-leave" @click="show=false;makePoint('activity_狠心离开')">狠心离开</div>
           <div class="btn-pay" @click="createOrder">立即购买</div>
           <div class="btn-pay" @click="createOrder">立即购买</div>
         </div>
         </div>
       </div>
       </div>
@@ -80,7 +80,7 @@
         <div class="txt6">3、年卡特惠包合约到期后,如时长补充包仍有时长,年卡特惠包所属云手机可继续使用至时长用尽。</div>
         <div class="txt6">3、年卡特惠包合约到期后,如时长补充包仍有时长,年卡特惠包所属云手机可继续使用至时长用尽。</div>
         <div class="txt7">温馨提示:</div>
         <div class="txt7">温馨提示:</div>
         <div class="txt6">1、请您理解:通过任何不正当手段参与活动,如借助非自然流量/外挂工具;利用技术漏洞,恶意退款,批量注册账号、买号等搅乱平台管理秩序的行为,臂云科技有权限制/取消用户的活动资格,不予发放/撤销相关交易及福利内容。</div>
         <div class="txt6">1、请您理解:通过任何不正当手段参与活动,如借助非自然流量/外挂工具;利用技术漏洞,恶意退款,批量注册账号、买号等搅乱平台管理秩序的行为,臂云科技有权限制/取消用户的活动资格,不予发放/撤销相关交易及福利内容。</div>
-        <div class="txt6">2、如有疑问请联系唔即云APP客服咨询。</div>
+        <div class="txt6">2、如有疑问请联系双子星APP客服咨询。</div>
       </div>
       </div>
     </van-popup>
     </van-popup>
   </div>
   </div>
@@ -90,6 +90,7 @@
 import { Toast } from 'vant'
 import { Toast } from 'vant'
 import RoundTurntable from './component/roundTurntable.vue'
 import RoundTurntable from './component/roundTurntable.vue'
 const RSA = require('../../../plugins/wx_rsa');
 const RSA = require('../../../plugins/wx_rsa');
+const webUni = require('../../../plugins/uni');
 export default {
 export default {
   name: 'Lottery',
   name: 'Lottery',
   auth: false,
   auth: false,
@@ -155,7 +156,9 @@ export default {
       payType: '',
       payType: '',
       mealList: [],
       mealList: [],
       status: 0,
       status: 0,
-      carousel: []
+      carousel: [],
+      phoneType: 'SVIP',
+      client: 0
     }
     }
   },
   },
   async fetch() {
   async fetch() {
@@ -169,6 +172,15 @@ export default {
     title: '年卡抽奖活动'
     title: '年卡抽奖活动'
   },
   },
   created() {
   created() {
+    if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
+      this.client = 1
+    } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
+      this.client = 2
+    } else if (this.$userAgent.isMiniProgram) {
+      this.client = 5
+    } else {
+      this.client = 7
+    }
     this.getLuckDrawActivity()
     this.getLuckDrawActivity()
     this.getMealInfo()
     this.getMealInfo()
     this.getCarouselList()
     this.getCarouselList()
@@ -179,7 +191,7 @@ export default {
       this.carousel = res.data;
       this.carousel = res.data;
     },
     },
     async getMealInfo() {
     async getMealInfo() {
-      const res = await this.$axios.$get('/pay/v2/meal/info?phoneType=SVIP');
+      const res = await this.$axios.$get('/pay/v2/meal/info?phoneType=' + this.phoneType);
       this.mealList = res.data.list.filter(item => item.day === 30 || item.day === 365)
       this.mealList = res.data.list.filter(item => item.day === 30 || item.day === 365)
     },
     },
     async createOrder() {
     async createOrder() {
@@ -188,31 +200,57 @@ export default {
           duration: 0,
           duration: 0,
           forbidClick: true,
           forbidClick: true,
         });
         });
+        this.makePoint('activity_立即购买')
         let taocan = {
         let taocan = {
           buyType: 1,
           buyType: 1,
           couponId: 0,
           couponId: 0,
           id: this.selMealId,
           id: this.selMealId,
           mealType: 0,
           mealType: 0,
-          phoneType: 'SVIP',
+          phoneType: this.phoneType,
           quantity: 1,
           quantity: 1,
         };
         };
         taocan = this.sort_ASCII(taocan);
         taocan = this.sort_ASCII(taocan);
         const sign = this.jiaqian(JSON.stringify(taocan));
         const sign = this.jiaqian(JSON.stringify(taocan));
         const res = await this.$axios.$post('/pay/v1/order/create', taocan, { headers: { Authorization: this.token, sign } });
         const res = await this.$axios.$post('/pay/v1/order/create', taocan, { headers: { Authorization: this.token, sign } });
-        if (this.$userAgent.isAndroid) {
+        if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
           window.native.startPay(this.payType === 'aliPay' ? 3 : 2, res.data.myOrderNum, 1);
           window.native.startPay(this.payType === 'aliPay' ? 3 : 2, res.data.myOrderNum, 1);
-        }
-        if (this.$userAgent.isIos) {
+        } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
           window.webkit.messageHandlers.startPay.postMessage({
           window.webkit.messageHandlers.startPay.postMessage({
             payType: this.payType === 'aliPay' ? 3 : 2,
             payType: this.payType === 'aliPay' ? 3 : 2,
             orderNum: res.data.myOrderNum,
             orderNum: res.data.myOrderNum,
             actualPrice: this.actualPrice
             actualPrice: this.actualPrice
           });
           });
+        } else if (this.$userAgent.isMiniProgram) {
+          if (this.payType === 'aliPay') {
+            Toast({
+              message: '微信小程序不支持支付宝支付',
+              position: 'top',
+              duration: 3000
+            });
+            return false
+          }
+          this.$wx.miniProgram.navigateTo({
+            url: '/packageA/order/status/index?record=' + JSON.stringify({
+              payActive: this.payType === 'wxPay' ? 1 : 0,
+              myOrderNum: res.data.myOrderNum
+            }),
+          });
+        } else {
+          // 使用postMessage 方法可以发送消息到应用, 消息内容需要在data 对象中,否则webview无法接收到
+          webUni.webView.postMessage({
+            data: {
+              payType: this.payType === 'aliPay' ? 3 : 2,
+              orderNum: res.data.myOrderNum,
+              buyType: 1,
+              price: this.actualPrice
+            }
+          })
         }
         }
       } catch (error) {
       } catch (error) {
         Toast({
         Toast({
           message: error.message,
           message: error.message,
-          position: 'top'
+          position: 'top',
+          duration: 3000
         });
         });
       } finally {
       } finally {
         Toast.clear();
         Toast.clear();
@@ -248,6 +286,7 @@ export default {
       const res = await this.$axios.$post('/activity/v1/member/luckDrawActivity');
       const res = await this.$axios.$post('/activity/v1/member/luckDrawActivity');
       this.activityId = res.data.activityId
       this.activityId = res.data.activityId
       this.status = res.data.status
       this.status = res.data.status
+      this.num = res.data.count
     },
     },
     // 开始抽奖
     // 开始抽奖
     async startRotation() {
     async startRotation() {
@@ -255,6 +294,7 @@ export default {
       if (!this.canBeRotated()) {
       if (!this.canBeRotated()) {
         return false;
         return false;
       }
       }
+      this.makePoint('activity_立即抽奖')
       // 开始转动
       // 开始转动
       // 先上锁
       // 先上锁
       this.isLocking = true;
       this.isLocking = true;
@@ -263,27 +303,37 @@ export default {
       if (res.status === 0) {
       if (res.status === 0) {
         const index = this.prizeData.findIndex(item => item.level === res.data.actualPrice)
         const index = this.prizeData.findIndex(item => item.level === res.data.actualPrice)
         this.actualPrice = res.data.actualPrice
         this.actualPrice = res.data.actualPrice
-        if (Number(localStorage.getItem('year-15-9')) !== 2 && this.actualPrice === 15.9) {
-          localStorage.setItem('year-15-9', 1)
+        if (this.actualPrice === 15.9) {
+          this.makePoint('activity_15.9年卡')
+          if (Number(localStorage.getItem('year-15-9')) !== 2)
+            localStorage.setItem('year-15-9', 1)
         }
         }
-        if (Number(localStorage.getItem('year-9-9')) !== 2 && this.actualPrice === 9.9) {
+        if (this.actualPrice === 9.9) {
+          if (Number(localStorage.getItem('year-9-9')) !== 2)
+            this.makePoint('activity_9.9年卡')
           localStorage.setItem('year-9-9', 1)
           localStorage.setItem('year-9-9', 1)
         }
         }
-        this.num = res.data.count
         this.mealId = res.data.mealId
         this.mealId = res.data.mealId
         this.selMealId = res.data.mealId
         this.selMealId = res.data.mealId
         this.paySupportType = res.data.paySupportType
         this.paySupportType = res.data.paySupportType
         this.payType = this.paySupportType[0]
         this.payType = this.paySupportType[0]
+        this.phoneType = res.data.phoneType
         this.title = res.data.title
         this.title = res.data.title
         this.prizeIndex = index;
         this.prizeIndex = index;
       } else {
       } else {
         return
         return
       }
       }
       // 成功后次数减少一次
       // 成功后次数减少一次
-      // this.num--;
+      if (this.num > 1) {
+        this.num--;
+      }
       // 告诉子组件,开始转动了
       // 告诉子组件,开始转动了
       this.$refs.roundTurntable.rotate(this.prizeIndex);
       this.$refs.roundTurntable.rotate(this.prizeIndex);
     },
     },
+    makePoint(positionButton) {
+      const now = new Date()
+      this.$axios.$post('/public/v5/buriedPointRecord/reportRecords', [{ client: this.client, eventCode: '27_抽奖流程', userName: this.$auth.user.userName, positionButton, operationTime: now.toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '') }])
+    },
     // 已经转动完转盘触发的函数
     // 已经转动完转盘触发的函数
     endRotation() {
     endRotation() {
       // 提示中奖
       // 提示中奖
@@ -300,6 +350,7 @@ export default {
         Toast({
         Toast({
           message: '当前活动已过期',
           message: '当前活动已过期',
           position: 'top',
           position: 'top',
+          duration: 3000
         });
         });
         return false;
         return false;
       }
       }
@@ -307,6 +358,7 @@ export default {
         Toast({
         Toast({
           message: '当前活动未开启',
           message: '当前活动未开启',
           position: 'top',
           position: 'top',
+          duration: 3000
         });
         });
         return false;
         return false;
       }
       }
@@ -314,12 +366,14 @@ export default {
         Toast({
         Toast({
           message: '当前活动已结束',
           message: '当前活动已结束',
           position: 'top',
           position: 'top',
+          duration: 3000
         });
         });
         return false;
         return false;
       }
       }
       return true;
       return true;
     },
     },
     closed() {
     closed() {
+      this.makePoint('activity_关闭抽奖', 'eventCode传27_抽奖流程')
       if (Number(localStorage.getItem('year-15-9')) !== 2) {
       if (Number(localStorage.getItem('year-15-9')) !== 2) {
         this.show = true
         this.show = true
         localStorage.setItem('year-15-9', 2)
         localStorage.setItem('year-15-9', 2)

File diff suppressed because it is too large
+ 1 - 0
plugins/uni.js