yuantianjiao 6 vuotta sitten
vanhempi
commit
22a5cf4157

+ 24
- 12
src/components/salesRecordItem/index.vue Näytä tiedosto

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <div class="salesRecordItem">
3
-    <div class="top flex-h">
3
+    <div class="top flex-h" @click="toDetail">
4 4
       <span>销售名称:</span>
5 5
       <span>{{data.name}}</span>
6 6
       <div class="flex-item">
@@ -11,19 +11,19 @@
11 11
       <div class="flex-item">
12 12
         <div>
13 13
           <span>已发出<em>{{data.cardAndCoupon.usedNum}}</em>张卡券</span>
14
-          <div class="progress">
14
+          <!-- <div class="progress">
15 15
             <div :style="{width: (data.cardAndCoupon.usedNum/data.cardAndCoupon.totalNum).toFixed(2) * 100 + '%', background: returnProgressColor((data.cardAndCoupon.usedNum/data.cardAndCoupon.totalNum).toFixed(2) * 100)}"></div>
16
-          </div>
17
-          <a :class="{'grey': data.cardAndCoupon.status === 1}" @click="triggerCardAndCoupon(data)">{{data.cardAndCoupon.status === 1 ? '关闭卡券' : '开启卡券'}}</a>
16
+          </div> -->
17
+          <a :class="{'grey': !fibdata.coupon }" @click="triggerCardAndCoupon(data)">{{ fibdata.coupon ? '开启卡券' : '关闭卡券' }}</a>
18 18
         </div>
19 19
       </div>
20 20
       <div class="flex-item">
21 21
         <div>
22
-          <span>已送出<em>12</em>杯饮品</span>
23
-          <div class="progress">
22
+          <span>已送出<em>{{data.drink.usedNum}}</em>杯饮品</span>
23
+          <!-- <div class="progress">
24 24
             <div :style="{width: (data.drink.usedNum/data.drink.totalNum).toFixed(2) * 100 + '%', background: returnProgressColor((data.drink.usedNum/data.drink.totalNum).toFixed(2) * 100)}"></div>
25
-          </div>
26
-          <a :class="{'grey': data.drink.status === 1}" @click="triggerDrink(data)">{{data.drink.status === 1 ? '关闭饮品' : '开启饮品'}}</a>
25
+          </div> -->
26
+          <a :class="{'grey': !fibdata.order }" @click="triggerDrink(data)">{{ fibdata.order ? '开启饮品' : '关闭饮品' }}</a>
27 27
         </div>
28 28
       </div>
29 29
     </div>
@@ -34,7 +34,16 @@
34 34
 
