Browse Source

缴费

master
xuesinan 4 years ago
parent
commit
d9f4a5c622
  1. 56
      src/views/Pay/Pay.vue

56
src/views/Pay/Pay.vue

@ -55,7 +55,7 @@
<script>
import { mapState, mapMutations } from 'vuex';
import { toPay, uploadImg } from '@/config/api';
import { toPay, uploadImg, getUserInfo } from '@/config/api';
function getBase64(file) {
return new Promise((resolve, reject) => {
@ -70,7 +70,7 @@ export default {
data() {
return {
timer: null,
player_id: '',
playerId: '',
fileId: '',
previewVisible: false,
previewImage: '',
@ -92,22 +92,14 @@ export default {
if (this.projectId) {
clearInterval(this.timer);
await this.setParams();
//
// document.querySelector('#scrollTo').scrollIntoView({
// behavior: 'smooth', //
// block: 'start', //
// });
}
}, 300);
},
methods: {
// ...mapMutations('home', ['setStartTime', 'setEndTime', 'setMemberIdList']),
async setParams() {
const { projectId, roleId } = this;
const params = { param: { projectId, roleId } };
const params = { param: { projectId } };
await this.getUserInfo(params);
},
@ -120,7 +112,7 @@ export default {
const res = await getUserInfo(params);
const { code, msg, data } = res.data;
if (code === 200 && data) {
this.player_id = data.id;
this.playerId = data.id;
} else {
this.$message.error(msg || '获取失败');
throw msg;
@ -144,41 +136,35 @@ export default {
handleChange({ fileList }) {
this.fileList = fileList;
// this.uploadImg();
},
/**
* 上传文件
*/
// async uploadImg() {
// try {
// const params = { param: this.fileList[0] };
// const res = await uploadImg();
// const { code, msg, data } = res.data;
// if (code === 200) {
// this.fileId = data.fileId;
// } else {
// this.$message.error(msg || '');
// throw msg;
// }
// } catch (error) {
// throw error || '';
// }
// },
async uploadPay() {
let res = {};
this.fileList.forEach((item, index) => {
if (index === 0 && item.response) {
res = item.response.data;
}
});
this.fileId = res.fileId;
if (!this.fileId) {
this.$message.info('图片上传未完成或未上传图片');
return false;
}
try {
const params = {
param: {
projectId: this.projectId,
player_id: this.player_id,
playerId: this.playerId,
fileId: this.fileId,
},
};
const res = await toPay();
const res = await toPay(params);
const { code, msg, data } = res.data;
if (code === 200) {
this.targetList = data;
this.back();
} else {
this.$message.error(msg || '获取失败');
throw msg;

Loading…
Cancel
Save