7b1fc62d50b36a8fcddd50b54ce10d1fb9d41639.svn-base 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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,'进球:单/双')"
  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,'进球:单/双')"
  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) {
  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. };
  92. //调用玩法投注公共方法
  93. this.$public.bettingFunction(
  94. this.betting,
  95. bettingInfo,
  96. this.data,
  97. this.$store.getters.getBetting,
  98. this.title,
  99. this.dataNum,
  100. this.$store.getters.getLimit,
  101. function(res, type) {
  102. _this.$set(res, "isTrue", type);
  103. },
  104. function(data, val,type) {
  105. if(type) {
  106. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  107. }
  108. _this.$store.dispatch("BETTING", []);
  109. _this.$store.dispatch("BETTING", data ? data : val);
  110. if(_this.$store.getters.getIsBetting == '100') return false
  111. _this.$store.dispatch("ISBETTING",'100')
  112. }
  113. );
  114. },
  115. //获取玩法id
  116. getBettingId(data) {
  117. if (data) {
  118. data.forEach((res, index) => {
  119. if (res.title == this.title) {
  120. this.betting = res.data;
  121. this.dataNum = index;
  122. }
  123. });
  124. }
  125. }
  126. },
  127. computed: {
  128. getUserIcons() {
  129. return this.$store.getters.getGameRatio;
  130. },
  131. getBetting() {
  132. return this.$store.getters.getBetting;
  133. },
  134. //获取投注框删除的投注信息
  135. getDeleteType() {
  136. return this.$store.getters.getDeleteType;
  137. }
  138. },
  139. watch: {
  140. //监听vuex里面数据
  141. getUserIcons(val) {
  142. this.match_id = val.match_id;
  143. if (!val) return false;
  144. this.home_team = val.home_team;
  145. this.guest_team = val.guest_team;
  146. this.lg_id=val.lg_id
  147. val.oddsData.forEach(res => {
  148. if (res[0].p_code == this.title) {
  149. this.isDisplay = true;
  150. this.data = res;
  151. }
  152. });
  153. this.getBettingId(this.$store.getters.getBetting);
  154. if (this.dataNum != 10000) {
  155. this.betting.forEach(res => {
  156. this.data.forEach((e, index) => {
  157. if (res.id == e.id) {
  158. this.$set(e, "isTrue", true);
  159. }
  160. });
  161. });
  162. }
  163. //console.log(this.data, "a123");
  164. },
  165. //获取已投注信息
  166. getBetting(val) {
  167. let _this = this;
  168. this.$public.getBettingId(val, this.title, function(data, index) {
  169. _this.betting = data;
  170. _this.dataNum = index;
  171. });
  172. },
  173. //监听投注框删除处理
  174. getDeleteType(val) {
  175. this.data.forEach(e => {
  176. if (val == "all") {
  177. this.$set(e, "isTrue", false);
  178. } else {
  179. if (e.id == val) {
  180. this.$set(e, "isTrue", false);
  181. }
  182. }
  183. });
  184. }
  185. }
  186. };
  187. </script>
  188. <style scoped>
  189. div /deep/ .yd-accordion-head {
  190. padding: 0 0.32rem;
  191. background: #a0a0a0;
  192. }
  193. .goalBox {
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: center;
  197. background: #f8f8f8;
  198. padding: 0 0.32rem;
  199. }
  200. div /deep/ .yd-accordion-title {
  201. color: #fefefe;
  202. font-size: 0.28rem;
  203. }
  204. div /deep/ .yd-accordion-head-arrow:after {
  205. border: none;
  206. width: 0.5rem;
  207. height: 0.5rem;
  208. background: url("../assets/st-imges/xiangxia.png") no-repeat;
  209. background-size: 100% 100%;
  210. }
  211. .box {
  212. font-size: 0.24rem;
  213. color: #333333;
  214. background: #f4f4f4;
  215. padding: 0 0.32rem;
  216. }
  217. .left_box {
  218. width: 50%;
  219. border-right: 1px solid #e4e4e4;
  220. line-height: 0.9rem;
  221. }
  222. .right_box {
  223. width: 50%;
  224. padding-left: 0.16rem;
  225. line-height: 0.9rem;
  226. }
  227. .ratio {
  228. display: flex;
  229. align-items: center;
  230. justify-content: center;
  231. width: 1.07rem;
  232. height: 0.76rem;
  233. border: 1px solid #cecece;
  234. border-radius: 0.1rem;
  235. margin: 0.06rem;
  236. padding: .1rem;
  237. text-align: center;
  238. }
  239. .col {
  240. background: #f76649;
  241. border: 2px solid #f76649 !important;
  242. }
  243. .col span {
  244. color: #f4f4f4 !important;
  245. }
  246. /* .odds .score {
  247. display: block;
  248. margin-top: 0.04rem;
  249. } */
  250. </style>