Commit a146d1e5 by zhangxw

服务项目按适用车价细化需求开发

1 parent f4701f21
...@@ -827,7 +827,8 @@ export const downloadReportManage_reportType = [ ...@@ -827,7 +827,8 @@ export const downloadReportManage_reportType = [
{ confId: "selleruseruserdipadanalysis", confValue: "驻店人员平板使用分析" }, { confId: "selleruseruserdipadanalysis", confValue: "驻店人员平板使用分析" },
{ confId: "dailybehaviorsummary", confValue: "日行为汇总表" }, { confId: "dailybehaviorsummary", confValue: "日行为汇总表" },
{ confId: "weeklybehaviorsummary", confValue: "周行为汇总表" }, { confId: "weeklybehaviorsummary", confValue: "周行为汇总表" },
{ confId: "businessDataSummary", confValue: "业务数据汇总" } { confId: "businessDataSummary", confValue: "业务数据汇总" },
{ confId: "yanbaoMerAndPerRanking", confValue: "门店产值及个人成交排名" }
] ]
// 下载报表 业务类型 // 下载报表 业务类型
......
...@@ -23,3 +23,14 @@ export function filterSpecsStr(data) { ...@@ -23,3 +23,14 @@ export function filterSpecsStr(data) {
return "-" return "-"
} }
} }
export function convertYuanToWan(yuan) {
// 将元转换为万元
const wan = yuan / 10000
// 判断小数部分是否为零
if (wan % 1 === 0) {
return wan.toFixed(0) // 如果是整数,保留0位小数
} else {
return wan.toFixed(2) // 否则保留2位小数
}
}
...@@ -270,7 +270,7 @@ import relateStoreTable from './relateStoreTable.vue' ...@@ -270,7 +270,7 @@ import relateStoreTable from './relateStoreTable.vue'
import { getList, getAccountMerchantList } from '@/api/merchant' import { getList, getAccountMerchantList } from '@/api/merchant'
import selectGoodsDialog from '../../components/selectGoodsDialog.vue' import selectGoodsDialog from '../../components/selectGoodsDialog.vue'
import ellipsisPopover from '../../components/ellipsisPopover.vue' import ellipsisPopover from '../../components/ellipsisPopover.vue'
import { filterSpecsStr } from '../../filterOption' import { filterSpecsStr, convertYuanToWan } from '../../filterOption'
export default { export default {
name: 'GroundingForm', name: 'GroundingForm',
components: { components: {
...@@ -610,7 +610,9 @@ export default { ...@@ -610,7 +610,9 @@ export default {
..._valueObj, ..._valueObj,
goodsName: _valueObj.goodsInfo.goodsName, goodsName: _valueObj.goodsInfo.goodsName,
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: _valueObj?.upgradeGoodsServiceItemsList?.map(item => { return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` })?.join(','), // 服务项目 serviceItemNames: _valueObj?.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('/') : '', positionNames: _positionNamesArr.length ? _positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '',
specificationData: this.filterSpecsStr(_valueObj), specificationData: this.filterSpecsStr(_valueObj),
djCost: _valueObj?.djCost, djCost: _valueObj?.djCost,
......
...@@ -16,7 +16,7 @@ import { BaseData, sceneCodeList } from '@/common/constants.js' ...@@ -16,7 +16,7 @@ import { BaseData, sceneCodeList } from '@/common/constants.js'
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 { filterSpecsStr } from "../filterOption" import { filterSpecsStr, convertYuanToWan } from "../filterOption"
export default { export default {
name: 'EditGrounding', name: 'EditGrounding',
components: { components: {
...@@ -307,7 +307,9 @@ export default { ...@@ -307,7 +307,9 @@ export default {
...res?.upgradeGoods, ...res?.upgradeGoods,
goodsName: res.goodsInfo.goodsName, goodsName: res.goodsInfo.goodsName,
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: res?.upgradeGoods?.upgradeGoodsServiceItemsList?.map(item => { return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` })?.join(','), // 服务项目 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('/') : '', positionNames: positionNamesArr.length ? positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '',
specificationData: this.filterSpecsStr(res?.upgradeGoods), specificationData: this.filterSpecsStr(res?.upgradeGoods),
carTypeConfigName: res?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'), carTypeConfigName: res?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'),
......
...@@ -16,7 +16,7 @@ import { mapActions } from 'vuex' ...@@ -16,7 +16,7 @@ import { mapActions } from 'vuex'
import { deepClone, Util } from '@/common/util' import { deepClone, Util } from '@/common/util'
import { productList, baseSupplyModeList, upgradeSupplyModeList, crowdUpgradeSupplyModeList } from './constants/data' import { productList, baseSupplyModeList, upgradeSupplyModeList, crowdUpgradeSupplyModeList } from './constants/data'
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { filterSpecsStr } from '../filterOption' import { filterSpecsStr, convertYuanToWan } from '../filterOption'
export default { export default {
name: 'GroundingDetail', name: 'GroundingDetail',
components: { components: {
...@@ -226,7 +226,9 @@ export default { ...@@ -226,7 +226,9 @@ export default {
...res.upgradeGoods, ...res.upgradeGoods,
goodsName: res.goodsInfo.goodsName, goodsName: res.goodsInfo.goodsName,
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: res?.upgradeGoods?.upgradeGoodsServiceItemsList?.map(item => { return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` })?.join(','), // 服务项目 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('/') : '', positionNames: positionNamesArr.length ? positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '',
specificationData: this.filterSpecsStr(res?.upgradeGoods), specificationData: this.filterSpecsStr(res?.upgradeGoods),
carTypeConfigName: res?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'), carTypeConfigName: res?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'),
......
...@@ -269,7 +269,7 @@ import { getList, getAccountMerchantList } from '@/api/merchant' ...@@ -269,7 +269,7 @@ import { getList, getAccountMerchantList } from '@/api/merchant'
import { upgradeSupplyModeList, crowdUpgradeSupplyModeList, packageGoodsForm } from "../../grounding/constants/data" import { upgradeSupplyModeList, crowdUpgradeSupplyModeList, packageGoodsForm } from "../../grounding/constants/data"
import selectGoodsDialog from '../../components/selectGoodsDialog.vue' import selectGoodsDialog from '../../components/selectGoodsDialog.vue'
import ellipsisPopover from '../../components/ellipsisPopover.vue' import ellipsisPopover from '../../components/ellipsisPopover.vue'
import { filterSpecsStr } from '../../filterOption' import { filterSpecsStr, convertYuanToWan } from '../../filterOption'
export default { export default {
name: 'GroundingForm', name: 'GroundingForm',
components: { components: {
...@@ -462,7 +462,11 @@ export default { ...@@ -462,7 +462,11 @@ export default {
..._valueObj, ..._valueObj,
goodsName: _valueObj.goodsInfo.goodsName, goodsName: _valueObj.goodsInfo.goodsName,
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: _valueObj?.upgradeGoodsServiceItemsList?.map(item => { return this.extendedPosiType.includes(_valueObj?.goodsInfo?.goodsType) ? item.serviceName : `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` })?.join(','), // 服务项目 serviceItemNames: _valueObj?.upgradeGoodsServiceItemsList?.map(item => {
return this.extendedPosiType.includes(_valueObj?.goodsInfo?.goodsType) ?
item.serviceName :
`${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('/') : '', positionNames: _positionNamesArr.length ? _positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '',
specificationData: this.filterSpecsStr(_valueObj), specificationData: this.filterSpecsStr(_valueObj),
djCost: _valueObj?.djCost, djCost: _valueObj?.djCost,
...@@ -541,7 +545,7 @@ export default { ...@@ -541,7 +545,7 @@ export default {
this.$set(this.formData.groundingGoodsList[index], 'upgradeProductCost', '') this.$set(this.formData.groundingGoodsList[index], 'upgradeProductCost', '')
} }
// 当商品信息自带嘀加成本时,将输入框置灰 // 当商品信息自带嘀加成本时,将输入框置灰
if (!this.filterEmpty(this.formData.groundingGoodsList[index]?.upgradeGoods?.djCost)) { if (!this.filterEmpty(this.formData.groundingGoodsList[index]?.upgradeGoods?.djCost) && _formBlock[_formBlock.findIndex(subItem => subItem.name == 'djCost')]) {
this.$set(_formBlock[_formBlock.findIndex(subItem => subItem.name == 'djCost')], 'isDisabled', true) this.$set(_formBlock[_formBlock.findIndex(subItem => subItem.name == 'djCost')], 'isDisabled', true)
} }
this.show = true this.show = true
......
...@@ -16,7 +16,7 @@ import { packageGoodsForm } from '../grounding/constants/data' ...@@ -16,7 +16,7 @@ import { packageGoodsForm } from '../grounding/constants/data'
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 { filterSpecsStr } from "../filterOption" import { filterSpecsStr, convertYuanToWan } from "../filterOption"
export default { export default {
name: 'EditPackage', name: 'EditPackage',
components: { components: {
...@@ -251,7 +251,9 @@ export default { ...@@ -251,7 +251,9 @@ export default {
goodsName: val.goodsName, goodsName: val.goodsName,
upgradeGoodsName: val?.upgradeGoodsName, upgradeGoodsName: val?.upgradeGoodsName,
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: val?.upgradeGoods?.upgradeGoodsServiceItemsList?.map(item => { return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` })?.join(','), // 服务项目 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('/') : '', positionNames: positionNamesArr.length ? positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '',
specificationData: this.filterSpecsStr(val?.upgradeGoods), specificationData: this.filterSpecsStr(val?.upgradeGoods),
carTypeConfigName: val?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'), carTypeConfigName: val?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'),
...@@ -351,6 +353,12 @@ export default { ...@@ -351,6 +353,12 @@ export default {
this.editData = data this.editData = data
// 判断套餐的所有子商品适用车型是否存在交集 // 判断套餐的所有子商品适用车型是否存在交集
let seriesIdFlag = false let seriesIdFlag = false
// let copyGroundingGoodsList = deepClone(data?.groundingGoodsList)
// const seriesIdsSet = copyGroundingGoodsList?.filter(v => {
// return v?.upgradeGoods?.carTypeConfigList?.length
// })?.map(item => {
// return new Set(item.upgradeGoods.carTypeConfigList.map(bItem => bItem.seriesId))
// })
const seriesIdsSet = data?.groundingGoodsList?.map(item => const seriesIdsSet = data?.groundingGoodsList?.map(item =>
new Set(item?.upgradeGoods?.carTypeConfigList?.map(bItem => bItem.seriesId)) new Set(item?.upgradeGoods?.carTypeConfigList?.map(bItem => bItem.seriesId))
) )
...@@ -368,13 +376,7 @@ export default { ...@@ -368,13 +376,7 @@ export default {
break break
} }
} }
if (seriesIdFlag) { const confirmSave = () => {
this.$confirm('<p>当前套餐商品的适用车型不一致,</p>是否确认继续使用?', '提示', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true,
type: 'warning'
}).then(() => {
if ((num == 1)) {
this.$confirm('<p>上架信息保存后,自动进入上架审核流程</p>是否确定保存?', '提示', { this.$confirm('<p>上架信息保存后,自动进入上架审核流程</p>是否确定保存?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
...@@ -384,13 +386,26 @@ export default { ...@@ -384,13 +386,26 @@ export default {
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
}
if (seriesIdFlag) {
this.$confirm('<p>当前套餐商品的适用车型不一致,</p>是否确认继续使用?', '提示', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true,
type: 'warning'
}).then(() => {
if (num === 1) {
confirmSave()
} else { } else {
this.checkEvent(params) this.checkEvent(params)
} }
}) })
} else { } else {
if (num === 1) {
confirmSave()
} else {
this.checkEvent(params) this.checkEvent(params)
} }
}
}, },
checkEvent(params) { checkEvent(params) {
this.confirmEvent(params) this.confirmEvent(params)
......
...@@ -16,7 +16,7 @@ import { mapActions } from 'vuex' ...@@ -16,7 +16,7 @@ import { mapActions } from 'vuex'
import { deepClone, Util } from '@/common/util' import { deepClone, Util } from '@/common/util'
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { packageGoodsDetail, upgradeSupplyModeList, crowdUpgradeSupplyModeList } from '../grounding/constants/data' import { packageGoodsDetail, upgradeSupplyModeList, crowdUpgradeSupplyModeList } from '../grounding/constants/data'
import { filterSpecsStr } from "../filterOption" import { filterSpecsStr, convertYuanToWan } from "../filterOption"
export default { export default {
name: 'PackageDetail', name: 'PackageDetail',
components: { components: {
...@@ -183,7 +183,9 @@ export default { ...@@ -183,7 +183,9 @@ export default {
upgradeGoodsName: val?.upgradeGoodsName, upgradeGoodsName: val?.upgradeGoodsName,
goodsTypeName: val?.goodsTypeName, // 升级商品所属类目 goodsTypeName: val?.goodsTypeName, // 升级商品所属类目
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: val?.upgradeGoods?.upgradeGoodsServiceItemsList?.map(item => { return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` })?.join(','), // 服务项目 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('/') : '', positionNames: positionNamesArr.length ? positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '',
specificationData: this.filterSpecsStr(val?.upgradeGoods), specificationData: this.filterSpecsStr(val?.upgradeGoods),
carTypeConfigName: val?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'), carTypeConfigName: val?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'),
......
...@@ -121,7 +121,7 @@ import { getGoodsInfoById } from '@/api/commodity' ...@@ -121,7 +121,7 @@ import { getGoodsInfoById } from '@/api/commodity'
import { deepClone, Util } from '@/common/util' import { deepClone, Util } from '@/common/util'
import { baseConfig } from '@/main' import { baseConfig } from '@/main'
import ellipsisPopover from '../../components/ellipsisPopover.vue' import ellipsisPopover from '../../components/ellipsisPopover.vue'
import { filterSpecsStr } from '../../filterOption' import { filterSpecsStr, convertYuanToWan } from '../../filterOption'
export default { export default {
name: 'DrawerDetail', name: 'DrawerDetail',
components: {ellipsisPopover}, components: {ellipsisPopover},
...@@ -178,7 +178,9 @@ export default { ...@@ -178,7 +178,9 @@ export default {
} }
const positionNamesArr = deepClone(this.positionTypeList).filter(val => item.position?.split(',')?.includes(val.position + '')) || [] const positionNamesArr = deepClone(this.positionTypeList).filter(val => item.position?.split(',')?.includes(val.position + '')) || []
item.positionNames = positionNamesArr.length ? positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '' item.positionNames = positionNamesArr.length ? positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : ''
item.serviceItemNames = item?.upgradeGoodsServiceItemsList?.map(v => { return `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}` })?.join(',') item.serviceItemNames = item?.upgradeGoodsServiceItemsList?.map(v => {
return `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}${(v.serviceItemId) ? `/${convertYuanToWan(v.minPrice)}-${convertYuanToWan(v.maxPrice)}万` : ''}`
})?.join(',')
item.extendServiceItemNames = item?.upgradeGoodsServiceItemsList?.map(v => { return `${v.serviceName}` })?.join(',') item.extendServiceItemNames = item?.upgradeGoodsServiceItemsList?.map(v => { return `${v.serviceName}` })?.join(',')
item.specificationName = this.filterSpecsStr(obj) item.specificationName = this.filterSpecsStr(obj)
item.carSeriesName = item?.carTypeConfigList?.map(v => { return v.seriesName })?.join('/') item.carSeriesName = item?.carTypeConfigList?.map(v => { return v.seriesName })?.join('/')
......
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
size="small" size="small"
v-model="subItem.djCost" v-model="subItem.djCost"
:class="{ 'w-150-per': true, 'border-red': filterEmpty(subItem.djCost) && subItem.djCostEmpty }" :class="{ 'w-150-per': true, 'border-red': filterEmpty(subItem.djCost) && subItem.djCostEmpty }"
:disabled="goodsInfoData.scrmFlag == 'Y'" :disabled="true"
@input="handlePrice($event, subIndex, 'djCost')"> @input="handlePrice($event, subIndex, 'djCost')">
<el-popover v-if="filterEmpty(subItem.djCost) && subItem.djCostEmpty" <el-popover v-if="filterEmpty(subItem.djCost) && subItem.djCostEmpty"
slot="suffix" slot="suffix"
...@@ -567,6 +567,9 @@ export default { ...@@ -567,6 +567,9 @@ export default {
specsInputVal: '', specsInputVal: '',
specsStartInputVal: '', specsStartInputVal: '',
specsEndInputVal: '', specsEndInputVal: '',
oldspecsInputVal: '',
oldspecsStartInputVal: '',
oldspecsEndInputVal: '',
reg: { reg: {
priceReg: /^\d[\d\.]*$/ priceReg: /^\d[\d\.]*$/
}, },
...@@ -804,15 +807,37 @@ export default { ...@@ -804,15 +807,37 @@ export default {
this.serviceSelectIndex = index this.serviceSelectIndex = index
this.serviceItemsVisible = true this.serviceItemsVisible = true
}, },
// 防止精度丢失
highPrecisionAdd(arr) {
// 转换为字符串处理小数,避免浮点数精度问题
let total = 0
arr.forEach((item) => {
const num = parseFloat(item)
if (!isNaN(num)) {
total = this.addPrecise(total, num)
}
})
return total
},
addPrecise(a, b) {
const aStr = a.toString()
const bStr = b.toString()
const aDecimalLen = (aStr.split(".")[1] || "").length
const bDecimalLen = (bStr.split(".")[1] || "").length
const maxDecimalLen = Math.max(aDecimalLen, bDecimalLen)
const multiplier = Math.pow(10, maxDecimalLen)
const aInt = Math.round(a * multiplier)
const bInt = Math.round(b * multiplier)
const result = (aInt + bInt) / multiplier
return result
},
handleRelateServiceConfirm(data) { handleRelateServiceConfirm(data) {
// 批量操作服务项目 // 批量操作服务项目
if (this.filterEmpty(this.serviceSelectIndex)) { if (this.filterEmpty(this.serviceSelectIndex)) {
this.goodsInfoData?.goodsSpecificationList.map(v => { this.goodsInfoData?.goodsSpecificationList.map(v => {
if (v.checked) { if (v.checked) {
v.serviceItemArr = data v.serviceItemArr = data
v.djCost = data.reduce((v, i) => { v.djCost = this.highPrecisionAdd(data?.map(i => i.djCost))
return v + i.standardSalesCost
}, 0)
} }
return v return v
}) })
...@@ -820,13 +845,11 @@ export default { ...@@ -820,13 +845,11 @@ export default {
} }
const index = this.serviceSelectIndex const index = this.serviceSelectIndex
let djCost = 0 let djCost = 0
data.forEach(v => { // 嘀加成本通过已选服务项目的销售成本自动累计 // 嘀加成本通过已选服务项目的销售成本自动累计
djCost += v.standardSalesCost djCost = this.highPrecisionAdd(data?.map(i => i.djCost))
})
if (!data?.length) djCost = '' if (!data?.length) djCost = ''
this.$set(this.goodsInfoData.goodsSpecificationList[index], 'serviceItemArr', data) this.$set(this.goodsInfoData.goodsSpecificationList[index], 'serviceItemArr', data)
// 暂时放开嘀加成本与服务项目联动累加 this.$set(this.goodsInfoData.goodsSpecificationList[index], 'djCost', djCost)
// this.$set(this.goodsInfoData.goodsSpecificationList[index], 'djCost', djCost)
this.serviceSelectIndex = null this.serviceSelectIndex = null
this.serviceSelected = [] this.serviceSelected = []
this.serviceItemsVisible = false this.serviceItemsVisible = false
...@@ -984,7 +1007,11 @@ export default { ...@@ -984,7 +1007,11 @@ export default {
handleSpecsInput(e, key) { handleSpecsInput(e, key) {
if (this.selectTypeSequence > 0) { if (this.selectTypeSequence > 0) {
let newValue = e.replace(/[^\d.]/g, '') let newValue = e.replace(/[^\d.]/g, '')
let oldValue = this[key] let oldValue = this[`old${key}`]
// let intergerDigit = this.selectTypeSequence == 3 ? 3 : 2 // 整数位数
// let pointDigit = this.selectTypeSequence == 3 ? 2 : 0 // 小数位数
// let maxValue = this.selectTypeSequence == 3 ? 200 : 99 // 最大值
// this.$set(this, key, limitPrice(newValue, oldValue, intergerDigit, pointDigit, 0, maxValue))
this.$set(this, key, limitPrice(newValue, oldValue, 2, this.selectTypeSequence == 3 ? 2 : 0, 0)) this.$set(this, key, limitPrice(newValue, oldValue, 2, this.selectTypeSequence == 3 ? 2 : 0, 0))
this.$set(this, `old${key}`, this[key]) this.$set(this, `old${key}`, this[key])
} }
...@@ -1033,8 +1060,11 @@ export default { ...@@ -1033,8 +1060,11 @@ export default {
if (this.selectTypeSequence == 3) { if (this.selectTypeSequence == 3) {
this.specsStartInputVal = tag.specificationValue?.split('-')[0] this.specsStartInputVal = tag.specificationValue?.split('-')[0]
this.specsEndInputVal = tag.specificationValue?.split('-')[1] this.specsEndInputVal = tag.specificationValue?.split('-')[1]
this.oldspecsStartInputVal = tag.specificationValue?.split('-')[0]
this.oldspecsEndInputVal = tag.specificationValue?.split('-')[1]
} else { } else {
this.specsInputVal = tag.specificationValue this.specsInputVal = tag.specificationValue
this.oldspecsInputVal = tag.specificationValue
} }
this.tempTag = tag.specificationValue this.tempTag = tag.specificationValue
this.isChange = true this.isChange = true
...@@ -1139,7 +1169,7 @@ export default { ...@@ -1139,7 +1169,7 @@ export default {
for (let i = 0; i < ranges.length; i++) { for (let i = 0; i < ranges.length; i++) {
const [rangeStart, rangeEnd] = ranges[i].map(Number) const [rangeStart, rangeEnd] = ranges[i].map(Number)
// 判断是否存在冲突 // 判断是否存在冲突
if (start <= rangeEnd && end >= rangeStart) { if (start < rangeEnd && end > rangeStart) {
return true return true
} }
} }
......
...@@ -40,10 +40,18 @@ ...@@ -40,10 +40,18 @@
label="年限" label="年限"
align="center"> align="center">
</el-table-column> </el-table-column>
<el-table-column prop="standardSalesCost" <el-table-column prop="price"
label="销售成本/元" label="适用车价/万元"
width="140" width="140"
align="center"> align="center">
<template slot-scope="scope">
<span>{{ `${convertYuanToWan(scope.row.minPrice)}-${convertYuanToWan(scope.row.maxPrice)}`}}</span>
</template>
</el-table-column>
<el-table-column prop="djCost"
label="嘀加成本/元"
width="100"
align="center">
</el-table-column> </el-table-column>
<el-table-column prop="serviceOverview" <el-table-column prop="serviceOverview"
width="210" width="210"
...@@ -81,6 +89,7 @@ ...@@ -81,6 +89,7 @@
<script> <script>
import { deepClone } from '@/common/util' import { deepClone } from '@/common/util'
import { convertYuanToWan } from '../../filterOption'
export default { export default {
name: 'RelateServiceDialog', name: 'RelateServiceDialog',
data() { data() {
...@@ -90,7 +99,8 @@ export default { ...@@ -90,7 +99,8 @@ export default {
// 分页 // 分页
total: 0, total: 0,
currentPage: 1, currentPage: 1,
pageSize: 20 pageSize: 20,
convertYuanToWan
} }
}, },
...@@ -115,10 +125,15 @@ export default { ...@@ -115,10 +125,15 @@ export default {
mounted() { mounted() {
this.selectedData = deepClone(this.serviceSelected) this.selectedData = deepClone(this.serviceSelected)
// 若是历史服务项目数据不回显(历史已选服务项目没有适用车价)
this.selectedData = this.selectedData?.filter(val => !this.filterEmpty(val.serviceItemId))
this.getSelectingList() this.getSelectingList()
}, },
methods: { methods: {
filterEmpty(data) {
return data instanceof Array ? data.length <= 0 : (data ?? '') === ''
},
selectable(row) { selectable(row) {
const { selectedData } = this const { selectedData } = this
// 每个服务项目code只能选中一个 按等级和年限区分 // 每个服务项目code只能选中一个 按等级和年限区分
...@@ -143,8 +158,8 @@ export default { ...@@ -143,8 +158,8 @@ export default {
pageSize: this.pageSize pageSize: this.pageSize
}).then(res => { }).then(res => {
res?.list?.forEach(val => { res?.list?.forEach(val => {
val.uniqueValue = `${val.serviceName}-${val.serviceGrade}/${val.servicePeriod}` val.uniqueValue = `${val.serviceName}-${val.serviceGrade}/${val.servicePeriod}${(val.serviceItemId) ? `/${this.convertYuanToWan(val.minPrice)}-${this.convertYuanToWan(val.maxPrice)}万` : ''}`
val.uniqueCode = `${val.serviceCode}-${val.serviceGrade}/${val.servicePeriod}` val.uniqueCode = `${val.serviceCode}-${val.serviceGrade}/${val.servicePeriod}${(val.serviceItemId) ? `/${val.serviceItemId}` : ''}`
}) })
this.selectingData = res.list this.selectingData = res.list
this.total = res.total this.total = res.total
......
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
<td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)"> <td v-if="(extendedPosiType.includes(goodsInfoData.goodsType) || equitySceneType.includes(goodsInfoData.goodsType)) && !baseConfig.supplierCode.includes(`${goodsInfoData.supplierCode}`)">
<el-input placeholder="请输入" <el-input placeholder="请输入"
size="small" size="small"
:disabled="goodsInfoData.scrmFlag == 'Y'" :disabled="true"
v-model="subItem.djCost" v-model="subItem.djCost"
:class="{ 'w-150-per': true, 'border-red': filterEmpty(subItem.djCost) && subItem.djCostEmpty }" :class="{ 'w-150-per': true, 'border-red': filterEmpty(subItem.djCost) && subItem.djCostEmpty }"
@input="handlePrice($event, subIndex, 'djCost')"> @input="handlePrice($event, subIndex, 'djCost')">
...@@ -650,15 +650,37 @@ export default { ...@@ -650,15 +650,37 @@ export default {
this.serviceSelectIndex = index this.serviceSelectIndex = index
this.serviceItemsVisible = true this.serviceItemsVisible = true
}, },
// 防止精度丢失
highPrecisionAdd(arr) {
// 转换为字符串处理小数,避免浮点数精度问题
let total = 0
arr.forEach((item) => {
const num = parseFloat(item)
if (!isNaN(num)) {
total = this.addPrecise(total, num)
}
})
return total
},
addPrecise(a, b) {
const aStr = a.toString()
const bStr = b.toString()
const aDecimalLen = (aStr.split(".")[1] || "").length
const bDecimalLen = (bStr.split(".")[1] || "").length
const maxDecimalLen = Math.max(aDecimalLen, bDecimalLen)
const multiplier = Math.pow(10, maxDecimalLen)
const aInt = Math.round(a * multiplier)
const bInt = Math.round(b * multiplier)
const result = (aInt + bInt) / multiplier
return result
},
handleRelateServiceConfirm(data) { handleRelateServiceConfirm(data) {
// 批量操作权益服务项目 // 批量操作权益服务项目
if (this.filterEmpty(this.serviceSelectIndex)) { if (this.filterEmpty(this.serviceSelectIndex)) {
this.goodsInfoData?.goodsSpecificationSingleList.map(v => { this.goodsInfoData?.goodsSpecificationSingleList.map(v => {
if (v.checked) { if (v.checked) {
v.serviceItemArr = data v.serviceItemArr = data
v.djCost = data.reduce((v, i) => { v.djCost = this.highPrecisionAdd(data?.map(i => i.djCost))
return v + i.standardSalesCost
}, 0)
} }
return v return v
}) })
...@@ -666,13 +688,11 @@ export default { ...@@ -666,13 +688,11 @@ export default {
} }
const index = this.serviceSelectIndex const index = this.serviceSelectIndex
let djCost = 0 let djCost = 0
data.forEach(v => { // 嘀加成本通过已选服务项目的销售成本自动累计 // 嘀加成本通过已选服务项目的销售成本自动累计
djCost += v.standardSalesCost djCost = this.highPrecisionAdd(data?.map(i => i.djCost))
})
if (!data?.length) djCost = '' if (!data?.length) djCost = ''
this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'serviceItemArr', data) this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'serviceItemArr', data)
// 暂时放开嘀加成本与服务项目联动累加 this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'djCost', djCost)
// this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'djCost', djCost)
this.serviceSelectIndex = null this.serviceSelectIndex = null
this.serviceSelected = [] this.serviceSelected = []
this.serviceItemsVisible = false this.serviceItemsVisible = false
......
...@@ -34,6 +34,7 @@ import { addProductManage, UpdateProductManage } from '@api/productManage' ...@@ -34,6 +34,7 @@ import { addProductManage, UpdateProductManage } from '@api/productManage'
import { BaseData, applicableModelTypeList } from '@/common/constants.js' import { BaseData, applicableModelTypeList } from '@/common/constants.js'
import { getGoodsInfoById } from '@api/commodity' import { getGoodsInfoById } from '@api/commodity'
import { baseConfig } from '@/main' import { baseConfig } from '@/main'
import { convertYuanToWan } from '../filterOption'
export default { export default {
name: 'EditProductManage', name: 'EditProductManage',
components: { components: {
...@@ -129,8 +130,8 @@ export default { ...@@ -129,8 +130,8 @@ export default {
let objData = {} let objData = {}
this.copyUpgradeGoodsList = deepClone(res.upgradeGoodsList).map((val, index) => { this.copyUpgradeGoodsList = deepClone(res.upgradeGoodsList).map((val, index) => {
val?.upgradeGoodsServiceItemsList?.forEach(v => { val?.upgradeGoodsServiceItemsList?.forEach(v => {
v.uniqueValue = `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}` v.uniqueValue = `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}${(v.serviceItemId) ? `/${convertYuanToWan(v.minPrice)}-${convertYuanToWan(v.maxPrice)}万` : ''}`
v.uniqueCode = `${v.serviceCode}-${v.serviceGrade}/${v.servicePeriod}` v.uniqueCode = `${v.serviceCode}-${v.serviceGrade}/${v.servicePeriod}${(v.serviceItemId) ? `/${v.serviceItemId}` : ''}`
}) })
return { return {
id: val.id, id: val.id,
...@@ -192,8 +193,8 @@ export default { ...@@ -192,8 +193,8 @@ export default {
goodsSpecificationSingleList: deepClone(this.copyUpgradeGoodsList), goodsSpecificationSingleList: deepClone(this.copyUpgradeGoodsList),
upgradeGoodsList: res.upgradeGoodsList?.map(val => { upgradeGoodsList: res.upgradeGoodsList?.map(val => {
val?.upgradeGoodsServiceItemsList?.map(v => { val?.upgradeGoodsServiceItemsList?.map(v => {
v.uniqueValue = `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}` v.uniqueValue = `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}${(v.serviceItemId) ? `/${convertYuanToWan(v.minPrice)}-${convertYuanToWan(v.maxPrice)}万` : ''}`
v.uniqueCode = `${v.serviceCode}-${v.serviceGrade}/${v.servicePeriod}` v.uniqueCode = `${v.serviceCode}-${v.serviceGrade}/${v.servicePeriod}${(v.serviceItemId) ? `/${v.serviceItemId}` : ''}`
return v return v
}) })
return val return val
...@@ -274,7 +275,10 @@ export default { ...@@ -274,7 +275,10 @@ export default {
serviceName: val.serviceName, serviceName: val.serviceName,
serviceGrade: val.serviceGrade, serviceGrade: val.serviceGrade,
servicePeriod: val.servicePeriod, servicePeriod: val.servicePeriod,
standardSalesCost: val.standardSalesCost djCost: val.djCost,
serviceItemId: val.serviceItemId,
minPrice: val.minPrice,
maxPrice: val.maxPrice
}) })
}) })
arr.push({ arr.push({
...@@ -330,7 +334,10 @@ export default { ...@@ -330,7 +334,10 @@ export default {
serviceName: val.serviceName, serviceName: val.serviceName,
serviceGrade: val.serviceGrade, serviceGrade: val.serviceGrade,
servicePeriod: val.servicePeriod, servicePeriod: val.servicePeriod,
standardSalesCost: val.standardSalesCost djCost: val.djCost,
serviceItemId: val.serviceItemId,
minPrice: val.minPrice,
maxPrice: val.maxPrice
}) })
}) })
if (item.statusFlag != 2) { if (item.statusFlag != 2) {
......
...@@ -203,7 +203,7 @@ import { mapActions } from "vuex" ...@@ -203,7 +203,7 @@ import { mapActions } from "vuex"
import { limitPrice } from "@/common/format" import { limitPrice } from "@/common/format"
import selectGoodsDialog from "../../../components/selectGoodsDialog.vue" import selectGoodsDialog from "../../../components/selectGoodsDialog.vue"
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { filterSpecsStr } from "../../../filterOption" import { filterSpecsStr, convertYuanToWan } from "../../../filterOption"
import { businessLineOpt } from "@/common/constants.js" import { businessLineOpt } from "@/common/constants.js"
import { computeProductProfitDetail } from "@api/shelfManage" import { computeProductProfitDetail } from "@api/shelfManage"
export default { export default {
...@@ -342,7 +342,7 @@ export default { ...@@ -342,7 +342,7 @@ export default {
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: _formData.upgradeGoods?.upgradeGoodsServiceItemsList serviceItemNames: _formData.upgradeGoods?.upgradeGoodsServiceItemsList
?.map((item) => { ?.map((item) => {
return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ''}`
}) })
?.join(","), // 服务项目 ?.join(","), // 服务项目
specificationData: this.filterSpecsStr(_formData.upgradeGoods), specificationData: this.filterSpecsStr(_formData.upgradeGoods),
...@@ -403,7 +403,7 @@ export default { ...@@ -403,7 +403,7 @@ export default {
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: _valueObj?.upgradeGoodsServiceItemsList serviceItemNames: _valueObj?.upgradeGoodsServiceItemsList
?.map((item) => { ?.map((item) => {
return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ''}`
}) })
?.join(","), // 服务项目 ?.join(","), // 服务项目
// positionNames: _positionNamesArr.length ? _positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '', // positionNames: _positionNamesArr.length ? _positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '',
......
...@@ -324,7 +324,7 @@ import { mapActions } from "vuex" ...@@ -324,7 +324,7 @@ import { mapActions } from "vuex"
import { limitPrice } from "@/common/format" import { limitPrice } from "@/common/format"
import selectGoodsDialog from "../../../components/selectGoodsDialog.vue" import selectGoodsDialog from "../../../components/selectGoodsDialog.vue"
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { filterSpecsStr } from "../../../filterOption" import { filterSpecsStr, convertYuanToWan } from "../../../filterOption"
import { computeProductProfitDetail } from "@api/shelfManage" import { computeProductProfitDetail } from "@api/shelfManage"
export default { export default {
name: "PackageTab", name: "PackageTab",
...@@ -559,7 +559,7 @@ export default { ...@@ -559,7 +559,7 @@ export default {
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: _formData.upgradeGoods?.upgradeGoodsServiceItemsList serviceItemNames: _formData.upgradeGoods?.upgradeGoodsServiceItemsList
?.map((item) => { ?.map((item) => {
return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ''}`
}) })
?.join(","), // 服务项目 ?.join(","), // 服务项目
specificationData: this.filterSpecsStr(_formData.upgradeGoods), specificationData: this.filterSpecsStr(_formData.upgradeGoods),
...@@ -720,7 +720,7 @@ export default { ...@@ -720,7 +720,7 @@ export default {
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: _valueObj?.upgradeGoodsServiceItemsList serviceItemNames: _valueObj?.upgradeGoodsServiceItemsList
?.map((item) => { ?.map((item) => {
return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ''}`
}) })
?.join(","), // 服务项目 ?.join(","), // 服务项目
// positionNames: _positionNamesArr.length ? _positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '', // positionNames: _positionNamesArr.length ? _positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '',
......
...@@ -195,7 +195,7 @@ import { deepClone } from "@/common/util" ...@@ -195,7 +195,7 @@ import { deepClone } from "@/common/util"
import { mapActions } from "vuex" import { mapActions } from "vuex"
import { limitPrice } from "@/common/format" import { limitPrice } from "@/common/format"
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { filterSpecsStr } from "@/views/goods/filterOption" import { filterSpecsStr, convertYuanToWan } from "@/views/goods/filterOption"
import { businessLineOpt } from "@/common/constants.js" import { businessLineOpt } from "@/common/constants.js"
export default { export default {
name: "GoodTab", name: "GoodTab",
...@@ -317,7 +317,7 @@ export default { ...@@ -317,7 +317,7 @@ export default {
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: _formData.upgradeGoods?.upgradeGoodsServiceItemsList serviceItemNames: _formData.upgradeGoods?.upgradeGoodsServiceItemsList
?.map((item) => { ?.map((item) => {
return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ''}`
}) })
?.join(","), // 服务项目 ?.join(","), // 服务项目
specificationData: this.filterSpecsStr(_formData.upgradeGoods), specificationData: this.filterSpecsStr(_formData.upgradeGoods),
......
...@@ -311,7 +311,7 @@ import { businessNature, businessLineOpt } from "@/common/constants.js" ...@@ -311,7 +311,7 @@ import { businessNature, businessLineOpt } from "@/common/constants.js"
import { mapActions } from "vuex" import { mapActions } from "vuex"
import { limitPrice } from "@/common/format" import { limitPrice } from "@/common/format"
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { filterSpecsStr } from "@/views/goods/filterOption" import { filterSpecsStr, convertYuanToWan } from "@/views/goods/filterOption"
export default { export default {
name: "PackageTab", name: "PackageTab",
...@@ -442,7 +442,7 @@ export default { ...@@ -442,7 +442,7 @@ export default {
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: _formData.upgradeGoods?.upgradeGoodsServiceItemsList serviceItemNames: _formData.upgradeGoods?.upgradeGoodsServiceItemsList
?.map((item) => { ?.map((item) => {
return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ''}`
}) })
?.join(","), // 服务项目 ?.join(","), // 服务项目
specificationData: this.filterSpecsStr(_formData.upgradeGoods), specificationData: this.filterSpecsStr(_formData.upgradeGoods),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!