71ebbfbd01997020c1ab9d9a2846a9fa5428ee89.svn-base 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div>
  3. <div v-if="isData">
  4. <div class="tit">
  5. <span>首粒入球/最后一粒入球</span>
  6. </div>
  7. <div class="playCode">
  8. <div class="tbody">
  9. <div>最先进球</div>
  10. <div>最后进球</div>
  11. <div>没有进球</div>
  12. </div>
  13. <div class="info">
  14. <div class="before">
  15. <div
  16. class="team"
  17. v-for="(item,index) in data"
  18. v-if="item.odds_code == 'flbfh'"
  19. >
  20. <span class="teamName">{{home_team}}</span>
  21. <span
  22. class="odds"
  23. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  24. @click="betMethod(index,item.id,home_team,'最先进球')"
  25. >{{item.odds}}</span>
  26. </div>
  27. <div
  28. class="team"
  29. v-for="(item,index) in data"
  30. v-if="item.odds_code == 'flbfg'"
  31. >
  32. <span class="teamName">{{guest_team}}</span>
  33. <span
  34. class="odds"
  35. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  36. @click="betMethod(index,item.id,guest_team,'最先进球')"
  37. >{{item.odds}}</span>
  38. </div>
  39. </div>
  40. <div class="after">
  41. <div
  42. class="team"
  43. v-for="(item,index) in data"
  44. v-if="item.odds_code == 'flblh'"
  45. >
  46. <span class="teamName">{{home_team}}</span>
  47. <span
  48. class="odds"
  49. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  50. @click="betMethod(index,item.id,home_team,'最后进球')"
  51. >{{item.odds}}</span>
  52. </div>
  53. <div
  54. class="team"
  55. v-for="(item,index) in data"
  56. v-if="item.odds_code == 'flblg'"
  57. >
  58. <span class="teamName">{{guest_team}}</span>
  59. <span
  60. class="odds"
  61. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  62. @click="betMethod(index,item.id,guest_team,'最后进球')"
  63. >{{item.odds}}</span>
  64. </div>
  65. </div>
  66. <div class="notHave row item-center">
  67. <div
  68. class="team"
  69. v-for="(item,index) in data"
  70. v-if="item.odds_code == 'flbn'"
  71. >
  72. <span class="teamName">没有进球</span>
  73. <span
  74. class="odds"
  75. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  76. @click="betMethod(index,item.id,'','没有进球')"
  77. >{{item.odds}}</span>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. export default {
  87. data() {
  88. return {
  89. title: "FLB",
  90. data: [], //数据源
  91. isData: "", //是否有数据
  92. guest_team: "", //客队名
  93. home_team: "", //主队名
  94. // obj:'',//
  95. match_id: "",
  96. limit: "", //投注数量
  97. lg_id: ""
  98. };
  99. },
  100. /***
  101. * 方法
  102. */
  103. methods: {
  104. //玩法分类
  105. playGrouping(data) {
  106. // let obj={};
  107. let betting = this.$store.getters.getBetting;
  108. data.forEach(e => {
  109. if(betting.length > 0){
  110. for(let i= 0; i< betting.length; i++){
  111. if(betting[i].title =="FLB" && betting[i].data.length >0){
  112. for(let j = 0 ; j < betting[i].data.length ; j++ ){
  113. if(betting[i].data[j].id == e.id){
  114. this.$set(e,'isTrue',true);
  115. //betting[i].data.splice(j,1);
  116. }
  117. }
  118. break;
  119. }
  120. }
  121. }
  122. e.lg_id = this.lg_id;
  123. // if(e.odds_code.startsWith('last_number')){
  124. // obj.a= true
  125. // }else if(e.odds_code.startsWith('half')){
  126. // obj.b= true;
  127. // }
  128. });
  129. // this.obj = obj;
  130. },
  131. /*---------------------------------- */
  132. //玩法投注
  133. betMethod(index, id, name, playName) {
  134. if (this.data[index].isTrue) {
  135. this.$set(this.data[index], "isTrue", false);
  136. } else {
  137. this.$set(this.data[index], "isTrue", true);
  138. }
  139. //调用投注公共方法
  140. let betting = this.$store.getters.getBetting;
  141. let _this = this;
  142. let ballId = this.$store.getters.getBallCode;
  143. let teamName = {
  144. home: this.home_team,
  145. guest: this.guest_team
  146. };
  147. this.$public.publicBetMethod(
  148. this.data,
  149. this.title,
  150. id,
  151. index,
  152. betting,
  153. teamName,
  154. playName,
  155. name,
  156. this.match_id,
  157. ballId,
  158. this.limit,
  159. function(data, type) {
  160. _this.$store.dispatch("SET_BETTING", []);
  161. _this.$store.dispatch("SET_BETTING", data);
  162. }
  163. );
  164. }
  165. },
  166. /**
  167. * 计算属性
  168. */
  169. computed: {
  170. getGameRatio() {
  171. return this.$store.getters.getGameRatio;
  172. },
  173. //获取投注数据
  174. getBetting() {
  175. return this.$store.getters.getBetting;
  176. },
  177. //获取投注数据数量
  178. getLimit() {
  179. return this.$store.getters.getLimit;
  180. }
  181. },
  182. /**
  183. * 监听器
  184. */
  185. watch: {
  186. getGameRatio(val) {
  187. this.lg_id = val.lg_id;
  188. this.match_id = val.match_id;
  189. this.guest_team = val.guest_team;
  190. this.home_team = val.home_team;
  191. val.oddsData.forEach(e => {
  192. if (e[0].p_code == this.title) {
  193. this.data = e;
  194. this.isData = true;
  195. this.playGrouping(this.data);
  196. }
  197. });
  198. //console.log(this.data);
  199. },
  200. //投注数据监听和处理
  201. getBetting(val) {
  202. if (val.length > 0) {
  203. let id = this.$store.getters.getDeleteType;
  204. for (let i = 0; i < val.length; i++) {
  205. if (val[i].title == this.title) {
  206. for (let j = 0; j < this.data.length; j++) {
  207. if (this.data[j].id == id) {
  208. this.$set(this.data[j], "isTrue", false);
  209. break;
  210. }
  211. }
  212. break;
  213. }
  214. }
  215. } else {
  216. for (let j = 0; j < this.data.length; j++) {
  217. if (this.data[j].isTrue) {
  218. this.$set(this.data[j], "isTrue", false);
  219. }
  220. }
  221. }
  222. },
  223. //投注数量
  224. getLimit(val) {
  225. this.limit = val;
  226. }
  227. }
  228. };
  229. </script>
  230. <style scoped>
  231. .flex {
  232. display: flex;
  233. /* justify-content: space-between; */
  234. align-items: center;
  235. flex-direction: row;
  236. flex-wrap: wrap;
  237. }
  238. .rFlex {
  239. display: flex;
  240. justify-content: space-between;
  241. align-items: center;
  242. }
  243. .tit {
  244. background: #cdcdcd;
  245. font-size: 0.14rem;
  246. padding: 0 0.1rem;
  247. height: 0.4rem;
  248. line-height: 0.4rem;
  249. color: #333;
  250. }
  251. .playCode {
  252. background: #fff;
  253. }
  254. .tbody {
  255. height: 0.4rem;
  256. line-height: 0.4rem;
  257. background-color: #e5e5e5;
  258. color: rgb(90, 90, 90);
  259. text-align: left;
  260. display: flex;
  261. }
  262. .tbody div {
  263. font-size: 0.14rem;
  264. padding-left: 0.1rem;
  265. flex: 1 1 0%;
  266. display: flex;
  267. /* justify-content: center; */
  268. }
  269. .info {
  270. display: flex;
  271. flex-direction: row;
  272. align-items: center;
  273. height: 100%;
  274. }
  275. .info .before,
  276. .after,
  277. .notHave {
  278. flex: 1 1 0%;
  279. flex-direction: column;
  280. }
  281. .team {
  282. display: flex;
  283. justify-content: space-between;
  284. flex: 1 1 0%;
  285. height: 0.4rem;
  286. font-size: 0.14rem;
  287. padding: 0 0.1rem;
  288. align-items: center;
  289. border-bottom: 1px solid #d7d7d7;
  290. line-height: 0.4rem;
  291. }
  292. .odds {
  293. display: inline-block;
  294. width: 0.48rem;
  295. height: 0.3rem;
  296. border: 0.01rem solid #ccc;
  297. line-height: 0.3rem;
  298. text-align: center;
  299. border-radius: 0.05rem;
  300. cursor: pointer;
  301. }
  302. .odds:hover {
  303. background: #ddd;
  304. color: #f76649;
  305. }
  306. .after {
  307. border-left: 1px solid #d7d7d7;
  308. border-right: 1px solid #d7d7d7;
  309. }
  310. .notHave {
  311. height: 0.8rem;
  312. }
  313. .notHave .team {
  314. border: none;
  315. width: 100%;
  316. }
  317. .team:hover {
  318. background: #fff5e9;
  319. }
  320. .notHave .team:hover {
  321. background: #fff;
  322. }
  323. .after .team:nth-last-child(1),
  324. .before .team:nth-last-child(1) {
  325. border-bottom: none;
  326. }
  327. </style>