Commit a41f417e by Jaxon

style: 格式调整

1 parent 64d41875
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"dist", "dist",
".git" ".git"
] ]
// 对齐 Webpack 的 extensions 优先级 // 对齐 Webpack 的 extensions 优先级
// "extensions": [".vue", ".js", ".ts", ".json"] // "extensions": [".vue", ".js", ".ts", ".json"]
} }
...@@ -115,7 +115,7 @@ let baseConfig = config; ...@@ -115,7 +115,7 @@ let baseConfig = config;
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取 // 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
fetch( fetch(
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config", "https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config-sj",
) )
.then( .then(
(response) => { (response) => {
......
This diff could not be displayed because it is too large.
<!-- 上架编辑 --> <!-- 上架编辑 -->
<template> <template>
<d2-container class="edit-commodity" v-loading="!show"> <d2-container v-loading="!show" class="edit-commodity">
<div class="" v-if="show"> <div v-if="show" class="">
<grounding-form ref="d2GroundingForm" :add-or-edit="addOrEdit" :form-ref="proFormRef" :origin-data="editData" <GroundingForm ref="d2GroundingForm"
:form-list="editForm" :second-goods-list="secondGoodsList" @handleAddConfirm="handleAddConfirm" :add-or-edit="addOrEdit"
@handleClose="handleAddClose" :position-type-list="positionTypeList"></grounding-form> :form-ref="proFormRef"
</div> :origin-data="editData"
</d2-container> :form-list="editForm"
:second-goods-list="secondGoodsList"
:position-type-list="positionTypeList"
@handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose">
</GroundingForm>
</div>
</d2-container>
</template> </template>
<script> <script>
import { productList, baseSupplyModeList, upgradeSupplyModeList } from "./constants/data" import { addOrUpdateAPI, checkGroundingLog, getMerchantGoodsInfo } from "@api/grounding";
import { getMerchantGoodsInfo, addOrUpdateAPI, checkGroundingLog } from '@api/grounding' import { mapActions } from "vuex";
import groundingForm from "./components/groundingForm.vue" import { BaseData, sceneCodeList } from "@/common/constants.js";
import { BaseData, sceneCodeList } from '@/common/constants.js' import { deepClone } from "@/common/util";
import { mapActions } from 'vuex' import { baseConfig } from "@/main";
import { deepClone } from '@/common/util' import { convertYuanToWan, filterSpecsStr } from "../filterOption";
import { baseConfig } from '@/main' import groundingForm from "./components/groundingForm.vue";
import { filterSpecsStr, convertYuanToWan } from "../filterOption" import { baseSupplyModeList, productList, upgradeSupplyModeList } from "./constants/data";
export default { export default {
name: 'EditGrounding', name: "EditGrounding",
components: { components: {
groundingForm GroundingForm: groundingForm,
}, },
data() { data() {
return { return {
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类 extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
show: false, show: false,
addOrEdit: 'add', addOrEdit: "add",
proFormRef: 'pro', proFormRef: "pro",
editForm: [{ editForm: [{
title: '商品信息', title: "商品信息",
formBlock: [{ formBlock: [
name: 'upgradeGoodsId', {
label: '上架商品', name: "upgradeGoodsId",
isRequired: true, label: "上架商品",
type: 'searchSelect', isRequired: true,
optionList: [], type: "searchSelect",
isClear: false, optionList: [],
optionId: 'confId', isClear: false,
optionNameLabel: 'confNameValue', optionId: "confId",
optionTypeNameLabel: 'confTypeNameValue', optionNameLabel: "confNameValue",
width: '432px' optionTypeNameLabel: "confTypeNameValue",
}, { width: "432px",
type: 'incidBox', },
key: 'goodsType', {
detailInfo: [{ type: "incidBox",
label: '商品名称', key: "goodsType",
value: 'upgradeGoodsName' detailInfo: [
}, { {
label: '规格', label: "商品名称",
value: 'specificationData' value: "upgradeGoodsName",
}, { },
label: '商品编码', {
value: 'type' label: "规格",
}, { value: "specificationData",
label: '第三方编码', },
value: 'thirdPartyCode' {
}, { label: "商品编码",
label: '采购价', value: "type",
value: 'purchasePrice', },
unit: true {
}, { label: "第三方编码",
label: '参考售价', value: "thirdPartyCode",
value: 'upgradePrice', },
unit: true {
}, { label: "采购价",
label: '适用车型', value: "purchasePrice",
value: 'carTypeConfigName' unit: true,
}, { },
label: '所属系列', {
value: 'goodsName' label: "参考售价",
}, { value: "upgradePrice",
label: '所属分类', unit: true,
value: 'tempGoodsTypeName' },
}, { {
label: '商品ID', label: "适用车型",
value: 'upgradeCommodityCode' value: "carTypeConfigName",
}] },
}, { {
name: 'position', label: "所属系列",
label: '上架部位', value: "goodsName",
type: 'radio', },
radioGroupList: [] {
}, { label: "所属分类",
name: 'goodsAlias', value: "tempGoodsTypeName",
label: '商品别名', },
type: 'input', {
maxlength: 50, label: "商品ID",
width: '432px' value: "upgradeCommodityCode",
}, { },
name: 'warrantyType', ],
label: '质保卡类型', },
type: 'select', {
isClear: false, name: "position",
optionList: [{ label: "上架部位",
confId: 0, type: "radio",
confName: '质保卡' radioGroupList: [],
}, { },
confId: 1, {
confName: '质保权益卡' name: "goodsAlias",
}], label: "商品别名",
optionId: 'confId', type: "input",
optionLabel: 'confName', maxlength: 50,
width: '432px' width: "432px",
}, { },
name: 'productType', {
label: '产品类型', name: "warrantyType",
type: 'check', label: "质保卡类型",
checkGroupList: [] type: "select",
}, { isClear: false,
name: 'baseSupplyMode', optionList: [{
label: '基础产品供货模式', confId: 0,
type: 'radio', confName: "质保卡",
index: 1, }, {
radioGroupList: [] confId: 1,
}, { confName: "质保权益卡",
name: 'upgradeSupplyMode', }],
label: '升级/产品供货模式', optionId: "confId",
type: 'radio', optionLabel: "confName",
index: 2, width: "432px",
radioGroupList: [] },
}, { {
name: 'sellPrice', name: "productType",
label: '售价', label: "产品类型",
type: 'input', type: "check",
width: '432px', checkGroupList: [],
unit: true, },
handleInput: true {
}, { name: "baseSupplyMode",
name: 'minSellPrice', label: "基础产品供货模式",
label: '最低售价', type: "radio",
type: 'input', index: 1,
width: '432px', radioGroupList: [],
unit: true, },
handleInput: true {
}, { name: "upgradeSupplyMode",
name: 'upgradeProductCost', label: "升级/产品供货模式",
label: '产品、升级成本', type: "radio",
type: 'input', index: 2,
width: '432px', radioGroupList: [],
unit: true, },
handleInput: true {
}, { name: "sellPrice",
name: 'giftCost', label: "售价",
label: '赠送成本', type: "input",
type: 'input', width: "432px",
width: '432px', unit: true,
unit: true, handleInput: true,
handleInput: true },
}, { {
name: 'recoveryCost', name: "minSellPrice",
label: '回收成本', label: "最低售价",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { },
name: 'virtualAccountCost', {
label: '虚拟对账成本', name: "upgradeProductCost",
type: 'input', label: "产品、升级成本",
width: '432px', type: "input",
unit: true, width: "432px",
handleInput: true unit: true,
}, { handleInput: true,
name: 'djCost', },
label: '嘀加成本', {
type: 'input', name: "giftCost",
width: '432px', label: "赠送成本",
unit: true, type: "input",
isDisabled: false, width: "432px",
handleInput: true unit: true,
}, { handleInput: true,
name: 'thirdPartyCost', },
label: '第三方成本', {
type: 'input', name: "recoveryCost",
width: '432px', label: "回收成本",
unit: true, type: "input",
handleInput: true width: "432px",
}, { unit: true,
name: 'financeCheckFlag', handleInput: true,
label: '财务规则校验', },
type: 'flagRadio', {
radioGroupList: [{ name: "virtualAccountCost",
label: '关闭', label: "虚拟对账成本",
value: 'N' type: "input",
}, { width: "432px",
label: '开启', unit: true,
value: 'Y' handleInput: true,
}] },
}] {
}, { name: "djCost",
title: '门店信息', label: "嘀加成本",
formBlock: [{ type: "input",
name: 'sceneType', width: "432px",
label: '业务场景', unit: true,
isRequired: true, isDisabled: false,
type: 'select', handleInput: true,
isClear: false, },
optionList: [], {
optionId: 'confId', name: "thirdPartyCost",
optionLabel: 'confValue', label: "第三方成本",
width: '432px' type: "input",
}, { width: "432px",
name: 'merchantGoodsRefList', unit: true,
label: '上架门店', handleInput: true,
isRequired: true, },
type: 'button' {
}, { name: "financeCheckFlag",
name: 'voucherList', label: "财务规则校验",
label: '上架凭证', type: "flagRadio",
type: 'upload', radioGroupList: [{
topTips: '支持扩展名:.pdf .jpg .png', label: "关闭",
tips: '注:最多可上传30个文件', value: "N",
maxPhotoNum: 30 }, {
}] label: "开启",
}], value: "Y",
editData: { }],
merchantGoodsRefList: [], },
sceneCode: '', ],
upgradeGoodsId: '', }, {
goodsCode: '', title: "门店信息",
positionNames: '', formBlock: [{
goodsType: '', name: "sceneType",
productType: [], label: "业务场景",
sceneCode: '', isRequired: true,
baseSupplyMode: '', type: "select",
upgradeSupplyMode: '', isClear: false,
sellPrice: '', optionList: [],
minSellPrice: '', optionId: "confId",
giveCostPrice: '', optionLabel: "confValue",
recoveryCostPrice: '', width: "432px",
reconcilyCostPrice: '', }, {
voucherList: [], name: "merchantGoodsRefList",
validMinSellPriceFlag: true, label: "上架门店",
validMinSellPrice: 'Y', isRequired: true,
financeCheckFlag: 'N' type: "button",
}, }, {
secondGoodsList: [], name: "voucherList",
goodsNameKeyword: '', label: "上架凭证",
currentPage: 1, type: "upload",
pageSize: 20, topTips: "支持扩展名:.pdf .jpg .png",
positionTypeList: [], // 太阳膜类商品部位 tips: "注:最多可上传30个文件",
filterSpecsStr maxPhotoNum: 30,
} }],
}, }],
mounted() { editData: {
this.getBaseData() merchantGoodsRefList: [],
const id = this.$route.query.id sceneCode: "",
if (!id) { upgradeGoodsId: "",
this.$nextTick(() => { goodsCode: "",
this.show = true positionNames: "",
}) goodsType: "",
} else { productType: [],
this.addOrEdit = 'edit' sceneCode: "",
// 获取商品详情 baseSupplyMode: "",
this.getDetailInfo(id) upgradeSupplyMode: "",
} sellPrice: "",
}, minSellPrice: "",
methods: { giveCostPrice: "",
...mapActions({ recoveryCostPrice: "",
get: 'd2admin/base/get', reconcilyCostPrice: "",
close: 'd2admin/page/close' voucherList: [],
}), validMinSellPriceFlag: true,
async getBaseData() { validMinSellPrice: "Y",
this.editForm.forEach(item => { financeCheckFlag: "N",
item.formBlock && item.formBlock.forEach(v => { },
if (v.type == 'check') { secondGoodsList: [],
v.checkGroupList = productList // 产品类型 goodsNameKeyword: "",
} else if (v.type == 'radio') { currentPage: 1,
if (v.index == 1) { pageSize: 20,
v.radioGroupList = baseSupplyModeList // 基础供货模式 positionTypeList: [], // 太阳膜类商品部位
} else if (v.index == 2) { filterSpecsStr,
v.radioGroupList = upgradeSupplyModeList // 升级供货模式 };
} else { },
v.radioGroupList = [] mounted() {
} this.getBaseData();
} const id = this.$route.query.id;
if (v.name == 'sceneType') { // 业务场景 if (!id) {
v.optionList = sceneCodeList this.$nextTick(() => {
} this.show = true;
}) });
}) } else {
this.positionTypeList = await this.get(BaseData.positionTypeList) this.addOrEdit = "edit";
}, // 获取商品详情
getDetailInfo(id) { this.getDetailInfo(id);
getMerchantGoodsInfo({ id }).then(res => { }
const productType = [] },
const positionNamesArr = deepClone(this.positionTypeList)?.filter(val => (res?.upgradeGoods.position?.split(','))?.includes(val.position + '')) || [] methods: {
if (res?.upgradeProductFlag == 'Y') productType.push(2) ...mapActions({
if (res?.baseProductFlag == 'Y') productType.push(1) get: "d2admin/base/get",
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = res.goodsInfo || {} close: "d2admin/page/close",
const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName] }),
const result = types.filter(type => type).join('-') async getBaseData() {
res.productType = productType // 产品类型 this.editForm.forEach((item) => {
res.positionNamesArr = positionNamesArr item.formBlock && item.formBlock.forEach((v) => {
res.supplierCode = res?.goodsInfo?.supplierCode // 供应方code if (v.type == "check") {
res.validMinSellPriceFlag = res?.validMinSellPrice == 'Y' // 是否校验最低价 v.checkGroupList = productList; // 产品类型
res.supplierCode = res?.goodsInfo?.supplierCode } else if (v.type == "radio") {
res.financeCheckFlag = res.financeCheckFlag if (v.index == 1) {
res.voucherList.forEach(val => { // 处理上传进度 默认进度100% v.radioGroupList = baseSupplyModeList; // 基础供货模式
if (val.voucherFileUrl) val.uploadProgress = 100 } else if (v.index == 2) {
}) v.radioGroupList = upgradeSupplyModeList; // 升级供货模式
res.merchantGoodsRefList = res.merchantGoodsRefList || [] // 上架门店 } else {
res.voucherList = res.voucherList || [] // 上架凭证 v.radioGroupList = [];
res.upgradeGoods = { }
...res?.upgradeGoods, }
goodsName: res.goodsInfo.goodsName, if (v.name == "sceneType") { // 业务场景
tempGoodsTypeName: result, v.optionList = sceneCodeList;
serviceItemNames: res?.upgradeGoods?.upgradeGoodsServiceItemsList?.map(item => { }
return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ''}` });
})?.join(','), // 服务项目 });
positionNames: positionNamesArr.length ? positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '', this.positionTypeList = await this.get(BaseData.positionTypeList);
specificationData: this.filterSpecsStr(res?.upgradeGoods), },
carTypeConfigName: res?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'), getDetailInfo(id) {
upgradeCommodityCode: res?.upgradeGoods?.commodityCode getMerchantGoodsInfo({ id }).then((res) => {
} const productType = [];
this.editData = res || {} const positionNamesArr = deepClone(this.positionTypeList)?.filter(val => (res?.upgradeGoods.position?.split(","))?.includes(val.position + "")) || [];
this.$nextTick(() => { if (res?.upgradeProductFlag == "Y")
this.show = true productType.push(2);
}) if (res?.baseProductFlag == "Y")
}) productType.push(1);
}, const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = res.goodsInfo || {};
filterEmpty(data) { const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName];
return (data ?? '') === '' const result = types.filter(type => type).join("-");
}, res.productType = productType; // 产品类型
handleAddClose() { res.positionNamesArr = positionNamesArr;
this.close({ tagName: '/grounding' }) res.supplierCode = res?.goodsInfo?.supplierCode; // 供应方code
this.$router.push({ name: 'grounding' }) res.validMinSellPriceFlag = res?.validMinSellPrice == "Y"; // 是否校验最低价
this.close({ tagName: '/editGrounding' }) res.supplierCode = res?.goodsInfo?.supplierCode;
}, res.financeCheckFlag = res.financeCheckFlag;
handleAddConfirm(data) { res.voucherList.forEach((val) => { // 处理上传进度 默认进度100%
const { num } = data if (val.voucherFileUrl)
this.confirm(num, data) val.uploadProgress = 100;
}, });
confirm(num, data, existCheck = true) { res.merchantGoodsRefList = res.merchantGoodsRefList || []; // 上架门店
// 1保存并上架 2存草稿 res.voucherList = res.voucherList || []; // 上架凭证
const formObj = {} res.upgradeGoods = {
this.editForm.forEach(val => { ...res?.upgradeGoods,
val.formBlock.forEach(v => { goodsName: res.goodsInfo.goodsName,
if (v.name) formObj[v.name] = data[v.name] tempGoodsTypeName: result,
if (v.name == 'productType') { serviceItemNames: res?.upgradeGoods?.upgradeGoodsServiceItemsList?.map((item) => {
formObj.baseProductFlag = data[v.name].includes(1) ? 'Y' : 'N' return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ""}`;
formObj.upgradeProductFlag = data[v.name].includes(2) ? 'Y' : 'N' })?.join(","), // 服务项目
} positionNames: positionNamesArr.length
}) ? positionNamesArr.map((subItem) => {
}) return subItem?.confName;
const arr = [] }).join("/")
data?.merchantGoodsRefList?.forEach(val => { // 上架门店组合数据 防止请求参数过长 : "",
arr.push({ specificationData: this.filterSpecsStr(res?.upgradeGoods),
merchantId: val.merchantId, carTypeConfigName: res?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join("/"),
merchantName: val.merchantName upgradeCommodityCode: res?.upgradeGoods?.commodityCode,
}) };
}) this.editData = res || {};
const fileArr = [] this.$nextTick(() => {
data?.voucherList?.forEach(val => { // 处理上传凭证数据 删除或取消上传并不会删除数组 只是将url置空 this.show = true;
if (val.voucherFileUrl) { });
fileArr.push({ });
voucherFileUrl: val.voucherFileUrl, },
fileSize: val.fileSize, filterEmpty(data) {
fileName: val.fileName return (data ?? "") === "";
}) },
} handleAddClose() {
}) this.close({ tagName: "/grounding" });
// 整理上传凭证数据 this.$router.push({ name: "grounding" });
delete formObj?.productType this.close({ tagName: "/editGrounding" });
const params = { },
saveDraft: num === 2, // 是否存草稿 handleAddConfirm(data) {
id: data.id, const { num } = data;
...formObj, this.confirm(num, data);
merchantGoodsRefList: arr, },
voucherList: fileArr, confirm(num, data, existCheck = true) {
existCheck, // 1保存并上架 2存草稿
validMinSellPrice: data?.validMinSellPrice const formObj = {};
} this.editForm.forEach((val) => {
if (data?.goodsType == 1 && data?.sceneType != 1) return this.$message.warning('太阳膜类商品仅支持上架至精品升级场景') val.formBlock.forEach((v) => {
if (this.extendedPosiType.includes(data.goodsType) && data?.sceneType != 0) return this.$message.warning('延保类商品仅支持上架至会员/权益升级场景') if (v.name)
this.editData = data formObj[v.name] = data[v.name];
const checkParams = { if (v.name == "productType") {
id: data.id || '', formObj.baseProductFlag = data[v.name].includes(1) ? "Y" : "N";
upgradeGoodsId: formObj.upgradeGoodsId, formObj.upgradeProductFlag = data[v.name].includes(2) ? "Y" : "N";
position: formObj.position || '', }
sceneType: formObj.sceneType, });
merchantIdList: arr?.map(val => { return val.merchantId }) });
} const arr = [];
if ((num == 1 || num == 3) && !baseConfig.supplierCode.includes(data.supplierCode)) { // 第三方商品无需走审核流程不用提示 data?.merchantGoodsRefList?.forEach((val) => { // 上架门店组合数据 防止请求参数过长
this.$confirm('<p>上架信息保存后,自动进入上架审核流程</p>是否确定保存?', '提示', { arr.push({
confirmButtonText: '确定', merchantId: val.merchantId,
dangerouslyUseHTMLString: true, merchantName: val.merchantName,
type: 'warning' });
}).then(() => { });
// 校验上架记录中是否已存在 const fileArr = [];
this.checkEvent(checkParams, params, num) data?.voucherList?.forEach((val) => { // 处理上传凭证数据 删除或取消上传并不会删除数组 只是将url置空
}).catch(err => { if (val.voucherFileUrl) {
console.log(err) fileArr.push({
}) voucherFileUrl: val.voucherFileUrl,
} else { fileSize: val.fileSize,
// 校验上架记录中是否已存在 fileName: val.fileName,
this.checkEvent(checkParams, params, num) });
} }
}, });
checkEvent(checkParams, params, num) { // 整理上传凭证数据
checkGroundingLog(this.dealObjectValue(checkParams)).then(res => { delete formObj?.productType;
if (res >= 1) { const params = {
this.$confirm('当前商品在对应门店已存在上架记录,是否确定保存?', '提示', { saveDraft: num === 2, // 是否存草稿
confirmButtonText: '确定', id: data.id,
type: 'warning' ...formObj,
}).then(() => { merchantGoodsRefList: arr,
this.confirmEvent(params, num) voucherList: fileArr,
}) existCheck,
} else { validMinSellPrice: data?.validMinSellPrice,
this.confirmEvent(params, num) };
} if (data?.goodsType == 1 && data?.sceneType != 1)
}) return this.$message.warning("太阳膜类商品仅支持上架至精品升级场景");
}, if (this.extendedPosiType.includes(data.goodsType) && data?.sceneType != 0)
confirmEvent(params, num) { return this.$message.warning("延保类商品仅支持上架至会员/权益升级场景");
const obj = { // 商品信息 this.editData = data;
position: '', const checkParams = {
goodsAlias: '', id: data.id || "",
warrantyType: '', upgradeGoodsId: formObj.upgradeGoodsId,
productType: [], position: formObj.position || "",
baseSupplyMode: '', sceneType: formObj.sceneType,
upgradeSupplyMode: '', merchantIdList: arr?.map((val) => {
sellPrice: '', return val.merchantId;
minSellPrice: '', }),
upgradeProductCost: '', };
giftCost: '', if ((num == 1 || num == 3) && !baseConfig.supplierCode.includes(data.supplierCode)) { // 第三方商品无需走审核流程不用提示
recoveryCost: '', this.$confirm("<p>上架信息保存后,自动进入上架审核流程</p>是否确定保存?", "提示", {
virtualAccountCost: '', confirmButtonText: "确定",
validMinSellPrice: 'Y', dangerouslyUseHTMLString: true,
djCost: '', type: "warning",
thirdPartyCost: '' }).then(() => {
} // 校验上架记录中是否已存在
addOrUpdateAPI(this.dealObjectValue(params)).then(res => { this.checkEvent(checkParams, params, num);
this.notice.okTips() }).catch((err) => {
if (num == 3) { console.log(err);
// 保留 上架商品和上架门店上架凭证数据 });
this.editData = { } else {
...this.editData, // 校验上架记录中是否已存在
...obj this.checkEvent(checkParams, params, num);
} }
} else { // 保存后跳转列表页 },
this.handleClose(true) checkEvent(checkParams, params, num) {
} checkGroundingLog(this.dealObjectValue(checkParams)).then((res) => {
}) if (res >= 1) {
}, this.$confirm("当前商品在对应门店已存在上架记录,是否确定保存?", "提示", {
dealObjectValue(obj) { confirmButtonText: "确定",
var param = {} type: "warning",
if (obj === null || obj === undefined || obj === "") return param }).then(() => {
for (var key in obj) { this.confirmEvent(params, num);
if (obj[key] !== null && obj[key] !== undefined && obj[key] !== "") { });
param[key] = obj[key] } else {
} this.confirmEvent(params, num);
} }
return param });
}, },
handleClose(isRefresh = false) { confirmEvent(params, num) {
if (isRefresh) { const obj = { // 商品信息
this.close({ tagName: '/grounding' }) position: "",
this.$router.push({ name: 'grounding' }) goodsAlias: "",
this.close({ tagName: '/grounding' }) warrantyType: "",
} else { productType: [],
this.$confirm('内容未保存,是否返回?', '提示', { baseSupplyMode: "",
confirmButtonText: '确定', upgradeSupplyMode: "",
type: 'warning' sellPrice: "",
}).then(() => { minSellPrice: "",
this.close({ tagName: '/grounding' }) upgradeProductCost: "",
this.$router.push({ name: 'grounding' }) giftCost: "",
this.close({ tagName: '/grounding' }) recoveryCost: "",
}).catch(err => { virtualAccountCost: "",
console.log(err) validMinSellPrice: "Y",
}) djCost: "",
} thirdPartyCost: "",
} };
} addOrUpdateAPI(this.dealObjectValue(params)).then((res) => {
} this.notice.okTips();
if (num == 3) {
// 保留 上架商品和上架门店上架凭证数据
this.editData = {
...this.editData,
...obj,
};
} else { // 保存后跳转列表页
this.handleClose(true);
}
});
},
dealObjectValue(obj) {
let param = {};
if (obj === null || obj === undefined || obj === "")
return param;
for (let key in obj) {
if (obj[key] !== null && obj[key] !== undefined && obj[key] !== "") {
param[key] = obj[key];
}
}
return param;
},
handleClose(isRefresh = false) {
if (isRefresh) {
this.close({ tagName: "/grounding" });
this.$router.push({ name: "grounding" });
this.close({ tagName: "/grounding" });
} else {
this.$confirm("内容未保存,是否返回?", "提示", {
confirmButtonText: "确定",
type: "warning",
}).then(() => {
this.close({ tagName: "/grounding" });
this.$router.push({ name: "grounding" });
this.close({ tagName: "/grounding" });
}).catch((err) => {
console.log(err);
});
}
},
},
};
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="品牌:"> <el-form-item label="品牌:">
<el-radio-group v-model="businessType" @change="handleChangeBusinessType"> <el-radio-group v-model="brandId" @change="handleChangeBrand">
<el-radio v-for="(item, index) in brandMerchant" <el-radio v-for="(item) in brandMerchant"
:key="`${item.businessType}${index}`" :key="item.id"
:label="item.businessType"> :label="item.id">
{{ item.childBrandNames }} {{ item.childBrandNames }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
...@@ -37,34 +37,36 @@ export default { ...@@ -37,34 +37,36 @@ export default {
data() { data() {
return { return {
businessType: undefined, businessType: undefined,
brandId: undefined,
}; };
}, },
computed: { computed: {
businessTypes() { businessTypes() {
return this.brandMerchant.map(item => item.businessType); return this.brandMerchant.map(item => item.businessType);
}, },
brandList() {
return this.brandMerchant.map(item => item.childBrandNames);
},
}, },
mounted() { mounted() {
}, },
methods: { methods: {
async handleSetDefaultType() { async handleSetDefaultType() {
console.log("执行");
if (this.brandMerchant[0]?.businessType !== undefined && this.brandMerchant[0].businessType !== null) { if (this.brandMerchant[0]?.businessType !== undefined && this.brandMerchant[0].businessType !== null) {
console.log("?", this.brandMerchant);
this.businessType = this.brandMerchant[0].businessType; this.businessType = this.brandMerchant[0].businessType;
console.log(this.businessType); this.brandId = this.brandMerchant[0].id;
this.handleChangeBusinessType(this.businessType); this.handleChangeBusinessType(this.businessType);
} }
}, },
handleChangeBusinessType(businessType) {
handleChangeBusinessType(e) { const item = this.brandMerchant.find(item => item.businessType === businessType);
console.log("handleChangeBusinessType", e); console.log("item", item);
console.log("this.brandMerchant", this.brandMerchant); if (item) {
const item = this.brandMerchant.find(item => item.businessType === e); this.brandId = item.id;
this.$emit("changeBusiness", item);
}
},
handleChangeBrand(brandId) {
const item = this.brandMerchant.find(item => item.id === brandId);
if (item) { if (item) {
this.businessType = item.businessType;
this.$emit("changeBusiness", item); this.$emit("changeBusiness", item);
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!