From 60dd3c9b8646b71e77bc0e93721b1ab380ba4c5b Mon Sep 17 00:00:00 2001 From: Wang YiHang <3060234389@qq.com> Date: Fri, 30 Aug 2024 22:37:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/market/apitype.js | 8 +-- src/views/market/apitype/index.vue | 109 +++-------------------------- 2 files changed, 15 insertions(+), 102 deletions(-) diff --git a/src/api/market/apitype.js b/src/api/market/apitype.js index c16edcf..724019a 100644 --- a/src/api/market/apitype.js +++ b/src/api/market/apitype.js @@ -1,11 +1,11 @@ import request from '@/utils/request' -export function pay(data) { +export function pay(query) { return request({ - url: '/pay/alipay/pay/payZFB', - method: 'post', - data: data + url: '/pay/alipay/pay', + method: 'get', + params: query }) } // 查询接口列表 diff --git a/src/views/market/apitype/index.vue b/src/views/market/apitype/index.vue index 57676c0..7ee2ede 100644 --- a/src/views/market/apitype/index.vue +++ b/src/views/market/apitype/index.vue @@ -94,29 +94,6 @@ @pagination="getList" /> - - - -
- 确认支付 -
-
-
@@ -132,7 +109,6 @@ export default { data() { return { - dialogTableVisible:false, all:"全部类型", activeNameL:"全部类型", editableTabs: [], @@ -170,87 +146,23 @@ export default { // 表单校验 rules: { }, - amountVal: '', - disabled: false, - // 同步跳转页面地址 - returnUrl:'http://localhost:80/#/entertainment/payment', - //充值参数 - rechargeParams: { - "totalAmt": '', //金额 - "paymentType": "0", //支付方式[0:微信,1:支付宝,2:余额,3:活动] - "transType": "1", //交易类型[0:充值,1:消费] - "subject":"" - } + pay:{ + + }, }; }, created() { this.getList(); }, methods: { - paymentTypeChange(val) { - this.rechargeParams.paymentType = val - }, - //确认支付 - async surePay() { - if (this.rechargeParams.totalAmt === '') { - this.$message.warning('请输入金额'); - return; - } - if (this.rechargeParams.paymentType === '0') { - - } else if (this.rechargeParams.paymentType === '1') { - let praem = { - // 生成一个随你的订单号 方便测试 - outTradeNo:this.getProjectNum() + Math.floor(Math.random() * 10000), - // 传递支付金额 - totalAmount:this.rechargeParams.totalAmt, - // 传递同步跳转地址 - returnUrl:this.returnUrl, - // 商品名称 - subject:'支付金额', - // 支付类型 - productCode:'FAST_INSTANT_TRADE_PAY' - } - pay(praem).then(code => { - if (code.code === 200) { - // 支付方式跳转 - this.$message.success('支付宝支付') - const payDiv = document.getElementById('payDiv'); - if (payDiv) { - document.body.removeChild(payDiv); - } - const div = document.createElement('div'); - div.id = 'payDiv'; - div.innerHTML = code.data; - document.body.appendChild(div); - document.getElementById('payDiv').getElementsByTagName('form')[0].submit(); - } - }) - } - }, - // 获取当前日期的方法 - getProjectNum () { - const projectTime = new Date() // 当前中国标准时间 - const Year = projectTime.getFullYear() // 获取当前年份 支持IE和火狐浏览器. - const Month = projectTime.getMonth() + 1 // 获取中国区月份 - const Day = projectTime.getDate() // 获取几号 - var CurrentDate = Year - if (Month >= 10) { // 判断月份和几号是否大于10或者小于10 - CurrentDate += Month - } else { - CurrentDate += '0' + Month - } - if (Day >= 10) { - CurrentDate += Day - } else { - CurrentDate += '0' + Day - } - return CurrentDate - }, gotoMaintained(customer){ - this.dialogTableVisible=true; - this.rechargeParams.totalAmt=customer.sysNumber; - this.rechargeParams.subject=customer.sysIntro; + this.pay.subject=customer.sysIntro + this.pay.traceNo=Math.floor(Math.random() * 900000) + 100000 + this.pay.totalAmount=customer.sysNumber + this.pay.returnUrl = `http://47.116.173.119:80/alipay/pay?subject=${this.pay.subject}&traceNo=${this.pay.traceNo}&totalAmount=${this.pay.totalAmount}`; + pay(this.pay).then(res => { + console.log(res); + }) }, getType(activeNameL){ this.activeNameL=activeNameL @@ -270,6 +182,7 @@ export default { // 将 Map 的值(即去重后的对象)转换回数组 this.editableTabs = Array.from(uniqueSysLeixingpick.values()) ; + this.total = response.data.total; this.loading = false; }