b81728a99059658e8b173d0c540ba5982a921577.svn-base 8.0 KB

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