39ba4f56275dbd585143d0ed742a7ddfc8a36ed8.svn-base 6.3 KB

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