8e23c89d102fe548a05f8e51770013224c882658.svn-base 15 KB

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