| | |
| | | export const getOpenIdBase = (params, config = {}) => http.get(URL + |
| | | '/payfour-merchant/v1/web/aggregatePayAllin/getOpenIdBase', params, config = {}); |
| | | |
| | | /*统一登录*/ |
| | | /*统一授权*/ |
| | | export const userLogin = (params, config = {}) => { |
| | | let path = '/payfour-merchant/v1/web/aggregatePayAllin/getOpenId' |
| | | let path = '/payfour-merchant/v1/web/aggregatePayAllin/getOpenId' //微信授权 |
| | | if(params.platform==5){ //支付宝授权 |
| | | path = '/payfour-merchant/v1/web/h5PayAli/getUserIdByCode' |
| | | } |
| | | if (params.platform == 15) { //云闪付授权 |
| | | path = '/service-merchant/v1/web/h5PayUnionPay/getUserIdByCode' |
| | | } |
| | | return http.get(URL + path, |
| | | params, config = {}) |
| | | }; |
| | |
| | | import { |
| | | getPlat |
| | | } from 'common/util.js'; |
| | | |
| | | module.exports = (vm) => { |
| | | uni.$u.http.setConfig((x) => { |
| | | return x = { |
| | |
| | | if (TOKEN) { |
| | | x.header[ACCESSTOKEN] = 'Bearer ' + TOKEN; |
| | | } |
| | | const plat = getPlat() |
| | | if (plat == 2) { //微信 |
| | | const OPENID = uni.getStorageSync('OPENID' + plat) || null |
| | | const UNIONID = uni.getStorageSync('UNIONID' + plat) || null |
| | | if (OPENID) { |
| | | x.header['Openid'] = OPENID; |
| | | } |
| | | if (UNIONID) { |
| | | x.header['Unionid'] = UNIONID; |
| | | } |
| | | } |
| | | if (plat == 5) { //支付宝 |
| | | const ALIUSERID = uni.getStorageSync('ALIUSERID' + plat) || null |
| | | if (ALIUSERID) { |
| | | x.header['Aliuserid'] = ALIUSERID; |
| | | } |
| | | } |
| | | if (plat == 15) { //云闪付 |
| | | const UNIONPAYID = uni.getStorageSync('UNIONPAYID ' + plat) || null |
| | | if (UNIONPAYID) { |
| | | x.header['Unionpayid '] = UNIONPAYID; |
| | | } |
| | | } |
| | | return x; |
| | | }, x => { |
| | | return Promise.reject(x) |
| | |
| | | if (ua.match(/AlipayClient/i) == 'alipayclient') { |
| | | return 5; |
| | | } |
| | | //判断是不是云闪付 |
| | | if (ua.indexOf('unionpay/1.0') !== -1) { |
| | | return 15; |
| | | } |
| | | // #endif |
| | | // #ifdef MP-WEIXIN |
| | | return 2; |
| | |
| | | import App from './App' |
| | | import Vue from 'vue' |
| | | import Vconsole from 'vconsole'; |
| | | new Vconsole(); |
| | | import uView from '@/uni_modules/uview-ui' |
| | | Vue.use(uView) |
| | | |
| | |
| | | }, |
| | | onShow() { |
| | | let redirect_uri = `${config.webURL}/pay/scanpay?cid=${this.opt.cid||''}&shopId=${this.opt.shopId||''}&activityQrcodeId=${this.opt.activityQrcodeId||''}&smoney=${this.opt.smoney||''}` |
| | | if(uni.getStorageSync('OPENID'+this.platform)){ |
| | | if(this.platform==2&&uni.getStorageSync('OPENID'+this.platform)){ |
| | | window.location.href = redirect_uri |
| | | return |
| | | } |
| | | if(this.platform==5&&uni.getStorageSync('ALIUSERID'+this.platform)){ |
| | | window.location.href = redirect_uri |
| | | return |
| | | } |
| | |
| | | } else if (this.platform == 5) { |
| | | window.location.href = |
| | | `https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=${config.ali_appid}&scope=auth_base&redirect_uri=${redirect_uri}&state=STATE` |
| | | } else if (this.platform == 15) { |
| | | window.location.href = |
| | | `https://qr.95516.com/qrcGtwWeb-web/api/userAuth?version=1.0.0&redirectUrl=${redirect_uri}` |
| | | } else { |
| | | uni.reLaunch({ |
| | | url: `/pay/scanpay?cid=${this.opt.cid}` |
| | |
| | | this.cid = opt.cid |
| | | this.init() |
| | | } |
| | | if (opt.code || opt.auth_code) { |
| | | if (opt.code || opt.auth_code || opt.userAuthCode) { |
| | | let params = { |
| | | code: opt.code |
| | | } |
| | | let code = opt.code |
| | | if (this.payWay == 2&&opt.state == 1 ) { |
| | | if (this.payWay == 2&&opt.state == 1 ) { //微信 |
| | | params.getUserInfo = 1 |
| | | } |
| | | if (this.payWay == 5) { |
| | | if (this.payWay == 5) { //支付宝 |
| | | params.code = opt.auth_code |
| | | } |
| | | if (this.payWay == 15) { //云闪付 |
| | | code = opt.userAuthCode |
| | | } |
| | | const cd = uni.getStorageSync('cd') |
| | | if (code === cd) { |
| | |
| | | if (res.unionid) { |
| | | uni.setStorageSync('UNIONID' + this.payWay, res.unionid) |
| | | } |
| | | if (res.aLiUserId) { |
| | | uni.setStorageSync('ALIUSERID' + this.payWay, res.aLiUserId) |
| | | } |
| | | this.UNIONID = res.unionid |
| | | uni.setStorageSync(ACCESSTOKEN, res.token) |
| | | uni.setStorageSync('IS_NEW', res.isNew) |