e3b83f0c7f331abe28f521c4cd29cb908b7965c2.svn-base 10 KB

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