9f75d49939bed26b7659c1738b4c47f085290bce.svn-base 12 KB

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