Commit bf21f95d by zhangxw

商品中心改版 代码提交

1 parent 4e47314e
...@@ -116,3 +116,9 @@ export function getThiredMaterialList(data) { ...@@ -116,3 +116,9 @@ export function getThiredMaterialList(data) {
data.method = `${path}goods.type.querySceneCategoryGoods` data.method = `${path}goods.type.querySceneCategoryGoods`
return request(data, 'post') return request(data, 'post')
} }
// 保存商品
export function saveTempGoods(data) {
data.method = `${path}basegoods.saveTemp`
return request(data, 'post')
}
\ No newline at end of file \ No newline at end of file
...@@ -324,7 +324,7 @@ export default { ...@@ -324,7 +324,7 @@ export default {
shopPriceArr.push(v.upgradePrice) shopPriceArr.push(v.upgradePrice)
v.listShowShopPrice = v.upgradePrice v.listShowShopPrice = v.upgradePrice
v.listShowStock = v.stock v.listShowStock = v.stock
v.listShowSpecificationData = v.specificationData.replace(';~;', ' ') v.listShowSpecificationData = v.specificationData.replace(/;~;/g, ' ')
v.goodsInfo.goodsName = val.baseGoodsName || v.goodsInfo.goodsName // 新数据显示商品名称,历史商品数据显示素材名称 v.goodsInfo.goodsName = val.baseGoodsName || v.goodsInfo.goodsName // 新数据显示商品名称,历史商品数据显示素材名称
stockTotal += v.stock stockTotal += v.stock
}) })
......
...@@ -117,8 +117,10 @@ ...@@ -117,8 +117,10 @@
<div v-else <div v-else
slot="auth-button-other" slot="auth-button-other"
slot-scope="scope"> slot-scope="scope">
<span v-show="showAloneUpOrDownBT(scope.scope)">
<auth-button :data="scope.scope" <auth-button :data="scope.scope"
:show-btn-ids="['9030208']" /> :show-btn-ids="['9030208']" />
</span>
</div> </div>
</d2-table> </d2-table>
</div> </div>
...@@ -345,14 +347,16 @@ export default { ...@@ -345,14 +347,16 @@ export default {
return { return {
0: 'ashSpot', 0: 'ashSpot',
1: 'greenSpot', 1: 'greenSpot',
2: 'yellowSpot' 2: 'yellowSpot',
3: 'ashSpot'
}[cellValue.status] }[cellValue.status]
}, },
formatter: (cellValue) => { formatter: (cellValue) => {
return { return {
0: '待上架', 0: '待上架',
1: '在售', 1: '在售',
2: '部分在售' 2: '部分在售',
3: '草稿'
}[cellValue.status] }[cellValue.status]
} }
}, { }, {
...@@ -382,6 +386,9 @@ export default { ...@@ -382,6 +386,9 @@ export default {
}, { }, {
confId: 2, confId: 2,
confValue: '部分在售' confValue: '部分在售'
}, {
confId: 3,
confValue: '草稿'
}], }],
reviewStatusList: [{ reviewStatusList: [{
confId: 0, confId: 0,
...@@ -441,7 +448,6 @@ export default { ...@@ -441,7 +448,6 @@ export default {
currentPage: 1, currentPage: 1,
pageSize: 9999 pageSize: 9999
}).then(res => { }).then(res => {
console.log(res)
this.baseData.merchantServiceList = res.list this.baseData.merchantServiceList = res.list
this.getOptionsList() this.getOptionsList()
}) })
...@@ -615,6 +621,14 @@ export default { ...@@ -615,6 +621,14 @@ export default {
// console.log(row); // console.log(row);
return flag return flag
}, },
// 子商品单独上下架操作按钮显示
showAloneUpOrDownBT(row) {
var flag = true
if (row.status == '3') { // 父商品状态为草稿 不显示按钮
flag = false
}
return flag
},
// 子商品单独上下架 // 子商品单独上下架
handleUpOrDownForChild(row) { handleUpOrDownForChild(row) {
console.log(row) console.log(row)
...@@ -668,7 +682,7 @@ export default { ...@@ -668,7 +682,7 @@ export default {
// html = '审核中的商品不可执行此操作!' // html = '审核中的商品不可执行此操作!'
// } // }
row.status row.status == 1 || row.status == 2 || row.status == 0
? this.$confirm(html, '提示', { ? this.$confirm(html, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
showCancelButton: false, showCancelButton: false,
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
v-for="(item,index) in commodityInfo.upgradeGoodsList" v-for="(item,index) in commodityInfo.upgradeGoodsList"
:key="index"> :key="index">
<p class="car-sub-head"> <p class="car-sub-head">
商品{{ index + 1 }}-{{ item.specificationData ? (item.goodsInfo.goodsName + ' ' + item.specificationData.replace(';~;', ' ')) : item.goodsInfo.goodsName }} 商品{{ index + 1 }}-{{ item.specificationData ? (item.goodsInfo.goodsName + ' ' + item.specificationData.replace(/;~;/g, ' ')) : item.goodsInfo.goodsName }}
</p> </p>
<!-- <el-form-item class="d2-drawer-item" <!-- <el-form-item class="d2-drawer-item"
label="商品名称:"> label="商品名称:">
......
...@@ -203,19 +203,6 @@ export default { ...@@ -203,19 +203,6 @@ export default {
created() { created() {
this.addOrEdit = this.$route.params.addOrEdit this.addOrEdit = this.$route.params.addOrEdit
if (this.addOrEdit === 'edit') {
this.editForm[0].formBlock[0] = {
name: 'goodsCode',
label: '选择素材',
isRequired: true,
type: 'select',
isClear: false,
optionList: [],
optionId: 'goodsCode',
optionLabel: 'goodsName',
width: '400px'
}
}
}, },
mounted() { mounted() {
...@@ -235,7 +222,7 @@ export default { ...@@ -235,7 +222,7 @@ export default {
methods: { methods: {
...mapActions({ close: 'd2admin/page/close' }), ...mapActions({ close: 'd2admin/page/close' }),
getGoodsList() { getGoodsList(showSelect, goodsInfoId) {
getThiredMaterialList({}).then(res => { getThiredMaterialList({}).then(res => {
res && res.forEach(item => { res && res.forEach(item => {
item.value = item.sceneType item.value = item.sceneType
...@@ -258,17 +245,18 @@ export default { ...@@ -258,17 +245,18 @@ export default {
item.children = twoChildren item.children = twoChildren
}) })
this.editForm[0].formBlock[0].optionList = res this.editForm[0].formBlock[0].optionList = res
if (showSelect) {
this.decorate(goodsInfoId, res)
this.$nextTick(() => {
this.show = true
})
}
}) })
}, },
getGoodsInfo(id, flag) { getGoodsInfo(id, flag) {
getGoodsInfoById({ id: id }).then(res => { getGoodsInfoById({ id: id }).then(res => {
// this.userInfo.beSuper && this.getGoodsList()
this.editForm[0].formBlock[0].optionList = [{
goodsCode: res.goodsInfo.goodsCode,
goodsName: res.goodsInfo.goodsName
}]
var tempIndex = this.editForm.findIndex(i => i.title === '选素材') var tempIndex = this.editForm.findIndex(i => i.title === '选素材')
this.editForm[tempIndex].formBlock[0].isDisabled = true this.editForm[tempIndex].formBlock[0].isDisabled = res.status == 1 || res.status == 2 ? true : false
var linkMerchantIndex = this.editForm.findIndex(i => i.title === '分配到门店') var linkMerchantIndex = this.editForm.findIndex(i => i.title === '分配到门店')
this.editForm[linkMerchantIndex].formBlock[0].name = res.distributionType == '0' ? 'linkMerchants' : 'speciLinkMerchants' this.editForm[linkMerchantIndex].formBlock[0].name = res.distributionType == '0' ? 'linkMerchants' : 'speciLinkMerchants'
this.radioType = this.radioType ? this.radioType : (res.distributionType + '') this.radioType = this.radioType ? this.radioType : (res.distributionType + '')
...@@ -307,16 +295,47 @@ export default { ...@@ -307,16 +295,47 @@ export default {
goodsSpecificationNameList: res.goodsSpecificationNameList, goodsSpecificationNameList: res.goodsSpecificationNameList,
linkMerchants: res.upgradeGoodsMerchantRefList ? res.upgradeGoodsMerchantRefList : [], linkMerchants: res.upgradeGoodsMerchantRefList ? res.upgradeGoodsMerchantRefList : [],
speciLinkMerchants: res.upgradeGoodsMerchantRefList ? res.upgradeGoodsMerchantRefList : [], speciLinkMerchants: res.upgradeGoodsMerchantRefList ? res.upgradeGoodsMerchantRefList : [],
goodsId: res.goodsInfo.goodsCode status: res.status
}
if (flag) { // 首次进入编辑页面
this.getGoodsList(true, res.goodsInfo.id)
} else { // 按规格分配后 获取商品详情
this.decorate(res.goodsInfo.id, this.editForm[0].formBlock[0].optionList)
} }
this.editForm[0].formBlock[0].type = 'select'
this.markOldVal.shopPrice = res.shopPrice this.markOldVal.shopPrice = res.shopPrice
this.markOldVal.retailPrice = res.retailPrice this.markOldVal.retailPrice = res.retailPrice
this.$nextTick(() => {
this.show = true
})
}) })
}, },
decorate(goodsInfoId, treeData) {
let arr = this.changeDetSelect(
goodsInfoId,
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 == 2) { // depthN == 2只匹配素材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)
},
handleAddClose(isRefresh = false) { handleAddClose(isRefresh = false) {
if (isRefresh) { if (isRefresh) {
this.close({ tagName: '/commodity' }) this.close({ tagName: '/commodity' })
...@@ -371,12 +390,11 @@ export default { ...@@ -371,12 +390,11 @@ export default {
specificationData: specificationData, specificationData: specificationData,
upgradePrice: item.upgradePrice, upgradePrice: item.upgradePrice,
shopMinPrice: item.shopMinPrice, shopMinPrice: item.shopMinPrice,
stock: item.stock, stock: (item.stock ?? '') === '' ? 999999 : item.stock,
warrantyPeriod: item.warrantyPeriod warrantyPeriod: item.warrantyPeriod
}) })
}) })
var params = { var params = {
// yqMerchantId: this.userInfo.beSuper ? data.yqMerchantId : this.userInfo.detail.merchantId,
merchantId: this.userInfo.detail.merchantId, merchantId: this.userInfo.detail.merchantId,
id: data.id, id: data.id,
goodsCode: data.goodsCode, goodsCode: data.goodsCode,
...@@ -384,7 +402,6 @@ export default { ...@@ -384,7 +402,6 @@ export default {
goodsSpecificationNameList: goodsSpecificationNameList, goodsSpecificationNameList: goodsSpecificationNameList,
goodsSpecificationList: goodsSpecificationList goodsSpecificationList: goodsSpecificationList
} }
console.log(params)
addOrEditBaseGoods(params).then(res => { addOrEditBaseGoods(params).then(res => {
// flag true提交 // flag true提交
if (flag) { if (flag) {
......
...@@ -89,7 +89,7 @@ export default { ...@@ -89,7 +89,7 @@ export default {
name: 'goodsName', name: 'goodsName',
label: '产品名称', label: '产品名称',
type: 'input', type: 'input',
maxlength: 10, maxlength: 20,
width: '432px' width: '432px'
}, { }, {
name: 'sceneType', name: 'sceneType',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!