e21fa907e73a546f845fd5157cd1619274fb788f.svn-base 6.0 KB

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