Commit bf21f95d by zhangxw

商品中心改版 代码提交

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