Commit 469556b0 by chenwq

秒杀活动改代码

1 parent 6635021b
...@@ -170,7 +170,8 @@ export default { ...@@ -170,7 +170,8 @@ export default {
name: 'activityName', name: 'activityName',
width: '320px', width: '320px',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20,
isDisabled: false
}, },
{ {
label: '活动宣传图', label: '活动宣传图',
...@@ -179,6 +180,7 @@ export default { ...@@ -179,6 +180,7 @@ export default {
width: '320px', width: '320px',
limitSize: 10, limitSize: 10,
maxPhotoNum: 1, maxPhotoNum: 1,
isDisabled: false,
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
...@@ -193,7 +195,8 @@ export default { ...@@ -193,7 +195,8 @@ export default {
name: 'promotion', name: 'promotion',
width: '320px', width: '320px',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20,
isDisabled: false
}, },
{ {
label: '活动时间', label: '活动时间',
...@@ -227,9 +230,7 @@ export default { ...@@ -227,9 +230,7 @@ export default {
this.apear = 'see' this.apear = 'see'
this.title = '查看' this.title = '查看'
this.isDisabled = true this.isDisabled = true
this.editFormData[0].isDisabled = true this.changeFormAttr('editFormData', 'isDisabled', ['活动名称', '活动宣传图', '活动宣传语'], true)
this.editFormData[1].isDisabled = true
this.editFormData[2].isDisabled = true
} else if (addOrEdit == 2) { } else if (addOrEdit == 2) {
this.apear = 'edit' this.apear = 'edit'
this.title = '编辑' this.title = '编辑'
...@@ -256,6 +257,12 @@ export default { ...@@ -256,6 +257,12 @@ export default {
}, },
methods: { methods: {
changeFormAttr(formName, attrName, labelList, attrValue) {
labelList.forEach(item => {
let idx = this[formName].findIndex(k => k.label == item)
this[formName][idx][attrName] = attrValue
})
},
limitPriceForInput(val, intergerDigit, pointDigit, minValue, maxValue, regRule) { limitPriceForInput(val, intergerDigit, pointDigit, minValue, maxValue, regRule) {
var _regRule = regRule || 'priceReg' var _regRule = regRule || 'priceReg'
if (val && this.reg[_regRule].test(val + '')) { if (val && this.reg[_regRule].test(val + '')) {
...@@ -309,11 +316,11 @@ export default { ...@@ -309,11 +316,11 @@ export default {
this.$apis.proManage.getProInfoApi({ id: id }).then(res => { this.$apis.proManage.getProInfoApi({ id: id }).then(res => {
this.selectedProInfo = this.$common.utils.deepClone(res) this.selectedProInfo = this.$common.utils.deepClone(res)
if (this.selectedProInfo.specificationDetailList.length) { if (this.selectedProInfo.specificationDetailList.length) {
this.editFormData[5].isHide = false this.changeFormAttr('editFormData', 'isHide', ['规格明细'], false)
this.specificationDetailList = this.selectedProInfo.specificationList this.specificationDetailList = this.selectedProInfo.specificationList
this.recoverySpec() this.recoverySpec()
} else { } else {
this.editFormData[5].isHide = true this.changeFormAttr('editFormData', 'isHide', ['规格明细'], true)
this.nameToValSpecsList = [] this.nameToValSpecsList = []
this.specificationDetailList = [] this.specificationDetailList = []
} }
...@@ -465,7 +472,7 @@ export default { ...@@ -465,7 +472,7 @@ export default {
delete param.activityPrice delete param.activityPrice
delete param.goodsStock delete param.goodsStock
param.specificationDetailList = [] param.specificationDetailList = []
this.nameToValSpecsList.forEach(function(item) { this.nameToValSpecsList.forEach(function (item) {
var obj = { var obj = {
retailPrice: (item.activityPrice * 100).toFixed(0), //存的分,需乘100 retailPrice: (item.activityPrice * 100).toFixed(0), //存的分,需乘100
stock: item.goodsStock, stock: item.goodsStock,
...@@ -548,7 +555,7 @@ export default { ...@@ -548,7 +555,7 @@ export default {
.then(() => { .then(() => {
this.cancelJump() this.cancelJump()
}) })
.catch(() => {}) .catch(() => { })
} else { } else {
this.cancelJump() this.cancelJump()
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!