Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 956bee6e
authored
Apr 29, 2026
by
Jaxon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat(商品上架): 分账配置 - 查看 - 链条
1 parent
4e41ff3a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
964 additions
and
22 deletions
src/views/goods/shelfProduct/api/index.js
src/views/goods/shelfProduct/components/profitSharingConfig/components/costAttributionSetting/index.vue
src/views/goods/shelfProduct/components/profitSharingConfig/components/specialCategory/index.vue
src/views/goods/shelfProduct/components/profitSharingConfig/components/specialCategory/specialCategoryDetail.vue
src/views/goods/shelfProduct/components/profitSharingConfig/components/specialCategory/specialCategoryModify.vue
src/views/goods/shelfProduct/components/profitSharingConfig/hooks/index.js
src/views/goods/shelfProduct/components/profitSharingConfig/index.vue
src/views/goods/shelfProduct/constant/index.js
src/views/goods/shelfProduct/utils/status.js
src/views/goods/shelfProduct/utils/validate.js
src/views/goods/shelfProduct/view/modify/index.vue
src/views/goods/shelfProduct/api/index.js
View file @
956bee6
...
@@ -4,33 +4,33 @@ import { mockRequest } from "@/api/mock/request.mock.js";
...
@@ -4,33 +4,33 @@ import { mockRequest } from "@/api/mock/request.mock.js";
import
request
from
"@/api/request"
;
import
request
from
"@/api/request"
;
import
RequestMethods
from
"@/api/request.methods"
;
import
RequestMethods
from
"@/api/request.methods"
;
// 获取数据 表格数据
// 获取数据 表格数据
export
function
getShelfProductPageApi
(
data
)
{
export
function
getShelfProductPageApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.approval.page"
;
data
.
method
=
"dj.api.goods.listing.approval.page"
;
return
request
(
data
,
RequestMethods
.
POST
);
return
request
(
data
,
RequestMethods
.
POST
);
}
}
export
function
getShelfProductBaseInfoApi
(
data
)
{
export
function
getShelfProductBaseInfoApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.approval.getBaseInfo"
;
data
.
method
=
"dj.api.goods.listing.approval.getBaseInfo"
;
return
mockRequest
(
data
);
return
mockRequest
(
data
);
}
}
// 第一步 提交
// 第一步 提交
export
function
postShelfProductBaseInfoApi
(
data
)
{
export
function
postShelfProductBaseInfoApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.approval.save"
;
data
.
method
=
"dj.api.goods.listing.approval.save"
;
return
request
(
data
,
RequestMethods
.
POST
,
[
"file"
]);
return
request
(
data
,
RequestMethods
.
POST
,
[
"file"
]);
}
}
// 第一步 通过上面的接口 得到uuid, 然后用这个uuid 轮训
// 第一步 通过上面的接口 得到uuid, 然后用这个uuid 轮训
export
function
postPollFileParseStatusApi
(
data
)
{
export
function
postPollFileParseStatusApi
(
data
=
{}
)
{
data
.
method
=
`dj.api.common.importExcel.async.queryProcess`
;
data
.
method
=
`dj.api.common.importExcel.async.queryProcess`
;
return
request
(
data
,
"post"
);
return
request
(
data
,
"post"
);
}
}
export
function
getShelfProductBaseInfoByUUIDApi
(
data
)
{
export
function
getShelfProductBaseInfoByUUIDApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.approval.getBaseInfoByUuid"
;
data
.
method
=
"dj.api.goods.listing.approval.getBaseInfoByUuid"
;
return
request
(
data
,
RequestMethods
.
POST
);
return
request
(
data
,
RequestMethods
.
POST
);
}
}
// 获取流量方列表
// 获取流量方列表
export
function
getTrafficSourceListApi
(
data
)
{
export
function
getTrafficSourceListApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.create.business.approve.merchantPage"
;
data
.
method
=
"dj.api.create.business.approve.merchantPage"
;
return
request
(
defaults
(
data
,
{
return
request
(
defaults
(
data
,
{
currentPage
:
1
,
currentPage
:
1
,
...
@@ -39,28 +39,28 @@ export function getTrafficSourceListApi(data) {
...
@@ -39,28 +39,28 @@ export function getTrafficSourceListApi(data) {
}
}
// 获取商品/套餐列表
// 获取商品/套餐列表
export
function
getProductPackagesListApi
(
data
)
{
export
function
getProductPackagesListApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.product.page"
;
data
.
method
=
"dj.api.goods.listing.product.page"
;
return
request
(
data
,
RequestMethods
.
POST
);
return
request
(
data
,
RequestMethods
.
POST
);
}
}
// 获取商品/套餐详情
// 获取商品/套餐详情
export
function
getProductPackagesDetailApi
(
data
)
{
export
function
getProductPackagesDetailApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.product.getDetailById"
;
data
.
method
=
"dj.api.goods.listing.product.getDetailById"
;
return
request
(
data
,
RequestMethods
.
POST
);
return
request
(
data
,
RequestMethods
.
POST
);
}
}
// 新增 商品 / 套餐
// 新增 商品 / 套餐
export
function
postProductPackagesApi
(
data
)
{
export
function
postProductPackagesApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.product.insertOrUpdate"
;
data
.
method
=
"dj.api.goods.listing.product.insertOrUpdate"
;
return
request
(
data
,
RequestMethods
.
POST
);
return
request
(
data
,
RequestMethods
.
POST
);
}
}
export
function
delProductPackagesApi
(
data
)
{
export
function
delProductPackagesApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.product.delete"
;
data
.
method
=
"dj.api.goods.listing.product.delete"
;
return
request
(
data
,
RequestMethods
.
POST
);
return
request
(
data
,
RequestMethods
.
POST
);
}
}
// 分页查询 商户列表-带关联关系
// 分页查询 商户列表-带关联关系
export
async
function
getMerchantTrafficSideListApi
(
data
)
{
export
async
function
getMerchantTrafficSideListApi
(
data
=
{}
)
{
const
res
=
await
getMerchantListApi
(
data
);
const
res
=
await
getMerchantListApi
(
data
);
res
.
list
=
res
.
list
.
map
(
item
=>
({
res
.
list
=
res
.
list
.
map
(
item
=>
({
merchantId
:
item
.
merchantId
,
merchantId
:
item
.
merchantId
,
...
@@ -69,14 +69,26 @@ export async function getMerchantTrafficSideListApi(data) {
...
@@ -69,14 +69,26 @@ export async function getMerchantTrafficSideListApi(data) {
return
res
;
return
res
;
}
}
// 分账配置 - 基础规则信息
// 分账配置 -
获取
基础规则信息
export
function
getProfitSharingConfigBaseDetailApi
(
data
)
{
export
function
getProfitSharingConfigBaseDetailApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.divisionRule.getBaseRule"
;
data
.
method
=
"dj.api.goods.listing.divisionRule.getBaseRule"
;
return
mockRequest
(
data
,
RequestMethods
.
POST
);
return
request
(
data
,
RequestMethods
.
POST
);
}
// 分账配置 - 保存基础规则信息
export
function
postProfitSharingConfigBaseDetailApi
(
data
=
{})
{
data
.
method
=
"dj.api.goods.listing.divisionRule.saveBaseRule"
;
return
request
(
data
,
RequestMethods
.
POST
);
}
}
// 分账配置 - 所有品类列表
// 分账配置 - 所有品类列表
export
function
getProfitSharingConfigSpecialCategoryListApi
(
data
)
{
export
function
getProfitSharingConfigSpecialCategoryListApi
(
data
=
{}
)
{
data
.
method
=
"dj.api.goods.listing.divisionRule.listGoodsTypeGroup"
;
data
.
method
=
"dj.api.goods.listing.divisionRule.listGoodsTypeGroup"
;
return
mockRequest
(
data
,
RequestMethods
.
POST
);
return
request
(
data
,
RequestMethods
.
POST
);
}
// 分账配置 - 品类详情
export
function
getProfitSharingConfigSpecialCategoryDetailApi
(
data
=
{})
{
data
.
method
=
"dj.api.goods.listing.divisionRule.getGoodsTypeGroupDetail"
;
return
request
(
data
,
RequestMethods
.
POST
);
}
}
src/views/goods/shelfProduct/components/profitSharingConfig/components/costAttributionSetting/index.vue
0 → 100644
View file @
956bee6
<
template
>
<div
class=
"attribution-setting-wrapper"
>
<el-form-item
:label=
"title"
style=
"flex:1;"
>
<table
cellpadding=
"0"
cellspacing=
"0"
class=
"table-block"
>
<tr
class=
"table-header"
>
<th>
分账对象/分账类目
</th>
<!--
<td>
平台方分账金额
</td>
-->
<th
v-for=
"(item, index) in tableCols"
:key=
"index"
>
<span
class=
"required-star"
>
*
</span>
{{
item
.
feeCategoryName
||
item
.
expenseCategoryName
}}
</th>
</tr>
<tr
v-for=
"(item, rowIndex) in tableRows"
:key=
"item.targetMerchantType"
class=
"table-body"
>
<td
class=
"merchant-name-wrapper"
>
<span
:title=
"getMerchantTypeName(item)"
>
{{
getMerchantTypeName
(
item
)
}}
</span>
</td>
<template
v-for=
"(colItem, colIndex) in tableCols"
>
<td
:key=
"`$
{colIndex}colList`" class="radio-wrapper">
<!-- 只在最后一行渲染 el-form-item 用于校验整列,避免每行都产生校验规则和报错 -->
<el-form-item
v-if=
"rowIndex === tableRows.length - 1"
:prop=
"propPrefix ? `$
{propPrefix}_${colItem.expenseCategoryId}` : ''"
:rules="[{
required: true,
validator: validateCostAttributionSetting,
trigger: 'change',
colItem,
}]"
class="column-validator-item"
label-width="0">
<el-radio
:value=
"value[colItem.expenseCategoryId]"
:label=
"item.targetMerchantType"
:disabled=
"disabled"
@
input=
"val => handleRadioChange(colItem.expenseCategoryId, val)"
>
{{
""
}}
</el-radio>
</el-form-item>
<el-radio
v-else
:value=
"value[colItem.expenseCategoryId]"
:label=
"item.targetMerchantType"
:disabled=
"disabled"
@
input=
"val => handleRadioChange(colItem.expenseCategoryId, val)"
>
{{
""
}}
</el-radio>
</td>
</
template
>
</tr>
</table>
</el-form-item>
</div>
</template>
<
script
>
import
{
isBatchPublishMode
}
from
"@/views/goods/shelfProduct/utils/status.js"
;
import
{
validateCostAttributionSetting
}
from
"@/views/goods/shelfProduct/utils/validate.js"
;
export
default
{
name
:
""
,
props
:
{
tableCols
:
{
type
:
Array
,
default
:
()
=>
([]),
},
tableRows
:
{
type
:
Array
,
default
:
()
=>
([]),
},
title
:
{
type
:
String
,
default
:
""
,
},
disabled
:
{
type
:
Boolean
,
default
:
false
,
},
value
:
{
type
:
Object
,
default
:
()
=>
({}),
},
propPrefix
:
{
type
:
String
,
default
:
""
,
},
},
data
()
{
return
{
};
},
computed
:
{
},
mounted
()
{
},
methods
:
{
validateCostAttributionSetting
,
handleRadioChange
(
expenseCategoryId
,
val
)
{
const
newValue
=
{
...
this
.
value
,
[
expenseCategoryId
]:
val
};
this
.
$emit
(
"input"
,
newValue
);
// 手动触发该列的表单校验,以消除由于点击非第一行 radio 而未触发的校验错误
if
(
this
.
propPrefix
)
{
const
propName
=
`
${
this
.
propPrefix
}
_
${
expenseCategoryId
}
`
;
this
.
$nextTick
(()
=>
{
let
parent
=
this
.
$parent
;
while
(
parent
&&
parent
.
$options
.
componentName
!==
"ElForm"
)
{
parent
=
parent
.
$parent
;
}
if
(
parent
)
{
parent
.
validateField
(
propName
);
}
});
}
},
getMerchantTypeName
(
item
)
{
const
name
=
{
1
:
"平台方"
,
2
:
"服务商"
,
3
:
"流量方"
,
4
:
"平台方"
,
5
:
"服务商2"
,
};
// 如果是 项目制批量上架 不显示name
if
(
isBatchPublishMode
(
this
.
shelfType
))
{
return
item
.
merchantName
;
}
const
type
=
item
.
targetMerchantType
;
return
`
${
name
[
type
]}
:
${
item
.
merchantName
}
`
;
},
},
};
</
script
>
<
style
scoped
lang=
"scss"
>
.attribution-setting-wrapper
{
display
:
flex
;
>
.label
{
width
:
150px
;
text-align
:
right
;
flex-shrink
:
0
;
vertical-align
:
middle
;
font-size
:
14px
;
color
:
#606266
;
line-height
:
32px
;
padding
:
0
12px
0
0
;
box-sizing
:
border-box
;
}
.form-wrapper
{
overflow-x
:
scroll
;
flex-shrink
:
0
;
flex
:
1
;
}
::v-deep
.table-block
{
width
:
100%
;
table-layout
:
fixed
;
border-collapse
:
collapse
;
th,
td
{
border
:
1px
solid
#e5e5e5
;
}
.table-header
{
padding
:
14px
0
;
th
{
width
:
auto
;
line-height
:
20px
;
color
:
#333333
;
font-size
:
14px
;
&:first-child
{
width
:
150px
;
}
.required-star
{
color
:
#f56c6c
;
margin-right
:
4px
;
}
}
}
.table-body
{
td
{
padding
:
18px
0
;
}
.merchant-name-wrapper
{
line-height
:
20px
;
color
:
#666666
;
font-size
:
14px
;
text-align
:
center
;
}
.radio-wrapper
{
text-align
:
center
;
.el-form-item
{
margin-bottom
:
0
!important
;
.el-form-item__content
{
justify-content
:
center
;
align-items
:
center
;
.el-radio
{
margin-right
:
0
;
}
.el-form-item__error
{
width
:
100%
;
}
}
}
.column-validator-item
{
::v-deep
.el-form-item__error
{
position
:
relative
;
padding-top
:
4px
;
}
}
}
}
//
th
,
//
td
{
//
font-size
:
12px
;
//
font-weight
:
normal
;
//
padding
:
0px
10px
;
//
border
:
1px
solid
#e5e6e7
;
//
border-width
:
0px
1px
1px
0px
;
//
border-spacing
:
0
;
//
text-align
:
center
;
//
min-width
:
100px
;
//
white-space
:
nowrap
;
//
&.merchant-name-wrapper
{
//
min-width
:
150px
;
//
}
//
}
//
td
{
//
font-size
:
14px
!important
;
//
}
}
}
.pb-20
{
padding-bottom
:
26px
!important
;
}
</
style
>
src/views/goods/shelfProduct/components/profitSharingConfig/components/specialCategory/index.vue
0 → 100644
View file @
956bee6
<
template
>
<div
class=
"special-category-wrapper"
>
<Detail
v-if=
"editState === VIEW_MODE.VIEW"
v-bind=
"$attrs"
:goods-list=
"options.productType"
:base-scene-code=
"baseSceneCode"
v-on=
"$listeners"
/>
<Modify
v-if=
"editState === VIEW_MODE.EDIT"
ref=
"modifyRef"
v-bind=
"$attrs"
:goods-list=
"options.productType"
:base-scene-code=
"baseSceneCode"
/>
</div>
</
template
>
<
script
>
import
{
VIEW_MODE
}
from
"@/views/goods/shelfProduct/constant/index.js"
;
import
Detail
from
"./specialCategoryDetail.vue"
;
import
Modify
from
"./specialCategoryModify.vue"
;
export
default
{
name
:
""
,
components
:
{
Detail
,
Modify
,
},
inheritAttrs
:
false
,
props
:
{
editState
:
{
type
:
String
,
default
:
VIEW_MODE
.
VIEW
,
},
baseSceneCode
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
VIEW_MODE
,
options
:
{
category
:
{},
productType
:
[],
selectedGoodsType
:
[],
},
};
},
computed
:
{
},
mounted
()
{
},
methods
:
{
},
};
</
script
>
<
style
scoped
lang=
"scss"
>
</
style
>
src/views/goods/shelfProduct/components/profitSharingConfig/components/specialCategory/specialCategoryDetail.vue
0 → 100644
View file @
956bee6
<
template
>
<!-- 分账配置 - 特殊品类 - 编辑状态 -->
<div
class=
"detail-wrapper "
>
<Descriptions
:schema=
"getSchema"
:data=
"getSchemaData"
/>
<CostAttributionSetting
:value=
"owningMerchantDistributionRulesMap"
prop-prefix=
"owningMerchantDistributionRulesMap"
title=
"费用归属设置"
disabled
:table-cols=
"tableCols"
:table-rows=
"tableRows"
/>
<CostAttributionSetting
:value=
"merchantDistributionRulesMap"
prop-prefix=
"merchantDistributionRulesMap"
title=
"实际分账设置"
disabled
:table-cols=
"tableCols"
:table-rows=
"tableRows"
/>
</div>
</
template
>
<
script
>
import
{
pick
}
from
"lodash-es"
;
import
{
defaultSelectOptions
,
otherSelectOptions
,
severSelectOptions
,
}
from
"@/common/constant/merchant"
;
import
{
isZeroOrNumber
}
from
"@/libs/number.js"
;
import
Descriptions
from
"@/views/goods/shelfManage/components/descriptions/index.vue"
;
import
CostAttributionSetting
from
"@/views/goods/shelfProduct/components/profitSharingConfig/components/costAttributionSetting/index.vue"
;
import
{
getTableCols
,
getTableRows
,
getTrafficExpenseCategoryRules
,
rulesToMap
,
}
from
"@/views/goods/shelfProduct/components/profitSharingConfig/hooks"
;
import
{
categoryTypeOptions
}
from
"@/views/goods/shelfProduct/constant/index.js"
;
export
default
{
name
:
""
,
components
:
{
Descriptions
,
CostAttributionSetting
,
},
props
:
{
specialDetail
:
{
type
:
Object
,
default
:
()
=>
({}),
},
baseSceneCode
:
{
type
:
String
,
required
:
true
,
},
realityShopMerchantId
:
{
type
:
Number
,
default
:
0
,
},
realityShopMerchantName
:
{
type
:
String
,
default
:
""
,
},
realityPlatformMerchantId
:
{
type
:
Number
,
default
:
0
,
},
realityPlatformMerchantName
:
{
type
:
String
,
default
:
""
,
},
partnerMerchantId
:
{
type
:
Number
,
default
:
0
,
},
partnerMerchantName
:
{
type
:
String
,
default
:
""
,
},
partnerMerchantName2
:
{
type
:
String
,
default
:
""
,
},
partnerMerchantId2
:
{
type
:
Number
,
default
:
0
,
},
realityShopLevel
:
{
type
:
Number
,
default
:
0
,
},
shelfType
:
{
type
:
Number
,
default
:
0
,
},
},
data
()
{
return
{
};
},
computed
:
{
owningMerchantDistributionRulesMap
()
{
return
rulesToMap
(
this
.
specialDetail
?.
owningMerchantDistributionRules
,
this
.
tableRows
,
this
.
tableCols
,
);
},
merchantDistributionRulesMap
()
{
return
rulesToMap
(
this
.
specialDetail
?.
merchantDistributionRules
,
this
.
tableRows
,
this
.
tableCols
,
);
},
tableRows
()
{
return
getTableRows
(
pick
(
this
.
$props
,
[
"realityShopMerchantId"
,
"realityShopMerchantName"
,
"realityPlatformMerchantId"
,
"realityPlatformMerchantName"
,
"partnerMerchantId"
,
"partnerMerchantName"
,
"partnerMerchantId2"
,
"partnerMerchantName2"
,
"realityShopLevel"
,
"shelfType"
,
]));
},
tableCols
()
{
return
getTableCols
(
this
.
baseSceneCode
,
this
.
specialDetail
?.
expenseCategoryRuleList
||
[],
this
.
specialDetail
.
goodsTypeGroupRelationList
||
[]);
},
getSchemaData
()
{
const
trafficSideExpenseCategoryRules
=
getTrafficExpenseCategoryRules
(
this
.
specialDetail
?.
expenseCategoryRuleList
||
[]);
const
data
=
trafficSideExpenseCategoryRules
.
reduce
((
acc
,
item
)
=>
{
const
isAmount
=
[
3
,
10
].
includes
(
item
.
expenseCategoryCalculateType
);
const
unit
=
isAmount
?
"元"
:
"%"
;
const
value
=
isZeroOrNumber
(
item
.
expenseCategoryValue
);
let
typeLabel
=
""
;
const
options
=
this
.
getExpenseCategoryCalculateTypeOptions
(
item
.
applicationObjectType
);
const
opt
=
options
.
find
(
o
=>
o
.
expenseCategoryCalculateType
===
item
.
expenseCategoryCalculateType
);
if
(
opt
)
{
typeLabel
=
opt
.
label
;
}
acc
[
item
.
expenseCategoryId
]
=
{
text
:
`
${
value
}${
unit
}
`
,
typeLabel
,
};
return
acc
;
},
{});
// 不是全部的话
if
(
this
.
specialDetail
.
groupType
!==
1
)
{
const
categoryTypeOpt
=
categoryTypeOptions
.
find
(
o
=>
o
.
value
===
this
.
specialDetail
.
categoryType
);
data
.
categoryType
=
{
text
:
categoryTypeOpt
?
categoryTypeOpt
.
label
:
"-"
};
let
goodsStr
=
"-"
;
if
(
this
.
specialDetail
.
goodsTypeGroupRelationList
&&
this
.
specialDetail
.
goodsTypeGroupRelationList
.
length
)
{
goodsStr
=
this
.
specialDetail
.
goodsTypeGroupRelationList
.
map
((
item
)
=>
{
if
(
this
.
specialDetail
.
categoryType
===
1
)
return
item
.
goodsTypeName
;
if
(
this
.
specialDetail
.
categoryType
===
2
)
return
`
${
item
.
upgradeGoodsName
}
(
${
item
.
merchantGoodsCode
}
)`
;
if
(
this
.
specialDetail
.
categoryType
===
3
)
return
`
${
item
.
packageName
}
(
${
item
.
packageCode
}
)`
;
return
"-"
;
});
}
data
.
goodsTypeGroupRelations
=
{
text
:
goodsStr
};
}
return
data
;
},
getSchema
()
{
const
trafficSideExpenseCategoryRules
=
getTrafficExpenseCategoryRules
(
this
.
specialDetail
?.
expenseCategoryRuleList
||
[]);
const
schema
=
trafficSideExpenseCategoryRules
.
map
((
item
)
=>
{
return
{
descKey
:
item
.
expenseCategoryId
,
label
:
item
.
expenseCategoryName
||
item
.
applicationObjectName
,
col
:
24
,
render
:
(
h
,
{
data
,
schemaItem
})
=>
{
const
info
=
data
[
schemaItem
.
descKey
];
if
(
!
info
)
return
h
(
"span"
,
"-"
);
return
h
(
"span"
,
info
.
typeLabel
?
`
${
info
.
typeLabel
}
:
${
info
.
text
}
`
:
info
.
text
);
},
};
});
if
(
this
.
specialDetail
.
groupType
!==
1
)
{
schema
.
unshift
(
{
descKey
:
"categoryType"
,
label
:
"分账品类"
,
col
:
24
,
render
:
(
h
,
{
data
,
schemaItem
})
=>
{
const
info
=
data
[
schemaItem
.
descKey
];
return
h
(
"span"
,
info
?
info
.
text
:
"-"
);
},
},
{
descKey
:
"goodsTypeGroupRelations"
,
label
:
"商品"
,
col
:
24
,
render
:
(
h
,
{
data
,
schemaItem
})
=>
{
const
info
=
data
[
schemaItem
.
descKey
];
if
(
!
info
||
info
.
text
===
"-"
)
{
return
h
(
"span"
,
"-"
);
}
if
(
Array
.
isArray
(
info
.
text
))
{
return
h
(
"div"
,
{
class
:
"goods-relations-wrap"
},
info
.
text
.
join
(
","
));
}
return
h
(
"span"
,
info
.
text
);
},
},
);
}
return
schema
;
},
},
mounted
()
{
},
methods
:
{
getExpenseCategoryCalculateTypeOptions
(
targetType
)
{
if
(
targetType
===
1
)
{
return
[...
defaultSelectOptions
,
...
otherSelectOptions
];
}
if
(
targetType
===
2
)
{
return
severSelectOptions
;
}
if
(
targetType
===
3
)
{
return
defaultSelectOptions
;
}
return
[];
},
},
};
</
script
>
<
style
scoped
lang=
"scss"
>
::v-deep
.goods-relations-wrap
{
white-space
:
normal
;
word-break
:
break-all
;
overflow-wrap
:
anywhere
;
}
</
style
>
src/views/goods/shelfProduct/components/profitSharingConfig/components/specialCategory/specialCategoryModify.vue
0 → 100644
View file @
956bee6
<
template
>
<div
class=
""
>
</div>
</
template
>
<
script
>
export
default
{
name
:
""
,
props
:
{
baseSceneCode
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
};
},
computed
:
{
},
mounted
()
{
},
methods
:
{
},
};
</
script
>
<
style
scoped
lang=
"scss"
>
</
style
>
src/views/goods/shelfProduct/components/profitSharingConfig/hooks/index.js
0 → 100644
View file @
956bee6
import
{
paymentChannelList
as
getPaymentChannelListApi
}
from
"@api/merchant"
;
import
{
cloneDeep
,
sortBy
,
uniqBy
}
from
"lodash-es"
;
import
{
getMerchantLevelApi
}
from
"@/api/shelfManage"
;
import
{
queryFeeCategoryByType
as
getFeeCategoryByTypeApi
}
from
"@/api/sys.base"
;
import
{
attrToVal
as
attrToValOptions
,
userType
}
from
"@/common/constants"
;
import
{
isSingleShopMode
}
from
"@/views/goods/shelfManage/components/profitSharingConfig/utils/feeCategoryHelper"
;
import
{
getProfitSharingConfigBaseDetailApi
,
getProfitSharingConfigSpecialCategoryDetailApi
,
getProfitSharingConfigSpecialCategoryListApi
,
postProfitSharingConfigBaseDetailApi
,
}
from
"@/views/goods/shelfProduct/api"
;
import
{
getSelectFilterIds
,
getTableFilterIds
,
isMemberRightsUpgrade
,
}
from
"@/views/goods/shelfProduct/utils/status"
;
// 获取渠道列表, 这里的数据不真实. 仅做循环展示用 .
// 具体的值需要 获取品类详情后 再设置
export
async
function
getDivisionRuleAutosShowList
()
{
const
data
=
await
getPaymentChannelListApi
({});
return
data
.
map
((
item
)
=>
{
return
{
paymentChannelId
:
item
.
paymentChannelId
,
paymentChannelName
:
item
.
paymentChannelName
,
// 自动分账标识(Y是,N否)
autoFlag
:
"N"
,
// 分账时间方式(1:T+1,2:每月)
settleTimeType
:
1
,
// 分账时间每月几号
settleTime
:
null
,
};
});
}
/**
* 将渠道的值映射到 渠道列表里
*/
export
function
syncDivisionRuleValue
(
valueList
,
showList
)
{
for
(
const
paymentChannelItem
of
showList
)
{
const
divisionItem
=
valueList
.
find
(
item
=>
item
.
paymentChannelId
===
paymentChannelItem
.
paymentChannelId
);
if
(
!
divisionItem
)
{
continue
;
}
Object
.
assign
(
paymentChannelItem
,
divisionItem
);
}
return
showList
;
}
// 单店模式下的 流量方分账方数据项
export
async
function
getSingleRealityShopMerchantOptions
({
merchantId
,
baseSceneCode
})
{
const
res
=
await
getMerchantLevelApi
({
merchantId
,
channelType
:
1
,
scene
:
isMemberRightsUpgrade
(
baseSceneCode
)
?
0
:
1
,
});
if
(
!
res
.
merchantId
)
{
return
;
}
const
merchantLevel
=
[
{
merchantId
:
res
.
merchantId
,
showMerchantName
:
res
.
merchantName
,
merchantName
:
res
.
merchantName
,
userType
:
res
.
merchantAccountLevel
,
realityShopLevel
:
1
,
},
];
const
accountLevel
=
Number
(
res
.
merchantAccountLevel
);
const
additionalList
=
attrToValOptions
.
filter
(
item
=>
item
.
confId
<
accountLevel
&&
res
[
`
${
item
.
confLabel
}
MerchantId`
]);
const
additionalMerchants
=
additionalList
.
map
((
item
)
=>
{
const
merchantId
=
res
[
`
${
item
.
confLabel
}
MerchantId`
];
const
merchantName
=
res
[
`
${
item
.
confLabel
}
MerchantName`
];
return
{
merchantId
,
showMerchantName
:
`
${
userType
[
item
.
confId
]}
:
${
merchantName
}
`
,
merchantName
,
userType
:
item
.
confId
,
realityShopLevel
:
2
,
};
});
merchantLevel
.
push
(...
additionalMerchants
);
if
(
res
.
firstFlowMerchantId
)
{
merchantLevel
.
push
({
merchantId
:
res
.
firstFlowMerchantId
,
showMerchantName
:
res
.
firstFlowMerchantName
,
merchantName
:
res
.
firstFlowMerchantName
,
});
}
if
(
res
.
flowChannelMerchantId
)
{
merchantLevel
.
push
({
merchantId
:
res
.
flowChannelMerchantId
,
showMerchantName
:
res
.
flowChannelMerchantName
,
merchantName
:
res
.
flowChannelMerchantName
,
});
}
// 将数据去重 (商户上架时一级流量方和流量通道方设置同一家门店)
return
uniqBy
(
merchantLevel
,
"merchantId"
);
}
// 获取特殊品类 选择项
export
async
function
getProfitSharingTypeList
({
businessCode
})
{
const
data
=
await
getProfitSharingConfigSpecialCategoryListApi
({
businessCode
});
// 设置名字
return
sortBy
(
data
.
map
((
item
,
index
)
=>
({
...
item
,
title
:
item
.
groupType
===
1
?
"全部品类"
:
"特殊品类"
,
})),
"id"
);
}
// 获取特殊品类 详情
export
async
function
getProfitSharingTypeDetail
({
businessCode
,
goodsTypeGroupId
,
baseSceneCode
})
{
const
detail
=
await
getProfitSharingConfigSpecialCategoryDetailApi
({
businessCode
,
goodsTypeGroupId
});
detail
.
expenseCategoryRuleList
=
await
syncExpenseCategoryRulesToFeeCategoryType
(
baseSceneCode
,
detail
.
expenseCategoryRuleList
);
return
detail
;
}
// 同步 getFeeCategoryByTypeApi 的数据
async
function
syncExpenseCategoryRulesToFeeCategoryType
(
baseSceneCode
,
expenseCategoryRuleList
)
{
const
{
list
}
=
await
getFeeCategoryByTypeApi
({
feeCategoryType
:
1
,
orderBy
:
2
,
pageSize
:
100000
,
applicationSceneType
:
isMemberRightsUpgrade
(
baseSceneCode
)
?
0
:
1
,
});
return
list
.
map
((
feeItem
)
=>
{
feeItem
.
expenseCategoryId
=
feeItem
.
feeCategoryNameId
;
feeItem
.
expenseCategoryName
=
feeItem
.
feeCategoryName
;
const
expenseCategory
=
expenseCategoryRuleList
.
find
(
item
=>
feeItem
.
feeCategoryNameId
===
item
.
expenseCategoryId
);
return
{
expenseCategoryId
:
feeItem
.
feeCategoryNameId
,
expenseCategoryName
:
feeItem
.
feeCategoryName
,
...
feeItem
,
...
expenseCategory
||
{},
};
});
}
// 获取 分账配置 基础信息
export
async
function
getProfitSharingBaseDetail
({
businessCode
})
{
// 获取渠道列表, 这里的数据不真实. 仅做循环展示用 .
// 具体的值需要 获取品类详情后 再设置
const
showList
=
await
getDivisionRuleAutosShowList
();
const
baseDetail
=
await
getProfitSharingConfigBaseDetailApi
({
businessCode
});
const
divisionRuleAutos
=
await
syncDivisionRuleValue
(
baseDetail
.
divisionRuleAutoList
,
showList
);
return
{
baseDetail
,
divisionRuleAutos
,
};
}
// 保存 分账配置 基础信息
export
async
function
postProfitSharingBaseDetail
({
businessCode
,
divisionRuleAutos
,
realityShopUserType
,
realityShopLevel
,
realityShopMerchantId
,
realityShopMerchantName
})
{
return
await
postProfitSharingConfigBaseDetailApi
({
businessCode
,
divisionRuleAutos
:
divisionRuleAutos
.
map
(
item
=>
({
paymentChannelId
:
item
.
paymentChannelId
,
paymentChannelName
:
item
.
paymentChannelName
,
autoFlag
:
item
.
autoFlag
,
settleTimeType
:
item
.
settleTimeType
,
settleTime
:
item
.
settleTime
,
})),
realityShopUserType
,
realityShopLevel
,
realityShopMerchantId
,
realityShopMerchantName
,
});
}
export
function
getTrafficExpenseCategoryRules
(
expenseCategoryRuleList
,
baseSceneCode
)
{
return
expenseCategoryRuleList
.
filter
(
item
=>
getSelectFilterIds
(
baseSceneCode
).
includes
(
item
.
feeCategoryNameId
));
}
// 获取表格列
export
function
getTableCols
(
baseSceneCode
,
expenseCategoryRules
,
goodsTypeGroupRules
)
{
const
filterIdList
=
getTableFilterIds
(
baseSceneCode
);
const
tableCols
=
cloneDeep
(
expenseCategoryRules
.
filter
(
item
=>
filterIdList
.
includes
(
item
.
feeCategoryNameId
))
||
[]);
if
(
goodsTypeGroupRules
.
virtualAccountCostFlag
===
"Y"
)
{
tableCols
.
push
({
id
:
300
,
feeCategoryNameId
:
300
,
expenseCategoryId
:
300
,
feeCategoryName
:
"虚拟对账成本"
,
applicationObjectName
:
"虚拟对账成本"
,
applicationObjectType
:
3
,
});
}
if
(
goodsTypeGroupRules
.
recoveryCostFlag
===
"Y"
)
{
tableCols
.
push
({
id
:
301
,
feeCategoryNameId
:
301
,
expenseCategoryId
:
301
,
feeCategoryName
:
"回收成本"
,
applicationObjectName
:
"回收成本"
,
applicationObjectType
:
3
,
});
}
if
(
goodsTypeGroupRules
.
djCostFlag
===
"Y"
)
{
tableCols
.
push
({
id
:
700
,
feeCategoryNameId
:
700
,
expenseCategoryId
:
700
,
feeCategoryName
:
"嘀加成本"
,
applicationObjectName
:
"嘀加成本"
,
applicationObjectType
:
3
,
});
}
tableCols
.
push
({
id
:
4
,
feeCategoryNameId
:
4
,
expenseCategoryId
:
4
,
feeCategoryName
:
"手续费"
,
applicationObjectName
:
"手续费"
,
applicationObjectType
:
3
,
});
return
uniqBy
(
tableCols
,
"expenseCategoryId"
);
}
export
function
getTableRows
({
realityShopMerchantId
,
realityShopMerchantName
,
realityPlatformMerchantId
,
realityPlatformMerchantName
,
partnerMerchantId
,
partnerMerchantName
,
partnerMerchantId2
,
partnerMerchantName2
,
realityShopLevel
,
shelfType
,
})
{
function
getMerchantSide
()
{
if
(
isSingleShopMode
(
shelfType
))
{
return
{
merchantId
:
realityShopMerchantId
,
merchantName
:
realityShopMerchantName
,
targetMerchantType
:
3
,
};
}
return
{
merchantId
:
realityShopLevel
,
merchantName
:
realityShopLevel
===
1
?
"流量方"
:
"上级流量方"
,
targetMerchantType
:
3
,
targetMerchantLevel
:
realityShopLevel
,
};
}
const
rows
=
[
{
merchantId
:
realityPlatformMerchantId
,
merchantName
:
isSingleShopMode
(
shelfType
)
?
realityPlatformMerchantName
:
"平台方"
,
targetMerchantType
:
1
,
targetMerchantLevel
:
1
,
},
getMerchantSide
(),
{
merchantId
:
partnerMerchantId
,
merchantName
:
isSingleShopMode
(
shelfType
)
?
partnerMerchantName
:
"服务商"
,
targetMerchantType
:
2
,
targetMerchantLevel
:
1
,
},
];
if
(
partnerMerchantId2
)
{
rows
.
push
({
merchantId
:
partnerMerchantId2
,
merchantName
:
isSingleShopMode
(
shelfType
)
?
partnerMerchantName2
:
"服务商2"
,
targetMerchantType
:
5
,
targetMerchantLevel
:
1
,
});
}
return
rows
;
}
export
function
rulesToMap
(
rules
,
tableRows
,
tableCols
)
{
const
map
=
{};
// 设置默认值等于平台方
// if (tableRows.length > 0) {
// for (const col of tableCols) {
// map[col.expenseCategoryId] = tableRows[0].targetMerchantType;
// }
// }
for
(
const
rule
of
(
rules
||
[]))
{
map
[
rule
.
expenseCategoryId
]
=
rule
.
targetMerchantType
;
}
return
map
;
}
src/views/goods/shelfProduct/components/profitSharingConfig/index.vue
View file @
956bee6
This diff is collapsed.
Click to expand it.
src/views/goods/shelfProduct/constant/index.js
View file @
956bee6
...
@@ -4,7 +4,7 @@ export const statusOptions = [
...
@@ -4,7 +4,7 @@ export const statusOptions = [
{
value
:
2
,
label
:
"已审核"
},
{
value
:
2
,
label
:
"已审核"
},
{
value
:
3
,
label
:
"驳回"
},
{
value
:
3
,
label
:
"驳回"
},
];
];
// 商品上架 业务场景
// 商品上架 业务场景
第0位必须是 精品升级
export
const
sceneTypeOptions
=
[
export
const
sceneTypeOptions
=
[
{
value
:
"100101"
,
label
:
"精品升级"
},
{
value
:
"100101"
,
label
:
"精品升级"
},
{
value
:
"110101"
,
label
:
"售前会员权益升级"
},
{
value
:
"110101"
,
label
:
"售前会员权益升级"
},
...
@@ -40,3 +40,10 @@ export const settleTimeOptions = [
...
@@ -40,3 +40,10 @@ export const settleTimeOptions = [
{
value
:
1
,
label
:
"1"
},
{
value
:
1
,
label
:
"1"
},
{
value
:
2
,
label
:
"2"
},
{
value
:
2
,
label
:
"2"
},
];
];
// 分账品类
export
const
categoryTypeOptions
=
[
{
label
:
"按商品分类"
,
value
:
1
},
{
label
:
"按具体商品"
,
value
:
2
},
{
label
:
"按具体套餐"
,
value
:
3
},
];
src/views/goods/shelfProduct/utils/status.js
View file @
956bee6
import
{
VIEW_MODE
}
from
"@/views/goods/shelfProduct/constant/index.js"
;
import
{
sceneTypeOptions
,
VIEW_MODE
}
from
"@/views/goods/shelfProduct/constant/index.js"
;
// 判断是否为查看状态
// 判断是否为查看状态
// true: 查看状态
// true: 查看状态
...
@@ -23,7 +23,8 @@ export function isQualityUpgrade(sceneType) {
...
@@ -23,7 +23,8 @@ export function isQualityUpgrade(sceneType) {
* @returns {boolean} 是否
* @returns {boolean} 是否
*/
*/
export
function
isMemberRightsUpgrade
(
sceneType
)
{
export
function
isMemberRightsUpgrade
(
sceneType
)
{
return
sceneType
===
0
;
const
memberValues
=
sceneTypeOptions
.
slice
(
1
).
map
(
item
=>
item
.
value
);
return
memberValues
.
includes
(
sceneType
);
}
}
/**
/**
...
@@ -46,3 +47,34 @@ export function isSingleShopMode(shelfType) {
...
@@ -46,3 +47,34 @@ export function isSingleShopMode(shelfType) {
export
function
isBatchPublishMode
(
shelfType
)
{
export
function
isBatchPublishMode
(
shelfType
)
{
return
shelfType
===
2
;
return
shelfType
===
2
;
}
}
/**
* 分账配置 表格仅展示下面这些expenseCategoryId || feeCategoryNameId
* @param {*} sceneType
* @returns array[number]
*/
export
function
getSelectFilterIds
(
baseSceneCode
)
{
const
ids
=
[
1
,
2
,
1300
];
if
(
isMemberRightsUpgrade
(
baseSceneCode
))
{
// 会员权益升级 需要1301 资源费
ids
.
push
(
1301
);
}
return
ids
;
}
/**
* 分账配置 - 表格仅展示下面这些expenseCategoryId || feeCategoryNameId
* @param {*} baseSceneCode
* @returns
*/
export
function
getTableFilterIds
(
baseSceneCode
)
{
const
sceneTypeFilter
=
{
// 精品升级
1
:
[
1
,
2
,
3
,
4
,
301
,
1300
],
// 会员升级权益
0
:
[
1
,
2
,
4
,
701
,
1300
,
1301
],
};
const
sceneType
=
isMemberRightsUpgrade
(
baseSceneCode
)
?
1
:
0
;
return
sceneTypeFilter
[
sceneType
]
||
[];
}
src/views/goods/shelfProduct/utils/validate.js
View file @
956bee6
...
@@ -6,3 +6,18 @@ export function validSettleTimeType(rule, value, callback, item) {
...
@@ -6,3 +6,18 @@ export function validSettleTimeType(rule, value, callback, item) {
callback
();
callback
();
}
}
}
}
export
function
validateCostAttributionSetting
(
rule
,
val
,
callback
)
{
const
{
colItem
}
=
rule
;
console
.
log
(
rule
);
// 由于 prop 是拼接的虚拟路径(如 prefix_123),el-form 传入的 val 永远是 undefined。
// 我们需要从 rule.field 中解析出真实的 expenseCategoryId,并从 this.value 中获取真实值
const
expenseCategoryId
=
rule
.
field
?
rule
.
field
.
split
(
"_"
).
pop
()
:
null
;
const
actualValue
=
expenseCategoryId
?
this
.
value
[
expenseCategoryId
]
:
val
;
if
(
actualValue
===
undefined
||
actualValue
===
null
)
{
callback
(
new
Error
(
`请选择
${
colItem
.
feeCategoryName
||
colItem
.
expenseCategoryName
}
`
));
}
else
{
callback
();
}
}
src/views/goods/shelfProduct/view/modify/index.vue
View file @
956bee6
...
@@ -28,8 +28,7 @@
...
@@ -28,8 +28,7 @@
<FormStep
v-loading=
"data.isStepLoading"
name=
"ProfitSharingConfig"
>
<FormStep
v-loading=
"data.isStepLoading"
name=
"ProfitSharingConfig"
>
<ProfitSharingConfig
business-code=
"GL202604281514047652"
<ProfitSharingConfig
business-code=
"GL202604281514047652"
base-scene-code=
"100101"
base-scene-code=
"100101"
:shelf-type=
"1"
:shelf-type=
"1"
/>
:shelve-id=
"1545"
/>
</FormStep>
</FormStep>
</div>
</div>
<div
class=
"footer-wrapper"
>
<div
class=
"footer-wrapper"
>
...
@@ -107,7 +106,7 @@ export default {
...
@@ -107,7 +106,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
step
:
{
step
:
{
confirmStep
:
1
,
confirmStep
:
2
,
},
},
// 第一步轮训用的 , null || Fn, 为Fn时, 执行即取消轮训
// 第一步轮训用的 , null || Fn, 为Fn时, 执行即取消轮训
polling
:
null
,
polling
:
null
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment