From 1d92202b1a8aa23576ae07299b0629ca09530e6e Mon Sep 17 00:00:00 2001 From: linda Date: Wed, 28 Oct 2026 16:10:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BE=AE=E4=BF=A1=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E7=99=BB=E5=BD=95=20+=20=E6=88=91=E7=9A=84=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=88=87=E6=8D=A2=20+=20=E5=B8=88=E5=82=85?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8F=B0=E5=85=A8=E6=A8=A1=E5=9D=97=20+=20?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E7=BE=8E=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 登录与角色: - Auth::wxlogin 微信 code → jscode2session → 落库发 token(appid/secret 走 .env) - 新增 fa_user_wechat 表,openid 幂等建号(CLI 已验证 is_new 1→0 不重复建号) - Auth::switchRole 角色切换(未入驻 2001 / 审核中 2002 / 未通过 2003) - pages/login 改为微信一键授权;pages/mine 我的中心(师傅入口 + 切换师傅端) 师傅工作台(对齐需求文档): - pages/master/workbench 工作台:接单开关 / 待处理待验收 / 可提现 / 六宫格入口 / 信用四指标 / 技能标签 - pages/master/hall 订单大厅:类型筛选(一口价/报价) + 4 种排序 + 抢单倒计时 + 报价入口 - pages/master/quote 报价竞标:金额/说明/有效期 + 报价记录 - pages/master/wallet 钱包:可提现/今日/累计 + 账单明细 + 提现校验 - pages/master/credit 信用与申诉:五项指标 + 规则 + 申诉提交/记录 - 新增 fa_appeal 表 视觉: - 15 个类目图标重画为双色扁平 SVG,用无头 Chrome 渲染为 192px 透明 PNG - 首页改用 ,移除 200 行 CSS 图标数据 验证:page_flow 47 + e2e_flow 65 + phase2_verify 27 = 139 项断言全通过 --- YJYF/YJYF.vue | 50 +----- db/schema_phase2.sql | 41 +++++ pages.json | 20 +++ pages/login/login.vue | 157 ++++++----------- pages/master/credit.vue | 121 +++++++++++++ pages/master/hall.vue | 58 ++++++- pages/master/quote.vue | 96 +++++++++++ pages/master/wallet.vue | 105 ++++++++++++ pages/master/workbench.vue | 161 ++++++++++++++++++ pages/mine/mine.vue | 161 ++++++++++++++++++ server/application/api/controller/Auth.php | 64 ++++++- server/application/api/controller/Master.php | 141 ++++++++++++++- server/application/common/library/WxLogin.php | 105 ++++++++++++ static/icons/appliance.png | Bin 0 -> 1982 bytes static/icons/bath.png | Bin 0 -> 2485 bytes static/icons/curtain.png | Bin 0 -> 2493 bytes static/icons/door.png | Bin 0 -> 2503 bytes static/icons/fitness.png | Bin 0 -> 2291 bytes static/icons/frame.png | Bin 0 -> 2935 bytes static/icons/kitchen.png | Bin 0 -> 3006 bytes static/icons/lamp.png | Bin 0 -> 2655 bytes static/icons/lock.png | Bin 0 -> 4276 bytes static/icons/more.png | Bin 0 -> 3417 bytes static/icons/rack.png | Bin 0 -> 2677 bytes static/icons/shower.png | Bin 0 -> 3953 bytes static/icons/sofa.png | Bin 0 -> 2837 bytes static/icons/tv.png | Bin 0 -> 2931 bytes static/icons/water.png | Bin 0 -> 3622 bytes tests/phase2_verify.js | 140 +++++++++++++++ utils/api.js | 8 + utils/role.js | 20 +++ 31 files changed, 1293 insertions(+), 155 deletions(-) create mode 100644 db/schema_phase2.sql create mode 100644 pages/master/credit.vue create mode 100644 pages/master/quote.vue create mode 100644 pages/master/wallet.vue create mode 100644 pages/master/workbench.vue create mode 100644 pages/mine/mine.vue create mode 100644 server/application/common/library/WxLogin.php create mode 100644 static/icons/appliance.png create mode 100644 static/icons/bath.png create mode 100644 static/icons/curtain.png create mode 100644 static/icons/door.png create mode 100644 static/icons/fitness.png create mode 100644 static/icons/frame.png create mode 100644 static/icons/kitchen.png create mode 100644 static/icons/lamp.png create mode 100644 static/icons/lock.png create mode 100644 static/icons/more.png create mode 100644 static/icons/rack.png create mode 100644 static/icons/shower.png create mode 100644 static/icons/sofa.png create mode 100644 static/icons/tv.png create mode 100644 static/icons/water.png create mode 100644 tests/phase2_verify.js create mode 100644 utils/role.js diff --git a/YJYF/YJYF.vue b/YJYF/YJYF.vue index e3bad6d..d10a903 100644 --- a/YJYF/YJYF.vue +++ b/YJYF/YJYF.vue @@ -86,14 +86,7 @@ - - - + {{ c.name }} @@ -254,29 +247,9 @@ /* ---------- 服务图标:纯 CSS 图元,零图片依赖 o=描边框 l=实心线 d=圆形描边 t=三角 格式 [类型, left, top, w, h, radius, rotate],画布 56×56rpx */ - const iconCats = [ - { n: '家具', p: [['o',12,10,32,16,6],['o',6,26,44,14,5],['l',14,40,3,7],['l',39,40,3,7]] }, - { n: '卫浴', p: [['l',20,6,3,12],['l',20,6,13,3],['o',4,21,48,21,'4 4 16 16'],['l',12,42,3,6],['l',41,42,3,6]] }, - { n: '灯具', p: [['l',27,4,3,13],['o',12,17,32,16,'16 16 0 0'],['l',8,33,40,3],['l',16,40,3,8],['l',27,40,3,8],['l',38,40,3,8]] }, - { n: '锁具', p: [['o',14,16,26,34,5],['o',19,21,16,9,2],['l',19,36,5,5],['l',26,36,5,5],['l',19,43,5,5],['l',26,43,5,5],['l',40,26,8,3]] }, - { n: '窗帘', p: [['l',2,8,52,3],['o',6,11,19,37,'0 0 5 5'],['l',12,11,2,31],['l',19,11,2,31],['o',31,11,19,37,'0 0 5 5'],['l',37,11,2,31],['l',44,11,2,31]] }, - { n: '墙纸/壁画', p: [['o',6,10,22,30,3],['l',11,30,12,3],['o',29,16,22,30,3],['l',34,36,12,3]] }, - { n: '净水器', p: [['o',19,8,18,6,2],['o',8,14,40,26,4],['l',17,40,3,8],['l',13,45,7,3],['l',32,40,3,8],['l',32,45,7,3]] }, - { n: '晾衣架', p: [['l',5,11,46,3],['l',11,14,3,9],['l',42,14,3,9],['l',5,23,46,3],['l',17,26,3,12],['l',27,26,3,17],['l',37,26,3,12]] }, - { n: '门窗', p: [['o',15,8,26,40,'4 4 0 0'],['o',21,14,14,11,2],['l',35,30,3,8],['l',11,48,34,3]] }, - { n: '家电', p: [['o',17,8,24,40,5],['l',17,22,24,3],['l',33,12,3,7],['l',33,26,3,7]] }, - { n: '电视/投影', p: [['o',5,12,46,30,4],['t',24,20,11,7],['l',26,42,4,5],['l',19,47,18,3]] }, - { n: '淋浴房', p: [['o',8,10,40,38,'4 4 0 0'],['l',30,10,3,38],['l',24,26,3,8],['l',6,48,44,3]] }, - { n: '商用厨电', p: [['o',15,8,28,40,4],['l',28,8,3,40],['l',21,20,3,9],['l',34,20,3,9]] }, - { n: '健身器材', p: [['d',3,28,24,24],['l',12,37,6,6],['l',14,39,28,3,null,-43],['l',33,14,3,16],['l',26,10,16,4,2],['l',42,10,3,14],['l',36,10,14,3]] }, - { n: '更多', p: [['o',8,8,18,18,5],['o',30,8,18,18,5],['o',8,30,18,18,5],['o',30,30,18,18,5]] } - ] - - /* 图标库:按后端返回的 icon 键匹配(顺序与 iconCats 一致) */ - const ICON_KEYS = ['sofa', 'bath', 'lamp', 'lock', 'curtain', 'frame', 'water', 'rack', 'door', 'appliance', 'tv', 'shower', 'kitchen', 'fitness', 'more'] - const iconLib = {} - iconCats.forEach((c, i) => { iconLib[ICON_KEYS[i]] = c.p }) - const iconOf = (key) => iconLib[key] || iconLib.more + /* 服务图标资源:static/icons/.png(双色扁平,由 SVG 渲染) */ + const ICON_KEYS = ['sofa','bath','lamp','lock','curtain','frame','water','rack','door','appliance','tv','shower','kitchen','fitness','more'] + const iconOf = (key) => (ICON_KEYS.indexOf(key) > -1 ? key : 'more') /* 服务类目(真实接口) */ const cats = ref([]) @@ -291,15 +264,6 @@ } catch (e) {} } - const partStyle = (p) => { - if (p[0] === 't') { - return 'left:' + p[1] + 'rpx;top:' + p[2] + 'rpx;border-left:' + p[3] + 'rpx solid #B85E2A;border-top:' + p[4] + 'rpx solid transparent;border-bottom:' + p[4] + 'rpx solid transparent;' - } - let s = 'left:' + p[1] + 'rpx;top:' + p[2] + 'rpx;width:' + p[3] + 'rpx;height:' + p[4] + 'rpx;' - if (p[5]) s += 'border-radius:' + String(p[5]).split(/\s+/).map(function (v) { return v + 'rpx' }).join(' ') + ';' - if (p[6]) s += 'transform:rotate(' + p[6] + 'deg);transform-origin:0 50%;' - return s - } /* ---------- 交互 ---------- */ const toast = (title) => uni.showToast({ title, icon: 'none' }) @@ -327,7 +291,7 @@ } const onUser = () => { if (!needLogin()) return - uni.navigateTo({ url: '/pages/order/list' }) + uni.navigateTo({ url: '/pages/mine/mine' }) } const switchTab = (i) => { @@ -717,6 +681,10 @@ align-items: center; justify-content: center; } + .cat-img { + width: 58rpx; + height: 58rpx; + } .cat-name { display: block; margin-top: 12rpx; diff --git a/db/schema_phase2.sql b/db/schema_phase2.sql new file mode 100644 index 0000000..bc928d5 --- /dev/null +++ b/db/schema_phase2.sql @@ -0,0 +1,41 @@ +-- ============================================================================ +-- 优匠优服 · Phase 2(微信授权登录 / 申诉中心) +-- 纯新增表,不改动既有表结构 +-- ============================================================================ +SET NAMES utf8mb4; + +-- 微信授权账号绑定(不动 fa_user 结构,独立表存放) +CREATE TABLE IF NOT EXISTS `fa_user_wechat` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '关联 fa_user.id', + `openid` varchar(64) NOT NULL DEFAULT '' COMMENT '小程序 openid', + `unionid` varchar(64) NOT NULL DEFAULT '' COMMENT '开放平台 unionid', + `session_key` varchar(128) NOT NULL DEFAULT '', + `nickname` varchar(64) NOT NULL DEFAULT '' COMMENT '微信昵称', + `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '微信头像', + `createtime` bigint(16) DEFAULT NULL, + `updatetime` bigint(16) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `openid` (`openid`), + KEY `user_id` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='微信授权账号'; + +-- 申诉中心(误判 / 恶意评价 / 扣款申诉) +CREATE TABLE IF NOT EXISTS `fa_appeal` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `master_id` int(10) unsigned NOT NULL DEFAULT '0', + `order_id` int(10) unsigned NOT NULL DEFAULT '0', + `type` enum('misjudge','review','deduct','other') NOT NULL DEFAULT 'other' COMMENT '误判/恶意评价/扣款/其他', + `content` varchar(500) NOT NULL DEFAULT '', + `images` varchar(1000) NOT NULL DEFAULT '', + `status` enum('wait','handling','done','reject') NOT NULL DEFAULT 'wait', + `reply` varchar(500) NOT NULL DEFAULT '' COMMENT '平台回复', + `createtime` bigint(16) DEFAULT NULL, + `updatetime` bigint(16) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `master_id` (`master_id`), + KEY `status` (`status`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='申诉工单'; + +-- 回滚: +-- DROP TABLE IF EXISTS `fa_appeal`,`fa_user_wechat`; diff --git a/pages.json b/pages.json index bfe7a7c..e59a1be 100644 --- a/pages.json +++ b/pages.json @@ -42,10 +42,30 @@ "path": "pages/master/apply", "style": { "navigationBarTitleText": "师傅入驻" } }, + { + "path": "pages/master/workbench", + "style": { "navigationBarTitleText": "师傅工作台" } + }, { "path": "pages/master/hall", "style": { "navigationBarTitleText": "订单大厅", "enablePullDownRefresh": false } }, + { + "path": "pages/master/quote", + "style": { "navigationBarTitleText": "报价管理" } + }, + { + "path": "pages/master/wallet", + "style": { "navigationBarTitleText": "我的钱包" } + }, + { + "path": "pages/master/credit", + "style": { "navigationBarTitleText": "信用与申诉" } + }, + { + "path": "pages/mine/mine", + "style": { "navigationStyle": "custom", "backgroundColor": "#F5F6F8" } + }, { "path": "pages/master/orders", "style": { diff --git a/pages/login/login.vue b/pages/login/login.vue index 9fd3455..a3833e9 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -19,83 +19,58 @@ - - 手机号 - + + 微 + {{ loading ? '微信授权中...' : '微信一键登录' }} - - 验证码 - - {{ codeText }} - - - {{ loading ? '登录中...' : '登录 / 注册' }} - 未注册的手机号将自动创建账号 + 授权仅用于账号识别,不会获取你的其他信息 + 登录即代表同意《用户服务协议》与《隐私政策》 - - 登录即代表同意《用户服务协议》与《隐私政策》 - diff --git a/pages/master/credit.vue b/pages/master/credit.vue new file mode 100644 index 0000000..3f77c86 --- /dev/null +++ b/pages/master/credit.vue @@ -0,0 +1,121 @@ +