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 fb7bd0ce
authored
May 12, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
f834c531
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
329 additions
and
21 deletions
src/common/installVueMapApi.js
src/components/merchantVerify/merchantVerifyDisplay.js
src/main.js
src/views/systemConfig/merchant/financialRules/index.vue
src/views/systemConfig/merchant/financialRules/utils/validateGoodsTypeGroupRulePayload.js
src/views/systemConfig/merchant/merchantGroundingEdit/MerchantGroundingEdit.vue
src/views/systemConfig/merchant/merchantGroundingEdit/merchantOnShelfOpenPayload.js
src/common/installVueMapApi.js
0 → 100644
View file @
fb7bd0c
import
GLMapSdk
from
"@/common/glsk-mapapi-sdk"
;
let
singleton
=
null
;
function
attachReady
(
sdk
)
{
if
(
typeof
sdk
.
ready
===
"function"
)
return
;
sdk
.
ready
=
function
mapApiReady
(
timeoutMs
=
30000
)
{
const
inst
=
this
;
const
deadline
=
Date
.
now
()
+
timeoutMs
;
return
new
Promise
((
resolve
,
reject
)
=>
{
function
tick
()
{
if
(
inst
.
GLMap
)
{
resolve
(
inst
);
return
;
}
if
(
Date
.
now
()
>=
deadline
)
{
reject
(
new
Error
(
"Map SDK load timeout"
));
return
;
}
setTimeout
(
tick
,
50
);
}
tick
();
});
};
}
function
getOrCreateSdk
()
{
if
(
!
singleton
)
{
singleton
=
new
GLMapSdk
();
attachReady
(
singleton
);
}
return
singleton
;
}
/**
* 注册 Vue.prototype.$mapapi:首次访问再实例化 GLMapSdk,并补全 glsk-mapapi-sdk 未提供的 ready()(轮询 GLMap)。
*/
export
function
installVueMapApi
(
Vue
)
{
Object
.
defineProperty
(
Vue
.
prototype
,
"$mapapi"
,
{
get
()
{
return
getOrCreateSdk
();
},
configurable
:
true
,
});
}
src/components/merchantVerify/merchantVerifyDisplay.js
View file @
fb7bd0c
...
@@ -119,6 +119,20 @@ export function buildMerchantVerifyEchoDisplay(mi) {
...
@@ -119,6 +119,20 @@ export function buildMerchantVerifyEchoDisplay(mi) {
const
mainBrandsFromTree
=
formatMainBrandsFromBrandTreeList
(
m
.
brandTreeList
);
const
mainBrandsFromTree
=
formatMainBrandsFromBrandTreeList
(
m
.
brandTreeList
);
/** 详情「商户名称」后附半角括号内商户号:优先 merchantNo,缺省用 merchantId */
let
noPart
=
""
;
if
(
m
.
merchantNo
!=
null
&&
String
(
m
.
merchantNo
).
trim
()
!==
""
)
{
noPart
=
String
(
m
.
merchantNo
).
trim
();
}
else
if
(
m
.
merchantId
!=
null
&&
String
(
m
.
merchantId
).
trim
()
!==
""
)
{
noPart
=
String
(
m
.
merchantId
).
trim
();
}
const
namePart
=
displayScalarMerchantVerify
(
m
.
merchantName
);
let
merchantNameEcho
=
namePart
;
if
(
noPart
)
{
merchantNameEcho
=
namePart
!==
"-"
?
`
${
namePart
}
(
${
noPart
}
)`
:
`(
${
noPart
}
)`
;
}
return
{
return
{
merchantType
:
displayScalarMerchantVerify
(
merchantType
:
displayScalarMerchantVerify
(
merchantTypeFromAccountTypes
||
m
.
merchantTypeName
||
m
.
merchantType
merchantTypeFromAccountTypes
||
m
.
merchantTypeName
||
m
.
merchantType
...
@@ -131,7 +145,7 @@ export function buildMerchantVerifyEchoDisplay(mi) {
...
@@ -131,7 +145,7 @@ export function buildMerchantVerifyEchoDisplay(mi) {
),
),
superChannel
:
displayScalarMerchantVerify
(
m
.
channelName
),
superChannel
:
displayScalarMerchantVerify
(
m
.
channelName
),
openMode
:
openParts
.
length
?
openParts
.
join
(
" / "
)
:
"-"
,
openMode
:
openParts
.
length
?
openParts
.
join
(
" / "
)
:
"-"
,
merchantName
:
displayScalarMerchantVerify
(
m
.
merchantName
)
,
merchantName
:
merchantNameEcho
,
_emptyRightMerchantName
:
""
,
_emptyRightMerchantName
:
""
,
merchantNo
:
displayScalarMerchantVerify
(
m
.
merchantNo
),
merchantNo
:
displayScalarMerchantVerify
(
m
.
merchantNo
),
merchantInnerId
:
displayScalarMerchantVerify
(
m
.
id
),
merchantInnerId
:
displayScalarMerchantVerify
(
m
.
id
),
...
...
src/main.js
View file @
fb7bd0c
...
@@ -8,7 +8,7 @@ import Vue from "vue";
...
@@ -8,7 +8,7 @@ import Vue from "vue";
import
VueLazyload
from
"vue-lazyload"
;
import
VueLazyload
from
"vue-lazyload"
;
import
{
config
}
from
"@/common/baseConfig"
;
import
{
config
}
from
"@/common/baseConfig"
;
import
GLMapSdk
from
"@/common/glsk-mapapi-sdk
"
;
import
{
installVueMapApi
}
from
"@/common/installVueMapApi
"
;
import
notice
from
"@/common/notice"
;
import
notice
from
"@/common/notice"
;
import
util
from
"@/libs/util.js"
;
import
util
from
"@/libs/util.js"
;
// 针对template模板中使用可选链操作符
// 针对template模板中使用可选链操作符
...
@@ -26,7 +26,7 @@ import router from "./router";
...
@@ -26,7 +26,7 @@ import router from "./router";
import
"default-passive-events"
;
import
"default-passive-events"
;
import
"element-ui/lib/theme-chalk/index.css"
;
import
"element-ui/lib/theme-chalk/index.css"
;
Vue
.
prototype
.
$mapapi
=
new
GLMapSdk
(
);
installVueMapApi
(
Vue
);
Vue
.
use
(
VueLazyload
,
{
Vue
.
use
(
VueLazyload
,
{
// 懒加载默认加载图片
// 懒加载默认加载图片
loading
:
loading
:
...
...
src/views/systemConfig/merchant/financialRules/index.vue
View file @
fb7bd0c
...
@@ -101,12 +101,14 @@
...
@@ -101,12 +101,14 @@
<!-- <span class="title-tips">切换品类前会自动保存当前编辑内容。</span> -->
<!-- <span class="title-tips">切换品类前会自动保存当前编辑内容。</span> -->
<span
class=
"division-rules-toolbar__controls"
>
<span
class=
"division-rules-toolbar__controls"
>
<span
class=
"select-wrapper"
>
<span
class=
"select-wrapper"
>
<el-select
:value=
"editableTabsValue"
class=
"tab-select"
:popper-append-to-body=
"false"
<el-select
:value=
"editableTabsValue"
placeholder=
"请选择特殊品类"
@
change=
"handleDivisionTabChange"
>
:class=
"['tab-select', { 'tab-select--error': divisionTabSelectError }]"
:popper-append-to-body=
"false"
placeholder=
"请选择特殊品类"
@
change=
"handleDivisionTabChange"
>
<el-option
v-for=
"(item, idx) in editableTabs"
:key=
"item.name"
:label=
"item.title"
:value=
"item.name"
>
<el-option
v-for=
"(item, idx) in editableTabs"
:key=
"item.name"
:label=
"item.title"
:value=
"item.name"
>
<div
class=
"tab-select-options-wrapper"
>
<div
class=
"tab-select-options-wrapper"
>
<span
class=
"tab-select-options-wrapper__left"
>
<span
class=
"tab-select-options-wrapper__left"
>
<span
v-show=
"item.calculateModeError || item.divisionTestTabWarningFromApi"
<span
v-show=
"item.calculateModeError || item.divisionTestTabWarningFromApi || item.rulePayloadValidationError"
class=
"el-icon-warning icons car-error-txt"
/>
class=
"el-icon-warning icons car-error-txt"
/>
<span
class=
"label"
>
{{ item.title }}
</span>
<span
class=
"label"
>
{{ item.title }}
</span>
</span>
</span>
...
@@ -201,6 +203,7 @@ import {
...
@@ -201,6 +203,7 @@ import {
}
from
"./utils/classificationRuleCache"
}
from
"./utils/classificationRuleCache"
import
{
import
{
distributionRulesLookComplete
,
distributionRulesLookComplete
,
ledgerMerchantIdLooseEqual
,
prepareRuleForValidation
,
prepareRuleForValidation
,
validateGoodsTypeGroupRulePayload
validateGoodsTypeGroupRulePayload
}
from
"./utils/validateGoodsTypeGroupRulePayload"
}
from
"./utils/validateGoodsTypeGroupRulePayload"
...
@@ -304,7 +307,11 @@ export default {
...
@@ -304,7 +307,11 @@ export default {
financialRulesEnv
:
{
financialRulesEnv
:
{
routerInfo
:
{},
routerInfo
:
{},
scene
:
undefined
scene
:
undefined
}
},
/** getFinancialObj 等初始化完成后再响应分账方变更,避免首屏回填误清空测试状态 */
_ledgerInvalidateReady
:
false
,
/** getGoodsTypeGroupRules 失败时品类切换下拉标红 */
divisionTabSelectError
:
false
}
}
},
},
provide
()
{
provide
()
{
...
@@ -485,6 +492,15 @@ export default {
...
@@ -485,6 +492,15 @@ export default {
this
.
initBaseData
()
this
.
initBaseData
()
},
},
immediate
:
true
immediate
:
true
},
"financialObj.realityShopMerchantId"
(
newVal
,
oldVal
)
{
this
.
_maybeInvalidateDivisionTabsForLedgerFieldChange
(
newVal
,
oldVal
)
},
"financialObj.realityPlatformMerchantId"
(
newVal
,
oldVal
)
{
this
.
_maybeInvalidateDivisionTabsForLedgerFieldChange
(
newVal
,
oldVal
)
},
"financialObj.djzhySubMerchantId"
(
newVal
,
oldVal
)
{
this
.
_maybeInvalidateDivisionTabsForLedgerFieldChange
(
newVal
,
oldVal
)
}
}
},
},
mounted
()
{
mounted
()
{
...
@@ -509,6 +525,9 @@ export default {
...
@@ -509,6 +525,9 @@ export default {
// merchantId && this.getMerchantLevel(merchantId, "merchantLevelList", scene)
// merchantId && this.getMerchantLevel(merchantId, "merchantLevelList", scene)
Promise
.
all
(
eventArr
).
then
(()
=>
{
Promise
.
all
(
eventArr
).
then
(()
=>
{
this
.
checkSelectEmpty
()
this
.
checkSelectEmpty
()
this
.
$nextTick
(()
=>
{
this
.
_ledgerInvalidateReady
=
true
})
})
})
},
},
methods
:
{
methods
:
{
...
@@ -1480,6 +1499,7 @@ export default {
...
@@ -1480,6 +1499,7 @@ export default {
* @returns {Promise<{ ok: boolean, incrementalRules: Array, fullMergedRules: Array|null, firstErrorTabIndex?: number }>}
* @returns {Promise<{ ok: boolean, incrementalRules: Array, fullMergedRules: Array|null, firstErrorTabIndex?: number }>}
*/
*/
async
getGoodsTypeGroupRules
(
_list
,
options
=
{})
{
async
getGoodsTypeGroupRules
(
_list
,
options
=
{})
{
this
.
clearDivisionTabSelectValidationUi
()
const
onlyActiveTab
=
options
.
onlyActiveTab
===
true
const
onlyActiveTab
=
options
.
onlyActiveTab
===
true
const
startTabName
=
this
.
editableTabsValue
const
startTabName
=
this
.
editableTabsValue
...
@@ -1502,10 +1522,15 @@ export default {
...
@@ -1502,10 +1522,15 @@ export default {
||
allRuleTabIndices
.
length
===
0
||
allRuleTabIndices
.
length
===
0
)
{
)
{
this
.
rebuildCrossTabGoodsSelectionsFromRules
()
this
.
rebuildCrossTabGoodsSelectionsFromRules
()
this
.
setDivisionTabSelectValidationUiFailed
(
this
.
activeDivisionTabIndex
>=
0
?
this
.
activeDivisionTabIndex
:
null
)
return
{
return
{
ok
:
false
,
ok
:
false
,
incrementalRules
:
[],
incrementalRules
:
[],
fullMergedRules
:
null
fullMergedRules
:
null
,
firstErrorTabIndex
:
this
.
activeDivisionTabIndex
>=
0
?
this
.
activeDivisionTabIndex
:
undefined
}
}
}
}
}
else
{
}
else
{
...
@@ -1580,9 +1605,15 @@ export default {
...
@@ -1580,9 +1605,15 @@ export default {
const
tab
=
this
.
editableTabs
[
tabindex
]
const
tab
=
this
.
editableTabs
[
tabindex
]
const
rulePayload
=
this
.
resolveRulePayloadForTabValidation
(
tabindex
)
const
rulePayload
=
this
.
resolveRulePayloadForTabValidation
(
tabindex
)
if
(
!
validateGoodsTypeGroupRulePayload
(
rulePayload
))
{
if
(
!
validateGoodsTypeGroupRulePayload
(
rulePayload
,
this
.
getLedgerContextForRuleValidation
()
)
)
{
await
this
.
focusTabAndRunHandleConfirm
(
tab
.
name
)
await
this
.
focusTabAndRunHandleConfirm
(
tab
.
name
)
this
.
rebuildCrossTabGoodsSelectionsFromRules
()
this
.
rebuildCrossTabGoodsSelectionsFromRules
()
this
.
setDivisionTabSelectValidationUiFailed
(
tabindex
)
return
{
return
{
ok
:
false
,
ok
:
false
,
incrementalRules
:
[],
incrementalRules
:
[],
...
@@ -1632,6 +1663,7 @@ export default {
...
@@ -1632,6 +1663,7 @@ export default {
}
}
this
.
rebuildCrossTabGoodsSelectionsFromRules
()
this
.
rebuildCrossTabGoodsSelectionsFromRules
()
this
.
clearDivisionTabSelectValidationUi
()
return
{
return
{
ok
:
true
,
ok
:
true
,
incrementalRules
,
incrementalRules
,
...
@@ -1644,6 +1676,37 @@ export default {
...
@@ -1644,6 +1676,37 @@ export default {
closeLoading
()
closeLoading
()
}
}
},
},
/** 品类切换下拉及选项上的纯数据校验失败提示 */
clearDivisionTabSelectValidationUi
()
{
this
.
divisionTabSelectError
=
false
const
tabs
=
this
.
editableTabs
||
[]
for
(
let
i
=
0
;
i
<
tabs
.
length
;
i
++
)
{
const
t
=
tabs
[
i
]
if
(
!
t
||
String
(
t
.
name
)
===
"add"
)
continue
if
(
t
.
rulePayloadValidationError
)
{
this
.
$set
(
t
,
"rulePayloadValidationError"
,
false
)
}
}
},
setDivisionTabSelectValidationUiFailed
(
firstErrorTabIndex
)
{
const
tabs
=
this
.
editableTabs
||
[]
for
(
let
i
=
0
;
i
<
tabs
.
length
;
i
++
)
{
const
t
=
tabs
[
i
]
if
(
!
t
||
String
(
t
.
name
)
===
"add"
)
continue
if
(
t
.
rulePayloadValidationError
)
{
this
.
$set
(
t
,
"rulePayloadValidationError"
,
false
)
}
}
this
.
divisionTabSelectError
=
true
if
(
firstErrorTabIndex
!=
null
&&
firstErrorTabIndex
>=
0
&&
tabs
[
firstErrorTabIndex
]
&&
String
(
tabs
[
firstErrorTabIndex
].
name
)
!==
"add"
)
{
this
.
$set
(
tabs
[
firstErrorTabIndex
],
"rulePayloadValidationError"
,
true
)
}
},
getSelectingList
(
defaultSelect
)
{
getSelectingList
(
defaultSelect
)
{
getAllGoodsList
({
getAllGoodsList
({
// upgradeGoodsNameOrCCode: this.goodsNameKeyword,
// upgradeGoodsNameOrCCode: this.goodsNameKeyword,
...
@@ -1772,6 +1835,34 @@ export default {
...
@@ -1772,6 +1835,34 @@ export default {
}
}
})
})
},
},
/** 提交前纯数据校验:分账表须与当前基础分账方一致(见 validateGoodsTypeGroupRulePayload 第二参) */
getLedgerContextForRuleValidation
()
{
const
fo
=
this
.
financialObj
||
{}
return
{
realityPlatformMerchantId
:
fo
.
realityPlatformMerchantId
,
realityShopMerchantId
:
fo
.
realityShopMerchantId
,
djzhySubMerchantId
:
fo
.
djzhySubMerchantId
}
},
/**
* 平台方 / 流量方 / 嘀加子商户变更后:各品类 Tab 视为未再确认,避免缓存快路径与 UI 清空脱节。
*/
invalidateAllDivisionTabsAfterLedgerPartyChange
()
{
const
tabs
=
this
.
editableTabs
||
[]
for
(
let
i
=
0
;
i
<
tabs
.
length
;
i
++
)
{
const
tab
=
tabs
[
i
]
if
(
!
tab
||
String
(
tab
.
name
)
===
"add"
)
continue
this
.
ensureTabRevisionFields
(
tab
)
this
.
$set
(
tab
,
"testFlag"
,
"N"
)
this
.
$set
(
tab
,
"divisionTestTabWarningFromApi"
,
false
)
this
.
$set
(
tab
,
"ruleCacheRevision"
,
(
tab
.
ruleCacheRevision
||
0
)
+
1
)
}
},
_maybeInvalidateDivisionTabsForLedgerFieldChange
(
newVal
,
oldVal
)
{
if
(
!
this
.
_ledgerInvalidateReady
)
return
if
(
ledgerMerchantIdLooseEqual
(
newVal
,
oldVal
))
return
this
.
invalidateAllDivisionTabsAfterLedgerPartyChange
()
},
getMerchantLevel
(
id
,
name
,
scene
)
{
getMerchantLevel
(
id
,
name
,
scene
)
{
// console.log(this.merchantInfo)
// console.log(this.merchantInfo)
// getPlatformMerchantList().then(res => {
// getPlatformMerchantList().then(res => {
...
@@ -1886,6 +1977,7 @@ export default {
...
@@ -1886,6 +1977,7 @@ export default {
this
.
rebuildCrossTabGoodsSelectionsFromRules
()
this
.
rebuildCrossTabGoodsSelectionsFromRules
()
this
.
editableTabsValue
=
newName
this
.
editableTabsValue
=
newName
this
.
currentIndex
=
newName
this
.
currentIndex
=
newName
this
.
clearDivisionTabSelectValidationUi
()
},
},
/**
/**
* 下拉切换品类:受控 el-select,先持久化旧 tab 再更新 editableTabsValue。
* 下拉切换品类:受控 el-select,先持久化旧 tab 再更新 editableTabsValue。
...
@@ -2248,6 +2340,15 @@ export default {
...
@@ -2248,6 +2340,15 @@ export default {
width
:
280px
;
width
:
280px
;
max-width
:
100%
;
max-width
:
100%
;
&.tab-select--error
.el-input__inner
{
border-color
:
#f56c6c
;
}
&
.tab-select--error
.el-input.is-focus
.el-input__inner
,
&
.tab-select--error
.el-input__inner
:focus
{
border-color
:
#f56c6c
;
}
.el-select-dropdown__item
{
.el-select-dropdown__item
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
...
...
src/views/systemConfig/merchant/financialRules/utils/validateGoodsTypeGroupRulePayload.js
View file @
fb7bd0c
...
@@ -79,13 +79,134 @@ function validateCostConvertRates(rule) {
...
@@ -79,13 +79,134 @@ function validateCostConvertRates(rule) {
return
true
return
true
}
}
/** 与 rulePayloadCanonicalCompare.looseLeafEqual 对齐:number / string 同值视为相等 */
export
function
ledgerMerchantIdLooseEqual
(
a
,
b
)
{
if
(
a
===
b
)
return
true
if
(
a
==
null
||
b
==
null
)
return
false
const
s1
=
String
(
a
).
trim
()
const
s2
=
String
(
b
).
trim
()
if
(
s1
===
""
&&
s2
===
""
)
return
true
const
n1
=
Number
(
s1
)
const
n2
=
Number
(
s2
)
if
(
!
Number
.
isNaN
(
n1
)
&&
!
Number
.
isNaN
(
n2
)
&&
s1
===
String
(
n1
)
&&
s2
===
String
(
n2
))
{
return
n1
===
n2
}
return
s1
===
s2
}
function
pushId
(
set
,
id
)
{
if
(
id
===
""
||
id
===
undefined
||
id
===
null
)
return
set
.
add
(
String
(
id
).
trim
())
}
/**
* 从 expenseCategoryRules 解析服务商商户号(与 classificationCpt handleSelectChange 一致)
* @param {Array} rules
* @returns {string[]}
*/
export
function
extractServiceMerchantIdsFromExpenseCategoryRules
(
rules
)
{
if
(
!
Array
.
isArray
(
rules
))
return
[]
const
out
=
[]
const
seen
=
new
Set
()
const
add
=
(
id
)
=>
{
if
(
id
===
""
||
id
===
undefined
||
id
===
null
)
return
const
s
=
String
(
id
).
trim
()
if
(
!
s
||
seen
.
has
(
s
))
return
seen
.
add
(
s
)
out
.
push
(
s
)
}
for
(
let
i
=
0
;
i
<
rules
.
length
;
i
++
)
{
const
cur
=
rules
[
i
]
if
(
!
cur
||
typeof
cur
!==
"object"
)
continue
const
id1
=
cur
.
targetMerchant
?.
merchantId
??
cur
.
targetMerchantId
add
(
id1
)
if
(
cur
.
formType
===
2
&&
Array
.
isArray
(
cur
.
children
))
{
for
(
let
j
=
0
;
j
<
cur
.
children
.
length
;
j
++
)
{
const
ele
=
cur
.
children
[
j
]
if
(
!
ele
||
typeof
ele
!==
"object"
)
continue
const
id2
=
ele
.
targetMerchant
?.
merchantId
??
ele
.
targetMerchantId
add
(
id2
)
}
}
}
return
out
}
/**
* 当前基础分账方 + 本条规则内服务商,用于校验分账表 merchantId 是否在可选范围内。
* @typedef {object} FinancialLedgerContext
* @property {string|number} [realityPlatformMerchantId]
* @property {string|number} [realityShopMerchantId]
* @property {string|number} [djzhySubMerchantId]
*/
/**
* @param {object} rule 已 fillDj 的规则
* @param {FinancialLedgerContext} ledger
* @returns {Set<string>}
*/
function
buildAllowedMerchantIdSet
(
rule
,
ledger
)
{
const
set
=
new
Set
()
if
(
ledger
&&
typeof
ledger
===
"object"
)
{
pushId
(
set
,
ledger
.
realityPlatformMerchantId
)
pushId
(
set
,
ledger
.
realityShopMerchantId
)
pushId
(
set
,
ledger
.
djzhySubMerchantId
)
}
const
svc
=
extractServiceMerchantIdsFromExpenseCategoryRules
(
rule
.
expenseCategoryRules
)
for
(
let
k
=
0
;
k
<
svc
.
length
;
k
++
)
{
pushId
(
set
,
svc
[
k
])
}
return
set
}
function
merchantIdInAllowedSet
(
allowedSet
,
merchantId
)
{
if
(
merchantId
===
""
||
merchantId
===
undefined
||
merchantId
===
null
)
return
false
const
s
=
String
(
merchantId
).
trim
()
for
(
const
x
of
allowedSet
)
{
if
(
ledgerMerchantIdLooseEqual
(
s
,
x
))
return
true
}
return
false
}
/**
* 分账表每行 merchantId 须在「平台/流量/子商户 + 本条 expense 内服务商」集合内;
* 导流方行 targetMerchantType===3 时 merchantId 须等于当前 realityShopMerchantId。
*/
export
function
distributionRulesConsistentWithLedgerParty
(
rule
,
ledger
)
{
if
(
!
ledger
||
typeof
ledger
!==
"object"
)
return
true
const
md
=
rule
.
merchantDistributionRules
const
od
=
rule
.
owningMerchantDistributionRules
if
(
!
Array
.
isArray
(
md
)
||
!
Array
.
isArray
(
od
))
return
false
const
allowed
=
buildAllowedMerchantIdSet
(
rule
,
ledger
)
const
shopId
=
ledger
.
realityShopMerchantId
const
rowOk
=
(
rows
)
=>
{
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
r
=
rows
[
i
]
if
(
!
r
||
typeof
r
!==
"object"
)
return
false
const
mid
=
r
.
merchantId
if
(
mid
===
""
||
mid
===
undefined
||
mid
===
null
)
return
false
if
(
!
merchantIdInAllowedSet
(
allowed
,
mid
))
return
false
const
t
=
Number
(
r
.
targetMerchantType
)
if
(
t
===
3
)
{
if
(
shopId
===
""
||
shopId
===
undefined
||
shopId
===
null
)
return
false
if
(
!
ledgerMerchantIdLooseEqual
(
mid
,
shopId
))
return
false
}
}
return
true
}
return
rowOk
(
md
)
&&
rowOk
(
od
)
}
/**
/**
* 对单条 goodsTypeGroupRules 项做纯数据校验(不挂载 el-form)。
* 对单条 goodsTypeGroupRules 项做纯数据校验(不挂载 el-form)。
* 先 fillDjGoodsTypeGroupRelations 再验,与提交流程一致。
* 先 fillDjGoodsTypeGroupRelations 再验,与提交流程一致。
*
*
* @param {object} rawRule
* @param {FinancialLedgerContext} [ledgerContext] 传入时校验分账行与当前基础分账方 / 本条规则内服务商一致(提交路径);不传则跳过该项以保持与 persist 内 prev/next 形态校验兼容。
* @returns {boolean}
* @returns {boolean}
*/
*/
export
function
validateGoodsTypeGroupRulePayload
(
rawRule
)
{
export
function
validateGoodsTypeGroupRulePayload
(
rawRule
,
ledgerContext
)
{
if
(
!
rawRule
||
typeof
rawRule
!==
"object"
)
return
false
if
(
!
rawRule
||
typeof
rawRule
!==
"object"
)
return
false
const
rule
=
fillDjGoodsTypeGroupRelations
(
deepClone
(
rawRule
))
const
rule
=
fillDjGoodsTypeGroupRelations
(
deepClone
(
rawRule
))
if
(
!
rule
||
typeof
rule
!==
"object"
)
return
false
if
(
!
rule
||
typeof
rule
!==
"object"
)
return
false
...
@@ -109,6 +230,10 @@ export function validateGoodsTypeGroupRulePayload(rawRule) {
...
@@ -109,6 +230,10 @@ export function validateGoodsTypeGroupRulePayload(rawRule) {
if
(
!
distributionRulesLookComplete
(
rule
))
return
false
if
(
!
distributionRulesLookComplete
(
rule
))
return
false
if
(
ledgerContext
!=
null
&&
typeof
ledgerContext
===
"object"
)
{
if
(
!
distributionRulesConsistentWithLedgerParty
(
rule
,
ledgerContext
))
return
false
}
const
gt
=
Number
(
rule
.
groupType
)
const
gt
=
Number
(
rule
.
groupType
)
const
gs
=
Number
(
rule
.
goodsSource
)
const
gs
=
Number
(
rule
.
goodsSource
)
// 嘀加来源且特殊品类:须指定品类/商品/套餐清单;goodsSource 为 2、3 时模板不展示该校验项
// 嘀加来源且特殊品类:须指定品类/商品/套餐清单;goodsSource 为 2、3 时模板不展示该校验项
...
...
src/views/systemConfig/merchant/merchantGroundingEdit/MerchantGroundingEdit.vue
View file @
fb7bd0c
...
@@ -217,6 +217,20 @@ export default {
...
@@ -217,6 +217,20 @@ export default {
}
}
return
out
;
return
out
;
},
},
/** 弹框回写:StepTwo 字段为权威值,同步到 estimated*(供经营区块等读取) */
syncEstimatedFieldsFromStepTwo
(
row
)
{
const
out
=
{
...
row
};
if
(
out
.
estimatedConversionRate
!=
null
)
{
out
.
estimatedConversion
=
out
.
estimatedConversionRate
;
}
if
(
out
.
upgradePrice
!=
null
)
{
out
.
estimatedUpgradePrice
=
out
.
upgradePrice
;
}
if
(
out
.
revenue
!=
null
)
{
out
.
estimatedRevenue
=
out
.
revenue
;
}
return
out
;
},
mapProductDetailsForSubmit
(
list
)
{
mapProductDetailsForSubmit
(
list
)
{
if
(
!
Array
.
isArray
(
list
)
||
!
list
.
length
)
return
[];
if
(
!
Array
.
isArray
(
list
)
||
!
list
.
length
)
return
[];
return
list
.
map
((
pd
)
=>
this
.
applyLegacySalesCategoryKeys
(
pd
));
return
list
.
map
((
pd
)
=>
this
.
applyLegacySalesCategoryKeys
(
pd
));
...
@@ -241,12 +255,13 @@ export default {
...
@@ -241,12 +255,13 @@ export default {
);
);
},
},
editSalesCategoryData
(
data
)
{
editSalesCategoryData
(
data
)
{
const
next
=
this
.
syncEstimatedFieldsFromStepTwo
({
...
data
});
this
.
productDetails
=
this
.
productDetails
.
map
(
item
=>
{
this
.
productDetails
=
this
.
productDetails
.
map
(
item
=>
{
if
(
if
(
item
.
productType
===
data
.
productType
&&
item
.
productType
===
data
.
productType
&&
item
.
productCategory
===
data
.
productCategory
item
.
productCategory
===
data
.
productCategory
)
{
)
{
return
data
;
return
next
;
}
}
return
item
;
return
item
;
});
});
...
@@ -261,7 +276,7 @@ export default {
...
@@ -261,7 +276,7 @@ export default {
throw
new
Error
(
"该销售品类已存在"
);
throw
new
Error
(
"该销售品类已存在"
);
}
}
});
});
this
.
productDetails
.
push
(
data
);
this
.
productDetails
.
push
(
this
.
syncEstimatedFieldsFromStepTwo
({
...
data
})
);
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
$message
.
error
(
error
.
message
);
this
.
$message
.
error
(
error
.
message
);
}
}
...
...
src/views/systemConfig/merchant/merchantGroundingEdit/merchantOnShelfOpenPayload.js
View file @
fb7bd0c
...
@@ -107,6 +107,16 @@ function detailScalarSubmitValue(v) {
...
@@ -107,6 +107,16 @@ function detailScalarSubmitValue(v) {
}
}
function
mapProductDetailBusinessRow
(
pd
)
{
function
mapProductDetailBusinessRow
(
pd
)
{
// StepTwo 弹框只绑定 estimatedConversionRate / upgradePrice / revenue,优先于详情里可能未更新的 estimated*
const
estimatedConversionVal
=
numOrNull
(
pd
.
estimatedConversionRate
!=
null
?
pd
.
estimatedConversionRate
:
pd
.
estimatedConversion
,
);
const
estimatedUpgradePriceVal
=
numOrNull
(
pd
.
upgradePrice
!=
null
?
pd
.
upgradePrice
:
pd
.
estimatedUpgradePrice
,
);
const
estimatedRevenueVal
=
numOrNull
(
pd
.
revenue
!=
null
?
pd
.
revenue
:
pd
.
estimatedRevenue
,
);
const
row
=
{
const
row
=
{
productType
:
pd
.
productType
,
productType
:
pd
.
productType
,
productCategory
:
pd
.
productCategory
,
productCategory
:
pd
.
productCategory
,
...
@@ -114,15 +124,13 @@ function mapProductDetailBusinessRow(pd) {
...
@@ -114,15 +124,13 @@ function mapProductDetailBusinessRow(pd) {
penetrationRate
:
numOrNull
(
pd
.
penetrationRate
),
penetrationRate
:
numOrNull
(
pd
.
penetrationRate
),
conversionRate
:
numOrNull
(
pd
.
conversionRate
),
conversionRate
:
numOrNull
(
pd
.
conversionRate
),
revenuePerCar
:
numOrNull
(
pd
.
revenuePerCar
),
revenuePerCar
:
numOrNull
(
pd
.
revenuePerCar
),
estimatedConversion
:
numOrNull
(
estimatedConversion
:
estimatedConversionVal
,
pd
.
estimatedConversion
!=
null
?
pd
.
estimatedConversion
:
pd
.
estimatedConversionRate
,
estimatedUpgradePrice
:
estimatedUpgradePriceVal
,
),
estimatedRevenue
:
estimatedRevenueVal
,
estimatedUpgradePrice
:
numOrNull
(
// 与上列 estimated* 同源,兼容 StepTwo / 历史字段名
pd
.
estimatedUpgradePrice
!=
null
?
pd
.
estimatedUpgradePrice
:
pd
.
upgradePrice
,
estimatedConversionRate
:
estimatedConversionVal
,
),
upgradePrice
:
estimatedUpgradePriceVal
,
estimatedRevenue
:
numOrNull
(
revenue
:
estimatedRevenueVal
,
pd
.
estimatedRevenue
!=
null
?
pd
.
estimatedRevenue
:
pd
.
revenue
,
),
recyclingFilm
:
numOrNull
(
pd
.
recyclingFilm
),
recyclingFilm
:
numOrNull
(
pd
.
recyclingFilm
),
trafficFee
:
numOrNull
(
pd
.
trafficFee
),
trafficFee
:
numOrNull
(
pd
.
trafficFee
),
marketFee1
:
numOrNull
(
pd
.
marketFee1
),
marketFee1
:
numOrNull
(
pd
.
marketFee1
),
...
...
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