1cb75dc60a62c1c8b4665a8b44343368991b1a79.svn-base 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div>
  3. <div v-for="item in data">
  4. <yd-accordion>
  5. <!-- 组件标题 -->
  6. <yd-accordion-item class="Match-game" :title="item.title" open>
  7. <div class="row allAlignment center rowBox" style="padding:0;">
  8. <!-- {{item.data.a}} -->
  9. <div class="column width-box" style="border-right: 1px solid #e4e4e4;">
  10. <div v-for="(items) in item.data.a" class="left-box">
  11. <div class="row allAlignment center">
  12. <span>大</span>
  13. <div
  14. class="column center btn-box"
  15. @click="bettingBtn(items.id,'大',items.odds_only,items.p_code,match_id)"
  16. >
  17. <span style="color: #f76649;" v-if="items.condition">{{ items.condition }}</span>
  18. <span>{{ items.odds }}</span>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="column width-box">
  24. <div v-for="(items) in item.data.b" class="right-box">
  25. <div class="row allAlignment center">
  26. <span>小</span>
  27. <div
  28. class="column center btn-box"
  29. @click="bettingBtn(items.id,'小',items.odds_only,items.p_code,match_id)"
  30. >
  31. <span style="color: #f76649;" v-if="items.condition">{{ items.condition }}</span>
  32. <span>{{ items.odds }}</span>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </yd-accordion-item>
  39. </yd-accordion>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. //总进球数
  46. data() {
  47. return {
  48. // 组件内部测试状态
  49. home_team: "",
  50. guest_team: "",
  51. title: "球队进球大小",
  52. data: [],
  53. lg_id: "123456",
  54. isDisplay: false,
  55. match_id: ""
  56. };
  57. },
  58. methods: {
  59. bettingBtn(
  60. id,
  61. name,
  62. odds,
  63. odds_only,
  64. p_code,
  65. match_id,
  66. condition = "",
  67. bettingTime = ""
  68. ) {
  69. let _this = this;
  70. let bettingInfo = {
  71. id,
  72. home_team: this.home_team,
  73. guest_team: this.guest_team,
  74. name,
  75. odds,
  76. p_code,
  77. match_id,
  78. odds_id: id,
  79. lg_id: this.lg_id,
  80. condition,
  81. odds_code: this.title,
  82. score: this.score,
  83. bettingTime,
  84. odds_only,
  85. ballId: this.$store.getters.getBallId
  86. };
  87. //调用玩法投注公共方法
  88. this.$public.bettingFunction(
  89. this.betting,
  90. bettingInfo,
  91. this.data,
  92. this.$store.getters.getBetting,
  93. this.title,
  94. this.dataNum,
  95. this.$store.getters.getLimit,
  96. function(res, type) {
  97. _this.$set(res, "isTrue", type);
  98. },
  99. function(data, val) {
  100. _this.$store.dispatch("BETTING", []);
  101. _this.$store.dispatch("BETTING", data ? data : val);
  102. if (_this.$store.getters.getIsBetting == "100") return false;
  103. _this.$store.dispatch("ISBETTING", "100");
  104. }
  105. );
  106. }
  107. },
  108. computed: {
  109. getUserIcons() {
  110. return this.$store.getters.getGameRatio;
  111. }
  112. },
  113. watch: {
  114. getUserIcons(val) {
  115. console.log(val);
  116. this.match_id = val.match_id;
  117. if (!val) return false;
  118. this.home_team = val.home_team;
  119. this.guest_team = val.guest_team;
  120. let objA = {},
  121. objB = {},
  122. objC = {},
  123. objD = {};
  124. val.oddsData.forEach(res => {
  125. if (res.key == this.title) {
  126. this.isDisplay = true;
  127. //console.log('球队进球大小',res);
  128. let key = Object.keys(res.data);
  129. let data = Object.values(res.data);
  130. key.forEach((e, index) => {
  131. let str = e.split("|");
  132. if (str[0] == "全场") {
  133. if (str[1] == "主队") {
  134. if (str[2] == "大") {
  135. objA.a = data[index];
  136. console.log("主大", data[index]);
  137. } else if (str[2] == "小") {
  138. objA.b = data[index];
  139. console.log("主小", data[index]);
  140. }
  141. } else if (str[1] == "客队") {
  142. if (str[2] == "大") {
  143. objB.a = data[index];
  144. } else if (str[2] == "小") {
  145. objB.b = data[index];
  146. }
  147. }
  148. //arrays.push(data[index][0]);
  149. } else if (str[0] == "上半场") {
  150. if (str[1] == "主队") {
  151. if (str[2] == "大") {
  152. objC.a = data[index];
  153. } else if (str[2] == "小") {
  154. objC.b = data[index];
  155. }
  156. } else if (str[1] == "客队") {
  157. if (str[2] == "大") {
  158. objD.a = data[index];
  159. } else if (str[2] == "小") {
  160. objD.b = data[index];
  161. }
  162. }
  163. }
  164. });
  165. }
  166. });
  167. if (objA.a) {
  168. this.data.push({ title: this.home_team + ":进球大小", data: objA });
  169. }
  170. if (objB.a) {
  171. this.data.push({ title: this.guest_team + ":进球大小", data: objB });
  172. }
  173. if (objC.a) {
  174. this.data.push({
  175. title: this.home_team + ":进球大小-上半场",
  176. data: objC
  177. });
  178. }
  179. if (objD.a) {
  180. this.data.push({
  181. title: this.guest_team + ":进球大小-上半场",
  182. data: objD
  183. });
  184. }
  185. console.log(this.data);
  186. }
  187. },
  188. mounted() {
  189. }
  190. };
  191. </script>
  192. <style scoped>
  193. div /deep/ .yd-accordion-head-arrow:after {
  194. border: none;
  195. width: 0.5rem;
  196. height: 0.5rem;
  197. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  198. background-size: 100% 100%;
  199. }
  200. div /deep/ .yd-accordion-head,
  201. div /deep/ .yd-accordion-head-content,
  202. div /deep/ .yd-accordion-title {
  203. height: 0.88rem;
  204. font-size: 0.28rem;
  205. color: #333;
  206. background: #f8f8f8;
  207. }
  208. div /deep/ .yd-accordion-head {
  209. padding: 0 0.32rem;
  210. }
  211. .rowBox {
  212. padding: 0 0.32rem;
  213. background: #f0f0f0;
  214. border-bottom: 1px solid #e4e4e4;
  215. }
  216. .width-box {
  217. width: 50%;
  218. }
  219. .right-box {
  220. padding-right: 0.32rem;
  221. padding-left: 0.2rem;
  222. border-bottom: 1px solid #e4e4e4;
  223. }
  224. .left-box {
  225. padding-left: 0.32rem;
  226. border-bottom: 1px solid #e4e4e4;
  227. }
  228. .btn-box {
  229. width: 1.07rem;
  230. height: 0.76rem;
  231. font-size: 0.24rem;
  232. padding: 0.1rem;
  233. border: 2px solid #cecece;
  234. border-radius: 0.1rem;
  235. margin: 0.1rem;
  236. }
  237. .active {
  238. background: #f76649;
  239. padding: 0.1rem;
  240. border: 2px solid #f76649;
  241. color: #f4f4f4 !important;
  242. }
  243. </style>