d271b6261884954f77273fbb40c55b4e69b5624e.svn-base 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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,item.oddsType)"
  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,item.oddsType)"
  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='',oddsType,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. oddsType
  95. }
  96. //调用玩法投注公共方法
  97. this.$public.bettingFunction(this.betting,bettingInfo,this.data,this.$store.getters.getBetting,this.title,this.dataNum, this.$store.getters.getLimit,function(res,type){
  98. _this.$set(res,'isTrue',type);
  99. },function(data,val,type){
  100. if(type) {
  101. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  102. }
  103. _this.$store.dispatch("BETTING", []);
  104. _this.$store.dispatch("BETTING", data ? data : val);
  105. if(_this.$store.getters.getIsBetting == '100') return false
  106. _this.$store.dispatch("ISBETTING",'100')
  107. })
  108. },
  109. //获取玩法id
  110. getBettingId(data) {
  111. if(data){
  112. data.forEach((res, index) => {
  113. if (res.title == this.title) {
  114. this.betting = res.data;
  115. this.dataNum = index;
  116. }
  117. });
  118. }
  119. }
  120. },
  121. computed: {
  122. //从Vuex获取数据
  123. getUserIcons() {
  124. return this.$store.getters.getGameRatio;
  125. },
  126. getBetting() {
  127. return this.$store.getters.getBetting;
  128. },
  129. //获取投注框删除的投注信息
  130. getDeleteType(){
  131. return this.$store.getters.getDeleteType;
  132. },
  133. },
  134. watch: {
  135. //监听vuex里面数据
  136. getUserIcons(val) {
  137. this.match_id=val.match_id
  138. if(!val) return false;
  139. this.home_team = val.home_team;
  140. this.guest_team = val.guest_team;
  141. this.lg_id=val.lg_id
  142. val.oddsData.forEach(res => {
  143. if (res[0].p_code == this.title) {
  144. this.isDisplay = true;
  145. this.data = res;
  146. }
  147. });
  148. this.getBettingId(this.$store.getters.getBetting);
  149. if (this.dataNum != 10000) {
  150. this.betting.forEach((res) => {
  151. this.data.forEach((e,index) => {
  152. if ((res.id == e.id)) {
  153. this.$set(e,'isTrue',true);
  154. }
  155. });
  156. });
  157. }
  158. },
  159. //获取已投注信息
  160. getBetting(val) {
  161. let _this =this;
  162. this.$public.getBettingId(val,this.title,function(data,index){
  163. _this.betting = data;
  164. _this.dataNum = index;
  165. });
  166. },
  167. //监听投注框删除处理
  168. getDeleteType(val){
  169. this.data.forEach(e =>{
  170. if(val =='all'){
  171. this.$set(e, "isTrue", false);
  172. }else{
  173. if(e.id == val){
  174. this.$set(e, "isTrue", false);
  175. }
  176. }
  177. })
  178. }
  179. },
  180. };
  181. </script>
  182. <style scoped>
  183. div /deep/ .yd-accordion-head-arrow:after {
  184. border: none;
  185. width: 0.5rem;
  186. height: 0.5rem;
  187. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  188. background-size: 100% 100%;
  189. }
  190. div /deep/ .yd-accordion-head,
  191. div /deep/ .yd-accordion-head-content,
  192. div /deep/ .yd-accordion-title {
  193. height: 0.88rem;
  194. font-size: 0.28rem;
  195. color: #FEFEFE;
  196. background: #a0a0a0;
  197. }
  198. div /deep/ .yd-accordion-head {
  199. padding: 0 0.32rem;
  200. }
  201. .twoPadding {
  202. padding: 0 0.32rem;
  203. }
  204. .row-box {
  205. height: 0.9rem;
  206. background: #f4f4f4;
  207. font-size: 0.26rem;
  208. border-bottom: 1px solid #e4e4e4 !important;
  209. }
  210. .The-club-box {
  211. width: 1.07rem;
  212. height: 0.76rem;
  213. font-size: 0.24rem;
  214. padding: 0.1rem;
  215. border: 1px solid #cecece;
  216. border-radius: 0.1rem;
  217. margin: 0.1rem;
  218. }
  219. .active {
  220. background: #f76649;
  221. color: #f4f4f4;
  222. padding: 0.1rem;
  223. border: 2px solid #f76649;
  224. }
  225. .start-box {
  226. height: 0.9rem;
  227. line-height: 0.9rem;
  228. background: #cecece;
  229. color: #333;
  230. }
  231. </style>