Commit 49b207bd by cwq0219

秒杀活动,弹窗,bug

1 parent 1e566c83
...@@ -43,21 +43,12 @@ ...@@ -43,21 +43,12 @@
<td :style="{ width: specsWidth }" v-for="(n, idx) in item.specsValueList" :key="idx">{{ n }}</td> <td :style="{ width: specsWidth }" v-for="(n, idx) in item.specsValueList" :key="idx">{{ n }}</td>
<td :style="{ width: specsWidth }">{{ item.retailPrice }}元</td> <td :style="{ width: specsWidth }">{{ item.retailPrice }}元</td>
<td :style="{ width: specsWidth }">{{ item.stock }}件</td> <td :style="{ width: specsWidth }">{{ item.stock }}件</td>
<!-- <td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" :class="{ 'border-red': (!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted }" placeholder="零售价" v-model="item.retailPrice" @input.native="e => handleInput(e, index)">
<el-popover v-show="(!(item.retailPrice + '') || +item.supplyPrice > +item.retailPrice) && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" :content="!(item.retailPrice + '') ? '零售价是必填项' : '零售价要大于供货价'">
<i class="el-icon-warning color-red" slot="reference"></i>
</el-popover>
</el-input>
</td> -->
<td :style="{ width: specsWidth }"> <td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="秒杀价" style="width:90%" v-model="item.activityPrice" @input="item.activityPrice = activityPrice_input($event, item.retailPrice)"> <el-input :disabled="isDisabled" placeholder="秒杀价" style="width:90%" v-model="item.activityPrice" @input="item.activityPrice = activityPrice_input($event, item.retailPrice)">
<!-- <span slot="append">元</span> -->
</el-input> </el-input>
</td> </td>
<td :style="{ width: specsWidth }"> <td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="活动库存" style="width:90%" v-model="item.goodsStock" @input="item.goodsStock = goodsStock_input($event, item.stock)"> <el-input :disabled="isDisabled" placeholder="活动库存" style="width:90%" v-model="item.goodsStock" @input="item.goodsStock = goodsStock_input($event, item.stock)">
<!-- <span slot="append">件</span> -->
</el-input> </el-input>
</td> </td>
</tr> </tr>
...@@ -72,7 +63,7 @@ ...@@ -72,7 +63,7 @@
<el-button v-if="apear != 'see'" @click="handleCancel">取消</el-button> <el-button v-if="apear != 'see'" @click="handleCancel">取消</el-button>
<el-button v-if="apear == 'see'" @click="handleCancel">返回</el-button> <el-button v-if="apear == 'see'" @click="handleCancel">返回</el-button>
</div> </div>
<select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose"></select-single-pro-dialog> <select-single-pro-dialog v-if="isSingleSelectVisible" :isSingleSelectVisible="isSingleSelectVisible" :selectedProInfo="selectedProInfo" @handleSingleSelectConfirm="handleSingleSelectConfirm" @handleSingleSelectClose="handleSingleSelectClose(true)"></select-single-pro-dialog>
</div> </div>
</template> </template>
...@@ -102,6 +93,7 @@ export default { ...@@ -102,6 +93,7 @@ export default {
addOrEdit: 1, addOrEdit: 1,
id: '' id: ''
}, },
editStatus: false,
/* eslint-disable */ /* eslint-disable */
reg: { reg: {
priceReg: /^\d[\d\.]*$/, priceReg: /^\d[\d\.]*$/,
...@@ -213,7 +205,6 @@ export default { ...@@ -213,7 +205,6 @@ export default {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
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.routeInfo.addOrEdit != 1 ? this.getInfo() : '' this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
var id = this.routeInfo.id var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit var addOrEdit = this.routeInfo.addOrEdit
...@@ -236,6 +227,12 @@ export default { ...@@ -236,6 +227,12 @@ export default {
}, },
watch: { watch: {
editForm: {
handler(val) {
this.editStatus = true
},
deep: true
},
'editForm.activityPrice'(newValue, oldValue) { 'editForm.activityPrice'(newValue, oldValue) {
this.editForm.activityPrice = limitPrice(newValue, oldValue, 5, 2, 0, (this.selectedProInfo.retailPrice / 100).toFixed(2)) this.editForm.activityPrice = limitPrice(newValue, oldValue, 5, 2, 0, (this.selectedProInfo.retailPrice / 100).toFixed(2))
}, },
...@@ -247,10 +244,6 @@ export default { ...@@ -247,10 +244,6 @@ export default {
methods: { methods: {
limitPriceForInput(val, intergerDigit, pointDigit, minValue, maxValue, regRule) { limitPriceForInput(val, intergerDigit, pointDigit, minValue, maxValue, regRule) {
var _regRule = regRule || 'priceReg' var _regRule = regRule || 'priceReg'
// if (val && (minValue && (val < minValue)) || (maxValue && (val > maxValue))) {
// console.log('aaa');
// return maxValue ? maxValue : (minValue?minValue:'')
// }
if (val && this.reg[_regRule].test(val + '')) { if (val && this.reg[_regRule].test(val + '')) {
maxValue = typeof maxValue == 'string' ? parseFloat(maxValue) : maxValue maxValue = typeof maxValue == 'string' ? parseFloat(maxValue) : maxValue
minValue = typeof minValue == 'string' ? parseFloat(minValue) : minValue minValue = typeof minValue == 'string' ? parseFloat(minValue) : minValue
...@@ -283,41 +276,26 @@ export default { ...@@ -283,41 +276,26 @@ export default {
this.handleSingleSelectClose() this.handleSingleSelectClose()
}, },
handleSingleSelectConfirm(selectedProInfo) { handleSingleSelectConfirm(selectedProInfo) {
// this.editForm.goodsId = selectedProInfo.id this.editForm.activityPrice = ''
// this.editForm.goodsName = selectedProInfo.goodsName this.editForm.goodsStock = ''
// this.editForm.goodsImage = selectedProInfo.goodsImage
this.handleSingleSelectClose() this.handleSingleSelectClose()
if (selectedProInfo) { if (selectedProInfo) {
this.editForm.goodsId = selectedProInfo.id this.editForm.goodsId = selectedProInfo.id
this.getGoodInfo(selectedProInfo.id) this.getGoodInfo(selectedProInfo.id)
} }
}, },
handleSingleSelectClose() { handleSingleSelectClose(isCancel = false) {
if(isCancel) {
this.getGoodInfo(this.selectedProInfo.id)
}
this.isSingleSelectVisible = !this.isSingleSelectVisible this.isSingleSelectVisible = !this.isSingleSelectVisible
}, },
getGoodInfo(id) { getGoodInfo(id) {
this.$apis.proManage.getProInfoApi({ id: id }).then(res => { this.$apis.proManage.getProInfoApi({ id: id }).then(res => {
// this.editForm = {
// ...res,
// retailPrice: '',
// supplyPrice: res.supplyPrice ? (res.supplyPrice / 100).toFixed(2) : ''
// }
// // 规格
// if (this.editForm.specificationList.length) {
// this.specificationDetailList = this.$common.utils.deepClone(this.editForm.specificationList)
// this.recoverySpec()
// // this.findSpeceMin()
// } else {
// // 零售价
// this.editForm.retailPrice = (res.retailPrice / 100).toFixed(2)
// }
// this.mainImgUrl = this.editForm.goodsDetailImageList[0].content
// this.moveNum = this.editForm.goodsDetailImageList.length > 4 ? this.editForm.goodsDetailImageList.length - 4 : 0
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.editFormData[5].isHide = false
// this.specificationDetailList = this.$common.utils.deepClone(res.specificationList)
this.specificationDetailList = this.selectedProInfo.specificationList this.specificationDetailList = this.selectedProInfo.specificationList
this.recoverySpec() this.recoverySpec()
} else { } else {
...@@ -380,7 +358,6 @@ export default { ...@@ -380,7 +358,6 @@ export default {
item.retailPrice = (temp.retailPrice / 100).toFixed(2) item.retailPrice = (temp.retailPrice / 100).toFixed(2)
item.stock = temp.stock item.stock = temp.stock
item.specificationKey = temp.specificationKey item.specificationKey = temp.specificationKey
// item.supplyPrice = this.editForm.supplyPrice
break break
} }
} }
...@@ -397,7 +374,7 @@ export default { ...@@ -397,7 +374,7 @@ export default {
} }
}) })
} }
// console.log(this.nameToValSpecsList); // console.log(this.nameToValSpecsList)
}, },
setLocaleCompare(params) { setLocaleCompare(params) {
let keys = [] let keys = []
...@@ -435,11 +412,15 @@ export default { ...@@ -435,11 +412,15 @@ export default {
form.activityImg = info.activityImg form.activityImg = info.activityImg
form.promotion = info.promotion form.promotion = info.promotion
form.activityTime = [info.startTime, info.endTime] form.activityTime = [info.startTime, info.endTime]
form.goodsId = info.goodsId
this.getGoodInfo(info.goodsId) this.getGoodInfo(info.goodsId)
if (info.activityPrice != null && info.goodsStock != null) { if (info.activityPrice != null && info.goodsStock != null) {
form.activityPrice = (info.activityPrice / 100).toFixed(2) form.activityPrice = (info.activityPrice / 100).toFixed(2)
form.goodsStock = info.goodsStock form.goodsStock = info.goodsStock
} }
this.$nextTick(()=>{
this.editStatus = false
})
}) })
}, },
...@@ -532,16 +513,30 @@ export default { ...@@ -532,16 +513,30 @@ export default {
type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
}) })
if (res.code == '0') { if (res.code == '0') {
this.handleCancel() this.cancelJump()
} }
}) })
} }
}) })
}, },
handleCancel() { cancelJump() {
this.$router.push({ this.$router.push({
path: '/seckillActivity/index' path: '/seckillActivity/index'
}) })
},
handleCancel() {
if (this.editStatus) {
this.$confirm('当前有内容信息未保存,是否继续返回?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.cancelJump()
})
.catch(() => {})
} else {
this.cancelJump()
}
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!