45ae6c0a393a27b62992e7201d92a12a461f2b85.svn-base 7.7 KB

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