425148b44cc619ab35b9147dc91c4ceb011b44dd.svn-base 5.6 KB

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