Commit 3efca0fc by 张立顺

修复支付宝支付问题

1 parent 15c493c1
......@@ -4,13 +4,13 @@
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no,viewport-fit=cover">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
<!-- <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<title>
<%= webpackConfig.name %>
</title>
<% } %> -->
<title>
<%= webpackConfig.name %>
</title>
</head>
<body>
......@@ -24,10 +24,10 @@
<!-- <script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> -->
<!-- <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script> -->
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<!-- <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
<!-- built files will be auto injected -->
<% } %> -->
<!-- built files will be auto injected -->
</body>
</html>
\ No newline at end of file
......@@ -5,7 +5,9 @@ const path = 'dj.api.smartcarlife.'
// /router/dj.api.smartcarlife.alipay.oauth.token
// 支付宝授权码换取用户ID
export function alipayOauthToken(data) {
console.log('data', data)
data.method = `${path}alipay.oauth.token`
console.log('data', data)
return request(data, RequestMethods.POST)
}
// 发起支付
......
......@@ -116,6 +116,7 @@ service.interceptors.response.use(
// subErrors: null
// }
const dataAxios = response.data
console.log('dataAxios', dataAxios)
const ruleResult = baseConfig.axios.result
// 这个状态码是和后端约定的
// 有 code 代表这是一个后端接口 可以进行进一步的判断
......@@ -141,6 +142,7 @@ service.interceptors.response.use(
},
error => {
console.log(error, 'error')
if (error && error.response) {
switch (error.response.status) {
case 400:
......
......@@ -116,7 +116,7 @@ export default {
// openId: 'oQ6Sh5cGirPd55Oc1J1oJSRpboFM',
// openId: '',
userId: '', // 测试用数据
// userId: '2088012113317722', // 测试用数据
// userId: '2088012113317722' // 测试用数据
tradeNO: ''// 测试用数据
// tradeNO: '2022083122001417721446143547'// 测试用数据
}
......@@ -140,13 +140,13 @@ export default {
scopes: ['auth_base']
}, function (res) {
console.log('res.authCode', res.authCode)
res.authCode && that.gteOpenId(res.authCode)
res.authCode && that.getOpenId(res.authCode)
}, function (res) {
console.log('res.fail', res)
// res.authCode && that.gteOpenId(res.authCode)
// res.authCode && that.getOpenId(res.authCode)
})
// this.gteOpenId('ab3aa51e466140b5b96475706653UX72')
// this.getOpenId('ab3aa51e466140b5b96475706653UX72')
// this.aliPayment()
......@@ -158,9 +158,11 @@ export default {
// })
},
methods: {
gteOpenId(code) {
getOpenId(code) {
// ap.alert(JSON.stringify(code))
console.log('gteOpenId', code)
console.log('getOpenId', code)
console.log(alipayOauthToken)
// !code&&console.log('alipayOauthToken')
code && alipayOauthToken({ code }).then((result) => {
console.log('alipayOauthToken', result)
const { userId } = result
......@@ -296,8 +298,9 @@ export default {
// return
createWxPayH5(params).then((result) => {
const { tradeNO } = JSON.parse(result.jsapiPayInfo)
this.outTradeNo = tradeNO
this.outTradeNo && this.aliPayment()
this.tradeNO = tradeNO
console.log('tradeNO', tradeNO)
this.tradeNO && this.aliPayment()
}).catch((err) => {
console.log(err)
}).finally(() => {
......@@ -307,7 +310,7 @@ export default {
aliPayment() {
const that = this
// 调用支付宝api唤起支付功能
console.log('this.outTradeNo', this.tradeNO)
console.log('this.tradeNO', this.tradeNO)
const { tradeNO } = this
AlipayJSBridge.call(
'tradePay',
......
......@@ -53,9 +53,9 @@ const spritesmithFunction = data => {
return `${shared}\n${perSprite}`
}
module.exports = {
// publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-lwk/', // 本地调试时需登录时使用
publicPath: IS_PROD ? '/dj-carlife-web-alipay' : './', // 本地调试时需登录时使用
// publicPath: './',
publicPath: '/dj-carlife-web-alipay', // 署应用包时的基本 URL。 vue-router history模式使用
// publicPath: '/dj-carlife-web-alipay', // 署应用包时的基本 URL。 vue-router history模式使用
// publicPath: '/dj-carlife-web-alipay/', // 署应用包时的基本 URL。 vue-router history模式使用
outputDir: 'dist', // 生产环境构建文件的目录
// assetsDir: 'static', // outputDir的静态资源(js、css、img、fonts)目录
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!