feat:更新
This commit is contained in:
1 parent
f0ed36e25c
commit
39022f3711
3 files changed
+37
-10
No files matched your search
@@ -38,7 +38,7 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["remainTicketNum"]),
|
||||
...mapGetters(["remainTicketNum", "ticketRule"]),
|
||||
modeClass() {
|
||||
if (this.mode === "blue") return "bottom-view-xy";
|
||||
return "bottom-view-hh";
|
||||
@@ -80,7 +80,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
active: 0,
|
||||
ticketRule: null,
|
||||
ticketRuleConfig: [
|
||||
{
|
||||
ruleType: "one",
|
||||
@@ -105,13 +104,15 @@ export default {
|
||||
this.getqueryTicketRule();
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(["SetRuleType", "SetRemainTicketNum"]),
|
||||
...mapMutations(["SetRuleType", "SetRemainTicketNum", "SetTicketRule"]),
|
||||
getQueryTicketNum() {
|
||||
queryTicketNum({ uid: this.uid })
|
||||
.then(res => {
|
||||
const { code, data } = res;
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
this.SetRemainTicketNum(data.num || 0);
|
||||
} else {
|
||||
this.$toast.fail(msg);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -121,9 +122,12 @@ export default {
|
||||
getqueryTicketRule() {
|
||||
queryTicketRule({ drawType: this.drawType })
|
||||
.then(res => {
|
||||
const { code, data } = res;
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
this.ticketRule = data || null;
|
||||
// this.ticketRule = data || null;
|
||||
this.SetTicketRule(data || null);
|
||||
} else {
|
||||
this.$toast.fail(msg);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
@@ -88,7 +88,7 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["ruleType", "prizeIdList"]),
|
||||
...mapGetters(["ruleType", "prizeIdList", "remainTicketNum"]),
|
||||
drawType() {
|
||||
if (this.mode === "blue") return "turntable1";
|
||||
return "turntable2";
|
||||
@@ -154,10 +154,12 @@ export default {
|
||||
getQueryPrizeInfo() {
|
||||
queryPrizeInfo({ drawType: this.drawType })
|
||||
.then(res => {
|
||||
const { code, data } = res;
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
this.SetPrizeInfo(data);
|
||||
this.prizes = this.configPrizes(data);
|
||||
} else {
|
||||
this.$toast.fail(msg);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -165,6 +167,14 @@ export default {
|
||||
});
|
||||
},
|
||||
postDoLottery() {
|
||||
if (
|
||||
this.remainTicketNum === 0 ||
|
||||
this.remainTicketNum < this.curTicketRuleValue
|
||||
) {
|
||||
this.$toast.fail("余额不足!");
|
||||
return;
|
||||
}
|
||||
|
||||
this.timeout = false;
|
||||
this.request = false;
|
||||
this.$refs.LuckDraw.play();
|
||||
@@ -176,7 +186,7 @@ export default {
|
||||
deviceId: "abc",
|
||||
ruleType: this.ruleType
|
||||
}).then(res => {
|
||||
const { code, data } = res;
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
this.request = true;
|
||||
this.lotteryData = data;
|
||||
@@ -184,6 +194,8 @@ export default {
|
||||
if (this.timeout && this.request)
|
||||
this.stopLuckDraw(this.maxVauePrizeIndex);
|
||||
this.postSaveLog();
|
||||
} else {
|
||||
this.$toast.fail(msg);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+12
-1
@@ -7,7 +7,8 @@ export default new Vuex.Store({
|
||||
state: {
|
||||
prizeInfo: [],
|
||||
ruleType: "one",
|
||||
remainTicketNum: 0
|
||||
remainTicketNum: 0,
|
||||
ticketRule: null
|
||||
},
|
||||
getters: {
|
||||
prizeInfo: state => {
|
||||
@@ -27,6 +28,13 @@ export default new Vuex.Store({
|
||||
},
|
||||
remainTicketNum: state => {
|
||||
return state.remainTicketNum;
|
||||
},
|
||||
ticketRule: state => {
|
||||
return state.ticketRule;
|
||||
},
|
||||
curTicketRuleValue: state => {
|
||||
if (!state.ticketRule) return 0;
|
||||
return state.ticketRule[state.ruleType];
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
@@ -38,6 +46,9 @@ export default new Vuex.Store({
|
||||
},
|
||||
SetRemainTicketNum(state, payload) {
|
||||
state.remainTicketNum = payload;
|
||||
},
|
||||
SetTicketRule(state, payload) {
|
||||
state.ticketRule = payload;
|
||||
}
|
||||
},
|
||||
actions: {},
|
||||
|
||||
Reference in new issue
Block a user