Merge branch 'feature/shop-order-v2' into 'master'
一件代发二期 一件代发二期 See merge request !112
Showing
27 changed files
with
1374 additions
and
206 deletions
@@ -6,6 +6,7 @@ import print from './print'; | @@ -6,6 +6,7 @@ import print from './print'; | ||
6 | import stock from './stock'; | 6 | import stock from './stock'; |
7 | import invoice from './invoice'; | 7 | import invoice from './invoice'; |
8 | import withdraw from './withdraw'; | 8 | import withdraw from './withdraw'; |
9 | +import transaction from './transaction'; | ||
9 | export default { | 10 | export default { |
10 | clearing, | 11 | clearing, |
11 | payment, | 12 | payment, |
@@ -15,4 +16,5 @@ export default { | @@ -15,4 +16,5 @@ export default { | ||
15 | stock, | 16 | stock, |
16 | invoice, | 17 | invoice, |
17 | withdraw, | 18 | withdraw, |
19 | + transaction, | ||
18 | }; | 20 | }; |
app/pages/finance/transaction/index.js
0 → 100644
app/pages/finance/transaction/views/list.vue
0 → 100644
1 | +<template> | ||
2 | + <div> | ||
3 | + <layout-body> | ||
4 | + <p slot="title">交易服务明细</p> | ||
5 | + <layout-filter ref="filter" :model="filters" class="box-filter" :inline="true" :col="1"> | ||
6 | + <filter-item label="起止时间"> | ||
7 | + <Date-picker | ||
8 | + v-model="filters.createTime.model" | ||
9 | + type="datetimerange" | ||
10 | + format="yyyy-MM-dd" | ||
11 | + placeholder="选择日期和时间" | ||
12 | + @on-change="createTimeChange" | ||
13 | + ></Date-picker> | ||
14 | + <div class="quick"> | ||
15 | + <template v-for="(option, key) in quickOptions"> | ||
16 | + <a :key="key" href="javascript:;" @click="timeFlag(key)">{{ option }}</a> | ||
17 | + </template> | ||
18 | + </div> | ||
19 | + <div class="select-container"> | ||
20 | + <Select v-model.trim="filters.status.model" :placeholder="filters.status.label" clearable> | ||
21 | + <Option v-for="(option, key) in filters.status.options" :key="key" :value="+key"> | ||
22 | + {{ option }} | ||
23 | + </Option> | ||
24 | + </Select> | ||
25 | + </div> | ||
26 | + </filter-item> | ||
27 | + <filter-item> | ||
28 | + <div class="select-container"> | ||
29 | + <Input v-model.trim="filters.orderCode.model" :placeholder="filters.orderCode.label" /> | ||
30 | + </div> | ||
31 | + <div class="select-container"> | ||
32 | + <Input v-model.trim="filters.productSku.model" :placeholder="filters.productSku.label" /> | ||
33 | + </div> | ||
34 | + <div class="select-container"> | ||
35 | + <Input v-model.trim="filters.productName.model" :placeholder="filters.productName.label" /> | ||
36 | + </div> | ||
37 | + <div class="select-container"> | ||
38 | + <Button type="primary" @click="search">查询</Button> | ||
39 | + <Button type="primary" @click="reset">全部</Button> | ||
40 | + <Button type="warning" @click="exportList">导出</Button> | ||
41 | + </div> | ||
42 | + </filter-item> | ||
43 | + </layout-filter> | ||
44 | + <layout-list> | ||
45 | + <Table border :columns="tableCols" :data="tableData" show-summary></Table> | ||
46 | + <Table border :columns="summaryColumn" :data="summaryInfo" :show-header="false"></Table> | ||
47 | + <Page | ||
48 | + :total="pageData.total" | ||
49 | + :current="pageData.current" | ||
50 | + :page-size="pageData.pageSize" | ||
51 | + show-total | ||
52 | + @on-change="pageChange" | ||
53 | + ></Page> | ||
54 | + </layout-list> | ||
55 | + </layout-body> | ||
56 | + </div> | ||
57 | +</template> | ||
58 | + | ||
59 | +<script> | ||
60 | +import _ from 'lodash'; | ||
61 | +import moment from 'moment'; | ||
62 | +import qs from 'querystringify'; | ||
63 | +import FinanceService from 'services/finance/finance-service'; | ||
64 | +import baseExportApi from 'util/excel'; | ||
65 | +export default { | ||
66 | + data() { | ||
67 | + return { | ||
68 | + //当前的搜索条件 | ||
69 | + currentSearchParams: {}, | ||
70 | + filters: { | ||
71 | + createTime: { | ||
72 | + label: '创建时间', | ||
73 | + model: '', | ||
74 | + }, | ||
75 | + beginTime: { | ||
76 | + model: '', | ||
77 | + }, | ||
78 | + endTime: { | ||
79 | + model: '', | ||
80 | + }, | ||
81 | + timeFlag: { | ||
82 | + label: '时间标志', | ||
83 | + model: '', | ||
84 | + }, | ||
85 | + status: { | ||
86 | + label: '提现状态', | ||
87 | + model: '', | ||
88 | + options: { | ||
89 | + '0': '冻结中', | ||
90 | + '1': '可提现', | ||
91 | + '2': '提现中', | ||
92 | + '3': '提现成功', | ||
93 | + '-1': '提现失败', | ||
94 | + }, | ||
95 | + }, | ||
96 | + orderCode: { | ||
97 | + label: '订单号', | ||
98 | + model: '', | ||
99 | + }, | ||
100 | + productSku: { | ||
101 | + label: 'SKU', | ||
102 | + model: '', | ||
103 | + }, | ||
104 | + productName: { | ||
105 | + label: '商品名称', | ||
106 | + model: '', | ||
107 | + }, | ||
108 | + pageNo: 1, | ||
109 | + pageSize: 10, | ||
110 | + }, | ||
111 | + tableCols: [ | ||
112 | + { | ||
113 | + title: '账务ID', | ||
114 | + key: 'id', | ||
115 | + width: 60, | ||
116 | + align: 'center', | ||
117 | + }, | ||
118 | + { | ||
119 | + title: '结算时间', | ||
120 | + key: 'businessTime', | ||
121 | + align: 'center', | ||
122 | + render(h, params) { | ||
123 | + const time = moment.unix(params.row.businessTime); | ||
124 | + return ( | ||
125 | + <div> | ||
126 | + <div>{time.format('YYYY/MM/DD')}</div> | ||
127 | + <div>{time.format('HH:mm:ss')}</div> | ||
128 | + </div> | ||
129 | + ); | ||
130 | + }, | ||
131 | + }, | ||
132 | + { | ||
133 | + title: '订单号', | ||
134 | + key: 'orderCode', | ||
135 | + align: 'center', | ||
136 | + }, | ||
137 | + { | ||
138 | + title: 'SKU', | ||
139 | + key: 'productSku', | ||
140 | + align: 'center', | ||
141 | + }, | ||
142 | + { | ||
143 | + title: '数量', | ||
144 | + key: 'quantity', | ||
145 | + align: 'center', | ||
146 | + }, | ||
147 | + { | ||
148 | + title: '商品名称', | ||
149 | + key: 'productName', | ||
150 | + align: 'center', | ||
151 | + }, | ||
152 | + { | ||
153 | + title: '账务类型', | ||
154 | + key: 'billTypeDesc', | ||
155 | + align: 'center', | ||
156 | + }, | ||
157 | + { | ||
158 | + title: '业务描述', | ||
159 | + key: 'clearingTypeName', | ||
160 | + align: 'center', | ||
161 | + }, | ||
162 | + { | ||
163 | + title: '成交价/优惠价', | ||
164 | + key: 'lastPrice', | ||
165 | + align: 'center', | ||
166 | + }, | ||
167 | + { | ||
168 | + title: '商家应收/分摊比例', | ||
169 | + key: 'clearingDiscount', | ||
170 | + align: 'center', | ||
171 | + }, | ||
172 | + { | ||
173 | + title: '商家应收', | ||
174 | + key: 'shopDeserveAmount', | ||
175 | + align: 'center', | ||
176 | + }, | ||
177 | + { | ||
178 | + title: '提现服务费', | ||
179 | + key: 'withdrawServiceAmount', | ||
180 | + align: 'center', | ||
181 | + }, | ||
182 | + { | ||
183 | + title: '交易服务费', | ||
184 | + key: 'serviceAmount', | ||
185 | + align: 'center', | ||
186 | + }, | ||
187 | + { | ||
188 | + title: '商家实收', | ||
189 | + key: 'shopNetAmount', | ||
190 | + align: 'center', | ||
191 | + }, | ||
192 | + { | ||
193 | + title: '提现状态', | ||
194 | + key: 'statusName', | ||
195 | + align: 'center', | ||
196 | + }, | ||
197 | + { | ||
198 | + title: '可提现日期', | ||
199 | + key: 'withdrawalTime', | ||
200 | + align: 'center', | ||
201 | + render(h, params) { | ||
202 | + if (!params.row.withdrawalTime) { | ||
203 | + return ''; | ||
204 | + } | ||
205 | + const appSuTime = moment.unix(params.row.withdrawalTime); | ||
206 | + return ( | ||
207 | + <div> | ||
208 | + <div>{appSuTime.format('YYYY/MM/DD')}</div> | ||
209 | + <div>{appSuTime.format('HH:mm:ss')}</div> | ||
210 | + </div> | ||
211 | + ); | ||
212 | + }, | ||
213 | + }, | ||
214 | + { | ||
215 | + title: '提现申请日期', | ||
216 | + key: 'withdrawApplyTime', | ||
217 | + align: 'center', | ||
218 | + render(h, params) { | ||
219 | + if (!params.row.withdrawApplyTime) { | ||
220 | + return ''; | ||
221 | + } | ||
222 | + const applyTime = moment.unix(params.row.withdrawApplyTime); | ||
223 | + return ( | ||
224 | + <div> | ||
225 | + <div>{applyTime.format('YYYY/MM/DD')}</div> | ||
226 | + <div>{applyTime.format('HH:mm:ss')}</div> | ||
227 | + </div> | ||
228 | + ); | ||
229 | + }, | ||
230 | + }, | ||
231 | + ], | ||
232 | + tableData: [], | ||
233 | + summaryColumn: [ | ||
234 | + { | ||
235 | + title: '账务ID', | ||
236 | + key: 'summaryName', | ||
237 | + width: 60, | ||
238 | + align: 'center', | ||
239 | + }, | ||
240 | + {}, | ||
241 | + {}, | ||
242 | + {}, | ||
243 | + {}, | ||
244 | + {}, | ||
245 | + {}, | ||
246 | + {}, | ||
247 | + {}, | ||
248 | + {}, | ||
249 | + { | ||
250 | + title: '商家应收汇总', | ||
251 | + key: 'shopDeserveAmount', | ||
252 | + align: 'center', | ||
253 | + }, | ||
254 | + { | ||
255 | + title: '提现服务费汇总', | ||
256 | + key: 'withdrawServiceAmount', | ||
257 | + align: 'center', | ||
258 | + }, | ||
259 | + { | ||
260 | + title: '交易服务费汇总', | ||
261 | + key: 'serviceAmount', | ||
262 | + align: 'center', | ||
263 | + }, | ||
264 | + | ||
265 | + { | ||
266 | + title: '商家实收汇总', | ||
267 | + key: 'shopNetAmount', | ||
268 | + align: 'center', | ||
269 | + }, | ||
270 | + {}, | ||
271 | + {}, | ||
272 | + {}, | ||
273 | + ], | ||
274 | + summaryInfo: [], | ||
275 | + pageData: { | ||
276 | + total: 0, | ||
277 | + current: 1, | ||
278 | + pageSize: 10, | ||
279 | + }, | ||
280 | + quickOptions: { | ||
281 | + 1: '今天', | ||
282 | + 2: '昨天', | ||
283 | + 3: '最近7天', | ||
284 | + 4: '最近30天', | ||
285 | + }, | ||
286 | + }; | ||
287 | + }, | ||
288 | + created() { | ||
289 | + this.financeService = new FinanceService(); | ||
290 | + this.search(); | ||
291 | + }, | ||
292 | + methods: { | ||
293 | + //组织当前的搜索条件 | ||
294 | + filterValues() { | ||
295 | + const _this = this; | ||
296 | + _.each(this.filters, (value, key) => { | ||
297 | + _this.currentSearchParams[key] = value.model; | ||
298 | + }); | ||
299 | + const { current, pageSize } = this.pageData; | ||
300 | + this.currentSearchParams.pageNo = current; | ||
301 | + this.currentSearchParams.pageSize = pageSize; | ||
302 | + }, | ||
303 | + //点击搜索动作 | ||
304 | + search() { | ||
305 | + this.filters.timeFlag.model = ''; | ||
306 | + this.pageData.current = 1; | ||
307 | + this.filterValues(); | ||
308 | + this.list(); | ||
309 | + }, | ||
310 | + //点击全部操作 | ||
311 | + reset() { | ||
312 | + this.pageData.current = 1; | ||
313 | + this.resetFilter(); | ||
314 | + this.filterValues(); | ||
315 | + this.list(); | ||
316 | + }, | ||
317 | + //点击快速查询操作 | ||
318 | + timeFlag(flag) { | ||
319 | + this.resetFilter(); | ||
320 | + this.filters.timeFlag.model = flag; | ||
321 | + this.pageData.current = 1; | ||
322 | + this.filterValues(); | ||
323 | + this.list(); | ||
324 | + }, | ||
325 | + //格式化时间 | ||
326 | + createTimeChange(time) { | ||
327 | + if (!_.isArray(time)) { | ||
328 | + time = time.split(' - '); | ||
329 | + } | ||
330 | + if ((time[0] + '').length) { | ||
331 | + this.filters.beginTime.model = moment(time[0]).format('YYYY-MM-DD'); | ||
332 | + this.filters.endTime.model = moment(time[1]).format('YYYY-MM-DD'); | ||
333 | + } else { | ||
334 | + this.filters.beginTime.model = ''; | ||
335 | + this.filters.endTime.model = ''; | ||
336 | + } | ||
337 | + }, | ||
338 | + //点击分页 | ||
339 | + pageChange(page) { | ||
340 | + this.pageData.current = page; | ||
341 | + this.currentSearchParams.pageNo = page; | ||
342 | + this.list(); | ||
343 | + }, | ||
344 | + //获取列表数据 | ||
345 | + list() { | ||
346 | + Promise.all([ | ||
347 | + this.financeService.shopBillList(this.currentSearchParams), | ||
348 | + this.financeService.querySummaryInfo(this.currentSearchParams), | ||
349 | + ]).then(result => { | ||
350 | + this.tableData = _.get(result[0], 'data.records', []); | ||
351 | + this.pageData.total = _.get(result[0], 'data.totalCount', 0); | ||
352 | + this.pageData.current = _.get(result[0], 'data.pageNo', 1); | ||
353 | + const summaryInfo = _.get(result[1], 'data', {}); | ||
354 | + this.summaryInfo = []; | ||
355 | + this.summaryInfo.push({ ...summaryInfo, summaryName: '汇总' }); | ||
356 | + }); | ||
357 | + }, | ||
358 | + //导出列表 | ||
359 | + exportList() { | ||
360 | + const queryString = { ...this.currentSearchParams, excelConf: 'shopBill' }; | ||
361 | + const params = qs.stringify(queryString, true); | ||
362 | + const href = `${baseExportApi}${params}`; | ||
363 | + window.open(href, '_blank'); | ||
364 | + }, | ||
365 | + //重置筛选条件 | ||
366 | + resetFilter() { | ||
367 | + //重置筛选框中的数据 | ||
368 | + _.each(this.filters, value => { | ||
369 | + if (value.hasOwnProperty('model')) { | ||
370 | + value.model = ''; | ||
371 | + } | ||
372 | + }); | ||
373 | + }, | ||
374 | + }, | ||
375 | +}; | ||
376 | +</script> | ||
377 | + | ||
378 | +<style lang="scss"> | ||
379 | +.layout-container { | ||
380 | + min-height: 200px; | ||
381 | + margin: 15px; | ||
382 | + overflow: hidden; | ||
383 | + background: #fff; | ||
384 | + border-radius: 4px; | ||
385 | + | ||
386 | + .layout-filter .line { | ||
387 | + border-top: none; | ||
388 | + margin-bottom: 0; | ||
389 | + } | ||
390 | +} | ||
391 | + | ||
392 | +.shop-card { | ||
393 | + margin-top: 10px; | ||
394 | + margin-bottom: 10px; | ||
395 | +} | ||
396 | + | ||
397 | +.box-title { | ||
398 | + font-weight: 700; | ||
399 | + color: #495060; | ||
400 | + font-size: 16px; | ||
401 | + line-height: 22px; | ||
402 | + margin: 5px; | ||
403 | + | ||
404 | + &:before { | ||
405 | + content: ' '; | ||
406 | + display: inline-block; | ||
407 | + width: 5px; | ||
408 | + margin-right: 2px; | ||
409 | + height: 22px; | ||
410 | + vertical-align: top; | ||
411 | + background-color: #999; | ||
412 | + } | ||
413 | +} | ||
414 | + | ||
415 | +.box-item { | ||
416 | + width: 90%; | ||
417 | + height: 50px; | ||
418 | + padding: 0 0 0 15px; | ||
419 | + line-height: 50px; | ||
420 | + font-size: 14px; | ||
421 | + overflow: hidden; | ||
422 | + border-radius: 5px; | ||
423 | + color: #fff; | ||
424 | + margin-bottom: 10px; | ||
425 | + | ||
426 | + .box-item-label { | ||
427 | + display: inline-block; | ||
428 | + min-width: 75px; | ||
429 | + vertical-align: top; | ||
430 | + font-weight: normal; | ||
431 | + } | ||
432 | + | ||
433 | + .box-item-value { | ||
434 | + font-size: 20px; | ||
435 | + font-weight: 600; | ||
436 | + } | ||
437 | + | ||
438 | + i { | ||
439 | + display: inline-block; | ||
440 | + width: 20px; | ||
441 | + height: 20px; | ||
442 | + font-size: 22px; | ||
443 | + text-align: center; | ||
444 | + margin-top: -7px; | ||
445 | + vertical-align: middle; | ||
446 | + margin-right: 3px; | ||
447 | + } | ||
448 | +} | ||
449 | + | ||
450 | +.box-filter { | ||
451 | + .ivu-date-picker { | ||
452 | + margin-left: 0; | ||
453 | + width: 220px !important; | ||
454 | + } | ||
455 | + | ||
456 | + .quick { | ||
457 | + display: inline-block; | ||
458 | + margin-left: 20px; | ||
459 | + margin-right: 50px; | ||
460 | + | ||
461 | + a { | ||
462 | + margin-right: 5px; | ||
463 | + } | ||
464 | + } | ||
465 | + | ||
466 | + .select-container { | ||
467 | + display: inline-block; | ||
468 | + width: 200px; | ||
469 | + margin-right: 15px; | ||
470 | + margin-top: 5px; | ||
471 | + } | ||
472 | +} | ||
473 | + | ||
474 | +.ivu-table-cell { | ||
475 | + padding-left: 6px; | ||
476 | + padding-right: 6px; | ||
477 | +} | ||
478 | + | ||
479 | +.action-column { | ||
480 | + .cell-action-row { | ||
481 | + margin-top: 10px; | ||
482 | + | ||
483 | + &:last-child { | ||
484 | + margin-bottom: 10px; | ||
485 | + } | ||
486 | + } | ||
487 | +} | ||
488 | +</style> |
@@ -81,11 +81,13 @@ | @@ -81,11 +81,13 @@ | ||
81 | <div class="select-container"> | 81 | <div class="select-container"> |
82 | <Button type="primary" @click="search">查询</Button> | 82 | <Button type="primary" @click="search">查询</Button> |
83 | <Button type="primary" @click="reset">全部</Button> | 83 | <Button type="primary" @click="reset">全部</Button> |
84 | + <Button type="warning" @click="exportList">导出</Button> | ||
84 | </div> | 85 | </div> |
85 | </filter-item> | 86 | </filter-item> |
86 | </layout-filter> | 87 | </layout-filter> |
87 | <layout-list> | 88 | <layout-list> |
88 | <Table border :columns="tableCols" :data="tableData"></Table> | 89 | <Table border :columns="tableCols" :data="tableData"></Table> |
90 | + <Table border :columns="summaryColumn" :data="summaryInfo" :show-header="false"></Table> | ||
89 | <Page | 91 | <Page |
90 | :total="pageData.total" | 92 | :total="pageData.total" |
91 | :current="pageData.current" | 93 | :current="pageData.current" |
@@ -103,6 +105,8 @@ import _ from 'lodash'; | @@ -103,6 +105,8 @@ import _ from 'lodash'; | ||
103 | import moment from 'moment'; | 105 | import moment from 'moment'; |
104 | import { FreightApply } from './store'; | 106 | import { FreightApply } from './store'; |
105 | import FinanceService from 'services/finance/finance-service'; | 107 | import FinanceService from 'services/finance/finance-service'; |
108 | +import baseExportApi from 'util/excel'; | ||
109 | +import qs from 'querystringify'; | ||
106 | 110 | ||
107 | export default { | 111 | export default { |
108 | data() { | 112 | data() { |
@@ -113,52 +117,48 @@ export default { | @@ -113,52 +117,48 @@ export default { | ||
113 | this.search(); | 117 | this.search(); |
114 | }, | 118 | }, |
115 | methods: { | 119 | methods: { |
120 | + //组织当前的搜索条件 | ||
116 | filterValues() { | 121 | filterValues() { |
117 | - const values = { | ||
118 | - pageNo: 1, | ||
119 | - pageSize: 10, | ||
120 | - }; | ||
121 | - const fields = this.filters; | ||
122 | - const keysMap = { | ||
123 | - beginTime: 'beginTime', | ||
124 | - endTime: 'endTime', | ||
125 | - timeFlag: 'timeFlag', | ||
126 | - targetAccount: 'targetAccount', | ||
127 | - orderCode: 'orderCode', | ||
128 | - clearingType: 'clearingType', | ||
129 | - subClearingType: 'subClearingType', | ||
130 | - status: 'status', | ||
131 | - }; | ||
132 | - | ||
133 | - if (this.enableFilter) { | ||
134 | - _.each(keysMap, (val, key) => { | ||
135 | - values[key] = fields[val].model; | ||
136 | - }); | ||
137 | - } | ||
138 | - return values; | 122 | + const _this = this; |
123 | + _.each(this.filters, (value, key) => { | ||
124 | + _this.currentSearchParams[key] = value.model; | ||
125 | + }); | ||
126 | + const { current, pageSize } = this.pageData; | ||
127 | + this.currentSearchParams.pageNo = current; | ||
128 | + this.currentSearchParams.pageSize = pageSize; | ||
139 | }, | 129 | }, |
130 | + //重置筛选条件 | ||
131 | + resetFilter() { | ||
132 | + //重置筛选框中的数据 | ||
133 | + _.each(this.filters, value => { | ||
134 | + if (value.hasOwnProperty('model')) { | ||
135 | + value.model = ''; | ||
136 | + } | ||
137 | + }); | ||
138 | + }, | ||
139 | + //点击搜索按钮动作 | ||
140 | search() { | 140 | search() { |
141 | - let params = {}; | ||
142 | - this.enableFilter = true; | ||
143 | - params = this.filterValues(); | ||
144 | - this.list(params); | 141 | + this.filters.timeFlag.model = ''; |
145 | this.pageData.current = 1; | 142 | this.pageData.current = 1; |
143 | + this.filterValues(); | ||
144 | + this.list(); | ||
146 | }, | 145 | }, |
146 | + //点击全部操作 | ||
147 | reset() { | 147 | reset() { |
148 | - let params = {}; | ||
149 | - this.enableFilter = false; | ||
150 | - params = this.filterValues(); | ||
151 | - this.list(params); | ||
152 | this.pageData.current = 1; | 148 | this.pageData.current = 1; |
149 | + this.resetFilter(); | ||
150 | + this.filterValues(); | ||
151 | + this.list(); | ||
153 | }, | 152 | }, |
153 | + //点击快速查询操作 | ||
154 | timeFlag(flag) { | 154 | timeFlag(flag) { |
155 | - let params = {}; | ||
156 | - this.enableFilter = false; | ||
157 | - params = this.filterValues(); | ||
158 | - params.timeFlag = flag; | ||
159 | - this.list(params); | 155 | + this.resetFilter(); |
156 | + this.filters.timeFlag.model = flag; | ||
160 | this.pageData.current = 1; | 157 | this.pageData.current = 1; |
158 | + this.filterValues(); | ||
159 | + this.list(); | ||
161 | }, | 160 | }, |
161 | + //格式化时间 | ||
162 | createTimeChange(time) { | 162 | createTimeChange(time) { |
163 | if (!_.isArray(time)) { | 163 | if (!_.isArray(time)) { |
164 | time = time.split(' - '); | 164 | time = time.split(' - '); |
@@ -171,17 +171,24 @@ export default { | @@ -171,17 +171,24 @@ export default { | ||
171 | this.filters.endTime.model = ''; | 171 | this.filters.endTime.model = ''; |
172 | } | 172 | } |
173 | }, | 173 | }, |
174 | + //点击分页 | ||
174 | pageChange(page) { | 175 | pageChange(page) { |
175 | - const params = this.filterValues(); | ||
176 | - params.pageNo = page; | ||
177 | this.pageData.current = page; | 176 | this.pageData.current = page; |
178 | - this.list(params); | 177 | + this.currentSearchParams.pageNo = page; |
178 | + this.list(); | ||
179 | }, | 179 | }, |
180 | - list(params) { | ||
181 | - this.financeService.shopWithdrawFreightList(params).then(ret => { | ||
182 | - this.tableData = _.get(ret, 'data.records', []); | ||
183 | - this.pageData.total = _.get(ret, 'data.totalCount', 0); | ||
184 | - this.pageData.current = _.get(ret, 'data.pageNo', 1); | 180 | + //获取列表数据 |
181 | + list() { | ||
182 | + Promise.all([ | ||
183 | + this.financeService.shopWithdrawFreightList(this.currentSearchParams), | ||
184 | + this.financeService.queryFreightBillSummary(this.currentSearchParams), | ||
185 | + ]).then(result => { | ||
186 | + this.tableData = _.get(result[0], 'data.records', []); | ||
187 | + this.pageData.total = _.get(result[0], 'data.totalCount', 0); | ||
188 | + this.pageData.current = _.get(result[0], 'data.pageNo', 1); | ||
189 | + const summaryInfo = _.get(result[1], 'data', {}); | ||
190 | + this.summaryInfo = []; | ||
191 | + this.summaryInfo.push({ ...summaryInfo, summaryName: '汇总' }); | ||
185 | }); | 192 | }); |
186 | }, | 193 | }, |
187 | getDetailById(id) { | 194 | getDetailById(id) { |
@@ -192,6 +199,13 @@ export default { | @@ -192,6 +199,13 @@ export default { | ||
192 | }, | 199 | }, |
193 | }); | 200 | }); |
194 | }, | 201 | }, |
202 | + //导出列表 | ||
203 | + exportList() { | ||
204 | + const queryString = { ...this.currentSearchParams, excelConf: 'shopFreightList' }; | ||
205 | + const params = qs.stringify(queryString, true); | ||
206 | + const href = `${baseExportApi}${params}`; | ||
207 | + window.open(href, '_blank'); | ||
208 | + }, | ||
195 | }, | 209 | }, |
196 | }; | 210 | }; |
197 | </script> | 211 | </script> |
@@ -52,6 +52,9 @@ | @@ -52,6 +52,9 @@ | ||
52 | </filter-item> | 52 | </filter-item> |
53 | <filter-item> | 53 | <filter-item> |
54 | <div class="select-container"> | 54 | <div class="select-container"> |
55 | + <Input v-model.trim="filters.orderCode.model" :placeholder="filters.orderCode.label" /> | ||
56 | + </div> | ||
57 | + <div class="select-container"> | ||
55 | <Input v-model.trim="filters.productSku.model" :placeholder="filters.productSku.label" /> | 58 | <Input v-model.trim="filters.productSku.model" :placeholder="filters.productSku.label" /> |
56 | </div> | 59 | </div> |
57 | <div class="select-container"> | 60 | <div class="select-container"> |
@@ -61,35 +64,16 @@ | @@ -61,35 +64,16 @@ | ||
61 | }}</Option> | 64 | }}</Option> |
62 | </Select> | 65 | </Select> |
63 | </div> | 66 | </div> |
64 | - <!-- <div class="select-container">--> | ||
65 | - <!-- <Input v-model.trim="filters.targetAccount.model" :placeholder="filters.targetAccount.label" />--> | ||
66 | - <!-- </div>--> | ||
67 | - <!-- <div class="select-container">--> | ||
68 | - <!-- <Select v-model.trim="filters.clearingType.model" :placeholder="filters.clearingType.label">--> | ||
69 | - <!-- <Option v-for="option in filters.clearingType.options" :key="option.value" :value="option.value">{{--> | ||
70 | - <!-- option.label--> | ||
71 | - <!-- }}</Option>--> | ||
72 | - <!-- </Select>--> | ||
73 | - <!-- </div>--> | ||
74 | - <!-- <div class="select-container">--> | ||
75 | - <!-- <Select v-model.trim="filters.subClearingType.model" :placeholder="filters.subClearingType.label">--> | ||
76 | - <!-- <Option v-for="option in filters.subClearingType.options" :key="option.value" :value="option.value">{{--> | ||
77 | - <!-- option.label--> | ||
78 | - <!-- }}</Option>--> | ||
79 | - <!-- </Select>--> | ||
80 | - <!-- </div>--> | ||
81 | - <div class="select-container"> | ||
82 | - <Input v-model.trim="filters.orderCode.model" :placeholder="filters.orderCode.label" /> | ||
83 | - </div> | ||
84 | <div class="select-container"> | 67 | <div class="select-container"> |
85 | <Button type="primary" @click="search">查询</Button> | 68 | <Button type="primary" @click="search">查询</Button> |
86 | <Button type="primary" @click="reset">全部</Button> | 69 | <Button type="primary" @click="reset">全部</Button> |
87 | - <!-- <Button>导出</Button>--> | 70 | + <Button type="warning" @click="exportList">导出</Button> |
88 | </div> | 71 | </div> |
89 | </filter-item> | 72 | </filter-item> |
90 | </layout-filter> | 73 | </layout-filter> |
91 | <layout-list> | 74 | <layout-list> |
92 | <Table border :columns="tableCols" :data="tableData"></Table> | 75 | <Table border :columns="tableCols" :data="tableData"></Table> |
76 | + <Table border :columns="summaryColumn" :data="summaryInfo" :show-header="false"></Table> | ||
93 | <Page | 77 | <Page |
94 | :total="pageData.total" | 78 | :total="pageData.total" |
95 | :current="pageData.current" | 79 | :current="pageData.current" |
@@ -107,7 +91,8 @@ import _ from 'lodash'; | @@ -107,7 +91,8 @@ import _ from 'lodash'; | ||
107 | import moment from 'moment'; | 91 | import moment from 'moment'; |
108 | import { ServiceList } from './store'; | 92 | import { ServiceList } from './store'; |
109 | import FinanceService from 'services/finance/finance-service'; | 93 | import FinanceService from 'services/finance/finance-service'; |
110 | - | 94 | +import baseExportApi from 'util/excel'; |
95 | +import qs from 'querystringify'; | ||
111 | export default { | 96 | export default { |
112 | data() { | 97 | data() { |
113 | return ServiceList.call(this); | 98 | return ServiceList.call(this); |
@@ -117,54 +102,48 @@ export default { | @@ -117,54 +102,48 @@ export default { | ||
117 | this.search(); | 102 | this.search(); |
118 | }, | 103 | }, |
119 | methods: { | 104 | methods: { |
105 | + //组织当前的搜索条件 | ||
120 | filterValues() { | 106 | filterValues() { |
121 | - const values = { | ||
122 | - pageNo: 1, | ||
123 | - pageSize: 10, | ||
124 | - }; | ||
125 | - const fields = this.filters; | ||
126 | - const keysMap = { | ||
127 | - beginTime: 'beginTime', | ||
128 | - endTime: 'endTime', | ||
129 | - timeFlag: 'timeFlag', | ||
130 | - status: 'status', | ||
131 | - orderCode: 'orderCode', | ||
132 | - productSku: 'productSku', | ||
133 | - targetAccount: 'targetAccount', | ||
134 | - clearingType: 'clearingType', | ||
135 | - subClearingType: 'subClearingType', | ||
136 | - // statementSn: 'statementSn', | ||
137 | - }; | ||
138 | - | ||
139 | - if (this.enableFilter) { | ||
140 | - _.each(keysMap, (val, key) => { | ||
141 | - values[key] = fields[val].model; | ||
142 | - }); | ||
143 | - } | ||
144 | - return values; | 107 | + const _this = this; |
108 | + _.each(this.filters, (value, key) => { | ||
109 | + _this.currentSearchParams[key] = value.model; | ||
110 | + }); | ||
111 | + const { current, pageSize } = this.pageData; | ||
112 | + this.currentSearchParams.pageNo = current; | ||
113 | + this.currentSearchParams.pageSize = pageSize; | ||
145 | }, | 114 | }, |
115 | + //重置筛选条件 | ||
116 | + resetFilter() { | ||
117 | + //重置筛选框中的数据 | ||
118 | + _.each(this.filters, value => { | ||
119 | + if (value.hasOwnProperty('model')) { | ||
120 | + value.model = ''; | ||
121 | + } | ||
122 | + }); | ||
123 | + }, | ||
124 | + //点击搜索按钮动作 | ||
146 | search() { | 125 | search() { |
147 | - let params = {}; | ||
148 | - this.enableFilter = true; | ||
149 | - params = this.filterValues(); | ||
150 | - this.list(params); | 126 | + this.filters.timeFlag.model = ''; |
151 | this.pageData.current = 1; | 127 | this.pageData.current = 1; |
128 | + this.filterValues(); | ||
129 | + this.list(); | ||
152 | }, | 130 | }, |
131 | + //点击全部操作 | ||
153 | reset() { | 132 | reset() { |
154 | - let params = {}; | ||
155 | - this.enableFilter = false; | ||
156 | - params = this.filterValues(); | ||
157 | - this.list(params); | ||
158 | this.pageData.current = 1; | 133 | this.pageData.current = 1; |
134 | + this.resetFilter(); | ||
135 | + this.filterValues(); | ||
136 | + this.list(); | ||
159 | }, | 137 | }, |
138 | + //点击快速查询操作 | ||
160 | timeFlag(flag) { | 139 | timeFlag(flag) { |
161 | - let params = {}; | ||
162 | - this.enableFilter = false; | ||
163 | - params = this.filterValues(); | ||
164 | - params.timeFlag = flag; | ||
165 | - this.list(params); | 140 | + this.resetFilter(); |
141 | + this.filters.timeFlag.model = flag; | ||
166 | this.pageData.current = 1; | 142 | this.pageData.current = 1; |
143 | + this.filterValues(); | ||
144 | + this.list(); | ||
167 | }, | 145 | }, |
146 | + //格式化时间 | ||
168 | createTimeChange(time) { | 147 | createTimeChange(time) { |
169 | if (!_.isArray(time)) { | 148 | if (!_.isArray(time)) { |
170 | time = time.split(' - '); | 149 | time = time.split(' - '); |
@@ -177,19 +156,33 @@ export default { | @@ -177,19 +156,33 @@ export default { | ||
177 | this.filters.endTime.model = ''; | 156 | this.filters.endTime.model = ''; |
178 | } | 157 | } |
179 | }, | 158 | }, |
159 | + //点击分页 | ||
180 | pageChange(page) { | 160 | pageChange(page) { |
181 | - const params = this.filterValues(); | ||
182 | - params.pageNo = page; | ||
183 | this.pageData.current = page; | 161 | this.pageData.current = page; |
184 | - this.list(params); | 162 | + this.currentSearchParams.pageNo = page; |
163 | + this.list(); | ||
185 | }, | 164 | }, |
186 | - list(params) { | ||
187 | - this.financeService.shopWithdrawServiceList(params).then(ret => { | ||
188 | - this.tableData = _.get(ret, 'data.records', []); | ||
189 | - this.pageData.total = _.get(ret, 'data.totalCount', 0); | ||
190 | - this.pageData.current = _.get(ret, 'data.pageNo', 1); | 165 | + //获取列表数据 |
166 | + list() { | ||
167 | + Promise.all([ | ||
168 | + this.financeService.shopWithdrawServiceList(this.currentSearchParams), | ||
169 | + this.financeService.queryBillSummary(this.currentSearchParams), | ||
170 | + ]).then(result => { | ||
171 | + this.tableData = _.get(result[0], 'data.records', []); | ||
172 | + this.pageData.total = _.get(result[0], 'data.totalCount', 0); | ||
173 | + this.pageData.current = _.get(result[0], 'data.pageNo', 1); | ||
174 | + const summaryInfo = _.get(result[1], 'data', {}); | ||
175 | + this.summaryInfo = []; | ||
176 | + this.summaryInfo.push({ ...summaryInfo, summaryName: '汇总' }); | ||
191 | }); | 177 | }); |
192 | }, | 178 | }, |
179 | + //导出列表 | ||
180 | + exportList() { | ||
181 | + const queryString = { ...this.currentSearchParams, excelConf: 'shopServiceList' }; | ||
182 | + const params = qs.stringify(queryString, true); | ||
183 | + const href = `${baseExportApi}${params}`; | ||
184 | + window.open(href, '_blank'); | ||
185 | + }, | ||
193 | }, | 186 | }, |
194 | }; | 187 | }; |
195 | </script> | 188 | </script> |
@@ -10,6 +10,8 @@ const withdrawStatus = { | @@ -10,6 +10,8 @@ const withdrawStatus = { | ||
10 | 10 | ||
11 | export default function() { | 11 | export default function() { |
12 | return { | 12 | return { |
13 | + //当前的搜索条件 | ||
14 | + currentSearchParams: {}, | ||
13 | filters: { | 15 | filters: { |
14 | createTime: { | 16 | createTime: { |
15 | label: '创建时间', | 17 | label: '创建时间', |
@@ -87,8 +89,6 @@ export default function() { | @@ -87,8 +89,6 @@ export default function() { | ||
87 | }, | 89 | }, |
88 | ], | 90 | ], |
89 | }, | 91 | }, |
90 | - pageNo: 1, | ||
91 | - pageSize: 10, | ||
92 | }, | 92 | }, |
93 | tableCols: [ | 93 | tableCols: [ |
94 | { | 94 | { |
@@ -124,6 +124,14 @@ export default function() { | @@ -124,6 +124,14 @@ export default function() { | ||
124 | key: 'clearingType', | 124 | key: 'clearingType', |
125 | }, | 125 | }, |
126 | { | 126 | { |
127 | + title: '运费', | ||
128 | + key: 'freightAmount', | ||
129 | + }, | ||
130 | + { | ||
131 | + title: '提现服务费', | ||
132 | + key: 'withdrawServiceAmount', | ||
133 | + }, | ||
134 | + { | ||
127 | title: '商家实收(元)', | 135 | title: '商家实收(元)', |
128 | key: 'realIncome', | 136 | key: 'realIncome', |
129 | }, | 137 | }, |
@@ -171,25 +179,6 @@ export default function() { | @@ -171,25 +179,6 @@ export default function() { | ||
171 | ); | 179 | ); |
172 | }, | 180 | }, |
173 | }, | 181 | }, |
174 | - // { | ||
175 | - // title: '操作', | ||
176 | - // key: 'action', | ||
177 | - // width: 180, | ||
178 | - // align: 'center', | ||
179 | - // render: (h, params) => { | ||
180 | - // const row = params.row; | ||
181 | - // return ( | ||
182 | - // <div> | ||
183 | - // <div class="cell-action-row"> | ||
184 | - // <i-button type="primary" size="small" onClick={() => this.getDetailById(row.id)}> | ||
185 | - // 查看明细 | ||
186 | - // </i-button> | ||
187 | - // </div> | ||
188 | - // </div> | ||
189 | - // ); | ||
190 | - // }, | ||
191 | - // className: 'action-column', | ||
192 | - // }, | ||
193 | ], | 182 | ], |
194 | tableData: [], | 183 | tableData: [], |
195 | pageData: { | 184 | pageData: { |
@@ -197,5 +186,33 @@ export default function() { | @@ -197,5 +186,33 @@ export default function() { | ||
197 | current: 1, | 186 | current: 1, |
198 | pageSize: 10, | 187 | pageSize: 10, |
199 | }, | 188 | }, |
189 | + summaryColumn: [ | ||
190 | + { | ||
191 | + title: '账务ID', | ||
192 | + key: 'summaryName', | ||
193 | + align: 'center', | ||
194 | + width: 60, | ||
195 | + }, | ||
196 | + {}, | ||
197 | + {}, | ||
198 | + {}, | ||
199 | + {}, | ||
200 | + { | ||
201 | + title: '运费汇总', | ||
202 | + key: 'freightAmount', | ||
203 | + }, | ||
204 | + { | ||
205 | + title: '提现服务费汇总', | ||
206 | + key: 'withdrawServiceAmount', | ||
207 | + }, | ||
208 | + { | ||
209 | + title: '商家实收汇总', | ||
210 | + key: 'realIncome', | ||
211 | + }, | ||
212 | + {}, | ||
213 | + {}, | ||
214 | + {}, | ||
215 | + ], | ||
216 | + summaryInfo: [], | ||
200 | }; | 217 | }; |
201 | } | 218 | } |
@@ -10,6 +10,8 @@ const withdrawStatus = { | @@ -10,6 +10,8 @@ const withdrawStatus = { | ||
10 | 10 | ||
11 | export default function() { | 11 | export default function() { |
12 | return { | 12 | return { |
13 | + //当前的搜索条件 | ||
14 | + currentSearchParams: {}, | ||
13 | filters: { | 15 | filters: { |
14 | createTime: { | 16 | createTime: { |
15 | label: '创建时间', | 17 | label: '创建时间', |
@@ -95,8 +97,6 @@ export default function() { | @@ -95,8 +97,6 @@ export default function() { | ||
95 | label: '提现账户', | 97 | label: '提现账户', |
96 | model: '', | 98 | model: '', |
97 | }, | 99 | }, |
98 | - pageNo: 1, | ||
99 | - pageSize: 10, | ||
100 | }, | 100 | }, |
101 | tableCols: [ | 101 | tableCols: [ |
102 | { | 102 | { |
@@ -108,6 +108,18 @@ export default function() { | @@ -108,6 +108,18 @@ export default function() { | ||
108 | title: '提现时间', | 108 | title: '提现时间', |
109 | key: 'withdrawTime', | 109 | key: 'withdrawTime', |
110 | align: 'center', | 110 | align: 'center', |
111 | + render(h, params) { | ||
112 | + if (!params.row.withdrawTime) { | ||
113 | + return ''; | ||
114 | + } | ||
115 | + const time = moment.unix(params.row.withdrawTime); | ||
116 | + return ( | ||
117 | + <div> | ||
118 | + <div>{time.format('YYYY/MM/DD')}</div> | ||
119 | + <div>{time.format('HH:mm:ss')}</div> | ||
120 | + </div> | ||
121 | + ); | ||
122 | + }, | ||
111 | }, | 123 | }, |
112 | { | 124 | { |
113 | title: '商家收款账户', | 125 | title: '商家收款账户', |
@@ -129,11 +141,6 @@ export default function() { | @@ -129,11 +141,6 @@ export default function() { | ||
129 | key: 'productName', | 141 | key: 'productName', |
130 | align: 'center', | 142 | align: 'center', |
131 | }, | 143 | }, |
132 | - // { | ||
133 | - // title: '业务单据号', | ||
134 | - // key: 'statementSn', | ||
135 | - // align: 'center', | ||
136 | - // }, | ||
137 | { | 144 | { |
138 | title: '账务类型', | 145 | title: '账务类型', |
139 | key: 'clearingType', | 146 | key: 'clearingType', |
@@ -141,7 +148,17 @@ export default function() { | @@ -141,7 +148,17 @@ export default function() { | ||
141 | }, | 148 | }, |
142 | { | 149 | { |
143 | title: '子服务类型', | 150 | title: '子服务类型', |
144 | - key: 'subClearingType', | 151 | + key: 'clearingTypeName', |
152 | + align: 'center', | ||
153 | + }, | ||
154 | + { | ||
155 | + title: '交易服务费', | ||
156 | + key: 'tradeServiceAmount', | ||
157 | + align: 'center', | ||
158 | + }, | ||
159 | + { | ||
160 | + title: '提现服务费', | ||
161 | + key: 'withdrawServiceAmount', | ||
145 | align: 'center', | 162 | align: 'center', |
146 | }, | 163 | }, |
147 | { | 164 | { |
@@ -161,10 +178,13 @@ export default function() { | @@ -161,10 +178,13 @@ export default function() { | ||
161 | }, | 178 | }, |
162 | { | 179 | { |
163 | title: '提现成功日期', | 180 | title: '提现成功日期', |
164 | - key: 'createTime', | 181 | + key: 'withdrawSuccessTime', |
165 | align: 'center', | 182 | align: 'center', |
166 | render(h, params) { | 183 | render(h, params) { |
167 | - const time = moment.unix(params.row.createTime); | 184 | + if (!params.row.withdrawSuccessTime) { |
185 | + return ''; | ||
186 | + } | ||
187 | + const time = moment.unix(params.row.withdrawSuccessTime); | ||
168 | return ( | 188 | return ( |
169 | <div> | 189 | <div> |
170 | <div>{time.format('YYYY/MM/DD')}</div> | 190 | <div>{time.format('YYYY/MM/DD')}</div> |
@@ -180,5 +200,37 @@ export default function() { | @@ -180,5 +200,37 @@ export default function() { | ||
180 | current: 1, | 200 | current: 1, |
181 | pageSize: 10, | 201 | pageSize: 10, |
182 | }, | 202 | }, |
203 | + summaryColumn: [ | ||
204 | + { | ||
205 | + title: '账务ID', | ||
206 | + key: 'summaryName', | ||
207 | + align: 'center', | ||
208 | + }, | ||
209 | + {}, | ||
210 | + {}, | ||
211 | + {}, | ||
212 | + {}, | ||
213 | + {}, | ||
214 | + {}, | ||
215 | + {}, | ||
216 | + { | ||
217 | + title: '交易服务费汇总', | ||
218 | + key: 'tradeServiceAmount', | ||
219 | + align: 'center', | ||
220 | + }, | ||
221 | + { | ||
222 | + title: '提现服务费汇总', | ||
223 | + key: 'withdrawServiceAmount', | ||
224 | + align: 'center', | ||
225 | + }, | ||
226 | + { | ||
227 | + title: '服务费汇总', | ||
228 | + key: 'serviceAmount', | ||
229 | + align: 'center', | ||
230 | + }, | ||
231 | + {}, | ||
232 | + {}, | ||
233 | + ], | ||
234 | + summaryInfo: [], | ||
183 | }; | 235 | }; |
184 | } | 236 | } |
1 | export default function() { | 1 | export default function() { |
2 | return { | 2 | return { |
3 | showLoading: true, | 3 | showLoading: true, |
4 | + show: true, | ||
5 | + timeCount: '', | ||
6 | + timer: null, | ||
4 | isAble: true, | 7 | isAble: true, |
5 | data: { | 8 | data: { |
6 | applyType: 0, | 9 | applyType: 0, |
@@ -28,6 +31,8 @@ export default function() { | @@ -28,6 +31,8 @@ export default function() { | ||
28 | token: '', | 31 | token: '', |
29 | timestamp: '', | 32 | timestamp: '', |
30 | salt: 'fd4ad5fcsa0de589af23234ks1923ks', | 33 | salt: 'fd4ad5fcsa0de589af23234ks1923ks', |
34 | + verifyCode: '', | ||
31 | }, | 35 | }, |
36 | + shopPhone: '', | ||
32 | }; | 37 | }; |
33 | } | 38 | } |
@@ -34,6 +34,11 @@ | @@ -34,6 +34,11 @@ | ||
34 | <Form-item label="提现金额" prop="withdrawAmount"> | 34 | <Form-item label="提现金额" prop="withdrawAmount"> |
35 | <input v-model="data.withdrawAmount" :disabled="isAble" placeholder="请选择日期获取提现金额" /> | 35 | <input v-model="data.withdrawAmount" :disabled="isAble" placeholder="请选择日期获取提现金额" /> |
36 | </Form-item> | 36 | </Form-item> |
37 | + <Form-item label="短信验证码"> | ||
38 | + <input v-model="data.verifyCode" placeholder="短信验证码" /> | ||
39 | + <Button v-show="show" type="primary" size="large" @click="getVerifyCode">获取验证码</Button> | ||
40 | + <Button v-show="!show" type="default" size="large" disabled> {{ timeCount }}s 后重新发送</Button> | ||
41 | + </Form-item> | ||
37 | <Form-item label="提现到帐号"> | 42 | <Form-item label="提现到帐号"> |
38 | <span>{{ data.withdrawAccount }}</span> | 43 | <span>{{ data.withdrawAccount }}</span> |
39 | </Form-item> | 44 | </Form-item> |
@@ -56,6 +61,7 @@ | @@ -56,6 +61,7 @@ | ||
56 | import moment from 'moment'; | 61 | import moment from 'moment'; |
57 | import crypto from 'util/crypto'; | 62 | import crypto from 'util/crypto'; |
58 | import FinanceService from 'services/finance/finance-service'; | 63 | import FinanceService from 'services/finance/finance-service'; |
64 | +import ShopService from 'services/shop/shop-service'; | ||
59 | import { WithdrawApply } from './store'; | 65 | import { WithdrawApply } from './store'; |
60 | 66 | ||
61 | export default { | 67 | export default { |
@@ -67,6 +73,7 @@ export default { | @@ -67,6 +73,7 @@ export default { | ||
67 | token: this.$user.token, | 73 | token: this.$user.token, |
68 | timestamps: Math.round(new Date().getTime() / 1000), | 74 | timestamps: Math.round(new Date().getTime() / 1000), |
69 | }; | 75 | }; |
76 | + this.shopService = new ShopService(); | ||
70 | this.financeService = new FinanceService(); | 77 | this.financeService = new FinanceService(); |
71 | this.financeService | 78 | this.financeService |
72 | .shopWithdrawApplyInit(params) | 79 | .shopWithdrawApplyInit(params) |
@@ -97,9 +104,66 @@ export default { | @@ -97,9 +104,66 @@ export default { | ||
97 | this.$Message.error('请求出错'); | 104 | this.$Message.error('请求出错'); |
98 | this.showLoading = false; | 105 | this.showLoading = false; |
99 | }); | 106 | }); |
107 | + this.getShopInfo(); | ||
100 | }, | 108 | }, |
101 | mounted() {}, | 109 | mounted() {}, |
102 | methods: { | 110 | methods: { |
111 | + //获取店铺信息 | ||
112 | + getShopInfo() { | ||
113 | + this.shopService.getShop().then(res => { | ||
114 | + const { checkTel } = res.data; | ||
115 | + this.shopPhone = checkTel; | ||
116 | + }); | ||
117 | + }, | ||
118 | + //获取短信验证码 | ||
119 | + getVerifyCode() { | ||
120 | + if (this.shopPhone === '') { | ||
121 | + this.$Notice.error({ | ||
122 | + title: '发送失败', | ||
123 | + desc: '店铺绑定手机为空,请先绑定手机', | ||
124 | + }); | ||
125 | + return false; | ||
126 | + } | ||
127 | + this.validateBtn(); | ||
128 | + const smsParams = { | ||
129 | + phones: this.shopPhone, | ||
130 | + project: 'shop', | ||
131 | + className: 'withdraw', | ||
132 | + methodName: 'getVerifyCode', | ||
133 | + }; | ||
134 | + return this.financeService.sendShopVerifyCode(smsParams).then(result => { | ||
135 | + if (result.code === 200) { | ||
136 | + this.$Notice.success({ | ||
137 | + title: '发送成功', | ||
138 | + desc: '验证码已发送到您手机!', | ||
139 | + }); | ||
140 | + } else { | ||
141 | + this.$Notice.error({ | ||
142 | + title: '发送失败', | ||
143 | + desc: result.message, | ||
144 | + }); | ||
145 | + } | ||
146 | + }); | ||
147 | + }, | ||
148 | + | ||
149 | + // 点击验证码后倒计时 | ||
150 | + validateBtn() { | ||
151 | + const timeCount = 60; | ||
152 | + if (!this.timer) { | ||
153 | + this.timeCount = timeCount; | ||
154 | + this.show = false; | ||
155 | + this.timer = setInterval(() => { | ||
156 | + if (this.timeCount > 0 && this.timeCount <= timeCount) { | ||
157 | + this.timeCount--; | ||
158 | + } else { | ||
159 | + this.show = true; | ||
160 | + clearInterval(this.timer); | ||
161 | + this.timer = null; | ||
162 | + } | ||
163 | + }, 1000); | ||
164 | + } | ||
165 | + }, | ||
166 | + | ||
103 | backList() { | 167 | backList() { |
104 | this.$router.push({ name: 'finance.withdraw.withdrawlist' }); | 168 | this.$router.push({ name: 'finance.withdraw.withdrawlist' }); |
105 | }, | 169 | }, |
@@ -130,28 +194,50 @@ export default { | @@ -130,28 +194,50 @@ export default { | ||
130 | params.sign = crypto.md5(arrParams.join('|')); | 194 | params.sign = crypto.md5(arrParams.join('|')); |
131 | params.account = this.$user.name; | 195 | params.account = this.$user.name; |
132 | params.timeout = 60000; // 提现超时时间60秒 | 196 | params.timeout = 60000; // 提现超时时间60秒 |
197 | + // 短信验证码 | ||
198 | + params.verifyCode = this.data.verifyCode; | ||
133 | return params; | 199 | return params; |
134 | }, | 200 | }, |
135 | save() { | 201 | save() { |
202 | + if (!this.beforeSave()) { | ||
203 | + return false; | ||
204 | + } | ||
136 | const applyParams = this.beforeSave(); | 205 | const applyParams = this.beforeSave(); |
137 | - this.$Loading.start(); | ||
138 | - this.submitDisabled = true; | ||
139 | - return this.financeService.shopWithdrawApply(applyParams).then(result => { | ||
140 | - if (result.code === 200) { | ||
141 | - this.$Loading.finish(); | ||
142 | - this.$Notice.success({ | ||
143 | - title: '提交成功', | ||
144 | - desc: '确认提现成功!', | ||
145 | - }); | ||
146 | - this.backList(); | ||
147 | - } else { | ||
148 | - this.$Loading.error(); | ||
149 | - this.submitDisabled = false; | ||
150 | - this.$Notice.error({ | 206 | + if (!applyParams.verifyCode || applyParams.verifyCode === '') { |
207 | + this.$Notice.error({ | ||
208 | + title: '提交错误', | ||
209 | + desc: '验证码不能为空', | ||
210 | + }); | ||
211 | + return false; | ||
212 | + } | ||
213 | + const _this = this; | ||
214 | + this.financeService.verifySmsCode({ phone: this.shopPhone, verifyCode: applyParams.verifyCode }).then(res => { | ||
215 | + if (res.code !== 200) { | ||
216 | + _this.$Notice.error({ | ||
151 | title: '提交错误', | 217 | title: '提交错误', |
152 | - desc: result.message, | 218 | + desc: res.message, |
153 | }); | 219 | }); |
220 | + return false; | ||
154 | } | 221 | } |
222 | + _this.$Loading.start(); | ||
223 | + _this.submitDisabled = true; | ||
224 | + _this.financeService.shopWithdrawApply(applyParams).then(result => { | ||
225 | + if (result.code === 200) { | ||
226 | + _this.$Loading.finish(); | ||
227 | + _this.$Notice.success({ | ||
228 | + title: '提交成功', | ||
229 | + desc: '确认提现成功!', | ||
230 | + }); | ||
231 | + _this.backList(); | ||
232 | + } else { | ||
233 | + _this.$Loading.error(); | ||
234 | + _this.submitDisabled = false; | ||
235 | + _this.$Notice.error({ | ||
236 | + title: '提交错误', | ||
237 | + desc: result.message, | ||
238 | + }); | ||
239 | + } | ||
240 | + }); | ||
155 | }); | 241 | }); |
156 | }, | 242 | }, |
157 | submit() { | 243 | submit() { |
@@ -74,7 +74,7 @@ export default { | @@ -74,7 +74,7 @@ export default { | ||
74 | }, | 74 | }, |
75 | //编辑 | 75 | //编辑 |
76 | edit(params) { | 76 | edit(params) { |
77 | - this.title = '编辑运费魔板'; | 77 | + this.title = '编辑运费模板'; |
78 | const { templateName, defaultFee, freeMount, id } = params; | 78 | const { templateName, defaultFee, freeMount, id } = params; |
79 | this.templateName = templateName; | 79 | this.templateName = templateName; |
80 | this.defaultFee = defaultFee; | 80 | this.defaultFee = defaultFee; |
@@ -9,15 +9,15 @@ | @@ -9,15 +9,15 @@ | ||
9 | </Row> | 9 | </Row> |
10 | <br /> | 10 | <br /> |
11 | <Row> | 11 | <Row> |
12 | - <i-col span="4">订单号:{{ orderInfo.orderCode }}</i-col> | ||
13 | - <i-col span="4">下单时间:{{ orderInfo.createTime | timeFormat }}</i-col> | ||
14 | - <i-col span="4">发货时间:{{ orderInfo.shipmentTime | timeFormat }}</i-col> | 12 | + <i-col span="6">订单号:{{ orderInfo.orderCode }}</i-col> |
13 | + <i-col span="6">下单时间:{{ orderInfo.createTime | timeFormat }}</i-col> | ||
14 | + <i-col span="6">发货时间:{{ orderInfo.shipmentTime | timeFormat }}</i-col> | ||
15 | </Row> | 15 | </Row> |
16 | <br /> | 16 | <br /> |
17 | <Row> | 17 | <Row> |
18 | - <i-col span="4">订单状态:{{ orderStatus[orderInfo.orderStatus] }}</i-col> | ||
19 | - <i-col span="4">提交时间:{{ orderInfo.checkTime | timeFormat }}</i-col> | ||
20 | - <i-col span="4">成交时间:{{ orderInfo.deliveryTime | timeFormat }}</i-col> | 18 | + <i-col span="6">订单状态:{{ orderStatus[orderInfo.orderStatus] }}</i-col> |
19 | + <i-col span="6">提交时间:{{ orderInfo.checkTime | timeFormat }}</i-col> | ||
20 | + <i-col span="6">成交时间:{{ orderInfo.deliveryTime | timeFormat }}</i-col> | ||
21 | </Row> | 21 | </Row> |
22 | </div> | 22 | </div> |
23 | </div> | 23 | </div> |
@@ -23,6 +23,7 @@ | @@ -23,6 +23,7 @@ | ||
23 | <td>{{ goods.productPrice && goods.productPrice.retailPrice ? goods.productPrice.retailPrice : '' }}</td> | 23 | <td>{{ goods.productPrice && goods.productPrice.retailPrice ? goods.productPrice.retailPrice : '' }}</td> |
24 | <td>{{ goods.salePrice }}</td> | 24 | <td>{{ goods.salePrice }}</td> |
25 | <td>{{ goods.lastPrice }}</td> | 25 | <td>{{ goods.lastPrice }}</td> |
26 | + <td>{{ goods.discountPrice }}</td> | ||
26 | <td> | 27 | <td> |
27 | {{ | 28 | {{ |
28 | goodsPromos[goods.id] && goodsPromos[goods.id].couponsDiscountAmount | 29 | goodsPromos[goods.id] && goodsPromos[goods.id].couponsDiscountAmount |
@@ -50,13 +51,13 @@ | @@ -50,13 +51,13 @@ | ||
50 | </tbody> | 51 | </tbody> |
51 | <tfoot> | 52 | <tfoot> |
52 | <tr> | 53 | <tr> |
53 | - <td colspan="13" style="text-align: left"> | 54 | + <td colspan="14" style="text-align: left"> |
54 | <span>实付金额:¥{{ orderInfo.lastOrderAmount }}</span> | 55 | <span>实付金额:¥{{ orderInfo.lastOrderAmount }}</span> |
55 | <span>快递费:¥{{ orderInfo.shippingCost }}</span> | 56 | <span>快递费:¥{{ orderInfo.shippingCost }}</span> |
56 | </td> | 57 | </td> |
57 | </tr> | 58 | </tr> |
58 | <tr> | 59 | <tr> |
59 | - <td td colspan="13"> | 60 | + <td td colspan="14"> |
60 | <div class="ivu-card"> | 61 | <div class="ivu-card"> |
61 | <div class="ivu-card-head" style="text-align: left"> | 62 | <div class="ivu-card-head" style="text-align: left"> |
62 | <p slot="title">使用优惠券</p> | 63 | <p slot="title">使用优惠券</p> |
@@ -66,7 +67,7 @@ | @@ -66,7 +67,7 @@ | ||
66 | </td> | 67 | </td> |
67 | </tr> | 68 | </tr> |
68 | <tr> | 69 | <tr> |
69 | - <td colspan="13"> | 70 | + <td colspan="14"> |
70 | <div class="ivu-card"> | 71 | <div class="ivu-card"> |
71 | <div class="ivu-card-head" style="text-align: left"> | 72 | <div class="ivu-card-head" style="text-align: left"> |
72 | <p slot="title">参与促销</p> | 73 | <p slot="title">参与促销</p> |
@@ -108,6 +109,7 @@ export default { | @@ -108,6 +109,7 @@ export default { | ||
108 | { title: '吊牌价', width: '6%' }, | 109 | { title: '吊牌价', width: '6%' }, |
109 | { title: '销售价', width: '6%' }, | 110 | { title: '销售价', width: '6%' }, |
110 | { title: '成交价', width: '6%' }, | 111 | { title: '成交价', width: '6%' }, |
112 | + { title: 'VIP折扣', width: '6%' }, | ||
111 | { title: '优惠券', width: '6%' }, | 113 | { title: '优惠券', width: '6%' }, |
112 | { title: 'YOHO币', width: '6%' }, | 114 | { title: 'YOHO币', width: '6%' }, |
113 | { title: '红包', width: '6%' }, | 115 | { title: '红包', width: '6%' }, |
@@ -125,10 +127,6 @@ export default { | @@ -125,10 +127,6 @@ export default { | ||
125 | key: 'couponAmount', | 127 | key: 'couponAmount', |
126 | }, | 128 | }, |
127 | { | 129 | { |
128 | - title: '优惠券金额调整', | ||
129 | - key: 'couponAdjustAmount', | ||
130 | - }, | ||
131 | - { | ||
132 | title: '费用承担类型', | 130 | title: '费用承担类型', |
133 | key: 'feeSharingTypeStr', | 131 | key: 'feeSharingTypeStr', |
134 | }, | 132 | }, |
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | <td :rowspan="item.goodsList.length">{{ item.consigneeName }}</td> | 32 | <td :rowspan="item.goodsList.length">{{ item.consigneeName }}</td> |
33 | <td :rowspan="item.goodsList.length">{{ paymentStatusArr[item.paymentStatus] }}</td> | 33 | <td :rowspan="item.goodsList.length">{{ paymentStatusArr[item.paymentStatus] }}</td> |
34 | <td :rowspan="item.goodsList.length">{{ item.lastOrderAmount }}</td> | 34 | <td :rowspan="item.goodsList.length">{{ item.lastOrderAmount }}</td> |
35 | - <td :rowspan="item.goodsList.length">{{ orderStatusArr[item.orderStatus] }}</td> | 35 | + <td :rowspan="item.goodsList.length">{{ item.orderStatusStr }}</td> |
36 | <td :rowspan="item.goodsList.length"> | 36 | <td :rowspan="item.goodsList.length"> |
37 | <i-button type="default" size="small" @click="goToDetail(item.orderCode)">查看订单</i-button> | 37 | <i-button type="default" size="small" @click="goToDetail(item.orderCode)">查看订单</i-button> |
38 | <template v-if="item.orderStatus == 100 || item.orderStatus == 200"> | 38 | <template v-if="item.orderStatus == 100 || item.orderStatus == 200"> |
@@ -20,16 +20,29 @@ | @@ -20,16 +20,29 @@ | ||
20 | </Option> | 20 | </Option> |
21 | </Select> | 21 | </Select> |
22 | </filter-item> | 22 | </filter-item> |
23 | + <filter-item label="开始时间"> | ||
24 | + <Date-picker v-model="beginTimeModel" type="datetime" placeholder="创建开始时间" clearable></Date-picker> | ||
25 | + </filter-item> | ||
26 | + <filter-item label="结束时间"> | ||
27 | + <Date-picker v-model="endTimeModel" type="datetime" placeholder="创建结束时间" clearable></Date-picker> | ||
28 | + </filter-item> | ||
23 | <filter-item> | 29 | <filter-item> |
24 | <Button type="primary" @click="search">筛选</Button> | 30 | <Button type="primary" @click="search">筛选</Button> |
25 | <Button @click="reset">全部</Button> | 31 | <Button @click="reset">全部</Button> |
32 | + <Button type="warning" @click="exportList">导出</Button> | ||
26 | </filter-item> | 33 | </filter-item> |
27 | </layout-filter> | 34 | </layout-filter> |
28 | <layout-list> | 35 | <layout-list> |
29 | <list-tabs @change-tabs="onChangeTabs"></list-tabs> | 36 | <list-tabs @change-tabs="onChangeTabs"></list-tabs> |
30 | <data-table :table-data="tableData" :payment-status-arr="paymentStatusArr" :order-status-arr="orderStatusArr"> | 37 | <data-table :table-data="tableData" :payment-status-arr="paymentStatusArr" :order-status-arr="orderStatusArr"> |
31 | </data-table> | 38 | </data-table> |
32 | - <Page :total="pageData.total" :current="pageData.current" :page-size="20" show-total @on-change="pageChange"> | 39 | + <Page |
40 | + :total="pageData.total" | ||
41 | + :current="pageData.current" | ||
42 | + :page-size="pageData.pageSize" | ||
43 | + show-total | ||
44 | + @on-change="pageChange" | ||
45 | + > | ||
33 | </Page> | 46 | </Page> |
34 | </layout-list> | 47 | </layout-list> |
35 | </layout-body> | 48 | </layout-body> |
@@ -40,6 +53,7 @@ import { ListTabs, DataTable } from './components'; | @@ -40,6 +53,7 @@ import { ListTabs, DataTable } from './components'; | ||
40 | import { OrderService } from 'services/order'; | 53 | import { OrderService } from 'services/order'; |
41 | import _ from 'lodash'; | 54 | import _ from 'lodash'; |
42 | import { OrderConfig } from '../configs'; | 55 | import { OrderConfig } from '../configs'; |
56 | +import qs from 'querystringify'; | ||
43 | export default { | 57 | export default { |
44 | components: { ListTabs, DataTable }, | 58 | components: { ListTabs, DataTable }, |
45 | data() { | 59 | data() { |
@@ -51,11 +65,15 @@ export default { | @@ -51,11 +65,15 @@ export default { | ||
51 | productSku: '', | 65 | productSku: '', |
52 | consigneeName: '', | 66 | consigneeName: '', |
53 | orderStatus: '', | 67 | orderStatus: '', |
54 | - pageSize: 20, | 68 | + pageSize: 10, |
55 | pageNo: 1, | 69 | pageNo: 1, |
56 | orderStatusStr: '', | 70 | orderStatusStr: '', |
57 | orderStatusType: 0, | 71 | orderStatusType: 0, |
72 | + beginCreateTime: '', | ||
73 | + endCreateTime: '', | ||
58 | }, | 74 | }, |
75 | + beginTimeModel: '', | ||
76 | + endTimeModel: '', | ||
59 | tableData: [], | 77 | tableData: [], |
60 | orderStatusArr: OrderConfig.orderStatus, | 78 | orderStatusArr: OrderConfig.orderStatus, |
61 | pageData: { | 79 | pageData: { |
@@ -64,6 +82,20 @@ export default { | @@ -64,6 +82,20 @@ export default { | ||
64 | }, | 82 | }, |
65 | }; | 83 | }; |
66 | }, | 84 | }, |
85 | + watch: { | ||
86 | + beginTimeModel: { | ||
87 | + handler(newValue) { | ||
88 | + this.query.beginCreateTime = new Date(newValue).getTime() / 1000; | ||
89 | + }, | ||
90 | + deep: true, | ||
91 | + }, | ||
92 | + endTimeModel: { | ||
93 | + handler(newValue) { | ||
94 | + this.query.endCreateTime = new Date(newValue).getTime() / 1000; | ||
95 | + }, | ||
96 | + deep: true, | ||
97 | + }, | ||
98 | + }, | ||
67 | created() { | 99 | created() { |
68 | this.orderService = new OrderService(); | 100 | this.orderService = new OrderService(); |
69 | this.search(); | 101 | this.search(); |
@@ -93,8 +125,18 @@ export default { | @@ -93,8 +125,18 @@ export default { | ||
93 | this.query.orderStatus = ''; | 125 | this.query.orderStatus = ''; |
94 | this.query.pageSize = 20; | 126 | this.query.pageSize = 20; |
95 | this.query.pageNo = 1; | 127 | this.query.pageNo = 1; |
128 | + this.query.beginCreateTime = ''; | ||
129 | + this.query.endCreateTime = ''; | ||
130 | + this.beginTimeModel = ''; | ||
131 | + this.endTimeModel = ''; | ||
96 | this.search(); | 132 | this.search(); |
97 | }, | 133 | }, |
134 | + //导出列表 | ||
135 | + exportList() { | ||
136 | + const queryString = qs.stringify(this.query, true); | ||
137 | + const href = `${OrderService.exportOrdersByStatus}${queryString}`; | ||
138 | + window.open(href, '_blank'); | ||
139 | + }, | ||
98 | }, | 140 | }, |
99 | }; | 141 | }; |
100 | </script> | 142 | </script> |
1 | <template> | 1 | <template> |
2 | <div class="ivu-card"> | 2 | <div class="ivu-card"> |
3 | <div class="ivu-card-head"> | 3 | <div class="ivu-card-head"> |
4 | - <h3>退款商品信息</h3> | 4 | + <p slot="title">退款商品信息</p> |
5 | </div> | 5 | </div> |
6 | <div class="ivu-card-body"> | 6 | <div class="ivu-card-body"> |
7 | <table cellspacing="0" cellpadding="0" class="order-detail"> | 7 | <table cellspacing="0" cellpadding="0" class="order-detail"> |
@@ -31,17 +31,6 @@ | @@ -31,17 +31,6 @@ | ||
31 | <td>{{ goods.giftCardAmount }}</td> | 31 | <td>{{ goods.giftCardAmount }}</td> |
32 | <td>{{ goods.activityDiscount }}</td> | 32 | <td>{{ goods.activityDiscount }}</td> |
33 | <td>{{ returnedReason[goods.returnedReason] }}</td> | 33 | <td>{{ returnedReason[goods.returnedReason] }}</td> |
34 | - <template v-if="index == 0"> | ||
35 | - <td :rowspan="tableData.length"> | ||
36 | - {{ returnedInfo.realReturnedAmount }} | ||
37 | - </td> | ||
38 | - <td :rowspan="tableData.length"> | ||
39 | - {{ returnedInfo.returnShippingCost }} | ||
40 | - </td> | ||
41 | - <td :rowspan="tableData.length"> | ||
42 | - {{ returnedInfo.realReturnedAmount + returnedInfo.returnShippingCost }} | ||
43 | - </td> | ||
44 | - </template> | ||
45 | </tr> | 34 | </tr> |
46 | <tr v-if="goods.remark || goods.imperfectImage" :key="index + '_1'" class="returned-remark"> | 35 | <tr v-if="goods.remark || goods.imperfectImage" :key="index + '_1'" class="returned-remark"> |
47 | <td colspan="14"> | 36 | <td colspan="14"> |
@@ -64,7 +53,7 @@ | @@ -64,7 +53,7 @@ | ||
64 | import prodImage from 'util/prod-image'; | 53 | import prodImage from 'util/prod-image'; |
65 | export default { | 54 | export default { |
66 | name: 'ReturnedGoodsInfo', | 55 | name: 'ReturnedGoodsInfo', |
67 | - props: ['tableData', 'returnedReason', 'returnedInfo'], | 56 | + props: ['tableData', 'returnedReason'], |
68 | data() { | 57 | data() { |
69 | return { | 58 | return { |
70 | tableCols: [ | 59 | tableCols: [ |
@@ -79,9 +68,6 @@ export default { | @@ -79,9 +68,6 @@ export default { | ||
79 | { title: '礼品卡', width: '6%' }, | 68 | { title: '礼品卡', width: '6%' }, |
80 | { title: '活动优惠', width: '6%' }, | 69 | { title: '活动优惠', width: '6%' }, |
81 | { title: '退款原因', width: '6%' }, | 70 | { title: '退款原因', width: '6%' }, |
82 | - { title: '退货款金额', width: '6%' }, | ||
83 | - { title: '退运费金额', width: '6%' }, | ||
84 | - { title: '退款总金额', width: '6%' }, | ||
85 | ], | 71 | ], |
86 | }; | 72 | }; |
87 | }, | 73 | }, |
@@ -21,14 +21,27 @@ | @@ -21,14 +21,27 @@ | ||
21 | </Option> | 21 | </Option> |
22 | </Select> | 22 | </Select> |
23 | </filter-item> | 23 | </filter-item> |
24 | + <filter-item label="开始时间"> | ||
25 | + <Date-picker v-model="beginTimeModel" type="datetime" placeholder="申请开始时间" clearable></Date-picker> | ||
26 | + </filter-item> | ||
27 | + <filter-item label="结束时间"> | ||
28 | + <Date-picker v-model="endTimeModel" type="datetime" placeholder="申请结束时间" clearable></Date-picker> | ||
29 | + </filter-item> | ||
24 | <filter-item> | 30 | <filter-item> |
25 | <Button type="primary" @click="search">筛选</Button> | 31 | <Button type="primary" @click="search">筛选</Button> |
26 | <Button @click="reset">全部</Button> | 32 | <Button @click="reset">全部</Button> |
33 | + <Button type="warning" @click="exportList">导出</Button> | ||
27 | </filter-item> | 34 | </filter-item> |
28 | </layout-filter> | 35 | </layout-filter> |
29 | <layout-list> | 36 | <layout-list> |
30 | <returned-list-table :table-data="tableData" :shop-status="returnedGoodsShopStatus"></returned-list-table> | 37 | <returned-list-table :table-data="tableData" :shop-status="returnedGoodsShopStatus"></returned-list-table> |
31 | - <Page :total="pageData.total" :current="pageData.current" :page-size="20" show-total @on-change="pageChange"> | 38 | + <Page |
39 | + :total="pageData.total" | ||
40 | + :current="pageData.current" | ||
41 | + :page-size="pageData.pageSize" | ||
42 | + show-total | ||
43 | + @on-change="pageChange" | ||
44 | + > | ||
32 | </Page> | 45 | </Page> |
33 | </layout-list> | 46 | </layout-list> |
34 | </layout-body> | 47 | </layout-body> |
@@ -39,21 +52,26 @@ import { ReturnedListTable } from '../components'; | @@ -39,21 +52,26 @@ import { ReturnedListTable } from '../components'; | ||
39 | import { ReturnedService } from 'services/order'; | 52 | import { ReturnedService } from 'services/order'; |
40 | import { OrderConfig } from 'pages/order/configs'; | 53 | import { OrderConfig } from 'pages/order/configs'; |
41 | import _ from 'lodash'; | 54 | import _ from 'lodash'; |
55 | +import qs from 'querystringify'; | ||
42 | 56 | ||
43 | export default { | 57 | export default { |
44 | components: { ReturnedListTable }, | 58 | components: { ReturnedListTable }, |
45 | data() { | 59 | data() { |
46 | return { | 60 | return { |
61 | + beginTimeModel: '', | ||
62 | + endTimeModel: '', | ||
47 | paymentStatusArr: OrderConfig.paymentStatus, | 63 | paymentStatusArr: OrderConfig.paymentStatus, |
48 | query: { | 64 | query: { |
49 | orderCode: '', | 65 | orderCode: '', |
50 | productSkn: '', | 66 | productSkn: '', |
51 | productSku: '', | 67 | productSku: '', |
52 | consigneeName: '', | 68 | consigneeName: '', |
53 | - pageSize: 20, | 69 | + pageSize: 10, |
54 | pageNo: 1, | 70 | pageNo: 1, |
55 | queryType: 1, | 71 | queryType: 1, |
56 | shopStatus: '-1', | 72 | shopStatus: '-1', |
73 | + startTime: '', | ||
74 | + endTime: '', | ||
57 | }, | 75 | }, |
58 | returnedGoodsShopStatus: OrderConfig.returnedGoodsShopStatus, | 76 | returnedGoodsShopStatus: OrderConfig.returnedGoodsShopStatus, |
59 | pageData: { | 77 | pageData: { |
@@ -63,6 +81,20 @@ export default { | @@ -63,6 +81,20 @@ export default { | ||
63 | tableData: [], | 81 | tableData: [], |
64 | }; | 82 | }; |
65 | }, | 83 | }, |
84 | + watch: { | ||
85 | + beginTimeModel: { | ||
86 | + handler(newValue) { | ||
87 | + this.query.startTime = new Date(newValue).getTime() / 1000; | ||
88 | + }, | ||
89 | + deep: true, | ||
90 | + }, | ||
91 | + endTimeModel: { | ||
92 | + handler(newValue) { | ||
93 | + this.query.endTime = new Date(newValue).getTime() / 1000; | ||
94 | + }, | ||
95 | + deep: true, | ||
96 | + }, | ||
97 | + }, | ||
66 | created() { | 98 | created() { |
67 | this.ReturnedService = new ReturnedService(); | 99 | this.ReturnedService = new ReturnedService(); |
68 | this.search(); | 100 | this.search(); |
@@ -90,8 +122,18 @@ export default { | @@ -90,8 +122,18 @@ export default { | ||
90 | this.query.pageSize = 20; | 122 | this.query.pageSize = 20; |
91 | this.query.pageNo = 1; | 123 | this.query.pageNo = 1; |
92 | this.query.orderStatusStr = ''; | 124 | this.query.orderStatusStr = ''; |
125 | + this.query.startTime = ''; | ||
126 | + this.query.endTime = ''; | ||
127 | + this.beginTimeModel = ''; | ||
128 | + this.endTimeModel = ''; | ||
93 | this.search(); | 129 | this.search(); |
94 | }, | 130 | }, |
131 | + //导出列表 | ||
132 | + exportList() { | ||
133 | + const queryString = qs.stringify(this.query, true); | ||
134 | + const href = `${ReturnedService.exportReturnedGoods}${queryString}`; | ||
135 | + window.open(href, '_blank'); | ||
136 | + }, | ||
95 | }, | 137 | }, |
96 | }; | 138 | }; |
97 | </script> | 139 | </script> |
@@ -2,17 +2,23 @@ | @@ -2,17 +2,23 @@ | ||
2 | <div class="ivu-row"> | 2 | <div class="ivu-row"> |
3 | <div class="ivu-card"> | 3 | <div class="ivu-card"> |
4 | <div class="ivu-card-head"> | 4 | <div class="ivu-card-head"> |
5 | - <h3>退货申请处理</h3> | 5 | + <p slot="title">退货申请处理</p> |
6 | </div> | 6 | </div> |
7 | <div class="ivu-card-body"> | 7 | <div class="ivu-card-body"> |
8 | <Row> | 8 | <Row> |
9 | - <i-col span="4">退货ID:{{ id }}</i-col> | ||
10 | - <i-col span="4">退款申请时间:{{ returnedInfo.createTime | timeFormat }}</i-col> | ||
11 | - <i-col span="4">退货状态:{{ returnedGoodsShopStatus[returnedInfo.shopStatus] }}</i-col> | 9 | + <i-col span="6">退货ID:{{ id }}</i-col> |
10 | + <i-col span="6">退款申请时间:{{ returnedInfo.createTime | timeFormat }}</i-col> | ||
11 | + <i-col span="6">退货状态:{{ returnedGoodsShopStatus[returnedInfo.shopStatus] }}</i-col> | ||
12 | </Row> | 12 | </Row> |
13 | + <br /> | ||
14 | + <Row> | ||
15 | + <i-col span="6">退货款金额:{{ returnedInfo.realReturnedAmount }}</i-col> | ||
16 | + <i-col span="6">退运费金额:{{ returnedInfo.returnShippingCost }}</i-col> | ||
17 | + <i-col span="6">退款总金额:{{ returnTotalAmount }}</i-col> | ||
18 | + </Row> | ||
19 | + <br /> | ||
13 | <Row> | 20 | <Row> |
14 | - <i-col span="4">退款总金额:{{ returnTotalAmount }}</i-col> | ||
15 | - <i-col span="4"> | 21 | + <i-col span="8"> |
16 | 退款成功时间:<span v-if="returnedInfo.refundTime">{{ returnedInfo.refundTime | timeFormat }}</span> | 22 | 退款成功时间:<span v-if="returnedInfo.refundTime">{{ returnedInfo.refundTime | timeFormat }}</span> |
17 | </i-col> | 23 | </i-col> |
18 | </Row> | 24 | </Row> |
@@ -21,8 +27,7 @@ | @@ -21,8 +27,7 @@ | ||
21 | <!--订单基本信息--> | 27 | <!--订单基本信息--> |
22 | <order-base-info :order-info="orderInfo" :order-status="orderStatus"></order-base-info> | 28 | <order-base-info :order-info="orderInfo" :order-status="orderStatus"></order-base-info> |
23 | <!--退货商品信息--> | 29 | <!--退货商品信息--> |
24 | - <returned-goods-info :table-data="returnGoods" :returned-reason="returnedReasonArr" :returned-info="returnedInfo"> | ||
25 | - </returned-goods-info> | 30 | + <returned-goods-info :table-data="returnGoods" :returned-reason="returnedReasonArr"></returned-goods-info> |
26 | <div class="ivu-card"> | 31 | <div class="ivu-card"> |
27 | <div class="ivu-card-head"> | 32 | <div class="ivu-card-head"> |
28 | <h3>寄回物流信息</h3> | 33 | <h3>寄回物流信息</h3> |
@@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
66 | <Option v-for="streetOption in streetList[addressSelected.district.value]" :label="streetOption.name" :value="streetOption.value" :key="streetOption.value"></Option> | 66 | <Option v-for="streetOption in streetList[addressSelected.district.value]" :label="streetOption.name" :value="streetOption.value" :key="streetOption.value"></Option> |
67 | </Select> | 67 | </Select> |
68 | <Input v-model="addressDetail" placeholder="详细地址"></Input> | 68 | <Input v-model="addressDetail" placeholder="详细地址"></Input> |
69 | - <p>注:店铺地址味店铺最新可联系到的地址</p> | 69 | + <p>注:店铺地址为店铺最新可联系到的地址</p> |
70 | </div> | 70 | </div> |
71 | </Form-item> | 71 | </Form-item> |
72 | <Form-item v-if="shopData.shopNature === 6" label="店铺客服电话:"> | 72 | <Form-item v-if="shopData.shopNature === 6" label="店铺客服电话:"> |
@@ -16,6 +16,12 @@ const apiUrl = { | @@ -16,6 +16,12 @@ const apiUrl = { | ||
16 | shopWithdrawApplyInit: '/erp/shopWithdrawApplyInit', | 16 | shopWithdrawApplyInit: '/erp/shopWithdrawApplyInit', |
17 | shopGetAvailableAmount: '/erp/shopGetAvailableAmount', | 17 | shopGetAvailableAmount: '/erp/shopGetAvailableAmount', |
18 | shopWithdrawApply: '/erp/shopWithdrawApply', | 18 | shopWithdrawApply: '/erp/shopWithdrawApply', |
19 | + sendShopVerifyCode: '/erp/sendShopVerifyCode', | ||
20 | + verifySmsCode: '/erp/verifySmsCode', | ||
21 | + queryShopBillList: '/erp/queryShopBillList', | ||
22 | + querySummaryInfo: '/erp/querySummaryInfo', | ||
23 | + queryBillSummary: '/erp/queryBillSummary', | ||
24 | + queryFreightBillSummary: '/erp/queryFreightBillSummary', | ||
19 | }; | 25 | }; |
20 | 26 | ||
21 | class FinanceService extends Service { | 27 | class FinanceService extends Service { |
@@ -145,10 +151,60 @@ class FinanceService extends Service { | @@ -145,10 +151,60 @@ class FinanceService extends Service { | ||
145 | shopWithdrawApply(params) { | 151 | shopWithdrawApply(params) { |
146 | return this.post(apiUrl.shopWithdrawApply, params); | 152 | return this.post(apiUrl.shopWithdrawApply, params); |
147 | } | 153 | } |
154 | + | ||
155 | + /** | ||
156 | + * 获取提现短信验证码 | ||
157 | + * @param params | ||
158 | + * @return {*} | ||
159 | + */ | ||
160 | + sendShopVerifyCode(params) { | ||
161 | + return this.post(apiUrl.sendShopVerifyCode, params); | ||
162 | + } | ||
163 | + | ||
164 | + /** | ||
165 | + * 验证短信验证码 | ||
166 | + * @param params | ||
167 | + * @return {*} | ||
168 | + */ | ||
169 | + verifySmsCode(params) { | ||
170 | + return this.post(apiUrl.verifySmsCode, params); | ||
171 | + } | ||
172 | + | ||
173 | + /** | ||
174 | + * 交易账务明细新 | ||
175 | + * @param params | ||
176 | + * @returns {Promise<unknown>} | ||
177 | + */ | ||
178 | + shopBillList(params) { | ||
179 | + return this.post(apiUrl.queryShopBillList, params); | ||
180 | + } | ||
181 | + | ||
182 | + /** | ||
183 | + * 财务明细汇总 | ||
184 | + * @param params | ||
185 | + */ | ||
186 | + querySummaryInfo(params) { | ||
187 | + return this.post(apiUrl.querySummaryInfo, params); | ||
188 | + } | ||
189 | + | ||
190 | + /** | ||
191 | + * 服务费账单汇总 | ||
192 | + * @param params | ||
193 | + */ | ||
194 | + queryBillSummary(params) { | ||
195 | + return this.post(apiUrl.queryBillSummary, params); | ||
196 | + } | ||
197 | + | ||
198 | + /** | ||
199 | + * 运费账务汇总 | ||
200 | + * @param params | ||
201 | + */ | ||
202 | + queryFreightBillSummary(params) { | ||
203 | + return this.post(apiUrl.queryFreightBillSummary, params); | ||
204 | + } | ||
148 | } | 205 | } |
149 | 206 | ||
150 | FinanceService.exportBalanceList = '/Api/erp/exportBalanceList'; // 导出对账单列表, 结算单列表 | 207 | FinanceService.exportBalanceList = '/Api/erp/exportBalanceList'; // 导出对账单列表, 结算单列表 |
151 | FinanceService.exportBalanceDetail = '/Api/erp/exportBalanceDetail'; // 导出对账单详情 | 208 | FinanceService.exportBalanceDetail = '/Api/erp/exportBalanceDetail'; // 导出对账单详情 |
152 | -FinanceService.exportSettlementDetail = '/Api/erp/exportSettlementDetail'; // 导出结算单详情 | ||
153 | FinanceService.exportInventory = '/Api/erp/exportInventoryLedgerList'; // 导出结算单库存 | 209 | FinanceService.exportInventory = '/Api/erp/exportInventoryLedgerList'; // 导出结算单库存 |
154 | export default FinanceService; | 210 | export default FinanceService; |
app/util/excel.js
0 → 100644
@@ -97,7 +97,7 @@ const domainApis = { | @@ -97,7 +97,7 @@ const domainApis = { | ||
97 | orderDetail: '/erp-gateway-web/shop/orders/queryOrdersDetail', //订单详情 | 97 | orderDetail: '/erp-gateway-web/shop/orders/queryOrdersDetail', //订单详情 |
98 | queryOrderGoods: '/erp-gateway-web/shop/orders/queryOrdersGoodsAndPrice', //获取订单商品 | 98 | queryOrderGoods: '/erp-gateway-web/shop/orders/queryOrdersGoodsAndPrice', //获取订单商品 |
99 | queryOrderGoodsPromos: '/erp-gateway-web/cs/order/goodspromos/query', //获取订单商品的促销 | 99 | queryOrderGoodsPromos: '/erp-gateway-web/cs/order/goodspromos/query', //获取订单商品的促销 |
100 | - queryOrderCoupons: '/erp-gateway-web/cs/order/coupons', //获取订单优惠券 | 100 | + queryOrderCoupons: '/erp-gateway-web/shop/orders/queryShopOrderCoupons', //获取订单优惠券 |
101 | queryOrderPromos: '/erp-gateway-web/cs/order/promotions', //获取订单促销 | 101 | queryOrderPromos: '/erp-gateway-web/cs/order/promotions', //获取订单促销 |
102 | confirmExpress: '/erp-gateway-web/shop/orders/ordersUpdateExpress', //订单确认物流 | 102 | confirmExpress: '/erp-gateway-web/shop/orders/ordersUpdateExpress', //订单确认物流 |
103 | exportOrdersByStatus: '/erp-gateway-web/shop/export/exportOrdersByStatus', //导出订单列表 | 103 | exportOrdersByStatus: '/erp-gateway-web/shop/export/exportOrdersByStatus', //导出订单列表 |
@@ -127,6 +127,12 @@ const domainApis = { | @@ -127,6 +127,12 @@ const domainApis = { | ||
127 | shopWithdrawApplyInit: '/erp-gateway-web/shop/withdraw/init', //提现页面初始数据 | 127 | shopWithdrawApplyInit: '/erp-gateway-web/shop/withdraw/init', //提现页面初始数据 |
128 | shopGetAvailableAmount: '/erp-gateway-web/shop/withdraw/getAvailableAmount', //根据店铺ID,时间获取可用的提现金额 | 128 | shopGetAvailableAmount: '/erp-gateway-web/shop/withdraw/getAvailableAmount', //根据店铺ID,时间获取可用的提现金额 |
129 | shopWithdrawApply: '/erp-gateway-web/shop/withdraw/apply', //资金操作明细-申请提现 | 129 | shopWithdrawApply: '/erp-gateway-web/shop/withdraw/apply', //资金操作明细-申请提现 |
130 | + sendShopVerifyCode: '/erp-gateway-web/sms/sendVerificationCode', //获取短信验证码 | ||
131 | + verifySmsCode: '/erp-gateway-web/sms/verifySmsCode', // 验证短信验证码 | ||
132 | + queryShopBillList: '/erp-gateway-web/shop/bill/list', //交易账务明细(新) | ||
133 | + querySummaryInfo: '/erp-gateway-web/shop/bill/summaryInfo', //财务明细汇总 | ||
134 | + queryBillSummary: '/erp-gateway-web/shop/withdraw/service/billSummary', //服务费账单汇总 | ||
135 | + queryFreightBillSummary: '/erp-gateway-web/shop/withdraw/freight/billSummary', //运费账务汇总 | ||
130 | }, | 136 | }, |
131 | platform: { | 137 | platform: { |
132 | queryShopsByAdminPid: '/SellerShopController/queryShopsByAdminPid', | 138 | queryShopsByAdminPid: '/SellerShopController/queryShopsByAdminPid', |
1 | +const exportExcelConfs = { | ||
2 | + //交易账务明细报表导出配置 | ||
3 | + shopBill: { | ||
4 | + apiUrl: '/erp/queryShopBillList', | ||
5 | + conf: { | ||
6 | + cols: [ | ||
7 | + { | ||
8 | + caption: '账务ID', | ||
9 | + type: 'number', | ||
10 | + }, | ||
11 | + { | ||
12 | + caption: '结算时间', | ||
13 | + type: 'string', | ||
14 | + }, | ||
15 | + { | ||
16 | + caption: '订单号', | ||
17 | + type: 'string', | ||
18 | + }, | ||
19 | + { | ||
20 | + caption: 'SKU', | ||
21 | + type: 'string', | ||
22 | + }, | ||
23 | + { | ||
24 | + caption: '数量', | ||
25 | + type: 'number', | ||
26 | + }, | ||
27 | + { | ||
28 | + caption: '商品名称', | ||
29 | + type: 'string', | ||
30 | + }, | ||
31 | + { | ||
32 | + caption: '账务类型', | ||
33 | + type: 'string', | ||
34 | + }, | ||
35 | + { | ||
36 | + caption: '业务描述', | ||
37 | + type: 'string', | ||
38 | + }, | ||
39 | + { | ||
40 | + caption: '成交价/优惠价', | ||
41 | + type: 'number', | ||
42 | + }, | ||
43 | + { | ||
44 | + caption: '商家应收/分摊比例', | ||
45 | + type: 'number', | ||
46 | + }, | ||
47 | + { | ||
48 | + caption: '商家应收', | ||
49 | + type: 'number', | ||
50 | + }, | ||
51 | + { | ||
52 | + caption: '提现服务费', | ||
53 | + type: 'number', | ||
54 | + }, | ||
55 | + { | ||
56 | + caption: '交易服务费', | ||
57 | + type: 'number', | ||
58 | + }, | ||
59 | + { | ||
60 | + caption: '商家实收', | ||
61 | + type: 'number', | ||
62 | + }, | ||
63 | + { | ||
64 | + caption: '提现状态', | ||
65 | + type: 'string', | ||
66 | + }, | ||
67 | + { | ||
68 | + caption: '可提现日期', | ||
69 | + type: 'string', | ||
70 | + }, | ||
71 | + { | ||
72 | + caption: '提现申请日期', | ||
73 | + type: 'string', | ||
74 | + }, | ||
75 | + ], | ||
76 | + rows: [ | ||
77 | + 'id', | ||
78 | + 'businessTime', | ||
79 | + 'orderCode', | ||
80 | + 'productSku', | ||
81 | + 'quantity', | ||
82 | + 'productName', | ||
83 | + 'billTypeDesc', | ||
84 | + 'clearingTypeName', | ||
85 | + 'lastPrice', | ||
86 | + 'clearingDiscount', | ||
87 | + 'shopDeserveAmount', | ||
88 | + 'withdrawServiceAmount', | ||
89 | + 'serviceAmount', | ||
90 | + 'shopNetAmount', | ||
91 | + 'statusName', | ||
92 | + 'withdrawalTime', | ||
93 | + 'withdrawApplyTime', | ||
94 | + ], | ||
95 | + }, | ||
96 | + }, | ||
97 | + //服务费账单报表导出配置 | ||
98 | + shopServiceList: { | ||
99 | + apiUrl: '/erp/shopWithdrawServiceList', | ||
100 | + conf: { | ||
101 | + cols: [ | ||
102 | + { | ||
103 | + caption: '账务ID', | ||
104 | + type: 'number', | ||
105 | + }, | ||
106 | + { | ||
107 | + caption: '提现时间', | ||
108 | + type: 'string', | ||
109 | + }, | ||
110 | + { | ||
111 | + caption: '商家收款账户', | ||
112 | + type: 'string', | ||
113 | + }, | ||
114 | + { | ||
115 | + caption: '订单号', | ||
116 | + type: 'string', | ||
117 | + }, | ||
118 | + { | ||
119 | + caption: 'SKU', | ||
120 | + type: 'number', | ||
121 | + }, | ||
122 | + { | ||
123 | + caption: '商品名称', | ||
124 | + type: 'string', | ||
125 | + }, | ||
126 | + { | ||
127 | + caption: '账务类型', | ||
128 | + type: 'string', | ||
129 | + }, | ||
130 | + { | ||
131 | + caption: '子服务类型', | ||
132 | + type: 'string', | ||
133 | + }, | ||
134 | + { | ||
135 | + caption: '交易服务费', | ||
136 | + type: 'number', | ||
137 | + }, | ||
138 | + { | ||
139 | + caption: '提现服务费', | ||
140 | + type: 'number', | ||
141 | + }, | ||
142 | + { | ||
143 | + caption: '服务费金额', | ||
144 | + type: 'number', | ||
145 | + }, | ||
146 | + { | ||
147 | + caption: '提现状态', | ||
148 | + type: 'string', | ||
149 | + }, | ||
150 | + { | ||
151 | + caption: '提现成功日期', | ||
152 | + type: 'string', | ||
153 | + }, | ||
154 | + ], | ||
155 | + rows: [ | ||
156 | + 'id', | ||
157 | + 'withdrawTime', | ||
158 | + 'targetAccount', | ||
159 | + 'orderCode', | ||
160 | + 'productSku', | ||
161 | + 'productName', | ||
162 | + 'clearingType', | ||
163 | + 'clearingTypeName', | ||
164 | + 'tradeServiceAmount', | ||
165 | + 'withdrawServiceAmount', | ||
166 | + 'serviceAmount', | ||
167 | + 'statusName', | ||
168 | + 'withdrawSuccessTime', | ||
169 | + ], | ||
170 | + }, | ||
171 | + }, | ||
172 | + //运费账务明细报表导出配置 | ||
173 | + shopFreightList: { | ||
174 | + apiUrl: '/erp/shopWithdrawFreightList', | ||
175 | + conf: { | ||
176 | + cols: [ | ||
177 | + { | ||
178 | + caption: '账务ID', | ||
179 | + type: 'number', | ||
180 | + }, | ||
181 | + { | ||
182 | + caption: '结算时间', | ||
183 | + type: 'string', | ||
184 | + }, | ||
185 | + { | ||
186 | + caption: '订单号', | ||
187 | + type: 'string', | ||
188 | + }, | ||
189 | + { | ||
190 | + caption: '商品名称', | ||
191 | + type: 'string', | ||
192 | + }, | ||
193 | + { | ||
194 | + caption: '账务类型', | ||
195 | + type: 'string', | ||
196 | + }, | ||
197 | + { | ||
198 | + caption: '运费', | ||
199 | + type: 'number', | ||
200 | + }, | ||
201 | + { | ||
202 | + caption: '提现服务费', | ||
203 | + type: 'number', | ||
204 | + }, | ||
205 | + { | ||
206 | + caption: '商家实收', | ||
207 | + type: 'number', | ||
208 | + }, | ||
209 | + { | ||
210 | + caption: '提现状态', | ||
211 | + type: 'string', | ||
212 | + }, | ||
213 | + { | ||
214 | + caption: '提现成功日期', | ||
215 | + type: 'string', | ||
216 | + }, | ||
217 | + ], | ||
218 | + rows: [ | ||
219 | + 'id', | ||
220 | + 'clearingTime', | ||
221 | + 'orderCode', | ||
222 | + 'productName', | ||
223 | + 'clearingType', | ||
224 | + 'freightAmount', | ||
225 | + 'withdrawServiceAmount', | ||
226 | + 'realIncome', | ||
227 | + 'statusName', | ||
228 | + 'withdrawTime', | ||
229 | + ], | ||
230 | + }, | ||
231 | + }, | ||
232 | +}; | ||
233 | +module.exports = exportExcelConfs; |
@@ -15,6 +15,7 @@ const FileController = require('./file-controller'); | @@ -15,6 +15,7 @@ const FileController = require('./file-controller'); | ||
15 | const ImportController = require('./import-controller'); | 15 | const ImportController = require('./import-controller'); |
16 | const CaptchaController = require('./captcha-controller'); | 16 | const CaptchaController = require('./captcha-controller'); |
17 | const GeeCaptchaController = require('./gee-captcha-controller'); | 17 | const GeeCaptchaController = require('./gee-captcha-controller'); |
18 | +const OutputController = require('./output-controller'); | ||
18 | 19 | ||
19 | let router = Express.Router(); // eslint-disable-line | 20 | let router = Express.Router(); // eslint-disable-line |
20 | 21 | ||
@@ -23,6 +24,7 @@ router.post('/logout', middleware(UserController, 'logout')); | @@ -23,6 +24,7 @@ router.post('/logout', middleware(UserController, 'logout')); | ||
23 | router.post('/switchShop', before, auth, middleware(UserController, 'switchShop')); | 24 | router.post('/switchShop', before, auth, middleware(UserController, 'switchShop')); |
24 | router.post('/upload/image', before, auth, middleware(FileController, 'uploadImage')); | 25 | router.post('/upload/image', before, auth, middleware(FileController, 'uploadImage')); |
25 | router.post('/import', before, auth, middleware(ImportController, 'import')); | 26 | router.post('/import', before, auth, middleware(ImportController, 'import')); |
27 | +router.get('/export/excel', before, middleware(OutputController, 'exportExcel')); | ||
26 | router.post('/config', middleware(UserController, 'config')); | 28 | router.post('/config', middleware(UserController, 'config')); |
27 | router.get('/captcha.jpg', middleware(CaptchaController, 'captcha')); | 29 | router.get('/captcha.jpg', middleware(CaptchaController, 'captcha')); |
28 | router.get('/geeCaptcha', middleware(GeeCaptchaController, 'captcha')); | 30 | router.get('/geeCaptcha', middleware(GeeCaptchaController, 'captcha')); |
1 | const Context = require('../framework/context'); | 1 | const Context = require('../framework/context'); |
2 | const nodeExcel = require('excel-export'); | 2 | const nodeExcel = require('excel-export'); |
3 | +const ExportExcelService = require('../service/export-excel-service'); | ||
4 | +const _ = require('lodash'); | ||
5 | +const exportExcelConfs = require('../common/excel-conf/exprot-excel-conf'); | ||
6 | +const config = global.yoho.config; | ||
7 | +const moment = require('moment'); | ||
3 | 8 | ||
4 | // 暂时弃用 | 9 | // 暂时弃用 |
5 | class OutputController extends Context { | 10 | class OutputController extends Context { |
6 | constructor() { | 11 | constructor() { |
7 | super(); | 12 | super(); |
13 | + this.exportExcelService = this.instance(ExportExcelService); | ||
8 | } | 14 | } |
15 | + | ||
9 | productList(req, res) { | 16 | productList(req, res) { |
10 | const conf = { | 17 | const conf = { |
11 | name: 'mysheet', | 18 | name: 'mysheet', |
@@ -19,7 +26,11 @@ class OutputController extends Context { | @@ -19,7 +26,11 @@ class OutputController extends Context { | ||
19 | type: 'string', | 26 | type: 'string', |
20 | }, | 27 | }, |
21 | ], | 28 | ], |
22 | - rows: [['1', '2'], ['3', '2'], ['4', '2']], | 29 | + rows: [ |
30 | + ['1', '2'], | ||
31 | + ['3', '2'], | ||
32 | + ['4', '2'], | ||
33 | + ], | ||
23 | }; | 34 | }; |
24 | const result = nodeExcel.execute(conf); | 35 | const result = nodeExcel.execute(conf); |
25 | 36 | ||
@@ -27,6 +38,95 @@ class OutputController extends Context { | @@ -27,6 +38,95 @@ class OutputController extends Context { | ||
27 | res.setHeader('Content-Disposition', 'attachment; filename=productList.xlsx'); | 38 | res.setHeader('Content-Disposition', 'attachment; filename=productList.xlsx'); |
28 | res.end(result, 'binary'); | 39 | res.end(result, 'binary'); |
29 | } | 40 | } |
41 | + | ||
42 | + /** | ||
43 | + * 导出 | ||
44 | + * @param req | ||
45 | + * @param res | ||
46 | + */ | ||
47 | + exportExcel(req, res) { | ||
48 | + //获取导出表格的配置文件 | ||
49 | + const { apiUrl, conf } = exportExcelConfs[req.query.excelConf]; | ||
50 | + const searchParams = this.createSearchParams(req); | ||
51 | + //请求服务数据 | ||
52 | + this.exportExcelService.getExportData(apiUrl, searchParams).then(result => { | ||
53 | + const totalPage = result.totalPage || 0; | ||
54 | + if (totalPage < 1) { | ||
55 | + res.end('', 'binary'); | ||
56 | + } | ||
57 | + const apis = []; | ||
58 | + for (let i = 1; i <= totalPage; i++) { | ||
59 | + searchParams.pageNo = i; | ||
60 | + apis.push(this.exportExcelService.getExportData(apiUrl, searchParams)); | ||
61 | + } | ||
62 | + Promise.all(apis).then(result => { | ||
63 | + //获取结果集中的records | ||
64 | + const excel = this.createExcelData(result, conf); | ||
65 | + res.setHeader('Content-Type', 'application/vnd.openxmlformats'); | ||
66 | + res.setHeader('Content-Disposition', 'attachment; filename=download.xlsx'); | ||
67 | + res.end(excel, 'binary'); | ||
68 | + }); | ||
69 | + }); | ||
70 | + } | ||
71 | + | ||
72 | + /** | ||
73 | + * 组织查询数据 | ||
74 | + * @param req | ||
75 | + */ | ||
76 | + createSearchParams(req) { | ||
77 | + //获取导出配置 | ||
78 | + const currentShop = _.find(req.user.shops, shop => shop.shopsId === _.parseInt(req.cookies._sign)); | ||
79 | + let baseParams = {}; | ||
80 | + if (currentShop) { | ||
81 | + baseParams = { | ||
82 | + pid: req.user.uid, | ||
83 | + shopsId: currentShop.shopsId, | ||
84 | + shopId: currentShop.shopsId, | ||
85 | + shop: currentShop.shopsId, | ||
86 | + supplierId: currentShop.shopsBrands.length | ||
87 | + ? req.user.supplier_id | ||
88 | + ? req.user.supplier_id | ||
89 | + : _.first(currentShop.shopsBrands).supplierId | ||
90 | + : 0, | ||
91 | + platform_id: config.platform, | ||
92 | + }; | ||
93 | + } | ||
94 | + return { ...req.query, ...baseParams, pageSize: 1000 }; | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * 组织表格要用的数据 | ||
99 | + * @param columnFields | ||
100 | + * @param rows | ||
101 | + */ | ||
102 | + createExcelData(dataList, config) { | ||
103 | + const { cols, rows } = config; | ||
104 | + const conf = { ...{}, cols, rows: [] }; | ||
105 | + const list = _.flattenDeep(_.map(dataList, 'records')); | ||
106 | + //组织导出数据 | ||
107 | + _.forEach(list, item => { | ||
108 | + //组织导出的每一列数据 | ||
109 | + const excelRow = []; | ||
110 | + _.forEach(rows, row => { | ||
111 | + if (!item.hasOwnProperty(row)) { | ||
112 | + excelRow.push(String('')); | ||
113 | + return true; | ||
114 | + } | ||
115 | + //如果导出的列是时间,则格式化时间 | ||
116 | + if ((row.indexOf('time') > -1 || row.indexOf('Time') > -1) && item[row] > 0) { | ||
117 | + excelRow.push(String(moment(item[row] * 1000).format('YYYY-MM-DD HH:mm:ss'))); | ||
118 | + return true; | ||
119 | + } | ||
120 | + if (_.isNaN(item[row])) { | ||
121 | + excelRow.push(String(item[row])); | ||
122 | + return true; | ||
123 | + } | ||
124 | + excelRow.push(item[row]); | ||
125 | + }); | ||
126 | + conf.rows.push(excelRow); | ||
127 | + }); | ||
128 | + return nodeExcel.execute(conf); | ||
129 | + } | ||
30 | } | 130 | } |
31 | 131 | ||
32 | module.exports = OutputController; | 132 | module.exports = OutputController; |
server/service/export-excel-service.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +const _ = require('lodash'); | ||
4 | +const Context = require('../framework/context'); | ||
5 | +const Api = require('../common/api'); | ||
6 | +const config = global.yoho.config; | ||
7 | +class ExportExcelService extends Context { | ||
8 | + constructor() { | ||
9 | + super(); | ||
10 | + this.api = this.instance(Api); | ||
11 | + } | ||
12 | + //获取要导出的数据 | ||
13 | + getExportData(apiUrl, params) { | ||
14 | + const apiArr = _.split(apiUrl, '/'); | ||
15 | + const platform = apiArr[1]; | ||
16 | + const method = apiArr[2]; | ||
17 | + return this.api | ||
18 | + .post(config.apiDomain[platform][method], params) | ||
19 | + .then(res => { | ||
20 | + if (res.code !== 200) { | ||
21 | + return Promise.reject({ code: 500, message: res.message }); | ||
22 | + } | ||
23 | + return res.data; | ||
24 | + }) | ||
25 | + .catch(error => { | ||
26 | + return Promise.reject({ code: 400, message: error.message }); | ||
27 | + }); | ||
28 | + } | ||
29 | +} | ||
30 | +module.exports = ExportExcelService; |
-
Please register or login to post a comment