c6a350b765c623cd9211617a6fb6450c647baa04.svn-base 6.2 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 v-for="item in data" :key="item.id" class="list-row" v-if="item.odds_code !='half'" >
  8. <span class="The-club">{{ item.condition }}</span>
  9. <span
  10. :class="item.isTrue ? 'active The-club-box' : 'The-club-box'"
  11. @click="bettingBtn(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id)"
  12. >{{ item.odds }}</span>
  13. <!-- </div> -->
  14. </div>
  15. </yd-accordion-item>
  16. </yd-accordion>
  17. <yd-accordion>
  18. <!-- 组件标题 -->
  19. <yd-accordion-item class="Match-game" title="总进球数-上半场" open>
  20. <div v-for="item in data" :key="item.id" class="list-row" v-if="item.odds_code =='half'" >
  21. <span class="The-club">{{ item.condition }}</span>
  22. <span
  23. :class="item.isTrue ? 'active The-club-box' : 'The-club-box'"
  24. @click="bettingBtn(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id)"
  25. >{{ item.odds }}</span>
  26. <!-- </div> -->
  27. </div>
  28. </yd-accordion-item>
  29. </yd-accordion>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. export default {
  35. //总进球数
  36. data() {
  37. return {
  38. title: "total_goal",
  39. data: [],
  40. home_team:'',//主队
  41. match_id:'',
  42. guest_team:'',//客队
  43. score:'0,0',//比分
  44. isDisplay:false,//是否显示
  45. betting: [], //获取vuex本组件类已投注倍率数据集合
  46. dataNum: 10000 //对应的数据的下标
  47. };
  48. },
  49. methods: {
  50. //玩法投注
  51. bettingBtn(id,name,odds,odds_only,p_code,match_id,condition='',bettingTime='') {
  52. let _this = this;
  53. let bettingInfo = {
  54. id,
  55. home_team:this.home_team,
  56. guest_team:this.guest_team,
  57. name,
  58. odds,
  59. condition,
  60. ballId:this.$store.getters.getBallId,
  61. p_code,
  62. match_id,
  63. ganame:this.title,
  64. score:this.score,
  65. bettingTime,
  66. odds_only,
  67. }
  68. //调用玩法投注公共方法
  69. this.$public.bettingFunction(this.betting,bettingInfo,this.data,this.$store.getters.getBetting,this.title,this.dataNum,
  70. function(res, type) {
  71. _this.$set(res, "isTrue", type);
  72. },
  73. function(data, val) {
  74. _this.$store.dispatch("BETTING", []);
  75. _this.$store.dispatch("BETTING", data ? data : val);
  76. if(_this.$store.getters.getIsBetting) return false
  77. _this.$store.dispatch("ISBETTING",true)
  78. }
  79. );
  80. }
  81. },
  82. /**
  83. * 计算属性
  84. */
  85. computed: {
  86. /*------------------------------------------------------------ */
  87. getUserIcons() {
  88. return this.$store.getters.getGameRatio;
  89. },
  90. /*------------------------------------------------------------ */
  91. getBetting() {
  92. return this.$store.getters.getBetting;
  93. },
  94. //获取投注框删除的投注信息
  95. getDeleteType(){
  96. return this.$store.getters.getDeleteType;
  97. },
  98. },
  99. /**
  100. * 监听器
  101. */
  102. watch: {
  103. /*------------------------------------------------------------ */
  104. getUserIcons(val) {
  105. this.match_id=val.match_id
  106. //console.log("更新数据", val);
  107. if (!val) return false;
  108. let _this =this;
  109. this.home_team = val.home_team;
  110. this.guest_team = val.guest_team;
  111. val.oddsData.forEach(res => {
  112. if (res[0].p_code == this.title) {
  113. this.isDisplay = true;
  114. res.forEach((e)=>{
  115. if(e.odds_code.startsWith('half')){
  116. e.odds_code = 'half';
  117. }
  118. })
  119. this.data = res;
  120. }
  121. });
  122. this.$public.getBettingId(this.$store.getters.getBetting,this.title,function(data,index){
  123. _this.betting = data;
  124. _this.dataNum = index;
  125. });
  126. // console.log('总进球数',this.dataNum);
  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. //获取已投注信息
  139. getBetting(val) {
  140. let _this =this;
  141. this.$public.getBettingId(val,this.title,function(data,index){
  142. _this.betting = data;
  143. _this.dataNum = index;
  144. });
  145. },
  146. //监听投注框删除处理
  147. getDeleteType(val){
  148. this.data.forEach(e =>{
  149. if(val =='all'){
  150. this.$set(e, "isTrue", false);
  151. }else{
  152. if(e.id == val){
  153. this.$set(e, "isTrue", false);
  154. }
  155. }
  156. })
  157. }
  158. }
  159. };
  160. </script>
  161. <style scoped>
  162. div /deep/ .yd-accordion-head-arrow:after {
  163. border: none;
  164. width: 0.5rem;
  165. height: 0.5rem;
  166. background: url(../../assets/st-imges/xiangxia.png) no-repeat;
  167. background-size: 100% 100%;
  168. }
  169. div /deep/ .yd-accordion-head,
  170. div /deep/ .yd-accordion-head-content,
  171. div /deep/ .yd-accordion-title {
  172. height: 0.88rem;
  173. font-size: 0.28rem;
  174. color: #FEFEFE;
  175. background: #a0a0a0;
  176. }
  177. div /deep/ .yd-accordion-head {
  178. padding: 0 0.32rem;
  179. }
  180. /*
  181. .Match-game-stat {
  182. position: absolute;
  183. right: 1.35rem;
  184. color: #fd8f26;
  185. font-size: 0.23rem;
  186. }*/
  187. .Match-game {
  188. position: relative;
  189. }
  190. .list-row {
  191. display: flex;
  192. justify-content: space-between;
  193. height: 0.87rem;
  194. background: #f8f8f8;
  195. border-bottom: 1px solid #e4e4e4;
  196. align-items: center;
  197. padding: 0 0.32rem;
  198. }
  199. .The-club {
  200. font-size: 0.28rem;
  201. }
  202. .The-club-box {
  203. display: inline-block;
  204. display: flex;
  205. flex-wrap: wrap;
  206. align-items: center;
  207. justify-content: center;
  208. width: 1.07rem;
  209. height: 0.76rem;
  210. font-size: 0.24rem;
  211. padding: 0.1rem;
  212. border: 2px solid #cecece;
  213. border-radius: 0.1rem;
  214. margin-right: 0.1rem;
  215. }
  216. .active {
  217. background: #f76649;
  218. color: #f4f4f4;
  219. padding: 0.1rem;
  220. border: 2px solid #f76649;
  221. }
  222. .active i {
  223. color: #f4f4f4 !important;
  224. }
  225. </style>