23ac19e6cd963c14589a77c1c8c3e5dbf3de8494.svn-base 14 KB

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