feat: 5.26 update
This commit is contained in:
parent
107ebd7a1d
commit
63a7f0ccf4
@ -36,7 +36,7 @@ const routes = [
|
|||||||
path: '/My',
|
path: '/My',
|
||||||
name: 'My',
|
name: 'My',
|
||||||
component: () => import('./views/User/My.vue'),
|
component: () => import('./views/User/My.vue'),
|
||||||
meta: { title: '我的', cache: true }
|
meta: { title: '我的' }
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
meta: { noLogin: true }
|
meta: { noLogin: true }
|
||||||
|
|||||||
@ -43,7 +43,8 @@ export async function toDataURL(selector, options = {}) {
|
|||||||
canvasHeight,
|
canvasHeight,
|
||||||
pixelRatio,
|
pixelRatio,
|
||||||
cors: useCORS,
|
cors: useCORS,
|
||||||
backgroundColor: '#ffffff'
|
backgroundColor: '#ffffff',
|
||||||
|
fetchLikeCORS: true
|
||||||
})
|
})
|
||||||
|
|
||||||
const mimeType = format === 'jpeg' ? 'image/jpeg' : 'image/png'
|
const mimeType = format === 'jpeg' ? 'image/jpeg' : 'image/png'
|
||||||
|
|||||||
@ -165,19 +165,19 @@ export default {
|
|||||||
const onBridgeReady = () => {
|
const onBridgeReady = () => {
|
||||||
WeixinJSBridge.invoke(
|
WeixinJSBridge.invoke(
|
||||||
'getBrandWCPayRequest', {
|
'getBrandWCPayRequest', {
|
||||||
appId: payData.appId,
|
appId: payData.appId,
|
||||||
timeStamp: payData.timeStamp,
|
timeStamp: payData.timeStamp,
|
||||||
nonceStr: payData.nonceStr,
|
nonceStr: payData.nonceStr,
|
||||||
package: payData.package,
|
package: payData.package,
|
||||||
signType: payData.signType,
|
signType: payData.signType,
|
||||||
paySign: payData.paySign
|
paySign: payData.paySign
|
||||||
},
|
},
|
||||||
(res) => {
|
(res) => {
|
||||||
if (res.err_msg === 'get_brand_wcpay_request:ok') {
|
if (res.err_msg === 'get_brand_wcpay_request:ok') {
|
||||||
this.$showSuccessToast('支付成功');
|
this.$showSuccessToast('支付成功');
|
||||||
this.onPayCompleted();
|
this.onPayCompleted();
|
||||||
} else {
|
} else {
|
||||||
this.showPayResult = true;
|
// this.showPayResult = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -132,7 +132,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
back() {
|
back() {
|
||||||
this.$router.back();
|
this.$navigate('/TradeList');
|
||||||
},
|
},
|
||||||
async loadData() {
|
async loadData() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
<button v-if="item.state === 0" @click="cancelTrade(item)">取消订单</button>
|
<button v-if="item.state === 0" @click="cancelTrade(item)">取消订单</button>
|
||||||
<button v-if="!item.shopname" @click="$navigate(`TradeDetail?ordernum=${item.ordernum}`)">查看详情</button>
|
<button v-if="!item.shopname" @click="$navigate(`TradeDetail?ordernum=${item.ordernum}`)">查看详情</button>
|
||||||
<button v-else @click="$navigate(`MerchantTradeDetail?id=${item.ordernum}`)">查看详情</button>
|
<button v-else @click="$navigate(`MerchantTradeDetail?id=${item.ordernum}`)">查看详情</button>
|
||||||
<!-- <button v-if="item.state === 3 || item.state === 4" @click="showLogistics(item)">物流信息</button> -->
|
<button v-if="item.state === 3 || item.state === 4" @click="showLogistics(item)">物流信息</button>
|
||||||
|
|
||||||
<button v-if="item.state === 3" @click="confirmReceipt(item)">确认收货</button>
|
<button v-if="item.state === 3" @click="confirmReceipt(item)">确认收货</button>
|
||||||
<button v-if="item.state === 0" @click="$navigate(`Pay?ordernum=${item.ordernum}`)">立即支付</button>
|
<button v-if="item.state === 0" @click="$navigate(`Pay?ordernum=${item.ordernum}`)">立即支付</button>
|
||||||
@ -61,6 +61,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</BaseList>
|
</BaseList>
|
||||||
|
|
||||||
|
|
||||||
|
<van-popup v-model:show="logisticsVisible" round position="bottom" teleport="body">
|
||||||
|
<div class="logistics-popup">
|
||||||
|
<div class="logistics-tit">物流信息</div>
|
||||||
|
<div class="logistics-content">
|
||||||
|
<div class="logistics-item">
|
||||||
|
<span class="label">物流公司</span>
|
||||||
|
<span class="value">{{ currentLogistics?.exportname }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="logistics-item">
|
||||||
|
<span class="label">物流单号</span>
|
||||||
|
<span class="value">{{ currentLogistics?.exportnum }}</span>
|
||||||
|
<img src="/img/copy_b.png" @click="$copyText(currentLogistics?.exportnum); $showSuccessToast('复制成功')" alt="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="logistics-close">
|
||||||
|
<van-button type="primary" block round color="#ca2904" @click="logisticsVisible = false">关闭</van-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</van-popup>
|
||||||
</div>
|
</div>
|
||||||
</BasePage>
|
</BasePage>
|
||||||
</template>
|
</template>
|
||||||
@ -111,6 +132,8 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
_initializing: true,
|
_initializing: true,
|
||||||
|
logisticsVisible: false,
|
||||||
|
currentLogistics: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -212,6 +235,12 @@ export default {
|
|||||||
.catch(err => this.$showFailToast(err.message || '取消失败'))
|
.catch(err => this.$showFailToast(err.message || '取消失败'))
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 显示物流信息
|
||||||
|
showLogistics(item) {
|
||||||
|
this.currentLogistics = item
|
||||||
|
this.logisticsVisible = true
|
||||||
|
},
|
||||||
|
|
||||||
back() {
|
back() {
|
||||||
this.$navigate('/My');
|
this.$navigate('/My');
|
||||||
},
|
},
|
||||||
@ -220,3 +249,53 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.logistics-popup {
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.logistics-tit {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logistics-content {
|
||||||
|
background: #f5f5f5;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 15px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logistics-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
width: 70px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
flex: 1;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.logistics-close {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<BasePage>
|
<BasePage>
|
||||||
<!-- v-if="data.Icon" -->
|
|
||||||
<div class="ewm_bg" style="font-family: 'PingFang SC'">
|
<div class="ewm_bg" style="font-family: 'PingFang SC'">
|
||||||
<div class="d1">
|
<div class="d1">
|
||||||
<div class="w100">
|
<div class="w100">
|
||||||
<img id="invite_bg" :src="bgSrc" crossorigin="anonymous" />
|
<img id="invite_bg" src="/img/invite_bg.jpg" crossorigin="anonymous">
|
||||||
<!-- <img id="invite_bg" src="/img/invite_bg.jpg" crossorigin="anonymous"> -->
|
|
||||||
</div>
|
</div>
|
||||||
<img class="icon" :src="$file(data.Avatar) + '?t=1'" crossorigin="anonymous">
|
<img class="icon" :src="$file(data.Avatar)" crossorigin="anonymous">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<b>{{ $substring(data.NickName, 0, 8) }}</b>
|
<b>{{ $substring(data.NickName, 0, 8) }}</b>
|
||||||
</div>
|
</div>
|
||||||
@ -15,18 +13,15 @@
|
|||||||
<div class="ewm_test box box-tb box-align-center">
|
<div class="ewm_test box box-tb box-align-center">
|
||||||
<vue-qr v-if="!loading" :text="link" backgroundColor="rgb(255,255,255)"
|
<vue-qr v-if="!loading" :text="link" backgroundColor="rgb(255,255,255)"
|
||||||
colorLight="rgb(255,255,255)"></vue-qr>
|
colorLight="rgb(255,255,255)"></vue-qr>
|
||||||
<!-- <span>扫码立即注册</span> -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="sc_ewm" class="b_l_w bx" style="font-family: 'PingFang SC'"></div>
|
<div id="sc_ewm" class="b_l_w bx" style="font-family: 'PingFang SC'"></div>
|
||||||
|
|
||||||
</BasePage>
|
</BasePage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { toDataURL } from '@/utils/html2image';
|
import html2canvas from 'html2canvas'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Invite',
|
name: 'Invite',
|
||||||
@ -34,106 +29,96 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
data: {
|
data: {
|
||||||
Icon: '',
|
|
||||||
Avatar: '',
|
Avatar: '',
|
||||||
NickName: '',
|
NickName: '',
|
||||||
},
|
},
|
||||||
link: '',
|
link: '',
|
||||||
userStore: null,
|
}
|
||||||
bgSrc: '',
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loading = false;
|
this.init()
|
||||||
this.preloadBackground().then(() => {
|
|
||||||
this.init().then(() => {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.CreatePoster(".ewm_bg > div", "#sc_ewm");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async preloadBackground() {
|
|
||||||
const bgUrl = this.$file(this.$datadic.getContent('code_yqmbj'));
|
|
||||||
const cacheKey = 'invite_bg_cache';
|
|
||||||
const cached = localStorage.getItem(cacheKey);
|
|
||||||
if (cached) {
|
|
||||||
this.bgSrc = cached;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const response = await fetch(bgUrl, { mode: 'cors' });
|
|
||||||
const blob = await response.blob();
|
|
||||||
const reader = new FileReader();
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
reader.onloadend = () => {
|
|
||||||
localStorage.setItem(cacheKey, reader.result);
|
|
||||||
this.bgSrc = reader.result;
|
|
||||||
resolve();
|
|
||||||
};
|
|
||||||
reader.readAsDataURL(blob);
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Background preload failed:', e);
|
|
||||||
this.bgSrc = bgUrl;
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async init() {
|
async init() {
|
||||||
try {
|
try {
|
||||||
// 获取用户信息
|
const userInfo = await this.$get('/v1/client/DUsersClient')
|
||||||
const userInfo = await this.$get('/v1/client/DUsersClient');
|
|
||||||
if (userInfo?.data) {
|
if (userInfo?.data) {
|
||||||
this.data.Avatar = userInfo.data.userimg || '';
|
this.data.Avatar = userInfo.data.userimg || ''
|
||||||
this.data.NickName = userInfo.data.nickname || '';
|
this.data.NickName = userInfo.data.nickname || ''
|
||||||
this.data.Icon = userInfo.data.Icon || '';
|
|
||||||
}
|
}
|
||||||
// 生成包含邀请码的链接
|
const inviteCode = userInfo?.data?.cellphone || ''
|
||||||
const inviteCode = userInfo?.data?.cellphone || '';
|
this.link = `${location.origin}${location.pathname}#/Login?invite=${inviteCode}`
|
||||||
this.link = `${location.origin}${location.pathname}#/Login?invite=${inviteCode}`;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('获取用户信息失败:', err);
|
console.error('获取用户信息失败:', err)
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.generatePoster()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async CreatePoster(divID, targetID) {
|
|
||||||
var shareContent = document.querySelector(divID);
|
async generatePoster() {
|
||||||
|
const el = document.querySelector('.ewm_bg > .d1')
|
||||||
|
const bgImg = document.querySelector('#invite_bg')
|
||||||
|
if (!el || !bgImg) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Wait for background and avatar images to load
|
// Convert local image to base64 for Safari compatibility
|
||||||
const promises = [];
|
if (bgImg.src.startsWith('/')) {
|
||||||
const bgImg = shareContent.querySelector('#invite_bg');
|
await this.loadImageToBase64(bgImg)
|
||||||
if (bgImg && !bgImg.complete) {
|
|
||||||
promises.push(new Promise(resolve => {
|
|
||||||
bgImg.onload = resolve;
|
|
||||||
bgImg.onerror = resolve;
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
const avatarImg = shareContent.querySelector('.icon');
|
|
||||||
if (avatarImg && !avatarImg.complete) {
|
|
||||||
promises.push(new Promise(resolve => {
|
|
||||||
avatarImg.onload = resolve;
|
|
||||||
avatarImg.onerror = resolve;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (promises.length > 0) {
|
|
||||||
await Promise.all(promises);
|
|
||||||
}
|
|
||||||
// Extra delay for Safari/WeChat compatibility
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 300));
|
|
||||||
|
|
||||||
var dataUrl = await toDataURL(shareContent, { format: 'png', pixelRatio: 2, useCORS: true });
|
if (document.fonts?.ready) {
|
||||||
var newImg = document.createElement("img");
|
await document.fonts.ready
|
||||||
newImg.src = dataUrl;
|
}
|
||||||
newImg.width = shareContent.offsetWidth;
|
await new Promise(resolve => setTimeout(resolve, 500))
|
||||||
newImg.height = shareContent.offsetHeight;
|
|
||||||
document.querySelector(targetID).appendChild(newImg);
|
const canvas = await html2canvas(el, {
|
||||||
|
scale: 2,
|
||||||
|
useCORS: true,
|
||||||
|
backgroundColor: '#ffffff',
|
||||||
|
logging: false
|
||||||
|
})
|
||||||
|
const dataUrl = canvas.toDataURL('image/png')
|
||||||
|
|
||||||
|
const target = document.querySelector('#sc_ewm')
|
||||||
|
if (target) {
|
||||||
|
target.innerHTML = ''
|
||||||
|
const img = document.createElement('img')
|
||||||
|
img.src = dataUrl
|
||||||
|
img.style.width = '100%'
|
||||||
|
img.style.display = 'block'
|
||||||
|
target.appendChild(img)
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('生成海报失败', err);
|
console.error('生成海报失败', err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
loadImageToBase64(imgEl) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const img = new Image()
|
||||||
|
img.crossOrigin = 'anonymous'
|
||||||
|
img.onload = () => {
|
||||||
|
try {
|
||||||
|
const canvas = document.createElement('canvas')
|
||||||
|
canvas.width = img.width
|
||||||
|
canvas.height = img.height
|
||||||
|
const ctx = canvas.getContext('2d')
|
||||||
|
ctx.drawImage(img, 0, 0)
|
||||||
|
imgEl.src = canvas.toDataURL('image/png')
|
||||||
|
resolve()
|
||||||
|
} catch (e) {
|
||||||
|
reject(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
img.onerror = reject
|
||||||
|
img.src = imgEl.src
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
@ -153,7 +138,6 @@ export default {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 34vw;
|
left: 34vw;
|
||||||
bottom: 46vw;
|
bottom: 46vw;
|
||||||
// line-height: 6vw;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
b {
|
b {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user