|
|
@@ -38,7 +38,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="3">
|
|
|
+ <el-col :span="4">
|
|
|
<el-form-item label="充值账户" prop="username" class="filter-item">
|
|
|
<span style="font-size: 5px; color: #67C23A;">:{{ accountNum }}</span>
|
|
|
<el-input
|
|
|
@@ -49,29 +49,12 @@
|
|
|
@change="setAccountNum"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
- <!-- <el-row class="row-bg" gutter="10">
|
|
|
- <el-col :span="9">
|
|
|
- <span style="font-size: 5px; color: #67C23A;">贴入充值账号,一行一个账号.</span>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6" style="margin-top: 150px;">
|
|
|
- <el-button type="success" @click="confirmAccount">确认账号</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="9">
|
|
|
- <span style="font-size: 5px; color: #67C23A;">账号确认成功后会显示到这里.</span>
|
|
|
- <el-input
|
|
|
- v-model="accountHandleSuccess"
|
|
|
- type="textarea"
|
|
|
- placeholder="账号检测成功."
|
|
|
- :autosize="{ minRows: 10, maxRows: 30 }"
|
|
|
- />
|
|
|
- </el-col>
|
|
|
- </el-row> -->
|
|
|
+ <span v-show="repeatNumList">重复账号:{{ repeatNumList }}</span>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="3">
|
|
|
+ <el-col :span="5">
|
|
|
<el-form-item label="账户余额">
|
|
|
- <span>0元</span>
|
|
|
+ <span>{{ user_money }}元</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="充值金额" prop="money">
|
|
|
<el-input v-model="dataForm.money" type="number" min="0" class="filter-item" />
|
|
|
@@ -121,21 +104,24 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+var LodashArray = require('lodash/array')
|
|
|
import { Message, MessageBox, Loading } from 'element-ui'
|
|
|
import { rechargeChannelPlatformAccount } from '@/api/common'
|
|
|
-import { validMobile } from '@/utils/validate'
|
|
|
+// import { validMobile } from '@/utils/validate'
|
|
|
|
|
|
export default {
|
|
|
name: 'Recharge',
|
|
|
data() {
|
|
|
return {
|
|
|
// accountHandleSuccess: '', // 处理成功账号
|
|
|
+ repeatNumList: [], // 重复账号
|
|
|
dataForm: {
|
|
|
pid: 'd65aa6d7614589bffe62456b88e98811', // 游戏平台ID;默认魅族平台
|
|
|
cid: '', // 渠道账号ID
|
|
|
gfid: '', // 游戏ID
|
|
|
paypwd: '', // 支付密码
|
|
|
- username: '13121776520\n13121776521\n13121776522\n13121776523\n13121776524\n13121776525', // 充值账户
|
|
|
+ // username: '13121776520\n13121776521\n13121776522\n\n13121776523\n13121776524\n13121776525', // 充值账户
|
|
|
+ username: '', // 充值账户
|
|
|
money: 1, // 充值金额(单位:元)
|
|
|
recharge: 2, //
|
|
|
payway: 1, // 充值方式
|
|
|
@@ -160,6 +146,7 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
// balanceMoney: 0, // 渠道余额
|
|
|
+ user_money: 0, // 账户余额
|
|
|
rechargeChannelPlatform: [], // 渠道账号
|
|
|
rechargeGame: [], // 游戏列表
|
|
|
|
|
|
@@ -167,28 +154,52 @@ export default {
|
|
|
thenAccount: '', // 成功账户
|
|
|
thenAccountNum: 0, // 成功个数
|
|
|
catchAccount: '', // 失败账户
|
|
|
- catchAccountNum: 0, // 失败个数
|
|
|
- loadingText: '处理中,请稍等。。。',
|
|
|
- loadingTextNum: 0 // 操作百分比
|
|
|
+ catchAccountNum: 0 // 失败个数
|
|
|
+ // loadingText: '处理中,请稍等。。。',
|
|
|
+ // loadingTextNum: 0 // 操作百分比
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
// this.getBalanceMoney(this.dataForm.pid)
|
|
|
this.getRechargePlatform(this.dataForm.pid)
|
|
|
this.getRechargeGame(this.dataForm.pid)
|
|
|
+ this.updateUserMoney()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 更新用户余额
|
|
|
+ updateUserMoney() {
|
|
|
+ this.$store.dispatch('user/getInfo').then((res) => {
|
|
|
+ const { data } = res
|
|
|
+ this.user_money = data.user_money
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 统计充值账户数量并处理行数不是账号的
|
|
|
setAccountNum() {
|
|
|
+ if (!this.dataForm.username) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
this.accountNum = 0
|
|
|
- const list = this.dataForm.username.split('\n')
|
|
|
+ this.repeatNumList = []
|
|
|
+ var newQuestion = this.dataForm.username.replace(/\n\n/, '\n')
|
|
|
+ const list = newQuestion.split('\n')
|
|
|
+
|
|
|
+ var newList = [] // 处理重复数据
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
- // console.log(list[i])
|
|
|
- if (validMobile(list[i])) {
|
|
|
+ // 账户去重,并提示
|
|
|
+ if (newList.indexOf(list[i]) === -1) {
|
|
|
this.accountNum++
|
|
|
+ newList.push(list[i])
|
|
|
+ } else {
|
|
|
+ if (this.repeatNumList.indexOf(list[i]) === -1) {
|
|
|
+ this.repeatNumList.push(list[i])
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ this.dataForm.username = newList.join().replace(new RegExp(',', 'g'), '\n')
|
|
|
},
|
|
|
async onSubmit() {
|
|
|
+ // this.setAccountNum()
|
|
|
+
|
|
|
this.thenAccount = ''
|
|
|
this.catchAccount = ''
|
|
|
|
|
|
@@ -200,47 +211,51 @@ export default {
|
|
|
// })
|
|
|
// }
|
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
|
- console.log('# form-validate:', valid)
|
|
|
if (valid) {
|
|
|
// 截取数据
|
|
|
var userLists = this.dataForm.username.split('\n')
|
|
|
|
|
|
- // TODO: 账号重复判断、账号为空判断
|
|
|
-
|
|
|
MessageBox.prompt('输入支付密码', 'Tip', {
|
|
|
confirmButtonText: '确认',
|
|
|
cancelButtonText: '取消'
|
|
|
}).then(({ value }) => {
|
|
|
- var successList = [] // 成功数据
|
|
|
- var failList = [] // 失败数据
|
|
|
-
|
|
|
- const loading = Loading.service({
|
|
|
- lock: true,
|
|
|
- text: this.loadingText,
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
- })
|
|
|
+ // 提取第一条账号数据,针对接口提交判断数据是否有误
|
|
|
+ var oneData = { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: value, username: userLists[0], money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type }
|
|
|
+ this.$store.dispatch('common/rechargePlayer', oneData).then((res) => {
|
|
|
+ const { code, status } = res
|
|
|
+ if (code === 200 && status === true) {
|
|
|
+ this.thenAccount = this.thenAccount + oneData.username + '\n'
|
|
|
+ this.thenAccountNum++
|
|
|
|
|
|
- // setTimeout(() => {
|
|
|
- // loading.close()
|
|
|
- // }, 2000)
|
|
|
+ // 遮屏
|
|
|
+ const loading = Loading.service({
|
|
|
+ lock: true,
|
|
|
+ text: '处理中, 请稍等...',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ })
|
|
|
|
|
|
- const loadingNum = userLists.length - 1
|
|
|
- // console.log('# loadingNum:', loadingNum)
|
|
|
-
|
|
|
- userLists.forEach(async(item, index) => {
|
|
|
- // console.log('# index:', index)
|
|
|
- // this.loadingText = '处理中,当前' + index
|
|
|
- if (validMobile(item)) {
|
|
|
- var _data = { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: value, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type }
|
|
|
- await this.rechargePlayer({ successList, failList }, _data, index)
|
|
|
- }
|
|
|
- if (loadingNum === index) {
|
|
|
+ // 成功后处理剩下账号数据
|
|
|
+ // const loadingNum = userLists.length - 1
|
|
|
+ console.log('# AAA:', userLists)
|
|
|
+ userLists = LodashArray.drop(userLists)
|
|
|
+ console.log('# BBBB:', userLists)
|
|
|
loading.close()
|
|
|
+ // userLists.forEach(async(item, index) => {
|
|
|
+ // var _data = { pid: this.dataForm.pid, cid: this.dataForm.cid, gfid: this.dataForm.gfid, paypwd: value, username: item, money: this.dataForm.money, recharge: this.dataForm.recharge, payway: this.dataForm.payway, type: this.dataForm.type }
|
|
|
+ // await this.rechargePlayer(_data, index)
|
|
|
+ // if (loadingNum === index) {
|
|
|
+ // loading.close()
|
|
|
+ // this.updateUserMoney()
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ } else {
|
|
|
+ this.catchAccount = this.catchAccount + oneData.username + '\n'
|
|
|
+ this.catchAccountNum++
|
|
|
}
|
|
|
+ }).catch((res) => {
|
|
|
+ this.catchAccount = this.catchAccount + oneData.username + '\n'
|
|
|
+ this.catchAccountNum++
|
|
|
})
|
|
|
-
|
|
|
- console.log('# 成功:', successList)
|
|
|
- console.log('# 失败:', failList)
|
|
|
}).catch(() => {
|
|
|
return Message({
|
|
|
type: 'info',
|
|
|
@@ -256,18 +271,16 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 异步进行账户充值
|
|
|
- rechargePlayer(request, data, index) {
|
|
|
+ rechargePlayer(data, index) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- setTimeout((_request, _data) => {
|
|
|
+ setTimeout((_data) => {
|
|
|
this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
|
|
|
const { code, status } = res
|
|
|
if (code === 200 && status === true) {
|
|
|
- _request.successList.push(_data.username)
|
|
|
this.thenAccount = this.thenAccount + _data.username + '\n'
|
|
|
this.thenAccountNum++
|
|
|
resolve()
|
|
|
} else {
|
|
|
- _request.failList.push(_data.username)
|
|
|
this.catchAccount = this.catchAccount + _data.username + '\n'
|
|
|
this.catchAccountNum++
|
|
|
resolve()
|
|
|
@@ -277,7 +290,7 @@ export default {
|
|
|
this.catchAccountNum++
|
|
|
resolve()
|
|
|
})
|
|
|
- }, 2000 * index, request, data)
|
|
|
+ }, 2000 * index, data)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
@@ -311,6 +324,8 @@ export default {
|
|
|
getRechargeGame(pid) {
|
|
|
this.$store.dispatch('common/rechargeGame', pid).then((res) => {
|
|
|
this.rechargeGame = res
|
|
|
+
|
|
|
+ // TODO: 判断当前账户是否有默认选项,没有则选中第一条。
|
|
|
this.dataForm.gfid = 42670
|
|
|
}).catch((res) => {
|
|
|
return Message({
|