37333fdc97ab59b8cac78c2532e14ae1344e1be4.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <!--
  2. * @Description: In User Settings Edit
  3. * @Author: your name
  4. * @Date: 2019-08-26 10:58:22
  5. * @LastEditTime: 2019-08-27 16:46:24
  6. * @LastEditors: Please set LastEditors
  7. -->
  8. <template>
  9. <div>
  10. <div v-if="isDisplay">
  11. <yd-accordion>
  12. <yd-accordion-item class="Match-game" :title="total_title" open>
  13. <div class="row allAlignment center rowBox" >
  14. <div class="column width-box " style="border-right: 1px solid #e4e4e4">
  15. <div v-if="item.odds_code == 'tnb'" v-for=" (item,index) in data" class="row allAlignment center borderBottom" >
  16. <span>大</span>
  17. <div v-if="item.odds >0" class="column center btn-box"
  18. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  19. @click="bettingBtn(item.id,'大',item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,item.oddsType)"
  20. >
  21. <span class="spanCol" v-if="item.condition">{{ item.condition }}</span>
  22. <span>{{ item.odds }}</span>
  23. </div>
  24. <div v-else class="btn-box column center">
  25. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="column width-box " >
  30. <div v-if="item.odds_code == 'tns'" v-for=" (item,index) in data" class="row allAlignment center borderBottom">
  31. <span style="padding-left: 0.2rem;">小</span>
  32. <div v-if="item.odds >0" class="column center btn-box"
  33. :class="{active:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  34. @click="bettingBtn(item.id,'小',item.odds,item.odds_only,item.p_code,match_id,item.condition,item.odds_code,item.oddsType)"
  35. >
  36. <span class="spanCol" v-if="item.condition">{{ item.condition }}</span>
  37. <span>{{ item.odds }}</span>
  38. </div>
  39. <div v-else class="btn-box column center">
  40. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </yd-accordion-item>
  46. </yd-accordion>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. export default {
  52. //总进球数
  53. data() {
  54. return {
  55. title: "TN",
  56. isDisplay: false,
  57. home_team: "",
  58. guest_team: "",
  59. total_title: "总得分:大/小",
  60. data: [],
  61. lg_id: "",
  62. match_id: "",
  63. betting: [], //已投注倍率id集合
  64. dataNum: 10000 //对应的数据的下标
  65. };
  66. },
  67. methods: {
  68. bettingBtn(id,name,odds,odds_only,p_code,match_id,condition,odds_code,oddsType,bettingTime = "") {
  69. let _this = this;
  70. let bettingInfo = {
  71. id,
  72. home_team: this.home_team,
  73. guest_team: this.guest_team,
  74. name,
  75. odds,
  76. p_code,
  77. ballId: this.$store.getters.getBallId,
  78. match_id,
  79. condition,
  80. odds_code: this.title,
  81. score: this.score,
  82. bettingTime,
  83. odds_only,
  84. play_name:"总得分:大/小",
  85. lg_id: this.lg_id,
  86. oddsType
  87. };
  88. //调用玩法投注公共方法
  89. this.$public.bettingFunction(
  90. this.betting,
  91. bettingInfo,
  92. this.data,
  93. this.$store.getters.getBetting,
  94. this.title,
  95. this.dataNum,
  96. this.$store.getters.getLimit,
  97. function(res, type) {
  98. _this.$set(res, "isTrue", type);
  99. },
  100. function(data, val,type) {
  101. if(type) {
  102. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  103. }
  104. _this.$store.dispatch("BETTING", []);
  105. _this.$store.dispatch("BETTING", data ? data : val);
  106. if(_this.$store.getters.getIsBetting == '100') return false
  107. _this.$store.dispatch("ISBETTING",'100')
  108. }
  109. );
  110. if (this.$store.getters.getLimit * 1 >= 10) return false;
  111. },
  112. //获取玩法id
  113. getBettingId(data) {
  114. if (data) {
  115. data.forEach((res, index) => {
  116. if (res.title == this.title) {
  117. this.betting = res.data;
  118. this.dataNum = index;
  119. }
  120. });
  121. }
  122. },
  123. //子玩法分类
  124. removeHeavy(data){
  125. this.data = [];
  126. data.forEach(e=>{
  127. // let index = e.odds_code.lastIndexOf('_');
  128. // let str= e.odds_code.slice(0,index)
  129. // console.log(e.odds_code);
  130. if(e.odds_code == 'tnb' || e.odds_code == 'tns'){
  131. this.isDisplay = true;
  132. this.data.push(e)
  133. }
  134. })
  135. },
  136. },
  137. computed: {
  138. getUserIcons() {
  139. return this.$store.getters.getGameRatio;
  140. },
  141. getBetting() {
  142. return this.$store.getters.getBetting;
  143. },
  144. //获取投注框删除的投注信息
  145. getDeleteType() {
  146. // console.log(this.$store.getters.getDeleteType)
  147. return this.$store.getters.getDeleteType;
  148. }
  149. },
  150. watch: {
  151. getUserIcons(val) {
  152. this.match_id = val.match_id;
  153. if (!val) return false;
  154. this.home_team = val.home_team;
  155. this.guest_team = val.guest_team;
  156. // 联赛id
  157. this.lg_id=val.lg_id;
  158. val.oddsData.forEach(res => {
  159. if (res[0].p_code == this.title) {
  160. this.removeHeavy(res);
  161. }
  162. });
  163. this.getBettingId(this.$store.getters.getBetting);
  164. if (this.dataNum != 10000) {
  165. this.betting.forEach(res => {
  166. this.data.forEach((e, index) => {
  167. if (res.id == e.id) {
  168. this.$set(e, "isTrue", true);
  169. }
  170. });
  171. });
  172. }
  173. },
  174. //获取已投注信息
  175. getBetting(val) {
  176. let _this = this;
  177. //投注框数据发生变法,初始化组件页面渲染和数据;
  178. this.$public.getBettingId(val, this.title, function(data, index) {
  179. _this.betting = data;
  180. _this.dataNum = index;
  181. });
  182. },
  183. //监听投注框删除处理
  184. getDeleteType(val) {
  185. this.data.forEach(e => {
  186. if (val == "all") {
  187. this.$set(e, "isTrue", false);
  188. } else {
  189. if (e.id == val) {
  190. this.$set(e, "isTrue", false);
  191. }
  192. }
  193. });
  194. }
  195. }
  196. };
  197. </script>
  198. <style scoped>
  199. div /deep/ .yd-accordion-head-arrow:after {
  200. border: none;
  201. width: 0.5rem;
  202. height: 0.5rem;
  203. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  204. background-size: 100% 100%;
  205. }
  206. div /deep/ .yd-accordion-title {
  207. height: 0.88rem;
  208. font-size: 0.28rem;
  209. color: #fefefe;
  210. }
  211. div /deep/ .yd-accordion-head {
  212. padding: 0 0.32rem;
  213. background: #a0a0a0;
  214. }
  215. .rowBox {
  216. padding: 0 0.32rem;
  217. background: #f0f0f0;
  218. border-bottom: 1px solid #e4e4e4;
  219. }
  220. .width-box {
  221. width: 50%;
  222. }
  223. .right-box {
  224. padding-right: 0.32rem;
  225. padding-left: 0.2rem;
  226. border-bottom: 1px solid #e4e4e4;
  227. }
  228. .left-box {
  229. padding-left: 0.32rem;
  230. border-bottom: 1px solid #e4e4e4;
  231. }
  232. .btn-box {
  233. width: 1.07rem;
  234. height: 0.76rem;
  235. font-size: 0.24rem;
  236. padding: 0.1rem;
  237. border: 2px solid #cecece;
  238. border-radius: 0.1rem;
  239. margin: 0.1rem;
  240. }
  241. .borderBottom{
  242. border-bottom: 1px solid #e4e4e4
  243. }
  244. .active {
  245. background: #f76649;
  246. padding: 0.1rem;
  247. border: 2px solid #f76649;
  248. }
  249. .active span{
  250. color: #f4f4f4 !important;
  251. }
  252. .spanCol{
  253. color: #f76649;
  254. }
  255. </style>