许成详 6 年之前
父節點
當前提交
5103b163f6

+ 4
- 4
src/components/myCard/myCard.vue 查看文件

3
     <div class="card-top flex-h">
3
     <div class="card-top flex-h">
4
       <div>
4
       <div>
5
         <img :src="logo" class="logo">
5
         <img :src="logo" class="logo">
6
-        <span>¥ <span> {{data.Price}} </span> 元</span>
6
+        <span>¥ <span> {{data.price}} </span> 元</span>
7
         <img :src="line3" class="line3">
7
         <img :src="line3" class="line3">
8
       </div>
8
       </div>
9
       <div>
9
       <div>
31
         <span>{{data.usedCount}}</span>
31
         <span>{{data.usedCount}}</span>
32
       </div>
32
       </div>
33
     </div>
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
     </div>
36
     </div>
37
   </div>
37
   </div>
58
   },
58
   },
59
   methods: {
59
   methods: {
60
     share () {
60
     share () {
61
-      if(this.data.invalid){
61
+      if(!this.data.invalid){
62
         this.$emit('share', this.data)
62
         this.$emit('share', this.data)
63
       }
63
       }
64
     }
64
     }
103
         align-items: baseline;
103
         align-items: baseline;
104
         span {
104
         span {
105
           color: #fc6243;
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 查看文件

51
                   <div class="flex-item">
51
                   <div class="flex-item">
52
                     <div>
52
                     <div>
53
                       <span>卡券货值总额:</span>
53
                       <span>卡券货值总额:</span>
54
-                      <span>¥1000</span>
55
-                      <span>万</span>
54
+                      <span>¥{{cardTotalCount}}</span>
56
                     </div>
55
                     </div>
57
                   </div>
56
                   </div>
58
                   <a @click="toSalesHistory">销售记录</a>
57
                   <a @click="toSalesHistory">销售记录</a>
141
   name: '',
140
   name: '',
142
   data () {
141
   data () {
143
     return {
142
     return {
143
+      cardTotalCount: 0,
144
+      postCouponData: {
145
+        page: 1,
146
+        pageSize: 10
147
+      },
144
       postCardData: {
148
       postCardData: {
145
         page: 1,
149
         page: 1,
146
         pageSize: 10
150
         pageSize: 10
256
     scroll
260
     scroll
257
   },
261
   },
258
   created () {
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
     this.getCaseList().then((res) => {
297
     this.getCaseList().then((res) => {
284
       this.topCaseInfoData.CaseName = res.cases[0].CaseName
298
       this.topCaseInfoData.CaseName = res.cases[0].CaseName
285
       this.topCaseInfoData.CaseId = res.cases[0].CaseId
299
       this.topCaseInfoData.CaseId = res.cases[0].CaseId
297
   methods: {
311
   methods: {
298
     ...mapUserCenterActions([
312
     ...mapUserCenterActions([
299
       'getMyCardList',
313
       'getMyCardList',
314
+      'getMyCouponList',
315
+      'getForbidInfo',
300
     ]),
316
     ]),
301
     ...actions([
317
     ...actions([
302
       'getCaseList',
318
       'getCaseList',
309
     ]),
325
     ]),
310
     ...mapCustomerActions(['getCustomerList']),
326
     ...mapCustomerActions(['getCustomerList']),
311
     ...mapCardActions(['getCardList']),
327
     ...mapCardActions(['getCardList']),
328
+    returnInvalid (item) {
329
+      return false
330
+    },
312
     toSalesHistory () {
331
     toSalesHistory () {
313
-      console.log(this.getUrl('salesRecord'))
332
+      //console.log(this.getUrl('salesRecord'))
314
       window.location.href = this.getUrl('salesRecord')
333
       window.location.href = this.getUrl('salesRecord')
315
     },
334
     },
316
     getUrl (val) {
335
     getUrl (val) {

+ 19
- 0
src/store/userCenter/userCenter.js 查看文件

101
     }
101
     }
102
   },
102
   },
103
   actions: {
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
     getMyCardList (context, payload) { // 获取我的卡列表
123
     getMyCardList (context, payload) { // 获取我的卡列表
105
       return new Promise((resolve) => {
124
       return new Promise((resolve) => {
106
         Ajax(api.sales.getCardList.url, {
125
         Ajax(api.sales.getCardList.url, {

+ 4
- 4
src/util/ajax.js 查看文件

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

+ 5
- 1
src/util/api.js 查看文件

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