489319bc1c22647efae2d043b35113f0fc699719.svn-base 12 KB

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