35 35
 export default {
36 36
   name: '',
37
-  props: ['data'],
37
+  props: {
38
+    data: {
39
+      type: Object,
40
+      default: () => { }
41
+    },
42
+    fibdata: {
43
+      type: Object,
44
+      default: () => { }
45
+    }
46
+  },
38 47
   data () {
39 48
     return {
40 49
 
@@ -47,14 +56,17 @@ export default {
47 56
 
48 57
   },
49 58
   created () {
50
-
59
+    console.log(this.fibdata)
51 60
   },
52 61
   methods: {
53 62
     triggerCardAndCoupon (item) { // 切换卡券状态
54
-      this.$emit('triggerCardAndCoupon', {type: this.data.cardAndCoupon.status === 1 ? 'close' : 'open', data: item})
63
+      this.$emit('triggerCardAndCoupon', { type: this.fibdata.coupon ? 'open' : 'close', data: item })
55 64
     },
56 65
     triggerDrink (item) { // 切换饮品状态
57
-      this.$emit('triggerDrink', {type: this.data.drink.status === 1 ? 'close' : 'open', data: item})
66
+      this.$emit('triggerDrink', { type: this.fibdata.order ? 'open' : 'close', data: item })
67
+    },
68
+    toDetail () {
69
+      this.$emit('toDetail', this.data)
58 70
     },
59 71
     returnProgressColor (val) { // 返回进度条颜色
60 72
       if (val <= 33) {

+ 100
- 102
src/pages/sales/salesRecord/index.vue Näytä tiedosto

@@ -1,14 +1,14 @@
1 1
 <template>
2 2
   <div class="mainPage flex-v">
3 3
     <div class="top">
4
-      <topCaseInfo :data="topCaseInfoData" @selectCase="showSelect = true"></topCaseInfo>
4
+      <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer !== undefined ? userInfo.customer.CustomerName : ''" @selectCase="showVanPicker"></topCaseInfo>
5 5
     </div>
6 6
     <div class="flex-item body">
7 7
       <div>
8 8
         <ul>
9
-          <router-link tag="li" v-for="(item,index) in list" :key="index" :to="{name: 'salesGiveOutDetail', query: {}}">
10
-            <salesRecordItem :data="item" @triggerCardAndCoupon="triggerCardAndCoupon" @triggerDrink="triggerDrink"></salesRecordItem>
11
-          </router-link>
9
+          <li v-for="(item,index) in list" :key="index">
10
+            <salesRecordItem :data="item" :fibdata="fibdata(item)" @triggerCardAndCoupon="triggerCardAndCoupon" @triggerDrink="triggerDrink" @toDetail='toDetail'></salesRecordItem>
11
+          </li>
12 12
         </ul>
13 13
       </div>
14 14
     </div>
@@ -18,125 +18,123 @@
18 18
 <script>
19 19
 import topCaseInfo from '../../../components/topCaseInfo/index'
20 20
 import salesRecordItem from '../../../components/salesRecordItem/index'
21
-
21
+import { mapState, createNamespacedHelpers } from 'vuex'
22
+const { mapState: mapForbidState, mapActions: mapForbidActions } = createNamespacedHelpers('forbid')
23
+const { mapActions: actions } = createNamespacedHelpers('app')
24
+const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
25
+const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
22 26
 export default {
23 27
   name: '',
24 28
   data () {
25 29
     return {
26 30
       topCaseInfoData: {
27
-        caseName: '',
31
+        CaseName: '',
28 32
         caseId: '',
29
-        showSelect: false,
30
-        userName: 'xxx'
33
+        showSelect: false
31 34
       },
32
-      list: [{
33
-        name: '柳依依',
34
-        id: '1',
35
-        cardAndCoupon: {
36
-          totalNum: '100',
37
-          usedNum: '35',
38
-          status: 1,
39
-        },
40
-        drink: {
41
-          totalNum: '100',
42
-          usedNum: '68',
43
-          status: 0,
44
-        },
45
-      }, {
46
-        name: '柳依依',
47
-        id: '1',
48
-        cardAndCoupon: {
49
-          totalNum: '100',
50
-          usedNum: '10',
51
-          status: 1,
52
-        },
53
-        drink: {
54
-          totalNum: '100',
55
-          usedNum: '45',
56
-          status: 1,
57
-        },
58
-      }, {
59
-        name: '柳依依',
60
-        id: '1',
61
-        cardAndCoupon: {
62
-          totalNum: '100',
63
-          usedNum: '35',
64
-          status: 1,
65
-        },
66
-        drink: {
67
-          totalNum: '100',
68
-          usedNum: '68',
69
-          status: 1,
70
-        },
71
-      }, {
72
-        name: '柳依依',
73
-        id: '1',
74
-        cardAndCoupon: {
75
-          totalNum: '100',
76
-          usedNum: '35',
77
-          status: 1,
78
-        },
79
-        drink: {
80
-          totalNum: '100',
81
-          usedNum: '68',
82
-          status: 1,
83
-        },
84
-      }, {
85
-        name: '柳依依',
86
-        id: '1',
87
-        cardAndCoupon: {
88
-          totalNum: '100',
89
-          usedNum: '35',
90
-          status: 1,
91
-        },
92
-        drink: {
93
-          totalNum: '100',
94
-          usedNum: '68',
95
-          status: 1,
96
-        },
97
-      }, {
98
-        name: '柳依依',
99
-        id: '1',
100
-        cardAndCoupon: {
101
-          totalNum: '100',
102
-          usedNum: '35',
103
-          status: 1,
104
-        },
105
-        drink: {
106
-          totalNum: '100',
107
-          usedNum: '68',
108
-          status: 1,
109
-        },
110
-      }, {
111
-        name: '柳依依',
112
-        id: '1',
113
-        cardAndCoupon: {
114
-          totalNum: '100',
115
-          usedNum: '35',
116
-          status: 1,
117
-        },
118
-        drink: {
119
-          totalNum: '100',
120
-          usedNum: '68',
121
-          status: 1,
122
-        },
123
-      }],
35
+      list: []
124 36
     }
125 37
   },
126 38
   components: {
127 39
     topCaseInfo,
128
-    salesRecordItem,
40
+    salesRecordItem
41
+  },
42
+  computed: {
43
+    ...mapState({
44
+      userInfo: x => x.userCenter.userInfo,
45
+      CaseList: x => x.app.CaseList,
46
+      CaseTableList: x => x.placeOrderForCoffee.CaseTableList,
47
+    }),
48
+    ...mapCaseState({
49
+      caseTotal: x => x.caseTotal,
50
+    }),
51
+    ...mapForbidState({
52
+      salesList: x => x.salesList,
53
+      forbidList: x => x.forbidList,
54
+    }),
129 55
   },
130 56
   created () {
131
-
57
+    this.getCaseList().then((res) => {
58
+      this.topCaseInfoData.CaseName = res.cases[0].CaseName
59
+      this.topCaseInfoData.CaseId = res.cases[0].CaseId
60
+    })
61
+    this.init()
132 62
   },
133 63
   methods: {
64
+    ...actions([
65
+      'getCaseList',
66
+    ]),
67
+    ...mapCaseActions([
68
+      'getCaseTotal',
69
+    ]),
70
+    fibdata (item) {
71
+      const couponfib = this.forbidList.filter(x => x.UserId === item.UserId && x.ForbidType === 'coupon').length > 0 ? true : false
72
+      const orderfib = this.forbidList.filter(x => x.UserId === item.UserId && x.ForbidType === 'order').length > 0 ? true : false
73
+      return {
74
+        'coupon': couponfib,
75
+        'order': orderfib
76
+      }
77
+    },
78
+    showVanPicker () {
79
+      this.showSelect = true
80
+    },
81
+    selectCase (val) { // 选择案场
82
+      this.topCaseInfoData.CaseName = val.CaseName
83
+      this.topCaseInfoData.CaseId = val.CaseId
84
+      this.getCaseTableList({
85
+        caseid: this.topCaseInfoData.CaseId
86
+      })
87
+      this.showSelect = false
88
+    },
89
+    ...mapForbidActions(['getSales', 'getForbidList', 'putForbid', 'putForbidOpen']),
134 90
     triggerCardAndCoupon (val) { // 切换卡券状态 type='close':关闭;type='open':开启;
135 91
       console.log(val)
92
+      if (val.type === 'open') {
93
+        this.putForbid({ userid: val.data.UserId, type: 'coupon' })
94
+      } else {
95
+        this.putForbidOpen({ userid: val.data.UserId, type: 'coupon' })
96
+      }
97
+      this.init()
136 98
     },
137 99
     triggerDrink (val) { // 切换饮品状态 type='close':关闭;type='open':开启;
138 100
       console.log(val)
101
+      if (val.type === 'open') {
102
+        this.putForbid({ userid: val.data.UserId, type: 'order' })
103
+      } else {
104
+        this.putForbidOpen({ userid: val.data.UserId, type: 'order' })
105
+      }
106
+      this.init()
139 107
     },
108
+    toDetail (item) {
109
+      console.log(item)
110
+      this.$router.push({ name: 'salesGiveOutDetail', query: { id: item.UserId } })
111
+    },
112
+    init () {
113
+      this.getSales({ type: 'sales' }).then(() => {
114
+        this.getForbidList().then(() => {
115
+          this.list = []
116
+          for (let i = 0; i < this.salesList.length; i++) {
117
+            let CustomerCard = this.salesList[i].CustomerCard || []
118
+            let CustomerCoupon = this.salesList[i].CustomerCoupon || []
119
+            let OrdersDetail = this.salesList[i].OrdersDetail || []
120
+            let item = {
121
+              name: this.salesList[i].RealName,
122
+              id: i,
123
+              cardAndCoupon: {
124
+                totalNum: '100',
125
+                usedNum: CustomerCard.length + CustomerCoupon.length
126
+              },
127
+              drink: {
128
+                totalNum: '100',
129
+                usedNum: OrdersDetail.length
130
+              },
131
+              UserId: this.salesList[i].UserId
132
+            }
133
+            this.list.push(item)
134
+          }
135
+        })
136
+      })
137
+    }
140 138
   }
141 139
 }
142 140
 </script>

+ 3
- 1
src/pages/user/card/index.vue Näytä tiedosto

@@ -167,6 +167,8 @@ export default {
167 167
               this.data[this.active].hasPic = true
168 168
             }
169 169
           })
170
+        } else {
171
+          this.$refs.scroll.forceUpdate()
170 172
         }
171 173
       }
172 174
     },
@@ -174,7 +176,7 @@ export default {
174 176
       this.$router.push({ name: 'cardDetail', query: { CustomerGymId: item.CustomerGymId } })
175 177
     },
176 178
     toCouponsDetail () {
177
-      this.$router.push({ name: 'couponsDetail'})
179
+      this.$router.push({ name: 'couponsDetail' })
178 180
     }
179 181
   }
