b237e7206625ef832f3fd218b6bb47576ca68e33.svn-base 10.0 KB

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