This commit is contained in:
weipengfei 2024-03-02 14:41:28 +08:00
parent 9958c5db29
commit a06111c67c
4 changed files with 57 additions and 33 deletions

View File

@ -12,8 +12,8 @@ let httpApiSix
let wsApi
// 在打包之前请检查当前环境是否正确
// const env = 'dev'; // 开发
const env = 'prod'; // 生产
const env = 'dev'; // 开发
// const env = 'prod'; // 生产
// const env = 'prew'; // 预上线
switch (env) {

View File

@ -47,8 +47,8 @@ export function toLogin(push, pathLogin) {
}
// #endif
if (!pathLogin)
pathLogin = '/page/users/login/login_copy'
Cache.set('login_back_url', path);
pathLogin = '/page/users/login/login_copy';
Cache.set('login_back_url', path);
// #ifdef H5
if (isWeixin()) {
auth.oAuth();

View File

@ -1,12 +1,11 @@
<template>
<view>
<view class="container" v-if="merchantInfo && !isEmpty">
<view class="v-navbar">
<u-navbar title="面对面收款" :safeAreaInsetTop="false" :fixed="false" :autoBack="true" bgColor="transparent"
leftIconColor="#fff" :titleStyle="{color:'#fff',fontWeight:'bold',fontSize:'32rpx'}">
</u-navbar>
</view>
<view class="container">
<view class="v-navbar">
<u-navbar title="面对面收款" :safeAreaInsetTop="false" :fixed="false" @leftClick="leftClick" bgColor="transparent"
leftIconColor="#fff" :titleStyle="{color:'#fff',fontWeight:'bold',fontSize:'32rpx'}">
</u-navbar>
</view>
<view v-if="merchantInfo && !isEmpty">
<view class="v-desc">
<view>
<view class="v-desc-main">付款给商家</view>
@ -50,9 +49,9 @@
<!-- 无商户信息提示 -->
<view v-else class="empty">
<image src="/static/images/no_thing.png"></image>
<text>暂未登陆~</text>
<text style="margin-top: 60rpx;">{{tips}}</text>
<!-- 登陆 -->
<authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun">
<authorize :isAuto="isAuto" :isGoIndex="false" :isShowAuth="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun">
</authorize>
</view>
</view>
@ -64,6 +63,7 @@
addCart,
orderCheck
} from "@/api/payment.js";
import Cache from '@/utils/cache';
import {
mapGetters
} from "vuex";
@ -100,27 +100,35 @@
},
isAuto: false, //
isShowAuth: false, //
mer_id: ''
mer_id: '',
tips: '暂未登陆~'
}
},
onLoad(opt) {
this.mer_id = opt.mer_id;
if (!this.isLogin) {
this.isAuto = true;
this.isShowAuth = true
} else {
this.getProductInfoByMerid(opt.mer_id);
}
},
onShow() {
if (!this.isLogin) {
Cache.set("login_back_url_weixin", getCurrentPages()[0].route + "?mer_id=" + this.mer_id);
this.isAuto = true;
this.isShowAuth = true;
} else {
this.getProductInfoByMerid(this.mer_id);
}
},
methods: {
leftClick(e){
uni.switchTab({
url: '/pages/index/index'
})
},
//
authColse: function(e) {
this.isShowAuth = e;
},
onLoadFun() {
this.$Cache.set("login_back_url", getCurrentPages()[0].route + "?mer_id=" + this.mer_id);
this.getProductInfoByMerid(this.mer_id);
this.isShowAuth = false;
},
@ -151,9 +159,9 @@
})
});
});
}).catch(() => {
}).catch((err) => {
this.$util.Tips({
title: "操作失败!"
title: err.message || err.msg || err
})
})
},
@ -165,10 +173,16 @@
}).then(res => {
this.merchantInfo = res.data;
}).catch((err) => {
this.tips = err.message || err.smg || err;
this.$util.Tips({
title: err.message || err.msg || err
})
// #ifdef APP
uni.navigateBack({
delta: 1
})
setTimeout(()=>{
uni.navigateBack({
delta: 1
})
}, 1500)
// #endif
// #ifndef APP

View File

@ -254,6 +254,7 @@
mapGetters
} from "vuex";
import Verify from '@/components/verify/verify.vue';
import { Toast } from "../../../libs/uniApi";
const BACK_URL = "login_back_url";
// #ifdef APP-PLUS
var jpushModule = uni.requireNativePlugin("JG-JPush");
@ -726,17 +727,26 @@
// #endif
})
.then(res => {
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
that.$store.commit("LOGIN", {
'token': res.data.token,
'time': res.data.exp
});
that.$store.commit("SETUID", res.data.user.uid);
that.$store.commit('UPDATE_USERINFO', res.data.user);
uni.switchTab({
url: '/pages/user/index'
})
const backUrl = that.$Cache.get('login_back_url_weixin') || that.$Cache.get(BACK_URL) || "/pages/index/index";
let method
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart',
'/pages/goods_cate/goods_cate',
'/pages/user/index'
]
if (indexPat.includes(this.getPath(backUrl))) {
method = 'switchTab'
} else {
method = 'navigateTo'
}
uni[method]({
url: backUrl
});
})
.catch(res => {
that.$util.Tips({