浏览代码

网银支付接口调试

yuwenjun1997 3 年之前
父节点
当前提交
cc7664cc96

+ 6 - 6
.env.development

@@ -4,19 +4,19 @@ NODE_ENV = development
 ENV = 'development'
 
 # 测试地址 API接口
-# VUE_APP_BASE_API = 'https://zplma-b.caimei365.com'
-VUE_APP_BASE_API = 'http://192.168.2.68:8012'
+VUE_APP_BASE_API = 'https://zplma-b.caimei365.com'
+# VUE_APP_BASE_API = 'http://192.168.2.68:8012'
 
 # 文件上传 API接口地址
-# VUE_APP_UPLOAD_API='https://zplma-b.caimei365.com'
-VUE_APP_UPLOAD_API='http://192.168.2.68:8012'
+VUE_APP_UPLOAD_API='https://zplma-b.caimei365.com'
+# VUE_APP_UPLOAD_API='http://192.168.2.68:8012'
 
 # 二维码生成链接location
 VUE_APP_BASE_SERVER = 'https://www-b.caimei365.com'
 
 # 消息接口地址 WebSocket
-# VUE_APP_SOCKET_SERVER = 'wss://zplma-b.caimei365.com/websocket?sessionSource=zplm_admin'
-VUE_APP_SOCKET_SERVER = 'ws://192.168.2.68:8012/websocket?sessionSource=zplm_admin'
+VUE_APP_SOCKET_SERVER = 'wss://zplma-b.caimei365.com/websocket?sessionSource=zplm_admin'
+# VUE_APP_SOCKET_SERVER = 'ws://192.168.2.68:8012/websocket?sessionSource=zplm_admin'
 
 # 网站地址
 # VUE_APP_LOCAL = 'http://192.168.2.81:9527'

+ 11 - 2
src/api/pay.js

@@ -18,8 +18,8 @@ export function checkedWinxinPaySuccess(params) {
   })
 }
 
