5b852e11a7686b13997370232013271612695ab8.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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,item.oddsType)"
  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,item.oddsType)"
  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+'-上半场',item.oddsType)"
  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+'-上半场',item.oddsType)"
  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+'-第一盘',item.oddsType)"
  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+'-第一盘',item.oddsType)"
  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,oddsType,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. oddsType
  159. };
  160. //调用玩法投注公共方法
  161. this.$public.bettingFunction(
  162. this.betting,
  163. bettingInfo,
  164. this.data,
  165. this.$store.getters.getBetting,
  166. this.title,
  167. this.dataNum,
  168. this.$store.getters.getLimit,
  169. function(res, type) {
  170. _this.$set(res, "isTrue", type);
  171. },
  172. function(data, val,type) {
  173. if(type) {
  174. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  175. }
  176. _this.$store.dispatch("BETTING", []);
  177. _this.$store.dispatch("BETTING", data ? data : val);
  178. if(_this.$store.getters.getIsBetting == '100') return false
  179. _this.$store.dispatch("ISBETTING",'100')
  180. }
  181. );
  182. if (this.$store.getters.getLimit * 1 >= 10) return false;
  183. },
  184. //获取玩法id
  185. getBettingId(data) {
  186. if (data) {
  187. data.forEach((res, index) => {
  188. if (res.title == this.title) {
  189. this.betting = res.data;
  190. this.dataNum = index;
  191. }
  192. });
  193. }
  194. },
  195. //子玩法分类
  196. removeHeavy(data){
  197. let obj ={};
  198. data.forEach(e=>{
  199. if(e.odds_code.startsWith('total')){
  200. obj.a = true;
  201. }else if(e.odds_code.startsWith('half')){
  202. obj.b = true;
  203. }else if(e.odds_code.startsWith('one')){
  204. obj.c = true;
  205. }else if(e.odds_code.startsWith('two')){
  206. obj.d = true;
  207. }
  208. // else if(e.odds_code.startsWith('half')){
  209. // }else if(e.odds_code.startsWith('half')){
  210. // }
  211. })
  212. this.obj = obj;
  213. },
  214. },
  215. computed: {
  216. getUserIcons() {
  217. return this.$store.getters.getGameRatio;
  218. },
  219. getBetting() {
  220. return this.$store.getters.getBetting;
  221. },
  222. //获取投注框删除的投注信息
  223. getDeleteType() {
  224. // console.log(this.$store.getters.getDeleteType)
  225. return this.$store.getters.getDeleteType;
  226. }
  227. },
  228. watch: {
  229. getUserIcons(val) {
  230. this.match_id = val.match_id;
  231. if (!val) return false;
  232. this.home_team = val.home_team;
  233. this.guest_team = val.guest_team;
  234. // 联赛id
  235. this.lg_id=val.lg_id;
  236. val.oddsData.forEach(res => {
  237. if (res[0].p_code == this.title) {
  238. this.data =res;
  239. this.isDisplay = true;
  240. this.removeHeavy(res);
  241. }
  242. });
  243. this.getBettingId(this.$store.getters.getBetting);
  244. if (this.dataNum != 10000) {
  245. this.betting.forEach(res => {
  246. this.data.forEach((e, index) => {
  247. if (res.id == e.id) {
  248. this.$set(e, "isTrue", true);
  249. }
  250. });
  251. });
  252. }
  253. },
  254. //获取已投注信息
  255. getBetting(val) {
  256. let _this = this;
  257. //投注框数据发生变法,初始化组件页面渲染和数据;
  258. this.$public.getBettingId(val, this.title, function(data, index) {
  259. _this.betting = data;
  260. _this.dataNum = index;
  261. });
  262. },
  263. //监听投注框删除处理
  264. getDeleteType(val) {
  265. this.data.forEach(e => {
  266. if (val == "all") {
  267. this.$set(e, "isTrue", false);
  268. } else {
  269. if (e.id == val) {
  270. this.$set(e, "isTrue", false);
  271. }
  272. }
  273. });
  274. }
  275. }
  276. };
  277. </script>
  278. <style scoped>
  279. div /deep/ .yd-accordion-head-arrow:after {
  280. border: none;
  281. width: 0.5rem;
  282. height: 0.5rem;
  283. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  284. background-size: 100% 100%;
  285. }
  286. div /deep/ .yd-accordion-title {
  287. height: 0.88rem;
  288. font-size: 0.28rem;
  289. color: #fefefe;
  290. }
  291. div /deep/ .yd-accordion-head {
  292. padding: 0 0.32rem;
  293. background: #a0a0a0;
  294. }
  295. .rowBox {
  296. padding: 0 0.32rem;
  297. background: #f0f0f0;
  298. border-bottom: 1px solid #e4e4e4;
  299. }
  300. .width-box {
  301. width: 50%;
  302. }
  303. .right-box {
  304. padding-right: 0.32rem;
  305. padding-left: 0.2rem;
  306. border-bottom: 1px solid #e4e4e4;
  307. }
  308. .left-box {
  309. padding-left: 0.32rem;
  310. border-bottom: 1px solid #e4e4e4;
  311. }
  312. .btn-box {
  313. width: 1.07rem;
  314. height: 0.76rem;
  315. font-size: 0.24rem;
  316. padding: 0.1rem;
  317. border: 2px solid #cecece;
  318. border-radius: 0.1rem;
  319. margin: 0.1rem;
  320. }
  321. .borderBottom{
  322. border-bottom: 1px solid #e4e4e4
  323. }
  324. .active {
  325. background: #f76649;
  326. padding: 0.1rem;
  327. border: 2px solid #f76649;
  328. }
  329. .active span{
  330. color: #f4f4f4 !important;
  331. }
  332. .spanCol{
  333. color: #f76649;
  334. }
  335. </style>