Commit 9e77a7ea by cwq0219

带货查看

1 parent eb641265
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<p v-show="!specificationDetailList.length" class="supply-price txt-ellipsis">{{ editForm.retailPrice }}元</p> <p v-show="!specificationDetailList.length" class="supply-price txt-ellipsis">{{ editForm.retailPrice }}元</p>
</div> </div>
</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> <span class="spesc-label" :style="{ width: labelWidth }">规格明细:</span>
<div style="width: calc(100% - 100px);"> <div style="width: calc(100% - 100px);">
<table class="table-spesc"> <table class="table-spesc">
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</table> </table>
</div> </div>
</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>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button> <el-button type="primary" @click="handleConfirm">确定</el-button>
...@@ -82,6 +82,7 @@ export default { ...@@ -82,6 +82,7 @@ export default {
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
submitted: false, submitted: false,
isDisabled: false,
mainImgUrl: '', mainImgUrl: '',
moveNum: 0, moveNum: 0,
curMoveNum: 0, curMoveNum: 0,
...@@ -98,37 +99,49 @@ export default { ...@@ -98,37 +99,49 @@ export default {
}, },
specificationDetailList: [], specificationDetailList: [],
nameToValSpecsList: [], nameToValSpecsList: [],
editForm: {}, editForm: {
retailPrice: ''
},
editRule: { editRule: {
zoneName: [{ required: true, message: '请输入专区名称', trigger: 'change' }], retailPrice: [
zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }], { required: true, message: '请输入零售价', trigger: 'change' },
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }] {
} validator: (rule, value, callback) => {
// editFormData: [ return +this.editForm.supplyPrice > +value ? callback(new Error('零售价不能小于供货价')) : callback()
// { },
// label: '专区名称', trigger: 'change'
// name: 'zoneName', }
// width: '320px', ]
// type: 'input', },
// maxlength: 20 editFormData: [
// }, {
// { label: '零售价',
// label: '专区图片', name: 'retailPrice',
// name: 'zoneImg', width: '280px',
// type: 'upload', type: 'input',
// width: '320px', isDisabled: false
// limitSize: 10, },
// maxPhotoNum: 1, {
// handleUpload: (e, file, targetItem) => { label: '供货价',
// const imgFile = e.target.result name: 'supplyPrice',
// const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] width: '280px',
// this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => { type: 'input',
// this.editForm[targetItem.name] = res isDisabled: true
// this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name) },
// }) {
// } 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 { ...@@ -137,6 +150,8 @@ export default {
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params this.routeInfo = this.$route.params
this.title = this.titleObj[this.routeInfo.addOrEdit] this.title = this.titleObj[this.routeInfo.addOrEdit]
this.isDisabled = this.routeInfo.addOrEdit == 3
this.editFormData[0].isDisabled = true
this.routeInfo.addOrEdit != 1 ? this.getInfo() : '' this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
}, },
...@@ -145,18 +160,9 @@ export default { ...@@ -145,18 +160,9 @@ export default {
this.$apis.proManage.getProInfoApi({ id: this.routeInfo.id }).then(res => { this.$apis.proManage.getProInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = { this.editForm = {
...res, ...res,
// goodsVideo: res.goodsVideo || '',
// classifyIdList: res.classifyList.map(item => item.id),
// originalPrice: (res.originalPrice / 100).toFixed(2),
retailPrice: '', retailPrice: '',
supplyPrice: res.supplyPrice ? (res.supplyPrice / 100).toFixed(2) : '' 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) { if (this.editForm.specificationList.length) {
this.specificationDetailList = this.$common.utils.deepClone(this.editForm.specificationList) this.specificationDetailList = this.$common.utils.deepClone(this.editForm.specificationList)
...@@ -168,11 +174,6 @@ export default { ...@@ -168,11 +174,6 @@ export default {
} }
this.mainImgUrl = this.editForm.goodsDetailImageList[0].content this.mainImgUrl = this.editForm.goodsDetailImageList[0].content
this.moveNum = this.editForm.goodsDetailImageList.length > 4 ? this.editForm.goodsDetailImageList.length - 4 : 0 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 { ...@@ -231,7 +232,6 @@ export default {
} }
}) })
} }
// console.log(this.nameToValSpecsList)
}, },
setLocaleCompare(params) { setLocaleCompare(params) {
let keys = [] let keys = []
...@@ -251,7 +251,6 @@ export default { ...@@ -251,7 +251,6 @@ export default {
}, },
// 换图 // 换图
handleChangeImg(idx) { handleChangeImg(idx) {
console.log(this.editForm.goodsDetailImageList)
this.mainImgUrl = this.editForm.goodsDetailImageList[idx].content this.mainImgUrl = this.editForm.goodsDetailImageList[idx].content
}, },
// 移动图片 // 移动图片
...@@ -303,11 +302,12 @@ export default { ...@@ -303,11 +302,12 @@ export default {
}, },
handleConfirm() { handleConfirm() {
this.submitted = true this.submitted = true
if (!this.checkSpeceData()) { var flag = false
return
}
var params = {} var params = {}
if (this.nameToValSpecsList.length) { if (this.nameToValSpecsList.length) {
if (!this.checkSpeceData()) {
return
}
params.specificationDetailList = [] params.specificationDetailList = []
this.nameToValSpecsList.forEach((item, index) => { this.nameToValSpecsList.forEach((item, index) => {
params.specificationDetailList.push({ params.specificationDetailList.push({
...@@ -317,9 +317,18 @@ export default { ...@@ -317,9 +317,18 @@ export default {
}) })
}) })
} else { } else {
params = { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
retailPrice: (this.editForm.retailPrice * 100).toFixed(0) if (!valid) {
} flag = true
} else {
params = {
retailPrice: (this.editForm.retailPrice * 100).toFixed(0)
}
}
})
}
if (flag) {
return true
} }
params.id = this.routeInfo.id params.id = this.routeInfo.id
this.$apis.proManage.updateTakeProApi(params).then(res => { 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!