27222f5bf9838d0a4a3a450d18e26281a48a6e51.svn-base 10.0 KB

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