本地备份:消息系统改造前完整版本(未推送,便于回退)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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}}"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@import '../../styles/dashou-xym-order-card.wxss';
|
||||
|
||||
page {
|
||||
background-color: #f7dc51;
|
||||
background-color: #c4b5fd;
|
||||
}
|
||||
|
||||
.qiangdan-page {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "接单考试",
|
||||
"navigationBarBackgroundColor": "#f7dc51",
|
||||
"navigationBarBackgroundColor": "#c4b5fd",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"chenghao-tag": "/components/chenghao-tag/chenghao-tag"
|
||||
},
|
||||
"backgroundTextStyle": "dark",
|
||||
"navigationBarBackgroundColor": "#fff8e1",
|
||||
"navigationBarBackgroundColor": "#f5f3ff",
|
||||
"navigationBarTitleText": "常规发单",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#f5f5f5",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"pindao-modal": "/components/pindao-modal/pindao-modal"
|
||||
},
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#fff8e1",
|
||||
"backgroundColor": "#f5f3ff",
|
||||
"backgroundTextStyle": "dark",
|
||||
"enablePullDownRefresh": false,
|
||||
"onReachBottomDistance": 50
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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('撤回');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@import '../../styles/shangjia-xym-common.wxss';
|
||||
|
||||
page { background: #fff8e1; }
|
||||
page { background: #f5f3ff; }
|
||||
|
||||
.sub-scroll { height: calc(100vh - 120rpx); }
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"popup-notice": "/components/popup-notice/popup-notice"
|
||||
},
|
||||
"backgroundTextStyle": "dark",
|
||||
"navigationBarBackgroundColor": "#fff8e1",
|
||||
"navigationBarBackgroundColor": "#f5f3ff",
|
||||
"navigationBarTitleText": "自定义发单",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#f5f5f5",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": true,
|
||||
"backgroundColor": "#fff8e1",
|
||||
"backgroundColor": "#f5f3ff",
|
||||
"backgroundTextStyle": "dark",
|
||||
"usingComponents": {
|
||||
"global-notification": "/components/global-notification/global-notification",
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#fff8e1",
|
||||
"backgroundColor": "#f5f3ff",
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#fff8e1",
|
||||
"backgroundColor": "#f5f3ff",
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
"chenghao-tag": "/components/chenghao-tag/chenghao-tag"
|
||||
},
|
||||
"backgroundTextStyle": "dark",
|
||||
"navigationBarBackgroundColor": "#fff8e1",
|
||||
"navigationBarBackgroundColor": "#f5f3ff",
|
||||
"navigationBarTitleText": "常规发单",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#f5f5f5",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,12 @@ Page(createPage({
|
||||
if (app.globalData.ossImageUrl) {
|
||||
this.setupImageUrls();
|
||||
}
|
||||
// 每次进入刷新经营/处罚统计(避免罚单数量卡住不更新)
|
||||
if (this.data.isShangjia || isMerchantPortalUser()) {
|
||||
if (!isStaffMode()) {
|
||||
this.loadDashboardStats();
|
||||
}
|
||||
}
|
||||
this.loadMerchantDataIfNeeded();
|
||||
},
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"chenghao-tag": "/components/chenghao-tag/chenghao-tag"
|
||||
},
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#fff8e1",
|
||||
"backgroundColor": "#f5f3ff",
|
||||
"backgroundTextStyle": "dark",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"ignoreUploadUnusedFiles": true,
|
||||
"compileWorklet": false,
|
||||
"uglifyFileName": false,
|
||||
"uploadWithSourceMap": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"packNpmManually": false,
|
||||
"minifyWXSS": true,
|
||||
"minifyWXML": true,
|
||||
@@ -25,8 +25,7 @@
|
||||
"useCompilerPlugins": false,
|
||||
"condition": false,
|
||||
"swc": false,
|
||||
"disableSWC": true,
|
||||
"urlCheck": false
|
||||
"disableSWC": true
|
||||
},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
@@ -35,36 +34,7 @@
|
||||
},
|
||||
"libVersion": "3.14.3",
|
||||
"packOptions": {
|
||||
"ignore": [
|
||||
{
|
||||
"value": ".vs",
|
||||
"type": "folder"
|
||||
},
|
||||
{
|
||||
"value": "_backup_pre_redesign",
|
||||
"type": "folder"
|
||||
},
|
||||
{
|
||||
"value": ".md",
|
||||
"type": "suffix"
|
||||
},
|
||||
{
|
||||
"value": ".vsidx",
|
||||
"type": "suffix"
|
||||
},
|
||||
{
|
||||
"value": "project.private.config.json",
|
||||
"type": "file"
|
||||
},
|
||||
{
|
||||
"value": "static/lib/restapi.js",
|
||||
"type": "file"
|
||||
},
|
||||
{
|
||||
"value": "static/lib/EmojiDecoder.js",
|
||||
"type": "file"
|
||||
}
|
||||
],
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"appid": "wx0e4be86faac4a8d1",
|
||||
|
||||
@@ -17,22 +17,22 @@
|
||||
box-shadow: 0 10rpx 28rpx rgba(0, 0, 0, 0.09);
|
||||
}
|
||||
|
||||
/* 平台订单 */
|
||||
/* 平台订单 - 紫色主题 */
|
||||
.xym-pingtai-order {
|
||||
padding-bottom: 5rpx;
|
||||
background: #927a46;
|
||||
background: #7c3aed;
|
||||
}
|
||||
|
||||
.xym-pingtai-head {
|
||||
height: 72rpx;
|
||||
padding: 0 24rpx;
|
||||
background: linear-gradient(50deg, #957c48, #5c4a28);
|
||||
background: linear-gradient(50deg, #6d28d9, #9333ea);
|
||||
border-radius: 30rpx 30rpx 0 0;
|
||||
}
|
||||
|
||||
.xym-head-time {
|
||||
font-size: 24rpx;
|
||||
color: #fcd270;
|
||||
color: #e9d5ff;
|
||||
}
|
||||
|
||||
.xym-head-tag {
|
||||
@@ -40,21 +40,21 @@
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
font-weight: 600;
|
||||
background: rgba(252, 210, 112, 0.22);
|
||||
color: #fcd270;
|
||||
border: 1rpx solid rgba(252, 210, 112, 0.4);
|
||||
background: rgba(196, 181, 253, 0.28);
|
||||
color: #f5f3ff;
|
||||
border: 1rpx solid rgba(196, 181, 253, 0.55);
|
||||
}
|
||||
|
||||
.xym-pingtai-body {
|
||||
border-radius: 40rpx 10rpx 30rpx 30rpx;
|
||||
padding: 0 20rpx 24rpx;
|
||||
background: linear-gradient(to bottom, #3a3220, #cec180);
|
||||
background: linear-gradient(to bottom, #5b21b6, #c4b5fd);
|
||||
}
|
||||
|
||||
/* 商家订单 */
|
||||
.xym-shangjia-order {
|
||||
padding-bottom: 5rpx;
|
||||
background: linear-gradient(to bottom, #fff8e1, #ffe0b2);
|
||||
background: linear-gradient(to bottom, #f5f3ff, #ddd6fe);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
.xym-shangjia-head .xym-head-tag {
|
||||
background: rgba(255, 255, 255, 0.65);
|
||||
color: #492f00;
|
||||
border-color: rgba(255, 208, 97, 0.5);
|
||||
border-color: rgba(147, 51, 234, 0.5);
|
||||
}
|
||||
|
||||
.order-con {
|
||||
@@ -213,7 +213,6 @@
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
/* 金牌卡底部商家条 */
|
||||
.gold-card .merchant-strip {
|
||||
margin: 16rpx 6rpx 0;
|
||||
padding: 16rpx 20rpx;
|
||||
@@ -296,7 +295,7 @@
|
||||
}
|
||||
|
||||
.xym-pingtai-body .zhiding-strip .zhiding-name {
|
||||
color: #f5e6b8;
|
||||
color: #ede9fe;
|
||||
}
|
||||
|
||||
.reward-badge {
|
||||
@@ -313,13 +312,13 @@
|
||||
}
|
||||
|
||||
.reward-badge.normal-reward {
|
||||
color: #492f00;
|
||||
background: linear-gradient(to bottom, #fae04d, #ffc0a3);
|
||||
color: #4c1d95;
|
||||
background: linear-gradient(to bottom, #c4b5fd, #a78bfa);
|
||||
}
|
||||
|
||||
.reward-badge.platform-reward {
|
||||
color: #fff;
|
||||
background: linear-gradient(to right, #dabd83, #704029);
|
||||
background: linear-gradient(to right, #9333ea, #c4b5fd);
|
||||
}
|
||||
|
||||
.xym-shangjia-body .reward-badge:not(.member-tip) {
|
||||
@@ -368,8 +367,8 @@
|
||||
|
||||
.remark-block.gold {
|
||||
color: #fff;
|
||||
border-color: #ffd700;
|
||||
background: rgba(255, 215, 0, 0.12);
|
||||
border-color: #c4b5fd;
|
||||
background: rgba(196, 181, 253, 0.12);
|
||||
}
|
||||
|
||||
.remark-block.dark {
|
||||
@@ -383,7 +382,7 @@
|
||||
}
|
||||
|
||||
.remark-block.gold .remark-label {
|
||||
color: #ffd700;
|
||||
color: #c4b5fd;
|
||||
}
|
||||
|
||||
.remark-block.dark .remark-label {
|
||||
@@ -418,17 +417,17 @@
|
||||
}
|
||||
|
||||
.o-amt.light {
|
||||
color: #f5e6b8;
|
||||
color: #ede9fe;
|
||||
}
|
||||
|
||||
.btn-bg {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3);
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa);
|
||||
border-radius: 60rpx;
|
||||
color: #492f00;
|
||||
color: #4c1d95;
|
||||
}
|
||||
|
||||
.qiangdan {
|
||||
color: #492f00;
|
||||
color: #4c1d95;
|
||||
width: 180rpx;
|
||||
min-width: 100rpx;
|
||||
padding: 15rpx 10rpx;
|
||||
@@ -440,8 +439,8 @@
|
||||
}
|
||||
|
||||
.qiangdan.btn-qiang-brown {
|
||||
background: linear-gradient(to right, #7a4a2d 0%, #e4ce94 100%) !important;
|
||||
color: #000 !important;
|
||||
background: linear-gradient(to right, #7c3aed 0%, #c4b5fd 100%) !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.view-more-inline {
|
||||
@@ -463,7 +462,7 @@
|
||||
padding-right: 12rpx;
|
||||
}
|
||||
|
||||
/* 优质商家金牌卡片 — 与逍遥梦 ui-preview 一致 */
|
||||
/* 优质商家金牌卡片 */
|
||||
.xym-order-item.gold-card {
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: 30rpx;
|
||||
@@ -673,29 +672,31 @@
|
||||
padding: 0 10rpx 6rpx;
|
||||
}
|
||||
|
||||
/* 公告条 */
|
||||
.xym-gonggao-bar {
|
||||
.merchant-plain {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #fdf9db;
|
||||
margin: 0 24rpx 0;
|
||||
border-radius: 10rpx;
|
||||
padding: 10rpx 16rpx;
|
||||
}
|
||||
|
||||
.xym-gonggao-ico {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 12rpx;
|
||||
.merchant-user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.xym-gonggao-txt {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
.m-info {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.dark-t {
|
||||
color: #e8c547;
|
||||
}
|
||||
|
||||
.o-amt-grey {
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.65);
|
||||
}
|
||||
|
||||
.kehuduan-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
}
|
||||
|
||||
.leixing-item.leixing-active {
|
||||
background: linear-gradient(180deg, #fff0c2, #f5d563) !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(255, 208, 97, 0.35) !important;
|
||||
background: linear-gradient(180deg, #ede9fe, #c4b5fd) !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(147, 51, 234, 0.35) !important;
|
||||
}
|
||||
|
||||
.leixing-active .leixing-name {
|
||||
@@ -32,14 +32,14 @@
|
||||
}
|
||||
|
||||
.type-btn.type-active {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
color: #492f00 !important;
|
||||
box-shadow: 0 2rpx 8rpx rgba(180, 130, 20, 0.2) !important;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
background: #fff !important;
|
||||
border: 1rpx solid rgba(255, 208, 97, 0.3) !important;
|
||||
border: 1rpx solid rgba(147, 51, 234, 0.3) !important;
|
||||
}
|
||||
|
||||
.left-status {
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
|
||||
.status-item.status-active {
|
||||
background: #fff8e1 !important;
|
||||
background: #f5f3ff !important;
|
||||
}
|
||||
|
||||
.status-active .status-name {
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
background: #ffd061 !important;
|
||||
background: #9333ea !important;
|
||||
}
|
||||
|
||||
.right-list {
|
||||
@@ -74,11 +74,11 @@
|
||||
|
||||
.loading-spinner,
|
||||
.mini-spinner {
|
||||
border-top-color: #ffd061 !important;
|
||||
border-top-color: #9333ea !important;
|
||||
}
|
||||
|
||||
.load-more-btn {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
color: #492f00 !important;
|
||||
border: 2rpx solid #fff !important;
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@ page {
|
||||
.role-chip {
|
||||
background: rgba(255, 255, 255, 0.8) !important;
|
||||
color: #666 !important;
|
||||
border: 2rpx solid rgba(255, 208, 97, 0.25) !important;
|
||||
border: 2rpx solid rgba(147, 51, 234, 0.25) !important;
|
||||
}
|
||||
|
||||
.role-chip.on {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
color: #492f00 !important;
|
||||
border-color: #ffd061 !important;
|
||||
border-color: #9333ea !important;
|
||||
font-weight: 700 !important;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ page {
|
||||
}
|
||||
|
||||
.date-chip.on {
|
||||
background: #fef6d4 !important;
|
||||
background: #ede9fe !important;
|
||||
color: #492f00 !important;
|
||||
font-weight: 700 !important;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ page {
|
||||
}
|
||||
|
||||
.my-rank-bar {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
}
|
||||
|
||||
.my-rank-bar text {
|
||||
@@ -88,5 +88,5 @@ page {
|
||||
}
|
||||
|
||||
.loader {
|
||||
border-top-color: #ffd061 !important;
|
||||
border-top-color: #9333ea !important;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* 打手充值页 - 逍遥梦风格视觉覆盖(不改 wxml/逻辑) */
|
||||
|
||||
.page-container {
|
||||
background: linear-gradient(180deg, #f7dc51 0%, #fff 22%, #fff8e1 100%) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd 0%, #fff 22%, #f5f3ff 100%) !important;
|
||||
}
|
||||
|
||||
.page-container::before {
|
||||
@@ -19,18 +19,18 @@
|
||||
|
||||
.dec-line,
|
||||
.dec-diamond {
|
||||
background: #ffd061 !important;
|
||||
background: #9333ea !important;
|
||||
}
|
||||
|
||||
.vip-card {
|
||||
background: #fdfcfa !important;
|
||||
border: 2rpx solid rgba(255, 208, 97, 0.5) !important;
|
||||
border: 2rpx solid rgba(147, 51, 234, 0.5) !important;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08) !important;
|
||||
}
|
||||
|
||||
.vip-card.active {
|
||||
border-color: #ffd061 !important;
|
||||
box-shadow: 0 8rpx 28rpx rgba(255, 208, 97, 0.35) !important;
|
||||
border-color: #9333ea !important;
|
||||
box-shadow: 0 8rpx 28rpx rgba(147, 51, 234, 0.35) !important;
|
||||
}
|
||||
|
||||
.card-frame,
|
||||
@@ -69,7 +69,7 @@
|
||||
.tech-buy-btn,
|
||||
.tech-btn,
|
||||
.modal-btn.confirm-btn {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
border: 2rpx solid #fff !important;
|
||||
border-radius: 44rpx !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(180, 130, 20, 0.25) !important;
|
||||
@@ -122,8 +122,8 @@
|
||||
|
||||
.huiyuan-tag,
|
||||
.tech-tag {
|
||||
background: #fef6d4 !important;
|
||||
border: 1rpx solid rgba(255, 208, 97, 0.4) !important;
|
||||
background: #ede9fe !important;
|
||||
border: 1rpx solid rgba(147, 51, 234, 0.4) !important;
|
||||
}
|
||||
|
||||
.tag-name {
|
||||
@@ -135,7 +135,7 @@
|
||||
}
|
||||
|
||||
.tech-line {
|
||||
background: linear-gradient(90deg, transparent, #ffd061, transparent) !important;
|
||||
background: linear-gradient(90deg, transparent, #9333ea, transparent) !important;
|
||||
}
|
||||
|
||||
.tech-modal .modal-container {
|
||||
@@ -168,13 +168,13 @@
|
||||
}
|
||||
|
||||
.quick-btn {
|
||||
background: #fef6d4 !important;
|
||||
border: 2rpx solid rgba(255, 208, 97, 0.4) !important;
|
||||
background: #ede9fe !important;
|
||||
border: 2rpx solid rgba(147, 51, 234, 0.4) !important;
|
||||
}
|
||||
|
||||
.quick-btn.active {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
border-color: #ffd061 !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
border-color: #9333ea !important;
|
||||
}
|
||||
|
||||
.quick-text {
|
||||
@@ -182,7 +182,7 @@
|
||||
}
|
||||
|
||||
.pay-method-item {
|
||||
background: #fef6d4 !important;
|
||||
background: #ede9fe !important;
|
||||
border-radius: 16rpx !important;
|
||||
}
|
||||
|
||||
@@ -204,8 +204,8 @@
|
||||
}
|
||||
|
||||
.spinner-ring {
|
||||
border-color: rgba(255, 208, 97, 0.3) !important;
|
||||
border-top-color: #ffd061 !important;
|
||||
border-color: rgba(147, 51, 234, 0.3) !important;
|
||||
border-top-color: #9333ea !important;
|
||||
}
|
||||
|
||||
.tech-footer .footer-text {
|
||||
|
||||
@@ -15,6 +15,33 @@
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.xym-gonggao-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #f5f3ff;
|
||||
margin: 0 24rpx 8rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 10rpx 16rpx;
|
||||
border: 1rpx solid rgba(147, 51, 234, 0.15);
|
||||
}
|
||||
|
||||
.xym-gonggao-ico {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.xym-gonggao-txt {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.xym-lunbo-swiper {
|
||||
height: 300rpx;
|
||||
border-radius: 20rpx;
|
||||
@@ -27,7 +54,7 @@
|
||||
}
|
||||
|
||||
.qiangdan-page {
|
||||
background: linear-gradient(180deg, #f7dc51 0%, #fff 28%, #fff8e1 100%) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd 0%, #fff 28%, #f5f3ff 100%) !important;
|
||||
}
|
||||
|
||||
.qiangdan-page::before {
|
||||
@@ -37,19 +64,39 @@
|
||||
.leixing-quyu {
|
||||
background: #fff !important;
|
||||
border-bottom: none !important;
|
||||
box-shadow: 0 4rpx 14rpx rgba(0, 0, 0, 0.06) !important;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06) !important;
|
||||
margin: 6rpx 20rpx 8rpx !important;
|
||||
border-radius: 28rpx !important;
|
||||
padding: 14rpx 0 8rpx !important;
|
||||
border: 2rpx solid rgba(255, 224, 130, 0.5) !important;
|
||||
padding: 16rpx 0 12rpx !important;
|
||||
overflow: visible !important;
|
||||
position: relative !important;
|
||||
z-index: 2 !important;
|
||||
border: 2rpx solid rgba(196, 181, 253, 0.45) !important;
|
||||
}
|
||||
|
||||
.leixing-scroll {
|
||||
height: 132rpx !important;
|
||||
width: 100% !important;
|
||||
height: 168rpx !important;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
.leixing-container {
|
||||
display: inline-flex !important;
|
||||
padding: 0 24rpx !important;
|
||||
gap: 16rpx !important;
|
||||
}
|
||||
|
||||
.leixing-item {
|
||||
width: 120rpx !important;
|
||||
display: inline-flex !important;
|
||||
flex-direction: column !important;
|
||||
align-items: center !important;
|
||||
position: relative !important;
|
||||
flex-shrink: 0 !important;
|
||||
}
|
||||
|
||||
.leixing-active {
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
.leixing-tupian {
|
||||
@@ -58,11 +105,13 @@
|
||||
border-radius: 20rpx !important;
|
||||
border: none !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08) !important;
|
||||
position: relative !important;
|
||||
z-index: 1 !important;
|
||||
}
|
||||
|
||||
.leixing-active .leixing-tupian {
|
||||
border: 3rpx solid #ffd061 !important;
|
||||
box-shadow: 0 6rpx 16rpx rgba(255, 208, 97, 0.45) !important;
|
||||
border: 3rpx solid #9333ea !important;
|
||||
box-shadow: 0 6rpx 16rpx rgba(147, 51, 234, 0.45) !important;
|
||||
}
|
||||
|
||||
.leixing-jieshao {
|
||||
@@ -70,36 +119,83 @@
|
||||
font-size: 22rpx !important;
|
||||
color: #666 !important;
|
||||
text-shadow: none !important;
|
||||
max-width: 120rpx !important;
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis !important;
|
||||
white-space: nowrap !important;
|
||||
text-align: center !important;
|
||||
line-height: 1.3 !important;
|
||||
position: relative !important;
|
||||
z-index: 1 !important;
|
||||
}
|
||||
|
||||
.leixing-active .leixing-jieshao {
|
||||
color: #492f00 !important;
|
||||
color: #6d28d9 !important;
|
||||
font-weight: 700 !important;
|
||||
}
|
||||
|
||||
.guangyun-effect {
|
||||
background: radial-gradient(circle, rgba(255, 208, 97, 0.35) 0%, transparent 70%) !important;
|
||||
background: radial-gradient(circle, rgba(147, 51, 234, 0.28) 0%, transparent 72%) !important;
|
||||
top: -8rpx !important;
|
||||
left: -8rpx !important;
|
||||
right: -8rpx !important;
|
||||
bottom: -8rpx !important;
|
||||
z-index: 0 !important;
|
||||
}
|
||||
|
||||
.biaoqian-quyu {
|
||||
background: transparent !important;
|
||||
padding: 8rpx 20rpx 0 !important;
|
||||
padding: 4rpx 20rpx 8rpx !important;
|
||||
margin: 0 0 4rpx !important;
|
||||
position: relative !important;
|
||||
z-index: 1 !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.biaoqian-scroll {
|
||||
width: 100% !important;
|
||||
height: auto !important;
|
||||
min-height: 72rpx !important;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
.biaoqian-container {
|
||||
display: inline-flex !important;
|
||||
align-items: center !important;
|
||||
gap: 16rpx !important;
|
||||
padding: 4rpx 0 8rpx !important;
|
||||
}
|
||||
|
||||
.biaoqian-item {
|
||||
display: inline-flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
min-height: 52rpx !important;
|
||||
padding: 6rpx 16rpx !important;
|
||||
border-radius: 20rpx !important;
|
||||
background: rgba(255, 255, 255, 0.65) !important;
|
||||
border: 2rpx solid rgba(201, 162, 39, 0.25) !important;
|
||||
border: 2rpx solid rgba(147, 51, 234, 0.25) !important;
|
||||
flex-shrink: 0 !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
|
||||
.biaoqian-active {
|
||||
background: linear-gradient(180deg, #fff0c2, #f5d563) !important;
|
||||
border-color: rgba(180, 130, 20, 0.85) !important;
|
||||
background: linear-gradient(180deg, #ede9fe, #c4b5fd) !important;
|
||||
border-color: rgba(124, 58, 237, 0.85) !important;
|
||||
}
|
||||
|
||||
.quanbu-text {
|
||||
font-size: 24rpx !important;
|
||||
color: #666 !important;
|
||||
line-height: 1.2 !important;
|
||||
}
|
||||
|
||||
.fenge-xian {
|
||||
background: linear-gradient(90deg, transparent, #ffd061, transparent) !important;
|
||||
background: linear-gradient(90deg, transparent, #9333ea, transparent) !important;
|
||||
opacity: 0.6 !important;
|
||||
margin: 6rpx 30rpx 0 !important;
|
||||
margin: 8rpx 30rpx 0 !important;
|
||||
height: 2rpx !important;
|
||||
flex-shrink: 0 !important;
|
||||
}
|
||||
|
||||
.dingdan-list {
|
||||
@@ -109,7 +205,7 @@
|
||||
|
||||
.refreshing-text,
|
||||
.pull-down-text {
|
||||
color: #6b5420 !important;
|
||||
color: #7c3aed !important;
|
||||
text-shadow: none !important;
|
||||
}
|
||||
|
||||
@@ -129,7 +225,7 @@
|
||||
}
|
||||
|
||||
.pingtai-card {
|
||||
background: linear-gradient(to bottom, #927a46, #cec180) !important;
|
||||
background: linear-gradient(to bottom, #7c3aed, #c4b5fd) !important;
|
||||
padding: 0 0 16rpx !important;
|
||||
}
|
||||
|
||||
@@ -140,7 +236,7 @@
|
||||
|
||||
.pingtai-card .card-top,
|
||||
.shangjia-card .card-top {
|
||||
background: linear-gradient(50deg, #957c48, #5c4a28) !important;
|
||||
background: linear-gradient(50deg, #6d28d9, #9333ea) !important;
|
||||
border-radius: 28rpx 28rpx 0 0 !important;
|
||||
margin: -28rpx -24rpx 16rpx !important;
|
||||
padding: 16rpx 24rpx !important;
|
||||
@@ -148,11 +244,11 @@
|
||||
|
||||
.pingtai-tag,
|
||||
.creat-time {
|
||||
color: #fcd270 !important;
|
||||
color: #ede9fe !important;
|
||||
}
|
||||
|
||||
.shangjia-card {
|
||||
background: linear-gradient(to bottom, #fff8e1, #ffe0b2) !important;
|
||||
background: linear-gradient(to bottom, #f5f3ff, #ddd6fe) !important;
|
||||
}
|
||||
|
||||
.card-content,
|
||||
@@ -176,26 +272,26 @@
|
||||
}
|
||||
|
||||
.fenyong-box {
|
||||
background: linear-gradient(to bottom, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(to bottom, #c4b5fd, #a78bfa) !important;
|
||||
border-radius: 30rpx !important;
|
||||
}
|
||||
|
||||
.fenyong-text,
|
||||
.fenyong-price,
|
||||
.fenyong-unit {
|
||||
color: #492f00 !important;
|
||||
color: #4c1d95 !important;
|
||||
}
|
||||
|
||||
.qiangdan-btn,
|
||||
.mecha-btn {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
border: 2rpx solid #fff !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(180, 130, 20, 0.25) !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(124, 58, 237, 0.25) !important;
|
||||
}
|
||||
|
||||
.qiangdan-btn .btn-text,
|
||||
.mecha-btn .btn-text {
|
||||
color: #492f00 !important;
|
||||
color: #4c1d95 !important;
|
||||
}
|
||||
|
||||
.btn-shine,
|
||||
@@ -205,7 +301,7 @@
|
||||
}
|
||||
|
||||
.loading-mask {
|
||||
background: rgba(255, 248, 225, 0.85) !important;
|
||||
background: rgba(245, 243, 255, 0.85) !important;
|
||||
}
|
||||
|
||||
.loading-mask-text,
|
||||
@@ -215,7 +311,7 @@
|
||||
}
|
||||
|
||||
.unauthorized-container {
|
||||
background: linear-gradient(180deg, #f7dc51, #fff 50%) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #fff 50%) !important;
|
||||
}
|
||||
|
||||
.unauthorized-card {
|
||||
@@ -234,12 +330,12 @@
|
||||
}
|
||||
|
||||
.btn-register {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
border-radius: 44rpx !important;
|
||||
}
|
||||
|
||||
.btn-register .btn-text {
|
||||
color: #492f00 !important;
|
||||
color: #4c1d95 !important;
|
||||
}
|
||||
|
||||
.card-glow {
|
||||
@@ -255,15 +351,15 @@
|
||||
}
|
||||
|
||||
.tag-platform {
|
||||
background: rgba(252, 210, 112, 0.22);
|
||||
color: #fcd270;
|
||||
border: 1rpx solid rgba(252, 210, 112, 0.45);
|
||||
background: rgba(196, 181, 253, 0.28);
|
||||
color: #ede9fe;
|
||||
border: 1rpx solid rgba(196, 181, 253, 0.55);
|
||||
}
|
||||
|
||||
.tag-merchant {
|
||||
background: rgba(255, 255, 255, 0.45);
|
||||
color: #492f00;
|
||||
border: 1rpx solid rgba(255, 208, 97, 0.55);
|
||||
color: #6d28d9;
|
||||
border: 1rpx solid rgba(147, 51, 234, 0.55);
|
||||
}
|
||||
|
||||
.fenyong-mark {
|
||||
@@ -273,7 +369,7 @@
|
||||
text-align: center;
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
color: #492f00;
|
||||
color: #4c1d95;
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
border-radius: 50%;
|
||||
margin-right: 8rpx;
|
||||
@@ -295,29 +391,3 @@
|
||||
font-weight: 700 !important;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
/* 手动刷新悬浮钮(抢单池 / 接单页) */
|
||||
.refresh-float {
|
||||
position: fixed;
|
||||
right: 24rpx;
|
||||
top: calc(env(safe-area-inset-top) + 88rpx);
|
||||
z-index: 20;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.12);
|
||||
border: 2rpx solid rgba(255, 208, 97, 0.45);
|
||||
}
|
||||
|
||||
.refresh-float:active {
|
||||
transform: scale(0.96);
|
||||
}
|
||||
|
||||
.refresh-float-ico {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 30rpx;
|
||||
position: relative;
|
||||
background: linear-gradient(to bottom, #fff8e1, #ffe0b2);
|
||||
background: linear-gradient(to bottom, #f5f3ff, #ddd6fe);
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 12rpx 32rpx rgba(0, 0, 0, 0.12);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: linear-gradient(180deg, #f7dc51 0%, #fff 28%, #fff8e1 100%);
|
||||
background: linear-gradient(180deg, #c4b5fd 0%, #fff 28%, #f5f3ff 100%);
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -49,13 +49,13 @@
|
||||
font-weight: 700;
|
||||
border: 2rpx solid #fff;
|
||||
border-radius: 60rpx;
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3);
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa);
|
||||
color: #492f00;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sj-btn-bg {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3);
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa);
|
||||
border-radius: 60rpx;
|
||||
color: #492f00;
|
||||
font-weight: 700;
|
||||
@@ -66,7 +66,7 @@
|
||||
font-size: 20rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 8rpx;
|
||||
background: #ff9900;
|
||||
background: #8b5cf6;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
margin: 0 30rpx;
|
||||
padding: 24rpx 20rpx;
|
||||
border-radius: 26rpx;
|
||||
background: #fef6d4;
|
||||
background: #ede9fe;
|
||||
}
|
||||
|
||||
.sj-w-label {
|
||||
@@ -129,11 +129,11 @@
|
||||
}
|
||||
|
||||
.sj-fadan-btn--regular {
|
||||
background: linear-gradient(135deg, #fff8e1, #ffe0b2);
|
||||
background: linear-gradient(135deg, #f5f3ff, #ddd6fe);
|
||||
}
|
||||
|
||||
.sj-fadan-btn--custom {
|
||||
background: linear-gradient(135deg, #fef6d4, #f5d563);
|
||||
background: linear-gradient(135deg, #ede9fe, #c4b5fd);
|
||||
}
|
||||
|
||||
.sj-fadan-title {
|
||||
@@ -219,7 +219,7 @@
|
||||
text-align: center;
|
||||
padding: 16rpx 8rpx;
|
||||
border-radius: 12rpx;
|
||||
background: linear-gradient(180deg, #fff8e1, #fef6d4);
|
||||
background: linear-gradient(180deg, #f5f3ff, #ede9fe);
|
||||
font-size: 24rpx;
|
||||
color: #492f00;
|
||||
font-weight: 600;
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
padding: 24rpx;
|
||||
padding-bottom: 160rpx;
|
||||
box-sizing: border-box;
|
||||
background: linear-gradient(180deg, #f7dc51 0%, #f5f5f5 18%, #f5f5f5 100%);
|
||||
background: linear-gradient(180deg, #c4b5fd 0%, #f5f5f5 18%, #f5f5f5 100%);
|
||||
}
|
||||
|
||||
.sj-form-theme .balance-card {
|
||||
background: #fef6d4 !important;
|
||||
background: #ede9fe !important;
|
||||
border-radius: 26rpx !important;
|
||||
padding: 28rpx 24rpx !important;
|
||||
margin-bottom: 20rpx !important;
|
||||
@@ -76,7 +76,7 @@
|
||||
}
|
||||
|
||||
.sj-form-theme .card-dot {
|
||||
background: #ffd061 !important;
|
||||
background: #9333ea !important;
|
||||
}
|
||||
|
||||
.sj-form-theme .card-title,
|
||||
@@ -108,12 +108,12 @@
|
||||
|
||||
.sj-form-theme .type-chip--active,
|
||||
.sj-form-theme .type-active {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
color: #492f00 !important;
|
||||
font-weight: 700 !important;
|
||||
border: none !important;
|
||||
transform: none !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(255, 208, 97, 0.35) !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(147, 51, 234, 0.35) !important;
|
||||
}
|
||||
|
||||
.sj-form-theme .type-text {
|
||||
@@ -161,11 +161,11 @@
|
||||
}
|
||||
|
||||
.sj-form-theme .submit-btn {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
color: #492f00 !important;
|
||||
border-radius: 44rpx !important;
|
||||
font-weight: 700 !important;
|
||||
box-shadow: 0 6rpx 16rpx rgba(255, 208, 97, 0.35) !important;
|
||||
box-shadow: 0 6rpx 16rpx rgba(147, 51, 234, 0.35) !important;
|
||||
}
|
||||
|
||||
.sj-form-theme .submit-bar {
|
||||
@@ -174,7 +174,7 @@
|
||||
}
|
||||
|
||||
.sj-form-theme switch {
|
||||
color: #ffd061 !important;
|
||||
color: #9333ea !important;
|
||||
}
|
||||
|
||||
.sj-form-theme .search-section {
|
||||
@@ -197,7 +197,7 @@
|
||||
}
|
||||
|
||||
.sj-form-theme .search-btn {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
.sj-form-theme .generate-grid-btn,
|
||||
.sj-form-theme .copy-grid-btn,
|
||||
.sj-form-theme .action-grid-btn {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
color: #492f00 !important;
|
||||
border: 2rpx solid #fff !important;
|
||||
box-shadow: none !important;
|
||||
@@ -250,7 +250,7 @@
|
||||
}
|
||||
|
||||
.sj-form-theme .tutorial-btn {
|
||||
background: linear-gradient(180deg, #fae04d, #ffc0a3) !important;
|
||||
background: linear-gradient(180deg, #c4b5fd, #a78bfa) !important;
|
||||
color: #492f00 !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1) !important;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
}
|
||||
|
||||
.c-tab-txt-on {
|
||||
color: #ffd061;
|
||||
color: #9333ea;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
1325
utils/chat-core.js
1325
utils/chat-core.js
File diff suppressed because it is too large
Load Diff
25
utils/grab-order-gate.js
Normal file
25
utils/grab-order-gate.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 抢单前检查(仅点击抢单时调用)
|
||||
*/
|
||||
import request from './request.js';
|
||||
|
||||
/** 检查是否有待处理罚款(待缴纳 / 申诉中) */
|
||||
export async function checkPenaltyForGrab() {
|
||||
try {
|
||||
const res = await request({ url: '/yonghu/cffktjhq', method: 'POST' });
|
||||
if (res?.data?.code === 0) {
|
||||
const fk = res.data.data?.fakuan || {};
|
||||
const pending = Number(fk.daijiaona || 0) + Number(fk.shensuzhong || 0);
|
||||
if (pending > 0) {
|
||||
return {
|
||||
blocked: true,
|
||||
msg: '您有未缴纳或申诉中的罚单,请先处理后再抢单',
|
||||
url: '/pages/penalty/penalty/penalty',
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('checkPenaltyForGrab failed', e);
|
||||
}
|
||||
return { blocked: false };
|
||||
}
|
||||
241
utils/group-chat.js
Normal file
241
utils/group-chat.js
Normal file
@@ -0,0 +1,241 @@
|
||||
/**
|
||||
* 打手-商家/老板配对群:group_Ds{打手}_Sj{商家}
|
||||
*/
|
||||
export const ORDER_CARD_PREFIX = '[ORDER_CARD]';
|
||||
|
||||
const ZHUANGTAI_MAP = {
|
||||
1: '已下单', 2: '进行中', 3: '已完成', 4: '退款中',
|
||||
5: '已退款', 6: '退款失败', 7: '指定中', 8: '结算中',
|
||||
};
|
||||
|
||||
export function getZhuangtaiText(zhuangtai) {
|
||||
if (zhuangtai == null || zhuangtai === '') return '';
|
||||
const n = Number(zhuangtai);
|
||||
return ZHUANGTAI_MAP[n] || ZHUANGTAI_MAP[zhuangtai] || '';
|
||||
}
|
||||
|
||||
export function buildDashouShangjiaGroupId(dashouUid, shangjiaUid) {
|
||||
return `group_Ds${dashouUid}_Sj${shangjiaUid}`;
|
||||
}
|
||||
|
||||
export function buildDashouBossGroupId(dashouUid, bossUid) {
|
||||
return `group_Ds${dashouUid}_Boss${bossUid}`;
|
||||
}
|
||||
|
||||
export function resolveLocalGroupId(identityType, myUid, partnerUid, fadanPingtai, orderId, isCross) {
|
||||
const cross = isCross === 1 || isCross === true || String(isCross) === '1';
|
||||
if (cross && orderId) {
|
||||
return `group_${orderId}`;
|
||||
}
|
||||
if (!myUid) return orderId ? `group_${orderId}` : null;
|
||||
if (!partnerUid) return orderId ? `group_${orderId}` : null;
|
||||
if (identityType === 'shangjia') {
|
||||
return buildDashouShangjiaGroupId(partnerUid, myUid);
|
||||
}
|
||||
if (identityType === 'dashou') {
|
||||
if (fadanPingtai === 2 || String(fadanPingtai) === '2') {
|
||||
return buildDashouShangjiaGroupId(myUid, partnerUid);
|
||||
}
|
||||
return buildDashouBossGroupId(myUid, partnerUid);
|
||||
}
|
||||
return orderId ? `group_${orderId}` : null;
|
||||
}
|
||||
|
||||
export function isPairGroupId(groupId) {
|
||||
return /^group_Ds\w+_(Sj|Boss)\w+$/.test(groupId || '');
|
||||
}
|
||||
|
||||
export function parsePairGroupId(groupId) {
|
||||
if (!groupId) return null;
|
||||
let m = /^group_Ds(\w+)_Sj(\w+)$/.exec(groupId);
|
||||
if (m) return { dashouId: `Ds${m[1]}`, partnerId: `Sj${m[2]}`, partnerRole: 'shangjia' };
|
||||
m = /^group_Ds(\w+)_Boss(\w+)$/.exec(groupId);
|
||||
if (m) return { dashouId: `Ds${m[1]}`, partnerId: `Boss${m[2]}`, partnerRole: 'boss' };
|
||||
return null;
|
||||
}
|
||||
|
||||
export function getCounterpartGoEasyId(groupId, myGoEasyId) {
|
||||
const parsed = parsePairGroupId(groupId);
|
||||
if (!parsed || !myGoEasyId) return null;
|
||||
if (myGoEasyId === parsed.dashouId) return parsed.partnerId;
|
||||
if (myGoEasyId === parsed.partnerId) return parsed.dashouId;
|
||||
return null;
|
||||
}
|
||||
|
||||
function fixAvatarUrl(avatar, defaultAvatar, ossBase) {
|
||||
if (!avatar) return defaultAvatar;
|
||||
if (avatar.startsWith('http')) return avatar;
|
||||
return (ossBase || '') + avatar.replace(/^\//, '');
|
||||
}
|
||||
|
||||
/** 根据群 to.data 与当前身份,解析对方/双方展示信息 */
|
||||
export function applyPairMetaToConversation(item, myGoEasyId, defaultAvatar, ossBase) {
|
||||
if (!item || !item.data) return;
|
||||
const d = item.data;
|
||||
|
||||
if (d.dashouGoEasyId && d.partnerGoEasyId) {
|
||||
const isDashou = myGoEasyId === d.dashouGoEasyId;
|
||||
const isPartner = myGoEasyId === d.partnerGoEasyId;
|
||||
d.dashouNicheng = d.dashouName || d.dashouNicheng || '';
|
||||
d.partnerNicheng = d.partnerName || d.partnerNicheng || '';
|
||||
d.dashouAvatar = fixAvatarUrl(d.dashouAvatar, defaultAvatar, ossBase);
|
||||
d.partnerAvatar = fixAvatarUrl(d.partnerAvatar, defaultAvatar, ossBase);
|
||||
|
||||
if (isDashou) {
|
||||
d.counterpartId = d.partnerGoEasyId;
|
||||
d.counterpartYonghuid = d.partnerYonghuid || d.partnerGoEasyId.replace(/^(Sj|Boss)/, '');
|
||||
d.partnerRoleLabel = d.partnerGoEasyId.startsWith('Boss') ? '老板' : '商家';
|
||||
d.name = d.partnerNicheng || `${d.partnerRoleLabel}${d.counterpartYonghuid}`;
|
||||
d.avatar = d.partnerAvatar || defaultAvatar;
|
||||
} else if (isPartner) {
|
||||
d.counterpartId = d.dashouGoEasyId;
|
||||
d.counterpartYonghuid = d.dashouYonghuid || d.dashouGoEasyId.replace(/^Ds/, '');
|
||||
d.name = d.dashouNicheng || `打手${d.counterpartYonghuid}`;
|
||||
d.avatar = d.dashouAvatar || defaultAvatar;
|
||||
} else {
|
||||
const cpId = getCounterpartGoEasyId(item.groupId, myGoEasyId);
|
||||
if (cpId === d.partnerGoEasyId) {
|
||||
d.name = d.partnerNicheng;
|
||||
d.avatar = d.partnerAvatar || defaultAvatar;
|
||||
} else if (cpId === d.dashouGoEasyId) {
|
||||
d.name = d.dashouNicheng;
|
||||
d.avatar = d.dashouAvatar || defaultAvatar;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const counterpartId = getCounterpartGoEasyId(item.groupId, myGoEasyId);
|
||||
if (counterpartId) {
|
||||
d.counterpartId = counterpartId;
|
||||
d.counterpartYonghuid = counterpartId.replace(/^(Ds|Sj|Boss)/, '');
|
||||
if (!d.name || d.name === item.groupId) {
|
||||
d.name = `用户${d.counterpartYonghuid.slice(-6)}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (item.lastMessage && item.lastMessage.senderId && item.lastMessage.senderId !== myGoEasyId) {
|
||||
const sd = item.lastMessage.senderData || {};
|
||||
if (sd.avatar) d.avatar = fixAvatarUrl(sd.avatar, defaultAvatar, ossBase);
|
||||
if (sd.name) d.name = sd.name;
|
||||
}
|
||||
|
||||
d.avatar = fixAvatarUrl(d.avatar, defaultAvatar, ossBase);
|
||||
}
|
||||
|
||||
export function parseOrderCardText(text) {
|
||||
if (!text || !text.startsWith(ORDER_CARD_PREFIX)) return null;
|
||||
try {
|
||||
const data = JSON.parse(text.slice(ORDER_CARD_PREFIX.length));
|
||||
return {
|
||||
orderId: data.dingdan_id,
|
||||
jieshao: data.jieshao || '',
|
||||
jine: data.jine || '',
|
||||
beizhu: data.beizhu || '',
|
||||
zhuangtai: data.zhuangtai,
|
||||
nicheng: data.nicheng || '',
|
||||
create_time: data.create_time || '',
|
||||
};
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
import { getChatImageUrl } from '../static/lib/utils.js';
|
||||
|
||||
export function normalizeGroupMessage(msg) {
|
||||
if (!msg) return msg;
|
||||
if (msg.type === 'text' && msg.payload && msg.payload.text) {
|
||||
const card = parseOrderCardText(msg.payload.text);
|
||||
if (card) {
|
||||
msg.type = 'order';
|
||||
msg.payload = card;
|
||||
}
|
||||
}
|
||||
if (msg.type === 'custom' && msg.payload) {
|
||||
const inner = msg.payload.payload || msg.payload;
|
||||
if (inner && (inner.orderId || inner.dingdan_id)) {
|
||||
msg.type = 'order';
|
||||
msg.payload = {
|
||||
orderId: inner.orderId || inner.dingdan_id,
|
||||
jieshao: inner.jieshao || '',
|
||||
jine: inner.jine || '',
|
||||
beizhu: inner.beizhu || '',
|
||||
zhuangtai: inner.zhuangtai,
|
||||
nicheng: inner.nicheng || '',
|
||||
create_time: inner.create_time || '',
|
||||
};
|
||||
}
|
||||
}
|
||||
if (msg.type === 'image') {
|
||||
const url = getChatImageUrl(msg);
|
||||
msg.payload = { ...(msg.payload || {}), url };
|
||||
msg.imageUrl = url;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
export function formatLastMessagePreview(msg) {
|
||||
if (!msg) return '';
|
||||
if (msg.type === 'text' && msg.payload && msg.payload.text) {
|
||||
const card = parseOrderCardText(msg.payload.text);
|
||||
if (card) return `[订单] ${card.jieshao || card.orderId}`;
|
||||
return msg.payload.text;
|
||||
}
|
||||
if (msg.type === 'order' && msg.payload) {
|
||||
return `[订单] ${msg.payload.jieshao || msg.payload.orderId || ''}`;
|
||||
}
|
||||
if (msg.type === 'image') return '[图片]';
|
||||
return '[消息]';
|
||||
}
|
||||
|
||||
export function enrichGroupConversation(item, myGoEasyId, defaultAvatar, ossBase) {
|
||||
if (!item || item.type !== 'group') return item;
|
||||
if (!item.data) item.data = {};
|
||||
|
||||
applyPairMetaToConversation(item, myGoEasyId, defaultAvatar, ossBase);
|
||||
|
||||
if (item.data.orderZhuangtai != null) {
|
||||
item.data.orderZhuangtaiText = ZHUANGTAI_MAP[item.data.orderZhuangtai] || '';
|
||||
}
|
||||
|
||||
item.displayLastMsg = formatLastMessagePreview(item.lastMessage);
|
||||
if (!item.data.avatar) item.data.avatar = defaultAvatar;
|
||||
return item;
|
||||
}
|
||||
|
||||
export function isOrderGroupConversation(c) {
|
||||
if (!c || c.type !== 'group') return false;
|
||||
if (c.data && c.data.orderId) return true;
|
||||
if (c.data && c.data.dashouGoEasyId) return true;
|
||||
return isPairGroupId(c.groupId) || /^group_\w+$/.test(c.groupId || '');
|
||||
}
|
||||
|
||||
export function getConversationSortTime(conversation, openTimes) {
|
||||
const id = conversation.groupId || conversation.userId || '';
|
||||
const msgTs = conversation.lastMessage?.timestamp || 0;
|
||||
const openTs = (openTimes && id && openTimes[id]) ? openTimes[id] : 0;
|
||||
return Math.max(msgTs, openTs);
|
||||
}
|
||||
|
||||
export function sortConversations(list, openTimes) {
|
||||
return list.sort((a, b) => {
|
||||
if (a.top && !b.top) return -1;
|
||||
if (!a.top && b.top) return 1;
|
||||
if (a.unread > 0 && b.unread <= 0) return -1;
|
||||
if (a.unread <= 0 && b.unread > 0) return 1;
|
||||
const ta = getConversationSortTime(a, openTimes);
|
||||
const tb = getConversationSortTime(b, openTimes);
|
||||
return tb - ta;
|
||||
});
|
||||
}
|
||||
|
||||
export function recordConversationOpen(conversation) {
|
||||
const id = conversation?.groupId || conversation?.userId;
|
||||
if (!id) return;
|
||||
try {
|
||||
const times = wx.getStorageSync('conversationOpenTimes') || {};
|
||||
times[id] = Date.now();
|
||||
wx.setStorageSync('conversationOpenTimes', times);
|
||||
} catch (e) {}
|
||||
}
|
||||
@@ -1,218 +1,269 @@
|
||||
/**
|
||||
* 连接管理模块 - xiaoxilj.js (根治发送失败:跳转前确保群组已订阅)
|
||||
* 从详情页跳转订单群聊时,提前订阅群组,避免发送消息时订阅未完成而失败
|
||||
*/
|
||||
const app = getApp();
|
||||
|
||||
function waitForConnection(expectedUserId, timeout = 10000) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const timer = setTimeout(() => {
|
||||
app.off('connectionChanged', handler);
|
||||
reject(new Error('连接超时'));
|
||||
}, timeout);
|
||||
|
||||
const handler = (event) => {
|
||||
if (event.status === 'connected') {
|
||||
if (event.userId === expectedUserId) {
|
||||
clearTimeout(timer);
|
||||
app.off('connectionChanged', handler);
|
||||
resolve();
|
||||
} else {
|
||||
console.error(`连接身份不匹配: 期望 ${expectedUserId}, 实际 ${event.userId}`);
|
||||
wx.removeStorageSync('savedGoEasyConnection');
|
||||
wx.removeStorageSync('goEasyUserId');
|
||||
wx.removeStorageSync('currentGoEasyIdentity');
|
||||
if (app.clearSavedConnection) app.clearSavedConnection();
|
||||
clearTimeout(timer);
|
||||
app.off('connectionChanged', handler);
|
||||
reject(new Error(`连接身份不匹配: 期望 ${expectedUserId}, 实际 ${event.userId}`));
|
||||
}
|
||||
} else if (event.status === 'disconnected' && !event.manual) {
|
||||
wx.removeStorageSync('savedGoEasyConnection');
|
||||
wx.removeStorageSync('goEasyUserId');
|
||||
wx.removeStorageSync('currentGoEasyIdentity');
|
||||
if (app.clearSavedConnection) app.clearSavedConnection();
|
||||
clearTimeout(timer);
|
||||
app.off('connectionChanged', handler);
|
||||
reject(new Error('连接失败'));
|
||||
}
|
||||
};
|
||||
app.on('connectionChanged', handler);
|
||||
});
|
||||
}
|
||||
|
||||
class ConnectionManager {
|
||||
// 原有的私聊方法保持不变
|
||||
async connectAndChat(params) {
|
||||
const { identityType, userId, targetUser } = params;
|
||||
if (!identityType || !userId || !targetUser || !targetUser.id) {
|
||||
throw new Error('参数不完整');
|
||||
}
|
||||
|
||||
if (identityType === 'dashou' && !userId.startsWith('Ds')) {
|
||||
throw new Error(`接单员身份的用户ID必须以Ds开头,实际为 ${userId}`);
|
||||
}
|
||||
if (identityType === 'shangjia' && !userId.startsWith('Sj')) {
|
||||
throw new Error(`商家身份的用户ID必须以Sj开头,实际为 ${userId}`);
|
||||
}
|
||||
if (identityType === 'boss' && !userId.startsWith('Boss')) {
|
||||
throw new Error(`老板身份的用户ID必须以Boss开头,实际为 ${userId}`);
|
||||
}
|
||||
|
||||
wx.removeStorageSync('savedGoEasyConnection');
|
||||
wx.removeStorageSync('goEasyUserId');
|
||||
wx.removeStorageSync('currentGoEasyIdentity');
|
||||
if (app.clearSavedConnection) app.clearSavedConnection();
|
||||
|
||||
if (wx.goEasy && wx.goEasy.getConnectionStatus() === 'connected') {
|
||||
wx.goEasy.disconnect();
|
||||
}
|
||||
|
||||
const waitPromise = waitForConnection(userId);
|
||||
app.connectWithIdentity(identityType, userId, false);
|
||||
|
||||
try {
|
||||
await waitPromise;
|
||||
|
||||
const currentUser = {
|
||||
id: userId,
|
||||
name: app.globalData.currentUser?.name || '用户',
|
||||
avatar: app.globalData.currentUser?.avatar || (app.globalData.ossImageUrl + app.globalData.morentouxiang)
|
||||
};
|
||||
|
||||
const to = {
|
||||
id: targetUser.id,
|
||||
name: targetUser.name || '用户',
|
||||
avatar: targetUser.avatar || (app.globalData.ossImageUrl + app.globalData.morentouxiang)
|
||||
};
|
||||
|
||||
const param = { to, currentUser };
|
||||
const path = '/pages/chat/chat?data=' + encodeURIComponent(JSON.stringify(param));
|
||||
wx.navigateTo({ url: path });
|
||||
} catch (err) {
|
||||
console.error('连接失败:', err);
|
||||
wx.showToast({ title: err.message || '连接失败', icon: 'none' });
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async connectToGroupChat(params) {
|
||||
const { identityType, userId, orderId, groupName, groupAvatar, isCross } = params;
|
||||
if (!identityType || !userId || !orderId) {
|
||||
throw new Error('参数不完整:identityType, userId, orderId 必填');
|
||||
}
|
||||
|
||||
// 校验 userId 前缀
|
||||
if (identityType === 'dashou' && !userId.startsWith('Ds')) {
|
||||
throw new Error(`接单员身份的用户ID必须以Ds开头,实际为 ${userId}`);
|
||||
}
|
||||
if (identityType === 'shangjia' && !userId.startsWith('Sj')) {
|
||||
throw new Error(`商家身份的用户ID必须以Sj开头,实际为 ${userId}`);
|
||||
}
|
||||
if (identityType === 'boss' && !userId.startsWith('Boss')) {
|
||||
throw new Error(`老板身份的用户ID必须以Boss开头,实际为 ${userId}`);
|
||||
}
|
||||
|
||||
|
||||
// 1. 同步全局角色,确保群聊页初始化正确
|
||||
app.globalData.currentRole = identityType;
|
||||
wx.setStorageSync('currentRole', identityType);
|
||||
|
||||
const uid = userId.replace(/^(Ds|Sj|Boss|Gs|Zz)/, '');
|
||||
const avatar = wx.getStorageSync('touxiang') ||
|
||||
(app.globalData.ossImageUrl + app.globalData.morentouxiang);
|
||||
app.globalData.currentUser = {
|
||||
id: userId,
|
||||
name: app.globalData.currentUser?.name || `用户${uid}`,
|
||||
avatar: avatar
|
||||
};
|
||||
|
||||
// 2. 确保 GoEasy 已使用目标身份连接
|
||||
let needConnect = false;
|
||||
if (!wx.goEasy || !wx.goEasy.getConnectionStatus || wx.goEasy.getConnectionStatus() !== 'connected') {
|
||||
needConnect = true;
|
||||
} else {
|
||||
const currentUserId = wx.goEasy.im?.userId;
|
||||
if (currentUserId !== userId) {
|
||||
needConnect = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needConnect) {
|
||||
wx.removeStorageSync('savedGoEasyConnection');
|
||||
wx.removeStorageSync('goEasyUserId');
|
||||
if (app.clearSavedConnection) app.clearSavedConnection();
|
||||
if (wx.goEasy && wx.goEasy.getConnectionStatus() === 'connected') {
|
||||
wx.goEasy.disconnect();
|
||||
}
|
||||
const waitPromise = waitForConnection(userId);
|
||||
app.connectWithIdentity(identityType, userId, false);
|
||||
try {
|
||||
await waitPromise;
|
||||
} catch (err) {
|
||||
wx.showToast({ title: '连接失败', icon: 'none' });
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 从会话列表查找群组;找不到则用订单号作为 groupId(首聊场景)
|
||||
const orderIdStr = String(orderId);
|
||||
let realGroupId = orderIdStr;
|
||||
try {
|
||||
const result = await new Promise((resolve, reject) => {
|
||||
wx.goEasy.im.latestConversations({
|
||||
onSuccess: (res) => {
|
||||
const conversations = res.content?.conversations || [];
|
||||
const found = conversations.find((c) => {
|
||||
if (c.type !== 'group') return false;
|
||||
if (c.groupId === orderIdStr) return true;
|
||||
const data = c.data || {};
|
||||
return String(data.orderId || '') === orderIdStr;
|
||||
});
|
||||
resolve(found ? found.groupId : orderIdStr);
|
||||
},
|
||||
onFailed: reject,
|
||||
});
|
||||
});
|
||||
realGroupId = result || orderIdStr;
|
||||
} catch (err) {
|
||||
console.warn('获取会话列表失败,使用订单号作为群ID', err);
|
||||
realGroupId = orderIdStr;
|
||||
}
|
||||
|
||||
// 4. 🔥 关键:主动订阅群组并等待成功,确保发送消息时订阅已完成
|
||||
try {
|
||||
await new Promise((resolve, reject) => {
|
||||
wx.goEasy.im.subscribeGroup({
|
||||
groupIds: [realGroupId],
|
||||
onSuccess: () => {
|
||||
resolve();
|
||||
},
|
||||
onFailed: (error) => {
|
||||
console.error('订阅群组失败:', error);
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
wx.showToast({ title: '订阅群组失败', icon: 'none' });
|
||||
throw err;
|
||||
}
|
||||
|
||||
// 5. 跳转群聊页(参数与消息列表完全一致)
|
||||
const param = {
|
||||
groupId: realGroupId,
|
||||
orderId: orderIdStr,
|
||||
groupName: groupName || '订单群聊',
|
||||
groupAvatar: groupAvatar || '',
|
||||
isCross: isCross || 0,
|
||||
currentUserId: userId,
|
||||
currentUserName: app.globalData.currentUser?.name || `用户${uid}`,
|
||||
currentUserAvatar: avatar,
|
||||
};
|
||||
const path = '/pages/group-chat/group-chat?data=' + encodeURIComponent(JSON.stringify(param));
|
||||
wx.navigateTo({ url: path });
|
||||
}
|
||||
}
|
||||
|
||||
export default new ConnectionManager();
|
||||
/**
|
||||
* 订单群聊跳转:先确定群 ID,IM 连接失败也尽量能进聊天页
|
||||
*/
|
||||
import request from './request';
|
||||
import { persistGroupMeta } from './im-user.js';
|
||||
import { resolveLocalGroupId } from './group-chat.js';
|
||||
|
||||
const app = getApp();
|
||||
|
||||
function formatError(err) {
|
||||
if (!err) return '进入聊天失败';
|
||||
if (typeof err === 'string') return err;
|
||||
if (err.message) return err.message;
|
||||
if (err.content) return String(err.content);
|
||||
if (err.msg) return String(err.msg);
|
||||
if (err.code) return `连接失败(${err.code})`;
|
||||
try {
|
||||
return JSON.stringify(err);
|
||||
} catch (e) {
|
||||
return '进入聊天失败';
|
||||
}
|
||||
}
|
||||
|
||||
function withTimeout(promise, ms, errMsg) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const timer = setTimeout(() => reject(new Error(errMsg || '操作超时')), ms);
|
||||
promise
|
||||
.then((v) => { clearTimeout(timer); resolve(v); })
|
||||
.catch((e) => { clearTimeout(timer); reject(e); });
|
||||
});
|
||||
}
|
||||
|
||||
function getConnectedUserId() {
|
||||
const fromState = app.globalData?.goEasyConnection?.userId;
|
||||
const fromIm = wx.goEasy?.im?.userId;
|
||||
return fromState || fromIm || '';
|
||||
}
|
||||
|
||||
function isImConnected() {
|
||||
const status = wx.goEasy?.getConnectionStatus?.() || 'disconnected';
|
||||
return status === 'connected' || status === 'reconnected';
|
||||
}
|
||||
|
||||
async function ensureIdentityConnection(identityType, userId) {
|
||||
app.globalData.currentRole = identityType;
|
||||
wx.setStorageSync('currentRole', identityType);
|
||||
|
||||
const uid = userId.replace(/^(Ds|Sj|Boss|Gs|Zz|Kh)/, '');
|
||||
const avatar = wx.getStorageSync('touxiang') ||
|
||||
(app.globalData.ossImageUrl + app.globalData.morentouxiang);
|
||||
app.globalData.currentUser = {
|
||||
id: userId,
|
||||
name: app.globalData.currentUser?.name || `用户${uid}`,
|
||||
avatar: avatar,
|
||||
};
|
||||
|
||||
if (!app.globalData.chatEnabled || !wx.goEasy?.im) {
|
||||
throw new Error('聊天服务未就绪,请稍后重试');
|
||||
}
|
||||
|
||||
if (isImConnected() && getConnectedUserId() === userId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const connectedId = getConnectedUserId();
|
||||
if (connectedId && connectedId !== userId && app.disconnectGoEasy) {
|
||||
await app.disconnectGoEasy();
|
||||
}
|
||||
|
||||
if (!app.connectWithIdentity) {
|
||||
throw new Error('聊天功能未初始化');
|
||||
}
|
||||
|
||||
await withTimeout(
|
||||
app.connectWithIdentity(identityType, userId, true),
|
||||
12000,
|
||||
'IM连接超时'
|
||||
);
|
||||
|
||||
if (!isImConnected()) {
|
||||
throw new Error('IM连接失败,请检查网络后重试');
|
||||
}
|
||||
}
|
||||
|
||||
async function prepareGroupChat(identityType, userId, orderId, partnerUid, fadanPingtai, groupName, isCross) {
|
||||
let chatData = null;
|
||||
|
||||
try {
|
||||
const res = await withTimeout(
|
||||
request({
|
||||
url: '/dingdan/ltdhzb',
|
||||
method: 'POST',
|
||||
data: {
|
||||
dingdan_id: orderId,
|
||||
identityType,
|
||||
push_order_card: false,
|
||||
},
|
||||
}),
|
||||
12000,
|
||||
'准备群聊超时'
|
||||
);
|
||||
const body = res?.data || {};
|
||||
if (body.code === 0 && body.data?.groupId) {
|
||||
chatData = body.data;
|
||||
} else if (body.msg) {
|
||||
console.warn('ltdhzb:', body.msg);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('ltdhzb 请求失败,尝试本地 groupId', e);
|
||||
}
|
||||
|
||||
if (!chatData?.groupId) {
|
||||
const myUid = userId.replace(/^(Ds|Sj|Boss)/, '');
|
||||
let localGroupId = resolveLocalGroupId(
|
||||
identityType, myUid, partnerUid, fadanPingtai, orderId, isCross
|
||||
);
|
||||
if (!localGroupId && orderId) {
|
||||
localGroupId = `group_${orderId}`;
|
||||
}
|
||||
if (!localGroupId) {
|
||||
throw new Error('无法确定群聊,请确认订单已接单且对方信息完整');
|
||||
}
|
||||
chatData = {
|
||||
groupId: localGroupId,
|
||||
orderId,
|
||||
groupName: groupName || '订单群聊',
|
||||
isCross: isCross || fadanPingtai || 0,
|
||||
};
|
||||
try {
|
||||
await request({
|
||||
url: '/dingdan/ltdhzb',
|
||||
method: 'POST',
|
||||
data: { dingdan_id: orderId, identityType, push_order_card: false },
|
||||
});
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
|
||||
return chatData;
|
||||
}
|
||||
|
||||
class ConnectionManager {
|
||||
async connectAndChat(params) {
|
||||
const { identityType, userId, targetUser } = params;
|
||||
if (!identityType || !userId || !targetUser || !targetUser.id) {
|
||||
throw new Error('参数不完整');
|
||||
}
|
||||
|
||||
await ensureIdentityConnection(identityType, userId);
|
||||
|
||||
const currentUser = {
|
||||
id: userId,
|
||||
name: app.globalData.currentUser?.name || '用户',
|
||||
avatar: app.globalData.currentUser?.avatar || (app.globalData.ossImageUrl + app.globalData.morentouxiang),
|
||||
};
|
||||
|
||||
const to = {
|
||||
id: targetUser.id,
|
||||
name: targetUser.name || '用户',
|
||||
avatar: targetUser.avatar || (app.globalData.ossImageUrl + app.globalData.morentouxiang),
|
||||
};
|
||||
|
||||
const param = { to, currentUser };
|
||||
wx.navigateTo({ url: '/pages/chat/chat?data=' + encodeURIComponent(JSON.stringify(param)) });
|
||||
}
|
||||
|
||||
async connectToGroupChat(params) {
|
||||
const {
|
||||
identityType, userId, orderId, groupName, groupAvatar, isCross,
|
||||
partnerUid, fadanPingtai,
|
||||
} = params;
|
||||
|
||||
if (!identityType || !userId || !orderId) {
|
||||
throw new Error('参数不完整');
|
||||
}
|
||||
|
||||
app.globalData.currentRole = identityType;
|
||||
wx.setStorageSync('currentRole', identityType);
|
||||
|
||||
wx.showLoading({ title: '建立联系中...', mask: true });
|
||||
|
||||
try {
|
||||
const chatData = await prepareGroupChat(
|
||||
identityType, userId, orderId, partnerUid, fadanPingtai || isCross, groupName, isCross
|
||||
);
|
||||
|
||||
const realGroupId = chatData.groupId;
|
||||
let avatar = chatData.counterpartAvatar || chatData.groupAvatar || groupAvatar || '';
|
||||
if (avatar && !avatar.startsWith('http')) {
|
||||
avatar = app.globalData.ossImageUrl + avatar.replace(/^\//, '');
|
||||
}
|
||||
|
||||
if (!app.globalData.groupInfoMap) app.globalData.groupInfoMap = {};
|
||||
const meta = {
|
||||
name: chatData.counterpartName || chatData.groupName || groupName,
|
||||
avatar,
|
||||
orderId: chatData.orderId || orderId,
|
||||
orderDesc: chatData.orderDesc || '',
|
||||
orderZhuangtai: chatData.orderZhuangtai,
|
||||
dashouGoEasyId: chatData.dashouGoEasyId,
|
||||
partnerGoEasyId: chatData.partnerGoEasyId,
|
||||
dashouYonghuid: chatData.dashouYonghuid,
|
||||
partnerYonghuid: chatData.partnerYonghuid,
|
||||
dashouName: chatData.dashouName,
|
||||
partnerName: chatData.partnerName,
|
||||
dashouAvatar: chatData.dashouAvatar,
|
||||
partnerAvatar: chatData.partnerAvatar,
|
||||
counterpartId: chatData.counterpartId,
|
||||
counterpartYonghuid: chatData.counterpartYonghuid,
|
||||
};
|
||||
app.globalData.groupInfoMap[realGroupId] = meta;
|
||||
persistGroupMeta(app, realGroupId, meta);
|
||||
|
||||
let imReady = false;
|
||||
try {
|
||||
await ensureIdentityConnection(identityType, userId);
|
||||
imReady = true;
|
||||
try {
|
||||
await withTimeout(
|
||||
new Promise((resolve, reject) => {
|
||||
wx.goEasy.im.subscribeGroup({
|
||||
groupIds: [realGroupId],
|
||||
onSuccess: () => resolve(),
|
||||
onFailed: (error) => reject(error),
|
||||
});
|
||||
}),
|
||||
8000,
|
||||
'订阅群聊超时'
|
||||
);
|
||||
} catch (subErr) {
|
||||
console.warn('订阅群聊失败,仍尝试进入页面', subErr);
|
||||
}
|
||||
} catch (imErr) {
|
||||
console.warn('IM连接失败,仍进入聊天页由页面重连', imErr);
|
||||
}
|
||||
|
||||
const uid = userId.replace(/^(Ds|Sj|Boss)/, '');
|
||||
const param = {
|
||||
groupId: realGroupId,
|
||||
orderId: chatData.orderId || orderId,
|
||||
groupName: chatData.counterpartName || chatData.groupName || groupName || '订单群聊',
|
||||
groupAvatar: avatar,
|
||||
isCross: chatData.isCross != null ? chatData.isCross : (isCross || 0),
|
||||
currentUserId: userId,
|
||||
currentUserName: app.globalData.currentUser?.name || `用户${uid}`,
|
||||
currentUserAvatar: app.globalData.currentUser?.avatar ||
|
||||
(wx.getStorageSync('touxiang') || (app.globalData.ossImageUrl + app.globalData.morentouxiang)),
|
||||
orderZhuangtai: chatData.orderZhuangtai,
|
||||
orderJine: chatData.orderJine,
|
||||
orderDesc: chatData.orderDesc || '',
|
||||
imReady,
|
||||
};
|
||||
|
||||
wx.hideLoading();
|
||||
wx.navigateTo({
|
||||
url: '/pages/group-chat/group-chat?data=' + encodeURIComponent(JSON.stringify(param)),
|
||||
fail: (navErr) => {
|
||||
wx.showToast({ title: formatError(navErr), icon: 'none', duration: 2500 });
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
wx.hideLoading();
|
||||
console.error('跳转群聊失败:', err);
|
||||
wx.showToast({ title: formatError(err), icon: 'none', duration: 2500 });
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new ConnectionManager();
|
||||
|
||||
Reference in New Issue
Block a user