Commit 9e77a7ea by cwq0219

带货查看

1 parent eb641265
......@@ -23,7 +23,7 @@
<p v-show="!specificationDetailList.length" class="supply-price txt-ellipsis">{{ editForm.retailPrice }}元</p>
</div>
</div>
<div class="flex" style="margin-top: 20px;" id="specificationDetailList">
<div v-if="specificationDetailList.length" class="flex" style="margin-top: 20px;" id="specificationDetailList">
<span class="spesc-label" :style="{ width: labelWidth }">规格明细:</span>
<div style="width: calc(100% - 100px);">
<table class="table-spesc">
......@@ -56,7 +56,7 @@
</table>
</div>
</div>
<!-- <glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :editForm="editFormData" :formRules="editRule"></glsx-combi-form> -->
<glsx-combi-form v-if="!specificationDetailList.length" class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button>
......@@ -82,6 +82,7 @@ export default {
footerWidth: '0',
editChildRef: 'editChildRef',
submitted: false,
isDisabled: false,
mainImgUrl: '',
moveNum: 0,
curMoveNum: 0,
......@@ -98,37 +99,49 @@ export default {
},
specificationDetailList: [],
nameToValSpecsList: [],
editForm: {},
editForm: {
retailPrice: ''
},
editRule: {
zoneName: [{ required: true, message: '请输入专区名称', trigger: 'change' }],
zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }],
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }]
}
// editFormData: [
// {
// label: '专区名称',
// name: 'zoneName',
// width: '320px',
// type: 'input',
// maxlength: 20
// },
// {
// label: '专区图片',
// name: 'zoneImg',
// type: 'upload',
// width: '320px',
// limitSize: 10,
// maxPhotoNum: 1,
// handleUpload: (e, file, targetItem) => {
// const imgFile = e.target.result
// const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
// this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
// this.editForm[targetItem.name] = res
// this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
// })
// }
// }
// ]
retailPrice: [
{ required: true, message: '请输入零售价', trigger: 'change' },
{
validator: (rule, value, callback) => {
return +this.editForm.supplyPrice > +value ? callback(new Error('零售价不能小于供货价')) : callback()
},
trigger: 'change'
}
]
},
editFormData: [
{
label: '零售价',
name: 'retailPrice',
width: '280px',
type: 'input',
isDisabled: false
},
{
label: '供货价',
name: 'supplyPrice',
width: '280px',
type: 'input',
isDisabled: true
},
{
label: '库存',
name: 'goodsStock',
width: '280px',
type: 'input',
isDisabled: true
}
]
}
},
watch: {
'editForm.retailPrice'(newValue, oldValue) {
this.editForm.retailPrice = limitPrice(newValue, oldValue, 5, 2)
}
},
......@@ -137,6 +150,8 @@ export default {
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
this.title = this.titleObj[this.routeInfo.addOrEdit]
this.isDisabled = this.routeInfo.addOrEdit == 3
this.editFormData[0].isDisabled = true
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
},
......@@ -145,18 +160,9 @@ export default {
this.$apis.proManage.getProInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = {
...res,
// goodsVideo: res.goodsVideo || '',
// classifyIdList: res.classifyList.map(item => item.id),
// originalPrice: (res.originalPrice / 100).toFixed(2),
retailPrice: '',
supplyPrice: res.supplyPrice ? (res.supplyPrice / 100).toFixed(2) : ''
// describeTxt: '',
// descImgList: []
}
// 运费
// if (this.editForm.deliveryType == 2) {
// this.editForm.expressFee = (res.expressFee / 100).toFixed(2)
// }
// 规格
if (this.editForm.specificationList.length) {
this.specificationDetailList = this.$common.utils.deepClone(this.editForm.specificationList)
......@@ -168,11 +174,6 @@ export default {
}
this.mainImgUrl = this.editForm.goodsDetailImageList[0].content
this.moveNum = this.editForm.goodsDetailImageList.length > 4 ? this.editForm.goodsDetailImageList.length - 4 : 0
// this.retailStockRule()
// this.editForm.goodsDescList.length && this.recoveryDescribe()
// this.editForm.supplyMerchantList.length && this.recoveryMerchantList()
// this.handleTypeChange(this.editForm.deliveryType)
// console.log(this.editForm)
})
},
// 规格值解构
......@@ -231,7 +232,6 @@ export default {
}
})
}
// console.log(this.nameToValSpecsList)
},
setLocaleCompare(params) {
let keys = []
......@@ -251,7 +251,6 @@ export default {
},
// 换图
handleChangeImg(idx) {
console.log(this.editForm.goodsDetailImageList)
this.mainImgUrl = this.editForm.goodsDetailImageList[idx].content
},
// 移动图片
......@@ -303,11 +302,12 @@ export default {
},
handleConfirm() {
this.submitted = true
if (!this.checkSpeceData()) {
return
}
var flag = false
var params = {}
if (this.nameToValSpecsList.length) {
if (!this.checkSpeceData()) {
return
}
params.specificationDetailList = []
this.nameToValSpecsList.forEach((item, index) => {
params.specificationDetailList.push({
......@@ -317,9 +317,18 @@ export default {
})
})
} else {
params = {
retailPrice: (this.editForm.retailPrice * 100).toFixed(0)
}
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (!valid) {
flag = true
} else {
params = {
retailPrice: (this.editForm.retailPrice * 100).toFixed(0)
}
}
})
}
if (flag) {
return true
}
params.id = this.routeInfo.id
this.$apis.proManage.updateTakeProApi(params).then(res => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!