180 182
 }

+ 7
- 8
src/pages/user/mainPage/coffeeIndex/index.vue Näytä tiedosto

@@ -8,8 +8,8 @@
8 8
     </nav>
9 9
     <scroll ref='scroll' :isloading='isloading' class='wrapper' :data='data[navActive].list' :pullUpLoad='pullUpLoadObj' :startY='parseInt(startY)' @pullingUp='getList'>
10 10
       <div class="content">
11
-        <div>
12
-          <ul>
11
+        <!-- <div>
12
+          <ul> -->
13 13
             <li :hidden="navActive !== 0 && userInfo.customer.MapUser !== ''" class="placeOrder">
14 14
               <div class="topInfo flex-h" v-if="userInfo.customer.MapUser !== ''">
15 15
                 <div class="flex-item">
@@ -90,11 +90,11 @@
90 90
                   </van-checkbox>
91 91
                   <i class="iconfont icon-sousuo search-icon" @click="searchMask"></i>
92 92
                 </div>
93
-                <customerCard v-for="(item,index) in data[3].list" :key="index" :data='item' @share='share'></customerCard>
93
+                <customerCard v-for="(item,index) in data[3].list" :key="index" :data='item' @remark='remark' @history='history' @record='record'></customerCard>
94 94
               </div>
