Преглед на файлове

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/wechat into dev

yuantianjiao преди 6 години
родител
ревизия
b68369c08a

+ 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
 }

+ 23
- 30
src/pages/user/card/index.vue Целия файл

@@ -6,12 +6,12 @@
6 6
     <scroll ref='scroll' :isloading='isloading' class='wrapper' :data='data[active].list' :pullUpLoad='pullUpLoadObj' :startY='parseInt(startY)' @pullingUp='getList'>
7 7
       <div class="box">
8 8
         <div v-if="active == 0">
9
-          <discounts v-for="(item,index) in data[0].list" :key='index' @toUse='toUse' :data='item' @toDetail="toCouponsDetail(item)"></discounts>
9
+          <discounts v-for="(item,index) in data[0].list" :key='index' @toUse='toUse' :data='item' @toDetail="toCardDetail(item)"></discounts>
10 10
           <noMore v-if="data[active].hasPic"></noMore>
11 11
         </div>
12 12
         <div v-if="active == 1">
13 13
           <div class="fitness-card" v-for="(item,index) in data[1].list" :key='index'>
14
-            <div :class="{'opacity' : item.CardStatus == 'expire' || item.CardStatus == 'used', 'gray': item.CardStatus == 'used'}" @click="toCardDetail(item)">
14
+            <div :class="{'opacity' : item.CardStatus == 'expire' || item.CardStatus == 'used', 'gray': item.CardStatus == 'used'}" @click="toGymCardDetail(item)">
15 15
               <div class="card-top">
16 16
                 <div class="top-left">
17 17
                   <img :src="logo" alt="">
@@ -81,29 +81,7 @@ export default {
81 81
           hasMore: true,
82 82
           page: 1,
83 83
           pageSize: 1,
84
-          list: [
85
-            {
86
-              title: '小小外交官体验卡',
87
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
88
-              time: '2018年02月17日',
89
-              useType: '未使用',
90
-              tag: '共享'
91
-            },
92
-            {
93
-              title: '小小外交官体验卡',
94
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
95
-              time: '2018年02月17日',
96
-              useType: '已使用',
97
-              tag: '商品'
98
-            },
99
-            {
100
-              title: '小小外交官体验卡',
101
-              desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
102
-              time: '2018年02月17日',
103
-              useType: '已失效',
104
-              tag: '商品'
105
-            }
106
-          ]
84
+          list: []
107 85
         },
