3da0c44a90467f48caa176bde08336dc022c9918.svn-base 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class="goal">
  3. <div v-if="isDisplay">
  4. <yd-accordion :accordion="true">
  5. <yd-accordion-item title="总局数:单/双" open>
  6. <div class="row allAlignment box">
  7. <div class=" column allAlignment left_box">
  8. <div
  9. v-for="(item,index) in data"
  10. :key="'b'+index"
  11. v-if="item.odds_code =='two_sides_single'"
  12. class=" row allAlignment"
  13. >
  14. <div>{{item.condition}}</div>
  15. <div v-if="item.odds >0" class="ratio"
  16. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  17. @click="toggle(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'进球:单/双',item.oddsType)"
  18. >
  19. <span>{{item.odds}}</span>
  20. </div>
  21. <div v-else class="ratio column center">
  22. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  23. </div>
  24. </div>
  25. </div>
  26. <div class=" column allAlignment right_box ">
  27. <div
  28. v-for="(item,index) in data"
  29. :key="'b'+index"
  30. v-if="item.odds_code =='two_sides_double' "
  31. class=" row allAlignment"
  32. >
  33. <div>{{item.condition}}</div>
  34. <div v-if="item.odds >0" class="ratio"
  35. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  36. @click="toggle(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'进球:单/双',item.oddsType)"
  37. >
  38. <span>{{item.odds}}</span>
  39. </div>
  40. <div v-else class="ratio column center">
  41. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </yd-accordion-item>
  47. </yd-accordion>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. export default {
  53. // 进球大小单双数
  54. data() {
  55. return {
  56. title: "two_game_sides",
  57. // status: -1,
  58. smallStatus: [],
  59. isDisplay: false,
  60. home_team: "",
  61. guest_team: "",
  62. match_id: "",
  63. lg_id:'',
  64. score: "0",
  65. data: [], //
  66. betting: [], //已投注倍率id集合
  67. dataNum: 10000 //对应的数据的下标
  68. };
  69. },
  70. methods: {
  71. //玩法投注
  72. toggle(id, name, odds, odds_only, p_code, match_id, odds_code,play_name,oddsType) {
  73. let _this = this;
  74. let bettingInfo = {
  75. id,
  76. home_team: this.home_team,
  77. guest_team: this.guest_team,
  78. name,
  79. odds,
  80. ballId: this.$store.getters.getBallId,
  81. condition:name,
  82. odds_code,
  83. score: this.score,
  84. play_name,
  85. bettingTime: "",
  86. odds_only,
  87. lg_id:this.lg_id,
  88. odds_id:id,
  89. p_code,
  90. match_id,
  91. oddsType
  92. };
  93. //调用玩法投注公共方法
  94. this.$public.bettingFunction(
  95. this.betting,
  96. bettingInfo,
  97. this.data,
  98. this.$store.getters.getBetting,
  99. this.title,
  100. this.dataNum,
  101. this.$store.getters.getLimit,
  102. function(res, type) {
  103. _this.$set(res, "isTrue", type);
  104. },
  105. function(data, val,type) {
  106. if(type) {
  107. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  108. }
  109. _this.$store.dispatch("BETTING", []);
  110. _this.$store.dispatch("BETTING", data ? data : val);
  111. if(_this.$store.getters.getIsBetting == '100') return false
  112. _this.$store.dispatch("ISBETTING",'100')
  113. }
  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. getUserIcons() {
  130. return this.$store.getters.getGameRatio;
  131. },
  132. getBetting() {
  133. return this.$store.getters.getBetting;
  134. },
  135. //获取投注框删除的投注信息
  136. getDeleteType() {
  137. return this.$store.getters.getDeleteType;
  138. }
  139. },
  140. watch: {
  141. //监听vuex里面数据
  142. getUserIcons(val) {
  143. this.match_id = val.match_id;
  144. if (!val) return false;
  145. this.home_team = val.home_team;
  146. this.guest_team = val.guest_team;
  147. this.lg_id=val.lg_id
  148. val.oddsData.forEach(res => {
  149. if (res[0].p_code == this.title) {
  150. this.isDisplay = true;
  151. this.data = res;
  152. }
  153. });
  154. this.getBettingId(this.$store.getters.getBetting);
  155. if (this.dataNum != 10000) {
  156. this.betting.forEach(res => {
  157. this.data.forEach((e, index) => {
  158. if (res.id == e.id) {
  159. this.$set(e, "isTrue", true);
  160. }
  161. });
  162. });
  163. }
  164. //console.log(this.data, "a123");
  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 {
  191. padding: 0 0.32rem;
  192. background: #a0a0a0;
  193. }
  194. .goalBox {
  195. display: flex;
  196. justify-content: space-between;
  197. align-items: center;
  198. background: #f8f8f8;
  199. padding: 0 0.32rem;
  200. }
  201. div /deep/ .yd-accordion-title {
  202. color: #fefefe;
  203. font-size: 0.28rem;
  204. }
  205. div /deep/ .yd-accordion-head-arrow:after {
  206. border: none;
  207. width: 0.5rem;
  208. height: 0.5rem;
  209. background: url("../assets/st-imges/xiangxia.png") no-repeat;
  210. background-size: 100% 100%;
  211. }
  212. .box {
  213. font-size: 0.24rem;
  214. color: #333333;
  215. background: #f4f4f4;
  216. padding: 0 0.32rem;
  217. }
  218. .left_box {
  219. width: 50%;
  220. border-right: 1px solid #e4e4e4;
  221. line-height: 0.9rem;
  222. }
  223. .right_box {
  224. width: 50%;
  225. padding-left: 0.16rem;
  226. line-height: 0.9rem;
  227. }
  228. .ratio {
  229. display: flex;
  230. align-items: center;
  231. justify-content: center;
  232. width: 1.07rem;
  233. height: 0.76rem;
  234. border: 1px solid #cecece;
  235. border-radius: 0.1rem;
  236. margin: 0.06rem;
  237. padding: .1rem;
  238. text-align: center;
  239. }
  240. .col {
  241. background: #f76649;
  242. border: 2px solid #f76649 !important;
  243. }
  244. .col span {
  245. color: #f4f4f4 !important;
  246. }
  247. /* .odds .score {
  248. display: block;
  249. margin-top: 0.04rem;
  250. } */
  251. </style>