本地备份:消息系统改造前完整版本(未推送,便于回退)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-06-29 04:18:48 +08:00
parent 848c2f6486
commit 9976bc1d6d
46 changed files with 2004 additions and 1060 deletions

View File

@@ -9,6 +9,7 @@ import PopupService from '../../services/popupService.js';
import { reconnectForRole } from '../../utils/role-tab-bar.js';
import { ensurePhoneAuth } from '../../utils/phone-auth.js';
import { fetchGonggaoLunbo, isGonggaoCacheValid } from '../../utils/display-config.js';
import { checkPenaltyForGrab } from '../../utils/grab-order-gate.js';
Page({
data: {
@@ -61,8 +62,18 @@ Page({
async onLoad() {
if (app.globalData._acceptOrderSessionReady && app.globalData._acceptOrderPageCache) {
const cache = app.globalData._acceptOrderPageCache;
this.setData({ ...cache });
const cache = { ...app.globalData._acceptOrderPageCache };
this.data.shangpinleixing = cache.shangpinleixing || [];
const dingdanList = Array.isArray(cache.dingdanList)
? cache.dingdanList.map((item) => this.processDingdanItem(item))
: [];
this.setData({
...cache,
shangpinleixing: cache.shangpinleixing || [],
dingdanList,
bankuaiBiaoqian: cache.bankuaiBiaoqian || [],
lunboList: cache.lunboList || [],
});
if ((!cache.lunboList || cache.lunboList.length === 0) && !cache.gonggao && isGonggaoCacheValid(app)) {
const lunboList = this.processLunboUrls(app.globalData.shangpinlunbo);
const gonggao = app.globalData.shangpingonggao || '';
@@ -72,6 +83,12 @@ Page({
this.loadGlobalStatus();
this.registerNotificationComponent();
await this.syncDashouProfileFromServer();
if (!this.data.shangpinleixing || this.data.shangpinleixing.length === 0) {
await this.loadShangpinLeixing(true, false, false);
} else if (this.data.xuanzhongLeixingId) {
await this.loadDingdanList(true, true);
}
this.persistPageCache();
this._skipShowRefresh = true;
return;
}
@@ -546,6 +563,19 @@ Page({
const dingdanItem = e.currentTarget.dataset.item;
if (!dingdanItem) return;
const penalty = await checkPenaltyForGrab();
if (penalty.blocked) {
wx.showToast({
title: penalty.msg,
icon: 'none',
duration: 2000,
});
setTimeout(() => {
wx.navigateTo({ url: penalty.url });
}, 500);
return;
}
await this.checkExamStatus();
if (this.data.examRequired && !this.data.examPassed) {

View File

@@ -1,12 +1,12 @@
{
"navigationBarTitleText": "抢单大厅",
"navigationBarBackgroundColor": "#f7dc51",
"backgroundColor": "#f7dc51",
"backgroundColorTop": "#f7dc51",
"navigationBarBackgroundColor": "#c4b5fd",
"backgroundColor": "#c4b5fd",
"backgroundColorTop": "#c4b5fd",
"navigationBarTextStyle": "black",
"enablePullDownRefresh": false,
"backgroundTextStyle": "dark",
"backgroundColor": "#fff8e1",
"backgroundColor": "#f5f3ff",
"usingComponents": {
"chenghao-tag": "/components/chenghao-tag/chenghao-tag",
"global-notification": "/components/global-notification/global-notification"

View File

@@ -1,4 +1,4 @@
<!-- pages/qiangdan/qiangdan.wxml -->
<!-- pages/qiangdan/qiangdan.wxml -->
<view class="qiangdan-page">
@@ -18,7 +18,7 @@
refresher-default-style="black"
refresher-background="#fff8e1"
refresher-background="#f5f3ff"
refresher-triggered="{{scrollViewRefreshing}}"
@@ -56,7 +56,7 @@
indicator-color="rgba(255,255,255,0.6)"
indicator-active-color="#ffd061"
indicator-active-color="#9333ea"
autoplay="{{lunboList.length > 1}}"

View File

@@ -3,7 +3,7 @@
@import '../../styles/dashou-xym-order-card.wxss';
page {
background-color: #f7dc51;
background-color: #c4b5fd;
}
.qiangdan-page {

View File

@@ -1,6 +1,6 @@
{
"usingComponents": {},
"navigationBarTitleText": "接单考试",
"navigationBarBackgroundColor": "#f7dc51",
"navigationBarBackgroundColor": "#c4b5fd",
"navigationBarTextStyle": "black"
}

View File

@@ -1,6 +1,6 @@
.exam-page {
min-height: 100vh;
background: linear-gradient(180deg, #fff8e1 0%, #fff3d6 100%);
background: linear-gradient(180deg, #f5f3ff 0%, #fff3d6 100%);
padding: 24rpx;
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
@@ -29,12 +29,12 @@
}
.btn-primary {
background: linear-gradient(90deg, #f7dc51, #ffc0a3);
background: linear-gradient(90deg, #c4b5fd, #a78bfa);
padding: 22rpx 48rpx;
border-radius: 48rpx;
font-weight: 600;
font-size: 30rpx;
color: #492f00;
color: #6d28d9;
text-align: center;
}
@@ -83,7 +83,7 @@
.progress {
font-size: 28rpx;
color: #492f00;
color: #6d28d9;
font-weight: 600;
}
@@ -98,8 +98,8 @@
display: inline-block;
font-size: 22rpx;
color: #b8860b;
background: #fff8e1;
border: 1rpx solid #f7dc51;
background: #f5f3ff;
border: 1rpx solid #c4b5fd;
border-radius: 8rpx;
padding: 4rpx 16rpx;
margin-bottom: 16rpx;
@@ -139,7 +139,7 @@
}
.opt-active {
border-color: #f7dc51;
border-color: #c4b5fd;
background: #fffdf0;
}
@@ -157,15 +157,15 @@
}
.opt-radio-on {
border-color: #f7dc51;
background: #fff8e1;
border-color: #c4b5fd;
background: #f5f3ff;
}
.opt-radio-dot {
width: 18rpx;
height: 18rpx;
border-radius: 50%;
background: #f7dc51;
background: #c4b5fd;
}
.opt-body {
@@ -177,7 +177,7 @@
.opt-label {
font-weight: 700;
color: #492f00;
color: #6d28d9;
min-width: 40rpx;
font-size: 28rpx;
}

View File

@@ -4,7 +4,7 @@
"chenghao-tag": "/components/chenghao-tag/chenghao-tag"
},
"backgroundTextStyle": "dark",
"navigationBarBackgroundColor": "#fff8e1",
"navigationBarBackgroundColor": "#f5f3ff",
"navigationBarTitleText": "常规发单",
"navigationBarTextStyle": "black",
"backgroundColor": "#f5f5f5",

View File

@@ -290,7 +290,7 @@ page {
.filter-switch.active {
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
}
.link-list {
@@ -324,7 +324,7 @@ page {
.copy-link-btn {
padding: 8rpx 20rpx;
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
border-radius: 15rpx;
font-size: 22rpx;
}
@@ -339,7 +339,7 @@ page {
padding: 15rpx 40rpx;
background: linear-gradient(180deg, #fae04d, #ffc0a3);
border-radius: 30rpx;
color: #492f00;
color: #6d28d9;
font-size: 26rpx;
}
@@ -374,7 +374,7 @@ page {
.copy-modal-grid-btn,
.edit-modal-grid-btn {
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
}
.delete-modal-grid-btn {
@@ -485,7 +485,7 @@ page {
.confirm-add-grid-btn {
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
}
.confirm-content {
@@ -539,7 +539,7 @@ page {
.confirm-new-link-grid-btn {
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
}
.loading-mask {
@@ -569,7 +569,7 @@ page {
width: 90rpx;
height: 90rpx;
border: 8rpx solid #eee;
border-top: 8rpx solid #ffd061;
border-top: 8rpx solid #9333ea;
border-radius: 50%;
animation: spin 1.2s linear infinite;
margin-bottom: 35rpx;

View File

@@ -6,7 +6,7 @@
"pindao-modal": "/components/pindao-modal/pindao-modal"
},
"navigationStyle": "custom",
"backgroundColor": "#fff8e1",
"backgroundColor": "#f5f3ff",
"backgroundTextStyle": "dark",
"enablePullDownRefresh": false,
"onReachBottomDistance": 50

View File

@@ -39,7 +39,7 @@
refresher-enabled="{{true}}"
refresher-threshold="80"
refresher-default-style="black"
refresher-background="#fff8e1"
refresher-background="#f5f3ff"
refresher-triggered="{{scrollViewRefreshing}}"
bindrefresherrefresh="onPullDownRefresh"
>

View File

@@ -1,7 +1,7 @@
/* 打手端个人中心 - 逍遥梦 UI逻辑不变 */
page {
background: #fff8e1;
background: #f5f3ff;
color: #333;
}
@@ -16,7 +16,7 @@ page {
flex-direction: column;
overflow: hidden;
box-sizing: border-box;
background: linear-gradient(180deg, #f7dc51 0%, #fff 28%, #fff8e1 100%);
background: linear-gradient(180deg, #c4b5fd 0%, #fff 28%, #f5f3ff 100%);
position: relative;
}
@@ -126,7 +126,7 @@ page {
padding: 2rpx 12rpx;
border-radius: 8rpx;
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
}
.sn-row {
@@ -238,7 +238,7 @@ page {
border: 2rpx solid #fff;
border-radius: 60rpx;
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
white-space: nowrap;
}
@@ -272,8 +272,8 @@ page {
border-radius: 16rpx;
font-size: 28rpx;
font-weight: 600;
color: #492f00;
background: linear-gradient(180deg, #fff8e1, #ffe8b8);
color: #6d28d9;
background: linear-gradient(180deg, #f5f3ff, #ffe8b8);
border: 1rpx solid rgba(201, 169, 98, 0.45);
}
@@ -305,7 +305,7 @@ page {
.btn-bg {
background: linear-gradient(180deg, #fae04d, #ffc0a3);
border-radius: 30px;
color: #492f00;
color: #6d28d9;
}
.withdraw {
@@ -334,7 +334,7 @@ page {
.vip-strip-sub {
display: block;
font-size: 22rpx;
color: rgba(252, 210, 112, 0.65);
color: rgba(196, 181, 253, 0.65);
margin-top: 4rpx;
}
@@ -552,7 +552,7 @@ page {
}
.rank-theme-gold {
background: linear-gradient(135deg, #a8842a 0%, #f5d563 100%);
background: linear-gradient(135deg, #a8842a 0%, #c4b5fd 100%);
}
.rank-theme-gold .rank-tile-name,
@@ -608,7 +608,7 @@ page {
margin-bottom: 16rpx;
}
.unreg-btn-text { color: #492f00; }
.unreg-btn-text { color: #6d28d9; }
.unreg-btn-secondary {
text-align: center;
@@ -644,7 +644,7 @@ page {
width: 60rpx;
height: 60rpx;
border: 4rpx solid rgba(0, 0, 0, 0.08);
border-top-color: #ffd061;
border-top-color: #9333ea;
border-radius: 50%;
animation: fighterSpin 0.8s linear infinite;
}

View File

@@ -1,8 +1,10 @@
const app = getApp();
import { formatDate } from '../../static/lib/utils';
import { sendGroupMessage } from '../../utils/message-sender';
import { getLocalImUserId } from '../../utils/im-user.js';
import { resolveAvatarUrl } from '../../utils/avatar.js';
import { showConfirmByScene } from '../../utils/scriptService.js';
import { normalizeGroupMessage, getZhuangtaiText } from '../../utils/group-chat.js';
import { persistGroupMeta } from '../../utils/im-user.js';
import { getFreshImUser } from '../../utils/im-user.js';
Page({
data: {
@@ -11,6 +13,10 @@ Page({
groupAvatar: '',
orderId: '',
isCross: 0,
orderZhuangtai: null,
orderZhuangtaiText: '',
orderJine: '',
orderJieshao: '',
currentUser: null,
messages: [],
inputText: '',
@@ -28,7 +34,6 @@ Page({
lastTapMsgId: '',
emojiList: ['😀','😁','😂','🤣','😃','😄','😅','😆','😉','😊','😋','😎','😍','😘','😗','😙','😚','🙂','🤗','🤩','🤔','🤨','😐','😑','😶','🙄','😏','😣','😥','😮','🤐','😯','😪','😫','😴','😌','😛','😜','😝','🤤','😒','😓','😔','😕','🙃','🤑','😲','☹','🙁','😖','😞','😟','😤','😢','😭','😦','😧','😨','😩','🤯','😬','😰','😱','🥵','🥶','😳','🤪','😵','😡','😠','🤬','😷','🤒','🤕','🤢','🤮','🤧','😇','🤠','🤡','🤥','🤫','🤭','🧐','🤓','😈','👿','👹','👺','💀','👻','👽','🤖','💩','😺','😸','😹','😻','😼','😽','🙀','😿','😾'],
pendingImage: '',
pendingImageFile: null,
keyboardHeight: 0,
bottomSafeHeight: 10
},
@@ -41,111 +46,164 @@ Page({
p = { ...p, ...d };
} catch (e) {}
}
const orderId = String(p.orderId || p.groupId || '');
const groupId = String(p.groupId || p.orderId || '');
this.setData({
groupId,
groupId: p.groupId,
groupName: p.groupName,
groupAvatar: p.groupAvatar,
orderId,
isCross: p.isCross,
orderId: p.orderId,
isCross: p.isCross
});
wx.setNavigationBarTitle({ title: this.data.groupName });
const localImId = getLocalImUserId(app);
const userId = localImId || p.currentUserId;
if (userId) {
// 如果有外部传入的 currentUser 信息,直接用,不再依赖全局状态
if (p.currentUserId) {
this.setData({
currentUser: {
id: userId,
name: p.currentUserName || app.globalData.currentUser?.name || `用户${wx.getStorageSync('uid') || ''}`,
avatar: resolveAvatarUrl(p.currentUserAvatar || wx.getStorageSync('touxiang'), app),
},
id: p.currentUserId,
name: p.currentUserName || `用户${p.currentUserId.replace(/^[A-Za-z]+/,'')}`,
avatar: p.currentUserAvatar || (app.globalData.ossImageUrl + app.globalData.morentouxiang)
}
});
} else {
this.initCurrentUser();
}
},
initCurrentUser() {
const imId = getLocalImUserId(app);
const uid = wx.getStorageSync('uid');
if (!imId) return;
this.setData({
currentUser: {
id: imId,
name: app.globalData.currentUser?.name || wx.getStorageSync('nicheng') || `用户${uid}`,
avatar: resolveAvatarUrl(wx.getStorageSync('touxiang'), app),
},
});
},
buildImageFile(tempPath, size) {
return {
path: tempPath,
tempFilePath: tempPath,
size: size || 0,
};
},
normalizeMessage(msg) {
if (!msg) return msg;
if (!msg.payload) msg.payload = {};
if (msg.type === 'image') {
const p = msg.payload;
if (!p.url) p.url = p.thumbnail || p.thumb || p.imageUrl || '';
const meta = (app.globalData.groupInfoMap && app.globalData.groupInfoMap[p.groupId]) || {};
const initZt = p.orderZhuangtai != null ? p.orderZhuangtai : meta.orderZhuangtai;
if (initZt != null) {
this.applyOrderStatus(initZt, {
orderId: p.orderId || meta.orderId,
jine: p.orderJine || meta.orderJine,
jieshao: p.orderDesc || meta.orderDesc,
});
}
return msg;
},
mergeSentMessage(localId, sent) {
if (!sent) {
this.updateMsg(localId, 'success');
onShow() {
app.globalData.pageState.isInChatPage = true;
app.globalData.pageState.currentChatId = this.data.groupId;
app.globalData.pageState.isInGroupChat = true;
this.ensureChatConnection();
},
onHide() {
app.globalData.pageState.isInChatPage = false;
app.globalData.pageState.currentChatId = '';
app.globalData.pageState.isInGroupChat = false;
this.clearPageListeners();
},
applyOrderStatus(zhuangtai, extra) {
if (zhuangtai == null && zhuangtai !== 0) return;
const patch = {
orderZhuangtai: zhuangtai,
orderZhuangtaiText: getZhuangtaiText(zhuangtai),
};
if (extra) {
if (extra.jine) patch.orderJine = extra.jine;
if (extra.jieshao) patch.orderJieshao = extra.jieshao;
if (extra.orderId) patch.orderId = extra.orderId;
}
this.setData(patch);
const groupId = this.data.groupId;
if (!groupId) return;
if (!app.globalData.groupInfoMap) app.globalData.groupInfoMap = {};
const meta = { ...(app.globalData.groupInfoMap[groupId] || {}), orderZhuangtai: zhuangtai };
if (extra && extra.orderId) meta.orderId = extra.orderId;
app.globalData.groupInfoMap[groupId] = meta;
persistGroupMeta(app, groupId, meta);
},
applyOrderCardPayload(payload) {
if (!payload) return;
const cardOrderId = payload.orderId || payload.dingdan_id;
if (cardOrderId && this.data.orderId && cardOrderId !== this.data.orderId) return;
const zt = payload.zhuangtai != null ? payload.zhuangtai : this.data.orderZhuangtai;
payload.zhuangtaiText = getZhuangtaiText(zt);
this.applyOrderStatus(zt, {
orderId: payload.orderId || payload.dingdan_id || this.data.orderId,
jine: payload.jine,
jieshao: payload.jieshao,
});
this.updateOrderBubblesInList(payload);
},
updateOrderBubblesInList(payload) {
if (!payload) return;
const orderId = payload.orderId || payload.dingdan_id;
if (!orderId) return;
const messages = this.data.messages.map((m) => {
if (m.type !== 'order' || !m.payload) return m;
const oid = m.payload.orderId || m.payload.dingdan_id;
if (oid !== orderId) return m;
return { ...m, payload: { ...m.payload, ...payload, orderId: oid } };
});
this.setData({ messages });
},
mergeServerMessage(localId, status, serverMsg) {
if (!serverMsg) {
this.updateMsg(localId, status);
return;
}
normalizeGroupMessage(serverMsg);
serverMsg.formattedTime = formatDate(serverMsg.timestamp);
if (serverMsg.type === 'order') {
this.applyOrderCardPayload(serverMsg.payload);
}
const msgs = this.data.messages.map((m) => {
if (m.messageId !== localId) return m;
return this.normalizeMessage({
...m,
...sent,
status: 'success',
messageId: sent.messageId || m.messageId,
payload: sent.payload || m.payload,
senderData: m.senderData || sent.senderData,
});
return {
...serverMsg,
showTime: m.showTime,
status: status || 'success',
formattedTime: serverMsg.formattedTime || m.formattedTime,
};
});
this.setData({ messages: msgs });
},
onShow() {
this.autoConnect();
},
async ensureChatConnection() {
const role = app.globalData.currentRole || 'normal';
const uid = wx.getStorageSync('uid');
const prefixMap = { normal:'Boss', dashou:'Ds', shangjia:'Sj', guanshi:'Gs', zuzhang:'Zz', kaoheguan:'Kh' };
const pageUserId = this.data.currentUser?.id;
const targetUserId = pageUserId || (prefixMap[role] || 'Boss') + uid;
onHide() {
this.clearAllListeners();
},
autoConnect() {
const targetUserId = this.data.currentUser?.id || getLocalImUserId(app);
if (!targetUserId) return;
const afterReady = () => {
this.subscribeGroupIfNeeded().then(() => {
this.setupAllListeners();
this.loadHistory(true);
this.markGroupMessageAsRead();
});
const onReady = () => {
this.subscribeGroupIfNeeded()
.then(() => {
this.setupAllListeners();
return this.loadHistory(true);
})
.then(() => this.markGroupMessageAsRead());
};
const status = wx.goEasy.getConnectionStatus ? wx.goEasy.getConnectionStatus() : 'disconnected';
if (status === 'connected' || status === 'reconnected') {
const currentUserId = wx.goEasy.im ? wx.goEasy.im.userId : null;
if (currentUserId === targetUserId) {
afterReady();
return;
}
wx.goEasy.disconnect();
const connectedId = app.globalData?.goEasyConnection?.userId || wx.goEasy?.im?.userId;
const status = wx.goEasy?.getConnectionStatus?.() || 'disconnected';
const imOk = status === 'connected' || status === 'reconnected';
if (imOk && connectedId === targetUserId) {
onReady();
return;
}
this.connectGoEasy(targetUserId);
try {
if (app.ensureImForRole) {
await app.ensureImForRole(role);
} else if (app.connectWithIdentity) {
await app.connectWithIdentity(role, targetUserId, true);
}
onReady();
} catch (e) {
const s = wx.goEasy?.getConnectionStatus?.();
if (s === 'connected' || s === 'reconnected') onReady();
else wx.showToast({ title: '连接失败,请重试', icon: 'none' });
}
},
clearPageListeners() {
this.clearAllListeners();
},
connectGoEasy(userId) {
@@ -155,14 +213,15 @@ Page({
id: userId,
data: {
name: currentUser.name,
avatar: resolveAvatarUrl(currentUser.avatar, app),
avatar: currentUser.avatar || (app.globalData.ossImageUrl + app.globalData.morentouxiang)
},
onSuccess: () => {
this.subscribeGroupIfNeeded().then(() => {
this.setupAllListeners();
this.loadHistory(true);
this.markGroupMessageAsRead();
});
this.subscribeGroupIfNeeded()
.then(() => {
this.setupAllListeners();
return this.loadHistory(true);
})
.then(() => this.markGroupMessageAsRead());
},
onFailed: (error) => {
if (error.code === 408) {
@@ -179,14 +238,17 @@ Page({
subscribeGroupIfNeeded() {
const { groupId } = this.data;
if (!groupId || !wx.goEasy?.im?.subscribeGroup) return Promise.resolve();
if (!groupId || !wx.goEasy?.im) return Promise.resolve();
return new Promise((resolve) => {
wx.goEasy.im.subscribeGroup({
groupIds: [String(groupId)],
onSuccess: () => resolve(true),
onFailed: (error) => {
console.warn('subscribeGroup failed', error);
resolve(false);
groupIds: [groupId],
onSuccess: () => {
console.log(`[群聊页] 订阅成功: ${groupId}`);
resolve();
},
onFailed: (err) => {
console.error(`[群聊页] 订阅失败: ${groupId}`, err);
resolve();
},
});
});
@@ -205,6 +267,23 @@ Page({
if (this._deleteHandler) { wx.goEasy.im.off(wx.GoEasy.IM_EVENT.MESSAGE_DELETED, this._deleteHandler); this._deleteHandler = null; }
},
initCurrentUser() {
const uid = wx.getStorageSync('uid');
const role = app.globalData.currentRole || 'normal';
const fresh = getFreshImUser(app, role, uid);
this.setData({ currentUser: {
id: fresh.id,
name: fresh.name,
avatar: fresh.avatar,
}});
},
fixAvatar(url) {
if (!url) return app.globalData.ossImageUrl + app.globalData.morentouxiang;
if (url.startsWith('http')) return url;
return app.globalData.ossImageUrl + url;
},
isConnected() {
const s = wx.goEasy.getConnectionStatus ? wx.goEasy.getConnectionStatus() : 'disconnected';
return s === 'connected' || s === 'reconnected';
@@ -231,12 +310,14 @@ Page({
let list = res.content || [];
list.sort((a, b) => a.timestamp - b.timestamp);
list.forEach((m, idx) => {
m = this.normalizeMessage(m);
list[idx] = m;
normalizeGroupMessage(m);
m.formattedTime = formatDate(m.timestamp);
if (idx === 0) m.showTime = true;
else m.showTime = (m.timestamp - list[idx-1].timestamp) / 60000 > 5;
if (!m.senderData) m.senderData = { name: '未知用户', avatar: '' };
if (m.type === 'order' && m.payload) {
this.applyOrderCardPayload(m.payload);
}
});
let final = refresh ? list : [...list, ...this.data.messages];
if (!refresh) {
@@ -267,17 +348,21 @@ Page({
if (this._msgHandler) wx.goEasy.im.off(wx.GoEasy.IM_EVENT.GROUP_MESSAGE_RECEIVED, this._msgHandler);
this._msgHandler = (msg) => {
if (msg.groupId !== this.data.groupId) return;
if (msg.senderId === this.data.currentUser.id) return;
msg = this.normalizeMessage(msg);
normalizeGroupMessage(msg);
if (msg.type === 'order' && msg.payload) {
this.applyOrderCardPayload(msg.payload);
}
if (msg.senderId === this.data.currentUser.id && msg.type !== 'order') return;
msg.formattedTime = formatDate(msg.timestamp);
const msgs = this.data.messages;
if (msgs.some((m) => m.messageId === msg.messageId)) return;
const last = msgs.length ? msgs[msgs.length-1] : null;
msg.showTime = last ? (msg.timestamp - last.timestamp) / 60000 > 5 : true;
this.setData({ messages: [...msgs, msg], scrollToView: 'msg-bottom' });
this.markGroupMessageAsRead();
};
wx.goEasy.im.on(wx.GoEasy.IM_EVENT.GROUP_MESSAGE_RECEIVED, this._msgHandler);
this.markGroupMessageAsRead();
this.markGroupMessageAsRead(); // ← 收到新消息就标记已读
},
markGroupMessageAsRead() {
@@ -312,31 +397,21 @@ Page({
chooseImage() {
const that = this;
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success(res) {
const file = (res.tempFiles && res.tempFiles[0]) || null;
if (!file || !file.tempFilePath) return;
that.setData({
pendingImage: file.tempFilePath,
pendingImageFile: that.buildImageFile(file.tempFilePath, file.size),
});
},
fail() {
wx.showToast({ title: '选择图片失败', icon: 'none' });
},
wx.chooseImage({
count: 1, sizeType: ['compressed'], sourceType: ['album', 'camera'],
success(res) { that.setData({ pendingImage: res.tempFilePaths[0] }); }
});
},
clearPendingImage() { this.setData({ pendingImage: '', pendingImageFile: null }); },
clearPendingImage() { this.setData({ pendingImage: '' }); },
sendMessage() {
if (this.data.pendingImage) {
this.sendImageMsg(this.data.pendingImage, this.data.pendingImageFile);
this.setData({ pendingImage: '', pendingImageFile: null });
const file = this.data.pendingImage;
showConfirmByScene('chat_image_confirm', () => {
this.sendImageMsg(file);
this.setData({ pendingImage: '' });
});
return;
}
const text = this.data.inputText.trim();
@@ -367,61 +442,18 @@ Page({
}
that.setData({ messages: [...msgs, localMsg], scrollToView: 'msg-bottom' });
},
onSuccess: (messageId, status) => {
that.updateMsg(messageId, status);
onSuccess: (messageId, status, serverMsg) => {
that.mergeServerMessage(messageId, status, serverMsg);
}
});
},
sendImageMsg(filePath, fileObj) {
sendImageMsg(file) {
const that = this;
const { currentUser, groupId, orderId, isCross, groupName, groupAvatar } = that.data;
if (!filePath || !currentUser || !groupId) return;
if (isCross === 0) {
if (!wx.goEasy || !wx.goEasy.im) {
wx.showToast({ title: '聊天未连接', icon: 'none' });
return;
}
const avatar = resolveAvatarUrl(currentUser.avatar, app);
const name = currentUser.name || '用户';
const localId = `image-${Date.now()}`;
const imageFile = fileObj || this.buildImageFile(filePath, 0);
const localMsg = {
messageId: localId,
type: 'image',
timestamp: Date.now(),
senderId: currentUser.id,
groupId,
senderData: { name, avatar },
payload: { url: filePath },
status: 'sending',
formattedTime: formatDate(Date.now()),
showTime: this.needShow(Date.now()),
};
that.setData({ messages: [...that.data.messages, localMsg], scrollToView: 'msg-bottom' });
const toData = { name: groupName || '订单群聊', avatar: groupAvatar || avatar, isCross: 0 };
if (orderId) toData.orderId = orderId;
const imgMsg = wx.goEasy.im.createImageMessage({
file: imageFile,
to: { type: wx.GoEasy.IM_SCENE.GROUP, id: groupId, data: toData },
});
wx.goEasy.im.sendMessage({
message: imgMsg,
onSuccess: (sent) => that.mergeSentMessage(localId, sent),
onFailed: (error) => {
console.error('[群聊] 图片发送失败', error);
that.updateMsg(localId, 'failed');
wx.showToast({ title: '图片发送失败', icon: 'none' });
},
});
return;
}
sendGroupMessage({
msgData: {
type: 'image',
filePath,
filePath: file,
currentUser: that.data.currentUser,
groupId: that.data.groupId,
orderId: that.data.orderId,
@@ -438,11 +470,8 @@ Page({
}
that.setData({ messages: [...msgs, localMsg], scrollToView: 'msg-bottom' });
},
onSuccess: (messageId, status) => {
that.updateMsg(messageId, status);
if (status === 'failed') {
wx.showToast({ title: '图片发送失败', icon: 'none' });
}
onSuccess: (messageId, status, serverMsg) => {
that.mergeServerMessage(messageId, status, serverMsg);
}
});
},
@@ -477,7 +506,7 @@ Page({
const msgId = e.currentTarget.dataset.messageid;
if (!msgId) return;
const msg = this.data.messages.find(m => m.messageId === msgId);
if (!msg || msg.messageId.startsWith('local-')) return;
if (!msg || String(msg.messageId).startsWith('local-')) return;
const itemList = ['复制'];
if (msg.senderId === this.data.currentUser.id && (Date.now() - msg.timestamp < 120000) && !msg.recalled) {
itemList.push('撤回');

View File

@@ -1,6 +1,6 @@
@import '../../styles/shangjia-xym-common.wxss';
page { background: #fff8e1; }
page { background: #f5f3ff; }
.sub-scroll { height: calc(100vh - 120rpx); }

View File

@@ -4,7 +4,7 @@
"popup-notice": "/components/popup-notice/popup-notice"
},
"backgroundTextStyle": "dark",
"navigationBarBackgroundColor": "#fff8e1",
"navigationBarBackgroundColor": "#f5f3ff",
"navigationBarTitleText": "自定义发单",
"navigationBarTextStyle": "black",
"backgroundColor": "#f5f5f5",

View File

@@ -159,7 +159,7 @@
<text class="field-optional">选填</text>
</view>
<view class="switch-row">
<switch checked="{{commissionEnabled}}" bindchange="onCommissionToggle" color="#ffd061"/>
<switch checked="{{commissionEnabled}}" bindchange="onCommissionToggle" color="#9333ea"/>
<text class="switch-label">{{commissionEnabled ? '已开启' : '未开启'}}</text>
</view>
<input

View File

@@ -1,7 +1,7 @@
{
"navigationStyle": "custom",
"enablePullDownRefresh": true,
"backgroundColor": "#fff8e1",
"backgroundColor": "#f5f3ff",
"backgroundTextStyle": "dark",
"usingComponents": {
"global-notification": "/components/global-notification/global-notification",

View File

@@ -1,7 +1,7 @@
@import '../../styles/shangjia-xym-common.wxss';
page {
background: #fff8e1;
background: #f5f3ff;
}
.sj-page--home {
@@ -85,13 +85,13 @@ page {
.dot.active {
width: 16rpx;
border-radius: 8rpx;
background: #ffd061;
background: #9333ea;
}
.sj-notice-bar {
display: flex;
align-items: center;
background: #fdf9db;
background: #f5f3ff;
margin: 12rpx 24rpx 0;
border-radius: 10rpx;
padding: 10rpx 16rpx;
@@ -166,7 +166,7 @@ page {
.sj-fadan-big-title {
font-size: 30rpx;
font-weight: 700;
color: #492f00;
color: #6d28d9;
}
.sj-fadan-big-sub {

View File

@@ -1,5 +1,5 @@
{
"navigationStyle": "custom",
"backgroundColor": "#fff8e1",
"backgroundColor": "#f5f3ff",
"usingComponents": {}
}

View File

@@ -96,7 +96,7 @@
min-height: 64rpx;
border-radius: 10rpx;
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
font-size: 28rpx;
font-weight: 700;
flex-shrink: 0;

View File

@@ -1,5 +1,5 @@
{
"navigationStyle": "custom",
"backgroundColor": "#fff8e1",
"backgroundColor": "#f5f3ff",
"usingComponents": {}
}

View File

@@ -1,7 +1,7 @@
/* pages/merchant-order-detail/merchant-order-detail.wxss - 商家订单详情(逍遥梦金色主题) */
@import '../../styles/shangjia-xym-common.wxss';
page { background: #fff8e1; }
page { background: #f5f3ff; }
.sjddxq-page { padding-bottom: calc(200rpx + env(safe-area-inset-bottom)); }
/* 加载状态居中布局 */
@@ -94,7 +94,7 @@ page { background: #fff8e1; }
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(180deg, rgba(255, 248, 225, 0.96), #fff8e1 30%);
background: linear-gradient(180deg, rgba(245, 243, 255, 0.96), #f5f3ff 30%);
padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom));
box-shadow: 0 -8rpx 28rpx rgba(0, 0, 0, 0.08);
display: flex;
@@ -123,20 +123,20 @@ page { background: #fff8e1; }
.sj-action-btn--gold {
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
border: 2rpx solid #fff;
box-shadow: 0 6rpx 18rpx rgba(245, 213, 99, 0.35);
}
.sj-action-btn--outline {
background: rgba(255, 255, 255, 0.95);
color: #492f00;
border: 2rpx solid #f5d563;
color: #6d28d9;
border: 2rpx solid #c4b5fd;
}
.sj-action-btn--warn {
background: linear-gradient(180deg, #ffb74d, #ff8a65);
color: #492f00;
color: #6d28d9;
border: 2rpx solid #fff;
box-shadow: 0 6rpx 16rpx rgba(255, 138, 101, 0.28);
}
@@ -149,7 +149,7 @@ page { background: #fff8e1; }
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.45); }
.modal-content { position: relative; width: 620rpx; background: #fdfcfa; border-radius: 32rpx; overflow: hidden; border: 2rpx solid rgba(245, 213, 99, 0.4); }
.modal-hd { padding: 32rpx; font-size: 34rpx; font-weight: 700; color: #492f00; display: flex; justify-content: space-between; border-bottom: 1rpx solid rgba(245, 213, 99, 0.35); }
.modal-hd { padding: 32rpx; font-size: 34rpx; font-weight: 700; color: #6d28d9; display: flex; justify-content: space-between; border-bottom: 1rpx solid rgba(245, 213, 99, 0.35); }
.modal-close { color: #999; font-size: 40rpx; }
.modal-body { padding: 32rpx; }
.modal-tip { font-size: 28rpx; color: #555; margin-bottom: 12rpx; }
@@ -163,7 +163,7 @@ page { background: #fff8e1; }
.fenhong-tip { text-align: center; font-size: 28rpx; color: #ff9800; margin: 16rpx 0 0; }
.modal-btns { display: flex; border-top: 1rpx solid #f0f0f0; }
.modal-btn { flex: 1; text-align: center; padding: 28rpx; font-size: 30rpx; font-weight: 500; }
.modal-btn.cancel { color: #886633; background: #fff8e1; }
.modal-btn.cancel { color: #886633; background: #f5f3ff; }
.modal-btn.confirm { color: #492f00; background: linear-gradient(180deg, #fae04d, #ffc0a3); font-weight: 700; }

View File

@@ -2,7 +2,7 @@
"navigationBarTitleText": "我的派单",
"enablePullDownRefresh": false,
"backgroundTextStyle": "dark",
"backgroundColor": "#fff8e1",
"backgroundColor": "#f5f3ff",
"usingComponents": {
"global-notification": "/components/global-notification/global-notification",
"chenghao-tag": "/components/chenghao-tag/chenghao-tag"

View File

@@ -87,7 +87,7 @@
refresher-enabled="{{true}}"
refresher-threshold="80"
refresher-default-style="black"
refresher-background="#fff8e1"
refresher-background="#f5f3ff"
refresher-triggered="{{scrollViewRefreshing}}"
bindrefresherrefresh="onPullDownRefresh"
bindscrolltolower="onReachBottom"

View File

@@ -6,13 +6,13 @@
page {
height: 100%;
overflow: hidden;
background: #fff8e1;
background: #f5f3ff;
}
.sj-page {
height: 100vh;
display: flex;
flex-direction: column;
background: #fff8e1;
background: #f5f3ff;
}
/* ========== 商品类型区 ========== */
@@ -123,8 +123,8 @@ page {
text-align: center;
}
.time-pill--active {
color: #492f00;
background: linear-gradient(180deg, #fff8e1, #ffe9b8);
color: #6d28d9;
background: linear-gradient(180deg, #f5f3ff, #ffe9b8);
border: 1rpx solid #e8c547;
}
.time-sep {
@@ -175,7 +175,7 @@ page {
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
}
.staff-filter-pill--active {
background: linear-gradient(180deg, #fff8e1, #ffe9b8);
background: linear-gradient(180deg, #f5f3ff, #ffe9b8);
border-color: #e8c547;
box-shadow: 0 4rpx 12rpx rgba(232, 197, 71, 0.25);
}
@@ -191,7 +191,7 @@ page {
}
.staff-filter-pill--active .staff-filter-tag {
background: rgba(255, 255, 255, 0.85);
color: #492f00;
color: #6d28d9;
}
.staff-filter-value {
flex: 1;
@@ -204,7 +204,7 @@ page {
white-space: nowrap;
}
.staff-filter-pill--active .staff-filter-value {
color: #492f00;
color: #6d28d9;
}
.staff-filter-arrow {
flex-shrink: 0;
@@ -561,7 +561,7 @@ page {
.load-more-btn {
background: linear-gradient(180deg, #fae04d, #ffc0a3);
color: #492f00;
color: #6d28d9;
border: 2rpx solid #fff;
box-shadow: 0 6rpx 16rpx rgba(245, 213, 99, 0.3);
}

View File

@@ -5,7 +5,7 @@
"chenghao-tag": "/components/chenghao-tag/chenghao-tag"
},
"backgroundTextStyle": "dark",
"navigationBarBackgroundColor": "#fff8e1",
"navigationBarBackgroundColor": "#f5f3ff",
"navigationBarTitleText": "常规发单",
"navigationBarTextStyle": "black",
"backgroundColor": "#f5f5f5",

View File

@@ -2,7 +2,7 @@
.role-page {
min-height: 100vh;
background: linear-gradient(180deg, #f7dc51 0%, #fff 28%, #fff8e1 100%);
background: linear-gradient(180deg, #c4b5fd 0%, #fff 28%, #f5f3ff 100%);
box-sizing: border-box;
}

View File

@@ -144,6 +144,12 @@ Page(createPage({
if (app.globalData.ossImageUrl) {
this.setupImageUrls();
}
// 每次进入刷新经营/处罚统计(避免罚单数量卡住不更新)
if (this.data.isShangjia || isMerchantPortalUser()) {
if (!isStaffMode()) {
this.loadDashboardStats();
}
}
this.loadMerchantDataIfNeeded();
},

View File

@@ -6,7 +6,7 @@
"chenghao-tag": "/components/chenghao-tag/chenghao-tag"
},
"navigationStyle": "custom",
"backgroundColor": "#fff8e1",
"backgroundColor": "#f5f3ff",
"backgroundTextStyle": "dark",
"enablePullDownRefresh": true
}

View File

@@ -1,7 +1,7 @@
@import '../../styles/shangjia-xym-common.wxss';
page {
background: #fff8e1;
background: #f5f3ff;
}
.user-page {
@@ -100,7 +100,7 @@ page {
font-size: 24rpx;
font-weight: 600;
color: #7a5a12;
background: linear-gradient(180deg, #fff8e1, #ffe9b8);
background: linear-gradient(180deg, #f5f3ff, #ffe9b8);
border: 1rpx solid #e8c547;
border-radius: 28rpx;
box-shadow: 0 2rpx 8rpx rgba(200, 160, 40, 0.15);
@@ -279,7 +279,7 @@ page {
width: 60rpx;
height: 60rpx;
border: 4rpx solid rgba(0, 0, 0, 0.08);
border-top-color: #ffd061;
border-top-color: #9333ea;
border-radius: 50%;
animation: sjSpin 0.8s linear infinite;
}

View File

@@ -141,7 +141,7 @@ page {
line-height: 1.2;
}
.gradient-bg {
background: linear-gradient(to right, rgba(255, 208, 97, 0.05), rgba(255, 208, 97, 0.15));
background: linear-gradient(to right, rgba(147, 51, 234, 0.05), rgba(147, 51, 234, 0.15));
}
.title-text {
font-size: 34rpx;

View File

@@ -25,7 +25,7 @@
class="xym-lunbo-swiper"
indicator-dots="{{lunboList.length > 1}}"
indicator-color="rgba(255,255,255,0.6)"
indicator-active-color="#ffd061"
indicator-active-color="#9333ea"
autoplay="{{lunboList.length > 1}}"
interval="4000"
circular

View File

@@ -66,7 +66,7 @@
margin-bottom: 30rpx;
background: linear-gradient(180deg, #fae04d, #ffc0a3);
border-radius: 10rpx;
box-shadow: 0 8rpx 24rpx rgba(180, 130, 20, 0.25);
box-shadow: 0 8rpx 24rpx rgba(124, 58, 237, 0.25);
}
.icon-lock::before {
@@ -77,7 +77,7 @@
transform: translateX(-50%);
width: 44rpx;
height: 36rpx;
border: 8rpx solid #ffd061;
border: 8rpx solid #9333ea;
border-bottom: none;
border-radius: 22rpx 22rpx 0 0;
box-sizing: border-box;