Commit 7ad751ef by wangzhihui

商品库:商品上架、套餐管理需求开发

1 parent 54dd3312
...@@ -187,3 +187,15 @@ export function getOperationCost(data) { ...@@ -187,3 +187,15 @@ export function getOperationCost(data) {
data.method = 'dj.api.smartcarlife.merchantGoodsInfo.operationCost.calculate' data.method = 'dj.api.smartcarlife.merchantGoodsInfo.operationCost.calculate'
return request(data, "post") return request(data, "post")
} }
// 查询商品成本(默认带入产品成本)
export function queryMerchantGoodsCost(data) {
data.method = `dj.api.smartcarlife.merchantGoodsInfo.productCost.calculate`;
return request(data, "post");
}
// 校验门店省市是否在产品适用区域内
export function validateStoreRegion(data) {
data.method = `${path}merchantGoodsInfo.validateStoreRegion`;
return request(data, "post");
}
...@@ -164,6 +164,10 @@ export function getUpgradeProductList(data) { ...@@ -164,6 +164,10 @@ export function getUpgradeProductList(data) {
data.method = `${path}productManager.listUpgradeGoodsWithPage`; data.method = `${path}productManager.listUpgradeGoodsWithPage`;
return request(data, "post"); return request(data, "post");
} }
export function getUpgradeProductListV2(data) {
data.method = `dj.api.smartcarlife.productManager.listUpgradeGoodsWithPage.v2`;
return request(data, "post");
}
// 根据id查询商品详情 // 根据id查询商品详情
export function getBaseGoodsById(data) { export function getBaseGoodsById(data) {
......
...@@ -165,7 +165,7 @@ export const routerName = { ...@@ -165,7 +165,7 @@ export const routerName = {
title: "上架管理", title: "上架管理",
authId: "90309", authId: "90309",
parentId: "903", parentId: "903",
cache: false, cache: true,
}, },
auth: [ auth: [
{ {
...@@ -400,7 +400,7 @@ export const routerName = { ...@@ -400,7 +400,7 @@ export const routerName = {
title: "套餐管理", title: "套餐管理",
authId: "90312", authId: "90312",
parentId: "903", parentId: "903",
cache: false, cache: true,
}, },
auth: [ auth: [
{ {
......
...@@ -112,6 +112,12 @@ export const packageGoodsForm = [ ...@@ -112,6 +112,12 @@ export const packageGoodsForm = [
type: "price", type: "price",
isPrice: true, isPrice: true,
}, },
{
label: "采购成本/元",
value: "purchaseCost",
type: "price",
isPrice: true,
},
], ],
}, },
{ {
...@@ -122,6 +128,33 @@ export const packageGoodsForm = [ ...@@ -122,6 +128,33 @@ export const packageGoodsForm = [
width: "432px", width: "432px",
}, },
{ {
name: "serviceItemId",
label: "服务项目",
type: "select",
isRequired: true,
isClear: false,
optionList: [],
optionId: "serviceItemId",
optionLabel: "serviceItemsName",
width: "432px",
},
{
name: "productCostType",
label: "商品成本带入方式",
type: "flagRadio",
isRequired: true,
radioGroupList: [
{
label: "默认带入产品成本",
value: 1,
},
{
label: "自定义成本",
value: 0,
},
],
},
{
name: "goodsAlias", name: "goodsAlias",
label: "商品别名", label: "商品别名",
type: "input", type: "input",
...@@ -263,6 +296,11 @@ export const packageGoodsDetail = [ ...@@ -263,6 +296,11 @@ export const packageGoodsDetail = [
value: "operationCost", value: "operationCost",
type: "price", type: "price",
}, },
{
label: "采购成本/元",
value: "purchaseCost",
type: "price",
},
], ],
}, },
{ {
...@@ -316,4 +354,12 @@ export const packageGoodsDetail = [ ...@@ -316,4 +354,12 @@ export const packageGoodsDetail = [
label: "第三方成本", label: "第三方成本",
unit: true, unit: true,
}, },
{
name: "productCostTypeStr",
label: "商品成本带入方式",
},
{
name: "serviceItemDisplay",
label: "服务项目",
},
]; ];
...@@ -52,3 +52,13 @@ export const inventoryTypeList = [ ...@@ -52,3 +52,13 @@ export const inventoryTypeList = [
confValue: "虚拟", confValue: "虚拟",
}, },
]; ];
export const productCostTypeList = [
{
confId: 0,
confValue: "自定义成本",
},
{
confId: 1,
confValue: "默认带入产品成本",
},
];
export { default as relateStoreDialog } from "./components/relateStoreDialog.vue"; export { default as relateStoreDialog } from "./components/relateStoreDialog.vue";
export { default as relateStoreTable } from "./components/relateStoreTable.vue"; export { default as relateStoreTable } from "./components/relateStoreTable.vue";
export { crowdUpgradeSupplyModeList, packageGoodsDetail, packageGoodsForm, upgradeSupplyModeList } from "./constants/data"; export { crowdUpgradeSupplyModeList, packageGoodsDetail, packageGoodsForm, upgradeSupplyModeList } from "./constants/data";
export { financeCheckFlagList, inventoryTypeList, statusList } from "./constants/index"; export { financeCheckFlagList, inventoryTypeList, productCostTypeList, statusList } from "./constants/index";
export { default as merchantIcon } from "./images/merchant_icon.png"; export { default as merchantIcon } from "./images/merchant_icon.png";
export { default as pdfThumbnailPng } from "./images/PDF_thumbnail.png"; export { default as pdfThumbnailPng } from "./images/PDF_thumbnail.png";
export { default as photoThumbnailPng } from "./images/photo_thumbnail.png"; export { default as photoThumbnailPng } from "./images/photo_thumbnail.png";
......
import { baseConfig } from "@/main";
/** 太阳膜、改色膜、车衣 — 需展示服务项目 */
export const SERVICE_ITEM_GOODS_TYPES = [1, 12, 14];
export function isEquityOrExtended(goodsType) {
if (goodsType === "" || goodsType === null || goodsType === undefined) {
return false;
}
const equitySceneType = baseConfig.equitySceneType || [];
const extendedPosiType = baseConfig.extendedPosiType || [];
const type = Number(goodsType);
return equitySceneType.includes(type) || extendedPosiType.includes(type)
|| equitySceneType.includes(goodsType) || extendedPosiType.includes(goodsType);
}
export function isThirdPart(supplierCode) {
return (baseConfig.supplierCode || []).includes(`${supplierCode}`);
}
/** 自营延保 & 权益 */
export function isSelfOperatedEquityExtended(goodsType, supplierCode) {
return isEquityOrExtended(goodsType) && !isThirdPart(supplierCode);
}
/** 第三方延保 & 权益 */
export function isThirdPartyEquityExtended(goodsType, supplierCode) {
return isEquityOrExtended(goodsType) && isThirdPart(supplierCode);
}
/** 轻改类:非权益 & 非延保 */
export function isLightModification(goodsType) {
return goodsType !== "" && goodsType !== undefined && goodsType !== null && !isEquityOrExtended(goodsType);
}
export function shouldShowServiceItem(goodsType) {
if (goodsType === "" || goodsType === null || goodsType === undefined) {
return false;
}
return SERVICE_ITEM_GOODS_TYPES.includes(Number(goodsType));
}
/** 自营延保/权益不展示商品成本带入方式 */
export function shouldShowProductCostType(goodsType, supplierCode) {
return !!goodsType && !isSelfOperatedEquityExtended(goodsType, supplierCode);
}
/**
* 根据 query.cost 返回值填充成本字段
* 1、轻改:upgradeCost → 升级产品填产品升级成本;基础产品填赠送成本
* 2、权益延保自营:equityDjCost 由选产品旧逻辑处理,此处不改
* 3、权益延保第三方:equityOperationCost → 第三方成本;勾选基础产品时同时填赠送成本
*/
export function applyQueryCostResult(formData, costResult = {}, productType = []) {
const { goodsType, supplierCode } = formData;
const types = productType || [];
if (isLightModification(goodsType)) {
const upgradeCost = costResult.upgradeCost ?? "";
if (types.includes(2)) {
formData.upgradeProductCost = upgradeCost;
}
if (types.includes(1)) {
formData.giftCost = upgradeCost;
}
return;
}
// 自营延保/权益:沿用选产品时 djCost 旧逻辑,不在此填充
if (isSelfOperatedEquityExtended(goodsType, supplierCode)) {
return;
}
if (isThirdPartyEquityExtended(goodsType, supplierCode)) {
const equityOperationCost = costResult.equityOperationCost ?? "";
formData.thirdPartyCost = equityOperationCost;
if (types.includes(1)) {
formData.giftCost = equityOperationCost;
}
}
}
export function isAutoProductCostType(productCostType) {
return productCostType === 1 || productCostType === "1";
}
function isEmptyCost(value) {
return (value ?? "") === "";
}
/**
* 选择「默认带入产品成本」时,判断当前需填充的成本是否为空
*/
export function isAutoFillCostEmpty(formData, costResult = {}, productType = []) {
const { goodsType, supplierCode } = formData;
const types = productType || [];
if (isLightModification(goodsType)) {
if (!types.includes(1) && !types.includes(2)) {
return false;
}
return isEmptyCost(costResult.upgradeCost);
}
if (isThirdPartyEquityExtended(goodsType, supplierCode)) {
return isEmptyCost(costResult.equityOperationCost);
}
return false;
}
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<script> <script>
import { addOrUpdateAPI, checkGroundingLog, getMerchantGoodsInfo, getOperationCost } from "@api/grounding"; import { addOrUpdateAPI, checkGroundingLog, getMerchantGoodsInfo, getOperationCost } from "@api/grounding";
import { getList as getConstructionItemList } from "@api/serviceItemsManage";
import { getBaseSceneCodeList } from "@api/productManage"; import { getBaseSceneCodeList } from "@api/productManage";
import { mapActions } from "vuex"; import { mapActions } from "vuex";
import { BaseData } from "@/common/constants.js"; import { BaseData } from "@/common/constants.js";
...@@ -26,6 +27,7 @@ import { baseConfig } from "@/main"; ...@@ -26,6 +27,7 @@ import { baseConfig } from "@/main";
import { convertYuanToWan, filterSpecsStr } from "@/views/goods/filterOption"; import { convertYuanToWan, filterSpecsStr } from "@/views/goods/filterOption";
import groundingForm from "@/views/goods/grounding/components/groundingForm.vue"; import groundingForm from "@/views/goods/grounding/components/groundingForm.vue";
import { baseSupplyModeList, productList, upgradeSupplyModeList } from "@/views/goods/grounding/constants/data"; import { baseSupplyModeList, productList, upgradeSupplyModeList } from "@/views/goods/grounding/constants/data";
import { isSelfOperatedEquityExtended } from "@/views/goods/grounding/utils/productCost";
export default { export default {
name: "EditGrounding", name: "EditGrounding",
...@@ -130,6 +132,11 @@ export default { ...@@ -130,6 +132,11 @@ export default {
value: "operationCost", value: "operationCost",
type: "price", type: "price",
}, },
{
label: "采购成本/元",
value: "operationCost",
type: "price",
},
], ],
}, },
{ {
...@@ -140,6 +147,33 @@ export default { ...@@ -140,6 +147,33 @@ export default {
width: "432px", width: "432px",
}, },
{ {
name: "serviceItemId",
label: "服务项目",
type: "select",
isRequired: true,
isClear: false,
optionList: [],
optionId: "serviceItemId",
optionLabel: "serviceItemsName",
width: "432px",
},
{
name: "productCostType",
label: "商品成本带入方式",
type: "flagRadio",
isRequired: true,
radioGroupList: [
{
label: "默认带入产品成本",
value: 1,
},
{
label: "自定义成本",
value: 0,
},
],
},
{
name: "goodsAlias", name: "goodsAlias",
label: "商品别名", label: "商品别名",
type: "input", type: "input",
...@@ -307,6 +341,9 @@ export default { ...@@ -307,6 +341,9 @@ export default {
sellPriceValidType: 1, sellPriceValidType: 1,
tempValidDate: [], tempValidDate: [],
financeCheckFlag: "N", financeCheckFlag: "N",
serviceItemId: "",
productCostType: "",
warrantyType: 0,
}, },
secondGoodsList: [], secondGoodsList: [],
goodsNameKeyword: "", goodsNameKeyword: "",
...@@ -326,9 +363,9 @@ export default { ...@@ -326,9 +363,9 @@ export default {
}), }),
initData() { initData() {
// 获取业务场景数据 // 获取业务场景数据
getBaseSceneCodeList({ status: 1 }).then((res) => { getBaseSceneCodeList({ status: 1 }).then(async (res) => {
this.sceneCodeList = res || []; this.sceneCodeList = res || [];
this.getBaseData(); await this.getBaseData();
const id = this.$route.query.id; const id = this.$route.query.id;
if (!id) { if (!id) {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -341,6 +378,15 @@ export default { ...@@ -341,6 +378,15 @@ export default {
}); });
}, },
async getBaseData() { async getBaseData() {
const serviceItemRes = await getConstructionItemList({
categoryId: 1,
pageSize: 10000,
currentPage: 1,
});
const serviceItemList = (serviceItemRes?.list || []).map(item => ({
...item,
serviceItemId: item.serviceItemId ?? item.id,
}));
this.editForm.forEach((item) => { this.editForm.forEach((item) => {
item.formBlock && item.formBlock.forEach((v) => { item.formBlock && item.formBlock.forEach((v) => {
if (v.type == "check") { if (v.type == "check") {
...@@ -357,6 +403,9 @@ export default { ...@@ -357,6 +403,9 @@ export default {
if (v.name == "baseSceneCode") { // 业务场景 if (v.name == "baseSceneCode") { // 业务场景
v.optionList = this.sceneCodeList; v.optionList = this.sceneCodeList;
} }
if (v.name == "serviceItemId") {
v.optionList = serviceItemList;
}
}); });
}); });
this.positionTypeList = await this.get(BaseData.positionTypeList); this.positionTypeList = await this.get(BaseData.positionTypeList);
...@@ -392,6 +441,9 @@ export default { ...@@ -392,6 +441,9 @@ export default {
} }
} }
res.tempValidDate = tempValidDate; res.tempValidDate = tempValidDate;
if (res.warrantyType === null || res.warrantyType === undefined || res.warrantyType === "") {
res.warrantyType = 0;
}
res.upgradeGoods = { res.upgradeGoods = {
...res?.upgradeGoods, ...res?.upgradeGoods,
goodsName: res.goodsInfo.goodsName, goodsName: res.goodsInfo.goodsName,
...@@ -420,7 +472,6 @@ export default { ...@@ -420,7 +472,6 @@ export default {
return (data ?? "") === ""; return (data ?? "") === "";
}, },
handleAddClose() { handleAddClose() {
this.close({ tagName: "/grounding" });
this.$router.push({ name: "grounding" }); this.$router.push({ name: "grounding" });
this.close({ tagName: "/editGrounding" }); this.close({ tagName: "/editGrounding" });
}, },
...@@ -481,7 +532,11 @@ export default { ...@@ -481,7 +532,11 @@ export default {
}; };
if (params.tempValidDate) { if (params.tempValidDate) {
delete params.tempValidDate; delete params.tempValidDate;
}; }
// 自营延保/权益不传商品成本带入方式,沿用旧规则
if (isSelfOperatedEquityExtended(data.goodsType, data.supplierCode)) {
delete params.productCostType;
}
if (data?.goodsType == 1 && !this.filterBaseSceneCodeBySceneType(1)?.includes(data?.baseSceneCode)) { if (data?.goodsType == 1 && !this.filterBaseSceneCodeBySceneType(1)?.includes(data?.baseSceneCode)) {
return this.$message.warning("太阳膜类产品仅支持上架至精品升级场景"); return this.$message.warning("太阳膜类产品仅支持上架至精品升级场景");
} }
...@@ -538,7 +593,7 @@ export default { ...@@ -538,7 +593,7 @@ export default {
const obj = { // 产品信息 const obj = { // 产品信息
position: "", position: "",
goodsAlias: "", goodsAlias: "",
warrantyType: "", warrantyType: 0,
productType: [], productType: [],
baseSupplyMode: "", baseSupplyMode: "",
upgradeSupplyMode: "", upgradeSupplyMode: "",
...@@ -551,6 +606,8 @@ export default { ...@@ -551,6 +606,8 @@ export default {
validMinSellPrice: "Y", validMinSellPrice: "Y",
djCost: "", djCost: "",
thirdPartyCost: "", thirdPartyCost: "",
serviceItemId: "",
productCostType: "",
}; };
addOrUpdateAPI(this.dealObjectValue(params)).then((res) => { addOrUpdateAPI(this.dealObjectValue(params)).then((res) => {
this.notice.okTips(); this.notice.okTips();
...@@ -578,18 +635,18 @@ export default { ...@@ -578,18 +635,18 @@ export default {
return param; return param;
}, },
handleClose(isRefresh = false) { handleClose(isRefresh = false) {
if (isRefresh) { const goBack = () => {
this.close({ tagName: "/grounding" });
this.$router.push({ name: "grounding" }); this.$router.push({ name: "grounding" });
this.close({ tagName: "/grounding" }); this.close({ tagName: "/editGrounding" });
};
if (isRefresh) {
goBack();
} else { } else {
this.$confirm("内容未保存,是否返回?", "提示", { this.$confirm("内容未保存,是否返回?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
type: "warning", type: "warning",
}).then(() => { }).then(() => {
this.close({ tagName: "/grounding" }); goBack();
this.$router.push({ name: "grounding" });
this.close({ tagName: "/grounding" });
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);
}); });
......
...@@ -7,7 +7,7 @@ import { BaseData, sceneCodeList } from "@/common/constants.js"; ...@@ -7,7 +7,7 @@ import { BaseData, sceneCodeList } from "@/common/constants.js";
import { Util } from "@/common/util"; import { Util } from "@/common/util";
import store from "@/store"; import store from "@/store";
import { baseSupplyModeList, upgradeSupplyModeList } from "@/views/goods/grounding/constants/data"; import { baseSupplyModeList, upgradeSupplyModeList } from "@/views/goods/grounding/constants/data";
import { financeCheckFlagList, inventoryTypeList, sellPriceTempValidStatusList, statusList } from "@/views/goods/grounding/constants/index"; import { financeCheckFlagList, inventoryTypeList, productCostTypeList, sellPriceTempValidStatusList, statusList } from "@/views/goods/grounding/constants/index";
import { priceFilter } from "@/views/goods/grounding/utils/number"; import { priceFilter } from "@/views/goods/grounding/utils/number";
export async function getSearchFromSchema(_refreshTableFn) { export async function getSearchFromSchema(_refreshTableFn) {
...@@ -158,6 +158,15 @@ export async function getSearchFromSchema(_refreshTableFn) { ...@@ -158,6 +158,15 @@ export async function getSearchFromSchema(_refreshTableFn) {
name: "cityCodeList", name: "cityCodeList",
addHtml: "applicableAreaSelect", addHtml: "applicableAreaSelect",
}, },
{
label: "商品成本带入方式",
name: "productCostType",
type: "select",
optionList: cloneDeep(productCostTypeList),
optionId: "confId",
optionLabel: "confValue",
optionsName: "productCostTypeList",
},
]; ];
}; };
...@@ -377,6 +386,11 @@ export async function getTableSchema() { ...@@ -377,6 +386,11 @@ export async function getTableSchema() {
}, },
}, },
{ {
label: "商品成本带入方式",
prop: "productCostTypeStr",
width: "150",
},
{
label: "校验最低价", label: "校验最低价",
prop: "", prop: "",
addHtml: "validMinSellPrice", addHtml: "validMinSellPrice",
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="header"> <div class="header">
<d2-search ref="showSearch" <d2-search ref="showSearch"
class="show-search" class="show-search"
label-width="100px" label-width="140px"
:form-data="searchFormSchema" :form-data="searchFormSchema"
:search-form="searchForm"> :search-form="searchForm">
<template #goodsCascader> <template #goodsCascader>
...@@ -217,7 +217,8 @@ import merchantIcon from "@/views/goods/grounding/images/merchant_icon.png"; ...@@ -217,7 +217,8 @@ import merchantIcon from "@/views/goods/grounding/images/merchant_icon.png";
import { getSearchFromSchema, getTableSchema } from "./index.data.js"; import { getSearchFromSchema, getTableSchema } from "./index.data.js";
export default { export default {
name: "GroundingIndex", // 需与路由 name 一致,d2admin keep-alive include 按路由名匹配
name: "grounding",
components: { components: {
BatchCopyDialog: batchCopyDialog, BatchCopyDialog: batchCopyDialog,
BatchModifyInventoryDialog, BatchModifyInventoryDialog,
...@@ -225,6 +226,7 @@ export default { ...@@ -225,6 +226,7 @@ export default {
}, },
data() { data() {
return { return {
isFirstActivated: true,
loading: { loading: {
page: false, page: false,
}, },
...@@ -248,6 +250,7 @@ export default { ...@@ -248,6 +250,7 @@ export default {
goodsSource: 0, goodsSource: 0,
financeCheckFlag: "", financeCheckFlag: "",
inventoryType: "", inventoryType: "",
productCostType: "",
cityCodeList: [], cityCodeList: [],
}, },
tempGoodsType: [], tempGoodsType: [],
...@@ -308,6 +311,16 @@ export default { ...@@ -308,6 +311,16 @@ export default {
this.loading.page = false; this.loading.page = false;
} }
}, },
activated() {
// 首次进入由 mounted + d2-table 自动拉取;从编辑/查看返回时保留筛选并刷新列表
if (this.isFirstActivated) {
this.isFirstActivated = false;
return;
}
this.$nextTick(() => {
this.$refs.groundingIndexTable && this.$refs.groundingIndexTable.refreshTable(false, false);
});
},
methods: { methods: {
...mapActions({ ...mapActions({
get: "d2admin/base/get", get: "d2admin/base/get",
...@@ -445,6 +458,7 @@ export default { ...@@ -445,6 +458,7 @@ export default {
goodsSource: 0, goodsSource: 0,
financeCheckFlag: "", financeCheckFlag: "",
inventoryType: "", inventoryType: "",
productCostType: "",
}; };
this.tempGoodsType = []; this.tempGoodsType = [];
this.applicableAreas = []; this.applicableAreas = [];
......
...@@ -27,6 +27,7 @@ import { deepClone } from "@/common/util"; ...@@ -27,6 +27,7 @@ import { deepClone } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import { convertYuanToWan, filterSpecsStr } from "@/views/goods/filterOption"; import { convertYuanToWan, filterSpecsStr } from "@/views/goods/filterOption";
import { packageGoodsForm } from "@/views/goods/grounding/index.js"; import { packageGoodsForm } from "@/views/goods/grounding/index.js";
import { isSelfOperatedEquityExtended } from "@/views/goods/grounding/utils/productCost";
import PackageForm from "@/views/goods/packageManage/components/packageForm/index.vue"; import PackageForm from "@/views/goods/packageManage/components/packageForm/index.vue";
export default { export default {
...@@ -208,7 +209,7 @@ export default { ...@@ -208,7 +209,7 @@ export default {
position: "", // 上架部位 position: "", // 上架部位
sellPrice: "", // 参考售价 sellPrice: "", // 参考售价
minSellPrice: "", // 最低售价 minSellPrice: "", // 最低售价
warrantyType: "", // 质保卡类型 warrantyType: 0, // 质保卡类型,默认质保卡
upgradeSupplyMode: "", // 升级产品供货模式 upgradeSupplyMode: "", // 升级产品供货模式
upgradeProductCost: "", // 升级产品成本 upgradeProductCost: "", // 升级产品成本
recoveryCost: "", // 回收成本 recoveryCost: "", // 回收成本
...@@ -216,6 +217,8 @@ export default { ...@@ -216,6 +217,8 @@ export default {
djCost: "", // 嘀加成本 djCost: "", // 嘀加成本
thirdPartyCost: "", // 第三方成本 thirdPartyCost: "", // 第三方成本
validMinSellPriceFlag: false, // 是否校验最低价 validMinSellPriceFlag: false, // 是否校验最低价
serviceItemId: "", // 服务项目
productCostType: "", // 商品成本带入方式,不默认选中
}, },
], ],
voucherList: [], // 上架凭证 voucherList: [], // 上架凭证
...@@ -287,13 +290,19 @@ export default { ...@@ -287,13 +290,19 @@ export default {
minSellPrice: val?.minSellPrice, // 最低售价 minSellPrice: val?.minSellPrice, // 最低售价
validMinSellPriceFlag: val?.validMinSellPrice === "Y", // 是否校验最低价 validMinSellPriceFlag: val?.validMinSellPrice === "Y", // 是否校验最低价
warrantyPeriod: val?.upgradeGoods?.warrantyPeriod, // 质保年限 warrantyPeriod: val?.upgradeGoods?.warrantyPeriod, // 质保年限
warrantyType: val?.warrantyType, // 质保卡类型 warrantyType: val?.warrantyType === "" || val?.warrantyType === null || val?.warrantyType === undefined
? 0
: val?.warrantyType, // 质保卡类型,默认质保卡
upgradeSupplyMode: val?.upgradeSupplyMode, // 升级、产品供货模式 upgradeSupplyMode: val?.upgradeSupplyMode, // 升级、产品供货模式
upgradeProductCost: val?.upgradeProductCost, // 升级产品成本 upgradeProductCost: val?.upgradeProductCost, // 升级产品成本
recoveryCost: val?.recoveryCost, // 回收成本 recoveryCost: val?.recoveryCost, // 回收成本
virtualAccountCost: val?.virtualAccountCost, // 虚拟对账成本 virtualAccountCost: val?.virtualAccountCost, // 虚拟对账成本
djCost: val?.djCost, // 嘀加成本 djCost: val?.djCost, // 嘀加成本
thirdPartyCost: val?.thirdPartyCost, // 第三方成本 thirdPartyCost: val?.thirdPartyCost, // 第三方成本
serviceItemId: val?.serviceItemId ?? "", // 服务项目
productCostType: val?.productCostType === 0 || val?.productCostType === 1 || val?.productCostType === "0" || val?.productCostType === "1"
? Number(val.productCostType)
: "", // 商品成本带入方式
supplierCode: val?.goodsInfo?.supplierCode, // 供应方 supplierCode: val?.goodsInfo?.supplierCode, // 供应方
upgradeGoods: { upgradeGoods: {
...val?.upgradeGoods, ...val?.upgradeGoods,
...@@ -331,7 +340,6 @@ export default { ...@@ -331,7 +340,6 @@ export default {
this.show = true; this.show = true;
}, },
handleAddClose() { handleAddClose() {
this.close({ tagName: "/packageManage" });
this.$router.push({ name: "packageManage" }); this.$router.push({ name: "packageManage" });
this.close({ tagName: "/editPackage" }); this.close({ tagName: "/editPackage" });
}, },
...@@ -395,7 +403,7 @@ export default { ...@@ -395,7 +403,7 @@ export default {
}); });
const merchantGoodsInfoList = []; const merchantGoodsInfoList = [];
data?.groundingGoodsList?.forEach((val) => { // 套餐产品数据处理 data?.groundingGoodsList?.forEach((val) => { // 套餐产品数据处理
merchantGoodsInfoList.push({ const item = {
id: val.id, id: val.id,
upgradeGoodsId: val.upgradeGoodsId, upgradeGoodsId: val.upgradeGoodsId,
position: val?.position || undefined, position: val?.position || undefined,
...@@ -413,7 +421,16 @@ export default { ...@@ -413,7 +421,16 @@ export default {
recoveryCost: val?.recoveryCost, // 回收成本 recoveryCost: val?.recoveryCost, // 回收成本
upgradeSupplyMode: val?.upgradeSupplyMode || "", // 升级产品供货模式 upgradeSupplyMode: val?.upgradeSupplyMode || "", // 升级产品供货模式
warrantyType: val?.warrantyType, // 质保卡类型 warrantyType: val?.warrantyType, // 质保卡类型
}); serviceItemId: val?.serviceItemId || undefined, // 服务项目 id
productCostType: val?.productCostType === 0 || val?.productCostType === 1 || val?.productCostType === "0" || val?.productCostType === "1"
? Number(val.productCostType)
: undefined, // 0-自定义成本 1-默认带入产品成本
};
// 自营延保/权益不传商品成本带入方式,沿用旧规则
if (isSelfOperatedEquityExtended(val?.goodsType, val?.supplierCode)) {
delete item.productCostType;
}
merchantGoodsInfoList.push(item);
}); });
// 整理上传凭证数据 // 整理上传凭证数据
const params = { const params = {
...@@ -519,18 +536,18 @@ export default { ...@@ -519,18 +536,18 @@ export default {
return param; return param;
}, },
handleClose(isRefresh = false) { handleClose(isRefresh = false) {
if (isRefresh) { const goBack = () => {
this.close({ tagName: "/packageManage" });
this.$router.push({ name: "packageManage" }); this.$router.push({ name: "packageManage" });
this.close({ tagName: "/packageManage" }); this.close({ tagName: "/editPackage" });
};
if (isRefresh) {
goBack();
} else { } else {
this.$confirm("内容未保存,是否返回?", "提示", { this.$confirm("内容未保存,是否返回?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
type: "warning", type: "warning",
}).then(() => { }).then(() => {
this.close({ tagName: "/packageManage" }); goBack();
this.$router.push({ name: "packageManage" });
this.close({ tagName: "/packageManage" });
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);
}); });
......
...@@ -3,7 +3,7 @@ import { getParkStore } from "@api/editCustomer"; ...@@ -3,7 +3,7 @@ import { getParkStore } from "@api/editCustomer";
import { getAreaDataList, getBaseSceneCodeList } from "@api/productManage"; import { getAreaDataList, getBaseSceneCodeList } from "@api/productManage";
import { cloneDeep, isFunction } from "lodash-es"; import { cloneDeep, isFunction } from "lodash-es";
import { Util } from "@/common/util"; import { Util } from "@/common/util";
import { financeCheckFlagList, inventoryTypeList, priceFilter, statusList } from "@/views/goods/grounding"; import { financeCheckFlagList, inventoryTypeList, priceFilter, productCostTypeList, statusList } from "@/views/goods/grounding";
export async function getSearchFormSchema(_refreshTable) { export async function getSearchFormSchema(_refreshTable) {
const refreshTable = isFunction(_refreshTable) ? _refreshTable : () => {}; const refreshTable = isFunction(_refreshTable) ? _refreshTable : () => {};
...@@ -98,6 +98,39 @@ export async function getSearchFormSchema(_refreshTable) { ...@@ -98,6 +98,39 @@ export async function getSearchFormSchema(_refreshTable) {
name: "applicableArea", name: "applicableArea",
addHtml: "applicableAreaSelect", addHtml: "applicableAreaSelect",
}, },
{
label: "商品成本带入方式",
name: "productCostType",
type: "select",
optionList: cloneDeep(productCostTypeList),
optionId: "confId",
optionLabel: "confValue",
optionsName: "productCostTypeList",
},
{
label: "产品ID",
name: "productId",
maxlength: "50",
type: "input",
isClear: true,
keyFn: refreshTable,
},
{
label: "产品名称",
name: "productName",
maxlength: "50",
type: "input",
isClear: true,
keyFn: refreshTable,
},
{
label: "产品编码",
name: "productCode",
maxlength: "50",
type: "input",
isClear: true,
keyFn: refreshTable,
},
]; ];
} }
...@@ -197,6 +230,12 @@ export async function getTableColumnsSchema() { ...@@ -197,6 +230,12 @@ export async function getTableColumnsSchema() {
}, },
}, },
{ {
label: "商品成本带入方式",
prop: "productCostTypeStr",
width: "150",
},
{
label: "上架门店", label: "上架门店",
name: "", name: "",
type: "slot", type: "slot",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<d2-search v-if="searchFormSchema.length" <d2-search v-if="searchFormSchema.length"
ref="showSearch" ref="showSearch"
class="show-search" class="show-search"
label-width="100px" label-width="140px"
:form-data="searchFormSchema" :form-data="searchFormSchema"
:search-form="searchForm"> :search-form="searchForm">
<template #matchPackageCode> <template #matchPackageCode>
...@@ -173,7 +173,8 @@ import BatchModifyPackageInventoryDialog from "@/views/goods/packageManage/compo ...@@ -173,7 +173,8 @@ import BatchModifyPackageInventoryDialog from "@/views/goods/packageManage/compo
import { getSearchFormSchema, getTableColumnsSchema } from "./index.data.js"; import { getSearchFormSchema, getTableColumnsSchema } from "./index.data.js";
export default { export default {
name: "PackageManage", // 需与路由 name 一致,d2admin keep-alive include 按路由名匹配
name: "packageManage",
components: { components: {
// ApplicableAreaSelect, // ApplicableAreaSelect,
BatchModifyPackageInventoryDialog, BatchModifyPackageInventoryDialog,
...@@ -181,6 +182,7 @@ export default { ...@@ -181,6 +182,7 @@ export default {
}, },
data() { data() {
return { return {
isFirstActivated: true,
images: { images: {
merchantIcon, merchantIcon,
}, },
...@@ -200,6 +202,10 @@ export default { ...@@ -200,6 +202,10 @@ export default {
goodsSource: 0, goodsSource: 0,
financeCheckFlag: "", financeCheckFlag: "",
inventoryType: "", inventoryType: "",
productCostType: "",
productId: "",
productName: "",
productCode: "",
}, },
getListApi: getPackageManageList, getListApi: getPackageManageList,
searchFormSchema: [], searchFormSchema: [],
...@@ -238,6 +244,16 @@ export default { ...@@ -238,6 +244,16 @@ export default {
this.loading.page = false; this.loading.page = false;
} }
}, },
activated() {
// 首次进入由 mounted + d2-table 自动拉取;从编辑/查看返回时保留筛选并刷新列表
if (this.isFirstActivated) {
this.isFirstActivated = false;
return;
}
this.$nextTick(() => {
this.$refs.packageIndexTable && this.$refs.packageIndexTable.refreshTable(false, false);
});
},
methods: { methods: {
...mapActions({ ...mapActions({
get: "d2admin/base/get", get: "d2admin/base/get",
...@@ -273,6 +289,10 @@ export default { ...@@ -273,6 +289,10 @@ export default {
goodsSource: 0, goodsSource: 0,
financeCheckFlag: "", financeCheckFlag: "",
inventoryType: "", inventoryType: "",
productCostType: "",
productId: "",
productName: "",
productCode: "",
}; };
this.applicableAreas = []; this.applicableAreas = [];
// 重新查询 // 重新查询
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!