许成详 пре 6 година
родитељ
комит
374628c8b7

+ 12
- 14
src/components/myCard/myCard.vue Прегледај датотеку

@@ -3,35 +3,35 @@
3 3
     <div class="card-top flex-h">
4 4
       <div>
5 5
         <img :src="logo" class="logo">
6
-        <span>¥ <span> 9999 </span> 元</span>
6
+        <span>¥ <span> {{data.Price}} </span> 元</span>
7 7
         <img :src="line3" class="line3">
8 8
       </div>
9 9
       <div>
10
-        <h2>咖啡团课一次体验卡</h2>
11
-        <span>可在银城会所健身房体验私教课一次</span>
12
-        <span>2018年02月17日-2018年3月17日</span>
10
+        <h2>{{data.title}}</h2>
11
+        <span>{{data.desc}}</span>
12
+        <span>{{data.startDate}}-{{data.endDate}}</span>
13 13
       </div>
14 14
     </div>
15 15
     <div class="card-main flex-h">
16 16
       <img :src="line">
17 17
       <div class="flex-h">
18 18
         <span>总数量</span>
19
-        <span>40</span>
19
+        <span>{{data.totalCount}}</span>
20 20
       </div>
21 21
       <div>
22 22
         <span>总剩余</span>
23
-        <span>40</span>
23
+        <span>{{data.totalCount - data.SentCount}}</span>
24 24
       </div>
25 25
       <div>
26 26
         <span>用户领取</span>
27
-        <span>40</span>
27
+        <span>{{data.SentCount}}</span>
28 28
       </div>
29 29
       <div>
30 30
         <span>用户使用</span>
31
-        <span>40</span>
31
+        <span>{{data.usedCount}}</span>
32 32
       </div>
33 33
     </div>
34
-    <div v-if='canShare' class="card-bottom" @click.stop="share">
34
+    <div v-if='data.invalid' class="card-bottom" @click.stop="share">
35 35
       分享卡券
36 36
     </div>
37 37
   </div>
@@ -54,15 +54,13 @@ export default {
54 54
     data: {
55 55
       type: Object,
56 56
       default: () => { }
57
-    },
58
-    canShare: {
59
-      type: Boolean,
60
-      default: true
61 57
     }
62 58
   },
63 59
   methods: {
64 60
     share () {
65
-      this.$emit('share', this.data)
61
+      if(this.data.invalid){
62
+        this.$emit('share', this.data)
63
+      }
66 64
     }
67 65
   }
68 66
 }

+ 35
- 69
src/pages/user/mainPage/coffeeIndex/index.vue Прегледај датотеку

@@ -135,11 +135,16 @@ const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForC
135 135
 const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
136 136
 const { mapState: mapCustomerState, mapActions: mapCustomerActions } = createNamespacedHelpers('myCustomer')
137 137
 const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('myCard')
138
+const { mapActions: mapUserCenterActions } = createNamespacedHelpers('userCenter')
138 139
 
