47d64c105046c2d55c657ce5aad88d952fea45e6.svn-base 7.7 KB

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