许成详 пре 6 година
родитељ
комит
2cc6160c9f
3 измењених фајлова са 81 додато и 14 уклоњено
  1. 64
    14
      src/pages/system/cardAndCouponManager/cardManager/index.vue
  2. 13
    0
      src/store/card/card.js
  3. 4
    0
      src/util/api.js

+ 64
- 14
src/pages/system/cardAndCouponManager/cardManager/index.vue Прегледај датотеку

@@ -123,7 +123,7 @@
123 123
           <li class="flex-item">
124 124
             <el-input
125 125
               placeholder="请输入推荐人"
126
-              v-model="dialogPostData.referrer"
126
+              v-model="dialogPostData.recommendname"
127 127
               clearable>
128 128
             </el-input>
129 129
           </li>
@@ -134,7 +134,7 @@
134 134
         <ul class="dialogSearchList flex-h">
135 135
           <li class="flex-item">
136 136
             <el-date-picker
137
-              v-model="dialogPostData.startdate"
137
+              v-model="dialogPostData.begindate"
138 138
               type="date"
139 139
               placeholder="选择起始日期">
140 140
             </el-date-picker>
@@ -149,7 +149,7 @@
149 149
       <div>
150 150
         <el-table
151 151
           ref="multipleTable"
152
-          :data="customerList"
152
+          :data="customers.list"
153 153
           tooltip-effect="dark"
154 154
           style="width: 100%"
155 155
           @selection-change="handleSelectionChange">
@@ -161,7 +161,7 @@
161 161
             label="姓名">
162 162
           </el-table-column>
163 163
           <el-table-column
164
-            prop="NickName"
164
+            prop="CustomerName"
165 165
             label="微信昵称">
166 166
           </el-table-column>
167 167
           <el-table-column
@@ -171,9 +171,12 @@
171 171
           <el-table-column
172 172
             prop="CreatDate"
173 173
             label="创建时间">
174
+            <template slot-scope="scope">
175
+              <span>{{toolClass.dateFormat(scope.row.CreateDate, 'yyyy-MM-dd')}}</span>
176
+            </template>
174 177
           </el-table-column>
175 178
           <el-table-column
176
-            prop="Referrer"
179
+            prop="RecommendName"
177 180
             label="推荐人">
178 181
           </el-table-column>
179 182
         </el-table>
@@ -188,8 +191,8 @@
188 191
         </el-pagination>
189 192
       </div>
190 193
       <span slot="footer" class="dialog-footer">
191
-        <el-button @click="centerDialogVisible = false">取 消</el-button>
192
-        <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
194
+        <el-button @click="closeDialog">取 消</el-button>
195
+        <el-button type="primary" @click="toSendCard">确 定</el-button>
193 196
       </span>
194 197
     </el-dialog>
195 198
   </div>
@@ -198,14 +201,20 @@
198 201
 <script>
199 202
 import { mapState, createNamespacedHelpers } from 'vuex'
200 203
 const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('card')
204
+const { mapState: mapCustomerState, mapActions: mapCustomerActions } = createNamespacedHelpers('customer')
201 205
 
202 206
 export default {
203 207
   name: '',
204 208
   data () {
205 209
     return {
210
+      selectCustomer: [],
206 211
       dialogTotal: 0,
207 212
       dialogPostData: {
208
-        caseid: '', // 案场id
213
+        username: '',
214
+        phone: '',
215
+        recommendname: '',
216
+        begindate: '',
217
+        enddate: '',
209 218
         page: 1, // 当前页码
210 219
         pagesize: 10, // 请求数据量
211 220
       },
@@ -232,6 +241,9 @@ export default {
232 241
       cases: x => x.app.cases.list,
233 242
       defaultCaseId: x => x.app.cases.default
234 243
     }),
244
+    ...mapCustomerState({
245
+      customers: x => x.customers,
246
+    }),
235 247
     CaseId: {
236 248
       get () {
237 249
         return this.postData.caseid || this.defaultCaseId
@@ -244,21 +256,59 @@ export default {
244 256
   methods: {
245 257
     ...mapCardActions([
246 258
       'GetCardList',
259
+      'giveCard',
260
+    ]),
261
+    ...mapCustomerActions([
262
+      'GetCustomerList',
263
+      'SetCustomerListNull',
247 264
     ]),
248 265
     toSendHistory () { // 查看赠送记录
249
-      this.$router.push({name: 'givingRecords'})
266
+      this.$router.push({ name: 'givingRecords' })
250 267
     },
251 268
     dialogSearch () { // 赠送客户搜索
252
-      // 1
269
+      this.GetCustomerList(this.dialogPostData)
253 270
     },
254 271
     handleCurrentChangeDialog (val) {
255
-      // 1
272
+      this.dialogPostData.page = val
273
+      this.GetCustomerList(this.dialogPostData)
256 274
     },
257 275
     handleSelectionChange (val) {
258
-      this.postData.page = val
259
-      this.getList()
276
+      // console.log(val)
277
+      this.selectCustomer = val
278
+    },
279
+    toSendCard () { // 赠送卡
280
+      if (this.selectCustomer.length) {
281
+        this.selectCustomer = this.selectCustomer.map(x => x.CustomerId).join(',')
282
+        this.giveCard({
283
+          id: this.currentCardId,
284
+          users: this.selectCustomer,
285
+        }).then(res => {
286
+          this.$message({
287
+            type: 'success',
288
+            message: '赠送成功!'
289
+          })
290
+          this.centerDialogVisible = false
291
+          this.selectCustomer = []
292
+          if (this.customers.list.length) {
293
+            this.customers.list = []
294
+          }
295
+          this.getList()
296
+        })
297
+      } else {
298
+        this.$message({
299
+          type: 'error',
300
+          message: '请先选择需要赠送的客户!'
301
+        })
302
+      }
303
+    },
304
+    closeDialog () { // 关闭弹窗
305
+      this.centerDialogVisible = false
306
+      if (this.customers.list.length) {
307
+        this.customers.list = []
308
+      }
260 309
     },
261
-    sendCard (index, row) { // 赠送卡
310
+    sendCard (index, row) { // 赠送卡弹窗
311
+      this.currentCardId = row.CardId
262 312
       this.centerDialogVisible = true
263 313
     },
264 314
     search () { // 搜索

+ 13
- 0
src/store/card/card.js Прегледај датотеку

@@ -64,5 +64,18 @@ export default {
64 64
         }).catch(reject)
65 65
       })
66 66
     },
67
+    giveCard ({ commit }, { id, users }) {
68
+      return new Promise((resolve, reject) => {
69
+        ajax(api.cardManager.giveCard.url, {
70
+          method: api.cardManager.giveCard.method,
71
+          urlData: {
72
+            id,
73
+            users
74
+          },
75
+        }).then(res => {
76
+          resolve(res)
77
+        }).catch(reject)
78
+      })
79
+    }
67 80
   }
68 81
 }

+ 4
- 0
src/util/api.js Прегледај датотеку

@@ -605,6 +605,10 @@ const $api = {
605 605
       method: 'get',
606 606
       url: `${baseUrl}${common}/card/:id`
607 607
     },
608
+    giveCard: {
609
+      method: 'post',
610
+      url: `${baseUrl}${common}/card/:id/to/:users`
611
+    },
608 612
   },
609 613
   couponManager: {
610 614
     couponList: {