08a90ec5bf9007045cd7317227aa0f92674f41df.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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.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. <!-- && item.odds_code.endsWith('big') -->
  57. <div v-if="item.odds_code.startsWith('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.startsWith('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. let index = e.odds_code.lastIndexOf('_');
  174. let str= e.odds_code.slice(0,index)
  175. if('tnb_5' == str || 'tnb' == str){
  176. if(e.odds_code.startsWith('tnb')){
  177. obj.a = true;
  178. }else if(e.odds_code.startsWith('tnb_5')){
  179. obj.b = true;
  180. }
  181. this.isDisplay = true;
  182. this.data.push(e)
  183. }
  184. })
  185. this.obj = obj;
  186. },
  187. },
  188. computed: {
  189. getUserIcons() {
  190. return this.$store.getters.getGameRatio;
  191. },
  192. getBetting() {
  193. return this.$store.getters.getBetting;
  194. },
  195. //获取投注框删除的投注信息
  196. getDeleteType() {
  197. // console.log(this.$store.getters.getDeleteType)
  198. return this.$store.getters.getDeleteType;
  199. }
  200. },
  201. watch: {
  202. getUserIcons(val) {
  203. this.match_id = val.match_id;
  204. if (!val) return false;
  205. this.home_team = val.home_team;
  206. this.guest_team = val.guest_team;
  207. // 联赛id
  208. this.lg_id=val.lg_id;
  209. val.oddsData.forEach(res => {
  210. if (res[0].p_code == this.title) {
  211. this.removeHeavy(res);
  212. }
  213. });
  214. this.getBettingId(this.$store.getters.getBetting);
  215. if (this.dataNum != 10000) {
  216. this.betting.forEach(res => {
  217. this.data.forEach((e, index) => {
  218. if (res.id == e.id) {
  219. this.$set(e, "isTrue", true);
  220. }
  221. });
  222. });
  223. }
  224. },
  225. //获取已投注信息
  226. getBetting(val) {
  227. let _this = this;
  228. //投注框数据发生变法,初始化组件页面渲染和数据;
  229. this.$public.getBettingId(val, this.title, function(data, index) {
  230. _this.betting = data;
  231. _this.dataNum = index;
  232. });
  233. },
  234. //监听投注框删除处理
  235. getDeleteType(val) {
  236. this.data.forEach(e => {
  237. if (val == "all") {
  238. this.$set(e, "isTrue", false);
  239. } else {
  240. if (e.id == val) {
  241. this.$set(e, "isTrue", false);
  242. }
  243. }
  244. });
  245. }
  246. }
  247. };
  248. </script>
  249. <style scoped>
  250. div /deep/ .yd-accordion-head-arrow:after {
  251. border: none;
  252. width: 0.5rem;
  253. height: 0.5rem;
  254. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  255. background-size: 100% 100%;
  256. }
  257. div /deep/ .yd-accordion-title {
  258. height: 0.88rem;
  259. font-size: 0.28rem;
  260. color: #fefefe;
  261. }
  262. div /deep/ .yd-accordion-head {
  263. padding: 0 0.32rem;
  264. background: #a0a0a0;
  265. }
  266. .rowBox {
  267. padding: 0 0.32rem;
  268. background: #f0f0f0;
  269. border-bottom: 1px solid #e4e4e4;
  270. }
  271. .width-box {
  272. width: 50%;
  273. }
  274. .right-box {
  275. padding-right: 0.32rem;
  276. padding-left: 0.2rem;
  277. border-bottom: 1px solid #e4e4e4;
  278. }
  279. .left-box {
  280. padding-left: 0.32rem;
  281. border-bottom: 1px solid #e4e4e4;
  282. }
  283. .btn-box {
  284. width: 1.07rem;
  285. height: 0.76rem;
  286. font-size: 0.24rem;
  287. padding: 0.1rem;
  288. border: 1px solid #cecece;
  289. border-radius: 0.1rem;
  290. margin: 0.1rem;
  291. }
  292. .borderBottom{
  293. border-bottom: 1px solid #e4e4e4
  294. }
  295. .active {
  296. background: #f76649;
  297. padding: 0.1rem;
  298. border: 1px solid #f76649;
  299. }
  300. .active span{
  301. color: #f4f4f4 !important;
  302. }
  303. .spanCol{
  304. color: #f76649;
  305. }
  306. </style>