82288ada17522f50c9f5ce500094bdf48521b082.svn-base 7.5 KB

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