| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999 |
- <template>
- <div>
- <el-progress
- v-show="progressInfo.percentageNum > 0"
- :text-inside="true"
- :stroke-width="26"
- :percentage="progressInfo.percentageNum"
- style="margin: 10px;"
- />
- <!-- v-loading="loading"
- element-loading-text="Loading..."
- element-loading-svg-view-box="-10, -10, 50, 50"
- element-loading-background="rgba(0, 0, 0, 0.8)" -->
- <el-form
- ref="dataForm"
- v-loading="formLoading"
- :model="dataForm"
- :rules="ruleForm"
- class="login-container"
- element-loading-text="处理中..."
- element-loading-svg-view-box="-10, -10, 50, 50"
- element-loading-background="rgba(0, 0, 0, 0.2)"
- >
- <el-row :gutter="30">
- <el-col :span="4">
- <el-form-item label="游戏平台" prop="pid">
- <el-select v-model="dataForm.pid" placeholder="Select" class="filter-item">
- <el-option
- v-for="item in rechargePlatform"
- :key="item.pid"
- :label="item.platform"
- :value="item.pid"
- />
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="渠道余额" style="width: 300px;">
- <el-input v-model="balanceMoney" type="number" class="inline-input filter-item" disabled style="width: 160px;" /> 元
- </el-form-item> -->
- <el-form-item label="渠道账号" prop="cid">
- <el-select v-model="dataForm.cid" placeholder="Select" class="filter-item">
- <el-option
- v-for="item in rechargeChannelPlatform"
- :key="item.cid"
- :label="item.account"
- :value="item.cid"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="选择游戏" prop="gfid">
- <el-select v-model="dataForm.gfid" placeholder="Select" class="filter-item">
- <el-option
- v-for="item in rechargeGame"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="账户余额">
- <span>{{ user_money }}元</span>
- </el-form-item>
- <el-form-item label="当前渠道余额">
- <span>{{ balanceMoney }}元</span>
- </el-form-item>
- </el-col>
- <el-col :span="3">
- <el-form-item label="充值账户" prop="username" class="filter-item">
- <span style="font-size: 5px; color: #67C23A;">:{{ accountNum }}</span>
- <el-input
- v-model="dataForm.username"
- type="textarea"
- placeholder="请输入充值账户."
- :autosize="{ minRows: 15, maxRows: 60 }"
- @change="setAccountNum"
- />
- </el-form-item>
- </el-col>
- <el-col v-show="repeatNumList" :span="3">
- <el-form-item label="重复账号:" class="filter-item">
- <span style="font-size: 5px; color: #F56C6C;">:{{ repeatNumNum }}</span>
- <el-input
- v-model="repeatNumList"
- type="textarea"
- :autosize="{ minRows: 15, maxRows: 60 }"
- />
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label="充值金额" prop="money">
- <el-input v-model="dataForm.money" type="number" min="0" :max="maxMoney" class="filter-item" />
- <span style="font-size: var(--el-font-size-extra-small); color: #909399;">最大充值金额:{{ maxMoney }}</span>
- </el-form-item>
- <!-- <el-form-item label="平台折扣">
- <span>9.8折</span>
- </el-form-item>
- <el-form-item label="游戏折扣">
- <span>9.8折</span>
- </el-form-item> -->
- <el-form-item label="支付方式">
- <el-radio-group v-model="dataForm.payway" prop="payway" class="filter-item">
- <el-radio :label="1">久币支付</el-radio>
- <!-- <el-radio :label="2">商务币支付</el-radio> -->
- </el-radio-group>
- </el-form-item>
- <el-form-item label="总支付金额">
- <span>{{ rechargeMoney }} 元</span>
- </el-form-item>
- <el-form-item label="账号检测">
- <el-radio-group v-model="onCheck" prop="payway" class="filter-item">
- <el-switch v-model="onCheck" />
- </el-radio-group>
- </el-form-item>
- <el-form-item label="是否充值">
- <el-radio-group v-model="onRecharge" prop="onRecharge" class="filter-item">
- <el-switch v-model="onRecharge" />
- </el-radio-group>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="onSubmit()">提交</el-button>
- </el-form-item>
- </el-col>
- <el-col :span="9">
- 处理时间:<span>{{ startTime }}</span> -- <span>{{ endTime }}</span>
- <el-row :gutter="10">
- <el-col :span="8">
- <span style="font-size: 5px; color: #67C23A;">成功账户:{{ thenAccountNum }}</span>
- <el-input
- v-model="thenAccount"
- type="textarea"
- :autosize="{ minRows: 15, maxRows: 60 }"
- disabled
- />
- </el-col>
- <el-col :span="8">
- <span style="font-size: 5px; color: #F56C6C;">失败账户:{{ catchAccountNum }}</span>
- <el-input
- v-model="catchAccount"
- type="textarea"
- :autosize="{ minRows: 15, maxRows: 60 }"
- disabled
- />
- </el-col>
- <el-col :span="8">
- <span style="font-size: 5px; color: #F56C6C;">账户不存在:{{ noExistenceNum }}</span>
- <el-input
- v-model="noExistence"
- type="textarea"
- :autosize="{ minRows: 15, maxRows: 60 }"
- disabled
- />
- </el-col>
- </el-row>
- </el-col>
- </el-row>
- </el-form>
- </div>
- </template>
- <script>
- var LodashArray = require('lodash/array')
- import { Message, MessageBox, Loading } from 'element-ui'
- import { rechargeChannelPlatformAccount } from '@/api/common'
- export default {
- name: 'Recharge',
- data() {
- return {
- formLoading: false, // 表单记载状态
- dataForm: {
- pid: 'd65aa6d7614589bffe62456b88e98811', // 游戏平台ID;默认魅族平台
- cid: '', // 渠道账号ID
- gfid: '', // 游戏ID
- paypwd: '', // 支付密码
- username: '', // 充值账户
- money: 1, // 充值金额(单位:元)
- recharge: 2, //
- payway: 1, // 充值方式
- type: 3 //
- },
- ruleForm: {
- pid: [{ required: true, message: '请选择平台.', trigger: 'change' }],
- cid: [{ required: true, message: '请选择渠道账号.', trigger: 'change' }],
- gfid: [{ required: true, message: '请选择游戏.', trigger: 'change' }],
- username: [{ required: true, message: '缺少充值账户.', trigger: 'blur' }],
- money: [{ required: true, message: '请输入充值金额,最低一元.', trigger: 'blur' }]
- },
- // 游戏平台列表
- rechargePlatform: [
- {
- 'pid': 'd65aa6d7614589bffe62456b88e98811',
- 'platform': 'MM',
- 'disRate': 9.8,
- 'rate': 9.7,
- 'type': 0,
- 'length': 2
- }
- ],
- balanceMoney: 0, // 渠道余额
- user_money: 0, // 账户余额
- maxMoney: 0, // 最大充值金额
- rechargeChannelPlatform: [], // 渠道账号
- rechargeGame: [], // 游戏列表
- accountNum: 0, // 总账户个数
- repeatNumList: '', // 重复账号列表
- repeatNumNum: 0, // 重复账号个数
- thenAccount: '', // 成功账户
- thenAccountNum: 0, // 成功个数
- catchAccount: '', // 失败账户
- catchAccountNum: 0, // 失败个数
- noExistence: '', // 不存在账户
- noExistenceNum: 0, // 不存在账户个数
- startTime: 0, // 开始时间
- endTime: 0, // 结束时间
- onCheck: false, // 是否需要检测账号
- onRecharge: true, // 是否充值
- rechargeMoney: 0, // 支付总金额
- progressInfo: {
- percentageNum: 0, // 进度条百分比
- num: 0 // 当前数
- }
- }
- },
- watch: {
- 'dataForm.money': {
- handler(val, oldVal) {
- this.checkMoney(val)
- }
- }
- },
- created() {
- this.getRechargePlatform(this.dataForm.pid)
- this.getRechargeGame(this.dataForm.pid)
- // this.updateUserMoney()
- this.updateMoney()
- this.$store.dispatch('user/getF5').then((res) => {
- if (!res) {
- this.$store.dispatch('user/setF5')
- location.reload()
- }
- })
- },
- methods: {
- // 判断充值金额
- checkMoney(money) {
- this.rechargeMoney = this.accountNum * money
- if ((this.balanceMoney - this.rechargeMoney) < 0) {
- // this.rechargeMoney = this.accountNum * oldVal
- return Message({
- type: 'warning',
- message: '渠道余额不足以充值!'
- })
- }
- },
- // 更新用户余额
- updateUserMoney() {
- this.$store.dispatch('user/getInfo').then((res) => {
- const { data } = res
- this.user_money = Math.floor(data.user_money)
- return Message({
- type: 'success',
- message: '账户余额已更新'
- })
- })
- },
- // 统计充值账户数量并处理行数是否账号
- setAccountNum() {
- if (!this.dataForm.username) {
- return false
- }
- this.accountNum = 0
- this.repeatNumList = []
- this.repeatNumNum = 0
- var newQuestion = this.dataForm.username.replace(/\n\n/, '\n')
- const list = newQuestion.split('\n')
- var newList = []
- for (var i = 0; i < list.length; i++) {
- if (list[i] === '') {
- continue
- }
- // 账户去重,并提示
- if (newList.indexOf(list[i]) === -1) {
- this.accountNum++
- newList.push(list[i])
- } else {
- if (this.repeatNumList.indexOf(list[i]) === -1) {
- this.repeatNumNum++
- this.repeatNumList.push(list[i])
- }
- }
- }
- this.repeatNumList = this.repeatNumList.join().replace(new RegExp(',', 'g'), '\n')
- this.dataForm.username = newList.join().replace(new RegExp(',', 'g'), '\n')
- this.rechargeMoney = this.accountNum * this.dataForm.money
- this.maxMoney = Math.floor(this.balanceMoney / this.accountNum)
- },
- /**
- * 发起提交 游戏账号检测/提交充值 数据
- */
- onSubmit() {
- this.startLoading()
- // this.formLoading = true
- // this.setAccountNum()
- this.thenAccount = '' // 渠道余额
- this.thenAccountNum = 0 // 成功个数
- this.catchAccount = '' // 失败账户
- this.catchAccountNum = 0 // 失败个数
- this.noExistence = '' // 不存在账户
- this.noExistenceNum = 0 // 不存在账户个数
- this.startTime = ''
- this.endTime = ''
- this.progressInfo.percentageNum = 0 // 进度条百分比
- this.progressInfo.num = 0 // 进度条百分比
- // TODO: 正式服务器未上线,暂时不需要
- // if ((this.balanceMoney - this.dataForm.money) < 0) {
- // return Message({
- // type: 'info',
- // message: '余额不足以充值.'
- // })
- // }
- if (this.onCheck === false && this.onRecharge === false) {
- return Message({
- type: 'warning',
- message: '请选择是否检测或充值!'
- })
- }
- this.operation('time_start')
- // 截取账号
- var accountLists = this.dataForm.username.split('\n')
- // 检测不充值
- if (this.onCheck === true && this.onRecharge === false) {
- // this.startLoading()
- // this.formLoading = true
- this.sublmeRecharge(accountLists, 1)
- return false
- }
- // 需要充值则检测余额
- if ((this.balanceMoney - this.rechargeMoney) < 0) {
- // this.formLoading = false
- this.cloneLoading()
- return Message({
- type: 'warning',
- message: '账户余额不足以充值!'
- })
- }
- this.$refs['dataForm'].validate((valid) => {
- if (valid) {
- MessageBox.prompt('输入支付密码', 'Tip', {
- confirmButtonText: '确认',
- cancelButtonText: '取消'
- }).then(({ value }) => {
- // this.startLoading()
- if (this.onRecharge === true && this.onCheck === false) { // 充值不检测
- this.sublmeRecharge(accountLists, 2, value)
- } else if (this.onRecharge === true && this.onCheck === true) { // 充值并检测
- this.sublmeRecharge(accountLists, 3, value)
- }
- }).catch(() => {
- this.cloneLoading()
- // this.formLoading = false
- return Message({
- message: '取消充值.'
- })
- })
- } else {
- this.cloneLoading()
- // this.formLoading = false
- return Message({
- type: 'error',
- message: '请完善提交内容.'
- })
- }
- })
- },
- // 提交检测和充值
- async sublmeRecharge(accountLists, operationType, paypwd = '') {
- // this.startTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
- // 提取第一条账号数据,进行提交测试
- const oneAccount = accountLists[0]
- const loadingNum = accountLists.length - 2
- this.progressInfo.num++
- switch (operationType) {
- case 1: // 账号检测
- await this.$store.dispatch('common/rechargePlayerType', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, username: oneAccount }).then((res) => {
- const { code, status, message } = res
- if (code === 200 && status === true) {
- this.thenAccount = this.thenAccount + oneAccount + '\n'
- this.thenAccountNum++
- // Message({
- // type: 'success',
- // message: '检测成功 ' + oneAccount + ' : ' + message
- // })
- this.$notify({
- title: '检测成功',
- message: oneAccount + ' : ' + message,
- type: 'success'
- })
- // 成功后处理剩下账号数据
- accountLists = LodashArray.drop(accountLists) // 删除第一个账户
- if (accountLists.length <= 0) {
- this.cloneLoading()
- return false
- }
- accountLists.forEach(async(item, index) => {
- await this.rechargePlayer(
- { 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 },
- index, operationType, loadingNum
- )
- })
- } else {
- this.noExistence = this.noExistence + oneAccount + '\n'
- this.noExistenceNum++
- // this.cloneLoading(false)
- // this.formLoading = false
- this.cloneLoading()
- // return Message({
- // message: '检测 ' + oneAccount + ' : ' + message
- // })
- return this.$notify({
- title: '检测有误',
- message: oneAccount + ' : ' + message,
- type: 'info'
- })
- }
- }).catch((error) => {
- this.catchAccount = this.catchAccount + oneAccount + '\n'
- this.catchAccountNum++
- // this.cloneLoading(false)
- // this.formLoading = false
- this.cloneLoading()
- // return Message({
- // type: 'error',
- // message: '检测失败 ' + oneAccount + ' :' + error.message
- // })
- return this.$notify({
- title: '检测失败',
- message: oneAccount + ' : ' + error.message,
- type: 'error'
- })
- })
- break
- case 2: // 充值
- 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) => {
- const { code, status, message } = res
- if (code === 200 && status === true) {
- this.thenAccount = this.thenAccount + oneAccount + '\n'
- this.thenAccountNum++
- // Message({
- // type: 'success',
- // message: '充值成功 ' + oneAccount + ' : ' + message
- // })
- this.$notify({
- title: '充值成功',
- message: oneAccount + ' : ' + message,
- type: 'success'
- })
- // 成功后处理剩下账号数据
- accountLists = LodashArray.drop(accountLists) // 删除第一个账户
- console.log('# 充值 -- 账户列表:', accountLists)
- if (accountLists && accountLists.length > 0) {
- accountLists.forEach(async(item, index) => {
- await this.rechargePlayer(
- { 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 },
- index, operationType, loadingNum
- )
- })
- } else {
- this.cloneLoading()
- this.operation('time_end')
- }
- } else {
- this.catchAccount = this.catchAccount + oneAccount + '\n'
- this.catchAccountNum++
- // this.formLoading = false
- this.cloneLoading()
- this.operation('time_end')
- // return Message({
- // message: '充值 ' + oneAccount + ' : ' + message
- // })
- return this.$notify({
- title: '充值有误',
- message: oneAccount + ' : ' + message,
- type: 'info'
- })
- }
- }).catch((error) => {
- this.catchAccount = this.catchAccount + oneAccount + '\n'
- this.catchAccountNum++
- // this.formLoading = false
- this.cloneLoading()
- this.operation('time_end')
- // return Message({
- // type: 'error',
- // message: '充值失败 ' + oneAccount + ' : ' + error.message
- // })
- return this.$notify({
- title: '充值失败',
- message: oneAccount + ' : ' + error.message,
- type: 'error'
- })
- })
- break
- case 3: // 充值并检测
- // 账号检测
- this.$store.dispatch('common/rechargePlayerType', { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, username: oneAccount }).then((res) => {
- const { code, status, message } = res
- if (code === 200 && status === true) {
- // Message({
- // type: 'success',
- // message: '检测成功 ' + oneAccount + ' : ' + message
- // })
- this.$notify({
- title: '检测成功',
- message: oneAccount + ' : ' + message,
- type: 'success'
- })
- // 充值
- 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) => {
- const { code, status, message } = res
- if (code === 200 && status === true) {
- this.thenAccount = this.thenAccount + oneAccount + '\n'
- this.thenAccountNum++
- // Message({
- // type: 'success',
- // message: '充值成功 ' + oneAccount + ' : ' + message
- // })
- this.$notify({
- title: '充值成功',
- message: oneAccount + ' : ' + message,
- type: 'success'
- })
- // 成功后处理剩下账号数据
- accountLists = LodashArray.drop(accountLists) // 删除第一个账户
- if (accountLists && accountLists.length > 0) {
- accountLists.forEach(async(item, index) => {
- await this.rechargePlayer(
- { 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 },
- index, operationType, loadingNum
- )
- })
- } else {
- this.cloneLoading()
- this.operation('time_end')
- }
- } else {
- this.catchAccount = this.catchAccount + oneAccount + '\n'
- this.catchAccountNum++
- // this.formLoading = false
- this.cloneLoading()
- this.operation('time_end')
- // return Message({
- // type: 'warning',
- // message: '充值 ' + oneAccount + ' : ' + message
- // })
- return this.$notify({
- title: '充值有误',
- message: oneAccount + ' : ' + message,
- type: 'info'
- })
- }
- }).catch((error) => {
- this.catchAccount = this.catchAccount + oneAccount + '\n'
- this.catchAccountNum++
- // this.formLoading = false
- this.cloneLoading()
- this.operation('time_end')
- // return Message({
- // type: 'error',
- // message: '充值失败 ' + oneAccount + ' : ' + error.message
- // })
- return this.$notify({
- title: '充值失败',
- message: oneAccount + ' : ' + error.message,
- type: 'error'
- })
- })
- } else {
- this.noExistence = this.noExistence + oneAccount + '\n'
- this.noExistenceNum++
- // this.formLoading = false
- this.cloneLoading()
- this.operation('time_end')
- // return Message({
- // message: '检测 ' + oneAccount + ' : ' + message
- // })
- return this.$notify({
- title: '检测失败',
- message: oneAccount + ' : ' + message,
- type: 'error'
- })
- }
- }).catch((error) => {
- this.catchAccount = this.catchAccount + oneAccount + '\n'
- this.catchAccountNum++
- // this.formLoading = false
- this.cloneLoading()
- this.operation('time_end')
- // return Message({
- // type: 'error',
- // message: '检测失败 ' + oneAccount + ' : ' + error.message
- // })
- return this.$notify({
- title: '检测失败',
- message: oneAccount + ' : ' + error.message,
- type: 'error'
- })
- })
- break
- default:
- this.$notify({
- title: '操作有误',
- message: '非法操作!',
- type: 'error'
- })
- this.cloneLoading()
- this.operation('time_end')
- break
- }
- // // ## 测试(去除第一个账户单独测试)
- // // 是否需要验证账户
- // const loadingNum = accountLists.length - 1
- // // 遮屏
- // this.loading = Loading.service({
- // lock: true,
- // text: '处理中, 请稍等...',
- // background: 'rgba(0, 0, 0, 0.7)'
- // })
- // // 成功后处理剩下账号数据
- // accountLists.forEach(async(item, index) => {
- // await this.rechargePlayer(
- // { 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 },
- // index,
- // this.onCheck,
- // loadingNum
- // )
- // })
- },
- // 启动遮屏
- startLoading() {
- this.loading = Loading.service({
- lock: true,
- text: '处理中, 请稍等...',
- background: 'rgba(0, 0, 0, 0.3)'
- })
- },
- // 关闭遮屏
- cloneLoading(onMoney = true) {
- this.loading.close()
- },
- // 更新账户余额和渠道余额
- updateMoney() {
- this.updateUserMoney()
- this.getBalanceMoney()
- },
- // 相关操作
- operation(type) {
- switch (type) {
- case 'loading_clone': // 关闭加载窗口
- this.formLoading = false
- break
- case 'time_start': // 开始时间
- this.startTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
- break
- case 'time_end': // 结束时间
- this.endTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
- break
- default:
- break
- }
- },
- // 异步进行账户检测与充值
- rechargePlayer(data, index, operationType, count) {
- const that = this
- // 延迟一秒处理
- setTimeout((data, new_index, new_operationType, new_count, that) => {
- return new Promise((resolve, reject) => {
- // 继续延迟
- setTimeout((_data, _index, _operationType, _count) => {
- that.progressInfo.num++
- that.progressCheck()
- switch (_operationType) {
- case 1: // 检测账户
- this.$store.dispatch('common/rechargePlayerType', { pid: _data.pid, cid: _data.cid, gfid: _data.gfid, username: _data.username }).then((res) => {
- const { code, status, message } = res
- if (code === 200 && status === true) {
- this.thenAccount = this.thenAccount + _data.username + '\n'
- this.thenAccountNum++
- // Message({
- // type: 'success',
- // message: '检测成功 ' + _data.username + ' :' + message
- // })
- this.$notify({
- title: '检测成功',
- message: _data.username + ' :' + message,
- type: 'success'
- })
- } else {
- if (code === 10001) {
- this.catchAccount = this.catchAccount + _data.username + '\n'
- this.catchAccountNum++
- } else {
- this.noExistence = this.noExistence + _data.username + '\n'
- this.noExistenceNum++
- }
- // Message({
- // message: '检测 ' + _data.username + ' :' + message
- // })
- this.$notify({
- title: '检测失败',
- message: _data.username + ' :' + message,
- type: 'info'
- })
- }
- }).catch((error) => {
- this.catchAccount = this.catchAccount + _data.username + '\n'
- this.catchAccountNum++
- // Message({
- // type: 'error',
- // message: '检测失败 ' + _data.username + ' :' + error.message
- // })
- this.$notify({
- title: '检测失败',
- message: _data.username + ' :' + error.message,
- type: 'error'
- })
- })
- break
- case 2: // 充值账户
- // 充值
- console.log('# 充值: ', _data)
- this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
- const { code, status, message } = res
- if (code === 200 && status === true) {
- this.thenAccount = this.thenAccount + _data.username + '\n'
- this.thenAccountNum++
- // Message({
- // type: 'success',
- // message: '充值成功 ' + _data.username + ':' + message
- // })
- this.$notify({
- title: '充值成功',
- message: _data.username + ' :' + message,
- type: 'success'
- })
- } else {
- this.catchAccount = this.catchAccount + _data.username + '\n'
- this.catchAccountNum++
- // Message({
- // message: '充值 ' + _data.username + ':' + message
- // })
- this.$notify({
- title: '充值失败',
- message: _data.username + ':' + message,
- type: 'info'
- })
- }
- }).catch((error) => {
- this.catchAccount = this.catchAccount + _data.username + '\n'
- this.catchAccountNum++
- // Message({
- // type: 'error',
- // message: '充值失败 ' + _data.username + ':' + error.message
- // })
- this.$notify({
- title: '充值失败',
- message: _data.username + ':' + error.message,
- type: 'error'
- })
- })
- break
- case 3: // 检测并充值
- // 账号检测
- this.$store.dispatch('common/rechargePlayerType', { pid: _data.pid, cid: _data.cid, gfid: _data.gfid, username: _data.username }).then((res) => {
- const { code, status, message } = res
- if (code === 200 && status === true) {
- // Message({
- // type: 'success',
- // message: '检测成功 ' + _data.username + ':' + message
- // })
- this.$notify({
- title: '检测成功',
- message: _data.username + ':' + message,
- type: 'success'
- })
- // 充值
- this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
- const { code, status, message } = res
- if (code === 200 && status === true) {
- this.thenAccount = this.thenAccount + _data.username + '\n'
- this.thenAccountNum++
- // Message({
- // type: 'success',
- // message: '充值成功 ' + _data.username + ':' + message
- // })
- this.$notify({
- title: '充值成功',
- message: _data.username + ' :' + message,
- type: 'success'
- })
- } else {
- this.catchAccount = this.catchAccount + _data.username + '\n'
- this.catchAccountNum++
- // Message({
- // message: '充值 ' + _data.username + ':' + message
- // })
- this.$notify({
- title: '充值有误',
- message: _data.username + ' :' + message,
- type: 'info'
- })
- }
- }).catch((error) => {
- this.catchAccount = this.catchAccount + _data.username + '\n'
- this.catchAccountNum++
- // Message({
- // type: 'error',
- // message: '充值失败 ' + _data.username + ':' + error.message
- // })
- this.$notify({
- title: '充值失败',
- message: _data.username + ' :' + error.message,
- type: 'error'
- })
- })
- } else {
- if (code === 10001) {
- this.catchAccount = this.catchAccount + _data.username + '\n'
- this.catchAccountNum++
- } else {
- this.noExistence = this.noExistence + _data.username + '\n'
- this.noExistenceNum++
- }
- // Message({
- // message: '检测 ' + _data.username + ':' + message
- // })
- this.$notify({
- title: '检测有误',
- message: _data.username + ' :' + message,
- type: 'info'
- })
- }
- }).catch((error) => {
- this.catchAccount = this.catchAccount + _data.username + '\n'
- this.catchAccountNum++
- // Message({
- // type: 'error',
- // message: '检测失败 ' + _data.username + ':' + error.message
- // })
- this.$notify({
- title: '检测失败',
- message: _data.username + ' :' + error.message,
- type: 'error'
- })
- })
- break
- default:
- break
- }
- if (_index !== null && _index === _count || _index > _count) {
- setTimeout(() => {
- // 检测不更新账户余额
- // var onMoney = true
- // this.formLoading = false
- this.cloneLoading()
- this.operation('time_end')
- if (new_operationType === 1) {
- // onMoney = false
- this.updateUserMoney()
- }
- // this.cloneLoading(onMoney)
- }, 1500)
- }
- resolve()
- }, 1800 * (index + 1), data, new_index, new_operationType, new_count)
- // }, (1600 + Math.round(Math.random() * 300)) * (index + 1), data, onCheck)
- // 1500 * (index + 1): +1的原因是,这里是从第二条数据开始处理的,异步处理之前单独处理了一个,所以时间久点。
- })
- }, 1000, data, index, operationType, count, that)
- },
- // 渠道账号列表
- getRechargePlatform(val) {
- rechargeChannelPlatformAccount(val).then(response => {
- // console.log('# getRechargePlatform:', response)
- this.rechargeChannelPlatform = response.data.data
- this.dataForm.cid = response.data.data[0]['cid']
- }).catch(res => {
- return Message({
- message: res,
- type: 'error',
- duration: 5 * 1000
- })
- })
- },
- // 游戏列表
- getRechargeGame(pid) {
- this.$store.dispatch('common/rechargeGame', pid).then((res) => {
- this.rechargeGame = res
- // 设置默认游戏
- if (res.find(item => item.id === 54252)) {
- this.dataForm.gfid = 54252
- }
- }).catch((res) => {
- return Message({
- message: res,
- type: 'error',
- duration: 5 * 1000
- })
- })
- },
- // 账户余额 -- 弃用
- getBalanceMoney() {
- this.$store.dispatch('common/getMainChannelMoney', this.dataForm.pid).then((res) => {
- this.balanceMoney = res
- if (this.accountNum > 0) {
- this.maxMoney = Math.floor(res / this.accountNum)
- } else {
- this.maxMoney = Math.floor(res)
- }
- return Message({
- type: 'success',
- message: '渠道余额已更新'
- })
- }).catch((res) => {
- return Message({
- message: res,
- type: 'error',
- duration: 5 * 1000
- })
- })
- },
- // 进度条统计
- progressCheck() {
- this.progressInfo.percentageNum = parseInt((this.progressInfo.num / this.accountNum) * 100)
- console.log('# progressCheck: ', this.progressInfo.num, this.accountNum, this.progressInfo.percentageNum)
- }
- }
- }
- </script>
- <style lang="scss">
- .login-container{
- margin: 20px;
- background-color: #FFFFFF;
- .el-bg-border{
- border: 2px dashed #909399;
- padding: 10px;
- }
- }
- </style>
|