6f06b552a233c07e3819445465bd649392fe3ef6.svn-base 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <div>
  3. <div v-if="isData">
  4. <div v-if="obj.a">
  5. <div class="tit">
  6. <span>波胆</span>
  7. </div>
  8. <div class="playCode">
  9. <div class="tBody flex">
  10. <div style="width:calc(40% - 1px)">{{home_team}}</div>
  11. <div style="width:20%;">和局</div>
  12. <div style="width:calc(40% - 1px)">{{guest_team}}</div>
  13. </div>
  14. <div class="playOdds">
  15. <div class="home flex">
  16. <div class="scoreBox rFlex" v-for="(item,index) in data" v-if="item.odds_code[1]-item.odds_code[2] >0 && !item.odds_code.endsWith('_h')">
  17. <div class="score">{{item.condition}}</div>
  18. <div class="odds" v-if="item.odds > 0" :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}"
  19. @click="betMethod(index,item.id,home_team,'波胆')">{{item.odds}}</div>
  20. </div>
  21. </div>
  22. <div class="and">
  23. <div class="scoreBox rFlex" v-for="(item,index) in data" v-if="item.odds_code[1]-item.odds_code[2] == 0 && !item.odds_code.endsWith('_h')">
  24. <div class="score">{{item.condition}}</div>
  25. <div class="odds" :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}" @click="betMethod(index,item.id,'和局','波胆')">{{item.odds}}</div>
  26. </div>
  27. </div>
  28. <div class="guest">
  29. <div class="scoreBox rFlex" v-for="(item,index) in data" v-if="item.odds_code[1]-item.odds_code[2] < 0 && !item.odds_code.endsWith('_h')">
  30. <div class="score">{{item.condition}}</div>
  31. <div class="odds" :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}" @click="betMethod(index,item.id,guest_team,'波胆')">{{item.odds}}</div>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="tFooter" v-for="(item,index) in data" v-if="item.odds_code =='bo' ">
  36. <span>其它比分</span>
  37. <span class="odds" :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}" @click="betMethod(index,item.id,'','波胆')">{{item.odds}}</span>
  38. </div>
  39. </div>
  40. </div>
  41. <div v-if="obj.b">
  42. <div class="tit">
  43. <span>波胆-上半场</span>
  44. </div>
  45. <div class="playCode">
  46. <div class="tBody flex">
  47. <div style="width:calc(40% - 1px)">{{home_team}}</div>
  48. <div style="width:20%;">和局</div>
  49. <div style="width:calc(40% - 1px)">{{guest_team}}</div>
  50. </div>
  51. <div class="playOdds">
  52. <div class="home row flex wrap topAlignment">
  53. <div class="scoreBox rFlex" v-for="(item,index) in data" v-if="item.odds_code[1]-item.odds_code[2] >0 && item.odds_code.endsWith('_h')">
  54. <div class="score">{{item.condition}}</div>
  55. <div class="odds" :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}" @click="betMethod(index,item.id,home_team,'波胆-上半场')">{{item.odds}}</div>
  56. </div>
  57. <div class="scoreBox rFlex" ></div>
  58. <div class="scoreBox rFlex" ></div>
  59. </div>
  60. <div class="and">
  61. <div class="scoreBox rFlex" v-for="(item,index) in data" v-if="item.odds_code[1]-item.odds_code[2] == 0 && item.odds_code.endsWith('_h')">
  62. <div class="score">{{item.condition}}</div>
  63. <div class="odds" :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}" @click="betMethod(index,item.id,'和局','波胆-上半场')">{{item.odds}}</div>
  64. </div>
  65. </div>
  66. <div class="guest">
  67. <div class="scoreBox rFlex" v-for="(item,index) in data" v-if="item.odds_code[1]-item.odds_code[2] < 0 && item.odds_code.endsWith('_h')">
  68. <div class="score">{{item.condition}}</div>
  69. <div class="odds" :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}" @click="betMethod(index,item.id,guest_team,'波胆-上半场')">{{item.odds}}</div>
  70. </div>
  71. <div class="scoreBox rFlex" ></div>
  72. <div class="scoreBox rFlex" ></div>
  73. </div>
  74. </div>
  75. <div class="tFooter" v-for="(item,index) in data" v-if="item.odds_code == 'bo_h'">
  76. <span>其它比分</span>
  77. <span class="odds" :class="{chooseStyle:item.isTrue,rising:item.change == 'rising',falling:item.change == 'falling'}" @click="betMethod(index,item.id,'','波胆-上半场')">{{item.odds}}</span>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </template>
  84. <script>
  85. export default {
  86. data(){
  87. return{
  88. title:'B',
  89. data:[],//数据源
  90. isData:true,//
  91. guest_team:'',//客队名
  92. home_team:'',//主队名
  93. obj:'',//
  94. match_id:'',
  95. limit:'',//投注数量
  96. lg_id:'',
  97. }
  98. },
  99. /***
  100. * 方法
  101. */
  102. methods:{
  103. //玩法分类
  104. playGrouping(data){
  105. let obj={};
  106. let betting = this.$store.getters.getBetting;
  107. data.forEach(e=>{
  108. if(betting.length > 0){
  109. for(let i= 0; i< betting.length; i++){
  110. if(betting[i].title =="B" && betting[i].data.length >0){
  111. for(let j = 0 ; j < betting[i].data.length ; j++ ){
  112. if(betting[i].data[j].id == e.id){
  113. this.$set(e,'isTrue',true);
  114. //betting[i].data.splice(j,1);
  115. }
  116. }
  117. break;
  118. }
  119. }
  120. }
  121. e.lg_id = this.lg_id;
  122. if(e.odds_code.startsWith('b')){
  123. obj.a= true
  124. }
  125. if(e.odds_code.endsWith('_h')){
  126. obj.b= true;
  127. }
  128. })
  129. this.obj = obj;
  130. },
  131. /*---------------------------------- */
  132. //玩法投注
  133. betMethod(index,id,name,playName){
  134. if(this.data[index].isTrue){
  135. this.$set(this.data[index],'isTrue',false);
  136. }else{
  137. this.$set(this.data[index],'isTrue',true);
  138. }
  139. //调用投注公共方法
  140. let betting = this.$store.getters.getBetting;
  141. let _this = this;
  142. let ballId = this.$store.getters.getBallCode;
  143. let teamName ={
  144. home:this.home_team,
  145. guest:this.guest_team
  146. }
  147. this.$public.publicBetMethod(this.data,this.title,id,index,betting,teamName,playName,name,this.match_id,ballId,this.limit,function(data,type){
  148. if(type){
  149. _this.$dialog.toast({ mes: "亲,超出表格上限啦。", timeout: 2000 });
  150. }
  151. _this.$store.dispatch("SET_BETTING",[]);
  152. _this.$store.dispatch("SET_BETTING",data);
  153. })
  154. }
  155. },
  156. /**
  157. * 计算属性
  158. */
  159. computed: {
  160. getGameRatio(){
  161. return this.$store.getters.getGameRatio
  162. },
  163. //获取投注数据
  164. getBetting(){
  165. return this.$store.getters.getBetting
  166. },
  167. //获取投注数据数量
  168. getLimit(){
  169. return this.$store.getters.getLimit
  170. }
  171. },
  172. /**
  173. * 监听器
  174. */
  175. watch: {
  176. getGameRatio(val){
  177. this.lg_id = val.lg_id
  178. this.match_id = val.match_id
  179. this.guest_team = val.guest_team;
  180. this.home_team = val.home_team
  181. val.oddsData.forEach(e => {
  182. if(e[0].p_code == this.title){
  183. this.data = e;
  184. this.isData = true;
  185. this.playGrouping(this.data );
  186. }
  187. });
  188. //console.log(this.data);
  189. },
  190. //投注数据监听和处理
  191. getBetting(val){
  192. if(val.length > 0){
  193. let id = this.$store.getters.getDeleteType;
  194. for(let i= 0; i < val.length; i++ ){
  195. if(val[i].title == this.title){
  196. for(let j = 0;j < this.data.length ;j++){
  197. if(this.data[j].id == id){
  198. this.$set(this.data[j],'isTrue',false)
  199. break;
  200. }
  201. }
  202. break;
  203. }
  204. }
  205. }else{
  206. for(let j = 0;j < this.data.length ;j++){
  207. if(this.data[j].isTrue){
  208. this.$set(this.data[j],'isTrue',false)
  209. }
  210. }
  211. }
  212. },
  213. //投注数量
  214. getLimit(val){
  215. this.limit = val
  216. }
  217. },
  218. };
  219. </script>
  220. <style scoped>
  221. .flex {
  222. display: flex;
  223. /* justify-content: space-between; */
  224. align-items: center;
  225. flex-direction: row;
  226. flex-wrap: wrap;
  227. }
  228. .rFlex {
  229. display: flex;
  230. justify-content: space-between;
  231. align-items: center;
  232. }
  233. .tit {
  234. background: #cdcdcd;
  235. font-size: 0.14rem;
  236. padding: 0 0.1rem;
  237. height: 0.4rem;
  238. line-height: 0.4rem;
  239. color: #333;
  240. }
  241. .playCode {
  242. background: #fff;
  243. }
  244. .tBody {
  245. font-size: 0.14rem;
  246. text-align: center;
  247. background-color: #e5e5e5;
  248. color: rgb(90, 90, 90);
  249. height: 0.4rem;
  250. }
  251. .home,.guest {
  252. width: 40%;
  253. min-height: 0.4rem;
  254. }
  255. .scoreBox {
  256. width: calc(50% - 1px);
  257. height: 0.4rem;
  258. padding: 0 .1rem;
  259. font-size: .14rem;
  260. border-right: 1px solid #d7d7d7;
  261. border-bottom: 1px solid #d7d7d7;
  262. }
  263. .score {
  264. color: #f76649;
  265. font-weight: bold;
  266. /* text-align: right; */
  267. }
  268. .scoreBox:hover,.tFooter:hover {
  269. background: #fff5e9;
  270. }
  271. .playOdds {
  272. display: flex;
  273. }
  274. .and {
  275. width: 20%;
  276. /* line-height: 0.4rem; */
  277. }
  278. .and .scoreBox {
  279. width: calc(100% - 1px);
  280. }
  281. .guest{
  282. display: flex;
  283. align-items: center;
  284. flex-direction: row;
  285. flex-wrap: wrap;
  286. }
  287. .odds{
  288. display: inline-block;
  289. width: 0.48rem;
  290. height: 0.3rem;
  291. border: 0.01rem solid #ccc;
  292. line-height: 0.3rem;
  293. text-align: center;
  294. border-radius: 0.05rem;
  295. cursor: pointer;
  296. }
  297. .odds:hover{
  298. background: #ddd;
  299. color: #f76649;
  300. }
  301. .tFooter{
  302. height: 0.4rem;
  303. line-height: 0.4rem;
  304. padding: 0 .24rem;
  305. font-size: .14rem;
  306. text-align: right;
  307. }
  308. </style>