20655c4e69c724086de6766a1eaaa3ec250b1acf.svn-base 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div>
  3. <div v-if="isDisplay ">
  4. <yd-accordion>
  5. <!-- 组件标题 -->
  6. <yd-accordion-item class="Match-game" title="最先进球/最后进球" open>
  7. <div class="start-box twoPadding">
  8. <span>最先进球队伍</span>
  9. </div>
  10. <div style="background: #F0F0F0;" v-for="(item,index) in data" :key="index">
  11. <div v-if=" item.odds_code =='first_ball_home' || item.odds_code =='first_ball_guest'">
  12. <div class="row allAlignment center row-box twoPadding">
  13. <span>{{ item.odds_code =='first_ball_home' ? home_team :guest_team}}</span>
  14. <div
  15. class="The-club-box row center"
  16. :class="item.isTrue== true ? 'active' : ''"
  17. @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'),'最先进球队伍')"
  18. >
  19. <span>{{item.odds}}</span>
  20. </div>
  21. </div>
  22. </div>
  23. <!-- ':'最后进球队伍'}} -->
  24. </div>
  25. <div class="start-box twoPadding">
  26. <span>最后进球队伍</span>
  27. </div>
  28. <div style="background: #F0F0F0;" v-for="(item,index) in data" :key="item.id">
  29. <div
  30. v-if="item.odds_code =='last_ball_home' || item.odds_code =='last_ball_guest' || item.odds_code == 'not_ball' "
  31. >
  32. <div class="row allAlignment center row-box twoPadding">
  33. <span>{{ item.odds_code =='last_ball_home' ? home_team : item.odds_code =='last_ball_guest' ? guest_team :'无进球'}}</span>
  34. <div
  35. class="The-club-box row center"
  36. :class="item.isTrue== true ? 'active' : ''"
  37. @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'),'最后进球队伍')"
  38. >
  39. <span>{{item.odds}}</span>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </yd-accordion-item>
  45. </yd-accordion>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. export default {
  51. // 让球
  52. data() {
  53. return {
  54. // 组件内部测试状态
  55. title: "",
  56. home_team: "",
  57. guest_team: "",
  58. match_id:'',
  59. lg_id:'',
  60. data: [], //数据源
  61. isDisplay: "" ,//是否显示
  62. betting: [], //已投注倍率id集合
  63. dataNum: 10000 //对应的数据的下标
  64. };
  65. },
  66. methods: {
  67. //玩法投注
  68. bettingBtn(id,name,odds,odds_only,p_code,match_id,odds_code,play_name,condition='',bettingTime='') {
  69. console.log(this.data)
  70. let _this = this;
  71. let bettingInfo = {
  72. id,
  73. home_team:this.home_team,
  74. guest_team:this.guest_team,
  75. name,
  76. odds,
  77. p_code,
  78. match_id,
  79. condition,
  80. odds_code,
  81. play_name,
  82. lg_id:this.lg_id,
  83. odds_id:id,
  84. odds_code,
  85. score:this.score,
  86. bettingTime,
  87. odds_only,
  88. ballId:this.$store.getters.getBallId,
  89. }
  90. //调用玩法投注公共方法
  91. this.$public.bettingFunction(this.betting,bettingInfo,this.data,this.$store.getters.getBetting,this.title,this.dataNum, this.$store.getters.getLimit,function(res,type){
  92. _this.$set(res,'isTrue',type);
  93. },function(data,val){
  94. if(type) {
  95. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  96. }
  97. _this.$store.dispatch("BETTING", []);
  98. _this.$store.dispatch("BETTING", data ? data : val);
  99. if(_this.$store.getters.getIsBetting) return false
  100. _this.$store.dispatch("ISBETTING",true)
  101. })
  102. },
  103. //获取玩法id
  104. getBettingId(data) {
  105. if(data){
  106. data.forEach((res, index) => {
  107. if (res.title == this.title) {
  108. this.betting = res.data;
  109. this.dataNum = index;
  110. }
  111. });
  112. }
  113. }
  114. },
  115. computed: {
  116. //从Vuex获取数据
  117. getUserIcons() {
  118. return this.$store.getters.getGameRatio;
  119. },
  120. getBetting() {
  121. return this.$store.getters.getBetting;
  122. },
  123. //获取投注框删除的投注信息
  124. getDeleteType(){
  125. return this.$store.getters.getDeleteType;
  126. },
  127. },
  128. watch: {
  129. //监听vuex里面数据
  130. getUserIcons(val) {
  131. this.match_id=val.match_id
  132. if(!val) return false;
  133. //console.log('先进/后进',val);
  134. this.home_team = val.home_team;
  135. this.guest_team = val.guest_team;
  136. this.lg_id=val.lg_id
  137. val.oddsData.forEach(res => {
  138. if (res[0].p_code == this.title) {
  139. this.isDisplay = true;
  140. this.data = res;
  141. }
  142. });
  143. this.getBettingId(this.$store.getters.getBetting);
  144. if (this.dataNum != 10000) {
  145. this.betting.forEach((res) => {
  146. this.data.forEach((e,index) => {
  147. if ((res.id == e.id)) {
  148. this.$set(e,'isTrue',true);
  149. }
  150. });
  151. });
  152. }
  153. },
  154. //获取已投注信息
  155. getBetting(val) {
  156. let _this =this;
  157. this.$public.getBettingId(val,this.title,function(data,index){
  158. _this.betting = data;
  159. _this.dataNum = index;
  160. });
  161. },
  162. //监听投注框删除处理
  163. getDeleteType(val){
  164. this.data.forEach(e =>{
  165. if(val =='all'){
  166. this.$set(e, "isTrue", false);
  167. }else{
  168. if(e.id == val){
  169. this.$set(e, "isTrue", false);
  170. }
  171. }
  172. })
  173. }
  174. },
  175. };
  176. </script>
  177. <style scoped>
  178. div /deep/ .yd-accordion-head-arrow:after {
  179. border: none;
  180. width: 0.5rem;
  181. height: 0.5rem;
  182. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  183. background-size: 100% 100%;
  184. }
  185. div /deep/ .yd-accordion-head,
  186. div /deep/ .yd-accordion-head-content,
  187. div /deep/ .yd-accordion-title {
  188. height: 0.88rem;
  189. font-size: 0.28rem;
  190. color: #FEFEFE;
  191. background: #a0a0a0;
  192. }
  193. div /deep/ .yd-accordion-head {
  194. padding: 0 0.32rem;
  195. }
  196. .twoPadding {
  197. padding: 0 0.32rem;
  198. }
  199. .row-box {
  200. height: 0.9rem;
  201. font-size: 0.26rem;
  202. border-bottom: 1px solid #e4e4e4 !important;
  203. }
  204. .The-club-box {
  205. width: 1.07rem;
  206. height: 0.76rem;
  207. font-size: 0.24rem;
  208. padding: 0.1rem;
  209. border: 2px solid #cecece;
  210. border-radius: 0.1rem;
  211. margin: 0.1rem;
  212. }
  213. .active {
  214. background: #f76649;
  215. color: #f4f4f4;
  216. padding: 0.1rem;
  217. border: 2px solid #f76649;
  218. }
  219. .start-box {
  220. height: 0.9rem;
  221. line-height: 0.9rem;
  222. background: #cecece;
  223. color: #333;
  224. }
  225. </style>