12b49f3f733c26dc35662743344c5a58cafe88d1.svn-base 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div>
  3. <div v-if="isDisplay">
  4. <!-- 主队 -->
  5. <yd-accordion>
  6. <yd-accordion-item class="Match-game" :title="total_title" open>
  7. <div class="row allAlignment center rowBox" >
  8. <div class="column width-box " style="border-right: 1px solid #e4e4e4">
  9. <div v-if="item.odds_code.endsWith('big')" v-for=" (item,index) in data" class="row allAlignment center ">
  10. <span>大</span>
  11. <div v-if="item.odds >0" class="column center btn-box"
  12. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  13. @click="bettingBtn(item.id,'大',item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code)"
  14. >
  15. <span class="spanCol" v-if="item.condition">{{ item.condition }}</span>
  16. <span>{{ item.odds }}</span>
  17. </div>
  18. <div v-else class="btn-box column center">
  19. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="column width-box ">
  24. <div v-if="item.odds_code.endsWith('small')" v-for=" (item,index) in data" class="row allAlignment center ">
  25. <span style="padding-left: 0.2rem;">小</span>
  26. <div v-if="item.odds >0" class="column center btn-box"
  27. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  28. @click="bettingBtn(item.id,'小',item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code)"
  29. >
  30. <span class="spanCol" v-if="item.condition">{{ item.condition }}</span>
  31. <span>{{ item.odds }}</span>
  32. </div>
  33. <div v-else class="btn-box column center">
  34. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  35. </div>
  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: "total_size",
  50. isDisplay: false,
  51. home_team: "",
  52. guest_team: "",
  53. total_title:'总得分:大/小-上半场',
  54. data: [],
  55. lg_id: "",
  56. match_id: "",
  57. betting: [], //已投注倍率id集合
  58. dataNum: 10000 //对应的数据的下标
  59. };
  60. },
  61. methods: {
  62. bettingBtn(id,name,odds,odds_only,p_code,match_id,condition,odds_code,bettingTime = "") {
  63. let _this = this;
  64. let bettingInfo = {
  65. id,
  66. home_team: this.home_team,
  67. guest_team: this.guest_team,
  68. name,
  69. odds,
  70. p_code,
  71. ballId: this.$store.getters.getBallId,
  72. match_id,
  73. condition,
  74. odds_code: this.title,
  75. score: this.score,
  76. bettingTime,
  77. odds_only,
  78. play_name:this.total_title,
  79. lg_id: this.lg_id,
  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. if("half_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: 1px solid #cecece;
  230. border-radius: 0.1rem;
  231. margin: 0.1rem;
  232. }
  233. .active {
  234. background: #f76649;
  235. padding: 0.1rem;
  236. border: 1px solid #f76649;
  237. }
  238. .active span{
  239. color: #f4f4f4 !important;
  240. }
  241. .spanCol{
  242. color: #f76649;
  243. }
  244. </style>