Commit 51983e3c by Jaxon

feat(商品上架): 完善商品确认组件的数据流与交互

- 移除未使用的 API 导入
- 在商品/套餐组件中透传 merchantIdList,用于获取运营成本
- 修改 formItemMixin 的 saveEdit 方法,支持跳过验证
- 将商品/套餐组件的 v-show 改为 v-if,避免隐藏组件状态残留
- 在商品选择弹窗中增加运营成本字段和适用区域显示
- 修复套餐商品验证时引用错误的问题
- 商品详情组件支持更新运营成本数据
- 调整商品详情展示 schema,显示运营成本并隐藏部分字段
1 parent 4c705e0e
...@@ -63,8 +63,10 @@ export default { ...@@ -63,8 +63,10 @@ export default {
this.editState = VIEW_MODE.EDIT; this.editState = VIEW_MODE.EDIT;
}, },
async saveEdit() { async saveEdit({ useValidate = true } = {}) {
if (useValidate) {
await this.validate(); await this.validate();
}
if (this.editState !== VIEW_MODE.EDIT) if (this.editState !== VIEW_MODE.EDIT)
return; return;
this.editState = VIEW_MODE.SAVING; this.editState = VIEW_MODE.SAVING;
...@@ -127,7 +129,6 @@ export default { ...@@ -127,7 +129,6 @@ export default {
}, },
mounted() { mounted() {
console.log("this", this);
this._register(); this._register();
}, },
......
<template> <template>
<div class="detail-wrapper"> <div class="detail-wrapper">
<Descriptions :data="packageData" :schema="packagesSchema" /> <Descriptions :data="packages" :schema="packagesSchema" />
<el-divider class="divider"></el-divider> <el-divider class="divider"></el-divider>
<div v-for="productData in productList" <div v-for="(productData, index) in productList"
:key="productData.id" :key="productData.id"
class="product-detail-wrapper"> class="product-detail-wrapper">
<Product :product="productData" <Product :product="productData"
...@@ -12,8 +12,10 @@ ...@@ -12,8 +12,10 @@
:show-sales-proportion-percent="false" :show-sales-proportion-percent="false"
:show-settlement-type="false" :show-settlement-type="false"
:show-gift-cost="false" :show-gift-cost="false"
:merchant-id-list="merchantIdList"
:show-penetration-rate="false" :show-penetration-rate="false"
use-parent-mode /> use-parent-mode
@update:upgradeGoods="handleUpdateProduct($event, index)" />
<el-divider class="divider"></el-divider> <el-divider class="divider"></el-divider>
</div> </div>
</div> </div>
...@@ -32,6 +34,10 @@ export default { ...@@ -32,6 +34,10 @@ export default {
Product, Product,
}, },
props: { props: {
merchantIdList: {
type: Array,
default: () => [],
},
packages: { packages: {
type: Object, type: Object,
default: () => ({ }), default: () => ({ }),
...@@ -44,31 +50,40 @@ export default { ...@@ -44,31 +50,40 @@ export default {
data() { data() {
return { return {
VIEW_MODE, VIEW_MODE,
packageData: {},
packagesSchema: [], packagesSchema: [],
}; };
}, },
computed: { computed: {
productList() { productList() {
return this.packageData.detailList.map(item => ({ return this.packages.detailList.map(item => ({
upgradeGoodsId: item.upgradeGoodsId, upgradeGoodsId: item.upgradeGoodsId,
upgradeCommodityCode: item.upgradeCommodityCode,
detailList: [item], detailList: [item],
})); }));
}, },
}, },
watch: {
packages: {
handler(val) {
this.$set(this, "packageData", cloneDeep(val));
},
immediate: true,
deep: true,
},
},
async mounted() { async mounted() {
this.packagesSchema = await getPackagesDetailDescriptionSchema(); this.packagesSchema = await getPackagesDetailDescriptionSchema();
}, },
methods: { methods: {
handleUpdateProduct(upgradeGoods, productListIndex) {
const packages = cloneDeep(this.packages);
const current = packages.detailList?.[productListIndex];
if (!current) {
return;
}
if (!upgradeGoods.positionList) {
upgradeGoods.positionList = [];
}
packages.detailList[productListIndex] = {
...current,
upgradeGoods,
upgradeCommodityCode: upgradeGoods.commodityCode,
upgradeGoodsId: upgradeGoods.id,
upgradeGoodsName: upgradeGoods.upgradeGoodsName,
};
this.$emit("update:packages", packages);
},
}, },
}; };
</script> </script>
......
...@@ -142,8 +142,8 @@ ...@@ -142,8 +142,8 @@
<el-divider class="divider" /> <el-divider class="divider" />
<div v-if="productList && productList.length"> <div v-if="productList && productList.length">
<div v-for="(goodsForm, index) in productList" <div v-for="(goodsForm, index) in productList"
:key="goodsForm.id"> :key="goodsForm.upgradeCommodityCode">
<Product :ref="`productForm${goodsForm.upgradeGoodsId}`" <Product :ref="goodsForm.upgradeCommodityCode"
:product.sync="goodsForm" :product.sync="goodsForm"
:edit-state="VIEW_MODE.EDIT" :edit-state="VIEW_MODE.EDIT"
:disabled-ids="packageSelectedGoodsIds" :disabled-ids="packageSelectedGoodsIds"
...@@ -151,6 +151,7 @@ ...@@ -151,6 +151,7 @@
:show-gift-cost="false" :show-gift-cost="false"
:show-sales-proportion-percent="false" :show-sales-proportion-percent="false"
:show-settlement-type="false" :show-settlement-type="false"
:merchant-id-list="merchantIdList"
use-remove-btn use-remove-btn
@update:upgradeGoods="handleUpdateProduct($event, index)" @update:upgradeGoods="handleUpdateProduct($event, index)"
@remove="handleRemoveProduct(goodsForm.id, index)" /> @remove="handleRemoveProduct(goodsForm.id, index)" />
...@@ -177,6 +178,10 @@ export default { ...@@ -177,6 +178,10 @@ export default {
Product, Product,
}, },
props: { props: {
merchantIdList: {
type: Array,
required: true,
},
baseSceneCode: { baseSceneCode: {
type: String, type: String,
required: true, required: true,
...@@ -217,6 +222,7 @@ export default { ...@@ -217,6 +222,7 @@ export default {
productList() { productList() {
return this.packageForm.detailList.map(item => ({ return this.packageForm.detailList.map(item => ({
upgradeGoodsId: item.upgradeGoodsId, upgradeGoodsId: item.upgradeGoodsId,
upgradeCommodityCode: item.upgradeCommodityCode,
detailList: [item], detailList: [item],
})); }));
}, },
...@@ -259,7 +265,6 @@ export default { ...@@ -259,7 +265,6 @@ export default {
isSolarFilm, isSolarFilm,
handleUpdateProduct(upgradeGoods, productListIndex) { handleUpdateProduct(upgradeGoods, productListIndex) {
console.log("upgradeGoods", upgradeGoods);
if (this.packageForm.detailList[productListIndex]) { if (this.packageForm.detailList[productListIndex]) {
if (!upgradeGoods.positionList) { if (!upgradeGoods.positionList) {
upgradeGoods.positionList = []; upgradeGoods.positionList = [];
...@@ -330,15 +335,11 @@ export default { ...@@ -330,15 +335,11 @@ export default {
}); });
throw new Error("套餐的商品不能为空"); throw new Error("套餐的商品不能为空");
} }
await this.$nextTick();
for (const goods of this.packageForm.detailList) { for (const goods of this.productList) {
const refs = this.$refs[`productForm${goods.upgradeGoodsId}`]; const refs = this.$refs[goods.upgradeCommodityCode];
const ref = Array.isArray(refs) ? refs[0] : refs; const ref = Array.isArray(refs) ? refs[0] : refs;
console.log("ref", ref); console.log("ref", ref);
if (!refs || !isFunction(ref?.validate)) {
console.log("不存在或者不是函数?", ref, ref.validate);
continue;
}
await ref.validate(); await ref.validate();
} }
return { return {
......
<template> <template>
<div class="content"> <div class="content">
<div class="tabs-wrapper"> <div class="tabs-wrapper">
<Detail v-show="editState === VIEW_MODE.VIEW" <Detail v-if="editState === VIEW_MODE.VIEW"
v-bind="$attrs" v-bind="$attrs"
:edit-state="editState" :edit-state="editState"
v-on="$listeners" /> v-on="$listeners" />
<Modify v-show="editState === VIEW_MODE.EDIT" <Modify v-if="editState === VIEW_MODE.EDIT || editState === VIEW_MODE.SAVING"
ref="modifyRef" ref="modifyRef"
v-bind="$attrs" v-bind="$attrs"
:edit-state="editState" :edit-state="editState"
...@@ -45,6 +45,7 @@ export default { ...@@ -45,6 +45,7 @@ export default {
// 尚未初始化 // 尚未初始化
return; return;
} }
console.log("combo index validate");
return await modifyRef.validate(); return await modifyRef.validate();
}, },
}, },
......
...@@ -20,6 +20,10 @@ export default { ...@@ -20,6 +20,10 @@ export default {
Descriptions, Descriptions,
}, },
props: { props: {
merchantIdList: {
type: Array,
required: true,
},
product: { product: {
type: Object, type: Object,
required: true, required: true,
......
...@@ -35,8 +35,7 @@ ...@@ -35,8 +35,7 @@
:rules="[{ required: true, message: '请选择上架部位', trigger: 'change' }]"> :rules="[{ required: true, message: '请选择上架部位', trigger: 'change' }]">
<el-radio-group v-model="product.detailList[0].position"> <el-radio-group v-model="product.detailList[0].position">
<template v-for="item in options.position"> <template v-for="item in options.position">
<el-radio v-if="showPositionItem(item.position)" <el-radio :key="item.position"
:key="item.position"
:label="item.position"> :label="item.position">
{{ item.confName }} {{ item.confName }}
</el-radio> </el-radio>
...@@ -205,6 +204,7 @@ ...@@ -205,6 +204,7 @@
<SelectGoodsDialog v-if="dialog.selectGoods.show" <SelectGoodsDialog v-if="dialog.selectGoods.show"
:show.sync="dialog.selectGoods.show" :show.sync="dialog.selectGoods.show"
:base-scene-code="baseSceneCode" :base-scene-code="baseSceneCode"
:merchant-id-list="merchantIdList"
:expand-ids="disabledIds" :expand-ids="disabledIds"
:active-id="product.detailList[0].upgradeCommodityCode" :active-id="product.detailList[0].upgradeCommodityCode"
@confirm="handleSelectGoodsConfirm" /> @confirm="handleSelectGoodsConfirm" />
...@@ -236,7 +236,10 @@ export default { ...@@ -236,7 +236,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
merchantIdList: {
type: Array,
required: true,
},
// 当套餐加载这个组件的时候 不需要结算方式 // 当套餐加载这个组件的时候 不需要结算方式
showSettlementType: { showSettlementType: {
type: Boolean, type: Boolean,
...@@ -312,7 +315,6 @@ export default { ...@@ -312,7 +315,6 @@ export default {
this.$emit("remove"); this.$emit("remove");
}, },
async initOptions() { async initOptions() {
console.log("product init", BaseData.positionTypeList);
this.options.position = await this.get(BaseData.positionTypeList); this.options.position = await this.get(BaseData.positionTypeList);
}, },
...@@ -327,7 +329,6 @@ export default { ...@@ -327,7 +329,6 @@ export default {
handleSelectGoodsConfirm(upgradeGoods) { handleSelectGoodsConfirm(upgradeGoods) {
// 库存-sku001 // 库存-sku001
console.log("upgradeGoods", upgradeGoods);
upgradeGoods.djCost = upgradeGoods.djCost ?? 0; upgradeGoods.djCost = upgradeGoods.djCost ?? 0;
upgradeGoods.positionList = []; upgradeGoods.positionList = [];
if (upgradeGoods.position) { if (upgradeGoods.position) {
......
<template> <template>
<div class=""> <div class="">
<Detail v-show="editState === VIEW_MODE.VIEW" <Detail v-if="editState === VIEW_MODE.VIEW"
v-bind="$attrs" v-bind="$attrs"
:merchant-id-list="merchantIdList"
:product="product"
v-on="$listeners" /> v-on="$listeners" />
<Modify v-show="editState === VIEW_MODE.EDIT" <Modify v-if="editState === VIEW_MODE.EDIT || editState === VIEW_MODE.SAVING"
v-bind="$attrs" v-bind="$attrs"
ref="modifyRef" ref="modifyRef"
:merchant-id-list="merchantIdList"
:product="product"
v-on="$listeners" /> v-on="$listeners" />
</div> </div>
</template> </template>
<script> <script>
import { getOperationCost } from "@/api/grounding";
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index"; import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index";
import Detail from "./components/detail/index.vue"; import Detail from "./components/detail/index.vue";
import Modify from "./components/modify/index.vue"; import Modify from "./components/modify/index.vue";
...@@ -22,6 +27,14 @@ export default { ...@@ -22,6 +27,14 @@ export default {
}, },
inheritAttrs: false, inheritAttrs: false,
props: { props: {
merchantIdList: {
type: Array,
required: true,
},
product: {
type: Object,
default: () => ({}),
},
editState: { editState: {
type: String, type: String,
required: true, required: true,
...@@ -33,12 +46,37 @@ export default { ...@@ -33,12 +46,37 @@ export default {
}; };
}, },
computed: { computed: {
}, },
watch: { watch: {
}, },
async mounted() {
await this.init();
},
methods: { methods: {
async init() {
console.log("123");
const _operationCost = this.product?.detailList?.[0]?.upgradeGoods?.operationCost;
if (_operationCost) {
return;
}
const commodityCode = this.product?.detailList?.[0]?.upgradeGoods?.commodityCode;
if (!commodityCode) {
return;
}
const { operationCost } = await getOperationCost({
commodityCode,
merchantIdList: this.merchantIdList,
});
// 创建新对象
const upgradeGoods = structuredClone(this.product.detailList[0].upgradeGoods);
this.$emit("update:upgradeGoods", {
...upgradeGoods,
operationCost,
});
},
// product.detailList[0].upgradeGoods.commodityCode
async validate() { async validate() {
console.log("进得来?");
const modifyRef = this.$refs.modifyRef; const modifyRef = this.$refs.modifyRef;
if (!modifyRef) { if (!modifyRef) {
// 尚未初始化 // 尚未初始化
......
<template> <template>
<VenusDialog v-model="showDialog" <VenusDialog v-model="showDialog"
title="选择商品" title="选择产品"
width="70%" width="70%"
height="700px"
draggable draggable
destroy-on-close destroy-on-close
:close-on-click-modal="false" :close-on-click-modal="false"
...@@ -65,12 +66,29 @@ ...@@ -65,12 +66,29 @@
</el-button> </el-button>
</div> </div>
<d2-table ref="tableRef" <d2-table ref="tableRef"
class="table-wrapper"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
:get-list-api="table.api" :get-list-api="table.api"
:has-num="false" :has-num="false"
:search-form="table.form" :search-form="table.form"
:table-params="table.props" :table-params="table.props"
@setTableFinishFun="setTableFinishFun"> @setTableFinishFun="setTableFinishFun">
<template #upgradeGoodsAreaList="{ scope }">
<el-tooltip v-if="Array.isArray(scope.upgradeGoodsAreaList) && scope.upgradeGoodsAreaList.length" placement="top">
<template #content>
<div class="car-type-list">
<div v-for="(item, index) in scope.upgradeGoodsAreaList" :key="index">
{{ item.provinceName === '全国' ? '全国' : `${item.provinceName}-${item.cityName}` }}
</div>
</div>
</template>
<div class="text-hide" v-text="getUpgradeGoodsAreaList(scope.upgradeGoodsAreaList)">
</div>
</el-tooltip>
<div v-else>
-
</div>
</template>
<template #single-button="scope"> <template #single-button="scope">
<el-radio v-model="selectedId" <el-radio v-model="selectedId"
:disabled="getExpandIds.includes(scope.scope.commodityCode)" :disabled="getExpandIds.includes(scope.scope.commodityCode)"
...@@ -111,6 +129,8 @@ ...@@ -111,6 +129,8 @@
<script> <script>
import { getAllCategory } from "@api/product"; import { getAllCategory } from "@api/product";
import { getUpgradeProductList } from "@api/productManage"; import { getUpgradeProductList } from "@api/productManage";
import { isArray } from "lodash-es";
import { getOperationCost } from "@/api/grounding";
import VenusDialog from "@/components/venusDialog/index.vue"; import VenusDialog from "@/components/venusDialog/index.vue";
import { setAllOptions } from "@/libs/select"; import { setAllOptions } from "@/libs/select";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
...@@ -138,6 +158,11 @@ export default { ...@@ -138,6 +158,11 @@ export default {
type: Array, type: Array,
default: () => ([]), default: () => ([]),
}, },
// 服务商列表
merchantIdList: {
type: Array,
default: () => ([]),
},
// 业务场景 // 业务场景
baseSceneCode: { baseSceneCode: {
type: String, type: String,
...@@ -211,6 +236,22 @@ export default { ...@@ -211,6 +236,22 @@ export default {
}, },
methods: { methods: {
formatCar, formatCar,
getUpgradeGoodsAreaList(areaList) {
if (!isArray(areaList)) {
return "-";
}
if (areaList.length === 0) {
return "-";
}
const _areaList = areaList.map((item) => {
if (item.provinceName === "全国") {
return item.provinceName;
}
return `${item.provinceName}-${item.cityName}`;
});
return _areaList.join(",");
},
handleSelectedRow(row) { handleSelectedRow(row) {
this.$set(this, "selectedRow", row); this.$set(this, "selectedRow", row);
this.selectedId = row.commodityCode; this.selectedId = row.commodityCode;
...@@ -254,12 +295,20 @@ export default { ...@@ -254,12 +295,20 @@ export default {
// 会员权益 goodsTypeList // 会员权益 goodsTypeList
const searchKey = isQualityUpgrade(this.baseSceneCode) ? "excludeGoodsTypeList" : "goodsTypeList"; const searchKey = isQualityUpgrade(this.baseSceneCode) ? "excludeGoodsTypeList" : "goodsTypeList";
this.table.form[searchKey] = filterParams; this.table.form[searchKey] = filterParams;
this.table.form.merchantIds = this.merchantIdList;
}, },
handleSelectGoodsConfirm() { async handleSelectGoodsConfirm() {
if (!this.selectedId) { if (!this.selectedId) {
return this.$message.warning("请选择商品"); return this.$message.warning("请选择商品");
} }
this.$emit("confirm", this.selectedRow); const { operationCost } = await getOperationCost({
commodityCode: this.selectedRow.commodityCode,
merchantIdList: this.merchantIdList,
});
this.$emit("confirm", {
...this.selectedRow,
operationCost,
});
}, },
handleReset() { handleReset() {
this.table.form = { this.table.form = {
...@@ -291,4 +340,9 @@ export default { ...@@ -291,4 +340,9 @@ export default {
padding: 0; padding: 0;
} }
} }
.table-wrapper {
::v-deep .el-table .cell {
padding: 6px 8px;
}
}
</style> </style>
...@@ -74,18 +74,19 @@ ...@@ -74,18 +74,19 @@
<el-button style="width:160px" <el-button style="width:160px"
type="primary" type="primary"
size="small" size="small"
@click="saveEdit()"> @click="saveEdit({ useValidate: false })">
保存 保存
</el-button> </el-button>
</div> </div>
</div> </div>
<div class="tabs-wrapper"> <div v-if="hasMerchantIdList" class="tabs-wrapper">
<Product v-if="productDetail.productType === 1" <Product v-if="productDetail.productType === 1"
ref="productRefs" ref="productRefs"
:key="tabsActive" :key="tabsActive"
:edit-state="editState" :edit-state="editState"
:merchant-id-list="merchantIdList"
:base-scene-code="baseSceneCode" :base-scene-code="baseSceneCode"
:product="productDetail || { detailList: [] }" :product="productDetail || { detailList: [] }"
@update:upgradeGoods="handleProductUpdateUpgradeGoods" /> @update:upgradeGoods="handleProductUpdateUpgradeGoods" />
...@@ -93,10 +94,12 @@ ...@@ -93,10 +94,12 @@
ref="packageRefs" ref="packageRefs"
:key="tabsActive" :key="tabsActive"
:prefix="$data._prefix" :prefix="$data._prefix"
:merchant-id-list="merchantIdList"
:edit-state="editState" :edit-state="editState"
:base-scene-code="baseSceneCode" :base-scene-code="baseSceneCode"
:shelf-type="shelfType" :shelf-type="shelfType"
:packages="productDetail || { detailList: [] }" /> :packages="productDetail || { detailList: [] }"
@update:packages="handleComboUpdatePackages" />
</div> </div>
</template> </template>
...@@ -115,6 +118,7 @@ import { ...@@ -115,6 +118,7 @@ import {
delProductPackagesApi, delProductPackagesApi,
getProductPackagesDetailApi, getProductPackagesDetailApi,
getProductPackagesListApi, getProductPackagesListApi,
getShelfProductBaseInfoApi,
postProductPackagesApi, postProductPackagesApi,
} from "@/views/goods/shelfProduct/api/index.js"; } from "@/views/goods/shelfProduct/api/index.js";
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index.js"; import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index.js";
...@@ -163,6 +167,9 @@ export default { ...@@ -163,6 +167,9 @@ export default {
list: [], list: [],
}, },
productDetail: { }, productDetail: { },
// 这是来自整个订单的, 跟detail无关,不能放detail里
merchantIdList: [],
hasMerchantIdList: false,
}; };
}, },
computed: { computed: {
...@@ -175,8 +182,7 @@ export default { ...@@ -175,8 +182,7 @@ export default {
}, },
}, },
}, },
mounted() { async mounted() {
}, },
methods: { methods: {
isEmpty, isEmpty,
...@@ -280,29 +286,30 @@ export default { ...@@ -280,29 +286,30 @@ export default {
return; return;
} }
const newRow = list[0]; const newRow = list[0];
if (isCreate) { if (isCreate) {
// 新增
this.tabs.list.unshift(newRow);
const index = this.tabs.list.findIndex(item => item.id === this.tabsActive);
this.tabs.list.splice(index, 1);
this.tabs.active = newRow.id;
// id 由临时 nanoid- 改为正式id 所以要多做一些步骤
// tabs list 先 push 接口返回的 存储好的id
} else {
console.log("new row", newRow);
// 有值 为 修改 // 有值 为 修改
const index = this.tabs.list.findIndex(item => item.id === req.id); const index = this.tabs.list.findIndex(item => item.id === req.id);
if (index === -1) { if (index === -1) {
return; return;
} }
this.$set(this.tabs.list, index, newRow); this.$set(this.tabs.list, index, newRow);
} else {
// 空值 为 新增
// id 由临时 nanoid- 改为正式id 所以要多做一些步骤
// tabs list 先 push 接口返回的 存储好的id
this.tabs.list.unshift(newRow);
// 删掉新增时 临时存的
const index = this.tabs.list.findIndex(item => item.id === this.tabsActive);
this.tabs.list.splice(index, 1);
this.tabs.active = newRow.id;
// 通过现有 nanoid 找到对应index 删掉
// 设置 active值
} }
this.$refs.remoteSelectRef.forceUpdate(); this.$refs.remoteSelectRef.forceUpdate();
// // 根据id 修改 productName // // 根据id 修改 productName
// await this.$refs.remoteSelectRef.getApi(false); // await this.$refs.remoteSelectRef.getApi(false);
this.$set(this, "productDetail", newDetail);
this.productDetail = newDetail; this.productDetail = newDetail;
if (useMessage) { if (useMessage) {
this.$message({ this.$message({
...@@ -380,6 +387,12 @@ export default { ...@@ -380,6 +387,12 @@ export default {
// 获取头部的select选择项 // 获取头部的select选择项
async getTitleOptions({ pageQuery, isImmediate }) { async getTitleOptions({ pageQuery, isImmediate }) {
if (!this.hasMerchantIdList) {
const { merchantIdList } = await getShelfProductBaseInfoApi({ businessCode: this.businessCode });
this.merchantIdList = merchantIdList || [];
await this.$nextTick();
}
const { list, pages } = await getProductPackagesListApi({ const { list, pages } = await getProductPackagesListApi({
businessCode: this.businessCode, businessCode: this.businessCode,
productName: pageQuery.searchValue, productName: pageQuery.searchValue,
...@@ -394,6 +407,7 @@ export default { ...@@ -394,6 +407,7 @@ export default {
} }
} }
pageQuery.pages = pages; pageQuery.pages = pages;
this.hasMerchantIdList = true;
return { return {
list: list.map(item => ({ list: list.map(item => ({
...item, ...item,
...@@ -414,6 +428,9 @@ export default { ...@@ -414,6 +428,9 @@ export default {
}); });
this.$set(this.productDetail, "upgradeGoodsId", upgradeGoods.id); this.$set(this.productDetail, "upgradeGoodsId", upgradeGoods.id);
}, },
handleComboUpdatePackages(packages) {
this.$set(this, "productDetail", packages);
},
// 新增按钮 // 新增按钮
async handleAppendProductPackages(command) { async handleAppendProductPackages(command) {
......
import { get } from "lodash-es"; import { get, isArray } from "lodash-es";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
import { BaseData, settlementTypeOpt } from "@/common/constants"; import { BaseData, settlementTypeOpt } from "@/common/constants";
import { isZeroOrNumber } from "@/libs/number"; import { isZeroOrNumber } from "@/libs/number";
...@@ -226,7 +226,7 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -226,7 +226,7 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
positionOption = await store.dispatch("d2admin/base/get", BaseData.positionTypeList); positionOption = await store.dispatch("d2admin/base/get", BaseData.positionTypeList);
} }
return [ return [
{ name: "detailList.0.upgradeGoods.upgradeGoodsName", label: "商品名称", col: 8 }, { name: "detailList.0.upgradeGoods.upgradeGoodsName", label: "产品名称", col: 8 },
{ {
name: "detailList.0.upgradeGoods.specificationData", name: "detailList.0.upgradeGoods.specificationData",
label: "规格", label: "规格",
...@@ -240,7 +240,7 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -240,7 +240,7 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
}, },
{ {
name: "detailList.0.upgradeGoods.type", name: "detailList.0.upgradeGoods.type",
label: "商品编码", label: "产品编码",
col: 8, col: 8,
render(h, { data, schemaItem }) { render(h, { data, schemaItem }) {
const value = get(data, schemaItem.name); const value = get(data, schemaItem.name);
...@@ -252,7 +252,7 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -252,7 +252,7 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
}, },
{ {
name: "detailList.0.upgradeGoods.thirdPartyCode", name: "detailList.0.upgradeGoods.thirdPartyCode",
label: "第三方编码", label: "供应商编码",
col: 8, col: 8,
render(h, { data, schemaItem }) { render(h, { data, schemaItem }) {
const value = get(data, schemaItem.name); const value = get(data, schemaItem.name);
...@@ -262,18 +262,18 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -262,18 +262,18 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
); );
}, },
}, },
{ // {
name: "detailList.0.upgradeGoods.purchasePrice", // name: "detailList.0.upgradeGoods.purchasePrice",
label: "采购价/卷", // label: "采购价/卷",
col: 8, // col: 8,
render(h, { data, schemaItem }) { // render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name)); // const value = isZeroOrNumber(get(data, schemaItem.name));
return h( // return h(
"span", // "span",
value === "-" ? value : `${value}元`, // value === "-" ? value : `${value}元`,
); // );
}, // },
}, // },
{ {
name: "detailList.0.upgradeGoods.upgradePrice", name: "detailList.0.upgradeGoods.upgradePrice",
label: "参考售价/件", label: "参考售价/件",
...@@ -339,7 +339,7 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -339,7 +339,7 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
); );
}, },
}, },
{ name: "detailList.0.upgradeGoods.commodityCode", label: "商品ID", col: 8 }, { name: "detailList.0.upgradeGoods.commodityCode", label: "产品ID", col: 8 },
{ {
name: "detailList.0.upgradeGoods.djCost", name: "detailList.0.upgradeGoods.djCost",
label: "嘀加成本/件", label: "嘀加成本/件",
...@@ -352,13 +352,12 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -352,13 +352,12 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
); );
}, },
isHide: ({ formModel }) => { isHide: ({ formModel }) => {
return false; const goodsInfo = formModel?.goodsInfo || formModel.upgradeGoods?.goodsInfo;
// const goodsInfo = formModel?.goodsInfo || formModel.upgradeGoods?.goodsInfo; const supplierCode = formModel?.supplierCode || formModel?.upgradeGoods?.supplierCode || goodsInfo?.supplierCode;
// const supplierCode = formModel?.supplierCode || formModel?.upgradeGoods?.supplierCode || goodsInfo?.supplierCode; const hasEquityScene = baseConfig.equitySceneType.includes(formModel.goodsType);
// const hasEquityScene = baseConfig.equitySceneType.includes(formModel.goodsType); const hasExtendPosition = baseConfig.extendedPosiType.includes(formModel.goodsType);
// const hasExtendPosition = baseConfig.extendedPosiType.includes(formModel.goodsType); const hasSupplierCode = baseConfig.supplierCode.includes(supplierCode);
// const hasSupplierCode = baseConfig.supplierCode.includes(supplierCode); return !((hasEquityScene || hasExtendPosition) && !hasSupplierCode);
// return !((hasEquityScene || hasExtendPosition) && !hasSupplierCode);
}, },
}, },
{ {
...@@ -381,9 +380,9 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -381,9 +380,9 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
const names = positions.map(item => item.confName); const names = positions.map(item => item.confName);
return result(names?.join("/")); return result(names?.join("/"));
}, },
// isHide: ({ formModel }) => { isHide: ({ formModel }) => {
// return formModel.goodsType !== 1; return formModel?.detailList?.[0]?.goodsType !== 1;
// }, },
}, },
{ {
name: "detailList.0.upgradeGoods.upgradeGoodsServiceItemsList", name: "detailList.0.upgradeGoods.upgradeGoodsServiceItemsList",
...@@ -409,14 +408,6 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -409,14 +408,6 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
value, value,
); );
}, },
// isHide: ({ formModel }) => {
// const upgradeGoods = get(formModel, "detailList.0.upgradeGoods");
// const hasEquityScene = baseConfig.equitySceneType.includes(upgradeGoods?.goodsType);
// const hasSupplierCode = baseConfig.supplierCode.includes(upgradeGoods?.goodsInfo.supplierCode);
// // 这里是hide 所以要反一下
// return !(hasEquityScene && !hasSupplierCode);
// },
}, },
{ {
name: "detailList.0.upgradeGoods.entityCardFlag", name: "detailList.0.upgradeGoods.entityCardFlag",
...@@ -429,13 +420,6 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -429,13 +420,6 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
value === "Y" ? "是" : "否", value === "Y" ? "是" : "否",
); );
}, },
// isHide: ({ formModel }) => {
// const upgradeGoods = get(formModel, "detailList.0.upgradeGoods");
// const hasEquityScene = baseConfig.equitySceneType.includes(upgradeGoods?.goodsType);
// // 这里是hide 所以要反一下
// return !(hasEquityScene);
// },
}, },
{ {
name: "detailList.0.upgradeGoods.warrantyPeriod", name: "detailList.0.upgradeGoods.warrantyPeriod",
...@@ -448,12 +432,18 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() { ...@@ -448,12 +432,18 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
value === "-" ? value : `${value}年`, value === "-" ? value : `${value}年`,
); );
}, },
// isHide: ({ formModel }) => { },
// const upgradeGoods = get(formModel, "detailList.0.upgradeGoods"); {
// const hasMembraneType = baseConfig.membraneTypeList.includes(upgradeGoods?.goodsType); name: "detailList.0.upgradeGoods.operationCost",
// // 这里是hide 所以要反一下 label: "运营成本/元",
// return !(hasMembraneType); col: 8,
// }, render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name));
return h(
"span",
value === "-" ? value : `${value}元`,
);
},
}, },
]; ];
} }
...@@ -567,7 +557,7 @@ export const selectGoodsTableSchema = { ...@@ -567,7 +557,7 @@ export const selectGoodsTableSchema = {
width: "60", width: "60",
}, },
{ {
label: "商品名称", label: "产品名称",
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
width: 150, width: 150,
formatter: (cellValue) => { formatter: (cellValue) => {
...@@ -575,7 +565,7 @@ export const selectGoodsTableSchema = { ...@@ -575,7 +565,7 @@ export const selectGoodsTableSchema = {
}, },
}, },
{ {
label: "商品ID", label: "产品ID",
prop: "commodityCode", prop: "commodityCode",
width: 180, width: 180,
formatter: (cellValue) => { formatter: (cellValue) => {
...@@ -590,14 +580,14 @@ export const selectGoodsTableSchema = { ...@@ -590,14 +580,14 @@ export const selectGoodsTableSchema = {
}, },
}, },
{ {
label: "商品编码", label: "产品编码",
prop: "type", prop: "type",
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.type || "-"; return cellValue.type || "-";
}, },
}, },
{ {
label: "第三方编码", label: "供应商编码",
prop: "thirdPartyCode", prop: "thirdPartyCode",
width: 100, width: 100,
formatter: (cellValue) => { formatter: (cellValue) => {
...@@ -605,13 +595,43 @@ export const selectGoodsTableSchema = { ...@@ -605,13 +595,43 @@ export const selectGoodsTableSchema = {
}, },
}, },
{ {
label: "运营成本/元",
prop: "operationCost",
width: 100,
formatter: (row) => {
const value = isZeroOrNumber(row.operationCost);
return value === "-" ? value : `${value}元`;
},
},
{
label: "适用区域",
prop: "upgradeGoodsAreaList",
width: 180,
addHtml: "upgradeGoodsAreaList",
// formatter: (row) => {
// if (!isArray(row.upgradeGoodsAreaList)) {
// return "-";
// }
// if (row.upgradeGoodsAreaList.length === 0) {
// return "-";
// }
// const areaList = row.upgradeGoodsAreaList.map((item) => {
// if (item.provinceName === "全国") {
// return item.provinceName;
// }
// return `${item.provinceName}-${item.cityName}`;
// });
// return areaList.join("/");
// },
},
{
label: "适用车型", label: "适用车型",
prop: "", prop: "",
addHtml: "carName", addHtml: "carName",
width: 200, width: 200,
// formatter: (cellValue) => { formatter: (cellValue) => {
// return cellValue?.carTypeConfigList?.length ? cellValue.carTypeConfigList.map(item => item.seriesName).join('/') : '-' return cellValue?.carTypeConfigList?.length ? cellValue.carTypeConfigList.map(item => item.seriesName).join("/") : "-";
// } },
}, },
{ {
label: "所属系列", label: "所属系列",
...@@ -644,7 +664,7 @@ export const selectGoodsTableSchema = { ...@@ -644,7 +664,7 @@ export const selectGoodsTableSchema = {
export function getSelectGoodsTableFilterSchema(keyDownGetList) { export function getSelectGoodsTableFilterSchema(keyDownGetList) {
return [ return [
{ {
label: "商品名称", label: "产品名称",
name: "upgradeGoodsName", name: "upgradeGoodsName",
type: "input", type: "input",
maxlength: 50, maxlength: 50,
...@@ -652,7 +672,7 @@ export function getSelectGoodsTableFilterSchema(keyDownGetList) { ...@@ -652,7 +672,7 @@ export function getSelectGoodsTableFilterSchema(keyDownGetList) {
keyFn: keyDownGetList, keyFn: keyDownGetList,
}, },
{ {
label: "商品ID", label: "产品ID",
name: "commodityCode", name: "commodityCode",
addHtml: "commodityCode", addHtml: "commodityCode",
}, },
...@@ -665,12 +685,12 @@ export function getSelectGoodsTableFilterSchema(keyDownGetList) { ...@@ -665,12 +685,12 @@ export function getSelectGoodsTableFilterSchema(keyDownGetList) {
keyFn: keyDownGetList, keyFn: keyDownGetList,
}, },
{ {
label: "商品编码", label: "产品编码",
name: "type", name: "type",
addHtml: "type", addHtml: "type",
}, },
{ {
label: "第三方编码", label: "供应商编码",
name: "thirdPartyCode", name: "thirdPartyCode",
addHtml: "thirdPartyCode", addHtml: "thirdPartyCode",
}, },
......
...@@ -110,7 +110,6 @@ import { readFileAsDataURL } from "@/libs/file"; ...@@ -110,7 +110,6 @@ import { readFileAsDataURL } from "@/libs/file";
import { startPolling } from "@/libs/interval"; import { startPolling } from "@/libs/interval";
import { syncTime } from "@/libs/sleep"; import { syncTime } from "@/libs/sleep";
import { import {
getShelfProductBaseInfoApi,
getShelfProductBaseInfoByUUIDApi, getShelfProductBaseInfoByUUIDApi,
getShelfProductUpdateStep, getShelfProductUpdateStep,
postPollFileParseStatusApi, postPollFileParseStatusApi,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!