chooseRuleDialog.vue
11 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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<!-- 选择财务规则弹窗 -->
<template>
<d2-dialog title="选择财务规则"
:is-visible="ruleVisible"
class="chooseRuleDialog"
width="65%"
@closeDialog="handleClose"
@confirmDialog="handleAddConfirm">
<!-- <div>
<span>订单所属商户:{{recordInfo.merchantName}}</span><span>主订单编号:{{recordInfo.inputtedOrderCode}}</span><span>订单金额:{{recordInfo.totalFee ? '¥' + recordInfo.totalFee / 100 : ''}}</span><span>支付时间:{{recordInfo.accountDate}}</span>
</div> -->
<el-form class="rule-form"
label-width="110px"
:inline="true">
<el-form-item class="d2-drawer-item"
label="订单所属商户:">
<span>{{ recordInfo.merchantName }}</span>
</el-form-item>
<el-form-item class="d2-drawer-item"
label="主订单编号:">
<!-- <span>{{ recordInfo.inputtedOrderCode }}</span> -->
<span>{{ recordInfo.orderCode }}</span>
</el-form-item>
<el-form-item class="d2-drawer-item"
label="订单金额:">
<!-- <span>{{ recordInfo.totalFee ? '¥' + recordInfo.totalFee / 100 : '' }}</span> -->
<span>{{ recordInfo.totalPrice ? '¥' + recordInfo.totalPrice : '' }}</span>
</el-form-item>
<el-form-item class="d2-drawer-item"
label="支付时间:">
<!-- <span>{{ recordInfo.accountDate }}</span> -->
<span>{{ recordInfo.paySuccessDate }}</span>
</el-form-item>
</el-form>
<div class="fontD">请选择要应用的分账规则:</div>
<div>
<div class="merchant-checkrecord">
<div class="account-detail"
ref="accountDetail">
<div v-if="formArray && formArray.length > 0">
<div v-for="(formItem, index) in formArray"
:ref="'resize' + index"
:key="index">
<p class="sub-title"
:class="{ 'sub-border': !formItem.show }">
<el-radio v-model="radio"
:label="formItem.id">
<i></i>
</el-radio>
<span class="label">
<span>{{ formItem.formatEffectStartDate }}</span>
<span v-if="formItem.formatEffectStartDate"> - </span>
<span :class="{ labelColor: !formItem.formatEffectEndDate }">{{
formItem.formatEffectStartDate
? formItem.formatEffectEndDate
? formItem.formatEffectEndDate
: "生效中"
: "待生效"
}}</span>
</span>
<span class="updatedInfo">
操作人: {{ formItem.updatedBy }} 操作时间:
{{ formItem.formatUpdatedDate }}
</span>
</p>
</div>
</div>
<div v-else
class="nothingtips">
<img style="height: 109px; width: 109px"
src="../systemConfig/merchant/images/empty.png" />
<p class="title">暂无分账规则</p>
<p class="tips">快去设置看看~</p>
</div>
</div>
</div>
</div>
<div class="fontD">请选择要应用的对账规则:</div>
<div>
<div class="merchant-checkrecord">
<div class="account-detail"
ref="accountDetail">
<div v-if="formArray2 && formArray2.length > 0">
<div v-for="(formItem, index) in formArray2"
:ref="'resize' + index"
:key="index">
<p class="sub-title"
:class="{ 'sub-border': !formItem.show }">
<el-radio v-model="radio2"
:label="formItem.id">
<i></i>
</el-radio>
<span class="label">
<span>{{ formItem.formatEffectStartDate }}</span>
<span v-if="formItem.formatEffectStartDate"> - </span>
<span :class="{ labelColor: !formItem.formatEffectEndDate }">{{
formItem.formatEffectStartDate
? formItem.formatEffectEndDate
? formItem.formatEffectEndDate
: "生效中"
: "待生效"
}}</span>
</span>
<span class="updatedInfo">
操作人: {{ formItem.updatedBy }} 操作时间:
{{ formItem.formatUpdatedDate }}
</span>
</p>
</div>
</div>
<div v-else
class="nothingtips">
<img style="height: 109px; width: 109px"
src="../systemConfig/merchant/images/empty.png" />
<p class="title">暂无对账规则</p>
<p class="tips">快去设置看看~</p>
</div>
</div>
</div>
</div>
</d2-dialog>
</template>
<script>
import dayjs from "dayjs"
// import { Util, deepClone } from '@/common/util'
// import { getHistoryRecord } from "@api/publicAccount"
// import {
// getLedgerHistoryRecordApi,
// } from "@api/merchant"
import { getHistoryEffectRecord, manualDivision } from '@api/order'
export default {
name: "ChooseRuleDialog",
props: {
ruleVisible: {
type: Boolean,
default: false
},
recordInfo: {
type: Object,
default: () => { }
},
/** 与订单列表场景一致,分账规则查询需带上 */
baseSceneCode: {
type: String,
default: "",
},
},
components: {
},
computed: {},
data() {
return {
formArray: [],
formArray2: [],
radio: '',
radio2: ''
}
},
created() {
},
mounted() {
// this.recordInfo.accountDate = this.recordInfo.accountDate ? Util.dateFormate(this.recordInfo.accountDate, 'YYYY-MM-DD HH:mm:ss') : ''
this.getLedgerHistoryRecord()
},
methods: {
// 分账
async getLedgerHistoryRecord() {
const merchantId = this.recordInfo.merchantId
const sceneType = this.recordInfo.sceneType
const params = {
merchantId,
sceneType,
}
const baseSceneCode = this.baseSceneCode || this.recordInfo?.baseSceneCode
if (baseSceneCode) {
params.baseSceneCode = baseSceneCode
}
const res = await getHistoryEffectRecord(params)
if (res) {
const settleDistributeRuleEffectiveList = res.settleDistributeRuleEffectiveList // 分账规则
const reconciliationRuleEffectiveList = res.reconciliationRuleEffectiveList // 对账规则
const format = "YYYY/MM/DD HH:mm"
if (settleDistributeRuleEffectiveList.length > 0) {
this.formArray = settleDistributeRuleEffectiveList.map(item => {
item.formatEffectEndDate = item.effectEndDate
? dayjs(item.effectEndDate).format(format)
: ""
item.formatEffectStartDate = item.effectStartDate
? dayjs(item.effectStartDate).format(format)
: ""
item.formatUpdatedDate = dayjs(item.updatedDate).format(format)
item.show = false
return item
})
} else {
this.formArray = []
}
if (reconciliationRuleEffectiveList.length > 0) {
this.formArray2 = reconciliationRuleEffectiveList.map(item => {
item.formatEffectEndDate = item.effectEndDate
? dayjs(item.effectEndDate).format(format)
: ""
item.formatEffectStartDate = item.effectStartDate
? dayjs(item.effectStartDate).format(format)
: ""
item.formatUpdatedDate = dayjs(item.updatedDate).format(format)
item.show = false
return item
})
} else {
this.formArray2 = []
}
}
},
handleAddConfirm() {
if (!this.radio) {
this.notice.warningTips('请选择分账规则')
return
}
if (!this.radio2) {
this.notice.warningTips('请选择对账规则')
return
}
var params = {}
params.outTradeNo = this.recordInfo.outTradeNo
params.inputtedOrderCode = this.recordInfo.orderCode
params.settleDistributeEffectRuleId = this.radio
params.reconciliationRuleEffectRuleId = this.radio2
// return console.log('params', params)
this.$confirm("确定分账后,当前订单会以选择的分账规则进行分账,且不可撤回;是否确定分账?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
manualDivision(params).then(res => {
this.notice.okTips('发起分账成功')
this.handleClose(true)
})
})
.catch((err) => {
console.log(err)
})
},
handleClose(flag) {
this.$emit('dialogClose', flag)
}
}
}
</script>
<style lang="scss" scoped>
$color: #2a58ad;
.merchant-checkrecord {
padding-left: 20px;
padding-right: 16px;
padding-bottom: 20px;
.account-detail {
// height: 400px;
// height: calc(100vh - 200px);
padding-right: 15px;
overflow-y: scroll;
overflow-x: hidden;
}
.sub-title {
font-weight: 700;
color: #333333;
padding: 17px 0;
margin: 0;
display: flex;
// justify-content: space-between;
font-size: 14px;
// &::before {
// top: 50%;
// transform: translateY(-50%);
// }
.label {
padding-left: 8px;
width: 37%;
}
.labelColor {
color: #0947c6;
}
.updatedInfo {
width: 40%;
text-align: left;
}
.collapse {
padding-right: 20px;
color: #0947c6;
cursor: pointer;
.arrow {
transition: all 1s;
}
.move {
transform: rotate(-180deg);
}
}
}
.sub-border {
animation: border-delay 1s forwards;
}
@keyframes border-delay {
0% {
/* opacity: 0; */
/* right: -100%; */
}
100% {
border-bottom: 1px solid #d8d8d8;
}
}
.nothingtips {
// align-items: center;
text-align: center;
font-size: 16px;
padding-top: 40px;
.title {
font-size: 20px;
color: #666;
margin: 16px 0;
}
.tips {
font-size: 12px;
color: #999;
}
}
.title {
}
.type {
margin-top: 6px;
display: flex;
.btn {
width: 96px;
height: 40px;
background: #f8f8f8;
border-radius: 4px 4px 0 0;
line-height: 40px;
text-align: center;
cursor: pointer;
}
.act {
font-weight: 500;
color: $color;
background: #fff;
}
}
}
.rule-form {
// border-bottom: 1px solid #e7eaec;
padding: 0 20px 20px;
margin-bottom: 20px;
background: #ffffff;
margin: 0 0 0 10px;
}
.rule-form .d2-drawer-item {
font-family: PingFangSC-Regular;
font-size: 14px;
color: #333333;
font-weight: 400;
width: 25%;
margin: 0 0 0 0;
}
.fontD {
margin: 10px 20px 15px;
}
</style>