yuantianjiao 6 years ago
parent
commit
d5aac12e89

+ 1
- 1
src/pages/user/bindMobile/bindMobile.vue View File

@@ -173,7 +173,7 @@ export default {
173 173
         if (this.$route.query.isLottery) {
174 174
           setTimeout(() => {
175 175
             const from = this.$route.query.luckshare ? `#/from/${this.$route.query.luckshare}` : ''
176
-            window.location.href = `/game/luckdraw/${from}`
176
+            window.location.href = `${window.location.origin}/c-v2/game/luckdraw/${from}`
177 177
           }, 2000)
178 178
         } else {
179 179
           setTimeout(function () {

+ 13
- 11
src/pages/user/mainPage/coffeeIndex/index.vue View File

@@ -132,6 +132,7 @@ const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForC
132 132
 const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
133 133
 const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('myCard')
134 134
 const { mapActions: mapUserCenterActions } = createNamespacedHelpers('userCenter')
135
+const wx = require('weixin-js-sdk')
135 136
 
136 137
 export default {
137 138
   name: '',
@@ -427,6 +428,7 @@ export default {
427 428
       window.location.href = this.getUrl('customerSearch')
428 429
     },
429 430
     locationMapping () {
431
+      let that = this
430 432
       wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
431 433
         title: '城的空间',
432 434
         desc: '城的空间',
@@ -438,23 +440,23 @@ export default {
438 440
           success: function (res) {
439 441
             let latitude1 = res.latitude // 纬度,浮点数,范围为90 ~ -90
440 442
             let longitude1 = res.longitude // 经度,浮点数,范围为180 ~ -180。
441
-            for (let i = 0; i < this.CaseList.length; i++) {
442
-              let result = this.CaseList[i].Coordinate.split(",")
443
+            for (let i = 0; i < that.CaseList.length; i++) {
444
+              let result = that.CaseList[i].Coordinate.split(",")
443 445
               let latitude2 = parseFloat(result[0])
444 446
               let longitude2 = parseFloat(result[1])
445
-              if (this.toolClass.getGreatCircleDistance(latitude1, longitude1, latitude2, longitude2) < 500) {
446
-                this.topCaseInfoData.caseName = this.CaseList[i].CaseName
447
-                this.topCaseInfoData.caseId = this.CaseList[i].CaseId
448
-                this.getCaseTableList({
449
-                  caseid: this.topCaseInfoData.caseId
447
+              if (that.toolClass.getGreatCircleDistance(latitude1, longitude1, latitude2, longitude2) < 500) {
448
+                that.topCaseInfoData.caseName = that.CaseList[i].CaseName
449
+                that.topCaseInfoData.caseId = that.CaseList[i].CaseId
450
+                that.getCaseTableList({
451
+                  caseid: that.topCaseInfoData.caseId
450 452
                 })
451
-                this.getCaseTotal({
452
-                  caseid: this.topCaseInfoData.caseId
453
+                that.getCaseTotal({
454
+                  caseid: that.topCaseInfoData.caseId
453 455
                 })
454 456
               }
455 457
             }
456
-            if (!this.topCaseInfoData.caseId || !this.topCaseInfoData.caseName){
457
-              this.topCaseInfoData.caseName = '当前位置无案场'
458
+            if (!that.topCaseInfoData.caseId || !that.topCaseInfoData.caseName){
459
+              that.topCaseInfoData.caseName = '当前位置无案场'
458 460
             }
459 461
           }
460 462
         })

+ 9
- 7
src/pages/user/mainPage/userCenter/index.vue View File

@@ -23,21 +23,21 @@
23 23
             <img src="../../../../common/icon/userCenter-icon-1.png" width="100%" height="100%" alt="">
24 24
           </div>
25 25
           <span>优惠券</span>
26
-          <span>2张未使用</span>
26
+          <span>{{Nums.couponnum || 0}}张未使用</span>
27 27
         </div>
28 28
         <div class="flex-item privilege-item" @click="toCard">
29 29
           <div class="img-box">
30 30
             <img src="../../../../common/icon/userCenter-icon-2.png" width="100%" height="100%" alt="">
31 31
           </div>
32 32
           <span>卡券</span>
33
-          <span>2张未使用</span>
33
+          <span>{{Nums.cardsnum || 0}}张未使用</span>
34 34
         </div>
35 35
         <div class="flex-item privilege-item" @click="toVip">
36 36
           <div class="img-box">
37 37
             <img src="../../../../common/icon/userCenter-icon-3.png" width="100%" height="100%" alt="">
38 38
           </div>
39 39
           <span>VIP卡</span>
40
-          <span>¥200 <i class="iconfont icon-jiantou-right" style="font-size: 0.1rem;"></i></span>
40
+          <span>¥{{(Nums.account || {}).Amount || 0}} <i class="iconfont icon-jiantou-right" style="font-size: 0.1rem;"></i></span>
41 41
         </div>
42 42
       </div>
43 43
 
@@ -77,7 +77,8 @@ export default {
77 77
   computed: {
78 78
     ...mapState({
79 79
       userInfo: x => x.userCenter.userInfo,
80
-      org: x => x.app.orgId
80
+      org: x => x.app.orgId,
81
+      Nums: x => x.userCenter.Nums
81 82
     })
82 83
   },
83 84
   components: {
@@ -92,9 +93,10 @@ export default {
92 93
         this.isLoading = false
93 94
       }
94 95
     })
96
+    this.getNum()
95 97
   },
96 98
   methods: {
97
-    ...actions(['getUserInfo']),
99
+    ...actions(['getUserInfo', 'getNum']),
98 100
     toLessonOrder () {
99 101
       this.$router.push({ name: 'lessonOrder' })
100 102
     },
@@ -114,7 +116,7 @@ export default {
114 116
       this.$router.push({ name: 'orderList' })
115 117
     },
116 118
     toBodyCheck () {
117
-      window.location.href = `/bodyCheck.html#/`
119
+      window.location.href = `${window.location.origin}/c-v2/bodyCheck.html#/`
118 120
     },
119 121
     toLuckdraw () {
120 122
       // ^参数约定为97
@@ -122,7 +124,7 @@ export default {
122 124
       let num = Math.floor(Math.random() * 10 + 1) * 100 + Math.floor(Math.random() * 10 + 1) * 10 + Math.floor(Math.random() * 10 + 1)
123 125
       num = num >= 1000 ? 999 : num
124 126
       userid = parseInt(`${userid}${num}`) ^ 97
125
-      window.location.href = `/game/luckdraw/#/lotteryList?from=${userid}`
127
+      window.location.href = `${window.location.origin}/c-v2/game/luckdraw/#/lotteryList?from=${userid}`
126 128
     }
127 129
   }
128 130
 }

+ 1
- 0
src/pages/user/majorProjectsDetail/index.vue View File

@@ -74,6 +74,7 @@ import { swiper, swiperSlide } from 'vue-awesome-swiper'
74 74
 import 'swiper/dist/css/swiper.css'
75 75
 import { mapState, createNamespacedHelpers } from 'vuex'
76 76
 const { mapActions: mapProjectActions, mapState: mapProjectState } = createNamespacedHelpers('majorProjects')
77
+const wx = require('weixin-js-sdk')
77 78
 
78 79
 export default {
79 80
   name: '',

+ 15
- 1
src/store/userCenter/userCenter.js View File

@@ -73,6 +73,7 @@ http.submitData = (data) => { // 绑定手机号
73 73
 export default {
74 74
   namespaced: true,
75 75
   state: {
76
+    Nums: {},
76 77
     userInfo: {},
77 78
     caseInfo: {},
78 79
     courseOrderList: {},
@@ -80,6 +81,9 @@ export default {
80 81
     courseOrderDetail: {},
81 82
   },
82 83
   mutations: {
84
+    setNums (state, data) {
85
+      state.Nums = data || {}
86
+    },
83 87
     setUserInfo (state, data) {
84 88
       state.userInfo = data
85 89
     },
@@ -96,11 +100,21 @@ export default {
96 100
       if (page <= 1) {
97 101
         state.courseOrderList = res
98 102
       } else {
99
-        state.courseOrderList = {...res, list: [...state.courseOrderList.list, ...res.list]}
103
+        state.courseOrderList = { ...res, list: [...state.courseOrderList.list, ...res.list] }
100 104
       }
101 105
     }
102 106
   },
103 107
   actions: {
108
+    getNum (context) { // 获取我的用户领取卡信息
109
+      return new Promise((resolve) => {
110
+        Ajax({
111
+          ...api.user.getNum
112
+        }).then(res => {
113
+          context.commit('setNums', res)
114
+          resolve(res)
115
+        })
116
+      })
117
+    },
104 118
     getCustomerCardList (context, { id, payload }) { // 获取我的用户领取卡信息
105 119
       return new Promise((resolve) => {
106 120
         Ajax(api.sales.getCustomerCardList.url, {

+ 3
- 1
src/util/ajax.js View File

@@ -10,7 +10,9 @@ const token = function (headers) {
10 10
     localStorage.setItem('JWT', headers.authorization)
11 11
     JWT = headers.authorization
12 12
   }
13
-  return JWT ? JWT : localStorage.getItem('JWT')
13
+  const token = JWT ? JWT : localStorage.getItem('JWT')
14
+
15
+  return !token ? '' : token
14 16
 }
15 17
 
16 18
 const Axios = axios.create({

+ 7
- 3
src/util/api.js View File

@@ -1,5 +1,5 @@
1
-// const baseUrl = '/api-v2'
2
-const baseUrl = '/api'
1
+const baseUrl = '/api-v2'
2
+// const baseUrl = '/api'
3 3
 const wechat = '/wechat/:org'
4 4
 const guest = '/guest/:org'
5 5
 const common = '/common/:org'
@@ -126,6 +126,10 @@ const $api = {
126 126
       method: 'get',
127 127
       url: `${baseUrl}${wechat}/gymcard/:customerGymId`
128 128
     },
129
+    getNum: { // 获取卡券数
130
+      method: 'get',
131
+      url: `${baseUrl}${wechat}/customer/info`
132
+    }
129 133
   },
130 134
   director: {
131 135
     getSales: { // 获取销售列表
@@ -204,7 +208,7 @@ const $api = {
204 208
   share: {
205 209
     share: {
206 210
       method: 'get',
207
-      url: `${baseUrl}${guest}/wechat/jssdk/signature/:url`
211
+      url: `${baseUrl}${guest}/wechat/jssdk/signature`
208 212
     },
209 213
     card: {
210 214
       method: 'get',

+ 4
- 2
src/util/share.js View File

@@ -14,14 +14,16 @@ function wxsdk (params, config) {
14 14
   return new Promise(function (resolve, reject) {
15 15
     Ajax(api.share.share.url, {
16 16
       method: api.share.share.method,
17
-      urlData: {
17
+      queryData: {
18 18
         ...params
19 19
       }
20 20
     }).then(result => {
21
+      console.log(result)
22
+      let time = parseInt(result.timestamp)
21 23
       wx.config({
22 24
         debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
23 25
         appId: result.appId, // 必填,公众号的唯一标识
24
-        timestamp: result.timestamp, // 必填,生成签名的时间戳
26
+        timestamp: time, // 必填,生成签名的时间戳
25 27
         nonceStr: result.noncestr, // 必填,生成签名的随机串
26 28
         signature: result.signature, // 必填,签名,见附录1
27 29
         jsApiList: [