cd707df7832a2c2c6dc3e079a74ea61e051a580c.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <!--
  2. * @Description: In User Settings Edit
  3. * @Author: your name
  4. * @Date: 2019-08-26 10:58:22
  5. * @LastEditTime: 2019-08-27 15:53:00
  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,'进球:单/双',tem.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. <yd-accordion :accordion="true">
  56. <yd-accordion-item title="进球:单/双-上半场" open>
  57. <div class="row allAlignment box">
  58. <div class=" column allAlignment left_box">
  59. <div
  60. v-for="(item,index) in data"
  61. :key="item.id"
  62. v-if="item.odds_code =='tss_h'"
  63. class=" row allAlignment"
  64. >
  65. <div>{{item.condition}}</div>
  66. <div v-if="item.odds >0" class="ratio"
  67. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'} "
  68. @click="toggle(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'进球:单/双-上半场',item.oddsType)"
  69. >
  70. <span>{{item.odds}}</span>
  71. </div>
  72. <div v-else class="ratio column center">
  73. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  74. </div>
  75. </div>
  76. </div>
  77. <div class=" column allAlignment right_box">
  78. <div
  79. v-for="(item,index) in data"
  80. :key="item.id"
  81. v-if="item.odds_code =='tsd_h' "
  82. class="row allAlignment"
  83. >
  84. <div>{{item.condition}}</div>
  85. <div v-if="item.odds >0" class="ratio"
  86. :class="{col:item.isTrue,increased_color:item.change == 'add',reduce_color:item.change == 'red'}"
  87. @click="toggle(item.id,item.condition,item.odds,item.odds_only,item.p_code,match_id,item.odds_code,'进球:单/双-上半场',item.oddsType)"
  88. >
  89. <span>{{item.odds}}</span>
  90. </div>
  91. <div v-else class="ratio column center">
  92. <img style="width: 0.7rem;height: 0.5rem;" src="@/assets/st-imges/mima.png"><img>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </yd-accordion-item>
  98. </yd-accordion>
  99. </div>
  100. </div>
  101. </template>
  102. <script>
  103. export default {
  104. // 进球大小单双数
  105. data() {
  106. return {
  107. title: "TS",
  108. // status: -1,
  109. smallStatus: [],
  110. isDisplay: false,
  111. home_team: "",
  112. guest_team: "",
  113. match_id: "",
  114. lg_id:'',
  115. score: "0",
  116. data: [], //
  117. betting: [], //已投注倍率id集合
  118. dataNum: 10000 //对应的数据的下标
  119. };
  120. },
  121. methods: {
  122. //玩法投注
  123. toggle(id, name, odds, odds_only, p_code, match_id, odds_code,play_name,oddsType) {
  124. let _this = this;
  125. let bettingInfo = {
  126. id,
  127. home_team: this.home_team,
  128. guest_team: this.guest_team,
  129. name:'',
  130. odds,
  131. ballId: this.$store.getters.getBallId,
  132. condition:name,
  133. odds_code,
  134. score: this.score,
  135. play_name,
  136. bettingTime: "",
  137. odds_only,
  138. lg_id:this.lg_id,
  139. odds_id:id,
  140. p_code,
  141. match_id,
  142. oddsType
  143. };
  144. //调用玩法投注公共方法
  145. this.$public.bettingFunction(
  146. this.betting,
  147. bettingInfo,
  148. this.data,
  149. this.$store.getters.getBetting,
  150. this.title,
  151. this.dataNum,
  152. this.$store.getters.getLimit,
  153. function(res, type) {
  154. _this.$set(res, "isTrue", type);
  155. },
  156. function(data, val,type) {
  157. if(type) {
  158. _this.$dialog.alert({mes: '你的注单已达到上限啦!'});
  159. }
  160. _this.$store.dispatch("BETTING", []);
  161. _this.$store.dispatch("BETTING", data ? data : val);
  162. if(_this.$store.getters.getIsBetting == '100') return false
  163. _this.$store.dispatch("ISBETTING",'100')
  164. }
  165. );
  166. },
  167. //获取玩法id
  168. getBettingId(data) {
  169. // console.log("ssaa", data);
  170. if (data) {
  171. data.forEach((res, index) => {
  172. if (res.title == this.title) {
  173. this.betting = res.data;
  174. this.dataNum = index;
  175. }
  176. });
  177. }
  178. }
  179. },
  180. computed: {
  181. getUserIcons() {
  182. return this.$store.getters.getGameRatio;
  183. },
  184. getBetting() {
  185. return this.$store.getters.getBetting;
  186. },
  187. //获取投注框删除的投注信息
  188. getDeleteType() {
  189. return this.$store.getters.getDeleteType;
  190. }
  191. },
  192. watch: {
  193. //监听vuex里面数据
  194. getUserIcons(val) {
  195. this.match_id = val.match_id;
  196. if (!val) return false;
  197. this.home_team = val.home_team;
  198. this.guest_team = val.guest_team;
  199. this.lg_id=val.lg_id
  200. val.oddsData.forEach(res => {
  201. if (res[0].p_code == this.title) {
  202. this.isDisplay = true;
  203. this.data = res;
  204. //console.log(res);
  205. }
  206. });
  207. this.getBettingId(this.$store.getters.getBetting);
  208. if (this.dataNum != 10000) {
  209. this.betting.forEach(res => {
  210. this.data.forEach((e, index) => {
  211. if (res.id == e.id) {
  212. this.$set(e, "isTrue", true);
  213. }
  214. });
  215. });
  216. }
  217. //console.log(this.data, "a123");
  218. },
  219. //获取已投注信息
  220. getBetting(val) {
  221. let _this = this;
  222. this.$public.getBettingId(val, this.title, function(data, index) {
  223. _this.betting = data;
  224. _this.dataNum = index;
  225. });
  226. },
  227. //监听投注框删除处理
  228. getDeleteType(val) {
  229. this.data.forEach(e => {
  230. if (val == "all") {
  231. this.$set(e, "isTrue", false);
  232. } else {
  233. if (e.id == val) {
  234. this.$set(e, "isTrue", false);
  235. }
  236. }
  237. });
  238. }
  239. }
  240. };
  241. </script>
  242. <style scoped>
  243. div /deep/ .yd-accordion-head {
  244. padding: 0 0.32rem;
  245. background: #a0a0a0;
  246. }
  247. .goalBox {
  248. display: flex;
  249. justify-content: space-between;
  250. align-items: center;
  251. background: #f8f8f8;
  252. padding: 0 0.32rem;
  253. }
  254. div /deep/ .yd-accordion-title {
  255. color: #fefefe;
  256. font-size: 0.28rem;
  257. }
  258. div /deep/ .yd-accordion-head-arrow:after {
  259. border: none;
  260. width: 0.5rem;
  261. height: 0.5rem;
  262. background: url("../assets/st-imges/xiangxia.png") no-repeat;
  263. background-size: 100% 100%;
  264. }
  265. .box {
  266. font-size: 0.24rem;
  267. color: #333333;
  268. background: #f4f4f4;
  269. padding: 0 0.32rem;
  270. }
  271. .left_box {
  272. width: 50%;
  273. border-right: 1px solid #e4e4e4;
  274. line-height: 0.9rem;
  275. }
  276. .right_box {
  277. width: 50%;
  278. padding-left: 0.16rem;
  279. line-height: 0.9rem;
  280. }
  281. .ratio {
  282. display: flex;
  283. align-items: center;
  284. justify-content: center;
  285. width: 1.07rem;
  286. height: 0.76rem;
  287. border: 1px solid #cecece;
  288. border-radius: 0.1rem;
  289. margin: 0.06rem;
  290. padding: .1rem;
  291. text-align: center;
  292. }
  293. /* .odds {
  294. display: flex;
  295. width: 50%;
  296. justify-content: space-between;
  297. background: #f8f8f8;
  298. text-align: left;
  299. }
  300. .odds .odd {
  301. width: 100%;
  302. }
  303. .odds .small {
  304. width: 50%;
  305. display: flex;
  306. justify-content: space-between;
  307. border-right: 1px solid #e4e4e4;
  308. }
  309. .odds .large {
  310. width: 100%;
  311. display: flex;
  312. justify-content: space-between;
  313. border-right: 1px solid #e4e4e4;
  314. }
  315. .odds .small {
  316. border-right: none;
  317. padding-left: 0.16rem;
  318. }
  319. .odds .large div,
  320. .odds .small div {
  321. height: 0.88rem;
  322. font-size: 0.24rem;
  323. color: #333333;
  324. }
  325. .odds .large div:nth-child(1),
  326. .odds .small div:nth-child(1) {
  327. line-height: 0.88rem;
  328. }
  329. .odds .large .ratio,
  330. .odds .small .ratio {
  331. width: 1.07rem;
  332. height: 0.76rem;
  333. line-height: 0.76rem;
  334. border: 2px solid #cecece;
  335. border-radius: 0.1rem;
  336. margin-top: 0.06rem;
  337. text-align: center;
  338. margin-right: 0.14rem;
  339. }
  340. .odds .large .ratio span,
  341. .odds .small .ratio span {
  342. font-size: 0.24rem;
  343. }
  344. .odds .large .score,
  345. .odds .small .score {
  346. color: #fd8f26;
  347. }
  348. .odds:nth-last-child(1) .large,
  349. .odds:nth-last-child(1) .small {
  350. border-bottom: none;
  351. }
  352. .largeScore,
  353. .smallScore {
  354. line-height: 0.76rem;
  355. }*/
  356. .col {
  357. background: #f76649;
  358. border: 2px solid #f76649 !important;
  359. }
  360. .col span {
  361. color: #f4f4f4 !important;
  362. }
  363. /* .odds .score {
  364. display: block;
  365. margin-top: 0.04rem;
  366. } */
  367. </style>