许成详 6 years ago
parent
commit
c1fca59b8a

+ 6
- 0
package-lock.json View File

@@ -13386,6 +13386,12 @@
13386 13386
       "integrity": "sha1-XS/yKXcAPsaHpLhwc9+7rBRszyk=",
13387 13387
       "dev": true
13388 13388
     },
13389
+    "weixin-js-sdk": {
13390
+      "version": "1.3.3",
13391
+      "resolved": "https://registry.npmjs.org/weixin-js-sdk/-/weixin-js-sdk-1.3.3.tgz",
13392
+      "integrity": "sha512-1ofMi7Q1ioXV8/V8tGv3DrU7pugmyvhN86Pxbj1WaGeIEs/+yz0Jdv/5L+ocuDh/JAbKmtvMvBXh0OyuP6kQ8A==",
13393
+      "dev": true
13394
+    },
13389 13395
     "which": {
13390 13396
       "version": "1.3.1",
13391 13397
       "resolved": "http://registry.npm.taobao.org/which/download/which-1.3.1.tgz",

+ 3
- 14
src/components/customerCard/customerCard.vue View File

@@ -2,21 +2,16 @@
2 2
   <div class="card-content">
3 3
     <div class="card-top flex-h">
4 4
       <div class="flex-h">
5
-        <img :src="inv" alt="">
5
+        <img :src="data.Headimgurl" alt="">
6 6
         <div>
7
-          <span>姓名:王丽丽</span>
8
-          <span>手机号:17372957078</span>
7
+          <span>姓名:{{data.Name}}</span>
8
+          <span>手机号:{{data.Phone}}</span>
9 9
         </div>
10 10
       </div>
11 11
       <div>
12 12
         <div @click="record">领取记录</div>
13
-        <div @click="history">历史备注</div>
14 13
       </div>
15 14
     </div>
16
-    <div class="card-bottom">
17
-      <span>备注:老客户,人非常好。</span>
18
-      <span @click="remark">+ 添加备注</span>
19
-    </div>
20 15
   </div>
21 16
 </template>
22 17
 
@@ -36,15 +31,9 @@ export default {
36 31
     }
37 32
   },
38 33
   methods: {
39
-    remark () {
40
-      this.$emit('remark', this.data)
41
-    },
42 34
     record () {
43 35
       this.$emit('record', this.data)
44 36
     },
45
-    history () {
46
-      this.$emit('history', this.data)
47
-    }
48 37
   }
49 38
 }
50 39
 </script>

+ 35
- 45
src/pages/sales/customerSearch/index.vue View File

@@ -1,11 +1,14 @@
1 1
 <template>
2 2
   <div class="mainPage flex-v">
3
+    <div class="top">
4
+      <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer !== undefined ? userInfo.customer.CustomerName : ''"></topCaseInfo>
5
+    </div>
3 6
     <div class="content flex-item">
4 7
       <div>
5 8
         <ul>
6 9
           <li class="customer-card">
7 10
             <div class="list-box">
8
-              <customerCard v-for="(item,index) in cardList" :key="index" :data='item' @remark='remark' @record='record' @history='history'></customerCard>
11
+              <customerCard v-for="(item,index) in cardList" :key="index" :data='item' @record='record'></customerCard>
9 12
             </div>
10 13
           </li>
11 14
         </ul>
@@ -19,18 +22,6 @@
19 22
       </div>
20 23
       <div class="mask-bottom"></div>
21 24
     </div>
22
-    <van-dialog
23
-      v-model="showDialog"
24
-      show-cancel-button
25
-      title='添加备注'
26
-      :before-close="beforeClose">
27
-      <van-field
28
-        v-model="message"
29
-        type="textarea"
30
-        placeholder="请输入备注"
31
-        rows="3"
32
-        autosize/>
33
-    </van-dialog>
34 25
   </div>
35 26
 </template>
36 27
 
@@ -38,34 +29,29 @@
38 29
 import customerCard from '../../../components/customerCard/customerCard'
39 30
 import active from '../../../common/icon/check-box-checked.png'
40 31
 import normal from '../../../common/icon/check-box-empty.png'
32
+import topCaseInfo from '../../../components/topCaseInfo/index'
41 33
 import { mapState, createNamespacedHelpers } from 'vuex'
42 34
 const { mapActions: actions } = createNamespacedHelpers('app')
43 35
 const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
44 36
 const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
37
+const { mapActions: mapUserCenterActions } = createNamespacedHelpers('userCenter')
45 38
 
