| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 |
- <template>
- <div>
- <div v-if="isDisplay">
- <div v-if="obj.a">
- <yd-accordion>
- <yd-accordion-item title="让球" open>
- <div v-for="(item,index) in data" :accordion="true" :key="index">
- <div v-if="item.odds_code == 'concede_home' || item.odds_code == 'concede_guest'">
- <div style="padding:0 0.32rem;" class="odds">
- <div class="row allAlignment center small">
- <span>{{item.odds_code =='concede_home' ? home_team :guest_team}}</span>
- <div v-if="item.odds >0" class="ratio column center"
- @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球')"
- :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
- >
- <span class="score">{{item.condition}}</span>
- <span>{{item.odds}}</span>
- </div>
- <div v-else class="ratio column center">
- <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
- </div>
- </div>
- </div>
- </div>
- </div>
- </yd-accordion-item>
- </yd-accordion>
- </div>
-
- <div v-if="obj.b">
- <yd-accordion>
- <yd-accordion-item title="让球-上半场" open>
- <div v-for="(item,index) in data" :accordion="true" :key="index">
- <div v-if="item.odds_code.startsWith('half') ">
- <div style="padding:0 0.32rem;" class="odds">
- <div class="row allAlignment center small">
- <span>{{item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
- <div v-if="item.odds >0" class="ratio column center"
- @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-上半场')"
- :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
- >
- <span class="score">{{item.condition}}</span>
- <span>{{item.odds}}</span>
- </div>
- <div v-else class="ratio column center">
- <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
- </div>
- </div>
- </div>
- </div>
- </div>
- </yd-accordion-item>
- </yd-accordion>
- </div>
- <div v-if="obj.c">
- <yd-accordion>
- <yd-accordion-item title="让球-第一节" open>
- <div v-for="(item,index) in data" :accordion="true" :key="index">
- <div v-if="item.odds_code.startsWith('one')">
- <div style="padding:0 0.32rem;" class="odds">
- <div class="row allAlignment center small">
- <span>{{item.odds_code.endsWith('home')? home_team :guest_team}}</span>
- <div v-if="item.odds >0" class="ratio column center"
- @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-第一节')"
- :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
- >
- <span class="score">{{item.condition}}</span>
- <span>{{item.odds}}</span>
- </div>
- <div v-else class="ratio column center">
- <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
- </div>
- </div>
- </div>
- </div>
- </div>
- </yd-accordion-item>
- </yd-accordion>
- </div>
- <div v-if="obj.d">
- <yd-accordion>
- <yd-accordion-item title="让球-第二节" open>
- <div v-for="(item,index) in data" :accordion="true" :key="index">
- <div v-if="item.odds_code.startsWith('two')">
- <div style="padding:0 0.32rem;" class="odds">
- <div class="row allAlignment center small">
- <span>{{item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
- <div v-if="item.odds >0" class="ratio column center"
- @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-第二节')"
- :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
- >
- <span class="score">{{item.condition}}</span>
- <span>{{item.odds}}</span>
- </div>
- <div v-else class="ratio column center">
- <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
- </div>
- </div>
- </div>
- </div>
- </div>
- </yd-accordion-item>
- </yd-accordion>
- </div>
- <div v-if="obj.e">
- <yd-accordion>
- <yd-accordion-item title="让球-第三节" open>
- <div v-for="(item,index) in data" :accordion="true" :key="index">
- <div v-if="item.odds_code.startsWith('three')">
- <div style="padding:0 0.32rem;" class="odds">
- <div class="row allAlignment center small">
- <span>{{ item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
- <div v-if="item.odds >0" class="ratio column center"
- @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-第三节')"
- :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
- >
- <span class="score">{{item.condition}}</span>
- <span>{{item.odds}}</span>
- </div>
- <div v-else class="ratio column center">
- <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
- </div>
- </div>
- </div>
- </div>
- </div>
- </yd-accordion-item>
- </yd-accordion>
- </div>
- <div v-if="obj.f">
- <yd-accordion>
- <yd-accordion-item title="让球-第四节" open>
- <div v-for="(item,index) in data" :accordion="true" :key="index">
- <div v-if="item.odds_code.startsWith('four')">
- <div style="padding:0 0.32rem;" class="odds">
- <div class="row allAlignment center small">
- <span>{{ item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
- <div v-if="item.odds >0" class="ratio column center"
- @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-第四节')"
- :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
- >
- <span class="score">{{item.condition}}</span>
- <span>{{item.odds}}</span>
- </div>
- <div v-else class="ratio column center">
- <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
- </div>
- </div>
- </div>
- </div>
- </div>
- </yd-accordion-item>
- </yd-accordion>
- </div>
- <div v-if="obj.g">
- <yd-accordion>
- <yd-accordion-item title="让球-前五局" open>
- <div v-for="(item,index) in data" :accordion="true" :key="index">
- <div v-if="item.odds_code.startsWith('five')">
- <div style="padding:0 0.32rem;" class="odds">
- <div class="row allAlignment center small">
- <span>{{ item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
- <div v-if="item.odds >0" class="ratio column center"
- @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-前五局')"
- :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
- >
- <span class="score">{{item.condition}}</span>
- <span>{{item.odds}}</span>
- </div>
- <div v-else class="ratio column center">
- <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
- </div>
- </div>
- </div>
- </div>
- </div>
- </yd-accordion-item>
- </yd-accordion>
- </div>
- </div>
- </div>
- </template>
- <script>
- // import BettingWindow from "@/components/StBettingWindow";
- export default {
- data() {
- return {
- title: "concede",
- isDisplay: false,
- home_team: "",
- guest_team: "",
- data: [],
- obj:'',//
- lg_id:'',
- match_id: "",
- betting: [], //已投注倍率id集合
- dataNum: 10000 //对应的数据的下标
- };
- },
- methods: {
- //玩法投注
- bettingBtn(id,name,odds,odds_only,p_code,match_id,condition,odds_code,play_name,bettingTime = "") {
- let _this = this;
- let bettingInfo = {
- id,
- home_team: this.home_team,
- guest_team: this.guest_team,
- name,
- odds,
- p_code,
- ballId: this.$store.getters.getBallId,
- match_id,
- condition,
- odds_code: odds_code,
- score: this.score,
- bettingTime,
- odds_only,
- play_name,
- odds_id:id,
- lg_id:this.lg_id,
- };
- // if(this.$store.getters.getLimit * 1 >= 10){
- // this.$dialog.alert({mes: '你的注单已达到上限啦!'});
- // }
- // if (isAdd) {
- //调用玩法投注公共方法
- 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,type) {
- //console.log(data, val,type);
- if(type) {
- _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
- }
- _this.$store.dispatch("BETTING", []);
- _this.$store.dispatch("BETTING", data ? data : val);
- if(_this.$store.getters.getIsBetting == '100') return false
- _this.$store.dispatch("ISBETTING",'100')
- }
- );
- // }
- if (this.$store.getters.getLimit * 1 >= 10) return false;
- },
- //获取玩法id
- getBettingId(data) {
- if (data) {
- data.forEach((res, index) => {
- if (res.title == this.title) {
- this.betting = res.data;
- this.dataNum = index;
- }
- });
- }
- },
- /*-------------------------------*/
- //获取子玩法分类
- getChildPlay(data){
- let obj ={};
- data.forEach(e=>{
- if(e.odds_code.startsWith('concede')){
- obj.a =true;
- }else if(e.odds_code.startsWith('half')){
- obj.b =true;
- }else if(e.odds_code.startsWith('one')){
- obj.c =true;
- }else if(e.odds_code.startsWith('two')){
- obj.d =true;
- }else if(e.odds_code.startsWith('three')){
- obj.e =true;
- }else if(e.odds_code.startsWith('four')){
- obj.f =true;
- }else if(e.odds_code.startsWith('five')){
- obj.g =true;
- }
- this.obj = obj
- })
- },
- },
- /**
- * 计算属性
- */
- computed: {
- getUserIcons() {
- return this.$store.getters.getGameRatio;
- },
- getBetting() {
- return this.$store.getters.getBetting;
- },
- //获取投注框删除的投注信息
- getDeleteType() {
- return this.$store.getters.getDeleteType;
- }
- },
- /**
- * 监听器
- */
- watch: {
- getUserIcons(val) {
- this.match_id = val.match_id;
- if (!val) return false;
- this.home_team = val.home_team;
- this.guest_team = val.guest_team;
- // 联赛id
- this.lg_id=val.lg_id;
- val.oddsData.forEach(res => {
- if (res[0].p_code == this.title) {
- //console.log("更新数据", res);
- this.isDisplay = true;
- this.data = res;
- this.getChildPlay(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);
- }
- }
- });
- }
- }
- // component:{BettingWindow},
- };
- </script>
- <style scoped>
- div /deep/ .yd-accordion-head {
- padding: 0 0.32rem;
- background: #a0a0a0;
- }
- div /deep/ .yd-accordion-title {
- color: #fefefe;
- font-size: 0.28rem;
- }
- 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%;
- }
- .small {
- font-size: 0.26rem;
- border-bottom: 1px solid #e4e4e4;
- padding-left: 0.16rem;
- }
- .odds {
- background: #f4f4f4;
- text-align: left;
- }
- .ratio {
- width: 1.07rem;
- height: 0.76rem;
- border: 1px solid #cecece;
- margin-right: 0.14rem;
- border-radius: 0.1rem;
- margin: 0.06rem;
- }
- .score {
- color: #f76649;
- }
- .col {
- background: #f76649;
- border: 2px solid #f76649 !important;
- }
- .col span {
- color: #f4f4f4 !important;
- }
- </style>
|