12c21f24d580d1b942c167a592f4ba34f4d60081.svn-base 7.7 KB

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