46 39
 export default {
47 40
   name: '',
48 41
   data () {
49 42
     return {
43
+      topCaseInfoData: {
44
+        CaseName: '',
45
+        CaseId: '',
46
+        ShowSelect: false,
47
+      },
50 48
       icon: {
51 49
         active: active,
52 50
         normal: normal
53 51
       },
54
-      showDialog: false,
55 52
       mask: true,
56 53
       checked: true,
57
-      cardList: [
58
-        {
59
-          invalid: true
60
-        },
61
-        {
62
-          invalid: false
63
-        },
64
-        {
65
-          invalid: false
66
-        }
67
-      ],
68
-      message: ''
54
+      cardList: [],
69 55
     }
70 56
   },
71 57
   computed: {
@@ -79,10 +65,19 @@ export default {
79 65
     })
80 66
   },
81 67
   components: {
82
-    customerCard
68
+    customerCard,
69
+    topCaseInfo,
70
+  },
71
+  created () {
72
+    this.getCaseList().then((res) => {
73
+      this.topCaseInfoData.CaseName = res.cases[0].CaseName
74
+      this.topCaseInfoData.CaseId = res.cases[0].CaseId
75
+    })
83 76
   },
84
-  created () { },
85 77
   methods: {
78
+    ...mapUserCenterActions([
79
+      'getCustomerList',
80
+    ]),
86 81
     ...actions([
87 82
       'getCaseList',
88 83
     ]),
@@ -92,28 +87,23 @@ export default {
92 87
     ...mapCaseActions([
93 88
       'getCaseTotal',
94 89
     ]),
95
-    remark (item) {
96
-      console.log(item)
97
-      this.showDialog = true
98
-    },
99
-    history (item) {
100
-      console.log(item)
101
-      this.$router.push({ name: 'history' })
102
-    },
103 90
     record (item) {
104
-      console.log(item)
91
+      // console.log(item)
105 92
       this.$router.push({ name: 'getRecord' })
106 93
     },
107 94
     searchMask () {
108
-      this.mask = false
95
+      this.getCustomerList({
96
+        page: 1,
97
+        pagesize: 10000,
98
+        isrecommend: false
99
+      }).then((res) => {
100
+        // console.log(JSON.stringify(res))
101
+        for (var n = 0; n < res.length; n++) {
102
+          this.cardList.push({...res[n], invalid: false})
103
+        }
104
+        this.mask = false
105
+      })
109 106
     },
110
-    beforeClose (action, done) {
111
-      if (action === 'confirm') {
112
-        setTimeout(done, 1000)
113
-      } else {
114
-        done()
115
-      }
116
-    }
117 107
   }
118 108
 }
119 109
 </script>

+ 2
- 2
src/pages/user/App.vue View File

@@ -12,7 +12,7 @@ export default {
12 12
   name: 'app',
13 13
   data () {
14 14
     return {
15
-      showPage: true
15
+      showPage: false
16 16
     }
17 17
   },
18 18
   components: {},
@@ -23,7 +23,7 @@ export default {
23 23
     })
24 24
   },
