c257fe55ae07158c71d5445d7928ff8f7d87ce8c.svn-base 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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,'大')"
  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,'小')"
  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(item,name) {
  69. let _this = this;
  70. let bettingInfo = {
  71. id:item.id,
  72. home_team: this.home_team,
  73. guest_team: this.guest_team,
  74. name,
  75. odds:item.odds,
  76. p_code:item.p_code,
  77. ballId: this.$store.getters.getBallId,
  78. match_id:this.match_id,
  79. condition:item.condition,
  80. odds_code:item.odds_code,
  81. score: this.score,
  82. odds_only:item.odds_only,
  83. play_name:"总得分:大/小",
  84. lg_id: this.lg_id,
  85. oddsType:item.oddsType
  86. };
  87. //调用玩法投注公共方法
  88. this.$public.bettingFunction(
  89. this.betting,
  90. bettingInfo,
  91. this.data,
  92. this.$store.getters.getBetting,
  93. this.title,
  94. this.dataNum,
  95. this.$store.getters.getLimit,
  96. function(res, type) {
  97. _this.$set(res, "isTrue", type);
  98. },
  99. function(data, val,type) {
  100. if(type) {
  101. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  102. }
  103. _this.$store.dispatch("BETTING", []);
  104. _this.$store.dispatch("BETTING", data ? data : val);
  105. if(_this.$store.getters.getIsBetting == '100') return false
  106. _this.$store.dispatch("ISBETTING",'100')
  107. }
  108. );
  109. if (this.$store.getters.getLimit * 1 >= 10) return false;
  110. },
  111. //获取玩法id
  112. getBettingId(data) {
  113. if (data) {
  114. data.forEach((res, index) => {
  115. if (res.title == this.title) {
  116. this.betting = res.data;
  117. this.dataNum = index;
  118. }
  119. });
  120. }
  121. },
  122. //子玩法分类
  123. removeHeavy(data){
  124. this.data = [];
  125. data.forEach(e=>{
  126. // let index = e.odds_code.lastIndexOf('_');
  127. // let str= e.odds_code.slice(0,index)
  128. // console.log(e.odds_code);
  129. if(e.odds_code == 'tnb' || e.odds_code == 'tns'){
  130. this.isDisplay = true;
  131. this.data.push(e)
  132. }
  133. })
  134. },
  135. },
  136. computed: {
  137. getUserIcons() {
  138. return this.$store.getters.getGameRatio;
  139. },
  140. getBetting() {
  141. return this.$store.getters.getBetting;
  142. },
  143. //获取投注框删除的投注信息
  144. getDeleteType() {
  145. // console.log(this.$store.getters.getDeleteType)
  146. return this.$store.getters.getDeleteType;
  147. }
  148. },
  149. watch: {
  150. getUserIcons(val) {
  151. this.match_id = val.match_id;
  152. if (!val) return false;
  153. this.home_team = val.home_team;
  154. this.guest_team = val.guest_team;
  155. // 联赛id
  156. this.lg_id=val.lg_id;
  157. val.oddsData.forEach(res => {
  158. if (res[0].p_code == this.title) {
  159. this.removeHeavy(res);
  160. }
  161. });
  162. this.getBettingId(this.$store.getters.getBetting);
  163. if (this.dataNum != 10000) {
  164. this.betting.forEach(res => {
  165. this.data.forEach((e, index) => {
  166. if (res.id == e.id) {
  167. this.$set(e, "isTrue", true);
  168. }
  169. });
  170. });
  171. }
  172. },
  173. //获取已投注信息
  174. getBetting(val) {
  175. let _this = this;
  176. //投注框数据发生变法,初始化组件页面渲染和数据;
  177. this.$public.getBettingId(val, this.title, function(data, index) {
  178. _this.betting = data;
  179. _this.dataNum = index;
  180. });
  181. },
  182. //监听投注框删除处理
  183. getDeleteType(val) {
  184. this.data.forEach(e => {
  185. if (val == "all") {
  186. this.$set(e, "isTrue", false);
  187. } else {
  188. if (e.id == val) {
  189. this.$set(e, "isTrue", false);
  190. }
  191. }
  192. });
  193. }
  194. }
  195. };
  196. </script>
  197. <style scoped>
  198. div /deep/ .yd-accordion-head-arrow:after {
  199. border: none;
  200. width: 0.5rem;
  201. height: 0.5rem;
  202. background: url(../assets/st-imges/xiangxia.png) no-repeat;
  203. background-size: 100% 100%;
  204. }
  205. div /deep/ .yd-accordion-title {
  206. height: 0.88rem;
  207. font-size: 0.28rem;
  208. color: #fefefe;
  209. }
  210. div /deep/ .yd-accordion-head {
  211. padding: 0 0.32rem;
  212. background: #a0a0a0;
  213. }
  214. .rowBox {
  215. padding: 0 0.32rem;
  216. background: #f0f0f0;
  217. border-bottom: 1px solid #e4e4e4;
  218. }
  219. .width-box {
  220. width: 50%;
  221. }
  222. .right-box {
  223. padding-right: 0.32rem;
  224. padding-left: 0.2rem;
  225. border-bottom: 1px solid #e4e4e4;
  226. }
  227. .left-box {
  228. padding-left: 0.32rem;
  229. border-bottom: 1px solid #e4e4e4;
  230. }
  231. .btn-box {
  232. width: 1.07rem;
  233. height: 0.76rem;
  234. font-size: 0.24rem;
  235. padding: 0.1rem;
  236. border: 2px solid #cecece;
  237. border-radius: 0.1rem;
  238. margin: 0.1rem;
  239. }
  240. .borderBottom{
  241. border-bottom: 1px solid #e4e4e4
  242. }
  243. .active {
  244. background: #f76649;
  245. padding: 0.1rem;
  246. border: 2px solid #f76649;
  247. }
  248. .active span{
  249. color: #f4f4f4 !important;
  250. }
  251. .spanCol{
  252. color: #f76649;
  253. }
  254. </style>