c2a46b7e90db38bc364b49df1069adfbf1f59fbc.svn-base 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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,item.oddsType)"
  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,item.oddsType)"
  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. oddsType,
  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. condition,
  77. ballId: this.$store.getters.getBallId,
  78. p_code,
  79. match_id,
  80. odds_code,
  81. play_name,
  82. score: this.score,
  83. lg_id: this.lg_id,
  84. odds_id: id,
  85. bettingTime,
  86. odds_only,
  87. oddsType
  88. };
  89. // console.log(this.data,'bbb')
  90. //调用玩法投注公共方法
  91. this.$public.bettingFunction(
  92. this.betting,
  93. bettingInfo,
  94. this.data,
  95. this.$store.getters.getBetting,
  96. this.title,
  97. this.dataNum,
  98. this.$store.getters.getLimit,
  99. function(res, type) {
  100. _this.$set(res, "isTrue", type);
  101. },
  102. function(data, val, type) {
  103. if (type) {
  104. _this.$dialog.alert({ mes: "你的注单已达到上限啦!" });
  105. }
  106. _this.$store.dispatch("BETTING", []);
  107. _this.$store.dispatch("BETTING", data ? data : val);
  108. if (_this.$store.getters.getIsBetting == "100") return false;
  109. _this.$store.dispatch("ISBETTING", "100");
  110. }
  111. );
  112. },
  113. //数据排序处理
  114. dataSorting(data){
  115. data.sort(function(a,b){
  116. return a.condition.substring(0,1)*1-b.condition.substring(0,1)*1
  117. })
  118. this.data= data;
  119. }
  120. },
  121. /**
  122. * 计算属性
  123. */
  124. computed: {
  125. /*------------------------------------------------------------ */
  126. getUserIcons() {
  127. return this.$store.getters.getGameRatio;
  128. },
  129. /*------------------------------------------------------------ */
  130. getBetting() {
  131. return this.$store.getters.getBetting;
  132. },
  133. //获取投注框删除的投注信息
  134. getDeleteType() {
  135. return this.$store.getters.getDeleteType;
  136. }
  137. },
  138. /**
  139. * 监听器
  140. */
  141. watch: {
  142. /*------------------------------------------------------------ */
  143. getUserIcons(val) {
  144. this.match_id = val.match_id;
  145. //console.log("更新数据", val);
  146. if (!val) return false;
  147. let _this = this;
  148. this.home_team = val.home_team;
  149. this.guest_team = val.guest_team;
  150. this.lg_id = val.lg_id;
  151. val.oddsData.forEach(res => {
  152. if (res[0].p_code == this.title) {
  153. this.isDisplay = true;
  154. // res.forEach(e => {
  155. // if (e.odds_code.startsWith("half")) {
  156. // e.odds_code = "half";
  157. // }
  158. // });
  159. this.dataSorting(res);
  160. //console.log(res);
  161. //this.data = res;
  162. //console.log(this.data);
  163. }
  164. });
  165. this.$public.getBettingId(
  166. this.$store.getters.getBetting,
  167. this.title,
  168. function(data, index) {
  169. _this.betting = data;
  170. _this.dataNum = index;
  171. }
  172. );
  173. // console.log('总进球数',this.dataNum);
  174. if (this.dataNum != 10000) {
  175. this.betting.forEach(res => {
  176. this.data.forEach((e, index) => {
  177. if (res.id == e.id) {
  178. this.$set(e, "isTrue", true);
  179. }
  180. });
  181. });
  182. }
  183. },
  184. /*------------------------------------------------------------ */
  185. //获取已投注信息
  186. getBetting(val) {
  187. let _this = this;
  188. this.$public.getBettingId(val, this.title, function(data, index) {
  189. _this.betting = data;
  190. _this.dataNum = index;
  191. });
  192. },
  193. //监听投注框删除处理
  194. getDeleteType(val) {
  195. this.data.forEach(e => {
  196. if (val == "all") {
  197. this.$set(e, "isTrue", false);
  198. } else {
  199. if (e.id == val) {
  200. this.$set(e, "isTrue", false);
  201. }
  202. }
  203. });
  204. }
  205. }
  206. };
  207. </script>
  208. <style scoped>
  209. div /deep/ .yd-accordion-head-arrow:after {
  210. border: none;
  211. width: 0.5rem;
  212. height: 0.5rem;
  213. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  214. background-size: 100% 100%;
  215. }
  216. div /deep/ .yd-accordion-head,
  217. div /deep/ .yd-accordion-head-content,
  218. div /deep/ .yd-accordion-title {
  219. font-size: 0.28rem;
  220. color: #fefefe;
  221. background: #a0a0a0;
  222. }
  223. div /deep/ .yd-accordion-head {
  224. padding: 0 0.32rem;
  225. }
  226. /*
  227. .Match-game-stat {
  228. position: absolute;
  229. right: 1.35rem;
  230. color: #fd8f26;
  231. font-size: 0.23rem;
  232. }*/
  233. .Match-game {
  234. position: relative;
  235. }
  236. .list-row {
  237. display: flex;
  238. justify-content: space-between;
  239. height: 0.87rem;
  240. background: #f8f8f8;
  241. border-bottom: 1px solid #e4e4e4;
  242. align-items: center;
  243. padding: 0 0.32rem;
  244. }
  245. .The-club {
  246. font-size: 0.26rem;
  247. }
  248. .The-club-box {
  249. display: inline-block;
  250. display: flex;
  251. flex-wrap: wrap;
  252. align-items: center;
  253. justify-content: center;
  254. width: 1.07rem;
  255. height: 0.76rem;
  256. font-size: 0.24rem;
  257. padding: 0.1rem;
  258. border: 1px solid #cecece;
  259. border-radius: 0.1rem;
  260. margin-right: 0.1rem;
  261. }
  262. .active {
  263. background: #f76649;
  264. color: #f4f4f4;
  265. padding: 0.1rem;
  266. border: 1px solid #f76649;
  267. }
  268. .active i {
  269. color: #f4f4f4 !important;
  270. }
  271. </style>