Commit a41f417e by Jaxon

style: 格式调整

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