1466489239e47478d41968033cf63053ad8e47f7.svn-base 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <div>
  3. <div v-if="isDisplay">
  4. <div v-if="obj.a">
  5. <yd-accordion>
  6. <yd-accordion-item title="让球" open>
  7. <div v-for="(item,index) in data" :accordion="true" :key="index">
  8. <div v-if="item.odds_code == 'concede_home' || item.odds_code == 'concede_guest'">
  9. <div style="padding:0 0.32rem;" class="odds">
  10. <div class="row allAlignment center small">
  11. <span>{{item.odds_code =='concede_home' ? home_team :guest_team}}</span>
  12. <div v-if="item.odds >0" class="ratio column center"
  13. @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球')"
  14. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
  15. >
  16. <span class="score">{{item.condition}}</span>
  17. <span>{{item.odds}}</span>
  18. </div>
  19. <div v-else class="ratio column center">
  20. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </yd-accordion-item>
  27. </yd-accordion>
  28. </div>
  29. <div v-if="obj.b">
  30. <yd-accordion>
  31. <yd-accordion-item title="让球-上半场" open>
  32. <div v-for="(item,index) in data" :accordion="true" :key="index">
  33. <div v-if="item.odds_code.startsWith('half') ">
  34. <div style="padding:0 0.32rem;" class="odds">
  35. <div class="row allAlignment center small">
  36. <span>{{item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
  37. <div v-if="item.odds >0" class="ratio column center"
  38. @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-上半场')"
  39. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
  40. >
  41. <span class="score">{{item.condition}}</span>
  42. <span>{{item.odds}}</span>
  43. </div>
  44. <div v-else class="ratio column center">
  45. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </yd-accordion-item>
  52. </yd-accordion>
  53. </div>
  54. <div v-if="obj.c">
  55. <yd-accordion>
  56. <yd-accordion-item title="让球-第一节" open>
  57. <div v-for="(item,index) in data" :accordion="true" :key="index">
  58. <div v-if="item.odds_code.startsWith('one')">
  59. <div style="padding:0 0.32rem;" class="odds">
  60. <div class="row allAlignment center small">
  61. <span>{{item.odds_code.endsWith('home')? home_team :guest_team}}</span>
  62. <div v-if="item.odds >0" class="ratio column center"
  63. @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-第一节')"
  64. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
  65. >
  66. <span class="score">{{item.condition}}</span>
  67. <span>{{item.odds}}</span>
  68. </div>
  69. <div v-else class="ratio column center">
  70. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </yd-accordion-item>
  77. </yd-accordion>
  78. </div>
  79. <div v-if="obj.d">
  80. <yd-accordion>
  81. <yd-accordion-item title="让球-第二节" open>
  82. <div v-for="(item,index) in data" :accordion="true" :key="index">
  83. <div v-if="item.odds_code.startsWith('two')">
  84. <div style="padding:0 0.32rem;" class="odds">
  85. <div class="row allAlignment center small">
  86. <span>{{item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
  87. <div v-if="item.odds >0" class="ratio column center"
  88. @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-第二节')"
  89. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
  90. >
  91. <span class="score">{{item.condition}}</span>
  92. <span>{{item.odds}}</span>
  93. </div>
  94. <div v-else class="ratio column center">
  95. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </yd-accordion-item>
  102. </yd-accordion>
  103. </div>
  104. <div v-if="obj.e">
  105. <yd-accordion>
  106. <yd-accordion-item title="让球-第三节" open>
  107. <div v-for="(item,index) in data" :accordion="true" :key="index">
  108. <div v-if="item.odds_code.startsWith('three')">
  109. <div style="padding:0 0.32rem;" class="odds">
  110. <div class="row allAlignment center small">
  111. <span>{{ item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
  112. <div v-if="item.odds >0" class="ratio column center"
  113. @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-第三节')"
  114. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
  115. >
  116. <span class="score">{{item.condition}}</span>
  117. <span>{{item.odds}}</span>
  118. </div>
  119. <div v-else class="ratio column center">
  120. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </yd-accordion-item>
  127. </yd-accordion>
  128. </div>
  129. <div v-if="obj.f">
  130. <yd-accordion>
  131. <yd-accordion-item title="让球-第四节" open>
  132. <div v-for="(item,index) in data" :accordion="true" :key="index">
  133. <div v-if="item.odds_code.startsWith('four')">
  134. <div style="padding:0 0.32rem;" class="odds">
  135. <div class="row allAlignment center small">
  136. <span>{{ item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
  137. <div v-if="item.odds >0" class="ratio column center"
  138. @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-第四节')"
  139. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
  140. >
  141. <span class="score">{{item.condition}}</span>
  142. <span>{{item.odds}}</span>
  143. </div>
  144. <div v-else class="ratio column center">
  145. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. </yd-accordion-item>
  152. </yd-accordion>
  153. </div>
  154. <div v-if="obj.g">
  155. <yd-accordion>
  156. <yd-accordion-item title="让球-前五局" open>
  157. <div v-for="(item,index) in data" :accordion="true" :key="index">
  158. <div v-if="item.odds_code.startsWith('five')">
  159. <div style="padding:0 0.32rem;" class="odds">
  160. <div class="row allAlignment center small">
  161. <span>{{ item.odds_code.endsWith('home') ? home_team :guest_team}}</span>
  162. <div v-if="item.odds >0" class="ratio column center"
  163. @click="bettingBtn(item.id,item.odds_code.endsWith('home') ? home_team :guest_team,item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,'让球-前五局')"
  164. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color: item.change == 'red'} "
  165. >
  166. <span class="score">{{item.condition}}</span>
  167. <span>{{item.odds}}</span>
  168. </div>
  169. <div v-else class="ratio column center">
  170. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. </yd-accordion-item>
  177. </yd-accordion>
  178. </div>
  179. </div>
  180. </div>
  181. </template>
  182. <script>
  183. // import BettingWindow from "@/components/StBettingWindow";
  184. export default {
  185. data() {
  186. return {
  187. title: "concede",
  188. isDisplay: false,
  189. home_team: "",
  190. guest_team: "",
  191. data: [],
  192. obj:'',//
  193. lg_id:'',
  194. match_id: "",
  195. betting: [], //已投注倍率id集合
  196. dataNum: 10000 //对应的数据的下标
  197. };
  198. },
  199. methods: {
  200. //玩法投注
  201. bettingBtn(id,name,odds,odds_only,p_code,match_id,condition,odds_code,play_name,bettingTime = "") {
  202. let _this = this;
  203. let bettingInfo = {
  204. id,
  205. home_team: this.home_team,
  206. guest_team: this.guest_team,
  207. name,
  208. odds,
  209. p_code,
  210. ballId: this.$store.getters.getBallId,
  211. match_id,
  212. condition,
  213. odds_code: odds_code,
  214. score: this.score,
  215. bettingTime,
  216. odds_only,
  217. play_name,
  218. odds_id:id,
  219. lg_id:this.lg_id,
  220. };
  221. // if(this.$store.getters.getLimit * 1 >= 10){
  222. // this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  223. // }
  224. // if (isAdd) {
  225. //调用玩法投注公共方法
  226. this.$public.bettingFunction(
  227. this.betting,
  228. bettingInfo,
  229. this.data,
  230. this.$store.getters.getBetting,
  231. this.title,
  232. this.dataNum,
  233. this.$store.getters.getLimit,
  234. function(res, type) {
  235. _this.$set(res, "isTrue", type);
  236. },
  237. function(data, val,type) {
  238. //console.log(data, val,type);
  239. if(type) {
  240. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  241. }
  242. _this.$store.dispatch("BETTING", []);
  243. _this.$store.dispatch("BETTING", data ? data : val);
  244. if(_this.$store.getters.getIsBetting == '100') return false
  245. _this.$store.dispatch("ISBETTING",'100')
  246. }
  247. );
  248. // }
  249. if (this.$store.getters.getLimit * 1 >= 10) return false;
  250. },
  251. //获取玩法id
  252. getBettingId(data) {
  253. if (data) {
  254. data.forEach((res, index) => {
  255. if (res.title == this.title) {
  256. this.betting = res.data;
  257. this.dataNum = index;
  258. }
  259. });
  260. }
  261. },
  262. /*-------------------------------*/
  263. //获取子玩法分类
  264. getChildPlay(data){
  265. let obj ={};
  266. data.forEach(e=>{
  267. if(e.odds_code.startsWith('concede')){
  268. obj.a =true;
  269. }else if(e.odds_code.startsWith('half')){
  270. obj.b =true;
  271. }else if(e.odds_code.startsWith('one')){
  272. obj.c =true;
  273. }else if(e.odds_code.startsWith('two')){
  274. obj.d =true;
  275. }else if(e.odds_code.startsWith('three')){
  276. obj.e =true;
  277. }else if(e.odds_code.startsWith('four')){
  278. obj.f =true;
  279. }else if(e.odds_code.startsWith('five')){
  280. obj.g =true;
  281. }
  282. this.obj = obj
  283. })
  284. },
  285. },
  286. /**
  287. * 计算属性
  288. */
  289. computed: {
  290. getUserIcons() {
  291. return this.$store.getters.getGameRatio;
  292. },
  293. getBetting() {
  294. return this.$store.getters.getBetting;
  295. },
  296. //获取投注框删除的投注信息
  297. getDeleteType() {
  298. return this.$store.getters.getDeleteType;
  299. }
  300. },
  301. /**
  302. * 监听器
  303. */
  304. watch: {
  305. getUserIcons(val) {
  306. this.match_id = val.match_id;
  307. if (!val) return false;
  308. this.home_team = val.home_team;
  309. this.guest_team = val.guest_team;
  310. // 联赛id
  311. this.lg_id=val.lg_id;
  312. val.oddsData.forEach(res => {
  313. if (res[0].p_code == this.title) {
  314. //console.log("更新数据", res);
  315. this.isDisplay = true;
  316. this.data = res;
  317. this.getChildPlay(res);
  318. }
  319. });
  320. this.getBettingId(this.$store.getters.getBetting);
  321. if (this.dataNum != 10000) {
  322. this.betting.forEach(res => {
  323. this.data.forEach((e, index) => {
  324. if (res.id == e.id) {
  325. this.$set(e, "isTrue", true);
  326. }
  327. });
  328. });
  329. }
  330. },
  331. //获取已投注信息
  332. getBetting(val) {
  333. let _this = this;
  334. //投注框数据发生变法,初始化组件页面渲染和数据;
  335. this.$public.getBettingId(val, this.title, function(data, index) {
  336. _this.betting = data;
  337. _this.dataNum = index;
  338. });
  339. },
  340. //监听投注框删除处理
  341. getDeleteType(val) {
  342. this.data.forEach(e => {
  343. if (val == "all") {
  344. this.$set(e, "isTrue", false);
  345. } else {
  346. if (e.id == val) {
  347. this.$set(e, "isTrue", false);
  348. }
  349. }
  350. });
  351. }
  352. }
  353. // component:{BettingWindow},
  354. };
  355. </script>
  356. <style scoped>
  357. div /deep/ .yd-accordion-head {
  358. padding: 0 0.32rem;
  359. background: #a0a0a0;
  360. }
  361. div /deep/ .yd-accordion-title {
  362. color: #fefefe;
  363. font-size: 0.28rem;
  364. }
  365. div /deep/ .yd-accordion-head-arrow:after {
  366. border: none;
  367. width: 0.5rem;
  368. height: 0.5rem;
  369. background: url("../assets/st-imges/xiangxia.png") no-repeat;
  370. background-size: 100% 100%;
  371. }
  372. .small {
  373. font-size: 0.26rem;
  374. border-bottom: 1px solid #e4e4e4;
  375. padding-left: 0.16rem;
  376. }
  377. .odds {
  378. background: #f4f4f4;
  379. text-align: left;
  380. }
  381. .ratio {
  382. width: 1.07rem;
  383. height: 0.76rem;
  384. border: 1px solid #cecece;
  385. margin-right: 0.14rem;
  386. border-radius: 0.1rem;
  387. margin: 0.06rem;
  388. }
  389. .score {
  390. color: #f76649;
  391. }
  392. .col {
  393. background: #f76649;
  394. border: 2px solid #f76649 !important;
  395. }
  396. .col span {
  397. color: #f4f4f4 !important;
  398. }
  399. </style>