Commit 1e432a1e by 黑潮

fix: 库存回显修复

parent 55a5a254
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
奖品数量 <el-radio class="ml10" v-model="calculate" :label="true">增加</el-radio> 奖品数量 <el-radio class="ml10" v-model="calculate" :label="true">增加</el-radio>
<el-radio v-model="calculate" :label="false">减少</el-radio> <el-radio v-model="calculate" :label="false">减少</el-radio>
<div class="vl"> <div class="vl">
<el-input-number controls-position="right" :min="0" :max="max" v-model="count" class="w200 block-center" @blur="checkCalc"></el-input-number> <el-input-number controls-position="right" :min="0" :max="max" v-model="count" class="w200 block-center"></el-input-number>
</div> </div>
<div class="fz14 vl" v-if="needCheck && calculate">可用库存:{{ maxStock }}</div> <div class="fz14 vl" v-if="needCheck && calculate">可用库存:{{ maxStock }}</div>
<div class="fz14 vl" v-if="!calculate">当前库存:{{ totalCount }}</div> <div class="fz14 vl" v-if="!calculate">当前库存:{{ currentCount }}</div>
<div class="fz14 vl mb10">结果:{{ resNum }}</div> <div class="fz14 vl mb10">结果:{{ resNum }}</div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
import { updatePrizeStock } from '@/service/api/gameApi.js'; import { updatePrizeStock } from '@/service/api/gameApi.js';
export default { export default {
props: { props: {
currentCount: {
type: Number,
require: true
},
totalCount: { totalCount: {
type: Number, type: Number,
default: 0 default: 0
...@@ -70,7 +74,12 @@ export default { ...@@ -70,7 +74,12 @@ export default {
return isNaN(num) ? 0 : num; return isNaN(num) ? 0 : num;
}, },
max() { max() {
return this.needCheck && this.calculate ? this.maxStock - this.totalCount : 1000000; if (this.needCheck) {
return this.calculate ? this.maxStock - this.totalCount : this.currentCount;
} else {
return this.calculate ? 1000000 : this.currentCount;
}
// return this.needCheck && this.calculate ? this.maxStock - this.totalCount : 1000000;
} }
}, },
methods: { methods: {
...@@ -79,14 +88,14 @@ export default { ...@@ -79,14 +88,14 @@ export default {
this.needCheck = true; this.needCheck = true;
this.maxStock = maxStock; this.maxStock = maxStock;
}, },
checkCalc() { // checkCalc() {
if (!this.calculate) { // if (!this.calculate) {
if (this.count > this.totalCount) { // if (this.count > this.totalCount) {
this.count = this.totalCount; // this.count = this.totalCount;
this.$tips({ type: 'warning', message: '输入数量不能大于总数' }); // this.$tips({ type: 'warning', message: '输入数量不能大于总数' });
} // }
} // }
}, // },
close() { close() {
this.$emit('update:show', false); this.$emit('update:show', false);
this.count = 0; this.count = 0;
......
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
<el-button @click="$router.go(-1)">返 回</el-button> <el-button @click="$router.go(-1)">返 回</el-button>
</div> </div>
<vue-gic-card :showCardDialog.sync="showCardDialog" @selectCard="selectCard" :cardLimit="3" :cardType="null"></vue-gic-card> <vue-gic-card :showCardDialog.sync="showCardDialog" @selectCard="selectCard" :cardLimit="3" :cardType="null"></vue-gic-card>
<calculate ref="calculate" :show.sync="calculateShow" :gameId="form.gameActivityId" :totalCount="currentObj.prizeCount" :prizeId="currentObj.prizeId" :prizeReferType="currentObj.prizeReferType" :prizeReferId="currentObj.prizeReferId" :useStrategy="0" @countRefresh="countRefresh"></calculate> <calculate ref="calculate" :show.sync="calculateShow" :gameId="form.gameActivityId" :currentCount="currentObj.prizeStock" :totalCount="currentObj.prizeCount" :prizeId="currentObj.prizeId" :prizeReferType="currentObj.prizeReferType" :prizeReferId="currentObj.prizeReferId" :useStrategy="0" @countRefresh="countRefresh"></calculate>
<strategy :show.sync="strategyShow" :gameId="form.gameActivityId" :strategyType="strategyType" :dataId="gamePrizeStrategyId" :gameActivityId="form.gameActivityId" :cardObj="strategyDialog" @set-data="setStrategyCard" @refesh="klflStrategyList"></strategy> <strategy :show.sync="strategyShow" :gameId="form.gameActivityId" :strategyType="strategyType" :dataId="gamePrizeStrategyId" :gameActivityId="form.gameActivityId" :cardObj="strategyDialog" @set-data="setStrategyCard" @refesh="klflStrategyList"></strategy>
<code-dialog :show.sync="codeDialogShow" :id="form.gameActivityId" @selectedCode="selectedCode"></code-dialog> <code-dialog :show.sync="codeDialogShow" :id="form.gameActivityId" @selectedCode="selectedCode"></code-dialog>
</el-form> </el-form>
...@@ -374,11 +374,13 @@ export default { ...@@ -374,11 +374,13 @@ export default {
this.calculateShow = true; this.calculateShow = true;
if (obj.prizeReferType == 2) { if (obj.prizeReferType == 2) {
// 卡券 获取库存值 // 卡券 获取库存值
console.log('nnnnn');
this.getCouponStock(obj.card.coupCardId); this.getCouponStock(obj.card.coupCardId);
} }
}, },
countRefresh(val) { countRefresh(val) {
this.currentObj.prizeStock = this.currentObj.prizeCount = val.calc ? parseInt(this.currentObj.prizeCount) + parseInt(val.num) : parseInt(this.currentObj.prizeCount) - parseInt(val.num); this.currentObj.prizeCount = val.calc ? parseInt(this.currentObj.prizeCount) + parseInt(val.num) : parseInt(this.currentObj.prizeCount) - parseInt(val.num);
this.currentObj.prizeStock = val.calc ? parseInt(this.currentObj.prizeStock) + parseInt(val.num) : parseInt(this.currentObj.prizeStock) - parseInt(val.num);
}, },
selectBg(v, i) { selectBg(v, i) {
this.currentBg = v; this.currentBg = v;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment