f0a5cee4834b60eb6ef7ea1e1eadb080891de773.svn-base 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <template>
  2. <div>
  3. <div>
  4. <div class="Serch row item-center">
  5. <div class="Soccer-game row item-center">
  6. <div
  7. style=" display:flex;align-items:center;justify-content:center;"
  8. class="Soccer-game-title"
  9. @click="isreturn()"
  10. >
  11. <img class="box-img" src="../assets/st-imges/returnbox.png">
  12. {{this.title}}
  13. </div>
  14. </div>
  15. <div class="Serch-box row item-center">
  16. <div class="Serch-box-home row item-center">
  17. <img class="Serch-box-img" src="../assets/st-imges/sousuo.png">
  18. <input
  19. v-model="SerchValue"
  20. @keydown="serchchange(SerchValue)"
  21. @input="searchTeam(SerchValue)"
  22. class="Serch-box-input"
  23. type="text"
  24. placeholder="请输入球队名称"
  25. >
  26. <img
  27. class="Serch-box-del"
  28. @click="delinputvalue()"
  29. v-if="Serchchange==true"
  30. src="../assets/st-imges/del.png"
  31. >
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. <div>
  37. <div v-for="items in data" :key="items.id">
  38. <div class="row allAlignment box center">
  39. <span>{{items.name_chinese}}</span>
  40. <div class="Match-title-num">
  41. <span>{{items.count}}</span>
  42. </div>
  43. </div>
  44. <div v-for=" (item,index) in items.match_info" :key="index" class="Match-box">
  45. <div class="row allAlignment Match-box-top">
  46. <div class="Match-box-top-left">
  47. <span>{{item.match_date}}</span>
  48. <span>{{item.match_time}}</span>
  49. </div>
  50. <div class="Match-box-top-right row">
  51. <span style="margin-right: .15rem;" class="Match-box-top-num">{{item.tag}}</span>
  52. <span style="margin-right: .15rem;">让球</span>
  53. <span style="margin-right: .15rem;">大小</span>
  54. </div>
  55. </div>
  56. <div
  57. class="row allAlignment center"
  58. @click="matchInfo(item.match_id);"
  59. style="padding:0 .32rem"
  60. >
  61. <div class="column average name-box">
  62. <div>{{item.home_team}}</div>
  63. <div>{{item.guest_team}}</div>
  64. </div>
  65. <div class="Match-bottom-right">
  66. <!-- 主队 -->
  67. <div class="row">
  68. <div
  69. class="Match-list-left"
  70. v-for="(items,indexs) in item.oddsData.homeOdds"
  71. :key="indexs"
  72. @click.stop="isBetting(items.id,item.home_team,item.guest_team,item.home_team,items.odds,items.condition,'size_home')"
  73. >
  74. <div :class="{ 'active' :items.isTrue == true}" class="column center">
  75. <span style="color:#FD8F26">{{items.condition}}</span>
  76. <span>{{items.odds}}</span>
  77. </div>
  78. </div>
  79. </div>
  80. <!-- 客队 -->
  81. <div class="row">
  82. <div
  83. class="Match-list-right row"
  84. v-for="(items,indexs) in item.oddsData.guestOdds"
  85. :key="indexs"
  86. @click.stop="isBetting(items.id,item.home_team,item.guest_team,item.guest_team,items.odds,items.condition,'size_guest')"
  87. >
  88. <div :class="{'active':items.isTrue==true }" class="column center">
  89. <span style="color:#FD8F26">
  90. <i style="color:#AAAAAA">{{items.condition}}</i>
  91. </span>
  92. <span>{{items.odds}}</span>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <BettingWindow v-show="isWindow"/>
  102. </div>
  103. </template>
  104. <script>
  105. import BettingWindow from "@/components/StBettingWindow";
  106. import NotOpend from "@/components/StNotOpend";
  107. import Loading from "@/components/StLoading";
  108. export default {
  109. name: "entryForm",
  110. data() {
  111. return {
  112. SerchValue: "",
  113. Serchchange: false,
  114. title: " ", //标题
  115. data: "",
  116. game_code: this.$route.query.game_code, //球的类型别名
  117. leagueID: this.$route.query.leagueID, //获取联赛id
  118. isWindow: false,
  119. thisNum: 10000,
  120. info: "没有相关联赛信息",
  121. noData: false, //没有数据为true
  122. betting: 10000, //vuex里面玩法投注数据
  123. timers : true
  124. };
  125. },
  126. components: {
  127. BettingWindow,
  128. NotOpend,
  129. Loading
  130. },
  131. methods: {
  132. // 返回上一页
  133. isreturn() {
  134. history.go(-1);
  135. },
  136. getmatchInfo(search) {
  137. // console.log('奔溃接口页面');
  138. this.$store.dispatch("GETSHOW", true);
  139. this.$http
  140. .get(this.$ports.match.participateDtl, {
  141. game_code: this.game_code,
  142. code: this.$route.query.code,
  143. search
  144. })
  145. .then(res => {
  146. this.codeShow = false;
  147. this.$store.dispatch("GETSHOW", false);
  148. if (res.data.status == 1) {
  149. // let odds = {};
  150. // let homeOdds = [],
  151. // guestOdds = [];
  152. console.log("参赛表单", res.data.data);
  153. for (var i = 0; i < res.data.data.length; i++) {
  154. this.dataGroup(res.data.data[i].match_info);
  155. }
  156. this.data = res.data.data;
  157. } else {
  158. }
  159. });
  160. },
  161. //是否显示删除按钮
  162. serchchange(val) {
  163. if (val.length >= 1) {
  164. this.Serchchange = true;
  165. } else {
  166. this.Serchchange = false;
  167. }
  168. },
  169. /**
  170. * 查询球队
  171. */
  172. searchTeam(val) {
  173. let getActivity = this.$store.getters.getActivity;
  174. let matchDate = this.$route.query.matchDate;
  175. if (val.length >= 1) {
  176. this.Serchchange = true;
  177. } else {
  178. this.Serchchange = false;
  179. }
  180. this.getmatchInfo(val);
  181. },
  182. //清空输入
  183. delinputvalue() {
  184. this.SerchValue = "";
  185. this.Serchchange = false;
  186. this.getmatchInfo("");
  187. },
  188. // // 添加、删除vuex投注数据公共方法
  189. AddDelete: function(id, home, guest, name, odds, condition) {
  190. let isAdd = true;
  191. let bettingInfo = {
  192. id,
  193. home_team: home,
  194. guest_team: guest,
  195. name,
  196. odds,
  197. condition,
  198. ballId:this.$store.getters.getBallId,
  199. ganame: "concede_size",
  200. score: this.score,
  201. bettingTime: ""
  202. };
  203. let matchList = this.$store.getters.getBetting;
  204. if (this.thisNum != 10000) {
  205. // //删除vuex投注数据
  206. // console.log('123',matchList[this.thisNum].data,this.thisNum)
  207. matchList[this.thisNum].data.forEach((res, index) => {
  208. if (res.id == id) {
  209. matchList[this.thisNum].data.splice(index, 1);
  210. this.$store.dispatch("BETTING", matchList);
  211. isAdd = false;
  212. }
  213. });
  214. // //添加vuex投注数据
  215. if (isAdd) {
  216. // console.log('我需要的',matchList[this.thisNum])
  217. matchList[this.thisNum].data.push(bettingInfo);
  218. this.$store.dispatch("BETTING", matchList);
  219. if (this.$store.getters.getIsBetting) return false;
  220. this.$store.dispatch("ISBETTING", true);
  221. }
  222. } else {
  223. //添加新的玩法赔率数据
  224. let obj = {
  225. title: "concede_size",
  226. data: [bettingInfo]
  227. };
  228. //判断vuex有误其它玩法数据
  229. if (matchList) {
  230. matchList.push(obj);
  231. } else {
  232. this.$store.dispatch("BETTING", [obj]);
  233. }
  234. }
  235. if (this.$store.getters.getIsBetting) return false;
  236. this.$store.dispatch("ISBETTING", true);
  237. },
  238. // //修改当前页面样式公共方法
  239. modifyStyle: function(id, type) {
  240. // 改变页面样式,循环data
  241. this.data.every(e => {
  242. let ret = false;
  243. if (type == "size_home") {
  244. e.match_info.forEach((res, index) => {
  245. res.oddsData.every((k, i) => {
  246. if (k.id == id) {
  247. this.$set(k, "isTrue", k.isTrue ? false : true);
  248. ret = true;
  249. return false;
  250. }
  251. return true;
  252. });
  253. });
  254. } else if (type == "size_guest") {
  255. e.match_info.forEach((res, index) => {
  256. res.oddsData.every((k, i) => {
  257. if (k.id == id) {
  258. this.$set(k, "isTrue", k.isTrue ? false : true);
  259. ret = true;
  260. return false;
  261. }
  262. return true;
  263. });
  264. });
  265. }
  266. if (ret) {
  267. return false;
  268. } else {
  269. return true;
  270. }
  271. });
  272. },
  273. //修改投注样式
  274. isBetting(id, home, guest, name, odds, condition, type) {
  275. if (this.data) {
  276. // 处理vuex 数据
  277. this.AddDelete(id, home, guest, name, odds, condition);
  278. // 处理当前页面样式
  279. this.modifyStyle(id, type);
  280. }
  281. },
  282. //跳转到赛事详情
  283. matchInfo: function(id) {
  284. this.$router.push({
  285. path: "/StRollBallBettingPage",
  286. query: { gameCode: this.game_code, home: 1 }
  287. });
  288. this.$store.dispatch("MACTH_ID", id);
  289. },
  290. /**
  291. * 赛事赔率玩法数据组合方法
  292. */
  293. dataGroup: function(data) {
  294. // console.log(this.data)
  295. let homeOdds = [],
  296. guestOdds = [];
  297. let A, B, C, D;
  298. data.forEach((column, index) => {
  299. if (column.oddsData == null || column.oddsData.length == 0) {
  300. column.oddsData = {
  301. homeOdds: [{ status: -1 }, { status: -1 }],
  302. guestOdds: [{ status: -1 }, { status: -1 }]
  303. };
  304. } else {
  305. // console.log('123', column)
  306. column.oddsData.forEach(val => {
  307. if (this.betting != 10000) {
  308. this.betting.forEach(e => {
  309. if (val.id == e.id) {
  310. this.$set(val,'isTrue',true)
  311. console.log('我要的值',val)
  312. // val.isTrue = true;
  313. //this.$set(val,'isTrue',true);
  314. }
  315. });
  316. }
  317. if (val.odds_code == "concede_home") {
  318. A = val;
  319. } else if (val.odds_code == "size_home") {
  320. B = val;
  321. } else if (val.odds_code == "concede_guest") {
  322. C = val;
  323. } else if (val.odds_code == "size_guest") {
  324. D = val;
  325. }
  326. });
  327. column.oddsData.homeOdds = [];
  328. column.oddsData.homeOdds.push(A);
  329. column.oddsData.homeOdds.push(B);
  330. column.oddsData.guestOdds = [];
  331. column.oddsData.guestOdds.push(C);
  332. column.oddsData.guestOdds.push(D);
  333. }
  334. });
  335. this.data = data;
  336. // console.log('data',this.data)
  337. }
  338. },
  339. /**
  340. * 计算属性
  341. */
  342. computed: {
  343. getBetting() {
  344. return this.$store.getters.getBetting;
  345. },
  346. //获取投注框删除的投注信息
  347. getDeleteType() {
  348. return this.$store.getters.getDeleteType;
  349. },
  350. getIsBetting() {
  351. return this.$store.getters.getIsBetting;
  352. }
  353. },
  354. /**
  355. * 监听器
  356. */
  357. watch: {
  358. getIsBetting(val) {
  359. this.isWindow = val;
  360. },
  361. // 监听删除投注
  362. getDeleteType(val) {
  363. console.log('删除',val)
  364. let flag = true;
  365. this.data.forEach(e => {
  366. if (val == "all") {
  367. e.match_info.forEach(data => {
  368. data.oddsData.forEach((k, i) => {
  369. console.log('123')
  370. this.$set(k, "isTrue", false);
  371. });
  372. });
  373. } else {
  374. console.log('aaaaa')
  375. e.match_info.forEach((res, index) => {
  376. res.oddsData.every((k, i) => {
  377. if (k.id == val) {
  378. this.$set(k, "isTrue", false);
  379. flag = true;
  380. return false;
  381. }
  382. return true;
  383. });
  384. });
  385. }
  386. });
  387. },
  388. //获取已投注信息
  389. getBetting(val) {
  390. //获取vuex玩法已投注相对应的数据
  391. val.forEach((e, index) => {
  392. if ("concede_size" == e.title) {
  393. this.thisNum = index;
  394. this.betting = e.data;
  395. }
  396. });
  397. }
  398. },
  399. mounted() {
  400. // 是否展示投注框
  401. if (this.$store.getters.getIsBetting) {
  402. this.isWindow = true;
  403. }
  404. //获取vuex玩法已投注相对应的数据
  405. let getBetting = this.$store.getters.getBetting;
  406. if (getBetting) {
  407. getBetting.forEach(e => {
  408. if ("concede_size" == e.title) {
  409. this.betting = e.data;
  410. }
  411. });
  412. }
  413. let _this = this;
  414. this.$public.ajaxTimerFun(function(timing) {
  415. _this.getmatchInfo("");
  416. if (!_this.timers) {
  417. clearInterval(timing);
  418. }
  419. });
  420. console.log("data", this.data);
  421. /*-----------------------*/
  422. this.getmatchInfo("");
  423. },
  424. beforeDestroy(){
  425. this.timers = false;
  426. }
  427. };
  428. </script>
  429. <style scoped>
  430. .Serch {
  431. height: 0.75rem;
  432. display: flex;
  433. justify-content: space-between;
  434. align-items: center;
  435. background-color: #363636;
  436. color: #fd8f26;
  437. font-family: "PingFang-SC-Regular";
  438. padding: 0 0.32rem;
  439. }
  440. .lock {
  441. background: #f4f4f4;
  442. }
  443. .Serch-box-input {
  444. width: 2rem;
  445. border: none;
  446. position: absolute;
  447. left: 0.5rem;
  448. top: 0.06rem;
  449. }
  450. /* .BettingWindow{
  451. z-index: 10000;
  452. position:fixed;
  453. top:0;
  454. width: 100%;
  455. } */
  456. .Serch-box-img {
  457. width: 0.3rem;
  458. height: 0.3rem;
  459. position: absolute;
  460. left: 0.1rem;
  461. top: 0.06rem;
  462. }
  463. .Serch-box-del {
  464. width: 0.2rem;
  465. height: 0.2rem;
  466. position: absolute;
  467. right: 0.2rem;
  468. }
  469. .Serch-box-home {
  470. height: 0.44rem;
  471. width: 4.73rem;
  472. background: #e4e4e4;
  473. border-radius: 0.2rem;
  474. display: flex;
  475. justify-content: space-around;
  476. align-items: center;
  477. padding-left: 0.1rem;
  478. padding-right: 0.1rem;
  479. position: relative;
  480. }
  481. .box-img {
  482. width: 0.37rem;
  483. height: 0.3rem;
  484. margin-right: 0.18rem;
  485. }
  486. .Soccer-game-title {
  487. display: flex;
  488. color: #f76649;
  489. align-items: center;
  490. width: 1.3rem;
  491. font-size: 0.3rem;
  492. }
  493. .Soccer-game-box {
  494. display: flex;
  495. left: -0.3rem;
  496. top: 0.2rem;
  497. background: #fff;
  498. background: #626262;
  499. color: #a6a6a6;
  500. height: 0.7rem;
  501. align-items: center;
  502. }
  503. .Soccer-game-src {
  504. width: 0.25rem;
  505. height: 0.25rem;
  506. }
  507. .box {
  508. padding: 0 0.32rem;
  509. color: #e1e1df;
  510. height: 0.88rem;
  511. font-size: 0.32rem;
  512. background: linear-gradient(to bottom, #999999, #6a6a6b);
  513. }
  514. .Match-title-num {
  515. width: 0.46rem;
  516. height: 0.46rem;
  517. line-height: 0.46rem;
  518. text-align: center;
  519. background: #f76649;
  520. font-size: 0.26rem;
  521. border-radius: 50%;
  522. color: #f5f5f5;
  523. }
  524. .Match-box-top-right > span {
  525. width: 1.07rem;
  526. text-align: center;
  527. }
  528. .Match-box {
  529. height: 2.45rem;
  530. }
  531. .name-box {
  532. height: 1.76rem;
  533. }
  534. .Match-box-top {
  535. height: 0.45rem;
  536. line-height: 0.45rem;
  537. background: #dcdcdc;
  538. font-size: 0.23rem;
  539. padding: 0 0.32rem;
  540. }
  541. .Match-box-top-num {
  542. width: 0.64rem !important;
  543. height: 0.45rem;
  544. background: #ebebeb;
  545. font-size: 0.24rem;
  546. }
  547. .Match-box {
  548. background: #f8f8f8;
  549. }
  550. .Match-bottom-right {
  551. height: 2rem;
  552. padding: 0.1rem 0.1rem 0 0.14rem;
  553. }
  554. .Match-list-left div {
  555. width: 1.07rem;
  556. height: 0.76rem;
  557. border: 1px solid #e4e4e4;
  558. border-radius: 0.1rem;
  559. padding: 0.1rem;
  560. margin: 0.06rem 0.08rem;
  561. }
  562. .Match-list-right div {
  563. width: 1.07rem;
  564. height: 0.76rem;
  565. border: 1px solid #e4e4e4;
  566. border-radius: 0.1rem;
  567. margin: 0.06rem 0.08rem;
  568. }
  569. .active {
  570. background: #f76649;
  571. border: none;
  572. color: #e1e1df !important;
  573. }
  574. </style>