cfcfb16cb695a7a355d118762014c8bf6cff168f.svn-base 6.2 KB

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