| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <template>
- <div>
- <div v-if="isDisplay ">
- <yd-accordion>
- <!-- 组件标题 -->
- <yd-accordion-item class="Match-game" title="最先进球/最后进球" open>
- <div class="start-box twoPadding">
- <span>最先进球队伍</span>
- </div>
- <div style="background: #F0F0F0;" v-for="(item,index) in data" :key="index">
- <div v-if=" item.odds_code =='first_ball_home' || item.odds_code =='first_ball_guest'">
- <div class="row allAlignment center row-box twoPadding">
- <span>{{ item.odds_code =='first_ball_home' ? home_team :guest_team}}</span>
- <div
- class="The-club-box row center"
- :class="item.isTrue== true ? 'active' : ''"
- @click="bettingBtn(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,(item.odds_code =='first_ball_home' ? 'home_team' :'guest_team'),'最先进球队伍')"
- >
- <span>{{item.odds}}</span>
- </div>
- </div>
- </div>
- <!-- ':'最后进球队伍'}} -->
- </div>
- <div class="start-box twoPadding">
- <span>最后进球队伍</span>
- </div>
- <div style="background: #F0F0F0;" v-for="(item,index) in data" :key="item.id">
- <div
- v-if="item.odds_code =='last_ball_home' || item.odds_code =='last_ball_guest' || item.odds_code == 'not_ball' "
- >
- <div class="row allAlignment center row-box twoPadding">
- <span>{{ item.odds_code =='last_ball_home' ? home_team : item.odds_code =='last_ball_guest' ? guest_team :'无进球'}}</span>
- <div
- class="The-club-box row center"
- :class="item.isTrue== true ? 'active' : ''"
- @click="bettingBtn(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,(item.odds_code =='last_ball_home' ? 'home_team' : item.odds_code =='last_ball_guest' ?'guest_team' :'not_ball'),'最后进球队伍')"
- >
- <span>{{item.odds}}</span>
- </div>
- </div>
- </div>
- </div>
- </yd-accordion-item>
- </yd-accordion>
- </div>
- </div>
- </template>
- <script>
- export default {
- // 让球
- data() {
- return {
- // 组件内部测试状态
- title: "",
- home_team: "",
- guest_team: "",
- match_id:'',
- lg_id:'',
- data: [], //数据源
- isDisplay: "" ,//是否显示
- betting: [], //已投注倍率id集合
- dataNum: 10000 //对应的数据的下标
- };
- },
- methods: {
- //玩法投注
- bettingBtn(id,name,odds,odds_only,p_code,match_id,odds_code,play_name,condition='',bettingTime='') {
- console.log(this.data)
- let _this = this;
- let bettingInfo = {
- id,
- home_team:this.home_team,
- guest_team:this.guest_team,
- name,
- odds,
- p_code,
- match_id,
- condition,
- odds_code,
- play_name,
- lg_id:this.lg_id,
- odds_id:id,
- odds_code,
- score:this.score,
- bettingTime,
- odds_only,
- ballId:this.$store.getters.getBallId,
- }
- //调用玩法投注公共方法
- this.$public.bettingFunction(this.betting,bettingInfo,this.data,this.$store.getters.getBetting,this.title,this.dataNum, this.$store.getters.getLimit,function(res,type){
- _this.$set(res,'isTrue',type);
- },function(data,val){
- if(type) {
- _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
- }
- _this.$store.dispatch("BETTING", []);
- _this.$store.dispatch("BETTING", data ? data : val);
- if(_this.$store.getters.getIsBetting) return false
- _this.$store.dispatch("ISBETTING",true)
- })
- },
- //获取玩法id
- getBettingId(data) {
- if(data){
- data.forEach((res, index) => {
- if (res.title == this.title) {
- this.betting = res.data;
- this.dataNum = index;
- }
- });
- }
- }
- },
- computed: {
- //从Vuex获取数据
- getUserIcons() {
- return this.$store.getters.getGameRatio;
- },
- getBetting() {
- return this.$store.getters.getBetting;
- },
- //获取投注框删除的投注信息
- getDeleteType(){
- return this.$store.getters.getDeleteType;
- },
- },
- watch: {
- //监听vuex里面数据
- getUserIcons(val) {
- this.match_id=val.match_id
- if(!val) return false;
- //console.log('先进/后进',val);
- this.home_team = val.home_team;
- this.guest_team = val.guest_team;
- this.lg_id=val.lg_id
- val.oddsData.forEach(res => {
- if (res[0].p_code == this.title) {
- this.isDisplay = true;
- this.data = res;
-
- }
- });
- this.getBettingId(this.$store.getters.getBetting);
- if (this.dataNum != 10000) {
- this.betting.forEach((res) => {
- this.data.forEach((e,index) => {
- if ((res.id == e.id)) {
- this.$set(e,'isTrue',true);
- }
- });
- });
- }
-
- },
- //获取已投注信息
- getBetting(val) {
- let _this =this;
- this.$public.getBettingId(val,this.title,function(data,index){
- _this.betting = data;
- _this.dataNum = index;
- });
- },
- //监听投注框删除处理
- getDeleteType(val){
- this.data.forEach(e =>{
- if(val =='all'){
- this.$set(e, "isTrue", false);
- }else{
- if(e.id == val){
- this.$set(e, "isTrue", false);
- }
- }
- })
- }
- },
- };
- </script>
- <style scoped>
- div /deep/ .yd-accordion-head-arrow:after {
- border: none;
- width: 0.5rem;
- height: 0.5rem;
- background: url(../assets/st-imges/xiangxia.png) no-repeat;
- background-size: 100% 100%;
- }
- div /deep/ .yd-accordion-head,
- div /deep/ .yd-accordion-head-content,
- div /deep/ .yd-accordion-title {
- height: 0.88rem;
- font-size: 0.28rem;
- color: #FEFEFE;
- background: #a0a0a0;
- }
- div /deep/ .yd-accordion-head {
- padding: 0 0.32rem;
- }
- .twoPadding {
- padding: 0 0.32rem;
- }
- .row-box {
- height: 0.9rem;
- font-size: 0.26rem;
- border-bottom: 1px solid #e4e4e4 !important;
- }
- .The-club-box {
- width: 1.07rem;
- height: 0.76rem;
- font-size: 0.24rem;
- padding: 0.1rem;
- border: 2px solid #cecece;
- border-radius: 0.1rem;
- margin: 0.1rem;
- }
- .active {
- background: #f76649;
- color: #f4f4f4;
- padding: 0.1rem;
- border: 2px solid #f76649;
- }
- .start-box {
- height: 0.9rem;
- line-height: 0.9rem;
- background: #cecece;
- color: #333;
- }
- </style>
|