DivisionConfig.vue
11.3 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
<!-- 查看 - 分账配置 -->
<template>
<div class="edit-page division-config">
<div class="title">
<span>分账配置</span>
</div>
<div style="padding: 20px">
<el-form ref="divisionRuleRef" :model="financialObj" label-suffix=":" label-width="154px">
<el-form-item label="" prop="autoFlag">
<span class="tips-block" slot="label">
<span class="tips-label">线上自动分账</span>
<el-tooltip popper-class="tooltip-class" effect="dark" content="产生交易后会自动打款给商户,开启及关闭操作第二天生效。"
placement="top">
<span class="tips-icon" /> </el-tooltip>:
</span>
<el-switch v-model="financialObj.autoFlag" active-value="Y" disabled inactive-value="N" />
</el-form-item>
<el-form-item label="结算时间方式">
<span class="tips-block" slot="label">
<span class="tips-label">分账周期</span>
<el-tooltip popper-class="tooltip-class" effect="dark" content="用户支付的款项可按T+1或指定日自动打款给商户。" placement="top">
<span class="tips-icon" /> </el-tooltip>:
</span>
<div class="block_item" style="margin-bottom: 20px">
<span>
分账周期 T+{{ settleTimeObj.first }}日
<span v-show="financialObj.settleTimeType == 1">(分账后第2天到分账方对公账户)</span>
</span>
</div>
</el-form-item>
<el-form-item label="流量方分账方">
<span>{{ financialObj.realityShopMerchantName }}</span>
</el-form-item>
</el-form>
<el-tabs v-model="editableTabsValue" type="card" class="my-tab-pane">
<!-- closable -->
<el-tab-pane v-for="item in editableTabs" :key="item.name" :label="item.title" :name="item.name">
<span slot="label">{{ item.title }} </span>
<div class="classificationCptContainer">
<el-form ref="divisionRuleRef" :model="financialObj" label-suffix=":" label-width="154px">
<el-form-item label="分账品类">
{{
financialObj.goodsTypeGroupRules[editableTabsValue - 1]
.categoryType || "--"
}}</el-form-item>
<el-form-item label="">
{{
financialObj.goodsTypeGroupRules[editableTabsValue - 1]
.packageArrText
}}</el-form-item>
<template v-for="(item, index) in financialObj.goodsTypeGroupRules[
editableTabsValue - 1
].expenseCategoryRules">
<el-form-item :key="index" :label="item.expenseCategoryName">
<span>{{
getExpenseCategoryCalculateType(
item.expenseCategoryCalculateType,
item.expenseCategoryValue
)
}}</span>
</el-form-item>
</template>
</el-form>
</div>
<tableAccount ref="tableAccount" :merchant-distribution-rules="financialObj.goodsTypeGroupRules[editableTabsValue - 1]
.merchantDistributionRules
" :table-select-options="tableSelectOptions" :classification-obj-select="tableClassificationObjSelect" />
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import { deepClone } from "@/common/util"
import tableAccount from "./components/tableAccount"
export default {
name: "DivisionConfig",
components: {
tableAccount
},
props: {
divisiObj: {
type: Object,
default: () => { }
}
},
data() {
// 这里存放数据
return {
settleTimeObj: {
first: "1",
second: "1"
},
financialObj: {},
editableTabs: [],
editableTabsValue: "1"
}
},
computed: {
tableClassificationObjSelect() {
const filterObj = deepClone(
this.financialObj.goodsTypeGroupRules[this.editableTabsValue - 1]
.expenseCategoryRules
)
const obj = {
trafficSide: filterObj
}
const arr = [
{
id: 4,
expenseCategoryId: 4,
applicationObjectName: "手续费",
applicationObjectType: 3
},
{
id: 701,
expenseCategoryId: 701,
applicationObjectName: "第三方成本",
applicationObjectType: 3
}
]
obj.trafficSide && obj.trafficSide.push(...arr)
return obj
},
tableSelectOptions: {
get() {
const info = this.financialObj
// 平台方
const platformSideobj = {
merchantId: info.realityPlatformMerchantId, // 实际分账平台方商户id(嘀加智慧云为-1)
merchantName: info.realityPlatformMerchantName,
targetMerchantType: 1
}
// 流量方
const merchantSideobj = {
merchantId: info.realityShopMerchantId, // 实际分账商户方商户id(嘀加智慧云为-1)
merchantName: info.realityShopMerchantName,
targetMerchantType: 3
}
//服务商
const serviceObj = {
merchantId: info.partnerMerchantId,
merchantName: info.partnerMerchantName,
targetMerchantType: 2
}
// // 如果勾选商户 就追加进去
// if (info.djzhySubMerchantId) {
// const dizhySubMerchantObj = {
// merchantId: info.djzhySubMerchantId, // 实际分账商户方商户id(嘀加智慧云为-1)
// merchantName: info.djzhySubMerchantName,
// targetMerchantType: 4
// }
// return [
// platformSideobj,
// dizhySubMerchantObj,
// ...this.serviceSelectList,
// merchantSideobj
// ]
// }
return [platformSideobj, merchantSideobj, serviceObj]
}
}
},
watch: {
divisiObj: {
handler(val, oldVal) {
if (val) {
this.initData(val)
}
},
immediate: true,
deep: true
}
},
created() { },
methods: {
initData(data) {
let result = data
result.autoFlag = result.autoFlag ? result.autoFlag : "N"
result.settleTimeType = result.settleTimeType ? result.settleTimeType : 1
result.multiPlatformMerchantFlag = result.multiPlatformMerchantFlag || "N"
const autoFlag = result?.autoFlag == "Y"
if (result?.settleTimeType == 2) result.settleTimeType = 1
result && (this.financialObj = result)
result.goodsTypeGroupRules &&
result.goodsTypeGroupRules.forEach((item, index) => {
const upgradeArr = []
const packageArr = []
const textArr = []
this.editableTabs[index] = {
title: "特殊品类" + (index + 1),
name: (index + 1).toString(),
testFlag: item.testFlag == "Y" && autoFlag ? "Y" : "N",
groupDivisionRuleId:
item.testFlag == "Y" ? "" : item.groupDivisionRuleId || ""
}
// 按商品分类
if (
item.goodsTypes?.length &&
item.goodsTypes[0]?.categoryType == 1
) {
item.goodsTypes = deepClone(item.goodsTypes)
item.categoryTypeText = "按商品分类"
item.categoryType = 1
item.goodsTypes?.forEach((val) => {
textArr.push(val.upgradeGoodsName)
})
item.packageArrText = textArr.join(",")
item.upgradeGoods = [] // 与具体商品互不干扰
item.packageGoods = []
}
// 按具体商品
if (
item.goodsTypes?.length &&
item.goodsTypes[0]?.categoryType == 2
) {
item.upgradeGoods = deepClone(item.goodsTypes)
item.categoryType = "按具体商品"
item.goodsTypes?.forEach((val) => {
upgradeArr.push({
upgradeGoodsId: val.upgradeGoodsId,
upgradeGoodsName: val.upgradeGoodsName,
commodityCode: val.commodityCode
})
textArr.push(val.upgradeGoodsName)
})
item.packageArrText = textArr.join(",")
item.goodsTypes = [] // 与分类互不干扰
item.packageGoods = []
}
// 按套餐商品
if (
item.goodsTypes?.length &&
item.goodsTypes[0]?.categoryType == 3
) {
item.packageGoods = deepClone(item.goodsTypes)
item.categoryType = 3
item.categoryType = "按套餐商品"
item.goodsTypes?.forEach((val) => {
packageArr.push({
packageCode: val.packageCode,
packageName: val.packageName
// commodityCode: val.commodityCode
})
textArr.push(val.packageName)
})
item.packageArrText = textArr.join(",")
item.goodsTypes = [] // 与分类互不干扰
item.upgradeGoods = [] // 与具体商品互不干扰
}
})
this.financialObj = result
this.initSettleTimeObj()
},
// filterData(data) {
// let arrIdx = [1, 302, 2]
// console.log(this.financialObj, ' this.financialObj')
// this.financialObj.goodsTypeGroupRules.forEach((item) => {
// item.expenseCategoryTypeRules = []
// item.expenseCategoryRules.forEach((type) => {
// if (arrIdx.includes(type.expenseCategoryId)) {
// if (type.expenseCategoryId == 1100)
// type.expenseCategoryName = "一线阳光激励费"
// if (type.expenseCategoryId == 809)
// type.expenseCategoryName = "一线阳光2激励费"
// item.expenseCategoryTypeRules.push(type)
// }
// })
// this.$set(
// item,
// "expenseCategoryTypeRules",
// item.expenseCategoryTypeRules
// )
// })
// this.initSettleTimeObj()
// },
initSettleTimeObj() {
const { settleTimeType, settleTime } = this.financialObj
this.settleTimeObj[settleTimeType == 1 ? "first" : "second"] = settleTime
console.log('this.settleTimeObj: ', this.settleTimeObj)
},
getExpenseCategoryCalculateType(value, num) {
if (!value || num == null) {
return "-"
}
// console.log('num: ', num)
let res
switch (value) {
case 1:
res = "按毛利比例:"
break
case 2:
res = "按收入比例:"
break
case 3:
res = "按固定金额:"
break
case 4:
res = "按(产值-流量成本):"
break
case 5:
res = "按(产值-流量成本-其他费用不包含产品成本):"
break
case 6:
res = "按(产值-流量成本-其他费用包含产品成本):"
break
case 8:
res = "按(收入-自定义其他费用):"
break
case 9:
res = "按(收入-其他费用):"
break
case 10:
res = `按固定金额${num}元*购买数量`
break
}
res = value == 10 ? res : res + num + (value == 3 ? "元" : "%")
return res
}
}
}
</script>
<style lang="scss" scoped>
@import "../../style/editdetailCon.scss";
</style>