108 86
         {
109 87
           hasPic: false,
@@ -139,9 +117,24 @@ export default {
139 117
   },
140 118
   created () {
141 119
     this.change('', 0)
120
+    this.getCardList().then((res) => {
121
+      for (var n = 0; n < res.length; n++) {
122
+        this.data[0].list.push({
123
+          title: res[n].CardName,
124
+          desc: res[n].Share.CardUseRule,
125
+          time: this.toolClass.dateFormat(res[n].EndDate),
126
+          useType: res[n].Status === 1 ? '未使用' : '已使用',
127
+          tag: '共享',
128
+          cardid: res[n].CardId
129
+        })
130
+      }
131
+    })
142 132
   },
143 133
   methods: {
144
-    ...mapCardActions(['getgymCardList']),
134
+    ...mapCardActions([
135
+      'getgymCardList',
136
+      'getCardList',
137
+    ]),
145 138
     change (item, index) {
146 139
       this.active = index
147 140
       this.getList('change')
@@ -172,11 +165,11 @@ export default {
172 165
         }
173 166
       }
174 167
     },
175
-    toCardDetail (item) {
176
-      this.$router.push({ name: 'cardDetail', query: { CustomerGymId: item.CustomerGymId } })
168
+    toGymCardDetail (item) {
169
+      this.$router.push({ name: 'gymCardDetail', query: { CustomerGymId: item.CustomerGymId } })
177 170
     },
178
-    toCouponsDetail () {
179
-      this.$router.push({ name: 'couponsDetail' })
171
+    toCardDetail (item) {
172
+      this.$router.push({ name: 'cardDetail', query: { id: item.cardid } })
180 173
     }
181 174
   }
182 175
 }

+ 11
- 24
src/pages/user/cardDetail/index.vue Целия файл

@@ -1,62 +1,49 @@
1 1
 <template>
2 2
   <div class="mainPage">
3 3
     <div class="title">体验卡详情</div>
4
-    <div class="content">
4
+    <div class="content" v-if="info !== null">
5 5
       <div class="message">
6 6
         <div>
7
-          <span>会所健身体验卡</span>
7
+          <span>{{info.CardName}}</span>
8 8
           <span class="sub">(可在银城会所健身房和游泳池使用)</span>
9 9
         </div>
10 10
         <div>
11 11
           <span>有效时间</span>
12
-          <span>{{toolClass.dateFormat(gymCardDetail.EndDate)}}</span>
12
+          <span>{{toolClass.dateFormat(info.EndDate)}}</span>
13 13
         </div>
14 14
       </div>
15 15
       <div class="rule">
16 16
         <div>使用规则</div>
17
-        <div>{{gymCardDetail.CardUseRule}}</div>
17
+        <div>{{info.Share.CardUseInstruction}}</div>
18 18
       </div>
19 19
       <div class="line">
20 20
         <img :src="Artboard" alt="" width="100%">
21 21
       </div>
22
-      <div class="qr-code" style="margin-top:.1rem;">
23
-        <qrCode :msg='msg' v-if="msg"></qrCode>
24
-      </div>
25 22
     </div>
26 23
   </div>
27 24
 </template>
28 25
 
29 26
 <script>
30
-import qrCode from '../../../components/qrCodeCard/qrCodeCard'
31 27
 import Artboard from '../../../common/icon/Artboard.png'
32 28
 import { createNamespacedHelpers } from 'vuex'
33
-const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('card')
29
+const { mapActions: mapCardActions } = createNamespacedHelpers('card')
34 30
 export default {
35 31
   data () {
36 32
     return {
37 33
       msg: '',
38 34
       Artboard,
39
-      time: '2018年3月17日'
35
+      time: '2018年3月17日',
36
+      info: null,
40 37
     }
41 38
   },
42
-  methods: {
43
-
44
-  },
45
-  computed: {
46
-    ...mapCardState({
47
-      gymCardDetail: x => x.gymCardDetail
48
-    })
49
-  },
50
-  components: {
51
-    qrCode
52
-  },
53 39
   created () {
54
-    this.getgymCardDetail({ customerGymId: this.$route.query.CustomerGymId }).then(() => {
55
-      this.msg = this.gymCardDetail.CustomerGymId
40
+    this.getCardInfo({ id: this.$route.query.id }).then((res) => {
41
+      console.log(JSON.stringify(res))
42
+      this.info = res
56 43
     })
57 44
   },
58 45
   methods: {
59
-    ...mapCardActions(['getgymCardDetail'])
46
+    ...mapCardActions(['getCardInfo'])
60 47
   }
61 48
 }
62 49
 </script>

+ 28
- 25
src/pages/user/coupons/index.vue Целия файл

@@ -2,7 +2,9 @@
2 2
   <div class="mainPage">
3 3
     <scroll ref='scroll' :isloading='isloading' class='wrapper' :data='list' :pullUpLoad='pullUpLoadObj' :startY='parseInt(startY)' @pullingUp='getList'>
4 4
       <div class="box">
5
-        <discounts v-for="(item,index) in list" :key='index' @toUse='toUse' :data='item'></discounts>
5
+        <router-link tag="div" v-for="(item,index) in list" :key='index' :to="{name: 'couponsDetail', query: {id: item.customercouponid}}">
6
+          <discounts @toUse='toUse' :data='item'></discounts>
7
+        </router-link>
6 8
         <noMore v-if="hasPic"></noMore>
7 9
       </div>
8 10
     </scroll>
@@ -19,6 +21,9 @@ import failure from '../../../common/icon/inv.png'
19 21
 import scroll from '../../../components/scroll/scroll'
20 22
 import noMore from '../../../components/noMore/noMore'
21 23
 import discounts from '../../../components/discounts/discounts'
24
+import { mapState, createNamespacedHelpers } from 'vuex'
25
+const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
26
+
22 27
 export default {
23 28
   data () {
24 29
     return {
@@ -32,29 +37,7 @@ export default {
32 37
       isloading: true,
33 38
       hasPic: false,
34 39
       hasMore: true,
35
-      list: [
36
-        {
37
-          title: '小小外交官体验卡',
38
-          desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
39
-          time: '2018年02月17日',
40
-          useType: '未使用',
41
-          tag: '共享'
42
-        },
43
-        {
44
-          title: '小小外交官体验卡',
45
-          desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
46
-          time: '2018年02月17日',
47
-          useType: '已使用',
48
-          tag: '商品'
49
-        },
50
-        {
51
-          title: '小小外交官体验卡',
52
-          desc: '凭此体验券可让一位小朋友体验一次 适用于小小外交官课程',
53
-          time: '2018年02月17日',
54
-          useType: '已失效',
55
-          tag: '商品'
56
-        }
57
-      ],
40
+      list: [],
58 41
       line
59 42
     }
60 43
   },
@@ -76,7 +59,27 @@ export default {
76 59
         : false
77 60
     }
78 61
   },
62
+  created () {
63
+    this.getCouponList().then((res) => {
64
+      // console.log(JSON.stringify(res))
65
+      // console.log(JSON.stringify(this.couponList))
66
+      for (var n = 0; n < res.length; n++) {
67
+        this.list.push({
68
+          title: res[n].Coupon.CouponName,
69
+          desc: res[n].Coupon.Share.UseInstruction,
70
+          time: this.toolClass.dateFormat(res[n].EndDate),
71
+          useType: res[n].Status === 1 ? '未使用' : '已使用',
72
+          tag: res[n].Coupon.CouponType === 'coupon' ? '课程' : '商品',
73
+          customercouponid: res[n].CustomerCouponId,
74
+          couponid: res[n].Coupon.CouponId
75
+        })
76
+      }
77
+    })
78
+  },
79 79
   methods: {
80
+    ...caseTableActions([
81
+      'getCouponList',
82
+    ]),
80 83
     change (item, index) {
81 84
       this.active = index
82 85
     },
@@ -91,5 +94,5 @@ export default {
91 94
 </script>
92 95
 
93 96
 <style lang="scss" scoped>
94
-@import "page.scss";
97
+@import 'page.scss';
95 98
 </style>

+ 21
- 18
src/pages/user/couponsDetail/index.vue Целия файл

@@ -1,14 +1,14 @@
1 1
 <template>
2 2
   <div class="mainPage">
3 3
     <div class="title">体验券详情</div>
4
-    <div class="content">
4
+    <div class="content" v-if="info !== null">
5 5
       <div class="message">
6 6
         <div>
7
-          <span>体验券名称:小小外交官体验券</span>
7
+          <span>体验券名称:{{info.CustomerCouponName}}</span>
8 8
         </div>
9 9
         <div>
10 10
           <span>有效时间:</span>
11
-          <div class="time">{{time}}</div>
11
+          <div class="time">{{toolClass.dateFormat(info.EndDate)}}</div>
12 12
         </div>
13 13
       </div>
14 14
       <div class="rule">
@@ -16,41 +16,44 @@
16 16
         <div>1. 此卡不可兑换现金,不可与其他优惠活动同时使用。 </div>
17 17
         <div>2. 此卡不可多人使用,一人记一次。 </div>
18 18
         <div>3. 非会员可凭此卡享受对应课程。 </div>
19
-        <div>4. 截止日期至{{time}}。 </div>
19
+        <div>4. 截止日期至{{toolClass.dateFormat(info.EndDate)}}。 </div>
20 20
       </div>
21 21
       <div class="line">
22 22
         <img :src="Artboard" alt="" width="100%">
23 23
       </div>
24
-      <div class="qr-code" style="margin-top:.1rem;">
25
-        <div class="number">核销编码: 3423487682734</div>
26
-        <qrCode :msg='msg'></qrCode>
27
-      </div>
28 24
     </div>
29 25
   </div>
30 26
 </template>
31 27
 
32 28
 <script>
33
-import qrCode from '../../../components/qrCodeCard/qrCodeCard'
34 29
 import Artboard from '../../../common/icon/Artboard.png'
30
+import { mapState, createNamespacedHelpers } from 'vuex'
31
+const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
35 32
 export default {
36 33
   data () {
37 34
     return {
38
-      msg: {
39
-        course_type: 800
40
-      },
35
+      msg: 'sdsdssdsdsdsds',
41 36
       Artboard,
42
-      time: '2018年3月17日'
37
+      time: '2018年3月17日',
38
+      info: null,
43 39
     }
44 40
   },
41
+  created () {
42
+    this.getCouponInfo({
43
+      id: this.$route.query.id
44
+    }).then((res) => {
45
+      // console.log(JSON.stringify(res))
46
+      this.info = res
47
+    })
48
+  },
45 49
   methods: {
46
-
50
+    ...caseTableActions([
51
+      'getCouponInfo',
52
+    ]),
47 53
   },
48
-  components: {
49
-    qrCode
50
-  }
51 54
 }
52 55
 </script>
53 56
 
54 57
 <style lang="scss" scoped>
55
-@import "page.scss";
58
+@import 'page.scss';
56 59
 </style>

+ 66
- 0
src/pages/user/gymCardDetail/index.vue Целия файл

@@ -0,0 +1,66 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <div class="title">健身卡详情</div>
4
+    <div class="content">
5
+      <div class="message">
6
+        <div>
7
+          <span>会所健身体验卡</span>
8
+          <span class="sub">(可在银城会所健身房和游泳池使用)</span>
9
+        </div>
10
+        <div>
11
+          <span>有效时间</span>
12
+          <span>{{toolClass.dateFormat(gymCardDetail.EndDate)}}</span>
13
+        </div>
14
+      </div>
15
+      <div class="rule">
16
+        <div>使用规则</div>
17
+        <div>{{gymCardDetail.CardUseRule}}</div>
18
+      </div>
19
+      <div class="line">
20
+        <img :src="Artboard" alt="" width="100%">
21
+      </div>
22
+      <div class="qr-code" style="margin-top:.1rem;">
23
+        <qrCode :msg='msg' v-if="msg"></qrCode>
24
+      </div>
25
+    </div>
26
+  </div>
27
+</template>
28
+
29
+<script>
30
+import qrCode from '../../../components/qrCodeCard/qrCodeCard'
31
+import Artboard from '../../../common/icon/Artboard.png'
32
+import { createNamespacedHelpers } from 'vuex'
33
+const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('card')
34
+export default {
35
+  data () {
36
+    return {
37
+      msg: '',
38
+      Artboard,
39
+      time: '2018年3月17日'
40
+    }
41
+  },
42
+  methods: {
43
+
44
+  },
45
+  computed: {
46
+    ...mapCardState({
47
+      gymCardDetail: x => x.gymCardDetail
48
+    })
49
+  },
50
+  components: {
51
+    qrCode
52
+  },
53
+  created () {
54
+    this.getgymCardDetail({ customerGymId: this.$route.query.CustomerGymId }).then(() => {
55
+      this.msg = this.gymCardDetail.CustomerGymId
56
+    })
57
+  },
58
+  methods: {
59
+    ...mapCardActions(['getgymCardDetail'])
60
+  }
61
+}
62
+</script>
63
+
64
+<style lang="scss" scoped>
65
+@import 'page.scss';
66
+</style>

+ 60
- 0
src/pages/user/gymCardDetail/page.scss Целия файл

@@ -0,0 +1,60 @@
1
+.mainPage{
2
+  padding: .3rem .16rem .45rem;
3
+  box-sizing: border-box;
4
+  .title{
5
+    font-size: .18rem;
6
+    font-weight: bold;
7
+    padding-bottom: .14rem;
8
+    padding-left: .2rem;
9
+  }
10
+  .content{
11
+    background:#fff;
12
+    box-shadow:0px .08rem .37rem 0px rgba(202,202,202,0.42);
13
+    border-radius:.1rem;
14
+    padding: .12rem 0;
15
+    .message{
16
+      padding: 0 .22rem;
17
+      div{
18
+        margin-bottom: .2rem;
19
+        display: flex;
20
+        justify-content: space-between;
21
+        align-items: center;
22
+        span:nth-of-type(1){
23
+          font-size: .14rem;
24
+        }
25
+        span:nth-last-of-type(1){
26
+          text-align: right;
27
+        }
28
+        .sub{
29
+          color: #FA2A00;
30
+          font-size: .12rem;
31
+        }
32
+      }
33
+    }
34
+    .rule{
35
+      padding: 0 .22rem;
36
+      div:nth-of-type(1){
37
+        margin-bottom: .2rem;
38
+        font-size: .14rem;
39
+        color: #000;
40
+      }
41
+      div{
42
+        font-size: .12rem;
43
+        color: rgba(174,174,174,1);
44
+        margin-bottom: .1rem;
45
+      }
46
+    }
47
+  }
48
+  .number{
49
+    text-align: center;
50
+    color:rgba(143,143,143,1);
51
+    margin-bottom: .2rem;
52
+  }
53
+  .useType{
54
+    position: absolute;
55
+    bottom: 1.6rem;
56
+    right: .8rem;
57
+    width: .76rem;
58
+    height: .76rem;
59
+  }
60
+}

+ 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
     ]),

+ 93
- 40
src/pages/user/placeOrderDetail/index.vue Целия файл

@@ -23,8 +23,8 @@
23 23
               <div class="flex-item">
24 24
                 <div><span>选择商品券</span></div>
25 25
               </div>
26
-              <a class="active" @click="showSelect = true">
27
-                <span>{{postData.ticketName === '' ? '1张饮品券' : postData.ticketName}}</span>
26
+              <a class="active" v-if="getCouponOff && couponList.length" @click="showSelectCouponLayer = true">
27
+                <span>{{postData.customercouponid === '' ? '有' + couponList.length + '张优惠券可选' : '已选择优惠券'}}</span>
28 28
                 <i class="iconfont icon-jiantou-right"></i>
29 29
               </a>
30 30
             </li>
@@ -45,16 +45,24 @@
45 45
         <a @click="toPayer">确定</a>
46 46
       </div>
47 47
     </div>
48
-    <div class="selectLayer" :class="{'show': showSelect}">
49
-      <div>
50
-        <van-picker
51
-          show-toolbar
52
-          title="选择优惠券"
53
-          :columns="ticketList"
54
-          @cancel="showSelect = false"
55
-          @confirm="onConfirm"
56
-          value-key="value"
57
-        />
48
+    <div class="selectCouponLayer" :class="{'show': showSelectCouponLayer}">
49
+      <div class="flex-v">
50
+        <div>
51
+          <i class="iconfont icon-guanbi" @click="showSelectCouponLayer = false"></i>
52
+        </div>
53
+        <div class="flex-item">
54
+          <div class="flex-h">
55
+            <div class="flex-item" style="margin: 0 .2rem;">
56
+              <ul>
57
+                <li v-for="(item,index) in couponList" :key="index" @click="selectCouponItem(item)" :class="{'active':item.select}">
58
+                  <i class="iconfont icon-gouxuan"></i>
59
+                  <discounts :data="item"></discounts>
60
+                </li>
61
+              </ul>
62
+            </div>
63
+          </div>
64
+        </div>
65
+        <a @click="sureSelectCoupon">确定</a>
58 66
       </div>
59 67
     </div>
60 68
   </div>
@@ -63,12 +71,16 @@
63 71
 <script>
64 72
 import { mapState, createNamespacedHelpers } from 'vuex'
65 73
 const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
74
+import discounts from '../../../components/discounts/discounts'
66 75
 
67 76
 export default {
68 77
   name: '',
69 78
   data () {
70 79
     var _self = this
71 80
     return {
81
+      showSelectCouponLayer: false,
82
+      getCouponOff: false,
83
+      couponList: [], // 优惠券列表
72 84
       postData: {
73 85
         info: {
74 86
           CaseId: decodeURI(_self.$route.query.caseid),
@@ -81,21 +93,7 @@ export default {
81 93
           Remark: '',
82 94
         },
83 95
         detail: [],
84
-        coupon: [
85
-          //   {
86
-          //   OrdersCouponId: '',
87
-          //   OrdersId: '',
88
-          //   OrdersNo: '',
89
-          //   CouponId: '',
90
-          //   CouponName: '',
91
-          //   OrgId: '',
92
-          //   GoodsId: '',
93
-          //   GoodsName: '',
94
-          //   UsedAmount: '',
95
-          //   Status: '',
96
-          //   CreateDate: '',
97
-          // }
98
-        ],
96
+        customercouponid: ''
99 97
       },
100 98
       ticketList: [{
101 99
         value: '优惠券1',
@@ -107,10 +105,12 @@ export default {
107 105
         value: '优惠券3',
108 106
         id: '3',
109 107
       }],
110
-      showSelect: false,
111 108
       orderInfo: JSON.parse(_self.$route.query.info) || []
112 109
     }
113 110
   },
111
+  components: {
112
+    discounts,
113
+  },
114 114
   computed: {
115 115
     ...mapState({
116 116
       userInfo: x => x.userCenter.userInfo,
@@ -118,13 +118,71 @@ export default {
118 118
     })
119 119
   },
120 120
   created () {
121
-    // console.log(this.$route.query.info)
122
-    // console.log(JSON.stringify(this.postData))
121
+    this.getCouponList().then((res) => {
122
+      // console.log(JSON.stringify(res))
123
+      var id = JSON.parse(this.$route.query.info)[0].id, arr = [], nowDate = Date.now()
124
+      for (var n = 0; n < res.length; n++) {
125
+        if (res[n].Coupon.CouponType === 'goods' && res[n].Status === 1) {
126
+          if (res[n].Coupon.IsAll) {
127
+            this.couponList.push({
128
+              title: res[n].Coupon.CouponName,
129
+              desc: res[n].Coupon.Share.UseInstruction,
130
+              time: this.toolClass.dateFormat(res[n].EndDate),
131
+              useType: '未使用',
132
+              tag: '商品',
133
+              id: res[n].CustomerCouponId,
134
+              select: false,
135
+            })
136
+          } else {
137
+            for (var a = 0; a < res[n].Coupon.Targets.length; a++) {
138
+              if (res[n].Coupon.Targets[a].TargetId === id && nowDate >= new Date(res[n].StartDate).getTime() && nowDate < new Date(res[n].EndDate).getTime()) {
139
+                this.couponList.push({
140
+                  title: res[n].Coupon.CouponName,
141
+                  desc: res[n].Coupon.Share.UseInstruction,
142
+                  time: this.toolClass.dateFormat(res[n].EndDate),
143
+                  useType: '未使用',
144
+                  tag: '商品',
145
+                  id: res[n].CustomerCouponId,
146
+                  select: false,
147
+                })
148
+              }
149
+            }
150
+          }
151
+        }
152
+      }
153
+      this.getCouponOff = true
154
+      // console.log(JSON.stringify(this.couponList))
155
+    })
123 156
   },
124 157
   methods: {
125 158
     ...caseTableActions([
126 159
       'toPay',
160
+      'getCouponList',
127 161
     ]),
162
+    sureSelectCoupon () {
163
+      var bool = false
164
+      for (var n = 0; n < this.couponList.length; n++) {
165
+        if (this.couponList[n].select) {
166
+          bool = true
167
+          this.postData.customercouponid = this.couponList[n].id
168
+        }
169
+      }
170
+      if (!bool) {
171
+        this.postData.customercouponid = ''
172
+      }
173
+      this.showSelectCouponLayer = false
174
+    },
175
+    selectCouponItem (item) { // 选择优惠券
176
+      // item.select = !item.select
177
+      if (!item.select) {
178
+        for (var n = 0; n < this.couponList.length; n++) {
179
+          this.couponList[n].select = false
180
+        }
181
+        item.select = true
182
+      } else {
183
+        item.select = false
184
+      }
185
+    },
128 186
     returnAmount () { // 返回总金额  
129 187
       var amount = 0, num = 0, info = JSON.parse(this.$route.query.info)
130 188
       for (var n = 0; n < info.length; n++) {
@@ -138,16 +196,11 @@ export default {
138 196
       }
139 197
       return [amount, num]
140 198
     },
141
-    onConfirm (value, index) {
142
-      this.postData.coupon.CouponName = value.value
143
-      this.postData.coupon.CouponId = value.id
144
-      this.showSelect = false
145
-    },
146 199
     toPayer () { // 下单
147 200
       this.postData.info.OrgId = this.orgId
148 201
       this.postData.info.UserId = this.userInfo.CustomerId
149 202
       this.postData.info.UserName = this.userInfo.customer.CustomerName
150
-      this.postData.info.PayType = this.postData.coupon.length ? 'coupon' : 'vip'
203
+      this.postData.info.PayType = this.postData.customercouponid === '' ? 'coupon' : 'vip'
151 204
       var orderInfo = JSON.parse(this.$route.query.info)
152 205
       this.postData.detail = []
153 206
       var amount = 0
@@ -159,10 +212,10 @@ export default {
159 212
           SpecId: orderInfo[n].spec,
160 213
           SpecName: orderInfo[n].specname,
161 214
           Number: orderInfo[n].num - 0,
162
-          Price: String(orderInfo[n].price-0),
215
+          Price: String(orderInfo[n].price - 0),
163 216
         })
164
-        amount += (orderInfo[n].price-0) * orderInfo[n].num
165
-        num += orderInfo[n].num-0
217
+        amount += (orderInfo[n].price - 0) * orderInfo[n].num
218
+        num += orderInfo[n].num - 0
166 219
       }
167 220
       this.postData.info.Amount = String(amount)
168 221
       this.postData.info.OrdersNum = num
@@ -170,7 +223,7 @@ export default {
170 223
       this.toPay({
171 224
         info: JSON.stringify(this.postData.info),
172 225
         detail: JSON.stringify(this.postData.detail),
173
-        coupon: JSON.stringify(this.postData.coupon)
226
+        customercouponid: this.postData.customercouponid
174 227
       }).then((res) => {
175 228
         this.$dialog.alert({
176 229
           message: '下单成功!'

+ 132
- 0
src/pages/user/placeOrderDetail/page.scss Целия файл

@@ -167,4 +167,136 @@
167 167
       overflow: hidden;
168 168
     }
169 169
   }
170
+  .selectCouponLayer{
171
+    width: 100%;
172
+    position: absolute;
173
+    left: 0;
174
+    top: 0;
175
+    bottom: 0;
176
+    z-index: 100;
177
+    background: rgba(0,0,0,.5);
178
+    display: none;
179
+    &.show{
180
+      display: block;
181
+    }
182
+    >div{
183
+      width: 100%;
184
+      height: 4rem;
185
+      position: absolute;
186
+      overflow: hidden;
187
+      left: 0;
188
+      bottom: 0;
189
+      background: #fff;
190
+      border-radius: .1rem .1rem 0 0;
191
+      >div{
192
+        width: 100%;
193
+        &:first-child{
194
+          text-align: right;
195
+          margin-top: .1rem;
196
+          >i{
197
+            margin-right: .1rem;
198
+            font-size: .2rem;
199
+            color: #666;
200
+          }
201
+        }
202
+        &.flex-item{
203
+          position: relative;
204
+          overflow: visible;
205
+          >div{
206
+            width: 100%;
207
+            position: absolute;
208
+            overflow: visible;
209
+            left: 0;
210
+            top: 0;
211
+            bottom: 0;
212
+            >div{
213
+              width: 100%;
214
+              overflow-y: scroll;
215
+              -webkit-overflow-scrolling: touch;
216
+              transform: translateZ(0);
217
+              -webkit-transform: translateZ(0);
218
+              overflow-x: visible;
219
+              ul{
220
+                width: 100%;
221
+                position: relative;
222
+                overflow: visible;
223
+                li{
224
+                  width: 100%;
225
+                  position: relative;
226
+                  overflow: visible;
227
+                  margin: .1rem auto 0;
228
+                  >i{
229
+                    display: none;
230
+                    font-size: .2rem;
231
+                    color: #fd684a;
232
+                    position: absolute;
233
+                    right: .1rem;
234
+                    top: .1rem;
235
+                    z-index: 110;
236
+                  }
237
+                  &.active{
238
+                    >i{
239
+                      display: block;
240
+                    }
241
+                  }
242
+                }
243
+              }
244
+            }
245
+          }
246
+        }
247
+      }
248
+      >a{
249
+        width: 100%;
250
+        display: block;
251
+        text-align: center;
252
+        font-size: .16rem;
253
+        color: #fff;
254
+        background: #fd684a;
255
+        line-height: .5rem;
256
+      }
257
+    }
258
+    // >div{
259
+    //   width: 100%;
260
+    //   max-height: 3rem;
261
+    //   overflow: hidden;
262
+    //   position: absolute;
263
+    //   left: 0;
264
+    //   bottom: 0;
265
+    //   background: #fff;
266
+    //   border-radius: .1rem .1rem 0 0;
267
+    //   >div{
268
+    //     width: 100%;
269
+    //     position: relative;
270
+    //     overflow: visible;
271
+    //     &:first-child{
272
+    //       text-align: right;
273
+    //     }
274
+    //     i{
275
+    //       font-size: .2rem;
276
+    //       color: #666;
277
+    //       margin-right: .1rem;
278
+    //     }
279
+    //     >ul{
280
+    //       position: relative;
281
+    //       overflow: visible;
282
+    //       margin: 0 .2rem;
283
+    //       >li{
284
+    //         width: 100%;
285
+    //         position: relative;
286
+    //         overflow: visible;
287
+    //         margin: .1rem auto 0;
288
+    //       }
289
+    //     }
290
+    //   }
291
+    //   >a{
292
+    //     width: 100%;
293
+    //     display: block;
294
+    //     text-align: center;
295
+    //     font-size: .16rem;
296
+    //     color: #fff;
297
+    //     background: #fd684a;
298
+    //     line-height: .5rem;
299
+    //   }
300
+    // }
301
+  }
170 302
 }

+ 92
- 29
src/pages/user/placeOrderForCourse/index.vue Целия файл

@@ -54,7 +54,7 @@
54 54
                     <span>优惠信息</span>
55 55
                   </div>
56 56
                 </div>
57
-                <span>{{postData.CouponId == '' ? '暂未选择优惠券' : postData.CouponName}}</span>
57
+                <span>{{postData.customercouponid == '' ? '暂未选择优惠券' : '已选择优惠券'}}</span>
58 58
                 <i class="iconfont icon-jiantou-right"></i>
59 59
               </div>
60 60
               <div class="flex-h">
@@ -63,7 +63,7 @@
63 63
                     <span>优惠券</span>
64 64
                   </div>
65 65
                 </div>
66
-                <span>{{columns.length > 1 ? (columns.length-1) + '张可用优惠券' : '暂无优惠券'}}</span>
66
+                <span>{{couponList.length ? couponList.length + '张可用优惠券' : '暂无优惠券'}}</span>
67 67
               </div>
68 68
             </div>
69 69
             <div class="agreement">
@@ -98,14 +98,22 @@
98 98
     </div>
99 99
     <div class="layer" :class="{'show': showLayer}"> 
100 100
       <div>
101
-        <van-picker
102
-          show-toolbar
103
-          title="选择优惠券"
104
-          :columns="columns"
105
-          @cancel="onCancel"
106
-          @confirm="onConfirm"
107
-          value-key="value"
108
-        />
101
+        <div class="top">
102
+          <i class="iconfont icon-guanbi"></i>
103
+        </div>
104
+        <div class="body flex-h">
105
+          <div class="flex-item">
106
+            <div>
107
+              <ul>
108
+                <li v-for="(item,index) in couponList" :key="index" @click="selectCouponItem(item)" :class="{'active':item.select}">
109
+                  <i class="iconfont icon-gouxuan"></i>
110
+                  <discounts :data="item"></discounts>
111
+                </li>
112
+              </ul>
113
+            </div>
114
+          </div>
115
+        </div>
116
+        <a @click="sureSelectCoupon">确定</a>
109 117
       </div>
110 118
     </div>
111 119
   </div>
@@ -114,33 +122,28 @@
114 122
 <script>
115 123
 import { mapState, createNamespacedHelpers } from 'vuex'
116 124
 const { mapActions: mapProjectActions, mapState: mapProjectState } = createNamespacedHelpers('majorProjects')
125
+const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
126
+import discounts from '../../../components/discounts/discounts'
117 127
 
118 128
 export default {
119 129
   name: '',
120 130
   data () {
121 131
     return {
132
+      couponList: [],
133
+      getCouponOff: false,
122 134
       agreementOff: false, // 是否同意协议
123 135
       courseTimeList: [],
124 136
       postData: {
125 137
         CouponId: '',
126 138
         CouponName: '',
139
+        customercouponid: ''
127 140
       },
128 141
       showLayer: false, // 显隐选择优惠券弹窗
129
-      columns: [{ // 优惠券列表
130
-        value: '不选择优惠券',
131
-        id: '',
132
-      }, {
133
-        value: '优惠券1',
134
-        id: '1',
135
-      }, {
136
-        value: '优惠券2',
137
-        id: '2',
138
-      }, {
139
-        value: '优惠券3',
140
-        id: '3',
141
-      }],
142 142
     }
143 143
   },
144
+  components: {
145
+    discounts,
146
+  },
144 147
   computed: {
145 148
     ...mapState({
146 149
       orgid: x => x.app.orgId,
@@ -156,14 +159,74 @@ export default {
156 159
     }),
157 160
   },
158 161
   created () {
159
-    this.getCourseDetailInfo({ id: this.$route.query.id }).then((res) => {
160
-      var arr = res.CourseDetail
161
-      this.courseTimeList = arr.sort(function (a, b) { return new Date(a.BeginDate).getTime() > new Date(b.BeginDate).getTime() ? 1 : -1 })
162
+    this.getCouponList().then((res) => {
163
+      this.getCourseDetailInfo({ id: this.$route.query.id }).then((res) => {
164
+        var arr = res.CourseDetail
165
+        this.courseTimeList = arr.sort(function (a, b) { return new Date(a.BeginDate).getTime() > new Date(b.BeginDate).getTime() ? 1 : -1 })
166
+      })
167
+      var id = this.$route.query.id, arr = [], nowDate = Date.now()
168
+      for (var n = 0; n < res.length; n++) {
169
+        if (res[n].Coupon.CouponType === 'coupon' && res[n].Status === 1) {
170
+          if (res[n].Coupon.IsAll) {
171
+            this.couponList.push({
172
+              title: res[n].Coupon.CouponName,
173
+              desc: res[n].Coupon.Share.UseInstruction,
174
+              time: this.toolClass.dateFormat(res[n].EndDate),
175
+              useType: '未使用',
176
+              tag: '课程',
177
+              id: res[n].CustomerCouponId,
178
+              select: false,
179
+            })
180
+          } else {
181
+            for (var a = 0; a < res[n].Coupon.Targets.length; a++) {
182
+              if (res[n].Coupon.Targets[a].TargetId === id && nowDate >= new Date(res[n].StartDate).getTime() && nowDate < new Date(res[n].EndDate).getTime()) {
183
+                this.couponList.push({
184
+                  title: res[n].Coupon.CouponName,
185
+                  desc: res[n].Coupon.Share.UseInstruction,
186
+                  time: this.toolClass.dateFormat(res[n].EndDate),
187
+                  useType: '未使用',
188
+                  tag: '课程',
189
+                  id: res[n].CustomerCouponId,
190
+                  select: false,
191
+                })
192
+              }
193
+            }
194
+          }
195
+        }
196
+      }
197
+      this.getCouponOff = true
198
+      // console.log(JSON.stringify(this.couponList))
162 199
     })
163 200
   },
164 201
   methods: {
202
+    ...caseTableActions([
203
+      'getCouponList',
204
+    ]),
205
+    sureSelectCoupon () {
206
+      var bool = false
207
+      for (var n = 0; n < this.couponList.length; n++) {
208
+        if (this.couponList[n].select) {
209
+          bool = true
210
+          this.postData.customercouponid = this.couponList[n].id
211
+        }
212
+      }
213
+      if (!bool) {
214
+        this.postData.customercouponid = ''
215
+      }
216
+      this.showLayer = false
217
+    },
218
+    selectCouponItem (item) { // 选择优惠券
219
+      if (!item.select) {
220
+        for (var n = 0; n < this.couponList.length; n++) {
221
+          this.couponList[n].select = false
222
+        }
223
+        item.select = true
224
+      } else {
225
+        item.select = false
226
+      }
227
+    },
165 228
     placeOrder () { // 下单
166
-      if(!this.agreementOff){
229
+      if (!this.agreementOff) {
167 230
         this.$toast('请先阅读服务协议并同意')
168 231
         return false
169 232
       }
@@ -174,7 +237,7 @@ export default {
174 237
           CustomerId: this.user.CustomerId,
175 238
           Price: this.courseDetail.Price
176 239
         },
177
-        coupons: []
240
+        customercouponid: this.postData.customercouponid
178 241
       }).then((res) => {
179 242
         // console.log(JSON.stringify(res))
180 243
         this.$dialog.alert({
@@ -218,5 +281,5 @@ export default {
218 281
 
219 282
 <!-- Add "scoped" attribute to limit CSS to this component only -->
220 283
 <style lang="scss" scoped>
221
-@import "page.scss";
284
+@import 'page.scss';
222 285
 </style>

+ 64
- 0
src/pages/user/placeOrderForCourse/page.scss Целия файл

@@ -195,6 +195,70 @@
195 195
       left: 0;
196 196
       bottom: 0;
197 197
       overflow: hidden;
198
+      background: #fff;
199
+      border-radius: .1rem .1rem 0 0;
200
+      .top{
201
+        width: 100%;
202
+        position: relative;
203
+        overflow: hidden;
204
+        text-align: right;
205
+        margin-top: .1rem;
206
+        padding-bottom: .1rem;
207
+        i{
208
+          margin-right: .1rem;
209
+          font-size: .2rem;
210
+          color: #666;
211
+        }
212
+      }
213
+      >.body{
214
+        width: 100%;
215
+        position: relative;
216
+        overflow: visible;
217
+        >div{
218
+          margin: 0 .2rem;
219
+          position: relative;
220
+          overflow: visible;
221
+          >div{
222
+            width: 100%;
223
+            max-height: 3rem;
224
+            position: relative;
225
+            overflow-x: visible;
226
+            overflow-y: scroll;
227
+            -webkit-overflow-scrolling: touch;
228
+            transform: translateZ(0);
229
+            -webkit-transform: translateZ(0);
230
+            ul{
231
+              li{
232
+                margin: .1rem auto 0;
233
+                position: relative;
234
+                >i{
235
+                  display: none;
236
+                  font-size: .2rem;
237
+                  color: #fd684a;
238
+                  position: absolute;
239
+                  right: .1rem;
240
+                  top: .1rem;
241
+                  z-index: 110;
242
+                }
243
+                &.active{
244
+                  >i{
245
+                    display: block;
246
+                  }
247
+                }
248
+              }
249
+            }
250
+          }
251
+        }
252
+      }
253
+      >a{
254
+        width: 100%;
255
+        display: block;
256
+        line-height: .5rem;
257
+        text-align: center;
258
+        color: #fff;
259
+        font-size: .15rem;
260
+        background: #fc6243;
261
+      }
198 262
     }
199 263
   }
200 264
 }

+ 6
- 0
src/pages/user/router.js Целия файл

@@ -19,6 +19,7 @@ import card from './card/index' // 卡
19 19
 import coupons from './coupons/index' // 优惠券
20 20
 import lessonDetail from './lessonDetail/index' // 课程详情
21 21
 import cardDetail from './cardDetail/index' // 体验卡详情
22
+import gymCardDetail from './gymCardDetail/index' // 健身卡详情
22 23
 import couponsDetail from './couponsDetail/index' // 体验券详情
23 24
 import receive from './receive/index' // 领取页面
24 25
 import receiveResults from './receiveResults/index' // 领取结果页面
@@ -116,6 +117,11 @@ const router = new Router({
116 117
     name: 'cardDetail',
117 118
     component: cardDetail,
118 119
     children: []
120
+  }, { // 健身卡详情
121
+    path: '/gymCardDetail',
122
+    name: 'gymCardDetail',
123
+    component: gymCardDetail,
124
+    children: []
119 125
   }, { // 体验券详情
120 126
     path: '/couponsDetail',
121 127
     name: 'couponsDetail',

+ 25
- 0
src/store/card/index.js Целия файл

@@ -17,6 +17,31 @@ export default {
17 17
     }
18 18
   },
19 19
   actions: {
20
+    getCardList (context) { // 获取体验卡列表
21
+      return new Promise((resolve) => {
22
+        Ajax(api.card.getCardList.url, {
23
+          method: api.card.getCardList.method,
24
+        }).then(res => {
25
+          resolve(res)
26
+        }).catch((err) => {
27
+          reject(err)
28
+        })
29
+      })
30
+    },
31
+    getCardInfo (context, { id }) { // 获取体验卡详情
32
+      return new Promise((resolve) => {
33
+        Ajax(api.card.getCardInfo.url, {
34
+          method: api.card.getCardInfo.method,
35
+          urlData: {
36
+            id,
37
+          }
38
+        }).then(res => {
39
+          resolve(res)
40
+        }).catch((err) => {
41
+          reject(err)
42
+        })
43
+      })
44
+    },
20 45
     getgymCardList (context, data) { // 获取课程详情信息
21 46
       return new Promise((resolve) => {
22 47
         Ajax(api.user.gymCard.url, {

+ 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) => {

+ 2
- 2
src/store/majorProjects/majorProjects.js Целия файл

@@ -17,13 +17,13 @@ export default {
17 17
     }
18 18
   },
19 19
   actions: {
20
-    placeOrderForCourse (context, { order, coupons = [] }) { // 课程下单
20
+    placeOrderForCourse (context, { order, customercouponid }) { // 课程下单
21 21
       return new Promise((resolve, reject) => {
22 22
         Ajax(api.majorProjects.placeCourseOrder.url, {
23 23
           method: api.majorProjects.placeCourseOrder.method,
24 24
           data: {
25 25
             info: window.JSON.stringify(order),
26
-            coupons: window.JSON.stringify(coupons),
26
+            customercouponid,
27 27
           }
28 28
         }).then(res => {
29 29
           resolve(res)

+ 23
- 2
src/store/placeOrderForCoffee/index.js Целия файл

@@ -63,14 +63,35 @@ export default {
63 63
         })
64 64
       })
65 65
     },
66
-    toPay (context, { info, detail, coupon }) { // 下单
66
+    toPay (context, { info, detail, customercouponid }) { // 下单
67 67
       return new Promise((resolve) => {
68 68
         Ajax(api.caseForCoffee.placeGoodsOrder.url, {
69 69
           method: api.caseForCoffee.placeGoodsOrder.method,
70 70
           data: {
71 71
             info,
72 72
             detail,
73
-            coupon,
73
+            customercouponid,
74
+          },
75
+        }).then(res => {
76
+          resolve(res)
77
+        })
78
+      })
79
+    },
80
+    getCouponList (context) { // 获取优惠券列表
81
+      return new Promise((resolve) => {
82
+        Ajax(api.caseForCoffee.getCouponList.url, {
83
+          method: api.caseForCoffee.getCouponList.method,
84
+        }).then(res => {
85
+          resolve(res)
86
+        })
87
+      })
88
+    },
89
+    getCouponInfo (context, { id }) { // 获取优惠券详情
90
+      return new Promise((resolve) => {
91
+        Ajax(api.caseForCoffee.getCouponInfo.url, {
92
+          method: api.caseForCoffee.getCouponInfo.method,
93
+          urlData: {
94
+            id,
74 95
           },
75 96
         }).then(res => {
76 97
           resolve(res)

+ 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, {

+ 29
- 3
src/util/api.js Целия файл

@@ -47,7 +47,15 @@ const $api = {
47 47
     placeGoodsOrder: { // 商品下单
48 48
       method: 'post',
49 49
       url: `${baseUrl}${wechat}/order/goods`
50
-    }
50
+    },
51
+    getCouponList: { // 获取优惠券列表
52
+      method: 'get',
53
+      url: `${baseUrl}${wechat}/customer/coupon`
54
+    },
55
+    getCouponInfo: { // 获取优惠券详情
56
+      method: 'get',
57
+      url: `${baseUrl}${wechat}/customer/coupon/:id`
58
+    },
51 59
   },
52 60
   majorProjects: { // 项目专题
53 61
     getCourseList: { // 获取课程列表
@@ -67,7 +75,15 @@ const $api = {
67 75
     myCustomer: { // 我的客户
68 76
       method: 'get',
69 77
       url: `${baseUrl}${wechat}/customer/user`
70
-    }
78
+    },
79
+    getCardList: { // 我的体验卡列表
80
+      method: 'get',
81
+      url: `${baseUrl}${wechat}/customer/card`
82
+    },
83
+    getCardInfo: { // 我的体验卡详情
84
+      method: 'get',
85
+      url: `${baseUrl}${wechat}/customer/card/:id`
86
+    },
71 87
   },
72 88
   user: {
73 89
     info: { // 获取用户信息
@@ -106,7 +122,7 @@ const $api = {
106 122
       method: 'get',
107 123
       url: `${baseUrl}${wechat}/gymcard`
108 124
     },
109
-    gymCardDetail: { // 获取健身卡列表
125
+    gymCardDetail: { // 获取健身卡详情
110 126
       method: 'get',
111 127
       url: `${baseUrl}${wechat}/gymcard/:customerGymId`
112 128
     },
@@ -141,6 +157,16 @@ const $api = {
141 157
       url: `${baseUrl}${wechat}/coupon/detail/:id`
142 158
     }
143 159
   },
160
+  sales: {
161
+    getCardList: { // 获取我的卡列表
162
+      method: 'get',
163
+      url: `${baseUrl}${wechat}/card`
164
+    },
165
+    getCouponList: { // 获取我的券列表
166
+      method: 'get',
167
+      url: `${baseUrl}${wechat}/coupon`
168
+    },
169
+  },
144 170
   login: { // 主管、销售端登陆
145 171
     login: {
146 172
       method: 'post',