feat:更新

This commit is contained in:
dengtongyu committed 2021-08-29 20:12:18 +08:00
1 parent f0ed36e25c
commit 39022f3711
3 files changed
+37 -10

No files matched your search

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