许成详 6 years ago
parent
commit
fd59832068

+ 9
- 3
src/pages/sales/customerSearch/index.vue View File

9
           <li class="customer-card">
9
           <li class="customer-card">
10
             <div class="list-box">
10
             <div class="list-box">
11
               <customerCard v-for="(item,index) in cardList" :key="index" :data='item' @record='record'></customerCard>
11
               <customerCard v-for="(item,index) in cardList" :key="index" :data='item' @record='record'></customerCard>
12
+              <span class="noData" v-if="ajaxOff && !cardList.length">暂无数据</span>
12
             </div>
13
             </div>
13
           </li>
14
           </li>
14
         </ul>
15
         </ul>
16
     </div>
17
     </div>
17
     <div v-if="mask" class="search-mask">
18
     <div v-if="mask" class="search-mask">
18
       <div class="mask-top">
19
       <div class="mask-top">
19
-        <input type="text">
20
+        <input type="text" v-model="key">
20
         <i class="iconfont icon-sousuo search-icon"></i>
21
         <i class="iconfont icon-sousuo search-icon"></i>
21
         <span @click="searchMask">搜索</span>
22
         <span @click="searchMask">搜索</span>
22
       </div>
23
       </div>
49
         active: active,
50
         active: active,
50
         normal: normal
51
         normal: normal
51
       },
52
       },
53
+      ajaxOff: false,
54
+      key: '',
52
       mask: true,
55
       mask: true,
53
       checked: true,
56
       checked: true,
54
       cardList: [],
57
       cardList: [],
89
     ]),
92
     ]),
90
     record (item) {
93
     record (item) {
91
       // console.log(item)
94
       // console.log(item)
92
-      this.$router.push({ name: 'getRecord' })
95
+      this.$router.push({ name: 'getRecord', query: {name: item.Name, phone: item.Phone, id: item.CustomerId} })
93
     },
96
     },
94
     searchMask () {
97
     searchMask () {
95
       this.getCustomerList({
98
       this.getCustomerList({
96
         page: 1,
99
         page: 1,
97
         pagesize: 10000,
100
         pagesize: 10000,
98
-        isrecommend: false
101
+        isrecommend: false,
102
+        key: this.key,
99
       }).then((res) => {
103
       }).then((res) => {
100
         // console.log(JSON.stringify(res))
104
         // console.log(JSON.stringify(res))
105
+        res = res || []
101
         for (var n = 0; n < res.length; n++) {
106
         for (var n = 0; n < res.length; n++) {
102
           this.cardList.push({...res[n], invalid: false})
107
           this.cardList.push({...res[n], invalid: false})
103
         }
108
         }
104
         this.mask = false
109
         this.mask = false
110
+        this.ajaxOff = true
105
       })
111
       })
106
     },
112
     },
107
   }
113
   }

+ 7
- 0
src/pages/sales/customerSearch/page.scss View File

106
       }
106
       }
107
     }
107
     }
108
   }
108
   }
109
+  .noData{
110
+    width: 100%;
111
+    display: block;
112
+    text-align: center;
113
+    color: #666;
114
+    line-height: .4rem;
115
+  }
109
 }
116
 }

+ 99
- 18
src/pages/sales/getRecord/index.vue View File

1
 <template>
1
 <template>
2
   <div class="mainPage flex-v">
2
   <div class="mainPage flex-v">
3
     <div class="top">
3
     <div class="top">
4
-      <topCaseInfo :data="topCaseInfoData" @selectCase="showSelect = true"></topCaseInfo>
4
+      <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer !== undefined ? userInfo.customer.CustomerName : ''" @selectCase="showSelect = true"></topCaseInfo>
5
     </div>
5
     </div>
6
     <div class="info">
6
     <div class="info">
7
-      <span><em>姓名</em>:顶顶顶</span>
8
-      <span><em>手机号</em>:13888888888</span>
7
+      <span><em>姓名:</em>{{user.name}}</span>
8
+      <span><em>手机号:</em>{{user.phone}}</span>
9
     </div>
9
     </div>