95 95
             </li>
96
-          </ul>
97
-        </div>
96
+          <!-- </ul>
97
+        </div> -->
98 98
       </div>
99 99
     </scroll>
100 100
     <div class="selectCase" :hidden="!showSelect"></div>
@@ -364,7 +364,6 @@ export default {
364 364
     },
365 365
     cutNav (index) { // 切换nav
366 366
       this.navActive = index
367
-      console.log(this.navActive)
368 367
       // this.getList('change')
369 368
     },
370 369
     getList (param) {
@@ -372,9 +371,9 @@ export default {
372 371
         return
373 372
       } else {
374 373
         if (param === 'change') {
375
-          this.data[this.active].page = 0
374
+          this.data[this.navActive].page = 0
376 375
         }
377
-        if (this.data[this.active].hasMore) {
376
+        if (this.data[this.navActive].hasMore) {
378 377
           // this.getgymCardList({ page: this.data[this.active].page, pageSize: this.data[this.active].pageSize }).then((res) => {
379 378
           //   this.data[this.active].list = this.data[this.active].list.concat(this.gymCardList)
380 379
           //   this.data[this.active].page++

+ 14
- 14
src/pages/user/mainPage/coffeeIndex/page.scss Näytä tiedosto

@@ -32,18 +32,18 @@
32 32
     }
33 33
   }
34 34
   .content{
35
-    &>div{
36
-      width: 100%;
37
-      position: absolute;
38
-      left: 0;
39
-      top: 0;
40
-      bottom: 0;
41
-      overflow: hidden;
42
-      &>ul{
43
-        width: 100%;
44
-        height: 100%;
45
-        position: relative;
46
-        overflow: hidden;
35
+    // &>div{
36
+    //   width: 100%;
37
+    //   position: absolute;
38
+    //   left: 0;
39
+    //   top: 0;
40
+    //   bottom: 0;
41
+    //   overflow: hidden;
42
+    //   &>ul{
43
+    //     width: 100%;
44
+    //     height: 100%;
45
+    //     position: relative;
46
+    //     overflow: hidden;
47 47
         &>li{
48 48
           width: 100%;
49 49
           height: 100%;
@@ -179,8 +179,8 @@
179 179
             }
180 180
           }
181 181
         }
182
-      }
183
-    }
182
+    //   }
183
+    // }
184 184
   }