25 25
   created () {
26
-    console.log('creatde')
26
+    // console.log('creatde')
27 27
     if (location.search && this.toolClass.UrlSearch(location.search).code) {
28 28
       this.code = this.toolClass.UrlSearch(location.search).code
29 29
     } else {

+ 89
- 65
src/pages/user/mainPage/coffeeIndex/index.vue View File

@@ -65,8 +65,7 @@
65 65
                   <div class="flex-item">
66 66
                     <div>
67 67
                       <span>卡券货值总额:</span>
68
-                      <span>¥1000</span>
69
-                      <span>万</span>
68
+                      <span>¥{{couponTotalCount}}</span>
70 69
                     </div>
71 70
                   </div>
72 71
                   <a @click="toSalesHistory">销售记录</a>
@@ -77,19 +76,19 @@
77 76
             <li :hidden="navActive !== 3" class="customer-card">
78 77
               <div class="list-box">
79 78
                 <div class="search-bar flex-h">
80
-                  <span>共15位客户</span>
81
-                  <van-checkbox v-model="checked">
82
-                    我推荐的客户(8人)
79
+                  <span>共{{this.data[3].list.length}}位客户</span>
80
+                  <van-checkbox v-model="postCustomerData.isrecommend">
81
+                    我推荐的客户({{myRecommendUserList.length}}人)
83 82
                     <img
84 83
                       slot="icon"
85 84
                       slot-scope="props"
86
-                      :src="props.checked ? icon.active : icon.normal"
85
+                      :src="postCustomerData.isrecommend ? icon.active : icon.normal"
87 86
                       style="width:.2rem;height:.2rem;bottom: .02rem;position: relative;"
88 87
                     >
89 88
                   </van-checkbox>
90 89
                   <i class="iconfont icon-sousuo search-icon" @click="searchMask"></i>
91 90
                 </div>
92
-                <customerCard v-for="(item,index) in data[3].list" :key="index" :data='item' @remark='remark' @history='history' @record='record'></customerCard>
91
+                <customerCard v-for="(item,index) in postCustomerData.isrecommend ? myRecommendUserList : data[3].list" :key="index" :data='item' @record='record'></customerCard>
93 92
               </div>
94 93
             </li>
95 94
           <!-- </ul>
@@ -132,7 +131,6 @@ import { mapState, createNamespacedHelpers } from 'vuex'
132 131
 const { mapActions: actions } = createNamespacedHelpers('app')
133 132
 const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
134 133
 const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
135
-const { mapState: mapCustomerState, mapActions: mapCustomerActions } = createNamespacedHelpers('myCustomer')
136 134
 const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('myCard')
137 135
 const { mapActions: mapUserCenterActions } = createNamespacedHelpers('userCenter')
138 136
 
@@ -140,14 +138,22 @@ export default {
140 138
   name: '',
141 139
   data () {
142 140
     return {
141
+      myRecommendUserList: [],
142
+      forbidList: [],
143
+      postCustomerData: {
144
+        page: 1,
145
+        pagesize: 10000,
146
+        isrecommend: false,
147
+      },
148
+      couponTotalCount: 0,
143 149
       cardTotalCount: 0,
144 150
       postCouponData: {
145 151
         page: 1,
146
-        pageSize: 10
152
+        pageSize: 10000
147 153
       },
148 154
       postCardData: {
149 155
         page: 1,
150
-        pageSize: 10
156
+        pageSize: 10000
151 157
       },
152 158
       pullUpLoad: true,
153 159
       pullUpLoadThreshold: 40,
@@ -160,7 +166,6 @@ export default {
160 166
       active,
161 167
       normal,
162 168
       navActive: 0,
163
-      checked: true,
164 169
       showDialog: false,
165 170
       message: '',
166 171
       cutNavList: [{
@@ -245,9 +250,6 @@ export default {
245 250
     ...mapCaseState({
246 251
       caseTotal: x => x.caseTotal,
247 252
     }),
248
-    ...mapCustomerState({
249
-      customerList: x => x.customerList
250
-    }),
251 253
     ...mapCardState({
252 254
       cardList: x => x.cardList
253 255
     })
@@ -262,36 +264,64 @@ export default {
262 264
   created () {
263 265
     if (this.userInfo.customer.MapUser !== '') {
264 266
       this.getForbidInfo().then((res) => {
265
-        console.log(JSON.stringify(res))
266
-      })
267
-      this.getMyCouponList({
268
-        ...this.postCouponData
269
-      }).then((res) => {
270
-        console.log(JSON.stringify(res))
271
-      })
272
-      this.getMyCardList({
273
-        ...this.postCardData
274
-      }).then((res) => {
275
-        console.log(JSON.stringify(res))
276
-        res.list = res.list || []
277
-        for (var n = 0; n < res.list.length; n++) {
278
-          this.data[1].list.push({
279
-            invalid: this.returnInvalid(res.list[n]),
280
-            price: res.list[n].Price,
281
-            title: res.list[n].CardName,
282
-            desc: res.list[n].Share.CardUseRule,
283
-            startDate: this.toolClass.dateFormat(res.list[n].StartDate),
284
-            endDate: this.toolClass.dateFormat(res.list[n].EndDate),
285
-            totalCount: res.list[n].TotalCount,
286
-            SentCount: res.list[n].SentCount,
287
-            usedCount: res.list[n].UsedCount,
288
-          })
289
-        }
290
-        var count = 0
291
-        for (var n = 0; n < this.data[1].list.length; n++) {
292
-          count += this.data[1].list[n].price * this.data[1].list[n].totalCount - 0
293
-        }
294
-        this.cardTotalCount = count.toFixed(2)
267
+        this.forbidList = res || []
268
+        this.getCustomerList({
269
+          ...this.postCustomerData
270
+        }).then((res) => {
271
+          // console.log(JSON.stringify(res))
272
+          for (var n = 0; n < res.length; n++) {
273
+            if (res[n].RecommendId === this.userInfo.customer.MapUser) {
274
+              this.myRecommendUserList.push(res[n])
275
+            }
276
+            this.data[3].list.push(res[n])
277
+          }
278
+        })
279
+        this.getMyCouponList({
280
+          ...this.postCouponData
281
+        }).then((res) => {
282
+          res.list = res.list || []
283
+          for (var n = 0; n < res.list.length; n++) {
284
+            this.data[2].list.push({
285
+              invalid: this.returnInvalid(res.list[n], 'coupon'),
286
+              price: res.list[n].Price,
287
+              title: res.list[n].CouponName,
288
+              desc: res.list[n].Share.UseRule,
289
+              startDate: this.toolClass.dateFormat(res.list[n].StartDate),
290
+              endDate: this.toolClass.dateFormat(res.list[n].EndDate),
291
+              totalCount: res.list[n].TotalCount,
292
+              SentCount: res.list[n].SentCount,
293
+              usedCount: res.list[n].UsedCount,
294
+            })
295
+          }
296
+          var count = 0
297
+          for (var n = 0; n < this.data[2].list.length; n++) {
298
+            count += this.data[2].list[n].price * this.data[2].list[n].totalCount - 0
299
+          }
300
+          this.couponTotalCount = count.toFixed(2)
301
+        })
302
+        this.getMyCardList({
303
+          ...this.postCardData
304
+        }).then((res) => {
305
+          res.list = res.list || []
306
+          for (var n = 0; n < res.list.length; n++) {
307
+            this.data[1].list.push({
308
+              invalid: this.returnInvalid(res.list[n], 'card'),
309
+              price: res.list[n].Price,
310
+              title: res.list[n].CardName,
311
+              desc: res.list[n].Share.CardUseRule,
312
+              startDate: this.toolClass.dateFormat(res.list[n].StartDate),
313
+              endDate: this.toolClass.dateFormat(res.list[n].EndDate),
314
+              totalCount: res.list[n].TotalCount,
315
+              SentCount: res.list[n].SentCount,
316
+              usedCount: res.list[n].UsedCount,
317
+            })
318
+          }
319
+          var count = 0
320
+          for (var n = 0; n < this.data[1].list.length; n++) {
321
+            count += this.data[1].list[n].price * this.data[1].list[n].totalCount - 0
322
+          }
323
+          this.cardTotalCount = count.toFixed(2)
324
+        })
295 325
       })
296 326
     }
297 327
     this.getCaseList().then((res) => {
@@ -303,9 +333,6 @@ export default {
303 333
       this.getCaseTotal({
304 334
         caseid: this.topCaseInfoData.CaseId
305 335
       })
306
-      this.getCustomerList().then(() => {
307
-
308
-      })
309 336
     })
310 337
   },
311 338
   methods: {
@@ -313,6 +340,7 @@ export default {
313 340
       'getMyCardList',
314 341
       'getMyCouponList',
315 342
       'getForbidInfo',
343
+      'getCustomerList',
316 344
     ]),
317 345
     ...actions([
318 346
       'getCaseList',
@@ -323,13 +351,19 @@ export default {
323 351
     ...mapCaseActions([
324 352
       'getCaseTotal',
325 353
     ]),
326
-    ...mapCustomerActions(['getCustomerList']),
327 354
     ...mapCardActions(['getCardList']),
328
-    returnInvalid (item) {
355
+    returnInvalid (item, type) {
356
+      for (var n = 0; n < this.forbidList.length; n++) {
357
+        if (this.forbidList[n].UserId === this.userInfo.customer.CustomerId && this.forbidList[n].ForbidType === type) {
358
+          return true
359
+        }
360
+      }
361
+      if (item.TotalCount - 0 === item.SentCount - 0 + item.UsedCount - 0 || new Date(item.EndDate).getTime() < Date.now()) {
362
+        return true
363
+      }
329 364
       return false
330 365
     },
331 366
     toSalesHistory () {
332
-      //console.log(this.getUrl('salesRecord'))
333 367
       window.location.href = this.getUrl('salesRecord')
334 368
     },
335 369
     getUrl (val) {
@@ -359,33 +393,23 @@ export default {
359 393
           this.data[this.navActive].page = 0
360 394
         }
361 395
         if (this.data[this.navActive].hasMore) {
362
-          // this.getgymCardList({ page: this.data[this.active].page, pageSize: this.data[this.active].pageSize }).then((res) => {
363
-          //   this.data[this.active].list = this.data[this.active].list.concat(this.gymCardList)
364
-          //   this.data[this.active].page++
365
-          //   if (this.gymCardList.length < this.data[this.active].pageSize) {
366
-          //     this.data[this.active].hasMore = false
367
-          //   }
368
-          //   if (this.data[this.active].list.length <= 0) {
369
-          //     this.data[this.active].hasPic = true
370
-          //   }
371
-          // })
372 396
         }
373 397
       }
374 398
     },
375 399
     share (item) {
376
-      console.log(item)
400
+      // console.log(item)
377 401
     },
378 402
     remark (item) {
379
-      console.log(item)
403
+      // console.log(item)
380 404
       this.showDialog = true
381 405
     },
382 406
     history (item) {
383
-      console.log(item)
407
+      // console.log(item)
384 408
       window.location.href = this.getUrl('history')
385 409
     },
386 410
     record (item) {
387
-      console.log(item)
388
-      window.location.href = this.getUrl('getRecord')
411
+      // console.log(item)
412
+      window.location.href = this.getUrl('getRecord') + '?' + item
389 413
     },
390 414
     searchMask () {
391 415
       window.location.href = this.getUrl('customerSearch')

+ 13
- 3
src/store/userCenter/userCenter.js View File

@@ -17,7 +17,7 @@ http.getUserInfo = (data) => { // 获取用户信息
17 17
       method: api.user.info.method,
18 18
       queryData: queryData
19 19
     }).then(res => {
20
-      console.log(res)
20
+      // console.log(res)
21 21
       resolve(res)
22 22
     }).catch((err) => {
23 23
       reject(err)
@@ -41,7 +41,7 @@ http.getCaseInfo = (data) => { // 获取案场列表
41 41
 }
42 42
 
43 43
 http.getCaptcha = (data) => { // 获取验证码
44
-  console.log(data)
44
+  // console.log(data)
45 45
   return new Promise((resolve, reject) => {
46 46
     Ajax(api.user.captcha.url, {
47 47
       method: api.user.captcha.method,
@@ -57,7 +57,7 @@ http.getCaptcha = (data) => { // 获取验证码
57 57
 }
58 58
 
59 59
 http.submitData = (data) => { // 绑定手机号
60
-  console.log(data)
60
+  // console.log(data)
61 61
   return new Promise((resolve, reject) => {
62 62
     Ajax(api.user.wxsignup.url, {
63 63
       method: api.user.wxsignup.method,
@@ -101,6 +101,16 @@ export default {
101 101
     }
102 102
   },
103 103
   actions: {
104
+    getCustomerList (context, payload) { // 获取我的客户列表
105
+      return new Promise((resolve) => {
106
+        Ajax(api.sales.getCustomerList.url, {
107
+          method: api.sales.getCustomerList.method,
108
+          queryData: { ...payload }
109
+        }).then(res => {
110
+          resolve(res)
111
+        })
112
+      })
113
+    },
104 114
     getForbidInfo (context) { // 获取用户禁用信息
105 115
       return new Promise((resolve) => {
106 116
         Ajax(api.sales.getForbidInfo.url, {

+ 0
- 4
src/util/ajax.js View File

@@ -10,10 +10,6 @@ const token = function (headers) {
10 10
     localStorage.setItem('JWT', headers.authorization)
11 11
     JWT = headers.authorization
12 12
   }
13
-<<<<<<< HEAD
14
-  // console.log(JWT)
15
-=======
16
->>>>>>> b68369c08a5ea2596032788891e94d4f27c159f1
17 13
   return JWT ? JWT : localStorage.getItem('JWT')
18 14
 }
19 15
 

+ 4
- 11
src/util/api.js View File

@@ -148,17 +148,6 @@ const $api = {
148 148
       method: 'get',
149 149
       url: `${baseUrl}${wechat}/user/detail/:id`
150 150
     },
151
-<<<<<<< HEAD
152
-=======
153
-    getCardNum: { // 获取卡数量
154
-      method: 'get',
155
-      url: `${baseUrl}${wechat}/card/detail/:id`
156
-    },
157
-    getCouponNum: { // 获取券数量
158
-      method: 'get',
159
-      url: `${baseUrl}${wechat}/coupon/detail/:id`
160
-    }
161
->>>>>>> b68369c08a5ea2596032788891e94d4f27c159f1
162 151
   },
163 152
   sales: {
164 153
     getCardList: { // 获取我的卡列表
@@ -173,6 +162,10 @@ const $api = {
173 162
       method: 'get',
174 163
       url: `${baseUrl}${wechat}/user/forbid`
175 164
     },
165
+    getCustomerList: { // 获取客户列表
166
+      method: 'get',
167
+      url: `${baseUrl}${wechat}/customer/user`
168
+    },
176 169
   },
177 170
   login: { // 主管、销售端登陆
178 171
     login: {