-/** 查询支付是否成功 (支付宝 银联) */
-export function checkedOtherPaySuccess(params) {
+/** 查询支付是否成功 (支付宝) */
+export function checkedAliPaySuccess(params) {
   return request({
     url: '/pay/result/json',
     method: 'GET',
@@ -27,6 +27,15 @@ export function checkedOtherPaySuccess(params) {
   })
 }
 
+/** 查询支付是否成功(银联) */
+export function checkedUnionPaySuccess(params) {
+  return request({
+    url: '/pay/result/union',
+    method: 'GET',
+    params
+  })
+}
+
 /** 获取银联支付列表 */
 export function fetchBankcodeList(params) {
   return request({

+ 4 - 4
src/views/common/share/pay/pay.vue

@@ -51,7 +51,7 @@
 
 <script>
 import PayBank from '@/views/components/payment/pay-bank.vue'
-import { checkedOtherPaySuccess, fetchPayInfoWithLinkLogo } from '@/api/pay'
+import { checkedUnionPaySuccess, fetchPayInfoWithLinkLogo } from '@/api/pay'
 import { countDown } from '@/utils'
 export default {
   components: {
@@ -100,7 +100,7 @@ export default {
     },
     // 获取订单信息
     fetchPayInfoWithLinkLogo() {
-      fetchPayInfoWithLinkLogo({ linkLogo: this.linkLogo }).then(res => {
+      fetchPayInfoWithLinkLogo({ linkLogo: this.linkLogo }).then((res) => {
         const result = JSON.parse(res.data)
         this.orderPayLink = result.orderPayLink
         this.authUser = result.authUser
@@ -113,7 +113,7 @@ export default {
       this.redirectUrlQuery = {
         payAmount: e.data.payAmount
       }
-      checkedOtherPaySuccess({ mbOrderId: e.data.mbOrderId }).then(res => {
+      checkedUnionPaySuccess({ mbOrderId: e.data.mbOrderId }).then((res) => {
         res = JSON.parse(res.data)
         if (res.data.status === '1') {
           this.$router.push({
@@ -143,7 +143,7 @@ export default {
       const diffTime = new Date(this.orderPayLink.effectiveTime).getTime()
       const loadTime = new Date().getTime()
       this.timer && clearTimeout(this.timer)
-      countDown(diffTime, loadTime, {}, item => {
+      countDown(diffTime, loadTime, {}, (item) => {
         this.countDownTime = item.conttainer
         this.timer = item.t
       })

+ 9 - 4
src/views/components/payment/pay-bank.vue

@@ -70,7 +70,8 @@ export default {
   data() {
     return {
       isLoading: false,
-      bankList: [],
+      bankB2BList: [],
+      bankB2CList: [],
       checkedBank: '',
       payData: {},
       confirmVisiable: false,
@@ -82,6 +83,9 @@ export default {
   computed: {
     bankCode() {
       return this.bankList.find((item) => item.id === this.checkedBank)
+    },
+    bankList() {
+      return this.payWay === 3 ? this.bankB2BList : this.bankB2CList
     }
   },
   watch: {
@@ -100,7 +104,8 @@ export default {
     fetchBankcodeList() {
       fetchBankcodeList().then((res) => {
         const result = JSON.parse(res.data)
-        this.bankList = result.list
+        this.bankB2BList = result.B2B
+        this.bankB2CList = result.B2C
       })
     },
     // 确认支付弹窗
@@ -150,11 +155,11 @@ export default {
     handlePay() {
       let code = ''
       if (this.payWay === 3) {
-        this.userType = 'ENTERPRISE'
+        this.userType = 'B2B'
         code = this.bankCode.b2B
       }
       if (this.payWay === 4) {
-        this.userType = 'USER'
+        this.userType = 'B2C'
         code = this.bankCode.b2C
       }
       const params = {

+ 6 - 1
src/views/components/payment/pay-wechat.vue

@@ -37,9 +37,14 @@ export default {
     // 绘制支付二维码
     drawQrcode() {
       // const wxPayUri = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx91c4152b60ca91a3&redirect_uri=${process.env.VUE_APP_BASE_SERVER}/pay/wechatpay.html&response_type=code&scope=snsapi_base&state=${JSON.stringify(this.data)}#wechat_redirect`
-      const wxPayUri = `https://www-b.caimei365.com/wxcode.html?orderInfo=${encodeURIComponent(
+      // const wxPayUri = `https://www-b.caimei365.com/wxcode.html?orderInfo=${encodeURIComponent(
+      //   JSON.stringify(this.data)
+      // )}`
+      const wxPayUri = `${process.env.VUE_APP_BASE_SERVER}/wxcode.html?orderInfo=${encodeURIComponent(
         JSON.stringify(this.data)
       )}`
+
+      console.log(wxPayUri)
       qrcode
         .toDataURL(wxPayUri, { width: 180, margin: 0, errorCorrectionLevel: 'H', type: 'image/jpeg', scale: 1 })
         .then((url) => {

+ 18 - 4
src/views/normal/vip/buy.vue

@@ -100,7 +100,13 @@ import RadioCard from '@/views/components/RadioCard'
 
 // 接口
 import { fetchConfigureList } from '@/api/member'
-import { registerSuperPay, payOnlineChecked, checkedWinxinPaySuccess, checkedOtherPaySuccess } from '@/api/pay'
+import {
+  registerSuperPay,
+  payOnlineChecked,
+  checkedWinxinPaySuccess,
+  checkedAliPaySuccess,
+  checkedUnionPaySuccess
+} from '@/api/pay'
 
 export default {
   components: {
@@ -226,8 +232,10 @@ export default {
       this.payType = e.type
       if (e.type === 'WEIXIN') {
         this.checkedWinxinPaySuccess({ vipRecordId: e.data.vipRecordId, orderFlag: 0 })
+      } else if (e.type === 'ALIPAY') {
+        this.checkedAliPaySuccess({ mbOrderId: e.data.mbOrderId, orderFlag: 0 })
       } else {
-        this.checkedOtherPaySuccess({ mbOrderId: e.data.mbOrderId, orderFlag: 0 })
+        this.checkedUnionPaySuccess({ mbOrderId: e.data.mbOrderId, orderFlag: 0 })
       }
     },
     // 查询是否成功(微信支付专用)
@@ -237,8 +245,14 @@ export default {
       })
     },
     // 查询支付是否成功 (支付宝 银联)
-    checkedOtherPaySuccess(params) {
-      checkedOtherPaySuccess(params).then((res) => {
+    checkedAliPaySuccess(params) {
+      checkedAliPaySuccess(params).then((res) => {
+        this.handlePayResult(res)
+      })
+    },
+    // 查询支付是否成功 (支付宝 银联)
+    checkedUnionPaySuccess(params) {
+      checkedUnionPaySuccess(params).then((res) => {
         this.handlePayResult(res)
       })
     },