d17b146641b1e59e02433100794f5dded8bb865a.svn-base 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050
  1. <template>
  2. <div class="head" :class="newIsShrink ?'hiddenbox':'bgcolor'">
  3. <div style="padding-top:2rem; height:100%;width:90%" class="baffleBox" v-show="!newIsShrink">
  4. <div class="allBox">
  5. <div class="box">
  6. <div class="row allAlignment center">
  7. <span style="color:#f8f8f8;font-size:0.24rem;">余额:{{cash}}</span>
  8. <span style="font-size:0.28rem; color:#333333;font-weight:bold">投注单</span>
  9. <img style="width:.50rem;height:0.8rem" :src="img_size" alt @click="shrink()">
  10. <!-- style="color:#33333;font-size:0.24rem;" -->
  11. </div>
  12. </div>
  13. <!-- 数据列表 -->
  14. <div
  15. class="titleBox"
  16. v-for="(item,index) in dataList"
  17. :key="index"
  18. @click="activekey(index)"
  19. >
  20. <div class="tilteMatch">
  21. <div class="row center allAlignment" style="height:.5rem;padding-left:0.32rem">
  22. <span :style="item.repeat? 'background: #f76649;':'' ">{{item.play_name}}</span>
  23. <span class="cancel" @click.stop="delarr(item.p_code,item.id)">
  24. <img style="width:.25rem;height:.25rem" :src="img" alt>
  25. </span>
  26. </div>
  27. <div class="tilteMatchDiv" style="min-height:1rem;padding:0 .32rem">
  28. <div class="row item-center" style="height:50%">
  29. <div v-if="item.p_code =='capot'">
  30. <span>{{item.name}}</span>&emsp;
  31. <span>{{item.condition == 1 ? item.home_team :item.condition == 'x'? '和局':item.condition == 2? item.guest_team:item.condition }}</span>@
  32. <span>{{item.odds}}</span>
  33. </div>
  34. <div v-else>
  35. <span>{{item.name}}</span>&emsp;
  36. <span>{{item.condition}}</span>@
  37. <span>{{item.odds}}</span>
  38. </div>
  39. </div>
  40. <div class="row item-center" style="height:50%;">
  41. <span>{{item.home_team}}</span>
  42. <span style="color:#F76649">vs</span>
  43. <span>{{item.guest_team}}</span>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="bettingInput row item-center allAlignment">
  48. <div class="inputBox row allAlignment">
  49. <input
  50. class="input_text"
  51. type
  52. @click.stop="go()"
  53. v-model="bettingNumber[index]"
  54. placeholder="投注额"
  55. @click="activekey(index)"
  56. >
  57. <span style="padding:0 0.22rem;" @click.stop="ClearData(index)">
  58. <img style="width:.2rem;height:.2rem" :src="img" alt>
  59. </span>
  60. </div>
  61. <div class>
  62. <span v-if="bettingNumber[index]">{{(bettingNumber[index]*item.odds).toFixed(2)}}</span>
  63. <span v-else>可赢额</span>
  64. </div>
  65. </div>
  66. <div class="bottonBox row allAlignment" v-show="clickIndex==index">
  67. <div class="bottonBox-num column allAlignment center">
  68. <div @click="additionFun(100,index) ">+100</div>
  69. <div @click="additionFun(1000,index) ">+1000</div>
  70. <div @click="additionFun(10000,index) ">+10000</div>
  71. </div>
  72. <div class="column allAlignment center" >
  73. <div class="row allAlignment center" style="width:3.8rem">
  74. <div v-for=" n in 3" @click="updateNumber(n,index)">
  75. <button>{{n}}</button>
  76. </div>
  77. </div>
  78. <div class="row allAlignment center" style="width:3.8rem">
  79. <div v-for=" n in 3" @click="updateNumber(n+3,index)">
  80. <button>{{n+3}}</button>
  81. </div>
  82. </div>
  83. <div class="row allAlignment center" style="width:3.8rem">
  84. <div v-for=" n in 3" @click="updateNumber(n+6,index)">
  85. <button>{{n+6}}</button>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="column allAlignment center" >
  90. <button class="btn-right" @click="delNumder(index)" >x</button>
  91. <button class="btn-right" style="margin:0.1rem 0;" @click="updateNumber('0',index)">0</button>
  92. <button class="btn-right" @click="updateNumber('00',index)">00</button>
  93. </div>
  94. </div>
  95. </div>
  96. <!-- 单注 -->
  97. <div class="showNumber" @click.stop="activekey('all')">
  98. <div v-if="dataList.length>1">
  99. <span v-if="dataList" style="font-size:.3rem">单注</span>
  100. <div class="bettingInput row item-center allAlignment">
  101. <div class="inputBox row allAlignment">
  102. <input type @click="go()" v-model="arrNumber" placeholder="投注额">
  103. <span class="cancel" @click.stop="ClearData('all')">
  104. <img style="width:.2rem;height:.2rem" :src="img" alt>
  105. </span>
  106. <!-- <span @click.stop="ClearData('all')">x</span> -->
  107. </div>
  108. <div class>
  109. <span v-if="arrNumber">{{(datamMoney).toFixed(2)}}</span>
  110. <span v-else>可赢额</span>
  111. </div>
  112. </div>
  113. <!-- <div class="bottonBox" v-if="clickIndex=='all'">
  114. <div class="bottonBox-num row allAlignment" style="padding:0 .2rem">
  115. <div @click="additionFun(100,'all') ">+100</div>
  116. <div @click="additionFun(1000,'all')">+1000</div>
  117. <div @click="additionFun(10000,'all')">+10000</div>
  118. </div>
  119. <div style="margin-top:0.42rem;margin-bottom:0.42rem">
  120. <div class="row allAlignment center">
  121. <div v-for=" n in 6" @click="updateNumber(n,'all')">
  122. <button>{{n}}</button>
  123. </div>
  124. </div>
  125. <div class="row allAlignment center" style="margin-top:0.17rem;">
  126. <div v-for=" n in 3" @click="updateNumber(n+6,'all')">
  127. <button>{{n+6}}</button>
  128. </div>
  129. <button @click="updateNumber('0','all')">0</button>
  130. <button @click="updateNumber('00','all')">00</button>
  131. <button
  132. @click="delNumder('all')"
  133. style="background:rgb(247, 102, 73);font-size:.4rem;line-height:.86rem;"
  134. >x</button>
  135. </div>
  136. </div>
  137. </div> -->
  138. <div class="bottonBox row allAlignment" v-if="clickIndex=='all'">
  139. <div class="bottonBox-num column allAlignment center">
  140. <div @click="additionFun(100,'all') ">+100</div>
  141. <div @click="additionFun(1000,'all') ">+1000</div>
  142. <div @click="additionFun(10000,'all') ">+10000</div>
  143. </div>
  144. <div class="column allAlignment center" >
  145. <div class="row allAlignment center" style="width:3.8rem">
  146. <div v-for=" n in 3" @click="updateNumber(n,'all')">
  147. <button>{{n}}</button>
  148. </div>
  149. </div>
  150. <div class="row allAlignment center" style="width:3.8rem">
  151. <div v-for=" n in 3" @click="updateNumber(n+3,'all')">
  152. <button>{{n+3}}</button>
  153. </div>
  154. </div>
  155. <div class="row allAlignment center" style="width:3.8rem">
  156. <div v-for=" n in 3" @click="updateNumber(n+6,'all')">
  157. <button>{{n+6}}</button>
  158. </div>
  159. </div>
  160. </div>
  161. <div class="column allAlignment center" >
  162. <button class="btn-right" @click="delNumder('all')" >x</button>
  163. <button class="btn-right" style="margin:0.1rem 0;" @click="updateNumber('0','all')">0</button>
  164. <button class="btn-right" @click="updateNumber('00','all')">00</button>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. <!-- 过关投注 && compound.length > 0 -->
  170. <div v-if="!passThroughPlay && dataList.length > 2 ">
  171. <yd-accordion>
  172. <yd-accordion-item title="复式连串过关投注" open>
  173. <div
  174. class="showNumber"
  175. v-for="(item,index) in compound"
  176. @click.stop="activekey('through'+index)"
  177. >
  178. <span v-if="dataList" style="font-size:.3rem">{{item.title}}</span>
  179. <div class="bettingInput row item-center allAlignment">
  180. <div class="row center">
  181. <div class="inputBox row allAlignment">
  182. <input type @click="go()" v-model="item.money " placeholder="投注额">
  183. <!-- <span @click.stop="ClearData('through')">x</span> -->
  184. <span class="cancel" @click.stop="ClearData('through',index)">
  185. <img style="width:.2rem;height:.2rem" :src="img" alt>
  186. </span>
  187. </div>
  188. <span style="font-size:0.26rem;margin-left: 0.1rem;">X{{item.index}}</span>
  189. </div>
  190. <div class>
  191. <span v-if="item.money*1 > 0 ">{{(item.money * item.odds).toFixed(2)}}</span>
  192. <span v-else>可赢额</span>
  193. </div>
  194. </div>
  195. <!-- <div class="bottonBox" v-if="clickIndex=='through'+index">
  196. <div class="bottonBox-num " style="padding:0 .2rem">
  197. <div @click="additionFun(100,'through',index) ">+100</div>
  198. <div @click="additionFun(1000,'through',index)">+1000</div>
  199. <div @click="additionFun(10000,'through',index)">+10000</div>
  200. </div>
  201. <div style="margin-top:0.42rem;margin-bottom:0.42rem">
  202. <div class="row allAlignment center">
  203. <div v-for=" n in 6" @click="updateNumber(n,'through',index)">
  204. <button>{{n}}</button>
  205. </div>
  206. </div>
  207. <div class="row allAlignment center" style="margin-top:0.17rem;">
  208. <div v-for=" n in 3" @click="updateNumber(n+6,'through',index)">
  209. <button>{{n+6}}</button>
  210. </div>
  211. <button @click="updateNumber('0','through',index)">0</button>
  212. <button @click="updateNumber('00','through',index)">00</button>
  213. <button
  214. @click="delNumder('through',index)"
  215. style="background:rgb(247, 102, 73);font-size:.4rem;line-height:.86rem;"
  216. >x</button>
  217. </div>
  218. </div>
  219. </div> -->
  220. <div class="bottonBox row allAlignment" v-if="clickIndex=='through'+index">
  221. <div class="bottonBox-num column allAlignment center">
  222. <div @click="additionFun(100,'through',index) ">+100</div>
  223. <div @click="additionFun(1000,'through',index) ">+1000</div>
  224. <div @click="additionFun(10000,'through',index) ">+10000</div>
  225. </div>
  226. <div class="column allAlignment center" >
  227. <div class="row allAlignment center" style="width:3.8rem">
  228. <div v-for=" n in 3" @click="updateNumber(n,'through',index)">
  229. <button>{{n}}</button>
  230. </div>
  231. </div>
  232. <div class="row allAlignment center" style="width:3.8rem">
  233. <div v-for=" n in 3" @click="updateNumber(n+3,'through',index)">
  234. <button>{{n+3}}</button>
  235. </div>
  236. </div>
  237. <div class="row allAlignment center" style="width:3.8rem">
  238. <div v-for=" n in 3" @click="updateNumber(n+6,'through',index)">
  239. <button>{{n+6}}</button>
  240. </div>
  241. </div>
  242. </div>
  243. <div class="column allAlignment center" >
  244. <button class="btn-right" @click="delNumder('through',index)" >x</button>
  245. <button class="btn-right" style="margin:0.1rem 0;" @click="updateNumber('0','through',index)">0</button>
  246. <button class="btn-right" @click="updateNumber('00','through',index)">00</button>
  247. </div>
  248. </div>
  249. </div>
  250. </yd-accordion-item>
  251. </yd-accordion>
  252. <!-- <div class="row allAlignment center " style="height: 0.8rem;background: #ccc;padding: 0 0.2rem;">
  253. <span>复式连串过关投注</span>
  254. <img style="width:.4rem;height:.4rem" src="../assets/st-imges/xiangxia.png" alt="">
  255. </div>-->
  256. </div>
  257. <div v-if="passThroughPlay" class="row center" style="background:#f8f8f8;">
  258. <span style="color:red ">红色选项不可以结合进行过关投注</span>
  259. </div>
  260. <!-- 总数据展示 -->
  261. <div class="row allAlignment" style="padding:.1rem .2rem;background:#f8f8f8;">
  262. <span v-if="dataNum" class="showNumberSpan">所有投注({{dataNum}}):</span>
  263. <span v-else class="showNumberSpan">所有投注:</span>
  264. <span v-if="dataNumbe" style="font-size:0.24rem">{{(dataNumbe)}}</span>
  265. <span v-else style="font-size:0.24rem">0.00</span>
  266. </div>
  267. <div class="row allAlignment" style="padding:0 .2rem;background:#f8f8f8;">
  268. <span class="showNumberSpan">可赢金额:</span>
  269. <span
  270. v-if="datamMoney || compound_amount "
  271. style="font-size:0.24rem;color:#F76649;"
  272. >{{compound_amount *1 ?(compound_amount*1+datamMoney*1).toFixed(2):(datamMoney).toFixed(2)}}</span>
  273. <span v-else style="font-size:0.24rem;color:#F76649;">0.00</span>
  274. </div>
  275. <div style="background:#f8f8f8;padding:.1rem 0;border-radius: 0 0 .1rem .1rem; ">
  276. <div class="btn" style="background:#F76649;" @click="betOrder" v-if="isLogin">
  277. <span>确认投注</span>
  278. </div>
  279. <div class="btn" style="background:#F76649;" @click="loginReg" v-else>
  280. <span>登陆/注册</span>
  281. </div>
  282. <div class="btn" style="background:#A1A1A1;" @click="shrink">
  283. <span>添加更多的选择</span>
  284. </div>
  285. <div class="btn" style="background:#333;margin-bottom:.1rem;" @click.stop="alldel()">
  286. <span>全删除</span>
  287. </div>
  288. </div>
  289. </div>
  290. <!-- <div class="loading_box row center" >
  291. <div class="weui-loading"></div>
  292. </div>-->
  293. </div>
  294. <div
  295. class="shrink"
  296. :style="newIsShrink?'':'display:none'"
  297. @click="show()"
  298. >
  299. 投注单--选项
  300. <span class="num">{{dataList?dataList.length:'0'}}</span>
  301. </div>
  302. <div></div>
  303. <div v-if="isshow" class="login">
  304. <Login></Login>
  305. </div>
  306. <div v-else-if="rgShow" class="login">
  307. <register></register>
  308. </div>
  309. </div>
  310. </template>
  311. <script>
  312. import "../css/index.css";
  313. import Login from "@/pages/Login/index/StLogin";
  314. import register from "@/pages/Login/index/register";
  315. export default {
  316. data() {
  317. return {
  318. img: require("../assets/st-imges/del.png"),
  319. img_size: require("../assets/st-imges/narrow.png"),
  320. bettingNumber: [],
  321. balance: "", //余额
  322. bettingquantity: "", // 投注信息
  323. betting: "",
  324. dataList: [],
  325. arr: [], // 是否缩小
  326. isshrink: false, //小键盘显示位
  327. clickIndex: 0,
  328. // money:0,//可赢金额
  329. arrNumber: "", //单注数量
  330. dataNum: 0, //已投注数量
  331. dataNumbe: 0, //总投数
  332. datamMoney: 0, //可赢总金额
  333. isThrough: false, //触发过关玩法
  334. cash: 0.0, //余额
  335. compound: [], //复合玩法
  336. passThroughPlay: false, //判断比赛数据是否有相同赛事
  337. isLogin: false, //是否登陆
  338. isshow: false, //登陆显示/隐藏
  339. rgShow: false, //注册显示/隐藏
  340. compound_amount: "", //复合玩法可赢金额
  341. isSubmit: false //防止重复提交
  342. };
  343. },
  344. components: {
  345. Login,
  346. register
  347. },
  348. methods: {
  349. //
  350. /*---------------------------------- */
  351. //阻止input框获取焦点
  352. go: function() {
  353. document.activeElement.blur();
  354. },
  355. /*---------------------------------- */
  356. //小键盘数字字符串拼接
  357. updateNumber: function(val, index, num) {
  358. // console.log(index);
  359. let temporaryData = "";
  360. let isNumbers = true;
  361. if (index != "through" && index == "all") {
  362. temporaryData =
  363. this.arrNumber * 1 ? this.arrNumber + val + "" : val + "";
  364. if (temporaryData * 1 > 999999999) {
  365. temporaryData = 999999999 + "";
  366. }
  367. this.arrNumber = temporaryData;
  368. }
  369. if (index == "through") {
  370. isNumbers = false;
  371. let dataVal =
  372. this.compound[num].money * 1 > 0
  373. ? this.compound[num].money + (val + "")
  374. : val + "";
  375. if (dataVal * 1 > 999999999) {
  376. dataVal = 999999999 + "";
  377. }
  378. this.$set(this.compound[num], "money", dataVal);
  379. } else {
  380. this.dataList.forEach((e, i) => {
  381. if (index != "all" && index != "through") {
  382. if (index == i) {
  383. temporaryData =
  384. this.bettingNumber[index] * 1
  385. ? this.bettingNumber[index] + (val + "")
  386. : val + "";
  387. if (temporaryData * 1 > 999999999) {
  388. temporaryData = 999999999 + "";
  389. }
  390. this.bettingNumber.splice(index, 1, temporaryData);
  391. this.arrNumber = "";
  392. }
  393. } else if (index == "all") {
  394. this.bettingNumber.splice(i, 1, temporaryData);
  395. }
  396. });
  397. }
  398. this.profitFun();
  399. },
  400. /*---------------------------------------------*/
  401. //投注加法
  402. additionFun: function(val, index, num) {
  403. let data = "";
  404. let isNumbers = true;
  405. if (index != "through" && index == "all") {
  406. let dataAdd = 0;
  407. data =
  408. this.arrNumber * 1 ? this.arrNumber * 1 + val * 1 + "" : val + "";
  409. if (data * 1 > 999999999) {
  410. data = 999999999 + "";
  411. }
  412. this.arrNumber = data;
  413. }
  414. if (index == "through") {
  415. isNumbers = false;
  416. let dataVal =
  417. this.compound[num].money * 1 > 0
  418. ? this.compound[num].money * 1 + val * 1
  419. : val + "";
  420. if (dataVal * 1 > 999999999) {
  421. dataVal = 999999999 + "";
  422. }
  423. this.$set(this.compound[num], "money", dataVal);
  424. } else {
  425. this.dataList.forEach((e, i) => {
  426. if (index != "all" && index != "through") {
  427. if (index == i) {
  428. data =
  429. this.bettingNumber[index] * 1
  430. ? this.bettingNumber[index] * 1 + val + ""
  431. : val + "";
  432. if (data * 1 > 999999999) {
  433. data = 999999999 + "";
  434. }
  435. this.bettingNumber.splice(index, 1, data);
  436. this.arrNumber = "";
  437. }
  438. } else if (index == "all") {
  439. this.bettingNumber.splice(i, 1, data);
  440. }
  441. });
  442. }
  443. //if(!isNumbers) return false;
  444. this.profitFun();
  445. },
  446. /*---------------------------------- */
  447. //删除投注数的一位数
  448. delNumder: function(index, num) {
  449. //console.log(this.compound);
  450. let Str = this.bettingNumber;
  451. let strVal = "";
  452. let isNumbers = true;
  453. if (index == "through") {
  454. isNumbers = false;
  455. strVal = this.compound[num].money.substring(
  456. 0,
  457. this.compound[num].money.length - 1
  458. );
  459. this.$set(this.compound[num], "money", strVal);
  460. } else {
  461. if (index != "all") {
  462. Str.forEach((e, i) => {
  463. if (i == index) {
  464. strVal = e;
  465. e = strVal.substring(0, strVal.length - 1);
  466. this.bettingNumber.splice(index, 1, e);
  467. this.arrNumber = "";
  468. }
  469. });
  470. } else {
  471. Str.forEach((e, i) => {
  472. strVal = e.substring(0, e.length - 1);
  473. // console.log(strVal);
  474. this.bettingNumber.splice(i, 1, strVal);
  475. });
  476. this.arrNumber = this.arrNumber.substring(
  477. 0,
  478. this.arrNumber.length - 1
  479. );
  480. }
  481. }
  482. //if(!isNumbers) return false;
  483. this.profitFun();
  484. },
  485. /*---------------------------------- */
  486. //清空input框数据
  487. ClearData: function(index, num) {
  488. let isNumbers = true;
  489. if (index == "through") {
  490. //console.log(num);
  491. isNumbers = false;
  492. this.$set(this.compound[num], "money", "");
  493. } else {
  494. this.bettingNumber.forEach((e, i) => {
  495. if (index != "all") {
  496. if (i == index) {
  497. this.bettingNumber.splice(index, 1, "");
  498. this.arrNumber = "";
  499. }
  500. } else if (index == "all") {
  501. this.bettingNumber.splice(i, 1, "");
  502. this.arrNumber = "";
  503. }
  504. });
  505. }
  506. //if(!isNumbers) return false;
  507. this.profitFun();
  508. },
  509. /*---------------------------------- */
  510. // 删除所有投注
  511. alldel() {
  512. let betting = this.$store.getters.getBetting;
  513. betting.forEach(e => {
  514. e.data = [];
  515. });
  516. this.$store.dispatch("SET_NOROLL", false);
  517. this.bettingNumber = [];
  518. this.$store.dispatch("BETTING", []);
  519. this.$store.dispatch("BETTING", betting);
  520. this.$public.setItem("box_size", 2);
  521. this.$store.dispatch("ISBETTING", "-1");
  522. this.$store.dispatch("DEL_TYPE", "all");
  523. this.profitFun();
  524. },
  525. /*---------------------------------- */
  526. // 激活投注框的小键盘
  527. activekey(index) {
  528. this.clickIndex = index;
  529. },
  530. /*---------------------------------- */
  531. // 删除指定的投注数据
  532. delarr(name, numid) {
  533. let betting = this.$store.getters.getBetting;
  534. betting.forEach(res => {
  535. if (res.title == name) {
  536. res.data.forEach((e, index) => {
  537. if (e.id == numid) {
  538. res.data.splice(index, 1);
  539. //删除数据也要删除想对应的值
  540. this.bettingNumber.splice(index, 1);
  541. }
  542. });
  543. }
  544. this.$store.dispatch("BETTING", []);
  545. this.$store.dispatch("BETTING", betting);
  546. });
  547. this.$store.dispatch("DEL_TYPE", numid);
  548. this.profitFun();
  549. },
  550. /*---------------------------------- */
  551. //投注窗口放大
  552. shrink() {
  553. this.isshrink = true;
  554. this.$public.setItem("box_size", 1);
  555. },
  556. /*---------------------------------- */
  557. //计算可赢金额(总额)
  558. profitFun() {
  559. let dataNum = 0;
  560. let dataNumbe = 0;
  561. let datamMoney = 0;
  562. let compound_amount = 0;
  563. this.bettingNumber.forEach((e, i) => {
  564. if (e) {
  565. dataNum++;
  566. dataNumbe += e * 1;
  567. datamMoney += e * 1 * this.dataList[i].odds;
  568. }
  569. });
  570. this.compound.forEach(e => {
  571. //console.log(e);
  572. if (e.money * 1 > 0) {
  573. dataNum += e.index * 1;
  574. dataNumbe += e.money * 1 * e.index * 1;
  575. compound_amount += e.money * e.odds;
  576. }
  577. });
  578. this.dataNum = dataNum;
  579. this.dataNumbe = dataNumbe + "";
  580. this.datamMoney = datamMoney;
  581. this.compound_amount = compound_amount;
  582. },
  583. /*---------------------------------- */
  584. //投注窗口缩小
  585. show() {
  586. this.isshrink = false;
  587. this.$public.setItem("box_size", 2);
  588. },
  589. /*---------------------------------- */
  590. //登陆
  591. loginReg() {
  592. let isShow = true;
  593. this.isshow = true;
  594. this.$store.dispatch("GET_ISSHOW", isShow);
  595. },
  596. /*------------------------------- */
  597. //投注确认提交
  598. betOrder() {
  599. // 给数据原型添加一个判断字符是否存在于数组
  600. Array.prototype.in_array=function(e){
  601. var r=new RegExp(','+e+',');
  602. return (r.test(','+this.join(this.S)+','));
  603. };
  604. //
  605. //error-5111' => '赔率唯一ID为空'
  606. //'error-7047' => '赔率条件不匹配',
  607. //'error-7048' => '赔率数据不匹配',
  608. //'error-7049' => '赔率数据过期',
  609. //'error 7050' => ' 赔率代码不匹配',
  610. //'error-7051' =>'未获取到赔率记录' ,
  611. //' error-7052' => '赔率玩法代码未获取' ,
  612. //' error-7053' => '赔率玩法代码无效",
  613. //'error-7029' => '未获取到赔率数据',
  614. let code_array= [5111,7050,7052,7029,7053,7051,7047,7048,7049];
  615. if (this.isSubmit) return false;
  616. let limitingCond = JSON.parse(this.$public.getItem('limitingCond'));
  617. this.isSubmit = true;
  618. let list = [],obj = {},obj1 = {};
  619. for (let i = 0; i < this.bettingNumber.length; i++) {
  620. // console.log();
  621. if(this.bettingNumber[i]*1 < limitingCond.lower_limit*1 && this.bettingNumber[i] != ''){
  622. this.$dialog.alert({ mes: `亲!你输入的投注额,小于最低投注限制${limitingCond.lower_limit}元` });
  623. this.isSubmit = false;
  624. return false;
  625. }
  626. if(this.bettingNumber[i]*1 > limitingCond.upper_limit*1){
  627. this.$dialog.alert({ mes: `亲!你输入的投注额,大于最高投注限制${limitingCond.upper_limit}元` });
  628. this.isSubmit = false;
  629. return false;
  630. }
  631. }
  632. this.dataList.forEach((res, index) => {
  633. //单式数据组合
  634. if (this.bettingNumber[index]) {
  635. obj = {
  636. type: "1",
  637. index: index,
  638. bet_amount: this.bettingNumber[index]
  639. };
  640. list.push(obj);
  641. }
  642. });
  643. //串式数据组合
  644. for (let index = 0; index < this.compound.length; index++) {
  645. if ( this.compound[index].money) {
  646. if(this.compound[index].money * 1 < limitingCond.lower_limit*1){
  647. this.$dialog.alert({ mes: `亲!你输入的投注额,小于最低投注限制${limitingCond.lower_limit}元` });
  648. this.isSubmit = false;
  649. return false;
  650. }
  651. if(this.compound[index].money * 1 > limitingCond.upper_limit*1){
  652. this.$dialog.alert({ mes: `亲!你输入的投注额,大于最高投注限制${limitingCond.upper_limit}元` });
  653. this.isSubmit = false;
  654. return false;
  655. }
  656. obj = {
  657. type: this.compound[index].title,
  658. // odds:e.odds,
  659. bet_amount: this.compound[index].money //e.amount
  660. };
  661. list.push(obj);
  662. }
  663. };
  664. list.push(this.dataList);
  665. // console.log(this.dataNumbe);
  666. if (list.length > 1 && this.dataNumbe *1 >0 ) {
  667. //if(limitingCond.lower_limit * 1 <= this.dataNumbe && limitingCond.upper_limit * 1 >= this.dataNumbe){
  668. let token = this.$public.getItem("token");
  669. this.$http.post(this.$ports.betOrder.Bet, {
  670. data: list,
  671. token,
  672. bet_money: this.dataNumbe
  673. }).then(res => {
  674. if (res.data.status == 1) {
  675. this.alldel();
  676. this.cash = (this.cash - this.dataNumbe * 1).toFixed(2);
  677. this.$dialog.alert({ mes: "亲!你已经投注成功啦。" });
  678. } else if (res.data.status == "-4001") {
  679. this.isLogin = false;
  680. this.$dialog.alert({ mes: "亲!你的登陆已过期。" });
  681. } else if (res.data.status == "4204") {
  682. this.$dialog.alert({ mes: "亲!你的余额不足。" });
  683. }else if(code_array.in_array(res.data.status)){
  684. this.$dialog.alert({ mes: "亲!赔率发生变法,请重新选择。" });
  685. this.alldel();
  686. }else{
  687. this.$dialog.alert({ mes: "错误代码:"+res.data.status});
  688. }
  689. this.isSubmit = false;
  690. });
  691. //}
  692. } else {
  693. this.$dialog.alert({ mes: "亲!你还未输入投注金额啦。" });
  694. this.isSubmit = false;
  695. }
  696. },
  697. /*---------------------------------- */
  698. //投注页面数据处理
  699. getDataList: function(val) {
  700. console.log()
  701. let arrays = [];
  702. this.dataList = [];
  703. if (val) {
  704. val.forEach(e => {
  705. if (e.data.length > 0) {
  706. e.data.forEach((res, index) => {
  707. if (this.bettingNumber.length < e.data.length) {
  708. this.bettingNumber.push("");
  709. }
  710. res.repeat = false;
  711. this.passThroughPlay = false;
  712. arrays.push(res);
  713. //console.log('什么数据',arrays);
  714. });
  715. }
  716. });
  717. this.dataList = arrays;
  718. //判断比赛数据是否相同赛事
  719. if (this.dataList.length > 1) {
  720. this.dataList.forEach((res, i) => {
  721. if(res.match_id == 0){
  722. res.repeat = true;
  723. this.passThroughPlay = true;
  724. }
  725. this.dataList.forEach((e, index) => {
  726. if (res.match_id == e.match_id && i != index) {
  727. e.repeat = true;
  728. this.passThroughPlay = true;
  729. }
  730. });
  731. });
  732. }
  733. // 查看是否还有数据确定是否要关闭窗口
  734. }
  735. if (this.dataList.length == 0) {
  736. this.$public.setItem("box_size", 2);
  737. this.$store.dispatch("ISBETTING", "-1");
  738. }
  739. //console.log('处理完成的数据',this.dataList);
  740. //判断是否有过关玩法
  741. if (this.dataList.length >= 3) {
  742. this.compound.splice(0, this.compound.length);
  743. this.isThrough = true;
  744. this.dataList.forEach((res, index) => {
  745. if (index >= 2) {
  746. //this.$public.betPlay(index+1,this.dataList)
  747. this.compound.push(this.$public.betPlay(index + 1, this.dataList));
  748. }
  749. });
  750. } else {
  751. this.compound.splice(0, this.compound.length);
  752. }
  753. this.$store.dispatch("DEL_TYPE", "");
  754. },
  755. /*---------------------------------- */
  756. //获取用户个人信息
  757. getUserInfo() {
  758. let token = this.$public.getItem("token");
  759. this.$http.post(this.$ports.login.getAgent, { token }).then(res => {
  760. //console.log('检测',res);
  761. if (res.data.status == 1 && res.data.data != null) {
  762. this.cash = res.data.data.cash;
  763. this.isLogin = true;
  764. } else {
  765. this.isLogin = false;
  766. }
  767. });
  768. }
  769. },
  770. /**
  771. *
  772. */
  773. computed: {
  774. //获取vuex投注数据
  775. getBetting: function() {
  776. return this.$store.getters.getBetting;
  777. },
  778. /*------------------------------*/
  779. //获取投注框放大缩小状态
  780. newIsShrink() {
  781. // 改变背景滑动
  782. this.$store.dispatch("SET_NOROLL", !this.isshrink);
  783. return this.isshrink;
  784. },
  785. //获取注册页面状态
  786. getRgShow() {
  787. return this.$store.getters.getRgShow;
  788. },
  789. //获取登陆页面状态
  790. getIsShow() {
  791. return this.$store.getters.getIsShow;
  792. },
  793. //获取用户token
  794. getToken() {
  795. return this.$store.getters.getToken;
  796. }
  797. },
  798. /**
  799. *
  800. */
  801. watch: {
  802. getIsShow(val) {
  803. this.isshow = val;
  804. },
  805. getBetting(val) {
  806. this.getDataList(val);
  807. },
  808. //显示注册页面
  809. getRgShow(val) {
  810. this.rgShow = val;
  811. this.isshow = val ? false : true;
  812. //console.log(this.rgShow);
  813. },
  814. getToken(val) {
  815. //this.getUserInfo();
  816. this.isLogin = true;
  817. }
  818. },
  819. /**
  820. * 页面初始化完成进行挂载
  821. */
  822. mounted() {
  823. if (this.$public.getItem("box_size") == 1) {
  824. this.isshrink = true;
  825. }
  826. this.getDataList(this.$store.getters.getBetting);
  827. this.getUserInfo();
  828. if (this.$public.getItem("token")) {
  829. this.isLogin = true;
  830. }
  831. }
  832. };
  833. </script>
  834. <style scoped>
  835. div /deep/ .yd-accordion-head {
  836. padding: 0 0.32rem;
  837. background: #a0a0a0;
  838. }
  839. div /deep/ .yd-accordion-title {
  840. color: #fefefe;
  841. font-size: 0.28rem;
  842. }
  843. div /deep/ .yd-accordion-head-arrow:after {
  844. border: none;
  845. width: 0.5rem;
  846. height: 0.5rem;
  847. background: url("../assets/st-imges/xiangxia.png") no-repeat;
  848. background-size: 100% 100%;
  849. }
  850. .login {
  851. z-index: 999999;
  852. position: fixed;
  853. top: 0;
  854. }
  855. .num {
  856. display: inline-block;
  857. width: 0.46rem;
  858. height: 0.46rem;
  859. background: #dcdcdc;
  860. border-radius: 50%;
  861. line-height: 0.46rem;
  862. text-align: center;
  863. color: #f76649;
  864. }
  865. .bgcolor {
  866. background: rgba(40, 40, 40, 0.75);
  867. height: 55rem;
  868. }
  869. .hiddenbox {
  870. height: 1rem;
  871. }
  872. .head {
  873. display: flex;
  874. justify-content: center;
  875. position: fixed;
  876. bottom: 0;
  877. left: 0;
  878. width: 100%;
  879. z-index: 1000000;
  880. }
  881. .baffleBox {
  882. position: fixed;
  883. overflow-y: scroll;
  884. top: 0;
  885. left: 0.4rem;
  886. width: 100%;
  887. height: 100%;
  888. -webkit-overflow-scrolling: touch;
  889. z-index: 29;
  890. box-sizing: border-box;
  891. }
  892. .baffleBox::-webkit-scrollbar {
  893. width: 0;
  894. height: 0;
  895. background: transparent;
  896. }
  897. .allBox {
  898. width: 100%;
  899. height: 100%;
  900. border-radius: 0.1rem 0.1rem;
  901. }
  902. .box {
  903. background: #f76649;
  904. border-radius: 0.1rem 0.1rem 0 0;
  905. height: 1rem;
  906. line-height: 1rem;
  907. padding: 0 0.32rem 0 0.22rem;
  908. }
  909. .bottonBox {
  910. /* margin-top: 0.1rem;*/
  911. padding: 0.22rem 0;
  912. background: #CFD3D9;
  913. }
  914. .titleBox {
  915. padding: 0.21rem 0.07rem;
  916. border-bottom: 1px solid #ebebeb;
  917. background: #f8f8f8;
  918. }
  919. .bettingInput {
  920. padding-right: 0.32rem;
  921. padding-left: 0.45rem;
  922. height: 0.9rem;
  923. margin-top: 0.1rem;
  924. }
  925. .inputBox {
  926. width: 2.6rem;
  927. height: 0.8rem;
  928. border: 1px solid #CFD3D9;
  929. border-radius: 0.1rem;
  930. line-height: 0.8rem;
  931. padding-left: 0.22rem;
  932. }
  933. input {
  934. border: 0;
  935. width: 1.7rem;
  936. }
  937. .tilteMatch {
  938. height: 1.52rem;
  939. background: #ebebeb;
  940. }
  941. .tilteMatchDiv {
  942. margin-left: 0.13rem;
  943. }
  944. .cancel {
  945. padding: 0 0.15rem;
  946. }
  947. .btn-right{
  948. color: #FFFFFF;
  949. background: #A7AFBC;
  950. }
  951. button {
  952. width: 1.2rem;
  953. height: 0.8rem;
  954. border: 0;
  955. background: #FFFFFF;
  956. border-radius: 0.1rem;
  957. color: #000000;
  958. }
  959. .bottonBox-num > div {
  960. text-align: center;
  961. width: 1.2rem;
  962. height: 0.8rem;
  963. line-height: 0.8rem;
  964. border-radius: 0.1rem;
  965. color: #FFFFFF;
  966. background: #A7AFBC;
  967. }
  968. .showNumber {
  969. /* margin-top: 0.36rem; */
  970. border-bottom: 1px solid #ebebeb;
  971. background: #f8f8f8;
  972. padding-top: 0.2rem;
  973. padding: 0.21rem 0.2rem;
  974. }
  975. .btn {
  976. width: 100%;
  977. height: 0.94rem;
  978. border-radius: 0.1rem;
  979. line-height: 0.94rem;
  980. color: #f8f8f8;
  981. text-align: center;
  982. margin-top: 0.1rem;
  983. }
  984. .showNumberSpan {
  985. color: #363636;
  986. font-size: 0.28rem;
  987. }
  988. .shrink {
  989. height: 1rem;
  990. width: 100%;
  991. background: #f76649;
  992. color: #dcdcdc;
  993. position: fixed;
  994. left: 0;
  995. bottom: 0rem;
  996. line-height: 1rem;
  997. text-align: center;
  998. font-size: 0.3rem;
  999. }
  1000. .loading_box {
  1001. width: 3rem;
  1002. height: 3rem;
  1003. background: #ebebeb;
  1004. }
  1005. </style>