8d81777bb16b6d3a60a9eec3229721a3355f2dc6.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <div>
  3. <div v-if=" obj.a">
  4. <div class="tit" v-if="andShow != 'zq'">
  5. <span>总分:单/双</span>
  6. </div>
  7. <div class="tit" v-if="andShow == 'zq'">
  8. <span>进球:单/双</span>
  9. </div>
  10. <div class="playCode">
  11. <div class="home flex">
  12. <span class="teamName">单</span>
  13. <div v-for="(item,index) in data" v-if="item.odds_code == 'tss'">
  14. <span
  15. class="odds"
  16. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  17. @click="betMethod(index,item.id,'',andShow == 'zq'?'进球:单/双':'总分:单/双')"
  18. >{{item.odds}}</span>
  19. </div>
  20. </div>
  21. <div class="guest flex">
  22. <span class="teamName">双</span>
  23. <div
  24. class="oddsBox"
  25. v-for="(item,index) in data"
  26. v-if="item.odds_code == 'tsd'"
  27. >
  28. <span
  29. class="odds"
  30. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  31. @click="betMethod(index,item.id,'',andShow == 'zq'?'进球:单/双':'总分:单/双')"
  32. >{{item.odds}}</span>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <div v-if=" obj.b">
  38. <div class="tit" v-if="andShow != 'zq'">
  39. <span>总分:单/双-上半场</span>
  40. </div>
  41. <div class="tit" v-if="andShow == 'zq'">
  42. <span>进球:单/双-上半场</span>
  43. </div>
  44. <div class="playCode">
  45. <div class="home flex">
  46. <span class="teamName">单</span>
  47. <div v-for="(item,index) in data" v-if="item.odds_code == 'tss_h'">
  48. <span
  49. class="odds"
  50. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  51. @click="betMethod(index,item.id,'',andShow == 'zq'?'进球:单/双-上半场':'总分:单/双-上半场')"
  52. >{{item.odds}}</span>
  53. </div>
  54. </div>
  55. <div class="guest flex">
  56. <span class="teamName">双</span>
  57. <div
  58. class="oddsBox"
  59. v-for="(item,index) in data"
  60. v-if="item.odds_code == 'tsd_h'"
  61. >
  62. <span
  63. class="odds"
  64. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  65. @click="betMethod(index,item.id,'',andShow == 'zq'?'进球:单/双-上半场':'总分:单/双-上半场')"
  66. >{{item.odds}}</span>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <div v-if=" obj.c">
  72. <div class="tit">
  73. <span>总分:单/双-第一节</span>
  74. </div>
  75. <div class="playCode">
  76. <div class="home flex">
  77. <span class="teamName">单</span>
  78. <div
  79. v-for="(item,index) in data"
  80. v-if="item.odds_code.startsWith('tss') && item.odds_code.endsWith('_1')"
  81. >
  82. <span
  83. class="odds"
  84. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  85. @click="betMethod(index,item.id,'','总分:单/双-第一节')"
  86. >{{item.odds}}</span>
  87. </div>
  88. </div>
  89. <div class="guest flex">
  90. <span class="teamName">双</span>
  91. <div
  92. class="oddsBox"
  93. v-for="(item,index) in data"
  94. v-if="item.odds_code.startsWith('tsd') && item.odds_code.endsWith('_1')"
  95. >
  96. <span
  97. class="odds"
  98. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  99. @click="betMethod(index,item.id,'','总分:单/双-第一节')"
  100. >{{item.odds}}</span>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <div v-if=" obj.d">
  106. <div class="tit">
  107. <span>总分:单/双-第二节</span>
  108. </div>
  109. <div class="playCode">
  110. <div class="home flex">
  111. <span class="teamName">单</span>
  112. <div
  113. v-for="(item,index) in data"
  114. v-if="item.odds_code.startsWith('tss') && item.odds_code.endsWith('_2')"
  115. >
  116. <span
  117. class="odds"
  118. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  119. @click="betMethod(index,item.id,'','总分:单/双-第二节')"
  120. >{{item.odds}}</span>
  121. </div>
  122. </div>
  123. <div class="guest flex">
  124. <span class="teamName">双</span>
  125. <div
  126. class="oddsBox"
  127. v-for="(item,index) in data"
  128. v-if="item.odds_code.startsWith('tsd') && item.odds_code.endsWith('_2')"
  129. >
  130. <span
  131. class="odds"
  132. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  133. @click="betMethod(index,item.id,'','总分:单/双-第二节')"
  134. >{{item.odds}}</span>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. <div v-if=" obj.e">
  140. <div class="tit">
  141. <span>总分:单/双-第三节</span>
  142. </div>
  143. <div class="playCode">
  144. <div class="home flex">
  145. <span class="teamName">单</span>
  146. <div
  147. v-for="(item,index) in data"
  148. v-if="item.odds_code.startsWith('tss') && item.odds_code.endsWith('_3')"
  149. >
  150. <span
  151. class="odds"
  152. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  153. @click="betMethod(index,item.id,'','总分:单/双-第三节')"
  154. >{{item.odds}}</span>
  155. </div>
  156. </div>
  157. <div class="guest flex">
  158. <span class="teamName">双</span>
  159. <div
  160. class="oddsBox"
  161. v-for="(item,index) in data"
  162. v-if="item.odds_code.startsWith('tsd') && item.odds_code.endsWith('_3')"
  163. >
  164. <span
  165. class="odds"
  166. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  167. @click="betMethod(index,item.id,'','总分:单/双-第三节')"
  168. >{{item.odds}}</span>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <div v-if=" obj.f">
  174. <div class="tit">
  175. <span>总分:单/双-第四节</span>
  176. </div>
  177. <div class="playCode">
  178. <div class="home flex">
  179. <span class="teamName">单</span>
  180. <div
  181. v-for="(item,index) in data"
  182. v-if="item.odds_code.startsWith('tss') && item.odds_code.endsWith('_4')"
  183. >
  184. <span
  185. class="odds"
  186. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  187. @click="betMethod(index,item.id,'','总分:单/双-第四节')"
  188. >{{item.odds}}</span>
  189. </div>
  190. </div>
  191. <div class="guest flex">
  192. <span class="teamName">双</span>
  193. <div
  194. class="oddsBox"
  195. v-for="(item,index) in data"
  196. v-if="item.odds_code.startsWith('tsd') && item.odds_code.endsWith('_4')"
  197. >
  198. <span
  199. class="odds"
  200. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  201. @click="betMethod(index,item.id,'','总分:单/双-第四节')"
  202. >{{item.odds}}</span>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. </div>
  208. </template>
  209. <script>
  210. export default {
  211. data() {
  212. return {
  213. title: "TS",
  214. andShow: "",
  215. guest_team: "", //客队名
  216. home_team: "", //主队名
  217. obj: "",
  218. match_id: "",
  219. data: [],
  220. limit: "", //投注数量
  221. lg_id:'',
  222. };
  223. },
  224. /**
  225. * 页面初始化完成挂载
  226. */
  227. mounted() {
  228. this.andShow = this.$store.getters.getBallCode;
  229. },
  230. /***
  231. * 方法
  232. */
  233. methods: {
  234. //玩法分类
  235. playGrouping(data) {
  236. let obj = {};
  237. let betting = this.$store.getters.getBetting;
  238. data.forEach(e => {
  239. if(betting.length > 0){
  240. for(let i= 0; i< betting.length; i++){
  241. if(betting[i].title =="TS" && betting[i].data.length >0){
  242. for(let j = 0 ; j < betting[i].data.length ; j++ ){
  243. if(betting[i].data[j].id == e.id){
  244. this.$set(e,'isTrue',true);
  245. //betting[i].data.splice(j,1);
  246. }
  247. }
  248. break;
  249. }
  250. }
  251. }
  252. e.lg_id = this.lg_id;
  253. if (e.odds_code == 'tss' || e.odds_code == 'tsd') {
  254. obj.a = true;
  255. } else if (e.odds_code.endsWith("_h")) {
  256. obj.b = true;
  257. } else if (e.odds_code.endsWith("_1")) {
  258. obj.c = true;
  259. } else if (e.odds_code.endsWith("_2")) {
  260. obj.d = true;
  261. } else if (e.odds_code.endsWith("_3")) {
  262. obj.e = true;
  263. } else if (e.odds_code.endsWith("_4")) {
  264. obj.f = true;
  265. }
  266. });
  267. this.obj = obj;
  268. },
  269. /*---------------------------------- */
  270. //玩法投注
  271. betMethod(index, id, name, playName) {
  272. if (this.data[index].isTrue) {
  273. this.$set(this.data[index], "isTrue", false);
  274. this.$forceUpdate();
  275. } else {
  276. this.$set(this.data[index], "isTrue", true);
  277. this.$forceUpdate();
  278. }
  279. //调用投注公共方法
  280. let betting = this.$store.getters.getBetting;
  281. let _this = this;
  282. let ballId = this.$store.getters.getBallCode;
  283. let teamName = {
  284. home: this.home_team,
  285. guest: this.guest_team
  286. };
  287. this.$public.publicBetMethod(
  288. this.data,
  289. this.title,
  290. id,
  291. index,
  292. betting,
  293. teamName,
  294. playName,
  295. name,
  296. this.match_id,
  297. ballId,
  298. this.limit,
  299. function(data, type) {
  300. if (type) {
  301. _this.$dialog.toast({ mes: "亲,超出表格上限啦。", timeout: 2000 });
  302. }
  303. _this.$store.dispatch("SET_BETTING", []);
  304. _this.$store.dispatch("SET_BETTING", data);
  305. }
  306. );
  307. }
  308. },
  309. /**
  310. * 计算属性
  311. */
  312. computed: {
  313. getGameRatio() {
  314. return this.$store.getters.getGameRatio;
  315. },
  316. //获取投注数据
  317. getBetting() {
  318. return this.$store.getters.getBetting;
  319. },
  320. //获取投注数据数量
  321. getLimit() {
  322. return this.$store.getters.getLimit;
  323. }
  324. },
  325. /**
  326. * 监听器
  327. */
  328. watch: {
  329. getGameRatio(val) {
  330. this.lg_id = val.lg_id
  331. this.match_id = val.match_id;
  332. this.guest_team = val.guest_team;
  333. this.home_team = val.home_team;
  334. val.oddsData.forEach(e => {
  335. if (e[0].p_code == this.title) {
  336. this.data = e;
  337. this.playGrouping(this.data);
  338. //console.log(this.data,'ss');
  339. }
  340. });
  341. },
  342. //投注数据监听和处理
  343. getBetting(val) {
  344. if (val.length > 0) {
  345. let id = this.$store.getters.getDeleteType;
  346. for (let i = 0; i < val.length; i++) {
  347. if (val[i].title == this.title) {
  348. for (let j = 0; j < this.data.length; j++) {
  349. if (this.data[j].id == id) {
  350. this.$set(this.data[j], "isTrue", false);
  351. break;
  352. }
  353. }
  354. break;
  355. }
  356. }
  357. } else {
  358. for (let j = 0; j < this.data.length; j++) {
  359. if (this.data[j].isTrue) {
  360. this.$set(this.data[j], "isTrue", false);
  361. }
  362. }
  363. }
  364. },
  365. //投注数量
  366. getLimit(val) {
  367. this.limit = val;
  368. }
  369. }
  370. };
  371. </script>
  372. <style scoped>
  373. .flex {
  374. display: flex;
  375. justify-content: space-between;
  376. align-items: center;
  377. }
  378. .tit {
  379. background: #cdcdcd;
  380. font-size: 0.14rem;
  381. padding: 0 0.1rem;
  382. height: 0.4rem;
  383. line-height: 0.4rem;
  384. color: #333;
  385. }
  386. .playCode,
  387. .andCode {
  388. color: rgb(0, 0, 0);
  389. display: flex;
  390. }
  391. .playCode .home,
  392. .playCode .guest {
  393. height: 0.4rem;
  394. line-height: 0.4rem;
  395. width: 50%;
  396. font-size: 0.14rem;
  397. background: #fff;
  398. padding: 0 0 0 0.1rem;
  399. }
  400. .playCode .home {
  401. width: calc(50% - 1px);
  402. padding-right: 0.1rem;
  403. font-size: 0.14rem;
  404. padding: 0 0.1rem;
  405. border-right: 1px solid #e4e4e4;
  406. }
  407. .oddsBox {
  408. margin-right: 0.1rem;
  409. }
  410. .odds {
  411. display: inline-block;
  412. display: inline-block;
  413. width: 0.48rem;
  414. height: 0.3rem;
  415. border: 0.01rem solid #ccc;
  416. line-height: 0.3rem;
  417. text-align: center;
  418. border-radius: 0.05rem;
  419. cursor: pointer;
  420. }
  421. .odds:hover {
  422. background: #ddd;
  423. color: #f76649;
  424. }
  425. .guest {
  426. padding-right: 0.1rem;
  427. }
  428. .home:hover,
  429. .guest:hover {
  430. background: #fff5e9;
  431. }
  432. .draw {
  433. width: 20%;
  434. background: #fff;
  435. padding: 0 0.1rem;
  436. border-right: 1px solid #e4e4e4;
  437. }
  438. </style>