52e242ad77f33740e255f8dfa7e827163bd9c7d8.svn-base 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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:14:14
  6. * @LastEditors: Please set LastEditors
  7. -->
  8. <template>
  9. <div>
  10. <div v-if="isDisplay">
  11. <div v-if="obj.a">
  12. <yd-accordion>
  13. <yd-accordion-item class="Match-game" title="波胆" open>
  14. <div class="box title-box row item-center" >
  15. <span>{{home_team}}</span>
  16. </div>
  17. <div v-for="(item ,index) in data" :key="'a'+index" class="box" style="background: #F4F4F4;">
  18. <div v-if="item.odds_code.startsWith('b2')">
  19. <div class="row allAlignment center row-box">
  20. <span>{{item.condition}}</span>
  21. <div v-if="item.odds >0" class="The-club-box row center"
  22. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  23. @click="bettingBtn(item.id,home_team,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'波胆',item.condition,item.oddsType)"
  24. >
  25. <span>{{item.odds}}</span>
  26. </div>
  27. <div v-else class="ratio column center">
  28. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="box title-box row item-center" >
  34. <span>{{guest_team}}</span>
  35. </div>
  36. <div v-for="(item ,index) in data" :key="'b'+index" class="box" style="background: #F4F4F4;">
  37. <div v-if="item.odds_code.startsWith('b')">
  38. <div class="row allAlignment center row-box">
  39. <span>{{item.condition}}</span>
  40. <div v-if="item.odds >0" class="The-club-box row center"
  41. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  42. @click="bettingBtn(item.id,guest_team,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'波胆',item.condition,item.oddsType)"
  43. >
  44. <span>{{item.odds}}</span>
  45. </div>
  46. <div v-else class="ratio column center">
  47. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </yd-accordion-item>
  53. </yd-accordion>
  54. </div>
  55. <div v-if="obj.b">
  56. <yd-accordion>
  57. <yd-accordion-item class="Match-game" title="波胆-上半场" open>
  58. <div class="box title-box row item-center" >
  59. <span>{{home_team}}</span>
  60. </div>
  61. <div v-for="(item ,index) in data" :key="'a'+index" class="box" style="background: #F4F4F4;">
  62. <div v-if="item.odds_code.startsWith('b2')">
  63. <div class="row allAlignment center row-box">
  64. <span>{{item.condition}}</span>
  65. <div v-if="item.odds >0" class="The-club-box row center"
  66. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  67. @click="bettingBtn(item.id,home_team,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'波胆-上半场',item.condition,item.oddsType)"
  68. >
  69. <span>{{item.odds}}</span>
  70. </div>
  71. <div v-else class="ratio 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. <div class="box title-box row item-center" >
  78. <span>{{guest_team}}</span>
  79. </div>
  80. <div v-for="(item ,index) in data" :key="'b'+index" class="box" style="background: #F4F4F4;">
  81. <div v-if="item.odds_code.startsWith('b')">
  82. <div class="row allAlignment center row-box">
  83. <span>{{item.condition}}</span>
  84. <div v-if="item.odds >0" class="The-club-box row center"
  85. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  86. @click="bettingBtn(item.id,guest_team,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'波胆-上半场',item.condition,item.oddsType)"
  87. >
  88. <span>{{item.odds}}</span>
  89. </div>
  90. <div v-else class="ratio column center">
  91. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </yd-accordion-item>
  97. </yd-accordion>
  98. </div>
  99. </div>
  100. </div>
  101. </template>
  102. <script>
  103. export default {
  104. // 独赢
  105. data() {
  106. return {
  107. title: "B",
  108. home_team: " ",
  109. match_id:'',
  110. guest_team: " ",
  111. obj:'',//
  112. data: [],
  113. lg_id:'',
  114. isDisplay: "", //是否显示
  115. betting: [], //已投注倍率id集合
  116. dataNum: 10000 //对应的数据的下标
  117. };
  118. },
  119. methods: {
  120. //玩法投注
  121. bettingBtn(id, name, odds,odds_only,p_code,match_id,odds_code,play_name,condition = "",oddsType, bettingTime = "") {
  122. //console.log(this.data)
  123. let _this = this;
  124. let bettingInfo = {
  125. id,
  126. home_team: this.home_team,
  127. guest_team: this.guest_team,
  128. name,
  129. odds,
  130. ballId:this.$store.getters.getBallId,
  131. condition,
  132. odds_code,
  133. score: this.score,
  134. bettingTime,
  135. odds_only,
  136. p_code,
  137. lg_id:this.lg_id,
  138. odds_id:id,
  139. play_name,
  140. match_id,
  141. oddsType
  142. };
  143. //调用玩法投注公共方法
  144. this.$public.bettingFunction(
  145. this.betting,
  146. bettingInfo,
  147. this.data,
  148. this.$store.getters.getBetting,
  149. this.title,
  150. this.dataNum,
  151. this.$store.getters.getLimit,
  152. function(res, type) {
  153. _this.$set(res, "isTrue", type);
  154. },
  155. function(data, val,type) {
  156. if(type) {
  157. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  158. }
  159. _this.$store.dispatch("BETTING", []);
  160. _this.$store.dispatch("BETTING", data ? data : val);
  161. if(_this.$store.getters.getIsBetting == '100') return false
  162. _this.$store.dispatch("ISBETTING",'100')
  163. }
  164. );
  165. },
  166. //获取玩法id
  167. getBettingId(data) {
  168. if (data) {
  169. data.forEach((res, index) => {
  170. if (res.title == this.title) {
  171. this.betting = res.data;
  172. this.dataNum = index;
  173. }
  174. });
  175. }
  176. },
  177. /*-------------------------------*/
  178. //获取子玩法分类
  179. getChildPlay(data){
  180. let obj ={};
  181. this.data = [];
  182. data.forEach(e=>{
  183. if(e.odds >0){
  184. if(e.odds_code.startsWith('b')){
  185. obj.a = true;
  186. }else if(e.odds_code.startsWith('half')){
  187. obj.b = true;
  188. }
  189. this.data.push(e);
  190. }
  191. })
  192. this.obj = obj
  193. },
  194. },
  195. computed: {
  196. getUserIcons() {
  197. return this.$store.getters.getGameRatio;
  198. },
  199. getBetting() {
  200. return this.$store.getters.getBetting;
  201. },
  202. // 获取投注删除状态
  203. deleteType() {
  204. return this.$store.getters.getDeleteType;
  205. }
  206. },
  207. watch: {
  208. getUserIcons(val) {
  209. this.match_id=val.match_id
  210. if (!val) return false;
  211. this.home_team = val.home_team;
  212. this.guest_team = val.guest_team;
  213. this.lg_id = val.lg_id;
  214. val.oddsData.forEach(res => {
  215. if (res[0].p_code == this.title) {
  216. this.isDisplay = true;
  217. this.getChildPlay(res);
  218. }
  219. });
  220. this.getBettingId(this.$store.getters.getBetting);
  221. if (this.dataNum != 10000) {
  222. this.betting.forEach(res => {
  223. this.data.forEach((e, index) => {
  224. if (res.id == e.id) {
  225. this.$set(e, "isTrue", true);
  226. }
  227. });
  228. });
  229. }
  230. },
  231. //获取已投注信息
  232. getBetting(val) {
  233. let _this = this;
  234. this.$public.getBettingId(val, this.title, function(data, index) {
  235. _this.betting = data;
  236. _this.dataNum = index;
  237. });
  238. },
  239. //监听投注框删除处理
  240. deleteType(val) {
  241. this.data.forEach(e => {
  242. if (val == "all") {
  243. this.$set(e, "isTrue", false);
  244. } else {
  245. if (e.id == val) {
  246. this.$set(e, "isTrue", false);
  247. }
  248. }
  249. });
  250. },
  251. },
  252. mounted() {
  253. }
  254. };
  255. </script>
  256. <style scoped>
  257. div /deep/ .yd-accordion-head-arrow:after {
  258. border: none;
  259. width: 0.5rem;
  260. height: 0.5rem;
  261. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  262. background-size: 100% 100%;
  263. }
  264. div /deep/ .yd-accordion-head,
  265. div /deep/ .yd-accordion-head-content,
  266. div /deep/ .yd-accordion-title {
  267. font-size: 0.28rem;
  268. color: #fefefe;
  269. background: #a0a0a0;
  270. }
  271. div /deep/ .yd-accordion-head {
  272. padding: 0 0.32rem;
  273. }
  274. .box {
  275. padding: 0 0.32rem;
  276. }
  277. .title-box{
  278. background:#e4e4e4;
  279. min-height: 0.7rem;
  280. font-size: 0.24rem;
  281. }
  282. .row-box {
  283. height: 0.9rem;
  284. font-size: 0.26rem;
  285. border-bottom: 1px solid #e4e4e4;
  286. }
  287. .The-club-box {
  288. width: 1.07rem;
  289. height: 0.76rem;
  290. font-size: 0.24rem;
  291. padding: 0.1rem;
  292. border: 1px solid #cecece;
  293. border-radius: 0.1rem;
  294. margin: 0.06rem;
  295. }
  296. .active {
  297. background: #f76649;
  298. color: #f4f4f4;
  299. padding: 0.1rem;
  300. border: 1px solid #f76649;
  301. }
  302. .active i {
  303. color: #f4f4f4 !important;
  304. }
  305. .ratio {
  306. width: 1.07rem;
  307. height: 0.76rem;
  308. border: 1px solid #cecece;
  309. margin-right: 0.14rem;
  310. border-radius: 0.1rem;
  311. margin: 0.06rem;
  312. }
  313. </style>