cfc4b552d0cfccd29352bc2d24318a645cac2a09.svn-base 6.8 KB

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