许成详 hace 6 años
padre
commit
5103b163f6

+ 4
- 4
src/components/myCard/myCard.vue Ver fichero

@@ -3,7 +3,7 @@
3 3
     <div class="card-top flex-h">
4 4
       <div>
5 5
         <img :src="logo" class="logo">
6
-        <span>¥ <span> {{data.Price}} </span> 元</span>
6
+        <span>¥ <span> {{data.price}} </span> 元</span>
7 7
         <img :src="line3" class="line3">
8 8
       </div>
9 9
       <div>
@@ -31,7 +31,7 @@
31 31
         <span>{{data.usedCount}}</span>
32 32
       </div>
33 33
     </div>
34
-    <div v-if='data.invalid' class="card-bottom" @click.stop="share">
34
+    <div class="card-bottom" @click.stop="share">
35 35
       分享卡券
36 36
     </div>
37 37
   </div>
@@ -58,7 +58,7 @@ export default {
58 58
   },
59 59
   methods: {
60 60
     share () {
61
-      if(this.data.invalid){
61
+      if(!this.data.invalid){
62 62
         this.$emit('share', this.data)
63 63
       }
64 64
     }
@@ -103,7 +103,7 @@ export default {
103 103
         align-items: baseline;
104 104
         span {
105 105
           color: #fc6243;
106
-          font-size: 0.26rem;
106
+          font-size: 0.22rem;
107 107
         }
108 108
       }
109 109
     }

+ 46
- 27
src/pages/user/mainPage/coffeeIndex/index.vue Ver fichero

@@ -51,8 +51,7 @@
51 51
                   <div class="flex-item">
52 52
                     <div>
53 53
                       <span>卡券货值总额:</span>
54
-                      <span>¥1000</span>
55
-                      <span>万</span>
54
+                      <span>¥{{cardTotalCount}}</span>
56 55
                     </div>
57 56
                   </div>
58 57
                   <a @click="toSalesHistory">销售记录</a>
@@ -141,6 +140,11 @@ export default {
141 140
   name: '',
142 141
   data () {
143 142
     return {
143
+      cardTotalCount: 0,
144
+      postCouponData: {
145
+        page: 1,
146
+        pageSize: 10
147
+      },
144 148
       postCardData: {
145 149
         page: 1,
146 150
         pageSize: 10
@@ -256,30 +260,40 @@ export default {
256 260
     scroll
257 261
   },
258 262
   created () {
259
-    this.getMyCardList({
260
-      ...this.postCardData
261
-    }).then((res) => {
262
-      console.log(JSON.stringify(res))
263
-      for (var n = 0; n < res.list.length; n++) {
264
-        this.data[1].list.push({
265
-          invalid: '',
266
-          price: res.list[n].Price,
267
-          title: res.list[n].CardName,
268
-          desc: 'xxx',
269
-          startDate: this.toolClass.dateFormat(res.list[n].StartDate),
270
-          endDate: this.toolClass.dateFormat(res.list[n].EndDate),
271
-          totalCount: res.list[n].TotalCount,
272
-          SentCount: res.list[n].SentCount,
273
-          usedCount: res.list[n].UsedCount,
274
-          // title: res.list[n].CardName,
275
-          // desc: '描述',
276
-          // time: this.toolClass.dateFormat(res.list[n].EndDate),
277
-          // useType: '未使用',
278
-          // tag: '共享'
279
-        })
280
-      }
281
-      console.log(JSON.stringify(this.data[1].list))
282
-    })
263
+    if (this.userInfo.customer.MapUser !== '') {
264
+      this.getForbidInfo().then((res) => {
265
+        console.log(JSON.stringify(res))
266
+      })
267
+      this.getMyCouponList({
268
+        ...this.postCouponData
269
+      }).then((res) => {
270
+        console.log(JSON.stringify(res))
271
+      })
272
+      this.getMyCardList({
273
+        ...this.postCardData
274
+      }).then((res) => {
275
+        console.log(JSON.stringify(res))
276
+        res.list = res.list || []
277
+        for (var n = 0; n < res.list.length; n++) {
278
+          this.data[1].list.push({
279
+            invalid: this.returnInvalid(res.list[n]),
280
+            price: res.list[n].Price,
281
+            title: res.list[n].CardName,
282
+            desc: res.list[n].Share.CardUseRule,
283
+            startDate: this.toolClass.dateFormat(res.list[n].StartDate),
284
+            endDate: this.toolClass.dateFormat(res.list[n].EndDate),
285
+            totalCount: res.list[n].TotalCount,
286
+            SentCount: res.list[n].SentCount,
287
+            usedCount: res.list[n].UsedCount,
288
+          })
289
+        }
290
+        var count = 0
291
+        for (var n = 0; n < this.data[1].list.length; n++) {
292
+          count += this.data[1].list[n].price * this.data[1].list[n].totalCount - 0
293
+        }
294
+        this.cardTotalCount = count.toFixed(2)
295
+      })
296
+    }
283 297
     this.getCaseList().then((res) => {
284 298
       this.topCaseInfoData.CaseName = res.cases[0].CaseName
285 299
       this.topCaseInfoData.CaseId = res.cases[0].CaseId
@@ -297,6 +311,8 @@ export default {
297 311
   methods: {
298 312
     ...mapUserCenterActions([
299 313
       'getMyCardList',
314
+      'getMyCouponList',
315
+      'getForbidInfo',
300 316
     ]),
301 317
     ...actions([
302 318
       'getCaseList',
@@ -309,8 +325,11 @@ export default {
309 325
     ]),
310 326
     ...mapCustomerActions(['getCustomerList']),
311 327
     ...mapCardActions(['getCardList']),
328
+    returnInvalid (item) {
329
+      return false
330
+    },
312 331
     toSalesHistory () {
313
-      console.log(this.getUrl('salesRecord'))
332
+      //console.log(this.getUrl('salesRecord'))
314 333
       window.location.href = this.getUrl('salesRecord')
315 334
     },
316 335
     getUrl (val) {

+ 19
- 0
src/store/userCenter/userCenter.js Ver fichero

@@ -101,6 +101,25 @@ export default {
101 101
     }
102 102
   },
103 103
   actions: {
104
+    getForbidInfo (context) { // 获取用户禁用信息
105
+      return new Promise((resolve) => {
106
+        Ajax(api.sales.getForbidInfo.url, {
107
+          method: api.sales.getForbidInfo.method,
108
+        }).then(res => {
109
+          resolve(res)
110
+        })
111
+      })
112
+    },
113
+    getMyCouponList (context, payload) { // 获取我的券列表
114
+      return new Promise((resolve) => {
115
+        Ajax(api.sales.getCouponList.url, {
116
+          method: api.sales.getCouponList.method,
117
+          queryData: { ...payload }
118
+        }).then(res => {
119
+          resolve(res)
120
+        })
121
+      })
122
+    },
104 123
     getMyCardList (context, payload) { // 获取我的卡列表
105 124
       return new Promise((resolve) => {
106 125
         Ajax(api.sales.getCardList.url, {

+ 4
- 4
src/util/ajax.js Ver fichero

@@ -10,7 +10,7 @@ const token = function (headers) {
10 10
     localStorage.setItem('JWT', headers.authorization)
11 11
     JWT = headers.authorization
12 12
   }
13
-  console.log(JWT)
13
+  // console.log(JWT)
14 14
   return JWT ? JWT : localStorage.getItem('JWT')
15 15
 }
16 16
 
@@ -68,16 +68,16 @@ const ajax = (...args) => {
68 68
       if (code === 200) {
69 69
         resolve(result)
70 70
       } else if (code === 401) {
71
-        console.log(result)
71
+        // console.log(result)
72 72
         // reject(code)
73 73
         toolClass.getCode(result.appid)
74 74
       } else if (code === 406) {
75
-        console.log(router.history.current.name)
75
+        // console.log(router.history.current.name)
76 76
         if (router.history.current.name !== 'bindMobile') {
77 77
           router.push({ name: 'bindMobile' })
78 78
         }
79 79
       } else {
80
-        console.log(message)
80
+        // console.log(message)
81 81
         Toast.fail({
82 82
           duration: 2000, // 持续展示 toast
83 83
           forbidClick: true, // 禁用背景点击

+ 5
- 1
src/util/api.js Ver fichero

@@ -147,7 +147,7 @@ const $api = {
147 147
     getSalesCardList: {
148 148
       method: 'get',
149 149
       url: `${baseUrl}${wechat}/user/detail/:id`
150
-    }
150
+    },
151 151
   },
152 152
   sales: {
153 153
     getCardList: { // 获取我的卡列表
@@ -158,6 +158,10 @@ const $api = {
158 158
       method: 'get',
159 159
       url: `${baseUrl}${wechat}/coupon`
160 160
     },
161
+    getForbidInfo: { // 获取用户禁用信息
162
+      method: 'get',
163
+      url: `${baseUrl}${wechat}/user/forbid`
164
+    },
161 165
   },
162 166
   login: { // 主管、销售端登陆
163 167
     login: {