Authored by jiran.zhao

申请提现

... ... @@ -3,11 +3,27 @@ export default function() {
form: '',
showLoading: true,
data: {
seasons: '',
productIntro: '',
applyType: 0,
},
beginStr: '',
endStr: '',
beginTimeStr: '',
endTimeStr: '',
ruleValidate: {
productName: [{ required: true, message: '商品名不能为空', trigger: 'blur' }],
},
apply: {
shopId: '',
applyPid: '',
applyAmount: '',
applyType: 0,
beginTime: '',
endTime: '',
applyPhone: '',
targetAccount: '',
token: '',
timestamp: '',
salt: 'fd4ad5fcsa0de589af23234ks1923ks',
},
};
}
... ...
... ... @@ -10,21 +10,28 @@
<span class="red">*支付宝每日转账最高限额10万元人民币,单日超过10万人民币限额的,请联系平台客服</span>
</Form-item>
<Form-item label="提现方式">
<span>最大可提现</span><span>{{ formatDate(data.billBeginTime) }}</span>
<span>最大可提现</span><span>{{ beginTimeStr }}</span>
~
<span>{{ formatDate(data.billEndTime) }}</span>
<span>{{ endTimeStr }}</span>
<br />
<span>请选择账单日期</span>
<Date-picker
:value="data.range"
type="datetimerange"
v-model="beginStr"
type="date"
format="yyyy-MM-dd"
placeholder="选择日期时间"
@on-change="clickAvailableDate"
@on-change="changeTimeStr"
/>
<Date-picker
v-model="endStr"
type="date"
format="yyyy-MM-dd"
placeholder="选择日期时间"
@on-change="changeTimeStr"
/>
</Form-item>
<Form-item label="提现金额">
<input :value="data.availableAmount" placeholder="请输入..." />
<input :value="data.withdrawAmount" placeholder="请输入..." />
</Form-item>
<Form-item label="提现到帐号">
<span>{{ data.withdrawAccount }}</span>
... ... @@ -37,16 +44,15 @@
</Form-item>
<Form-item>
<Button id="btnSubmit" type="primary" size="large" @click="save">确认提现</Button>
<Button type="primary" size="large">联系客服</Button>
<Button id="cancel" type="primary" size="large">联系客服</Button>
<Button id="cancel" type="primary" size="large" @click="backList">取消</Button>
</Form-item>
</Form>
</layout-body>
</template>
<script>
import _ from 'lodash';
import moment from 'moment';
import crypto from 'util/crypto';
import FinanceService from 'services/finance/finance-service';
import { WithdrawApply } from './store';
... ... @@ -54,21 +60,36 @@ export default {
data() {
return WithdrawApply.call(this);
},
// watch: {
// beginTimeStr() {
// this.getAvailableAmount();
// },
// },
created() {
const params = {
token: this.$user.token,
timestamps: Math.round(new Date().getTime() / 1000),
};
this.financeService = new FinanceService();
this.financeService.shopWithdrawApplyInit(params).then(result => {
if (result.code === 200) {
Object.assign(this.data, result.data);
}
});
},
mounted() {
this.getInfo();
this.financeService
.shopWithdrawApplyInit(params)
.then(result => {
if (result.code === 200) {
this.data = result.data;
this.beginStr = this.formatDate(result.data.billBeginTime);
this.endStr = this.formatDate(result.data.billEndTime);
this.beginTimeStr = this.formatDate(result.data.billBeginTime);
this.endTimeStr = this.formatDate(result.data.billEndTime);
this.data.beginTime = result.data.billBeginTime;
this.data.endTime = result.data.billEndTime;
}
})
.catch(() => {
this.$Message.error('请求出错');
this.showLoading = false;
});
},
mounted() {},
methods: {
backList() {
this.$router.push({ name: 'finance.withdraw.withdrawlist' });
... ... @@ -93,23 +114,27 @@ export default {
});
},
beforeSave() {
const newApply = {};
newApply.availableAmount = this.data.availableAmount;
newApply.applyType = this.data.applyType;
newApply.beginTime = this.data.beginTime;
newApply.endTime = this.data.endTime;
newApply.applyAmount = this.data.applyAmount;
newApply.targetAccount = this.data.targetAccount;
newApply.remarks = this.data.remarks;
newApply.timestamp = this.data.timestamp;
newApply.token = this.data.token;
newApply.sign = this.data.sign;
return newApply;
this.apply.shopId = this.$user.currentShop.shopsId;
this.apply.applyPid = this.$user.pid;
this.apply.applyAmount = this.data.withdrawAmount;
this.apply.applyType = this.data.applyType;
this.apply.beginTime = this.data.beginTime;
this.apply.endTime = this.data.endTime;
this.apply.applyPhone = this.data.accountPhone;
this.apply.targetAccount = this.data.withdrawAccount;
this.apply.token = this.$user.token;
this.apply.timestamp = Math.round(new Date().getTime() / 1000);
const params = this.apply;
const arrParams = Object.keys(params).map(key => {
return this.apply[key];
});
this.apply.sign = crypto.md5(arrParams.join('|'));
this.apply.account = this.$user.name;
},
save() {
const newApply = this.beforeSave();
this.beforeSave();
this.$Loading.start();
return this.financeService.shopWithdrawApply(newApply).then(result => {
return this.financeService.shopWithdrawApply(this.apply).then(result => {
if (result.code === 200) {
this.$Loading.finish();
this.$Notice.success({
... ... @@ -147,38 +172,14 @@ export default {
return moment.unix(date).format('YYYY-MM-DD');
}
},
clickAvailableDate(time) {
if (!_.isArray(time)) {
time = time.split(' - ');
}
if ((time[0] + '').length) {
const billBeginStr = moment.unix(this.data.billBeginTime).format('YYYY-MM-DD');
const billEndStr = moment.unix(this.data.billEndTime).format('YYYY-MM-DD');
if (time[0] < billBeginStr || time[1] > billEndStr) {
this.data.beginTime = '';
this.data.endTime = '';
this.$Notice.error({
title: '时间选择错误',
desc: '请选择范围内时间',
});
}
this.data.beginTime = time[0];
this.data.endTime = time[1];
this.getAvailableAmount();
} else {
this.data.beginTime = '';
this.data.endTime = '';
}
},
getAvailableAmount() {
const params = {};
params.beginTime = this.data.beginTime;
params.endTime = this.data.endTime;
params.beginTime = this.beginStr;
params.endTime = this.endStr;
this.financeService.shopGetAvailableAmount(params).then(result => {
if (result.code === 200) {
this.data.availableAmount = result.availableAmount;
this.data.withdrawAmount = result.data.availableAmount;
} else {
this.$Loading.error();
this.$Notice.error({
title: '查询错误',
desc: result.message,
... ... @@ -186,6 +187,7 @@ export default {
}
});
},
changeTimeStr() {},
},
};
</script>
... ...
... ... @@ -134,7 +134,7 @@ class FinanceService extends Service {
* @returns {Promise<unknown>}
*/
shopGetAvailableAmount(params) {
return this.post(apiUrl.shopWithdrawApply, params);
return this.post(apiUrl.shopGetAvailableAmount, params);
}
/**
... ...
... ... @@ -65,6 +65,7 @@ class UserController extends Context {
pwdComplexRateDesc: user.pwdComplexRateDesc,
needUpdate,
token: user.token,
pid: user.pid,
},
});
});
... ...