1e452285fb75ad50fc96cd23b55d39ae5b01ab0e.svn-base 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  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. };
  124. },
  125. components: {
  126. BettingWindow,
  127. NotOpend,
  128. Loading
  129. },
  130. methods: {
  131. // 返回上一页
  132. isreturn() {
  133. history.go(-1);
  134. },
  135. getmatchInfo(search) {
  136. // console.log('奔溃接口页面');
  137. this.$store.dispatch("GETSHOW", true);
  138. this.$http
  139. .get(this.$ports.match.participateDtl, {
  140. game_code: this.game_code,
  141. code: this.$route.query.code,
  142. search
  143. })
  144. .then(res => {
  145. this.codeShow = false;
  146. this.$store.dispatch("GETSHOW", false);
  147. if (res.data.status == 1) {
  148. // let odds = {};
  149. // let homeOdds = [],
  150. // guestOdds = [];
  151. console.log("参赛表单", res.data.data);
  152. for (var i = 0; i < res.data.data.length; i++) {
  153. this.dataGroup(res.data.data[i].match_info);
  154. }
  155. this.data = res.data.data;
  156. } else {
  157. }
  158. });
  159. },
  160. //是否显示删除按钮
  161. serchchange(val) {
  162. if (val.length >= 1) {
  163. this.Serchchange = true;
  164. } else {
  165. this.Serchchange = false;
  166. }
  167. },
  168. /**
  169. * 查询球队
  170. */
  171. searchTeam(val) {
  172. let getActivity = this.$store.getters.getActivity;
  173. let matchDate = this.$route.query.matchDate;
  174. if (val.length >= 1) {
  175. this.Serchchange = true;
  176. } else {
  177. this.Serchchange = false;
  178. }
  179. this.getmatchInfo(val);
  180. },
  181. //清空输入
  182. delinputvalue() {
  183. this.SerchValue = "";
  184. this.Serchchange = false;
  185. this.getmatchInfo("");
  186. },
  187. // // 添加、删除vuex投注数据公共方法
  188. AddDelete: function(id, home, guest, name, odds, condition) {
  189. let isAdd = true;
  190. let bettingInfo = {
  191. id,
  192. home_team: home,
  193. guest_team: guest,
  194. name,
  195. odds,
  196. condition,
  197. ganame: "concede_size",
  198. score: this.score,
  199. bettingTime: ""
  200. };
  201. let matchList = this.$store.getters.getBetting;
  202. if (this.thisNum != 10000) {
  203. // //删除vuex投注数据
  204. // console.log('123',matchList[this.thisNum].data,this.thisNum)
  205. matchList[this.thisNum].data.forEach((res, index) => {
  206. if (res.id == id) {
  207. matchList[this.thisNum].data.splice(index, 1);
  208. this.$store.dispatch("BETTING", matchList);
  209. isAdd = false;
  210. }
  211. });
  212. // //添加vuex投注数据
  213. if (isAdd) {
  214. // console.log('我需要的',matchList[this.thisNum])
  215. matchList[this.thisNum].data.push(bettingInfo);
  216. this.$store.dispatch("BETTING", matchList);
  217. if (this.$store.getters.getIsBetting) return false;
  218. this.$store.dispatch("ISBETTING", true);
  219. }
  220. } else {
  221. //添加新的玩法赔率数据
  222. let obj = {
  223. title: "concede_size",
  224. data: [bettingInfo]
  225. };
  226. //判断vuex有误其它玩法数据
  227. if (matchList) {
  228. matchList.push(obj);
  229. } else {
  230. this.$store.dispatch("BETTING", [obj]);
  231. }
  232. }
  233. if (this.$store.getters.getIsBetting) return false;
  234. this.$store.dispatch("ISBETTING", true);
  235. },
  236. // //修改当前页面样式公共方法
  237. modifyStyle: function(id, type) {
  238. // 改变页面样式,循环data
  239. this.data.every(e => {
  240. let ret = false;
  241. if (type == "size_home") {
  242. e.match_info.forEach((res, index) => {
  243. res.oddsData.every((k, i) => {
  244. if (k.id == id) {
  245. this.$set(k, "isTrue", k.isTrue ? false : true);
  246. ret = true;
  247. return false;
  248. }
  249. return true;
  250. });
  251. });
  252. } else if (type == "size_guest") {
  253. e.match_info.forEach((res, index) => {
  254. res.oddsData.every((k, i) => {
  255. if (k.id == id) {
  256. this.$set(k, "isTrue", k.isTrue ? false : true);
  257. ret = true;
  258. return false;
  259. }
  260. return true;
  261. });
  262. });
  263. }
  264. if (ret) {
  265. return false;
  266. } else {
  267. return true;
  268. }
  269. });
  270. },
  271. //修改投注样式
  272. isBetting(id, home, guest, name, odds, condition, type) {
  273. if (this.data) {
  274. // 处理vuex 数据
  275. this.AddDelete(id, home, guest, name, odds, condition);
  276. // 处理当前页面样式
  277. this.modifyStyle(id, type);
  278. }
  279. },
  280. //跳转到赛事详情
  281. matchInfo: function(id) {
  282. this.$router.push({
  283. path: "/StRollBallBettingPage",
  284. query: { gameCode: this.game_code, home: 1 }
  285. });
  286. this.$store.dispatch("MACTH_ID", id);
  287. },
  288. /**
  289. * 赛事赔率玩法数据组合方法
  290. */
  291. dataGroup: function(data) {
  292. // console.log(this.data)
  293. let homeOdds = [],
  294. guestOdds = [];
  295. let A, B, C, D;
  296. data.forEach((column, index) => {
  297. if (column.oddsData == null || column.oddsData.length == 0) {
  298. column.oddsData = {
  299. homeOdds: [{ status: -1 }, { status: -1 }],
  300. guestOdds: [{ status: -1 }, { status: -1 }]
  301. };
  302. } else {
  303. // console.log('123', column)
  304. column.oddsData.forEach(val => {
  305. if (this.betting != 10000) {
  306. this.betting.forEach(e => {
  307. if (val.id == e.id) {
  308. val.isTrue = true;
  309. //this.$set(val,'isTrue',true);
  310. }
  311. });
  312. }
  313. if (val.odds_code == "concede_home") {
  314. A = val;
  315. } else if (val.odds_code == "size_home") {
  316. B = val;
  317. } else if (val.odds_code == "concede_guest") {
  318. C = val;
  319. } else if (val.odds_code == "size_guest") {
  320. D = val;
  321. }
  322. });
  323. column.oddsData.homeOdds = [];
  324. column.oddsData.homeOdds.push(A);
  325. column.oddsData.homeOdds.push(B);
  326. column.oddsData.guestOdds = [];
  327. column.oddsData.guestOdds.push(C);
  328. column.oddsData.guestOdds.push(D);
  329. }
  330. });
  331. this.data = data;
  332. // console.log('data',this.data)
  333. }
  334. },
  335. /**
  336. * 计算属性
  337. */
  338. computed: {
  339. getBetting() {
  340. return this.$store.getters.getBetting;
  341. },
  342. //获取投注框删除的投注信息
  343. getDeleteType() {
  344. return this.$store.getters.getDeleteType;
  345. },
  346. getIsBetting() {
  347. return this.$store.getters.getIsBetting;
  348. }
  349. },
  350. /**
  351. * 监听器
  352. */
  353. watch: {
  354. getIsBetting(val) {
  355. this.isWindow = val;
  356. },
  357. // 监听删除投注
  358. getDeleteType(val) {
  359. let flag = true;
  360. this.data.forEach(e => {
  361. if (val == "all") {
  362. e.match_info.forEach(data => {
  363. data.oddsData.forEach((k, i) => {
  364. this.$set(k, "isTrue", false);
  365. });
  366. });
  367. } else {
  368. e.match_info.forEach((res, index) => {
  369. res.oddsData.every((k, i) => {
  370. if (k.id == val) {
  371. this.$set(k, "isTrue", false);
  372. flag = true;
  373. return false;
  374. }
  375. return true;
  376. });
  377. });
  378. }
  379. });
  380. },
  381. //获取已投注信息
  382. getBetting(val) {
  383. //获取vuex玩法已投注相对应的数据
  384. val.forEach((e, index) => {
  385. if ("concede_size" == e.title) {
  386. this.thisNum = index;
  387. this.betting = e.data;
  388. }
  389. });
  390. }
  391. },
  392. mounted() {
  393. // 是否展示投注框
  394. if (this.$store.getters.getIsBetting) {
  395. this.isWindow = true;
  396. }
  397. //获取vuex玩法已投注相对应的数据
  398. let getBetting = this.$store.getters.getBetting;
  399. if (getBetting) {
  400. getBetting.forEach(e => {
  401. if ("concede_size" == e.title) {
  402. this.betting = e.data;
  403. }
  404. });
  405. }
  406. console.log("data", this.data);
  407. /*-----------------------*/
  408. this.getmatchInfo("");
  409. }
  410. };
  411. </script>
  412. <style scoped>
  413. .Serch {
  414. height: 0.75rem;
  415. display: flex;
  416. justify-content: space-between;
  417. align-items: center;
  418. background-color: #363636;
  419. color: #fd8f26;
  420. font-family: "PingFang-SC-Regular";
  421. padding: 0 0.32rem;
  422. }
  423. .lock {
  424. background: #f4f4f4;
  425. }
  426. .Serch-box-input {
  427. width: 2rem;
  428. border: none;
  429. position: absolute;
  430. left: 0.5rem;
  431. top: 0.06rem;
  432. }
  433. /* .BettingWindow{
  434. z-index: 10000;
  435. position:fixed;
  436. top:0;
  437. width: 100%;
  438. } */
  439. .Serch-box-img {
  440. width: 0.3rem;
  441. height: 0.3rem;
  442. position: absolute;
  443. left: 0.1rem;
  444. top: 0.06rem;
  445. }
  446. .Serch-box-del {
  447. width: 0.2rem;
  448. height: 0.2rem;
  449. position: absolute;
  450. right: 0.2rem;
  451. }
  452. .Serch-box-home {
  453. height: 0.44rem;
  454. width: 4.73rem;
  455. background: #e4e4e4;
  456. border-radius: 0.2rem;
  457. display: flex;
  458. justify-content: space-around;
  459. align-items: center;
  460. padding-left: 0.1rem;
  461. padding-right: 0.1rem;
  462. position: relative;
  463. }
  464. .box-img {
  465. width: 0.37rem;
  466. height: 0.3rem;
  467. margin-right: 0.18rem;
  468. }
  469. .Soccer-game-title {
  470. display: flex;
  471. color: #f76649;
  472. align-items: center;
  473. width: 1.3rem;
  474. font-size: 0.3rem;
  475. }
  476. .Soccer-game-box {
  477. display: flex;
  478. left: -0.3rem;
  479. top: 0.2rem;
  480. background: #fff;
  481. background: #626262;
  482. color: #a6a6a6;
  483. height: 0.7rem;
  484. align-items: center;
  485. }
  486. .Soccer-game-src {
  487. width: 0.25rem;
  488. height: 0.25rem;
  489. }
  490. .box {
  491. padding: 0 0.32rem;
  492. color: #e1e1df;
  493. height: 0.88rem;
  494. font-size: 0.32rem;
  495. background: linear-gradient(to bottom, #999999, #6a6a6b);
  496. }
  497. .Match-title-num {
  498. width: 0.46rem;
  499. height: 0.46rem;
  500. line-height: 0.46rem;
  501. text-align: center;
  502. background: #f76649;
  503. font-size: 0.26rem;
  504. border-radius: 50%;
  505. color: #f5f5f5;
  506. }
  507. .Match-box-top-right > span {
  508. width: 1.07rem;
  509. text-align: center;
  510. }
  511. .Match-box {
  512. height: 2.45rem;
  513. }
  514. .name-box {
  515. height: 1.76rem;
  516. }
  517. .Match-box-top {
  518. height: 0.45rem;
  519. line-height: 0.45rem;
  520. background: #dcdcdc;
  521. font-size: 0.23rem;
  522. padding: 0 0.32rem;
  523. }
  524. .Match-box-top-num {
  525. width: 0.64rem !important;
  526. height: 0.45rem;
  527. background: #ebebeb;
  528. font-size: 0.24rem;
  529. }
  530. .Match-box {
  531. background: #f8f8f8;
  532. }
  533. .Match-bottom-right {
  534. height: 2rem;
  535. padding: 0.1rem 0.1rem 0 0.14rem;
  536. }
  537. .Match-list-left div {
  538. width: 1.07rem;
  539. height: 0.76rem;
  540. border: 1px solid #e4e4e4;
  541. border-radius: 0.1rem;
  542. padding: 0.1rem;
  543. margin: 0.06rem 0.08rem;
  544. }
  545. .Match-list-right div {
  546. width: 1.07rem;
  547. height: 0.76rem;
  548. border: 1px solid #e4e4e4;
  549. border-radius: 0.1rem;
  550. margin: 0.06rem 0.08rem;
  551. }
  552. .active {
  553. background: #f76649;
  554. border: none;
  555. color: #e1e1df !important;
  556. }
  557. </style>