Commit fb7c550c by cwq0219

商品-价格

1 parent 2d0a211e
...@@ -319,7 +319,7 @@ export default { ...@@ -319,7 +319,7 @@ export default {
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => { this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs.editProRef1.validateField(targetItem.name) this.$refs.editFormRef.$refs.editProRef0.validateField(targetItem.name)
}) })
} }
}, },
...@@ -339,7 +339,7 @@ export default { ...@@ -339,7 +339,7 @@ export default {
resType: 1, resType: 1,
bizType: 1 bizType: 1
}) })
this.$refs.editFormRef.$refs.editProRef1.validateField(targetItem.name) this.$refs.editFormRef.$refs.editProRef0.validateField(targetItem.name)
}) })
} }
}, },
...@@ -808,7 +808,6 @@ export default { ...@@ -808,7 +808,6 @@ export default {
goodsVideo: res.goodsVideo || '', goodsVideo: res.goodsVideo || '',
classifyIdList: res.classifyList.map(item => item.id), classifyIdList: res.classifyList.map(item => item.id),
originalPrice: (res.originalPrice / 100).toFixed(2), originalPrice: (res.originalPrice / 100).toFixed(2),
// retailPrice: res.retailPrice ? (res.retailPrice / 100).toFixed(2) : '',
retailPrice: '', retailPrice: '',
supplyPrice: res.supplyPrice ? (res.supplyPrice / 100).toFixed(2) : '', supplyPrice: res.supplyPrice ? (res.supplyPrice / 100).toFixed(2) : '',
describeTxt: '', describeTxt: '',
...@@ -911,12 +910,63 @@ export default { ...@@ -911,12 +910,63 @@ export default {
}, },
// 图片-描述-end // 图片-描述-end
handleConfirm() { handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef[0].$refs.editProRef0.validate(valid0 => {
if (valid) { this.$refs.editFormRef[1].$refs.editProRef1.validate(valid1 => {
this.$refs.editFormRef[2].$refs.editProRef2.validate(valid2 => {
if (valid0 && valid1 && valid2) {
var params = this.$common.utils.deepClone(this.editForm) var params = this.$common.utils.deepClone(this.editForm)
var deleteAttrList = ['descImgList', 'describeTxt']
var priceList = ['retailPrice', 'originalPrice', 'supplyPrice', 'expressFee']
if (this.routeInfo.addOrEdit == 2) { if (this.routeInfo.addOrEdit == 2) {
params.id = this.routeInfo.id params.id = this.routeInfo.id
} }
// 描述
params.goodsDescList = this.$common.utils.deepClone(this.editForm.descImgList)
if (this.editForm.describeTxt) {
params.goodsDescList.unshift({
content: this.editForm.describeTxt,
resType: 2,
bizType: 2
})
}
// 规格
params.specificationDetailList = []
this.nameToValSpecsList.forEach((item, index) => {
var specificationData = ''
item.specsValueList.forEach((subItem, subIndex) => {
if (subIndex != 0) {
specificationData += '&'
}
specificationData = specificationData + this.specificationDetailList[subIndex].specificationName + '-' + subItem
})
params.specificationDetailList.push({
specificationData: specificationData,
retailPrice: (item.retailPrice * 100).toFixed(0),
stock: item.stock
})
})
// 专区-门店没有专区
if (this.routeInfo.groupOrStore != 1) {
delete params.zoneId
}
// 价格格式化(计算到分)
priceList.forEach(item => {
if (params[item]) {
params[item] = (this.editForm[item] * 100).toFixed(0)
}
})
params.supplyMerchantList = []
this.editForm.supplyMerchantList.forEach(item => {
params.supplyMerchantList.push({
merchantId: item.merchantNo,
merchantName: item.merchantName,
merchantAccountLevel: item.merchantAccountLevel
})
})
deleteAttrList.forEach(item => {
delete params[item]
})
console.log(params)
// this.$apis.zoneList.insertZoneApi(params).then(res => { // this.$apis.zoneList.insertZoneApi(params).then(res => {
// this.$message({ // this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败', // message: res.code == '0' ? '操作成功' : '操作失败',
...@@ -928,6 +978,8 @@ export default { ...@@ -928,6 +978,8 @@ export default {
// }) // })
} }
}) })
})
})
}, },
handleCancel() { handleCancel() {
this.$router.push({ this.$router.push({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!