diff --git a/index.html b/index.html index 8aedca8..ea33583 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + 泰古润 diff --git a/src/api/http.js b/src/api/http.js index 0afda7c..b8e4749 100644 --- a/src/api/http.js +++ b/src/api/http.js @@ -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}`; } diff --git a/src/api/user.js b/src/api/user.js index 583a058..30fc3ca 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -1,5 +1,5 @@ export function isLogin() { - return !!localStorage.getItem('token'); + return !!localStorage.getItem('member_token'); } export function formatGMT(t, format) { diff --git a/src/main.js b/src/main.js index aacbb50..50a8fc3 100644 --- a/src/main.js +++ b/src/main.js @@ -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 => { diff --git a/src/router.js b/src/router.js index e989e55..47dde38 100644 --- a/src/router.js +++ b/src/router.js @@ -300,6 +300,11 @@ const routes = [ }) } }, + { + path: '/SyncAuth', + name: 'SyncAuth', + component: () => import('./views/SyncAuth.vue'), + }, { path: '/404', name: '404', diff --git a/src/stores/user.js b/src/stores/user.js index 47b9c69..e69c6f9 100644 --- a/src/stores/user.js +++ b/src/stores/user.js @@ -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)); diff --git a/src/styles/ch.less b/src/styles/ch.less index 68a42d7..c83ae19 100644 --- a/src/styles/ch.less +++ b/src/styles/ch.less @@ -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 { diff --git a/src/styles/public.less b/src/styles/public.less index 4c54cdf..620785c 100644 --- a/src/styles/public.less +++ b/src/styles/public.less @@ -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; diff --git a/src/views/Account/Login.vue b/src/views/Account/Login.vue index b86db5d..d72737c 100644 --- a/src/views/Account/Login.vue +++ b/src/views/Account/Login.vue @@ -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?.('请输入手机号') diff --git a/src/views/Cashout/CashoutAccount.vue b/src/views/Cashout/CashoutAccount.vue index bcae1b0..15f9719 100644 --- a/src/views/Cashout/CashoutAccount.vue +++ b/src/views/Cashout/CashoutAccount.vue @@ -11,7 +11,8 @@
- {{ i.bankspname === '支付宝' ? '支付宝账号' : i.bankspname }}({{ i.bankcardnumber }}) + {{ i.bankspname === '支付宝' ? '支付宝账号' : i.bankspname }}({{ i.bankid === 91 ? i.bankcellphone + : i.bankcardnumber }})

2小时内到账 diff --git a/src/views/Merchant/MerchantIncome.vue b/src/views/Merchant/MerchantIncome.vue index efd52e8..cd02f7f 100644 --- a/src/views/Merchant/MerchantIncome.vue +++ b/src/views/Merchant/MerchantIncome.vue @@ -63,12 +63,12 @@

{{ item.typename }} -

剩余:{{ item.balance }}

+

剩余:{{ item.balance?.toFixed(2) }}

{{ item.nums > 0 ? '+' : '' }} {{ item.nums?.toFixed(2) }}
- 操作时间:{{ item.addtime }} + 操作时间:{{ $formatGMT(item.addtime, 'yyyy-MM-dd HH:mm:ss') }}
订单编号:{{ item.ordernum }} diff --git a/src/views/Merchant/MerchantIntroduction.vue b/src/views/Merchant/MerchantIntroduction.vue index 3eaa9c1..dbd8d5d 100644 --- a/src/views/Merchant/MerchantIntroduction.vue +++ b/src/views/Merchant/MerchantIntroduction.vue @@ -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) diff --git a/src/views/Merchant/MerchantTrade.vue b/src/views/Merchant/MerchantTrade.vue index 78334b1..2750dd3 100644 --- a/src/views/Merchant/MerchantTrade.vue +++ b/src/views/Merchant/MerchantTrade.vue @@ -134,7 +134,8 @@ - + @@ -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; diff --git a/src/views/Platform/Business_School.vue b/src/views/Platform/Business_School.vue index 7fda618..9500938 100644 --- a/src/views/Platform/Business_School.vue +++ b/src/views/Platform/Business_School.vue @@ -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); }) } diff --git a/src/views/Platform/Column.vue b/src/views/Platform/Column.vue index 22288ee..e2782d7 100644 --- a/src/views/Platform/Column.vue +++ b/src/views/Platform/Column.vue @@ -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; }) }, diff --git a/src/views/Platform/School_Detail.vue b/src/views/Platform/School_Detail.vue index ce37509..bfd424e 100644 --- a/src/views/Platform/School_Detail.vue +++ b/src/views/Platform/School_Detail.vue @@ -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() { diff --git a/src/views/SyncAuth.vue b/src/views/SyncAuth.vue new file mode 100644 index 0000000..ec72f4a --- /dev/null +++ b/src/views/SyncAuth.vue @@ -0,0 +1,28 @@ + + + \ No newline at end of file diff --git a/src/views/Tabbars/Gift.vue b/src/views/Tabbars/Gift.vue index 465956d..9b91a7d 100644 --- a/src/views/Tabbars/Gift.vue +++ b/src/views/Tabbars/Gift.vue @@ -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(''); diff --git a/src/views/Tabbars/Home.vue b/src/views/Tabbars/Home.vue index 4ce6ac2..f4978b4 100644 --- a/src/views/Tabbars/Home.vue +++ b/src/views/Tabbars/Home.vue @@ -76,7 +76,7 @@
- +
@@ -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; diff --git a/src/views/Tabbars/Mall.vue b/src/views/Tabbars/Mall.vue index d838ee6..6e7adbc 100644 --- a/src/views/Tabbars/Mall.vue +++ b/src/views/Tabbars/Mall.vue @@ -1,14 +1,14 @@ - + @@ -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 || '支付失败'); } }, diff --git a/src/views/Trade/TradeDetail.vue b/src/views/Trade/TradeDetail.vue index 8d95562..9410c71 100644 --- a/src/views/Trade/TradeDetail.vue +++ b/src/views/Trade/TradeDetail.vue @@ -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) { diff --git a/src/views/User/Checkout/Checkout.vue b/src/views/User/Checkout/Checkout.vue index f8b6979..bb5a769 100644 --- a/src/views/User/Checkout/Checkout.vue +++ b/src/views/User/Checkout/Checkout.vue @@ -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; }) diff --git a/src/views/User/My.vue b/src/views/User/My.vue index 655abc3..de9ae73 100644 --- a/src/views/User/My.vue +++ b/src/views/User/My.vue @@ -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: "确认退出?", diff --git a/src/views/User/Wallet/Balance.vue b/src/views/User/Wallet/Balance.vue index 42e4f54..77b9ca6 100644 --- a/src/views/User/Wallet/Balance.vue +++ b/src/views/User/Wallet/Balance.vue @@ -218,12 +218,12 @@
- + - - - - + + + + @@ -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; diff --git a/src/views/User/Wallet/CV.vue b/src/views/User/Wallet/CV.vue index e5c0468..74e8590 100644 --- a/src/views/User/Wallet/CV.vue +++ b/src/views/User/Wallet/CV.vue @@ -66,7 +66,7 @@ 订单:{{ item.ordernum }} - 时间:{{ $formatGMT(item.addtime, 'yyyy-dd-MM HH:ss') }} + 时间:{{ $formatGMT(item.addtime, 'yyyy-dd-MM HH:mm:ss') }}