544da78f93a495626cef233d6908c5151c437a7d.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <!--
  2. * @Description: In User Settings Edit
  3. * @Author: your name
  4. * @Date: 2019-08-26 10:58:22
  5. * @LastEditTime: 2019-08-27 15:30:40
  6. * @LastEditors: Please set LastEditors
  7. -->
  8. <template>
  9. <div>
  10. <!-- //v-for="(item,index) in data" -->
  11. <div v-if="isDisplay">
  12. <yd-accordion>
  13. <yd-accordion-item title="波胆" open>
  14. <div>
  15. <div class="rulesName row average">
  16. <div class="row item-center">{{home_team}}</div>
  17. <div class="row item-center">和局</div>
  18. <div class="row item-center">{{guest_team}}</div>
  19. </div>
  20. <div class="row grids average">
  21. <div class="column">
  22. <div class="gridsDiv row center" v-for="(item,index) in data.home " :key="item.id" v-if="data.home" >
  23. <div v-if="item.odds >0" class="column average minGrid"
  24. :class=" {trueSelected:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  25. @click="btnChoose(item,'波胆')" >
  26. <span style="color:#f76649 ">{{item.condition}}</span>
  27. <span>{{item.odds}}</span>
  28. </div>
  29. <div v-else class="minGrid column center">
  30. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="column middle">
  35. <div class="gridsDiv row center" v-for="(item,index) in data.arr " :key="item.id" v-if="data.arr" >
  36. <div v-if="item.odds >0" class="column average minGrid"
  37. :class="{trueSelected:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  38. @click="btnChoose(item,'波胆')" >
  39. <span style="color:#f76649 ">{{item.condition}}</span>
  40. <span>{{item.odds}}</span>
  41. </div>
  42. <div v-else class="minGrid column center">
  43. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="column">
  48. <div class="gridsDiv row center" v-for="(item,index) in data.goust " :key="item.id" v-if="data.goust" >
  49. <div v-if="item.odds >0" class="column average minGrid"
  50. :class="{trueSelected:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  51. @click="btnChoose(item,'波胆')" >
  52. <span style="color:#f76649 ">{{item.condition}}</span>
  53. <span>{{item.odds}}</span>
  54. </div>
  55. <div v-else class="minGrid column center">
  56. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <div style="background:#f8f8f8;">
  62. <div class="row rightAlignment center" style="height: 0.88rem;" v-for="(item,index) in data.other" :key="item.id" v-if="item.odds_code == 'bo'">
  63. <span>其他比分:</span>
  64. <div v-if="item.odds >0" class="minGrid minGridAll" :class=" item.isTrue ? 'trueSelected' :''" @click="btnChoose(item,'波胆')" >
  65. {{item.odds}}
  66. </div>
  67. <div v-else class="minGrid minGridAll">
  68. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </yd-accordion-item>
  74. </yd-accordion>
  75. <yd-accordion>
  76. <yd-accordion-item title="波胆-上半场" open>
  77. <div>
  78. <div class="rulesName row average">
  79. <div class="row item-center">{{home_team}}</div>
  80. <div class="row item-center">和局</div>
  81. <div class="row item-center">{{guest_team}}</div>
  82. </div>
  83. <div class="row grids average">
  84. <div class="column">
  85. <div class="gridsDiv row center" v-for="(item,index) in data.home_h " :key="item.id" v-if="data.home_h" >
  86. <div v-if="item.odds >0" class="column average minGrid" :class="{trueSelected:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  87. @click="btnChoose(item,'波胆-上半场')">
  88. <span style="color:#f76649 ">{{item.condition}}</span>
  89. <span>{{item.odds}}</span>
  90. </div>
  91. <div v-else class="minGrid column center">
  92. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="column middle">
  97. <div class="gridsDiv row center" v-for="(item,index) in data.arr_h " :key="item.id" v-if="data.arr_h" >
  98. <div v-if="item.odds >0" class="column average minGrid" :class="{trueSelected:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'} "
  99. @click="btnChoose(item,'波胆-上半场')">
  100. <span style="color:#f76649">{{item.condition}}</span>
  101. <span>{{item.odds}}</span>
  102. </div>
  103. <div v-else class="minGrid column center">
  104. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="column">
  109. <div class="gridsDiv row center" v-for="(item,index) in data.goust_h " :key="item.id" v-if="data.goust_h">
  110. <div v-if="item.odds >0" class="column average minGrid"
  111. :class="{trueSelected:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  112. @click="btnChoose(item,'波胆-上半场')" >
  113. <span style="color:#f76649">{{item.condition}}</span>
  114. <span>{{item.odds}}</span>
  115. </div>
  116. <div v-else class="minGrid column center">
  117. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. <div style="background:#f8f8f8;">
  123. <div class="row rightAlignment center" style="height: 0.88rem;" v-for="(item,index) in data.other " :key="item.id" v-if="item.odds_code.startsWith('bo_h')" >
  124. <span>其他比分:</span>
  125. <div v-if="item.odds >0" class="minGrid minGridAll" :class="item.isTrue ? 'trueSelected' :'' " @click="btnChoose(item,'波胆-上半场')"
  126. >{{item.odds}}</div>
  127. <div v-else class="minGrid minGridAll">
  128. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </yd-accordion-item>
  134. </yd-accordion>
  135. </div>
  136. </div>
  137. </template>
  138. <script>
  139. import "../css/index.css";
  140. import Vue from "vue";
  141. import { Accordion, AccordionItem } from "vue-ydui/dist/lib.rem/accordion";
  142. Vue.component(Accordion.name, Accordion);
  143. Vue.component(AccordionItem.name, AccordionItem);
  144. export default {
  145. name: "WaveBladder",
  146. data() {
  147. return {
  148. title: "B",
  149. home_team: "",
  150. guest_team: "",
  151. isDisplay: false,
  152. data:{},
  153. match_id:'',
  154. lg_id:'',
  155. betting: [], //已投注倍率id集合
  156. dataNum: 10000 //对应的数据的下标
  157. };
  158. },
  159. methods: {
  160. /*---------------------------------------------------- */
  161. //玩法投注
  162. //item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'波胆',item.condition,item.oddsType
  163. //btnChoose: function(id,name,odds,odds_only,p_code,match_id,odds_code,play_name,condition='',oddsType,bettingTime='') {
  164. btnChoose: function(item,name) {
  165. let _this = this;
  166. let bettingInfo = {
  167. id :item.id,
  168. home_team:this.home_team,
  169. guest_team:this.guest_team,
  170. name:'',
  171. odds:item.odds,
  172. condition:item.condition,
  173. odds_code:item.odds_code,
  174. bettingTime:'',
  175. odds_only:item.odds_only,
  176. odds_id:item.id,
  177. score:this.score,
  178. lg_id:this.lg_id,
  179. ballId:this.$store.getters.getBallId,
  180. play_name:name,
  181. p_code:item.p_code,
  182. match_id:this.match_id,
  183. oddsType:item.oddsType,
  184. }
  185. // console.log(bettingInfo);
  186. // return false;
  187. let dataList = [];
  188. //重组数组
  189. dataList = dataList.concat(this.data.home).concat(this.data.home_h).concat(this.data.goust).concat(this.data.arr).concat(this.data.arr_h).concat(this.data.goust_h).concat(this.data.other)
  190. //调用玩法投注公共方法
  191. this.$public.bettingFunction(
  192. this.betting,
  193. bettingInfo,
  194. dataList,
  195. this.$store.getters.getBetting,
  196. this.title,
  197. this.dataNum,
  198. this.$store.getters.getLimit,
  199. function(res, type) {
  200. _this.$set(res, "isTrue", type);
  201. },
  202. function(data, val,type) {
  203. if(type) {
  204. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  205. }
  206. _this.$store.dispatch("BETTING", []);
  207. _this.$store.dispatch("BETTING", data ? data : val);
  208. if(_this.$store.getters.getIsBetting == '100') return false
  209. _this.$store.dispatch("ISBETTING",'100')
  210. }
  211. );
  212. },
  213. //数据排序处理
  214. dataSorting(data){
  215. let arr = [],home = [],goust = [],other = [],arr_h = [],home_h = [],goust_h = [];
  216. data.forEach((res, i) => {
  217. let odds_code = res.odds_code;
  218. if (odds_code.startsWith("bo") == true || odds_code.startsWith("bo_h") == true) {
  219. other.push(res);
  220. }else{
  221. if (odds_code[1] - odds_code[2] < 0 && res.odds_code.endsWith("h") != true) {
  222. //客队排序
  223. goust.push(res);
  224. goust.sort((a, z) => {
  225. let str1 = a.condition.split("-");
  226. let str2 = z.condition.split("-");
  227. if (str1[1] - str2[1] != 0) {
  228. return str1[1] - str2[1];
  229. } else {
  230. return str1[0] - str2[0];
  231. }
  232. });
  233. } else if(odds_code[1] - odds_code[2] < 0 == true && res.odds_code.endsWith("h") == true){
  234. goust_h.push(res);
  235. //客队排序半场
  236. goust_h.sort((a, z) => {
  237. let str1 = a.condition.split("-");
  238. let str2 = z.condition.split("-");
  239. if (str1[1] - str2[1] != 0) {
  240. return str1[1] - str2[1];
  241. } else {
  242. return str1[0] - str2[0];
  243. }
  244. });
  245. }else if (odds_code[1] - odds_code[2] > 0 && res.odds_code.endsWith("h") != true ) {
  246. home.push(res);
  247. // 主队排序
  248. home.sort((a, z) => {
  249. let str1 = a.condition.split("-");
  250. let str2 = z.condition.split("-");
  251. if (str1[0] - str2[0] != 0) {
  252. return str1[0] - str2[0];
  253. } else {
  254. return str1[1] - str2[1];
  255. }
  256. });
  257. }else if(odds_code[1] - odds_code[2] > 0 && res.odds_code.endsWith("h") == true){
  258. home_h.push(res);
  259. // 主队排序半场
  260. home_h.sort((a, z) => {
  261. let str1 = a.condition.split("-");
  262. let str2 = z.condition.split("-");
  263. if (str1[0] - str2[0] != 0) {
  264. return str1[0] - str2[0];
  265. } else {
  266. return str1[1] - str2[1];
  267. }
  268. });
  269. }else if (odds_code[1] - odds_code[2] == 0 && res.odds_code.endsWith("h") != true) {
  270. arr.push(res);
  271. // 和排序
  272. arr.sort((a, z) => {
  273. let str1 = a.condition.split("-");
  274. let str2 = z.condition.split("-");
  275. return str1[0] - str2[0];
  276. });
  277. }else if (odds_code[1] - odds_code[2] == 0 && res.odds_code.endsWith("h") == true) {
  278. arr_h.push(res);
  279. // 和排序半场
  280. arr_h.sort((a, z) => {
  281. let str1 = a.condition.split("-");
  282. let str2 = z.condition.split("-");
  283. return str1[0] - str2[0];
  284. });
  285. }
  286. }
  287. });
  288. this.data= {home_h,home, goust,goust_h,arr,arr_h,other} //[...home, ...goust, ...arr, ...other];
  289. },
  290. //编辑数据
  291. loopEditor(data,val){
  292. if(data){
  293. data.forEach(e =>{
  294. if(val =='all'){
  295. this.$set(e, "isTrue", false);
  296. }else{
  297. if(e.id == val){
  298. this.$set(e, "isTrue", false);
  299. }
  300. }
  301. })
  302. }
  303. },
  304. //for编辑处理
  305. getisTrue(id){
  306. for(let i = 0 ;i < this.data.home.length ; i++){
  307. if (this.data.home[i].id == id) {
  308. this.$set(this.data.home[i], "isTrue", true);
  309. return false
  310. }
  311. }
  312. for(let i = 0 ;i < this.data.home_h.length ; i++){
  313. if (this.data.home_h[i].id == id) {
  314. this.$set(this.data.home_h[i], "isTrue", true);
  315. return false
  316. }
  317. }
  318. for(let i = 0 ;i < this.data.goust.length ; i++){
  319. if (this.data.goust[i].id == id) {
  320. this.$set(this.data.goust[i], "isTrue", true);
  321. return false
  322. }
  323. }
  324. for(let i = 0 ;i < this.data.goust_h.length ; i++){
  325. if (this.data.goust_h[i].id == id) {
  326. this.$set(this.data.goust_h[i], "isTrue", true);
  327. return false
  328. }
  329. }
  330. for(let i = 0 ;i < this.data.arr.length ; i++){
  331. if (this.data.arr[i].id == id) {
  332. this.$set(this.data.arr[i], "isTrue", true);
  333. return false
  334. }
  335. }
  336. for(let i = 0 ;i < this.data.arr_h.length ; i++){
  337. if (this.data.arr_h[i].id == id) {
  338. this.$set(this.data.arr_h[i], "isTrue", true);
  339. return false
  340. }
  341. }
  342. for(let i = 0 ;i < this.data.other.length ; i++){
  343. if (this.data.other[i].id == id) {
  344. this.$set(this.data.other[i], "isTrue", true);
  345. return false
  346. }
  347. }
  348. }
  349. },
  350. computed: {
  351. getUserIcons() {
  352. return this.$store.getters.getGameRatio;
  353. },
  354. getBetting() {
  355. return this.$store.getters.getBetting;
  356. },
  357. //获取投注框删除的投注信息
  358. getDeleteType(){
  359. return this.$store.getters.getDeleteType;
  360. },
  361. },
  362. watch: {
  363. getUserIcons(val) {
  364. this.match_id=val.match_id
  365. if (!val) return false;
  366. this.home_team = val.home_team;
  367. this.guest_team = val.guest_team;
  368. this.lg_id=val.lg_id;
  369. val.oddsData.forEach(res => {
  370. if (res[0].p_code == this.title) {
  371. this.isDisplay = true;
  372. //console.log(res);
  373. this.dataSorting(res);
  374. //this.data = res;
  375. }
  376. });
  377. let _this =this;
  378. this.$public.getBettingId(this.$store.getters.getBetting,this.title,function(data,index){
  379. _this.betting = data;
  380. _this.dataNum = index;
  381. });
  382. if (this.dataNum != 10000) {
  383. this.betting.forEach(res => {
  384. this.getisTrue(res.id)
  385. });
  386. }
  387. },
  388. //获取已投注信息
  389. getBetting(val) {
  390. let _this =this;
  391. this.$public.getBettingId(this.$store.getters.getBetting,this.title,function(data,index){
  392. _this.betting = data;
  393. _this.dataNum = index;
  394. });
  395. },
  396. //监听投注框删除处理
  397. getDeleteType(val){
  398. this.loopEditor(this.data.home,val);
  399. this.loopEditor(this.data.goust,val);
  400. this.loopEditor(this.data.other,val);
  401. this.loopEditor(this.data.arr,val);
  402. this.loopEditor(this.data.arr_h,val);
  403. this.loopEditor(this.data.home_h,val);
  404. this.loopEditor(this.data.goust_h,val);
  405. }
  406. }
  407. };
  408. </script>
  409. <style scoped>
  410. div /deep/ .yd-accordion-head {
  411. padding: 0 0.32rem;
  412. background: #a0a0a0;
  413. }
  414. div /deep/ .yd-accordion-head:after{
  415. height: 0;
  416. }
  417. div /deep/ .yd-accordion-title {
  418. color: #FEFEFE;
  419. font-size: 0.28rem;
  420. }
  421. div /deep/ .yd-accordion-head-arrow:after {
  422. border: none;
  423. width: 0.5rem;
  424. height: 0.5rem;
  425. background: url("../assets/st-imges/xiangxia.png") no-repeat;
  426. background-size: 100% 100%;
  427. }
  428. .grids{
  429. width: 100%;
  430. }
  431. .grids div {
  432. background: #f4f4f4;
  433. }
  434. .trueSelected{
  435. color: #f4f4f4 !important
  436. }
  437. .middle {
  438. border-left: 1px solid #e4e4e4;
  439. border-right: 1px solid #e4e4e4;
  440. }
  441. .rulesName {
  442. font-size: 0.26rem;
  443. background: #bcbcbc;
  444. color: #333;
  445. }
  446. div /deep/ .yd-accordion-content:after{
  447. height: 0;
  448. }
  449. .gridsDiv,
  450. .rulesName div {
  451. border-bottom: 1px solid #e4e4e4;
  452. height: 0.88rem;
  453. justify-content: center;
  454. width: 2.49rem;
  455. }
  456. .minGrid {
  457. width: 1.07rem;
  458. height: 0.76rem;
  459. font-size: 0.24rem;
  460. text-align: center;
  461. border: 1px solid #cecece;
  462. border-radius: 0.1rem;
  463. }
  464. .minGrid span {
  465. font-size: 0.24rem;
  466. padding: 0.08rem 0;
  467. line-height: 0;
  468. }
  469. .minGridAll {
  470. margin-right: 0.69rem;
  471. line-height: 0.76rem;
  472. text-align: center;
  473. }
  474. .trueSelected {
  475. background: #f76649 !important;
  476. border: 2px solid #f76649;
  477. }
  478. .trueSelected span {
  479. color: #f4f4f4 !important;
  480. }
  481. </style>