139 140
 export default {
140 141
   name: '',
141 142
   data () {
142 143
     return {
144
+      postCardData: {
145
+        page: 1,
146
+        pageSize: 10
147
+      },
143 148
       pullUpLoad: true,
144 149
       pullUpLoadThreshold: 40,
145 150
       startY: 0,
@@ -197,87 +202,21 @@ export default {
197 202
           hasMore: true,
198 203
           page: 1,
199 204
           pageSize: 1,
200
-          list: [
201
-            {
202
-              title: '小小外交官体验卡',
203
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
204
-              time: '2018年02月17日',
205
-              useType: '未使用',
206
-              tag: '共享'
207
-            },
208
-            {
209
-              title: '小小外交官体验卡',
210
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
211
-              time: '2018年02月17日',
212
-              useType: '已使用',
213
-              tag: '商品'
214
-            },
215
-            {
216
-              title: '小小外交官体验卡',
217
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
218
-              time: '2018年02月17日',
219
-              useType: '已失效',
220
-              tag: '商品'
221
-            }
222
-          ]
205
+          list: []
223 206
         },
224 207
         {
225 208
           hasPic: false,
226 209
           hasMore: true,
227 210
           page: 1,
228 211
           pageSize: 1,
229
-          list: [
230
-            {
231
-              title: '小小外交官体验卡',
232
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
233
-              time: '2018年02月17日',
234
-              useType: '未使用',
235
-              tag: '共享'
236
-            },
237
-            {
238
-              title: '小小外交官体验卡',
239
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
240
-              time: '2018年02月17日',
241
-              useType: '已使用',
242
-              tag: '商品'
243
-            },
244
-            {
245
-              title: '小小外交官体验卡',
246
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
247
-              time: '2018年02月17日',
248
-              useType: '已失效',
249
-              tag: '商品'
250
-            }
251
-          ]
212
+          list: []
252 213
         },
253 214
         {
254 215
           hasPic: false,
255 216
           hasMore: true,
256 217
           page: 1,
257 218
           pageSize: 1,
258
-          list: [
259
-            {
260
-              title: '小小外交官体验卡',
261
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
262
-              time: '2018年02月17日',
263
-              useType: '未使用',
264
-              tag: '共享'
265
-            },
266
-            {
267
-              title: '小小外交官体验卡',
268
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
269
-              time: '2018年02月17日',
270
-              useType: '已使用',
271
-              tag: '商品'
272
-            },
273
-            {
274
-              title: '小小外交官体验卡',
275
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
276
-              time: '2018年02月17日',
277
-              useType: '已失效',
278
-              tag: '商品'
279
-            }
280
-          ]
219
+          list: []
281 220
         }
282 221
       ]
283 222
     }
@@ -317,6 +256,30 @@ export default {
317 256
     scroll
318 257
   },
319 258
   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
+    })
320 283
     this.getCaseList().then((res) => {
321 284
       this.topCaseInfoData.CaseName = res.cases[0].CaseName
322 285
       this.topCaseInfoData.CaseId = res.cases[0].CaseId
@@ -332,6 +295,9 @@ export default {
332 295
     })
333 296
   },
334 297
   methods: {
298
+    ...mapUserCenterActions([
299
+      'getMyCardList',
300
+    ]),
335 301
     ...actions([
336 302
       'getCaseList',
337 303
     ]),

+ 1
- 1
src/store/index.js Прегледај датотеку

@@ -22,7 +22,7 @@ export const modules = {
22 22
   myCustomer: () => require('./myCustomer/index').default,
23 23
   myCard: () => require('./myCard/index').default,
24 24
   card: () => require('./card/index').default,
25
-  forbid: () => require('./forbid/index').default
25
+  forbid: () => require('./forbid/index').default,
26 26
 }
27 27
 
28 28
 Object.keys(modules).forEach((modKey) => {

+ 10
- 0
src/store/userCenter/userCenter.js Прегледај датотеку

@@ -101,6 +101,16 @@ export default {
101 101
     }
102 102
   },
103 103
   actions: {
104
+    getMyCardList (context, payload) { // 获取我的卡列表
105
+      return new Promise((resolve) => {
106
+        Ajax(api.sales.getCardList.url, {
107
+          method: api.sales.getCardList.method,
108
+          queryData: { ...payload }
109
+        }).then(res => {
110
+          resolve(res)
111
+        })
112
+      })
113
+    },
104 114
     getCourseOrderDetail (context, payload) { // 获取课程类型详情
105 115
       return new Promise((resolve) => {
106 116
         Ajax(api.user.getCourseOrderDetail.url, {

+ 10
- 0
src/util/api.js Прегледај датотеку

@@ -149,6 +149,16 @@ const $api = {
149 149
       url: `${baseUrl}${wechat}/user/detail/:id`
150 150
     }
151 151
   },
152
+  sales: {
153
+    getCardList: { // 获取我的卡列表
154
+      method: 'get',
155
+      url: `${baseUrl}${wechat}/card`
156
+    },
157
+    getCouponList: { // 获取我的券列表
158
+      method: 'get',
159
+      url: `${baseUrl}${wechat}/coupon`
160
+    },
161
+  },
152 162
   login: { // 主管、销售端登陆
153 163
     login: {
154 164
       method: 'post',