Commit c4bcb30f by chenwq

调整商品选择和成本获取方式的样式,新增shelfModel属性以支持不同上架模式

1 parent b0699c16
......@@ -24,7 +24,7 @@
:key="form.categoryType"
v-model="form.goodsTypeGroupRelationList"
placeholder="请选择商品"
style="width:390px"
style="width:800px"
value-key="merchantGoodsCode"
disabled
:fetch-api="fetchUpgradeGoodsList"
......@@ -47,7 +47,7 @@
ref="packageGoods"
v-model="form.goodsTypeGroupRelationList"
placeholder="请选择套餐"
style="width:390px"
style="width:800px"
value-key="packageCode"
disabled
:fetch-api="getPackagesGoodsList"
......
......@@ -139,7 +139,9 @@
</el-row>
</el-form>
<div class="actions-wrapper">
<el-button type="text" @click="handleAppendProduct">
<el-button v-if="shelfModel === 2"
type="text"
@click="handleAppendProduct">
<span class="el-icon-plus" />
添加商品
</el-button>
......@@ -157,6 +159,7 @@
:merchant-id="merchantId"
:merchant-id-list="merchantIdList"
:product.sync="productList[index]"
:shelf-model="shelfModel"
:shelf-type="shelfType"
:show-gift-cost="false"
:show-old-merchant-goods-code="false"
......@@ -217,6 +220,11 @@ export default {
type: Number,
default: 1,
},
/** 1-特殊上架;2-常规上架 */
shelfModel: {
type: Number,
default: 1,
},
},
data() {
return {
......
......@@ -19,7 +19,7 @@
<el-button icon="el-icon-plus" @click="handleSelectGoods">
选择商品
</el-button>
<el-button v-if="useRemoveBtn"
<el-button v-if="useRemoveBtn && shelfModel === 2"
type="text"
@click="handleRemove">
删除
......@@ -189,12 +189,12 @@
<el-col v-if="isMemberRightsUpgrade(baseSceneCode)" :span="12">
<el-form-item label="第三方成本/件:"
prop="detailList[0].thirdPartyCost"
:rules="[{ required: true, message: '请输入第三方成本', trigger: 'blur' }]">
:rules="[{ required: isUpgradeProductCostStyleDefault(product.detailList[0].thirdPartyCostStyle) ? false : true, message: '请输入第三方成本', trigger: 'blur' }]">
<div class="form-item-append-fix">
<VenusNumberInput v-model="product.detailList[0].thirdPartyCost"
placeholder="请输入第三方成本"
:controls="false"
:disabled="isUpgradeProductCostStyleDefault(product.detailList[0].upgradeProductCostStyle) || isDirectOperation(product.detailList[0].supplyFlag)"
:disabled="isUpgradeProductCostStyleDefault(product.detailList[0].thirdPartyCostStyle) || isDirectOperation(product.detailList[0].supplyFlag)"
:max="999999"
:min="0"
:precision="2" />
......@@ -205,7 +205,7 @@
<el-col v-if="isQualityUpgrade(baseSceneCode)" :span="12">
<el-form-item label="产品、升级成本:"
prop="detailList[0].upgradeProductCost"
:rules="[{ required: true, message: '请输入产品、升级成本', trigger: 'blur' }]">
:rules="[{ required: isUpgradeProductCostStyleDefault(product.detailList[0].upgradeProductCostStyle) ? false : true, message: '请输入产品、升级成本', trigger: 'blur' }]">
<div class="form-item-append-fix">
<VenusNumberInput v-model="product.detailList[0].upgradeProductCost"
placeholder="请输入产品、升级成本"
......@@ -220,11 +220,12 @@
</el-form-item>
</el-col>
<!-- 精品升级:取upgradeProductCostStyle,与“产品、升级成本/件”有联动关系;会员权益:取thirdPartyCostStyle,与“第三方成本/件”有联动关系 -->
<el-col v-if="showUpgradeProductCostStyle" :span="12">
<el-form-item label="产品成本获取方式:"
prop="detailList[0].upgradeProductCostStyle"
:prop="isQualityUpgrade(baseSceneCode) ? 'detailList[0].upgradeProductCostStyle' : 'detailList[0].thirdPartyCostStyle'"
:rules="[{ required: true, message: '请选择产品成本获取方式', trigger: 'change' }]">
<el-radio-group v-model="product.detailList[0].upgradeProductCostStyle"
<el-radio-group v-model="productCostStyleValue"
@change="handleUpgradeProductCostStyleChange">
<template v-for="item in options.productCostStyleOpt">
<el-radio :key="item.value"
......@@ -323,6 +324,11 @@ export default {
type: Number,
default: 1,
},
/** 1-特殊上架;2-常规上架 */
shelfModel: {
type: Number,
default: 1,
},
merchantIdList: {
type: Array,
required: true,
......@@ -384,6 +390,20 @@ export default {
},
computed: {
productCostStyleValue: {
get() {
return isQualityUpgrade(this.baseSceneCode)
? this.product.detailList[0].upgradeProductCostStyle
: this.product.detailList[0].thirdPartyCostStyle;
},
set(value) {
if (isQualityUpgrade(this.baseSceneCode)) {
this.product.detailList[0].upgradeProductCostStyle = value;
return;
}
this.product.detailList[0].thirdPartyCostStyle = value;
},
},
showUpgradeProductCostStyle() {
// 未选择产品 不显示
if (!(this.product.upgradeGoodsId || this.product.detailList[0].upgradeGoodsId)) {
......@@ -472,7 +492,7 @@ export default {
// 产品成本获取方式变动 更新成本
async updateCost() {
// 如果是自定义成本带入方式 则 不更新成本
if (isUpgradeProductCostStyleCustom(this.product?.detailList?.[0]?.upgradeProductCostStyle)) {
if (isUpgradeProductCostStyleCustom(this.productCostStyleValue)) {
return;
}
......@@ -489,15 +509,15 @@ export default {
// 如果是会员权益升级场景
if (isMemberRightsUpgrade(this.baseSceneCode)) {
this.product.detailList[0].thirdPartyCost = equityOperationCost ?? 0;
this.product.detailList[0].thirdPartyCost = equityOperationCost;
}
// 如果是精品升级场景
if (isQualityUpgrade(this.baseSceneCode)) {
this.product.detailList[0].upgradeProductCost = upgradeCost ?? 0;
this.product.detailList[0].upgradeProductCost = upgradeCost;
// 如果 是否作为赠送产品
if (this.product.detailList[0].isGiftCost === "Y") {
this.product.detailList[0].giftCost = upgradeCost ?? 0;
this.product.detailList[0].giftCost = upgradeCost;
}
}
},
......@@ -524,7 +544,7 @@ export default {
* 选择商品时
*/
async handleSelectGoodsConfirm(upgradeGoods) {
upgradeGoods.djCost = upgradeGoods.djCost ?? 0;
// upgradeGoods.djCost = upgradeGoods.djCost ?? 0;
upgradeGoods.positionList = [];
if (upgradeGoods.position) {
upgradeGoods.positionList = upgradeGoods.position.split(",").map(Number);
......
......@@ -100,6 +100,7 @@
:merchant-id-list="merchantIdList"
:packages="productDetail || { detailList: [] }"
:prefix="$data._prefix"
:shelf-model="shelfModel"
:shelf-type="shelfType"
@update:packages="handleComboUpdatePackages" />
</div>
......
......@@ -254,12 +254,16 @@ export async function getProductDetailDescriptionSchema(shelfType) {
},
},
/**
* 精品升级:取upgradeProductCostStyle,与“产品、升级成本/件”有联动关系;
* 会员权益:取thirdPartyCostStyle,与“第三方成本/件”有联动关系
*/
{
name: "detailList.0.upgradeProductCostStyle",
label: "产品成本获取方式",
col: 12,
render(h, { data, schemaItem }) {
const value = get(data, schemaItem.name);
const value = get(data, isQualityUpgrade(data.baseSceneCode) ? schemaItem.name : "detailList.0.thirdPartyCostStyle");
const item = productCostStyleOpt.find(item => item.value === value);
return h(
"span",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!