af75c5a7774c5ad7e08ac622960c29d2b45f76bb.svn-base 7.9 KB

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