63a65354ca45ad8c382b8118b523d6bf719f64fe.svn-base 13 KB

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