185 185
   .selectCase{
186 186
     width: 100%;

+ 24
- 18
src/pages/user/router.js Näytä tiedosto

@@ -20,6 +20,7 @@ import coupons from './coupons/index' // 优惠券
20 20
 import lessonDetail from './lessonDetail/index' // 课程详情
21 21
 import cardDetail from './cardDetail/index' // 体验卡详情
22 22
 import couponsDetail from './couponsDetail/index' // 体验券详情
23
+import share from './share/index' // 卡券分享页面
23 24
 
24 25
 Vue.use(Router)
25 26
 
@@ -33,92 +34,97 @@ const router = new Router({
33 34
       name: 'indexPage',
34 35
       component: indexPage,
35 36
       children: []
36
-    },{ // 城咖啡
37
+    }, { // 城咖啡
37 38
       path: 'coffeeIndex',
38 39
       name: 'coffeeIndex',
39 40
       component: coffeeIndex,
40 41
       children: []
41
-    },{ // 个人中心
42
+    }, { // 个人中心
42 43
       path: 'userCenter',
43 44
       name: 'userCenter',
44 45
       component: userCenter,
45 46
       children: []
46 47
     }]
47
-  },{ // 城咖啡-点单
48
+  }, { // 城咖啡-点单
48 49
     path: '/placeOrder',
49 50
     name: 'placeOrder',
50 51
     component: placeOrder,
51 52
     children: []
52
-  },{ // 城咖啡-点单详情
53
+  }, { // 城咖啡-点单详情
53 54
     path: '/placeOrderDetail',
54 55
     name: 'placeOrderDetail',
55 56
     component: placeOrderDetail,
56 57
     children: []
57
-  },{ // 城咖啡-点单列表
58
+  }, { // 城咖啡-点单列表
58 59
     path: '/orderList',
59 60
     name: 'orderList',
60 61
     component: orderList,
61 62
     children: []
62
-  },{ // 项目专题
63
+  }, { // 项目专题
63 64
     path: '/majorProjects',
64 65
     name: 'majorProjects',
65 66
     component: majorProjects,
66 67
     children: []
67
-  },{ // 项目专题详情
68
+  }, { // 项目专题详情
68 69
     path: '/majorProjectsDetail',
69 70
     name: 'majorProjectsDetail',
70 71
     component: majorProjectsDetail,
71 72
     children: []
72
-  },{ // 购买课程下单
73
+  }, { // 购买课程下单
73 74
     path: '/placeOrderForCourse',
74 75
     name: 'placeOrderForCourse',
75 76
     component: placeOrderForCourse,
76 77
     children: []
77
-  },{ // 5A
78
+  }, { // 5A
78 79
     path: '/fiveA',
79 80
     name: 'fiveA',
80 81
     component: fiveA,
81 82
     children: []
82
-  },{ // 绑定手机号
83
+  }, { // 绑定手机号
83 84
     path: '/bindMobile',
84 85
     name: 'bindMobile',
85 86
     component: bindMobile,
86 87
     children: []
87
-  },{ // 我的订单
88
+  }, { // 我的订单
88 89
     path: '/lessonOrder',
89 90
     name: 'lessonOrder',
90 91
     component: lessonOrder,
91 92
     children: []
92
-  },{ // vip卡说明
93
+  }, { // vip卡说明
93 94
     path: '/vip',
94 95
     name: 'vip',
95 96
     component: vip,
96 97
     children: []
97
-  },{ // 卡
98
+  }, { // 卡
98 99
     path: '/card',
99 100
     name: 'card',
100 101
     component: card,
101 102
     children: []
102
-  },{ // 优惠券
103
+  }, { // 优惠券
103 104
     path: '/coupons',
104 105
     name: 'coupons',
105 106
     component: coupons,
106 107
     children: []
107
-  },{ // 课程详情
108
+  }, { // 课程详情
108 109
     path: '/lessonDetail',
109 110
     name: 'lessonDetail',
110 111
     component: lessonDetail,
111 112
     children: []
112
-  },{ // 体验卡详情
113
+  }, { // 体验卡详情
113 114
     path: '/cardDetail',
114 115
     name: 'cardDetail',
115 116
     component: cardDetail,
116 117
     children: []
117
-  },{ // 体验券详情
118
+  }, { // 体验券详情
118 119
     path: '/couponsDetail',
119 120
     name: 'couponsDetail',
120 121
     component: couponsDetail,
121 122
     children: []
123
+  }, { // 卡券分享
124
+    path: '/share',
125
+    name: 'share',
126
+    component: share,
127
+    children: []
122 128
   }],
123 129
   linkActiveClass: 'active',
124 130
 })
