StOnlyWin.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div>
  3. <div v-if="isDisplay">
  4. <yd-accordion>
  5. <yd-accordion-item class="Match-game" title="独赢" open>
  6. <div v-for="(item ,index) in data" :key="index">
  7. <div class="box" style="background: #F4F4F4;">
  8. <div v-if="item.odds_code == 'capot_home'">
  9. <div class="row allAlignment center row-box">
  10. <span>{{home_team}}</span>
  11. <div
  12. class="The-club-box row center"
  13. :class="item.isTrue== true ? 'active' : ''"
  14. @click="bettingBtn(item.id,home_team,item.odds,item.odds_only,item.p_code,match_id,item.condition)"
  15. >
  16. <span>{{item.odds}}</span>
  17. </div>
  18. </div>
  19. </div>
  20. <div v-if="item.odds_code == 'capot_guest'">
  21. <div class="row allAlignment center row-box">
  22. <span>{{guest_team}}</span>
  23. <div
  24. class="The-club-box row center"
  25. :class="item.isTrue== true ? 'active ' : ''"
  26. @click="bettingBtn(item.id,guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition)"
  27. >
  28. <span>{{item.odds}}</span>
  29. </div>
  30. </div>
  31. </div>
  32. <div v-if="item.odds_code == 'capot_dogfall'">
  33. <div class="row allAlignment center row-box" style=" border-bottom:0;">
  34. <span>和局</span>
  35. <div
  36. class="The-club-box row center"
  37. :class="item.isTrue== true ? 'active' : ''"
  38. @click="bettingBtn(item.id,'和局',item.odds,item.odds_only,item.p_code,match_id,item.condition)"
  39. >
  40. <span>{{item.odds}}</span>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </yd-accordion-item>
  47. </yd-accordion>
  48. <yd-accordion>
  49. <yd-accordion-item class="Match-game" title="独赢-上半场" open>
  50. <div v-for="(item ,index) in data" :key="index">
  51. <div class="box" style="background: #F4F4F4;">
  52. <div v-if="item.odds_code == 'half_capot_home'">
  53. <div class="row allAlignment center row-box">
  54. <span>{{home_team}}</span>
  55. <div
  56. class="The-club-box row center"
  57. :class="item.isTrue== true ? 'active' : ''"
  58. @click="bettingBtn(item.id,home_team,item.odds,item.odds_only,item.p_code,match_id,item.condition)"
  59. >
  60. <span>{{item.odds}}</span>
  61. </div>
  62. </div>
  63. </div>
  64. <div v-if="item.odds_code == 'half_capot_guest'">
  65. <div class="row allAlignment center row-box">
  66. <span>{{guest_team}}</span>
  67. <div
  68. class="The-club-box row center"
  69. :class="item.isTrue== true ? 'active ' : ''"
  70. @click="bettingBtn(item.id,guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition)"
  71. >
  72. <span>{{item.odds}}</span>
  73. </div>
  74. </div>
  75. </div>
  76. <div v-if="item.odds_code == 'half_capot_dogfall'">
  77. <div class="row allAlignment center row-box" style=" border-bottom:0;">
  78. <span>和局</span>
  79. <div
  80. class="The-club-box row center"
  81. :class="item.isTrue== true ? 'active' : ''"
  82. @click="bettingBtn(item.id,'和局',item.odds,item.odds_only,item.p_code,match_id,item.condition)"
  83. >
  84. <span>{{item.odds}}</span>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </yd-accordion-item>
  91. </yd-accordion>
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. export default {
  97. // 独赢
  98. data() {
  99. return {
  100. title: "capot",
  101. home_team: " ",
  102. match_id:'',
  103. guest_team: " ",
  104. data: [],
  105. isDisplay: "", //是否显示
  106. betting: [], //已投注倍率id集合
  107. dataNum: 10000 //对应的数据的下标
  108. };
  109. },
  110. methods: {
  111. //玩法投注
  112. bettingBtn(id, name, odds,odds_only,p_code,match_id,condition = "", bettingTime = "") {
  113. console.log(this.data)
  114. let _this = this;
  115. let bettingInfo = {
  116. id,
  117. home_team: this.home_team,
  118. guest_team: this.guest_team,
  119. name,
  120. odds,
  121. ballId:this.$store.getters.getBallId,
  122. condition,
  123. ganame: this.title,
  124. score: this.score,
  125. bettingTime,
  126. odds_only,
  127. p_code,
  128. match_id,
  129. };
  130. //调用玩法投注公共方法
  131. this.$public.bettingFunction(
  132. this.betting,
  133. bettingInfo,
  134. this.data,
  135. this.$store.getters.getBetting,
  136. this.title,
  137. this.dataNum,
  138. function(res, type) {
  139. _this.$set(res, "isTrue", type);
  140. },
  141. function(data, val) {
  142. _this.$store.dispatch("BETTING", []);
  143. _this.$store.dispatch("BETTING", data ? data : val);
  144. if (_this.$store.getters.getIsBetting) return false;
  145. _this.$store.dispatch("ISBETTING", true);
  146. }
  147. );
  148. },
  149. //获取玩法id
  150. getBettingId(data) {
  151. if (data) {
  152. data.forEach((res, index) => {
  153. if (res.title == this.title) {
  154. this.betting = res.data;
  155. this.dataNum = index;
  156. }
  157. });
  158. }
  159. }
  160. },
  161. computed: {
  162. getUserIcons() {
  163. return this.$store.getters.getGameRatio;
  164. },
  165. getBetting() {
  166. return this.$store.getters.getBetting;
  167. },
  168. // 获取投注删除状态
  169. deleteType() {
  170. return this.$store.getters.getDeleteType;
  171. }
  172. },
  173. watch: {
  174. getUserIcons(val) {
  175. this.match_id=val.match_id
  176. console.log(val,'val')
  177. if (!val) return false;
  178. this.home_team = val.home_team;
  179. this.guest_team = val.guest_team;
  180. val.oddsData.forEach(res => {
  181. if (res[0].p_code == this.title) {
  182. this.isDisplay = true;
  183. this.data = res;
  184. }
  185. });
  186. this.getBettingId(this.$store.getters.getBetting);
  187. if (this.dataNum != 10000) {
  188. this.betting.forEach(res => {
  189. this.data.forEach((e, index) => {
  190. if (res.id == e.id) {
  191. this.$set(e, "isTrue", true);
  192. }
  193. });
  194. });
  195. }
  196. },
  197. //获取已投注信息
  198. getBetting(val) {
  199. let _this = this;
  200. this.$public.getBettingId(val, this.title, function(data, index) {
  201. _this.betting = data;
  202. _this.dataNum = index;
  203. });
  204. },
  205. //监听投注框删除处理
  206. deleteType(val) {
  207. console.log("我要的数据B",val);
  208. this.data.forEach(e => {
  209. if (val == "all") {
  210. this.$set(e, "isTrue", false);
  211. } else {
  212. if (e.id == val) {
  213. this.$set(e, "isTrue", false);
  214. }
  215. }
  216. });
  217. },
  218. },
  219. mounted() {
  220. }
  221. };
  222. </script>
  223. <style scoped>
  224. div /deep/ .yd-accordion-head-arrow:after {
  225. border: none;
  226. width: 0.5rem;
  227. height: 0.5rem;
  228. background: url(../../assets/st-imges/xiangxia.png) no-repeat;
  229. background-size: 100% 100%;
  230. }
  231. div /deep/ .yd-accordion-head,
  232. div /deep/ .yd-accordion-head-content,
  233. div /deep/ .yd-accordion-title {
  234. height: 0.88rem;
  235. font-size: 0.28rem;
  236. color: #fefefe;
  237. background: #a0a0a0;
  238. }
  239. div /deep/ .yd-accordion-head {
  240. padding: 0 0.32rem;
  241. }
  242. .box {
  243. padding: 0 0.32rem;
  244. }
  245. .row-box {
  246. height: 0.9rem;
  247. font-size: 0.26rem;
  248. border-bottom: 1px solid #e4e4e4;
  249. }
  250. .The-club-box {
  251. width: 1.07rem;
  252. height: 0.76rem;
  253. font-size: 0.24rem;
  254. padding: 0.1rem;
  255. border: 2px solid #cecece;
  256. border-radius: 0.1rem;
  257. margin-right: 0.1rem;
  258. }
  259. .active {
  260. background: #f76649;
  261. color: #f4f4f4;
  262. padding: 0.1rem;
  263. border: 2px solid #f76649;
  264. }
  265. .active i {
  266. color: #f4f4f4 !important;
  267. }
  268. </style>