a9794698776488a3e693d866c9630005ff79e7b8.svn-base 7.3 KB

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