feat: 优化腾讯地图地址选点插件,完善订单管理与分销服务

这个提交包含在:
2026-10-26 10:01:40 +08:00
父节点 d871e73d23
当前提交 7b58952cd4
共有 19 个文件被更改,包括 1045 次插入 和 201 次删除

查看文件

@@ -31,8 +31,14 @@ export default {
ic = sceneStr.slice(3)
} else if (sceneStr.indexOf('uid_') === 0) {
inviterId = sceneStr.slice(4)
} else if (/^id_\d+_u_(\d+)$/.test(sceneStr)) {
const m = sceneStr.match(/^id_\d+_u_(\d+)$/)
if (m && m[1]) inviterId = m[1]
} else if (sceneStr.indexOf('uid=') === 0) {
inviterId = sceneStr.slice(4)
} else if (/^id_\d+_u_(\d+)$/.test(sceneStr)) {
const m = sceneStr.match(/^id_\d+_u_(\d+)$/)
if (m && m[1]) inviterId = m[1]
} else if (/^[A-Za-z0-9]{4,16}$/.test(sceneStr)) {
ic = sceneStr
}

查看文件

@@ -11,8 +11,8 @@ export const distributionApi = {
team: (params = {}) => get('/distribution/team', params, { silent: true }),
/** 分销收益明细账单(佣金流水) */
commissions: (params = {}) => get('/distribution/commissions', params, { silent: true }),
/** 专属推广海报要素 */
poster: () => get('/distribution/poster', {}, { silent: true }),
/** 专属推广海报要素(支持传入 postId 获取详情页小程序码) */
poster: (params = {}) => get('/distribution/poster', params, { silent: true }),
/** 申请提现(提现至微信零钱) */
withdraw: (payload) => post('/distribution/withdraw', payload, { silent: true }),
/** 提现记录 */

查看文件

@@ -471,19 +471,16 @@
<text class="detail__poster-tip">点击大图可全屏预览,支持长按直接转发</text>
</view>
<!-- 底部三大快捷分享操作 -->
<!-- 底部快捷分享操作 -->
<view class="detail__poster-actions">
<view class="detail__poster-btn detail__poster-btn--primary" @click="savePoster">
<image class="fc-icon fc-icon--sm" :src="iconUrl('image-white')" mode="aspectFit" />
<text class="detail__poster-btn-text">保存到手机相册</text>
</view>
<button class="detail__poster-btn detail__poster-btn--share" open-type="share">
<button class="detail__poster-btn detail__poster-btn--share" @click="sharePosterImage">
<image class="fc-icon fc-icon--sm" :src="iconUrl('bar-share')" mode="aspectFit" />
<text class="detail__poster-btn-text">发给微信好友</text>
</button>
<view class="detail__poster-btn detail__poster-btn--ghost" @click="copyPosterText">
<text>复制文案</text>
</view>
</view>
</view>
</view>
@@ -503,6 +500,7 @@ import postApi from '@/common/api/post.js'
import favoriteApi from '@/common/api/favorite.js'
import reportApi from '@/common/api/report.js'
import memberApi from '@/common/api/member.js'
import distributionApi from '@/common/api/distribution.js'
import { REPORT_REASONS } from '@/common/constants/report.js'
import { iconUrl, categoryIconUrl, loadUiConfig, uiState } from '@/common/store/ui.js'
import { fromNow, assetUrl } from '@/common/utils/format.js'
@@ -691,8 +689,29 @@ export default {
}
},
},
/**
* 页面加载:提取帖子ID与分销裂变参数
* @param {Object} query 路由入参
*/
onLoad(query) {
this.id = Number(query.id || 101)
let postIdFromScene = 0
if (query) {
const ic = query.ic || query.inviteCode || query.invite_code
let inviterId = query.inviterId || query.inviter_id
if (query.scene) {
try {
const s = decodeURIComponent(query.scene)
const m = s.match(/^id_(\d+)(?:_u_(\d+))?$/)
if (m) {
postIdFromScene = Number(m[1] || 0)
if (m[2]) inviterId = m[2]
}
} catch (e) {}
}
if (ic) uni.setStorageSync('fc_invite_code', String(ic))
if (inviterId) uni.setStorageSync('fc_inviter_id', Number(inviterId))
}
this.id = Number((query && query.id) || postIdFromScene || 101)
this.posterImagePath = ''
loadUiConfig()
this.fetch()
@@ -701,19 +720,21 @@ export default {
if (this.loaded) this.refreshAccess()
},
/**
* 转发给微信好友(携带分销邀请人与精美封面图)
* 转发给微信好友(携带分销邀请码/邀请人与精美封面图)
*/
onShareAppMessage() {
let inviterId = 0
let inviteCode = ''
try {
const user = this.currentUser
if (user && user.id) inviterId = user.id
if (user && user.inviteCode) inviteCode = user.inviteCode
} catch (e) {}
const shareTitle = this.post.title
? `【${this.post.categoryName || '同城信息'}】${this.post.title}`
: (uiState.shareTitle || uiState.siteName || '同城便民信息')
const sharePath = `/pages/detail/detail?id=${this.id}${inviterId ? '&inviterId=' + inviterId : ''}`
const sharePath = `/pages/detail/detail?id=${this.id}${inviteCode ? '&ic=' + encodeURIComponent(inviteCode) : ''}${inviterId ? '&inviterId=' + inviterId : ''}`
const shareImg = this.posterImagePath || (this.imageUrls && this.imageUrls.length ? this.imageUrls[0] : (this.post.cover ? assetUrl(this.post.cover) : ''))
return {
@@ -723,13 +744,15 @@ export default {
}
},
/**
* 转发到微信朋友圈
* 转发到微信朋友圈(携带分销邀请码/邀请人)
*/
onShareTimeline() {
let inviterId = 0
let inviteCode = ''
try {
const user = this.currentUser
if (user && user.id) inviterId = user.id
if (user && user.inviteCode) inviteCode = user.inviteCode
} catch (e) {}
const shareTitle = this.post.title
@@ -739,7 +762,7 @@ export default {
return {
title: shareTitle,
query: `id=${this.id}${inviterId ? '&inviterId=' + inviterId : ''}`,
query: `id=${this.id}${inviteCode ? '&ic=' + encodeURIComponent(inviteCode) : ''}${inviterId ? '&inviterId=' + inviterId : ''}`,
imageUrl: shareImg || undefined,
}
},
@@ -1693,8 +1716,22 @@ export default {
} catch (e) {}
const qrUrl = `https://fenleixinxi.gzyakj.com.cn/pages/detail/detail?id=${this.id}${inviterId ? '&inviterId=' + inviterId : ''}`
// 绘制高识别度合规二维码(124 x 124)
this.drawRealQRCode(ctx, qrUrl, 56, 830, 124)
// 优先拉取并绘制微信官方小程序码,未发布或受限时无缝回退至自绘二维码(124 x 124)
let wxacodeLocal = ''
if (this.currentUser) {
try {
const posterMeta = await distributionApi.poster({ postId: this.id })
if (posterMeta && posterMeta.wxacodeUrl) {
wxacodeLocal = await this.getImageLocalPath(assetUrl(posterMeta.wxacodeUrl))
}
} catch (e) {}
}
if (wxacodeLocal) {
this.drawRoundRect(ctx, 56, 830, 124, 124, 10, '#FFFFFF', '#DFF2E8', 1)
ctx.drawImage(wxacodeLocal, 60, 834, 116, 116)
} else {
this.drawRealQRCode(ctx, qrUrl, 56, 830, 124)
}
// 右侧指引文案(显式左对齐,彻底杜绝对齐错乱)
this.drawSafeText(ctx, '微信长按识别小程序', 198, 842, {
@@ -1743,6 +1780,29 @@ export default {
}, 300)
})
},
/**
* 唤起微信原生图片分享面板(一键发给好友/发朋友圈/收藏),不支持时回退全屏预览长按转发
*/
sharePosterImage() {
if (!this.posterImagePath) {
uni.showToast({ title: '海报准备中,请稍候', icon: 'none' })
return
}
// #ifdef MP-WEIXIN
if (typeof wx !== 'undefined' && typeof wx.showShareImageMenu === 'function') {
wx.showShareImageMenu({
path: this.posterImagePath,
fail: (err) => {
if (err && err.errMsg && !err.errMsg.includes('cancel')) {
this.previewPoster()
}
},
})
return
}
// #endif
this.previewPoster()
},
/**
* 预览海报大图
*/

查看文件

@@ -512,14 +512,11 @@
<text>保存到相册</text>
</view>
<!-- #ifdef MP-WEIXIN -->
<button class="dist__poster-act-btn dist__poster-act-btn--share" open-type="share">
<button class="dist__poster-act-btn dist__poster-act-btn--share" @click="sharePosterImage">
<image class="dist__btn-icon" :src="iconUrl('share')" mode="aspectFit" />
<text>发给好友</text>
</button>
<!-- #endif -->
<view class="dist__poster-act-btn dist__poster-act-btn--ghost" @click="copyPosterText">
<text>复制文案</text>
</view>
</view>
</view>
</view>
@@ -528,7 +525,7 @@
<canvas
canvas-id="distPosterCanvas"
id="distPosterCanvas"
style="width: 600px; height: 880px; position: fixed; left: -9999px; top: -9999px; z-index: -999;"
style="width: 600px; height: 740px; position: fixed; left: -9999px; top: -9999px; z-index: -999;"
/>
</view>
</template>
@@ -1134,7 +1131,7 @@ export default {
}, 6000)
const W = 600
const H = 880
const H = 740
const ctx = uni.createCanvasContext('distPosterCanvas', this)
try {
@@ -1158,7 +1155,7 @@ export default {
ctx.fillRect(0, 0, W, H)
// 2. 纯白立体高光主卡片(圆角 24px,细边框 #D1FAE5)
this.drawRoundRect(ctx, 20, 20, 560, 840, 24, '#FFFFFF', '#D1FAE5', 1.5)
this.drawRoundRect(ctx, 20, 20, 560, 700, 24, '#FFFFFF', '#D1FAE5', 1.5)
// 3. 顶部 Header 栏(y: 44 ~ 76)
// 左侧绿色品牌胶囊
@@ -1291,7 +1288,16 @@ export default {
const qrX = 48
const qrY = 546
const qrSize = 150
this.drawRealQRCode(ctx, qrUrl, qrX, qrY, qrSize)
let wxacodeLocal = ''
if (meta && meta.wxacodeUrl) {
wxacodeLocal = await this.getImageLocalPath(meta.wxacodeUrl, 1500)
}
if (wxacodeLocal) {
this.drawRoundRect(ctx, qrX, qrY, qrSize, qrSize, 12, '#FFFFFF', '#DFF2E8', 1)
ctx.drawImage(wxacodeLocal, qrX + 6, qrY + 6, qrSize - 12, qrSize - 12)
} else {
this.drawRealQRCode(ctx, qrUrl, qrX, qrY, qrSize)
}
// 二维码右侧文字说明(从 x = 216 开始,宽度 344px 极为充裕,排版整洁绝不重叠)
const textX = 218
@@ -1362,6 +1368,33 @@ export default {
}
},
/**
* 全屏预览生成的海报大图
*/
/**
* 唤起微信原生图片转发菜单(一键发给好友/发朋友圈/收藏),不支持时回退全屏预览长按转发
*/
sharePosterImage() {
if (!this.posterImagePath) {
uni.showToast({ title: '海报正在生成,请稍候', icon: 'none' })
return
}
// #ifdef MP-WEIXIN
if (typeof wx !== 'undefined' && typeof wx.showShareImageMenu === 'function') {
wx.showShareImageMenu({
path: this.posterImagePath,
fail: (err) => {
if (err && err.errMsg && !err.errMsg.includes('cancel')) {
this.previewPoster()
}
},
})
return
}
// #endif
this.previewPoster()
},
/**
* 全屏预览生成的海报大图
*/
@@ -2422,7 +2455,7 @@ export default {
}
.dist__poster-img {
width: 500rpx;
height: 733rpx;
height: 616rpx;
border-radius: 20rpx;
box-shadow: 0 16rpx 40rpx rgba(4, 48, 30, 0.16);
background: #ffffff;

查看文件

@@ -356,12 +356,7 @@ export default {
*/
vipTitle() {
if (this.isMember) return '会员权益已生效'
const b = this.benefits || {}
if (b.postMode === 'free') {
return '开通会员,尊享 VIP 专属特权'
}
const discount = b.postDiscount
return discount ? `开通会员,享专属发帖与查看特权` : '开通会员,享专属特权'
return '开通会员 · 享免费发帖看号'
},
/**
* 顶栏显示的城市或区域文案(优先当前选择区县,其次城市,缺省回退到同城服务)
@@ -472,16 +467,44 @@ export default {
onUnload() {
uni.$off('refreshUnreadCount')
},
/**
* 微信好友转发(携带当前登录用户的分销邀请码/ID)
*/
onShareAppMessage() {
let queryStr = ''
try {
const store = useUserStore()
const user = (store.userInfo && store.userInfo.value) || store.userInfo || (store.state && store.state.userInfo)
if (user) {
const params = []
if (user.inviteCode) params.push('ic=' + encodeURIComponent(user.inviteCode))
if (user.id) params.push('inviterId=' + encodeURIComponent(user.id))
if (params.length) queryStr = '?' + params.join('&')
}
} catch (e) {}
return {
title: uiState.shareTitle || uiState.siteName || '同城分类信息',
path: '/pages/index/index',
path: '/pages/index/index' + queryStr,
}
},
/**
* 微信朋友圈转发(携带当前登录用户的分销邀请码/ID)
*/
onShareTimeline() {
let queryStr = ''
try {
const store = useUserStore()
const user = (store.userInfo && store.userInfo.value) || store.userInfo || (store.state && store.state.userInfo)
if (user) {
const params = []
if (user.inviteCode) params.push('ic=' + encodeURIComponent(user.inviteCode))
if (user.id) params.push('inviterId=' + encodeURIComponent(user.id))
if (params.length) queryStr = params.join('&')
}
} catch (e) {}
return {
title: uiState.shareTitle || uiState.siteName || '同城分类信息',
query: '',
query: queryStr,
}
},
/**
@@ -1208,35 +1231,52 @@ export default {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
box-shadow: $fc-shadow;
}
.home__vip-left {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
}
.home__vip-left .fc-icon {
flex-shrink: 0;
}
.home__vip-texts {
display: flex;
flex-direction: column;
margin-left: 12rpx;
margin-left: 14rpx;
flex: 1;
min-width: 0;
}
.home__vip-title {
color: #ffffff;
font-size: $fc-font-lg;
font-size: 30rpx;
font-weight: 700;
line-height: $fc-leading-tight;
line-height: 1.3;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.home__vip-sub {
color: rgba(255, 255, 255, 0.9);
font-size: $fc-font-xs;
margin-top: 8rpx;
color: rgba(255, 255, 255, 0.92);
font-size: 22rpx;
margin-top: 6rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.home__vip-btn {
flex-shrink: 0;
white-space: nowrap;
padding: 12rpx 28rpx;
border-radius: $fc-radius-pill;
background: #ffffff;
color: $fc-primary-text;
font-size: $fc-font-sm;
font-size: 24rpx;
font-weight: 700;
line-height: 1.2;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
}

查看文件

@@ -179,6 +179,7 @@ import FcEmpty from '@/components/fc-empty/fc-empty.vue'
import { merchantApi } from '@/common/api/merchant.js'
import { iconUrl, loadUiConfig } from '@/common/store/ui.js'
import { assetUrl } from '@/common/utils/format.js'
import { useUserStore } from '@/common/store/index.js'
export default {
components: { FcNavbar, FcPostCard, FcEmpty },
@@ -232,7 +233,13 @@ export default {
* @param {Object} query 路由入参
*/
onLoad(query) {
this.merchantId = Number(query.id || query.userId || 0)
if (query) {
const ic = query.ic || query.inviteCode || query.invite_code
const inviterId = query.inviterId || query.inviter_id
if (ic) uni.setStorageSync('fc_invite_code', String(ic))
if (inviterId) uni.setStorageSync('fc_inviter_id', Number(inviterId))
}
this.merchantId = Number((query && (query.id || query.userId)) || 0)
this.postId = Number(query.postId || 0)
loadUiConfig()
this.fetchLocation()
@@ -260,11 +267,44 @@ export default {
onShareAppMessage() {
return {
title: `【认证商家】${this.merchant.name || '同城实体门店'}`,
path: `/pages/merchant/detail?id=${this.merchantId}`,
path: this.buildSharePath(),
imageUrl: this.merchant.logo ? assetUrl(this.merchant.logo) : undefined,
}
},
/**
* 微信朋友圈分享配置(携带当前登录用户的分销邀请码/ID)
*/
onShareTimeline() {
return {
title: `【认证商家】${this.merchant.name || '同城实体门店'}`,
query: this.buildShareQuery(),
imageUrl: this.merchant.logo ? assetUrl(this.merchant.logo) : undefined,
}
},
methods: {
/**
* 构造带分销参数的商家详情页分享 query
* @returns {string}
*/
buildShareQuery() {
const params = [`id=${this.merchantId}`]
try {
const store = useUserStore()
const user = (store.userInfo && store.userInfo.value) || store.userInfo || (store.state && store.state.userInfo)
if (user) {
if (user.inviteCode) params.push('ic=' + encodeURIComponent(user.inviteCode))
if (user.id) params.push('inviterId=' + encodeURIComponent(user.id))
}
} catch (e) {}
return params.join('&')
},
/**
* 构造带分销参数的商家详情页分享路径
* @returns {string}
*/
buildSharePath() {
return '/pages/merchant/detail?' + this.buildShareQuery()
},
iconUrl,
assetUrl,
/**

查看文件

@@ -766,23 +766,32 @@ export default {
.mine__vip-left {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
margin-right: 16rpx;
}
.mine__vip-icon {
width: 52rpx;
height: 52rpx;
flex-shrink: 0;
}
.mine__vip-texts {
margin-left: 18rpx;
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
}
.mine__vip-title {
color: #4a2600; /* 深褐黑金字 */
font-size: 30rpx;
font-weight: 800;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.mine__vip-sub {
@@ -790,9 +799,14 @@ export default {
color: #7a4600; /* 高清晰深暖金副标题 */
font-size: 22rpx;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.mine__vip-btn {
flex-shrink: 0;
white-space: nowrap;
padding: 10rpx 26rpx;
border-radius: $fc-radius-pill;
background: #ffffff;