| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <template>
- <div>
- <div v-if="isData">
- <div v-if="obj.a ">
- <div class="tit">
- <span>冠军</span>
- </div>
- <div class="playCode row">
- <div class="row item-center allAlignment" style="border-right:.01rem solid #e4e4e4">
- <div class="teamName wrap">{{home_team}}</div>
- <div class="row allAlignment allAlignment">
- <div
- class="row center obbsBox rightAlignment"
- v-for="(item,index) in data"
- v-if="item.odds_code == 'kemp_home'"
- >
- <span class="condation">{{item.condition}}</span>
- <div
- class="odds row center"
- :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
- @click="betMethod(index,item.id,home_team,'冠军')"
- >
- <span>{{item.odds}}</span>
- </div>
- </div>
- </div>
- </div>
- <div class="row item-center allAlignment">
- <div class="teamName wrap">{{guest_team}}</div>
- <div class="row allAlignment">
- <div
- class="row center obbsBox rightAlignment"
- v-for="(item,index) in data"
- v-if="item.odds_code == 'kemp_guest'"
- >
- <span class="condation">{{item.condition}}</span>
- <div
- class="odds row center"
- :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
- @click="betMethod(index,item.id,guest_team,'冠军')"
- >
- <span>{{item.odds}}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div v-if="obj.b ">
- <div class="tit">
- <span>第一盘冠军</span>
- </div>
- <div class="playCode row">
- <div class="row item-center allAlignment" style="border-right:.01rem solid #e4e4e4">
- <div class="teamName wrap">{{home_team}}</div>
- <div class="row allAlignment">
- <div
- class="row center obbsBox rightAlignment"
- v-for="(item,index) in data"
- v-if="item.odds_code == 'one_kemp_home'"
- >
- <span class="condation">{{item.condition}}</span>
- <div
- class="odds row center"
- :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
- @click="betMethod(index,item.id,home_team,'第一盘冠军')"
- >
- <span>{{item.odds}}</span>
- </div>
- </div>
- </div>
- </div>
- <div class="row item-center allAlignment">
- <div class="teamName wrap">{{guest_team}}</div>
- <div class="row allAlignment">
- <div
- class="row center obbsBox rightAlignment"
- v-for="(item,index) in data"
- v-if="item.odds_code == 'one_kemp_guest'"
- >
- <span class="condation">{{item.condition}}</span>
- <div
- class="odds row center"
- :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
- @click="betMethod(index,item.id,guest_team,'第一盘冠军')"
- >
- <span>{{item.odds}}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div v-if="obj.c ">
- <div class="tit">
- <span>第二盘冠军</span>
- </div>
- <div class="playCode row">
- <div class="row item-center" style="border-right:.01rem solid #e4e4e4">
- <div class="teamName wrap">{{home_team}}</div>
- <div class="row allAlignment">
- <div
- class="row center obbsBox rightAlignment"
- v-for="(item,index) in data"
- v-if="item.odds_code == 'two_kemp_home'"
- >
- <span class="condation">{{item.condition}}</span>
- <div
- class="odds row center"
- :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
- @click="betMethod(index,item.id,home_team,'第二盘冠军')"
- >
- <span>{{item.odds}}</span>
- </div>
- </div>
- </div>
- </div>
- <div class="row item-center">
- <div class="teamName wrap">{{guest_team}}</div>
- <div class="row allAlignment">
- <div
- class="row center obbsBox rightAlignment"
- v-for="(item,index) in data"
- v-if="item.odds_code == 'two_kemp_guest'"
- >
- <span class="condation">{{item.condition}}</span>
- <div
- class="odds row center"
- :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
- @click="betMethod(index,item.id,guest_team,'第二盘冠军')"
- >
- <span>{{item.odds}}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- title: "kemp",
- data: [], //数据源
- array: [], //测试
- isData: "", //
- guest_team: "", //客队名
- home_team: "", //主队名
- obj: "", //
- match_id: "",
- lg_id:'',
- };
- },
- /***
- * 方法
- */
- methods: {
- //玩法分类
- playGrouping(data) {
- let obj = {};
- let betting = this.$store.getters.getBetting;
- data.forEach(e => {
- if(betting.length > 0){
- for(let i= 0; i< betting.length; i++){
- if(betting[i].title =="kemp" && betting[i].data.length >0){
- for(let j = 0 ; j < betting[i].data.length ; j++ ){
- if(betting[i].data[j].id == e.id){
- this.$set(e,'isTrue',true);
- //betting[i].data.splice(j,1);
- }
- }
- break;
- }
- }
- }
- e.lg_id = this.lg_id;
- if (e.odds_code.startsWith("kemp")) {
- obj.a = true;
- } else if (e.odds_code.startsWith("one")) {
- obj.b = true;
- }else if (e.odds_code.startsWith("two")) {
- obj.c = true;
- }
- });
- this.obj = obj;
- },
- /*---------------------------------- */
- //玩法投注
- betMethod(index, id, name, playName) {
- if (this.data[index].isTrue) {
- this.$set(this.data[index], "isTrue", false);
- } else {
- this.$set(this.data[index], "isTrue", true);
- }
- //调用投注公共方法
- let betting = this.$store.getters.getBetting;
- let _this = this;
- let ballId = this.$store.getters.getBallCode;
- let teamName = {
- home: this.home_team,
- guest: this.guest_team
- };
- this.$public.publicBetMethod(this.data,this.title,id,index,betting,teamName,playName,name,this.match_id,ballId,this.limit,function(data, type) {
- if (type) {
- _this.$dialog.toast({ mes: "亲,超出表格上限啦。", timeout: 2000 });
- }
- _this.$store.dispatch("SET_BETTING", []);
- _this.$store.dispatch("SET_BETTING", data);
- }
- );
- }
- },
- /**
- * 计算属性
- */
- computed: {
- getGameRatio() {
- return this.$store.getters.getGameRatio;
- },
- //获取投注数据
- getBetting() {
- return this.$store.getters.getBetting;
- },
- //获取投注数据数量
- getLimit() {
- return this.$store.getters.getLimit;
- }
- },
- /**
- * 监听器
- */
- watch: {
- getGameRatio(val) {
- //console.log(val,'567')
- this.lg_id = val.lg_id
- this.match_id = val.match_id;
- this.guest_team = val.guest_team;
- this.home_team = val.home_team;
- val.oddsData.forEach(e => {
- if (e[0].p_code == this.title) {
- this.data = e;
- this.isData = true;
- //console.log(this.data,'123');
- this.playGrouping(this.data);
- }
- });
- //console.log(this.data);
- },
- //投注数据监听和处理
- getBetting(val) {
- if (val.length > 0) {
- let id = this.$store.getters.getDeleteType;
- for (let i = 0; i < val.length; i++) {
- if (val[i].title == this.title) {
- for (let j = 0; j < this.data.length; j++) {
- if (this.data[j].id == id) {
- this.$set(this.data[j], "isTrue", false);
- break;
- }
- }
- break;
- }
- }
- } else {
- for (let j = 0; j < this.data.length; j++) {
- if (this.data[j].isTrue) {
- this.$set(this.data[j], "isTrue", false);
- }
- }
- }
- },
- //投注数量
- getLimit(val) {
- this.limit = val;
- }
- }
- };
- </script>
- <style scoped>
- .tit {
- background: #cdcdcd;
- font-size: 0.14rem;
- padding: 0 0.1rem;
- height: 0.4rem;
- line-height: 0.4rem;
- color: #333;
- }
- .playCode {
- background: #fff;
- min-height: 0.4rem;
- }
- .playCode > div {
- width: 50%;
- font-size: 0.14rem;
- padding: 0 .1rem;
- }
- .odds {
- width: 0.48rem;
- height: 0.3rem;
- border: 0.01rem solid #ccc;
- line-height: 0.3rem;
- text-align: center;
- border-radius: 0.05rem;
- cursor: pointer;
- }
- .odds:hover,
- .odds:hover {
- background: #ddd;
- color: #f76649;
- }
- .condation {
- color: #f76649;
- font-weight: bold;
- margin-right: .1rem;
- }
- .guest .odds span {
- line-height: 0.44rem;
- }
- </style>
|