b3d25d2d411bebf341a75be9a301a8c0a19d35e8.svn-base 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <template>
  2. <div>
  3. <div v-if=" obj.a">
  4. <!-- 主 -->
  5. <div class="tit">
  6. <span>球队得分大小:{{home_team}}</span>
  7. </div>
  8. <div class="playCode">
  9. <div class="home flex">
  10. <span class="teamName">大</span>
  11. <div v-for="(item,index) in data" v-if="item.odds_code == 'tbhb'">
  12. <span class="condition">{{item.condition}}</span>
  13. <span
  14. class="odds"
  15. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  16. @click="betMethod(index,item.id)"
  17. >{{item.odds}}</span>
  18. </div>
  19. </div>
  20. <div class="guest flex">
  21. <span class="teamName">小</span>
  22. <div
  23. class="oddsBox"
  24. v-for="(item,index) in data"
  25. v-if="item.odds_code == 'tbhs'"
  26. >
  27. <span class="condition">{{item.condition}}</span>
  28. <span
  29. class="odds"
  30. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  31. @click="betMethod(index,item.id)"
  32. >{{item.odds}}</span>
  33. </div>
  34. </div>
  35. </div>
  36. <!-- 客 -->
  37. <div class="tit">
  38. <span>球队得分大小:{{guest_team}}</span>
  39. </div>
  40. <div class="playCode">
  41. <div class="home flex">
  42. <span class="teamName">大</span>
  43. <div v-for="(item,index) in data" v-if="item.odds_code == 'tbgb'">
  44. <span class="condition">{{item.condition}}</span>
  45. <span
  46. class="odds"
  47. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  48. @click="betMethod(index,item.id)"
  49. >{{item.odds}}</span>
  50. </div>
  51. </div>
  52. <div class="guest flex">
  53. <span class="teamName">小</span>
  54. <div
  55. class="oddsBox"
  56. v-for="(item,index) in data"
  57. v-if="item.odds_code == 'tbgs'"
  58. >
  59. <span class="condition">{{item.condition}}</span>
  60. <span
  61. class="odds"
  62. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  63. @click="betMethod(index,item.id)"
  64. >{{item.odds}}</span>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <div v-if=" obj.b">
  70. <!-- 主 -->
  71. <div class="tit">
  72. <span>球队得分大小:{{home_team}}-上半场</span>
  73. </div>
  74. <div class="playCode">
  75. <div class="home flex">
  76. <span class="teamName">大</span>
  77. <div v-for="(item,index) in data" v-if="item.odds_code == 'tbhb_h'">
  78. <span class="condition">{{item.condition}}</span>
  79. <span
  80. class="odds"
  81. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  82. @click="betMethod(index,item.id)"
  83. >{{item.odds}}</span>
  84. </div>
  85. </div>
  86. <div class="guest flex">
  87. <span class="teamName">小</span>
  88. <div
  89. class="oddsBox"
  90. v-for="(item,index) in data"
  91. v-if="item.odds_code == 'tbhs_h'"
  92. >
  93. <span class="condition">{{item.condition}}</span>
  94. <span
  95. class="odds"
  96. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  97. @click="betMethod(index,item.id)"
  98. >{{item.odds}}</span>
  99. </div>
  100. </div>
  101. </div>
  102. <!-- 客 -->
  103. <div class="tit">
  104. <span>球队得分大小:{{guest_team}}-上半场</span>
  105. </div>
  106. <div class="playCode">
  107. <div class="home flex">
  108. <span class="teamName">大</span>
  109. <div v-for="(item,index) in data" v-if="item.odds_code == 'tbgb_h'">
  110. <span class="condition">{{item.condition}}</span>
  111. <span
  112. class="odds"
  113. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  114. @click="betMethod(index,item.id)"
  115. >{{item.odds}}</span>
  116. </div>
  117. </div>
  118. <div class="guest flex">
  119. <span class="teamName">小</span>
  120. <div
  121. class="oddsBox"
  122. v-for="(item,index) in data"
  123. v-if="item.odds_code == 'tbgs_h'"
  124. >
  125. <span class="condition">{{item.condition}}</span>
  126. <span
  127. class="odds"
  128. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  129. @click="betMethod(index,item.id)"
  130. >{{item.odds}}</span>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. <div v-if=" obj.c">
  136. <!-- 主队 -->
  137. <div class="tit">
  138. <span>球队得分大小:{{home_team}}-第一节</span>
  139. </div>
  140. <div class="playCode">
  141. <div class="home flex">
  142. <span class="teamName">大</span>
  143. <div
  144. v-for="(item,index) in data"
  145. v-if="item.odds_code.startsWith('tbhb') && item.odds_code.endsWith('_1')"
  146. >
  147. <span class="condition">{{item.condition}}</span>
  148. <span
  149. class="odds"
  150. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  151. @click="betMethod(index,item.id)"
  152. >{{item.odds}}</span>
  153. </div>
  154. </div>
  155. <div class="guest flex">
  156. <span class="teamName">小</span>
  157. <div
  158. class="oddsBox"
  159. v-for="(item,index) in data"
  160. v-if="item.odds_code.startsWith('tbhs') && item.odds_code.endsWith('_1')"
  161. >
  162. <span
  163. class="odds"
  164. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  165. @click="betMethod(index,item.id)"
  166. >{{item.odds}}</span>
  167. </div>
  168. </div>
  169. </div>
  170. <!-- 客队 -->
  171. <div class="tit">
  172. <span>球队得分大小:{{guest_team}}-第一节</span>
  173. </div>
  174. <div class="playCode">
  175. <div class="home flex">
  176. <span class="teamName">大</span>
  177. <div
  178. v-for="(item,index) in data"
  179. v-if="item.odds_code.startsWith('tbgb') && item.odds_code.endsWith('_1')"
  180. >
  181. <span class="condition">{{item.condition}}</span>
  182. <span
  183. class="odds"
  184. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  185. @click="betMethod(index,item.id)"
  186. >{{item.odds}}</span>
  187. </div>
  188. </div>
  189. <div class="guest flex">
  190. <span class="teamName">小</span>
  191. <div
  192. class="oddsBox"
  193. v-for="(item,index) in data"
  194. v-if="item.odds_code.startsWith('tbgs') && item.odds_code.endsWith('_1')"
  195. >
  196. <span class="condition">{{item.condition}}</span>
  197. <span
  198. class="odds"
  199. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  200. @click="betMethod(index,item.id)"
  201. >{{item.odds}}</span>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. <div v-if=" obj.d">
  207. <!-- 主队 -->
  208. <div class="tit">
  209. <span>球队得分大小:{{home_team}}-第二节</span>
  210. </div>
  211. <div class="playCode">
  212. <div class="home flex">
  213. <span class="teamName">大</span>
  214. <div
  215. v-for="(item,index) in data"
  216. v-if="item.odds_code.startsWith('tbhb') && item.odds_code.endsWith('_2')"
  217. >
  218. <span class="condition">{{item.condition}}</span>
  219. <span
  220. class="odds"
  221. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  222. @click="betMethod(index,item.id)"
  223. >{{item.odds}}</span>
  224. </div>
  225. </div>
  226. <div class="guest flex">
  227. <span class="teamName">小</span>
  228. <div
  229. class="oddsBox"
  230. v-for="(item,index) in data"
  231. v-if="item.odds_code.startsWith('tbhs') && item.odds_code.endsWith('_2')"
  232. >
  233. <span class="condition">{{item.condition}}</span>
  234. <span
  235. class="odds"
  236. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  237. @click="betMethod(index,item.id)"
  238. >{{item.odds}}</span>
  239. </div>
  240. </div>
  241. </div>
  242. <!-- 客队 -->
  243. <div class="tit">
  244. <span>球队得分大小:{{guest_team}}-第二节</span>
  245. </div>
  246. <div class="playCode">
  247. <div class="home flex">
  248. <span class="teamName">大</span>
  249. <div
  250. v-for="(item,index) in data"
  251. v-if="item.odds_code.startsWith('tbgb') && item.odds_code.endsWith('_2')"
  252. >
  253. <span class="condition">{{item.condition}}</span>
  254. <span
  255. class="odds"
  256. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  257. @click="betMethod(index,item.id)"
  258. >{{item.odds}}</span>
  259. </div>
  260. </div>
  261. <div class="guest flex">
  262. <span class="teamName">小</span>
  263. <div
  264. class="oddsBox"
  265. v-for="(item,index) in data"
  266. v-if="item.odds_code.startsWith('tbgs') && item.odds_code.endsWith('_2')"
  267. >
  268. <span class="condition">{{item.condition}}</span>
  269. <span
  270. class="odds"
  271. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  272. @click="betMethod(index,item.id)"
  273. >{{item.odds}}</span>
  274. </div>
  275. </div>
  276. </div>
  277. </div>
  278. <div v-if=" obj.e">
  279. <!-- 主队 -->
  280. <div class="tit">
  281. <span>球队得分大小:{{home_team}}-第三节</span>
  282. </div>
  283. <div class="playCode">
  284. <div class="home flex">
  285. <span class="teamName">大</span>
  286. <div
  287. v-for="(item,index) in data"
  288. v-if="item.odds_code.startsWith('tbhb') && item.odds_code.endsWith('_3')"
  289. >
  290. <span class="condition">{{item.condition}}</span>
  291. <span
  292. class="odds"
  293. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  294. @click="betMethod(index,item.id)"
  295. >{{item.odds}}</span>
  296. </div>
  297. </div>
  298. <div class="guest flex">
  299. <span class="teamName">小</span>
  300. <div
  301. class="oddsBox"
  302. v-for="(item,index) in data"
  303. v-if="item.odds_code.startsWith('tbhs') && item.odds_code.endsWith('_3')"
  304. >
  305. <span class="condition">{{item.condition}}</span>
  306. <span
  307. class="odds"
  308. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  309. @click="betMethod(index,item.id)"
  310. >{{item.odds}}</span>
  311. </div>
  312. </div>
  313. </div>
  314. <!-- 客队 -->
  315. <div class="tit">
  316. <span>球队得分大小:{{guest_team}}-第三节</span>
  317. </div>
  318. <div class="playCode">
  319. <div class="home flex">
  320. <span class="teamName">大</span>
  321. <div
  322. v-for="(item,index) in data"
  323. v-if="item.odds_code.startsWith('tbgb') && item.odds_code.endsWith('_3')"
  324. >
  325. <span class="condition">{{item.condition}}</span>
  326. <span
  327. class="odds"
  328. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  329. @click="betMethod(index,item.id)"
  330. >{{item.odds}}</span>
  331. </div>
  332. </div>
  333. <div class="guest flex">
  334. <span class="teamName">小</span>
  335. <div
  336. class="oddsBox"
  337. v-for="(item,index) in data"
  338. v-if="item.odds_code.startsWith('tbgs') && item.odds_code.endsWith('_3')"
  339. >
  340. <span class="condition">{{item.condition}}</span>
  341. <span
  342. class="odds"
  343. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  344. @click="betMethod(index,item.id)"
  345. >{{item.odds}}</span>
  346. </div>
  347. </div>
  348. </div>
  349. </div>
  350. <div v-if=" obj.f">
  351. <!-- 主队 -->
  352. <div class="tit">
  353. <span>球队得分大小:{{home_team}}-第四节</span>
  354. </div>
  355. <div class="playCode">
  356. <div class="home flex">
  357. <span class="teamName">大</span>
  358. <div
  359. v-for="(item,index) in data"
  360. v-if="item.odds_code.startsWith('tbhb') && item.odds_code.endsWith('_4')"
  361. >
  362. <span class="condition">{{item.condition}}</span>
  363. <span
  364. class="odds"
  365. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  366. @click="betMethod(index,item.id)"
  367. >{{item.odds}}</span>
  368. </div>
  369. </div>
  370. <div class="guest flex">
  371. <span class="teamName">小</span>
  372. <div
  373. class="oddsBox"
  374. v-for="(item,index) in data"
  375. v-if="item.odds_code.startsWith('tbhs') && item.odds_code.endsWith('_4')"
  376. >
  377. <span class="condition">{{item.condition}}</span>
  378. <span
  379. class="odds"
  380. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  381. @click="betMethod(index,item.id)"
  382. >{{item.odds}}</span>
  383. </div>
  384. </div>
  385. </div>
  386. <!-- 客队 -->
  387. <div class="tit">
  388. <span>球队得分大小:{{guest_team}}-第四节</span>
  389. </div>
  390. <div class="playCode">
  391. <div class="home flex">
  392. <span class="teamName">大</span>
  393. <div
  394. v-for="(item,index) in data"
  395. v-if="item.odds_code.startsWith('tbgb') && item.odds_code.endsWith('_4')"
  396. >
  397. <span class="condition">{{item.condition}}</span>
  398. <span
  399. class="odds"
  400. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  401. @click="betMethod(index,item.id)"
  402. >{{item.odds}}</span>
  403. </div>
  404. </div>
  405. <div class="guest flex">
  406. <span class="teamName">小</span>
  407. <div
  408. class="oddsBox"
  409. v-for="(item,index) in data"
  410. v-if="item.odds_code.startsWith('tbgs') && item.odds_code.endsWith('_4')"
  411. >
  412. <span class="condition">{{item.condition}}</span>
  413. <span
  414. class="odds"
  415. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  416. @click="betMethod(index,item.id)"
  417. >{{item.odds}}</span>
  418. </div>
  419. </div>
  420. </div>
  421. </div>
  422. </div>
  423. </template>
  424. <script>
  425. export default {
  426. data() {
  427. return {
  428. title: "TB",
  429. andShow: "",
  430. guest_team: "", //客队名
  431. home_team: "", //主队名
  432. obj: "",
  433. match_id:'',
  434. data:[],
  435. limit:'',//投注数量
  436. lg_id:'',
  437. };
  438. },
  439. /**
  440. * 页面初始化完成挂载
  441. */
  442. mounted() {
  443. this.andShow = this.$store.getters.getBallCode;
  444. },
  445. /***
  446. * 方法
  447. */
  448. methods: {
  449. //玩法分类
  450. playGrouping(data) {
  451. let obj = {};
  452. let betting = this.$store.getters.getBetting;
  453. data.forEach(e => {
  454. if(betting.length > 0){
  455. for(let i= 0; i< betting.length; i++){
  456. if(betting[i].title =="TB" && betting[i].data.length >0){
  457. for(let j = 0 ; j < betting[i].data.length ; j++ ){
  458. if(betting[i].data[j].id == e.id){
  459. this.$set(e,'isTrue',true);
  460. //betting[i].data.splice(j,1);
  461. }
  462. }
  463. break;
  464. }
  465. }
  466. }
  467. e.lg_id = this.lg_id;
  468. if (
  469. e.odds_code == 'tbhb' || e.odds_code == 'tbhs'|| e.odds_code == 'tbgb'|| e.odds_code == 'tbgs'
  470. ) {
  471. obj.a = true;
  472. } else if (e.odds_code.endsWith("_h")) {
  473. obj.b = true;
  474. } else if (e.odds_code.endsWith("_1")) {
  475. obj.c = true;
  476. } else if (e.odds_code.endsWith("_2")) {
  477. obj.d = true;
  478. } else if (e.odds_code.endsWith("_3")) {
  479. obj.e = true;
  480. } else if (e.odds_code.endsWith("_4")) {
  481. obj.f = true;
  482. }
  483. });
  484. this.obj = obj;
  485. },
  486. /*---------------------------------- */
  487. //玩法投注
  488. betMethod(index, id) {
  489. if (this.data[index].isTrue) {
  490. this.$set(this.data[index], "isTrue", false);
  491. } else {
  492. this.$set(this.data[index], "isTrue", true);
  493. }
  494. //调用投注公共方法
  495. let betting = this.$store.getters.getBetting;
  496. let _this = this;
  497. let ballId = this.$store.getters.getBallCode;
  498. let teamName ={
  499. home:this.home_team,
  500. guest:this.guest_team
  501. }
  502. this.$public.publicBetMethod(
  503. this.data,
  504. this.title,
  505. id,
  506. index,
  507. betting,
  508. teamName,playName,name,this.match_id,ballId,
  509. this.limit,
  510. function(data,type) {
  511. if(type){
  512. _this.$dialog.toast({ mes: "亲,超出表格上限啦。", timeout: 2000 });
  513. }
  514. _this.$store.dispatch("SET_BETTING", []);
  515. _this.$store.dispatch("SET_BETTING", data);
  516. }
  517. );
  518. }
  519. },
  520. /**
  521. * 计算属性
  522. */
  523. computed: {
  524. getGameRatio() {
  525. return this.$store.getters.getGameRatio;
  526. },
  527. //获取投注数据
  528. getBetting(){
  529. return this.$store.getters.getBetting
  530. },
  531. //获取投注数据数量
  532. getLimit(){
  533. return this.$store.getters.getLimit
  534. }
  535. },
  536. /**
  537. * 监听器
  538. */
  539. watch: {
  540. getGameRatio(val) {
  541. this.lg_id = val.lg_id
  542. this.match_id = val.match_id;
  543. this.guest_team = val.guest_team;
  544. this.home_team = val.home_team;
  545. val.oddsData.forEach(e => {
  546. if (e[0].p_code == this.title) {
  547. this.data = e;
  548. this.playGrouping(this.data);
  549. //console.log("12", this.data);
  550. }
  551. });
  552. },
  553. //投注数据监听和处理
  554. getBetting(val){
  555. if(val.length > 0){
  556. let id = this.$store.getters.getDeleteType;
  557. for(let i= 0; i < val.length; i++ ){
  558. if(val[i].title == this.title){
  559. for(let j = 0;j < this.data.length ;j++){
  560. if(this.data[j].id == id){
  561. this.$set(this.data[j],'isTrue',false)
  562. break;
  563. }
  564. }
  565. break;
  566. }
  567. }
  568. }else{
  569. for(let j = 0;j < this.data.length ;j++){
  570. if(this.data[j].isTrue){
  571. this.$set(this.data[j],'isTrue',false)
  572. }
  573. }
  574. }
  575. },
  576. //投注数量
  577. getLimit(val){
  578. this.limit = val
  579. }
  580. }
  581. };
  582. </script>
  583. <style scoped>
  584. .flex {
  585. display: flex;
  586. justify-content: space-between;
  587. align-items: center;
  588. }
  589. .tit {
  590. background: #cdcdcd;
  591. font-size: 0.14rem;
  592. padding: 0 0.1rem;
  593. height: 0.4rem;
  594. line-height: 0.4rem;
  595. color: #333;
  596. }
  597. .playCode,
  598. .andCode {
  599. color: #333;
  600. display: flex;
  601. font-size: .14rem;
  602. }
  603. .playCode .home,
  604. .playCode .guest {
  605. height: 0.4rem;
  606. line-height: 0.4rem;
  607. width: 50%;
  608. background: #fff;
  609. padding: 0 0 0 0.1rem;
  610. }
  611. .playCode .home {
  612. width: calc(50% - 1px);
  613. padding-right: 0.1rem;
  614. border-right: 1px solid #e4e4e4;
  615. }
  616. .oddsBox {
  617. margin-right: 0.1rem;
  618. }
  619. .odds {
  620. display: inline-block;
  621. height: 0.3rem;
  622. border: 1px solid #e4e4e4;
  623. width: 0.5rem;
  624. background-color: #fff;
  625. text-align: center;
  626. line-height: 0.23rem;
  627. margin: 0.07rem auto 0.04rem;
  628. padding: 0.04rem;
  629. }
  630. .odds:hover {
  631. background: orange !important;
  632. color: #fff !important;
  633. border-color: orange !important;
  634. cursor: pointer;
  635. }
  636. .guest {
  637. padding-right: 0.1rem;
  638. }
  639. .home:hover,
  640. .guest:hover {
  641. background: #fff5e9;
  642. }
  643. .draw {
  644. width: 20%;
  645. background: #fff;
  646. padding: 0 0.1rem;
  647. border-right: 1px solid #e4e4e4;
  648. }
  649. .condition {
  650. color: #f76649;
  651. font-weight: bold;
  652. margin-right: .1rem;
  653. }
  654. </style>