8ce6210baf1c51753be0c51bee4351c1fa4c765c.svn-base 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div>
  3. <div v-if="isDisplay">
  4. <yd-accordion>
  5. <yd-accordion-item class="Match-game" :title="total_title" open>
  6. <div class="row allAlignment center rowBox" >
  7. <div class="column width-box " style="border-right: 1px solid #e4e4e4">
  8. <div v-if="item.odds_code.endsWith('big')" v-for=" (item,index) in data" class="row allAlignment center borderBottom" >
  9. <span>大</span>
  10. <div v-if="item.odds >0" class="column center btn-box"
  11. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  12. @click="bettingBtn(item.id,'大',item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code)"
  13. >
  14. <span class="spanCol" v-if="item.condition">{{ item.condition }}</span>
  15. <span>{{ item.odds }}</span>
  16. </div>
  17. <div v-else class="btn-box column center">
  18. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="column width-box " >
  23. <div v-if="item.odds_code.endsWith('small')" v-for=" (item,index) in data" class="row allAlignment center borderBottom">
  24. <span style="padding-left: 0.2rem;">小</span>
  25. <div v-if="item.odds >0" class="column center btn-box"
  26. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  27. @click="bettingBtn(item.id,'小',item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code)"
  28. >
  29. <span class="spanCol" v-if="item.condition">{{ item.condition }}</span>
  30. <span>{{ item.odds }}</span>
  31. </div>
  32. <div v-else class="btn-box column center">
  33. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </yd-accordion-item>
  39. </yd-accordion>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. //总进球数
  46. data() {
  47. return {
  48. title: "total_size",
  49. isDisplay: false,
  50. home_team: "",
  51. guest_team: "",
  52. total_title: "总得分:大/小",
  53. data: [],
  54. lg_id: "",
  55. match_id: "",
  56. betting: [], //已投注倍率id集合
  57. dataNum: 10000 //对应的数据的下标
  58. };
  59. },
  60. methods: {
  61. bettingBtn(id,name,odds,odds_only,p_code,match_id,condition,odds_code,bettingTime = "") {
  62. let _this = this;
  63. let bettingInfo = {
  64. id,
  65. home_team: this.home_team,
  66. guest_team: this.guest_team,
  67. name,
  68. odds,
  69. p_code,
  70. ballId: this.$store.getters.getBallId,
  71. match_id,
  72. condition,
  73. odds_code: this.title,
  74. score: this.score,
  75. bettingTime,
  76. odds_only,
  77. play_name:"总得分:大/小",
  78. lg_id: this.lg_id,
  79. };
  80. //调用玩法投注公共方法
  81. this.$public.bettingFunction(
  82. this.betting,
  83. bettingInfo,
  84. this.data,
  85. this.$store.getters.getBetting,
  86. this.title,
  87. this.dataNum,
  88. this.$store.getters.getLimit,
  89. function(res, type) {
  90. _this.$set(res, "isTrue", type);
  91. },
  92. function(data, val,type) {
  93. if(type) {
  94. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  95. }
  96. _this.$store.dispatch("BETTING", []);
  97. _this.$store.dispatch("BETTING", data ? data : val);
  98. if(_this.$store.getters.getIsBetting == '100') return false
  99. _this.$store.dispatch("ISBETTING",'100')
  100. }
  101. );
  102. if (this.$store.getters.getLimit * 1 >= 10) return false;
  103. },
  104. //获取玩法id
  105. getBettingId(data) {
  106. if (data) {
  107. data.forEach((res, index) => {
  108. if (res.title == this.title) {
  109. this.betting = res.data;
  110. this.dataNum = index;
  111. }
  112. });
  113. }
  114. },
  115. //子玩法分类
  116. removeHeavy(data){
  117. this.data = [];
  118. data.forEach(e=>{
  119. let index = e.odds_code.lastIndexOf('_');
  120. let str= e.odds_code.slice(0,index)
  121. //console.log(e.odds_code);
  122. if('total_sizes' == str){
  123. this.isDisplay = true;
  124. this.data.push(e)
  125. }
  126. })
  127. },
  128. },
  129. computed: {
  130. getUserIcons() {
  131. return this.$store.getters.getGameRatio;
  132. },
  133. getBetting() {
  134. return this.$store.getters.getBetting;
  135. },
  136. //获取投注框删除的投注信息
  137. getDeleteType() {
  138. // console.log(this.$store.getters.getDeleteType)
  139. return this.$store.getters.getDeleteType;
  140. }
  141. },
  142. watch: {
  143. getUserIcons(val) {
  144. this.match_id = val.match_id;
  145. if (!val) return false;
  146. this.home_team = val.home_team;
  147. this.guest_team = val.guest_team;
  148. // 联赛id
  149. this.lg_id=val.lg_id;
  150. val.oddsData.forEach(res => {
  151. if (res[0].p_code == this.title) {
  152. this.removeHeavy(res);
  153. }
  154. });
  155. this.getBettingId(this.$store.getters.getBetting);
  156. if (this.dataNum != 10000) {
  157. this.betting.forEach(res => {
  158. this.data.forEach((e, index) => {
  159. if (res.id == e.id) {
  160. this.$set(e, "isTrue", true);
  161. }
  162. });
  163. });
  164. }
  165. },
  166. //获取已投注信息
  167. getBetting(val) {
  168. let _this = this;
  169. //投注框数据发生变法,初始化组件页面渲染和数据;
  170. this.$public.getBettingId(val, this.title, function(data, index) {
  171. _this.betting = data;
  172. _this.dataNum = index;
  173. });
  174. },
  175. //监听投注框删除处理
  176. getDeleteType(val) {
  177. this.data.forEach(e => {
  178. if (val == "all") {
  179. this.$set(e, "isTrue", false);
  180. } else {
  181. if (e.id == val) {
  182. this.$set(e, "isTrue", false);
  183. }
  184. }
  185. });
  186. }
  187. }
  188. };
  189. </script>
  190. <style scoped>
  191. div /deep/ .yd-accordion-head-arrow:after {
  192. border: none;
  193. width: 0.5rem;
  194. height: 0.5rem;
  195. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  196. background-size: 100% 100%;
  197. }
  198. div /deep/ .yd-accordion-title {
  199. height: 0.88rem;
  200. font-size: 0.28rem;
  201. color: #fefefe;
  202. }
  203. div /deep/ .yd-accordion-head {
  204. padding: 0 0.32rem;
  205. background: #a0a0a0;
  206. }
  207. .rowBox {
  208. padding: 0 0.32rem;
  209. background: #f0f0f0;
  210. border-bottom: 1px solid #e4e4e4;
  211. }
  212. .width-box {
  213. width: 50%;
  214. }
  215. .right-box {
  216. padding-right: 0.32rem;
  217. padding-left: 0.2rem;
  218. border-bottom: 1px solid #e4e4e4;
  219. }
  220. .left-box {
  221. padding-left: 0.32rem;
  222. border-bottom: 1px solid #e4e4e4;
  223. }
  224. .btn-box {
  225. width: 1.07rem;
  226. height: 0.76rem;
  227. font-size: 0.24rem;
  228. padding: 0.1rem;
  229. border: 2px solid #cecece;
  230. border-radius: 0.1rem;
  231. margin: 0.1rem;
  232. }
  233. .borderBottom{
  234. border-bottom: 1px solid #e4e4e4
  235. }
  236. .active {
  237. background: #f76649;
  238. padding: 0.1rem;
  239. border: 2px solid #f76649;
  240. }
  241. .active span{
  242. color: #f4f4f4 !important;
  243. }
  244. .spanCol{
  245. color: #f76649;
  246. }
  247. </style>