2 Commits
wwz_wx ... gyq

Author SHA1 Message Date
gyq
c98eb7406a 优化退出登录 2025-07-23 09:19:53 +08:00
gyq
4dad65e0e0 优化退出登录 2025-06-16 17:50:50 +08:00
4 changed files with 641 additions and 642 deletions

View File

@@ -7,9 +7,8 @@
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: async (data) => { success: async (data) => {
uni.cache.set('weixincode', data.code);
let res = await Api.getminiuserinfo({ let res = await Api.getminiuserinfo({
code: uni.cache.get('weixincode') //临时登录凭证 code: data.code
}) })
uni.cache.set('open_id', res.data.openid) uni.cache.set('open_id', res.data.openid)
this.$isResolve() this.$isResolve()

View File

@@ -5,9 +5,9 @@ const proxyApi = "/api/"
// #ifdef H5 // #ifdef H5
// const baseUrl = debug ? proxyApi : "https://invoice.sxczgkj.cn/api" // const baseUrl = debug ? proxyApi : "https://invoice.sxczgkj.cn/api"
// const baseUrl = 'https://invoice.sxczgkj.cn/api/' //正式 const baseUrl = 'https://invoice.sxczgkj.cn/api/' //正式
// const baseUrl = 'http://192.168.1.6:8888/api/'//本地 // const baseUrl = 'http://192.168.1.6:8888/api/'//本地
const baseUrl = 'https://test.invoice.sxczgkj.cn/api/'//测试 // const baseUrl = 'https://test.invoice.sxczgkj.cn/api/'//测试
// import VConsole from "./vConsole.js" // import VConsole from "./vConsole.js"
if (debug) { if (debug) {
// new VConsole() // new VConsole()

View File

@@ -1,43 +1,30 @@
<template> <template>
<view class="content"> <view class="content">
<!-- 占位符导航栏 --> <!-- 占位符导航栏 -->
<navseat :opacity='false' :title='"首页"' :titleshow='true' :iconshow='false' :heightshow='true' <navseat :opacity="false" :title="'首页'" :titleshow="true" :iconshow="false" :heightshow="true" :namecolor="'#fff'" iconcolor="#fff"></navseat>
:namecolor='"#fff"' iconcolor='#fff'></navseat>
<view class="topswiper" v-if="restype == 2"> <view class="topswiper" v-if="restype == 2">
<u-swiper :list="swiperlist" height="166"></u-swiper> <u-swiper :list="swiperlist" height="166"></u-swiper>
<view class="onetopswiper"> <view class="onetopswiper">发票服务</view>
发票服务
</view>
<view class="towtopswiper flex-between" @click="wodekaifapiao"> <view class="towtopswiper flex-between" @click="wodekaifapiao">
<view class="flex-colum-start" style="color: #2b378a;"> <view class="flex-colum-start" style="color: #2b378a">我的发票</view>
我的发票 <view class="towtopswipertow"></view>
</view> </view>
<view class="towtopswipertow"> <view style="margin-top: 80rpx; text-align: center; color: #3088fd; position: fixed; bottom: 40rpx; left: 50%; transform: translate(-50%, -50%)" @click="qushangjia()">
</view>
</view>
<view
style="margin-top:80rpx;text-align: center;color:#3088fd;position: fixed; bottom:40rpx;left: 50%;transform: translate(-50%,-50%);"
@click="qushangjia()">
我是商家 我是商家
</view> </view>
</view> </view>
<view class="Box flex-between" v-if="restype == 1 && improveinformation"> <view class="Box flex-between" v-if="restype == 1 && improveinformation">
<view class="content flex-colum" @click="merchantindex" v-if="store_status == 2"> <view class="content flex-colum" @click="merchantindex" v-if="store_status == 2">
<image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item3.png" mode="aspectFill"> <image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item3.png" mode="aspectFill"></image>
</image>
<text>固定开票</text> <text>固定开票</text>
</view> </view>
<view class="content flex-colum" @click="indexInvoicing" v-if="store_status == 1"> <view class="content flex-colum" @click="indexInvoicing" v-if="store_status == 1">
<image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item3.png" mode="aspectFill"> <image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item3.png" mode="aspectFill"></image>
</image>
<text>极速开票</text> <text>极速开票</text>
</view> </view>
<view class="content flex-colum" v-for="(item,index) in list" @click="clickcontent(item)" :key="index" <view class="content flex-colum" v-for="(item, index) in list" @click="clickcontent(item)" :key="index" v-if="item.show">
v-if="item.show"> <image :src="item.imge" mode="aspectFill"></image>
<image :src="item.imge" mode="aspectFill">
</image>
<text>{{ item.name }}</text> <text>{{ item.name }}</text>
</view> </view>
<!-- <view class="content flex-colum" @click="jumpToMiniProgram" v-if="improveinformation"> <!-- <view class="content flex-colum" @click="jumpToMiniProgram" v-if="improveinformation">
@@ -53,13 +40,24 @@
<button class="btn">打开小程序</button> <button class="btn">打开小程序</button>
</script> </script>
</wx-open-launch-weapp> --> </wx-open-launch-weapp> -->
<view class="flex-colum" <view
style=" width: 100%;margin-top:80rpx;text-align: center;position: fixed; font-size:24rpx; bottom:40rpx;left: 50%;transform: translate(-50%,-50%);padding: 0 40rpx;"> class="flex-colum"
style="
width: 100%;
margin-top: 80rpx;
text-align: center;
position: fixed;
font-size: 24rpx;
bottom: 40rpx;
left: 50%;
transform: translate(-50%, -50%);
padding: 0 40rpx;
"
>
<text>{{ improveinformationform.store.title }}</text> <text>{{ improveinformationform.store.title }}</text>
<text v-if="improveinformationform.is_tax == 1" <text v-if="improveinformationform.is_tax == 1" style="margin-top: 20rpx; text-align: center; color: #3088fd; margin-left: 10rpx" @click="clickswitch()">
style="margin-top:20rpx;text-align: center;color:#3088fd;margin-left: 10rpx;" 切换商户
@click="clickswitch()">切换商户</text> </text>
</view> </view>
</view> </view>
<!-- <view class="setClipboardDataclass" @click="setClipboardData" v-if="infos.deviceType != 'pc'"> <!-- <view class="setClipboardDataclass" @click="setClipboardData" v-if="infos.deviceType != 'pc'">
@@ -69,12 +67,11 @@
src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182"> src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182">
</pdf> --> </pdf> -->
<!-- <iframe width="100%" height="100%" src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182" frameborder="0"></iframe> --> <!-- <iframe width="100%" height="100%" src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182" frameborder="0"></iframe> -->
</view> </view>
</template> </template>
<script> <script>
import wx from 'weixin-js-sdk'; import wx from 'weixin-js-sdk';
import navseat from '@/components/navseat.vue' import navseat from '@/components/navseat.vue';
export default { export default {
components: { components: {
navseat navseat
@@ -82,9 +79,7 @@
data() { data() {
return { return {
restype: 1, restype: 1,
swiperlist: [ swiperlist: ['https://shuzu-download.oss-cn-shanghai.aliyuncs.com/advertise/2024-05-08-10-52-th-663ae8fc73220.png'],
'https://shuzu-download.oss-cn-shanghai.aliyuncs.com/advertise/2024-05-08-10-52-th-663ae8fc73220.png'
],
improveinformation: false, improveinformation: false,
improveinformationlist: {}, improveinformationlist: {},
onLoaduserId: '', onLoaduserId: '',
@@ -118,7 +113,7 @@
// // #endif // // #endif
try { try {
if (e.restype) { if (e.restype) {
this.restype = e.restype this.restype = e.restype;
} }
} catch (e) { } catch (e) {
//TODO handle the exception //TODO handle the exception
@@ -138,33 +133,34 @@
// 总? // 总?
let token = await this.api.h5encryption({ let token = await this.api.h5encryption({
store_id: uni.cache.get('userId') store_id: uni.cache.get('userId')
}) });
if (token.code == 1) { if (token.code == 1) {
uni.cache.set('token', token.data.token); uni.cache.set('token', token.data.token);
} }
let res = await this.api.storestorestatus({ let res = await this.api.storestorestatus({
store_id: uni.cache.get('userId') store_id: uni.cache.get('userId')
}) });
// try { // try {
// this.is_k_list = res.data.is_k_list // this.is_k_list = res.data.is_k_list
// } catch (e) { // } catch (e) {
// //TODO handle the exception // //TODO handle the exception
// } // }
if (res.code == 1 && uni.cache.get('store_status') == 1) { if (res.code == 1 && uni.cache.get('store_status') == 1) {
this.improveinformationform = res.data this.improveinformationform = res.data;
uni.cache.set('form', this.improveinformationform); uni.cache.set('form', this.improveinformationform);
if (res.data.sz_status == 0) { if (res.data.sz_status == 0) {
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/information' url: '/pages/index/information'
}); });
} else { } else {
this.improveinformation = true this.improveinformation = true;
} }
} else { } else {
// 这是固定开票的判断 // 这是固定开票的判断
if (res.data.status == 4) { //如果极速开票和固定开票共存的情况下 直接跳转到极速开票的上传信息 if (res.data.status == 4) {
this.improveinformation = true //如果极速开票和固定开票共存的情况下 直接跳转到极速开票的上传信息
return false this.improveinformation = true;
return false;
} else { } else {
if (res.data.status == -1 || res.data.status == 2 || res.data.status == 0) { if (res.data.status == -1 || res.data.status == 2 || res.data.status == 0) {
uni.pro.navigateTo('merchant/information', res.data.store); uni.pro.navigateTo('merchant/information', res.data.store);
@@ -179,10 +175,8 @@
}); });
} }
} else { } else {
this.restype == 2 this.restype == 2;
} }
}, },
// 监听跳转 // 监听跳转
handleLaunch() { handleLaunch() {
@@ -194,8 +188,8 @@
}, },
async onShow() { async onShow() {
try { try {
let res = await this.api.getrulelist() let res = await this.api.getrulelist();
this.list = res.data this.list = res.data;
} catch (e) { } catch (e) {
//TODO handle the exception //TODO handle the exception
} }
@@ -204,8 +198,8 @@
async jumpToMiniProgram() { async jumpToMiniProgram() {
let res = await this.api.userttwechat({ let res = await this.api.userttwechat({
url: location.href.split('#')[0] url: location.href.split('#')[0]
}) });
console.log(res) console.log(res);
// plus.share.getServices(function (res) { // plus.share.getServices(function (res) {
// var sweixin = null; // var sweixin = null;
// for (var i = 0; i < res.length; i++) { // for (var i = 0; i < res.length; i++) {
@@ -236,21 +230,21 @@
wx.config(res.data.wechat_mini); wx.config(res.data.wechat_mini);
// res.data.wechat_mini // res.data.wechat_mini
// 在wx.ready内调用 // 在wx.ready内调用
wx.ready(res => { wx.ready((res) => {
console.log(res); console.log(res);
this.$nextTick(() => { this.$nextTick(() => {
let btn = document.getElementById('launch-btn'); let btn = document.getElementById('launch-btn');
btn.addEventListener('launch', e => { btn.addEventListener('launch', (e) => {
console.log('success'); console.log('success');
}); });
btn.addEventListener('error', e => { btn.addEventListener('error', (e) => {
alert('小程序打开失败'); alert('小程序打开失败');
console.log('fail', e.detail); console.log('fail', e.detail);
}); });
}); });
}); });
wx.error(function (res) { wx.error(function (res) {
console.log('err', res) console.log('err', res);
}); });
// // #ifdef H5 // // #ifdef H5
// // 在H5环境中调用此函数来跳转到小程序 // // 在H5环境中调用此函数来跳转到小程序
@@ -276,18 +270,18 @@
content: '确定退出开票系统吗?', content: '确定退出开票系统吗?',
success: async (res) => { success: async (res) => {
if (res.confirm) { if (res.confirm) {
await this.api.userlogout() await this.api.userlogout();
uni.removeStorageSync('logintoken'); uni.clearStorageSync();
uni.removeStorageSync('token'); // uni.removeStorageSync('logintoken');
// uni.removeStorageSync('token');
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}) });
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
} }
} }
}) });
}, },
setClipboardData() { setClipboardData() {
uni.setClipboardData({ uni.setClipboardData({
@@ -298,7 +292,7 @@
clickswitch() { clickswitch() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/switch' url: '/pages/login/switch'
}) });
}, },
// 跳转 // 跳转
async clickcontent(item) { async clickcontent(item) {
@@ -309,7 +303,7 @@
case 2: case 2:
uni.navigateTo({ uni.navigateTo({
url: '/pages/webview/webview?tape=' + 1 url: '/pages/webview/webview?tape=' + 1
}) });
break; break;
case 3: case 3:
uni.showModal({ uni.showModal({
@@ -317,17 +311,18 @@
content: '确定退出开票系统吗?', content: '确定退出开票系统吗?',
success: async (res) => { success: async (res) => {
if (res.confirm) { if (res.confirm) {
await this.api.userlogout() await this.api.userlogout();
uni.removeStorageSync('logintoken'); uni.clearStorageSync();
uni.removeStorageSync('token'); // uni.removeStorageSync('logintoken');
// uni.removeStorageSync('token');
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}) });
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
} }
} }
}) });
break; break;
} }
}, },
@@ -341,12 +336,12 @@
uni.removeStorageSync('token'); uni.removeStorageSync('token');
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}) });
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
} }
} }
}) });
}, },
auditbilling() { auditbilling() {
uni.pro.navigateTo('index/auditbilling'); uni.pro.navigateTo('index/auditbilling');
@@ -379,7 +374,7 @@
// uni.pro.navigateTo('electric/index'); // uni.pro.navigateTo('electric/index');
let res = await this.api.szzpyhurl({ let res = await this.api.szzpyhurl({
store_id: uni.getStorageSync('userId') store_id: uni.getStorageSync('userId')
}) });
if (res) { if (res) {
uni.pro.navigateTo('webview/webview', { uni.pro.navigateTo('webview/webview', {
url: res.data.url, url: res.data.url,
@@ -396,7 +391,7 @@
<style lang="scss"> <style lang="scss">
page { page {
background: #F9F9F9; background: #f9f9f9;
} }
.content { .content {
@@ -440,14 +435,13 @@
} }
.Box { .Box {
padding: 0rpx 28rpx; padding: 0rpx 28rpx;
.content { .content {
margin-top: 32rpx; margin-top: 32rpx;
width: 30%; width: 30%;
height: 218rpx; height: 218rpx;
background: #FFFFFF; background: #ffffff;
image { image {
width: 60rpx; width: 60rpx;
@@ -462,7 +456,6 @@
color: #333333; color: #333333;
} }
} }
} }
.Box::after { .Box::after {

View File

@@ -1,18 +1,14 @@
<template> <template>
<view class="content"> <view class="content">
<view class="contentnav"> <view class="contentnav">欢迎您登录开票系统</view>
欢迎您登录开票系统
</view>
<view class="top_box"> <view class="top_box">
<view class="top_box_one"> <view class="top_box_one">
<text class="top_box_one_text">手机号码</text> <text class="top_box_one_text">手机号码</text>
<input type="number" v-model="form.account" :adjust-position="false" placeholder="请输入手机号码" maxlength="-1" <input type="number" v-model="form.account" :adjust-position="false" placeholder="请输入手机号码" maxlength="-1" data-key="mobile" />
data-key="mobile" />
</view> </view>
<view class="top_box_one"> <view class="top_box_one">
<text class="top_box_one_text">密码</text> <text class="top_box_one_text">密码</text>
<input type="mobile" v-model="form.password" :adjust-position="false" placeholder="请输入密码" <input type="mobile" v-model="form.password" :adjust-position="false" placeholder="请输入密码" maxlength="16" :password="!showPassword" />
maxlength="16" :password="!showPassword" />
<view class="repeat" @click="display"> <view class="repeat" @click="display">
<u-icon name="eye" v-if="showPassword"></u-icon> <u-icon name="eye" v-if="showPassword"></u-icon>
<u-icon v-else name="eye-off"></u-icon> <u-icon v-else name="eye-off"></u-icon>
@@ -40,19 +36,16 @@
<view class="agreement-Item" @click="Privacy(2)">隐私政策</view> <view class="agreement-Item" @click="Privacy(2)">隐私政策</view>
</view>--> </view>-->
<view class="agreement" @click="clickpassword"> <view class="agreement" @click="clickpassword">忘记密码</view>
忘记密码
</view> </view>
</view> <view style="margin-top: 80rpx; text-align: center; color: #3088fd; position: fixed; bottom: 40rpx; left: 50%; transform: translate(-50%, -50%)" @click="quyonghu">
<view
style="margin-top:80rpx;text-align: center;color:#3088fd;position: fixed; bottom:40rpx;left: 50%;transform: translate(-50%,-50%);"
@click="quyonghu">
我是用户 我是用户
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import Api from '@/common/js/api.js';
export default { export default {
data() { data() {
return { return {
@@ -65,30 +58,44 @@
// 注册定时器 初始值 // 注册定时器 初始值
second: 60, second: 60,
showText: true, showText: true,
Recapture: '发送验证码', Recapture: '发送验证码'
} };
}, },
async onLoad(e) { async onLoad(e) {
uni.login({
provider: 'weixin',
success: async (data) => {
let openid = uni.cache.get('open_id');
if (!openid) {
let res = await Api.getminiuserinfo({
code: data.code
});
uni.cache.set('open_id', res.data.openid);
}
await this.$onLaunched; await this.$onLaunched;
if (e.userId) { if (e.userId) {
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
}) });
// this.onLoaduserId = e.userId // this.onLoaduserId = e.userId
uni.cache.set('Type', e.type); uni.cache.set('Type', e.type);
uni.cache.set('userId', e.userId); uni.cache.set('userId', e.userId);
let token = await this.api.h5encryption({ let token = await this.api.h5encryption({
store_id: uni.cache.get('userId') store_id: uni.cache.get('userId')
}) });
if (token.code == 1) { if (token.code == 1) {
uni.cache.set('token', token.data.token); uni.cache.set('token', token.data.token);
uni.cache.set('store_status', 1); uni.cache.set('store_status', 1);
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/index?restype=' + 1 url: '/pages/index/index?restype=' + 1
}) });
} }
} }
}
});
}, },
methods: { methods: {
async CodeRegister() { async CodeRegister() {
@@ -100,7 +107,8 @@
}); });
return false; return false;
} }
const res = await this.api.smssend({ // post 手机验证码 const res = await this.api.smssend({
// post 手机验证码
mobile: this.form.account, mobile: this.form.account,
event: 'mobilelogin' event: 'mobilelogin'
}); });
@@ -138,7 +146,7 @@
clickpassword() { clickpassword() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/password' url: '/pages/login/password'
}) });
}, },
async userlogin() { async userlogin() {
if (this.form.account == null || this.form.account == '') { if (this.form.account == null || this.form.account == '') {
@@ -165,8 +173,8 @@
let res = await this.api.userlogin({ let res = await this.api.userlogin({
account: this.form.account, account: this.form.account,
password: this.form.password, password: this.form.password,
open_id: uni.cache.get('open_id'), open_id: uni.cache.get('open_id')
}) });
uni.cache.set('userId', res.data.userinfo.store_id); uni.cache.set('userId', res.data.userinfo.store_id);
uni.cache.set('logintoken', res.data.userinfo.token); uni.cache.set('logintoken', res.data.userinfo.token);
uni.cache.set('store_status', res.data.store_status); uni.cache.set('store_status', res.data.store_status);
@@ -176,16 +184,15 @@
if (res.data.set_pwd == 1) { if (res.data.set_pwd == 1) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/repairpassword' url: '/pages/login/repairpassword'
}) });
} else { } else {
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/index?restype=' + 1 url: '/pages/index/index?restype=' + 1
}); });
} }
}
} }
} }
};
</script> </script>
<style lang="scss"> <style lang="scss">