@@ -126,7 +132,7 @@ const router = new Router({
126 132
 router.beforeEach((to, from, next) => {
127 133
   // console.log(to)
128 134
   // if(){
129
-    
135
+
130 136
   // }
131 137
   next()
132 138
 })

+ 39
- 0
src/pages/user/share/index.vue Näytä tiedosto

@@ -0,0 +1,39 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <div class="banner">
4
+      <img src="" alt="" width="100%" height="100%">
5
+    </div>
6
+    <div class="content">
7
+      <div class="title">彻天彻地童玩探险乐园家庭套餐</div>
8
+      <div class="text">
9
+        <div>
10
+          <i class="icon-shuoming iconfont"></i>
11
+          <span>卡券使用说明</span>
12
+        </div>
13
+        <pre>工作工作工作工作工作工作工作工作工作给</pre>
14
+      </div>
15
+      <div class="text">
16
+        <div>
17
+          <i class="icon-shuoming iconfont"></i>
18
+          <span>卡券使用说明</span>
19
+        </div>
20
+        <pre>工作工作工作工作工作工作工作工作工作给</pre>
21
+      </div>
22
+      <div class="submit">确认领取</div>
23
+    </div>
24
+  </div>
25
+</template>
26
+
27
+<script>
28
+export default {
29
+  data () {
30
+    return {
31
+
32
+    }
33
+  }
34
+}
35
+</script>
36
+
37
+<style lang="scss" scoped>
38
+@import 'page.scss';
39
+</style>

+ 37
- 0
src/pages/user/share/page.scss Näytä tiedosto

@@ -0,0 +1,37 @@
1
+.mainPage{
2
+  .banner{
3
+    width: 100%;
4
+    height: 1.8rem;
5
+  }
6
+  .content{
7
+    padding: .2rem;
8
+    box-sizing: border-box;
9
+    .title{
10
+      font-size: .18rem;
11
+      padding-bottom: .2rem;
12
+    }
13
+    .text{
14
+      padding-bottom: .2rem;
15
+      >div:nth-of-type(1){
16
+        display: flex;
17
+        align-items: center;
18
+        padding-bottom: .1rem;
19
+        i,span{
20
+          color: rgba(168,182,200,1);
21
+        }
22
+      }
23
+      pre{
24
+        color: #323232;
25
+      }
26
+    }
27
+    .submit{
28
+      height: .46rem;
29
+      background: rgba(252,98,67,1);
30
+      border-radius: .25rem;
31
+      text-align: center;
32
+      line-height: .46rem;
33
+      font-size: .16rem;
34
+      color: #fff;
35
+    }
36
+  }
37
+}

+ 95
- 0
src/store/forbid/index.js Näytä tiedosto

@@ -0,0 +1,95 @@
1
+import Ajax from '../../util/ajax'
2
+import api from '../../util/api'
3
+
4
+// 请求数据
5
+export default {
6
+  namespaced: true,
7
+  state: {
8
+    salesList: [],
9
+    forbidList: [],
10
+    salesCardList: []
11
+  },
12
+  mutations: {
13
+    setSalesList (state, data) {
14
+      state.salesList = data || []
15
+    },
16
+    setForbidList (state, data) {
17
+      state.forbidList = data || []
18
+    },
19
+    setSalesCardList (state, data) {
20
+      state.salesCardList = data || []
21
+    }
22
+  },
23
+  actions: {
24
+    getSales (context, data) {
25
+      return new Promise((resolve, reject) => {
26
+        Ajax(api.director.getSales.url, {
27
+          method: api.director.getSales.method,
28
+          urlData: {
29
+            type: data.type
30
+          }
31
+        }).then(res => {
32
+          context.commit('setSalesList', res)
33
+          resolve(res)
34
+        }).catch((err) => {
35
+          reject(err)
36
+        })
37
+      })
38
+    },
39
+    getForbidList (context) {
40
+      return new Promise((resolve, reject) => {
41
+        Ajax(api.director.getForbidList.url, {
42
+          method: api.director.getForbidList.method
43
+        }).then(res => {
44
+          context.commit('setForbidList', res)
45
+          resolve(res)
46
+        }).catch((err) => {
47
+          reject(err)
48
+        })
49
+      })
50
+    },
51
+    putForbid (context, data) {
52
+      return new Promise((resolve, reject) => {
53
+        Ajax(api.director.putForbid.url, {
54
+          method: api.director.putForbid.method,
55
+          urlData: {
56
+            ...data
57
+          }
58
+        }).then(res => {
59
+          resolve(res)
60
+        }).catch((err) => {
61
+          reject(err)
62
+        })
63
+      })
64
+    },
65
+    putForbidOpen (context, data) {
66
+      return new Promise((resolve, reject) => {
67
+        Ajax(api.director.putForbidOpen.url, {
68
+          method: api.director.putForbidOpen.method,
69
+          urlData: {
70
+            ...data
71
+          }
72
+        }).then(res => {
73
+          resolve(res)
74
+        }).catch((err) => {
75
+          reject(err)
76
+        })
77
+      })
78
+    },
79
+    getSalesCardList (context, data) {
80
+      return new Promise((resolve, reject) => {
81
+        Ajax(api.director.getSalesCardList.url, {
82
+          method: api.director.getSalesCardList.method,
83
+          urlData: {
84
+            ...data
85
+          }
86
+        }).then(res => {
87
+          context.commit('setForbidList', res)
88
+          resolve(res)
89
+        }).catch((err) => {
90
+          reject(err)
91
+        })
92
+      })
93
+    }
94
+  }
95
+}

+ 2
- 1
src/store/index.js Näytä tiedosto

@@ -21,7 +21,8 @@ export const modules = {
21 21
   login: () => require('./login/login').default,
22 22
   myCustomer: () => require('./myCustomer/index').default,
23 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 26
 }
26 27
 
27 28
 Object.keys(modules).forEach((modKey) => {

+ 8
- 4
src/util/ajax.js Näytä tiedosto

@@ -3,7 +3,7 @@ import qs from 'qs'
3 3
 import toolClass from './util'
4 4
 import router from '../pages/user/router'
5 5
 import { Toast } from '../../node_modules/vant';
6
-
6
+var JWT = localStorage.getItem('JWT')
7 7
 const Axios = axios.create({
8 8
   timeout: 60000,
9 9
   responseType: 'json',
@@ -11,7 +11,8 @@ const Axios = axios.create({
11 11
   queryData: {},
12 12
   urlData: {},
13 13
   headers: {
14
-    'Content-Type': 'multipart/form-data'
14
+    'Content-Type': 'multipart/form-data',
15
+    'authorization': JWT
15 16
   }
16 17
 })
17 18
 
@@ -48,8 +49,11 @@ Axios.interceptors.request.use((config) => {
48 49
 
49 50
 const ajax = (...args) => {
50 51
   return new Promise((resolve, reject) => {
51
-    Axios(...args).then(({ data }) => {
52
-      // console.log(111)
52
+    Axios(...args).then(({ data, headers }) => {
53
+      if (headers.authorization) {
54
+        localStorage.setItem('JWT', headers.authorization)
55
+        JWT = headers.authorization
56
+      }
53 57
       const { code, message, result } = data
54 58
       if (code === 200) {
55 59
         resolve(result)

+ 24
- 2
src/util/api.js Näytä tiedosto

@@ -63,8 +63,8 @@ const $api = {
63 63
       url: `${baseUrl}${wechat}/order/course`
64 64
     },
65 65
   },
66
-  card:{
67
-    myCustomer:{ // 我的客户
66
+  card: {
67
+    myCustomer: { // 我的客户
68 68
       method: 'get',
69 69
       url: `${baseUrl}${wechat}/customer/user`
70 70
     }
@@ -111,6 +111,28 @@ const $api = {
111 111
       url: `${baseUrl}${wechat}/gymcard/:customerGymId`
112 112
     },
113 113
   },
114
+  director: {
115
+    getSales: { // 获取销售列表
116
+      method: 'get',
117
+      url: `${baseUrl}${wechat}/user/:type`
118
+    },
119
+    getForbidList: { // 获取禁用列表
120
+      method: 'get',
121
+      url: `${baseUrl}${wechat}/user/forbid`
122
+    },
123
+    putForbidOpen: { // 打开禁用状态
124
+      method: 'post',
125
+      url: `${baseUrl}${wechat}/user/forbid/:userid/:type`
126
+    },
127
+    putForbid:{ // 关闭禁用状态
128
+      method: 'put',
129
+      url: `${baseUrl}${wechat}/user/forbid/:userid/:type`
130
+    },
131
+    getSalesCardList: {
132
+      method: 'get',
133
+      url: `${baseUrl}${wechat}/user/detail/:id`
134
+    }
135
+  },
114 136
   login: { // 主管、销售端登陆
115 137
     login: {
116 138
       method: 'post',