fcfbbcc8a7108ec086a69429e3863dd6677e5384.svn-base 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div>
  3. <div v-if="isDisplay">
  4. <yd-accordion>
  5. <!-- 组件标题 -->
  6. <yd-accordion-item class="Match-game" :title="home_team+':球队得分最后一位数'" open>
  7. <div v-for="item in data" :key="item.id" class="list-row" v-if="item.odds_code =='last_home'">
  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="The-club-box 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="guest_team+':球队得分最后一位数'" open>
  22. <div v-for="item in data" :key="item.id" class="list-row" v-if="item.odds_code =='last_guest'">
  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="The-club-box 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: "last_number",
  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. dataSorting(data){
  113. data.sort(function(a,b){
  114. return a.condition.substring(0,1)*1-b.condition.substring(0,1)*1
  115. })
  116. this.data= data;
  117. }
  118. },
  119. /**
  120. * 计算属性
  121. */
  122. computed: {
  123. /*------------------------------------------------------------ */
  124. getUserIcons() {
  125. return this.$store.getters.getGameRatio;
  126. },
  127. /*------------------------------------------------------------ */
  128. getBetting() {
  129. return this.$store.getters.getBetting;
  130. },
  131. //获取投注框删除的投注信息
  132. getDeleteType() {
  133. return this.$store.getters.getDeleteType;
  134. }
  135. },
  136. /**
  137. * 监听器
  138. */
  139. watch: {
  140. /*------------------------------------------------------------ */
  141. getUserIcons(val) {
  142. this.match_id = val.match_id;
  143. //console.log("更新数据", val);
  144. if (!val) return false;
  145. let _this = this;
  146. this.home_team = val.home_team;
  147. this.guest_team = val.guest_team;
  148. this.lg_id = val.lg_id;
  149. val.oddsData.forEach(res => {
  150. if (res[0].p_code == this.title) {
  151. this.isDisplay = true;
  152. // res.forEach(e => {
  153. // if (e.odds_code.startsWith("half")) {
  154. // e.odds_code = "half";
  155. // }
  156. // });
  157. this.dataSorting(res);
  158. //console.log(res);
  159. //this.data = res;
  160. //console.log(this.data);
  161. }
  162. });
  163. this.$public.getBettingId(
  164. this.$store.getters.getBetting,
  165. this.title,
  166. function(data, index) {
  167. _this.betting = data;
  168. _this.dataNum = index;
  169. }
  170. );
  171. // console.log('总进球数',this.dataNum);
  172. if (this.dataNum != 10000) {
  173. this.betting.forEach(res => {
  174. this.data.forEach((e, index) => {
  175. if (res.id == e.id) {
  176. this.$set(e, "isTrue", true);
  177. }
  178. });
  179. });
  180. }
  181. },
  182. /*------------------------------------------------------------ */
  183. //获取已投注信息
  184. getBetting(val) {
  185. let _this = this;
  186. this.$public.getBettingId(val, this.title, function(data, index) {
  187. _this.betting = data;
  188. _this.dataNum = index;
  189. });
  190. },
  191. //监听投注框删除处理
  192. getDeleteType(val) {
  193. this.data.forEach(e => {
  194. if (val == "all") {
  195. this.$set(e, "isTrue", false);
  196. } else {
  197. if (e.id == val) {
  198. this.$set(e, "isTrue", false);
  199. }
  200. }
  201. });
  202. }
  203. }
  204. };
  205. </script>
  206. <style scoped>
  207. div /deep/ .yd-accordion-head-arrow:after {
  208. border: none;
  209. width: 0.5rem;
  210. height: 0.5rem;
  211. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  212. background-size: 100% 100%;
  213. }
  214. div /deep/ .yd-accordion-head,
  215. div /deep/ .yd-accordion-head-content,
  216. div /deep/ .yd-accordion-title {
  217. font-size: 0.28rem;
  218. color: #fefefe;
  219. background: #a0a0a0;
  220. }
  221. div /deep/ .yd-accordion-head {
  222. padding: 0 0.32rem;
  223. }
  224. /*
  225. .Match-game-stat {
  226. position: absolute;
  227. right: 1.35rem;
  228. color: #fd8f26;
  229. font-size: 0.23rem;
  230. }*/
  231. .Match-game {
  232. position: relative;
  233. }
  234. .list-row {
  235. display: flex;
  236. justify-content: space-between;
  237. height: 0.87rem;
  238. background: #f8f8f8;
  239. border-bottom: 1px solid #e4e4e4;
  240. align-items: center;
  241. padding: 0 0.32rem;
  242. }
  243. .The-club {
  244. font-size: 0.26rem;
  245. }
  246. .The-club-box {
  247. display: inline-block;
  248. display: flex;
  249. flex-wrap: wrap;
  250. align-items: center;
  251. justify-content: center;
  252. width: 1.07rem;
  253. height: 0.76rem;
  254. font-size: 0.24rem;
  255. padding: 0.1rem;
  256. border: 1px solid #cecece;
  257. border-radius: 0.1rem;
  258. margin-right: 0.1rem;
  259. }
  260. .active {
  261. background: #f76649;
  262. color: #f4f4f4;
  263. padding: 0.1rem;
  264. border: 1px solid #f76649;
  265. }
  266. .active i {
  267. color: #f4f4f4 !important;
  268. }
  269. </style>