d045654ae6f3441f7a6e3f44ff70fdcad5b57408.svn-base 6.8 KB

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