617951982d53a1ed8884f6b874232daca32f1e81.svn-base 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div class="goal">
  3. <div v-if="isDisplay">
  4. <yd-accordion :accordion="true">
  5. <yd-accordion-item title="进球:单/双" open>
  6. <div class="row allAlignment box">
  7. <div class=" column allAlignment left_box">
  8. <div
  9. v-for="(item,index) in data"
  10. :key="'b'+index"
  11. v-if="item.odds_code =='two_sides_single'"
  12. class=" row allAlignment"
  13. >
  14. <div>{{item.condition}}</div>
  15. <div
  16. class="ratio"
  17. :class="item.isTrue ==true ? 'col':''"
  18. @click="toggle(item.id,item.condition,item.odds,item.odds_onlys,item.p_code,match_id,item.odds_code,'进球:单/双')"
  19. >
  20. <span>{{item.odds}}</span>
  21. </div>
  22. </div>
  23. </div>
  24. <div class=" column allAlignment right_box ">
  25. <div
  26. v-for="(item,index) in data"
  27. :key="'b'+index"
  28. v-if="item.odds_code =='two_sides_double' "
  29. class=" row allAlignment"
  30. >
  31. <div>{{item.condition}}</div>
  32. <div
  33. class="ratio"
  34. :class="item.isTrue ==true ? 'col':''"
  35. @click="toggle(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'进球:单/双')"
  36. >
  37. <span>{{item.odds}}</span>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </yd-accordion-item>
  43. </yd-accordion>
  44. <yd-accordion :accordion="true">
  45. <yd-accordion-item title="进球:单/双-上半场" open>
  46. <div class="row allAlignment box">
  47. <div class=" column allAlignment left_box">
  48. <div
  49. v-for="(item,index) in data"
  50. :key="item.id"
  51. v-if="item.odds_code =='half_two_sides_single'"
  52. class=" row allAlignment"
  53. >
  54. <div>{{item.condition}}</div>
  55. <div
  56. class="ratio"
  57. :class="item.isTrue ==true ? 'col':''"
  58. @click="toggle(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'进球:单/双')"
  59. >
  60. <span>{{item.odds}}</span>
  61. </div>
  62. </div>
  63. </div>
  64. <div class=" column allAlignment right_box">
  65. <div
  66. v-for="(item,index) in data"
  67. :key="item.id"
  68. v-if="item.odds_code =='half_two_sides_double' "
  69. class="row allAlignment"
  70. >
  71. <div>{{item.condition}}</div>
  72. <div
  73. class="ratio"
  74. :class="item.isTrue ==true ? 'col':''"
  75. @click="toggle(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'进球:单/双')"
  76. >
  77. <span>{{item.odds}}</span>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </yd-accordion-item>
  83. </yd-accordion>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. export default {
  89. // 进球大小单双数
  90. data() {
  91. return {
  92. title: "two_sides",
  93. // status: -1,
  94. smallStatus: [],
  95. isDisplay: false,
  96. home_team: "",
  97. guest_team: "",
  98. match_id: "",
  99. lg_id:'',
  100. score: "0",
  101. data: [], //
  102. betting: [], //已投注倍率id集合
  103. dataNum: 10000 //对应的数据的下标
  104. };
  105. },
  106. methods: {
  107. //玩法投注
  108. toggle(id, name, odds, odds_only, p_code, match_id, odds_code,play_name) {
  109. let _this = this;
  110. let bettingInfo = {
  111. id,
  112. home_team: this.home_team,
  113. guest_team: this.guest_team,
  114. name,
  115. odds,
  116. ballId: this.$store.getters.getBallId,
  117. condition:name,
  118. odds_code,
  119. score: this.score,
  120. play_name,
  121. bettingTime: "",
  122. odds_only,
  123. lg_id:this.lg_id,
  124. odds_id:id,
  125. p_code,
  126. match_id
  127. };
  128. //调用玩法投注公共方法
  129. this.$public.bettingFunction(
  130. this.betting,
  131. bettingInfo,
  132. this.data,
  133. this.$store.getters.getBetting,
  134. this.title,
  135. this.dataNum,
  136. this.$store.getters.getLimit,
  137. function(res, type) {
  138. _this.$set(res, "isTrue", type);
  139. },
  140. function(data, val,type) {
  141. if(type) {
  142. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  143. }
  144. _this.$store.dispatch("BETTING", []);
  145. _this.$store.dispatch("BETTING", data ? data : val);
  146. if(_this.$store.getters.getIsBetting == '100') return false
  147. _this.$store.dispatch("ISBETTING",'100')
  148. }
  149. );
  150. },
  151. //获取玩法id
  152. getBettingId(data) {
  153. console.log("ssaa", data);
  154. if (data) {
  155. // data.forEach((res, index) => {
  156. // if (res.title == this.title) {
  157. // this.betting = res.data;
  158. // this.dataNum = index;
  159. // }
  160. // });
  161. }
  162. }
  163. },
  164. computed: {
  165. getUserIcons() {
  166. return this.$store.getters.getGameRatio;
  167. },
  168. getBetting() {
  169. return this.$store.getters.getBetting;
  170. },
  171. //获取投注框删除的投注信息
  172. getDeleteType() {
  173. return this.$store.getters.getDeleteType;
  174. }
  175. },
  176. watch: {
  177. //监听vuex里面数据
  178. getUserIcons(val) {
  179. this.match_id = val.match_id;
  180. if (!val) return false;
  181. this.home_team = val.home_team;
  182. this.guest_team = val.guest_team;
  183. this.lg_id=val.lg_id
  184. val.oddsData.forEach(res => {
  185. if (res[0].p_code == this.title) {
  186. this.isDisplay = true;
  187. this.data = res;
  188. }
  189. });
  190. this.getBettingId(this.$store.getters.getBetting);
  191. if (this.dataNum != 10000) {
  192. this.betting.forEach(res => {
  193. this.data.forEach((e, index) => {
  194. if (res.id == e.id) {
  195. this.$set(e, "isTrue", true);
  196. }
  197. });
  198. });
  199. }
  200. console.log(this.data, "a123");
  201. },
  202. //获取已投注信息
  203. getBetting(val) {
  204. let _this = this;
  205. this.$public.getBettingId(val, this.title, function(data, index) {
  206. _this.betting = data;
  207. _this.dataNum = index;
  208. });
  209. },
  210. //监听投注框删除处理
  211. getDeleteType(val) {
  212. this.data.forEach(e => {
  213. if (val == "all") {
  214. this.$set(e, "isTrue", false);
  215. } else {
  216. if (e.id == val) {
  217. this.$set(e, "isTrue", false);
  218. }
  219. }
  220. });
  221. }
  222. }
  223. };
  224. </script>
  225. <style scoped>
  226. div /deep/ .yd-accordion-head {
  227. padding: 0 0.32rem;
  228. background: #a0a0a0;
  229. }
  230. .goalBox {
  231. display: flex;
  232. justify-content: space-between;
  233. align-items: center;
  234. background: #f8f8f8;
  235. padding: 0 0.32rem;
  236. }
  237. div /deep/ .yd-accordion-title {
  238. color: #fefefe;
  239. font-size: 0.28rem;
  240. }
  241. div /deep/ .yd-accordion-head-arrow:after {
  242. border: none;
  243. width: 0.5rem;
  244. height: 0.5rem;
  245. background: url("../assets/st-imges/xiangxia.png") no-repeat;
  246. background-size: 100% 100%;
  247. }
  248. .box {
  249. font-size: 0.24rem;
  250. color: #333333;
  251. background: #f4f4f4;
  252. padding: 0 0.32rem;
  253. }
  254. .left_box {
  255. width: 50%;
  256. border-right: 1px solid #e4e4e4;
  257. line-height: 0.9rem;
  258. }
  259. .right_box {
  260. width: 50%;
  261. padding-left: 0.16rem;
  262. line-height: 0.9rem;
  263. }
  264. .ratio {
  265. display: flex;
  266. align-items: center;
  267. justify-content: center;
  268. width: 1.07rem;
  269. height: 0.76rem;
  270. border: 2px solid #cecece;
  271. border-radius: 0.1rem;
  272. margin: 0.06rem;
  273. padding: .1rem;
  274. text-align: center;
  275. }
  276. /* .odds {
  277. display: flex;
  278. width: 50%;
  279. justify-content: space-between;
  280. background: #f8f8f8;
  281. text-align: left;
  282. }
  283. .odds .odd {
  284. width: 100%;
  285. }
  286. .odds .small {
  287. width: 50%;
  288. display: flex;
  289. justify-content: space-between;
  290. border-right: 1px solid #e4e4e4;
  291. }
  292. .odds .large {
  293. width: 100%;
  294. display: flex;
  295. justify-content: space-between;
  296. border-right: 1px solid #e4e4e4;
  297. }
  298. .odds .small {
  299. border-right: none;
  300. padding-left: 0.16rem;
  301. }
  302. .odds .large div,
  303. .odds .small div {
  304. height: 0.88rem;
  305. font-size: 0.24rem;
  306. color: #333333;
  307. }
  308. .odds .large div:nth-child(1),
  309. .odds .small div:nth-child(1) {
  310. line-height: 0.88rem;
  311. }
  312. .odds .large .ratio,
  313. .odds .small .ratio {
  314. width: 1.07rem;
  315. height: 0.76rem;
  316. line-height: 0.76rem;
  317. border: 2px solid #cecece;
  318. border-radius: 0.1rem;
  319. margin-top: 0.06rem;
  320. text-align: center;
  321. margin-right: 0.14rem;
  322. }
  323. .odds .large .ratio span,
  324. .odds .small .ratio span {
  325. font-size: 0.24rem;
  326. }
  327. .odds .large .score,
  328. .odds .small .score {
  329. color: #fd8f26;
  330. }
  331. .odds:nth-last-child(1) .large,
  332. .odds:nth-last-child(1) .small {
  333. border-bottom: none;
  334. }
  335. .largeScore,
  336. .smallScore {
  337. line-height: 0.76rem;
  338. }*/
  339. .col {
  340. background: #f76649;
  341. border: 2px solid #f76649 !important;
  342. }
  343. .col span {
  344. color: #f4f4f4 !important;
  345. }
  346. /* .odds .score {
  347. display: block;
  348. margin-top: 0.04rem;
  349. } */
  350. </style>