settlement-list.vue
8.46 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
<template>
<layout-body>
<layout-filter ref="filter" :model="query">
<filter-item label="结算单ID">
<Input v-model.trim="query.id"></Input>
</filter-item>
<filter-item label="SKU编码">
<Input v-model.trim="query.productSku" :maxlength="9"></Input>
</filter-item>
<filter-item label="支付时间">
<Date-picker v-model="query.createTime"
type="daterange" format="yyyy-MM-dd" placeholder="选择日期" clearable>
</Date-picker>
</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>
<Tooltip class="help-tooltip" :content="helpTip" placement="top-start">
<span class="tip">帮助说明</span>
</Tooltip>
</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>
</layout-body>
</template>
<script>
import CandidateListService from 'services/kol/candidate-list-service';
import moment from 'moment';
import _ from 'lodash';
export default {
data() {
return {
query: {
id: '',
productSku: '',
status: null,
createTime: []
},
pageData: {
total: 0,
current: 1,
},
tableData: [],
tableCols: [{
title: '结算单ID',
key: 'id',
align: 'center'
}, {
title: '开始时间',
key: 'startTime',
width: 110,
render: (h, params) => {
let time = moment.unix(params.row.createTime);
return (
<div>{time.format('YYYY/MM/DD')}</div>
);
},
align: 'center'
}, {
title: '结束时间',
key: 'endTime',
width: 110,
render: (h, params) => {
let time = moment.unix(params.row.endTime);
return (
<div>{time.format('YYYY/MM/DD')}</div>
);
},
align: 'center'
}, {
title: '应付金额',
key: 'amount',
align: 'center'
}, {
title: '到票金额',
key: 'invoiceAmount',
align: 'center'
}, {
title: '实付金额',
key: 'paymentAmount',
align: 'center'
}, {
title: '状态',
key: 'statusName',
align: 'center'
}, {
title: '支付时间',
key: 'paymentTime',
width: 110,
render: (h, params) => {
if (!params.row.paymentTime) {
return '暂无';
} else {
let time = moment.unix(params.row.paymentTime);
return (
<div>{time.format('YYYY/MM/DD')}</div>
);
}
},
align: 'center'
}, {
title: '备注',
key: 'remark',
align: 'center'
}, {
title: '操作',
align: 'center',
width: 100,
render: (h, params) => {
return (
<action-group>
<i-button type="primary" size="small" onClick={() => this.edit(params.row)}>查看详情</i-button>
</action-group>
);
}
}],
helpTip: '结算单每月16号系统自动生成,用于与财务结算本月之前的所有已对账账单,未对账以及发生退货的账单不会出现在结算单中。系统生成结算单后,请尽快按照应付金额提供相应发票,进行结算。'
};
},
computed: {
startTime() {
let createTime = this.query.createTime;
if (_.isEmpty(createTime)) {
return 0;
} else {
return createTime[0] ? createTime[0].getTime() / 1000 : 0;
}
},
endTime() {
let createTime = this.query.createTime;
if (_.isEmpty(createTime)) {
return 0;
} else {
return createTime[1] ? createTime[1].getTime() / 1000 : 0;
}
}
},
created() {
this.candidateListService = new CandidateListService();
},
mounted() {
this.search();
},
methods: {
filterValues() {
let params = {
pageNo: this.pageData.current,
pageSize: 10,
id: +this.query.id,
productSku: +this.query.productSku,
status: +this.query.status,
startTime: this.startTime,
endTime: this.endTime
};
params = _.pickBy(params, val => val);
return params;
},
search() {
if (_.isObject(this.query) &&
typeof this.query.id !== 'undefined' &&
!_.isFinite(+this.query.id)) {
this.$Message.error('结算单ID只能是数字', 3);
return;
}
if (_.isObject(this.query) &&
typeof this.query.productSku !== 'undefined' &&
!_.isFinite(+this.query.productSku)) {
this.$Message.error('SKU编码只能是数字', 3);
return;
}
this.candidateListService.clearingList(this.filterValues()).then(ret => {
if (ret && ret.code === 200) {
this.tableData = _.get(ret, 'data.records', []);
this.pageData.total = _.get(ret, 'data.totalCount', 0);
this.pageData.current = _.get(ret, 'data.pageNo', 1);
} else {
this.$Message.error(ret.message);
}
});
},
reset() {
this.$refs.filter.reset();
this.search();
},
pageChange(val) {
this.pageData.current = val;
this.search();
},
edit(row) {
this.$router.push({
name: 'kol.settlement.detail',
params: {
id: row.id
}
});
},
exportData() {
let params = {};
let temp = [];
_.assign(params, this.filterValues());
_.each(params, (val, key) => {
temp.push(`${key}=${val}`);
});
const href = `/Api/erp/exportFavoriteClearingList?${temp.join('&')}`;
window.open(href, '_blank');
}
},
components: {}
};
</script>
<style lang="scss">
.ivu-date-picker .ivu-select-dropdown {
right: 0;
left: auto !important;
}
.help-tooltip {
.ivu-tooltip-inner {
max-width: 600px;
white-space: normal;
}
.tip {
margin-left: 10px;
color: #00b0ff;
cursor: pointer;
text-decoration: underline;
&:before {
display: inline-block;
content: "?";
font-size: 12px;
height: 12px;
width: 12px;
color: #fff;
line-height: 12px;
margin-right: 4px;
background-color: #00b0ff;
border-radius: 6px;
text-align: center;
}
}
}
</style>