Commit dcca0159 by Jaxon

feat(套餐管理): 结构调整

1 parent 3c44cf46
...@@ -487,7 +487,7 @@ export const routerName = { ...@@ -487,7 +487,7 @@ export const routerName = {
handle: "handleBatchModifyInventory", handle: "handleBatchModifyInventory",
}, },
], ],
component: _import("goods/packageManage/index"), component: _import("goods/packageManage/views/table/index"),
}, },
9031202: { 9031202: {
path: "/editPackage", path: "/editPackage",
...@@ -499,7 +499,7 @@ export const routerName = { ...@@ -499,7 +499,7 @@ export const routerName = {
sideHidden: true, sideHidden: true,
activePath: "/packageManage", activePath: "/packageManage",
}, },
component: _import("goods/packageManage/editPackage"), component: _import("goods/packageManage/views/modify/index"),
}, },
9031205: { 9031205: {
path: "/packageView", path: "/packageView",
...@@ -519,7 +519,7 @@ export const routerName = { ...@@ -519,7 +519,7 @@ export const routerName = {
handle: "handleCheck", handle: "handleCheck",
}, },
], ],
component: _import("goods/packageManage/packageView"), component: _import("goods/packageManage/views/detail/index"),
}, },
90314: { 90314: {
path: "/purchaseOnShelves", path: "/purchaseOnShelves",
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
<!-- 商品附带信息 --> <!-- 商品附带信息 -->
<div v-if="item.type === 'incidBox'"> <div v-if="item.type === 'incidBox'">
<el-form-item class="dis-in-block" <el-form-item class="dis-in-block"
style="margin-bottom: 0"
:label="item.label ? `${item.label}:` : ''" :label="item.label ? `${item.label}:` : ''"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
:prop="`groundingGoodsList[${eleIndex}][${item.name}]`" :prop="`groundingGoodsList[${eleIndex}][${item.name}]`">
style="margin-bottom: 0">
<div class="incid_box"> <div class="incid_box">
<div v-for="(subItem, subIndex) in item.detailInfo" <div v-for="(subItem, subIndex) in item.detailInfo"
:key="subIndex" :key="subIndex"
...@@ -90,11 +90,11 @@ ...@@ -90,11 +90,11 @@
<div v-else> <div v-else>
<el-form-item v-if="item.name !== 'positionStr' || (item.name == 'positionStr' && ele.goodsType == 1) || (item.name == 'positionStr' && extendedPosiType.includes(ele.goodsType) && !baseConfig.supplierCode.includes(`${ele.supplierCode}`))" <el-form-item v-if="item.name !== 'positionStr' || (item.name == 'positionStr' && ele.goodsType == 1) || (item.name == 'positionStr' && extendedPosiType.includes(ele.goodsType) && !baseConfig.supplierCode.includes(`${ele.supplierCode}`))"
class="dis-in-block" class="dis-in-block"
style="margin-bottom: 0"
:label="item.label ? `${item.unit ? (membraneTypeList.includes(ele.goodsType) ? `${item.label}(元)/车` : (`${item.label}(元)/件`)) : item.label}:` : ''" :label="item.label ? `${item.unit ? (membraneTypeList.includes(ele.goodsType) ? `${item.label}(元)/车` : (`${item.label}(元)/件`)) : item.label}:` : ''"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
:prop="`groundingGoodsList[${eleIndex}][${item.name}]`" :prop="`groundingGoodsList[${eleIndex}][${item.name}]`"
:rules="rules[item.name]" :rules="rules[item.name]">
style="margin-bottom: 0">
<div> <div>
<span>{{ item.unit || item.type == 'price' ? priceFilter(ele[item.name]) : (ele[item.name]) }}</span> <span>{{ item.unit || item.type == 'price' ? priceFilter(ele[item.name]) : (ele[item.name]) }}</span>
<span v-if="item.name == 'minSellPrice'">{{ ele.validMinSellPrice == 'Y' ? '(校验最低价)' : '(不校验最低价)' }}</span> <span v-if="item.name == 'minSellPrice'">{{ ele.validMinSellPrice == 'Y' ? '(校验最低价)' : '(不校验最低价)' }}</span>
...@@ -122,10 +122,10 @@ ...@@ -122,10 +122,10 @@
<div v-else-if="item.type === 'table'"> <div v-else-if="item.type === 'table'">
<el-form-item :id="item.name" <el-form-item :id="item.name"
class="dis-in-block" class="dis-in-block"
style="margin-bottom: 0"
:label="item.label ? `${item.label}:` : ''" :label="item.label ? `${item.label}:` : ''"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
:prop="item.name" :prop="item.name">
style="margin-bottom: 0">
<RelateStoreTable v-if="$$(formData.merchantGoodsRefList, 'length')" <RelateStoreTable v-if="$$(formData.merchantGoodsRefList, 'length')"
:is-detail="true" :is-detail="true"
:is-hide="true" :is-hide="true"
...@@ -138,10 +138,10 @@ ...@@ -138,10 +138,10 @@
<div v-if="$$(formData[item.name], 'length')"> <div v-if="$$(formData[item.name], 'length')">
<el-form-item :id="item.name" <el-form-item :id="item.name"
class="dis-in-block" class="dis-in-block"
style="margin-bottom: 0"
:label="item.label ? `${item.label}:` : ''" :label="item.label ? `${item.label}:` : ''"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
:prop="item.name" :prop="item.name">
style="margin-bottom: 0">
<div class="file_box"> <div class="file_box">
<div v-for="(subItem, subIndex) in formData[item.name]" <div v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex" :key="subIndex"
...@@ -149,10 +149,10 @@ ...@@ -149,10 +149,10 @@
<div class="item_box" @click="handleFileView(subItem)"> <div class="item_box" @click="handleFileView(subItem)">
<img v-if="subItem.voucherFileUrl.includes('.png') || subItem.voucherFileUrl.includes('.jpg')" <img v-if="subItem.voucherFileUrl.includes('.png') || subItem.voucherFileUrl.includes('.jpg')"
class="image_icon" class="image_icon"
src="../../grounding/images/photo_thumbnail.png" /> :src="images.photoThumbnailPng" />
<img v-if="subItem.voucherFileUrl.includes('.pdf')" <img v-if="subItem.voucherFileUrl.includes('.pdf')"
class="image_icon" class="image_icon"
src="../../grounding/images/PDF_thumbnail.png" /> :src="images.pdfThumbnailPng" />
<span class="file_size">文件大小:{{ formatSize(subItem.fileSize) }}</span> <span class="file_size">文件大小:{{ formatSize(subItem.fileSize) }}</span>
</div> </div>
</div> </div>
...@@ -163,10 +163,10 @@ ...@@ -163,10 +163,10 @@
<div v-else> <div v-else>
<el-form-item :id="item.name" <el-form-item :id="item.name"
class="dis-in-block" class="dis-in-block"
style="margin-bottom: 0"
:label="item.label ? `${item.unit ? (`${item.label}(元)/件`) : item.label}:` : ''" :label="item.label ? `${item.unit ? (`${item.label}(元)/件`) : item.label}:` : ''"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
:prop="item.name" :prop="item.name">
style="margin-bottom: 0">
<div> <div>
<span>{{ item.unit || item.isPrice ? priceFilter(formData[item.name]) || '-' : formData[item.name] || '-' }}</span> <span>{{ item.unit || item.isPrice ? priceFilter(formData[item.name]) || '-' : formData[item.name] || '-' }}</span>
</div> </div>
...@@ -178,14 +178,14 @@ ...@@ -178,14 +178,14 @@
<el-form-item style="margin-top: 40px;text-align: center;"> <el-form-item style="margin-top: 40px;text-align: center;">
<el-button v-if="examineFlag && formData.status == 4" <el-button v-if="examineFlag && formData.status == 4"
class="width_100" class="width_100"
:disabled="$store.state.d2admin.loading.value"
type="primary" type="primary"
:disabled="$store.state.d2admin.loading.value"
@click="handleCheck"> @click="handleCheck">
审核 审核
</el-button> </el-button>
<el-button class="width_100 cancel-btn" <el-button class="width_100 cancel-btn"
plain
type="primary" type="primary"
plain
@click="handleClose"> @click="handleClose">
返回 返回
</el-button> </el-button>
...@@ -202,8 +202,8 @@ ...@@ -202,8 +202,8 @@
import { mapActions } from "vuex"; import { mapActions } from "vuex";
import { deepClone } from "@/common/util"; import { deepClone } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import ellipsisPopover from "../../components/ellipsisPopover.vue"; import ellipsisPopover from "@/views/goods/components/ellipsisPopover.vue";
import relateStoreTable from "../../grounding/components/relateStoreTable.vue"; import { pdfThumbnailPng, photoThumbnailPng, relateStoreTable } from "@/views/goods/grounding";
export default { export default {
name: "GroundingForm", name: "GroundingForm",
...@@ -235,6 +235,10 @@ export default { ...@@ -235,6 +235,10 @@ export default {
}, },
data() { data() {
return { return {
images: {
pdfThumbnailPng,
photoThumbnailPng,
},
equitySceneType: baseConfig.equitySceneType || [], // 权益类目 equitySceneType: baseConfig.equitySceneType || [], // 权益类目
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类 extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
membraneTypeList: baseConfig.membraneTypeList, membraneTypeList: baseConfig.membraneTypeList,
...@@ -326,8 +330,9 @@ export default { ...@@ -326,8 +330,9 @@ export default {
} else { } else {
this.imgViewerVisible = true; this.imgViewerVisible = true;
this.imageFileArr.forEach((val, index) => { // 图片使用elementImage图片预览组件 this.imageFileArr.forEach((val, index) => { // 图片使用elementImage图片预览组件
if (val == item.voucherFileUrl) if (val == item.voucherFileUrl) {
this.initialIndex = index; this.initialIndex = index;
}
}); });
} }
}, },
...@@ -359,8 +364,9 @@ export default { ...@@ -359,8 +364,9 @@ export default {
// 处理金额补零 // 处理金额补零
priceFilter(num) { priceFilter(num) {
let pow = 10 ** 2; let pow = 10 ** 2;
if (this.filterEmpty(num)) if (this.filterEmpty(num)) {
return "-"; return "-";
}
return `${(Math.round(num * pow) / pow).toFixed(2)}元`; return `${(Math.round(num * pow) / pow).toFixed(2)}元`;
}, },
// 返回 // 返回
......
<!-- 查看上架 -->
<template>
<d2-container class="edit-commodity">
<div class="" v-if="show">
<detail ref="d2PackageDetail" :rules="rules" form-name="grounding" :origin-data="editData" :form-list="editForm"
@handleCheck="handleCheck"
@handleClose="handleAddClose"></detail>
</div>
</d2-container>
</template>
<script>
import { getPackageDetailInfo, batchCheckPackage } from '@api/packageManage'
import detail from './components/detail.vue'
import { sceneList, BaseData } from '@/common/constants.js'
import { mapActions } from 'vuex'
import { deepClone, Util } from '@/common/util'
import { baseConfig } from "@/main"
import { packageGoodsDetail, upgradeSupplyModeList, crowdUpgradeSupplyModeList } from '../grounding/constants/data'
import { filterSpecsStr, convertYuanToWan } from "../filterOption"
import { getOperationCost } from '@api/grounding'
export default {
name: 'PackageDetail',
components: {
detail
},
data() {
return {
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
rules: {
merchantGoodsRefList: [{ required: true }],
packageName: [{ required: true }],
baseSceneName: [{ required: true }],
positionStr: [{ required: true }],
upgradeGoodsName: [{ required: true }],
sellPrice: [{ required: true }],
minSellPrice: [{ required: true }],
djCost: [{ required: true }],
thirdPartyCost: [{ required: true }],
upgradeProductCost: [{ required: true }],
recoveryCost: [{ required: true }],
virtualAccountCost: [{ required: true }],
financeCheckFlagStr: [{ required: true }]
},
editForm: [{
title: '套餐信息',
formBlock: [{
name: 'packageName',
label: '套餐名称'
}, {
name: 'packageAlias',
label: '套餐别名'
}, {
name: 'sellPrice',
label: '售价',
// unit: true
isPrice: true
}, {
name: 'minSellPrice',
label: '最低售价',
// unit: true
isPrice: true
}, {
name: 'upgradeProductCost',
label: '产品、升级成本',
// unit: true
isPrice: true
}, {
name: 'recoveryCost',
label: '回收成本',
// unit: true
isPrice: true
}, {
name: 'virtualAccountCost',
label: '虚拟对账成本',
// unit: true
isPrice: true
}, {
name: 'djCost',
label: '嘀加成本',
// unit: true
isPrice: true
}, {
name: 'thirdPartyCost',
label: '第三方成本',
// unit: true
isPrice: true
}, {
name: 'financeCheckFlagStr',
label: '财务规则校验'
}]
}, {
title: '门店信息',
formBlock: [{
name: 'baseSceneName',
label: '业务场景'
}, {
name: 'merchantGoodsRefList',
label: '上架门店',
type: 'table'
}, {
name: 'voucherList',
label: '上架凭证',
type: 'upload'
}]
}, {
title: '商品信息',
formBlock: []
}, {
title: '操作信息',
formBlock: [{
type: 'checkView',
name: 'reviewLogList'
}]
}],
show: false,
editData: {},
examineFlag: false,
detailId: '',
warrantyTypeShow: {
0: '质保卡',
1: '质保权益卡'
},
filterSpecsStr
}
},
mounted() {
this.getBaseData()
// 获取商品详情
const id = this.$route.query.id
this.detailId = id
if (!id) return this.show = true
this.getDetailInfo(id)
},
methods: {
...mapActions({
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
async getBaseData() {
this.positionTypeList = await this.get(BaseData.positionTypeList)
},
getDetailInfo(id) {
getPackageDetailInfo({ id }).then(async res => {
res.reviewLogList?.forEach(val => {
val.updatedDateStr = val.updatedDate ? Util.dateFormate(val.updatedDate, 'YYYY-MM-DD HH:mm:ss') : ''
})
let arr = []
if (res.sceneType == 3) { // 1.3场景 升级产品供货模式
arr = crowdUpgradeSupplyModeList
}
res.groundingGoodsList = []
for (const val of (res?.merchantGoodsInfoList || [])) {
if (val.goodsType == 1) { // 太阳膜类 升级产品供货模式(优先级高)
arr = upgradeSupplyModeList
}
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = val.goodsInfo || {}
const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName]
const result = types.filter(type => type).join('-')
this.editForm[2].formBlock.push(packageGoodsDetail)
// 太阳膜类回显部位
const positionNamesArr = deepClone(this.positionTypeList).filter(subVal => (val?.upgradeGoods?.position?.split(','))?.includes(subVal.position + '')) || []
// 实时计算运营成本
const costResult = await getOperationCost({ commodityCode: val?.upgradeCommodityCode, merchantIdList: res?.merchantGoodsRefList?.map(v => { return v.merchantId }) })
res.groundingGoodsList.push({
goodsType: val?.goodsType, // 类目值
upgradeGoodsId: val?.upgradeGoodsId, // 升级商品Id
goodsAlias: val?.goodsAlias || '-', // 商品别名
positionStr: deepClone(this.positionTypeList)?.filter(subVal => val?.position == subVal.position)[0]?.confName || '', // 上架部位
sellPrice: val?.sellPrice, // 售价
minSellPrice: val?.minSellPrice, // 最低售价
validMinSellPrice: val?.validMinSellPrice, // 是否校验最低价
djCost: val?.djCost, // 嘀加成本
thirdPartyCost: val?.thirdPartyCost, // 第三方成本
supplierCode: val?.goodsInfo?.supplierCode, // 供应方
warrantyTypeStr: this.warrantyTypeShow[val?.warrantyType] || '-', // 质保卡类型
upgradeSupplyMode: val?.upgradeSupplyMode,
upgradeSupplyModeStr: arr?.filter(v => v.confId == val.upgradeSupplyMode)[0]?.confName || '', // 升级产品供货模式
upgradeProductCost: val?.upgradeProductCost, // 升级产品成本
virtualAccountCost: val?.virtualAccountCost, // 虚拟对账成本
recoveryCost: val?.recoveryCost, // 回收成本
warrantyPeriod: val?.upgradeGoods?.warrantyPeriod, // 质保年限
upgradePrice: val?.upgradeGoods?.upgradePrice, // 参考售价
upgradeGoods: {
...val?.upgradeGoods,
goodsName: val.goodsName,
upgradeGoodsName: val?.upgradeGoodsName,
goodsTypeName: val?.goodsTypeName, // 升级商品所属类目
tempGoodsTypeName: result,
serviceItemNames: val?.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(val?.upgradeGoods),
carTypeConfigName: val?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'),
upgradeCommodityCode: val?.upgradeCommodityCode,
operationCost: costResult?.operationCost
}
})
}
res.baseSceneName = res.baseSceneName || '-'
res.financeCheckFlagStr = res.financeCheckFlag == 'Y' ? '开启' : res.financeCheckFlag == 'N' ? '关闭' : '-'
res.merchantGoodsRefList = res.merchantGoodsRefList || []
res.voucherList = res?.voucherList || []
this.editData = res || {}
this.$nextTick(() => {
this.show = true
})
})
},
filterEmpty(data) {
return (data ?? '') === ''
},
handleCheck() {
this.$confirm('<p>审核通过后,套餐完成上架,对应的门店可使用该商品</p>是否确定审核?', '提示', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true,
type: 'warning'
}).then(() => {
batchCheckPackage({ ids: [this.detailId] }).then(res => {
this.notice.okTips()
this.handleClose(true)
})
}).catch(err => {
console.log(err)
})
},
handleClose() {
this.close({ tagName: '/packageManage' })
this.$router.push({ name: 'packageManage' })
this.close({ tagName: '/packageView' })
},
handleAddClose() {
this.handleClose()
}
}
}
</script>
<style lang="scss" scoped></style>
<!-- 查看上架 -->
<template>
<d2-container class="edit-commodity">
<div v-if="show" class="">
<Detail ref="d2PackageDetail"
form-name="grounding"
:form-list="editForm"
:origin-data="editData"
:rules="rules"
@handleCheck="handleCheck"
@handleClose="handleAddClose">
</Detail>
</div>
</d2-container>
</template>
<script>
import { getOperationCost } from "@api/grounding";
import { batchCheckPackage, getPackageDetailInfo } from "@api/packageManage";
import { mapActions } from "vuex";
import { BaseData, sceneList } from "@/common/constants.js";
import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main";
import { convertYuanToWan, filterSpecsStr } from "@/views/goods/filterOption";
import { crowdUpgradeSupplyModeList, packageGoodsDetail, upgradeSupplyModeList } from "@/views/goods/grounding";
import detail from "@/views/goods/packageManage/components/detail.vue";
export default {
name: "PackageDetail",
components: {
Detail: detail,
},
data() {
return {
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
rules: {
merchantGoodsRefList: [{ required: true }],
packageName: [{ required: true }],
baseSceneName: [{ required: true }],
positionStr: [{ required: true }],
upgradeGoodsName: [{ required: true }],
sellPrice: [{ required: true }],
minSellPrice: [{ required: true }],
djCost: [{ required: true }],
thirdPartyCost: [{ required: true }],
upgradeProductCost: [{ required: true }],
recoveryCost: [{ required: true }],
virtualAccountCost: [{ required: true }],
financeCheckFlagStr: [{ required: true }],
},
editForm: [{
title: "套餐信息",
formBlock: [{
name: "packageName",
label: "套餐名称",
}, {
name: "packageAlias",
label: "套餐别名",
}, {
name: "sellPrice",
label: "售价",
// unit: true
isPrice: true,
}, {
name: "minSellPrice",
label: "最低售价",
// unit: true
isPrice: true,
}, {
name: "upgradeProductCost",
label: "产品、升级成本",
// unit: true
isPrice: true,
}, {
name: "recoveryCost",
label: "回收成本",
// unit: true
isPrice: true,
}, {
name: "virtualAccountCost",
label: "虚拟对账成本",
// unit: true
isPrice: true,
}, {
name: "djCost",
label: "嘀加成本",
// unit: true
isPrice: true,
}, {
name: "thirdPartyCost",
label: "第三方成本",
// unit: true
isPrice: true,
}, {
name: "financeCheckFlagStr",
label: "财务规则校验",
}],
}, {
title: "门店信息",
formBlock: [{
name: "baseSceneName",
label: "业务场景",
}, {
name: "merchantGoodsRefList",
label: "上架门店",
type: "table",
}, {
name: "voucherList",
label: "上架凭证",
type: "upload",
}],
}, {
title: "商品信息",
formBlock: [],
}, {
title: "操作信息",
formBlock: [{
type: "checkView",
name: "reviewLogList",
}],
}],
show: false,
editData: {},
examineFlag: false,
detailId: "",
warrantyTypeShow: {
0: "质保卡",
1: "质保权益卡",
},
filterSpecsStr,
};
},
mounted() {
this.getBaseData();
// 获取商品详情
const id = this.$route.query.id;
this.detailId = id;
if (!id) {
return this.show = true;
}
this.getDetailInfo(id);
},
methods: {
...mapActions({
get: "d2admin/base/get",
close: "d2admin/page/close",
}),
async getBaseData() {
this.positionTypeList = await this.get(BaseData.positionTypeList);
},
getDetailInfo(id) {
getPackageDetailInfo({ id }).then(async (res) => {
res.reviewLogList?.forEach((val) => {
val.updatedDateStr = val.updatedDate ? Util.dateFormate(val.updatedDate, "YYYY-MM-DD HH:mm:ss") : "";
});
let arr = [];
if (res.sceneType == 3) { // 1.3场景 升级产品供货模式
arr = crowdUpgradeSupplyModeList;
}
res.groundingGoodsList = [];
for (const val of (res?.merchantGoodsInfoList || [])) {
if (val.goodsType == 1) { // 太阳膜类 升级产品供货模式(优先级高)
arr = upgradeSupplyModeList;
}
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = val.goodsInfo || {};
const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName];
const result = types.filter(type => type).join("-");
this.editForm[2].formBlock.push(packageGoodsDetail);
// 太阳膜类回显部位
const positionNamesArr = deepClone(this.positionTypeList).filter(subVal => (val?.upgradeGoods?.position?.split(","))?.includes(subVal.position + "")) || [];
// 实时计算运营成本
const costResult = await getOperationCost({ commodityCode: val?.upgradeCommodityCode, merchantIdList: res?.merchantGoodsRefList?.map((v) => {
return v.merchantId;
}) });
res.groundingGoodsList.push({
goodsType: val?.goodsType, // 类目值
upgradeGoodsId: val?.upgradeGoodsId, // 升级商品Id
goodsAlias: val?.goodsAlias || "-", // 商品别名
positionStr: deepClone(this.positionTypeList)?.filter(subVal => val?.position == subVal.position)[0]?.confName || "", // 上架部位
sellPrice: val?.sellPrice, // 售价
minSellPrice: val?.minSellPrice, // 最低售价
validMinSellPrice: val?.validMinSellPrice, // 是否校验最低价
djCost: val?.djCost, // 嘀加成本
thirdPartyCost: val?.thirdPartyCost, // 第三方成本
supplierCode: val?.goodsInfo?.supplierCode, // 供应方
warrantyTypeStr: this.warrantyTypeShow[val?.warrantyType] || "-", // 质保卡类型
upgradeSupplyMode: val?.upgradeSupplyMode,
upgradeSupplyModeStr: arr?.filter(v => v.confId == val.upgradeSupplyMode)[0]?.confName || "", // 升级产品供货模式
upgradeProductCost: val?.upgradeProductCost, // 升级产品成本
virtualAccountCost: val?.virtualAccountCost, // 虚拟对账成本
recoveryCost: val?.recoveryCost, // 回收成本
warrantyPeriod: val?.upgradeGoods?.warrantyPeriod, // 质保年限
upgradePrice: val?.upgradeGoods?.upgradePrice, // 参考售价
upgradeGoods: {
...val?.upgradeGoods,
goodsName: val.goodsName,
upgradeGoodsName: val?.upgradeGoodsName,
goodsTypeName: val?.goodsTypeName, // 升级商品所属类目
tempGoodsTypeName: result,
serviceItemNames: val?.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(val?.upgradeGoods),
carTypeConfigName: val?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join("/"),
upgradeCommodityCode: val?.upgradeCommodityCode,
operationCost: costResult?.operationCost,
},
});
}
res.baseSceneName = res.baseSceneName || "-";
res.financeCheckFlagStr = res.financeCheckFlag == "Y" ? "开启" : res.financeCheckFlag == "N" ? "关闭" : "-";
res.merchantGoodsRefList = res.merchantGoodsRefList || [];
res.voucherList = res?.voucherList || [];
this.editData = res || {};
this.$nextTick(() => {
this.show = true;
});
});
},
filterEmpty(data) {
return (data ?? "") === "";
},
handleCheck() {
this.$confirm("<p>审核通过后,套餐完成上架,对应的门店可使用该商品</p>是否确定审核?", "提示", {
confirmButtonText: "确定",
dangerouslyUseHTMLString: true,
type: "warning",
}).then(() => {
batchCheckPackage({ ids: [this.detailId] }).then((res) => {
this.notice.okTips();
this.handleClose(true);
});
}).catch((err) => {
console.log(err);
});
},
handleClose() {
this.close({ tagName: "/packageManage" });
this.$router.push({ name: "packageManage" });
this.close({ tagName: "/packageView" });
},
handleAddClose() {
this.handleClose();
},
},
};
</script>
<style lang="scss" scoped></style>
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
:form-ref="proFormRef" :form-ref="proFormRef"
:goods-select-list="goodsSelectList" :goods-select-list="goodsSelectList"
:origin-data="editData" :origin-data="editData"
:sceneCodeList="sceneCodeList"
:position-type-list="positionTypeList" :position-type-list="positionTypeList"
:scene-code-list="sceneCodeList"
@handleAddConfirm="handleAddConfirm" @handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose"> @handleClose="handleAddClose">
</PackageForm> </PackageForm>
...@@ -25,9 +25,9 @@ import { mapActions } from "vuex"; ...@@ -25,9 +25,9 @@ import { mapActions } from "vuex";
import { BaseData } from "@/common/constants.js"; import { BaseData } from "@/common/constants.js";
import { deepClone } from "@/common/util"; import { deepClone } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import { convertYuanToWan, filterSpecsStr } from "../filterOption"; import { convertYuanToWan, filterSpecsStr } from "@/views/goods/filterOption";
import { packageGoodsForm } from "../grounding/constants/data"; import { packageGoodsForm } from "@/views/goods/grounding/index.js";
import packageForm from "./components/packageForm.vue"; import packageForm from "@/views/goods/packageManage/components/packageForm.vue";
export default { export default {
name: "EditPackage", name: "EditPackage",
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
PackageForm: packageForm, PackageForm: packageForm,
}, },
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
if (to.query.addOrEdit == "edit") { if (to.query.addOrEdit === "edit") {
to.meta.title = "编辑套餐"; to.meta.title = "编辑套餐";
} else { } else {
to.meta.title = "新增套餐"; to.meta.title = "新增套餐";
...@@ -214,7 +214,7 @@ export default { ...@@ -214,7 +214,7 @@ export default {
}), }),
initData() { initData() {
// 获取业务场景数据 // 获取业务场景数据
getBaseSceneCodeList({status: 1}).then((res) => { getBaseSceneCodeList({ status: 1 }).then((res) => {
this.sceneCodeList = res || []; this.sceneCodeList = res || [];
this.getBaseData(); this.getBaseData();
const id = this.$route.query.id; const id = this.$route.query.id;
...@@ -293,8 +293,9 @@ export default { ...@@ -293,8 +293,9 @@ export default {
} }
res.financeCheckFlag = res?.financeCheckFlag; res.financeCheckFlag = res?.financeCheckFlag;
res.voucherList.forEach((val) => { // 处理上传进度 默认进度100% res.voucherList.forEach((val) => { // 处理上传进度 默认进度100%
if (val.voucherFileUrl) if (val.voucherFileUrl) {
val.uploadProgress = 100; val.uploadProgress = 100;
}
}); });
res.merchantGoodsRefList = res.merchantGoodsRefList.map((item) => { res.merchantGoodsRefList = res.merchantGoodsRefList.map((item) => {
return { return {
...@@ -322,18 +323,19 @@ export default { ...@@ -322,18 +323,19 @@ export default {
this.confirm(num, data); this.confirm(num, data);
}, },
filterBaseSceneCodeBySceneType(targetTypes) { filterBaseSceneCodeBySceneType(targetTypes) {
const types = [].concat(targetTypes) const types = [].concat(targetTypes);
return this.sceneCodeList?.flatMap(val => return this.sceneCodeList?.flatMap(val =>
types.includes(val.sceneType) ? [val.baseSceneCode] : [] types.includes(val.sceneType) ? [val.baseSceneCode] : [],
) || [] ) || [];
}, },
confirm(num, data) { confirm(num, data) {
// 1保存并上架 2存草稿 // 1保存并上架 2存草稿
const formObj = {}; const formObj = {};
this.editForm.forEach((val) => { this.editForm.forEach((val) => {
val.formBlock.forEach((v) => { val.formBlock.forEach((v) => {
if (v.name) if (v.name) {
formObj[v.name] = data[v.name]; formObj[v.name] = data[v.name];
}
}); });
}); });
const arr = []; const arr = [];
...@@ -409,15 +411,19 @@ export default { ...@@ -409,15 +411,19 @@ export default {
merchantGoodsInfoList, merchantGoodsInfoList,
}; };
// 套餐至少包含两个以上产品 // 套餐至少包含两个以上产品
if (merchantGoodsInfoList?.length < 2) if (merchantGoodsInfoList?.length < 2) {
return this.$message.warning("套餐至少需包含两个产品"); return this.$message.warning("套餐至少需包含两个产品");
}
// 套餐总售价需大于零 // 套餐总售价需大于零
if (formObj?.sellPrice <= 0) if (formObj?.sellPrice <= 0) {
return this.$message.warning("套餐总售价需大于零,请检查套餐包含产品售价"); return this.$message.warning("套餐总售价需大于零,请检查套餐包含产品售价");
if (merchantGoodsInfoList?.findIndex(v => this.membraneTypeList.includes(v.goodsType)) > -1 && !this.filterBaseSceneCodeBySceneType(1)?.includes(data?.baseSceneCode)) }
if (merchantGoodsInfoList?.findIndex(v => this.membraneTypeList.includes(v.goodsType)) > -1 && !this.filterBaseSceneCodeBySceneType(1)?.includes(data?.baseSceneCode)) {
return this.$message.warning("膜类产品仅支持上架精品升级场景"); return this.$message.warning("膜类产品仅支持上架精品升级场景");
if (merchantGoodsInfoList?.findIndex(v => this.extendedPosiType?.concat(this.equitySceneType)?.includes(v.goodsType)) > -1 && !this.filterBaseSceneCodeBySceneType(0)?.includes(data?.baseSceneCode)) }
if (merchantGoodsInfoList?.findIndex(v => this.extendedPosiType?.concat(this.equitySceneType)?.includes(v.goodsType)) > -1 && !this.filterBaseSceneCodeBySceneType(0)?.includes(data?.baseSceneCode)) {
return this.$message.warning("延保、权益类产品仅支持上架至延保&权益业务场景"); return this.$message.warning("延保、权益类产品仅支持上架至延保&权益业务场景");
}
this.editData = data; this.editData = data;
// 判断套餐的所有子产品适用车型是否存在交集(无适用车型默认为全部) // 判断套餐的所有子产品适用车型是否存在交集(无适用车型默认为全部)
let seriesIdFlag = false; let seriesIdFlag = false;
...@@ -487,8 +493,9 @@ export default { ...@@ -487,8 +493,9 @@ export default {
}, },
dealObjectValue(obj) { dealObjectValue(obj) {
let param = {}; let param = {};
if (obj === null || obj === undefined || obj === "") if (obj === null || obj === undefined || obj === "") {
return param; return param;
}
for (let key in obj) { for (let key in obj) {
if (obj[key] !== null && obj[key] !== undefined && obj[key] !== "") { if (obj[key] !== null && obj[key] !== undefined && obj[key] !== "") {
param[key] = obj[key]; param[key] = obj[key];
......
import { getShopMerchantList } from "@api/deviceManage";
import { getParkStore } from "@api/editCustomer";
import { getAreaDataList, getBaseSceneCodeList } from "@api/productManage";
import { cloneDeep, isFunction } from "lodash-es";
import { Util } from "@/common/util";
import { financeCheckFlagList, inventoryTypeList, priceFilter, statusList } from "@/views/goods/grounding";
export async function getSearchFormSchema(_refreshTable) {
const refreshTable = isFunction(_refreshTable) ? _refreshTable : () => {};
// 获取服务商
const merchantServiceList = await getShopMerchantList();
// 获取园区店
const yqMerchantServiceList = await getParkStore({});
yqMerchantServiceList.forEach((item) => {
item.yqMerchantId = item.merchantNo;
item.yqMerchantName = item.merchantName;
});
// 获取业务场景数据
const baseSceneList = await getBaseSceneCodeList();
return [
{
label: "套餐名称",
name: "packageName",
maxlength: "50",
type: "input",
isClear: true,
keyFn: refreshTable,
},
{
label: "套餐别名",
name: "packageAlias",
maxlength: "50",
type: "input",
isClear: true,
keyFn: refreshTable,
},
{
label: "套餐ID",
name: "matchPackageCode",
addHtml: "matchPackageCode",
},
{
label: "上架门店",
name: "merchantId",
type: "select",
optionList: merchantServiceList || [],
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "merchantServiceList",
},
{
label: "服务对接",
name: "yqMerchantId",
type: "select",
optionList: yqMerchantServiceList || [],
optionId: "yqMerchantId",
optionLabel: "yqMerchantName",
optionsName: "yqMerchantServiceList",
},
{
label: "业务场景",
name: "baseSceneCodeList",
type: "select",
optionList: baseSceneList,
optionId: "baseSceneCode",
optionLabel: "name",
optionsName: "baseSceneList",
},
{
label: "状态",
name: "status",
type: "select",
optionList: cloneDeep(statusList),
optionId: "confId",
optionLabel: "confValue",
optionsName: "statusList",
},
{
label: "财务校验",
name: "financeCheckFlag",
type: "select",
optionList: cloneDeep(financeCheckFlagList),
optionId: "confId",
optionLabel: "confValue",
optionsName: "financeCheckFlagList",
},
{
label: "库存模式",
name: "inventoryType",
type: "select",
optionList: cloneDeep(inventoryTypeList),
optionId: "confId",
optionLabel: "confValue",
optionsName: "inventoryTypeList",
},
{
label: "适用区域",
name: "applicableArea",
addHtml: "applicableAreaSelect",
},
];
}
export async function getTableColumnsSchema() {
return [
{
label: "序号",
prop: "ownSerialNum",
type: "ownSerialNum",
width: "100",
},
{
label: "套餐ID",
prop: "packageCode",
width: "200",
formatter: (cellValue) => {
return cellValue.packageCode || "-";
},
},
{
label: "套餐名称",
prop: "packageName",
width: "150",
formatter: (cellValue) => {
return cellValue.packageName || "-";
},
},
{
label: "套餐别名",
prop: "packageAlias",
width: "150",
formatter: (cellValue) => {
return cellValue.packageAlias || "-";
},
},
{
label: "售价/元",
prop: "sellPrice",
formatter: (cellValue) => {
return priceFilter(cellValue.sellPrice);
},
},
{
label: "最低售价/元",
prop: "minSellPrice",
formatter: (cellValue) => {
return priceFilter(cellValue.minSellPrice);
},
width: "100",
},
{
label: "产品、升级成本/元",
prop: "upgradeProductCost",
formatter: (cellValue) => {
return priceFilter(cellValue.upgradeProductCost);
},
width: "150",
},
{
label: "虚拟对账成本/元",
prop: "virtualAccountCost",
formatter: (cellValue) => {
return priceFilter(cellValue.virtualAccountCost);
},
width: "150",
},
{
label: "回收成本/元",
prop: "recoveryCost",
formatter: (cellValue) => {
return priceFilter(cellValue.recoveryCost);
},
width: "100",
},
{
label: "嘀加成本/元",
prop: "djCost",
formatter: (cellValue) => {
return priceFilter(cellValue.djCost);
},
width: "100",
},
{
label: "第三方成本/元",
prop: "thirdPartyCost",
formatter: (cellValue) => {
return priceFilter(cellValue.thirdPartyCost);
},
width: "120",
},
{
label: "库存模式",
prop: "inventoryType",
width: "120",
formatter: (cellValue) => {
return cellValue.inventoryType == 1 ? "虚拟" : cellValue.inventoryType == 2 ? "实物" : "-";
},
},
{
label: "上架门店",
name: "",
type: "slot",
addHtml: "merchantName",
width: 100,
},
{
label: "服务对接",
prop: "yqMerchantName",
type: "slot",
addHtml: "yqMerchantName",
width: 100,
},
{
label: "业务场景",
prop: "baseSceneName",
width: 130,
},
{
label: "状态",
prop: "status",
width: "100px",
className: (cellValue) => {
return {
3: "ashSpot",
4: "yellowSpot",
1: "greenSpot",
0: "ashSpot",
}[cellValue.status];
},
formatter: (cellValue) => {
return {
3: "草稿",
4: "待审核",
1: "已上架",
0: "已下架",
}[cellValue.status];
},
},
{
label: "财务校验",
prop: "financeCheckFlag",
width: "100px",
formatter: (cellValue) => {
return cellValue.financeCheckFlag == "Y" ? "开启" : "关闭";
},
},
{
label: "创建日期",
prop: "createdDate",
width: "150",
formatter: (cellValue) => {
return cellValue.createdDate ? Util.dateFormate(cellValue.createdDate, "YYYY-MM-DD HH:mm:ss") : "";
},
},
];
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!