3bf308973ab338cf0b96ce033b0174e09e5b1126.svn-base 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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)"
  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)"
  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: "first_last_ball",
  56. home_team: "",
  57. guest_team: "",
  58. data: [], //数据源
  59. isDisplay: "" ,//是否显示
  60. betting: [], //已投注倍率id集合
  61. dataNum: 10000 //对应的数据的下标
  62. };
  63. },
  64. methods: {
  65. //玩法投注
  66. bettingBtn(id,name,odds,condition='',bettingTime='') {
  67. let _this = this;
  68. let bettingInfo = {
  69. id,
  70. home_team:this.home_team,
  71. guest_team:this.guest_team,
  72. name,
  73. odds,
  74. condition,
  75. ganame:this.title,
  76. score:this.score,
  77. bettingTime,
  78. }
  79. //调用玩法投注公共方法
  80. this.$public.bettingFunction(this.betting,bettingInfo,this.data,this.$store.getters.getBetting,this.title,this.dataNum,function(res,type){
  81. _this.$set(res,'isTrue',type);
  82. },function(data,val){
  83. _this.$store.dispatch("BETTING", []);
  84. _this.$store.dispatch("BETTING", data ? data : val);
  85. if(_this.$store.getters.getIsBetting) return false
  86. _this.$store.dispatch("ISBETTING",true)
  87. })
  88. },
  89. //获取玩法id
  90. getBettingId(data) {
  91. if(data){
  92. data.forEach((res, index) => {
  93. if (res.title == this.title) {
  94. this.betting = res.data;
  95. this.dataNum = index;
  96. }
  97. });
  98. }
  99. }
  100. },
  101. computed: {
  102. //从Vuex获取数据
  103. getUserIcons() {
  104. return this.$store.getters.getGameRatio;
  105. },
  106. getBetting() {
  107. return this.$store.getters.getBetting;
  108. },
  109. //获取投注框删除的投注信息
  110. getDeleteType(){
  111. return this.$store.getters.getDeleteType;
  112. },
  113. },
  114. watch: {
  115. //监听vuex里面数据
  116. getUserIcons(val) {
  117. if(!val) return false;
  118. //console.log('先进/后进',val);
  119. this.home_team = val.home_team;
  120. this.guest_team = val.guest_team;
  121. val.oddsData.forEach(res => {
  122. if (res[0].p_code == this.title) {
  123. this.isDisplay = true;
  124. this.data = res;
  125. }
  126. });
  127. this.getBettingId(this.$store.getters.getBetting);
  128. if (this.dataNum != 10000) {
  129. this.betting.forEach((res) => {
  130. this.data.forEach((e,index) => {
  131. if ((res.id == e.id)) {
  132. this.$set(e,'isTrue',true);
  133. }
  134. });
  135. });
  136. }
  137. },
  138. //获取已投注信息
  139. getBetting(val) {
  140. let _this =this;
  141. this.$public.getBettingId(val,this.title,function(data,index){
  142. _this.betting = data;
  143. _this.dataNum = index;
  144. });
  145. },
  146. //监听投注框删除处理
  147. getDeleteType(val){
  148. this.data.forEach(e =>{
  149. if(val =='all'){
  150. this.$set(e, "isTrue", false);
  151. }else{
  152. if(e.id == val){
  153. this.$set(e, "isTrue", false);
  154. }
  155. }
  156. })
  157. }
  158. },
  159. };
  160. </script>
  161. <style scoped>
  162. div /deep/ .yd-accordion-head-arrow:after {
  163. border: none;
  164. width: 0.5rem;
  165. height: 0.5rem;
  166. background: url(../../assets/st-imges/xiangxia.png) no-repeat;
  167. background-size: 100% 100%;
  168. }
  169. div /deep/ .yd-accordion-head,
  170. div /deep/ .yd-accordion-head-content,
  171. div /deep/ .yd-accordion-title {
  172. height: 0.88rem;
  173. font-size: 0.28rem;
  174. color: #FEFEFE;
  175. background: #a0a0a0;
  176. }
  177. div /deep/ .yd-accordion-head {
  178. padding: 0 0.32rem;
  179. }
  180. .twoPadding {
  181. padding: 0 0.32rem;
  182. }
  183. .row-box {
  184. height: 0.9rem;
  185. font-size: 0.26rem;
  186. border-bottom: 1px solid #e4e4e4 !important;
  187. }
  188. .The-club-box {
  189. width: 1.07rem;
  190. height: 0.76rem;
  191. font-size: 0.24rem;
  192. padding: 0.1rem;
  193. border: 2px solid #cecece;
  194. border-radius: 0.1rem;
  195. margin: 0.1rem;
  196. }
  197. .active {
  198. background: #f76649;
  199. color: #f4f4f4;
  200. padding: 0.1rem;
  201. border: 2px solid #f76649;
  202. }
  203. .start-box {
  204. height: 0.9rem;
  205. line-height: 0.9rem;
  206. background: #cecece;
  207. color: #333;
  208. }
  209. </style>