d89b10bf0483d0a8eefe6769534a3c4039a152b8.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <div class="head" :class="newIsShrink ?'hiddenbox':'bgcolor'">
  3. <div class="baffleBox allBox" v-show="!newIsShrink">
  4. <div class="box">
  5. <div class="row allAlignment center">
  6. <span style="color:#f8f8f8;font-size:0.24rem;">余额:0</span>
  7. <span style="font-size:0.28rem; color:#333333;font-weight:bold">投注单</span>
  8. <span style="color:#33333;font-size:0.24rem;" @click="shrink()">
  9. <img style="width:.25rem;height:.25rem" :src="img" alt>
  10. </span>
  11. </div>
  12. </div>
  13. <div
  14. class="titleBox"
  15. v-for="(item,index) in dataList"
  16. :key="index"
  17. @click="activekey(index)"
  18. >
  19. <div class="tilteMatch">
  20. <div class="row item-center allAlignment" style="height:.5rem;padding:0 .32rem">
  21. <span style="font-size:.24rem">{{item.ganame}}</span>
  22. <span class="cancel" @click.stop="delarr(item.ganame,item.id)">
  23. <img style="width:.25rem;height:.25rem" :src="img" alt>
  24. </span>
  25. </div>
  26. <div class="tilteMatchDiv" style="height:1rem;padding:0 .32rem;font-size:.26rem">
  27. <div class="row item-center" style="height:50%">
  28. <span>{{item.name}}</span>&emsp;
  29. <span>{{item.condition}}</span>@
  30. <span>{{item.odds}}</span>
  31. </div>
  32. <div class="row item-center" style="height:50%;font-size:.24rem">
  33. <span>{{item.home_team}}</span>
  34. <span style="color:#F76649">vs</span>
  35. <span>{{item.guest_team}}</span>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="bettingInput row item-center average" @click="activekey(index)" >
  40. <div class="inputBox row allAlignment">
  41. <input type @click.stop="go()" v-bind:value="bettingNumberMgs" placeholder="投注额" @click="activekey(index)">
  42. <span @click="ClearData">
  43. <img style="width:.2rem;height:.2rem" :src="img" alt>
  44. </span>
  45. </div>
  46. <div class>
  47. <span>可赢额</span>
  48. </div>
  49. </div>
  50. <div class="bottonBox" v-show="item.isclick==true">
  51. <div class="bottonBox-num row allAlignment" style="padding:0 .2rem">
  52. <div>+100</div>
  53. <div>+1000</div>
  54. <div>+10000</div>
  55. </div>
  56. <div style="margin-top:0.42rem;margin-bottom:0.42rem">
  57. <div class="row allAlignment center">
  58. <div v-for=" n in 6" @click="updateNumber(n)">
  59. <button>{{n}}</button>
  60. </div>
  61. </div>
  62. <div class="row allAlignment center" style="margin-top:0.17rem;">
  63. <div v-for=" n in 3" @click="updateNumber(n+6)">
  64. <button>{{n+6}}</button>
  65. </div>
  66. <button @click="updateNumber('0')">0</button>
  67. <button @click="updateNumber('00')">00</button>
  68. <button
  69. @click="delNumder()"
  70. style="background:rgb(247, 102, 73);font-size:.4rem;line-height:.86rem;"
  71. >x</button>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <div class="showNumber" @click.stop="ISclick()">
  77. <div v-if="dataList.length>1">
  78. <span v-if="dataList" style="font-size:.3rem">单注</span>
  79. <div class="bettingInput row item-center average" v-if="dataList">
  80. <div class="inputBox row allAlignment">
  81. <input type @click="go()" v-bind:value="bettingNumberMgs" placeholder="投注额">
  82. <span @click="ClearData">x</span>
  83. </div>
  84. <div class>
  85. <span>可赢额</span>
  86. </div>
  87. </div>
  88. <div class="bottonBox" v-if="Isclick">
  89. <div class="bottonBox-num row allAlignment" style="padding:0 .2rem">
  90. <div>+100</div>
  91. <div>+1000</div>
  92. <div>+10000</div>
  93. </div>
  94. <div style="margin-top:0.42rem;margin-bottom:0.42rem">
  95. <div class="row allAlignment center">
  96. <div v-for=" n in 6" @click="updateNumber(n)">
  97. <button>{{n}}</button>
  98. </div>
  99. </div>
  100. <div class="row allAlignment center" style="margin-top:0.17rem;">
  101. <div v-for=" n in 3" @click="updateNumber(n+6)">
  102. <button>{{n+6}}</button>
  103. </div>
  104. <button @click="updateNumber('0')">0</button>
  105. <button @click="updateNumber('00')">00</button>
  106. <button
  107. @click="delNumder()"
  108. style="background:rgb(247, 102, 73);font-size:.4rem;line-height:.86rem;"
  109. >x</button>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="row allAlignment" style="padding:.1rem .2rem">
  114. <span class="showNumberSpan">所有投注:</span>
  115. <span style="font-size:0.24rem">0.00</span>
  116. </div>
  117. <div class="row allAlignment" style="padding:0 .2rem">
  118. <span class="showNumberSpan">可赢金额:</span>
  119. <span style="font-size:0.24rem;color:#F76649;">0.00</span>
  120. </div>
  121. </div>
  122. <!-- <span>红色选项不可以结合进行过关投注<span> -->
  123. <div class="btn" style="background:#F76649;">
  124. <span>投注</span>
  125. </div>
  126. <div class="btn" style="background:#A1A1A1;">
  127. <span>添加更多的选择</span>
  128. </div>
  129. <div class="btn" style="background:#333;margin-bottom:.5rem;" @click.stop="alldel()">
  130. <span>全删除</span>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="shrink" :style="newIsShrink?'':'display:none'" @click="show()">
  135. 投注单--选项
  136. <span class="num">{{dataList?dataList.length:'0'}}</span>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. import "../css/index.css";
  142. export default {
  143. data() {
  144. return {
  145. img: require("../assets/st-imges/del.png"),
  146. bettingNumber: "",
  147. //余额
  148. balance: "",
  149. // 全部可赢金额
  150. allmoney: "",
  151. // 全部投注金额
  152. allbetmoney: "",
  153. // 参与投注的项目数目
  154. bettingquantity: "",
  155. // 投注信息
  156. betting: "",
  157. dataList: [],
  158. arr: [],
  159. // 是否缩小
  160. isshrink: false,
  161. Isclick: false
  162. };
  163. },
  164. methods: {
  165. /*---------------------------------- */
  166. go: function() {
  167. document.activeElement.blur();
  168. },
  169. /*---------------------------------- */
  170. updateNumber: function(val) {
  171. this.bettingNumber += val;
  172. },
  173. /*---------------------------------- */
  174. delNumder: function() {
  175. let Str = this.bettingNumber;
  176. this.bettingNumber = Str.substring(0, Str.length - 1);
  177. },
  178. /*---------------------------------- */
  179. ClearData: function() {
  180. this.bettingNumber = "";
  181. },
  182. /*---------------------------------- */
  183. // 删除所有投注
  184. alldel() {
  185. let betting = this.$store.getters.getBetting;
  186. betting.forEach(e=>{
  187. e.data=[]
  188. })
  189. this.$store.dispatch("BETTING", []);
  190. this.$store.dispatch("BETTING", betting);
  191. this.$public.setCache("box_size", 2);
  192. this.$store.dispatch("ISBETTING", false);
  193. this.$store.dispatch('DEL_TYPE','all');
  194. },
  195. /*---------------------------------- */
  196. // 激活投注框的小键盘
  197. activekey(index) {
  198. this.dataList.forEach((e,i)=>{
  199. this.Isclick=false
  200. this.$set(this.dataList[i],'isclick',false)
  201. })
  202. this.$set(this.dataList[index],'isclick',true)
  203. },
  204. /*---------------------------------- */
  205. // 删除指定的投注
  206. delarr(name, numid) {
  207. let betting = this.$store.getters.getBetting;
  208. betting.forEach(res => {
  209. if (res.title == name) {
  210. res.data.forEach((e, index) => {
  211. if (e.id == numid) {
  212. res.data.splice(index, 1);
  213. }
  214. });
  215. }
  216. this.$store.dispatch("BETTING", []);
  217. this.$store.dispatch("BETTING", betting);
  218. });
  219. this.$store.dispatch('DEL_TYPE',numid)
  220. },
  221. /*---------------------------------- */
  222. //投注窗口放大
  223. shrink() {
  224. this.isshrink = true;
  225. this.$public.setCache("box_size", 1);
  226. },
  227. /*---------------------------------- */
  228. //投注窗口缩小
  229. show() {
  230. this.isshrink = false;
  231. this.$public.setCache("box_size", 2);
  232. },
  233. /*---------------------------------- */
  234. //激活单注的小键盘
  235. ISclick() {
  236. this.dataList.forEach((e,i)=>{
  237. this.Isclick=false
  238. this.$set(this.dataList[i],'isclick',false)
  239. })
  240. this.Isclick = true;
  241. }
  242. },
  243. computed: {
  244. //获取vuex投注数据
  245. getBetting: function() {
  246. let betting = this.$store.getters.getBetting;
  247. let array = [];
  248. if (betting) {
  249. betting.forEach(e => {
  250. e.data.forEach(res => {
  251. array.push(res);
  252. });
  253. });
  254. this.dataList = array;
  255. // 查看是否还有数据确定是否要关闭窗口
  256. }
  257. if(array==false){
  258. this.$public.setCache("box_size", 2);
  259. this.$store.dispatch("ISBETTING", false);
  260. }
  261. return this.dataList;
  262. },
  263. //获取投注金额
  264. bettingNumberMgs: function() {
  265. return this.bettingNumber;
  266. },
  267. /*------------------------------*/
  268. //获取投注框放大缩小状态
  269. newIsShrink() {
  270. return this.isshrink;
  271. }
  272. },
  273. watch: {
  274. Isshow(obj) {},
  275. getBetting(val) {}
  276. },
  277. mounted() {
  278. if (this.$public.getCache("box_size") == 1) {
  279. this.isshrink = true;
  280. }
  281. }
  282. };
  283. </script>
  284. <style scoped>
  285. .num {
  286. display: inline-block;
  287. width: 0.46rem;
  288. height: 0.46rem;
  289. background: #dcdcdc;
  290. border-radius: 50%;
  291. line-height: 0.46rem;
  292. text-align: center;
  293. color: #f76649;
  294. }
  295. .bgcolor {
  296. background: rgba(40, 40, 40, 0.75);
  297. height: 55rem;
  298. }
  299. .hiddenbox {
  300. height: 1rem;
  301. }
  302. .head {
  303. position: relative;
  304. display: flex;
  305. justify-content: center;
  306. position: fixed;
  307. top: 0;
  308. width: 100%;
  309. z-index: 1000000;
  310. }
  311. .baffleBox {
  312. position: fixed;
  313. overflow-y: scroll;
  314. top: 0;
  315. left: 0.4rem;
  316. width: 100%;
  317. height: 100%;
  318. -webkit-overflow-scrolling: touch;
  319. z-index: 29;
  320. box-sizing: border-box;
  321. }
  322. .allBox {
  323. margin-top: 1.04rem;
  324. width: 90%;
  325. height: 11.5rem;
  326. overflow-y: auto;
  327. background: #f8f8f8;
  328. border-radius: 0.1rem 0.1rem;
  329. }
  330. .box {
  331. background: #f76649;
  332. border-radius: 0.1rem 0.1rem 0 0;
  333. height: 1rem;
  334. line-height: 1rem;
  335. padding: 0 0.32rem 0 0.22rem;
  336. }
  337. .bottonBox {
  338. margin-top: 0.1rem;
  339. padding: 0.22rem;
  340. background: #ccc;
  341. }
  342. .titleBox {
  343. padding: 0.21rem 0.07rem;
  344. }
  345. .bettingInput {
  346. height: 0.9rem;
  347. margin-top: 0.1rem;
  348. }
  349. .inputBox {
  350. width: 4.31rem;
  351. height: 0.8rem;
  352. border: 1px solid #f76649;
  353. border-radius: 0.1rem;
  354. line-height: 0.8rem;
  355. padding: 0 0.22rem;
  356. }
  357. input {
  358. border: 0;
  359. }
  360. .tilteMatch {
  361. height: 1.52rem;
  362. background: #ebebeb;
  363. }
  364. .tilteMatchDiv {
  365. margin-left: 0.13rem;
  366. }
  367. .cancel {
  368. padding: 0 0.25rem;
  369. }
  370. button {
  371. width: 0.96rem;
  372. height: 0.88rem;
  373. border: 0;
  374. background: #a1a1a1;
  375. border-radius: 0.1rem;
  376. color: #f8f8f8;
  377. }
  378. .bottonBox-num > div {
  379. display: flex;
  380. justify-content: space-around;
  381. align-items: center;
  382. width: 1.8rem;
  383. height: 0.8rem;
  384. border-radius: 0.2rem;
  385. color: #ebebeb;
  386. background: #a1a1a1;
  387. }
  388. .showNumber {
  389. margin-top: 0.36rem;
  390. border-top: 1px solid #ebebeb;
  391. padding-top: 0.2rem;
  392. padding: 0.21rem 0.2rem;
  393. }
  394. .btn {
  395. width: 100%;
  396. height: 0.94rem;
  397. border-radius: 0.1rem;
  398. line-height: 0.94rem;
  399. color: #f8f8f8;
  400. text-align: center;
  401. margin-top: 0.2rem;
  402. }
  403. .showNumberSpan {
  404. color: #363636;
  405. font-size: 0.28rem;
  406. }
  407. .shrink {
  408. height: 1rem;
  409. width: 100%;
  410. background: #f76649;
  411. color: #dcdcdc;
  412. position: fixed;
  413. bottom: 0rem;
  414. line-height: 1rem;
  415. text-align: center;
  416. font-size: 0.3rem;
  417. }
  418. </style>