feat: 5.20 update

This commit is contained in:
chenhao 2026-05-20 14:41:50 +08:00
parent f52191e065
commit 5b37d7962d
26 changed files with 169 additions and 112 deletions

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/svg+xml" href="/img/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>泰古润</title>

View File

@ -20,7 +20,7 @@ function getHeaders(contentType = 'application/json') {
const headers = {
'Content-Type': contentType,
};
const token = localStorage.getItem('token');
const token = localStorage.getItem('member_token');
if (token) {
headers['Authorization'] = `Bearer ${token}`;
}
@ -64,7 +64,7 @@ function handleResponse(response) {
*/
function handleUnauthorized() {
// 清除登录状态
localStorage.removeItem('token');
localStorage.removeItem('member_token');
localStorage.removeItem('member_username');
// 跳转到登录页
@ -146,7 +146,7 @@ export const del = (url, data, timeout = DEFAULT_TIMEOUT) => request(url, data,
*/
export function postForm(url, formData, timeout = DEFAULT_TIMEOUT) {
const headers = {};
const token = localStorage.getItem('token');
const token = localStorage.getItem('member_token');
if (token) {
headers['Authorization'] = `Bearer ${token}`;
}
@ -171,7 +171,7 @@ export function upload(url, files, timeout = 30000) {
});
const headers = {};
const token = localStorage.getItem('token');
const token = localStorage.getItem('member_token');
if (token) {
headers['Authorization'] = `Bearer ${token}`;
}

View File

@ -1,5 +1,5 @@
export function isLogin() {
return !!localStorage.getItem('token');
return !!localStorage.getItem('member_token');
}
export function formatGMT(t, format) {

View File

@ -158,7 +158,7 @@ app.config.globalProperties.$valid = (field, msg) => {
return true;
};
app.config.globalProperties.$token = (e) => {
const token = localStorage.getItem(e).split('.');
const token = localStorage.getItem(e === 'token' ? 'member_token' : e).split('.');
return {
header: JSON.parse(atob(token[0])),
payload: JSON.parse(atob(token[1])),
@ -225,7 +225,7 @@ app.config.globalProperties.$uploadFiles = (files, uploadUrl) => {
fetch(`${import.meta.env.VITE_API_URL}${uploadUrl}`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${localStorage.getItem('token')}`,
'Authorization': `Bearer ${localStorage.getItem('member_token')}`,
},
body: fd,
}).then(rep => {

View File

@ -300,6 +300,11 @@ const routes = [
})
}
},
{
path: '/SyncAuth',
name: 'SyncAuth',
component: () => import('./views/SyncAuth.vue'),
},
{
path: '/404',
name: '404',

View File

@ -3,7 +3,7 @@ import { post } from '@/api/http';
export const useUserStore = defineStore('user', {
state: () => ({
token: localStorage.getItem('token') || '',
token: localStorage.getItem('member_token') || '',
// 用户基本信息
user: null,
cellphone: localStorage.getItem('cellphone') || '',
@ -54,9 +54,9 @@ export const useUserStore = defineStore('user', {
setToken(token) {
this.token = token;
if (token) {
localStorage.setItem('token', token);
localStorage.setItem('member_token', token);
} else {
localStorage.removeItem('token');
localStorage.removeItem('member_token');
}
},
/**
@ -85,7 +85,7 @@ export const useUserStore = defineStore('user', {
// 清除 localStorage
const keys = [
'token', 'cellphone', 'nickname', 'userimg',
'member_token', 'cellphone', 'nickname', 'userimg',
'isshop', 'iscenter', 'user_id', 'huiyuankaid', 'member_username'
];
keys.forEach(key => localStorage.removeItem(key));

View File

@ -3497,6 +3497,7 @@
background: transparent;
border-radius: 1.07vw;
border: solid 0.13vw #000000;
white-space: nowrap;
}
}
@ -5176,6 +5177,7 @@
height: 16vw;
border: solid 0.4vw #ffffff;
margin-right: 2.67vw;
border-radius: 50%;
}
.inf {

View File

@ -1951,7 +1951,8 @@ img {
.cashoutaccount {
.ca_content {
max-height: 124vw;
// max-height: 124vw;
min-height: 60vh;
overflow: auto;
.list {
@ -1988,9 +1989,12 @@ img {
.ca_bottom {
width: 92vw;
height: 60vw;
position: fixed;
margin-top: auto;
// height: 40vh;
height: max-content;
// position: fixed;
margin-top: 10vw;
margin-left: 4vw;
padding-bottom: 4vw;
left: 4vw;
bottom: 6vw;

View File

@ -164,8 +164,39 @@ export default {
location.replace('#/')
return
}
// this.checkWxLogin();
const code = JSON.stringify(this.$route.query.code);
if (code) {
alert(code)
this.$post('/v1/client/AuthClient/loginwxweb', { code }).then(res => {
this.$showSuccessToast('登录成功')
if (res.data?.openid) {
localStorage.setItem('openid', res.data.openid)
}
}).catch(err => {
alert(JSON.stringify(err))
this.$showFailToast(err.message || '微信登录失败')
})
}
this.$closeSkeleton?.()
},
checkWxLogin() {
if (!this.$isWechat()) return
if (this.$route.query.code) return
// console.log(window.location.href);
this.$get('/v1/client/AuthClient/loginwxweburl', {
returnUrl: `${encodeURIComponent(window.location.href)}`
}).then(res => {
alert(JSON.stringify(res))
if (res.data) {
window.location.href = res.data
}
}).catch(res => {
alert(res)
})
},
validatePhone(phone) {
if (!phone) {
this.$showFailToast?.('请输入手机号')

View File

@ -11,7 +11,8 @@
<img :src="i.bankspname === '支付宝' ? '/img/aliicon.png' : '/img/bankcardicon.png'" alt="">
<div>
<span>
{{ i.bankspname === '支付宝' ? '支付宝账号' : i.bankspname }}{{ i.bankcardnumber }}
{{ i.bankspname === '支付宝' ? '支付宝账号' : i.bankspname }}{{ i.bankid === 91 ? i.bankcellphone
: i.bankcardnumber }}
</span>
<p>
2小时内到账

View File

@ -63,12 +63,12 @@
<div class="item" v-for="item in records">
<div class="line1">
<span class="type">{{ item.typename }}</span>
<p>剩余{{ item.balance }}</p>
<p>剩余{{ item.balance?.toFixed(2) }}</p>
<span :class="item.nums > 0 ? 'income' : 'expend'">{{ item.nums > 0 ? '+' : '' }}
{{ item.nums?.toFixed(2) }}</span>
</div>
<div>
操作时间{{ item.addtime }}
操作时间{{ $formatGMT(item.addtime, 'yyyy-MM-dd HH:mm:ss') }}
</div>
<div>
订单编号{{ item.ordernum }}

View File

@ -171,7 +171,7 @@ export default {
fd.append('file', file)
return fetch(`${import.meta.env.VITE_API_URL}${url}`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
headers: { 'Authorization': `Bearer ${localStorage.getItem('member_token')}` },
body: fd,
}).then(res => res.json()).then(res => {
if (res.status !== 200) throw new Error(res.message)

View File

@ -134,7 +134,8 @@
</van-popup>
<!-- <van-popup v-model:show="showDateRange" position="bottom" :style="{ height: '75%' }"> -->
<van-calendar v-model:show="showDateRange" type="range" :min-date="new Date(2026, 0, 1)" @confirm="onDateRangeConfirm" />
<van-calendar v-model:show="showDateRange" type="range" :min-date="new Date(2026, 0, 1)"
@confirm="onDateRangeConfirm" />
<!-- <van-calendar type="range" v-model="selectedDateRange" :min-date="new Date(new Date().getFullYear() - 1, 0, 1)"
title="选择日期区间" show-title show-subtitle @confirm="onDateRangeConfirm" /> -->
@ -181,7 +182,7 @@ export default {
return res.data || []
},
onLoad(list) {
console.log('list loaded:', list);
// console.log('list loaded:', list);
},
onconfirm(value) {
this.date = this.currentDate;

View File

@ -99,7 +99,7 @@ export default {
getList() {
this.$get('/v1/client/CBusinessschoolcatesClient',).then(res => {
this.categories = res.data;
console.log(this.categories);
// console.log(this.categories);
})
}

View File

@ -31,7 +31,7 @@ export default {
emits: ['updateShare'],
mounted() {
this.$get('/v1/client/CNewsClient?pid=3').then(data => {
console.log(data);
// console.log(data);
this.articleList = data.data.items;
})
},

View File

@ -26,7 +26,7 @@ export default {
beforeCreate() {
this.$get(`/v1/client/CBusinessschoolsClient/${this.$route.query.id}`).then(res => {
this.article = res.data;
console.log(this.article);
// console.log(this.article);
})
},
mounted() {

28
src/views/SyncAuth.vue Normal file
View File

@ -0,0 +1,28 @@
<template>
</template>
<script>
export default {
mounted() {
if (this.token)
localStorage.setItem('member_token', this.token);
// if (this.miniopenid)
// localStorage.setItem('miniopenid', this.miniopenid);
if (this.target)
location.replace(`#/${this.target}`);
else
location.replace('#/');
},
data() {
return {
token: decodeURIComponent(this.$route.query.token || ''),
// miniopenid: decodeURIComponent(this.$route.query.miniopenid || ''),
target: decodeURIComponent(this.$route.query.target || ''),
}
},
methods: {
}
}
</script>

View File

@ -318,7 +318,7 @@ export default {
// },
onFinish(e) {
this.showRegion = false;
console.log(e);
// console.log(e);
this.address.ReceiveRegion = e.selectedOptions.map(x => x.id).join(';');
this.address.ReceiveRegionName = e.selectedOptions.map(x => x.text).join('');

View File

@ -76,7 +76,7 @@
</div>
<div class="video_box">
<video v-if="data.Video" :src="$file(data.Video.filecover)" controls></video>
<video v-if="data.video" :src="$file(data.video.contents)" :poster="data.video.filecover" controls></video>
<button @click="$navigate('/ColumnDetail?id=1')">了解我们</button>
</div>
@ -158,12 +158,12 @@ export default {
this.$get('/v1/client/CSlidesClient?pid=1').then(data => {
this.data.Carousel = data.data;
}),
this.$get('/v1/client/CDatadicsClient/code_sp').then(data => {
this.data.video = data.data;
})
]).catch(err => {
this.$showFailToast(err.message || '数据加载失败');
});
//
this.data.Video = this.$datadic.getContent('code_sp')
this.data.slideBg = this.$datadic.getContent('code_yqmbj')
},
create() {
// this.showcreate = true;

View File

@ -1,14 +1,14 @@
<template>
<div class="mall">
<div class="mall" :style="bgStyle" style="background-size: 100% 62.933vw;background-repeat: no-repeat;">
<div class="top">
<div class="search_box">
<img src="/img/search.png" alt="">
<input v-model="searchParams.Key" type="search" placeholder="水产海鲜限时折扣抢购中"
<input v-model="searchParams.Key" placeholder="请输入关键词搜索"
@search="$navigate('Category?Key=' + searchParams.Key)">
<button @click="$navigate('Category?Key=' + searchParams.Key)">搜索</button>
</div>
<div class="banner">
<van-swipe :autoplay="3000" indicator-color="white">
<van-swipe :autoplay="3000" indicator-color="white" @change="onSwipeChange">
<van-swipe-item v-for="item in data.Carousel">
<a @click="item.link ? $openUrl(item.link) : ''"><img :src="$file(item.img) || '/img/avatar.png'"
width="100%"></a>
@ -239,6 +239,7 @@ export default {
},
hotData: [],
typeData: [],
bgcolor: '',
}
},
methods: {
@ -249,6 +250,9 @@ export default {
}),
this.$get(`/v1/client/CSlidesClient?pid=2`).then(res => {
this.data.Carousel = res.data
if (res.data?.[0]?.bgcolor) {
this.bgcolor = res.data[0].bgcolor
}
}),
this.$get('/v1/client/EProsClient?recommend=true').then(res => {
this.hotData = res.data.items;
@ -270,6 +274,20 @@ export default {
changeTab(type) {
this.searchParams.pid = type;
this.$refs.BaseList.refresh()
},
onSwipeChange(index) {
const item = this.data.Carousel[index]
this.bgcolor = item?.bgcolor || ''
}
},
computed: {
bgStyle() {
if (this.bgcolor) {
return {
background: `linear-gradient(${this.bgcolor}, #f5f5f5)`
}
}
return {}
}
},
}

View File

@ -34,7 +34,7 @@
</van-cell>
<!-- 微信支付 -->
<van-cell title="微信支付" v-if="!hide" is-link @click="payMethod = ['wechat']">
<van-cell title="微信支付" is-link @click="payMethod = ['wechat']">
<template #icon>
<img class="pay-icon" src="/img/pay_weixin.png" />
</template>
@ -43,12 +43,12 @@
</template>
</van-cell>
<van-cell title="快捷支付HJ(更顺畅)" v-if="!hide" is-link @click="payMethod = ['wechat']">
<van-cell v-if="!hide" title="快捷支付HJ(更顺畅)" is-link @click="payMethod = ['bankcard']">
<template #icon>
<img class="pay-icon" src="/img/pay_bankcard.png" />
</template>
<template #right-icon>
<van-checkbox name="wechat" :class="{ selected: payMethod.includes('wechat') }" />
<van-checkbox name="bankcard" :class="{ selected: payMethod.includes('bankcard') }" />
</template>
</van-cell>
</van-checkbox-group>
@ -89,6 +89,7 @@ export default {
},
payMethod: ['balance'],
showPayResult: false,
paychannelList: [],
}
},
mounted() {
@ -99,6 +100,9 @@ export default {
return;
}
this.loadData();
this.$get('/v1/client/FOrdersClient/paychannel').then(res => {
this.paychannelList = res.data || [];
})
},
methods: {
back() {
@ -119,57 +123,34 @@ export default {
},
async doPay() {
const method = this.payMethod[0];
if (method === 'balance') {
this.balancePay();
} else if (method === 'alipay') {
this.alipayPay();
} else if (method === 'wechat') {
this.wechatPay();
}
},
//
async balancePay() {
// Paychannel
const channelMap = {
balance: 4,
alipay: 2,
wechat: 1,
bankcard: 3
};
const paychannel = channelMap[method];
const openid = localStorage.getItem('openid') || '';
try {
//
const res = await this.$get(`/v1/client/FOrdersClient/${this.ordernum}/payyue`);
if (res.data) {
const res = await this.$post(`/v1/client/FOrdersClient/${this.ordernum}/pay`, {
Paychannel: paychannel,
Openid: method === 'wechat' ? openid : ''
});
if (res.data && res.data.startsWith('http')) {
//
location.href = res.data;
}
this.showPayResult = true;
if (res.status === 200) {
this.$showSuccessToast('支付成功');
} else if (res.status === 200) {
//
this.$showSuccessToast(res.message || '支付成功');
setTimeout(() => {
this.onPayCompleted();
}, 1000);
}
} catch (err) {
this.$showFailToast(err.message || '支付失败');
}
},
//
async alipayPay() {
try {
const res = await this.$get(`/v1/client/FOrdersClient/${this.ordernum}/payali`);
if (res.data) {
location.href = res.data;
} else if (res.data.qrcode) {
//
this.$showSuccessToast('唤起支付宝中...');
}
this.showPayResult = true;
} catch (err) {
this.$showFailToast(err.message || '支付失败');
}
},
//
async wechatPay() {
try {
const res = await this.$get(`/v1/client/FOrdersClient/${this.ordernum}/paywechat`);
if (res.data.redirect) {
location.href = res.data.redirect;
}, 1500);
}
this.showPayResult = true;
} catch (err) {
this.showPayResult = false;
this.$showFailToast(err.message || '支付失败');
}
},

View File

@ -98,7 +98,7 @@ export default {
}
},
mounted() {
console.log(this.data.state);
// console.log(this.data.state);
this.ordernum = this.$route.query.ordernum;
if (this.ordernum) {

View File

@ -104,7 +104,7 @@ export default {
})
if (this.id)
this.$get(`/v1/client/DShopsClient/${this.id}`).then(res => {
console.log(res);
// console.log(res);
this.data.shop = res.data;
this.req.shopuserid = res.data.userid;
})

View File

@ -250,14 +250,6 @@ export default {
},
methods: {
init() {
const code = this.$route.query.code
if (code) {
this.$post('/v1/client/AuthClient/loginwxweb', { code }).then(res => {
this.$showSuccessToast('登录成功')
}).catch(err => {
this.$showFailToast(err.message || '微信登录失败')
})
}
Promise.all(
[
this.$get('/v1/client/DUsersClient').then(data => {
@ -276,7 +268,7 @@ export default {
}),
]
)
this.checkWxLogin()
},
onShowManagerPopup() {
this.managerPopupVisible = true
@ -284,19 +276,7 @@ export default {
onCloseManagerPopup() {
this.managerPopupVisible = false
},
checkWxLogin() {
if (!this.$isWechat()) return
if (this.$route.query.code) return
this.$get('/v1/client/AuthClient/loginwxweburl', {
returnUrl: `${encodeURIComponent(window.location.href)}`
}).then(res => {
if (res.data) {
window.location.href = res.data
}
}).catch(res => {
alert(res)
})
},
logout() {
this.$showConfirmDialog({
title: "确认退出?",

View File

@ -218,12 +218,12 @@
</div>
</div>
<van-tabs v-model:active="active" type="card" class="tabs" color="#374c6d">
<van-tabs v-model:active="active" type="card" class="tabs" color="#374c6d" @change="changeTabs">
<van-tab title="全部"></van-tab>
<van-tab title="礼包"></van-tab>
<van-tab title="商家"></van-tab>
<van-tab title="商城"></van-tab>
<van-tab title="分成"></van-tab>
<van-tab title="礼包" name="31"></van-tab>
<van-tab title="商家" name="34"></van-tab>
<van-tab title="商城" name="33"></van-tab>
<van-tab title="分成" name="32"></van-tab>
</van-tabs>
<BaseList ref="baselist" url="/v1/client/DUsermoneysClient" class="_m_" :params="searchParams">
@ -310,7 +310,7 @@ export default {
show: false,
showDate: false,
searchParams: {
// type: 'Balance',
type: '',
year: new Date().getFullYear(),
month: new Date().getMonth() + 1,
},
@ -326,6 +326,11 @@ export default {
}).catch(err => {
this.$showFailToast(err.message || '加载失败');
})
this.$get('/v1/client/DUsermoneysClient/select').then(res => {
// console.log(res.data);
})
},
onconfirm(value) {
this.date = this.currentDate;
@ -336,7 +341,8 @@ export default {
this.$refs.baselist.refresh()
},
changeTabs(e) {
this.show = false;
this.searchParams.type = e || '';
// this.$refs.baselist.refresh();
},
onShowTerm() {
this.showTerm = true;

View File

@ -66,7 +66,7 @@
订单{{ item.ordernum }}
</span>
<span>
时间{{ $formatGMT(item.addtime, 'yyyy-dd-MM HH:ss') }}
时间{{ $formatGMT(item.addtime, 'yyyy-dd-MM HH:mm:ss') }}
</span>
</div>
</template>