9d961691ad57485099e42b35f4dc285a40b741e6.svn-base 6.7 KB

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