recharge.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. {extend name="layout/base" /}
  2. {block name="title"}<title>麻花网络</title>{/block}
  3. {block name="header"}
  4. <!-- 引入样式 -->
  5. <!-- import CSS -->
  6. <!--引入 element-ui 的样式,-->
  7. <!--<link rel="stylesheet" href="https://unpkg.com/vant@2.12/lib/index.css"/>-->
  8. <!--<link rel="stylesheet" href="http://at.alicdn.com/t/font_2742661_uo77yoc5uc.css">-->
  9. <!--&lt;!&ndash; 必须先引入vue, 后使用element-ui &ndash;&gt;-->
  10. <!--<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>-->
  11. <!--&lt;!&ndash; 引入element 的组件库&ndash;&gt;-->
  12. <!--<script src="https://unpkg.com/vue@2.6/dist/vue.min.js"></script>-->
  13. <!--<script src="https://unpkg.com/vant@2.12/lib/vant.min.js"></script>-->
  14. <link rel="stylesheet" href="__STATIC__/vue/index.css"/>
  15. <link rel="stylesheet" href="__STATIC__/vue/font_2742661_uo77yoc5uc.css">
  16. <!-- 必须先引入vue, 后使用element-ui -->
  17. <script src="__STATIC__/vue/vue.js"></script>
  18. <!-- 引入element 的组件库-->
  19. <script src="__STATIC__/vue/vue.min.js"></script>
  20. <script src="__STATIC__/vue/vant.min.js"></script>
  21. <link rel="stylesheet" href="__STATIC__/css/mobile/swiper.min.css">
  22. <link rel="stylesheet" href="__STATIC__/css/mobile/index.css">
  23. <script src="__STATIC__/js/jquery v1.11.3.min.js"></script>
  24. <link rel="stylesheet" href="__STATIC__/css/coin/mobile.css">
  25. <!--<link rel="stylesheet" href="__STATIC__/css/coin/reset.css">-->
  26. <style>
  27. .van-tabs--line .van-tabs__wrap {
  28. border-bottom: 0.04rem solid #ededed;
  29. }
  30. [data-v-225d8f26] .van-tabs__line {
  31. position: absolute;
  32. bottom: 15px;
  33. left: 0;
  34. z-index: 1;
  35. background: #2db7ff;
  36. border-radius: var(--van-tabs-bottom-bar-height);
  37. width: 1rem;
  38. }
  39. .van-tab__text--ellipsis {
  40. display: -webkit-box;
  41. overflow: hidden;
  42. -webkit-line-clamp: 1;
  43. -webkit-box-orient: vertical;
  44. font-size: 0.32rem;
  45. font-family: Source Han Sans SC;
  46. font-weight: bold;
  47. line-height: 0.48rem;
  48. color: #000000;
  49. }
  50. .van-tabs__line {
  51. position: absolute;
  52. bottom: 15px;
  53. left: 0;
  54. z-index: 1;
  55. background: #2db7ff;
  56. border-radius: var(--van-tabs-bottom-bar-height);
  57. width: 1rem;
  58. }
  59. </style>
  60. {/block}
  61. {block name="content"}
  62. <header class="top">
  63. <div class="header">
  64. <div class="logo"><a href="" title="麻花网络游戏"><img src="__STATIC__/images/mobile/logo.png"></a></div>
  65. <div class="search">
  66. <img src="__STATIC__/images/mobile/icon/search.png">
  67. <input type="text" placeholder="" onclick='location.href=("{:getMobileSearchUrl()}")' readonly="readonly">
  68. </div>
  69. <div class="menu"><img src="__STATIC__/images/mobile/icon/menu-bar.png"></div>
  70. </div>
  71. </header>
  72. <div id="app">
  73. <div class="box" style="padding: 0.55rem 0 0.1rem 0;">
  74. <div class="center">
  75. <van-tabs v-model="active" @change="handleTabs">
  76. <van-tab v-for="(item, index) in payList">
  77. <div slot="title" class="tabs" @click="tab = item.tab">
  78. <img :src=item.image alt=""/>
  79. <span>{{item.name}}</span>
  80. </div>
  81. <div class="tab_center">
  82. <div class="center_a">
  83. <div class="center_box" @click="showPicker = true" :value="value">
  84. <img src="__STATIC__/images/coin/路径 691@2x.png" alt="" class="center_box_imga"/>
  85. <span>{{ value }}</span>
  86. <img src="__STATIC__/images/coin/路径 514.png" alt="" class="center_box_imgb"/>
  87. </div>
  88. <van-popup v-model="showPicker" round position="bottom">
  89. <van-picker show-toolbar :columns="columns" @cancel="showPicker = false"
  90. @confirm="onConfirm"/>
  91. </van-popup>
  92. <div class="center_boxtwo" v-if="value == '当前账号'" @change="handleValue">
  93. <span style="margin-left: 0.2rem">{$userinfo['username'] ?? ''}</span>
  94. </div>
  95. <div class="center_boxtwo" v-if="value == '其他账号'" @change="handleValue">
  96. <input type="text" v-model="username" placeholder="请输入账号"
  97. @change="handleChangeUserName"/>
  98. <!-- <input type="text" v-model="passusername" placeholder="确定账号" @change="handleChangeUserName"/>-->
  99. </div>
  100. </div>
  101. <div class="center_b">请选择充值对象:</div>
  102. <div class="xz">
  103. <van-radio-group v-model="checkType" direction="horizontal">
  104. <van-radio name="2">游戏</van-radio>
  105. <van-radio name="1" style="margin-left: 0.4rem">平台币</van-radio>
  106. </van-radio-group>
  107. </div>
  108. <div class="center_b" v-show="checkType == 2">
  109. 请选择需要充值的游戏角色:
  110. </div>
  111. <div v-show="checkType == 2">
  112. <van-field readonly clickable label="游戏名称" :value="gameName" placeholder="选择游戏名称"
  113. @click="showPickereGame = true">
  114. </van-field>
  115. <van-popup v-model="showPickereGame" round position="bottom">
  116. <van-picker show-toolbar :columns="gameList" @cancel="showPickereGame = false"
  117. @confirm="onConfirmeGame">
  118. </van-popup>
  119. <van-field readonly clickable label="区服名称" :value="serverName" placeholder="选择区服名称"
  120. @click="showPickereServer = true">
  121. </van-field>
  122. <van-popup v-model="showPickereServer" round position="bottom">
  123. <van-picker show-toolbar :columns="serverList" @cancel="showPickereServer = false"
  124. @confirm="onConfirmeServer"/>
  125. </van-popup>
  126. <van-field readonly clickable label="角色名称" :value="roleName" placeholder="选择角色名称"
  127. @click="showPickereRole = true">
  128. </van-field>
  129. <van-popup v-model="showPickereRole" round position="bottom">
  130. <van-picker show-toolbar :columns="roleList" @cancel="showPickereRole = false"
  131. @confirm="onConfirmeRole"/>
  132. </van-popup>
  133. </div>
  134. <div class="center_b">
  135. <img src="__STATIC__/images/coin/复件 (1) 路径 627@2x.png" alt=""/><span>请选择充值金额:<span
  136. v-show="accountType == 1">(当前平台币余额:<span v-html="coin_amount"> </span>)</span> </span>
  137. </div>
  138. <div class="jo_item">
  139. <van-radio-group v-model="radio" @change="amountChange" direction="horizontal">
  140. <van-radio :name="'' + 10">10元 &#8197;</van-radio>
  141. <van-radio :name="'' + 20">20元 &#8197;</van-radio>
  142. <van-radio :name="'' + 50">50元 &#8197;&#8197;&#8197;</van-radio>
  143. <van-radio :name="'' + 100">100元 &#8197;</van-radio>
  144. </van-radio-group>
  145. </div>
  146. <div class="jo_item">
  147. <van-radio-group v-model="radio" @change="amountChange" direction="horizontal">
  148. <van-radio :name="'' + 200">200元</van-radio>
  149. <van-radio :name="'' + 500">500元</van-radio>
  150. <van-radio :name="'' + 1000">1000元</van-radio>
  151. <van-radio :name="'' + 2000">2000元</van-radio>
  152. </van-radio-group>
  153. </div>
  154. <div class="jo_item">
  155. <van-radio-group v-model="radio" @change="amountChange" direction="horizontal">
  156. <van-radio name="-1">其他金额</van-radio>
  157. </van-radio-group>
  158. <div class="ji_index">¥<input type="text" v-model="amount" name="amount" id="amount"
  159. @change="handleAmount" @focus="handleAmount"/></div>
  160. </div>
  161. <div class="butt" @click="dialogPay">立即充值</div>
  162. <div class="aaa" v-show="pageLoading">
  163. <van-loading class="loading-bg" type="spinner" color="#303030" size="24px" />加载中..
  164. </div>
  165. </div>
  166. </van-tab>
  167. <van-tab v-show="tab == 'coinpay'">
  168. <div slot="title" class="tabs" @click="tab = 'coinpay'">
  169. <img src="__STATIC__/images/coin/组 537@2x.png" alt=""/>
  170. <span>平台币</span>
  171. </div>
  172. <div class="tab_center">
  173. <div class="center_a">
  174. <div class="center_box" >
  175. <img src="__STATIC__/images/coin/路径 691@2x.png" alt="" class="center_box_imga"/>
  176. <span>当前账号:</span>
  177. <!-- <img src="__STATIC__/images/coin/路径 514.png" alt="" class="center_box_imgb"/>-->
  178. </div>
  179. <van-popup round position="bottom">
  180. <van-picker show-toolbar :columns="columns2" @cancel="showPicker = false"
  181. @confirm="onConfirm"/>
  182. </van-popup>
  183. <div class="center_boxtwo" @change="handleValue">
  184. <span style="margin-left: 0.2rem">{$userinfo['username'] ?? '未登录,请先登陆'}</span>
  185. </div>
  186. <!-- <div class="center_boxtwo" v-if="value == '其他账号'" @change="handleValue">-->
  187. <!-- <input type="text" v-model="username" placeholder="请输入账号"-->
  188. <!-- @change="handleChangeUserName"/>-->
  189. <!-- </div>-->
  190. </div>
  191. <div class="center_b">
  192. 请选择需要充值的游戏角色:
  193. </div>
  194. <div>
  195. <van-field readonly clickable label="游戏名称" :value="gameName" placeholder="选择游戏名称"
  196. @click="showPickereGame = true">
  197. </van-field>
  198. <van-popup v-model="showPickereGame" round position="bottom">
  199. <van-picker show-toolbar :columns="gameList" @cancel="showPickereGame = false"
  200. @confirm="onConfirmeGame">
  201. </van-popup>
  202. <van-field readonly clickable label="区服名称" :value="serverName" placeholder="选择区服名称"
  203. @click="showPickereServer = true">
  204. </van-field>
  205. <van-popup v-model="showPickereServer" round position="bottom">
  206. <van-picker show-toolbar :columns="serverList" @cancel="showPickereServer = false"
  207. @confirm="onConfirmeServer"/>
  208. </van-popup>
  209. <van-field readonly clickable label="角色名称" :value="roleName" placeholder="选择角色名称"
  210. @click="showPickereRole = true">
  211. </van-field>
  212. <van-popup v-model="showPickereRole" round position="bottom">
  213. <van-picker show-toolbar :columns="roleList" @cancel="showPickereRole = false"
  214. @confirm="onConfirmeRole"/>
  215. </van-popup>
  216. </div>
  217. <div class="center_b">
  218. <img src="__STATIC__/images/coin/复件 (1) 路径 627@2x.png" alt=""/><span>请选择充值金额:<span
  219. v-show="accountType == 1">(当前平台币余额:<span v-html="coin_amount"> </span>)</span> </span>
  220. </div>
  221. <div class="jo_item">
  222. <van-radio-group v-model="radio" @change="amountChange" direction="horizontal">
  223. <van-radio :name="'' + 10">10元 &#8197;</van-radio>
  224. <van-radio :name="'' + 20">20元 &#8197;</van-radio>
  225. <van-radio :name="'' + 50">50元 &#8197;&#8197;&#8197;</van-radio>
  226. <van-radio :name="'' + 100">100元 &#8197;</van-radio>
  227. </van-radio-group>
  228. </div>
  229. <div class="jo_item">
  230. <van-radio-group v-model="radio" @change="amountChange" direction="horizontal">
  231. <van-radio :name="'' + 200">200元</van-radio>
  232. <van-radio :name="'' + 500">500元</van-radio>
  233. <van-radio :name="'' + 1000">1000元</van-radio>
  234. <van-radio :name="'' + 2000">2000元</van-radio>
  235. </van-radio-group>
  236. </div>
  237. <div class="jo_item">
  238. <van-radio-group v-model="radio" @change="amountChange" direction="horizontal">
  239. <van-radio name="-1">其他金额</van-radio>
  240. </van-radio-group>
  241. <div class="ji_index">¥<input type="text" v-model="amount" name="amount" id="amount"
  242. @change="handleAmount" @focus="handleAmount"/></div>
  243. </div>
  244. <div v-if="mixValue!==0">
  245. <div class="mix">平台币余额不足,还需支付:<span v-html="pay_amount"></span>元</div>
  246. <div class="mix_item">请选择充值方式:</div>
  247. <ul class="mix_index">
  248. <li v-for="(item, index) in payCoinList" :class="{ actives: payRadio == item.tab }"
  249. @click="payRadio = item.tab">
  250. <img :src=item.image alt=""/>
  251. </li>
  252. </ul>
  253. </div>
  254. <div class="jo_item">
  255. <span style="color: red;font-size: 0.12rem">注:平台币订单如果提交未付款余额将在半小时后退回账户中</span>
  256. </div>
  257. <div class="butt" @click="dialogPay">立即充值</div>
  258. <div class="aaa" v-show="pageLoading">
  259. <van-loading class="loading-bg" type="spinner" color="#303030" size="24px"/>加载中..
  260. </div>
  261. </div>
  262. </van-tab>
  263. </van-tabs>
  264. </div>
  265. </div>
  266. </div>
  267. {/block}
  268. {block name="detail_js"}
  269. <script>
  270. username2 = "{$username2}"
  271. username3 = "{$userinfo['username'] ?? ''}"
  272. console.log(username3)
  273. verifyUserNameStatusStr = 0
  274. if (username2) {
  275. accountTypeStr = "其他账号"
  276. verifyUserNameStatusStr = 1
  277. } else {
  278. if (username3) {
  279. accountTypeStr = "当前账号"
  280. verifyUserNameStatusStr = 1
  281. } else {
  282. accountTypeStr = "其他账号"
  283. }
  284. }
  285. new Vue({
  286. el: '#app',
  287. data: function () {
  288. return {
  289. value: accountTypeStr,
  290. showPicker: false,
  291. columns: ["当前账号", "其他账号"],
  292. columns2: ["当前账号"],
  293. // columnse: ['杭州', '宁波', '温州', '绍兴', '湖州', '嘉兴', '金华', '衢州'],
  294. // valuee: '',
  295. showPickere: false,
  296. show: false,
  297. fieldValue: "",
  298. cascaderValue: "",
  299. radioe: "1",
  300. tab: "old-zfb-wap",
  301. active: "",
  302. radio: "10",
  303. amount: 10,
  304. accountType: 2,
  305. checkType: "2",
  306. username: username2,
  307. passusername: username2,
  308. username3: username3,
  309. payList: [
  310. {
  311. tab: 'old-zfb-wap',
  312. name: "支付宝支付",
  313. image: "__STATIC__/images/coin/路径 689@2x.png"
  314. },
  315. {
  316. tab: 'kdh5',
  317. name: "微信支付",//酷点扫码
  318. image: "__STATIC__/images/coin/减去 13@2x.png"
  319. },
  320. // {
  321. // tab: 'coinpay',
  322. // name: "平台币支付",
  323. // image: "__STATIC__/images/coin/m3.png"
  324. // },
  325. ],
  326. gameList: [],
  327. serverList: [],
  328. roleList: [],
  329. gameid: "",
  330. gameName: "",
  331. serverid: "",
  332. serverName: "",
  333. roleid: "",
  334. roleName: "",
  335. verifyUserNameStatus: verifyUserNameStatusStr,
  336. showPickereGame: false,
  337. showPickereServer: false,
  338. showPickereRole: false,
  339. mixValue: 0,
  340. payCoinList: [
  341. {
  342. tab: 'old-zfb-wap',
  343. name: "支付宝支付",//现在
  344. image: "__STATIC__/images/coin/zfb.png"
  345. },
  346. {
  347. tab: 'kdh5',
  348. name: "微信支付",//酷点扫码
  349. image: "__STATIC__/images/coin/wx.png"
  350. },
  351. ],
  352. payRadio: 'old-zfb-wap',
  353. coin_amount: 0,
  354. pay_amount: 0, //还需支付金额
  355. coin_amt: 0, //平台币支付金额
  356. pageLoading:false
  357. };
  358. },
  359. components: {},
  360. mounted() {
  361. // this.getPaytype()
  362. this.getGameList()
  363. this.handleValue()
  364. this.getCoin()
  365. },
  366. methods: {
  367. getCoin() {
  368. $.ajax({
  369. url: '/coin/getCoin',
  370. type: 'post',
  371. data: {},
  372. success: function (data) {
  373. if (data.code == 1) {
  374. that.coin_amount = data.data.amount
  375. } else {
  376. alert(data.msg)
  377. }
  378. }
  379. })
  380. },
  381. pay_amount_fun() { // 还需支付金额
  382. money = parseFloat(this.amount);
  383. if (!money) {
  384. money = 0;
  385. }
  386. if (money <= parseFloat(this.coin_amount) && this.accountType == 1) {
  387. this.pay_amount = 0
  388. this.coin_amt = this.amount
  389. this.mixValue = 0
  390. } else {
  391. if (this.accountType == 2) {
  392. counp_money = 0;
  393. } else {
  394. counp_money = parseFloat(this.coin_amount);
  395. }
  396. real_money = money - counp_money;
  397. real_money = real_money.toFixed(2);
  398. this.pay_amount = real_money;
  399. this.coin_amt = this.coin_amount
  400. this.mixValue = 1
  401. }
  402. },
  403. handleAmount() {
  404. if (this.amount && parseFloat(this.amount) > 0) {
  405. this.amount = parseFloat(this.amount).toFixed(0);
  406. }
  407. console.log(this.amount)
  408. this.radio = "-1"
  409. this.pay_amount_fun()
  410. },
  411. handleValue() {
  412. if (this.value == '其他账号') {
  413. this.accountType = 2
  414. } else {
  415. console.log(username3)
  416. if (!username3) {
  417. alert('当前未登录请先登陆')
  418. this.value = '其他账号'
  419. this.accountType = 2
  420. } else {
  421. this.accountType = 1
  422. }
  423. this.username = ''
  424. }
  425. this.gameid = ''
  426. this.serverid = ''
  427. this.roleid = ''
  428. this.gameName = ""
  429. this.serverName = ""
  430. this.roleName = ""
  431. this.serverList = []
  432. this.roleList = []
  433. },
  434. onConfirm(value) {
  435. this.value = value;
  436. this.handleValue()
  437. this.showPicker = false;
  438. },
  439. onConfirme(value) {
  440. this.valuee = value;
  441. console.log(value);
  442. this.showPickere = false;
  443. },
  444. onConfirmeGame(value) {
  445. this.gameid = value.id;
  446. this.gameName = value.text
  447. this.showPickereGame = false;
  448. this.handleChangeGame()
  449. },
  450. onConfirmeServer(value) {
  451. this.serverid = value.id;
  452. this.serverName = value.text
  453. this.showPickereServer = false;
  454. this.handleChangeServer()
  455. },
  456. onConfirmeRole(value) {
  457. this.roleid = value.id;
  458. this.roleName = value.text
  459. this.showPickereRole = false;
  460. },
  461. amountChange(val) {
  462. console.log(val)
  463. if (parseFloat(val) > 0) {
  464. this.amount = parseFloat(val).toFixed(0);
  465. this.pay_amount_fun()
  466. } else {
  467. this.amount = null
  468. }
  469. },
  470. handleTabs(val) {
  471. console.log(val)
  472. console.log(this.tab)
  473. if (this.tab == 'coinpay') {
  474. if (this.accountType != 1) {
  475. that = this
  476. that.gameid = ''
  477. that.serverid = ''
  478. that.roleid = ''
  479. that.gameName = ''
  480. that.serverName = ""
  481. that.roleName = ""
  482. }
  483. if (!username3) {
  484. alert('当前未登录请先登陆')
  485. }else{
  486. this.value = '当前账号'
  487. this.accountType = 1
  488. }
  489. this.pay_amount_fun()
  490. }
  491. },
  492. handleChangeUserName() {
  493. that = this
  494. that.verifyUserNameStatus = 0
  495. that.gameid = ''
  496. that.serverid = ''
  497. that.roleid = ''
  498. that.gameName = ""
  499. that.serverName = ""
  500. that.roleName = ""
  501. $.ajax({
  502. url: '/coin/verifyUserName',
  503. type: 'post',
  504. data: {username: that.username},
  505. success: function (data) {
  506. if (data.code == 1) {
  507. that.verifyUserNameStatus = 1
  508. that.pay_amount_fun()
  509. } else {
  510. alert(data.msg)
  511. }
  512. }
  513. })
  514. },
  515. handleChangeGame(val) {
  516. that = this
  517. that.serverid = ''
  518. that.roleid = ''
  519. that.serverName = ""
  520. that.roleName = ""
  521. if (this.accountType == 2 && this.verifyUserNameStatus != 1) {
  522. alert('请先输入账号验证')
  523. return
  524. }
  525. $.ajax({
  526. url: '/coin/getServerList',
  527. type: 'post',
  528. data: {gameid: that.gameid},
  529. success: function (data) {
  530. if (data.code == 1) {
  531. that.serverList = data.data
  532. } else {
  533. alert(data.msg)
  534. }
  535. }
  536. })
  537. },
  538. handleChangeServer() {
  539. that = this
  540. that.roleid = ''
  541. that.roleName = ""
  542. if (this.accountType == 2 && this.verifyUserNameStatus != 1) {
  543. alert('请先输入账号验证')
  544. return
  545. }
  546. if(this.accountType == 1 && !username3){
  547. alert('未登录,请先登录')
  548. return
  549. }
  550. $.ajax({
  551. url: '/coin/getRoleList',
  552. type: 'post',
  553. data: {
  554. gameid: that.gameid,
  555. serverid: that.serverid,
  556. accountType: that.accountType,
  557. username: that.username
  558. },
  559. success: function (data) {
  560. if (data.code == 1) {
  561. that.roleList = data.data
  562. that.pay_amount_fun()
  563. } else {
  564. alert(data.msg)
  565. }
  566. }
  567. })
  568. },
  569. getGameList() {
  570. that = this
  571. $.ajax({
  572. url: '/coin/getGameList',
  573. type: 'post',
  574. success: function (data) {
  575. if (data.code == 1) {
  576. that.gameList = data.data
  577. } else {
  578. alert(data.msg)
  579. }
  580. }
  581. })
  582. },
  583. dialogPay() {
  584. that = this
  585. if (this.accountType == 2 && this.verifyUserNameStatus != 1) {
  586. alert('请先输入账号验证')
  587. return
  588. }
  589. if (that.tab == 'coinpay') {
  590. if (!username3) {
  591. alert('未登录,请先登录')
  592. return
  593. }
  594. if (that.pay_amount > 0) {
  595. if (that.payRadio == '') {
  596. alert('请先输入选择支付方式')
  597. return
  598. }
  599. }
  600. }
  601. if (this.accountType == 2){
  602. username = that.username
  603. }else{
  604. username = username3
  605. }
  606. if(!that.amount){
  607. alert('请先输入金额')
  608. return
  609. }
  610. this.$dialog.confirm({
  611. title: "确认充值",
  612. message: " 您要充值的账号:<span style='color: #00a0e9'><b>"+username+"</b></span> 金额:<span style='color: #00a0e9'><b>"+that.amount+"</b></span>元",
  613. confirmButtonText: "确定",
  614. cancelButtonText: "取消"
  615. }).then(() => {
  616. that.pageLoading = true
  617. that.pay()
  618. }).catch(() => {
  619. console.log("点击了取消按钮噢")
  620. that.pageLoading = false
  621. })
  622. },
  623. pay() {
  624. if (this.accountType == 2 && this.verifyUserNameStatus != 1) {
  625. alert('请先输入账号验证')
  626. that.pageLoading = false
  627. return
  628. }
  629. that = this
  630. var tab = that.tab
  631. if (that.tab == 'coinpay') {
  632. if (!username3) {
  633. alert('未登录,请先登录')
  634. that.pageLoading = false
  635. return
  636. }
  637. if (that.pay_amount > 0) {
  638. if (that.payRadio == '') {
  639. alert('请先输入选择支付方式')
  640. that.pageLoading = false
  641. return
  642. }
  643. tab = 'coin-' + that.payRadio
  644. }
  645. that.checkType = 2
  646. } else {
  647. that.coin_amt = 0;
  648. }
  649. // if(that.checkType == 1 || that.accountType == 2){
  650. // that.coin_amt = 0;
  651. // }
  652. $.ajax({
  653. url: '/coin/pay',
  654. type: 'post',
  655. data: {
  656. type: that.checkType,
  657. paytype: tab,
  658. amount: that.amount,
  659. coin_amt: that.coin_amt,
  660. accountType: that.accountType,
  661. username: that.username,
  662. gameid: that.gameid,
  663. serverid: that.serverid,
  664. roleid: that.roleid
  665. },
  666. success: function (data) {
  667. that.pageLoading = false
  668. console.log(data)
  669. paytype = tab
  670. if (data.code == 1) {
  671. if (paytype == 'old-zfb-wap' || paytype == 'coin-old-zfb-wap') { //支付宝扫码(支付宝官方扫码)
  672. const div = document.createElement('div')
  673. div.innerHTML = data.data.alipay_param.mweb_url
  674. document.body.appendChild(div)
  675. document.forms[0].submit()
  676. } else if (paytype == 'kdh5' || paytype == 'coin-kdh5') { //微信扫码(ku_param)
  677. window.location.href = data.data.kdh5_param.mweb_url
  678. } else if (paytype == 'coinpay') {
  679. alert(data.msg)
  680. window.location.href = window.location.href
  681. }
  682. } else {
  683. alert(data.msg)
  684. }
  685. }
  686. })
  687. }
  688. },
  689. })
  690. </script>
  691. {/block}