c6823a79cbbb950dba468cabd79d44083fe05a0e.svn-base 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. <div v-for="(item,index) in data" v-if="item.odds_code.startsWith('lnh')">
  11. <span class="condition">{{item.condition}}</span>
  12. <span class="odds"
  13. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  14. @click="betMethod(index,item.id,'大','球队进球大小:'+home_team)">{{item.odds}}</span>
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. <div v-if=" obj.b">
  20. <!-- 客 -->
  21. <div class="tit">
  22. <span>球队得分:最后一位数:{{guest_team}}</span>
  23. </div>
  24. <div class="playCode">
  25. <div class="home flex">
  26. <div v-for="(item,index) in data" v-if="item.odds_code.startsWith('lng')">
  27. <span class="condition">{{item.condition}}</span>
  28. <span class="odds"
  29. :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  30. @click="betMethod(index,item.id,'大','球队进球大小:'+guest_team)">{{item.odds}}</span>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. title: "LN",
  42. andShow: "",
  43. guest_team: "", //客队名
  44. home_team: "", //主队名
  45. obj: "",
  46. match_id: "",
  47. data: [],
  48. limit: "", //投注数量
  49. lg_id:'',
  50. };
  51. },
  52. /**
  53. * 页面初始化完成挂载
  54. */
  55. mounted() {
  56. this.andShow = this.$store.getters.getBallCode;
  57. },
  58. /***
  59. * 方法
  60. */
  61. methods: {
  62. //玩法分类
  63. playGrouping(data) {
  64. let betting = this.$store.getters.getBetting;
  65. let obj={};
  66. data.forEach(e => {
  67. if(betting.length > 0){
  68. for(let i= 0; i< betting.length; i++){
  69. if(betting[i].title =="LN" && betting[i].data.length >0){
  70. for(let j = 0 ; j < betting[i].data.length ; j++ ){
  71. if(betting[i].data[j].id == e.id){
  72. this.$set(e,'isTrue',true);
  73. //betting[i].data.splice(j,1);
  74. }
  75. }
  76. break;
  77. }
  78. }
  79. }
  80. console.log(e);
  81. if(e.odds_code.startsWith('lnh')){
  82. obj.a = true;
  83. }else if(e.odds_code.startsWith('lng')){
  84. obj.b = true;
  85. }
  86. e.lg_id = this.lg_id;
  87. });
  88. data.sort((a,b) => {
  89. return a.condition[0] - b.condition[0];
  90. })
  91. this.obj = obj;
  92. console.log(obj)
  93. },
  94. /*---------------------------------- */
  95. //玩法投注
  96. betMethod(index, id, name, playName) {
  97. if (this.data[index].isTrue) {
  98. this.$set(this.data[index], "isTrue", false);
  99. this.$forceUpdate();
  100. } else {
  101. this.$set(this.data[index], "isTrue", true);
  102. this.$forceUpdate();
  103. }
  104. //调用投注公共方法
  105. let betting = this.$store.getters.getBetting;
  106. let _this = this;
  107. let ballId = this.$store.getters.getBallCode;
  108. let teamName = {
  109. home: this.home_team,
  110. guest: this.guest_team
  111. };
  112. this.$public.publicBetMethod(
  113. this.data,
  114. this.title,
  115. id,
  116. index,
  117. betting,
  118. teamName,
  119. playName,
  120. name,
  121. this.match_id,
  122. ballId,
  123. this.limit,
  124. function(data, type) {
  125. if (type) {
  126. _this.$dialog.toast({ mes: "亲,超出表格上限啦。", timeout: 2000 });
  127. }
  128. _this.$store.dispatch("SET_BETTING", []);
  129. _this.$store.dispatch("SET_BETTING", data);
  130. }
  131. );
  132. }
  133. },
  134. /**
  135. * 计算属性
  136. */
  137. computed: {
  138. getGameRatio() {
  139. return this.$store.getters.getGameRatio;
  140. },
  141. //获取投注数据
  142. getBetting() {
  143. return this.$store.getters.getBetting;
  144. },
  145. //获取投注数据数量
  146. getLimit() {
  147. return this.$store.getters.getLimit;
  148. }
  149. },
  150. /**
  151. * 监听器
  152. */
  153. watch: {
  154. getGameRatio(val) {
  155. this.lg_id = val.lg_id
  156. this.match_id = val.match_id;
  157. this.guest_team = val.guest_team;
  158. this.home_team = val.home_team;
  159. val.oddsData.forEach(e => {
  160. if (e[0].p_code == this.title) {
  161. this.data = e;
  162. this.playGrouping(this.data);
  163. //console.log('12',this.data);
  164. }
  165. });
  166. },
  167. //投注数据监听和处理
  168. //投注数据监听和处理
  169. getBetting(val) {
  170. if (val.length > 0) {
  171. let id = this.$store.getters.getDeleteType;
  172. for (let i = 0; i < val.length; i++) {
  173. if (val[i].title == this.title) {
  174. for (let j = 0; j < this.data.length; j++) {
  175. if (this.data[j].id == id) {
  176. this.$set(this.data[j], "isTrue", false);
  177. break;
  178. }
  179. }
  180. break;
  181. }
  182. }
  183. } else {
  184. for (let j = 0; j < this.data.length; j++) {
  185. if (this.data[j].isTrue) {
  186. this.$set(this.data[j], "isTrue", false);
  187. }
  188. }
  189. }
  190. },
  191. //投注数量
  192. getLimit(val) {
  193. this.limit = val;
  194. }
  195. }
  196. };
  197. </script>
  198. <style scoped>
  199. .flex {
  200. display: flex;
  201. justify-content: space-between;
  202. align-items: center;
  203. }
  204. .tit {
  205. background: #cdcdcd;
  206. font-size: 0.14rem;
  207. padding: 0 0.1rem;
  208. height: 0.4rem;
  209. line-height: 0.4rem;
  210. color: #333;
  211. }
  212. .playCode,
  213. .andCode {
  214. color: rgb(0, 0, 0);
  215. display: flex;
  216. }
  217. .playCode .home,
  218. .playCode .guest {
  219. height: 0.4rem;
  220. line-height: 0.4rem;
  221. width: 50%;
  222. padding: 0 0.2rem;
  223. font-size: 0.14rem;
  224. background: #fff;
  225. padding: 0 0 0 0.1rem;
  226. }
  227. .playCode .home {
  228. width: 100%;
  229. padding-right: 0.1rem;
  230. padding: 0 0.1rem;
  231. font-size: 0.14rem;
  232. border-right: 1px solid #e4e4e4;
  233. }
  234. .oddsBox {
  235. margin-right: 0.1rem;
  236. }
  237. .odds {
  238. display: inline-block;
  239. width: 0.48rem;
  240. height: 0.3rem;
  241. border: 0.01rem solid #ccc;
  242. line-height: 0.3rem;
  243. text-align: center;
  244. border-radius: 0.05rem;
  245. cursor: pointer;
  246. }
  247. .odds:hover {
  248. background: #ddd;
  249. color: #f76649;
  250. }
  251. .guest {
  252. padding-right: 0.1rem;
  253. }
  254. .home:hover,
  255. .guest:hover {
  256. background: #fff5e9;
  257. }
  258. .draw {
  259. width: 20%;
  260. background: #fff;
  261. padding: 0 0.1rem;
  262. border-right: 1px solid #e4e4e4;
  263. }
  264. .condition {
  265. color: #f76649;
  266. font-weight: bold;
  267. margin-right: .1rem;
  268. }
  269. </style>