许成详 6 years ago
parent
commit
374628c8b7

+ 12
- 14
src/components/myCard/myCard.vue View File

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> 9999 </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>
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
       </div>
13
       </div>
14
     </div>
14
     </div>
15
     <div class="card-main flex-h">
15
     <div class="card-main flex-h">
16
       <img :src="line">
16
       <img :src="line">
17
       <div class="flex-h">
17
       <div class="flex-h">
18
         <span>总数量</span>
18
         <span>总数量</span>
19
-        <span>40</span>
19
+        <span>{{data.totalCount}}</span>
20
       </div>
20
       </div>
21
       <div>
21
       <div>
22
         <span>总剩余</span>
22
         <span>总剩余</span>
23
-        <span>40</span>
23
+        <span>{{data.totalCount - data.SentCount}}</span>
24
       </div>
24
       </div>
25
       <div>
25
       <div>
26
         <span>用户领取</span>
26
         <span>用户领取</span>
27
-        <span>40</span>
27
+        <span>{{data.SentCount}}</span>
28
       </div>
28
       </div>
29
       <div>
29
       <div>
30
         <span>用户使用</span>
30
         <span>用户使用</span>
31
-        <span>40</span>
31
+        <span>{{data.usedCount}}</span>
32
       </div>
32
       </div>
33
     </div>
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
     </div>
36
     </div>
37
   </div>
37
   </div>
54
     data: {
54
     data: {
55
       type: Object,
55
       type: Object,
56
       default: () => { }
56
       default: () => { }
57
-    },
58
-    canShare: {
59
-      type: Boolean,
60
-      default: true
61
     }
57
     }
62
   },
58
   },
63
   methods: {
59
   methods: {
64
     share () {
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 View File

135
 const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
135
 const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
136
 const { mapState: mapCustomerState, mapActions: mapCustomerActions } = createNamespacedHelpers('myCustomer')
136
 const { mapState: mapCustomerState, mapActions: mapCustomerActions } = createNamespacedHelpers('myCustomer')
137
 const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('myCard')
137
 const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('myCard')
138
+const { mapActions: mapUserCenterActions } = createNamespacedHelpers('userCenter')
138
 
139
 
139
 export default {
140
 export default {
140
   name: '',
141
   name: '',
141
   data () {
142
   data () {
142
     return {
143
     return {
144
+      postCardData: {
145
+        page: 1,
146
+        pageSize: 10
147
+      },
143
       pullUpLoad: true,
148
       pullUpLoad: true,
144
       pullUpLoadThreshold: 40,
149
       pullUpLoadThreshold: 40,
145
       startY: 0,
150
       startY: 0,
197
           hasMore: true,
202
           hasMore: true,
198
           page: 1,
203
           page: 1,
199
           pageSize: 1,
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
           hasPic: false,
208
           hasPic: false,
226
           hasMore: true,
209
           hasMore: true,
227
           page: 1,
210
           page: 1,
228
           pageSize: 1,
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
           hasPic: false,
215
           hasPic: false,
255
           hasMore: true,
216
           hasMore: true,
256
           page: 1,
217
           page: 1,
257
           pageSize: 1,
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
     scroll
256
     scroll
318
   },
257
   },
319
   created () {
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
     this.getCaseList().then((res) => {
283
     this.getCaseList().then((res) => {
321
       this.topCaseInfoData.CaseName = res.cases[0].CaseName
284
       this.topCaseInfoData.CaseName = res.cases[0].CaseName
322
       this.topCaseInfoData.CaseId = res.cases[0].CaseId
285
       this.topCaseInfoData.CaseId = res.cases[0].CaseId
332
     })
295
     })
333
   },
296
   },
334
   methods: {
297
   methods: {
298
+    ...mapUserCenterActions([
299
+      'getMyCardList',
300
+    ]),
335
     ...actions([
301
     ...actions([
336
       'getCaseList',
302
       'getCaseList',
337
     ]),
303
     ]),

+ 1
- 1
src/store/index.js View File

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

+ 10
- 0
src/store/userCenter/userCenter.js View File

101
     }
101
     }
102
   },
102
   },
103
   actions: {
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
     getCourseOrderDetail (context, payload) { // 获取课程类型详情
114
     getCourseOrderDetail (context, payload) { // 获取课程类型详情
105
       return new Promise((resolve) => {
115
       return new Promise((resolve) => {
106
         Ajax(api.user.getCourseOrderDetail.url, {
116
         Ajax(api.user.getCourseOrderDetail.url, {

+ 10
- 0
src/util/api.js View File

149
       url: `${baseUrl}${wechat}/user/detail/:id`
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
   login: { // 主管、销售端登陆
162
   login: { // 主管、销售端登陆
153
     login: {
163
     login: {
154
       method: 'post',
164
       method: 'post',