ad89212e0f024f9d57e2e830fb692a41aeb8e398.svn-base 6.8 KB

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