index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. <template>
  2. <div
  3. class="login-container"
  4. >
  5. <!-- v-loading="loading"
  6. element-loading-text="Loading..."
  7. element-loading-svg-view-box="-10, -10, 50, 50"
  8. element-loading-background="rgba(0, 0, 0, 0.8)" -->
  9. <el-form ref="dataForm" :model="dataForm" :rules="ruleForm">
  10. <el-row :gutter="30">
  11. <el-col :span="4">
  12. <el-form-item label="游戏平台" prop="pid">
  13. <el-select v-model="dataForm.pid" placeholder="Select" class="filter-item">
  14. <el-option
  15. v-for="item in rechargePlatform"
  16. :key="item.pid"
  17. :label="item.platform"
  18. :value="item.pid"
  19. />
  20. </el-select>
  21. </el-form-item>
  22. <!-- <el-form-item label="渠道余额" style="width: 300px;">
  23. <el-input v-model="balanceMoney" type="number" class="inline-input filter-item" disabled style="width: 160px;" />&nbsp;元
  24. </el-form-item> -->
  25. <el-form-item label="渠道账号" prop="cid">
  26. <el-select v-model="dataForm.cid" placeholder="Select" class="filter-item">
  27. <el-option
  28. v-for="item in rechargeChannelPlatform"
  29. :key="item.cid"
  30. :label="item.account"
  31. :value="item.cid"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="选择游戏" prop="gfid">
  36. <el-select v-model="dataForm.gfid" placeholder="Select" class="filter-item">
  37. <el-option
  38. v-for="item in rechargeGame"
  39. :key="item.id"
  40. :label="item.name"
  41. :value="item.id"
  42. />
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item label="账户余额">
  46. <span>{{ user_money }}元</span>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="3">
  50. <el-form-item label="充值账户" prop="username" class="filter-item">
  51. <span style="font-size: 5px; color: #67C23A;">:{{ accountNum }}</span>
  52. <el-input
  53. v-model="dataForm.username"
  54. type="textarea"
  55. placeholder="请输入充值账户."
  56. :autosize="{ minRows: 15, maxRows: 60 }"
  57. @change="setAccountNum"
  58. />
  59. </el-form-item>
  60. </el-col>
  61. <el-col v-show="repeatNumList" :span="3">
  62. <el-form-item label="重复账号:" class="filter-item">
  63. <span style="font-size: 5px; color: #F56C6C;">:{{ repeatNumNum }}</span>
  64. <el-input
  65. v-model="repeatNumList"
  66. type="textarea"
  67. :autosize="{ minRows: 15, maxRows: 60 }"
  68. />
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="4">
  72. <el-form-item label="充值金额" prop="money">
  73. <el-input v-model="dataForm.money" type="number" min="0" :max="maxMoney" class="filter-item" />
  74. <span style="font-size: var(--el-font-size-extra-small); color: #909399;">最大充值金额:{{ maxMoney }}</span>
  75. </el-form-item>
  76. <!-- <el-form-item label="平台折扣">
  77. <span>9.8折</span>
  78. </el-form-item>
  79. <el-form-item label="游戏折扣">
  80. <span>9.8折</span>
  81. </el-form-item> -->
  82. <el-form-item label="支付方式">
  83. <el-radio-group v-model="dataForm.payway" prop="payway" class="filter-item">
  84. <el-radio :label="1">久币支付</el-radio>
  85. <!-- <el-radio :label="2">商务币支付</el-radio> -->
  86. </el-radio-group>
  87. </el-form-item>
  88. <el-form-item label="总支付金额">
  89. <span>{{ rechargeMoney }} 元</span>
  90. </el-form-item>
  91. <el-form-item label="账号检测">
  92. <el-radio-group v-model="onCheck" prop="payway" class="filter-item">
  93. <el-switch v-model="onCheck" />
  94. </el-radio-group>
  95. </el-form-item>
  96. <el-form-item label="是否充值">
  97. <el-radio-group v-model="onRecharge" prop="onRecharge" class="filter-item">
  98. <el-switch v-model="onRecharge" />
  99. </el-radio-group>
  100. </el-form-item>
  101. <el-form-item>
  102. <el-button type="primary" @click="onSubmit()">提交</el-button>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="9">
  106. 处理时间:<span>{{ startTime }}</span> -- <span>{{ endTime }}</span>
  107. <el-row :gutter="10">
  108. <el-col :span="8">
  109. <span style="font-size: 5px; color: #67C23A;">成功账户:{{ thenAccountNum }}</span>
  110. <el-input
  111. v-model="thenAccount"
  112. type="textarea"
  113. :autosize="{ minRows: 15, maxRows: 60 }"
  114. />
  115. </el-col>
  116. <el-col :span="8">
  117. <span style="font-size: 5px; color: #F56C6C;">失败账户:{{ catchAccountNum }}</span>
  118. <el-input
  119. v-model="catchAccount"
  120. type="textarea"
  121. :autosize="{ minRows: 15, maxRows: 60 }"
  122. />
  123. </el-col>
  124. <el-col :span="8">
  125. <span style="font-size: 5px; color: #F56C6C;">账户不存在:{{ noExistenceNum }}</span>
  126. <el-input
  127. v-model="noExistence"
  128. type="textarea"
  129. :autosize="{ minRows: 15, maxRows: 60 }"
  130. />
  131. </el-col>
  132. </el-row>
  133. </el-col>
  134. </el-row>
  135. </el-form>
  136. </div>
  137. </template>
  138. <script>
  139. var LodashArray = require('lodash/array')
  140. import { Message, MessageBox, Loading } from 'element-ui'
  141. import { rechargeChannelPlatformAccount } from '@/api/common'
  142. export default {
  143. name: 'Recharge',
  144. data() {
  145. return {
  146. loading: false,
  147. dataForm: {
  148. pid: 'd65aa6d7614589bffe62456b88e98811', // 游戏平台ID;默认魅族平台
  149. cid: '', // 渠道账号ID
  150. gfid: '', // 游戏ID
  151. paypwd: '', // 支付密码
  152. username: '', // 充值账户
  153. money: 1, // 充值金额(单位:元)
  154. recharge: 2, //
  155. payway: 1, // 充值方式
  156. type: 3 //
  157. },
  158. ruleForm: {
  159. pid: [{ required: true, message: '请选择平台.', trigger: 'change' }],
  160. cid: [{ required: true, message: '请选择渠道账号.', trigger: 'change' }],
  161. gfid: [{ required: true, message: '请选择游戏.', trigger: 'change' }],
  162. username: [{ required: true, message: '缺少充值账户.', trigger: 'blur' }],
  163. money: [{ required: true, message: '请输入充值金额,最低一元.', trigger: 'blur' }]
  164. },
  165. // 游戏平台列表
  166. rechargePlatform: [
  167. {
  168. 'pid': 'd65aa6d7614589bffe62456b88e98811',
  169. 'platform': 'MM',
  170. 'disRate': 9.8,
  171. 'rate': 9.7,
  172. 'type': 0,
  173. 'length': 2
  174. }
  175. ],
  176. // balanceMoney: 0, // 渠道余额
  177. user_money: 0, // 账户余额
  178. maxMoney: 0, // 最大充值金额
  179. rechargeChannelPlatform: [], // 渠道账号
  180. rechargeGame: [], // 游戏列表
  181. accountNum: 0, // 总账户个数
  182. repeatNumList: '', // 重复账号列表
  183. repeatNumNum: 0, // 重复账号个数
  184. thenAccount: '', // 成功账户
  185. thenAccountNum: 0, // 成功个数
  186. catchAccount: '', // 失败账户
  187. catchAccountNum: 0, // 失败个数
  188. noExistence: '', // 不存在账户
  189. noExistenceNum: 0, // 不存在账户个数
  190. startTime: 0, // 开始时间
  191. endTime: 0, // 结束时间
  192. onCheck: false, // 是否需要检测账号
  193. onRecharge: true, // 是否充值
  194. rechargeMoney: 0 // 支付总金额
  195. }
  196. },
  197. watch: {
  198. 'dataForm.money': {
  199. handler(val, oldVal) {
  200. this.checkMoney(val)
  201. }
  202. }
  203. },
  204. created() {
  205. // this.getBalanceMoney(this.dataForm.pid)
  206. this.getRechargePlatform(this.dataForm.pid)
  207. this.getRechargeGame(this.dataForm.pid)
  208. this.updateUserMoney()
  209. this.$store.dispatch('user/getF5').then((res) => {
  210. if (!res) {
  211. this.$store.dispatch('user/setF5')
  212. location.reload()
  213. }
  214. })
  215. },
  216. methods: {
  217. // 判断充值金额
  218. checkMoney(money) {
  219. this.rechargeMoney = this.accountNum * money
  220. if ((this.user_money - this.rechargeMoney) < 0) {
  221. // this.rechargeMoney = this.accountNum * oldVal
  222. return Message({
  223. type: 'warning',
  224. message: '账户余额不足以充值!'
  225. })
  226. }
  227. },
  228. // 更新用户余额
  229. updateUserMoney() {
  230. this.$store.dispatch('user/getInfo').then((res) => {
  231. const { data } = res
  232. this.user_money = Math.floor(data.user_money)
  233. if (this.accountNum > 0) {
  234. this.maxMoney = Math.floor(data.user_money / this.accountNum)
  235. } else {
  236. this.maxMoney = Math.floor(data.user_money)
  237. }
  238. return Message({
  239. type: 'success',
  240. message: '账户余额已更新'
  241. })
  242. })
  243. },
  244. // 统计充值账户数量并处理行数是否账号
  245. setAccountNum() {
  246. if (!this.dataForm.username) {
  247. return false
  248. }
  249. this.accountNum = 0
  250. this.repeatNumList = []
  251. this.repeatNumNum = 0
  252. var newQuestion = this.dataForm.username.replace(/\n\n/, '\n')
  253. const list = newQuestion.split('\n')
  254. var newList = []
  255. for (var i = 0; i < list.length; i++) {
  256. if (list[i] === '') {
  257. continue
  258. }
  259. // 账户去重,并提示
  260. if (newList.indexOf(list[i]) === -1) {
  261. this.accountNum++
  262. newList.push(list[i])
  263. } else {
  264. if (this.repeatNumList.indexOf(list[i]) === -1) {
  265. this.repeatNumNum++
  266. this.repeatNumList.push(list[i])
  267. }
  268. }
  269. }
  270. this.repeatNumList = this.repeatNumList.join().replace(new RegExp(',', 'g'), '\n')
  271. this.dataForm.username = newList.join().replace(new RegExp(',', 'g'), '\n')
  272. this.rechargeMoney = this.accountNum * this.dataForm.money
  273. this.maxMoney = Math.floor(this.user_money / this.accountNum)
  274. },
  275. /**
  276. * 发起提交 游戏账号检测/提交充值 数据
  277. */
  278. onSubmit() {
  279. // this.setAccountNum()
  280. this.thenAccount = ''
  281. this.thenAccountNum = 0
  282. this.catchAccount = ''
  283. this.catchAccountNum = 0
  284. this.noExistence = ''
  285. this.noExistenceNum = 0
  286. this.startTime = ''
  287. this.endTime = ''
  288. // TODO: 正式服务器未上线,暂时不需要
  289. // if ((this.balanceMoney - this.dataForm.money) < 0) {
  290. // return Message({
  291. // type: 'info',
  292. // message: '余额不足以充值.'
  293. // })
  294. // }
  295. if (this.onCheck === false && this.onRecharge === false) {
  296. return Message({
  297. type: 'warning',
  298. message: '请选择是否检测或充值!'
  299. })
  300. }
  301. // 截取账号
  302. var accountLists = this.dataForm.username.split('\n')
  303. // 检测不充值
  304. if (this.onCheck === true && this.onRecharge === false) {
  305. this.startLoading()
  306. this.sublmeRecharge(accountLists, 1)
  307. return false
  308. }
  309. // 需要充值则检测余额
  310. if ((this.user_money - this.rechargeMoney) < 0) {
  311. return Message({
  312. type: 'warning',
  313. message: '账户余额不足以充值!'
  314. })
  315. }
  316. this.$refs['dataForm'].validate((valid) => {
  317. if (valid) {
  318. MessageBox.prompt('输入支付密码', 'Tip', {
  319. confirmButtonText: '确认',
  320. cancelButtonText: '取消'
  321. }).then(({ value }) => {
  322. this.startLoading()
  323. if (this.onRecharge === true && this.onCheck === false) { // 充值不检测
  324. this.sublmeRecharge(accountLists, 2, value)
  325. } else if (this.onRecharge === true && this.onCheck === true) { // 充值并检测
  326. this.sublmeRecharge(accountLists, 3, value)
  327. }
  328. }).catch(() => {
  329. return Message({
  330. message: '取消充值.'
  331. })
  332. })
  333. } else {
  334. return Message({
  335. type: 'error',
  336. message: '请完善提交内容.'
  337. })
  338. }
  339. })
  340. },
  341. // 提交检测和充值
  342. async sublmeRecharge(accountLists, operationType, paypwd = '') {
  343. this.startTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
  344. // 提取第一条账号数据,进行提交测试
  345. const oneAccount = accountLists[0]
  346. const loadingNum = accountLists.length - 2
  347. switch (operationType) {
  348. case 1: // 账号检测
  349. await this.$store.dispatch('common/rechargePlayerType', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, username: oneAccount }).then((res) => {
  350. const { code, status, message } = res
  351. if (code === 200 && status === true) {
  352. this.thenAccount = this.thenAccount + oneAccount + '\n'
  353. this.thenAccountNum++
  354. Message({
  355. type: 'success',
  356. message: '检测成功 ' + oneAccount + ' : ' + message
  357. })
  358. // 成功后处理剩下账号数据
  359. accountLists = LodashArray.drop(accountLists) // 删除第一个账户
  360. accountLists.forEach(async(item, index) => {
  361. await this.rechargePlayer(
  362. { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, type: this.dataForm.type },
  363. index, operationType, loadingNum
  364. )
  365. })
  366. } else {
  367. this.noExistence = this.noExistence + oneAccount + '\n'
  368. this.noExistenceNum++
  369. this.cloneLoading(false)
  370. return Message({
  371. message: '检测 ' + oneAccount + ' : ' + message
  372. })
  373. }
  374. }).catch((error) => {
  375. this.catchAccount = this.catchAccount + oneAccount + '\n'
  376. this.catchAccountNum++
  377. this.cloneLoading(false)
  378. return Message({
  379. type: 'error',
  380. message: '检测失败 ' + oneAccount + ' :' + error.message
  381. })
  382. })
  383. break
  384. case 2: // 充值
  385. this.$store.dispatch('common/rechargePlayer', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: oneAccount, money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type }).then((res) => {
  386. const { code, status, message } = res
  387. if (code === 200 && status === true) {
  388. this.thenAccount = this.thenAccount + oneAccount + '\n'
  389. this.thenAccountNum++
  390. Message({
  391. type: 'success',
  392. message: '充值成功 ' + oneAccount + ' : ' + message
  393. })
  394. // 成功后处理剩下账号数据
  395. accountLists = LodashArray.drop(accountLists) // 删除第一个账户
  396. accountLists.forEach(async(item, index) => {
  397. await this.rechargePlayer(
  398. { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type },
  399. index, operationType, loadingNum
  400. )
  401. })
  402. } else {
  403. this.catchAccount = this.catchAccount + oneAccount + '\n'
  404. this.catchAccountNum++
  405. this.cloneLoading()
  406. return Message({
  407. message: '充值 ' + oneAccount + ' : ' + message
  408. })
  409. }
  410. }).catch((error) => {
  411. this.catchAccount = this.catchAccount + oneAccount + '\n'
  412. this.catchAccountNum++
  413. this.cloneLoading()
  414. return Message({
  415. type: 'error',
  416. message: '充值失败 ' + oneAccount + ' : ' + error.message
  417. })
  418. })
  419. break
  420. case 3: // 充值并检测
  421. // 账号检测
  422. this.$store.dispatch('common/rechargePlayerType', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, username: oneAccount }).then((res) => {
  423. const { code, status, message } = res
  424. if (code === 200 && status === true) {
  425. Message({
  426. type: 'success',
  427. message: '检测成功 ' + oneAccount + ' : ' + message
  428. })
  429. // 充值
  430. this.$store.dispatch('common/rechargePlayer', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: oneAccount, money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type }).then((res) => {
  431. const { code, status, message } = res
  432. if (code === 200 && status === true) {
  433. this.thenAccount = this.thenAccount + oneAccount + '\n'
  434. this.thenAccountNum++
  435. Message({
  436. type: 'success',
  437. message: '充值成功 ' + oneAccount + ' : ' + message
  438. })
  439. // 成功后处理剩下账号数据
  440. accountLists = LodashArray.drop(accountLists) // 删除第一个账户
  441. accountLists.forEach(async(item, index) => {
  442. await this.rechargePlayer(
  443. { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type },
  444. index, operationType, loadingNum
  445. )
  446. })
  447. } else {
  448. this.catchAccount = this.catchAccount + oneAccount + '\n'
  449. this.catchAccountNum++
  450. this.cloneLoading()
  451. return Message({
  452. type: 'warning',
  453. message: '充值 ' + oneAccount + ' : ' + message
  454. })
  455. }
  456. }).catch((error) => {
  457. this.catchAccount = this.catchAccount + oneAccount + '\n'
  458. this.catchAccountNum++
  459. this.cloneLoading(false)
  460. return Message({
  461. type: 'error',
  462. message: '充值失败 ' + oneAccount + ' : ' + error.message
  463. })
  464. })
  465. } else {
  466. this.noExistence = this.noExistence + oneAccount + '\n'
  467. this.noExistenceNum++
  468. this.cloneLoading(false)
  469. return Message({
  470. message: '检测 ' + oneAccount + ' : ' + message
  471. })
  472. }
  473. }).catch((error) => {
  474. this.catchAccount = this.catchAccount + oneAccount + '\n'
  475. this.catchAccountNum++
  476. this.cloneLoading(false)
  477. return Message({
  478. type: 'error',
  479. message: '检测失败 ' + oneAccount + ' : ' + error.message
  480. })
  481. })
  482. break
  483. default:
  484. Message({
  485. type: 'error',
  486. message: '操作有误!!!'
  487. })
  488. break
  489. }
  490. // // ## 测试(去除第一个账户单独测试)
  491. // // 是否需要验证账户
  492. // const loadingNum = accountLists.length - 1
  493. // // 遮屏
  494. // this.loading = Loading.service({
  495. // lock: true,
  496. // text: '处理中, 请稍等...',
  497. // background: 'rgba(0, 0, 0, 0.7)'
  498. // })
  499. // // 成功后处理剩下账号数据
  500. // accountLists.forEach(async(item, index) => {
  501. // await this.rechargePlayer(
  502. // { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: paypwd, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, type: this.dataForm.type },
  503. // index,
  504. // this.onCheck,
  505. // loadingNum
  506. // )
  507. // })
  508. },
  509. // 启动遮屏
  510. startLoading() {
  511. this.loading = Loading.service({
  512. lock: true,
  513. text: '处理中, 请稍等...',
  514. background: 'rgba(0, 0, 0, 0.7)'
  515. })
  516. },
  517. // 关闭遮屏
  518. cloneLoading(onMoney = true) {
  519. this.loading.close()
  520. if (onMoney) {
  521. this.updateUserMoney()
  522. }
  523. this.endTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
  524. },
  525. // 异步进行账户检测与充值
  526. rechargePlayer(data, index, operationType, count) {
  527. // 延迟一秒处理
  528. setTimeout((data, new_index, new_operationType, new_count) => {
  529. return new Promise((resolve, reject) => {
  530. // 继续延迟
  531. setTimeout((_data, _index, _operationType, _count) => {
  532. switch (_operationType) {
  533. case 1: // 检测账户
  534. this.$store.dispatch('common/rechargePlayerType', { pid: _data.pid, cid: _data.cid, gfid: _data.gfid, username: _data.username }).then((res) => {
  535. const { code, status, message } = res
  536. if (code === 200 && status === true) {
  537. this.thenAccount = this.thenAccount + _data.username + '\n'
  538. this.thenAccountNum++
  539. Message({
  540. type: 'success',
  541. message: '检测成功 ' + _data.username + ' :' + message
  542. })
  543. } else {
  544. if (code === 10001) {
  545. this.catchAccount = this.catchAccount + _data.username + '\n'
  546. this.catchAccountNum++
  547. } else {
  548. this.noExistence = this.noExistence + _data.username + '\n'
  549. this.noExistenceNum++
  550. }
  551. Message({
  552. message: '检测 ' + _data.username + ' :' + message
  553. })
  554. }
  555. }).catch((error) => {
  556. this.catchAccount = this.catchAccount + _data.username + '\n'
  557. this.catchAccountNum++
  558. Message({
  559. type: 'error',
  560. message: '检测失败 ' + _data.username + ' :' + error.message
  561. })
  562. })
  563. break
  564. case 2: // 充值账户
  565. // 充值
  566. console.log('# 充值: ', _data)
  567. this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
  568. const { code, status, message } = res
  569. if (code === 200 && status === true) {
  570. this.thenAccount = this.thenAccount + _data.username + '\n'
  571. this.thenAccountNum++
  572. Message({
  573. type: 'success',
  574. message: '充值成功 ' + _data.username + ':' + message
  575. })
  576. } else {
  577. this.catchAccount = this.catchAccount + _data.username + '\n'
  578. this.catchAccountNum++
  579. Message({
  580. message: '充值 ' + _data.username + ':' + message
  581. })
  582. }
  583. }).catch((error) => {
  584. this.catchAccount = this.catchAccount + _data.username + '\n'
  585. this.catchAccountNum++
  586. Message({
  587. type: 'error',
  588. message: '充值失败 ' + _data.username + ':' + error.message
  589. })
  590. })
  591. break
  592. case 3: // 检测并充值
  593. // 账号检测
  594. this.$store.dispatch('common/rechargePlayerType', { pid: _data.pid, cid: _data.cid, gfid: _data.gfid, username: _data.username }).then((res) => {
  595. const { code, status, message } = res
  596. if (code === 200 && status === true) {
  597. Message({
  598. type: 'success',
  599. message: '检测成功 ' + _data.username + ':' + message
  600. })
  601. // 充值
  602. this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
  603. const { code, status, message } = res
  604. if (code === 200 && status === true) {
  605. this.thenAccount = this.thenAccount + _data.username + '\n'
  606. this.thenAccountNum++
  607. Message({
  608. type: 'success',
  609. message: '充值成功 ' + _data.username + ':' + message
  610. })
  611. } else {
  612. this.catchAccount = this.catchAccount + _data.username + '\n'
  613. this.catchAccountNum++
  614. Message({
  615. message: '充值 ' + _data.username + ':' + message
  616. })
  617. }
  618. }).catch((error) => {
  619. this.catchAccount = this.catchAccount + _data.username + '\n'
  620. this.catchAccountNum++
  621. Message({
  622. type: 'error',
  623. message: '充值失败 ' + _data.username + ':' + error.message
  624. })
  625. })
  626. } else {
  627. if (code === 10001) {
  628. this.catchAccount = this.catchAccount + _data.username + '\n'
  629. this.catchAccountNum++
  630. } else {
  631. this.noExistence = this.noExistence + _data.username + '\n'
  632. this.noExistenceNum++
  633. }
  634. Message({
  635. message: '检测 ' + _data.username + ':' + message
  636. })
  637. }
  638. }).catch((error) => {
  639. this.catchAccount = this.catchAccount + _data.username + '\n'
  640. this.catchAccountNum++
  641. Message({
  642. type: 'error',
  643. message: '检测失败 ' + _data.username + ':' + error.message
  644. })
  645. })
  646. break
  647. default:
  648. break
  649. }
  650. if (_index !== null && _index === _count || _index > _count) {
  651. setTimeout(() => {
  652. // 检测不更新账户余额
  653. var onMoney = true
  654. if (new_operationType === 1) {
  655. onMoney = false
  656. }
  657. this.cloneLoading(onMoney)
  658. }, 1500)
  659. }
  660. resolve()
  661. }, 1800 * (index + 1), data, new_index, new_operationType, new_count)
  662. // }, (1600 + Math.round(Math.random() * 300)) * (index + 1), data, onCheck)
  663. // 1500 * (index + 1): +1的原因是,这里是从第二条数据开始处理的,异步处理之前单独处理了一个,所以时间久点。
  664. })
  665. }, 1000, data, index, operationType, count)
  666. },
  667. // 渠道账号列表
  668. getRechargePlatform(val) {
  669. rechargeChannelPlatformAccount(val).then(response => {
  670. // console.log('# getRechargePlatform:', response)
  671. this.rechargeChannelPlatform = response.data.data
  672. this.dataForm.cid = response.data.data[0]['cid']
  673. }).catch(res => {
  674. return Message({
  675. message: res,
  676. type: 'error',
  677. duration: 5 * 1000
  678. })
  679. })
  680. },
  681. // 游戏列表
  682. getRechargeGame(pid) {
  683. this.$store.dispatch('common/rechargeGame', pid).then((res) => {
  684. this.rechargeGame = res
  685. // 设置默认游戏
  686. if (res.find(item => item.id === 54252)) {
  687. this.dataForm.gfid = 54252
  688. }
  689. }).catch((res) => {
  690. return Message({
  691. message: res,
  692. type: 'error',
  693. duration: 5 * 1000
  694. })
  695. })
  696. }
  697. }
  698. }
  699. </script>
  700. <style lang="scss">
  701. .login-container{
  702. margin: 20px;
  703. background-color: #FFFFFF;
  704. .el-bg-border{
  705. border: 2px dashed #909399;
  706. padding: 10px;
  707. }
  708. }
  709. </style>