石广澎
2024-08-08 7e081cadeda2d7b5d3cc3f6055b4ee2799d19c00
feat(支付): 云闪付
4个文件已修改
29 ■■■■■ 已修改文件
common/api/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/http.interceptor.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pay/login.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pay/scanpay.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/api/index.js
@@ -27,7 +27,7 @@
        path = '/payfour-merchant/v1/web/h5PayAli/getUserIdByCode'
    }
    if (params.platform == 15) { //云闪付授权
        path = '/service-merchant/v1/web/h5PayUnionPay/getUserIdByCode'
        path = '/payfour-merchant/v1/web/h5PayUnionPay/getUserIdByCode'
    }
    return http.get(URL + path,
        params, config = {})
common/http.interceptor.js
@@ -33,8 +33,8 @@
        }
        const plat = getPlat()
        if (plat == 2) { //微信
            const OPENID = uni.getStorageSync('OPENID' + plat) || null
            const UNIONID = uni.getStorageSync('UNIONID' + plat) || null
            const OPENID = uni.getStorageSync('OPENID') || null
            const UNIONID = uni.getStorageSync('UNIONID') || null
            if (OPENID) {
                x.header['Openid'] = OPENID;
            }
@@ -43,13 +43,13 @@
            }
        }
        if (plat == 5) { //支付宝
            const ALIUSERID = uni.getStorageSync('ALIUSERID' + plat) || null
            const ALIUSERID = uni.getStorageSync('ALIUSERID') || null
            if (ALIUSERID) {
                x.header['Aliuserid'] = ALIUSERID;
            }
        }
        if (plat == 15) { //云闪付
            const UNIONPAYID = uni.getStorageSync('UNIONPAYID ' + plat) || null
            const UNIONPAYID = uni.getStorageSync('UNIONPAYID') || null
            if (UNIONPAYID) {
                x.header['Unionpayid '] = UNIONPAYID;
            }
pay/login.vue
@@ -20,11 +20,15 @@
        },
    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(this.platform==2&&uni.getStorageSync('OPENID'+this.platform)){
      if(this.platform==2&&uni.getStorageSync('OPENID')){
        window.location.href = redirect_uri
        return
      }
      if(this.platform==5&&uni.getStorageSync('ALIUSERID'+this.platform)){
      if(this.platform==5&&uni.getStorageSync('ALIUSERID')){
        window.location.href = redirect_uri
        return
      }
      if(this.platform==15&&uni.getStorageSync('UNIONPAYID')){
        window.location.href = redirect_uri
        return
      }
pay/scanpay.vue
@@ -208,7 +208,7 @@
    uni.setStorageSync('SHOPID', opt.shopId)
    uni.setStorageSync('SMONEY', opt.smoney)
    uni.setStorageSync('AQCI', opt.activityQrcodeId)
    this.UNIONID = uni.getStorageSync('UNIONID' + this.payWay) || null
    this.UNIONID = uni.getStorageSync('UNIONID') || null
    this.isNew = uni.getStorageSync('IS_NEW')
    if (opt.smoney) {
      this.smoney = opt.smoney
@@ -288,13 +288,16 @@
    getToken(res) {
      this.token = res.token
      if (res.openid) {
        uni.setStorageSync('OPENID' + this.payWay, res.openid)
        uni.setStorageSync('OPENID', res.openid)
      }
      if (res.unionid) {
        uni.setStorageSync('UNIONID' + this.payWay, res.unionid)
        uni.setStorageSync('UNIONID', res.unionid)
      }
      if (res.aLiUserId) {
        uni.setStorageSync('ALIUSERID' + this.payWay, res.aLiUserId)
        uni.setStorageSync('ALIUSERID', res.aLiUserId)
      }
      if (res.cloudPayUserId) {
        uni.setStorageSync('UNIONPAYID', res.cloudPayUserId)
      }
      this.UNIONID = res.unionid
      uni.setStorageSync(ACCESSTOKEN, res.token)