aa7b592e54b77aa316e09b478a3f44a34c40498c.svn-base 7.6 KB

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