8696ea016a801734ce5b6d31957a8e6a0508a82e.svn-base 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <div>
  3. <div v-if="isData">
  4. <div v-if="obj.a ">
  5. <div class="tit">
  6. <span>让局</span>
  7. </div>
  8. <div class="playCode">
  9. <div class="row item-center">
  10. <div class="teamName wrap">{{home_team}}</div>
  11. <div class="row allAlignment">
  12. <div class="row center obbsBox rightAlignment" v-for="(item,index) in data" v-if="item.odds_code == 'lbh'">
  13. <span class="condation">{{item.condition}}</span>
  14. <div
  15. class="odds row center"
  16. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  17. @click="betMethod(index,item.id,home_team,'让局')"
  18. >
  19. <span>{{item.odds}}</span>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="row item-center">
  25. <div class="teamName wrap">{{guest_team}}</div>
  26. <div class="row allAlignment">
  27. <div class="row center obbsBox rightAlignment" v-for="(item,index) in data" v-if="item.odds_code == 'lbg'">
  28. <span class="condation">{{item.condition}}</span>
  29. <div
  30. class="odds row center"
  31. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  32. @click="betMethod(index,item.id,guest_team,'让局')"
  33. >
  34. <span>{{item.odds}}</span>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. title: "LB",
  49. data: [], //数据源
  50. isData: "", //是否有数据
  51. guest_team: "", //客队名
  52. home_team: "", //主队名
  53. obj: "", //
  54. match_id: "", //赛事id
  55. limit: "", //投注数量
  56. lg_id: ""
  57. };
  58. },
  59. /***
  60. * 方法
  61. */
  62. methods: {
  63. //玩法分类
  64. playGrouping(data) {
  65. let obj = {};
  66. let betting = this.$store.getters.getBetting;
  67. data.forEach(e => {
  68. if(betting.length > 0){
  69. for(let i= 0; i< betting.length; i++){
  70. if(betting[i].title =="LB" && betting[i].data.length >0){
  71. for(let j = 0 ; j < betting[i].data.length ; j++ ){
  72. if(betting[i].data[j].id == e.id){
  73. this.$set(e,'isTrue',true);
  74. //betting[i].data.splice(j,1);
  75. }
  76. }
  77. break;
  78. }
  79. }
  80. }
  81. e.lg_id = this.lg_id;
  82. if (e.odds_code.startsWith("lb")) {
  83. obj.a = true;
  84. }
  85. });
  86. this.obj = obj;
  87. },
  88. /*-------------------------------------------*/
  89. //玩法投注
  90. betMethod(index, id, name, playName) {
  91. if (this.data[index].isTrue) {
  92. this.$set(this.data[index], "isTrue", false);
  93. } else {
  94. if (this.limit < 10) {
  95. this.$set(this.data[index], "isTrue", true);
  96. }
  97. }
  98. //调用投注公共方法
  99. let betting = this.$store.getters.getBetting;
  100. let _this = this;
  101. let ballId = this.$store.getters.getBallCode;
  102. let teamName = {
  103. home: this.home_team,
  104. guest: this.guest_team
  105. };
  106. this.$public.publicBetMethod(
  107. this.data,
  108. this.title,
  109. id,
  110. index,
  111. betting,
  112. teamName,
  113. playName,
  114. name,
  115. this.match_id,
  116. ballId,
  117. this.limit,
  118. function(data, type) {
  119. if (type) {
  120. _this.$dialog.toast({ mes: "亲,超出表格上限啦。", timeout: 2000 });
  121. }
  122. _this.$store.dispatch("SET_BETTING", []);
  123. _this.$store.dispatch("SET_BETTING", data);
  124. }
  125. );
  126. }
  127. },
  128. /**
  129. * 计算属性
  130. */
  131. computed: {
  132. //获取玩法数据
  133. getGameRatio() {
  134. return this.$store.getters.getGameRatio;
  135. },
  136. //获取投注数据
  137. getBetting() {
  138. return this.$store.getters.getBetting;
  139. },
  140. //获取投注数据数量
  141. getLimit() {
  142. return this.$store.getters.getLimit;
  143. }
  144. },
  145. /**
  146. * 监听器
  147. */
  148. watch: {
  149. //玩法数据处理和监听
  150. getGameRatio(val) {
  151. this.lg_id = val.lg_id;
  152. this.match_id = val.match_id;
  153. this.guest_team = val.guest_team;
  154. this.home_team = val.home_team;
  155. val.oddsData.forEach(e => {
  156. if (e[0].p_code == this.title) {
  157. this.data = e;
  158. console.log(this.data,'wp局')
  159. this.isData = true;
  160. this.playGrouping(this.data);
  161. }
  162. });
  163. // console.log(this.data);
  164. },
  165. //投注数据监听和处理
  166. getBetting(val) {
  167. if (val.length > 0) {
  168. for (let i = 0; i < val.length; i++) {
  169. if (val[i].title == this.title) {
  170. let id = this.$store.getters.getDeleteType;
  171. for (let j = 0; j < this.data.length; j++) {
  172. if (this.data[j].id == id) {
  173. this.$set(this.data[j], "isTrue", false);
  174. break;
  175. }
  176. }
  177. break;
  178. }
  179. }
  180. }
  181. },
  182. //投注数量
  183. getLimit(val) {
  184. this.limit = val;
  185. }
  186. }
  187. };
  188. </script>
  189. <style scoped>
  190. .tit {
  191. background: #cdcdcd;
  192. font-size: 0.14rem;
  193. padding: 0 0.1rem;
  194. height: 0.4rem;
  195. line-height: 0.4rem;
  196. color: #333;
  197. }
  198. .playCode {
  199. background: #fff;
  200. min-height: 0.8rem;
  201. }
  202. .playCode > div {
  203. min-height: 0.4rem;
  204. font-size: 0.14rem;
  205. }
  206. .obbsBox {
  207. width: 1.3rem;
  208. }
  209. .teamName {
  210. width: 1.5rem;
  211. }
  212. .odds {
  213. width: 0.48rem;
  214. height: 0.3rem;
  215. border: 0.01rem solid #ccc;
  216. line-height: 0.3rem;
  217. text-align: center;
  218. border-radius: 0.05rem;
  219. cursor: pointer;
  220. }
  221. .odds:hover,
  222. .odds:hover {
  223. background: #ddd;
  224. color: #f76649;
  225. }
  226. .condation {
  227. color: #f4755b;
  228. font-weight: bold;
  229. margin-right: 0.1rem;
  230. }
  231. .guest .odds span {
  232. line-height: 0.44rem;
  233. }
  234. </style>