初始化

master
法外狂徒张三 2024-08-29 19:55:23 +08:00
parent 00fd0d3379
commit e4e4048392
1 changed files with 4 additions and 22 deletions

View File

@ -59,7 +59,7 @@
<el-col :span="8" v-for="customer in apitypeList" v-if="apitypeList.length != 0&&activeNameL=='全部类型'||customer.sysLeixingpick==activeNameL">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-image :src="customer.sysTypes" @click="initiatePayment(customer)">
<el-image :src="customer.sysTypes" @click="goToPaySuccess(customer)">
<div slot="placeholder" class="image-slot">
加载中<span class="dot">...</span>
</div>
@ -145,34 +145,16 @@ export default {
//
rules: {
},
paymentStatus: null, //
alipayUrl: null, // URL
};
},
created() {
this.getList();
},
methods: {
async initiatePayment(customer){
try {
this.paymentStatus = 'loading';
const response = await axios.get('/alipay/pay', {
params: {
subject: customer.sysIntro,
traceNo: Math.floor(Math.random() * 900000) + 100000, //
totalAmount: customer.sysNumber, //
},
});
this.alipayUrl = URL.createObjectURL(new Blob([response.data], { type: 'text/html' }));
window.location.href = this.alipayUrl; // 使iframe
this.paymentStatus = 'success';
} catch (error) {
console.error('支付请求失败:', error);
this.paymentStatus = 'error';
}
async goToPaySuccess(customer){
//window.open(url,'_self')
window.open("http://127.0.0.1:8080/alipay/pay?subject="+customer.sysIntro+"&traceNo="+Math.floor(Math.random() * 900000) + 100000+"&totalAmount="+customer.sysNumber,'_self')
},
getType(activeNameL){