fc34a2101c3dbc02071e36448258264f403b5d96.svn-base 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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,item.oddsType)"
  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,item.oddsType)"
  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,oddsType,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. oddsType
  80. };
  81. //调用玩法投注公共方法
  82. this.$public.bettingFunction(
  83. this.betting,
  84. bettingInfo,
  85. this.data,
  86. this.$store.getters.getBetting,
  87. this.title,
  88. this.dataNum,
  89. this.$store.getters.getLimit,
  90. function(res, type) {
  91. _this.$set(res, "isTrue", type);
  92. },
  93. function(data, val,type) {
  94. if(type) {
  95. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  96. }
  97. _this.$store.dispatch("BETTING", []);
  98. _this.$store.dispatch("BETTING", data ? data : val);
  99. if(_this.$store.getters.getIsBetting == '100') return false
  100. _this.$store.dispatch("ISBETTING",'100')
  101. }
  102. );
  103. if (this.$store.getters.getLimit * 1 >= 10) return false;
  104. },
  105. //获取玩法id
  106. getBettingId(data) {
  107. if (data) {
  108. data.forEach((res, index) => {
  109. if (res.title == this.title) {
  110. this.betting = res.data;
  111. this.dataNum = index;
  112. }
  113. });
  114. }
  115. },
  116. //子玩法分类
  117. removeHeavy(data){
  118. this.data = [];
  119. data.forEach(e=>{
  120. let index = e.odds_code.lastIndexOf('_');
  121. let str= e.odds_code.slice(0,index)
  122. //console.log(e.odds_code);
  123. if('total_sizes' == str){
  124. this.isDisplay = true;
  125. this.data.push(e)
  126. }
  127. })
  128. },
  129. },
  130. computed: {
  131. getUserIcons() {
  132. return this.$store.getters.getGameRatio;
  133. },
  134. getBetting() {
  135. return this.$store.getters.getBetting;
  136. },
  137. //获取投注框删除的投注信息
  138. getDeleteType() {
  139. // console.log(this.$store.getters.getDeleteType)
  140. return this.$store.getters.getDeleteType;
  141. }
  142. },
  143. watch: {
  144. getUserIcons(val) {
  145. this.match_id = val.match_id;
  146. if (!val) return false;
  147. this.home_team = val.home_team;
  148. this.guest_team = val.guest_team;
  149. // 联赛id
  150. this.lg_id=val.lg_id;
  151. val.oddsData.forEach(res => {
  152. if (res[0].p_code == this.title) {
  153. this.removeHeavy(res);
  154. }
  155. });
  156. this.getBettingId(this.$store.getters.getBetting);
  157. if (this.dataNum != 10000) {
  158. this.betting.forEach(res => {
  159. this.data.forEach((e, index) => {
  160. if (res.id == e.id) {
  161. this.$set(e, "isTrue", true);
  162. }
  163. });
  164. });
  165. }
  166. },
  167. //获取已投注信息
  168. getBetting(val) {
  169. let _this = this;
  170. //投注框数据发生变法,初始化组件页面渲染和数据;
  171. this.$public.getBettingId(val, this.title, function(data, index) {
  172. _this.betting = data;
  173. _this.dataNum = index;
  174. });
  175. },
  176. //监听投注框删除处理
  177. getDeleteType(val) {
  178. this.data.forEach(e => {
  179. if (val == "all") {
  180. this.$set(e, "isTrue", false);
  181. } else {
  182. if (e.id == val) {
  183. this.$set(e, "isTrue", false);
  184. }
  185. }
  186. });
  187. }
  188. }
  189. };
  190. </script>
  191. <style scoped>
  192. div /deep/ .yd-accordion-head-arrow:after {
  193. border: none;
  194. width: 0.5rem;
  195. height: 0.5rem;
  196. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  197. background-size: 100% 100%;
  198. }
  199. div /deep/ .yd-accordion-title {
  200. height: 0.88rem;
  201. font-size: 0.28rem;
  202. color: #fefefe;
  203. }
  204. div /deep/ .yd-accordion-head {
  205. padding: 0 0.32rem;
  206. background: #a0a0a0;
  207. }
  208. .rowBox {
  209. padding: 0 0.32rem;
  210. background: #f0f0f0;
  211. border-bottom: 1px solid #e4e4e4;
  212. }
  213. .width-box {
  214. width: 50%;
  215. }
  216. .right-box {
  217. padding-right: 0.32rem;
  218. padding-left: 0.2rem;
  219. border-bottom: 1px solid #e4e4e4;
  220. }
  221. .left-box {
  222. padding-left: 0.32rem;
  223. border-bottom: 1px solid #e4e4e4;
  224. }
  225. .btn-box {
  226. width: 1.07rem;
  227. height: 0.76rem;
  228. font-size: 0.24rem;
  229. padding: 0.1rem;
  230. border: 2px solid #cecece;
  231. border-radius: 0.1rem;
  232. margin: 0.1rem;
  233. }
  234. .borderBottom{
  235. border-bottom: 1px solid #e4e4e4
  236. }
  237. .active {
  238. background: #f76649;
  239. padding: 0.1rem;
  240. border: 2px solid #f76649;
  241. }
  242. .active span{
  243. color: #f4f4f4 !important;
  244. }
  245. .spanCol{
  246. color: #f76649;
  247. }
  248. </style>