10
-    <div class="list-title">
11
-      <span>名称</span>
12
-      <span>领取时间</span>
13
-      <span>记录</span>
14
-    </div>
15
-    <div class="list-detail" v-for="(item,index) in list" :key="index">
16
-      <span>瑜伽体验卡lkjfklskd</span>
17
-      <span>06-27 12:20</span>
18
-      <span>已使用</span>
10
+    <div class="flex-item flex-v">
11
+      <ul class="flex-h">
12
+        <li class="flex-item" :class="{'active': activeIndex === 0}" @click="cutNav(0)">卡记录</li>
13
+        <li class="flex-item" :class="{'active': activeIndex === 1}" @click="cutNav(1)">券记录</li>
14
+      </ul>
15
+      <div class="flex-item flex-v">
16
+        <div class="list-title">
17
+          <span>名称</span>
18
+          <span>领取时间</span>
19
+          <span>记录</span>
20
+        </div>
21
+        <div class="flex-item">
22
+          <div class="scollBody">
23
+            <div v-if="activeIndex === 0">
24
+              <div class="list-detail" v-for="(item,index) in cardList" :key="index">
25
+                <span>{{item.CustomerCardName}}</span>
26
+                <span>{{toolClass.dateFormat(item.ReceiveDate)}}</span>
27
+                <span>已使用</span>
28
+              </div>
29
+              <span class="noData" v-if="cardAjaxOff && !cardList.length">暂无数据</span>
30
+            </div>
31
+            <div v-if="activeIndex === 1">
32
+              <div class="list-detail" v-for="(item,index) in couponList" :key="index">
33
+                <span>{{item.CustomerCouponName}}</span>
34
+                <span>{{toolClass.dateFormat(item.ReceiveDate)}}</span>
35
+                <span>已使用</span>
36
+              </div>
37
+              <span class="noData" v-if="couponAjaxOff && !couponList.length">暂无数据</span>
38
+            </div>
39
+          </div>
40
+        </div>
41
+      </div>
19
     </div>
42
     </div>
20
   </div>
43
   </div>
21
 </template>
44
 </template>
22
 
45
 
23
 <script>
46
 <script>
24
 import topCaseInfo from '../../../components/topCaseInfo/index'
47
 import topCaseInfo from '../../../components/topCaseInfo/index'
48
+import { mapState, createNamespacedHelpers } from 'vuex'
49
+const { mapActions: mapUserCenterActions } = createNamespacedHelpers('userCenter')
50
+const { mapActions: actions } = createNamespacedHelpers('app')
25
 
51
 
26
 export default {
52
 export default {
27
   name: '',
53
   name: '',
28
   data () {
54
   data () {
29
     return {
55
     return {
30
-      list: [1,1,1,1,1],
56
+      activeIndex: 0,
57
+      user: {
58
+        name: this.$route.query.name,
59
+        phone: this.$route.query.phone,
60
+        id: this.$route.query.id
61
+      },
62
+      cardAjaxOff: false,
63
+      couponAjaxOff: false,
64
+      cardList: [],
65
+      couponList: [],
31
       topCaseInfoData: {
66
       topCaseInfoData: {
32
-        caseName: '',
33
-        caseId: '',
67
+        CaseName: '',
68
+        CaseId: '',
34
         showSelect: false,
69
         showSelect: false,
35
-        userName: 'xxx'
70
+        userName: ''
36
       },
71
       },
37
     }
72
     }
38
   },
73
   },
74
+  computed: {
75
+    ...mapState({
76
+      userInfo: x => x.userCenter.userInfo,
77
+      CaseList: x => x.app.CaseList,
78
+    }),
79
+  },
39
   components: {
80
   components: {
40
     topCaseInfo,
81
     topCaseInfo,
41
   },
82
   },
42
   created () {
83
   created () {
43
-
84
+    this.getCaseList().then((res) => {
85
+      this.topCaseInfoData.CaseName = res.cases[0].CaseName
86
+      this.topCaseInfoData.CaseId = res.cases[0].CaseId
87
+    })
88
+    this.getCustomerCardList({
89
+      id: this.user.id,
90
+      payload: {
91
+        page: 1,
92
+        pagesize: 10000,
93
+      }
94
+    }).then((res) => {
95
+      console.log(JSON.stringify(res))
96
+      res.list = res.list || []
97
+      for (var n = 0; n < res.list.length; n++) {
98
+        this.cardList.push(res.list[n])
99
+      }
100
+      this.cardAjaxOff = true
101
+    })
102
+    this.getCustomerCouponList({
103
+      id: this.user.id,
104
+      payload: {
105
+        page: 1,
106
+        pagesize: 10000,
107
+      }
108
+    }).then((res) => {
109
+      console.log(JSON.stringify(res))
110
+      res.list = res.list || []
111
+      for (var n = 0; n < res.list.length; n++) {
112
+        this.couponList.push(res.list[n])
113
+      }
114
+      this.couponAjaxOff = true
115
+    })
44
   },
116
   },
45
   methods: {
117
   methods: {
46
-    
118
+    ...actions([
119
+      'getCaseList',
120
+    ]),
121
+    ...mapUserCenterActions([
122
+      'getCustomerCardList',
123
+      'getCustomerCouponList',
124
+    ]),
125
+    cutNav (index) {
126
+      this.activeIndex = index
127
+    },
47
   }
128
   }
48
 }
129
 }
