许成详 6 years ago
parent
commit
bf49c7d21f

+ 23
- 30
src/pages/user/card/index.vue View File

6
     <scroll ref='scroll' :isloading='isloading' class='wrapper' :data='data[active].list' :pullUpLoad='pullUpLoadObj' :startY='parseInt(startY)' @pullingUp='getList'>
6
     <scroll ref='scroll' :isloading='isloading' class='wrapper' :data='data[active].list' :pullUpLoad='pullUpLoadObj' :startY='parseInt(startY)' @pullingUp='getList'>
7
       <div class="box">
7
       <div class="box">
8
         <div v-if="active == 0">
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
           <noMore v-if="data[active].hasPic"></noMore>
10
           <noMore v-if="data[active].hasPic"></noMore>
11
         </div>
11
         </div>
12
         <div v-if="active == 1">
12
         <div v-if="active == 1">
13
           <div class="fitness-card" v-for="(item,index) in data[1].list" :key='index'>
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
               <div class="card-top">
15
               <div class="card-top">
16
                 <div class="top-left">
16
                 <div class="top-left">
17
                   <img :src="logo" alt="">
17
                   <img :src="logo" alt="">
81
           hasMore: true,
81
           hasMore: true,
82
           page: 1,
82
           page: 1,
83
           pageSize: 1,
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
           hasPic: false,
87
           hasPic: false,
139
   },
117
   },
140
   created () {
118
   created () {
141
     this.change('', 0)
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
   methods: {
133
   methods: {
144
-    ...mapCardActions(['getgymCardList']),
134
+    ...mapCardActions([
135
+      'getgymCardList',
136
+      'getCardList',
137
+    ]),
145
     change (item, index) {
138
     change (item, index) {
146
       this.active = index
139
       this.active = index
147
       this.getList('change')
140
       this.getList('change')
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 View File

1
 <template>
1
 <template>
2
   <div class="mainPage">
2
   <div class="mainPage">
3
     <div class="title">体验卡详情</div>
3
     <div class="title">体验卡详情</div>
4
-    <div class="content">
4
+    <div class="content" v-if="info !== null">
5
       <div class="message">
5
       <div class="message">
6
         <div>
6
         <div>
7
-          <span>会所健身体验卡</span>
7
+          <span>{{info.CardName}}</span>
8
           <span class="sub">(可在银城会所健身房和游泳池使用)</span>
8
           <span class="sub">(可在银城会所健身房和游泳池使用)</span>
9
         </div>
9
         </div>
10
         <div>
10
         <div>
11
           <span>有效时间</span>
11
           <span>有效时间</span>
12
-          <span>{{toolClass.dateFormat(gymCardDetail.EndDate)}}</span>
12
+          <span>{{toolClass.dateFormat(info.EndDate)}}</span>
13
         </div>
13
         </div>
14
       </div>
14
       </div>
15
       <div class="rule">
15
       <div class="rule">
16
         <div>使用规则</div>
16
         <div>使用规则</div>
17
-        <div>{{gymCardDetail.CardUseRule}}</div>
17
+        <div>{{info.Share.CardUseInstruction}}</div>
18
       </div>
18
       </div>
19
       <div class="line">
19
       <div class="line">
20
         <img :src="Artboard" alt="" width="100%">
20
         <img :src="Artboard" alt="" width="100%">
21
       </div>
21
       </div>
22
-      <div class="qr-code" style="margin-top:.1rem;">
23
-        <qrCode :msg='msg' v-if="msg"></qrCode>
24
-      </div>
25
     </div>
22
     </div>
26
   </div>
23
   </div>
27
 </template>
24
 </template>
28
 
25
 
29
 <script>
26
 <script>
30
-import qrCode from '../../../components/qrCodeCard/qrCodeCard'
31
 import Artboard from '../../../common/icon/Artboard.png'
27
 import Artboard from '../../../common/icon/Artboard.png'
32
 import { createNamespacedHelpers } from 'vuex'
28
 import { createNamespacedHelpers } from 'vuex'
33
-const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('card')
29
+const { mapActions: mapCardActions } = createNamespacedHelpers('card')
34
 export default {
30
 export default {
35
   data () {
31
   data () {
36
     return {
32
     return {
37
       msg: '',
33
       msg: '',
38
       Artboard,
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
   created () {
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
   methods: {
45
   methods: {
59
-    ...mapCardActions(['getgymCardDetail'])
46
+    ...mapCardActions(['getCardInfo'])
60
   }
47
   }
61
 }
48
 }
62
 </script>
49
 </script>

+ 66
- 0
src/pages/user/gymCardDetail/index.vue View File

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 View File

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

+ 6
- 0
src/pages/user/router.js View File

19
 import coupons from './coupons/index' // 优惠券
19
 import coupons from './coupons/index' // 优惠券
20
 import lessonDetail from './lessonDetail/index' // 课程详情
20
 import lessonDetail from './lessonDetail/index' // 课程详情
21
 import cardDetail from './cardDetail/index' // 体验卡详情
21
 import cardDetail from './cardDetail/index' // 体验卡详情
22
+import gymCardDetail from './gymCardDetail/index' // 健身卡详情
22
 import couponsDetail from './couponsDetail/index' // 体验券详情
23
 import couponsDetail from './couponsDetail/index' // 体验券详情
23
 import share from './share/index' // 卡券分享页面
24
 import share from './share/index' // 卡券分享页面
24
 
25
 
115
     name: 'cardDetail',
116
     name: 'cardDetail',
116
     component: cardDetail,
117
     component: cardDetail,
117
     children: []
118
     children: []
119
+  }, { // 健身卡详情
120
+    path: '/gymCardDetail',
121
+    name: 'gymCardDetail',
122
+    component: gymCardDetail,
123
+    children: []
118
   }, { // 体验券详情
124
   }, { // 体验券详情
119
     path: '/couponsDetail',
125
     path: '/couponsDetail',
120
     name: 'couponsDetail',
126
     name: 'couponsDetail',

+ 25
- 0
src/store/card/index.js View File

17
     }
17
     }
18
   },
18
   },
19
   actions: {
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
     getgymCardList (context, data) { // 获取课程详情信息
45
     getgymCardList (context, data) { // 获取课程详情信息
21
       return new Promise((resolve) => {
46
       return new Promise((resolve) => {
22
         Ajax(api.user.gymCard.url, {
47
         Ajax(api.user.gymCard.url, {

+ 9
- 1
src/util/api.js View File

75
     myCustomer: { // 我的客户
75
     myCustomer: { // 我的客户
76
       method: 'get',
76
       method: 'get',
77
       url: `${baseUrl}${wechat}/customer/user`
77
       url: `${baseUrl}${wechat}/customer/user`
78
-    }
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
+    },
79
   },
87
   },
80
   user: {
88
   user: {
81
     info: { // 获取用户信息
89
     info: { // 获取用户信息