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 let wsApi
// 在打包之前请检查当前环境是否正确 // 在打包之前请检查当前环境是否正确
// const env = 'dev'; // 开发 const env = 'dev'; // 开发
const env = 'prod'; // 生产 // const env = 'prod'; // 生产
// const env = 'prew'; // 预上线 // const env = 'prew'; // 预上线
switch (env) { switch (env) {

View File

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

View File

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

View File

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