49
 </script>
130
 </script>

+ 45
- 1
src/pages/sales/getRecord/page.scss View File

41
       text-align: center;
41
       text-align: center;
42
     }
42
     }
43
   }
43
   }
44
-}
44
+  ul{
45
+    width: 100%;
46
+    border-top: .01rem solid #eee;
47
+    li{
48
+      text-align: center;
49
+      line-height: .46rem;
50
+      position: relative;
51
+      &.active::after{
52
+        content: '';
53
+        width: 50%;
54
+        height: .02rem;
55
+        background: #fc6243;
56
+        position: absolute;
57
+        left: 50%;
58
+        bottom: 0;
59
+        transform: translateX(-50%);
60
+        -webkit-transform: translateX(-50%);
61
+      }
62
+    }
63
+  }
64
+  .scollBody{
65
+    width: 100%;
66
+    position: absolute;
67
+    left: 0;
68
+    top: 0;
69
+    bottom: 0;
70
+    overflow: hidden;
71
+    >div{
72
+      width: 100%;
73
+      height: 100%;
74
+      position: relative;
75
+      overflow-y: scroll;
76
+      -webkit-overflow-scrolling: touch;
77
+      transform: translateZ(0);
78
+      -webkit-transform: translateZ(0);
79
+      .noData{
80
+        width: 100%;
81
+        display: block;
82
+        text-align: center;
83
+        color: #666;
84
+        line-height: .4rem;
85
+      }
86
+    }
87
+  }
88
+} 

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

409
     },
409
     },
410
     record (item) {
410
     record (item) {
411
       // console.log(item)
411
       // console.log(item)
412
-      window.location.href = this.getUrl('getRecord') + '?' + item
412
+      window.location.href = this.getUrl('getRecord') + '?name=' + item.Name + '&phone=' + item.Phone + '&id=' + item.CustomerId
413
     },
413
     },
414
     searchMask () {
414
     searchMask () {
415
       window.location.href = this.getUrl('customerSearch')
415
       window.location.href = this.getUrl('customerSearch')

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

101
     }
101
     }
102
   },
102
   },
103
   actions: {
103
   actions: {
104
+    getCustomerCardList (context, { id, payload }) { // 获取我的用户领取卡信息
105
+      return new Promise((resolve) => {
106
+        Ajax(api.sales.getCustomerCardList.url, {
107
+          method: api.sales.getCustomerCardList.method,
108
+          queryData: {
109
+            ...payload
110
+          },
111
+          urlData: {
112
+            id,
113
+          },
114
+        }).then(res => {
115
+          resolve(res)
116
+        })
117
+      })
118
+    },
119
+    getCustomerCouponList (context, { id, payload }) { // 获取我的用户领取券信息
120
+      return new Promise((resolve) => {
121
+        Ajax(api.sales.getCustomerCouponList.url, {
122
+          method: api.sales.getCustomerCouponList.method,
123
+          queryData: {
124
+            ...payload
125
+          },
126
+          urlData: {
127
+            id,
128
+          },
129
+        }).then(res => {
130
+          resolve(res)
131
+        })
132
+      })
133
+    },
104
     getCustomerList (context, payload) { // 获取我的客户列表
134
     getCustomerList (context, payload) { // 获取我的客户列表
105
       return new Promise((resolve) => {
135
       return new Promise((resolve) => {
106
         Ajax(api.sales.getCustomerList.url, {
136
         Ajax(api.sales.getCustomerList.url, {

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

166
       method: 'get',
166
       method: 'get',
167
       url: `${baseUrl}${wechat}/customer/user`
167
       url: `${baseUrl}${wechat}/customer/user`
168
     },
168
     },
169
+    getCustomerCardList: { // 获取我的用户领取卡信息
170
+      method: 'get',
171
+      url: `${baseUrl}${wechat}/customer/sales/card/:id`
172
+    },
173
+    getCustomerCouponList: { // 获取我的用户领取券信息
174
+      method: 'get',
175
+      url: `${baseUrl}${wechat}/customer/sales/coupon/:id`
176
+    },
169
   },
177
   },
170
   login: { // 主管、销售端登陆
178
   login: { // 主管、销售端登陆
171
     login: {
179
     login: {