1fa556c558bcf73551b35cd5151f8b98a7cb890e.svn-base 5.9 KB

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