list.vue
10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<template>
<layout-body>
<Alert type="warning" show-icon class="warning-box" closable>每个月16号生成本月之前的结算单,请大家务必在1号之前对账完毕。否则未对账的账单将移至下个月合并结算。</Alert>
<layout-filter ref="filter" :model="query">
<filter-item label="对帐单号">
<Input v-model.trim="query.id" :maxlength="9"></Input>
</filter-item>
<filter-item label="SKU编码">
<Input v-model.trim="query.productSku" :maxlength="9"></Input>
</filter-item>
<filter-item label="商品名称">
<Input v-model.trim="query.productName"></Input>
</filter-item>
<filter-item label="品牌">
<select-search-brand v-model="query.brandId"></select-search-brand>
</filter-item>
<filter-item label="订单号">
<Input v-model.trim="query.orderCode"></Input>
</filter-item>
<filter-item label="业务类型">
<Select v-model="query.outInType" clearable>
<Option value="30">销售出库</Option>
<Option value="33">退货入库</Option>
</Select>
</filter-item>
<filter-item label="对帐单状态">
<Select v-model="query.status" clearable>
<Option value="10">未对帐</Option>
<Option value="20">待结算</Option>
<Option value="30">已结算</Option>
</Select>
</filter-item>
<filter-item>
<Button type="primary" @click="search">筛选</Button>
<Button @click="reset">清空条件</Button>
<Button @click="exportData" type="warning">导出</Button>
</filter-item>
</layout-filter>
<layout-list>
<Table border :columns="tableCols" :data="tableData"></Table>
<Page :total="pageData.total" :current="pageData.current"
@on-change="pageChange" :page-size="10" show-total></Page>
</layout-list>
<Confirm ref="confirm" :onOk="onOk"></Confirm>
</layout-body>
</template>
<script>
import CandidateListService from 'services/kol/candidate-list-service';
import {Confirm} from './components';
import _ from 'lodash';
import moment from 'moment';
export default {
data() {
return {
query: {
id: '',
productSku: '',
productName: '',
brandId: null,
orderCode: null,
outInType: null,
status: null
},
pageData: {
total: 0,
current: 1,
},
tableData: [],
tableCols: [{
title: '订单号',
key: 'orderCode',
align: 'center',
width: 80
}, {
title: '帐单生成时间',
key: 'createTime',
width: 110,
align: 'center',
render: (h, params) => {
if (params.row.createTime) {
let time = moment.unix(params.row.createTime);
return (
<div>
<div> {time.format('YYYY/MM/DD')} </div>
<div> {time.format('HH:mm:ss')} </div>
</div>
);
}
}
}, {
title: '对帐单号',
key: 'id',
align: 'center',
width: 90
}, {
title: '对帐时间',
key: 'confirmTime',
align: 'center',
width: 90,
render: (h, params) => {
if (params.row.confirmTime === 'default') {
return '';
}
if (params.row.confirmTime) {
let time = moment.unix(params.row.confirmTime);
return (
<div>
<div> {time.format('YYYY/MM/DD')} </div>
<div> {time.format('HH:mm:ss')} </div>
</div>
);
} else {
return <span>{'暂无'}</span>;
}
}
}, {
title: 'SKU',
key: 'productSku',
align: 'center',
width: 85
}, {
title: '商品名称',
key: 'productName',
align: 'center',
width: 90
}, {
title: '品牌',
key: 'brandName',
align: 'center',
width: 100
}, {
title: '吊牌价',
key: 'retailPrice',
align: 'center',
width: 85
}, {
title: '支付金额',
key: 'lastPaymentAmount',
align: 'center',
width: 85
}, {
title: '结算比例',
key: 'clearingPercent',
align: 'center',
width: 85,
render: (h, params) => {
if (params.row.clearingPercent) {
return (
<span>{`${params.row.clearingPercent * 100}%`}</span>
);
}
}
}, {
title: '业务类型',
key: 'outInTypeName',
align: 'center',
width: 85
}, {
title: '数量',
key: 'num',
align: 'center',
width: 70
}, {
title: '佣金',
key: 'clearingAmount',
align: 'center',
width: 90
}, {
title: '状态',
key: 'statusName',
align: 'center',
width: 110,
render: (h, params) => {
if (params.row.status === 30) {
return (
<div>
<div>{params.row.statusName}</div>
<div>(结算单号:{params.row.favoriteClearingId})</div>
</div>
);
} else {
return <span>{params.row.statusName}</span>;
}
}
}, {
title: '操作',
render: (h, params) => {
if (params.row.status === 10) {
return (
<action-group>
<i-button type="primary" size="small" onClick={() => this.check(params.row)}>对帐</i-button>
</action-group>
);
}
},
width: 100,
align: 'center'
}]
};
},
created() {
this.candidateListService = new CandidateListService();
},
mounted() {
this.search();
},
methods: {
filterValues() {
let params = {
pageNo: this.pageData.current,
pageSize: 10,
needTotal: 1,
id: +this.query.id,
productSku: +this.query.productSku,
productName: this.query.productName,
brandId: +this.query.brandId,
orderCode: +this.query.orderCode,
outInType: +this.query.outInType,
status: +this.query.status
};
params = _.pickBy(params, val => val);
return params;
},
search() {
if (_.isObject(this.query) &&
typeof this.query.id !== 'undefined' &&
!_.isFinite(+this.query.id)) {
this.$Message.error('对帐单号只能是数字', 3);
return;
}
if (_.isObject(this.query) &&
typeof this.query.productSku !== 'undefined' &&
!_.isFinite(+this.query.productSku)) {
this.$Message.error('SKU编码只能是数字', 3);
return;
}
if (_.isObject(this.query) &&
typeof this.query.orderCode !== 'undefined' &&
!_.isFinite(+this.query.orderCode)) {
this.$Message.error('订单号只能是数字', 3);
return;
}
this.candidateListService.favoriteBalanceList(this.filterValues()).then(ret => {
if (ret && ret.code === 200) {
this.tableData = _.get(ret, 'data.records', []);
if (this.tableData.length > 0) {
this.tableData.push({
confirmTime: 'default',
outInTypeName: '总计',
num: ret.data.totalNum,
clearingAmount: ret.data.totalClearingAmount
});
}
this.pageData.total = _.get(ret, 'data.totalCount', 0);
} else {
this.$Message.error(ret.message);
}
});
},
reset() {
this.$refs.filter.reset();
this.search();
},
pageChange(val) {
this.pageData.current = val;
this.search();
},
check(row) {
this.$refs.confirm.show(row);
},
onOk(data) {
this.candidateListService.favoriteBalanceCheck({
id: data.id,
favoritePid: data.favoritePid
}).then(ret => {
if (ret && ret.code === 200) {
this.$Message.success('对账成功!');
this.$refs.confirm.hide();
this.search();
} else {
this.$Message.error(ret.message);
}
});
},
onCancel() {
this.$refs.confirm.hide();
},
exportData() {
let params = {};
let temp = [];
_.assign(params, this.filterValues());
_.each(params, (val, key) => {
temp.push(`${key}=${val}`);
});
const href = `/Api/erp/exportFavoriteBalanceDetail?${temp.join('&')}`;
window.open(href, '_blank');
}
},
components: {Confirm}
};
</script>
<style lang="scss">
.warning-box {
width: 950px;
display: inline-block;
margin-bottom: 15px;
}
</style>