41f7d5eea30718361d2460dd6f3fcba283a51211.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div>
  3. <div v-if="isDisplay">
  4. <yd-accordion>
  5. <!-- 组件标题 -->
  6. <yd-accordion-item class="Match-game" title="半场/全场" open>
  7. <div style="background: #F0F0F0;">
  8. <div v-for="(item, index) in data" class="list-row" :key="index">
  9. <div v-for="(items,i) in titleKey" :key="i" v-if="item.odds_code == items ">
  10. <span class="The-club">{{ titleData[i]}}</span>
  11. </div>
  12. <span
  13. :class="item.isTrue== true ? 'active The-club-box' : 'The-club-box'"
  14. @click="bettingBtn(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id)"
  15. >
  16. <!-- <i style="color: #FD8F26;" v-if="item.num">{{ item.num.num1 }}</i> -->
  17. <i>{{ item.odds}}</i>
  18. </span>
  19. </div>
  20. </div>
  21. </yd-accordion-item>
  22. </yd-accordion>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. export default {
  28. // 让球
  29. data() {
  30. return {
  31. title: "half_full",
  32. data: [], //数据源
  33. home_team: "", //主队名
  34. guest_team: "", //客队名
  35. isDisplay: false, //是否显示
  36. titleKey: [], //
  37. match_id:'',
  38. titleData: [], //
  39. betting: [], //已投注倍率id集合
  40. dataNum: 10000 //对应的数据的下标
  41. };
  42. },
  43. methods: {
  44. //玩法投注
  45. bettingBtn(id,condition,odds,odds_only,p_code,match_id,bettingTime='') {
  46. let _this = this;
  47. let bettingInfo = {
  48. id,
  49. home_team: this.home_team,
  50. guest_team: this.guest_team,
  51. name,
  52. odds,
  53. condition,
  54. odds_only,
  55. ballId:this.$store.getters.getBallId,
  56. p_code,
  57. match_id,
  58. ganame: this.title,
  59. score: this.score,
  60. bettingTime
  61. };
  62. //调用玩法投注公共方法
  63. this.$public.bettingFunction(
  64. this.betting,
  65. bettingInfo,
  66. this.data,
  67. this.$store.getters.getBetting,
  68. this.title,
  69. this.dataNum,
  70. function(res, type) {
  71. _this.$set(res, "isTrue", type);
  72. },
  73. function(data, val) {
  74. _this.$store.dispatch("BETTING", []);
  75. _this.$store.dispatch("BETTING", data ? data : val);
  76. if(_this.$store.getters.getIsBetting) return false
  77. _this.$store.dispatch("ISBETTING",true)
  78. }
  79. );
  80. },
  81. //获取玩法id
  82. getBettingId(data) {
  83. if (data) {
  84. data.forEach((res, index) => {
  85. if (res.title == this.title) {
  86. this.betting = res.data;
  87. this.dataNum = index;
  88. }
  89. });
  90. }
  91. }
  92. },
  93. computed: {
  94. //从Vuex获取数据
  95. getUserIcons() {
  96. return this.$store.getters.getGameRatio;
  97. },
  98. getBetting() {
  99. return this.$store.getters.getBetting;
  100. },
  101. //获取投注框删除的投注信息
  102. getDeleteType(){
  103. return this.$store.getters.getDeleteType;
  104. },
  105. },
  106. watch: {
  107. //监听vuex里面数据
  108. getUserIcons(val) {
  109. this.match_id=val.match_id
  110. this.home_team = val.home_team;
  111. this.guest_team = val.guest_team;
  112. val.oddsData.forEach(res => {
  113. if (res[0].p_code == this.title) {
  114. this.isDisplay = true;
  115. this.data = res;
  116. //console.log("获取数据", res);
  117. }
  118. });
  119. let objs = {
  120. half_full_home_home: this.home_team + "/" + this.home_team,
  121. half_full_home_dogfall: this.home_team + "/和局",
  122. half_full_home_guest: this.home_team + "/" + this.guest_team,
  123. half_full_dogfall_home: "和局/" + this.home_team,
  124. half_full_dogfall_dogfall: "和局/和局",
  125. half_full_dogfall_guest: "和局/" + this.guest_team,
  126. half_full_guest_home: this.guest_team + "/" + this.home_team,
  127. half_full_guest_dogfall: this.guest_team + "/和局",
  128. half_full_guest_guest: this.guest_team + "/" + this.guest_team
  129. };
  130. this.titleKey = Object.keys(objs);
  131. this.titleData = Object.values(objs);
  132. this.getBettingId(this.$store.getters.getBetting);
  133. if (this.dataNum != 10000) {
  134. this.betting.forEach(res => {
  135. this.data.forEach((e, index) => {
  136. if (res.id == e.id) {
  137. this.$set(e, "isTrue", true);
  138. }
  139. });
  140. });
  141. }
  142. },
  143. //获取已投注信息
  144. getBetting(val) {
  145. let _this =this;
  146. this.$public.getBettingId(val,this.title,function(data,index){
  147. _this.betting = data;
  148. _this.dataNum = index;
  149. });
  150. },
  151. getDeleteType(val){
  152. console.log("a")
  153. this.data.forEach(e =>{
  154. if(val =='all'){
  155. this.$set(e, "isTrue", false);
  156. }else{
  157. if(e.id == val){
  158. this.$set(e, "isTrue", false);
  159. }
  160. }
  161. })
  162. }
  163. },
  164. };
  165. </script>
  166. <style scoped>
  167. div /deep/ .yd-accordion-head-arrow:after {
  168. border: none;
  169. width: 0.5rem;
  170. height: 0.5rem;
  171. background: url(../../assets/st-imges/xiangxia.png) no-repeat;
  172. background-size: 100% 100%;
  173. }
  174. div /deep/ .yd-accordion-head,
  175. div /deep/ .yd-accordion-head-content,
  176. div /deep/ .yd-accordion-title {
  177. height: 0.88rem;
  178. font-size: 0.28rem;
  179. color: #fefefe;
  180. background: #a0a0a0;
  181. }
  182. div /deep/ .yd-accordion-head {
  183. padding: 0 0.32rem;
  184. }
  185. .Match-game {
  186. position: relative;
  187. }
  188. .Match-game-stat {
  189. position: absolute;
  190. right: 1.35rem;
  191. color: #fd8f26;
  192. font-size: 0.23rem;
  193. }
  194. .list-row {
  195. display: flex;
  196. justify-content: space-between;
  197. height: 0.87rem;
  198. background: #f8f8f8;
  199. border-bottom: 1px solid #e4e4e4;
  200. align-items: center;
  201. padding: 0 0.32rem;
  202. }
  203. .The-club {
  204. font-size: 0.24rem;
  205. }
  206. .The-club-box {
  207. display: inline-block;
  208. display: flex;
  209. flex-wrap: wrap;
  210. align-items: center;
  211. justify-content: center;
  212. width: 1.07rem;
  213. height: 0.76rem;
  214. font-size: 0.24rem;
  215. padding: 0.1rem;
  216. border: 2px solid #cecece;
  217. border-radius: 0.1rem;
  218. margin-right: 0.1rem;
  219. }
  220. .active {
  221. background: #f76649;
  222. padding: 0.1rem;
  223. border: 2px solid #f76649;
  224. }
  225. .active i {
  226. color: #f4f4f4 !important;
  227. }
  228. </style>