Commit 84e89df2 by wangzhihui

套餐管理需求开发

1 parent ce89a6f8
...@@ -36,3 +36,21 @@ export function delPackageById(data) { ...@@ -36,3 +36,21 @@ export function delPackageById(data) {
data.method = `${path}merchantPackageGoodsInfo.deleteById` data.method = `${path}merchantPackageGoodsInfo.deleteById`
return request(data) return request(data)
} }
// 根据套餐ID列表查询套餐下商品信息
export function getGoodsByPackageIdList(data) {
data.method = `${path}merchantPackageGoodsInfo.getGoodsByPackageIdList`
return request(data, "post")
}
// 根据套餐ID列表查询套餐关联商户列表
export function queryRelatedMerchantByPackageIdList(data) {
data.method = `${path}merchantPackageGoodsInfo.queryRelatedMerchantByPackageIdList`
return request(data, "post")
}
// 批量修改套餐库存管控模式
export function batchEditInventoryTypeByPackageId(data) {
data.method = `${path}merchantPackageGoodsInfo.batchEditInventoryTypeByPackageId`
return request(data, "post")
}
...@@ -411,6 +411,14 @@ export const routerName = { ...@@ -411,6 +411,14 @@ export const routerName = {
category: "Button", category: "Button",
handle: "handleExport", handle: "handleExport",
}, },
{
authId: "9031211",
parentId: "90312",
label: "批量修改库存模式",
category: "Button",
type: "primary",
handle: "handleBatchModifyInventory",
},
], ],
component: _import("goods/packageManage/index"), component: _import("goods/packageManage/index"),
}, },
......
...@@ -2,29 +2,36 @@ ...@@ -2,29 +2,36 @@
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2024-06-12 15:21:09 * @Date: 2024-06-12 15:21:09
* @LastEditors: 'wangzhihui' '1733904062@qq.com' * @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-03-23 18:41:31 * @LastEditTime: 2026-04-01 16:06:43
* @FilePath: \dj-car-life-system\src\views\goods\grounding\components\relateStoreTable.vue * @FilePath: \dj-car-life-system\src\views\goods\grounding\components\relateStoreTable.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
<template> <template>
<div class="store-table"> <div class="store-table">
<el-table border <el-table border
:data="merchantGoodsRefList" :data="isHide ? tableData : merchantGoodsRefList"
header-cell-class-name="header-cell-class-name" header-cell-class-name="header-cell-class-name"
:header-row-style="headerRowStyle" :header-row-style="headerRowStyle"
:span-method="isHide ? objectSpanMethod : ''"
style="width: 100%"> style="width: 100%">
<el-table-column align="center" <el-table-column align="center"
label="序号" label="序号"
type="index" width="60px">
width="60px" /> <template #default="scope">
{{ getIndex(scope.$index) }}
</template>
</el-table-column>
<el-table-column align="center" <el-table-column align="center"
label="门店名称" label="门店名称"
prop="merchantName" /> prop="merchantName" />
<el-table-column align="center" <el-table-column align="center"
label="门店商户号" label="门店商户号"
prop="merchantId" /> prop="merchantId" />
<el-table-column v-if="!isHide" <el-table-column v-if="isHide"
align="center" align="center"
label="商品名称"
prop="upgradeGoodsName" />
<el-table-column align="center"
label="库存管控"> label="库存管控">
<template #default="scope"> <template #default="scope">
<span v-if="isDetail">{{ scope.row.inventoryType == 1 ? '虚拟' : '实物' }}</span> <span v-if="isDetail">{{ scope.row.inventoryType == 1 ? '虚拟' : '实物' }}</span>
...@@ -71,9 +78,86 @@ export default { ...@@ -71,9 +78,86 @@ export default {
}, },
data() { data() {
return { return {
tableData: [],
}; };
}, },
watch: {
merchantGoodsRefList: {
handler(val) {
if (this.isHide)
this.initData();
},
immediate: true,
},
},
mounted() {
},
methods: { methods: {
initData() {
const tableData = [];
(this.merchantGoodsRefList || []).forEach((pkg) => {
if (pkg.inventoryTypeRefList && pkg.inventoryTypeRefList.length > 0) {
pkg.inventoryTypeRefList.forEach((goods) => {
if (goods) {
tableData.push({
merchantId: pkg.merchantId,
merchantName: pkg.merchantName,
merchantGoodsId: goods.merchantGoodsId,
upgradeGoodsName: goods.upgradeGoodsName,
inventoryType: goods.inventoryType,
});
}
});
}
});
this.tableData = tableData;
this.getSpanArr(this.tableData);
},
getIndex(index) {
if (!this.isHide) {
return index + 1;
}
// 当有合并单元格时,计算当前行在 spanArr 中是第几个非0项,从而得出正确的顺序序号
let count = 0;
for (let i = 0; i <= index; i++) {
if (this.spanArr[i] > 0) {
count++;
}
}
return count;
},
getSpanArr(data) {
this.spanArr = [];
this.pos = 0;
for (let i = 0; i < data.length; i++) {
if (i === 0) {
this.spanArr.push(1);
this.pos = 0;
} else {
// 判断当前元素与上一个元素是否属于同一个套餐
if (data[i].merchantId === data[i - 1].merchantId) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = i;
}
}
}
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
// 合并序号(0)和套餐名称(1)列
if (columnIndex === 0 || columnIndex === 1 || columnIndex === 2 || columnIndex === 6) {
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col,
};
}
},
handleDelete(item) { handleDelete(item) {
this.$emit("handleDelete", item); this.$emit("handleDelete", item);
}, },
......
export const productList = [{ export const productList = [{
confId: 1, confId: 1,
confName: '基础产品' confName: "基础产品",
}, { }, {
confId: 2, confId: 2,
confName: '升级产品' confName: "升级产品",
}] }];
export const baseSupplyModeList = [{ export const baseSupplyModeList = [{
confId: 1, confId: 1,
confName: '嘀加' confName: "嘀加",
}, { }, {
confId: 2, confId: 2,
confName: '门店' confName: "门店",
}] }];
// 太阳膜升级产品供货模式 // 太阳膜升级产品供货模式
export const upgradeSupplyModeList = [{ export const upgradeSupplyModeList = [{
confId: 1, confId: 1,
confName: '嘀加' confName: "嘀加",
}, { }, {
confId: 3, confId: 3,
confName: '门店套码+嘀加' confName: "门店套码+嘀加",
}, { }, {
confId: 4, confId: 4,
confName: '门店回收原厂+嘀加' confName: "门店回收原厂+嘀加",
}, { }, {
confId: 5, confId: 5,
confName: '服务商自采+嘀加' confName: "服务商自采+嘀加",
}] }];
// 1.3场景 升级产品供货模式 // 1.3场景 升级产品供货模式
export const crowdUpgradeSupplyModeList = [{ export const crowdUpgradeSupplyModeList = [{
confId: 1, confId: 1,
confName: '嘀加' confName: "嘀加",
}, { }, {
confId: 2, confId: 2,
confName: '门店' confName: "门店",
}] }];
// 套餐上架商品信息form表单 // 套餐上架商品信息form表单
export const packageGoodsForm = [{ export const packageGoodsForm = [{
name: 'upgradeGoodsId', name: "upgradeGoodsId",
label: '上架商品', label: "上架商品",
isRequired: true, isRequired: true,
type: 'searchSelect', type: "searchSelect",
optionList: [], optionList: [],
isClear: false, isClear: false,
optionId: 'confId', optionId: "confId",
optionNameLabel: 'confNameValue', optionNameLabel: "confNameValue",
optionTypeNameLabel: 'confTypeNameValue', optionTypeNameLabel: "confTypeNameValue",
width: '432px' width: "432px",
}, { }, {
type: 'incidBox', type: "incidBox",
key: 'goodsType', key: "goodsType",
detailInfo: [{ detailInfo: [{
label: '商品名称', label: "商品名称",
value: 'upgradeGoodsName' value: "upgradeGoodsName",
}, { }, {
label: '规格', label: "规格",
value: 'specificationData' value: "specificationData",
}, { }, {
label: '商品编码', label: "商品编码",
value: 'type' value: "type",
}, { }, {
label: '第三方编码', label: "第三方编码",
value: 'thirdPartyCode' value: "thirdPartyCode",
}, { }, {
label: '采购价', label: "采购价",
value: 'purchasePrice', value: "purchasePrice",
unit: true unit: true,
}, { }, {
label: '参考售价', label: "参考售价",
value: 'upgradePrice', value: "upgradePrice",
unit: true unit: true,
}, { }, {
label: '适用车型', label: "适用车型",
value: 'carTypeConfigName' value: "carTypeConfigName",
}, { }, {
label: '所属系列', label: "所属系列",
value: 'goodsName' value: "goodsName",
}, { }, {
label: '所属分类', label: "所属分类",
value: 'tempGoodsTypeName' value: "tempGoodsTypeName",
}, { }, {
label: '商品ID', label: "商品ID",
value: 'upgradeCommodityCode' value: "upgradeCommodityCode",
}] }],
}, { }, {
name: 'position', name: "position",
label: '上架部位', label: "上架部位",
type: 'radio', type: "radio",
radioGroupList: [] radioGroupList: [],
}, { }, {
name: 'goodsAlias', name: "goodsAlias",
label: '商品别名', label: "商品别名",
type: 'input', type: "input",
maxlength: 50, maxlength: 50,
width: '432px' width: "432px",
}, { }, {
name: 'warrantyType', name: "warrantyType",
label: '质保卡类型', label: "质保卡类型",
type: 'select', type: "select",
isClear: false, isClear: false,
optionList: [{ optionList: [{
confId: 0, confId: 0,
confName: '质保卡' confName: "质保卡",
}, { }, {
confId: 1, confId: 1,
confName: '质保权益卡' confName: "质保权益卡",
}], }],
optionId: 'confId', optionId: "confId",
optionLabel: 'confName', optionLabel: "confName",
width: '432px' width: "432px",
}, { }, {
name: 'upgradeSupplyMode', name: "upgradeSupplyMode",
label: '升级/产品供货模式', label: "升级/产品供货模式",
type: 'radio', type: "radio",
index: 2, index: 2,
radioGroupList: [] radioGroupList: [],
}, { }, {
name: 'sellPrice', name: "sellPrice",
label: '售价', label: "售价",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'minSellPrice', name: "minSellPrice",
label: '最低售价', label: "最低售价",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'upgradeProductCost', name: "upgradeProductCost",
label: '产品、升级成本', label: "产品、升级成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'recoveryCost', name: "recoveryCost",
label: '回收成本', label: "回收成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'virtualAccountCost', name: "virtualAccountCost",
label: '虚拟对账成本', label: "虚拟对账成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'djCost', name: "djCost",
label: '嘀加成本', label: "嘀加成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
isDisabled: false, isDisabled: false,
handleInput: true handleInput: true,
}, { }, {
name: 'thirdPartyCost', name: "thirdPartyCost",
label: '第三方成本', label: "第三方成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}] }];
// 套餐查看详情form // 套餐查看详情form
export const packageGoodsDetail = [ export const packageGoodsDetail = [
{ {
name: 'upgradeGoodsName', name: "upgradeGoodsName",
label: '上架商品', label: "上架商品",
type: 'incidBox', type: "incidBox",
key: 'goodsType', key: "goodsType",
detailInfo: [{ detailInfo: [{
label: '商品名称', label: "商品名称",
value: 'upgradeGoodsName' value: "upgradeGoodsName",
}, { }, {
label: '规格', label: "规格",
value: 'specificationData' value: "specificationData",
}, { }, {
label: '商品编码', label: "商品编码",
value: 'type' value: "type",
}, { }, {
label: '第三方编码', label: "第三方编码",
value: 'thirdPartyCode' value: "thirdPartyCode",
}, { }, {
label: '采购价', label: "采购价",
value: 'purchasePrice', value: "purchasePrice",
unit: true unit: true,
}, { }, {
label: '参考售价', label: "参考售价",
value: 'upgradePrice', value: "upgradePrice",
unit: true unit: true,
}, { }, {
label: '适用车型', label: "适用车型",
value: 'carTypeConfigName' value: "carTypeConfigName",
}, { }, {
label: '所属系列', label: "所属系列",
value: 'goodsName' value: "goodsName",
}, { }, {
label: '所属分类', label: "所属分类",
value: 'tempGoodsTypeName' value: "tempGoodsTypeName",
}, { }, {
label: '商品ID', label: "商品ID",
value: 'upgradeCommodityCode' value: "upgradeCommodityCode",
}] }],
}, { },
name: 'positionStr', {
label: '上架部位' name: "positionStr",
}, { label: "上架部位",
name: 'goodsAlias', },
label: '商品别名' {
}, { name: "goodsAlias",
name: 'warrantyTypeStr', label: "商品别名",
label: '质保卡类型' },
}, { {
name: 'upgradeSupplyModeStr', name: "warrantyTypeStr",
label: '升级产品供货模式' label: "质保卡类型",
}, { },
name: 'sellPrice', {
label: '售价', name: "upgradeSupplyModeStr",
unit: true label: "升级产品供货模式",
}, { },
name: 'minSellPrice', {
label: '最低售价', name: "sellPrice",
unit: true label: "售价",
}, { unit: true,
name: 'upgradeProductCost', },
label: '产品、升级成本', {
unit: true name: "minSellPrice",
}, { label: "最低售价",
name: 'recoveryCost', unit: true,
label: '回收成本', },
unit: true {
}, { name: "upgradeProductCost",
name: 'virtualAccountCost', label: "产品、升级成本",
label: '虚拟对账成本', unit: true,
unit: true },
}, { {
name: 'djCost', name: "recoveryCost",
label: '嘀加成本', label: "回收成本",
unit: true unit: true,
}, { },
name: 'thirdPartyCost', {
label: '第三方成本', name: "virtualAccountCost",
unit: true label: "虚拟对账成本",
} unit: true,
] },
{
name: "djCost",
label: "嘀加成本",
unit: true,
},
{
name: "thirdPartyCost",
label: "第三方成本",
unit: true,
},
];
<template>
<d2-dialog btn-ok-label="确认"
class="batch-modify-package-inventory-dialog"
:is-visible.sync="dialogVisible"
title="批量修改库存模式"
width="800px"
@closeDialog="handleClose"
@confirmDialog="handleConfirm">
<div class="tip-text">
已选择{{ selectedPackageCount }}个组合套餐,{{ totalGoodsCount }}个商品,涉及到{{ relatedStoreCount }}家门店
</div>
<div class="tip-sub-text">
统一设置所有商品的门店管控模式
</div>
<el-table border
:data="tableData"
max-height="400"
:span-method="objectSpanMethod"
style="width: 100%; margin-top: 20px;">
<el-table-column align="center"
label="序号"
type="index"
width="60">
<template #default="scope">
{{ getIndex(scope.$index) }}
</template>
</el-table-column>
<el-table-column label="套餐名称"
min-width="120"
prop="packageName"
show-overflow-tooltip>
</el-table-column>
<el-table-column label="商品名称"
min-width="120"
prop="upgradeGoodsName"
show-overflow-tooltip>
</el-table-column>
<el-table-column label="商品规格"
min-width="100"
prop="specificationData"
show-overflow-tooltip>
</el-table-column>
<el-table-column label="商品UID"
min-width="120"
prop="commodityCode"
show-overflow-tooltip>
</el-table-column>
<el-table-column label="库存模式" width="120">
<template #default="scope">
<el-select v-model="scope.row.inventoryType" size="small">
<el-option label="实物管控" :value="2"></el-option>
<el-option label="虚拟管控" :value="1"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="应用范围" width="180">
<template #default="scope">
<el-radio-group v-model="scope.row.bindAllMerchant" @change="handleScopeChange(scope.row)">
<el-radio :label="false">
指定门店
</el-radio>
<el-radio :label="true">
所有门店
</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column label="具体门店" width="160">
<template #default="scope">
<el-select v-if="!scope.row.bindAllMerchant"
v-model="scope.row.merchantIdList"
collapse-tags
filterable
multiple
placeholder="请选择"
size="small">
<el-option v-for="merchant in merchantList"
:key="merchant.merchantId"
:label="merchant.merchantName"
:value="merchant.merchantId">
</el-option>
</el-select>
<span v-else>-</span>
</template>
</el-table-column>
</el-table>
</d2-dialog>
</template>
<script>
import { batchEditInventoryTypeByPackageId, getGoodsByPackageIdList, queryRelatedMerchantByPackageIdList } from "@/api/packageManage";
export default {
name: "BatchModifyPackageInventoryDialog",
props: {
visible: {
type: Boolean,
default: false,
},
selectedData: {
type: Array,
default: () => [],
},
},
data() {
return {
dialogVisible: false,
tableData: [],
merchantList: [],
spanArr: [], // 用于合并单元格
pos: 0,
};
},
computed: {
selectedPackageCount() {
return this.selectedData.length;
},
totalGoodsCount() {
return this.tableData.length;
},
relatedStoreCount() {
return this.merchantList.length;
},
},
watch: {
visible(val) {
this.dialogVisible = val;
if (val) {
this.tableData = [];
this.merchantList = [];
this.spanArr = [];
this.pos = 0;
this.fetchData();
}
},
dialogVisible(val) {
this.$emit("update:visible", val);
},
},
methods: {
getIndex(index) {
if (!this.isHide) {
return index + 1;
}
// 当有合并单元格时,计算当前行在 spanArr 中是第几个非0项,从而得出正确的顺序序号
let count = 0;
for (let i = 0; i <= index; i++) {
if (this.spanArr[i] > 0) {
count++;
}
}
return count;
},
async fetchData() {
const idList = this.selectedData.map(item => item.id);
if (idList.length === 0)
return;
try {
// TODO: 真实接口对接,开发环境暂用假数据测试交互
// const [merchantRes, goodsRes] = await Promise.all([
// queryRelatedMerchantByPackageIdList({ idList }),
// getGoodsByPackageIdList({ idList }),
// ]);
// 模拟商户数据
const merchantRes = {
merchantList: [
{ merchantId: "M001", merchantName: "门店111" },
{ merchantId: "M002", merchantName: "门店222" },
{ merchantId: "M003", merchantName: "门店333" },
],
};
// 模拟商品数据
const goodsRes = [
{
packageId: "P001",
packageName: "策略套餐",
goodsList: [
{ merchantGoodsId: "G001", upgradeGoodsName: "商品1", specificationData: "123", commodityCode: "U45678" },
{ merchantGoodsId: "G002", upgradeGoodsName: "商品2", specificationData: "4565", commodityCode: "U234567" },
{ merchantGoodsId: "G003", upgradeGoodsName: "商品2", specificationData: "4565", commodityCode: "U234567" },
],
},
{
packageId: "P002",
packageName: "冲量套餐",
goodsList: [
{ merchantGoodsId: "G003", upgradeGoodsName: "商品3", specificationData: "223", commodityCode: "U123456" },
],
},
];
this.merchantList = merchantRes.merchantList || [];
const tableData = [];
(goodsRes || []).forEach((pkg) => {
if (pkg.goodsList && pkg.goodsList.length > 0) {
pkg.goodsList.forEach((goods) => {
tableData.push({
packageId: pkg.packageId,
packageName: pkg.packageName,
merchantGoodsId: goods.merchantGoodsId,
upgradeGoodsName: goods.upgradeGoodsName,
specificationData: goods.specificationData,
commodityCode: goods.commodityCode,
inventoryType: 2, // 默认实物
bindAllMerchant: false, // 默认指定门店
merchantIdList: [],
});
});
}
});
this.tableData = tableData;
this.getSpanArr(this.tableData);
} catch (error) {
console.error(error);
}
},
getSpanArr(data) {
console.log(data, "9999");
this.spanArr = [];
this.pos = 0;
for (let i = 0; i < data.length; i++) {
if (i === 0) {
this.spanArr.push(1);
this.pos = 0;
} else {
// 判断当前元素与上一个元素是否属于同一个套餐
if (data[i].packageId === data[i - 1].packageId) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = i;
}
}
}
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
// 合并序号(0)和套餐名称(1)列
if (columnIndex === 0 || columnIndex === 1) {
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col,
};
}
},
handleScopeChange(row) {
if (row.bindAllMerchant) {
row.merchantIdList = [];
}
},
handleClose() {
this.dialogVisible = false;
this.$emit("close");
},
handleConfirm() {
// 校验
for (let i = 0; i < this.tableData.length; i++) {
const row = this.tableData[i];
if (!row.inventoryType) {
this.$message.warning(`请选择 ${row.upgradeGoodsName} 的库存模式`);
return;
}
if (row.bindAllMerchant === false && (!row.merchantIdList || row.merchantIdList.length === 0)) {
this.$message.warning(`请选择 ${row.upgradeGoodsName} 的具体门店`);
return;
}
}
// 组装数据
const packageMap = {};
this.tableData.forEach((row) => {
if (!packageMap[row.packageId]) {
packageMap[row.packageId] = {
packageId: row.packageId,
goodsList: [],
};
}
packageMap[row.packageId].goodsList.push({
merchantGoodsId: row.merchantGoodsId,
inventoryType: row.inventoryType,
bindAllMerchant: row.bindAllMerchant,
merchantIdList: row.bindAllMerchant ? [] : row.merchantIdList,
});
});
const packageList = Object.values(packageMap);
batchEditInventoryTypeByPackageId({ packageList }).then((res) => {
if (res) {
this.$message.success("批量修改库存模式成功");
this.dialogVisible = false;
this.$emit("confirm");
}
});
},
},
};
</script>
<style lang="scss" scoped>
.batch-modify-package-inventory-dialog {
.tip-text {
font-size: 14px;
color: #333;
margin-bottom: 8px;
padding-left: 10px;
border-left: 3px solid #1890ff;
}
.tip-sub-text {
font-size: 14px;
color: #666;
margin-bottom: 10px;
margin-left: 13px;
}
::v-deep .el-radio {
margin-right: 10px;
}
::v-deep .el-radio__label {
padding-left: 5px;
}
}
</style>
...@@ -640,6 +640,43 @@ export default { ...@@ -640,6 +640,43 @@ export default {
if (!this.filterEmpty(_valueObj?.djCost)) if (!this.filterEmpty(_valueObj?.djCost))
_formData.djCost = _valueObj?.djCost; // 嘀加成本 商品信息自带数据 _formData.djCost = _valueObj?.djCost; // 嘀加成本 商品信息自带数据
this.handleSelectGoodsClose(); this.handleSelectGoodsClose();
this.updateMerchantGoodsRefList();
},
// 上架商品加入上架门店
updateMerchantGoodsRefList() {
let _formData = [];
this.formData.groundingGoodsList.forEach((item) => {
console.log(item);
_formData.push({
meantGoodsId: item.id,
upgradeGoodsName: item.upgradeGoods.upgradeGoodsName,
inventoryType: item.inventoryType || 2,
});
});
let merchantGoodsRefList = [];
merchantGoodsRefList = this.formData.merchantGoodsRefList.map((item) => {
return {
...item,
inventoryTypeRefList: _formData,
};
});
this.formData.merchantGoodsRefList = merchantGoodsRefList;
},
handleAddMerchantGoods() {
let _formData = [];
this.formData.groundingGoodsList.forEach((item) => {
_formData.push({
meantGoodsId: item.id,
upgradeGoodsName: item.upgradeGoods.upgradeGoodsName,
inventoryType: item.inventoryType || 2,
});
});
this.formData.merchantGoodsRefList.forEach((item) => {
if (!item.inventoryTypeRefList || item.inventoryTypeRefList.length == 0) {
console.log(item, "火箭");
item.inventoryTypeRefList = _formData;
}
});
}, },
handleSelectGoodsClose() { handleSelectGoodsClose() {
this.selectGoodsVisible = false; this.selectGoodsVisible = false;
...@@ -844,7 +881,10 @@ export default { ...@@ -844,7 +881,10 @@ export default {
}); });
return true; return true;
} }
console.log(selectedData);
this.formData.merchantGoodsRefList = selectedData; this.formData.merchantGoodsRefList = selectedData;
console.log(this.formData.merchantGoodsRefList);
this.updateMerchantGoodsRefList();
this.relateStoreVisible = false; this.relateStoreVisible = false;
}, },
handleRelateStoreClose() { handleRelateStoreClose() {
...@@ -861,6 +901,7 @@ export default { ...@@ -861,6 +901,7 @@ export default {
handleDelete(item) { handleDelete(item) {
const filterArr = this.formData.merchantGoodsRefList.filter(i => i.merchantId !== item.merchantId); const filterArr = this.formData.merchantGoodsRefList.filter(i => i.merchantId !== item.merchantId);
this.$set(this.formData, "merchantGoodsRefList", filterArr); this.$set(this.formData, "merchantGoodsRefList", filterArr);
this.updateMerchantGoodsRefList();
}, },
// 下拉加载更多 下拉框显示隐藏触发 // 下拉加载更多 下拉框显示隐藏触发
visibleChange(data) { visibleChange(data) {
......
...@@ -230,12 +230,14 @@ export default { ...@@ -230,12 +230,14 @@ export default {
}, },
getDetailInfo(id) { getDetailInfo(id) {
getPackageDetailInfo({ id }).then((res) => { getPackageDetailInfo({ id }).then((res) => {
console.log(res, "getPackageDetailInfo");
res.groundingGoodsList = []; res.groundingGoodsList = [];
res?.merchantGoodsInfoList?.forEach((val) => { res?.merchantGoodsInfoList?.forEach((val) => {
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = val.goodsInfo || {}; const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = val.goodsInfo || {};
const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName]; const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName];
const result = types.filter(type => type).join("-"); const result = types.filter(type => type).join("-");
const positionNamesArr = deepClone(this.positionTypeList)?.filter(subVal => (val?.upgradeGoods?.position?.split(","))?.includes(subVal.position + "")) || []; const positionNamesArr = deepClone(this.positionTypeList)?.filter(subVal => (val?.upgradeGoods?.position?.split(","))?.includes(subVal.position + "")) || [];
// 商品信息
res.groundingGoodsList.push({ res.groundingGoodsList.push({
id: val.id, id: val.id,
goodsType: val?.goodsType, // 类目值 goodsType: val?.goodsType, // 类目值
...@@ -279,7 +281,12 @@ export default { ...@@ -279,7 +281,12 @@ export default {
if (val.voucherFileUrl) if (val.voucherFileUrl)
val.uploadProgress = 100; val.uploadProgress = 100;
}); });
res.merchantGoodsRefList = res.merchantGoodsRefList || []; // 上架门店 res.merchantGoodsRefList = res.merchantGoodsRefList.map((item) => {
return {
...item,
inventoryTypeRefList: item.inventoryTypeRefList || [],
};
}) || []; // 上架门店
res.voucherList = res.voucherList || []; // 上架凭证 res.voucherList = res.voucherList || []; // 上架凭证
this.editData = res || {}; this.editData = res || {};
this.$nextTick(() => { this.$nextTick(() => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!