Commit e1b1f52b by zhangxw

bug修改

1 parent 4615ebe1
...@@ -48,3 +48,9 @@ export function getAllGroupByCategory(data) { ...@@ -48,3 +48,9 @@ export function getAllGroupByCategory(data) {
data.method = `${path}productManager.getAllGroupByCategory` data.method = `${path}productManager.getAllGroupByCategory`
return request(data) return request(data)
} }
// 获取所有上架商品
export function getAllGoodsList(data) {
data.method = `${path}productManager.search`
return request(data, 'post')
}
\ No newline at end of file \ No newline at end of file
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<!-- 商品分类 权益升级 (线上126) --> <!-- 商品分类 权益升级 (线上126) -->
<div class="item" v-if="equitySceneType.includes(formData[item.key]) || formData['sceneType'] == 0"> <div class="item" v-if="equitySceneType.includes(formData[item.key]) || formData['sceneType'] == 0">
<div class="label">服务项目:</div> <div class="label">服务项目:</div>
<div class="value">{{ serviceItems }}</div> <div class="value">{{ formData['serviceItemNames'] }}</div>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
...@@ -97,8 +97,7 @@ export default { ...@@ -97,8 +97,7 @@ export default {
formData: {}, formData: {},
selectedValue: '', selectedValue: '',
show: false, show: false,
examineFlag: false, examineFlag: false
serviceItems: ''
} }
}, },
...@@ -120,10 +119,6 @@ export default { ...@@ -120,10 +119,6 @@ export default {
formList: { formList: {
type: Array, type: Array,
default: () => { } default: () => { }
},
productServiceItemList: {
type: Array,
default: () => { }
} }
}, },
...@@ -157,8 +152,6 @@ export default { ...@@ -157,8 +152,6 @@ export default {
this.examineFlag = true this.examineFlag = true
} }
}) })
// 默认显示所有服务项目 (暂时不可配置 显示全部)
this.serviceItems = this.productServiceItemList?.map(v => { return v.serviceName })?.join(',') || ''
this.filterEditForm() this.filterEditForm()
}, },
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</el-form-item> </el-form-item>
</div> </div>
<!-- 商品附带信息 --> <!-- 商品附带信息 -->
<div v-if="formData['goodsId'].length && item.type === 'incidBox'"> <div v-if="formData['upgradeGoodsId'] && item.type === 'incidBox'">
<div class="incid_box"> <div class="incid_box">
<div class="item" v-for="(subItem, subIndex) in item.detailInfo" :key="subIndex"> <div class="item" v-for="(subItem, subIndex) in item.detailInfo" :key="subIndex">
<div class="label">{{ subItem.label }}:</div> <div class="label">{{ subItem.label }}:</div>
...@@ -47,12 +47,12 @@ ...@@ -47,12 +47,12 @@
<!-- 商品分类 权益升级 (线上126) --> <!-- 商品分类 权益升级 (线上126) -->
<div class="item" v-if="equitySceneType.includes(formData['goodsType']) || formData['sceneType'] == 0"> <div class="item" v-if="equitySceneType.includes(formData['goodsType']) || formData['sceneType'] == 0">
<div class="label">服务项目:</div> <div class="label">服务项目:</div>
<div class="value">{{ serviceItems }}</div> <div class="value">{{ formData['serviceItemNames'] }}</div>
</div> </div>
</div> </div>
</div> </div>
<!-- 下拉框/输入框 --> <!-- 下拉框/输入框 -->
<div v-if="item.type === 'input' || item.type === 'select' || item.type === 'cascader'"> <div v-if="item.type === 'input' || item.type === 'select' || item.type === 'searchSelect'">
<el-form-item :prop="item.name" <el-form-item :prop="item.name"
:label="item.label ? item.label + ':' : ''" :label="item.label ? item.label + ':' : ''"
:id="item.name" :id="item.name"
...@@ -84,15 +84,23 @@ ...@@ -84,15 +84,23 @@
:label="subItem[item.optionLabel]" :label="subItem[item.optionLabel]"
:value="subItem[item.optionId]" /> :value="subItem[item.optionId]" />
</el-select> </el-select>
<!-- 联级选择框 --> <el-select v-else-if="item.type === 'searchSelect'"
<el-cascader v-else-if="item.type === 'cascader'"
ref="goods-cascader"
v-model="formData[item.name]" v-model="formData[item.name]"
:options="secondGoodsList" :clearable="item.isClear"
:style="{'width': item.width || formItemWidth}"
:placeholder="'请选择' + item.label" :placeholder="'请选择' + item.label"
filterable @change="selectAddAttr($event, item)"
@change="changeSelect" /> :style="{'width': item.width || formItemWidth}"
remote
reserve-keyword
@visible-change="visibleChange"
:remote-method="remoteMethod"
v-el-select-loadmore="interestsLoadmore"
filterable>
<el-option v-for="subItem in item.optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]" />
</el-select>
</el-form-item> </el-form-item>
</div> </div>
<!-- 多选 --> <!-- 多选 -->
...@@ -135,8 +143,8 @@ ...@@ -135,8 +143,8 @@
plain plain
class="width_100" class="width_100"
@click="handleUp(2)" @click="handleUp(2)"
v-if="!formData.status || formData.status == 3"> v-if="filterEmpty(formData.status) || formData.status == 3">
保存 存草稿
</el-button> </el-button>
<el-button class="width_100 cancel-btn" @click="handleClose"> <el-button class="width_100 cancel-btn" @click="handleClose">
取消 取消
...@@ -150,9 +158,8 @@ ...@@ -150,9 +158,8 @@
import { deepClone } from '@/common/util' import { deepClone } from '@/common/util'
import { limitPrice } from '@/common/format' import { limitPrice } from '@/common/format'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { commodityAddSeviceMerchant } from '@api/commodity'
import { getSceneTypeListByMerchantId } from '@api/grounding' import { getSceneTypeListByMerchantId } from '@api/grounding'
import { sceneCodeList } from '@/common/constants.js' import { sceneCodeList, positionTypeList } from '@/common/constants.js'
import { upgradeSupplyModeList, crowdUpgradeSupplyModeList } from "../constants/data" import { upgradeSupplyModeList, crowdUpgradeSupplyModeList } from "../constants/data"
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
export default { export default {
...@@ -166,11 +173,10 @@ export default { ...@@ -166,11 +173,10 @@ export default {
priceReg: /^\d[\d\.]*$/ priceReg: /^\d[\d\.]*$/
}, },
show: false, show: false,
serviceItems: '',
rules: { rules: {
merchantId: [{ required: true, message: '请选择上架门店', trigger: 'change' }], merchantId: [{ required: true, message: '请选择上架门店', trigger: 'change' }],
sceneType: [{ required: true, message: '请选择业务场景', trigger: 'change' }], sceneType: [{ required: true, message: '请选择业务场景', trigger: 'change' }],
goodsId: [{ required: true, message: '请选择上架商品', trigger: 'change' }], upgradeGoodsId: [{ required: true, message: '请选择上架商品', trigger: 'change' }],
productType: [{ required: true, message: '请选择产品类型', trigger: 'change' }], productType: [{ required: true, message: '请选择产品类型', trigger: 'change' }],
baseSupplyMode: [{ required: true, message: '请选择基础产品供货模式', trigger: 'change' }], baseSupplyMode: [{ required: true, message: '请选择基础产品供货模式', trigger: 'change' }],
upgradeSupplyMode: [{ required: true, message: '请选择升级/产品供货模式', trigger: 'change' }], upgradeSupplyMode: [{ required: true, message: '请选择升级/产品供货模式', trigger: 'change' }],
...@@ -221,10 +227,6 @@ export default { ...@@ -221,10 +227,6 @@ export default {
secondGoodsList: { secondGoodsList: {
type: Array, type: Array,
default: () => {} default: () => {}
},
productServiceItemList: {
type: Array,
default: () => { }
} }
}, },
...@@ -253,12 +255,27 @@ export default { ...@@ -253,12 +255,27 @@ export default {
} }
}, },
directives: {
'el-select-loadmore': {
bind (el, binding) {
const SELECTWRAP_DOM = el.querySelector(
'.el-select-dropdown .el-select-dropdown__wrap'
)
SELECTWRAP_DOM.addEventListener('scroll', function () {
const condition =
this.scrollHeight - this.scrollTop <= this.clientHeight
if (condition) {
binding.value()
}
})
}
}
},
mounted() { mounted() {
this.formData = deepClone(this.originData) this.formData = deepClone(this.originData)
this.copyFormList = deepClone(this.formList) this.copyFormList = deepClone(this.formList)
this.filterEditForm() this.filterEditForm()
// 默认显示所有服务项目 (暂时不可配置 显示全部)
this.serviceItems = this.productServiceItemList.map(v => { return v.serviceName })?.join(',') || ''
}, },
methods: { methods: {
...@@ -303,6 +320,15 @@ export default { ...@@ -303,6 +320,15 @@ export default {
this.$refs[this.formRef + 'd2FormRuleForm'] && this.$refs[this.formRef + 'd2FormRuleForm'].clearValidate() this.$refs[this.formRef + 'd2FormRuleForm'] && this.$refs[this.formRef + 'd2FormRuleForm'].clearValidate()
}) })
}, },
visibleChange(data) {
this.$emit('visibleChange', data)
},
interestsLoadmore() {
this.$emit('interestsLoadmore')
},
remoteMethod(query) {
this.$emit('remoteMethod', query)
},
// 获取门店开通的场景 // 获取门店开通的场景
getSceneTypeList(e) { getSceneTypeList(e) {
getSceneTypeListByMerchantId({ merchantId: e }).then(res => { getSceneTypeListByMerchantId({ merchantId: e }).then(res => {
...@@ -310,21 +336,6 @@ export default { ...@@ -310,21 +336,6 @@ export default {
this.$set(this.formList[0].formBlock[1], 'optionList', arr) this.$set(this.formList[0].formBlock[1], 'optionList', arr)
}) })
}, },
// 搜索上架门店
// remoteMethod(queryString) {
// if (queryString) {
// this.loading = true
// setTimeout(() => {
// this.loading = false
// var params = { currentPage: 1, pageSize: 1000, merchantName: queryString }
// commodityAddSeviceMerchant(params).then(res => {
// this.formList[0].formBlock[0].optionList = res.list || []
// })
// }, 600);
// } else {
// this.formList[0].formBlock[0].optionList = []
// }
// },
// 修复直接调用可以会因为没有对应方法报错的问题 // 修复直接调用可以会因为没有对应方法报错的问题
input(event, item) { input(event, item) {
item.handleInput && this.handleInput(event, item) item.handleInput && this.handleInput(event, item)
...@@ -342,20 +353,24 @@ export default { ...@@ -342,20 +353,24 @@ export default {
}, },
// 选择框-添加其他属性 // 选择框-添加其他属性
selectAddAttr(value, targetItem) { selectAddAttr(value, targetItem) {
let _formData = this.formData
if (targetItem.name == 'merchantId') { if (targetItem.name == 'merchantId') {
var tempVal = targetItem.optionList.find(item => item.merchantId === value) var _tempVal = targetItem.optionList.find(item => item.merchantId === value)
this.formData.merchantName = tempVal.merchantName _formData.merchantName = _tempVal.merchantName
} }
}, // 带出上架商品的附带信息
// 联级选择框 if (targetItem.name === 'upgradeGoodsId') {
changeSelect(value) { let _valueObj = targetItem.optionList.filter(v => v.confId == value)[0]?.valueObj || {}
this.formData.upgradeGoodsId = value.constructor === Array ? value[value.length - 1] : value let _positionNamesArr = _valueObj?.goodsType == 1 ? deepClone(positionTypeList).filter(it => _valueObj?.position == it.position) : []
this.formData.goodsType = value.constructor === Array ? value[0] : '' _formData.upgradeGoodsId = value
// 回显商品附带信息 _formData.upgradeGoodsName = _valueObj?.upgradeGoodsName
let noodObj = this.$refs['goods-cascader'][0].getCheckedNodes()[0] || {} _formData.type = _valueObj?.type
this.formData = { _formData.upgradePrice = _valueObj?.upgradePrice
...this.formData, _formData.positionNames = _positionNamesArr.length ? _positionNamesArr[0]?.confName : '' // 部位
...noodObj?.data?.valueObj _formData.goodsName = _valueObj?.goodsName
_formData.goodsTypeName = _valueObj?.goodsTypeName
_formData.goodsType = _valueObj?.goodsType
_formData.serviceItemNames = _valueObj?.serviceItemNames
} }
}, },
handleClose() { handleClose() {
...@@ -415,6 +430,7 @@ export default { ...@@ -415,6 +430,7 @@ export default {
.item{ .item{
flex: 0 0 33%; flex: 0 0 33%;
display: flex; display: flex;
align-items: start;
margin: 10px 0; margin: 10px 0;
.label{ .label{
flex-shrink: 0; flex-shrink: 0;
......
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
:origin-data="editData" :origin-data="editData"
:form-list="editForm" :form-list="editForm"
:secondGoodsList="secondGoodsList" :secondGoodsList="secondGoodsList"
:productServiceItemList="productServiceItemList"
@handleAddConfirm="handleAddConfirm" @handleAddConfirm="handleAddConfirm"
@visibleChange="visibleChange"
@interestsLoadmore="interestsLoadmore"
@remoteMethod="remoteMethod"
@handleClose="handleAddClose"></grounding-form> @handleClose="handleAddClose"></grounding-form>
</div> </div>
</d2-container> </d2-container>
...@@ -19,10 +21,10 @@ ...@@ -19,10 +21,10 @@
import { productList, baseSupplyModeList, upgradeSupplyModeList } from "./constants/data" import { productList, baseSupplyModeList, upgradeSupplyModeList } from "./constants/data"
import { getMerchantGoodsInfo } from '@api/grounding' import { getMerchantGoodsInfo } from '@api/grounding'
import groundingForm from "./components/groundingForm.vue" import groundingForm from "./components/groundingForm.vue"
import { BaseData, positionTypeList } from '@/common/constants.js' import { positionTypeList } from '@/common/constants.js'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { deepClone } from '@/common/util' import { deepClone } from '@/common/util'
import { addOrUpdateAPI, getAllGroupByCategory } from '@api/grounding' import { addOrUpdateAPI, getAllGoodsList } from '@api/grounding'
import { getShopMerchantList } from '@api/deviceManage' import { getShopMerchantList } from '@api/deviceManage'
export default { export default {
name: 'editGrounding', name: 'editGrounding',
...@@ -60,14 +62,14 @@ export default { ...@@ -60,14 +62,14 @@ export default {
}, { }, {
title: '商品信息', title: '商品信息',
formBlock: [{ formBlock: [{
name: 'goodsId', name: 'upgradeGoodsId',
label: '上架商品', label: '上架商品',
isRequired: true, isRequired: true,
type: 'cascader', type: 'searchSelect',
isClear: false,
optionList: [], optionList: [],
optionId: 'categoryType', isClear: false,
optionLabel: 'categoryName', optionId: 'confId',
optionLabel: 'confValue',
width: '432px' width: '432px'
}, { }, {
type: 'incidBox', type: 'incidBox',
...@@ -82,7 +84,7 @@ export default { ...@@ -82,7 +84,7 @@ export default {
label: '参考售价/元', label: '参考售价/元',
value: 'upgradePrice' value: 'upgradePrice'
}, { }, {
label: '所属素材', label: '所属系列',
value: 'goodsName' value: 'goodsName'
}, { }, {
label: '所属分类', label: '所属分类',
...@@ -167,7 +169,7 @@ export default { ...@@ -167,7 +169,7 @@ export default {
editData: { editData: {
merchantId: '', merchantId: '',
sceneCode: '', sceneCode: '',
goodsId: [], upgradeGoodsId: '',
goodsCode: '', goodsCode: '',
positionNames: '', positionNames: '',
goodsType: '', goodsType: '',
...@@ -182,17 +184,22 @@ export default { ...@@ -182,17 +184,22 @@ export default {
reconcilyCostPrice: '' reconcilyCostPrice: ''
}, },
secondGoodsList: [], secondGoodsList: [],
merchantServiceList: [] merchantServiceList: [],
goodsNameKeyword: '',
currentPage: 1,
pageSize: 20
} }
}, },
mounted() { mounted() {
this.getProductServiceItemList()
this.getBaseData() this.getBaseData()
let id = this.$route.params.id let id = this.$route.params.id
// 获取全部上架门店
this.getAllShopMerchantList() this.getAllShopMerchantList()
if (!id) { if (!id) {
this.getGoodsList() // 获取全部上架商品
this.getSelectingList()
} else { } else {
// 获取商品详情
this.getDetailInfo(id) this.getDetailInfo(id)
} }
}, },
...@@ -201,82 +208,84 @@ export default { ...@@ -201,82 +208,84 @@ export default {
get: 'd2admin/base/get', get: 'd2admin/base/get',
close: 'd2admin/page/close' close: 'd2admin/page/close'
}), }),
// 获取权益升级类目 服务项目
async getProductServiceItemList() {
this.productServiceItemList = await this.get(BaseData.productServiceItemList)
},
// 获取全部4s店 // 获取全部4s店
getAllShopMerchantList() { getAllShopMerchantList() {
getShopMerchantList({}).then(res => { getShopMerchantList({}).then(res => {
let formList = this.editForm[0].formBlock let editForm = this.editForm[0].formBlock
formList[formList.findIndex(val => val.name == 'merchantId')].optionList = res || [] editForm[editForm.findIndex(val => val.name == 'merchantId')].optionList = res || []
}) })
}, },
// 获取上架商品数据 // 获取上架数据
getGoodsList(flag) { remoteMethod(query) {
getAllGroupByCategory({}).then(res => { this.goodsNameKeyword = query
res && res.forEach(item => { this.currentPage = 1
item.value = item.categoryType this.$set(this.editForm[1].formBlock[0], 'optionList', [])
item.label = item.categoryName this.getSelectingList() // 请求接口
const twoChildren = [] },
item.baseGoods && item.baseGoods.forEach(val => { visibleChange(data) {
val.upgradeGoodsList && val.upgradeGoodsList.forEach(v => { // 获取焦点重新渲染下拉框数据
let positionNamesArr = val.goodsInfo?.goodsType == 1 ? deepClone(positionTypeList).filter(it => v.position == it.position) : [] if (data) {
twoChildren.push({ if (this.goodsNameKeyword) {
value: v.id, this.goodsNameKeyword = ''
label: v.upgradeGoodsName, this.currentPage = 1
this.$set(this.editForm[1].formBlock[0], 'optionList', [])
this.getSelectingList()
}
}
},
// 获取更多上架商品
interestsLoadmore() {
setTimeout(() => {
this.currentPage = this.currentPage + 1
if (this.allPages < this.currentPage) {
this.currentPage = this.allPages
return
}
this.getSelectingList()
}, 10)
},
getSelectingList(defaultSelect) {
getAllGoodsList({
goodsNameKeyword: this.goodsNameKeyword,
currentPage: this.currentPage,
pageSize: this.pageSize
}).then(res => {
this.copyFormList = deepClone(this.editForm)
this.allPages = res.pages
let resArr = []
res.list && res.list.forEach(val => {
val.upgradeGoodsList.forEach(v => {
resArr.push({
confId: v.id,
confValue: `${v?.upgradeGoodsName} / ${val?.goodsInfo?.goodsTypeName} / ${val?.goodsInfo?.goodsName}`,
valueObj: { valueObj: {
upgradeGoodsName: v.upgradeGoodsName, upgradeGoodsName: v?.upgradeGoodsName,
goodsName: val.goodsInfo?.goodsName, goodsName: val?.goodsInfo?.goodsName,
type: v.type, goodsTypeName: val?.goodsInfo?.goodsTypeName,
goodsTypeName: val.goodsInfo?.goodsTypeName, upgradePrice: v?.upgradePrice,
upgradePrice: v.upgradePrice, type: v?.type,
purchasePrice: v.purchasePrice, goodsType: val?.goodsInfo?.goodsType,
positionNames: positionNamesArr.length ? positionNamesArr[0]?.confName : '' // 部位 position: v?.position,
serviceItemNames: v?.upgradeGoodsServiceItemsList?.map(item => {return item.serviceName})?.join(',')
} }
}) })
}) })
}) })
item.children = twoChildren let arr = this.editForm[1].formBlock[0].optionList.concat(resArr)
if (defaultSelect?.length) arr = arr.concat(defaultSelect)
this.$set(this.editForm[1].formBlock[0], 'optionList', this.unique(arr))
this.$nextTick(() => {
this.show = true
}) })
this.secondGoodsList = res }).catch(() => {
if (flag) {
this.decorate(flag, res)
}
this.$nextTick(() => { this.$nextTick(() => {
this.show = true this.show = true
}) })
}) })
}, },
decorate(upgradeGoodsId, treeData) { unique(arr){
let arr = this.changeDetSelect( const res= new Map()
upgradeGoodsId, return arr.filter((a)=> !res.has(a.confId) && res.set(a.confId,1))
treeData
)
this.editData.goodsId = arr
},
changeDetSelect(key, treeData) {
let arr = [] // 在递归时操作的数组
let returnArr = [] // 存放结果的数组
let depth = 0 // 定义全局层级
// 定义递归函数
function childrenEach(treeData, depthN) {
for (var j = 0; j < treeData.length; j++) {
depth = depthN // 将执行的层级赋值 到 全局层级
arr[depthN] = treeData[j].value
if (treeData[j].value == key && depthN == 1) { // depthN == 1只匹配子商品id
returnArr = arr.slice(0, depthN + 1) // 将目前匹配的数组,截断并保存到结果数组,
break
} else {
if (treeData[j].children) {
depth++
childrenEach(treeData[j].children, depth)
}
}
}
return returnArr
}
return childrenEach(treeData, depth)
}, },
getBaseData() { getBaseData() {
this.editForm.forEach(item => { this.editForm.forEach(item => {
...@@ -302,8 +311,12 @@ export default { ...@@ -302,8 +311,12 @@ export default {
res.productType = productType res.productType = productType
res.upgradePrice = res.upgradeGoods?.upgradePrice || '-' res.upgradePrice = res.upgradeGoods?.upgradePrice || '-'
res.positionNames = positionNamesArr.length ? positionNamesArr[0]?.confName : '' res.positionNames = positionNamesArr.length ? positionNamesArr[0]?.confName : ''
let defaultSelect = [{
confId: res?.upgradeGoodsId,
confValue: `${res?.upgradeGoodsName} / ${res?.goodsTypeName} / ${res?.goodsName})`
}]
this.editData = res || {} this.editData = res || {}
this.getGoodsList(res.upgradeGoodsId) this.getSelectingList(defaultSelect)
}) })
}, },
handleAddClose() { handleAddClose() {
...@@ -325,10 +338,6 @@ export default { ...@@ -325,10 +338,6 @@ export default {
formObj.baseProductFlag = data[v.name].includes(1) ? 'Y' : 'N' formObj.baseProductFlag = data[v.name].includes(1) ? 'Y' : 'N'
formObj.upgradeProductFlag = data[v.name].includes(2) ? 'Y' : 'N' formObj.upgradeProductFlag = data[v.name].includes(2) ? 'Y' : 'N'
} }
if (v.name == 'goodsId') {
formObj.upgradeGoodsId = data[v.name].constructor === Array ? data[v.name][data[v.name].length - 1] : data[v.name]
delete formObj[v.name]
}
}) })
}) })
delete formObj?.productType delete formObj?.productType
......
...@@ -20,7 +20,7 @@ import detail from './components/detail.vue' ...@@ -20,7 +20,7 @@ import detail from './components/detail.vue'
import { sceneList } from '@/common/constants.js' import { sceneList } from '@/common/constants.js'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { deepClone, Util } from '@/common/util' import { deepClone, Util } from '@/common/util'
import { BaseData, positionTypeList } from '@/common/constants' import { positionTypeList } from '@/common/constants'
import { productList, baseSupplyModeList, upgradeSupplyModeList, crowdUpgradeSupplyModeList} from './constants/data' import { productList, baseSupplyModeList, upgradeSupplyModeList, crowdUpgradeSupplyModeList} from './constants/data'
export default { export default {
name: 'groundingDetail', name: 'groundingDetail',
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
label: '参考售价/元', label: '参考售价/元',
value: 'upgradePrice' value: 'upgradePrice'
}, { }, {
label: '所属素材', label: '所属系列',
value: 'goodsName' value: 'goodsName'
}, { }, {
label: '所属分类', label: '所属分类',
...@@ -132,7 +132,6 @@ export default { ...@@ -132,7 +132,6 @@ export default {
// 获取商品详情 // 获取商品详情
let id = this.$route.params.id let id = this.$route.params.id
this.detailId = id this.detailId = id
this.getProductServiceItemList()
if (!id) return if (!id) return
this.getDetailInfo(id) this.getDetailInfo(id)
}, },
...@@ -141,9 +140,6 @@ export default { ...@@ -141,9 +140,6 @@ export default {
get: 'd2admin/base/get', get: 'd2admin/base/get',
close: 'd2admin/page/close' close: 'd2admin/page/close'
}), }),
async getProductServiceItemList() {
this.productServiceItemList = await this.get(BaseData.productServiceItemList)
},
getDetailInfo(id) { getDetailInfo(id) {
getMerchantGoodsInfo({ id }).then(res => { getMerchantGoodsInfo({ id }).then(res => {
let productType = [] let productType = []
...@@ -174,6 +170,7 @@ export default { ...@@ -174,6 +170,7 @@ export default {
res.upgradePrice = res.upgradeGoods?.upgradePrice || '-' res.upgradePrice = res.upgradeGoods?.upgradePrice || '-'
res.positionNames = positionNamesArr.length ? positionNamesArr[0]?.confName : '' res.positionNames = positionNamesArr.length ? positionNamesArr[0]?.confName : ''
res.productType = productType res.productType = productType
res.serviceItemNames = res.upgradeGoods?.upgradeGoodsServiceItemsList?.map(v => {return v.serviceName})?.join(',')
this.editData = res || {} this.editData = res || {}
this.$nextTick(() => { this.$nextTick(() => {
......
...@@ -274,39 +274,39 @@ export default { ...@@ -274,39 +274,39 @@ export default {
label: '售价/元', label: '售价/元',
prop: 'sellPrice', prop: 'sellPrice',
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.sellPrice ? this.priceFilter(cellValue.sellPrice) : '-' return this.priceFilter(cellValue.sellPrice)
} }
}, { }, {
label: '最低售价/元', label: '最低售价/元',
prop: 'minSellPrice', prop: 'minSellPrice',
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.minSellPrice ? this.priceFilter(cellValue.minSellPrice) : '-' return this.priceFilter(cellValue.minSellPrice)
}, },
width: 100 width: 100
}, { }, {
label: '产品/升级成本', label: '产品/升级成本',
prop: 'upgradeProductCost', prop: 'upgradeProductCost',
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.upgradeProductCost ? this.priceFilter(cellValue.upgradeProductCost) : '-' return this.priceFilter(cellValue.upgradeProductCost)
}, },
width: 110 width: 110
}, { }, {
label: '赠送成本', label: '赠送成本',
prop: 'giftCost', prop: 'giftCost',
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.giftCost ? this.priceFilter(cellValue.giftCost) : '-' return this.priceFilter(cellValue.giftCost)
} }
}, { }, {
label: '回收成本', label: '回收成本',
prop: 'recoveryCost', prop: 'recoveryCost',
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.recoveryCost ? this.priceFilter(cellValue.recoveryCost) : '-' return this.priceFilter(cellValue.recoveryCost)
} }
}, { }, {
label: '虚拟对账成本', label: '虚拟对账成本',
prop: 'virtualAccountCost', prop: 'virtualAccountCost',
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.virtualAccountCost ? this.priceFilter(cellValue.virtualAccountCost) : '-' return this.priceFilter(cellValue.virtualAccountCost)
}, },
width: 110 width: 110
}, { }, {
...@@ -417,6 +417,7 @@ export default { ...@@ -417,6 +417,7 @@ export default {
// 处理金额补零 // 处理金额补零
priceFilter(num) { priceFilter(num) {
var pow = Math.pow(10, 2) var pow = Math.pow(10, 2)
if (this.filterEmpty(num)) return '-'
return (Math.round(num * pow) / pow).toFixed(2) return (Math.round(num * pow) / pow).toFixed(2)
}, },
// 联动或许对应分类下的素材 // 联动或许对应分类下的素材
...@@ -449,6 +450,8 @@ export default { ...@@ -449,6 +450,8 @@ export default {
yqMerchantId: '', yqMerchantId: '',
goodsSource: 0 goodsSource: 0
} }
// 重新查询
this.$refs.groundingIndexTable.refreshTable(true, true)
}, },
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise(resolve => {
...@@ -505,6 +508,10 @@ export default { ...@@ -505,6 +508,10 @@ export default {
] ]
this.actionSetDownloadList({ list, type: 'dowloadList' }) this.actionSetDownloadList({ list, type: 'dowloadList' })
}, },
// 校验是否为空 不包含0
filterEmpty(data) {
return data instanceof Array ? data.length <= 0 : (data ?? '') === ''
},
formatJson(filterVal, jsonData) { formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => v[j])) return jsonData.map(v => filterVal.map(j => v[j]))
}, },
......
...@@ -264,7 +264,7 @@ export default { ...@@ -264,7 +264,7 @@ export default {
}) })
}, },
keyDowmGetList() { keyDowmGetList() {
this.$refs.commodityTable.refreshTable() this.$refs.productManageTable.refreshTable()
}, },
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
...@@ -274,6 +274,7 @@ export default { ...@@ -274,6 +274,7 @@ export default {
baseGoodsStatus: '', baseGoodsStatus: '',
type: '' type: ''
} }
this.$refs.productManageTable.refreshTable(true, true)
}, },
handleAdd(form) { handleAdd(form) {
this.close({ tagName: '/editProductManage' }) this.close({ tagName: '/editProductManage' })
......
...@@ -347,7 +347,7 @@ export default { ...@@ -347,7 +347,7 @@ export default {
specialList = ['purchasePrice', 'warrantyPeriod'] specialList = ['purchasePrice', 'warrantyPeriod']
} }
// 仅分发至单店时,隐藏采购价/卷,无需填写 // 仅分发至单店时,隐藏采购价/卷,无需填写
if (this.goodsInfoData.shoppingMallFlag === '0') specialList.splice(specialList.indexOf('purchasePrice'), 1) if (this.goodsInfoData.shoppingMallFlag === '0' && specialList.indexOf('purchasePrice') > 0) specialList.splice(specialList.indexOf('purchasePrice'), 1)
let requiredList = ['specificationData', 'upgradePrice', ...specialList] let requiredList = ['specificationData', 'upgradePrice', ...specialList]
for (var i = 0; i < confirmShopData.length; i++) { for (var i = 0; i < confirmShopData.length; i++) {
const item = confirmShopData[i] const item = confirmShopData[i]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!