194 Commits

Author SHA1 Message Date
luo
d3d606b1a7 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m14s
2026-08-13 16:05:14 +08:00
luo
dfc7472ad9 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m11s
2026-08-13 15:54:06 +08:00
luo
515e7e22c8 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m11s
2026-08-13 15:39:00 +08:00
luo
84af596a65 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m16s
2026-08-13 15:25:07 +08:00
luo
e1498cb5a6 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m17s
2026-08-13 14:51:44 +08:00
luo
42d94ce290 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m14s
2026-08-13 14:22:41 +08:00
luo
c22cae9c38 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m8s
2026-08-13 12:26:21 +08:00
luo
a3fe025a88 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m10s
2026-08-13 12:16:50 +08:00
luo
61672a4d51 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m11s
2026-08-13 12:06:13 +08:00
luo
ac45a08373 feat: 通知弹窗新增立即续费按钮
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m35s
2026-08-12 11:05:21 +08:00
luo
1e649e9835 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m8s
2026-08-05 16:53:05 +08:00
luo
1451cc83ff fix: ICCID
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m12s
2026-08-05 16:44:02 +08:00
luo
9f07f9d0ef fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m10s
2026-08-05 15:23:58 +08:00
luo
1891ea1e0d fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m10s
2026-08-05 15:09:47 +08:00
luo
bf0a38c763 fix: 认证策略是先充值后实名, 首页入口
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m49s
2026-08-05 14:53:07 +08:00
luo
9f70a7e395 fix: 更换图标
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m3s
2026-08-05 14:24:43 +08:00
luo
d05a47ffe2 fix: 认证策略是先充值后实名, 首页入口
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m11s
2026-08-05 12:02:25 +08:00
luo
f9d8a107a4 fix: 认证策略是先充值后实名, 首页入口
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m14s
2026-08-05 10:51:23 +08:00
luo
e4278d3883 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m12s
2026-07-31 09:58:39 +08:00
luo
819d5dc2f5 fix:套餐列表
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m12s
2026-07-30 16:20:20 +08:00
luo
4c10d1f9fa fix: 跳转手机号
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m8s
2026-07-30 15:59:55 +08:00
luo
7de5efedfd fix:ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m14s
2026-07-30 15:50:04 +08:00
luo
5f8ff768e6 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m9s
2026-07-30 15:41:11 +08:00
luo
d0f032aa1c fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m8s
2026-07-30 15:01:54 +08:00
luo
c45227ba7e fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m10s
2026-07-30 14:49:39 +08:00
luo
7ecb4709c8 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m10s
2026-07-30 14:35:40 +08:00
luo
49175f8a73 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m2s
2026-07-30 14:22:20 +08:00
luo
5cc6d4349e fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m1s
2026-07-30 14:08:21 +08:00
luo
2866b889bb fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m0s
2026-07-30 13:41:32 +08:00
luo
59dde650a2 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m2s
2026-07-30 13:31:47 +08:00
luo
9d0727ad8b fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 59s
2026-07-30 13:24:57 +08:00
luo
8f1a731b2b fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m1s
2026-07-30 13:16:48 +08:00
luo
39bc9f506d fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 59s
2026-07-30 13:06:02 +08:00
luo
0bae5233b3 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m5s
2026-07-30 12:59:32 +08:00
luo
502b2723db fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m0s
2026-07-30 12:49:14 +08:00
luo
2fb95b3257 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 58s
2026-07-30 12:36:46 +08:00
luo
dfa68a6a79 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m2s
2026-07-30 12:30:50 +08:00
luo
8027916e7a fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 57s
2026-07-30 12:17:32 +08:00
luo
8ef94125b9 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m8s
2026-07-30 11:42:52 +08:00
luo
e7a7b30bc8 fix: ui
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m1s
2026-07-30 11:35:56 +08:00
luo
863a34f74c fix: 只要任意一张实名了就可以不强制跳
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 56s
2026-07-29 17:49:25 +08:00
luo
b95daedba6 fix: icons和布局
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m1s
2026-07-29 17:29:55 +08:00
luo
7136655f48 fix: 布局
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 57s
2026-07-29 16:53:19 +08:00
luo
b5e4a1259b fix: 图标
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 54s
2026-07-29 16:32:13 +08:00
luo
2166241cdb fix: icons和布局
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-07-29 16:26:32 +08:00
luo
6c3cf15165 fix: 只要任意一张实名了就可以不强制跳
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 59s
2026-07-29 15:48:22 +08:00
luo
34ca1c5eca fix: 立即续费不跳转
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 59s
2026-07-28 16:02:40 +08:00
luo
64bccffe28 fix: 立即续费
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m16s
2026-07-28 14:47:34 +08:00
luo
4f281da778 feat: 7月迭代
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m11s
2026-07-27 18:13:19 +08:00
luo
6a794d88af feat: 新增文档
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m2s
2026-07-27 16:21:34 +08:00
luo
861ffa371b feat: 站内通知
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 54s
2026-07-25 11:28:58 +08:00
luo
f6a33121f2 feat: 站内通知
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 59s
2026-07-25 11:22:16 +08:00
luo
133a4d18ef feat: 站内通知
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Has been cancelled
2026-07-25 11:21:42 +08:00
luo
9c1c296d2e feat: 站内通知
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m29s
2026-07-25 11:08:03 +08:00
luo
3929156ef4 fix: git-config
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m45s
2026-07-24 12:16:04 +08:00
luo
ad3c9b964d fix: git-config 2026-07-24 12:11:03 +08:00
luo
59696a7e8e fix: 设备首页不显示iccid
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m8s
2026-07-20 10:25:39 +08:00
luo
d90a51ebf4 fix: 切换运营商
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s
2026-07-03 12:29:16 +08:00
luo
5b239c13b7 feat: 登录支持条形码
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-07-03 12:17:32 +08:00
luo
8397a51f8c fix: 切换运营商
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-07-03 11:47:30 +08:00
luo
a9fbbea1e6 fix: pay
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 56s
2026-07-03 09:07:28 +08:00
luo
6756ad5700 fix: 实名认证运营商分类
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-07-02 15:58:23 +08:00
luo
f581ccaa9b fix: 实名认证运营商分类
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 51s
2026-07-02 15:55:12 +08:00
luo
832c2852c7 fix: 实名认证运营商分类
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-07-02 15:40:49 +08:00
luo
3e81a216ad fix: 实名认证运营商分类
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-07-02 15:33:38 +08:00
luo
85cdeac804 fix:pay
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s
2026-06-26 18:01:01 +08:00
luo
59e4e1203e fix: pay
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s
2026-06-26 16:33:33 +08:00
luo
4dc86889c5 fix:bug scan
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-06-26 14:59:15 +08:00
luo
60fa91ea25 fix: tips
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m47s
2026-06-16 16:09:49 +08:00
sexygoat
50e4be4976 fix: 资产套餐历史流量显示逻辑
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 3m5s
2026-06-11 14:36:31 +08:00
sexygoat
5d78f24366 fix: 资产套餐历史流量显示逻辑
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-06-11 14:24:48 +08:00
sexygoat
069eab0462 fix: 换货
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m49s
2026-06-03 17:53:52 +08:00
sexygoat
c265dacafd fix: 修改套餐位置
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s
2026-05-28 14:26:49 +08:00
sexygoat
83c32279eb fix: 修改套餐位置
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 54s
2026-05-28 14:21:24 +08:00
sexygoat
169d2bdaad fix: 修改套餐位置
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 53s
2026-05-28 14:16:07 +08:00
sexygoat
427b211295 fix: pay
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m0s
2026-05-22 15:16:22 +08:00
sexygoat
874ff41ce3 fix:bug 2026-05-21 17:28:16 +08:00
sexygoat
368c0d75e7 fix:bug
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-05-21 16:40:43 +08:00
sexygoat
a0b2f69a8e fix: bug
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 11s
2026-05-21 16:21:23 +08:00
sexygoat
b566b0a5ea fix: bug
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m1s
2026-05-21 16:17:48 +08:00
sexygoat
4d9aa59254 fix:单卡设备显示字段
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 56s
2026-05-21 15:04:26 +08:00
sexygoat
1edd299f1b fix:单卡设备显示字段
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 12s
2026-05-21 14:44:46 +08:00
sexygoat
f9fead83cf fix:单卡设备显示字段
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Has been cancelled
2026-05-21 14:44:10 +08:00
sexygoat
dcc8c0ccd6 fix:bug
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-05-14 15:06:40 +08:00
sexygoat
0be325e379 fix: 优化换货
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 54s
2026-05-14 14:18:13 +08:00
sexygoat
fded2fe12d fix: 优化换货
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m0s
2026-05-14 14:06:52 +08:00
sexygoat
b611808316 fix: 优化换货
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m48s
2026-05-14 12:14:05 +08:00
sexygoat
7253996f40 fix: bug
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 51s
2026-05-14 10:09:13 +08:00
sexygoat
276f67b839 fix: 卡也有换货
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 56s
2026-05-14 09:55:01 +08:00
sexygoat
1ae5d945d1 fix:bug
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m39s
2026-05-14 09:50:02 +08:00
sexygoat
ac1f4b1cec fix:bug
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 57s
2026-05-11 15:15:44 +08:00
sexygoat
3f997063f4 fix: 优化体验
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m37s
2026-05-09 16:14:06 +08:00
sexygoat
c798cdba7f fix: 本月流量
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s
2026-05-08 09:49:35 +08:00
sexygoat
5218b37578 fix:name
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 49s
2026-05-07 17:13:03 +08:00
sexygoat
730626143d fix:name
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 45s
2026-05-07 17:08:14 +08:00
sexygoat
13f8538941 fix:name
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 41s
2026-05-07 17:03:59 +08:00
sexygoat
6b3e7ac185 fix:name
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 46s
2026-05-07 16:57:49 +08:00
8cec21e77e 更新 .gitea/workflows/deploy.yaml
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Has been cancelled
2026-05-07 16:56:02 +08:00
e3f4b05602 更新 .gitea/workflows/deploy.yaml
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 5s
2026-05-07 16:48:39 +08:00
sexygoat
92c5c4ed50 fix:百分比
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Has been cancelled
2026-05-07 16:19:00 +08:00
sexygoat
7dfbb2de3d fix: 本月流量
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m1s
2026-05-06 18:09:48 +08:00
sexygoat
ce7e2152b1 fix: 卡槽-钱包
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 49s
2026-05-06 10:41:45 +08:00
sexygoat
5f832f26b7 fix: 卡槽-钱包
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 49s
2026-05-06 10:40:23 +08:00
sexygoat
d6a9693482 fix: 卡槽-钱包
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 53s
2026-05-06 10:26:05 +08:00
sexygoat
9fadbd297b fix: 过期时间
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 53s
2026-05-06 10:16:06 +08:00
sexygoat
52c36dfc9b fix: singer
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-30 17:43:52 +08:00
sexygoat
a5c7e46dd7 fix: singer
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 48s
2026-04-30 17:41:05 +08:00
sexygoat
f505d85018 fix: singer
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 49s
2026-04-30 17:39:11 +08:00
sexygoat
7d0296dedb fix: singer
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-04-30 17:01:26 +08:00
sexygoat
83c27e5427 fix: singer
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s
2026-04-30 16:35:44 +08:00
sexygoat
8ca0fc3d50 Merge branch 'main' of https://git.boss160.cn/luo/device-voice-h5
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s
2026-04-30 10:59:33 +08:00
sexygoat
a0ac16d86c fix: app_id 2026-04-30 10:58:30 +08:00
74d83468e3 更新 Dockerfile
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 48s
2026-04-30 10:01:27 +08:00
sexygoat
29928f121a feat: 新增txt
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 45s
2026-04-29 18:40:21 +08:00
sexygoat
e7b9c75ad0 feat: 新增txt
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 4s
2026-04-29 18:38:09 +08:00
sexygoat
cebe545440 msg
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 48s
2026-04-29 17:48:54 +08:00
sexygoat
d679cad55f fix: singer
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 51s
2026-04-29 17:09:39 +08:00
sexygoat
5f0c215bdc fix: status
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s
2026-04-29 16:26:37 +08:00
sexygoat
35424347f3 fix: h5
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 50s
2026-04-28 11:22:03 +08:00
sexygoat
e121fca8ca fix:流量
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s
2026-04-27 18:30:26 +08:00
sexygoat
5de611d28f fix: ll
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 53s
2026-04-27 14:56:06 +08:00
sexygoat
24b2293d71 fix: ll 2026-04-27 14:45:03 +08:00
sexygoat
fbf5371086 fix: carrier_type
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m33s
2026-04-27 12:33:26 +08:00
sexygoat
f86281017a feat: 跳转地址提示
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 50s
2026-04-24 15:03:31 +08:00
sexygoat
f51c8d912b feat: 跳转地址提示
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-24 14:59:02 +08:00
sexygoat
bcc63f508a feat: 跳转地址提示
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-24 14:57:42 +08:00
sexygoat
fad37f511c feat: 跳转地址提示
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 48s
2026-04-24 14:54:31 +08:00
sexygoat
a9a1a557d9 feat: 跳转地址提示
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-24 14:40:43 +08:00
sexygoat
383e7b819b feat: 钱包样式
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-24 14:36:34 +08:00
sexygoat
8f4ecda7eb feat: 钱包样式
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 49s
2026-04-24 14:30:35 +08:00
sexygoat
71bb404fe1 feat: 钱包样式
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 48s
2026-04-24 14:24:57 +08:00
sexygoat
ef77905dbb feat: 钱包样式
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 49s
2026-04-24 14:18:35 +08:00
sexygoat
69923b81b0 feat: 钱包样式
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Has been cancelled
2026-04-24 14:17:46 +08:00
sexygoat
791e034a6b feat: 跳转地址提示
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 51s
2026-04-24 14:15:13 +08:00
sexygoat
42f4d9f96a fix: bug
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 53s
2026-04-24 10:27:35 +08:00
sexygoat
1d6c12e8d7 fix: WiFi弹窗
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 55s
2026-04-23 17:15:21 +08:00
sexygoat
8dc8600b52 fix: 弹窗提示
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-23 16:49:24 +08:00
sexygoat
94a31b2e47 fix: bug
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m26s
2026-04-23 16:32:24 +08:00
sexygoat
8a8393eede fix: 扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-17 16:57:09 +08:00
sexygoat
882ec0a1b8 fix: 扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 45s
2026-04-17 16:55:28 +08:00
sexygoat
093c337bc4 fix: 扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-17 16:51:52 +08:00
sexygoat
e2007b008a fix: 扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-17 16:48:36 +08:00
sexygoat
372e22f4b7 fix: 扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 50s
2026-04-17 16:45:45 +08:00
sexygoat
0ada36a778 fix: 扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 45s
2026-04-17 16:31:37 +08:00
sexygoat
547d944812 fix: 扫一扫1
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-17 16:20:12 +08:00
sexygoat
bdaada8224 fix: 扫一扫1
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-17 16:06:06 +08:00
sexygoat
b3fea2100b fix: 扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-17 16:01:00 +08:00
sexygoat
1e03191e82 fix: 扫一扫
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 19s
2026-04-17 15:57:13 +08:00
sexygoat
25fc534619 fix: 扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-17 15:48:55 +08:00
sexygoat
5dc948efec fix: 扫一扫
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 20s
2026-04-17 15:35:03 +08:00
sexygoat
fc7305dffe fix: 扫一扫登录
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 45s
2026-04-17 15:14:15 +08:00
sexygoat
35fa5fd2ae refactor: 删除多余的uview-plus SCSS导入,简化vite配置
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 19s
2026-04-17 15:10:02 +08:00
sexygoat
898aa41fd2 refactor: 删除多余的uview-plus SCSS导入,简化vite配置
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 20s
2026-04-17 15:07:40 +08:00
sexygoat
22538a8972 refactor: 删除多余的uview-plus SCSS导入,简化vite配置
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 14s
2026-04-17 15:03:14 +08:00
sexygoat
379ac883f0 fix: 移除多余的uview-plus SCSS导入,使用正确的JS配置方式
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 22s
2026-04-17 14:51:26 +08:00
sexygoat
2d27f55d69 fix: 修复SCSS导入路径和uni-app构建配置
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 10s
2026-04-17 14:43:26 +08:00
sexygoat
62751369a2 fix: 修复SCSS导入路径和uni-app构建配置
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 20s
2026-04-17 14:40:32 +08:00
sexygoat
10f8a1658e fix: 修复uni-app构建路径问题
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 45s
2026-04-17 14:34:20 +08:00
sexygoat
bbb840e521 fix: 修复SCSS编译和微信扫码功能
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 56s
2026-04-17 14:30:19 +08:00
sexygoat
404daa4b6d fix: 修复扫一扫登录
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 8s
2026-04-17 14:25:42 +08:00
sexygoat
40b8f76eef fix: 修复扫一扫登录
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 20s
2026-04-17 12:20:02 +08:00
sexygoat
5f4a26e693 fix: 修复扫一扫登录
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 51s
2026-04-17 11:18:46 +08:00
sexygoat
f72b77fe0d fix: 修复扫一扫登录
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 48s
2026-04-17 11:03:04 +08:00
sexygoat
39773341bd fix: 修复扫一扫登录
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-17 10:56:46 +08:00
sexygoat
16a47c1229 fix: 修复扫一扫登录
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-17 10:51:10 +08:00
sexygoat
715e4f6f7d fix: 修复扫一扫登录
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 53s
2026-04-17 10:45:26 +08:00
sexygoat
b3c925b0ca fix: 修复扫一扫登录
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 51s
2026-04-17 09:40:34 +08:00
sexygoat
263515758c feat: 登录扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-16 18:15:23 +08:00
sexygoat
f4ac65acce feat: 登录扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-16 18:09:59 +08:00
sexygoat
f5f993d1e2 feat: 登录扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m24s
2026-04-16 17:57:38 +08:00
sexygoat
63af194ec5 feat: 登录扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m25s
2026-04-16 17:47:27 +08:00
sexygoat
6d327c41cd feat: 登录扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 57s
2026-04-16 17:41:07 +08:00
sexygoat
bd0bb149b8 feat: 登录扫一扫
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 43s
2026-04-16 17:31:46 +08:00
sexygoat
102e6c0867 feat: 登录扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 45s
2026-04-16 17:14:43 +08:00
sexygoat
b56f68636c feat: 登录扫一扫
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-16 17:11:09 +08:00
sexygoat
e0db2b6df0 feat: 登录缓存token
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-16 17:01:36 +08:00
sexygoat
25e9946c17 feat: 登录缓存token
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 49s
2026-04-16 16:56:52 +08:00
sexygoat
64f479c62a fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-16 12:10:19 +08:00
sexygoat
c1172f7591 fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-16 12:00:04 +08:00
sexygoat
04ee3f2c87 fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-16 11:54:57 +08:00
sexygoat
4cb1e65e6e fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 50s
2026-04-16 11:29:45 +08:00
sexygoat
89aafa7317 fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 45s
2026-04-16 11:13:57 +08:00
sexygoat
e2d3d8172f fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-16 11:08:45 +08:00
sexygoat
7c35a0bad6 fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-16 11:00:38 +08:00
sexygoat
bd0fc9cfdb fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-16 10:53:57 +08:00
sexygoat
cca7131d68 fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-16 10:49:44 +08:00
sexygoat
0337d86ba2 fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-16 10:46:01 +08:00
sexygoat
89a6441f62 fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-16 10:44:20 +08:00
sexygoat
58d4b92287 fix: UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-16 10:38:56 +08:00
sexygoat
733fcc5511 fix: 订单列表
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-16 10:34:13 +08:00
sexygoat
c06d543af3 fix: 封装微信支付
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 46s
2026-04-16 10:28:02 +08:00
sexygoat
6b066e35da fix: 修改布局UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 50s
2026-04-16 10:21:11 +08:00
sexygoat
41349ac833 fix: 修改布局UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
2026-04-16 10:01:15 +08:00
sexygoat
c6246c023d fix: 修改布局UI
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m21s
2026-04-16 09:54:55 +08:00
146 changed files with 11300 additions and 3398 deletions

View File

@@ -2,13 +2,8 @@
"permissions": {
"allow": [
"Bash(git add:*)",
"Read(//Users/break/.agents/skills/impeccable/**)",
"Bash(node .agents/skills/impeccable/scripts/cleanup-deprecated.mjs)",
"Bash(node *)",
"Bash(npm run *)",
"Bash(curl -s http://localhost:5173)",
"Bash(git checkout *)",
"Bash(git commit -m ' *)"
"Bash(npm list:*)",
"Bash(find . -type f \\\\\\(-name *.openapi.* -o -name *-spec.yaml -o -name *-spec.yml \\\\\\))"
],
"deny": [],
"ask": []

15
.dockerignore Normal file
View File

@@ -0,0 +1,15 @@
node_modules
.git
.gitignore
*.md
.vscode
.idea
dist
unpackage
.DS_Store
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env.local
.env.*.local

1
.env.development Normal file
View File

@@ -0,0 +1 @@
VITE_BASE_URL=https://cmp-api.boss160.cn

1
.env.production Normal file
View File

@@ -0,0 +1 @@
VITE_BASE_URL=https://cmp-api.xm-iot.cn

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
*.html linguist-detectable=false
*.vue linguist-detectable=true

View File

@@ -3,7 +3,7 @@ name: 构建并部署前端到生产环境
on:
push:
branches:
- main
- develop
- dev
- test
@@ -21,13 +21,14 @@ jobs:
run: |
export PATH="$HOME/.nix-profile/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
export GIT_SSL_NO_VERIFY=1
git clone https://git.boss160.cn/luo/device-voice-h5.git .
git clone https://git.boss160.cn/luo/device-voice-h5 .
git checkout ${{ github.sha }}
- name: 设置镜像标签
id: tag
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
if [ "${{ github.ref }}" = "refs/heads/develop" ]; then
echo "tag=latest" >> $GITHUB_OUTPUT
elif [ "${{ github.ref }}" = "refs/heads/dev" ]; then
echo "tag=dev" >> $GITHUB_OUTPUT
@@ -51,8 +52,8 @@ jobs:
docker push ${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
- name: 部署到本地(仅 main 分支)
if: github.ref == 'refs/heads/main'
- name: 部署到本地(仅 develop 分支)
if: github.ref == 'refs/heads/develop'
run: |
mkdir -p ${{ env.DEPLOY_DIR }}

15
.gitignore vendored
View File

@@ -2,9 +2,22 @@
logs
*.log
npm-debug.log*
npminstall-debug.log
yarn-debug.log*
yarn-error.log*
# Common local files
dist-ssr
*.local
.cursorrules
.claude
.codex
.env.development
.env.production
.scratch
.agents
Thumbs.db
# Runtime data
pids
*.pid
@@ -91,4 +104,4 @@ dist/
# OS
.DS_Store
Thumbs.db
Thumbs.db

View File

@@ -1,30 +0,0 @@
# Impeccable Design Context
## Design Context
### Users
- **Who**: Regular consumers on mobile who purchased a portable WiFi/MiFi device
- **Context**: Using the app on their phone to check data usage, manage their device settings, top up balance, and ensure connectivity while traveling
- **Job to be done**: Quick access to device status, data usage, and account management with minimal friction
### Brand Personality
- **Voice**: Clean, confident, trustworthy
- **Tone**: Fast and efficient, modern and sleek, friendly and helpful, reliable and secure
- **3-word personality**: Modern · Trustworthy · Effortless
- **Emotional goals**: Users should feel in control of their connectivity, confident their device is working, and that managing it is simple
### Aesthetic Direction
- **Visual tone**: Minimal and refined — clean layouts with purposeful use of space
- **References**: Consumer electronics (Apple, Tile, Anker) + Minimalist app interfaces
- **Anti-references**: Cluttered admin dashboards, AI slop aesthetics, legacy carrier apps, overly playful designs
- **Theme**: Light mode only — bright, clean, accessible
- **Colors**: Blue-based palette (iOS-like primary blue #0A84FF) with the existing color system as a base
### Design Principles
1. **Clarity first**: Every element earns its place. No decorative clutter.
2. **Confidence through space**: Generous whitespace creates premium feel. Tight grouping shows related content.
3. **Light and bright**: Light theme only. White surfaces, not gray. Blue accent for primary actions.
4. **Progressive disclosure**: Simple by default, reveal complexity on demand (e.g., WiFi settings behind a tap).
5. **Fast interactions**: Optimistic UI. Updates feel instant. Loading states are minimal.
6. **Typography hierarchy**: Bold headings, readable body. Clear contrast between levels.
7. **Trust signals**: Online/offline status, battery level, data usage — at a glance, always visible.

18
AGENTS.md Normal file
View File

@@ -0,0 +1,18 @@
<!-- OPENSPEC:START -->
# OpenSpec Instructions
These instructions are for AI assistants working in this project.
Always open `@/openspec/AGENTS.md` when the request:
- Mentions planning or proposals (words like proposal, spec, change, plan)
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
- Sounds ambiguous and you need the authoritative spec before coding
Use `@/openspec/AGENTS.md` to learn:
- How to create and apply change proposals
- Spec format and conventions
- Project structure and guidelines
Keep this managed block so 'openspec update' can refresh the instructions.
<!-- OPENSPEC:END -->

607
App.vue
View File

@@ -5,89 +5,91 @@
</template>
<style lang="scss">
@import "uview-plus/index.scss";
:root {
/* 主色 - iOS Blue 家族 */
--primary: #007AFF;
--primary-light: #5AC8FA;
--primary-dark: #0056CC;
--primary-tint: rgba(0, 122, 255, 0.08);
/* 主色 */
--primary: #55ab5c;
--primary-light: #8bc98f;
--primary-dark: #3f8f47;
--up-primary: #55ab5c;
--up-primary-light: #eaf6ec;
--up-primary-dark: #3f8f47;
/* 语义色 */
--success: #34C759;
--success-light: rgba(52, 199, 89, 0.1);
--warning: #FF9500;
--warning-light: rgba(255, 149, 0, 0.1);
--danger: #FF3B30;
--danger-light: rgba(255, 59, 48, 0.1);
--info: #5856D6;
/* 辅助色 */
--success: #55ab5c;
--success-light: rgba(85, 171, 92, 0.12);
--up-success: #55ab5c;
--up-success-light: #eaf6ec;
--warning: #FF9F0A;
--warning-light: rgba(255, 159, 10, 0.12);
--danger: #FF453A;
--danger-light: rgba(255, 69, 58, 0.12);
--info: #5E5CE6;
/* 中性色 - 微妙的蓝色底色 */
--gray-50: #F8F9FC;
--gray-100: #EEF1F5;
--gray-200: #D9DDE6;
--gray-300: #B8C0D0;
--gray-400: #8E95A8;
--gray-500: #6B7280;
--gray-600: #4B5563;
--gray-700: #374151;
--gray-800: #1F2937;
--gray-900: #111827;
/* 扩展色 */
--purple: #BF5AF2;
--pink: #FF375F;
--teal: #64D2FF;
--indigo: #5E5CE6;
/* 文字色 */
--text-primary: var(--gray-900);
--text-secondary: var(--gray-600);
--text-tertiary: var(--gray-400);
--text-inverse: #FFFFFF;
/* 中性色 - 灰阶 */
--gray-100: #F2F2F7;
--gray-200: #E5E5EA;
--gray-300: #D1D1D6;
--gray-400: #C7C7CC;
--gray-500: #AEAEB2;
--gray-600: #8E8E93;
--gray-700: #636366;
--gray-800: #3C3C43;
--gray-900: #000000;
/* 背景色 */
--bg-base: #F5F7FA;
--bg-surface: #FFFFFF;
--bg-elevated: #FFFFFF;
--bg-primary: #FFFFFF;
--bg-secondary: #F8F8F8;
--bg-tertiary: #FFFFFF;
--bg-grouped: #F2F2F7;
/* 阴影 - 更细腻 */
--shadow-xs: 0 1rpx 2rpx rgba(0, 0, 0, 0.04);
--shadow-sm: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
--shadow-md: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
--shadow-lg: 0 8rpx 32rpx rgba(0, 0, 0, 0.10);
--shadow-xl: 0 16rpx 48rpx rgba(0, 0, 0, 0.12);
/* 文字色 */
--text-primary: #000000;
--text-secondary: #3C3C43;
--text-tertiary: rgba(60, 60, 67, 0.6);
--text-quaternary: rgba(60, 60, 67, 0.3);
--text-inverse: #FFFFFF;
/* 阴影 */
--shadow-small: 0 2rpx 4rpx rgba(0, 0, 0, 0.06);
--shadow-medium: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
--shadow-large: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
--shadow-extra-large: 0 16rpx 48rpx rgba(0, 0, 0, 0.16);
/* 圆角 */
--radius-xs: 6rpx;
--radius-sm: 10rpx;
--radius-md: 16rpx;
--radius-lg: 24rpx;
--radius-xl: 32rpx;
--radius-small: 8rpx;
--radius-medium: 16rpx;
--radius-large: 24rpx;
--radius-extra-large: 32rpx;
--radius-full: 9999rpx;
/* 间距 - 4pt 基准 */
--space-1: 4rpx;
--space-2: 8rpx;
--space-3: 12rpx;
--space-4: 16rpx;
--space-5: 20rpx;
--space-6: 24rpx;
--space-8: 32rpx;
--space-10: 40rpx;
--space-12: 48rpx;
--space-16: 64rpx;
/* 间距 */
--space-xs: 8rpx;
--space-sm: 16rpx;
--space-md: 24rpx;
--space-lg: 32rpx;
--space-xl: 40rpx;
--space-2xl: 48rpx;
/* 过渡 */
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
--duration-fast: 0.15s;
--duration-normal: 0.25s;
--duration-slow: 0.4s;
--transition-fast: 0.2s ease-out;
--transition-normal: 0.3s ease-out;
--transition-slow: 0.5s ease-out;
/* 边框色 */
--border-color: var(--gray-200);
--border-light: var(--gray-100);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "MiSans", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "MiSans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
ul, li {
@@ -96,31 +98,36 @@
page {
color: var(--text-primary);
background-color: var(--bg-base);
min-height: 100vh;
background: var(--bg-secondary);
// min-height: 100vh;
}
.container {
display: flex;
flex-direction: column;
gap: var(--space-4);
padding: var(--space-5) var(--space-4);
gap: 20rpx;
padding: 30rpx 20rpx;
max-width: 750rpx;
margin: 0 auto;
width: 100%;
box-sizing: border-box;
}
.pd-20{
padding: 20rpx;
}
.card {
background: var(--bg-surface);
border-radius: var(--radius-lg);
padding: var(--space-5);
box-shadow: var(--shadow-sm);
transition: box-shadow var(--duration-normal) var(--ease-out),
transform var(--duration-normal) var(--ease-out);
background: var(--bg-primary);
border-radius: var(--radius-medium);
padding: var(--space-md);
border: 1rpx solid var(--border-color);
transition: all var(--transition-fast);
}
.card-elevated {
box-shadow: var(--shadow-lg);
transform: translateY(-2px);
box-shadow: var(--shadow-large);
transform: translateY(-4rpx);
}
.card-interactive {
@@ -129,343 +136,155 @@
-webkit-tap-highlight-color: transparent;
}
/* 排版系统 */
.text-display {
font-size: 48rpx;
.title {
font-weight: 700;
line-height: 1.1;
letter-spacing: -0.03em;
color: var(--text-primary);
}
.text-title {
font-size: 36rpx;
font-weight: 600;
font-size: 34rpx;
line-height: 1.2;
color: var(--text-primary);
letter-spacing: -0.02em;
color: var(--text-primary);
}
.text-heading {
font-size: 30rpx;
.subtitle {
font-weight: 600;
line-height: 1.25;
letter-spacing: -0.01em;
color: var(--text-primary);
}
.text-body {
font-size: 28rpx;
font-weight: 400;
line-height: 1.5;
line-height: 1.3;
color: var(--text-secondary);
}
.text-caption {
font-size: 24rpx;
font-weight: 500;
line-height: 1.4;
color: var(--text-tertiary);
}
.text-label {
font-size: 22rpx;
font-weight: 600;
line-height: 1.3;
letter-spacing: 0.02em;
color: var(--text-tertiary);
text-transform: uppercase;
}
/* 间距 */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
/* Flex */
.flex-row { display: flex; align-items: center; }
.flex-row-g2 { display: flex; align-items: center; gap: var(--space-2); }
.flex-row-g3 { display: flex; align-items: center; gap: var(--space-3); }
.flex-row-g4 { display: flex; align-items: center; gap: var(--space-4); }
.flex-row-g5 { display: flex; align-items: center; gap: var(--space-5); }
.flex-row-g6 { display: flex; align-items: center; gap: var(--space-6); }
.flex-row-sb { display: flex; align-items: center; justify-content: space-between; }
.flex-row-center { display: flex; align-items: center; justify-content: center; }
.flex-row-end { display: flex; align-items: center; justify-content: flex-end; }
.flex-col { display: flex; flex-direction: column; }
.flex-col-g2 { display: flex; flex-direction: column; gap: var(--space-2); }
.flex-col-g3 { display: flex; flex-direction: column; gap: var(--space-3); }
.flex-col-g4 { display: flex; flex-direction: column; gap: var(--space-4); }
.flex-col-g5 { display: flex; flex-direction: column; gap: var(--space-5); }
.flex-col-g6 { display: flex; flex-direction: column; gap: var(--space-6); }
.flex-col-center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.w-full { width: 100%; }
.h-full { height: 100%; }
/* 交互状态 */
.interactive {
transition: all var(--duration-normal) var(--ease-out);
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
/* 标签 */
.tag {
display: inline-flex;
align-items: center;
padding: var(--space-1) var(--space-3);
border-radius: var(--radius-full);
font-size: 22rpx;
font-weight: 600;
line-height: 1.4;
letter-spacing: 0.01em;
&.tag-default {
background: var(--gray-100);
color: var(--gray-600);
}
&.tag-success {
background: var(--success-light);
color: var(--success);
}
&.tag-primary {
background: var(--primary-tint);
color: var(--primary);
}
&.tag-warning {
background: var(--warning-light);
color: var(--warning);
}
&.tag-danger {
background: var(--danger-light);
color: var(--danger);
}
}
/* 进度条 */
.progress {
width: 100%;
height: 10rpx;
background: var(--gray-100);
border-radius: var(--radius-full);
overflow: hidden;
.progress-fill {
height: 100%;
background: var(--primary);
border-radius: var(--radius-full);
transition: width var(--duration-slow) var(--ease-out);
}
}
/* 按钮 */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: var(--radius-md);
font-weight: 600;
line-height: 1;
cursor: pointer;
transition: all var(--duration-fast) var(--ease-out);
user-select: none;
-webkit-tap-highlight-color: transparent;
padding: var(--space-4) var(--space-5);
.body {
font-weight: 400;
font-size: 28rpx;
background: var(--gray-100);
color: var(--text-primary);
&.btn-primary {
background: var(--primary);
color: var(--text-inverse);
}
&.btn-success {
background: var(--success);
color: var(--text-inverse);
}
&.btn-warning {
background: var(--warning);
color: var(--text-inverse);
}
&.btn-danger {
background: var(--danger);
color: var(--text-inverse);
}
&.btn-ghost {
background: transparent;
color: var(--primary);
}
&.btn-mini {
min-height: 52rpx;
padding: 0 var(--space-4);
font-size: 24rpx;
border-radius: var(--radius-sm);
}
&.btn-large {
min-height: 88rpx;
padding: 0 var(--space-8);
font-size: 32rpx;
border-radius: var(--radius-lg);
}
&.btn-disabled {
opacity: 0.4;
cursor: not-allowed;
pointer-events: none;
}
line-height: 1.4;
color: var(--text-secondary);
}
.btn-group {
display: flex;
gap: var(--space-3);
.btn {
flex: 1;
}
&.btn-group-vertical {
flex-direction: column;
}
.caption {
font-weight: 500;
font-size: 24rpx;
line-height: 1.3;
color: var(--text-tertiary);
}
/* 兼容旧类名 */
.mt-xs { margin-top: var(--space-2); }
.mt-sm { margin-top: var(--space-4); }
.mt-md { margin-top: var(--space-6); }
.mt-lg { margin-top: var(--space-8); }
.mt-xl { margin-top: var(--space-10); }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-30 { margin-top: 30rpx; }
.mt-20 { margin-top: 20rpx; }
.mb-xs { margin-bottom: var(--space-2); }
.mb-sm { margin-bottom: var(--space-4); }
.mb-md { margin-bottom: var(--space-6); }
.mb-lg { margin-bottom: var(--space-8); }
.mb-xl { margin-bottom: var(--space-10); }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.p-xs { padding: var(--space-2); }
.p-sm { padding: var(--space-4); }
.p-md { padding: var(--space-6); }
.p-lg { padding: var(--space-8); }
.p-xl { padding: var(--space-10); }
.p-xs { padding: var(--space-xs); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.flex-row-g8 { display: flex; align-items: center; gap: var(--space-2); }
.flex-row-g16 { display: flex; align-items: center; gap: var(--space-4); }
.flex-row { display: flex; align-items: center; }
.flex-row-g8 { display: flex; align-items: center; gap: var(--space-xs); }
.flex-row-g16 { display: flex; align-items: center; gap: var(--space-sm); }
.flex-row-g20 { display: flex; align-items: center; gap: 20rpx; }
.flex-row-g24 { display: flex; align-items: center; gap: var(--space-6); }
.flex-row-g24 { display: flex; align-items: center; gap: var(--space-md); }
.flex-row-sb { display: flex; align-items: center; justify-content: space-between; }
.flex-row-center { display: flex; align-items: center; justify-content: center; }
.flex-col-g8 { display: flex; flex-direction: column; gap: var(--space-2); }
.flex-col-g16 { display: flex; flex-direction: column; gap: var(--space-4); }
.flex-col { display: flex; flex-direction: column; }
.flex-col-g8 { display: flex; flex-direction: column; gap: var(--space-xs); }
.flex-col-g16 { display: flex; flex-direction: column; gap: var(--space-sm); }
.flex-col-g20 { display: flex; flex-direction: column; gap: 20rpx; }
.flex-col-g24 { display: flex; flex-direction: column; gap: var(--space-6); }
.flex-col-g24 { display: flex; flex-direction: column; gap: var(--space-md); }
.flex-col-center-g20 { display: flex; flex-direction: column; gap: 20rpx; align-items: center; justify-content: center; }
.flex-col-center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
/* 背景色 */
.bg-primary { background-color: var(--bg-surface); }
.bg-secondary { background-color: var(--bg-base); }
.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }
.bg-danger { background-color: var(--danger); }
.w-100 { width: 100%; }
.h-100 { height: 100%; }
/* 文字色 */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-inverse { color: var(--text-inverse); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
/* 旧标签兼容 */
.tag-apple {
display: inline-flex;
align-items: center;
padding: var(--space-1) var(--space-3);
background: var(--gray-100);
color: var(--gray-600);
border-radius: var(--radius-full);
font-size: 22rpx;
font-weight: 600;
letter-spacing: 0.01em;
&.tag-success {
background: var(--success-light);
color: var(--success);
}
&.tag-primary {
background: var(--primary-tint);
color: var(--primary);
}
&.tag-warning {
background: var(--warning-light);
color: var(--warning);
}
&.tag-danger {
background: var(--danger-light);
color: var(--danger);
}
.interactive {
transition: all var(--transition-normal);
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
/* 旧按钮兼容 */
.button-apple {
background: var(--primary);
color: var(--text-inverse);
border: none;
border-radius: var(--radius-md);
padding: var(--space-4) var(--space-5);
border-radius: var(--radius-medium);
padding: var(--space-sm) var(--space-md);
font-weight: 600;
font-size: 28rpx;
transition: all var(--duration-normal) var(--ease-out);
transition: all var(--transition-normal);
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.tag-apple {
display: inline-flex;
align-items: center;
padding: var(--space-xs) var(--space-sm);
background: var(--gray-100);
color: var(--text-secondary);
border-radius: var(--radius-small);
font-size: 22rpx;
font-weight: 600;
letter-spacing: 0.02em;
&.tag-success {
background: var(--success-light);
color: var(--success);
}
&.tag-primary {
background: rgba(85, 171, 92, 0.12);
color: var(--primary);
}
&.tag-warning {
background: var(--warning-light);
color: var(--warning);
}
&.tag-danger {
background: var(--danger-light);
color: var(--danger);
}
}
.progress-apple {
width: 100%;
height: 8rpx;
background: var(--gray-200);
border-radius: var(--radius-small);
overflow: hidden;
position: relative;
.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--primary), var(--primary-light));
border-radius: var(--radius-small);
transition: width var(--transition-normal);
}
}
.btn-apple {
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: var(--radius-sm);
border-radius: var(--radius-small);
font-weight: 500;
font-size: 26rpx;
line-height: 1;
cursor: pointer;
transition: all var(--duration-fast) var(--ease-out);
transition: all 0.2s ease;
user-select: none;
-webkit-tap-highlight-color: transparent;
padding: var(--space-5);
padding: 20rpx;
background: var(--gray-100);
color: var(--text-primary);
@@ -475,7 +294,7 @@
}
&.btn-success {
background: var(--success);
background: var(--primary);
color: var(--text-inverse);
}
@@ -490,44 +309,56 @@
}
&.btn-secondary {
background: var(--gray-200);
color: var(--gray-700);
background: var(--gray-300);
color: var(--text-secondary);
}
&.btn-mini {
min-height: 52rpx;
padding: 0 var(--space-4);
min-height: 40rpx;
padding: 0 16rpx;
font-size: 24rpx;
border-radius: var(--radius-xs);
border-radius: 6rpx;
}
&.btn-large {
min-height: 88rpx;
padding: 0 var(--space-8);
min-height: 64rpx;
padding: 0 32rpx;
font-size: 32rpx;
border-radius: var(--radius-md);
border-radius: var(--radius-medium);
}
&.btn-disabled {
opacity: 0.4;
cursor: not-allowed;
pointer-events: none;
}
}
/* 旧进度条兼容 */
.progress-apple {
width: 100%;
height: 10rpx;
background: var(--gray-100);
border-radius: var(--radius-full);
overflow: hidden;
.btn-group {
display: flex;
gap: 12rpx;
.progress-fill {
height: 100%;
background: var(--primary);
border-radius: var(--radius-full);
transition: width var(--duration-slow) var(--ease-out);
.btn-apple {
flex: 1;
}
&.btn-group-vertical {
flex-direction: column;
}
}
/* 通用背景色 */
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }
.bg-danger { background-color: var(--danger); }
/* 通用文字色 */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-inverse { color: var(--text-inverse); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
</style>

View File

@@ -9,25 +9,36 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 设置工作目录
WORKDIR /build
# 设置 npm 镜像源
RUN npm config set registry https://registry.npmmirror.com
# 安装 pnpm
RUN corepack enable && corepack prepare pnpm@10.15.0 --activate
# 复制 package.json利用 Docker 缓存)
COPY package.json ./
# 设置 pnpm 镜像源
RUN pnpm config set registry https://registry.npmmirror.com
# 复制 package.json 和 pnpm-lock.yaml利用 Docker 缓存)
COPY package.json pnpm-lock.yaml ./
# 安装所有依赖
RUN npm install --legacy-peer-deps
RUN pnpm install --frozen-lockfile
# 安装 git (用于获取 commit 信息)
RUN apk add --no-cache git
# 复制源代码
COPY . .
# 创建 src 目录软链接 (兼容 uni-app 新版本)
RUN mkdir -p src && \
ln -sf /build/manifest.json /build/src/manifest.json && \
ln -sf /build/pages.json /build/src/pages.json
# 构建 H5 生产版本
RUN npm run build:h5
RUN pnpm run build:h5
# ================================
# 阶段 2: 运行阶段
# ================================
FROM --platform=linux/amd64 nginx:alpine
FROM --platform=linux/amd64 nginx:1.31.2-alpine
# 使用阿里云镜像源加速
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
@@ -46,6 +57,8 @@ COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
# 从构建阶段复制构建产物
COPY --from=builder /build/dist/build/h5 /usr/share/nginx/html
COPY MP_verify_yU2Z8mp831jh6QX7.txt /usr/share/nginx/html/MP_verify_yU2Z8mp831jh6QX7.txt
COPY MP_verify_0UoX8yClVgREjgPj.txt /usr/share/nginx/html/MP_verify_0UoX8yClVgREjgPj.txt
COPY MP_verify_4E1dVbOcZ9KzTzoc.txt /usr/share/nginx/html/MP_verify_4E1dVbOcZ9KzTzoc.txt
# 暴露端口
EXPOSE 80

View File

@@ -0,0 +1 @@
0UoX8yClVgREjgPj

View File

@@ -0,0 +1 @@
4E1dVbOcZ9KzTzoc

View File

@@ -1,7 +1,9 @@
export { authApi } from './modules/auth.js';
export { assetApi } from './modules/asset.js';
export { assetApi, hasActiveOrPendingPackage, isAssetRealNameCompleted } from './modules/asset.js';
export { deviceApi } from './modules/device.js';
export { exchangeApi } from './modules/exchange.js';
export { orderApi } from './modules/order.js';
export { notificationApi } from './modules/notification.js';
export { realnameApi } from './modules/realname.js';
export { walletApi } from './modules/wallet.js';
export { walletApi } from './modules/wallet.js';
export { wechatApi } from './modules/wechat.js';

View File

@@ -1,12 +1,48 @@
import request from '@/utils/request.js';
export const normalizeAssetInfo = (data = {}) => ({
...data,
allowed_payment_methods: Array.isArray(data.allowed_payment_methods)
? data.allowed_payment_methods
: [],
real_name_status: data.real_name_status === undefined || data.real_name_status === null
? data.real_name_status
: Number(data.real_name_status),
realname_required: data.realname_required === undefined || data.realname_required === null
? data.realname_required
: data.realname_required === true || data.realname_required === 1,
days_until_final_expiry: data.days_until_final_expiry === null || data.days_until_final_expiry === undefined
? data.days_until_final_expiry
: Number(data.days_until_final_expiry),
is_expiring: data.is_expiring === undefined || data.is_expiring === null
? data.is_expiring
: data.is_expiring === true || data.is_expiring === 1
});
export const isAssetRealNameCompleted = (assetInfo = {}) => {
if (assetInfo.asset_type === 'device') {
return (assetInfo.cards || []).some((card) => Number(card?.real_name_status) === 1);
}
return Number(assetInfo.real_name_status) === 1;
};
export const hasActiveOrPendingPackage = async (identifier) => {
const [pendingData, activeData] = await Promise.all([
assetApi.getPackageHistory(identifier, 1, 1, { status: 0 }),
assetApi.getPackageHistory(identifier, 1, 1, { status: 1 })
]);
return [pendingData, activeData].some(data => Array.isArray(data?.items) && data.items.length > 0);
};
export const assetApi = {
getInfo(identifier) {
return request({
url: '/api/c/v1/asset/info',
method: 'GET',
data: { identifier }
});
}).then(normalizeAssetInfo);
},
getPackageHistory(identifier, page, page_size, params = {}) {
@@ -17,11 +53,14 @@ export const assetApi = {
});
},
getPackages(identifier) {
getPackages(identifier, packageType = '') {
return request({
url: '/api/c/v1/asset/packages',
method: 'GET',
data: { identifier }
data: {
identifier,
...(packageType ? { package_type: packageType } : {})
}
});
},
@@ -32,4 +71,4 @@ export const assetApi = {
data: { identifier }
});
}
};
};

View File

@@ -5,7 +5,8 @@ export const authApi = {
return request({
url: '/api/c/v1/auth/verify-asset',
method: 'POST',
data: { identifier }
data: { identifier },
showError: false
});
},
@@ -47,4 +48,4 @@ export const authApi = {
method: 'POST'
});
}
};
};

View File

@@ -0,0 +1,36 @@
import request from '@/utils/request.js';
export const notificationApi = {
getList(page = 1, page_size = 20, is_read) {
return request({
url: '/api/c/v1/notifications',
method: 'GET',
data: {
page,
page_size,
...(is_read === undefined ? {} : { is_read })
}
});
},
getUnreadCount() {
return request({
url: '/api/c/v1/notifications/unread-count',
method: 'GET'
});
},
markRead(id) {
return request({
url: `/api/c/v1/notifications/${id}/read`,
method: 'PUT'
});
},
markAllRead() {
return request({
url: '/api/c/v1/notifications/read-all',
method: 'PUT'
});
}
};

View File

@@ -21,19 +21,24 @@ export const orderApi = {
});
},
create(identifier, package_ids) {
create(identifier, package_ids, payment_method) {
const data = { identifier, package_ids, payment_method };
if (payment_method === 'wechat') {
data.app_type = APP_TYPE;
}
return request({
url: '/api/c/v1/orders/create',
method: 'POST',
data: { identifier, package_ids, app_type: APP_TYPE }
data
});
},
pay(order_id, payment_method, password) {
const data = {
payment_method,
app_type: APP_TYPE
};
const data = { payment_method };
if (payment_method === 'wechat') {
data.app_type = APP_TYPE;
}
if (password) {
data.password = password;
}
@@ -43,4 +48,4 @@ export const orderApi = {
data
});
}
};
};

View File

@@ -1,11 +1,12 @@
import request from '@/utils/request.js';
export const realnameApi = {
getLink(identifier, iccid) {
getLink(identifier, iccid, options = {}) {
return request({
url: '/api/c/v1/realname/link',
method: 'GET',
data: { identifier, iccid }
data: { identifier, iccid },
...options
});
}
};
};

View File

@@ -11,10 +11,15 @@ export const walletApi = {
},
recharge(identifier, amount, payment_method) {
const data = { identifier, amount, payment_method };
if (payment_method === 'wechat') {
data.app_type = APP_TYPE;
}
return request({
url: '/api/c/v1/wallet/recharge',
method: 'POST',
data: { identifier, amount, payment_method, app_type: APP_TYPE }
data
});
},
@@ -59,4 +64,4 @@ export const walletApi = {
data: { identifier, page, page_size, ...params }
});
}
};
};

18
api/modules/wechat.js Normal file
View File

@@ -0,0 +1,18 @@
import request from '@/utils/request.js';
export const wechatApi = {
getAppId() {
return request({
url: '/api/c/v1/wechat/appid',
method: 'GET'
});
},
getJssdkConfig(url) {
return request({
url: '/api/c/v1/wechat/jssdk-config',
method: 'GET',
data: { url }
});
}
};

View File

@@ -1,217 +1,107 @@
<template>
<view class="device-status-card">
<view class="card-header">
<text class="text-heading">设备信息</text>
<view class="operator-badge">
<text class="operator-name">中国电信</text>
</view>
<view class="card device-status-card">
<view class="card-header mb-md flex-row-sb">
<view class="title">设备信息</view>
<view class="tag-apple tag-success">{{ deviceInfo.carrier_name || '-' }}</view>
</view>
<view class="status-row">
<view class="status-item">
<text class="status-label">当前卡</text>
<text class="status-value iccid">{{ deviceInfo.currentIccid }}</text>
<view class="device-info flex-col-g16">
<view class="info-row flex-row-sb">
<view class="info-label">
<view class="subtitle">当前卡号 {{ deviceInfo.currentIccid }}</view>
</view>
<view class="info-values flex-row-g20" @tap="$emit('authentication')">
<view class="tag-apple" :class="isRealName ? 'tag-success' : 'tag-warning'">
{{ isRealName ? '已实名' : '未实名' }}
</view>
</view>
</view>
<view class="status-item">
<text class="status-label">实名状态</text>
<view class="auth-badge" :class="isRealName ? 'auth-done' : 'auth-pending'" @tap="$emit('authentication')">
<text>{{ isRealName ? '已实名' : '未实名' }}</text>
<text class="arrow"></text>
<view class="info-row flex-row-sb">
<view class="info-label">
<view class="subtitle" v-if="isDevice">IMEI{{ deviceInfo.imei || '-' }}</view>
<view class="subtitle" v-else>手机号{{ deviceInfo.bound_phone || '-' }}</view>
</view>
</view>
</view>
<view class="status-row">
<view class="status-item full-width">
<text class="status-label">到期时间</text>
<text class="status-value expire">{{ deviceInfo.expireDate }}</text>
<view class="device-metrics flex-row-sb mt-md">
<view class="metric-item flex-col-center">
<view class="caption mb-xs">信号判断</view>
<view class="metric-value">{{ deviceInfo.signal_quality || '暂无数据' }}</view>
</view>
<view class="metric-item flex-col-center">
<view class="caption mb-xs">设备电量</view>
<view class="metric-value">{{ deviceInfo.battery }} %</view>
</view>
<view class="metric-item flex-col-center">
<view class="caption mb-xs">连接数量</view>
<view class="metric-value">{{ deviceInfo.connCnt }}/{{ deviceInfo.max_clients }}</view>
</view>
</view>
<view class="metrics-grid">
<view class="metric-card">
<view class="metric-icon signal">
<image src="/static/signal.png" mode="aspectFit" v-if="false"></image>
<text class="metric-icon-text">📶</text>
</view>
<text class="metric-label">信号强度</text>
<text class="metric-value">{{ getSignalText(deviceInfo.rssi) }}</text>
</view>
<view class="metric-card">
<view class="metric-icon battery">
<text class="metric-icon-text">🔋</text>
</view>
<text class="metric-label">设备电量</text>
<text class="metric-value">{{ deviceInfo.battery }}%</text>
</view>
<view class="metric-card">
<view class="metric-icon connections">
<text class="metric-icon-text">📱</text>
</view>
<text class="metric-label">连接数量</text>
<text class="metric-value">{{ deviceInfo.connCnt }}/{{ deviceInfo.max_clients }}</text>
</view>
<view v-if="shouldShowSignalReason(deviceInfo)" class="signal-reason">
<text class="signal-reason-label">怀疑原因</text>
<text class="signal-reason-text">{{ deviceInfo.signal_bad_reason }}</text>
</view>
</view>
</template>
<script setup>
import { computed } from 'vue';
const props = defineProps({
defineProps({
deviceInfo: { type: Object, default: () => ({}) },
isRealName: { type: Boolean, default: false },
isDevice: { type: Boolean, default: true },
opratorList: { type: Array, default: () => [] }
});
defineEmits(['authentication']);
const getSignalText = (rssi) => rssi || '强';
const shouldShowSignalReason = (deviceInfo) =>
['信号较弱', '信号很差', '暂无数据'].includes(deviceInfo?.signal_quality) &&
!!deviceInfo?.signal_bad_reason;
</script>
<style scoped lang="scss">
.device-status-card {
background: var(--bg-surface);
border-radius: var(--radius-xl);
padding: var(--space-5);
box-shadow: var(--shadow-sm);
}
.info-row {
padding: var(--space-sm) 0;
border-bottom: 1rpx solid var(--gray-200);
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: var(--space-4);
border-bottom: 1rpx solid var(--gray-100);
margin-bottom: var(--space-4);
}
&:last-child {
border-bottom: none;
}
.operator-badge {
padding: var(--space-1) var(--space-3);
background: var(--primary-tint);
border-radius: var(--radius-full);
}
.info-label {
min-width: 200rpx;
}
.operator-name {
font-size: 22rpx;
font-weight: 600;
color: var(--primary);
}
.status-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--space-3) 0;
& + .status-row {
border-top: 1rpx solid var(--gray-50);
.info-values {
flex: 1;
justify-content: flex-end;
}
}
}
.status-item {
display: flex;
flex-direction: column;
gap: var(--space-1);
.device-metrics {
background: var(--gray-100);
border-radius: var(--radius-small);
padding: 20rpx;
&.full-width {
flex: 1;
.metric-item {
flex: 1;
}
}
}
.status-label {
font-size: 24rpx;
color: var(--text-tertiary);
}
.status-value {
font-size: 28rpx;
font-weight: 600;
color: var(--text-primary);
&.iccid {
font-family: "SF Mono", "Menlo", monospace;
.signal-reason {
margin-top: 16rpx;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
font-size: 24rpx;
line-height: 1.5;
text-align: center;
color: var(--text-secondary);
}
&.expire {
color: var(--primary);
.signal-reason-label {
color: var(--text-primary);
}
}
.auth-badge {
display: inline-flex;
align-items: center;
gap: 4rpx;
padding: var(--space-1) var(--space-3);
border-radius: var(--radius-full);
font-size: 24rpx;
font-weight: 600;
cursor: pointer;
transition: transform var(--duration-fast) var(--ease-out);
&:active {
transform: scale(0.96);
}
&.auth-done {
background: var(--success-light);
color: var(--success);
}
&.auth-pending {
background: var(--warning-light);
color: var(--warning);
}
.arrow {
font-size: 28rpx;
line-height: 1;
}
}
.metrics-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: var(--space-3);
margin-top: var(--space-5);
padding-top: var(--space-5);
border-top: 1rpx solid var(--gray-100);
}
.metric-card {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--space-2);
padding: var(--space-4);
background: var(--gray-50);
border-radius: var(--radius-md);
}
.metric-icon {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--radius-sm);
.metric-icon-text {
font-size: 32rpx;
}
}
.metric-label {
font-size: 22rpx;
color: var(--text-tertiary);
text-align: center;
}
.metric-value {
font-size: 28rpx;
font-weight: 700;
color: var(--text-primary);
text-align: center;
}
</style>
</style>

View File

@@ -1,17 +1,13 @@
<template>
<view class="service-card" @click="handleClick">
<view class="service-inner">
<view class="service-left">
<view class="service-icon-wrap">
<image class="service-icon" src="/static/link.png" mode="aspectFit"></image>
</view>
<view class="service-content">
<text class="service-title">需要帮助</text>
<text class="service-desc">专属客服在线解答</text>
</view>
<view class="floating-service-card" @click="handleClick">
<view class="service-left">
<image class="service-icon" src="/static/link.png" mode="aspectFit"></image>
<view class="service-content">
<text class="service-title">需要帮助</text>
<text class="service-desc">专属客服在线解答</text>
</view>
<view class="service-btn">立即联系</view>
</view>
<view class="service-btn">立即联系</view>
</view>
</template>
@@ -24,71 +20,56 @@
</script>
<style scoped lang="scss">
.service-card {
.floating-service-card {
position: fixed;
bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
left: var(--space-4);
right: var(--space-4);
z-index: 999;
}
.service-inner {
bottom: 20rpx;
left: 20rpx;
right: 20rpx;
height: 120rpx;
background: #fff;
border-radius: 60rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.12);
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--space-4) var(--space-5);
background: var(--bg-surface);
border-radius: var(--radius-xl);
box-shadow: var(--shadow-lg);
padding: 0 24rpx 0 24rpx;
z-index: 1000;
}
.service-left {
display: flex;
align-items: center;
gap: var(--space-4);
}
gap: 20rpx;
.service-icon-wrap {
width: 80rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
background: var(--primary-tint);
border-radius: var(--radius-md);
}
.service-icon {
width: 76rpx;
height: 76rpx;
}
.service-icon {
width: 44rpx;
height: 44rpx;
}
.service-content {
display: flex;
flex-direction: column;
gap: 4rpx;
.service-content {
display: flex;
flex-direction: column;
gap: 2rpx;
}
.service-title {
font-size: 28rpx;
font-weight: 600;
color: var(--text-primary);
}
.service-title {
font-size: 28rpx;
font-weight: 600;
color: var(--text-primary);
line-height: 1.3;
}
.service-desc {
font-size: 24rpx;
color: var(--text-tertiary);
line-height: 1.3;
.service-desc {
font-size: 22rpx;
color: var(--text-tertiary);
}
}
}
.service-btn {
padding: var(--space-3) var(--space-5);
background: var(--primary);
color: var(--text-inverse);
padding: 16rpx 32rpx;
background: #55ab5c;
color: #fff;
font-size: 26rpx;
font-weight: 600;
border-radius: var(--radius-full);
line-height: 1;
border-radius: 40rpx;
}
</style>
</style>

View File

@@ -1,22 +1,113 @@
<template>
<view class="card function-card">
<view class="card-header mb-5">
<text class="text-heading">功能服务</text>
</view>
<view class="function-grid">
<view
v-for="item in displayFunctions"
:key="item.key"
class="function-item interactive"
:class="{ 'is-disabled': item.disabled }"
@click="handleItemClick(item)"
role="button"
tabindex="0"
>
<view class="function-icon-wrap">
<image class="function-icon" :src="item.icon" mode="aspectFit" :alt="item.name"></image>
<view class="function-item interactive card-interactive" @tap="$emit('enter', 'authentication')"
role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-authentication" src="/static/authentication.png" mode="aspectFit" alt="实名认证"></image>
</view>
<text class="function-name" :class="{ 'text-primary-color': item.highlight }">{{ item.name }}</text>
<view :class="['function-name', realNameStatus === '已实名' ? 'text-primary' : '']">
{{ realNameStatus || '实名认证' }}
</view>
</view>
<view class="function-item interactive card-interactive" @tap="$emit('sync')" role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-data" src="/static/data.png" mode="aspectFit" alt="数据同步"></image>
</view>
<view class="function-name">数据同步</view>
</view>
<view class="function-item interactive card-interactive" @tap="$emit('enter', 'package-order')"
role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-shop" src="/static/shop.png" mode="aspectFit" alt="套餐订购"></image>
</view>
<view class="function-name">套餐订购</view>
</view>
<view class="function-item interactive card-interactive" @tap="$emit('enter', 'notifications')" role="button"
tabindex="0">
<view class="function-icon function-icon-badge">
<image class="function-image icon-notification" src="/static/notification.png" mode="aspectFit" alt="站内通知"></image>
<view v-if="unreadCount > 0" class="unread-badge">{{ unreadCount > 99 ? '99+' : unreadCount }}</view>
</view>
<view class="function-name">站内通知</view>
</view>
<view class="function-item interactive card-interactive" @tap="$emit('enter', 'order-list')" role="button"
tabindex="0">
<view class="function-icon">
<image class="function-image icon-order" src="/static/order.png" mode="aspectFit" alt="我的订单"></image>
</view>
<view class="function-name">我的订单</view>
</view>
<view class="function-item interactive card-interactive" v-if="isDevice" @tap="$emit('enter', 'back')"
role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-back" src="/static/back.png" mode="aspectFit" alt="后台管理"></image>
</view>
<view class="function-name">后台管理</view>
</view>
<view class="function-item interactive card-interactive" v-if="isDevice" @tap="$emit('enter', 'switch')"
role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-change" src="/static/change.png" mode="aspectFit" alt="切换运营商"></image>
</view>
<view class="function-name">切换运营商</view>
</view>
<view class="function-item interactive card-interactive" @tap="$emit('enter', 'asset-package')"
role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-asset-package" src="/static/asset-package-history.png" mode="aspectFit" alt="资产套餐"></image>
</view>
<view class="function-name">历史套餐</view>
</view>
<view class="function-item interactive card-interactive" @tap="handleBindPhone" role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-bind-phone" src="/static/bind-phone.png" mode="aspectFit" alt="绑定手机号"></image>
</view>
<view :class="['function-name', alreadyBindPhone ? 'text-primary' : 'text-danger']">
{{ alreadyBindPhone ? '已绑定' : '未绑定' }}
</view>
</view>
<view class="function-item interactive card-interactive" @tap="$emit('enter', 'change-phone')" role="button"
tabindex="0">
<view class="function-icon">
<image class="function-image icon-change-phone" src="/static/change-phone.png" mode="aspectFit" alt="更换手机号"></image>
</view>
<view class="function-name">更换手机号</view>
</view>
<view class="function-item interactive card-interactive"
@tap="$emit('enter', 'device-exchange')" role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-change" src="/static/change-shop.png" mode="aspectFit" alt="换货"></image>
</view>
<view class="function-name">换货</view>
</view>
<view class="function-item interactive card-interactive" @tap="$emit('enter', 'wallet')" role="button"
tabindex="0">
<view class="function-icon">
<image class="function-image icon-wallet" src="/static/wallet-home.png" mode="aspectFit" alt="钱包"></image>
</view>
<view class="function-name">{{ walletText }}</view>
</view>
<view class="function-item interactive card-interactive" v-if="isDevice" @tap="$emit('enter', 'restart')"
role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-restart" src="/static/restart.png" mode="aspectFit" alt="重启设备"></image>
</view>
<view class="function-name">重启设备</view>
</view>
<view class="function-item interactive card-interactive" v-if="isDevice" @tap="$emit('enter', 'recover')"
role="button" tabindex="0">
<view class="function-icon">
<image class="function-image icon-recover" src="/static/recover.png" mode="aspectFit" alt="恢复出厂"></image>
</view>
<view class="function-name">恢复出厂</view>
</view>
<view class="function-item interactive card-interactive" @tap="$emit('enter', 'out')" role="button"
tabindex="0">
<view class="function-icon">
<image class="function-image icon-out" src="/static/out.png" mode="aspectFit" alt="退出登录"></image>
</view>
<view class="function-name">退出登录</view>
</view>
</view>
@@ -39,100 +130,120 @@
isDevice: {
type: Boolean,
default: true
},
walletBalance: {
type: [Number, String],
default: 0
},
unreadCount: {
type: Number,
default: 0
}
});
const emit = defineEmits(['enter', 'sync']);
const functions = computed(() => {
const list = [
{ key: 'authentication', name: props.realNameStatus || '实名认证', icon: '/static/authentication.png', action: 'authentication', highlight: props.realNameStatus === '已实名' },
{ key: 'sync', name: '运营数据同步', icon: '/static/data.png', action: 'sync' },
{ key: 'package-order', name: '套餐订购', icon: '/static/shop.png', action: 'package-order' },
{ key: 'order-list', name: '我的订单', icon: '/static/order.png', action: 'order-list' },
{ key: 'back', name: '后台管理', icon: '/static/back.png', action: 'back', deviceOnly: true },
{ key: 'switch', name: '切换运营商', icon: '/static/change.png', action: 'switch', deviceOnly: true },
{ key: 'asset-package', name: '资产套餐历史', icon: '/static/shop.png', action: 'asset-package' },
{ key: 'bind', name: props.alreadyBindPhone ? '已绑定' : '绑定手机号', icon: '/static/bind-phone.png', action: 'bind', highlight: props.alreadyBindPhone, disabled: props.alreadyBindPhone },
{ key: 'change-phone', name: '更换手机号', icon: '/static/change-phone.png', action: 'change-phone' },
{ key: 'device-exchange', name: '设备换货', icon: '/static/change.png', action: 'device-exchange', deviceOnly: true },
{ key: 'wallet', name: '我的钱包', icon: '/static/wallet.png', action: 'wallet' },
{ key: 'recover', name: '重启设备', icon: '/static/recover.png', action: 'recover', deviceOnly: true },
{ key: 'restart', name: '恢复出厂', icon: '/static/restart.png', action: 'restart', deviceOnly: true },
{ key: 'out', name: '退出登录', icon: '/static/out.png', action: 'out' }
];
const formatWalletBalance = (balance) => {
const amount = Number(balance);
if (!Number.isFinite(amount) || amount === 0) return '0';
return list.filter(item => !item.deviceOnly || props.isDevice);
});
return (amount / 100).toFixed(2).replace(/\.?0+$/, '');
};
const displayFunctions = computed(() => functions.value);
const walletText = computed(() => `钱包 (${formatWalletBalance(props.walletBalance)})`);
const handleItemClick = (item) => {
if (item.disabled) return;
if (item.action === 'bind' && props.alreadyBindPhone) return;
if (item.action === 'sync') {
emit('sync');
} else {
emit('enter', item.action);
const handleBindPhone = () => {
if (props.alreadyBindPhone) {
return;
}
emit('enter', 'bind');
};
</script>
<style scoped lang="scss">
.function-card {
.card-header {
padding-bottom: var(--space-4);
border-bottom: 1rpx solid var(--gray-100);
display: flex;
justify-content: space-between;
align-items: center;
}
.function-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12rpx;
width: 100%;
.function-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 16rpx 8rpx;
.function-icon {
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
image {
width: 100%;
height: 100%;
}
.function-image {
transform-origin: center;
}
.icon-authentication,
.icon-shop,
.icon-back,
.icon-change-phone,
.icon-wallet,
.icon-restart {
transform: scale(0.9);
}
.icon-data { transform: scale(1.06); }
.icon-notification,
.icon-change,
.icon-asset-package { transform: scale(1.01); }
.icon-order,
.icon-recover { transform: scale(0.91); }
.icon-bind-phone { transform: scale(0.93); }
.icon-out { transform: scale(0.97); }
}
.function-icon-badge { position: relative; }
.unread-badge {
position: absolute;
top: -8rpx;
right: -12rpx;
min-width: 34rpx;
height: 34rpx;
padding: 0 8rpx;
border-radius: 20rpx;
background: var(--danger);
color: #fff;
font-size: 18rpx;
line-height: 34rpx;
text-align: center;
}
.function-name {
font-size: 24rpx;
font-weight: 500;
color: var(--text-primary);
text-align: center;
margin-top: 12rpx;
}
}
}
}
.function-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: var(--space-4);
padding-top: var(--space-5);
.text-primary {
color: var(--primary) !important;
}
.function-item {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--space-2);
padding: var(--space-3);
border-radius: var(--radius-md);
transition: background var(--duration-fast) var(--ease-out);
&:active {
background: var(--gray-50);
}
&.is-disabled {
opacity: 0.5;
pointer-events: none;
}
}
.function-icon-wrap {
width: 88rpx;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
background: var(--gray-50);
border-radius: var(--radius-md);
}
.function-icon {
width: 48rpx;
height: 48rpx;
}
.function-name {
font-size: 22rpx;
font-weight: 500;
color: var(--text-secondary);
text-align: center;
line-height: 1.3;
white-space: nowrap;
}
</style>
</style>

View File

@@ -0,0 +1,200 @@
<template>
<view v-if="show" class="notification-popup" @tap.stop>
<view class="notification-popup-card">
<view class="popup-header">
<view class="popup-heading">新通知</view>
<view class="popup-close" role="button" aria-label="关闭" @tap="$emit('close')">×</view>
</view>
<swiper class="notification-swiper" :current="current" @change="$emit('change', $event)">
<swiper-item v-for="item in items" :key="item.id">
<view class="notification-content">
<view class="notification-title">{{ item.title || '业务通知' }}</view>
<view class="notification-severity">{{ getNotificationMeta(item) }}</view>
<view class="notification-time">{{ formatDate(item.created_at) }}</view>
<scroll-view scroll-y class="notification-body">
<text>{{ item.body || '暂无通知内容' }}</text>
</scroll-view>
<up-button v-if="item.category === 'expiry'" class="renew-button" type="primary" size="small"
@tap.stop="$emit('renew', item)">立即续费</up-button>
</view>
</swiper-item>
</swiper>
<view v-if="items.length > 1" class="popup-footer">
<view class="popup-swipe-hint" aria-label="左右滑动切换通知">
<text class="swipe-arrow"></text>
<text>左右滑动切换通知</text>
<text class="swipe-arrow"></text>
</view>
<view class="popup-dots">
<view v-for="(_, index) in items" :key="index" class="popup-dot" :class="{ active: index === current }"></view>
</view>
<view class="popup-counter">{{ current + 1 }}/{{ items.length }} 左右滑动查看</view>
</view>
</view>
</view>
</template>
<script setup>
defineProps({
show: Boolean,
items: {
type: Array,
default: () => []
},
current: {
type: Number,
default: 0
}
});
defineEmits(['close', 'change', 'renew']);
const formatDate = (value) => {
if (!value) return '-';
return value.replace('T', ' ').slice(0, 16);
};
const getNotificationMeta = (item) => {
const category = {
expiry: '套餐临期',
exchange: '换货'
}[item?.category] || '业务通知';
const severity = {
info: '提示',
warning: '警告',
error: '错误',
critical: '严重'
}[item?.severity];
return severity ? `${category} · ${severity}` : category;
};
</script>
<style scoped lang="scss">
.notification-popup {
position: fixed;
z-index: 1000;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 40rpx;
background: rgba(0, 0, 0, 0.48);
}
.notification-popup-card {
width: 100%;
max-width: 640rpx;
overflow: hidden;
border-radius: 24rpx;
background: #fff;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.18);
}
.popup-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 32rpx 18rpx;
}
.popup-heading {
color: var(--text-primary);
font-size: 34rpx;
font-weight: 600;
}
.popup-close {
width: 52rpx;
height: 52rpx;
color: var(--text-tertiary);
font-size: 48rpx;
font-weight: 300;
line-height: 46rpx;
text-align: center;
}
.notification-swiper { height: 430rpx; }
.notification-content {
height: 100%;
box-sizing: border-box;
padding: 18rpx 32rpx 28rpx;
}
.notification-title {
color: var(--text-primary);
font-size: 32rpx;
font-weight: 600;
line-height: 1.45;
}
.notification-severity {
margin-top: 10rpx;
color: var(--primary);
font-size: 22rpx;
}
.notification-time {
margin-top: 12rpx;
color: var(--text-tertiary);
font-size: 22rpx;
}
.notification-body {
box-sizing: border-box;
height: 180rpx;
margin-top: 28rpx;
color: var(--text-secondary);
font-size: 28rpx;
line-height: 1.7;
white-space: pre-wrap;
}
.popup-footer {
padding: 0 32rpx 28rpx;
text-align: center;
}
.renew-button {
margin-top: 20rpx;
}
.popup-swipe-hint {
display: flex;
align-items: center;
justify-content: center;
gap: 8rpx;
margin-bottom: 16rpx;
color: var(--primary);
font-size: 24rpx;
font-weight: 500;
}
.swipe-arrow {
font-size: 34rpx;
line-height: 1;
}
.popup-dots {
display: flex;
justify-content: center;
gap: 10rpx;
}
.popup-dot {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background: #d8dce3;
}
.popup-dot.active { width: 28rpx; border-radius: 8rpx; background: var(--primary); }
.popup-counter {
margin-top: 12rpx;
color: var(--text-tertiary);
font-size: 22rpx;
}
</style>

View File

@@ -0,0 +1,510 @@
<template>
<up-popup :show="show" mode="center" @close="close">
<view class="renewal-popup">
<view class="popup-header">
<view class="popup-title">{{ popupTitle }}</view>
<view class="popup-close" @tap="close">×</view>
</view>
<view class="package-summary">
<view class="summary-name">{{ summaryName }}</view>
<view v-if="summaryPrice" class="summary-price">¥{{ summaryPrice }}</view>
</view>
<view class="payment-methods">
<view
v-for="method in paymentMethodOptions"
:key="method.value"
class="method-item"
:class="{ active: paymentMethod === method.value }"
@tap="selectPaymentMethod(method.value)"
>
<view class="method-left">
<image v-if="method.value === 'alipay'" class="method-icon" src="/static/支付宝支付.png" mode="aspectFit"></image>
<image v-else-if="method.value === 'wallet'" class="method-icon" src="/static/wallet.png" mode="aspectFit"></image>
<image v-else-if="method.value === 'wechat'" class="method-icon" src="/static/微信支付.png" mode="aspectFit"></image>
<text class="method-name">{{ method.label }}</text>
</view>
<view class="method-radio" :class="{ checked: paymentMethod === method.value }"></view>
</view>
<view v-if="paymentMethodOptions.length === 0" class="method-empty">暂无可用支付方式</view>
</view>
<view class="popup-footer">
<button class="btn-apple btn-secondary" @tap="close">取消</button>
<button class="btn-apple btn-primary" :disabled="submitting" @tap="confirmPay">
{{ submitting ? '处理中...' : confirmText }}
</button>
</view>
</view>
</up-popup>
</template>
<script setup>
import { ref, computed } from 'vue';
import { assetApi, isAssetRealNameCompleted, orderApi } from '@/api/index.js';
import {
handlePaymentError,
isValidAlipayPaymentLink,
isValidWechatPayConfig,
openAlipayPayment,
PAYMENT_REFRESH_TARGETS,
showPaymentToast,
wechatH5Pay
} from '@/utils/payment.js';
import { formatMoney } from '@/utils/display.js';
import { getDefaultPaymentMethod, getPaymentMethodOptions, normalizePaymentMethods } from '@/utils/payment-methods.js';
const props = defineProps({
identifier: { type: String, default: '' },
paymentRefreshTarget: { type: String, default: PAYMENT_REFRESH_TARGETS.ORDER_LIST }
});
const emit = defineEmits(['completed']);
const show = ref(false);
const submitting = ref(false);
const packageIds = ref([]);
const packageNames = ref([]);
const renewalPrice = ref(null);
const paymentMethod = ref('alipay');
const allowedPaymentMethods = ref([]);
const assetInfo = ref({});
const operationMode = ref('renewal');
const orderPaymentId = ref(null);
const paymentMethodOptions = computed(() => getPaymentMethodOptions(allowedPaymentMethods.value));
const packageNamesText = computed(() => packageNames.value.filter(Boolean).join('、') || '当前套餐');
const popupTitle = computed(() => operationMode.value === 'order-payment' ? '立即支付' : '立即续费');
const summaryName = computed(() => operationMode.value === 'order-payment'
? packageNamesText.value.replace(/^当前套餐$/, '当前订单')
: packageNamesText.value);
const summaryPrice = computed(() => renewalPrice.value === null || renewalPrice.value === undefined || renewalPrice.value === ''
? ''
: formatMoney(renewalPrice.value));
const confirmText = computed(() => operationMode.value === 'order-payment' ? '确认支付' : '确认续费');
const hasPreparedPaymentData = (paymentData) => {
return isValidWechatPayConfig(paymentData?.pay_config) ||
isValidAlipayPaymentLink(paymentData?.payment_link);
};
const close = () => {
if (!submitting.value) show.value = false;
};
const loadAssetInfo = async () => {
assetInfo.value = await assetApi.getInfo(props.identifier);
allowedPaymentMethods.value = normalizePaymentMethods(assetInfo.value.allowed_payment_methods);
paymentMethod.value = getDefaultPaymentMethod(allowedPaymentMethods.value);
};
const open = async (ids, names = [], price = null) => {
operationMode.value = 'renewal';
orderPaymentId.value = null;
renewalPrice.value = price;
const validIds = [...new Set((Array.isArray(ids) ? ids : [ids])
.map((value) => Number(value))
.filter((value) => Number.isInteger(value) && value > 0))];
if (!validIds.length) {
uni.showToast({ title: '当前暂无可续费套餐', icon: 'none' });
return;
}
if (!props.identifier) {
uni.showToast({ title: '未找到当前资产', icon: 'none' });
return;
}
packageIds.value = validIds;
packageNames.value = Array.isArray(names) ? names.filter(Boolean) : [];
try {
await loadAssetInfo();
} catch (error) {
console.error('加载续费支付方式失败', error);
uni.showToast({ title: error.msg || error.message || '加载支付方式失败', icon: 'none' });
return;
}
if (assetInfo.value.effective_realname_policy === 'before_order' &&
assetInfo.value.realname_required && !isAssetRealNameCompleted(assetInfo.value)) {
uni.showModal({
title: '需要实名认证',
content: '当前资产下单前需要完成实名认证',
confirmText: '去认证',
cancelText: '取消',
success: ({ confirm }) => {
if (confirm) uni.navigateTo({ url: '/pages/auth/auth' });
}
});
return;
}
if (!paymentMethodOptions.value.length) {
uni.showToast({ title: '暂无可用支付方式', icon: 'none' });
return;
}
show.value = true;
};
const openOrderPayment = async (orderId, names = []) => {
if (!orderId) return;
if (!props.identifier) {
uni.showToast({ title: '未找到当前资产', icon: 'none' });
return;
}
operationMode.value = 'order-payment';
orderPaymentId.value = orderId;
renewalPrice.value = null;
packageIds.value = [];
packageNames.value = Array.isArray(names) ? names.filter(Boolean) : [];
try {
await loadAssetInfo();
} catch (error) {
console.error('加载订单支付方式失败', error);
uni.showToast({ title: error.msg || error.message || '加载支付方式失败', icon: 'none' });
return;
}
if (!paymentMethodOptions.value.length) {
uni.showToast({ title: '暂无可用支付方式', icon: 'none' });
return;
}
show.value = true;
};
const selectPaymentMethod = (method) => {
if (paymentMethodOptions.value.some((item) => item.value === method)) {
paymentMethod.value = method;
}
};
const confirmOrderStatus = async (orderId) => {
try {
const detail = await orderApi.getDetail(orderId);
const status = detail?.payment_status ?? detail?.order?.payment_status;
showPaymentToast(status === 2, status === 2 ? '支付成功' : '支付结果确认中');
if (status === 2) emit('completed');
} catch (error) {
console.error('确认订单支付状态失败', error);
showPaymentToast(false, '支付结果确认失败,请稍后查看订单');
}
};
const handlePreparedPayment = async (paymentData, orderId = null, isRecharge = false) => {
if (isValidWechatPayConfig(paymentData?.pay_config)) {
try {
await wechatH5Pay(paymentData.pay_config);
if (orderId) {
await confirmOrderStatus(orderId);
} else {
showPaymentToast(true, isRecharge ? '充值成功,套餐将自动购买' : '支付成功');
emit('completed');
}
} catch (error) {
handlePaymentError(error);
}
return;
}
if (isValidAlipayPaymentLink(paymentData?.payment_link)) {
await openAlipayPayment(paymentData.payment_link, props.paymentRefreshTarget);
return;
}
uni.showToast({ title: '支付参数获取失败', icon: 'none' });
};
const handleRechargeOrder = async (orderResult) => {
const recharge = orderResult.recharge;
if (recharge.status === 2 || recharge.status === 3) {
uni.showToast({ title: `充值订单${recharge.status_name || '不可支付'},请重新下单`, icon: 'none' });
return;
}
if (recharge.status === 1 && !hasPreparedPaymentData(orderResult)) {
uni.showModal({
title: '提示',
content: '检测到您有待支付的充值订单,是否前往我的钱包查看?',
confirmText: '去查看',
cancelText: '取消',
success: ({ confirm }) => {
if (confirm) uni.navigateTo({ url: '/pages/my-wallet/my-wallet' });
}
});
return;
}
if (!hasPreparedPaymentData(orderResult)) {
uni.showToast({ title: '支付参数获取失败', icon: 'none' });
return;
}
const packageName = packageNamesText.value;
const rechargeAmount = orderResult.linked_package_info?.force_recharge_amount || recharge.amount;
uni.showModal({
title: '需要充值',
content: `续费${packageName}需要先充值¥${formatMoney(rechargeAmount)},充值成功后将自动购买套餐`,
confirmText: '去充值',
cancelText: '取消',
success: async ({ confirm }) => {
if (confirm) await handlePreparedPayment(orderResult, null, true);
}
});
};
const confirmPay = async () => {
if (submitting.value) return;
if (operationMode.value === 'order-payment') {
await confirmOrderPayment();
return;
}
if (!packageIds.value.length) return;
submitting.value = true;
uni.showLoading({ title: '创建订单...', mask: true });
try {
const orderResult = await orderApi.create(props.identifier, packageIds.value, paymentMethod.value);
if (orderResult?.order_type === 'recharge' && orderResult.recharge) {
uni.hideLoading();
show.value = false;
await handleRechargeOrder(orderResult);
return;
}
const orderId = orderResult?.order?.order_id;
if (!orderId) {
uni.hideLoading();
show.value = false;
uni.showToast({ title: '订单创建失败', icon: 'none' });
return;
}
uni.showLoading({ title: '准备支付...', mask: true });
const payResult = await orderApi.pay(orderId, paymentMethod.value);
uni.hideLoading();
show.value = false;
if (paymentMethod.value === 'wallet') {
await confirmOrderStatus(orderId);
return;
}
await handlePreparedPayment(payResult, orderId);
} catch (error) {
uni.hideLoading();
show.value = false;
console.error('创建续费订单或支付失败', error);
uni.showToast({ title: error.msg || error.message || '操作失败,请稍后重试', icon: 'none' });
} finally {
submitting.value = false;
}
};
const confirmOrderPayment = async () => {
if (!orderPaymentId.value) return;
submitting.value = true;
uni.showLoading({ title: '准备支付...', mask: true });
try {
const payData = await orderApi.pay(orderPaymentId.value, paymentMethod.value);
uni.hideLoading();
show.value = false;
if (paymentMethod.value === 'wallet') {
await confirmOrderStatus(orderPaymentId.value);
return;
}
if (paymentMethod.value === 'wechat') {
if (!isValidWechatPayConfig(payData?.pay_config)) {
uni.showToast({ title: '支付参数获取失败', icon: 'none' });
return;
}
try {
await wechatH5Pay(payData.pay_config);
await confirmOrderStatus(orderPaymentId.value);
} catch (error) {
handlePaymentError(error);
}
return;
}
if (!isValidAlipayPaymentLink(payData?.payment_link)) {
uni.showToast({ title: '支付链接获取失败', icon: 'none' });
return;
}
await openAlipayPayment(payData.payment_link, props.paymentRefreshTarget);
} catch (error) {
uni.hideLoading();
console.error('订单支付失败', error);
uni.showToast({ title: error.msg || error.message || '支付失败,请稍后重试', icon: 'none' });
} finally {
submitting.value = false;
}
};
const payOrderDirectly = async (orderId, method = 'wallet') => {
if (!orderId || submitting.value) return;
submitting.value = true;
uni.showLoading({ title: '准备支付...', mask: true });
try {
await orderApi.pay(orderId, method);
uni.hideLoading();
if (method === 'wallet') {
await confirmOrderStatus(orderId);
}
} catch (error) {
uni.hideLoading();
console.error('直接支付订单失败', error);
uni.showToast({ title: error.msg || error.message || '支付失败,请稍后重试', icon: 'none' });
} finally {
submitting.value = false;
}
};
defineExpose({ open, openOrderPayment, payOrderDirectly });
</script>
<style scoped lang="scss">
.renewal-popup {
width: 600rpx;
max-width: calc(100vw - 80rpx);
padding: 0;
box-sizing: border-box;
background: #fff;
border-radius: 24rpx;
overflow: hidden;
}
.popup-header,
.popup-footer,
.method-left {
display: flex;
align-items: center;
}
.popup-header {
justify-content: space-between;
padding: 30rpx;
border-bottom: 1rpx solid var(--border-light);
}
.popup-title {
color: var(--text-primary);
font-size: 32rpx;
font-weight: 600;
}
.popup-close {
width: 48rpx;
height: 48rpx;
color: var(--text-tertiary);
font-size: 40rpx;
line-height: 48rpx;
text-align: center;
}
.package-summary {
padding: 32rpx 30rpx 24rpx;
background: transparent;
text-align: center;
}
.summary-name {
margin: 0;
color: var(--text-primary);
font-size: 32rpx;
font-weight: 700;
line-height: 1.4;
}
.summary-price {
margin-top: 14rpx;
color: var(--primary);
font-size: 48rpx;
font-weight: 700;
line-height: 1.2;
}
.payment-methods {
padding: 30rpx;
}
.method-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx;
margin-bottom: 20rpx;
border: 2rpx solid var(--border-light);
border-radius: var(--radius-medium);
transition: all 0.3s;
&:last-child { margin-bottom: 0; }
&.active {
border-color: var(--primary);
background: rgba(85, 171, 92, 0.05);
}
}
.method-left { gap: 20rpx; }
.method-icon {
width: 64rpx;
height: 64rpx;
}
.method-badge {
display: flex;
align-items: center;
justify-content: center;
background: #07c160;
color: #fff;
font-size: 24rpx;
font-weight: 600;
}
.method-badge-alipay { background: #1677ff; }
.method-name { color: var(--text-primary); font-size: 28rpx; }
.method-radio {
width: 36rpx;
height: 36rpx;
border: 2rpx solid var(--gray-400);
border-radius: 50%;
position: relative;
&.checked {
border-color: var(--primary);
background: var(--primary);
&::after {
content: '✓';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #fff;
font-size: 20rpx;
font-weight: 700;
}
}
}
.method-empty {
padding: 28rpx;
color: var(--text-tertiary);
font-size: 26rpx;
text-align: center;
}
.popup-footer {
display: flex;
padding: 30rpx;
gap: 20rpx;
border-top: 1rpx solid var(--border-light);
button {
flex: 1;
margin: 0;
}
}
</style>

View File

@@ -1,40 +1,36 @@
<template>
<view class="traffic-card">
<view class="card-header">
<text class="text-heading">本月流量</text>
<view class="usage-indicator">
<text class="usage-value">{{ usedFlowPercent }}</text>
<text class="usage-unit">%</text>
<view class="card traffic-card">
<view class="card-header flex-row-sb mb-lg">
<view class="title">本月流量</view>
<view class="usage-percent">
<text class="title">{{ usedFlowPercent }}</text>
<text class="caption">%</text>
</view>
</view>
<view class="progress-section">
<view class="progress-track">
<view class="progress-fill" :style="{ width: usedFlowPercent + '%' }"></view>
<view class="progress-section mb-lg">
<view class="progress-apple">
<view class="progress-fill" :style="{width: usedFlowPercent + '%'}"></view>
</view>
</view>
<view class="traffic-stats">
<view class="stat-item">
<text class="stat-label">已使用</text>
<view class="stat-value-wrap">
<view class="traffic-stats flex-row-sb">
<view class="stat-item flex-col-center">
<view class="caption mb-xs">已使用</view>
<view class="stat-value-container">
<text class="stat-value">{{ usedValue }}</text>
<text class="stat-unit">{{ usedUnit }}</text>
</view>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-label">总流量</text>
<view class="stat-value-wrap">
<view class="stat-item flex-col-center">
<view class="caption mb-xs">总流量</view>
<view class="stat-value-container">
<text class="stat-value">{{ totalValue }}</text>
<text class="stat-unit">{{ totalUnit }}</text>
</view>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-label">剩余</text>
<view class="stat-value-wrap">
<text class="stat-value remain">{{ remainValue }}</text>
<view class="stat-item flex-col-center">
<view class="caption mb-xs">剩余</view>
<view class="stat-value-container">
<text class="stat-value">{{ remainValue }}</text>
<text class="stat-unit">{{ remainUnit }}</text>
</view>
</view>
@@ -43,12 +39,23 @@
</template>
<script setup>
import { ref, computed, watch } from 'vue';
import { assetApi } from '@/api/index.js';
import { useUserStore } from '@/store/index.js';
import {
ref,
computed,
watch
} from 'vue';
import {
assetApi
} from '@/api/index.js';
import {
useUserStore
} from '@/store/index.js';
const props = defineProps({
identifier: { type: String, default: '' }
identifier: {
type: String,
default: ''
}
});
const emit = defineEmits(['packageLoaded']);
@@ -60,10 +67,15 @@
const totalMB = ref(0);
const remainMB = ref(0);
const toMB = (value) => Number(value) || 0;
// 格式化流量数据MB 转 GB
const formatTraffic = (mb) => {
if (!mb || mb === 0) {
return { value: '0.00', unit: 'MB' };
return {
value: '0.00',
unit: 'MB'
};
}
if (mb >= 1024) {
@@ -93,41 +105,41 @@
// 使用百分比
const usedFlowPercent = computed(() => {
if (totalMB.value && usedMB.value) {
if (totalMB.value > 0) {
const percent = (usedMB.value / totalMB.value * 100);
return Math.min(percent, 100).toFixed(1);
return Math.min(percent, 100).toFixed(2);
}
return '0.0';
return '0.00';
});
const getTrafficMetrics = (data) => {
const enableVirtualData = !!data.enable_virtual_data;
const used = enableVirtualData ? toMB(data.virtual_used_mb) : toMB(data.real_used_mb);
const total = toMB(data.real_total_mb);
const remain = Math.max(total - used, 0);
return {
used,
total,
remain
};
};
// 加载套餐流量数据
const loadPackageData = async () => {
const identifier = props.identifier || userStore.state.identifier;
if (!identifier) return;
try {
const data = await assetApi.getPackageHistory(identifier, 1, 10, { status: 1 });
const data = await assetApi.getInfo(identifier);
if (data.items && data.items.length > 0) {
// 只有一个生效中的套餐
const activePackage = data.items[0];
if (activePackage.enable_virtual_data) {
// 启用虚流量
usedMB.value = activePackage.virtual_used_mb || 0;
totalMB.value = activePackage.virtual_limit_mb || 0;
remainMB.value = activePackage.virtual_remain_mb || 0;
} else {
// 未启用虚流量,使用真流量
usedMB.value = activePackage.data_usage_mb || 0;
totalMB.value = activePackage.data_limit_mb || 0;
remainMB.value = totalMB.value - usedMB.value;
}
// 将套餐信息(包括到期时间)传递给父组件
emit('packageLoaded', activePackage);
if (data.current_package_usage_id) {
const metrics = getTrafficMetrics(data);
usedMB.value = metrics.used;
totalMB.value = metrics.total;
remainMB.value = metrics.remain;
emit('packageLoaded', data);
} else {
// 没有生效中的套餐
usedMB.value = 0;
totalMB.value = 0;
remainMB.value = 0;
@@ -143,110 +155,34 @@
if (newVal) {
loadPackageData();
}
}, { immediate: true });
}, {
immediate: true
});
</script>
<style scoped lang="scss">
.traffic-card {
background: var(--bg-surface);
border-radius: var(--radius-xl);
padding: var(--space-5);
box-shadow: var(--shadow-sm);
}
.usage-percent {
display: flex;
align-items: baseline;
gap: 4rpx;
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--space-5);
}
.title {
font-size: 35rpx;
font-weight: 700;
margin-right: 5rpx;
}
}
.usage-indicator {
display: flex;
align-items: baseline;
gap: 2rpx;
}
.traffic-stats {
background: var(--gray-100);
border-radius: var(--radius-small);
padding: 20rpx;
margin-top: 16rpx;
.usage-value {
font-size: 48rpx;
font-weight: 700;
color: var(--primary);
letter-spacing: -0.02em;
line-height: 1;
}
.usage-unit {
font-size: 28rpx;
font-weight: 600;
color: var(--text-tertiary);
}
.progress-section {
margin-bottom: var(--space-5);
}
.progress-track {
height: 14rpx;
background: var(--gray-100);
border-radius: var(--radius-full);
overflow: hidden;
}
.progress-fill {
height: 100%;
background: var(--primary);
border-radius: var(--radius-full);
transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.traffic-stats {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--space-4);
background: var(--gray-50);
border-radius: var(--radius-lg);
}
.stat-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: var(--space-1);
}
.stat-divider {
width: 1rpx;
height: 60rpx;
background: var(--gray-200);
}
.stat-label {
font-size: 24rpx;
color: var(--text-tertiary);
}
.stat-value-wrap {
display: flex;
align-items: baseline;
gap: 4rpx;
}
.stat-value {
font-size: 32rpx;
font-weight: 700;
color: var(--text-primary);
line-height: 1.1;
&.remain {
color: var(--success);
.stat-item {
flex: 1;
}
}
}
.stat-unit {
font-size: 22rpx;
font-weight: 500;
color: var(--text-tertiary);
}
</style>
</style>

View File

@@ -1,166 +1,94 @@
<template>
<view class="user-info-card">
<view class="card-main">
<view class="user-avatar">
<image :src="avatarUrl" mode="aspectFill" alt="用户头像" />
</view>
<view class="user-details">
<view class="user-id">
<text class="device-id">{{ currentCardNo || '-' }}</text>
<view class="status-badge" :class="isOnline ? 'status-online' : 'status-offline'">
<text class="status-dot"></text>
<text class="status-text">{{ isOnline ? '在线' : '离线' }}</text>
</view>
<view class="card user-info-card interactive">
<view class="flex-row-g20">
<view class="user-details flex-col-g8">
<view class="info-copy-row">
<view class="title">{{ currentCardNo || '-' }}</view>
<image class="copy-icon" src="/static/复制.png" mode="aspectFit"
@tap.stop="copyText(currentCardNo, '号码')" aria-label="复制号码"></image>
</view>
<view class="user-meta">
<text class="meta-text" v-if="isDevice">IMEI{{ deviceInfo.imei || '-' }}</text>
<text class="meta-text" v-else>手机号{{ deviceInfo.bound_phone || '-' }}</text>
<view v-if="!isDevice" class="info-copy-row">
<view class="caption">ICCID{{ deviceInfo.iccid || '-' }}</view>
<image class="copy-icon" src="/static/复制.png" mode="aspectFit"
@tap.stop="copyText(deviceInfo.iccid, 'ICCID')" aria-label="复制ICCID"></image>
</view>
<view class="caption">套餐名称{{ deviceInfo.packageName || '-' }}</view>
<view class="caption" :class="{ 'expiry-warning': isExpiring }">
套餐到期时间{{ deviceInfo.expireDate || '-' }}
<text v-if="isExpiring && expiryDays !== null">剩余 {{ expiryDays }} </text>
</view>
</view>
</view>
<view class="card-footer" v-if="!isDevice">
<view class="network-badge" :class="networkStatus == 1 ? 'network-ok' : 'network-stop'">
<view v-if="isDevice" class="tag-apple" :class="onlineStatus === '在线' ? 'tag-success' : 'tag-warning'">
{{ onlineStatus }}
</view>
<view v-else class="tag-apple" :class="networkStatus == 1 ? 'tag-success' : 'tag-warning'">
{{ networkStatus == 1 ? '正常' : '停机' }}
</view>
</view>
<up-button v-if="hasPackageName" class="renew-button" type="primary" size="small"
@tap.stop="emit('renew')">立即续费</up-button>
</view>
</template>
<script setup>
import { computed } from 'vue';
import { useUserStore } from '@/store/index.js';
const emit = defineEmits(['renew']);
const props = defineProps({
currentCardNo: { type: String, default: '' },
deviceInfo: { type: Object, default: () => ({}) },
onlineStatus: { type: String, default: '离线' },
networkStatus: { type: [String, Number], default: '离线' },
isDevice: { type: Boolean, default: true }
isDevice: { type: Boolean, default: true },
isExpiring: { type: Boolean, default: false },
expiryDays: { type: [Number, String], default: null }
});
const userStore = useUserStore();
const defaultAvatar = 'https://img1.baidu.com/it/u=2462918877,1866131262&fm=253&fmt=auto&app=138&f=JPEG?w=506&h=500';
const avatarUrl = computed(() => {
return userStore.state.userInfo.avatar || defaultAvatar;
const hasPackageName = computed(() => {
const packageName = String(props.deviceInfo?.packageName || '').trim();
return Boolean(packageName && packageName !== '-');
});
const isOnline = computed(() => {
return props.onlineStatus === '在线';
});
const copyText = (value, label) => {
const text = String(value || '').trim();
if (!text || text === '-') return;
uni.setClipboardData({
data: text,
success: () => uni.showToast({ title: `${label}已复制`, icon: 'success' })
});
};
</script>
<style scoped lang="scss">
.user-info-card {
background: var(--bg-surface);
border-radius: var(--radius-xl);
padding: var(--space-5);
box-shadow: var(--shadow-md);
}
.card-main {
display: flex;
align-items: center;
gap: var(--space-4);
}
.user-avatar {
width: 96rpx;
height: 96rpx;
border-radius: var(--radius-lg);
overflow: hidden;
border: 4rpx solid var(--gray-100);
flex-shrink: 0;
image {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.user-details {
flex: 1;
min-width: 0;
}
.user-id {
display: flex;
align-items: center;
gap: var(--space-3);
flex-wrap: wrap;
}
.device-id {
font-size: 32rpx;
font-weight: 700;
color: var(--text-primary);
letter-spacing: -0.01em;
}
.status-badge {
display: inline-flex;
align-items: center;
gap: 6rpx;
padding: 4rpx 12rpx;
border-radius: var(--radius-full);
font-size: 20rpx;
font-weight: 600;
}
.expiry-warning { color: var(--danger); }
.status-online {
background: var(--success-light);
color: var(--success);
}
.user-details {
flex: 1;
}
.status-offline {
background: var(--warning-light);
color: var(--warning);
}
.info-copy-row {
display: flex;
align-items: center;
gap: 12rpx;
}
.status-dot {
width: 8rpx;
height: 8rpx;
border-radius: 50%;
background: currentColor;
}
.copy-icon {
width: 28rpx;
height: 28rpx;
flex-shrink: 0;
cursor: pointer;
}
.status-text {
line-height: 1;
}
.renew-button {
margin: 24rpx 0 0;
width: 180rpx;
margin-left: auto;
}
.user-meta {
margin-top: var(--space-2);
}
.meta-text {
font-size: 24rpx;
color: var(--text-tertiary);
}
.card-footer {
margin-top: var(--space-4);
padding-top: var(--space-4);
border-top: 1rpx solid var(--gray-100);
}
.network-badge {
display: inline-flex;
align-items: center;
padding: var(--space-2) var(--space-4);
border-radius: var(--radius-full);
font-size: 24rpx;
font-weight: 600;
}
.network-ok {
background: var(--success-light);
color: var(--success);
}
.network-stop {
background: var(--danger-light);
color: var(--danger);
}
</style>
</style>

View File

@@ -1,124 +1,54 @@
<template>
<view class="wifi-card">
<view class="card-header">
<text class="text-heading">WiFi配置</text>
<button class="btn btn-mini btn-primary" @tap="$emit('modify')">修改</button>
</view>
<view class="wifi-list">
<view class="wifi-item">
<view class="wifi-icon-wrap">
<text class="wifi-icon-text">📶</text>
</view>
<view class="wifi-content">
<text class="wifi-label">网络名称</text>
<text class="wifi-value">{{ deviceInfo.ssidName }}</text>
</view>
<button class="btn-copy" @tap="$emit('copy', deviceInfo.ssidName)">复制</button>
<view class="card wifi-card">
<view class="card-header flex-row-sb">
<view class="title">WiFi配置</view>
<view class="btn-group">
<button class="btn-apple btn-primary btn-mini" @tap="copyConfig">复制配置</button>
<button class="btn-apple btn-primary btn-mini" @tap="$emit('modify')">修改配置</button>
</view>
<view class="wifi-item">
<view class="wifi-icon-wrap">
<text class="wifi-icon-text">🔑</text>
</view>
<view class="wifi-info flex-col-g16 mt-30">
<view class="wifi-item flex-row-sb">
<view class="wifi-details flex-col-g8">
<view class="caption">网络名称</view>
<view class="subtitle">{{ deviceInfo.ssidName }}</view>
</view>
<view class="wifi-content">
<text class="wifi-label">连接密码</text>
<text class="wifi-value">{{ deviceInfo.ssidPwd }}</text>
</view>
<view class="wifi-item flex-row-sb">
<view class="wifi-details flex-col-g8">
<view class="caption">连接密码</view>
<view class="subtitle">{{ deviceInfo.ssidPwd }}</view>
</view>
<button class="btn-copy" @tap="$emit('copy', deviceInfo.ssidPwd)">复制</button>
</view>
</view>
</view>
</template>
<script setup>
defineProps({
const props = defineProps({
deviceInfo: { type: Object, default: () => ({}) }
});
defineEmits(['modify', 'copy']);
const emit = defineEmits(['modify', 'copy-config']);
const copyConfig = () => {
emit('copy-config', `网络名称: ${props.deviceInfo.ssidName || ''} 连接密码: ${props.deviceInfo.ssidPwd || ''}`);
};
</script>
<style scoped lang="scss">
.wifi-card {
background: var(--bg-surface);
border-radius: var(--radius-xl);
padding: var(--space-5);
box-shadow: var(--shadow-sm);
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: var(--space-4);
border-bottom: 1rpx solid var(--gray-100);
margin-bottom: var(--space-4);
}
.wifi-list {
display: flex;
flex-direction: column;
gap: var(--space-3);
}
.wifi-item {
display: flex;
align-items: center;
gap: var(--space-4);
padding: var(--space-4);
background: var(--gray-50);
border-radius: var(--radius-md);
}
.wifi-icon-wrap {
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg-surface);
border-radius: var(--radius-sm);
flex-shrink: 0;
}
.wifi-icon-text {
font-size: 32rpx;
}
.wifi-content {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2rpx;
}
.wifi-label {
font-size: 22rpx;
color: var(--text-tertiary);
}
.wifi-value {
font-size: 28rpx;
font-weight: 600;
color: var(--text-primary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.btn-copy {
padding: var(--space-2) var(--space-4);
background: var(--bg-surface);
color: var(--primary);
font-size: 24rpx;
font-weight: 600;
border: none;
border-radius: var(--radius-full);
line-height: 1.5;
flex-shrink: 0;
&::after {
border: none;
.wifi-item {
padding: var(--space-md);
background: var(--gray-100);
border-radius: var(--radius-medium);
margin-bottom: var(--space-sm);
&:last-child { margin-bottom: 0; }
.wifi-details { flex: 1; }
}
}
</style>
.btn-group{
padding-right: var(--space-md);
}
</style>

View File

@@ -9,6 +9,9 @@ services:
- '3003:80'
networks:
- device-voice-network
tmpfs:
- /run:rw
- /tmp:rw
healthcheck:
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://127.0.0.1:80/health']
interval: 30s

View File

@@ -18,6 +18,8 @@ server {
}
location / {
alias /usr/share/nginx/html/;
index index.html;
try_files $uri $uri/ /index.html;
}

View File

@@ -1,4 +1,4 @@
# BaseUrl: https://cmp-api.boss160.cn
# BaseUrl: https://cmp-api.xm-iot.cn
错误响应示例:
{
@@ -328,6 +328,13 @@ url: /api/c/v1/asset/info
URL
GET /api/c/v1/asset/info
更新说明2026-05-08
* 本月流量展示以该接口返回字段为准
* 总流量:`real_total_mb`
* 已使用:`enable_virtual_data=true` 时取 `virtual_used_mb`,否则取 `real_used_mb`
* 剩余:`real_total_mb - 已使用`
* 进度条:`已使用 / real_total_mb`
Query 参数:
identifierstring必填- 资产标识符SN/IMEI/虚拟号/ICCID/MSISDN
@@ -374,6 +381,11 @@ data
URL
GET /api/c/v1/asset/package-history
更新说明2026-05-08
* 涉及“本月流量”展示时,以 `/api/c/v1/asset/info` 的规则为准
* 旧说明中“启用虚流量时总流量/剩余切换为虚流量”的规则已废弃
* 当前规则:总流量固定取 `real_total_mb`,已使用按 `enable_virtual_data``virtual_used_mb` / `real_used_mb` 间切换,剩余和进度条按该结果计算
Query 参数:
- identifierstring必填- 资产标识符SN/IMEI/虚拟号/ICCID/MSISDN
- pageinteger必填- 页码

View File

@@ -0,0 +1,286 @@
# 七月迭代 H5/C 端改动说明
本文根据《七月迭代实现与接口对接说明》整理,重点说明本期 H5/C 端需要调整的页面、接口和预期效果。
## 一、改动总览
本期 H5/C 端主要涉及以下功能:
1. 店铺 C 端登录限制。
2. 实名认证流程和实名状态展示。
3. 支付方式展示与支付提交。
4. 下架套餐老客户续费。
5. 预计套餐最终到期时间展示。
6. 套餐临期提醒。
7. 换货通知提醒。
8. C 端订单字段展示调整。
## 二、具体改动说明
### 1. 店铺 C 端登录限制(#41
#### 前端改动
资产验证后,根据接口返回结果判断是否允许登录。如果接口返回店铺已禁止 C 端登录,应直接展示后端错误提示,不继续获取或保存资产 Token。
#### 接口
```http
POST /api/c/v1/auth/verify-asset
```
#### 预期效果
- 被限制的店铺无法新登录 H5/C 端。
- 前端展示后端返回的业务错误信息。
- 已经签发的 Token 不会被强制吊销。
### 2. 实名认证流程(#62
#### 前端改动
资产初始化时只使用后端返回的实名策略和实名状态,不要根据卡、设备或前端本地规则自行推断。
重点使用以下字段:
- `effective_realname_policy`
- `realname_required`
- `real_name_status`
#### 接口
```http
GET /api/c/v1/asset/info?identifier=...
```
#### 预期效果
- `none`:不需要实名。
- `before_order`:下单前要求实名。
- `after_order`:下单后要求实名。
- 卡和设备存在策略冲突时,以设备最终生效策略为准。
- 设备只要有一张有效绑定卡已实名,即视为设备已实名。
### 3. 支付方式展示和提交(#48
#### 前端改动
支付按钮和支付方式列表必须使用后端返回的 `allowed_payment_methods`,不能在前端写死卡、设备的微信、支付宝或钱包规则。
下单或充值时必须将用户选择的 `payment_method` 传给后端;微信支付场景按接口要求传递 `app_type`
#### 接口
资产初始化:
```http
GET /api/c/v1/asset/info
```
充值前校验:
```http
GET /api/c/v1/wallet/recharge-check
```
创建订单:
```http
POST /api/c/v1/orders/create
```
钱包充值:
```http
POST /api/c/v1/wallet/recharge
```
#### 预期效果
- 不同资产类型显示正确的支付方式。
- 强充和普通充值遵循后端允许的支付配置。
- 前端无法绕过后端支付限制。
- 支付方式变化后,前端无需重新发布即可按接口结果生效。
### 4. 下架套餐老客户续费(#40
#### 前端改动
普通套餐列表中不展示下架套餐,但当前正在使用下架套餐的老客户仍可通过资产信息或历史订单获取套餐 ID并继续调用现有创建订单接口。
创建订单时传递:
- 选中的套餐 ID
- 资产 `identifier`
- 当前允许的 `payment_method`
#### 接口
获取当前资产套餐:
```http
GET /api/c/v1/asset/info
```
获取历史订单:
```http
GET /api/c/v1/orders
GET /api/c/v1/orders/:id
```
创建续费订单:
```http
POST /api/c/v1/orders/create
```
相关返回字段:
- 资产信息中的 `current_package_id`
- 历史订单中的 `package_ids`
#### 预期效果
- 老客户可以继续续费已下架套餐。
- 不新增专用续费接口,仍复用普通创建订单接口。
- 新客户和代理代购仍不能购买下架套餐。
- 历史订单数据不被修改。
### 5. 预计套餐最终到期时间(#46
#### 前端改动
资产详情、资产列表等页面展示后端返回的预计最终到期时间,不要只展示当前套餐的到期时间。
重点使用:
- `estimated_final_expires_at`
- `is_expiring`
- 剩余天数及临期等级字段(如接口返回)
#### 接口
```http
GET /api/c/v1/asset/info
```
#### 预期效果
- 用户看到资产综合计算后的最终到期时间。
- 临期资产可以按后端返回的临期字段进行高亮。
- 避免因只显示当前套餐到期时间导致到期日期不准确。
### 6. 套餐临期提醒(#33
#### 前端改动
接入 C 端现有站内通知能力,读取未读通知并在合适时机展示弹窗或提醒入口。
#### 接口
获取未读数量:
```http
GET /api/c/v1/notifications/unread-count
```
获取通知列表:
```http
GET /api/c/v1/notifications
```
标记已读:
```http
PUT /api/c/v1/notifications/:id/read
```
#### 预期效果
- 在套餐剩余 15 天、7 天、3 天时触发提醒。
- 前端可按后端返回的临期等级进行展示。
- 03 天的临期提醒优先级最高。
- 通知通过 C 端站内消息展示,不新增企微业务员提醒。
### 7. 换货通知提醒(#188
#### 前端改动
继续使用现有 C 端通知接口,展示换货相关的未读通知,并支持点击后标记已读。
#### 接口
```http
GET /api/c/v1/notifications/unread-count
GET /api/c/v1/notifications
PUT /api/c/v1/notifications/:id/read
```
#### 预期效果
- 换货创建后,用户可以在 H5/C 端收到站内通知。
- 首页或通知入口能够展示未读数量。
- 用户查看后可以正常标记已读。
- 不新增营销投放、ERP 或其他业务单据。
### 8. C 端订单字段展示(#181
#### 前端改动
订单列表和订单详情使用后端返回的订单角色及资产标识字段。
重点字段:
- `purchase_role`
- `asset_identifier`
设备资产标识的显示规则:
1. 优先显示 `VirtualNo`
2. `VirtualNo` 为空时显示 `IMEI`
3. 不使用 SN 冒充订单设备标识;
4. 历史空数据不需要前端伪造。
#### 接口
```http
GET /api/c/v1/orders
GET /api/c/v1/orders/:id
```
#### 预期效果
- 订单中的购买角色显示准确。
- 卡展示正确的 ICCID 或资产标识。
- 设备展示 VirtualNo缺失时使用 IMEI。
- 订单资产标识与退款、换货等业务中的固化快照保持一致。
## 三、H5/C 端不需要改动的内容
以下事项本期明确不需要 H5/C 端新增功能或接口:
- #84 H5 首页隐藏设备下 ICCID本期确认不做。
- #73 行业卡未实名复机:保持现有逻辑。
- #94 状态同步和运营商回调:继续读取现有资产状态字段,无新增 H5/C 端调用。
- 企业微信审批回调H5/C 端不调用。
- 原路退款、聚水潭、跨品类换货、分销码/佣金提现:本期不做。
## 四、H5/C 端联调注意事项
- 金额接口字段默认单位为“分”,页面展示时转换为“元”,提交时仍传整数分。
- `effective_realname_policy``allowed_payment_methods` 必须以后端返回值为准。
- 企微审批业务只读展示 `approval_provider``approval_status``approval_status_name`,不能再显示旧的人工通过、驳回或线下充值确认按钮。
- 企微回调接口由企微服务器调用H5/C 端不调用:
```http
GET/POST /api/callback/wecom/approval/:application_id
```
- 前端不要根据接口名称自行假设存在“下架套餐续费接口”,续费仍调用:
```http
POST /api/c/v1/orders/create
```

View File

@@ -0,0 +1,284 @@
# 七月迭代实现与接口对接说明
> 面向:产品、前端、测试和联调人员
> 范围:`deliver-july-iteration-confirmed-scope` 及本期确认“后端已完成,只需前端联调”的需求
> 接口细节:以 [`docs/admin-openapi.yaml`](../admin-openapi.yaml) 为准,本文只说明关键调用和字段变化。
## 一、先看这几个关键结论
1. **设备没有限速接口**:限速只允许对 IoT 卡 ICCID 操作,固定档位 `-18`,不通过设备绑定卡间接限速。
2. **企微模板在企微后台创建**:系统只配置应用、默认发起人、账号 userid 绑定、`template_id` 和控件映射,不在本系统设计审批节点。
3. **代理发起审批走默认发起人**:企微单据使用配置的默认成员发起,但退款、充值等本地业务单仍记录真实代理提交人。
4. **下架套餐续费不新增专用接口**:历史订单和资产信息返回稳定套餐 ID前端仍调用现有 C 端创建订单接口生成一张新订单。
5. **实名流程由后端返回值决定**:前端使用 `effective_realname_policy`,不能按卡或设备自行推断;设备有任意一张有效绑定卡已实名即视为已实名。
6. **支付按钮由后端返回值决定**:前端使用 `allowed_payment_methods`,不要自行写死卡/设备的微信、支付宝或钱包规则。
7. **设备批量分配只复用导入任务外壳**:复用任务表、队列、进度和结果页;不会进入原 Excel 创建设备逻辑。
8. **系列套餐批量授权后端原本就支持多选**:前端把多选套餐组装为 `packages[]` 调现有接口即可,不需要新后端接口。
## 二、本期需求怎么实现
### 2.1 本期新增或修改后端的需求
| 需求 | 实现方式 | 关键口径检查 |
| --- | --- | --- |
| #189 换货后退款套餐未失效 | 退款处理不再只按旧资产查套餐,而是按原订单和换货迁移关系定位新资产上的对应套餐权益 | 只失效该退款订单产生的权益,不影响其他订单套餐;无前端改动 |
| #188 换货 C 端提醒 | 创建物流换货单时写可靠通知事件,继续走现有 C 端站内通知和未读弹窗 | 不做营销投放、ERP、自动创建其他单据 |
| #182/#44 提交人和审批展示 | 退款、代理充值、换货列表/详情批量解析提交人 ID 和名称;企微详情已具备将审批节点 userid 批量映射系统账号的内部能力 | 当前退款/充值业务 DTO 只稳定返回提交人和审批状态,尚未直接返回审批节点人员列表;如页面必须展示具体审批人,仍需把已有投影接入业务查询 |
| #181 订单渠道和资产标识 | C 端新订单保存正确 `purchase_role`;卡返回 ICCID设备优先 VirtualNo、为空时返回 IMEI | 不用 SN 冒充订单设备标识;历史空数据不伪造 |
| #41 店铺 C 端登录限制 | 店铺增加 `client_login_disabled`C 端验证资产后、签发短期令牌前检查所属店铺 | 只阻止新登录,不吊销已有 Token平台库存保持原行为 |
| #53 卡/设备实名筛选 | 卡按自身实名状态过滤;设备通过有效绑定卡 `EXISTS` 实时判断 | 设备任意一张有效绑定卡已实名即为已实名;未建投影或 Worker |
| #57 退款中禁止换货 | 在现有换货创建入口前检查资产未终结退款 | 拒绝文案为“该资产存在退款申请”;不依赖企微实时接口 |
| #62 三种实名顺序 | 保留 `none/before_order/after_order`,补齐卡和设备最多 500 条批量修改C 端返回生效策略 | 批量全成全败;设备和下卡冲突时以设备策略为准 |
| #97 主钱包低余额预警 | 消费主钱包扣款事实,余额首次从不少于 100 元跌破 100 元时通知店铺业务员 | 阈值以下不重复;恢复后再次跌破可再次提醒;无业务员不猜接收人 |
| #33 套餐临期提醒 | 每日计算 15/7/3 天节点,提供后台/代理临期列表及数量,并向个人客户发送站内通知 | 高亮为 815、47、03 天03 天优先;不发企微业务员提醒 |
| #34 员工线下代充值 | 原充值创建入口在 `offline` 场景创建通用审批实例和企微提交事件;通过后幂等入主钱包 | 在线扫码充值后置;真实提交人、金额和凭证明文业务快照保留 |
| #35 退款企微审批 | 原退款申请关联唯一通用审批实例,企微标准终态驱动现有退款处理 | 不做原路退款;重复回调/轮询不会重复退款或失效套餐 |
| #37 企业微信审批 | 完成应用连接、通讯录同步、账号绑定、默认发起人、模板映射、提交、回调、详情查询和轮询恢复 | 模板/审批人规则由企微维护;超时结果未知不盲目重提 |
| #36 批量订购套餐 | 单列 CSV整批选择一个套餐和支付方式走独立异步任务逐行复用现有订单和钱包规则 | 不选择代理,不在 CSV 中逐行指定套餐;部分失败不影响其他行 |
| #40 下架套餐老客户续费 | 普通可购列表排除下架套餐;当前使用者可用历史订单或当前资产返回的套餐 ID 调现有下单接口创建新订单 | 无专用续费接口;新客户和代理代购仍拒绝;历史订单不修改 |
| #42 六类导出 | 在现有导出任务框架新增 IoT 卡、套餐、钱包流水、代理充值、退款、换货 datasource | 按现有数据权限和字段来源导出,不建设新字段权限平台 |
| #47 卡固定档位限速 | 后台选择固定档位,按 ICCID 调用 Gateway并记录操作审计和 Integration Log | 仅 IoT 卡;设备无接口;超时返回结果未知并人工核对 |
| #48 按资产类型配置支付方式 | `system_config` 分别保存卡、设备允许的 `wallet/wechat/alipay` 集合C 端返回业务场景交集,订单端再次校验 | 至少保留一种;强充和普通充值剔除钱包;前端不可绕过 |
| #49 设备批量分配 | 扩展现有设备导入任务的 `operation_type`,新增分配代理和设置套餐系列两个 CSV 分支 | CSV 单列 VirtualNo/IMEI/SN复用现有权限、分配、系列绑定和幂等规则 |
### 2.2 后端此前已经完成,主要由前端正确调用或展示
| 需求 | 后端现状 | 前端要做什么 |
| --- | --- | --- |
| #45 换货新旧资产展示/搜索 | 换货列表已分别返回新旧资产,并支持两个独立搜索参数 | 分别提供“旧资产”和“新资产”搜索框,不要继续共用一个字段 |
| #46 预计套餐到期 | 资产详情、C 端资产信息和相关列表已返回预计最终到期字段 | 展示 `estimated_final_expires_at`;按 `is_expiring` 或剩余天数高亮,不要只显示当前套餐到期时间 |
| #55 套餐分配生效条件 | 套餐和分配接口已支持默认值、覆盖值和最终生效值 | 创建/编辑套餐传 `expiry_base`;分配时传 `expiry_base_override`,展示 `effective_expiry_base` |
| #60 店铺联系电话搜索 | 店铺列表已支持 11 位联系电话精确查询 | 将输入值作为 `contact_phone` 查询参数传给店铺列表接口 |
| #86 资产换货标识和跳转 | 资产解析接口已返回 `exchange_trace.previous_asset/next_asset``can_view` | 仅 `can_view=true` 且存在资产 ID 时允许跳转;该需求前端已对接可保持现状 |
| #38 代理信用额度 | 角色默认额度、店铺实际额度、资金概况和负可用余额均已有接口 | 使用分单位字段;更新时携带钱包 `version`;余额为负数时正常展示 |
| #94 状态同步和运营商回调 | 后端回调、定时触发和原轮询链路已装配 | 通常无前端新调用;状态页面继续读取现有资产状态字段 |
| #96 店铺业务员 | 店铺创建/更新、候选人、列表/详情和筛选都已支持业务员 | 创建/编辑店铺选择 `business_owner_account_id`;列表可按该 ID 筛选并展示名称 |
| #98 换货新资产继承旧店铺 | 换货完成时后端自动继承旧资产店铺归属 | 前端继续调用原换货完成接口,不新增分配步骤 |
| #43 系列套餐批量授权 | 创建授权和管理套餐接口均支持 `packages[]`,单次 1100 项 | 页面实现套餐多选,一次提交整个数组;删除项使用 `remove=true` |
> 注意:#44 的“提交人”已经可以直接对接;“审批人”目前不是退款、充值列表的稳定返回字段。后端已经能从企微详情快照解析并映射 userid但当前前端不能把 `processor_id` 当作完整企微审批人列表。
### 2.3 本期明确不由后端处理
- #84 H5 首页隐藏设备下 ICCID纯前端显示调整但本期范围确认标记为“不做”。
- #63 授权列表滚动条和字段顺序:纯前端页面调整,需求已关闭。
- #73 行业卡未实名复机:后端保持原有行业卡放行逻辑,不改接口、不改前端。
- #99 原路退款、#52 聚水潭、#51 跨品类换货、#39 分销码/佣金提现:本期不做。
- #168#90#75#64:已关闭,本期不重新修改。
## 三、需求与接口对接表
### 3.1 资产、店铺、订单和换货
| 需求 | 接口 | 参数或返回变化 / 前端调用说明 |
| --- | --- | --- |
| #41 登录限制 | `PUT /api/admin/shops/:id``GET /api/admin/shops``GET /api/admin/shops/:id` | 更新请求增加可选 `client_login_disabled`;列表/详情返回同名布尔值。C 端仍调 `POST /api/c/v1/auth/verify-asset`,受限时直接展示后端错误,不会返回资产令牌 |
| #53 实名筛选 | `GET /api/admin/iot-cards/standalone``GET /api/admin/devices` | 查询参数增加 `real_name_status=0|1`;响应已有 `real_name_status``real_name_status_name` |
| #62 实名顺序 | `PATCH /api/admin/assets/:identifier/realname-mode``POST /api/admin/iot-cards/batch-update-realname-policy``POST /api/admin/devices/batch-update-realname-policy` | 单条传 `realname_policy`;批量传 `asset_ids[] + realname_policy`,最多 500 条 |
| #62/#48 C 端初始化 | `GET /api/c/v1/asset/info?identifier=...` | 使用 `effective_realname_policy``realname_required``real_name_status``allowed_payment_methods`;前端不要自行覆盖 |
| #45 换货搜索 | `GET /api/admin/exchanges` | 使用 `old_asset_keyword``new_asset_keyword` 两个独立参数,可同时传并按 AND 组合 |
| #57/#98 换货 | `POST /api/admin/exchanges``POST /api/admin/exchanges/:id/complete` | 请求结构不变;存在退款时创建接口返回业务错误;完成后店铺归属由后端继承 |
| #188 换货提醒 | `GET /api/c/v1/notifications/unread-count``GET /api/c/v1/notifications``PUT /api/c/v1/notifications/:id/read` | 无新增通知接口;前端继续使用现有未读数、列表和已读接口弹窗展示 |
| #181 订单字段 | `GET /api/admin/orders``GET /api/admin/orders/:id``GET /api/c/v1/orders``GET /api/c/v1/orders/:id` | 返回正确 `purchase_role``asset_identifier`;设备标识为 VirtualNo 优先、IMEI 兜底 |
| #40 下架套餐续费 | `GET /api/c/v1/asset/info``GET /api/c/v1/orders``GET /api/c/v1/orders/:id``POST /api/c/v1/orders/create` | 资产信息返回 `current_package_id`,历史订单返回 `package_ids`;前端把选中的套餐 ID、资产 `identifier` 和当前允许的 `payment_method` 传给原创建订单接口 |
| #46/#86 资产展示 | `GET /api/admin/assets/resolve/:identifier``GET /api/c/v1/asset/info` | 返回预计最终到期字段;后台解析额外返回 `exchange_trace`,跳转前检查 `can_view` |
### 3.2 店铺业务员、信用和套餐授权
| 需求 | 接口 | 参数或返回变化 / 前端调用说明 |
| --- | --- | --- |
| #60 联系电话搜索 | `GET /api/admin/shops?contact_phone=11位号码` | 精确查询;可与店铺名称、编号等条件组合 |
| #96 店铺业务员 | `GET /api/admin/shops/business-owner-candidates``POST /api/admin/shops``PUT /api/admin/shops/:id``GET /api/admin/shops` | 创建/更新传 `business_owner_account_id`;列表可用同名参数筛选,响应展示账号 ID、名称和可用状态 |
| #38 信用额度 | `PUT /api/admin/roles/:id/default-credit``PUT /api/admin/shops/:id/credit-limit``GET /api/admin/shops/fund-summary` | 角色接口配置新建代理默认值;店铺接口传 `credit_enabled + credit_limit + version`;金额单位均为分 |
| #55 套餐默认生效条件 | `POST /api/admin/packages``PUT /api/admin/packages/:id``GET /api/admin/packages/:id` | 请求使用 `expiry_base=from_activation|from_purchase`;响应展示默认生效条件名称 |
| #55 分配覆盖 | `POST /api/admin/shop-package-batch-allocations``PATCH /api/admin/shop-package-allocations/:id/expiry-base` | 分配时使用 `expiry_base_override``null` 表示跟随套餐默认值 |
| #43 系列套餐多选 | `POST /api/admin/shop-series-grants``PUT /api/admin/shop-series-grants/:id/packages` | `packages` 是 1100 项数组,每项包含 `package_id``cost_price`,删除时传 `remove=true` |
#### 3.2.1 #43 套餐价格展示和已授权/未授权区分
#43 不需要新增后端接口,前端按下面两个现有接口组合数据:
1. 调用 `GET /api/admin/packages?series_id={series_id}&page=1&page_size=100` 分页取得该系列全部套餐。列表项直接使用:
- `suggested_retail_price`:建议售价,单位分;未配置时为空。
- `cost_price`:公司成本价,单位分。
2. 编辑已有授权时,调用 `GET /api/admin/shop-series-grants/{grant_id}`,注意路径参数是授权记录 ID不是系列 ID。
3. 将授权详情的 `packages[].package_id` 组成已授权套餐 ID 集合。
4. 套餐列表项的 `id` 在该集合中显示“已授权”,否则显示“未授权”。授权详情 `packages[].cost_price` 是该次店铺授权成本价,不要拿它替代套餐列表的公司成本价。
5. 用户提交多选结果时,创建授权调用 `POST /api/admin/shop-series-grants`;编辑授权调用 `PUT /api/admin/shop-series-grants/{grant_id}/packages`。新增/调价项传 `package_id + cost_price`,删除项传 `package_id + remove=true`
套餐接口是分页接口;一个系列超过 100 个套餐时,前端必须继续请求后续页,再完成已授权集合标记。
### 3.3 审批、退款和员工线下代充值
| 需求 | 接口 | 参数或返回变化 / 前端调用说明 |
| --- | --- | --- |
| #181/#182/#44 退款 | `GET /api/admin/refunds``GET /api/admin/refunds/:id` | 新增/补齐 `asset_identifier``submitter_id``submitter_name``approval_provider``approval_status``approval_status_name`;资产标识是退款创建时固化的快照,卡为 ICCID设备按 VirtualNo 优先、IMEI 兜底;历史空快照不做兼容 |
| #182/#44 充值 | `GET /api/admin/agent-recharges``GET /api/admin/agent-recharges/:id` | 同上;线下代充值的审批状态只读展示 |
| #44 换货 | `GET /api/admin/exchanges``GET /api/admin/exchanges/:id` | 新增/补齐 `submitter_id``submitter_name` |
| #34 员工线下代充 | `POST /api/admin/agent-recharges` | 仍用原入口;`payment_method=offline` 时传目标 `shop_id`、金额、15 个 `payment_voucher_key` 和备注,创建后等待企微审批 |
| #35 退款申请 | `POST /api/admin/refunds` | 仍用原入口;请求结构保持订单、实收金额、申请金额、凭证、原因等业务字段,创建后等待企微审批 |
| #34/#35 旧按钮 | `POST /api/admin/agent-recharges/:id/offline-pay``POST /api/admin/refunds/:id/approve|reject` | 仅兼容存量旧审批记录;企微记录前端不得显示这些操作按钮,最终按发布配置停用 |
| #37 企微应用 | `POST/GET /api/admin/wecom/applications``POST /api/admin/wecom/applications/:id/test` | 配置 corp_id、agent_id、Secret、回调 Token、EncodingAESKey管理端按明文填写 |
| #37 默认发起人和成员 | `POST /api/admin/wecom/applications/:id/members/sync``GET /api/admin/wecom/applications/:id/members``PUT /api/admin/wecom/applications/:id/default-creator` | 先同步成员,再从可见成员中选择默认 `userid` |
| #37 账号绑定 | `PUT /api/admin/accounts/:id/wecom-binding` | 管理员选择应用可见成员,绑定 `(corp_id,userid)`;不做扫码绑定 |
| #37 场景模板 | `PUT /api/admin/wecom/scenes/:business_type``GET /api/admin/wecom/scenes` | `business_type``refund_approval``offline_recharge_approval`;传 `application_id``template_id``control_mapping[]` |
| #37 回调 | `GET/POST /api/callback/wecom/approval/:application_id` | 由企微服务器调用,前端无需调用 |
#### 3.3.1 企业微信审批 8 个接口的前端调用流程
企业微信配置页使用 8 个 `/api/admin/wecom` 接口账号绑定属于账号模块因此完整闭环是“8 个企微配置接口 + 1 个账号绑定接口”。应用凭据和场景写操作应只向超级管理员开放;前端收到 403 时不要降级绕过。
| 顺序 | 接口 | 页面动作与调用说明 |
| --- | --- | --- |
| 1 | `POST /api/admin/wecom/applications` | 保存应用。传 `corp_id``agent_id``name``secret``callback_token`、43 位 `encoding_aes_key``status=1`。相同 `corp_id + agent_id` 再次提交表示更新;保存响应中的 `id` 是后续 `application_id` |
| 2 | `GET /api/admin/wecom/applications?page=1&page_size=20` | 进入配置页或保存后刷新应用列表,展示连接时间、启用状态、默认发起人和凭据是否完整 |
| 3 | `POST /api/admin/wecom/applications/{id}/test` | 用户点击“测试连接”时调用;`data.success=true` 只表示成功取得 access_token不表示通讯录、模板和回调均已配置完成 |
| 4 | `POST /api/admin/wecom/applications/{id}/members/sync` | 连接成功后点击“同步成员”;后端拉取该自建应用可见范围,返回 `synced_count``synced_at` |
| 5 | `GET /api/admin/wecom/applications/{id}/members?page=1&page_size=20&keyword=...` | 查询最近同步的本地成员快照,`keyword` 可按姓名或 userid 搜索;用于默认发起人和账号绑定的选择器,不要允许手输一个未同步 userid |
| 6 | `PUT /api/admin/wecom/applications/{id}/default-creator` | 从成员选择器取 `userid`,请求体为 `{"userid":"zhangsan"}`。代理等非企微账号提交业务时,企微审批由该成员代为发起,但本地业务提交人仍保持真实账号 |
| 7 | `PUT /api/admin/wecom/scenes/{business_type}` | 分别保存退款和线下代充值模板映射;后端会实时读取企微模板详情并校验控件 ID、类型、必填控件和选择项 key校验失败时页面应保留用户输入并展示后端错误 |
| 8 | `GET /api/admin/wecom/scenes?page=1&page_size=20` | 进入场景页或保存后刷新,展示 `business_type_name`、模板名称、状态、最近校验时间和控件映射 |
应用保存请求示例:
```json
{
"corp_id": "wwxxxxxxxxxxxxxxxx",
"agent_id": 1000002,
"name": "测试环境审批应用",
"secret": "企微应用Secret",
"callback_token": "企微后台配置的回调Token",
"encoding_aes_key": "43位EncodingAESKey",
"status": 1
}
```
场景路径只支持:
- `refund_approval`:退款审批。
- `offline_recharge_approval`:员工线下代充值审批。
场景保存请求示例:
```json
{
"application_id": 1,
"template_id": "企微模板ID",
"control_mapping": [
{
"business_field": "refund_no",
"control_id": "Text-xxxxxxxx",
"control_type": "Text",
"option_mapping": {}
}
],
"status": 1
}
```
`control_mapping``control_id``control_type` 和选择项 key 必须来自企微后台已经创建的模板。退款可映射业务字段为 `refund_no``order_id``order_no``asset_identifier``asset_type``actual_received_amount``requested_refund_amount``refund_voucher_key``refund_reason``package_usage_id``submitter_id``submitter_name`;线下代充值可映射 `recharge_no``shop_id``shop_name``amount``amount_cent``payment_voucher_key``remark``submitter_id``submitter_name`。企微模板中的必填控件必须全部映射。
完成成员同步后,账号管理页还要调用:
```http
PUT /api/admin/accounts/{account_id}/wecom-binding
```
```json
{
"application_id": 1,
"userid": "zhangsan"
}
```
前端完整配置顺序为:保存应用 → 测试连接 → 同步成员 → 查询成员 → 设置默认发起人 → 给需要本人发起审批的系统账号绑定成员 → 保存两个业务场景 → 查询场景确认均已启用。应用可见范围变化后,应重新同步成员并检查默认发起人和账号绑定。
#### 3.3.2 配置完成后的业务审批流程
1. 前端继续调用原业务接口创建退款或员工线下代充值,不直接调用企微发起审批接口。
2. 后端保存业务单、通用审批实例和提交事件,并异步向企微发起审批;前端根据业务列表/详情的 `approval_provider``approval_status``approval_status_name` 只读展示进度。
3. `approval_status` 可能为:`0` 提交中、`1` 审批中、`2` 已通过、`3` 已拒绝、`4` 已撤销、`5` 通过后撤销、`6` 已删除、`7` 提交失败、`8` 提交结果未知。页面名称优先直接使用 `approval_status_name`
4. 企微回调和 Worker 轮询共同同步最终状态;`GET/POST /api/callback/wecom/approval/{application_id}` 只由企微服务器调用,前端禁止调用。
5. `approval_provider=wecom` 或存在 `approval_instance_id` 时,前端不得显示退款通过/驳回、线下充值确认等旧人工按钮。企微通过后,退款终结或钱包入账由后端自动幂等执行。
### 3.4 通知、批量任务、导出和 Gateway
| 需求 | 接口 | 参数或返回变化 / 前端调用说明 |
| --- | --- | --- |
| #97 后台低余额通知 | `GET /api/admin/notifications/unread-count``GET /api/admin/notifications``PUT /api/admin/notifications/:id/read` | 复用现有后台通知接口;业务员账号正常展示低余额通知 |
| #33 临期列表 | `GET /api/admin/expiring-assets` | 支持资产类型、关键词、店铺、套餐、剩余天数和日期范围;响应含 `summary``expiry_level``is_priority` |
| #33 C 端提醒 | `GET /api/c/v1/notifications/unread-count``GET /api/c/v1/notifications` | 复用现有站内通知,前端在 15/7/3 天节点按未读通知弹窗 |
| #36 批量订购上传 | `POST /api/admin/storage/upload-url` | `purpose=batch_purchase`,上传 UTF-8 单列 CSV 后取得 `file_key` |
| #36 批量订购任务 | `POST /api/admin/asset-package-batch-orders``GET /api/admin/asset-package-batch-orders``GET /api/admin/asset-package-batch-orders/:id` | 创建传 `file_key + package_id + payment_method`,线下支付另传 `voucher_keys[]`;详情返回逐行结果 |
| #42 业务导出 | `POST /api/admin/export-tasks``GET /api/admin/export-tasks``GET /api/admin/export-tasks/:id` | `scene` 使用 `iot_card/package/agent_wallet_transaction/agent_recharge/refund/exchange`,筛选条件放 `query` |
| #47 卡限速 | `PUT /api/admin/iot-cards/:iccid/speed-tier` | 请求只传 `code=-1..8`;设备页面不要展示限速入口 |
| #48 后台支付配置 | `GET /api/admin/system-configs``PUT /api/admin/system-configs/:key` | Key 为 `c2b.payment.card_allowed_methods``c2b.payment.device_allowed_methods`;更新请求的 `value` 是 JSON 数组字符串 |
| #48 C 端支付 | `GET /api/c/v1/asset/info``GET /api/c/v1/wallet/recharge-check``POST /api/c/v1/orders/create``POST /api/c/v1/wallet/recharge` | 展示和提交都使用后端返回的 `allowed_payment_methods`;创建订单时 `payment_method` 必传,微信场景按接口要求传 `app_type` |
| #49 分配 CSV 上传 | `POST /api/admin/storage/upload-url` | `purpose=device_batch_allocation`,上传单列 CSV 后取得 `file_key` |
| #49 创建设备分配任务 | `POST /api/admin/devices/import/allocations` | 传 `file_key + operation_type + target_id``operation_type=assign_shop|assign_series` |
| #49 查询任务 | `GET /api/admin/devices/import/tasks``GET /api/admin/devices/import/tasks/:id` | 复用原设备导入任务页面,新增展示 `operation_type``operation_name``target_id``status_name` |
### 3.5 前端静态 CSV 模板
本期需要前端提供两份静态文件模板,**都是 CSV不接受 Excel`.xls`/`.xlsx`**。文件使用 UTF-8 编码,允许 UTF-8 BOM最大 10MB最多 1000 行数据(不含表头)。每个文件只允许一列,不要添加空行、说明行或示例外的其他列。
#### 模板一:批量订购套餐
- 建议文件名:`批量订购套餐模板.csv`
- 上传用途:`purpose=batch_purchase`
- 套餐、支付方式和线下凭证由页面另外选择,不放在 CSV 中。
| 列序号 | 固定表头 | 必填 | 填写内容 |
| --- | --- | --- | --- |
| 1 | `资产标识` | 是 | 每行一个资产标识。卡支持 ICCID、VirtualNo 或 MSISDN设备支持 VirtualNo、IMEI 或 SN |
```csv
资产标识
89860012345678901234
CARD-VIRTUAL-0001
DEVICE-VIRTUAL-0001
860123456789012
```
#### 模板二:设备批量分配
- 建议文件名:`设备批量分配模板.csv`
- 上传用途:`purpose=device_batch_allocation`
- 目标代理或套餐系列由页面另外选择,不放在 CSV 中。“分配代理”和“设置套餐系列”可以共用这一份模板。
| 列序号 | 固定表头 | 必填 | 填写内容 |
| --- | --- | --- | --- |
| 1 | `设备标识` | 是 | 每行一个设备标识,支持 VirtualNo、IMEI 或 SN |
```csv
设备标识
DEVICE-VIRTUAL-0001
860123456789012
SN202607250001
```
> 前端下载的静态模板可以只保留表头,上述数据行仅用于说明格式。资产标识必须按文本原样保存,不得转换为科学计数法、浮点数或截断前导零。
## 四、前端本期最容易漏掉的工作
- 换货列表拆成新、旧资产两个搜索参数。
- 资产预计到期展示使用“预计最终到期”,并按临期字段高亮。
- 套餐分配页面传递默认/覆盖生效条件。
- 店铺页面接入联系电话查询、业务员选择和 C 端登录限制开关。
- 系列套餐授权页面真正使用现有 `packages[]` 做多选提交。
- C 端实名流程只读取 `effective_realname_policy`
- C 端支付按钮只读取 `allowed_payment_methods`
- 历史订单续费继续调用原创建订单接口,不等待新续费接口。
- 企微退款和线下代充值只读展示审批状态,隐藏本地人工审批按钮。
- 卡页面提供固定档位限速;设备页面不得出现限速入口。
- 设备批量分配继续复用原设备导入任务列表/详情页面,但根据 `operation_type` 改标题和结果说明。
## 五、联调和验收边界
- 当前有两个需要在联调时明确的接口边界:
- #44:退款/充值列表已经返回提交人和审批状态,但没有直接返回企微审批节点人员列表;现有 userid 映射能力尚未接入这两个业务 DTO。
- #49:设备批量分配创建服务允许平台和代理账号,但复用的设备导入任务列表/详情 Handler 目前仍沿用“仅平台用户可查看”的旧限制。若本期只允许平台操作则前端应隐藏代理入口;若要求代理自行查看任务,需要再统一后端权限。
- OpenAPI 已生成,新增路径和 DTO 已检查;设备限速旧契约不存在。
- 本次没有执行数据库迁移、完整构建、自动化测试、LSP 或真实企微/Gateway 闭环。
- 企微、Gateway、Redis/Asynq、对象存储配置和回滚步骤见 [`七月迭代联调交付说明.md`](七月迭代联调交付说明.md)。
- 涉及金额的字段默认单位为分;前端展示时统一转换,提交时不要传浮点元金额。

View File

@@ -0,0 +1,54 @@
# 个人客户站内通知
为个人客户增加通知入口,支持查询通知、查看未读数以及标记已读。进入首页时自动查询未读通知并弹窗展示;多条通知使用左右滑动查看,弹窗打开时第一条自动标记已读,滑动查看其他通知时立即标记对应通知已读。弹窗支持关闭。所有接口均需要登录,使用 `Bearer Token` 鉴权。
## 查询通知列表
`GET /api/c/v1/notifications`
查询当前客户可见的未过期业务通知,按创建时间和通知 ID 倒序排列。
| 参数 | 必填 | 说明 |
| --- | --- | --- |
| `page` | 否 | 页码,默认 1范围 110000 |
| `page_size` | 否 | 每页数量,默认 20范围 150 |
| `is_read` | 否 | 已读状态;`false` 仅查询未读,`true` 仅查询已读,不传时查询全部 |
返回:包含通知列表 `items`、当前页 `page`、每页数量 `size` 和总数 `total`。通知项包含标题、正文、类型、类别、级别、关联资源、已读状态及创建/已读时间。
## 标记单条通知已读
`PUT /api/c/v1/notifications/{id}/read`
将当前客户可见的指定通知标记为已读。通知不存在、属于其他客户或已经已读时,也返回成功,接口幂等。
返回:`{ "success": true }`
## 全部标记已读
`PUT /api/c/v1/notifications/read-all`
将当前客户可见的未过期未读业务通知全部标记为已读,重复调用幂等。
返回:`{ "updated_count": 3 }`
## 查询未读数
`GET /api/c/v1/notifications/unread-count`
查询当前客户未过期业务通知的未读数量;平台同步和系统运维通知不计入结果。
返回:`{ "count": 3, "display_count": "3" }`,数量超过 99 时 `display_count``99+`
## 首页未读通知弹窗
- 用户进入首页后,调用 `GET /api/c/v1/notifications`,传入 `is_read=false``page=1``page_size=50`,只展示当前未读通知。
- 有多条未读通知时默认展示第一条,弹窗打开后立即调用单条已读接口标记第一条。
- 用户左右滑动切换到其他通知时,视为已查看并立即调用单条已读接口标记当前通知。
- 点击关闭图标只关闭弹窗,不会将未查看的其他通知批量标记为已读;下次进入首页仍可继续展示剩余未读通知。
- 通知的 `ref_type``ref_id``ref_key` 仅用于资源定位或展示,不直接拼接页面路由。
## 通用约定
- 所有接口均使用 `Bearer Token` 鉴权。
- 未登录、参数错误、无权访问和服务异常沿用统一错误响应。

4
docs/充值.md Normal file
View File

@@ -0,0 +1,4 @@
我的钱包里面的账户充值里的确认充值按钮、我的钱包下面充值订单里的立即支付、套餐列表选择支付方式里的确认支付、我的订单里面的立即支付,都需要加上防抖。
OpenSpec 变更提案位置:
- `openspec/changes/add-payment-submit-guard/`

View File

@@ -0,0 +1,187 @@
# uniapp H5 调用微信扫一扫配置文档
## 一、微信 JSSDK 加载
**方式:通过 CDN 加载微信官方 JSSDK**
`index.html``<head>` 中添加:
```html
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
```
> **注意:** 不要使用 `import wx from 'jweixin-module'` 或 npm 包方式导入uni-app 会错误解析导致构建失败。
---
## 二、wxsdk.js 封装
创建 `utils/wxsdk.js`
```javascript
// utils/wxsdk.js
import { wechatApi } from '@/api/index.js'
// 注意:是 jWeixin不是 wx
// window.wx 会被 uni-app 框架占用为 Vue 模块
const wx = window.jWeixin
/**
* 初始化微信 JS-SDK
*/
export async function initWxConfig() {
const url = window.location.href.split('#')[0]
try {
const data = await wechatApi.getJssdkConfig(url)
const { app_id, timestamp, nonce_str, signature } = data
return new Promise((resolve, reject) => {
wx.config({
debug: true,
appId: app_id,
timestamp: timestamp,
nonceStr: nonce_str,
signature: signature,
jsApiList: ['scanQRCode']
})
wx.ready(() => {
console.log('微信 SDK 就绪')
resolve()
})
wx.error((err) => {
reject(err)
})
})
} catch (e) {
throw e
}
}
/**
* 调起微信扫一扫
* @returns {Promise<string>} 扫码结果字符串
*/
export function wxScan() {
return new Promise((resolve, reject) => {
wx.scanQRCode({
needResult: 1,
scanType: ['qrCode', 'barCode'],
success(res) {
resolve(res.resultStr)
},
fail(err) {
reject(new Error(err?.errMsg || '扫码失败'))
}
})
})
}
/**
* 检查是否在微信环境中
*/
export function isInWechat() {
return /micromessenger/i.test(navigator.userAgent)
}
```
---
## 三、后端接口要求
后端需提供 `/api/c/v1/wechat/jssdk-config` 接口,返回格式:
```json
{
"app_id": "wx1234567890",
"timestamp": 1234567890,
"nonce_str": "randomstring",
"signature": "xxxxx"
}
```
> **注意:** `nonce_str` 必须与生成 signature 时使用的一致
---
## 四、前端调用示例
```javascript
import { initWxConfig, wxScan, isInWechat } from '@/utils/wxsdk.js'
async function handleScan() {
if (!isInWechat()) {
uni.showToast({ title: '请在微信环境中使用', icon: 'none' })
return
}
try {
// 1. 初始化微信 SDK 配置
await initWxConfig()
// 2. 调起扫一扫
const result = await wxScan()
console.log('扫码结果:', result)
// 在此处理扫码结果
} catch (err) {
console.error('扫码错误:', err)
uni.showToast({ title: err.message || JSON.stringify(err), icon: 'none' })
}
}
```
---
## 五、注意事项
| 问题 | 原因 | 解决方案 |
|------|------|----------|
| `window.wx` 输出 `Module {$emit...}` | `window.wx` 被 uni-app 框架占用为 Vue 事件模块 | 使用 `window.jWeixin` |
| `jweixin-module` 打包报 `"default" is not exported` | uni 构建系统错误解析无 default export 的 UMD 模块 | 使用 CDN 加载,不走 npm |
| `wx.scanQRCode is not a function` | 微信 SDK 未正确加载 | 确认 `window.jWeixin` 有值 |
| 扫码提示 `{}` | `catch` 捕获空错误对象 | 需将错误信息转换为 `Error` 对象返回 |
---
## 六、调试建议
在微信开发者工具中打开控制台,检查以下变量:
```javascript
// 错误情况:被 uni-app 框架占用为 Vue 模块
window.wx
// 输出Module {$emit: ƒ, $off: ƒ, $on: ƒ, $once: ƒ, ...}
// 正确情况:微信 JSSDK
window.jWeixin
// 输出:{config: ƒ, ready: ƒ, error: ƒ, checkJsApi: ƒ, ...}
```
---
## 七、完整文件路径
```
project/
├── index.html # 引入微信 JSSDK CDN
├── utils/
│ └── wxsdk.js # 微信扫一扫封装
└── api/
└── modules/
└── wechat.js # 后端接口封装
```
`api/modules/wechat.js` 示例:
```javascript
import request from '@/utils/request.js'
export const wechatApi = {
getJssdkConfig(url) {
return request({
url: '/api/c/v1/wechat/jssdk-config',
method: 'GET',
data: { url }
})
}
}
```

View File

@@ -0,0 +1,277 @@
# C 端所需接口文档
## 1. 通用约定
- 测试环境:`https://cmp-api.boss160.cn`
- 鉴权:除特别说明外,所有接口都需要登录后的 JWT。
```http
Authorization: Bearer <token>
Content-Type: application/json
```
- `identifier`:资产标识符,可传 SN、IMEI、虚拟号、ICCID 或 MSISDN长度 150。
- 金额单位:分。页面展示时转换为元,提交时仍传整数分。
- 成功响应:`code = 0`
- 错误响应:`400` 参数错误、`401` 未认证或过期、`403` 无权访问、`500` 服务端错误。
通用成功响应格式:
```json
{
"code": 0,
"data": {},
"msg": "success",
"timestamp": "2026-07-27T10:00:00+08:00"
}
```
错误响应格式:
```json
{
"code": 1001,
"data": {},
"msg": "参数验证失败",
"timestamp": "2026-07-27T10:00:00+08:00"
}
```
## 2. 接口清单
| 用途 | 方法 | 路径 |
| --- | --- | --- |
| 获取资产信息 | GET | `/api/c/v1/asset/info` |
| 充值前校验 | GET | `/api/c/v1/wallet/recharge-check` |
| 创建套餐订单 | POST | `/api/c/v1/orders/create` |
| 创建充值订单 | POST | `/api/c/v1/wallet/recharge` |
| 订单列表 | GET | `/api/c/v1/orders` |
| 订单详情 | GET | `/api/c/v1/orders/{id}` |
## 3. 获取资产信息
### 请求
```http
GET /api/c/v1/asset/info?identifier=1234567890
```
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `identifier` | string | 是 | 资产标识符150 个字符 |
### `data` 关键返回字段
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `asset_id` | integer | 资产 ID |
| `asset_type` | string | `card` 卡、`device` 设备 |
| `identifier` | string | 当前资产标识符 |
| `iccid` / `msisdn` | string | 卡 ICCID / 手机号 |
| `sn` / `imei` / `virtual_no` | string | 设备序列号 / IMEI / 虚拟号 |
| `device_name` / `device_model` | string | 设备名称 / 型号 |
| `carrier_name` / `carrier_type` | string | 运营商名称 / 类型(`CMCC``CUCC``CTCC``CBN` |
| `status` / `status_name` | integer / string | 资产归属状态:`1` 在库、`2` 已分销;卡沿用卡状态枚举 |
| `activation_status` / `activation_status_name` | integer / string | 激活状态:`0` 未激活、`1` 已激活 |
| `network_status` / `network_status_name` | integer / string | 网络状态:`0` 停机、`1` 开机 |
| `real_name_status` / `real_name_status_name` | integer / string | 实名状态:`0` 未实名、`1` 已实名 |
| `realname_policy` | string | 实名策略:`none``before_order``after_order` |
| `effective_realname_policy` | string | 当前实际生效的实名策略 |
| `realname_required` | boolean | 当前资产是否需要实名 |
| `allowed_payment_methods` | string[] | 允许的支付方式:`wallet``wechat``alipay` |
| `wallet_balance` | integer | 钱包余额,单位为分 |
| `current_package_id` | integer | 当前主套餐 ID无套餐时为 `0`,可用于续费 |
| `current_package` | string | 当前套餐名称,无套餐时为空 |
| `current_package_activated_at` | datetime / null | 当前主套餐开始时间 |
| `current_package_expires_at` | datetime / null | 当前主套餐到期时间 |
| `estimated_final_expires_at` | datetime / null | 预计最终到期时间 |
| `days_until_final_expiry` | integer/null | 距预计最终到期的上海自然日天数 |
| `expiry_estimate_status` | string | `exact` 精确、`waiting_activation` 待激活、`none` 无套餐、`invalid_data` 数据异常 |
| `is_expiring` | boolean | 是否临期(精确推算且剩余 015 天) |
| `enable_virtual_data` | boolean | 当前主套餐是否启用虚流量 |
| `real_total_mb` / `real_used_mb` | integer | 真实总量 / 真实已用量,单位 MB |
| `virtual_total_mb` / `virtual_used_mb` | integer / number | 业务停机阈值 / 展示已用量,单位 MB |
| `reduction_pct` | number | 展示增幅比例:`real_total_mb / virtual_total_mb - 1` |
| `cards` | object[] | 设备绑定卡列表,包含 ICCID、MSISDN、网络状态、实名状态、插槽位置等 |
| `device_realtime` | object/null | 设备实时信息包含在线状态、电量、信号、WiFi、客户端数等 |
页面流量展示建议:总量使用 `real_total_mb`;已用量在 `enable_virtual_data = true` 时使用 `virtual_used_mb`,否则使用 `real_used_mb`
## 4. 充值前校验
### 请求
```http
GET /api/c/v1/wallet/recharge-check?identifier=1234567890
```
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `identifier` | string | 是 | 资产标识符 |
### `data` 返回字段
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `allowed_payment_methods` | string[]/null | 当前允许的支付方式:`wallet``wechat``alipay` |
| `need_force_recharge` | boolean | 是否必须先完成强制充值 |
| `force_recharge_amount` | integer | 强制充值金额,单位为分 |
| `min_amount` | integer | 最小充值金额,单位为分 |
| `max_amount` | integer | 最大充值金额,单位为分 |
| `message` | string | 页面提示信息 |
| `trigger_type` | string | 强制充值触发类型 |
## 5. 创建套餐订单
### 请求
```http
POST /api/c/v1/orders/create
```
```json
{
"identifier": "1234567890",
"package_ids": [1001, 1002],
"payment_method": "wechat",
"app_type": "miniapp"
}
```
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `identifier` | string | 是 | 资产标识符 |
| `package_ids` | integer[] | 是 | 套餐 ID 列表 |
| `payment_method` | string | 是 | `wallet``wechat``alipay` |
| `app_type` | string | 微信支付时是 | `official_account` 公众号、`miniapp` 小程序 |
### `data` 返回字段
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `idempotent` | boolean | 是否返回了已存在的待支付订单 |
| `order_type` | string | `package` 套餐订单、`recharge` 充值订单 |
| `order` | object | 订单信息,见下表 |
| `linked_package_info` | object | 关联套餐和强制充值信息 |
| `recharge` | object/null | 自动充值信息 |
| `pay_config` | object/null | 微信支付参数 |
| `payment_link` | object/null | 支付宝或其他网页支付链接 |
`order` 主要字段:`order_id``order_no``created_at``payment_method``payment_status``payment_status_name``total_amount`
- `payment_status``1` 待支付、`2` 已支付、`3` 已取消、`4` 已退款。
- `linked_package_info``force_recharge_amount``package_names``total_package_amount``wallet_credit`,金额均为分。
- `recharge``recharge_id``recharge_no``amount``status``status_name``auto_purchase_status`
- `pay_config``app_id``nonce_str``package``pay_sign``sign_type``timestamp`
- `payment_link``copy_link``qr_link``payment_no``pay_expire_at`
## 6. 创建充值订单
### 请求
```http
POST /api/c/v1/wallet/recharge
```
```json
{
"amount": 1000,
"identifier": "1234567890",
"payment_method": "wechat",
"app_type": "miniapp"
}
```
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `amount` | integer | 是 | 充值金额110000000 分 |
| `identifier` | string | 是 | 资产标识符 |
| `payment_method` | string | 是 | `wechat` 微信支付、`alipay` 支付宝 |
| `app_type` | string | 微信支付时是 | `official_account``miniapp` |
### `data` 返回字段
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `recharge` | object | 充值信息:`recharge_id``recharge_no``amount``status` |
| `pay_config` | object/null | 微信支付参数:`app_id``nonce_str``package``pay_sign``sign_type``timestamp` |
| `payment_link` | object/null | 支付链接:`copy_link``qr_link``payment_no``pay_expire_at` |
`recharge.status``0` 待支付、`1` 已支付、`2` 已关闭。
## 7. 订单列表
### 请求
```http
GET /api/c/v1/orders?identifier=1234567890&page=1&page_size=10
```
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `identifier` | string | 是 | 资产标识符 |
| `payment_status` | integer | 否 | `1` 待支付、`2` 已支付、`3` 已取消、`4` 已退款 |
| `page` | integer | 是 | 页码,从 1 开始 |
| `page_size` | integer | 是 | 每页数量1100 |
### `data` 返回字段
```json
{
"items": [],
"page": 1,
"size": 10,
"total": 0
}
```
`items[]` 字段:
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `order_id` / `order_no` | integer / string | 订单 ID / 订单号 |
| `asset_id` / `asset_type` | integer / string | 资产 ID / `card``device` |
| `asset_identifier` | string | 下单时资产标识快照;设备优先虚拟号,其次 IMEI |
| `package_ids` / `package_names` | array | 套餐 ID / 名称列表 |
| `payment_method` | string | `wallet``wechat``alipay` |
| `payment_status` / `payment_status_name` | integer / string | 支付状态及中文名称 |
| `total_amount` | integer | 订单总金额,单位为分 |
| `created_at` | string | 创建时间 |
## 8. 订单详情
### 请求
```http
GET /api/c/v1/orders/{id}
```
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `id` | integer | 是 | 订单 ID放在 URL 路径中 |
### `data` 返回字段
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `order_id` / `order_no` | integer / string | 订单 ID / 订单号 |
| `asset_id` / `asset_type` | integer / string | 资产 ID / `card``device` |
| `asset_identifier` | string | 下单时资产标识快照 |
| `packages` | object[] | 订单套餐明细 |
| `payment_method` | string | 支付方式 |
| `payment_status` / `payment_status_name` | integer / string | 支付状态及中文名称 |
| `total_amount` | integer | 订单总金额,单位为分 |
| `created_at` | string | 创建时间 |
| `paid_at` | string/null | 支付时间 |
| `completed_at` | string/null | 完成时间 |
`packages[]` 字段:`package_id``package_name``package_type``formal` 正式套餐、`addon` 加油包)、`price`(分)、`quantity`
## 9. 前端调用流程
1. 登录后保存 JWT后续请求统一携带 `Authorization: Bearer <token>`
2. 进入资产页面调用资产信息接口,并使用返回的 `allowed_payment_methods` 渲染支付方式。
3. 充值先调用充值前校验;若 `need_force_recharge = true`,使用后端返回的强制充值金额和提示。
4. 套餐购买或续费调用创建订单接口,`package_ids` 使用当前资产的 `current_package_id` 或历史订单的 `package_ids`
5. 充值调用创建充值订单接口。微信支付时必须传 `app_type`
6. 页面展示支付链接或支付参数后,支付结果通过订单详情等查询接口确认;不要仅根据前端跳转结果判断已支付。

436
docs/换货.md Normal file
View File

@@ -0,0 +1,436 @@
# 换货流程升级接口变更说明
## 一、数据库字段新增
### 表:`tb_exchange_order`
新增以下字段,所有换货单相关接口响应均会返回:
| 字段 | 类型 | 说明 |
| ------------ | ------------- | ---------------------------------------------------------- |
| flow_type | string | 流程类型:`shipping`(物流换货)或 `direct`(直接换货),历史数据为空时视为 `shipping` |
| shipped_at | string | null | 发货时间,仅 `shipping` 流程发货后有值 |
| completed_at | string | null | 换货完成时间,换货完成后有值 |
---
# 二、后台接口变更
## 1. 创建换货单
### POST /api/admin/exchanges
### 新增请求参数
```json
{
"old_asset_type": "iot_card",
"old_identifier": "xxx",
"exchange_reason": "设备损坏",
"flow_type": "shipping",
"new_identifier": "yyy",
"migrate_data": false,
"remark": null
}
```
### 参数说明
| 字段 | 类型 | 必填 | 说明 |
| -------------- | ------------- | ---------- | ---------------------------------------- |
| flow_type | string | 否 | 流程类型:`shipping` / `direct`,默认 `shipping` |
| new_identifier | string | direct 时必填 | 新资产标识符 |
| migrate_data | boolean | 否 | 是否迁移数据,默认 false |
| remark | string | null | 否 | 备注 |
### 不同流程行为差异
| flow_type | 创建后状态(status) | completed_at |
| --------- | ------------- | ------------ |
| shipping | 1待填写信息 | null |
| direct | 4已完成 | 当前时间 |
### 说明
* shipping 为原有流程
* direct 创建后直接完成
* direct 不需要填写地址
* direct 不需要发货
* direct 不需要确认完成
* 非法 flow_type 返回参数错误
---
## 2. 换货单列表
### GET /api/admin/exchanges
### 新增查询参数
| 参数 | 类型 | 说明 |
| ---------- | ------ | ------------------------ |
| flow_type | string | 按流程类型筛选shipping/direct |
| identifier | string | 资产标识符模糊查询(同时匹配旧资产、新资产) |
### 响应新增字段
```json
{
"flow_type": "shipping",
"flow_type_name": "物流换货",
"shipped_at": null,
"completed_at": null
}
```
---
## 3. 换货单详情
### GET /api/admin/exchanges/:id
### 响应新增字段
```json
{
"flow_type": "shipping",
"flow_type_name": "物流换货",
"shipped_at": null,
"completed_at": null
}
```
### 说明
对于 direct 类型:
* 收货信息为空
* 物流信息为空
属于正常情况,前端需根据 flow_type 控制相关区块显示。
---
## 4. 发货
### POST /api/admin/exchanges/:id/ship
### 新增限制
仅支持:
```text
flow_type = shipping
```
### 不允许情况
```text
flow_type = direct
```
返回:
```json
{
"code": 400,
"message": "流程类型不支持该操作"
}
```
### 前端处理
```javascript
exchange.flow_type === 'shipping'
```
---
## 5. 确认完成
### POST /api/admin/exchanges/:id/complete
### 新增限制
仅支持:
```text
flow_type = shipping
status = 3
```
### 不允许情况
```text
flow_type = direct
```
返回错误。
---
## 6. 取消换货
### POST /api/admin/exchanges/:id/cancel
### 新增限制
允许取消:
```text
flow_type = shipping
status IN (1, 2)
```
### 不允许取消
#### direct 单据
```text
flow_type = direct
```
#### 已发货单据
```text
flow_type = shipping
status = 3
```
返回错误。
---
# 三、客户端接口变更
## 1. 查询进行中的换货单
### GET /api/c/v1/exchange/pending
### 变更后返回规则
仅返回:
```text
flow_type = shipping
status IN (1, 2, 3)
```
### 不返回
```text
flow_type = direct
```
客户端无需特殊处理。
---
## 2. 填写收货地址
### POST /api/c/v1/exchange/:id/shipping-info
### 新增限制
仅支持:
```text
flow_type = shipping
status = 1
```
### 不允许
```text
flow_type = direct
```
返回错误。
---
# 四、前端 UI 改造建议
## 换货单详情页
### 新增展示字段
* 流程类型flow_type_name
* 完成时间completed_at
* 发货时间shipped_at
### 按流程类型控制按钮
#### direct
不显示:
* 发货
* 确认完成
* 取消
#### shipping + status = 1
显示:
* 取消
#### shipping + status = 2
显示:
* 发货
* 取消
#### shipping + status = 3
显示:
* 确认完成
### 信息区块控制
#### direct
隐藏:
* 收货信息
* 物流信息
或者显示:
```text
不适用
```
---
## 创建换货单弹窗
### 新增字段
流程类型:
* 物流换货shipping
* 直接换货direct
### 选择 direct 时
显示:
* 新资产标识符(必填)
* 是否迁移数据(开关)
对应参数:
```json
{
"new_identifier": "xxx",
"migrate_data": true
}
```
### 选择 shipping 时
隐藏:
* 新资产标识符
* 是否迁移数据
---
## 换货单列表页
### 新增表格列
```text
流程类型
```
显示:
```text
物流换货
直接换货
```
### 新增筛选项
```text
流程类型
```
下拉选项:
```text
全部
物流换货shipping
直接换货direct
```
---
# 五、流程状态说明
## shipping物流换货
```text
创建
待填写信息1
待发货2
已发货3
已完成4
```
## direct直接换货
```text
创建
已完成4
```
---
# 六、状态与操作矩阵
| flow_type | status | 发货 | 确认完成 | 取消 |
| --------- | ------ | -- | ---- | -- |
| shipping | 1 | ❌ | ❌ | ✅ |
| shipping | 2 | ✅ | ❌ | ✅ |
| shipping | 3 | ❌ | ✅ | ❌ |
| shipping | 4 | ❌ | ❌ | ❌ |
| direct | 4 | ❌ | ❌ | ❌ |
---
# 七、枚举定义
## flow_type
```json
{
"shipping": "物流换货",
"direct": "直接换货"
}
```
## flow_type_name 示例
```json
{
"flow_type": "shipping",
"flow_type_name": "物流换货"
}
```
```json
{
"flow_type": "direct",
"flow_type_name": "直接换货"
}
```

View File

@@ -0,0 +1,307 @@
# 支付宝支付链接前端对接说明
## 1. 对接范围
本次新增的是 **C 端支付宝支付链接能力**。前端无需接入支付宝 SDK后端会返回已签名的支付宝 WAP 支付链接。
覆盖场景:
1. 套餐订单支付
2. 钱包充值
3. 强制充值购包场景
微信支付原逻辑保持不变:微信返回 `pay_config`,支付宝返回 `payment_link`
具体接口路径、完整请求字段、响应结构、错误码请以前端接口文档 / OpenAPI 文档为准。
## 2. 支付方式取值
前端统一使用 `payment_method` 区分支付方式:
| 值 | 含义 | 前端处理 |
| --- | --- | --- |
| `wallet` | 钱包支付 | 仅订单支付支持,无第三方跳转 |
| `wechat` | 微信支付 | 使用返回的 `pay_config` 调起微信支付 |
| `alipay` | 支付宝支付 | 使用返回的 `payment_link` 打开或展示支付链接 |
注意事项:
- `app_type` 只在微信支付时需要。
- 支付宝支付时不需要传 `app_type`
- 支付宝支付返回的是支付链接,不是 JSAPI 参数。
## 3. 前端需要关注的响应字段
当选择支付宝支付时,接口响应中会返回 `payment_link`
```json
{
"payment_link": {
"payment_no": "支付单号",
"qr_link": "支付宝支付链接,可用于生成二维码",
"copy_link": "支付宝支付链接,可复制或直接打开",
"pay_expire_at": "支付链接过期时间RFC3339 格式"
}
}
```
字段说明:
| 字段 | 用途 |
| --- | --- |
| `payment_no` | 支付单号,问题排查 / 客服查询使用 |
| `qr_link` | 前端可用该链接生成二维码 |
| `copy_link` | 用户复制或浏览器打开的支付链接,当前与 `qr_link` 一致 |
| `pay_expire_at` | 支付链接过期时间,前端可用于倒计时展示 |
## 4. 推荐交互流程
### 4.1 支付宝支付流程
前端拿到 `payment_link` 后:
1. H5 / 浏览器场景:直接跳转 `copy_link`
支付成功后:
- 不要只依赖支付宝返回页判断支付成功。
- 最终支付状态以服务端订单 / 充值记录状态为准。
- 用户返回页面后,前端应轮询订单详情、订单列表或充值记录接口。
## 5. 各业务场景说明
### 5.1 套餐订单支付
普通套餐下单后,如果需要支付,前端调用订单支付接口,并传:
```json
{
"payment_method": "alipay"
}
```
支付宝支付响应示例:
```json
{
"payment_method": "alipay",
"payment_link": {
"payment_no": "...",
"qr_link": "...",
"copy_link": "...",
"pay_expire_at": "..."
}
}
```
前端根据 `payment_link` 发起支付宝支付。
### 5.2 钱包充值
创建钱包充值单时传:
```json
{
"payment_method": "alipay"
}
```
支付宝场景返回 `payment_link`;微信场景返回 `pay_config`
### 5.3 强制充值购包
创建订单时,如果后端判断需要强制充值,前端可指定:
```json
{
"payment_method": "alipay"
}
```
如果是支付宝强充,响应中会返回:
```json
{
"order_type": "recharge",
"recharge": {},
"payment_link": {}
}
```
前端按支付宝支付链接流程处理。
## 6. 前端展示建议
支付宝支付页面建议展示:
- 支付金额
- 支付宝二维码或“去支付宝支付”按钮
- 支付链接过期倒计时
- “我已完成支付”按钮
- “重新获取支付链接”按钮
点击“我已完成支付”时,不直接判定成功,应查询服务端状态。
## 7. 注意事项
1. 金额单位仍然是 **分**
2. 支付宝支付不需要 `app_type`
3. `pay_config` 只用于微信支付。
4. `payment_link` 只用于支付宝支付。
5. 支付状态以服务端为准,不以前端跳转结果为准。
6. 支付链接过期后,前端应重新调用对应支付 / 充值接口获取新链接。
7. 具体接口路径、完整字段、错误码请以前端接口文档 / OpenAPI 文档为准。
# 支付宝支付链接前端对接说明
## 1. 对接范围
本次新增的是 **C 端支付宝支付链接能力**。前端无需接入支付宝 SDK后端会返回已签名的支付宝 WAP 支付链接。
覆盖场景:
1. 套餐订单支付
2. 钱包充值
3. 强制充值购包场景
微信支付原逻辑保持不变:微信返回 `pay_config`,支付宝返回 `payment_link`
具体接口路径、完整请求字段、响应结构、错误码请以前端接口文档 / OpenAPI 文档为准。
## 2. 支付方式取值
前端统一使用 `payment_method` 区分支付方式:
| 值 | 含义 | 前端处理 |
| --- | --- | --- |
| `wallet` | 钱包支付 | 仅订单支付支持,无第三方跳转 |
| `wechat` | 微信支付 | 使用返回的 `pay_config` 调起微信支付 |
| `alipay` | 支付宝支付 | 使用返回的 `payment_link` 打开或展示支付链接 |
注意事项:
- `app_type` 只在微信支付时需要。
- 支付宝支付时不需要传 `app_type`
- 支付宝支付返回的是支付链接,不是 JSAPI 参数。
## 3. 前端需要关注的响应字段
当选择支付宝支付时,接口响应中会返回 `payment_link`
```json
{
"payment_link": {
"payment_no": "支付单号",
"qr_link": "支付宝支付链接,可用于生成二维码",
"copy_link": "支付宝支付链接,可复制或直接打开",
"pay_expire_at": "支付链接过期时间RFC3339 格式"
}
}
```
字段说明:
| 字段 | 用途 |
| --- | --- |
| `payment_no` | 支付单号,问题排查 / 客服查询使用 |
| `qr_link` | 前端可用该链接生成二维码 |
| `copy_link` | 用户复制或浏览器打开的支付链接,当前与 `qr_link` 一致 |
| `pay_expire_at` | 支付链接过期时间,前端可用于倒计时展示 |
## 4. 推荐交互流程
### 4.1 支付宝支付流程
前端拿到 `payment_link` 后:
1. H5 / 浏览器场景:直接跳转 `copy_link`
支付成功后:
- 不要只依赖支付宝返回页判断支付成功。
- 最终支付状态以服务端订单 / 充值记录状态为准。
- 用户返回页面后,前端应轮询订单详情、订单列表或充值记录接口。
## 5. 各业务场景说明
### 5.1 套餐订单支付
普通套餐下单后,如果需要支付,前端调用订单支付接口,并传:
```json
{
"payment_method": "alipay"
}
```
支付宝支付响应示例:
```json
{
"payment_method": "alipay",
"payment_link": {
"payment_no": "...",
"qr_link": "...",
"copy_link": "...",
"pay_expire_at": "..."
}
}
```
前端根据 `payment_link` 发起支付宝支付。
### 5.2 钱包充值
创建钱包充值单时传:
```json
{
"payment_method": "alipay"
}
```
支付宝场景返回 `payment_link`;微信场景返回 `pay_config`
### 5.3 强制充值购包
创建订单时,如果后端判断需要强制充值,前端可指定:
```json
{
"payment_method": "alipay"
}
```
如果是支付宝强充,响应中会返回:
```json
{
"order_type": "recharge",
"recharge": {},
"payment_link": {}
}
```
前端按支付宝支付链接流程处理。
## 6. 前端展示建议
支付宝支付页面建议展示:
- 支付金额
- 支付宝二维码或“去支付宝支付”按钮
- 支付链接过期倒计时
- “我已完成支付”按钮
- “重新获取支付链接”按钮
点击“我已完成支付”时,不直接判定成功,应查询服务端状态。
## 7. 注意事项
1. 金额单位仍然是 **分**
2. 支付宝支付不需要 `app_type`
3. `pay_config` 只用于微信支付。
4. `payment_link` 只用于支付宝支付。
5. 支付状态以服务端为准,不以前端跳转结果为准。
6. 支付链接过期后,前端应重新调用对应支付 / 充值接口获取新链接。
7. 具体接口路径、完整字段、错误码请以前端接口文档 / OpenAPI 文档为准。

View File

@@ -5,6 +5,8 @@
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<title></title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/misans@4.1.0/lib/Normal/MiSans-Regular.min.css"/>
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script>window.__WX_ENTRY_URL__ = window.location.href.split('#')[0]</script>
</head>
<body>
<div id="app"><!--app-html--></div>

62
main.js
View File

@@ -1,11 +1,55 @@
import App from './App'
import uviewPlus from 'uview-plus'
const TAB_BAR_STYLE_NOT_FOUND_ERROR = 'setTabBarStyle:fail not TabBar page'
const shouldIgnoreTabBarStyleError = (error) => {
const message = typeof error === 'string'
? error
: error?.errMsg || error?.message || ''
return message.includes(TAB_BAR_STYLE_NOT_FOUND_ERROR)
}
const patchSafeSetTabBarStyle = () => {
if (typeof uni === 'undefined' || typeof uni.setTabBarStyle !== 'function') {
return
}
if (uni.setTabBarStyle.__upSafePatched) {
return
}
const originalSetTabBarStyle = uni.setTabBarStyle.bind(uni)
const safeSetTabBarStyle = (options = {}) => {
try {
const result = originalSetTabBarStyle(options)
if (result && typeof result.catch === 'function') {
return result.catch((error) => {
if (shouldIgnoreTabBarStyleError(error)) {
return undefined
}
return Promise.reject(error)
})
}
return result
} catch (error) {
if (shouldIgnoreTabBarStyleError(error)) {
return undefined
}
throw error
}
}
safeSetTabBarStyle.__upSafePatched = true
uni.setTabBarStyle = safeSetTabBarStyle
}
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
patchSafeSetTabBarStyle()
const app = new Vue({
...App
})
@@ -15,10 +59,24 @@ app.$mount()
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
patchSafeSetTabBarStyle()
const app = createSSRApp(App)
app.use(uviewPlus)
// 使用 uview-plus (版本 3.4.0+)
app.use(uviewPlus, () => {
return {
options: {
config: {
// 默认单位 rpx
unit: 'rpx'
},
props: {
// 可以在这里配置组件默认属性
}
}
}
})
return {
app
}
}
// #endif
// #endif

View File

@@ -1,5 +1,5 @@
{
"name" : "device-voice-h5",
"name" : "c-xmot-iot",
"appid" : "__UNI__45F0251",
"description" : "",
"versionName" : "1.0.0",
@@ -17,7 +17,10 @@
"delay" : 0
},
/* */
"modules" : {},
"modules" : {
"Barcode" : {},
"Camera" : {}
},
/* */
"distribute" : {
/* android */
@@ -97,6 +100,8 @@
}
}
},
"sdkConfigs" : {}
"sdkConfigs" : {
"maps" : {}
}
}
}

456
openspec/AGENTS.md Normal file
View File

@@ -0,0 +1,456 @@
# OpenSpec Instructions
Instructions for AI coding assistants using OpenSpec for spec-driven development.
## TL;DR Quick Checklist
- Search existing work: `openspec spec list --long`, `openspec list` (use `rg` only for full-text search)
- Decide scope: new capability vs modify existing capability
- Pick a unique `change-id`: kebab-case, verb-led (`add-`, `update-`, `remove-`, `refactor-`)
- Scaffold: `proposal.md`, `tasks.md`, `design.md` (only if needed), and delta specs per affected capability
- Write deltas: use `## ADDED|MODIFIED|REMOVED|RENAMED Requirements`; include at least one `#### Scenario:` per requirement
- Validate: `openspec validate [change-id] --strict` and fix issues
- Request approval: Do not start implementation until proposal is approved
## Three-Stage Workflow
### Stage 1: Creating Changes
Create proposal when you need to:
- Add features or functionality
- Make breaking changes (API, schema)
- Change architecture or patterns
- Optimize performance (changes behavior)
- Update security patterns
Triggers (examples):
- "Help me create a change proposal"
- "Help me plan a change"
- "Help me create a proposal"
- "I want to create a spec proposal"
- "I want to create a spec"
Loose matching guidance:
- Contains one of: `proposal`, `change`, `spec`
- With one of: `create`, `plan`, `make`, `start`, `help`
Skip proposal for:
- Bug fixes (restore intended behavior)
- Typos, formatting, comments
- Dependency updates (non-breaking)
- Configuration changes
- Tests for existing behavior
**Workflow**
1. Review `openspec/project.md`, `openspec list`, and `openspec list --specs` to understand current context.
2. Choose a unique verb-led `change-id` and scaffold `proposal.md`, `tasks.md`, optional `design.md`, and spec deltas under `openspec/changes/<id>/`.
3. Draft spec deltas using `## ADDED|MODIFIED|REMOVED Requirements` with at least one `#### Scenario:` per requirement.
4. Run `openspec validate <id> --strict` and resolve any issues before sharing the proposal.
### Stage 2: Implementing Changes
Track these steps as TODOs and complete them one by one.
1. **Read proposal.md** - Understand what's being built
2. **Read design.md** (if exists) - Review technical decisions
3. **Read tasks.md** - Get implementation checklist
4. **Implement tasks sequentially** - Complete in order
5. **Confirm completion** - Ensure every item in `tasks.md` is finished before updating statuses
6. **Update checklist** - After all work is done, set every task to `- [x]` so the list reflects reality
7. **Approval gate** - Do not start implementation until the proposal is reviewed and approved
### Stage 3: Archiving Changes
After deployment, create separate PR to:
- Move `changes/[name]/``changes/archive/YYYY-MM-DD-[name]/`
- Update `specs/` if capabilities changed
- Use `openspec archive <change-id> --skip-specs --yes` for tooling-only changes (always pass the change ID explicitly)
- Run `openspec validate --strict` to confirm the archived change passes checks
## Before Any Task
**Context Checklist:**
- [ ] Read relevant specs in `specs/[capability]/spec.md`
- [ ] Check pending changes in `changes/` for conflicts
- [ ] Read `openspec/project.md` for conventions
- [ ] Run `openspec list` to see active changes
- [ ] Run `openspec list --specs` to see existing capabilities
**Before Creating Specs:**
- Always check if capability already exists
- Prefer modifying existing specs over creating duplicates
- Use `openspec show [spec]` to review current state
- If request is ambiguous, ask 12 clarifying questions before scaffolding
### Search Guidance
- Enumerate specs: `openspec spec list --long` (or `--json` for scripts)
- Enumerate changes: `openspec list` (or `openspec change list --json` - deprecated but available)
- Show details:
- Spec: `openspec show <spec-id> --type spec` (use `--json` for filters)
- Change: `openspec show <change-id> --json --deltas-only`
- Full-text search (use ripgrep): `rg -n "Requirement:|Scenario:" openspec/specs`
## Quick Start
### CLI Commands
```bash
# Essential commands
openspec list # List active changes
openspec list --specs # List specifications
openspec show [item] # Display change or spec
openspec validate [item] # Validate changes or specs
openspec archive <change-id> [--yes|-y] # Archive after deployment (add --yes for non-interactive runs)
# Project management
openspec init [path] # Initialize OpenSpec
openspec update [path] # Update instruction files
# Interactive mode
openspec show # Prompts for selection
openspec validate # Bulk validation mode
# Debugging
openspec show [change] --json --deltas-only
openspec validate [change] --strict
```
### Command Flags
- `--json` - Machine-readable output
- `--type change|spec` - Disambiguate items
- `--strict` - Comprehensive validation
- `--no-interactive` - Disable prompts
- `--skip-specs` - Archive without spec updates
- `--yes`/`-y` - Skip confirmation prompts (non-interactive archive)
## Directory Structure
```
openspec/
├── project.md # Project conventions
├── specs/ # Current truth - what IS built
│ └── [capability]/ # Single focused capability
│ ├── spec.md # Requirements and scenarios
│ └── design.md # Technical patterns
├── changes/ # Proposals - what SHOULD change
│ ├── [change-name]/
│ │ ├── proposal.md # Why, what, impact
│ │ ├── tasks.md # Implementation checklist
│ │ ├── design.md # Technical decisions (optional; see criteria)
│ │ └── specs/ # Delta changes
│ │ └── [capability]/
│ │ └── spec.md # ADDED/MODIFIED/REMOVED
│ └── archive/ # Completed changes
```
## Creating Change Proposals
### Decision Tree
```
New request?
├─ Bug fix restoring spec behavior? → Fix directly
├─ Typo/format/comment? → Fix directly
├─ New feature/capability? → Create proposal
├─ Breaking change? → Create proposal
├─ Architecture change? → Create proposal
└─ Unclear? → Create proposal (safer)
```
### Proposal Structure
1. **Create directory:** `changes/[change-id]/` (kebab-case, verb-led, unique)
2. **Write proposal.md:**
```markdown
# Change: [Brief description of change]
## Why
[1-2 sentences on problem/opportunity]
## What Changes
- [Bullet list of changes]
- [Mark breaking changes with **BREAKING**]
## Impact
- Affected specs: [list capabilities]
- Affected code: [key files/systems]
```
3. **Create spec deltas:** `specs/[capability]/spec.md`
```markdown
## ADDED Requirements
### Requirement: New Feature
The system SHALL provide...
#### Scenario: Success case
- **WHEN** user performs action
- **THEN** expected result
## MODIFIED Requirements
### Requirement: Existing Feature
[Complete modified requirement]
## REMOVED Requirements
### Requirement: Old Feature
**Reason**: [Why removing]
**Migration**: [How to handle]
```
If multiple capabilities are affected, create multiple delta files under `changes/[change-id]/specs/<capability>/spec.md`—one per capability.
4. **Create tasks.md:**
```markdown
## 1. Implementation
- [ ] 1.1 Create database schema
- [ ] 1.2 Implement API endpoint
- [ ] 1.3 Add frontend component
- [ ] 1.4 Write tests
```
5. **Create design.md when needed:**
Create `design.md` if any of the following apply; otherwise omit it:
- Cross-cutting change (multiple services/modules) or a new architectural pattern
- New external dependency or significant data model changes
- Security, performance, or migration complexity
- Ambiguity that benefits from technical decisions before coding
Minimal `design.md` skeleton:
```markdown
## Context
[Background, constraints, stakeholders]
## Goals / Non-Goals
- Goals: [...]
- Non-Goals: [...]
## Decisions
- Decision: [What and why]
- Alternatives considered: [Options + rationale]
## Risks / Trade-offs
- [Risk] → Mitigation
## Migration Plan
[Steps, rollback]
## Open Questions
- [...]
```
## Spec File Format
### Critical: Scenario Formatting
**CORRECT** (use #### headers):
```markdown
#### Scenario: User login success
- **WHEN** valid credentials provided
- **THEN** return JWT token
```
**WRONG** (don't use bullets or bold):
```markdown
- **Scenario: User login** ❌
**Scenario**: User login ❌
### Scenario: User login ❌
```
Every requirement MUST have at least one scenario.
### Requirement Wording
- Use SHALL/MUST for normative requirements (avoid should/may unless intentionally non-normative)
### Delta Operations
- `## ADDED Requirements` - New capabilities
- `## MODIFIED Requirements` - Changed behavior
- `## REMOVED Requirements` - Deprecated features
- `## RENAMED Requirements` - Name changes
Headers matched with `trim(header)` - whitespace ignored.
#### When to use ADDED vs MODIFIED
- ADDED: Introduces a new capability or sub-capability that can stand alone as a requirement. Prefer ADDED when the change is orthogonal (e.g., adding "Slash Command Configuration") rather than altering the semantics of an existing requirement.
- MODIFIED: Changes the behavior, scope, or acceptance criteria of an existing requirement. Always paste the full, updated requirement content (header + all scenarios). The archiver will replace the entire requirement with what you provide here; partial deltas will drop previous details.
- RENAMED: Use when only the name changes. If you also change behavior, use RENAMED (name) plus MODIFIED (content) referencing the new name.
Common pitfall: Using MODIFIED to add a new concern without including the previous text. This causes loss of detail at archive time. If you arent explicitly changing the existing requirement, add a new requirement under ADDED instead.
Authoring a MODIFIED requirement correctly:
1) Locate the existing requirement in `openspec/specs/<capability>/spec.md`.
2) Copy the entire requirement block (from `### Requirement: ...` through its scenarios).
3) Paste it under `## MODIFIED Requirements` and edit to reflect the new behavior.
4) Ensure the header text matches exactly (whitespace-insensitive) and keep at least one `#### Scenario:`.
Example for RENAMED:
```markdown
## RENAMED Requirements
- FROM: `### Requirement: Login`
- TO: `### Requirement: User Authentication`
```
## Troubleshooting
### Common Errors
**"Change must have at least one delta"**
- Check `changes/[name]/specs/` exists with .md files
- Verify files have operation prefixes (## ADDED Requirements)
**"Requirement must have at least one scenario"**
- Check scenarios use `#### Scenario:` format (4 hashtags)
- Don't use bullet points or bold for scenario headers
**Silent scenario parsing failures**
- Exact format required: `#### Scenario: Name`
- Debug with: `openspec show [change] --json --deltas-only`
### Validation Tips
```bash
# Always use strict mode for comprehensive checks
openspec validate [change] --strict
# Debug delta parsing
openspec show [change] --json | jq '.deltas'
# Check specific requirement
openspec show [spec] --json -r 1
```
## Happy Path Script
```bash
# 1) Explore current state
openspec spec list --long
openspec list
# Optional full-text search:
# rg -n "Requirement:|Scenario:" openspec/specs
# rg -n "^#|Requirement:" openspec/changes
# 2) Choose change id and scaffold
CHANGE=add-two-factor-auth
mkdir -p openspec/changes/$CHANGE/{specs/auth}
printf "## Why\n...\n\n## What Changes\n- ...\n\n## Impact\n- ...\n" > openspec/changes/$CHANGE/proposal.md
printf "## 1. Implementation\n- [ ] 1.1 ...\n" > openspec/changes/$CHANGE/tasks.md
# 3) Add deltas (example)
cat > openspec/changes/$CHANGE/specs/auth/spec.md << 'EOF'
## ADDED Requirements
### Requirement: Two-Factor Authentication
Users MUST provide a second factor during login.
#### Scenario: OTP required
- **WHEN** valid credentials are provided
- **THEN** an OTP challenge is required
EOF
# 4) Validate
openspec validate $CHANGE --strict
```
## Multi-Capability Example
```
openspec/changes/add-2fa-notify/
├── proposal.md
├── tasks.md
└── specs/
├── auth/
│ └── spec.md # ADDED: Two-Factor Authentication
└── notifications/
└── spec.md # ADDED: OTP email notification
```
auth/spec.md
```markdown
## ADDED Requirements
### Requirement: Two-Factor Authentication
...
```
notifications/spec.md
```markdown
## ADDED Requirements
### Requirement: OTP Email Notification
...
```
## Best Practices
### Simplicity First
- Default to <100 lines of new code
- Single-file implementations until proven insufficient
- Avoid frameworks without clear justification
- Choose boring, proven patterns
### Complexity Triggers
Only add complexity with:
- Performance data showing current solution too slow
- Concrete scale requirements (>1000 users, >100MB data)
- Multiple proven use cases requiring abstraction
### Clear References
- Use `file.ts:42` format for code locations
- Reference specs as `specs/auth/spec.md`
- Link related changes and PRs
### Capability Naming
- Use verb-noun: `user-auth`, `payment-capture`
- Single purpose per capability
- 10-minute understandability rule
- Split if description needs "AND"
### Change ID Naming
- Use kebab-case, short and descriptive: `add-two-factor-auth`
- Prefer verb-led prefixes: `add-`, `update-`, `remove-`, `refactor-`
- Ensure uniqueness; if taken, append `-2`, `-3`, etc.
## Tool Selection Guide
| Task | Tool | Why |
|------|------|-----|
| Find files by pattern | Glob | Fast pattern matching |
| Search code content | Grep | Optimized regex search |
| Read specific files | Read | Direct file access |
| Explore unknown scope | Task | Multi-step investigation |
## Error Recovery
### Change Conflicts
1. Run `openspec list` to see active changes
2. Check for overlapping specs
3. Coordinate with change owners
4. Consider combining proposals
### Validation Failures
1. Run with `--strict` flag
2. Check JSON output for details
3. Verify spec file format
4. Ensure scenarios properly formatted
### Missing Context
1. Read project.md first
2. Check related specs
3. Review recent archives
4. Ask for clarification
## Quick Reference
### Stage Indicators
- `changes/` - Proposed, not yet built
- `specs/` - Built and deployed
- `archive/` - Completed changes
### File Purposes
- `proposal.md` - Why and what
- `tasks.md` - Implementation steps
- `design.md` - Technical decisions
- `spec.md` - Requirements and behavior
### CLI Essentials
```bash
openspec list # What's in progress?
openspec show [item] # View details
openspec validate --strict # Is it correct?
openspec archive <change-id> [--yes|-y] # Mark complete (add --yes for automation)
```
Remember: Specs are truth. Changes are proposals. Keep them in sync.

View File

@@ -0,0 +1,25 @@
## Why
The front end currently supports WeChat payment and wallet balance payment, but it does not support the new backend Alipay WAP payment-link flow. This prevents users from completing package purchase and wallet recharge scenarios when Alipay is the selected method.
## What Changes
- Add Alipay as a supported payment method in package purchase, order list immediate payment, and wallet recharge flows
- Handle backend `payment_link` responses for Alipay while preserving existing WeChat `pay_config` handling
- Keep wallet balance payment behavior unchanged for package purchase
- Refresh payment-related page state from backend status after the user returns from the Alipay payment link flow
- Preserve current order creation, strong recharge, validation, toast, and list refresh behavior except where Alipay-specific branching is required
## Capabilities
### New Capabilities
- `alipay-payment-link`: Support backend-provided Alipay payment links across package, order, and wallet payment entry points
### Modified Capabilities
## Impact
- Affected code: `pages/package-order/package-order.vue`, `pages/order-list/order-list.vue`, `pages/my-wallet/my-wallet.vue`, `utils/payment.js`, `api/modules/wallet.js`
- Affected UI flows: package payment method popup, order list immediate payment, wallet recharge popup, wallet recharge order immediate payment
- No backend API path changes expected
- Existing WeChat and wallet payment behavior must remain available

View File

@@ -0,0 +1,58 @@
## ADDED Requirements
### Requirement: Package payment SHALL support Alipay payment links
The system SHALL allow users to choose Alipay during package purchase and SHALL handle backend Alipay responses through `payment_link` while preserving the existing WeChat and wallet payment branches.
#### Scenario: User pays a package order with Alipay
- **WHEN** the user selects `alipay` in the package payment popup and the backend returns `payment_method: "alipay"` with `payment_link`
- **THEN** the system SHALL open or present the returned Alipay payment link for the user
- **AND** the system SHALL NOT require WeChat `pay_config` fields for this branch
#### Scenario: User pays a package order with wallet balance
- **WHEN** the user selects `wallet` and the backend completes the package payment without a third-party redirect
- **THEN** the system SHALL preserve the existing wallet payment success flow
- **AND** the system SHALL refresh relevant wallet-related page state after success
#### Scenario: Strong recharge branch returns an Alipay payment link
- **WHEN** package order creation enters the strong recharge branch and the backend returns `order_type: "recharge"` with `payment_link`
- **THEN** the system SHALL use the Alipay payment-link flow for that recharge branch
- **AND** the system SHALL preserve the existing strong recharge messaging and follow-up refresh behavior
### Requirement: Pending order payment SHALL support Alipay payment links
The system SHALL allow users to continue payment for pending package orders from the order list through an Alipay payment link flow.
#### Scenario: User continues a pending order with Alipay
- **WHEN** the user starts payment for a pending order from the order list and the backend returns `payment_method: "alipay"` with `payment_link`
- **THEN** the system SHALL open or present the returned payment link
- **AND** the system SHALL refresh the order list from backend status after the user completes or retries the flow
### Requirement: Wallet recharge flows SHALL support Alipay payment links
The system SHALL support Alipay both when creating a new wallet recharge order and when retrying payment for a pending recharge order.
#### Scenario: User creates a new wallet recharge with Alipay
- **WHEN** the user confirms a wallet recharge with `payment_method: "alipay"` and the backend returns `payment_link`
- **THEN** the system SHALL open or present the returned payment link
- **AND** the system SHALL preserve the existing recharge validation rules and amount checks
#### Scenario: User retries a pending recharge order with Alipay
- **WHEN** the user continues payment for a pending recharge order and the backend returns `payment_link`
- **THEN** the system SHALL open or present the returned Alipay payment link
- **AND** the system SHALL refresh wallet detail and recharge list state from backend data after the user completes or retries the flow
### Requirement: Payment method branching SHALL distinguish WeChat and Alipay contracts
The system SHALL treat WeChat and Alipay payment preparation responses as different contracts and SHALL determine final payment success from backend order or recharge status instead of the redirect result alone.
#### Scenario: WeChat payment returns pay_config
- **WHEN** the backend returns `payment_method: "wechat"` with `pay_config`
- **THEN** the system SHALL continue to use the existing WeChat H5 payment invocation flow
- **AND** the system SHALL preserve the current `app_type` behavior for WeChat requests
#### Scenario: Alipay payment returns payment_link
- **WHEN** the backend returns `payment_method: "alipay"` with `payment_link`
- **THEN** the system SHALL use the returned link fields instead of expecting `pay_config`
- **AND** the system SHALL NOT depend on `app_type` for the Alipay branch
#### Scenario: User returns after Alipay jump
- **WHEN** the user comes back to the application after opening the Alipay payment link
- **THEN** the system SHALL refresh the relevant order or recharge data from backend APIs
- **AND** the system SHALL determine whether the payment succeeded from refreshed backend status

View File

@@ -0,0 +1,29 @@
## 1. Shared Payment Branching
- [x] 1.1 Add shared front-end handling for Alipay `payment_link` responses alongside the existing WeChat `pay_config` flow
- [x] 1.2 Ensure Alipay requests do not depend on `app_type` and existing WeChat requests continue to work unchanged
## 2. Package Purchase Flow
- [x] 2.1 Add Alipay as a selectable payment method in `pages/package-order/package-order.vue`
- [x] 2.2 Handle normal package order payment responses for `wechat`, `wallet`, and `alipay`
- [x] 2.3 Handle strong recharge branches that return `payment_link` for Alipay
## 3. Order List Flow
- [x] 3.1 Add an order-list payment entry that lets the user continue pending orders with Alipay
- [x] 3.2 Refresh order list state from backend data after the user completes or retries the Alipay flow
## 4. Wallet Flow
- [x] 4.1 Add Alipay as a selectable payment method in the wallet recharge popup
- [x] 4.2 Handle Alipay recharge creation responses in `confirmRecharge`
- [x] 4.3 Handle Alipay payment retries for pending recharge orders in `handleRechargePayment`
- [x] 4.4 Refresh wallet detail and recharge list state from backend data after the Alipay flow
## 5. Regression Verification
- [x] 5.1 Verify WeChat package payment still uses `pay_config`
- [x] 5.2 Verify wallet-balance package payment remains unchanged
- [x] 5.3 Verify Alipay package payment, order-list payment, wallet recharge, and recharge retry can all open a valid payment link flow
- [x] 5.4 Verify payment success is determined by refreshed backend status instead of the link jump result

View File

@@ -0,0 +1,26 @@
## Why
The wallet recharge confirmation, package payment confirmation, order list immediate payment, and wallet recharge order immediate payment flows can be triggered repeatedly when users tap quickly or when the page is slow to respond. This can cause duplicate order creation, duplicate payment preparation, repeated payment invocation, and inconsistent UI state.
## What Changes
- Add a front-end submit guard for the wallet recharge confirmation flow in `pages/my-wallet/my-wallet.vue`
- Add a front-end submit guard for the package payment confirmation flow in `pages/package-order/package-order.vue`
- Add a front-end submit guard for the order list immediate payment flow in `pages/order-list/order-list.vue`
- Add a front-end submit guard for the wallet recharge order immediate payment flow in `pages/my-wallet/my-wallet.vue`
- Standardize button behavior during submission so repeated taps are ignored until the current flow ends
- Require submit state recovery for success, failure, cancel, validation failure, list refresh, and modal re-entry paths
## Capabilities
### New Capabilities
- `payment-submit-guard`: Prevent duplicate submission in recharge and payment entry points across wallet, package order, and order list flows
### Modified Capabilities
## Impact
- Affected code: `pages/my-wallet/my-wallet.vue`, `pages/package-order/package-order.vue`, `pages/order-list/order-list.vue`
- Affected UI flows: wallet recharge modal, wallet recharge order list immediate payment, package payment method modal, order list immediate payment
- No backend API changes
- No payment business rule changes

View File

@@ -0,0 +1,81 @@
## ADDED Requirements
### Requirement: Wallet recharge confirmation SHALL prevent duplicate submission
The system SHALL prevent repeated taps on the wallet recharge confirmation button from starting more than one recharge submission flow at the same time.
#### Scenario: User taps confirm recharge repeatedly during submission
- **WHEN** the user taps the wallet recharge confirmation button multiple times before the current `confirmRecharge` flow completes
- **THEN** the system SHALL execute only the first submission flow
- **AND** the system SHALL ignore subsequent taps until the current flow ends
#### Scenario: Wallet recharge confirmation enters submitting state
- **WHEN** the first valid wallet recharge confirmation tap is accepted
- **THEN** the system SHALL mark the wallet recharge confirmation flow as submitting immediately
- **AND** the system SHALL present the confirmation button as non-repeatable during that state
#### Scenario: Wallet recharge confirmation recovers after terminal outcome
- **WHEN** the wallet recharge flow ends because of success, failure, cancellation, local validation failure, or modal re-entry
- **THEN** the system SHALL clear the submitting state
- **AND** the user SHALL be able to start a new recharge attempt
### Requirement: Package payment confirmation SHALL prevent duplicate submission
The system SHALL prevent repeated taps on the package payment confirmation button from starting more than one package payment submission flow at the same time.
#### Scenario: User taps confirm payment repeatedly during submission
- **WHEN** the user taps the package payment confirmation button multiple times before the current `confirmPay` flow completes
- **THEN** the system SHALL execute only the first submission flow
- **AND** the system SHALL ignore subsequent taps until the current flow ends
#### Scenario: Package payment confirmation enters submitting state
- **WHEN** the first valid package payment confirmation tap is accepted
- **THEN** the system SHALL mark the package payment confirmation flow as submitting immediately
- **AND** the system SHALL present the confirmation button as non-repeatable during that state
#### Scenario: Package payment confirmation recovers after terminal outcome
- **WHEN** the package payment flow ends because of success, failure, cancellation, validation failure, strong recharge prompt completion, or modal re-entry
- **THEN** the system SHALL clear the submitting state
- **AND** the user SHALL be able to start a new payment attempt
### Requirement: Order list immediate payment SHALL prevent duplicate submission
The system SHALL prevent repeated taps on an order list item's immediate payment button from starting more than one payment submission flow for the current order at the same time.
#### Scenario: User taps order list immediate payment repeatedly during submission
- **WHEN** the user taps the immediate payment button multiple times before the current `handleOrderPayment` flow completes
- **THEN** the system SHALL execute only the first submission flow
- **AND** the system SHALL ignore subsequent taps until the current flow ends
#### Scenario: Order list immediate payment enters submitting state
- **WHEN** the first valid order list immediate payment tap is accepted
- **THEN** the system SHALL mark the current order payment flow as submitting immediately
- **AND** the system SHALL present the triggered immediate payment button as non-repeatable during that state
#### Scenario: Order list immediate payment recovers after terminal outcome
- **WHEN** the order list payment flow ends because of success, failure, cancellation, list refresh, or page re-entry
- **THEN** the system SHALL clear the submitting state
- **AND** the user SHALL be able to start a new payment attempt if the order remains payable
### Requirement: Wallet recharge order immediate payment SHALL prevent duplicate submission
The system SHALL prevent repeated taps on a wallet recharge order item's immediate payment button from starting more than one recharge order payment flow for the current recharge order at the same time.
#### Scenario: User taps wallet recharge order immediate payment repeatedly during submission
- **WHEN** the user taps the immediate payment button multiple times before the current `handleRechargePayment` flow completes
- **THEN** the system SHALL execute only the first submission flow
- **AND** the system SHALL ignore subsequent taps until the current flow ends
#### Scenario: Wallet recharge order immediate payment enters submitting state
- **WHEN** the first valid wallet recharge order immediate payment tap is accepted
- **THEN** the system SHALL mark the current recharge order payment flow as submitting immediately
- **AND** the system SHALL present the triggered immediate payment button as non-repeatable during that state
#### Scenario: Wallet recharge order immediate payment recovers after terminal outcome
- **WHEN** the wallet recharge order payment flow ends because of success, failure, cancellation, list refresh, or page re-entry
- **THEN** the system SHALL clear the submitting state
- **AND** the user SHALL be able to start a new payment attempt if the recharge order remains payable
### Requirement: Submit guards SHALL NOT change existing payment business rules
The system SHALL preserve the current recharge validation, recharge order payment, order list payment, order creation, strong recharge decision, wallet payment, WeChat payment, toast, modal, and balance refresh behavior while adding submit guards.
#### Scenario: Existing business validation remains unchanged
- **WHEN** the user submits with an invalid recharge amount or reaches an existing payment business rule branch
- **THEN** the system SHALL keep the current validation and messaging behavior
- **AND** the duplicate submission guard SHALL only affect repeated-trigger protection

View File

@@ -0,0 +1,31 @@
## 1. Wallet Recharge Confirmation Submit Guard
- [x] 1.1 Add a dedicated submitting state for the wallet recharge confirmation flow
- [x] 1.2 Ignore repeated taps while `confirmRecharge` is already running
- [x] 1.3 Bind the confirmation button state to the submitting state and restore it on every exit path
## 2. Package Payment Confirmation Submit Guard
- [x] 2.1 Add a dedicated submitting state for the package payment confirmation flow
- [x] 2.2 Ignore repeated taps while `confirmPay` is already running
- [x] 2.3 Bind the confirmation button state to the submitting state and restore it on every exit path
## 3. Order List Immediate Payment Submit Guard
- [x] 3.1 Add a dedicated submitting state for order list immediate payment
- [x] 3.2 Ignore repeated taps while `handleOrderPayment` is already running for the current payment flow
- [x] 3.3 Bind the order list immediate payment button state to the submitting state and restore it on every exit path
## 4. Wallet Recharge Order Immediate Payment Submit Guard
- [x] 4.1 Add a dedicated submitting state for wallet recharge order immediate payment
- [x] 4.2 Ignore repeated taps while `handleRechargePayment` is already running for the current payment flow
- [x] 4.3 Bind the recharge order immediate payment button state to the submitting state and restore it on every exit path
## 5. Regression Verification
- [x] 5.1 Verify repeated taps only trigger one effective submit in the wallet recharge modal
- [x] 5.2 Verify repeated taps only trigger one effective submit in the package payment modal
- [x] 5.3 Verify repeated taps only trigger one effective submit in the order list immediate payment flow
- [x] 5.4 Verify repeated taps only trigger one effective submit in the wallet recharge order immediate payment flow
- [x] 5.5 Verify users can retry after validation failure, payment cancel, payment failure, list refresh, and modal reopen

View File

@@ -0,0 +1,19 @@
# Change: Add personal customer notifications
## Why
个人客户缺少统一的站内通知入口,无法查看业务通知、获取未读数量或管理通知已读状态。
## What Changes
- 增加个人客户通知列表查询接口,支持分页和固定倒序排列。
- 增加单条通知已读和全部通知已读接口。
- 增加个人客户通知未读数查询接口。
- 限制通知数据仅返回当前认证客户可见且未过期的业务通知。
- 统一返回通知内容、关联资源、通知级别、已读状态及时间信息。
## Impact
- Affected specs: `personal-notifications`
- Affected code: 个人客户通知 API、通知列表入口、未读数展示和已读状态处理
- No breaking changes to existing APIs

View File

@@ -0,0 +1,56 @@
## ADDED Requirements
### Requirement: Personal customers SHALL be able to query notifications
The system SHALL provide `GET /api/c/v1/notifications` for authenticated personal customers. The endpoint SHALL return only visible, unexpired business notifications for the current customer, ordered by creation time descending and notification ID descending.
#### Scenario: Query the first notification page
- **WHEN** an authenticated customer requests the notification list without pagination parameters
- **THEN** the system SHALL return page 1 with up to 20 notifications
- **AND** the response SHALL include `items`, `page`, `size`, and `total`
#### Scenario: Apply valid pagination
- **WHEN** the request includes `page` from 1 to 10000 and `page_size` from 1 to 50
- **THEN** the system SHALL return the requested page and page size
#### Scenario: Reject invalid pagination
- **WHEN** `page` or `page_size` is outside its allowed range
- **THEN** the system SHALL return a parameter validation error
### Requirement: Notification items SHALL expose client-readable status and metadata
Each notification item SHALL include `id`, `title`, `body`, `type`, `category`, `severity`, `ref_type`, `ref_id`, `ref_key`, `is_read`, `created_at`, and nullable `read_at`.
#### Scenario: Return an unread notification
- **WHEN** a visible notification has not been read by the current customer
- **THEN** the system SHALL return `is_read: false` and `read_at: null`
### Requirement: Personal customers SHALL be able to mark one notification as read
The system SHALL provide `PUT /api/c/v1/notifications/{id}/read` for authenticated personal customers. The operation SHALL be idempotent and SHALL only update a notification visible to the current customer.
#### Scenario: Mark a visible unread notification
- **WHEN** the customer marks a visible unread notification as read
- **THEN** the system SHALL set its read state and return `{ "success": true }`
#### Scenario: Mark an unavailable or already-read notification
- **WHEN** the notification does not exist, belongs to another customer, or is already read
- **THEN** the system SHALL return `{ "success": true }` without exposing ownership information
### Requirement: Personal customers SHALL be able to mark all notifications as read
The system SHALL provide `PUT /api/c/v1/notifications/read-all` to mark all visible, unexpired, unread business notifications for the current customer as read.
#### Scenario: Mark all unread notifications
- **WHEN** the customer calls the mark-all-read endpoint
- **THEN** the system SHALL return the number of notifications actually updated in `updated_count`
- **AND** repeated calls SHALL remain successful and return zero when nothing needs updating
### Requirement: Personal customers SHALL be able to query unread count
The system SHALL provide `GET /api/c/v1/notifications/unread-count`. The count SHALL include only visible, unexpired business notifications and SHALL exclude platform sync and system operations notifications.
#### Scenario: Return unread count and badge text
- **WHEN** an authenticated customer queries the unread count
- **THEN** the system SHALL return numeric `count` and string `display_count`
- **AND** `display_count` SHALL be `99+` when `count` exceeds 99

View File

@@ -0,0 +1,26 @@
## 1. API and Data Contract
- [x] 1.1 Define the client-side personal notification item and paginated list contract
- [x] 1.2 Define the client-side unread count and read-operation contracts
- [x] 1.3 Add authenticated notification API wrappers
## 2. Notification Behavior
- [ ] 2.1 Return only current customer's visible, unexpired business notifications
- [ ] 2.2 Apply creation-time and notification-ID descending ordering
- [ ] 2.3 Support idempotent single-read and read-all operations
- [ ] 2.4 Exclude platform sync and system operations notifications from unread count
## 3. Client Entry
- [x] 3.1 Add the personal notification list entry and pagination handling
- [x] 3.2 Add unread-count display and refresh behavior
- [x] 3.3 Mark notifications read from list actions and support mark-all-read
## 4. Verification
- [ ] 4.1 Test authentication, pagination limits, ordering, and visibility isolation
- [ ] 4.2 Test idempotent read behavior and unread-count updates
- [x] 4.3 Verify the H5 build and unified success/error response handling
> Note: The repository contains the H5 client only. Tasks 2.1-2.4 and 4.1-4.2 require implementation and verification in the backend service repository.

View File

@@ -0,0 +1,49 @@
## Context
The current device exchange popup stores recipient name, phone, and address in three flat fields, with `recipient_address` being a single string. The shipping submit API currently accepts only `recipient_name`, `recipient_phone`, and `recipient_address`, so the frontend must remain compatible unless the backend contract changes later.
The homepage already loads `/api/c/v1/asset/info` through `assetApi.getInfo(identifier)`. The UI shows package name and expiry date in the top summary card, but the request now also returns `data.iccid`, which should be exposed without adding a second asset query.
## Goals / Non-Goals
- Goals:
- Add a structured province/city/district selector using `element-china-area-data`
- Keep a separate detailed-address field for device exchange shipping info
- Allow users to paste one shipping-info string and prefill recipient name, phone, and address fields
- Preserve compatibility with the existing exchange shipping submit endpoint
- Show `ICCID` above the package name in the homepage top summary card
- Non-Goals:
- Redesign the backend exchange shipping API
- Add OCR or image-based recognition for shipping labels
- Normalize all historical address data outside the device exchange popup
## Decisions
- Decision: Use `element-china-area-data` as the source for province/city/district options.
Why: The request explicitly requires that dataset, and a static local area dataset avoids introducing extra network dependencies.
- Decision: Keep `/api/c/v1/exchange/{id}/shipping-info` unchanged and compose `recipient_address` on the client.
Why: The existing API already accepts one address string, so the frontend can implement the new UX without blocking on backend changes.
- Decision: Recognize pasted shipping text with best-effort client-side parsing for mainland China phone numbers and common copied-address formats.
Why: Users often copy a single line or multi-line string from chat or e-commerce apps, and partial automation reduces manual entry while still allowing correction.
- Decision: When reopening existing saved shipping info, prefill split fields with best-effort parsing and preserve the original address content if a full region split cannot be derived.
Why: Existing records are already stored as a combined string, so the UI needs a no-data-loss compatibility path during the transition.
- Decision: Use `data.iccid` from the existing asset info response as the homepage summary source of truth.
Why: The user explicitly named that field and endpoint, and it avoids mixing multiple ICCID sources in the header card.
## Risks / Trade-offs
- Pasted shipping strings vary in format, so recognition must remain best-effort and allow manual correction before submission.
- Some previously saved combined addresses may not map cleanly back to province/city/district selections, so fallback behavior must preserve the original text.
- Adding a new area dataset dependency increases bundle size slightly, but it keeps address selection deterministic and local.
## Migration Plan
1. Add the `element-china-area-data` dependency and wire it into the device exchange popup.
2. Introduce split address state, pasted-text parsing, and composed submit payload handling.
3. Update homepage asset state to read `data.iccid` and render it above package name.
4. Verify that existing exchange records remain editable without losing previously saved address content.

View File

@@ -0,0 +1,28 @@
## Why
The device exchange popup currently collects the shipping address as a single free-text field. This makes Chinese address entry error-prone, does not support selecting province/city/district from a standard area dataset, and forces users to manually rewrite recipient details even when they already copied a full shipping string from another app.
The homepage top summary card already loads asset information from `/api/c/v1/asset/info`, but it does not surface the `ICCID` value even though the response now provides `data.iccid`. Users need that value visible above the package name on the homepage.
## What Changes
- Replace the single shipping-address input in `pages/device-exchange/device-exchange.vue` with province/city/district selection backed by `element-china-area-data` plus a separate detailed-address input
- Add a pasteable shipping-info input so the page can recognize and prefill recipient name, phone number, and address from one copied string
- Keep the existing exchange shipping submission API contract and assemble the selected region text together with the detailed address into `recipient_address`
- Add an `ICCID` line above the package name in the homepage top summary card
- Use `data.iccid` from `/api/c/v1/asset/info?identifier=...` as the homepage `ICCID` source of truth
## Capabilities
### New Capabilities
- `device-exchange-shipping-entry`: Define structured shipping entry, pasted shipping-text recognition, and payload composition for the device exchange popup
- `index-asset-summary`: Define homepage summary display rules for `ICCID`
### Modified Capabilities
## Impact
- Affected code: `pages/device-exchange/device-exchange.vue`, `pages/index/index.vue`, `components/UserInfoCard.vue`, related address parsing helpers if introduced
- Affected dependencies: `element-china-area-data`
- Affected API usage: `/api/c/v1/exchange/{id}/shipping-info`, `/api/c/v1/asset/info`
- No backend API contract change is required if the frontend continues submitting a composed `recipient_address` string

View File

@@ -0,0 +1,50 @@
## ADDED Requirements
### Requirement: Device exchange shipping entry SHALL collect a structured recipient address
The system SHALL collect recipient name, recipient phone number, a province/city/district selection sourced from `element-china-area-data`, and a separate detailed address when the user fills shipping information for a pending device exchange.
#### Scenario: User opens the shipping popup for a pending exchange
- **WHEN** the device exchange record is in the state that allows filling shipping information
- **AND** the user opens the shipping popup
- **THEN** the popup SHALL show editable fields for recipient name, recipient phone number, province/city/district, and detailed address
#### Scenario: User attempts to submit without a complete address
- **WHEN** the user submits the shipping popup without selecting province/city/district or without entering a detailed address
- **THEN** the system SHALL block submission
- **AND** the system SHALL tell the user that the shipping address is incomplete
### Requirement: Device exchange shipping entry SHALL support pasted shipping-text recognition
The system SHALL provide a way for the user to paste one shipping-info string and SHALL attempt to recognize recipient name, mainland China phone number, and address content from that string into editable form fields.
#### Scenario: Pasted shipping text contains recognizable recipient information
- **WHEN** the user pastes a shipping-info string containing a recipient name, an 11-digit mainland China phone number, and address content
- **THEN** the system SHALL prefill the recognized recipient name and phone number
- **AND** the system SHALL prefill the recognized address content into the structured address form as far as it can infer
#### Scenario: Pasted shipping text is only partially recognizable
- **WHEN** the user pastes a shipping-info string but the system cannot confidently extract every required field
- **THEN** the system SHALL preserve the fields it can recognize
- **AND** the user SHALL still be able to manually complete or correct the remaining fields before submission
### Requirement: Device exchange shipping submission SHALL preserve the existing API contract
The system SHALL continue submitting `recipient_name`, `recipient_phone`, and `recipient_address` to `/api/c/v1/exchange/{id}/shipping-info`, and SHALL compose `recipient_address` from the selected province/city/district text together with the detailed address.
#### Scenario: User submits valid shipping information
- **WHEN** the user submits the popup with a valid recipient name, a valid mainland China phone number, a selected province/city/district, and a detailed address
- **THEN** the system SHALL call `/api/c/v1/exchange/{id}/shipping-info`
- **AND** the payload SHALL keep `recipient_name` and `recipient_phone`
- **AND** the payload SHALL send a composed `recipient_address` string containing the selected region text and the detailed address
### Requirement: Existing exchange shipping information SHALL remain editable without data loss
The system SHALL preserve previously saved shipping information when reopening the popup and SHALL support best-effort conversion from a previously saved combined address string into the new structured address fields.
#### Scenario: Existing saved address can be split into region and detail
- **WHEN** the popup opens for an exchange record that already has a saved `recipient_address`
- **AND** the saved address can be matched to province/city/district data
- **THEN** the system SHALL prefill the region selection and the detailed address
#### Scenario: Existing saved address cannot be fully split
- **WHEN** the popup opens for an exchange record that already has a saved `recipient_address`
- **AND** the saved address cannot be confidently split into province/city/district plus detailed address
- **THEN** the system SHALL preserve the original saved address content for manual correction
- **AND** the user SHALL still be able to complete a valid structured address before resubmitting

View File

@@ -0,0 +1,23 @@
## ADDED Requirements
### Requirement: Homepage top summary SHALL display ICCID above the package name
The system SHALL display an `ICCID` line above the package name in the homepage top summary card after asset information is loaded.
#### Scenario: Asset info returns an ICCID value
- **WHEN** the homepage loads asset information successfully
- **AND** the response contains `data.iccid`
- **THEN** the top summary card SHALL display `ICCID: <value>` above the package name
#### Scenario: Asset info does not return an ICCID value
- **WHEN** the homepage loads asset information successfully
- **AND** `data.iccid` is empty or missing
- **THEN** the top summary card SHALL still display the `ICCID` field
- **AND** the field SHALL show a stable fallback value
### Requirement: Homepage ICCID SHALL use the asset info response as the source of truth
The system SHALL source the homepage `ICCID` value from `data.iccid` returned by `/api/c/v1/asset/info?identifier=...`.
#### Scenario: Homepage refreshes asset information
- **WHEN** the homepage reads or refreshes asset information from `/api/c/v1/asset/info`
- **THEN** the `ICCID` shown in the top summary card SHALL be updated from `data.iccid`
- **AND** the header SHALL NOT depend on deriving the display value from a different ICCID field for this summary position

View File

@@ -0,0 +1,20 @@
## 1. Device Exchange Shipping Entry
- [x] 1.1 Add `element-china-area-data` and integrate province/city/district selection into `pages/device-exchange/device-exchange.vue`
- [x] 1.2 Replace the single shipping-address input with structured region selection plus a separate detailed-address input
- [x] 1.3 Add a pasted shipping-info input and parse recipient name, recipient phone, and address content into editable form fields
- [x] 1.4 Compose the selected region text and detailed address into `recipient_address` when submitting `/api/c/v1/exchange/{id}/shipping-info`
- [x] 1.5 Preserve edit compatibility for previously saved combined addresses
## 2. Homepage ICCID Summary
- [x] 2.1 Read `data.iccid` from `assetApi.getInfo(identifier)` into homepage state
- [x] 2.2 Render `ICCID` above the package name in `components/UserInfoCard.vue`
- [x] 2.3 Show a stable fallback when `data.iccid` is absent
## 3. Regression Verification
- [x] 3.1 Verify the device exchange popup blocks submission when region selection or detailed address is incomplete
- [x] 3.2 Verify a pasted shipping string can prefill recipient name, phone number, and address with manual correction still available
- [x] 3.3 Verify the exchange shipping submit payload remains compatible with the existing backend contract
- [x] 3.4 Verify the homepage top summary shows `ICCID` from `/api/c/v1/asset/info` above the package name

View File

@@ -0,0 +1,136 @@
# Exchange Flow Type Support - Implementation Summary
## 实施完成 ✅
### 变更概述
根据后端换货流程升级,前端已完成对新增字段的支持:
- `flow_type`: 流程类型shipping/direct
- `flow_type_name`: 流程类型名称
- `shipped_at`: 发货时间
- `completed_at`: 完成时间
### 已完成的工作
#### 1. 创建 OpenSpec 文档
-`proposal.md` - 提案说明
-`specs/exchange-flow-type-display/spec.md` - 详细规格
-`tasks.md` - 任务清单
#### 2. 代码实现
**修改文件:** `pages/device-exchange/device-exchange.vue`
**新增显示内容:**
```vue
<!-- 换货类型 - 始终显示 -->
<view class="info-row flex-row-sb">
<view class="info-label">换货类型</view>
<view class="info-value">{{ exchangeData.flow_type_name || '物流换货' }}</view>
</view>
<!-- 发货时间 - 条件显示 -->
<view class="info-row flex-row-sb" v-if="exchangeData.shipped_at">
<view class="info-label">发货时间</view>
<view class="info-value">{{ formatTime(exchangeData.shipped_at) }}</view>
</view>
<!-- 完成时间 - 条件显示 -->
<view class="info-row flex-row-sb" v-if="exchangeData.completed_at && exchangeData.status === 4">
<view class="info-label">完成时间</view>
<view class="info-value">{{ formatTime(exchangeData.completed_at) }}</view>
</view>
```
### 关键设计决策
#### 1. 后端保证的行为
- `GET /api/c/v1/exchange/pending` 仅返回 `shipping` 类型的进行中换货单
- `direct` 类型创建后立即完成,不会出现在待处理列表
- 前端无需额外过滤或判断
#### 2. 向后兼容
- 历史数据没有 `flow_type_name` 时,默认显示"物流换货"
- 新增字段都是条件显示,不影响现有数据展示
- 原有的按钮和表单逻辑保持不变
#### 3. 无需修改的部分
- ✅ API 模块 (`api/modules/exchange.js`) - 自动透传所有响应字段
- ✅ 表单提交逻辑 - 后端负责流程类型校验
- ✅ 按钮显示逻辑 - 因为 direct 类型不会进入待处理状态
### 显示逻辑
| 字段 | 显示条件 | 默认值 |
|------|---------|--------|
| 换货类型 | 始终显示 | "物流换货"(当 `flow_type_name` 为空时) |
| 发货时间 | `shipped_at` 不为空 | 不显示 |
| 完成时间 | `completed_at` 不为空 且 `status === 4` | 不显示 |
### 测试场景
需要测试的场景(待后端接口就绪后验证):
1. **待填写信息** (`status: 1`)
- 显示:换货类型、换货原因、申请时间
- 显示"填写信息"按钮
2. **待发货** (`status: 2`)
- 显示:换货类型、换货原因、申请时间、收件信息
- 不显示发货时间
3. **已发货** (`status: 3`)
- 显示:换货类型、换货原因、申请时间、发货时间、收件信息
- 不显示按钮
4. **已完成** (`status: 4`)
- 显示:换货类型、换货原因、申请时间、发货时间、完成时间、收件信息
- 不显示按钮
5. **无待处理换货单**
- 显示空状态:"暂无换货记录"
### API 响应示例
```json
{
"code": 0,
"msg": "success",
"data": {
"id": 123,
"exchange_no": "EXC20260603001",
"old_asset_type": "iot_card",
"old_identifier": "8986012345678901234",
"exchange_reason": "设备损坏",
"status": 2,
"status_text": "待发货",
"flow_type": "shipping",
"flow_type_name": "物流换货",
"shipped_at": null,
"completed_at": null,
"created_at": "2026-06-03T10:00:00+08:00",
"recipient_name": "张三",
"recipient_phone": "13800138000",
"recipient_address": "北京市朝阳区xxx路xxx号"
}
}
```
### 影响范围
- **修改文件**: 1 个 (`pages/device-exchange/device-exchange.vue`)
- **新增文档**: 3 个proposal, spec, tasks
- **影响用户**: 使用换货功能的客户端用户
- **兼容性**: 完全向后兼容,不影响现有流程
### 后续工作
- [ ] 等待后端接口部署
- [ ] 在测试环境验证所有测试场景
- [ ] 确认不同状态下的显示效果
- [ ] 验证历史数据的兼容性
---
**实施日期**: 2026-06-03
**实施人员**: Claude
**状态**: ✅ 代码实现完成,待测试验证

View File

@@ -0,0 +1,29 @@
## Why
The backend exchange system now supports two flow types: **shipping** (logistics-based exchange requiring address collection and shipment) and **direct** (immediate completion without logistics). The current frontend client only handles the original shipping flow and does not process the new `flow_type`, `flow_type_name`, `shipped_at`, and `completed_at` response fields.
This prevents the frontend from correctly displaying exchange records that may include both flow types and from adapting UI behavior based on flow type constraints.
## What Changes
- Update the exchange pending query and shipping info submission to handle new response fields: `flow_type`, `flow_type_name`, `shipped_at`, `completed_at`
- Preserve existing behavior where the pending exchange API only returns `shipping` type exchanges (status 1/2/3), as `direct` exchanges are completed immediately and never appear in pending state
- Display flow type information in the exchange detail view
- Ensure shipping info submission validates that the exchange is `flow_type = shipping` and `status = 1` (backend enforces this, frontend should handle error gracefully)
- No UI flow changes required since `direct` type exchanges will not appear in the pending list by design
## Capabilities
### New Capabilities
- `exchange-flow-type-display`: Display flow type and completion timestamps in exchange records
### Modified Capabilities
- `exchange-pending-query`: Handle new response fields from `/api/c/v1/exchange/pending`
- `exchange-shipping-submission`: Handle new response fields from `/api/c/v1/exchange/{id}/shipping-info`
## Impact
- Affected code: `pages/device-exchange/device-exchange.vue`, `api/modules/exchange.js`
- Affected API usage: `/api/c/v1/exchange/pending`, `/api/c/v1/exchange/{id}/shipping-info`
- No breaking changes: existing shipping flow behavior remains unchanged
- Backend ensures `direct` type exchanges are not returned by pending query, so frontend maintains current UX

View File

@@ -0,0 +1,195 @@
# Exchange Flow Type Display Specification
## Overview
Update the exchange display to show the new flow type and timestamp fields returned by the backend exchange APIs.
## API Response Changes
### GET /api/c/v1/exchange/pending
**New Response Fields:**
```json
{
"code": 0,
"msg": "success",
"timestamp": "2026-06-03T10:00:00+08:00",
"data": {
"id": 1,
"exchange_no": "EXC20260603001",
"order_no": "EXC20260603001",
"old_asset_type": "iot_card",
"old_identifier": "8986012345678901234",
"exchange_reason": "设备损坏",
"status": 2,
"status_text": "待发货",
"flow_type": "shipping",
"flow_type_name": "物流换货",
"shipped_at": null,
"completed_at": null,
"created_at": "2026-06-03T10:00:00+08:00",
"recipient_name": "张三",
"recipient_phone": "13800138000",
"recipient_address": "北京市朝阳区xxx路xxx号"
}
}
```
**Field Descriptions:**
| Field | Type | Description |
|-------|------|-------------|
| `flow_type` | string | 流程类型: `shipping` (物流换货) or `direct` (直接换货)。历史数据为空时视为 `shipping` |
| `flow_type_name` | string | 流程类型名称: "物流换货" or "直接换货" |
| `shipped_at` | string\|null | 发货时间,仅 `shipping` 流程发货后有值 |
| `completed_at` | string\|null | 换货完成时间,换货完成后有值 |
**Backend Behavior:**
- Only returns exchanges where `flow_type = shipping` AND `status IN (1, 2, 3)`
- `direct` type exchanges are never returned (they complete immediately on creation)
- If no pending exchange exists, returns `data: null`
### POST /api/c/v1/exchange/{id}/shipping-info
**Response includes the same new fields as above**
**Backend Constraints:**
- Only accepts `flow_type = shipping` AND `status = 1`
- Returns 400 error if `flow_type = direct`: `{"code": 400, "message": "流程类型不支持该操作"}`
- Returns 400 error if status is not 1: `{"code": 400, "message": "当前状态不允许填写收货信息"}`
## UI Changes
### Exchange Detail Card
Add flow type display in the exchange info section:
**Before:**
```
换货原因: 设备损坏
申请时间: 2026-06-03 10:00:00
收件人: 张三
联系电话: 13800138000
收货地址: 北京市朝阳区xxx路xxx号
```
**After:**
```
换货类型: 物流换货
换货原因: 设备损坏
申请时间: 2026-06-03 10:00:00
发货时间: 2026-06-04 15:30:00 (仅已发货时显示)
完成时间: 2026-06-05 10:00:00 (仅已完成时显示)
收件人: 张三
联系电话: 13800138000
收货地址: 北京市朝阳区xxx路xxx号
```
**Display Rules:**
1. **换货类型**: Always display `flow_type_name` if present, fallback to "物流换货" if empty
2. **发货时间**: Only display if `shipped_at` is not null
3. **完成时间**: Only display if `completed_at` is not null and `status === 4`
### Error Handling
When submitting shipping info fails with flow type error:
```javascript
// Existing error handling should catch and display backend error message
catch (error) {
console.error('提交换货信息失败', error);
// Backend will return: {"code": 400, "message": "流程类型不支持该操作"}
// Default error toast will show this message
}
```
## Implementation
### 1. Update API Module Types
No changes needed to `api/modules/exchange.js` - it already passes through all response fields.
### 2. Update Exchange Page Template
File: `pages/device-exchange/device-exchange.vue`
Add flow type and timestamp displays:
```vue
<view class="exchange-info">
<view class="info-row flex-row-sb">
<view class="info-label">换货类型</view>
<view class="info-value">{{ exchangeData.flow_type_name || '物流换货' }}</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">换货原因</view>
<view class="info-value">{{ exchangeData.exchange_reason }}</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">申请时间</view>
<view class="info-value">{{ formatTime(exchangeData.created_at) }}</view>
</view>
<view class="info-row flex-row-sb" v-if="exchangeData.shipped_at">
<view class="info-label">发货时间</view>
<view class="info-value">{{ formatTime(exchangeData.shipped_at) }}</view>
</view>
<view class="info-row flex-row-sb" v-if="exchangeData.completed_at && exchangeData.status === 4">
<view class="info-label">完成时间</view>
<view class="info-value">{{ formatTime(exchangeData.completed_at) }}</view>
</view>
<!-- Existing recipient fields -->
</view>
```
### 3. No Button Logic Changes
Since `direct` type exchanges never appear in pending (they complete immediately), the existing button visibility logic remains valid:
```vue
<view class="exchange-actions" v-if="exchangeData.status === 1">
<button class="btn-apple btn-primary" @tap="openPopup">填写信息</button>
</view>
```
Backend enforces that only `shipping` + status 1 can submit shipping info, so frontend doesn't need additional flow type checks.
## Testing Scenarios
### 1. Shipping Flow Exchange (Existing Behavior)
- Load pending exchange with `flow_type: "shipping"`, `status: 1`
- Verify "换货类型: 物流换货" displays
- Verify "填写信息" button shows
- Submit shipping info successfully
- Verify response includes new fields
### 2. Shipped Exchange
- Load exchange with `flow_type: "shipping"`, `status: 3`, `shipped_at: "2026-06-04T15:30:00+08:00"`
- Verify "发货时间" row displays
- Verify no action buttons show
### 3. Completed Exchange
- Load exchange with `flow_type: "shipping"`, `status: 4`, `completed_at: "2026-06-05T10:00:00+08:00"`
- Verify "完成时间" row displays
- Verify no action buttons show
### 4. No Pending Exchange
- Call API with no pending exchange
- Verify empty state shows: "暂无换货记录"
### 5. Error Handling (Edge Case)
If somehow a `direct` type exchange appeared and user tried to submit shipping info (should not happen), backend returns 400 error which existing error handler will toast.
## Backward Compatibility
- Historical data without `flow_type` will be treated as `shipping` (per backend spec)
- All new fields are optional in frontend display logic
- Existing shipping submission flow is unchanged

View File

@@ -0,0 +1,17 @@
# Tasks
## 1. Update Exchange Detail Display
- [x] Add flow type display row in exchange info section
- [x] Add shipped_at display row (conditional on value)
- [x] Add completed_at display row (conditional on value and status)
- [x] Ensure backward compatibility for historical data without flow_type
## 2. Testing
- [ ] Test with shipping flow exchange (status 1, 2, 3)
- [ ] Test with completed exchange showing completion time
- [ ] Test with shipped exchange showing ship time
- [ ] Test empty state when no pending exchange
- [ ] Test shipping info submission success with new response fields
## Files Modified
- [x] `pages/device-exchange/device-exchange.vue`: Added new field displays

View File

@@ -0,0 +1,25 @@
## Why
The current login flow decides whether to send the user to the bind-phone page based on `loginData.need_bind_phone`. This makes the phone-binding gate happen only at login time, which is fragile because the actual requirement belongs to entering the homepage, not only to completing login. As a result, the app can enter an inconsistent state when the user reaches `index` through other paths or when the latest bind requirement should be re-evaluated on homepage entry.
## What Changes
- Move the mandatory phone-binding gate out of `pages/login/login.vue`
- Make login success redirect to `pages/index/index` consistently
- Require `pages/index/index.vue` to check whether the current account still needs phone binding every time the page is entered
- Redirect to `pages/bind/bind` from `index` when binding is required, instead of deciding that only during login
- Keep the bind-phone page as the place where the user completes the required binding flow
## Capabilities
### New Capabilities
- `index-phone-bind-gate`: Define homepage-entry binding rules so phone binding is enforced from `index` instead of only from login
### Modified Capabilities
## Impact
- Affected code: `pages/login/login.vue`, `pages/index/index.vue`, `pages/bind/bind.vue`
- Affected flow: post-login routing, homepage entry, mandatory bind-phone redirect
- No backend API changes
- No login credential or bind-phone API contract changes

View File

@@ -0,0 +1,44 @@
## ADDED Requirements
### Requirement: Login success SHALL NOT own the bind-phone routing decision
The system SHALL stop deciding mandatory bind-phone routing inside the login success handler and SHALL route successful login into the homepage entry flow instead.
#### Scenario: Login succeeds for a user who may need binding
- **WHEN** the user completes login successfully
- **THEN** the system SHALL route the user to `pages/index/index`
- **AND** the system SHALL NOT branch directly from the login page to the bind-phone page based only on login-time routing logic
### Requirement: Index entry SHALL enforce the bind-phone gate
The system SHALL determine whether phone binding is required whenever the homepage is entered and SHALL redirect to the bind-phone page if the current account is not yet bound.
#### Scenario: User enters index and binding is required
- **WHEN** the user enters `pages/index/index`
- **AND** the latest account state indicates the phone is not yet bound
- **THEN** the system SHALL redirect the user from `index` to `pages/bind/bind`
#### Scenario: User enters index and binding is not required
- **WHEN** the user enters `pages/index/index`
- **AND** the latest account state indicates the phone is already bound
- **THEN** the system SHALL keep the user on the homepage
#### Scenario: User re-enters index later without binding
- **WHEN** the user enters `pages/index/index` again through a later navigation path
- **AND** the latest account state still indicates the phone is not yet bound
- **THEN** the system SHALL re-apply the bind-phone redirect
- **AND** the redirect SHALL NOT depend on whether the user just came from the login page
### Requirement: Bind completion SHALL remain compatible with homepage entry
The system SHALL preserve the existing bind-phone completion destination to the homepage while allowing the homepage gate to be the source of truth for whether binding is still required.
#### Scenario: User completes binding and returns to index
- **WHEN** the user completes phone binding successfully
- **THEN** the system SHALL return the user to `pages/index/index`
- **AND** entering `index` afterward SHALL no longer redirect if the account is now bound
### Requirement: Index phone-bind gate SHALL NOT change login or bind API contracts
The system SHALL preserve the existing login API, bind-phone API, token handling, and account retrieval contracts while changing only the routing responsibility.
#### Scenario: Routing responsibility changes without API change
- **WHEN** the new homepage-entry gate is applied
- **THEN** the system SHALL change only where the bind requirement is evaluated for routing
- **AND** the system SHALL NOT require backend API contract changes

View File

@@ -0,0 +1,23 @@
## 1. Login Redirect Responsibility
- [x] 1.1 Remove the bind-phone branching decision from the login success handler
- [x] 1.2 Make login success enter `pages/index/index` consistently
## 2. Index Entry Binding Gate
- [x] 2.1 Add a homepage-entry binding check in `pages/index/index.vue`
- [x] 2.2 Re-evaluate whether binding is required every time `index` is entered, not only after login
- [x] 2.3 Redirect from `index` to the bind-phone page when binding is still required
## 3. Bind Flow Compatibility
- [x] 3.1 Keep the bind-phone completion flow returning to `index`
- [x] 3.2 Ensure users who are already bound are not redirected away from `index`
- [x] 3.3 Ensure users who return to `index` without binding are checked again and redirected again if binding is still required
## 4. Regression Verification
- [x] 4.1 Verify login success always routes into `index`
- [x] 4.2 Verify entering `index` without a bound phone redirects to the bind page
- [x] 4.3 Verify entering `index` with a bound phone stays on the homepage
- [x] 4.4 Verify re-entering `index` through later navigation still rechecks binding state

View File

@@ -0,0 +1,63 @@
## Context
本次迭代同时调整认证入口、资产初始化、套餐购买、钱包充值、订单查询和站内通知入口。后端已经通过资产信息、充值校验、订单和通知接口返回策略与业务状态H5/C 端需要消费这些结果,而不是复制后端规则。当前仓库已经存在部分支付、实名和通知页面,因此提案以增量收敛行为为主。
接口约定以 `docs/所需接口文档/new-api.md` 为准;登录限制接口和通知接口的调用路径同时以 `docs/产品迭代7月份/七月迭代H5_C端改动说明.md` 中列出的既有路径为准。
## Goals / Non-Goals
- Goals: 让登录限制、实名策略、支付方式、强充约束、下架套餐续费、预计到期时间、临期/换货通知及订单标识展示均以后端返回为准。
- Goals: 保持现有 H5/C API 路径和支付入口,完成前端参数和展示规则收敛。
- Non-Goals: 不新增后端接口,不修改订单历史快照,不由 H5/C 调用企微审批回调,也不实现七月说明中列出的排除项。
## Decisions
### 1. Backend is the source of truth
资产初始化统一读取 `effective_realname_policy``realname_required``real_name_status``allowed_payment_methods``estimated_final_expires_at``days_until_final_expiry``expiry_estimate_status``is_expiring`。前端不再根据 `asset_type`、卡/设备组合或本地枚举推导实名和支付规则;设备是否已实名也以服务端最终状态为准。
### 2. Keep login failure before token persistence
`POST /api/c/v1/auth/verify-asset` 成功后才允许进入后续微信登录,并保存本次返回的 `asset_token`。业务失败时直接展示后端 `msg`,当前登录尝试不得继续获取或覆盖资产 TokenToken 的签发和吊销仍由服务端负责。
### 3. Normalize payment payloads at the API boundary
订单和充值页面只提交用户从后端允许列表中选择的 `payment_method`。仅在 `payment_method = wechat` 时提交接口要求的 `app_type`;钱包和支付宝不添加无关的微信字段。金额在 UI 层转换为元,在请求层保持整数分。
支付创建成功后,根据 `pay_config``payment_link` 进入既有支付处理;返回页面或支付完成后使用订单详情/状态查询确认结果,不能仅凭前端跳转成功判定已支付。
### 4. Separate catalog visibility from renewal eligibility
普通套餐列表继续只展示可售套餐。老客户续费使用资产信息中的 `current_package_id` 或历史订单中的 `package_ids` 作为已知套餐 ID复用 `POST /api/c/v1/orders/create`,不创建“下架套餐续费”专用接口。前端不得修改历史订单数据或把下架套餐重新放入普通新客购买列表。
### 5. Display the final expiry estimate
资产页面优先展示 `estimated_final_expires_at`,并用 `expiry_estimate_status` 判断其是否可展示,用 `days_until_final_expiry``is_expiring` 控制剩余天数及临期样式。前端不根据当前套餐到期时间自行累加计算最终日期;无可用估算时显示明确的空状态。
### 6. Reuse the existing customer notification entry
首页或通知入口读取未读数,通知页面读取列表,用户查看/点击通知后调用单条已读接口。套餐临期的 15/7/3 天触发和 03 天的优先级由后端通知数据表达,前端只负责按等级排序/展示和更新未读数。换货通知沿用同一套入口不新增营销、ERP 或业务员提醒通道。
本提案依赖进行中的 `add-personal-notifications` 变更提供通知数据的可见性、分页和幂等已读语义;本提案只定义 H5/C 的消费方式。
### 7. Preserve server snapshots in order views
订单列表和详情使用后端返回的 `purchase_role``asset_identifier`。设备显示优先使用 `virtual_no`,为空时使用 `imei`,绝不以 `sn` 代替;缺失数据保持空占位,不由前端伪造。金额继续按分转元展示。
## Risks / Trade-offs
- 后端字段缺失或为空时,页面可能无法给出策略或到期日期;通过统一空状态和错误提示避免前端猜测。
- 同一支付入口可能同时收到 `pay_config``payment_link` 为空的结果;前端必须保留既有错误处理并允许通过订单状态查询恢复。
- `add-personal-notifications` 与本提案同时推进时,需要先确认通知 API 的返回字段和分页参数一致;本提案不重复修改该服务契约。
- 下架套餐续费依赖资产或历史订单提供合法的套餐 ID若两者均不存在应明确提示不可续费而不是从普通列表猜测套餐。
## Migration Plan
1. 先更新 API 封装和数据归一化,再逐个接入登录、资产、支付、套餐、通知和订单页面。
2. 使用接口模拟数据覆盖策略冲突、支付方式变化、强充、临期等级、下架套餐和空标识场景。
3. 联调确认支付结果查询、通知已读幂等性及历史订单快照后发布。
4. 若任一后端字段未上线,回退对应 UI 展示入口,不回退到前端硬编码业务规则。
## Open Questions
- None. The proposal follows the July change description and the provided API document; backend response details not listed there remain opaque to the client and are displayed through existing generic error handling.

View File

@@ -0,0 +1,41 @@
# Change: Update July H5/C iteration behavior
## Why
七月迭代要求 H5/C 端将登录、实名、支付、套餐续费、到期提醒、站内通知和订单展示统一切换为以后端业务结果为准。当前页面和 API 封装仍存在按资产类型或前端本地规则判断的逻辑,部分订单提交也没有始终传递用户选择的支付方式,容易造成错误引导、支付参数不完整和订单信息展示失真。
## What Changes
- 在资产校验登录流程中处理店铺 C 端登录限制;被限制时展示后端业务错误,不保存或继续使用本次登录的资产 Token。
- 使用资产信息接口返回的 `effective_realname_policy``realname_required``real_name_status` 驱动实名状态展示及下单前后的实名流程。
- 使用 `allowed_payment_methods` 渲染支付方式,并在套餐下单、强充校验和钱包充值时按后端规则提交 `payment_method`;微信支付按要求提交 `app_type`
- 普通套餐列表隐藏下架套餐,同时允许正在使用下架套餐的老客户通过 `current_package_id` 或历史订单 `package_ids` 复用 `/api/c/v1/orders/create` 续费。
- 在资产详情、资产列表等页面展示后端计算的 `estimated_final_expires_at`,并使用临期字段进行高亮。
- 接入 C 端站内通知的未读数、列表和单条已读接口,展示套餐临期和换货通知,并按后端临期等级处理提醒优先级。
- 在订单列表和详情展示后端返回的 `purchase_role``asset_identifier`;设备标识按 `virtual_no` 优先、`imei` 兜底,不使用 SN 冒充。
- 保持金额接口以分传输、页面以元展示,并在支付参数或支付链接返回后通过订单状态查询确认支付结果。
本提案不包含首页隐藏设备 ICCID、行业卡未实名复机、状态同步/运营商回调、企微审批回调、原路退款、跨品类换货、分销码或佣金提现等明确排除项。H5/C 端不调用企微审批回调接口。
## Capabilities
### New Capabilities
- `c-login-access`: Enforce the shop-level C-end login restriction during asset verification
- `asset-realname-flow`: Drive real-name behavior from backend asset policy and status
- `asset-expiry-display`: Display the estimated final package expiry and expiry state
- `backend-driven-payment`: Render and submit payment methods from backend policy
- `legacy-package-renewal`: Allow eligible existing customers to renew discontinued packages
- `c-notification-reminders`: Surface expiry and exchange notifications in the H5/C client
- `order-display-fields`: Render order role and server-provided asset identifier snapshots
### Modified Capabilities
- `personal-notifications`: This change consumes the notification endpoints and does not redefine their backend visibility, pagination, or read-state contract. Coordinate with the existing `add-personal-notifications` change.
## Impact
- Affected code: `pages/login/login.vue`, `pages/index/index.vue`, `pages/auth/auth.vue`, `pages/switch/switch.vue`, `pages/package-order/package-order.vue`, `pages/my-wallet/my-wallet.vue`, `pages/order-list/order-list.vue`, `pages/notifications/notifications.vue`, related notification/payment components, and `api/modules/{auth,asset,order,wallet,notification}.js`
- Affected APIs: `/api/c/v1/auth/verify-asset`, `/api/c/v1/asset/info`, `/api/c/v1/wallet/recharge-check`, `/api/c/v1/orders/create`, `/api/c/v1/wallet/recharge`, `/api/c/v1/orders`, `/api/c/v1/orders/{id}`, `/api/c/v1/notifications/unread-count`, `/api/c/v1/notifications`, and `/api/c/v1/notifications/{id}/read`
- No new backend endpoint is required; the client adopts the response fields and request rules described in `docs/所需接口文档/new-api.md` and the July H5/C change description.
- Existing WeChat payment parameter handling, Alipay payment-link handling, wallet payment, payment submit guards, and notification list APIs must remain compatible.

View File

@@ -0,0 +1,23 @@
## ADDED Requirements
### Requirement: Asset views SHALL display the estimated final package expiry
Asset detail and summary views using `/api/c/v1/asset/info` SHALL prefer `estimated_final_expires_at` over `current_package_expires_at` for the user-facing final expiry. The client SHALL use `expiry_estimate_status`, `days_until_final_expiry`, and `is_expiring` when those fields are returned, and SHALL NOT calculate a replacement final expiry locally.
#### Scenario: Exact final expiry is available
- **WHEN** `expiry_estimate_status = exact` and `estimated_final_expires_at` is present
- **THEN** the client SHALL display the estimated final expiry date
- **AND** the client SHALL display the returned remaining-day value when available
#### Scenario: Asset is approaching final expiry
- **WHEN** `is_expiring = true` or the backend returns an applicable expiry level
- **THEN** the client SHALL apply the existing expiry highlight/reminder presentation
- **AND** the client SHALL use the backend value rather than recalculating the threshold
#### Scenario: Final expiry cannot be estimated
- **WHEN** `expiry_estimate_status` is `none`, `waiting_activation`, or `invalid_data`, or the estimated date is null
- **THEN** the client SHALL show the corresponding empty/pending state
- **AND** the client SHALL not present `current_package_expires_at` as if it were the final calculated expiry

View File

@@ -0,0 +1,37 @@
## ADDED Requirements
### Requirement: Real-name behavior SHALL use the effective backend asset policy
The H5/C client SHALL use `GET /api/c/v1/asset/info?identifier=...` as the source of truth for real-name behavior. It SHALL consume `effective_realname_policy`, `realname_required`, and `real_name_status` and SHALL NOT infer policy or final device real-name status from asset type, card type, device type, or frontend-only rules.
#### Scenario: Asset does not require real name
- **WHEN** asset information returns `effective_realname_policy = none` or `realname_required = false`
- **THEN** the client SHALL show the asset as not requiring real-name completion
- **AND** the client SHALL not block the normal order flow for real-name completion
#### Scenario: Real name is required before ordering
- **WHEN** asset information returns `effective_realname_policy = before_order`, `realname_required = true`, and `real_name_status` as not completed
- **THEN** the client SHALL show the real-name requirement
- **AND** the client SHALL prevent package order submission until the existing real-name flow completes
#### Scenario: Real name is required after ordering
- **WHEN** the effective real-name policy is `after_order`
- **AND** `/api/c/v1/device/cards` returns no card with completed real-name authentication
- **AND** package history contains neither a pending package (`status = 0`) nor an active package (`status = 1`)
- **THEN** selecting a real-name entry on the homepage or operator-switch page SHALL block direct real-name authentication
- **AND** the client SHALL show a confirmation prompt that can navigate to package ordering
#### Scenario: Post-order real-name requirement is satisfied
- **WHEN** the effective real-name policy is `after_order`
- **AND** `/api/c/v1/device/cards` returns at least one authenticated card, or package history contains a pending or active package
- **THEN** the homepage and operator-switch real-name entries SHALL retain the existing real-name authentication flow
#### Scenario: Device status is resolved from server output
- **WHEN** a device has cards with different local-looking real-name states but the asset info response returns the effective device `real_name_status`
- **THEN** the client SHALL display and use that returned effective status
- **AND** the client SHALL not replace it with a card/device inference

View File

@@ -0,0 +1,70 @@
## ADDED Requirements
### Requirement: Payment options SHALL be rendered from backend permissions
The H5/C client SHALL use `allowed_payment_methods` from asset information and the recharge-check response to determine which payment methods are visible and selectable. It SHALL support the backend values `wallet`, `wechat`, and `alipay` where returned, and SHALL not hard-code a card/device payment-method matrix.
#### Scenario: Asset payment methods are returned
- **WHEN** asset information returns a non-empty `allowed_payment_methods` list
- **THEN** the package payment UI SHALL render exactly the methods allowed by that list
- **AND** the client SHALL not offer a method absent from the list
#### Scenario: Recharge permissions differ from asset permissions
- **WHEN** `/api/c/v1/wallet/recharge-check` returns its own `allowed_payment_methods` value
- **THEN** the wallet recharge UI SHALL use the recharge-check value for that recharge attempt
- **AND** the client SHALL not reuse a stale package-payment method list
### Requirement: Payment creation SHALL submit the selected method and the required WeChat app type
The client SHALL submit `identifier`, the relevant package or amount fields, and the user-selected `payment_method` to the applicable creation endpoint. It SHALL submit `app_type` only when `payment_method = wechat`, using the endpoint-defined value `official_account` or `miniapp`.
#### Scenario: Create a package order
- **WHEN** the user submits an allowed package payment method
- **THEN** the client SHALL call `POST /api/c/v1/orders/create` with `identifier`, `package_ids`, and the selected `payment_method`
- **AND** the client SHALL include `app_type` for WeChat payment as required
#### Scenario: Create a wallet recharge
- **WHEN** the user submits an allowed recharge method and an amount within backend limits
- **THEN** the client SHALL call `POST /api/c/v1/wallet/recharge` with the integer amount in cents, identifier, and selected payment method
- **AND** the client SHALL include `app_type` only for WeChat payment
#### Scenario: User-facing currency conversion
- **WHEN** an amount is returned by an API in cents
- **THEN** the client SHALL display the corresponding yuan value
- **AND** the client SHALL submit the original integer-cent representation to the API
### Requirement: Recharge submission SHALL honor the backend pre-check
The client SHALL call `GET /api/c/v1/wallet/recharge-check?identifier=...` before starting a recharge. When `need_force_recharge = true`, it SHALL use `force_recharge_amount`, `min_amount`, `max_amount`, and `message` from the response to guide or block the recharge flow.
#### Scenario: Force recharge is required
- **WHEN** recharge-check returns `need_force_recharge = true`
- **THEN** the client SHALL present the backend force-recharge amount and message
- **AND** the client SHALL not submit a normal recharge that violates the returned requirement
#### Scenario: Recharge is permitted normally
- **WHEN** recharge-check returns `need_force_recharge = false` and the amount is within the returned range
- **THEN** the client SHALL allow the user to select an allowed method and submit the recharge order
### Requirement: Payment results SHALL be confirmed by backend order state
After order creation, the client SHALL preserve existing handling for `pay_config` and `payment_link`, and SHALL use an order or recharge status query to confirm completion. A successful frontend redirect or payment-link return alone SHALL not be treated as proof of payment.
#### Scenario: Backend returns WeChat payment parameters
- **WHEN** a creation response contains `pay_config`
- **THEN** the client SHALL invoke the existing WeChat payment flow
- **AND** the client SHALL refresh backend payment status after the flow returns
#### Scenario: Backend returns a web payment link
- **WHEN** a creation response contains `payment_link`
- **THEN** the client SHALL use the existing payment-link presentation/handling
- **AND** the client SHALL confirm the resulting order or recharge state through the backend

View File

@@ -0,0 +1,23 @@
## ADDED Requirements
### Requirement: C-end login SHALL honor asset verification access decisions
The H5/C client SHALL call `POST /api/c/v1/auth/verify-asset` before continuing the asset login flow. A business failure or C-end login restriction returned by the endpoint SHALL be shown using the backend business message, and the client SHALL NOT continue to obtain, persist, or use an asset token for that login attempt.
#### Scenario: Asset verification allows login
- **WHEN** asset verification succeeds and returns an asset token
- **THEN** the client SHALL persist the identifier and returned asset token and continue the existing login flow
#### Scenario: Shop forbids a new C-end login
- **WHEN** asset verification returns a business failure indicating that the shop has forbidden C-end login
- **THEN** the client SHALL display the backend error message
- **AND** the client SHALL stop the current login flow before WeChat authorization or token persistence
- **AND** the client SHALL not revoke an already-issued token as a side effect
#### Scenario: Asset verification fails without a usable token
- **WHEN** the verification request returns an error response or no usable asset token
- **THEN** the client SHALL display the existing request/business error
- **AND** the client SHALL leave the current login attempt unauthenticated

View File

@@ -0,0 +1,66 @@
## ADDED Requirements
### Requirement: H5/C SHALL surface unread customer notifications
The H5/C client SHALL use `GET /api/c/v1/notifications/unread-count` for the homepage or notification-entry badge and `GET /api/c/v1/notifications` for the notification list. It SHALL consume the existing personal-notification contract and SHALL not add a separate API for expiry or exchange reminders.
#### Scenario: Unread notifications exist
- **WHEN** the unread-count endpoint returns a positive count
- **THEN** the homepage or notification entry SHALL display the unread indicator using that count
- **AND** the notification list entry SHALL remain available
#### Scenario: No unread notifications exist
- **WHEN** the unread-count endpoint returns zero
- **THEN** the client SHALL clear the unread indicator
- **AND** the notification entry SHALL not show a stale count
### Requirement: Expiry and exchange notices SHALL use the shared notification channel
The client SHALL display package-expiry and exchange-related notifications returned for the authenticated customer through the shared notification list or reminder popup. The backend notification data SHALL determine the expiry trigger and severity; the client SHALL not create independent timers that send business notifications.
#### Scenario: Package reaches a reminder threshold
- **WHEN** the notification service returns an unread package-expiry notice for the 15-day, 7-day, or 3-day threshold
- **THEN** the client SHALL display it through the existing H5/C notification entry or popup
- **AND** the client SHALL use the returned expiry level for presentation
#### Scenario: Critical expiry notice has highest priority
- **WHEN** unread expiry notices include a notice for 0 to 3 remaining days
- **THEN** the client SHALL give that notice the highest reminder priority
- **AND** the client SHALL not downgrade it based on a client-side date calculation
#### Scenario: Exchange notification is returned
- **WHEN** an exchange-related unread notice is returned after an exchange is created
- **THEN** the notification entry/list SHALL display the notice
- **AND** the client SHALL not call a separate marketing, ERP, or salesperson notification endpoint
### Requirement: Viewing a notification SHALL support marking it read
When the user views or activates a notification, the client SHALL call `PUT /api/c/v1/notifications/{id}/read` for that notification and reconcile the local unread count after a successful response. Repeated read actions SHALL remain safe according to the existing notification API contract.
#### Scenario: User reads an unread notice
- **WHEN** the user opens or advances to an unread expiry or exchange notification
- **THEN** the client SHALL mark that notification read through the existing endpoint
- **AND** the badge/list state SHALL reflect the read result
#### Scenario: Notification read request fails
- **WHEN** marking a notification read fails
- **THEN** the client SHALL retain the unread state or refresh it from the backend
- **AND** the failure SHALL not prevent the user from viewing other asset or notification content
### Requirement: Multi-notification popup SHALL communicate horizontal navigation
When the homepage notification popup contains more than one notification, the client SHALL make the horizontal swipe interaction visible to the user and SHALL retain the current-position indicator.
#### Scenario: User opens multiple unread notifications
- **WHEN** the homepage popup contains two or more notifications
- **THEN** the popup SHALL display an explicit `左右滑动切换通知` hint
- **AND** the user SHALL be able to move between notifications by swiping horizontally
- **AND** the popup SHALL display the current notification position

View File

@@ -0,0 +1,59 @@
## ADDED Requirements
### Requirement: Discontinued packages SHALL remain renewable only for eligible existing customers
The H5/C client SHALL keep discontinued packages out of the ordinary package catalog shown to new customers and agents. An eligible existing customer SHALL be able to use a valid `current_package_id` from asset info or `package_ids` from a historical order to continue a package renewal.
#### Scenario: New customer opens the package catalog
- **WHEN** the package catalog contains a discontinued package that is not the customer's current package
- **THEN** the client SHALL not display that package as an ordinary purchase option
#### Scenario: Existing customer is using a discontinued current package
- **WHEN** asset info returns a discontinued package through `current_package_id`
- **THEN** the client SHALL expose that ID only in the eligible renewal context
- **AND** the client SHALL allow the customer to continue through the existing standard order/payment flow without navigating to the package catalog
#### Scenario: Existing customer renews from a historical order
- **WHEN** a historical order returns one or more valid `package_ids`
- **THEN** the client SHALL use those IDs for the renewal selection when the order-list renewal entry is used
- **AND** the client SHALL preserve the historical order data unchanged
### Requirement: Renewal SHALL reuse the standard order creation contract
The client SHALL create a renewal by calling `POST /api/c/v1/orders/create` with the selected package ID or IDs, the asset `identifier`, and a currently allowed `payment_method`. It SHALL not invent or call a dedicated discontinued-package renewal endpoint.
#### Scenario: Submit a discontinued-package renewal
- **WHEN** an eligible customer confirms a renewal with an allowed payment method
- **THEN** the client SHALL submit the selected package IDs, identifier, and payment method to the standard order endpoint
- **AND** the client SHALL follow the standard payment response handling
#### Scenario: No eligible package ID is available
- **WHEN** neither asset info nor the relevant historical order supplies a valid package ID
- **THEN** the client SHALL show that renewal is unavailable
- **AND** the client SHALL not guess an ID from the ordinary package catalog
### Requirement: Renewal buttons SHALL be limited to the homepage and order list
The client SHALL show an `立即续费` button in the homepage asset summary and in every order card in the order list. The client SHALL NOT show a renewal button in the order detail page, package catalog, package-order page, or other pages.
#### Scenario: Customer renews from the homepage
- **WHEN** the homepage asset summary is displayed
- **THEN** the client SHALL show an `立即续费` button
- **AND** tapping it SHALL directly start the standard order/payment flow for the asset's current package ID when one is available
#### Scenario: Customer renews from an order card
- **WHEN** an order is displayed in the order list
- **THEN** the client SHALL show an `立即续费` button for that order
- **AND** tapping it SHALL directly start the standard order/payment flow for that order's package IDs without navigating to the package-order page
#### Scenario: Customer views another page
- **WHEN** the customer views any page other than the homepage or order list
- **THEN** the client SHALL NOT show an `立即续费` button

View File

@@ -0,0 +1,47 @@
## ADDED Requirements
### Requirement: Order views SHALL display backend role and asset snapshots
The H5/C client SHALL use `GET /api/c/v1/orders` and `GET /api/c/v1/orders/{id}` as the source of truth for order display. Order list and detail views SHALL display the backend `purchase_role` and `asset_identifier` values when present.
#### Scenario: Order includes a purchase role
- **WHEN** an order response returns `purchase_role`
- **THEN** the order list and detail view SHALL render that role
- **AND** the client SHALL not infer the role from the current user or asset type
#### Scenario: Card order includes an asset identifier
- **WHEN** a card order returns an `asset_identifier` snapshot
- **THEN** the client SHALL display the returned card identifier, such as ICCID, without replacing it with a current asset lookup
### Requirement: Device order identifiers SHALL prefer virtual number over IMEI
For device orders, the client SHALL display `virtual_no`/`VirtualNo` when it is non-empty, and SHALL use `imei` only when the virtual number is empty. The client SHALL not use `sn` as a substitute for the order asset identifier.
#### Scenario: Device has a virtual number
- **WHEN** a device order response contains a non-empty virtual number and an IMEI
- **THEN** the client SHALL display the virtual number
- **AND** the client SHALL not display SN as the order device identifier
#### Scenario: Device virtual number is empty
- **WHEN** a device order response has an empty virtual number and a non-empty IMEI
- **THEN** the client SHALL display the IMEI
#### Scenario: Historical identifier data is empty
- **WHEN** both the virtual number and IMEI are absent or empty
- **THEN** the client SHALL show the existing empty placeholder
- **AND** the client SHALL not fabricate an identifier from SN or a new asset-info request
### Requirement: Order amounts SHALL use the common currency display rule
Order list and detail views SHALL display `total_amount` and package prices converted from integer cents to yuan while preserving the integer-cent values in API requests and response state.
#### Scenario: Display an order amount
- **WHEN** an order response returns an amount in cents
- **THEN** the client SHALL render the corresponding yuan value
- **AND** the client SHALL not expose the raw cent value as the user-facing amount

View File

@@ -0,0 +1,51 @@
## 1. API adapters and shared rules
- [x] 1.1 Update asset/auth adapters and login handling for `verify-asset` business failures before asset-token persistence
- [x] 1.2 Normalize asset response fields for real-name policy/status, allowed payment methods, expiry estimate, and device/card identifiers
- [x] 1.3 Update order and wallet adapters so every create request includes the selected `payment_method`, and only WeChat requests include `app_type`
- [x] 1.4 Preserve cent-based request payloads and provide one shared yuan display formatter for amounts
- [x] 1.5 Confirm notification adapter parameters and response handling against the pending `add-personal-notifications` change
## 2. Login and asset state
- [x] 2.1 Show the backend business error and stop the current login flow when C-end login is forbidden
- [x] 2.2 Drive real-name prompts, status labels, and order gates from `effective_realname_policy`, `realname_required`, and `real_name_status`
- [x] 2.3 Remove local card/device real-name policy inference while preserving the existing real-name link flow
- [x] 2.4 Replace current-package-only expiry display with `estimated_final_expires_at` and apply backend expiry status/highlight fields
- [x] 2.5 Gate homepage and operator-switch real-name entries for `after_order` using device card real-name states and pending/active package history
## 3. Package purchase and renewal
- [x] 3.1 Render payment options from `allowed_payment_methods` on package purchase and prevent unavailable methods from being selected
- [x] 3.2 Keep discontinued packages out of the ordinary package catalog for new customers and agents
- [x] 3.3 Add the eligible existing-customer renewal path using `current_package_id` or historical `package_ids`
- [x] 3.4 Reuse `POST /api/c/v1/orders/create` for renewal and preserve selected identifier, package IDs, payment method, and existing payment result handling
- [x] 3.5 Show `立即续费` only on the homepage asset summary and every order-list card, with direct order/payment handling
## 4. Wallet recharge and payment completion
- [x] 4.1 Call `/api/c/v1/wallet/recharge-check` before recharge and enforce backend force-recharge/min/max guidance in the UI
- [x] 4.2 Render recharge payment methods from the recharge-check response and submit the selected method
- [x] 4.3 Preserve existing WeChat `pay_config`, Alipay/other `payment_link`, wallet payment, and submit-guard behaviors
- [x] 4.4 Refresh and confirm order/recharge status from the backend after payment return or link completion
## 5. Customer notifications
- [x] 5.1 Refresh unread count at the homepage or notification entry using `/api/c/v1/notifications/unread-count`
- [x] 5.2 Display expiry and exchange notifications from `/api/c/v1/notifications`, including backend severity/expiry level
- [x] 5.3 Mark an item read with `/api/c/v1/notifications/{id}/read` when the user views or activates it, then reconcile the unread badge
- [x] 5.4 Keep notification failures non-blocking for asset loading and do not add WeCom, marketing, or ERP calls
## 6. Order display
- [x] 6.1 Render `purchase_role` from order list/detail responses
- [x] 6.2 Render `asset_identifier` snapshots, using device `virtual_no` first and `imei` second, never SN as a substitute
- [x] 6.3 Preserve blank historical data as an empty-state placeholder and format order amounts from cents to yuan
## 7. Verification
- [ ] 7.1 Add or update tests for login denial, all real-name policies, backend payment-method variations, and WeChat `app_type`
- [ ] 7.2 Add or update tests for force recharge, discontinued-package renewal, expiry estimate states, notification priority/read flow, and order identifier fallback
- [x] 7.3 Run the H5 compiler build and repository consistency checks; manual API fixture verification remains an integration follow-up
> Note: This H5 repository has no test script or test suite. Tasks 7.1 and 7.2 remain unchecked and require adding a test harness or backend/API fixture environment before they can be completed.

View File

@@ -0,0 +1,46 @@
## Context
The project moved mandatory phone-binding enforcement to homepage entry, and then added a one-time homepage bypass after bind success to avoid an immediate redirect loop. A later draft proposed automatically re-running `POST /api/c/v1/auth/wechat-login` after bind success. The required direction is now simpler than both of those approaches: after mandatory bind success, route the user back to the login page, explain that they need to log in again, preserve the identifier they already entered, and let them manually restart login.
The login page already has behavior that can trigger login automatically from some restored inputs or URL parameters. The new flow therefore needs to preserve the identifier for convenience without accidentally auto-submitting login on the user's behalf.
## Goals / Non-Goals
- Goals:
- Return mandatory bind-success users to the login page
- Show a clear re-login prompt after bind success
- Preserve the previously entered identifier in the login input
- Require the user to manually tap login again
- Non-Goals:
- Do not add a new backend endpoint
- Do not auto-run `POST /api/c/v1/auth/wechat-login` after bind success
- Do not change the ordinary bind flow that starts from homepage actions
## Decisions
- Decision: Mandatory bind completion SHALL route to `pages/login/login` instead of continuing directly to `pages/index/index`.
- Decision: The system SHALL show a one-time prompt that binding succeeded and the user must log in again.
- Decision: The previously entered identifier SHALL be preserved through the bind-success redirect and restored into the login input.
- Decision: Restoring the identifier SHALL NOT auto-submit login or auto-trigger the OAuth flow; the user must explicitly tap login.
## Alternatives Considered
- Keep the one-time homepage bypass: rejected because the post-bind continuation no longer needs to jump directly into the homepage.
- Automatically re-run `POST /api/c/v1/auth/wechat-login`: rejected because the requested flow is to require an explicit user-driven re-login.
- Pass the identifier through a login-page path that auto-starts login: rejected because the user explicitly wants the identifier preserved without automatic login.
## Risks / Trade-offs
- The client must distinguish between restoring an identifier for display and restoring one for automatic login initiation.
- The re-login prompt must be one-time or clearly scoped so it does not keep reappearing on unrelated later visits to the login page.
## Migration Plan
1. Remove the automatic post-bind wechat-login continuation plan from the active draft.
2. Route mandatory bind success back to `pages/login/login`.
3. Preserve the identifier so the login input remains prefilled.
4. Show the re-login prompt and require a manual login tap.
## Open Questions
- Which client-side storage path is the best fit for preserving the identifier while avoiding accidental auto-login behavior on the login page?

View File

@@ -0,0 +1,30 @@
# Change: Return to login for manual re-login after mandatory phone bind
## Why
The current mandatory bind-success continuation either relies on a homepage bypass workaround or on an automatic follow-up login flow. Both approaches make the post-bind path more fragile than necessary. The desired behavior is simpler: after successful mandatory phone binding, return the user to the login page, tell them they need to log in again, preserve the identifier they already entered, and let the user manually tap login.
## What Changes
- Return the user to `pages/login/login` after successful phone binding when the bind page was entered from the mandatory login gate
- Show a one-time prompt on the login page that phone binding succeeded and re-login is required
- Preserve the identifier the user already entered so the login input stays prefilled after returning
- Require the user to manually tap login again instead of auto-starting the login flow
- Keep the existing non-mandatory bind completion behavior unchanged
- Remove dependence on an automatic post-bind wechat-login recheck for this flow
- Preserve the current login and bind-phone API contracts without adding backend endpoints
## Capabilities
### New Capabilities
- `post-bind-manual-relogin`: Define the mandatory post-bind return-to-login and identifier-preservation flow
### Modified Capabilities
- `index-phone-bind-gate`: Allow mandatory bind completion from the login gate to return to login instead of homepage
## Impact
- Affected code: `pages/bind/bind.vue`, `pages/login/login.vue`, `pages/index/index.vue`
- Affected flow: mandatory phone binding, post-bind routing, login input restoration, manual re-login
- No backend API changes
- No login or bind-phone response schema changes

View File

@@ -0,0 +1,15 @@
## MODIFIED Requirements
### Requirement: Bind completion SHALL remain compatible with homepage entry
The system SHALL keep ordinary bind-phone completion compatible with homepage entry while allowing mandatory bind-phone completion from the login gate to return to the login page for a manual re-login.
#### Scenario: User completes ordinary binding and returns to index
- **WHEN** the user completes phone binding successfully after entering the bind page from a later homepage action
- **THEN** the system SHALL return the user to `pages/index/index`
- **AND** entering `index` afterward SHALL no longer redirect if the account is now bound
#### Scenario: User completes mandatory binding and returns to login
- **WHEN** the user completes phone binding successfully after entering the bind page from the mandatory login gate
- **THEN** the system SHALL return the user to `pages/login/login`
- **AND** the system SHALL preserve the previously entered identifier for the login input
- **AND** the user SHALL manually trigger the next login attempt before the homepage-entry gate is evaluated again

View File

@@ -0,0 +1,37 @@
## ADDED Requirements
### Requirement: Mandatory bind completion SHALL return the user to login for manual re-login
The system SHALL return the user to `pages/login/login` after successful phone binding when the bind page was entered from the mandatory login gate, and SHALL require an explicit user-driven re-login before continuing.
#### Scenario: Mandatory bind succeeds and requires manual re-login
- **WHEN** the user enters `pages/bind/bind` from the mandatory bind-phone gate
- **AND** the user completes phone binding successfully
- **THEN** the system SHALL route the user to `pages/login/login` instead of routing directly to `pages/index/index`
- **AND** the system SHALL show a prompt that binding succeeded and re-login is required
- **AND** the system SHALL wait for the user to explicitly trigger login again
### Requirement: Login input SHALL preserve the prior identifier without auto-submitting
The system SHALL preserve the identifier that the user previously entered before the mandatory bind flow and SHALL restore it into the login input without automatically starting login.
#### Scenario: Login page restores identifier after mandatory bind success
- **WHEN** the user is returned to `pages/login/login` after successful mandatory phone binding
- **THEN** the login input SHALL remain populated with the identifier that was entered before the bind flow
- **AND** the system SHALL NOT auto-submit login or auto-trigger the OAuth flow only because the identifier was restored
- **AND** the user SHALL manually tap the login action to continue
### Requirement: Mandatory post-bind return SHALL avoid automatic recheck dependencies
The system SHALL avoid depending on an automatic post-bind wechat-login recheck for the mandatory bind-success continuation flow.
#### Scenario: Mandatory bind success does not auto-call wechat-login
- **WHEN** the user completes phone binding successfully from the mandatory login gate
- **THEN** the system SHALL NOT automatically call `POST /api/c/v1/auth/wechat-login` as the immediate continuation step
- **AND** the post-bind continuation SHALL depend on the user re-entering the login flow manually
### Requirement: Non-mandatory bind completion SHALL keep existing behavior
The system SHALL keep the existing non-mandatory bind completion behavior when the bind page was entered from a later homepage action rather than from the mandatory login gate.
#### Scenario: Ordinary bind completion remains unchanged
- **WHEN** the user enters `pages/bind/bind` from a later homepage action rather than the mandatory login gate
- **AND** the user completes phone binding successfully
- **THEN** the system SHALL keep the current non-mandatory bind completion behavior
- **AND** the system SHALL NOT force the user back to `pages/login/login` for that ordinary bind flow

View File

@@ -0,0 +1,25 @@
## 1. Post-Bind Manual Re-Login
- [x] 1.1 Route mandatory bind success to `pages/login/login` instead of continuing directly to `pages/index/index`
- [x] 1.2 Show a one-time prompt that the user needs to log in again after successful binding
- [x] 1.3 Preserve the previously entered identifier so the login input stays prefilled after returning
- [x] 1.4 Ensure the restored identifier does not auto-trigger login and the user must manually tap login
## 2. Flow Compatibility
- [x] 2.1 Keep the existing non-mandatory bind completion behavior unchanged
- [x] 2.2 Remove dependence on automatic post-bind wechat-login continuation
- [x] 2.3 Keep the normal homepage bind gate behavior for later homepage entries
- [x] 2.4 Remove dependence on a one-time homepage bypass for mandatory bind success
## 3. API Contract Preservation
- [x] 3.1 Keep using the existing login and bind-phone API contracts
- [x] 3.2 Avoid adding a backend endpoint or changing current response schemas
## 4. Regression Verification
- [x] 4.1 Verify mandatory bind success returns to the login page with the identifier still visible
- [x] 4.2 Verify the login page shows the re-login prompt after bind success
- [x] 4.3 Verify login does not auto-start until the user clicks login
- [x] 4.4 Verify ordinary bind entry from homepage actions still follows the current completion path

View File

@@ -0,0 +1,24 @@
## Why
The homepage wallet entry currently displays the raw wallet balance value returned by the backend, which is cent-based. This causes incorrect user-facing values such as showing `100` instead of `1`. In addition, the wallet recharge order list always renders the auto purchase row, which can show misleading fallback text when the backend does not provide auto purchase data.
## What Changes
- Convert the homepage wallet entry balance from cents to yuan before rendering the value inside `钱包(...)`
- Keep the homepage wallet entry aligned with user-facing currency expectations instead of exposing the raw cent amount
- Render the recharge order `自动购包` field only when the recharge order includes auto purchase status data
- Preserve the current auto purchase status text mapping when the field exists, including existing compatibility values
## Capabilities
### New Capabilities
- `wallet-display-rules`: Define wallet-related UI display rules for homepage balance presentation and recharge order field visibility
### Modified Capabilities
## Impact
- Affected code: `components/FunctionCard.vue`, `pages/index/index.vue`, `pages/my-wallet/my-wallet.vue`
- Affected UI flows: homepage function menu wallet entry, wallet recharge order list
- No backend API changes
- No payment flow changes

View File

@@ -0,0 +1,42 @@
## ADDED Requirements
### Requirement: Homepage wallet entry SHALL display wallet balance in yuan
The system SHALL convert the backend wallet balance value from cents to yuan before rendering the balance inside the homepage wallet entry label.
#### Scenario: Cent-based balance is converted for homepage display
- **WHEN** the homepage wallet entry receives a wallet balance value of `100`
- **THEN** the system SHALL display the wallet entry label as `钱包 (1)` instead of showing the raw cent value
#### Scenario: Non-round cent amount is converted for homepage display
- **WHEN** the homepage wallet entry receives a cent-based wallet balance that is not a whole yuan amount
- **THEN** the system SHALL display the converted yuan value
- **AND** the system SHALL NOT display the raw cent integer
#### Scenario: Zero balance is displayed consistently
- **WHEN** the homepage wallet entry receives a wallet balance value of `0`
- **THEN** the system SHALL display `钱包 (0)`
### Requirement: Recharge order auto purchase row SHALL render only when data exists
The system SHALL render the `自动购包` row in the wallet recharge order list only when the recharge order includes auto purchase status data.
#### Scenario: Auto purchase data exists on a recharge order
- **WHEN** a recharge order includes `auto_purchase_status`
- **THEN** the system SHALL render the `自动购包` row
- **AND** the system SHALL display the status text mapped from that value
#### Scenario: Compatible disabled value still counts as existing data
- **WHEN** a recharge order includes `auto_purchase_status` with a value of `0` or `'0'`
- **THEN** the system SHALL render the `自动购包` row
- **AND** the system SHALL display the compatible disabled status text
#### Scenario: Auto purchase data is absent on a recharge order
- **WHEN** a recharge order does not include `auto_purchase_status`
- **THEN** the system SHALL NOT render the `自动购包` row
### Requirement: Wallet display rules SHALL NOT change API contracts or payment behavior
The system SHALL preserve the existing backend data contract, recharge order retrieval flow, payment actions, and wallet detail page amount handling while applying these display rules.
#### Scenario: Display-only adjustment does not alter business flow
- **WHEN** the homepage wallet balance or recharge order list is rendered with the new display rules
- **THEN** the system SHALL only change user-facing presentation
- **AND** the system SHALL NOT change payment processing or backend request behavior

View File

@@ -0,0 +1,18 @@
## 1. Homepage Wallet Balance Display
- [x] 1.1 Add a display rule for the homepage wallet entry that converts the backend cent amount to yuan before rendering
- [x] 1.2 Ensure converted values do not expose the raw cent amount in the `钱包(...)` label
- [x] 1.3 Preserve correct display for zero and non-integer yuan values
## 2. Recharge Order Auto Purchase Field Visibility
- [x] 2.1 Render the recharge order `自动购包` row only when the recharge order includes auto purchase status data
- [x] 2.2 Preserve the existing status text mapping when auto purchase status data exists, including compatible `0` and `1` values
- [x] 2.3 Hide the row entirely when auto purchase status data is absent
## 3. Regression Verification
- [x] 3.1 Verify a homepage wallet balance of `100` is displayed as `1` in the wallet entry
- [x] 3.2 Verify a non-round cent amount is displayed as its yuan value rather than the raw cent integer
- [x] 3.3 Verify recharge orders with `auto_purchase_status` render the `自动购包` row
- [x] 3.4 Verify recharge orders without `auto_purchase_status` do not render the `自动购包` row

31
openspec/project.md Normal file
View File

@@ -0,0 +1,31 @@
# Project Context
## Purpose
[Describe your project's purpose and goals]
## Tech Stack
- [List your primary technologies]
- [e.g., TypeScript, React, Node.js]
## Project Conventions
### Code Style
[Describe your code style preferences, formatting rules, and naming conventions]
### Architecture Patterns
[Document your architectural decisions and patterns]
### Testing Strategy
[Explain your testing approach and requirements]
### Git Workflow
[Describe your branching strategy and commit conventions]
## Domain Context
[Add domain-specific knowledge that AI assistants need to understand]
## Important Constraints
[List any technical, business, or regulatory constraints]
## External Dependencies
[Document key external services, APIs, or systems]

152
package-lock.json generated
View File

@@ -10,6 +10,8 @@
"@dcloudio/uni-h5": "3.0.0-4080720251210001",
"clipboard": "^2.0.11",
"dayjs": "^1.11.19",
"element-china-area-data": "^6.1.0",
"jweixin-module": "^1.6.0",
"uview-plus": "^3.6.29",
"vue": "^3.4.0"
},
@@ -18,6 +20,7 @@
"@dcloudio/uni-cli-shared": "3.0.0-4080720251210001",
"@dcloudio/uni-stacktracey": "3.0.0-4080720251210001",
"@dcloudio/vite-plugin-uni": "3.0.0-4080720251210001",
"cross-env": "^10.1.0",
"less": "^4.0.0",
"sass": "^1.63.2",
"vite": "5.2.8"
@@ -63,6 +66,7 @@
"resolved": "https://registry.npmmirror.com/@babel/core/-/core-7.25.2.tgz",
"integrity": "sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.24.7",
@@ -1914,7 +1918,8 @@
"version": "3.4.19",
"resolved": "https://registry.npmmirror.com/@dcloudio/types/-/types-3.4.19.tgz",
"integrity": "sha512-1foayOFEAQ+jnQLt3ACsovCNjer3/fXn1I2VBpmDOzs2nk/n4UHwRLAxZV/RpxRqaGOPEvKrO/Pq+VI6sAmuRw==",
"license": "Apache-2.0"
"license": "Apache-2.0",
"peer": true
},
"node_modules/@dcloudio/uni-app": {
"version": "3.0.0-4080720251210001",
@@ -2332,6 +2337,13 @@
"@jridgewell/sourcemap-codec": "^1.5.5"
}
},
"node_modules/@epic-web/invariant": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/@epic-web/invariant/-/invariant-1.0.0.tgz",
"integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==",
"dev": true,
"license": "MIT"
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.20.2",
"resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz",
@@ -3258,18 +3270,6 @@
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
"license": "MIT"
},
"node_modules/@types/node": {
"version": "25.0.3",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-25.0.3.tgz",
"integrity": "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
},
"node_modules/@vitejs/plugin-legacy": {
"version": "5.3.2",
"resolved": "https://registry.npmmirror.com/@vitejs/plugin-legacy/-/plugin-legacy-5.3.2.tgz",
@@ -3913,6 +3913,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759",
@@ -4059,6 +4060,12 @@
"node": ">=4"
}
},
"node_modules/china-division": {
"version": "2.7.0",
"resolved": "https://registry.npmmirror.com/china-division/-/china-division-2.7.0.tgz",
"integrity": "sha512-4uUPAT+1WfqDh5jytq7omdCmHNk3j+k76zEG/2IqaGcYB90c2SwcixttcypdsZ3T/9tN1TTpBDoeZn+Yw/qBEA==",
"license": "MIT"
},
"node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.6.0.tgz",
@@ -4216,6 +4223,39 @@
"url": "https://opencollective.com/core-js"
}
},
"node_modules/cross-env": {
"version": "10.1.0",
"resolved": "https://registry.npmmirror.com/cross-env/-/cross-env-10.1.0.tgz",
"integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@epic-web/invariant": "^1.0.0",
"cross-spawn": "^7.0.6"
},
"bin": {
"cross-env": "dist/bin/cross-env.js",
"cross-env-shell": "dist/bin/cross-env-shell.js"
},
"engines": {
"node": ">=20"
}
},
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
"license": "MIT",
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/css-font-size-keywords": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/css-font-size-keywords/-/css-font-size-keywords-1.0.0.tgz",
@@ -4354,6 +4394,15 @@
"integrity": "sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==",
"license": "ISC"
},
"node_modules/element-china-area-data": {
"version": "6.1.0",
"resolved": "https://registry.npmmirror.com/element-china-area-data/-/element-china-area-data-6.1.0.tgz",
"integrity": "sha512-IkpcjwQv2A/2AxFiSoaISZ+oMw1rZCPUSOg5sOCwT5jKc96TaawmKZeY81xfxXsO0QbKxU5LLc6AirhG52hUmg==",
"license": "MIT",
"dependencies": {
"china-division": "^2.7.0"
}
},
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-2.0.0.tgz",
@@ -5048,6 +5097,13 @@
"url": "https://github.com/sponsors/gjtorikian/"
}
},
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true,
"license": "ISC"
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -5096,6 +5152,12 @@
"graceful-fs": "^4.1.6"
}
},
"node_modules/jweixin-module": {
"version": "1.6.0",
"resolved": "https://registry.npmmirror.com/jweixin-module/-/jweixin-module-1.6.0.tgz",
"integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w==",
"license": "ISC"
},
"node_modules/lcid": {
"version": "3.1.1",
"resolved": "https://registry.npmmirror.com/lcid/-/lcid-3.1.1.tgz",
@@ -5565,6 +5627,16 @@
"node": ">= 0.8"
}
},
"node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/path-parse": {
"version": "1.0.7",
"resolved": "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz",
@@ -5625,9 +5697,9 @@
}
},
"node_modules/postcss": {
"version": "8.5.9",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.9.tgz",
"integrity": "sha512-7a70Nsot+EMX9fFU3064K/kdHWZqGVY+BADLyXc8Dfv+mTLLVl6JzJpPaCZ2kQL9gIJvKXSLMHhqdRRjwQeFtw==",
"version": "8.5.10",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.10.tgz",
"integrity": "sha512-pMMHxBOZKFU6HgAZ4eyGnwXF/EvPGGqUr0MnZ5+99485wwW41kW91A4LOGxSHhgugZmSChL5AlElNdwlNgcnLQ==",
"funding": [
{
"type": "opencollective",
@@ -5643,6 +5715,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
@@ -6049,6 +6122,7 @@
"integrity": "sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==",
"devOptional": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/estree": "1.0.8"
},
@@ -6151,6 +6225,7 @@
"integrity": "sha512-u56TU0AIFqMtauKl/OJ1AeFsXqRHkgO7nCWmHaDwfxDo9GUMSqBA4NEh6GMuh1CYVM7zuROYtZrHzPc2ixK+ww==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",
"immutable": "^4.0.0",
@@ -6339,6 +6414,29 @@
"dev": true,
"license": "ISC"
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
"license": "MIT",
"dependencies": {
"shebang-regex": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/side-channel": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.0.tgz",
@@ -6516,6 +6614,7 @@
"integrity": "sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw==",
"dev": true,
"license": "BSD-2-Clause",
"peer": true,
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
"acorn": "^8.15.0",
@@ -6592,8 +6691,7 @@
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true
"optional": true
},
"node_modules/unicode-canonical-property-names-ecmascript": {
"version": "2.0.1",
@@ -6863,6 +6961,7 @@
"integrity": "sha512-OyZR+c1CE8yeHw5V5t59aXsUPPVTHMDjEZz8MgguLL/Q7NblxhZUlTu9xSPqlsUO/y+X7dlU05jdhvyycD55DA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.20.1",
"postcss": "^8.4.38",
@@ -6918,6 +7017,7 @@
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.4.21.tgz",
"integrity": "sha512-5hjyV/jLEIKD/jYl4cavMcnzKwjMKohureP8ejn3hhEjwhWIhWeuzL2kJAjzl/WyVsgPY56Sy4Z40C3lVshxXA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/compiler-dom": "3.4.21",
"@vue/compiler-sfc": "3.4.21",
@@ -6955,6 +7055,22 @@
"integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==",
"license": "MIT"
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/xmlhttprequest": {
"version": "1.8.0",
"resolved": "https://registry.npmmirror.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz",

View File

@@ -1,13 +1,15 @@
{
"scripts": {
"dev:h5": "uni",
"build:h5": "UNI_INPUT_DIR=. uni build -p h5"
"build:h5": "cross-env UNI_INPUT_DIR=. uni build -p h5 --mode development",
"build:h5:production": "cross-env UNI_INPUT_DIR=. uni build -p h5 --mode production"
},
"devDependencies": {
"@dcloudio/types": "3.4.19",
"@dcloudio/uni-cli-shared": "3.0.0-4080720251210001",
"@dcloudio/uni-stacktracey": "3.0.0-4080720251210001",
"@dcloudio/vite-plugin-uni": "3.0.0-4080720251210001",
"cross-env": "^10.1.0",
"less": "^4.0.0",
"sass": "^1.63.2",
"vite": "5.2.8"
@@ -16,9 +18,11 @@
"@dcloudio/uni-app": "3.0.0-4080720251210001",
"@dcloudio/uni-components": "3.0.0-4080720251210001",
"@dcloudio/uni-h5": "3.0.0-4080720251210001",
"vue": "^3.4.0",
"clipboard": "^2.0.11",
"dayjs": "^1.11.19",
"uview-plus": "^3.6.29"
"element-china-area-data": "^6.1.0",
"jweixin-module": "^1.6.0",
"uview-plus": "^3.6.29",
"vue": "^3.4.0"
}
}

View File

@@ -44,6 +44,12 @@
"navigationBarTitleText": "我的订单"
}
},
{
"path": "pages/notifications/notifications",
"style": {
"navigationBarTitleText": "站内通知"
}
},
{
"path": "pages/bind/bind",
"style": {
@@ -60,7 +66,7 @@
{
"path": "pages/device-exchange/device-exchange",
"style": {
"navigationBarTitleText": "设备换货"
"navigationBarTitleText": "换货"
}
},
{
@@ -75,6 +81,12 @@
"navigationBarTitleText": "我的钱包"
}
},
{
"path": "pages/alipay-payment/alipay-payment",
"style": {
"navigationBarTitleText": "支付宝支付"
}
},
{
"path": "pages/error/error",
"style": {
@@ -84,9 +96,9 @@
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "信息查询",
"navigationBarBackgroundColor": "#F8F8F8",
"navigationBarTitleText": "设备卡信息查询",
"navigationBarBackgroundColor": "#FFFFFF",
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {}
}
}

View File

@@ -0,0 +1,173 @@
<template>
<view class="container alipay-page">
<view class="pay-content">
<view class="method-card">
<view class="method-header">
<view class="method-index">方式一</view>
<view class="method-title">浏览器链接支付宝支付</view>
</view>
<view class="browser-tip">点击右上角三个点使用浏览器打开</view>
<image class="tips-image" src="/static/tips.png" mode="widthFix"></image>
</view>
<view class="method-card">
<view class="method-header">
<view class="method-index">方式二</view>
<view class="method-title">支付宝扫码支付</view>
</view>
<view class="qr-wrap">
<u-qrcode v-if="qrUrl" :val="qrUrl" :size="220" unit="px" :show-loading="false"></u-qrcode>
</view>
<view class="qr-desc">截图保存二维码打开支付宝扫一扫即可支付</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { getPendingAlipayPaymentData } from '@/utils/payment.js';
const browserUrl = ref('');
const qrUrl = ref('');
const hasRedirected = ref(false);
const isInWechat = () => /micromessenger/i.test(navigator.userAgent);
const decodePaymentUrl = (value) => {
if (!value) {
return '';
}
try {
const normalized = value.replace(/-/g, '+').replace(/_/g, '/');
const padding = '='.repeat((4 - normalized.length % 4) % 4);
return decodeURIComponent(escape(atob(normalized + padding)));
} catch (e) {
return '';
}
};
const getQueryParam = (key) => {
// #ifdef H5
const params = new URLSearchParams(window.location.search);
return params.get(key) || '';
// #endif
// #ifndef H5
return '';
// #endif
};
const getPayUrlFromQuery = () => {
return decodePaymentUrl(getQueryParam('pay64'));
};
const getQrUrlFromQuery = () => {
return decodePaymentUrl(getQueryParam('qr64'));
};
const redirectToAlipayInBrowser = () => {
// #ifdef H5
if (hasRedirected.value || isInWechat() || !browserUrl.value) {
return;
}
hasRedirected.value = true;
window.location.href = browserUrl.value;
// #endif
};
const loadPaymentData = () => {
const data = getPendingAlipayPaymentData();
browserUrl.value = getPayUrlFromQuery() || data?.copyUrl || data?.qrUrl || '';
qrUrl.value = getQrUrlFromQuery() || data?.qrUrl || data?.copyUrl || browserUrl.value;
redirectToAlipayInBrowser();
};
onShow(() => {
loadPaymentData();
});
</script>
<style lang="scss" scoped>
.alipay-page {
min-height: 100vh;
box-sizing: border-box;
padding: 28rpx 24rpx 48rpx;
background: linear-gradient(180deg, #eaf6ec 0%, var(--bg-secondary) 42%);
}
.pay-content {
display: flex;
flex-direction: column;
gap: 24rpx;
}
.method-card {
background: var(--bg-primary);
border-radius: 28rpx;
padding: 32rpx;
box-shadow: 0 16rpx 40rpx rgba(85, 171, 92, 0.08);
border: 1rpx solid rgba(85, 171, 92, 0.08);
}
.qr-desc {
margin-top: 14rpx;
font-size: 26rpx;
line-height: 1.55;
color: var(--text-tertiary);
}
.method-header {
display: flex;
align-items: center;
gap: 16rpx;
margin-bottom: 28rpx;
}
.method-index {
padding: 8rpx 14rpx;
border-radius: 12rpx;
background: var(--primary);
color: var(--text-inverse);
font-size: 22rpx;
font-weight: 700;
}
.method-title {
font-size: 30rpx;
font-weight: 700;
color: var(--text-primary);
}
.browser-tip {
padding: 22rpx 24rpx;
border-radius: 18rpx;
background: rgba(85, 171, 92, 0.08);
color: var(--primary);
font-size: 28rpx;
font-weight: 600;
line-height: 1.45;
text-align: center;
}
.tips-image {
display: block;
width: 100%;
margin-top: 28rpx;
border-radius: 18rpx;
background: var(--gray-100);
}
.qr-wrap {
display: flex;
align-items: center;
justify-content: center;
padding: 28rpx;
border-radius: 24rpx;
background: #fff;
border: 1rpx dashed rgba(85, 171, 92, 0.24);
}
</style>

View File

@@ -1,8 +1,11 @@
<template>
<view class="container">
<!-- 空状态提示 -->
<view v-if="packageList.length === 0 && !loading" class="empty-state">
<view class="empty-icon">📦</view>
<view v-if="!historyLoaded || (loading && packageList.length === 0)" class="loading-state">
<up-loading-icon text="加载中" size="30"></up-loading-icon>
</view>
<view v-else-if="packageList.length === 0" class="empty-state">
<image class="empty-icon" src="/static/asset-package-history.png" mode="aspectFit" alt="资产套餐历史"></image>
<view class="empty-title">暂无套餐记录</view>
<view class="empty-desc">当前账号下暂无套餐历史信息</view>
</view>
@@ -15,30 +18,14 @@
</view>
<view class="package-info">
<view class="info-row flex-row-sb">
<view class="info-label">套餐类型</view>
<view class="info-value">{{ item.package_type === 'formal' ? '普通套餐' : '加油包' }}</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">使用类型</view>
<view class="info-value">{{ item.usage_type === 'single_card' ? '单卡' : '设备' }}</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">激活时间</view>
<view class="info-value">{{ item.activated_at || '-' }}</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">创建时间</view>
<view class="info-value">{{ item.created_at }}</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">到期时间</view>
<view class="info-value">{{ item.expires_at || '-' }}</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">优先级</view>
<view class="info-value">{{ item.priority }}</view>
</view>
</view>
<view class="divider"></view>
@@ -85,6 +72,7 @@
let packageList = reactive([]);
let loading = ref(false);
let historyLoaded = ref(false);
let noMore = ref(false);
let page = ref(1);
const pageSize = 10;
@@ -111,50 +99,29 @@
// 获取已使用流量
const getUsedFlow = (item) => {
if (item.enable_virtual_data) {
// 启用虚流量,显示已用虚流量
return formatMB(item.virtual_used_mb || 0);
} else {
// 未启用虚流量,显示已用真流量
return formatMB(item.data_usage_mb || 0);
return formatMB(item.real_used_mb || 0);
}
};
// 获取总流量
const getTotalFlow = (item) => {
if (item.enable_virtual_data) {
// 启用虚流量,显示虚流量总量
return formatMB(item.virtual_limit_mb || 0);
} else {
// 未启用虚流量,显示真流量总量
return formatMB(item.data_limit_mb || 0);
}
return formatMB(item.real_total_mb || 0);
};
// 获取剩余流量
const getRemainFlow = (item) => {
if (item.enable_virtual_data) {
// 启用虚流量,显示剩余虚流量
return formatMB(item.virtual_remain_mb || 0);
} else {
// 未启用虚流量,计算剩余真流量
const remain = (item.data_limit_mb || 0) - (item.data_usage_mb || 0);
return formatMB(remain);
}
const total = item.real_total_mb || 0;
const used = item.enable_virtual_data ? (item.virtual_used_mb || 0) : (item.real_used_mb || 0);
const remain = Math.max(total - used, 0);
return formatMB(remain);
};
// 获取使用百分比
const getUsagePercent = (item) => {
let used, total;
if (item.enable_virtual_data) {
// 启用虚流量
used = item.virtual_used_mb || 0;
total = item.virtual_limit_mb || 0;
} else {
// 未启用虚流量
used = item.data_usage_mb || 0;
total = item.data_limit_mb || 0;
}
const used = item.real_used_mb || 0;
const total = item.real_total_mb || 0;
if (!total) return 0;
return Math.min((used / total) * 100, 100).toFixed(2);
@@ -198,6 +165,7 @@
console.error('加载套餐历史失败', e);
}
loading.value = false;
historyLoaded.value = true;
};
const loadMore = () => {
@@ -213,6 +181,13 @@
<style lang="scss" scoped>
.container {
.loading-state {
display: flex;
align-items: center;
justify-content: center;
min-height: 500rpx;
}
.empty-state {
display: flex;
flex-direction: column;
@@ -220,7 +195,7 @@
justify-content: center;
padding: 120rpx 40rpx;
min-height: 400rpx;
.empty-icon { font-size: 120rpx; margin-bottom: 30rpx; opacity: 0.6; }
.empty-icon { width: 120rpx; height: 120rpx; margin-bottom: 30rpx; opacity: 0.6; }
.empty-title { font-size: 32rpx; font-weight: 600; color: var(--text-primary); margin-bottom: 16rpx; }
.empty-desc { font-size: 26rpx; color: var(--text-tertiary); text-align: center; }
}

View File

@@ -1,26 +1,35 @@
<template>
<view class="container">
<view v-if="list.length === 0 && !loading" class="empty-state">
<view class="empty-icon">📇</view>
<view v-if="!cardsLoaded || (loading && list.length === 0)" class="loading-state">
<up-loading-icon text="加载中" size="30"></up-loading-icon>
</view>
<view v-else-if="list.length === 0" class="empty-state">
<image class="empty-icon" src="/static/authentication.png" mode="aspectFit" alt="实名认证"></image>
<view class="empty-title">认证列表为空</view>
<view class="empty-desc">当前账号下暂无可实名的卡片</view>
</view>
<view class="card" v-for="item in list" :key="item.iccid">
<view class="flex-row-g20">
<view class="logo">
<image :src="getLogo(item.category).logo" mode="aspectFit"></image>
<view class="card carrier-card" v-for="item in list" :key="item.iccid">
<view class="carrier-main">
<view class="logo-stack">
<image class="carrier-logo" :src="getCarrier(item.carrier_type).logo" mode="aspectFit"></image>
</view>
<view class="flex-col-g20">
<view class="iccid">ICCID: {{ item.iccid }}</view>
<view class="operator">运营商: {{ getLogo(item.category).name }}</view>
<view class="carrier-details">
<view class="carrier-heading">
<view class="carrier-name">{{ getCarrier(item.carrier_type).name }}</view>
<image v-if="item.isDevice" class="slot-badge" :src="getSlotIcon(item.slot_position)" mode="aspectFit"></image>
</view>
<view class="carrier-iccid">
<text class="iccid-value-text">{{ item.iccid }}</text>
<image class="copy-icon" src="/static/复制.png" mode="aspectFit"
@tap.stop="copyIccid(item.iccid)" aria-label="复制ICCID"></image>
</view>
<view class="card-actions">
<button v-if="item.isRealName" class="btn-apple btn-primary action-button" disabled>已实名</button>
<button v-else class="btn-apple btn-primary action-button" @tap="toReal(item)">去实名</button>
</view>
</view>
</view>
<view class="btn mt-30 flex-col-g20">
<up-button class="btn-apple btn-primary" v-if="item.isRealName" type="primary">已实名</up-button>
<up-button class="btn-apple btn-success" v-else type="success" @tap="toReal(item)">去实名</up-button>
</view>
</view>
<view class="modal-overlay" v-if="showIccidModal" @tap="closeModal">
@@ -38,26 +47,58 @@
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { assetApi, deviceApi, realnameApi } from '@/api/index.js';
import { assetApi, realnameApi } from '@/api/index.js';
import { useUserStore } from '@/store/index.js';
import slot1Icon from '@/static/卡槽1.jpeg';
import slot2Icon from '@/static/卡槽2.jpeg';
import slot3Icon from '@/static/卡槽3.jpeg';
import cmccLogo from '@/static/中国移动.png';
import cuccLogo from '@/static/中国联通.png';
import ctccLogo from '@/static/中国电信.png';
import cbnLogo from '@/static/中国广电.png';
const userStore = useUserStore();
let list = reactive([]);
let loading = ref(false);
let cardsLoaded = ref(false);
let showIccidModal = ref(false);
let currentModalIccid = ref('');
let currentCard = ref(null);
let opratorList = reactive([
{ category: '124', logo: 'https://img2.baidu.com/it/u=139558247,3893370039&fm=253&fmt=auto?w=529&h=500', name: '中国电信' },
{ category: '125', logo: 'https://img1.baidu.com/it/u=2816777816,1756344384&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', name: '中国联通' },
{ category: '126', logo: 'https://img2.baidu.com/it/u=915783975,1594870591&fm=253&fmt=auto&app=120&f=PNG?w=182&h=182', name: '中国移动' }
]);
const carrierMap = {
CMCC: { name: '中国移动', logo: cmccLogo },
CUCC: { name: '中国联通', logo: cuccLogo },
CTCC: { name: '中国电信', logo: ctccLogo },
CBN: { name: '中国广电', logo: cbnLogo }
};
const getLogo = (category) => {
const operator = opratorList.find(item => item.category === category);
return operator || opratorList[0];
const slotIconMap = {
1: slot1Icon,
2: slot2Icon,
3: slot3Icon
};
const getCarrier = (carrierType) => {
return carrierMap[carrierType] || { name: '-', logo: '' };
};
const getSlotIcon = (slotPosition) => slotIconMap[Number(slotPosition)] || slotIconMap[1];
const sortBySlotPosition = (cards) => cards.sort((left, right) => {
const leftSlot = Number(left.slot_position);
const rightSlot = Number(right.slot_position);
const normalizedLeft = Number.isFinite(leftSlot) && leftSlot > 0 ? leftSlot : Number.MAX_SAFE_INTEGER;
const normalizedRight = Number.isFinite(rightSlot) && rightSlot > 0 ? rightSlot : Number.MAX_SAFE_INTEGER;
return normalizedLeft - normalizedRight;
});
const copyIccid = (value) => {
if (!value) return;
uni.setClipboardData({
data: String(value),
success: () => uni.showToast({ title: 'ICCID已复制', icon: 'success' })
});
};
const loadCards = async () => {
@@ -65,39 +106,30 @@
try {
const assetData = await assetApi.getInfo(userStore.state.identifier);
// 判断是否为设备
if (assetData.asset_type === 'device') {
// 是设备,调用设备卡列表接口
const data = await deviceApi.getCards(userStore.state.identifier);
if (data.cards && data.cards.length > 0) {
list.splice(0, list.length, ...data.cards.map(card => ({
iccid: card.iccid,
category: getCarrierCategory(card.carrier_name),
isRealName: card.real_name_status === 1
})));
}
const cards = (assetData.cards || []).map(card => ({
iccid: card.iccid,
carrier_type: card.carrier_type,
slot_position: card.slot_position,
isDevice: true,
isRealName: card.real_name_status === 1
}));
list.splice(0, list.length, ...sortBySlotPosition(cards));
} else if (assetData.iccid) {
list.splice(0, list.length, {
iccid: assetData.iccid,
carrier_type: assetData.carrier_type,
isDevice: false,
isRealName: assetData.real_name_status === 1
});
} else {
// 不是设备(单卡),直接使用 asset info 数据
if (assetData.identifier) {
list.splice(0, list.length, {
iccid: assetData.identifier,
category: getCarrierCategory(assetData.carrier_name),
isRealName: assetData.real_name_status === 1
});
}
list.splice(0, list.length);
}
} catch (e) {
console.error('加载卡列表失败', e);
}
loading.value = false;
};
const getCarrierCategory = (carrierName) => {
if (!carrierName) return '126';
if (carrierName.includes('电信')) return '124';
if (carrierName.includes('联通')) return '125';
if (carrierName.includes('移动')) return '126';
return '126';
cardsLoaded.value = true;
};
const toReal = async (card) => {
@@ -111,22 +143,25 @@
};
const doRealName = async () => {
const iccid = currentModalIccid.value;
closeModal();
try {
const data = await realnameApi.getLink(userStore.state.identifier, currentModalIccid.value);
const data = await realnameApi.getLink(userStore.state.identifier, iccid, { showError: false });
if (data.realname_url) {
uni.setClipboardData({
data: currentModalIccid.value,
data: iccid,
success: () => {
uni.showToast({ title: 'ICCID已复制', icon: 'success' });
}
});
closeModal();
setTimeout(() => {
window.location.href = data.realname_url;
}, 1500);
}
} catch (e) {
console.error('获取实名链接失败', e);
uni.showToast({ title: e?.msg || '获取实名链接失败', icon: 'none' });
}
};
@@ -137,15 +172,94 @@
<style lang="scss" scoped>
.container {
.card {
.logo {
width: 80rpx;
height: 80rpx;
border-radius: 120rpx;
border: 1rpx solid var(--primary);
overflow: hidden;
image { width: 100%; height: 100%; }
}
.carrier-card {
padding: 28rpx;
}
.carrier-main {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24rpx;
}
.logo-stack {
width: 88rpx;
height: 88rpx;
margin-top: 12rpx;
flex-shrink: 0;
box-sizing: border-box;
}
.carrier-logo {
width: 88rpx;
height: 88rpx;
flex-shrink: 0;
}
.slot-badge {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
}
.carrier-details {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
}
.carrier-name {
color: var(--text-primary);
font-size: 30rpx;
font-weight: 600;
line-height: 1.3;
}
.carrier-heading {
display: flex;
align-items: center;
gap: 10rpx;
}
.carrier-iccid {
display: flex;
align-items: center;
gap: 10rpx;
margin-top: 14rpx;
min-width: 0;
}
.iccid-value-text {
flex: 0 1 auto;
min-width: 0;
color: var(--text-secondary);
font-size: 24rpx;
line-height: 1.35;
word-break: break-all;
}
.copy-icon {
width: 30rpx;
height: 30rpx;
flex-shrink: 0;
cursor: pointer;
}
.card-actions {
width: 100%;
margin-top: 20rpx;
}
.action-button {
width: 100%;
height: 64rpx;
padding: 0 16rpx;
font-size: 26rpx;
line-height: 64rpx;
box-sizing: border-box;
&::after { border: none; }
}
}
@@ -240,8 +354,15 @@
justify-content: center;
padding: 120rpx 40rpx;
min-height: 400rpx;
.empty-icon { font-size: 120rpx; margin-bottom: 30rpx; opacity: 0.6; }
.empty-icon { width: 120rpx; height: 120rpx; margin-bottom: 30rpx; opacity: 0.6; }
.empty-title { font-size: 32rpx; font-weight: 600; color: var(--text-primary); margin-bottom: 16rpx; }
.empty-desc { font-size: 26rpx; color: var(--text-tertiary); text-align: center; }
}
</style>
.loading-state {
display: flex;
align-items: center;
justify-content: center;
min-height: 500rpx;
}
</style>

View File

@@ -3,7 +3,7 @@
<!-- 自定义导航栏 -->
<view v-if="!fromLogin" class="custom-navbar">
<view class="navbar-back" @tap="goBack">
<text class="back-text">🔙</text>
<image class="back-icon" src="../../static/left.png" mode="aspectFit" />
</view>
<view class="navbar-title">绑定手机号</view>
<view class="navbar-placeholder"></view>
@@ -41,6 +41,11 @@
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { authApi } from '@/api/index.js';
import { useUserStore } from '@/store/index.js';
const POST_BIND_RELOGIN_NOTICE_KEY = 'postBindReloginNotice';
const userStore = useUserStore();
let bind = reactive({
phone: '',
@@ -60,6 +65,23 @@
fromLogin.value = options.fromLogin === 'true';
});
const prepareManualRelogin = () => {
const preservedIdentifier = userStore.state.identifier || uni.getStorageSync('identifier') || '';
userStore.clearUser();
if (preservedIdentifier) {
userStore.setIdentifier(preservedIdentifier);
}
uni.setStorageSync(POST_BIND_RELOGIN_NOTICE_KEY, '1');
// #ifdef H5
if (typeof sessionStorage !== 'undefined') {
sessionStorage.removeItem('assetToken');
}
// #endif
};
const getCode = async () => {
if (!bind.phone) {
uni.showToast({ title: '请输入手机号', icon: 'none' });
@@ -100,15 +122,17 @@
try {
await authApi.bindPhone(bind.phone, bind.code);
if (fromLogin.value) {
prepareManualRelogin();
uni.reLaunch({ url: '/pages/login/login' });
return;
}
uni.showToast({ title: '绑定成功', icon: 'success' });
setTimeout(() => {
if (fromLogin.value) {
// 从登录页面过来的,绑定成功后跳转到首页
uni.redirectTo({ url: '/pages/index/index' });
} else {
// 从其他页面过来的,返回上一页
uni.navigateBack();
}
// 从其他页面过来的,返回上一页
uni.navigateBack();
}, 1500);
} catch (e) {
console.error('绑定手机号失败', e);
@@ -129,7 +153,9 @@
};
const goBack = () => {
uni.navigateBack();
uni.navigateTo({
url: '/pages/index/index'
})
};
</script>
@@ -137,6 +163,10 @@
.page {
min-height: 100vh;
background: var(--bg-secondary);
max-width: 750rpx;
margin: 0 auto;
width: 100%;
box-sizing: border-box;
}
.custom-navbar {
@@ -160,8 +190,8 @@
cursor: pointer;
.back-icon {
font-size: 36rpx;
color: var(--text-primary);
width: 40rpx;
height: 40rpx;
}
.back-text {
@@ -187,4 +217,4 @@
.container {
padding: var(--space-md);
}
</style>
</style>

View File

@@ -1,83 +1,181 @@
<template>
<view class="container">
<view v-if="!exchangeData && !loading" class="empty-state">
<view class="empty-icon">🔄</view>
<view v-if="!exchangeLoaded || (loading && !exchangeData)" class="loading-state">
<up-loading-icon text="加载中" size="30"></up-loading-icon>
</view>
<view v-else-if="!exchangeData" class="empty-state">
<image class="empty-icon" src="/static/change-shop.png" mode="aspectFit" alt="换货"></image>
<view class="empty-title">暂无换货记录</view>
<view class="empty-desc">当前账号下暂无设备换货记录</view>
<view class="empty-desc">当前账号下暂无换货记录</view>
</view>
<view v-else-if="exchangeData" class="card exchange-card">
<view class="exchange-header flex-row-sb">
<view class="exchange-no">{{ exchangeData?.exchange_no }}</view>
<view class="tag-apple" :class="getStatusClass(exchangeData?.status)">{{ exchangeData?.status_text }}</view>
<view class="exchange-no">{{ exchangeData.exchange_no }}</view>
<view class="tag-apple" :class="getStatusClass(exchangeData.status)">
{{ exchangeData.status_text }}
</view>
</view>
<view class="exchange-info">
<view class="info-row flex-row-sb">
<view class="info-label">换货类型</view>
<view class="info-value">{{ exchangeData.flow_type_name || '物流换货' }}</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">换货原因</view>
<view class="info-value">{{ exchangeData?.exchange_reason }}</view>
<view class="info-value">{{ exchangeData.exchange_reason }}</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">申请时间</view>
<view class="info-value">{{ formatTime(exchangeData?.created_at) }}</view>
<view class="info-value">{{ formatTime(exchangeData.created_at) }}</view>
</view>
<view class="info-row flex-row-sb" v-if="exchangeData?.recipient_name">
<view class="info-row flex-row-sb" v-if="exchangeData.shipped_at">
<view class="info-label">发货时间</view>
<view class="info-value">{{ formatTime(exchangeData.shipped_at) }}</view>
</view>
<view class="info-row flex-row-sb" v-if="exchangeData.completed_at && exchangeData.status === 4">
<view class="info-label">完成时间</view>
<view class="info-value">{{ formatTime(exchangeData.completed_at) }}</view>
</view>
<view class="info-row flex-row-sb" v-if="exchangeData.recipient_name">
<view class="info-label">收件人</view>
<view class="info-value">{{ exchangeData?.recipient_name }}</view>
<view class="info-value">{{ exchangeData.recipient_name }}</view>
</view>
<view class="info-row flex-row-sb" v-if="exchangeData?.recipient_phone">
<view class="info-row flex-row-sb" v-if="exchangeData.recipient_phone">
<view class="info-label">联系电话</view>
<view class="info-value">{{ exchangeData?.recipient_phone }}</view>
<view class="info-value">{{ exchangeData.recipient_phone }}</view>
</view>
<view class="info-row flex-row-sb" v-if="exchangeData?.recipient_address">
<view class="info-row flex-row-sb" v-if="exchangeData.recipient_address">
<view class="info-label">收货地址</view>
<view class="info-value address-value">{{ exchangeData?.recipient_address }}</view>
<view class="info-value address-value">{{ exchangeData.recipient_address }}</view>
</view>
</view>
<view class="exchange-actions" v-if="exchangeData?.status === 1">
<view class="exchange-actions" v-if="exchangeData.status === 1">
<button class="btn-apple btn-primary" @tap="openPopup">填写信息</button>
</view>
</view>
<up-popup :show="showPopup" mode="center" @close="showPopup=false">
<up-popup :show="showPopup" mode="center" @close="handlePopupClose">
<view class="popup-content">
<view class="popup-title">填写换货信息</view>
<view class="form-item">
<view class="form-label">粘贴收货信息</view>
<up-textarea
v-model="form.raw_shipping_text"
placeholder="可粘贴包含收件人、电话、地址的一整段文字"
autoHeight
:maxlength="-1"
border="surround"
/>
<view class="form-helper">识别结果可继续手动修改</view>
<view class="paste-action-row">
<button class="btn-apple btn-secondary paste-action-btn" @tap="clearPastedText">
清除
</button>
<button class="btn-apple btn-secondary paste-action-btn" @tap="fillFromPastedText">
识别并填充
</button>
</view>
</view>
<view class="form-item">
<view class="form-label">收件人姓名</view>
<up-input placeholder="请输入收件人姓名" border="surround" v-model="form.recipient_name" />
<up-input
v-model="form.recipient_name"
placeholder="请输入收件人姓名"
border="surround"
/>
</view>
<view class="form-item">
<view class="form-label">收件人电话</view>
<up-input placeholder="请输入收件人电话" border="surround" v-model="form.recipient_phone" />
<up-input
v-model="form.recipient_phone"
placeholder="请输入11位手机号"
type="number"
maxlength="11"
border="surround"
/>
</view>
<view class="form-item">
<view class="form-label">收货地址</view>
<up-input placeholder="请输入详细收货地址" border="surround" v-model="form.recipient_address" />
<view class="form-label">所在地区</view>
<view class="region-trigger" @tap="openAreaPicker">
<text class="region-trigger-text" :class="{ placeholder: !regionDisplayText }">
{{ regionDisplayText || '请选择省 / 市 / 区' }}
</text>
</view>
</view>
<view class="form-item">
<view class="form-label">详细地址</view>
<up-textarea
v-model="form.recipient_address_detail"
placeholder="请输入详细收货地址"
autoHeight
:maxlength="-1"
border="surround"
/>
</view>
<view class="popup-btn-group">
<button class="btn-apple btn-secondary" @tap="showPopup=false">取消</button>
<button class="btn-apple btn-secondary" @tap="handlePopupClose">取消</button>
<button class="btn-apple btn-primary" @tap="submitExchange">提交</button>
</view>
</view>
</up-popup>
<up-picker
:show="showAreaPicker"
:columns="areaPickerColumns"
keyName="label"
title="选择所在地区"
:defaultIndex="areaPickerDefaultIndex"
closeOnClickOverlay
@confirm="confirmAreaPicker"
@change="handleAreaPickerChange"
@cancel="showAreaPicker = false"
@close="showAreaPicker = false"
/>
</view>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { computed, onMounted, reactive, ref } from 'vue';
import { exchangeApi } from '@/api/index.js';
import { useUserStore } from '@/store/index.js';
import {
buildRegionColumns,
composeRecipientAddress,
getRegionDisplayText,
parseSavedRecipientAddress,
parseShippingText
} from '@/utils/shippingAddress.js';
const PHONE_REG = /^1[3-9]\d{9}$/;
const userStore = useUserStore();
let exchangeData = ref(null);
let loading = ref(false);
let showPopup = ref(false);
let form = reactive({
const exchangeData = ref(null);
const loading = ref(false);
const exchangeLoaded = ref(false);
const showPopup = ref(false);
const showAreaPicker = ref(false);
const areaPickerColumns = ref([]);
const areaPickerDefaultIndex = ref([0, 0, 0]);
const form = reactive({
raw_shipping_text: '',
recipient_name: '',
recipient_phone: '',
recipient_address: ''
recipient_region_codes: [],
recipient_address_detail: ''
});
const regionDisplayText = computed(() => {
return getRegionDisplayText(form.recipient_region_codes);
});
const getStatusClass = (status) => {
@@ -93,73 +191,195 @@
const formatTime = (time) => {
if (!time) return '-';
return time.split('T').join(' ').slice(0, 19);
return String(time).split('T').join(' ').slice(0, 19);
};
const getRecipientPhone = () => String(form.recipient_phone || '').trim();
const validateRecipientPhone = () => {
const phone = getRecipientPhone();
if (!phone) {
uni.showToast({ title: '请输入收件人电话', icon: 'none' });
return '';
}
if (!PHONE_REG.test(phone)) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
return '';
}
return phone;
};
const syncAreaPickerState = (regionCodes = []) => {
const { columns, defaultIndex } = buildRegionColumns(regionCodes);
areaPickerColumns.value = columns;
areaPickerDefaultIndex.value = defaultIndex.map((index) => (index < 0 ? 0 : index));
};
const loadExchange = async () => {
loading.value = true;
try {
const data = await exchangeApi.getPending(userStore.state.identifier);
// 接口返回的是单个对象,不是数组
exchangeData.value = data || null;
} catch (e) {
console.error('加载换货记录失败', e);
} catch (error) {
console.error('加载换货记录失败', error);
exchangeData.value = null;
} finally {
loading.value = false;
exchangeLoaded.value = true;
}
loading.value = false;
};
const handlePopupClose = () => {
showPopup.value = false;
showAreaPicker.value = false;
};
const openAreaPicker = () => {
syncAreaPickerState(form.recipient_region_codes);
showAreaPicker.value = true;
};
const openPopup = () => {
form.recipient_name = exchangeData?.recipient_name || '';
form.recipient_phone = exchangeData?.recipient_phone || '';
form.recipient_address = exchangeData?.recipient_address || '';
const currentExchange = exchangeData.value || {};
const { regionCodes, detailAddress } = parseSavedRecipientAddress(
currentExchange.recipient_address || ''
);
form.raw_shipping_text = '';
form.recipient_name = currentExchange.recipient_name || '';
form.recipient_phone = currentExchange.recipient_phone || '';
form.recipient_region_codes = regionCodes;
form.recipient_address_detail = detailAddress;
syncAreaPickerState(regionCodes);
showPopup.value = true;
};
const handleAreaPickerChange = (event) => {
const selectedValues = event.value || [];
const selectedProvinceCode = selectedValues[0]?.value || '';
const selectedCityCode =
event.columnIndex === 0 ? '' : selectedValues[1]?.value || '';
const selectedDistrictCode =
event.columnIndex === 2 ? selectedValues[2]?.value || '' : '';
const { columns, defaultIndex } = buildRegionColumns([
selectedProvinceCode,
selectedCityCode,
selectedDistrictCode
]);
areaPickerColumns.value = columns;
areaPickerDefaultIndex.value = defaultIndex.map((index) => (index < 0 ? 0 : index));
};
const confirmAreaPicker = ({ value }) => {
const selectedCodes = (value || []).map((item) => item?.value).filter(Boolean);
if (selectedCodes.length === 3) {
form.recipient_region_codes = selectedCodes;
syncAreaPickerState(selectedCodes);
}
showAreaPicker.value = false;
};
const fillFromPastedText = () => {
if (!form.raw_shipping_text.trim()) {
uni.showToast({ title: '请先粘贴收货信息', icon: 'none' });
return;
}
const parsed = parseShippingText(form.raw_shipping_text);
let updatedCount = 0;
if (parsed.recipient_name) {
form.recipient_name = parsed.recipient_name;
updatedCount += 1;
}
if (parsed.recipient_phone) {
form.recipient_phone = parsed.recipient_phone;
updatedCount += 1;
}
if (parsed.regionCodes.length === 3) {
form.recipient_region_codes = parsed.regionCodes;
syncAreaPickerState(parsed.regionCodes);
updatedCount += 1;
}
if (parsed.detailAddress) {
form.recipient_address_detail = parsed.detailAddress;
updatedCount += 1;
}
if (!updatedCount) {
uni.showToast({ title: '未识别到有效收货信息', icon: 'none' });
return;
}
uni.showToast({ title: '已识别并填充', icon: 'success' });
};
const clearPastedText = () => {
form.raw_shipping_text = '';
};
const submitExchange = async () => {
if (!form.recipient_name) {
if (!form.recipient_name.trim()) {
uni.showToast({ title: '请输入收件人姓名', icon: 'none' });
return;
}
if (!form.recipient_phone) {
uni.showToast({ title: '请输入收件人电话', icon: 'none' });
const recipientPhone = validateRecipientPhone();
if (!recipientPhone) return;
if (form.recipient_region_codes.length !== 3) {
uni.showToast({ title: '请选择省市区', icon: 'none' });
return;
}
// 手机号格式校验
const phoneReg = /^1[3-9]\d{9}$/;
if (!phoneReg.test(form.recipient_phone)) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
if (!form.recipient_address_detail.trim()) {
uni.showToast({ title: '请输入详细收货地址', icon: 'none' });
return;
}
if (!form.recipient_address) {
uni.showToast({ title: '请输入收货地址', icon: 'none' });
return;
}
const recipientAddress = composeRecipientAddress(
form.recipient_region_codes,
form.recipient_address_detail
);
try {
await exchangeApi.submitShippingInfo(
exchangeData.value.id,
form.recipient_name,
form.recipient_phone,
form.recipient_address
form.recipient_name.trim(),
recipientPhone,
recipientAddress
);
uni.showToast({ title: '提交成功', icon: 'success' });
showPopup.value = false;
loadExchange();
} catch (e) {
console.error('提交换货信息失败', e);
handlePopupClose();
await loadExchange();
} catch (error) {
console.error('提交换货信息失败', error);
}
};
onMounted(() => {
syncAreaPickerState();
loadExchange();
});
</script>
<style lang="scss" scoped>
.container {
.loading-state {
display: flex;
align-items: center;
justify-content: center;
min-height: 500rpx;
}
.empty-state {
display: flex;
flex-direction: column;
@@ -167,24 +387,58 @@
justify-content: center;
padding: 120rpx 40rpx;
min-height: 60vh;
.empty-icon { font-size: 120rpx; margin-bottom: 30rpx; opacity: 0.6; }
.empty-title { font-size: 32rpx; font-weight: 600; color: var(--text-primary); margin-bottom: 16rpx; }
.empty-desc { font-size: 26rpx; color: var(--text-tertiary); text-align: center; margin-bottom: 40rpx; }
.empty-btn { width: 100%; max-width: 400rpx; }
.empty-icon {
width: 120rpx;
height: 120rpx;
margin-bottom: 30rpx;
opacity: 0.6;
}
.empty-title {
font-size: 32rpx;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 16rpx;
}
.empty-desc {
font-size: 26rpx;
color: var(--text-tertiary);
text-align: center;
margin-bottom: 40rpx;
}
}
.exchange-card {
.exchange-header {
margin-bottom: var(--space-md);
.exchange-no { font-size: 28rpx; font-weight: 600; color: var(--text-primary); }
.exchange-no {
font-size: 28rpx;
font-weight: 600;
color: var(--text-primary);
}
}
.exchange-info {
.info-row {
padding: var(--space-xs) 0;
.info-label { font-size: 24rpx; color: var(--text-tertiary); }
.info-value { font-size: 24rpx; color: var(--text-primary); }
.address-value { max-width: 400rpx; text-align: right; }
.info-label {
font-size: 24rpx;
color: var(--text-tertiary);
}
.info-value {
font-size: 24rpx;
color: var(--text-primary);
}
.address-value {
max-width: 400rpx;
text-align: right;
}
}
}
@@ -192,14 +446,19 @@
margin-top: var(--space-lg);
padding-top: var(--space-md);
border-top: 1rpx solid var(--gray-200);
.btn-apple { width: 100%; }
.btn-apple {
width: 100%;
}
}
}
}
.popup-content {
width: 600rpx;
width: 660rpx;
padding: 30rpx;
box-sizing: border-box;
.popup-title {
font-size: 32rpx;
font-weight: 600;
@@ -207,19 +466,60 @@
text-align: center;
margin-bottom: var(--space-lg);
}
.form-item {
margin-bottom: var(--space-md);
.form-label {
font-size: 26rpx;
color: var(--text-secondary);
margin-bottom: var(--space-xs);
}
.form-helper {
margin-top: var(--space-xs);
font-size: 22rpx;
color: var(--text-tertiary);
}
.paste-action-row {
display: flex;
gap: var(--space-md);
margin-top: var(--space-sm);
.paste-action-btn {
flex: 1;
}
}
}
.region-trigger {
display: flex;
align-items: center;
min-height: 84rpx;
padding: 0 24rpx;
border: 2rpx solid var(--border-light);
border-radius: 12rpx;
background: #fff;
.region-trigger-text {
font-size: 28rpx;
color: var(--text-primary);
&.placeholder {
color: var(--text-tertiary);
}
}
}
.popup-btn-group {
display: flex;
gap: var(--space-md);
margin-top: var(--space-lg);
.btn-apple { flex: 1; }
.btn-apple {
flex: 1;
}
}
}
</style>
</style>

View File

@@ -1,35 +1,38 @@
<template>
<view class="container">
<UserInfoCard :currentCardNo="currentCardNo" :deviceInfo="deviceInfo" :onlineStatus="onlineStatus"
:isDevice="userInfo.isDevice" :networkStatus="deviceInfo.network_status" />
:isDevice="userInfo.isDevice" :networkStatus="deviceInfo.network_status"
:isExpiring="deviceInfo.isExpiring" :expiryDays="deviceInfo.expiryDays" @renew="startHomepageRenewal" />
<DeviceStatusCard v-if="userInfo.isDevice" :deviceInfo="deviceInfo" :isRealName="isRealName"
@authentication="enterDetail('authentication')" />
:isDevice="userInfo.isDevice" @authentication="enterDetail('authentication')" />
<!-- <VoiceCard v-if="!userInfo.isDevice" :voiceStats="voiceStats" :dateRangeText="dateRangeText"
@openDatePicker="openDateRangePicker" /> -->
<TrafficCard :identifier="currentCardNo" @packageLoaded="handlePackageLoaded" />
<TrafficCard :identifier="currentCardNo" />
<!-- <WhitelistCard v-if="!userInfo.isDevice" :whitelistData="whitelistData" @refresh="refreshWhitelist"
@add="showAddWhitelistDialog" @showSms="showSmsCodeDialog" /> -->
<WifiCard v-if="userInfo.isDevice" :deviceInfo="deviceInfo" @modify="modifyWifi" @copy="copy" />
<WifiCard v-if="userInfo.isDevice" :deviceInfo="deviceInfo" @modify="modifyWifi"
@copy-config="copyWifiConfig" />
<FunctionCard :realNameStatus="realNameStatus" :alreadyBindPhone="alreadyBindPhone"
:isDevice="userInfo.isDevice" @enter="enterDetail" @sync="onSync">
<!-- 修改WIFI弹窗 -->
:isDevice="userInfo.isDevice" :walletBalance="deviceInfo.walletBalance" :unreadCount="notificationUnreadCount"
@enter="enterDetail" @sync="onSync">
<!-- 修改配置弹窗 -->
<up-popup :show="showModifyWifi" mode="center" @close="showModifyWifi=false">
<view class="wifi-popup">
<view class="title mb-md">修改WIFI</view>
<view class="title mb-md">修改配置</view>
<view class="flex-col-g20">
<view class="flex-col-g8">
<label class="caption">名称:</label>
<up-input placeholder="WIFI名称" border="surround" v-model="wifi_info.ssid" />
<up-input placeholder="WIFI名称" class="wifi-input" v-model="wifi_info.ssid" />
</view>
<view class="flex-col-g8">
<label class="caption">密码:</label>
<up-input placeholder="WIFI密码" border="surround" v-model="wifi_info.pwd" />
<up-input placeholder="WIFI密码" class="wifi-input" v-model="wifi_info.pwd" />
</view>
</view>
<view class="btn-group mt-20">
@@ -94,6 +97,13 @@
<view class="bottom-spacer"></view>
<NotificationPopup :show="notificationPopupShow" :items="notificationItems"
:current="notificationPopupCurrent" @change="onNotificationChange" @close="closeNotificationPopup"
@renew="startHomepageRenewal" />
<RenewalPaymentPopup ref="renewalPopupRef" :identifier="userStore.state.identifier"
paymentRefreshTarget="home" @completed="loadAssetInfo" />
<!-- 日期选择器弹窗 -->
<up-datetime-picker v-if="!userInfo.isDevice" :show="showStartDatePicker" v-model="startDateTimestamp"
mode="date" @confirm="onStartDateConfirm" @cancel="showStartDatePicker=false"
@@ -113,6 +123,7 @@
onMounted,
computed
} from 'vue';
import { onShow } from '@dcloudio/uni-app';
import UserInfoCard from '@/components/UserInfoCard.vue';
import DeviceStatusCard from '@/components/DeviceStatusCard.vue';
import VoiceCard from '@/components/VoiceCard.vue';
@@ -121,13 +132,18 @@
import WifiCard from '@/components/WifiCard.vue';
import FunctionCard from '@/components/FunctionCard.vue';
import FloatingButton from '@/components/FloatingButton.vue';
import NotificationPopup from '@/components/NotificationPopup.vue';
import RenewalPaymentPopup from '@/components/RenewalPaymentPopup.vue';
import {
assetApi,
deviceApi
deviceApi,
hasActiveOrPendingPackage,
notificationApi
} from '@/api/index.js';
import {
useUserStore
} from '@/store/index.js';
import { consumePendingPaymentRefresh, PAYMENT_REFRESH_TARGETS } from '@/utils/payment.js';
const userStore = useUserStore();
@@ -147,7 +163,15 @@
connect: 0,
network_status: 1,
status: 1,
packageName: '-',
currentPackageId: 0,
renewalPrice: null,
expireDate: '-',
isExpiring: false,
expiryDays: null,
expiryEstimateStatus: 'none',
walletBalance: 0,
iccid: '-',
currentIccid: '-',
category: '-',
phone: '-',
@@ -155,7 +179,8 @@
totalBytesCnt: 0,
ssidName: '-',
ssidPwd: '-',
rssi: '-',
signal_quality: '暂无数据',
signal_bad_reason: '',
onlineStatus: '0',
connCnt: 0,
run_time: 0,
@@ -173,6 +198,8 @@
let alreadyBindPhone = ref(false);
let boundPhone = ref('');
let realNameStatus = ref('');
let effectiveRealnamePolicy = ref('none');
let realnameEntryChecking = ref(false);
let wifi_info = reactive({
ssid: '',
pwd: ''
@@ -204,6 +231,24 @@
let showSmsCode = ref(false);
let smsCodePhone = ref('');
let smsCode = ref('');
let indexEntryChecking = ref(false);
let notificationUnreadCount = ref(0);
let notificationPopupShow = ref(false);
let notificationItems = ref([]);
let notificationPopupCurrent = ref(0);
let renewalPopupRef = ref(null);
const notificationReadPending = new Set();
const formatDate = (dateStr) => {
if (!dateStr) return '-';
return dateStr.split('T')[0] || '-';
};
const resolveCurrentCard = (cards = []) => {
if (cards.length === 1) return cards[0];
if (cards.length > 1) return cards.find(card => card.is_current) || null;
return null;
};
const loadAssetInfo = async () => {
const identifier = userStore.state.identifier;
@@ -219,10 +264,22 @@
deviceInfo.network_status = data.network_status;
deviceInfo.status = data.status;
deviceInfo.imei = data.imei || '-';
deviceInfo.asset_type = data.asset_type || 'device';
deviceInfo.bound_phone = data.bound_phone || '';
isRealName.value = data.real_name_status === 1;
realNameStatus.value = data.real_name_status === 1 ? '已实名' : '未实名';
deviceInfo.asset_type = data.asset_type || 'device';
deviceInfo.bound_phone = data.bound_phone || '';
deviceInfo.packageName = data.current_package || '-';
deviceInfo.currentPackageId = Number(data.current_package_id || 0);
deviceInfo.renewalPrice = data.renewal_price ?? null;
deviceInfo.expireDate = formatDate(data.estimated_final_expires_at);
deviceInfo.isExpiring = data.is_expiring === true;
deviceInfo.expiryDays = data.days_until_final_expiry ?? null;
deviceInfo.expiryEstimateStatus = data.expiry_estimate_status || 'none';
deviceInfo.iccid = data.iccid || '-';
deviceInfo.walletBalance = data.wallet_balance ?? 0;
const currentCard = resolveCurrentCard(data.cards || []);
isRealName.value = Number(data.real_name_status) === 1;
realNameStatus.value = isRealName.value ? '已实名' : '未实名';
effectiveRealnamePolicy.value = data.effective_realname_policy || 'none';
userStore.setRealNameStatus(data.real_name_status);
boundPhone.value = data.bound_phone || '';
alreadyBindPhone.value = !!data.bound_phone;
@@ -230,9 +287,7 @@
// 当前卡信息
if (data.cards && data.cards.length > 0) {
// 找到当前卡
const currentCard = data.cards.find(card => card.is_current) || data.cards[0];
deviceInfo.currentIccid = currentCard.iccid || '-';
deviceInfo.currentIccid = currentCard?.iccid || '-';
// 卡列表
deviceInfo.mchList = data.cards.map(card => ({
@@ -245,6 +300,15 @@
deviceInfo.mchList = [];
}
// 运营商信息
const carrierTypeMap = {
CMCC: '中国移动',
CUCC: '中国联通',
CTCC: '中国电信',
CBN: '中国广电'
};
deviceInfo.carrier_name = (currentCard && carrierTypeMap[currentCard.carrier_type]) || '-';
// 设备实时信息
if (data.device_realtime) {
const rt = data.device_realtime;
@@ -256,7 +320,8 @@
deviceInfo.connCnt = rt.client_number ?? 0;
deviceInfo.max_clients = rt.max_clients ?? 1;
deviceInfo.run_time = rt.run_time || 0;
deviceInfo.rssi = calculateSignalStrength(rt.rsrp, rt.rsrq, rt.rssi);
deviceInfo.signal_quality = rt.signal_quality || '暂无数据';
deviceInfo.signal_bad_reason = rt.signal_bad_reason || '';
} else {
// 没有实时信息时设置默认值
deviceInfo.onlineStatus = '0';
@@ -267,39 +332,46 @@
deviceInfo.connCnt = 0;
deviceInfo.max_clients = 1;
deviceInfo.run_time = 0;
deviceInfo.rssi = '-';
deviceInfo.signal_quality = '暂无数据';
deviceInfo.signal_bad_reason = '';
}
// 到期时间由 TrafficCard 组件获取套餐信息时一并返回
// 最终到期时间和临期状态均以后端 asset/info 返回值为准。
return data;
} catch (e) {
console.error('加载资产信息失败', e);
return null;
} finally {
loading.value = false;
}
loading.value = false;
};
// 计算信号强度
const calculateSignalStrength = (rsrp, rsrq, rssi) => {
// 简单的信号强度计算逻辑
if (!rsrp && !rsrq && !rssi) return '-';
const handleIndexEntry = async () => {
const token = uni.getStorageSync('token');
if (!token) {
uni.reLaunch({ url: '/pages/login/login' });
return;
}
const rsrpNum = parseInt(rsrp);
if (isNaN(rsrpNum)) return '-';
if (indexEntryChecking.value) return;
indexEntryChecking.value = true;
if (rsrpNum >= -80) return '强';
if (rsrpNum >= -95) return '中';
return '弱';
try {
await loadAssetInfo();
} finally {
indexEntryChecking.value = false;
}
};
// 处理套餐加载完成事件(从 TrafficCard 组件传递过来)
const handlePackageLoaded = (activePackage) => {
if (activePackage && activePackage.expires_at) {
// 格式化到期时间
const date = new Date(activePackage.expires_at);
deviceInfo.expireDate =
`${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
} else {
deviceInfo.expireDate = '-';
const startHomepageRenewal = () => {
const packageId = Number(deviceInfo.currentPackageId || 0);
const packageName = String(deviceInfo.packageName || '').trim();
if (!packageId || !packageName || packageName === '-') {
uni.showToast({ title: '当前资产暂无可续费套餐', icon: 'none' });
return;
}
renewalPopupRef.value?.open([packageId], [packageName], deviceInfo.renewalPrice);
};
const modifyWifi = () => {
@@ -379,15 +451,27 @@
// #endif
};
const enterBack = () => {
const enterBack = async () => {
if (!deviceInfo.lan_ip || deviceInfo.lan_ip === '-') {
uni.showToast({
title: '暂无后台地址',
icon: 'none'
uni.showModal({
title: '提示',
content: '请将设备开机后, 等待2分钟左右进行连接WiFi',
showCancel: false,
buttonText: '我知道了'
});
return;
}
await new Promise((resolve) => {
uni.showModal({
title: '提示',
content: '请先连接当前设备WiFi否则无法访问后台管理',
cancelText: '取消',
confirmText: '我知道了',
success: (res) => res.confirm && resolve()
});
});
// 跳转到设备后台管理地址
const url = deviceInfo.lan_ip.startsWith('http') ? deviceInfo.lan_ip : `http://${deviceInfo.lan_ip}`;
@@ -430,16 +514,6 @@
restartShow.value = false;
};
const copy = (content) => {
uni.setClipboardData({
data: content,
success: () => uni.showToast({
title: '复制成功',
icon: 'none'
})
});
};
const YesRecover = async () => {
try {
await deviceApi.factoryReset(userStore.state.identifier);
@@ -593,56 +667,109 @@
return;
}
uni.showLoading({
title: '同步中...',
mask: true
uni.showModal({
title: '确认同步',
content: '确定要同步运营商数据吗?',
success: (res) => {
if (!res.confirm) return;
uni.showLoading({
title: '同步中...',
mask: true
});
assetApi.refresh(identifier).then((data) => {
uni.hideLoading();
if (data.accepted) {
const refreshTypeText = data.refresh_type === 'device' ? '设备' : '卡';
uni.showToast({
title: `${refreshTypeText}数据同步成功`,
icon: 'success',
duration: 2000
});
setTimeout(() => {
loadAssetInfo();
}, 2000);
} else {
uni.showToast({
title: '同步失败,请稍后重试',
icon: 'none'
});
}
}).catch((e) => {
uni.hideLoading();
console.error('同步数据失败', e);
if (e.msg && e.msg.includes('冷却')) {
uni.showToast({
title: e.msg,
icon: 'none',
duration: 2000
});
} else {
uni.showToast({
title: '同步失败',
icon: 'none'
});
}
});
}
});
};
const shouldRedirectRealnameToPackageOrder = async () => {
if (effectiveRealnamePolicy.value !== 'after_order') return false;
const identifier = userStore.state.identifier;
let cards = [{ real_name_status: isRealName.value ? 1 : 0 }];
if (userInfo.isDevice) {
const data = await deviceApi.getCards(identifier);
cards = Array.isArray(data?.cards) ? data.cards : [];
}
if (cards.some(card => Number(card?.real_name_status) === 1)) return false;
return !(await hasActiveOrPendingPackage(identifier));
};
const openRealnameEntry = async () => {
if (realnameEntryChecking.value) return;
realnameEntryChecking.value = true;
uni.showLoading({ title: '校验中...', mask: true });
try {
const data = await assetApi.refresh(identifier);
const shouldRedirect = await shouldRedirectRealnameToPackageOrder();
uni.hideLoading();
if (data.accepted) {
const refreshTypeText = data.refresh_type === 'device' ? '设备' : '卡';
uni.showToast({
title: `${refreshTypeText}数据同步成功`,
icon: 'success',
duration: 2000
});
// 同步成功后,延迟重新加载资产信息
setTimeout(() => {
loadAssetInfo();
}, 2000);
} else {
uni.showToast({
title: '同步失败,请稍后重试',
icon: 'none'
});
if (!shouldRedirect) {
uni.navigateTo({ url: '/pages/auth/auth' });
return;
}
} catch (e) {
uni.showModal({
title: '提示',
content: '当前设备所有卡均未实名,且暂无生效中或待生效套餐。请先订购套餐,再进行实名认证。',
confirmText: '去订购',
cancelText: '取消',
success: ({ confirm }) => {
if (confirm) uni.navigateTo({ url: '/pages/package-order/package-order' });
}
});
} catch (error) {
uni.hideLoading();
console.error('同步数据失败', e);
// 如果是冷却时间错误,显示提示
if (e.msg && e.msg.includes('冷却')) {
uni.showToast({
title: e.msg,
icon: 'none',
duration: 2000
});
} else {
uni.showToast({
title: '同步失败',
icon: 'none'
});
}
console.error('校验实名入口条件失败', error);
uni.showToast({ title: '实名条件校验失败,请稍后重试', icon: 'none' });
} finally {
realnameEntryChecking.value = false;
}
};
const enterDetail = (name) => {
switch (name) {
case 'notifications':
uni.navigateTo({
url: '/pages/notifications/notifications'
});
break;
case 'package-order':
uni.navigateTo({
url: '/pages/package-order/package-order'
@@ -695,12 +822,10 @@
});
break;
case 'authentication':
uni.navigateTo({
url: '/pages/auth/auth'
});
openRealnameEntry();
break;
case 'recover':
restartShow.value = true;
recoverShow.value = true;
break;
case 'restart':
restartShow.value = true;
@@ -711,28 +836,109 @@
}
};
const loadNotificationUnreadCount = async () => {
try {
const data = await notificationApi.getUnreadCount();
notificationUnreadCount.value = Number(data?.count || 0);
} catch (error) {
console.error('加载通知未读数失败', error);
}
};
const markNotificationRead = async (item) => {
if (!item || item.is_read || notificationReadPending.has(item.id)) return;
notificationReadPending.add(item.id);
try {
await notificationApi.markRead(item.id);
item.is_read = true;
item.read_at = new Date().toISOString();
notificationUnreadCount.value = Math.max(notificationUnreadCount.value - 1, 0);
} catch (error) {
console.error('标记首页通知已读失败', error);
} finally {
notificationReadPending.delete(item.id);
}
};
const loadUnreadNotifications = async () => {
try {
const data = await notificationApi.getList(1, 50, false);
const items = (data?.items || [])
.filter(item => !item.is_read)
.sort((a, b) => getNotificationPriority(b) - getNotificationPriority(a));
if (!items.length) return;
notificationItems.value = items;
notificationPopupCurrent.value = 0;
notificationPopupShow.value = true;
// 弹窗打开即视为用户已看到第一条通知。
markNotificationRead(items[0]);
} catch (error) {
console.error('加载首页未读通知失败', error);
}
};
const copyWifiConfig = (content) => {
uni.setClipboardData({
data: content,
success: () => uni.showToast({ title: '配置已复制', icon: 'none' })
});
};
const getNotificationPriority = (item) => {
const severityRank = { info: 10, warning: 20, error: 30, critical: 40 };
const remainingDays = Number(item?.days_until_expiry ?? item?.days_remaining ?? item?.remaining_days);
const expiryLevel = String(item?.expiry_level || '').toLowerCase();
if (item?.category === 'expiry' && ((Number.isFinite(remainingDays) && remainingDays >= 0 && remainingDays <= 3) ||
['0_3', '0-3', '0~3', 'critical'].includes(expiryLevel))) {
return 100;
}
return severityRank[item?.severity] || 0;
};
const onNotificationChange = (event) => {
const index = Number(event?.detail?.current ?? event?.current ?? 0);
notificationPopupCurrent.value = index;
markNotificationRead(notificationItems.value[index]);
};
const closeNotificationPopup = () => {
notificationPopupShow.value = false;
};
onMounted(() => {
initCurrentMonth();
loadAssetInfo();
});
onShow(() => {
if (consumePendingPaymentRefresh(PAYMENT_REFRESH_TARGETS.HOME)) {
loadAssetInfo();
}
handleIndexEntry();
loadNotificationUnreadCount();
loadUnreadNotifications();
});
</script>
<style scoped lang="scss">
.wifi-popup {
width: 600rpx;
padding: var(--space-6);
border-radius: var(--radius-xl);
background: var(--bg-surface);
padding: 30rpx;
.title {
font-size: 34rpx;
font-weight: 700;
font-size: 32rpx;
font-weight: 600;
color: var(--text-primary);
margin-bottom: var(--space-5);
}
.wifi-input {
border: 2rpx solid var(--border-light);
border-radius: 8rpx;
padding: 8rpx 16rpx;
}
}
.bottom-spacer {
height: 140rpx;
height: 120rpx;
}
</style>
</style>

View File

@@ -1,63 +1,64 @@
<template>
<view class="login-page">
<view class="overlay"></view>
<view class="animated-bg">
<view class="circle circle-1"></view>
<view class="circle circle-2"></view>
<view class="circle circle-3"></view>
<view class="circle circle-4"></view>
<view class="circle circle-5"></view>
<view class="shape shape-triangle"></view>
<view class="shape shape-square"></view>
<view class="shape shape-pentagon"></view>
<view class="shape shape-hexagon"></view>
</view>
<view class="content-wrapper">
<view class="content">
<view class="header">
<view class="main-title">登录</view>
<view class="main-title">欢迎登录</view>
<view class="sub-title">请输入标识进行登录</view>
</view>
<view class="form-section">
<view class="input-wrap" :class="{ focus: inputFocus }">
<input
v-model="identifier"
class="input"
placeholder="请输入标识"
placeholder-class="placeholder"
@focus="inputFocus = true"
@blur="inputFocus = false"
@input="showError = false"
/>
</view>
<text v-if="showError" class="error">请输入标识</text>
</view>
<view class="btn-section">
<button
class="btn-login"
:class="{ disabled: !identifier || loading || !agreed }"
:disabled="!identifier || loading || !agreed"
@tap="handleLogin"
>
<view v-if="loading" class="loading">
<view class="dot"/>
<view class="dot"/>
<view class="dot"/>
<view class="form-section">
<view class="input-wrap" :class="{ focus: inputFocus }">
<input
v-model="identifier"
class="input"
placeholder="请输入标识"
placeholder-class="placeholder"
@focus="inputFocus = true"
@blur="handleBlur"
@input="showError = false"
/>
<image
v-if="identifier && inputFocus"
class="clear-icon"
src="/static/clear.png"
mode="aspectFit"
@mousedown.prevent="clearInput"
@touchstart.prevent="clearInput"
></image>
</view>
<text v-if="showError" class="error">请输入标识</text>
</view>
<view class="btn-section">
<button
class="btn-login"
:class="{ disabled: !identifier || loading || !agreed }"
:disabled="!identifier || loading || !agreed"
@tap="handleLogin"
>
<view v-if="loading" class="loading">
<view class="dot"/>
<view class="dot"/>
<view class="dot"/>
</view>
<text v-else>立即登录</text>
</button>
<button class="btn-scan" @tap="handleScanLogin">
<image src="/static/scan-code.png" mode="aspectFit" class="scan-icon"></image>
<text>扫一扫登录</text>
</button>
</view>
<view class="agreement">
<view class="agreement-text">
<text class="text">登录即表示同意</text>
<text class="link">用户协议</text>
<text class="text"></text>
<text class="link">隐私政策</text>
</view>
<text v-else>登录</text>
</button>
</view>
<view class="agreement">
<view class="agreement-text">
<text class="text">登录即表示同意</text>
<text class="link">用户协议</text>
<text class="text"></text>
<text class="link">隐私政策</text>
</view>
</view>
</view>
</view>
</view>
@@ -65,17 +66,73 @@
<script setup>
import { ref, onMounted } from 'vue';
import { authApi } from '@/api/index.js';
import { onHide, onShow, onUnload } from '@dcloudio/uni-app';
import { authApi, wechatApi } from '@/api/index.js';
import { useUserStore } from '@/store/index.js';
import { APP_ID, USE_WECHAT_AUTH } from '@/utils/env.js';
import { initWxConfig, wxScan, isInWechat } from '@/utils/wxsdk.js';
const POST_BIND_RELOGIN_NOTICE_KEY = 'postBindReloginNotice';
const userStore = useUserStore();
const identifier = ref('');
const identifier = ref(uni.getStorageSync('identifier') || '');
const loading = ref(false);
const agreed = ref(true);
const inputFocus = ref(false);
const showError = ref(false);
const wechatAppId = ref('');
const resetLoadingState = () => {
loading.value = false;
};
onMounted(async () => {
const token = uni.getStorageSync('token');
if (token) {
uni.reLaunch({ url: '/pages/index/index' });
return;
}
showPostBindReloginNotice();
handleWechatCallback();
getPathDeviceId();
// 初始化微信 SDK (仅在微信浏览器内执行)
// #ifdef H5
if (isInWechat()) {
try {
await initWxConfig();
console.log('微信 SDK 初始化成功');
} catch (e) {
console.error('微信 SDK 初始化失败', e);
}
}
// #endif
});
onShow(() => {
resetLoadingState();
});
onHide(() => {
resetLoadingState();
});
onUnload(() => {
resetLoadingState();
});
const showPostBindReloginNotice = () => {
if (uni.getStorageSync(POST_BIND_RELOGIN_NOTICE_KEY) !== '1') {
return;
}
uni.removeStorageSync(POST_BIND_RELOGIN_NOTICE_KEY);
uni.showToast({
title: '绑定手机号成功,请重新登录',
icon: 'none',
duration: 2500
});
};
const getCode = () => {
const params = new URLSearchParams(window.location.search);
@@ -86,13 +143,41 @@
window.history.replaceState({}, '', window.location.pathname);
};
const redirectToWxAuth = (assetToken) => {
const getWechatAppId = async () => {
if (wechatAppId.value) {
return wechatAppId.value;
}
const data = await wechatApi.getAppId();
if (!data || !data.app_id) {
uni.showToast({ title: '微信公众号配置缺失', icon: 'none' });
throw new Error('wechat app_id is empty');
}
wechatAppId.value = data.app_id;
return wechatAppId.value;
};
const redirectToWxAuth = async (assetToken) => {
sessionStorage.setItem('assetToken', assetToken);
const redirectUri = encodeURIComponent('https://cmp-c.boss160.cn/');
const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${APP_ID}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_userinfo&state=wechat_auth#wechat_redirect`;
const appId = await getWechatAppId();
const redirectUri = encodeURIComponent(window.location.origin + window.location.pathname);
const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_userinfo&state=wechat_auth#wechat_redirect`;
window.location.href = url;
};
const clearInput = () => {
identifier.value = '';
showError.value = false;
inputFocus.value = true;
};
const handleBlur = () => {
setTimeout(() => {
inputFocus.value = false;
}, 200);
};
const handleLogin = () => {
if (!identifier.value) {
showError.value = true;
@@ -101,37 +186,91 @@
doLogin();
};
const doLogin = async () => {
loading.value = true;
const parseScanIdentifier = (resultStr) => {
const scanValue = (resultStr || '').trim();
if (!scanValue) return '';
const barcodeMatch = scanValue.match(/^[A-Z0-9_]+,(.+)$/);
if (barcodeMatch) return barcodeMatch[1].trim();
if (scanValue.includes('?')) {
const params = new URLSearchParams(scanValue.split('?')[1]);
const queryValue = params.get('cardNum') || params.get('identifier');
if (queryValue) return queryValue;
}
const match = scanValue.match(/=([^=]+)$/);
return match ? match[1].trim() : scanValue;
};
const handleScanLogin = async () => {
// #ifdef H5
try {
const verifyData = await authApi.verifyAsset(identifier.value);
userStore.setAssetToken(verifyData.asset_token);
userStore.setIdentifier(identifier.value);
if (!USE_WECHAT_AUTH) {
const loginData = await authApi.wechatLogin(verifyData.asset_token, 'mock_code');
userStore.setToken(loginData.token);
uni.setStorageSync('identifier', userStore.state.identifier);
// 判断是否需要绑定手机号
if (loginData.need_bind_phone) {
uni.redirectTo({ url: '/pages/bind/bind?fromLogin=true' });
} else {
uni.redirectTo({ url: '/pages/index/index' });
}
// 检查是否在微信环境
if (!isInWechat()) {
uni.showToast({ title: '请在微信中打开', icon: 'none' });
return;
}
redirectToWxAuth(verifyData.asset_token);
// 调用扫一扫
const resultStr = await wxScan();
console.log('扫码结果:', resultStr);
const value = parseScanIdentifier(resultStr);
if (value) {
identifier.value = value;
handleLogin();
} else {
uni.showToast({ title: '无效的扫码内容', icon: 'none' });
}
} catch (err) {
console.error('扫码错误:', err);
// uni.showToast({ title: JSON.stringify(err), icon: 'none' });
}
// #endif
// #ifndef H5
uni.showToast({ title: '请在微信中打开', icon: 'none' });
// #endif
};
const getPathDeviceId = () => {
const params = new URLSearchParams(window.location.search);
const idf = params.get('identifier');
if (idf) {
identifier.value = idf;
handleLogin();
}
};
const doLogin = async () => {
loading.value = true;
// 丢弃上一轮未完成授权留下的临时凭证,避免校验失败时继续复用。
if (typeof sessionStorage !== 'undefined') {
sessionStorage.removeItem('assetToken');
}
try {
const verifyData = await authApi.verifyAsset(identifier.value);
if (!verifyData?.asset_token) {
throw { msg: '资产校验未返回有效登录凭证' };
}
userStore.setAssetToken(verifyData.asset_token);
userStore.setIdentifier(identifier.value);
await redirectToWxAuth(verifyData.asset_token);
} catch (e) {
console.error('登录失败', e);
uni.showToast({
title: e?.msg || e?.message || '资产校验失败,请稍后重试',
icon: 'none',
duration: 2500
});
loading.value = false;
}
};
const handleWechatCallback = async () => {
if (!USE_WECHAT_AUTH) return;
const code = getCode();
const assetToken = sessionStorage.getItem('assetToken');
@@ -145,44 +284,18 @@
userStore.setToken(loginData.token);
uni.setStorageSync('identifier', userStore.state.identifier);
// H5 环境获取微信用户信息
// #ifdef H5
try {
// 通过 uni.getUserProfile 获取用户信息(需要用户点击授权)
// 注意:这个方法在微信公众号 H5 中不可用,需要通过后端接口获取
// 这里暂时保存默认信息,实际应该由后端返回用户信息
if (loginData.user_info) {
userStore.setUserInfo({
avatar: loginData.user_info.avatar || '',
nickname: loginData.user_info.nickname || ''
});
}
} catch (err) {
console.log('获取用户信息失败', err);
}
// #endif
// #ifdef MP-WEIXIN
// 小程序环境可以直接获取用户信息
try {
const { userInfo } = await uni.getUserProfile({
desc: '用于完善用户资料'
});
if (loginData.user_info) {
userStore.setUserInfo({
avatar: userInfo.avatarUrl || '',
nickname: userInfo.nickName || ''
avatar: loginData.user_info.avatar || '',
nickname: loginData.user_info.nickname || ''
});
} catch (err) {
console.log('用户取消授权');
}
// #endif
// 判断是否需要绑定手机号
if (loginData.need_bind_phone) {
// 需要绑定手机号,跳转到绑定页面
uni.redirectTo({ url: '/pages/bind/bind?fromLogin=true' });
} else {
// 不需要绑定,直接进入首页
uni.redirectTo({ url: '/pages/index/index' });
}
} catch (e) {
@@ -190,343 +303,172 @@
loading.value = false;
}
};
onMounted(() => {
handleWechatCallback();
});
</script>
<style lang="scss" scoped>
.login-page {
position: relative;
display: flex;
flex-direction: column;
background: linear-gradient(135deg, #005cbf 0%, #007aff 50%, #4da6ff 100%);
align-items: center;
justify-content: center;
min-height: 100vh;
}
.overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
z-index: 0;
}
.animated-bg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: 0;
}
.circle {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(2px);
}
.circle-1 {
width: 300rpx;
height: 300rpx;
top: 10%;
left: -100rpx;
animation: float1 20s infinite ease-in-out;
}
.circle-2 {
width: 200rpx;
height: 200rpx;
top: 60%;
right: -50rpx;
animation: float2 15s infinite ease-in-out;
}
.circle-3 {
width: 150rpx;
height: 150rpx;
top: 30%;
right: 20%;
animation: float3 18s infinite ease-in-out;
}
.circle-4 {
width: 250rpx;
height: 250rpx;
bottom: 10%;
left: 10%;
animation: float4 22s infinite ease-in-out;
}
.circle-5 {
width: 180rpx;
height: 180rpx;
top: 50%;
left: 50%;
animation: float5 16s infinite ease-in-out;
}
@keyframes float1 {
0%, 100% {
transform: translate(0, 0) scale(1);
opacity: 0.3;
}
50% {
transform: translate(100rpx, -80rpx) scale(1.2);
opacity: 0.5;
}
}
@keyframes float2 {
0%, 100% {
transform: translate(0, 0) scale(1);
opacity: 0.2;
}
50% {
transform: translate(-80rpx, 100rpx) scale(1.3);
opacity: 0.4;
}
}
@keyframes float3 {
0%, 100% {
transform: translate(0, 0) scale(1);
opacity: 0.25;
}
50% {
transform: translate(-60rpx, -60rpx) scale(1.1);
opacity: 0.45;
}
}
@keyframes float4 {
0%, 100% {
transform: translate(0, 0) scale(1);
opacity: 0.3;
}
50% {
transform: translate(120rpx, -100rpx) scale(1.15);
opacity: 0.5;
}
}
@keyframes float5 {
0%, 100% {
transform: translate(-50%, -50%) scale(1);
opacity: 0.2;
}
50% {
transform: translate(calc(-50% + 80rpx), calc(-50% + 80rpx)) scale(1.25);
opacity: 0.4;
}
}
.shape {
position: absolute;
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(1px);
}
.shape-triangle {
width: 0;
height: 0;
background: transparent;
border-left: 80rpx solid transparent;
border-right: 80rpx solid transparent;
border-bottom: 140rpx solid rgba(255, 255, 255, 0.1);
top: 15%;
right: 15%;
animation: rotate1 25s infinite linear;
}
.shape-square {
width: 120rpx;
height: 120rpx;
top: 70%;
left: 5%;
transform: rotate(45deg);
animation: float-rotate 20s infinite ease-in-out;
}
.shape-pentagon {
width: 100rpx;
height: 100rpx;
clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
top: 40%;
left: 80%;
animation: pulse 18s infinite ease-in-out;
}
.shape-hexagon {
width: 90rpx;
height: 90rpx;
clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
bottom: 25%;
right: 25%;
animation: float-spin 22s infinite ease-in-out;
}
@keyframes rotate1 {
0% {
transform: rotate(0deg);
opacity: 0.15;
}
50% {
opacity: 0.25;
}
100% {
transform: rotate(360deg);
opacity: 0.15;
}
}
@keyframes float-rotate {
0%, 100% {
transform: translate(0, 0) rotate(45deg);
opacity: 0.2;
}
50% {
transform: translate(80rpx, -60rpx) rotate(225deg);
opacity: 0.35;
}
}
@keyframes pulse {
0%, 100% {
transform: scale(1);
opacity: 0.2;
}
50% {
transform: scale(1.3);
opacity: 0.4;
}
}
@keyframes float-spin {
0%, 100% {
transform: translate(0, 0) rotate(0deg);
opacity: 0.25;
}
50% {
transform: translate(-70rpx, 90rpx) rotate(180deg);
opacity: 0.4;
}
background: var(--bg-secondary);
max-width: 750rpx;
margin: 0 auto;
width: 100%;
padding: 40rpx;
box-sizing: border-box;
}
.content-wrapper {
position: relative;
width: 100%;
}
.content {
background: var(--bg-primary);
border-radius: var(--radius-large);
padding: 60rpx 40rpx;
z-index: 1;
box-shadow: var(--shadow-medium);
}
.header {
margin-bottom: 80rpx;
text-align: center;
margin-bottom: 60rpx;
}
.main-title {
font-size: 56rpx;
font-size: 48rpx;
font-weight: 700;
color: #FFFFFF;
color: var(--text-primary);
line-height: 1.3;
margin-bottom: 24rpx;
letter-spacing: 0.5rpx;
text-shadow: 0 2rpx 8rpx rgba(64, 40, 128, 0.3);
margin-bottom: 16rpx;
letter-spacing: -0.5rpx;
}
.sub-title {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
font-size: 26rpx;
color: var(--text-tertiary);
line-height: 1.5;
letter-spacing: 0.5rpx;
text-shadow: 0 1rpx 4rpx rgba(64, 40, 128, 0.2);
}
.form-section {
margin-bottom: 60rpx;
margin-bottom: 48rpx;
}
.input-wrap {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.95);
border-radius: 20rpx;
padding: 32rpx 40rpx;
transition: all 0.3s;
box-shadow: 0 4rpx 16rpx rgba(64, 40, 128, 0.1);
gap: 16rpx;
background: var(--bg-secondary);
border: 2rpx solid var(--border-color);
border-radius: var(--radius-medium);
padding: 28rpx 32rpx;
transition: all 0.3s ease;
}
.input-wrap.focus {
background: rgba(255, 255, 255, 1);
box-shadow: 0 4rpx 20rpx rgba(64, 40, 128, 0.2);
background: var(--bg-primary);
border-color: var(--primary);
box-shadow: 0 0 0 4rpx rgba(85, 171, 92, 0.1);
}
.input {
flex: 1;
font-size: 32rpx;
color: #1A1A1A;
font-size: 30rpx;
color: var(--text-primary);
background: transparent;
}
.placeholder {
color: #C4C4C4;
color: var(--text-quaternary);
}
.clear-icon {
width: 32rpx;
height: 32rpx;
opacity: 0.4;
transition: opacity 0.3s ease;
cursor: pointer;
flex-shrink: 0;
}
.clear-icon:active {
opacity: 0.6;
}
.error {
font-size: 24rpx;
color: #EF4444;
color: var(--danger);
margin-top: 16rpx;
padding-left: 8rpx;
}
.btn-section {
margin-bottom: 60rpx;
margin-bottom: 48rpx;
}
.btn-login {
width: 100%;
height: 108rpx;
background: rgba(255, 255, 255, 0.25);
backdrop-filter: blur(10px);
border: 2rpx solid rgba(255, 255, 255, 0.4);
border-radius: 20rpx;
font-size: 36rpx;
height: 96rpx;
background: var(--primary);
border: none;
border-radius: var(--radius-medium);
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
color: var(--text-inverse);
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.15);
transition: all 0.3s ease;
box-shadow: 0 4rpx 12rpx rgba(85, 171, 92, 0.2);
}
.btn-login.disabled {
background: rgba(255, 255, 255, 0.3);
color: rgba(255, 255, 255, 0.7);
border: 2rpx solid rgba(255, 255, 255, 0.2);
background: var(--gray-300);
color: var(--text-quaternary);
box-shadow: none;
}
.btn-login:active:not(.disabled) {
opacity: 0.8;
transform: translateY(2rpx);
box-shadow: 0 2rpx 8rpx rgba(85, 171, 92, 0.2);
}
.btn-scan {
width: 100%;
height: 88rpx;
background: var(--bg-primary);
border: 2rpx solid var(--primary);
border-radius: var(--radius-medium);
font-size: 30rpx;
font-weight: 500;
color: var(--primary);
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
margin-top: 24rpx;
transition: all 0.3s ease;
}
.btn-scan:active {
background: rgba(85, 171, 92, 0.05);
}
.scan-icon {
width: 40rpx;
height: 40rpx;
}
.loading {
display: flex;
align-items: center;
gap: 8rpx;
gap: 12rpx;
}
.dot {
width: 10rpx;
height: 10rpx;
background: #FFFFFF;
width: 12rpx;
height: 12rpx;
background: var(--text-inverse);
border-radius: 50%;
animation: load 1.4s infinite ease-in-out both;
}
@@ -563,14 +505,13 @@
}
.text {
color: rgba(255, 255, 255, 0.8);
color: var(--text-tertiary);
white-space: nowrap;
}
.link {
color: #FFFFFF;
color: var(--primary);
font-weight: 500;
white-space: nowrap;
text-decoration: underline;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,178 @@
<template>
<view class="container">
<view class="toolbar flex-row-sb">
<view class="summary"> {{ total }} 条通知</view>
<button class="btn-apple btn-secondary mark-all" :disabled="unreadCount === 0" @tap="markAllRead">
全部已读
</button>
</view>
<view v-if="!notificationsLoaded || (loading && notifications.length === 0)" class="loading-state">
<up-loading-icon text="加载中" size="30"></up-loading-icon>
</view>
<view v-else-if="notifications.length === 0" class="empty-state">
<image src="/static/notification.png" mode="aspectFit" class="empty-icon" />
<view class="empty-title">暂无通知</view>
<view class="empty-desc">当前没有可查看的业务通知</view>
</view>
<view v-else class="notification-list">
<view v-for="item in notifications" :key="item.id" class="card notification-card"
:class="{ unread: !item.is_read }" @tap="markItemRead(item)">
<view class="notification-header flex-row-sb">
<view class="notification-title">{{ item.title || '业务通知' }}</view>
<view v-if="!item.is_read" class="unread-dot"></view>
</view>
<view class="notification-body">{{ item.body || '-' }}</view>
<view class="notification-footer flex-row-sb">
<view class="notification-meta">{{ getCategoryText(item.category) }} · {{ getSeverityText(item.severity) }}</view>
<view class="notification-time">{{ formatDate(item.created_at) }}</view>
</view>
</view>
</view>
<view v-if="notifications.length > 0" class="load-more" @tap="loadMore">
<text v-if="loading">加载中...</text>
<text v-else-if="noMore">没有更多了</text>
<text v-else>点击加载更多</text>
</view>
</view>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { notificationApi } from '@/api/index.js';
const pageSize = 20;
const notifications = reactive([]);
const page = ref(1);
const total = ref(0);
const unreadCount = ref(0);
const loading = ref(false);
const notificationsLoaded = ref(false);
const noMore = ref(false);
const formatDate = (value) => {
if (!value) return '-';
return value.replace('T', ' ').slice(0, 16);
};
const getCategoryText = (category) => ({
approval: '审批',
expiry: '临期',
exchange: '换货',
sync: '同步',
system: '系统'
}[category] || '通知');
const getSeverityText = (severity) => ({
info: '提示',
warning: '警告',
error: '错误',
critical: '严重'
}[severity] || '提示');
const getNotificationPriority = (item) => {
const severityRank = { info: 10, warning: 20, error: 30, critical: 40 };
const remainingDays = Number(item?.days_until_expiry ?? item?.days_remaining ?? item?.remaining_days);
const expiryLevel = String(item?.expiry_level || '').toLowerCase();
if (item?.category === 'expiry' && ((Number.isFinite(remainingDays) && remainingDays >= 0 && remainingDays <= 3) ||
['0_3', '0-3', '0~3', 'critical'].includes(expiryLevel))) {
return 100;
}
return severityRank[item?.severity] || 0;
};
const loadUnreadCount = async () => {
try {
const data = await notificationApi.getUnreadCount();
unreadCount.value = Number(data?.count || 0);
} catch (error) {
console.error('加载通知未读数失败', error);
}
};
const loadNotifications = async (append = false) => {
if (loading.value || (append && noMore.value)) return;
loading.value = true;
try {
const data = await notificationApi.getList(page.value, pageSize);
const items = (data?.items || []).sort((a, b) => getNotificationPriority(b) - getNotificationPriority(a));
if (append) {
notifications.push(...items);
} else {
notifications.splice(0, notifications.length, ...items);
}
total.value = Number(data?.total || 0);
noMore.value = notifications.length >= total.value || items.length < pageSize;
if (!noMore.value) page.value += 1;
} catch (error) {
console.error('加载通知列表失败', error);
} finally {
loading.value = false;
notificationsLoaded.value = true;
}
};
const markItemRead = async (item) => {
if (item.is_read) return;
try {
await notificationApi.markRead(item.id);
item.is_read = true;
item.read_at = new Date().toISOString();
unreadCount.value = Math.max(unreadCount.value - 1, 0);
} catch (error) {
console.error('标记通知已读失败', error);
}
};
const markAllRead = async () => {
if (!unreadCount.value) return;
try {
await notificationApi.markAllRead();
notifications.forEach(item => {
item.is_read = true;
item.read_at = item.read_at || new Date().toISOString();
});
unreadCount.value = 0;
uni.showToast({ title: '已全部标记为已读', icon: 'success' });
} catch (error) {
console.error('全部标记通知已读失败', error);
}
};
const loadMore = () => {
if (!noMore.value) loadNotifications(true);
};
onMounted(() => {
loadNotifications();
loadUnreadCount();
});
onShow(() => {
loadUnreadCount();
});
</script>
<style lang="scss" scoped>
.container { padding-bottom: 40rpx; }
.toolbar { margin-bottom: var(--space-md); }
.summary { color: var(--text-tertiary); font-size: 24rpx; }
.mark-all { margin: 0; padding: 0 24rpx; height: 64rpx; line-height: 64rpx; font-size: 24rpx; }
.notification-card { margin-bottom: var(--space-md); border-left: 6rpx solid transparent; }
.notification-card.unread { border-left-color: var(--primary); }
.notification-header { margin-bottom: var(--space-sm); }
.notification-title { color: var(--text-primary); font-size: 30rpx; font-weight: 600; flex: 1; }
.unread-dot { width: 14rpx; height: 14rpx; margin-left: 16rpx; border-radius: 50%; background: var(--primary); }
.notification-body { color: var(--text-secondary); font-size: 26rpx; line-height: 1.6; white-space: pre-wrap; }
.notification-footer { margin-top: var(--space-md); }
.notification-meta, .notification-time { color: var(--text-tertiary); font-size: 22rpx; }
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 140rpx 40rpx; }
.loading-state { display: flex; align-items: center; justify-content: center; min-height: 400rpx; }
.empty-icon { width: 100rpx; height: 100rpx; opacity: 0.6; margin-bottom: 24rpx; }
.empty-title { color: var(--text-primary); font-size: 30rpx; font-weight: 600; }
.empty-desc { color: var(--text-tertiary); font-size: 24rpx; margin-top: 12rpx; }
.load-more { padding: var(--space-lg); color: var(--text-tertiary); text-align: center; font-size: 24rpx; }
</style>

View File

@@ -1,118 +1,109 @@
<template>
<view class="container">
<view class="filter-tabs">
<view v-for="(item, index) in filterOptions" :key="index" class="tab-item"
:class="{ active: filterIndex === index }" @tap="onFilterChange(index)">
<view class="filter-tab-indicator" :style="filterIndicatorStyle"></view>
<view
v-for="(item, index) in filterOptions"
:key="index"
class="tab-item"
:class="{ active: filterIndex === index }"
@tap="onFilterChange(index)"
>
{{ item.label }}
<view v-if="filterIndex === index" class="tab-line"></view>
</view>
</view>
<view v-if="orderList.length === 0 && !loading" class="empty-state">
<view class="empty-icon">📋</view>
<view class="empty-title">暂无订单</view>
<view class="empty-desc">当前账号下暂无订单信息</view>
</view>
<view v-if="!ordersLoaded || (loading && orderList.length === 0)" class="loading-state">
<up-loading-icon text="加载中" size="30"></up-loading-icon>
</view>
<view v-else-if="orderList.length === 0" class="empty-state">
<image class="empty-icon" src="/static/order.png" mode="aspectFit" alt="我的订单"></image>
<view class="empty-title">暂无订单</view>
<view class="empty-desc">当前账号下暂无订单信息</view>
</view>
<scroll-view v-else scroll-y class="order-scroll" @scrolltolower="loadMore">
<view class="order-card" v-for="(item, index) in orderList" :key="index">
<view class="card-header">
<view class="header-left">
<view class="header-row">
<text class="field-tag">订单号</text>
<text class="order-no">{{ item.order_no }}</text>
<view v-else class="order-list">
<view class="order-card" v-for="item in orderList" :key="item.order_id">
<view class="card-header">
<view class="order-number" @tap.stop="copyOrderNo(item.order_no)">
<text class="order-no">{{ item.order_no || '-' }}</text>
<image class="copy-icon" src="/static/复制.png" mode="aspectFit"></image>
</view>
</view>
<view class="status-badge" :class="getStatusClass(item.payment_status)">
{{ item.payment_status_name }}
</view>
</view>
<view class="card-body">
<view class="info-grid">
<view class="info-item">
<view class="info-label">订单时间</view>
<view class="info-value">{{ item.created_at }}</view>
</view>
<view class="info-item">
<view class="info-label">订单金额</view>
<view class="info-value amount">¥{{ formatMoney(item.total_amount) }}</view>
<view class="status-badge" :class="getStatusClass(item.payment_status)">
{{ item.payment_status_name }}
</view>
</view>
<view class="divider"></view>
<view class="card-body">
<view class="package-row">
<view class="package-content">
<view class="package-name">{{ getPackageNamesText(item) }}</view>
<view class="package-desc">高速流量 · 全国通用 · 不限速</view>
</view>
<view class="order-amount">¥{{ formatMoney(item.total_amount) }}</view>
</view>
<view class="package-section">
<view class="section-label">套餐名称</view>
<view class="package-list">
<view class="package-item" v-for="(pkgName, pIndex) in item.package_names" :key="pIndex">
<text class="package-name">{{ pkgName }}</text>
<view class="card-divider"></view>
<view class="card-footer">
<view class="created-time">下单时间{{ item.created_at || '-' }}</view>
<view class="order-actions">
<button v-if="item.payment_status === 1" class="order-action-button primary-action-button"
@tap.stop="showOrderPaymentMethods(item)">
立即支付
</button>
<button v-if="item.payment_status === 2" class="order-action-button primary-action-button"
@tap.stop="startOrderRenewal(item)">立即续费</button>
</view>
</view>
</view>
</view>
<view v-if="item.payment_status === 1" class="card-footer">
<button class="btn-pay" @tap="handleOrderPayment(item)">立即支付</button>
</view>
<view class="load-more" v-if="orderList.length > 0">
<text v-if="loading">加载中...</text>
<text v-else-if="noMore">没有更多了</text>
<text v-else>上拉加载更多</text>
</view>
</view>
<view class="load-more" v-if="orderList.length > 0">
<text v-if="loading">加载中...</text>
<text v-else-if="noMore">没有更多了</text>
<text v-else>上拉加载更多</text>
</view>
</scroll-view>
<RenewalPaymentPopup ref="renewalPopupRef" :identifier="userStore.state.identifier"
paymentRefreshTarget="order-list" @completed="resetOrderListAndLoad" />
</view>
</template>
<script setup>
import { ref, reactive, computed, onMounted } from 'vue';
import { onReachBottom, onShow } from '@dcloudio/uni-app';
import { orderApi } from '@/api/index.js';
import RenewalPaymentPopup from '@/components/RenewalPaymentPopup.vue';
import { useUserStore } from '@/store/index.js';
import {
ref,
reactive,
onMounted
} from 'vue';
import {
orderApi
} from '@/api/index.js';
import {
useUserStore
} from '@/store/index.js';
consumePendingPaymentRefresh,
PAYMENT_REFRESH_TARGETS
} from '@/utils/payment.js';
import { formatMoney } from '@/utils/display.js';
const userStore = useUserStore();
let orderList = reactive([]);
let loading = ref(false);
let noMore = ref(false);
let page = ref(1);
const orderList = reactive([]);
const loading = ref(false);
const ordersLoaded = ref(false);
const noMore = ref(false);
const page = ref(1);
const renewalPopupRef = ref(null);
const pageSize = 10;
let filterIndex = ref(0);
let filterOptions = [{
label: '全部',
value: null
},
{
label: '待支付',
value: 1
},
{
label: '已支付',
value: 2
},
{
label: '已取消',
value: 3
},
{
label: '已退款',
value: 4
}
const filterIndex = ref(0);
const filterOptions = [
{ label: '全部', value: null },
{ label: '待支付', value: 1 },
{ label: '已支付', value: 2 },
{ label: '已取消', value: 3 },
{ label: '已退款', value: 4 }
];
const formatMoney = (amount) => {
if (!amount && amount !== 0) return '0.00';
return (amount / 100).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
};
const filterIndicatorStyle = computed(() => ({
left: `calc(${filterIndex.value * 20}% + 8rpx)`
}));
const getStatusClass = (status) => {
const classMap = {
@@ -124,17 +115,36 @@
return classMap[status] || '';
};
const onFilterChange = (index) => {
filterIndex.value = index;
const resetOrderListAndLoad = () => {
page.value = 1;
noMore.value = false;
loadOrderList();
};
const loadOrderList = async (append = false) => {
if (loading.value || noMore.value) return;
loading.value = true;
const scheduleOrderStatusRefresh = () => {
uni.showToast({
title: '正在同步支付状态',
icon: 'none'
});
resetOrderListAndLoad();
setTimeout(() => {
resetOrderListAndLoad();
}, 1500);
setTimeout(() => {
resetOrderListAndLoad();
}, 3000);
};
const onFilterChange = (index) => {
if (filterIndex.value === index) return;
filterIndex.value = index;
resetOrderListAndLoad();
};
const loadOrderList = async (append = false) => {
if (loading.value || (append && noMore.value)) return;
loading.value = true;
const paymentStatus = filterOptions[filterIndex.value].value;
try {
@@ -145,11 +155,17 @@
paymentStatus
);
const newData = (data.items || []).map(item => ({
const newData = (data.items || []).map((item) => ({
...item,
payment_status_name: item.payment_status === 1 ? '待支付' : item.payment_status === 2 ?
'已支付' : item.payment_status === 3 ? '已取消' : item.payment_status === 4 ? '已退款' :
'未知',
payment_status_name: item.payment_status === 1
? '待支付'
: item.payment_status === 2
? '已支付'
: item.payment_status === 3
? '已取消'
: item.payment_status === 4
? '已退款'
: '未知',
created_at: item.created_at ? item.created_at.split('T').join(' ').slice(0, 19) : ''
}));
@@ -162,12 +178,14 @@
if (newData.length < pageSize) {
noMore.value = true;
} else {
page.value++;
page.value += 1;
}
} catch (e) {
console.error('加载订单列表失败', e);
} catch (error) {
console.error('加载订单列表失败', error);
}
loading.value = false;
ordersLoaded.value = true;
};
const loadMore = () => {
@@ -176,131 +194,80 @@
}
};
const handleOrderPayment = async (order) => {
uni.showLoading({
title: '处理中...',
mask: true
});
try {
const payData = await orderApi.pay(order.order_id, 'wechat');
uni.hideLoading();
if (!payData.pay_config || !payData.pay_config.package) {
uni.showToast({
title: '支付参数获取失败',
icon: 'none'
});
return;
}
// #ifdef H5
if (typeof WeixinJSBridge === 'undefined') {
uni.showToast({
title: '请在微信中打开',
icon: 'none'
});
return;
}
WeixinJSBridge.invoke('getBrandWCPayRequest', {
appId: payData.pay_config.app_id,
timeStamp: payData.pay_config.timestamp,
nonceStr: payData.pay_config.nonce_str,
package: payData.pay_config.package,
signType: payData.pay_config.sign_type,
paySign: payData.pay_config.pay_sign
}, function(res) {
if (res.err_msg === 'get_brand_wcpay_request:ok') {
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(() => {
page.value = 1;
noMore.value = false;
loadOrderList();
}, 1500);
} else if (res.err_msg === 'get_brand_wcpay_request:cancel') {
uni.showToast({
title: '已取消支付',
icon: 'none'
});
} else {
uni.showToast({
title: '支付失败',
icon: 'none'
});
}
});
// #endif
// #ifndef H5
uni.requestPayment({
timeStamp: payData.pay_config.timestamp,
nonceStr: payData.pay_config.nonce_str,
package: payData.pay_config.package,
signType: payData.pay_config.sign_type,
paySign: payData.pay_config.pay_sign,
success: () => {
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(() => {
page.value = 1;
noMore.value = false;
loadOrderList();
}, 1500);
},
fail: (err) => {
if (err.errMsg && (err.errMsg.includes('cancel') || err.errMsg.includes('用户取消'))) {
uni.showToast({
title: '已取消支付',
icon: 'none'
});
} else {
uni.showToast({
title: '支付失败',
icon: 'none'
});
}
}
});
// #endif
} catch (e) {
uni.hideLoading();
console.error('支付失败', e);
const errorMsg = e.msg || e.message || '支付失败,请稍后重试';
uni.showToast({
title: errorMsg,
icon: 'none'
});
}
const getPackageNamesText = (order) => {
const packageNames = Array.isArray(order?.package_names)
? order.package_names.filter(Boolean)
: [];
return packageNames.join('、') || '-';
};
const copyOrderNo = (orderNo) => {
if (!orderNo) return;
uni.setClipboardData({
data: String(orderNo),
success: () => uni.showToast({ title: '订单号已复制', icon: 'success' })
});
};
const startOrderRenewal = (order) => {
const packageIds = Array.isArray(order?.package_ids) ? order.package_ids.filter(Boolean) : [];
if (!packageIds.length) {
uni.showToast({ title: '当前订单暂无可续费套餐', icon: 'none' });
return;
}
const packageNames = Array.isArray(order.package_names) ? order.package_names : [];
renewalPopupRef.value?.open(packageIds, packageNames);
};
const showOrderPaymentMethods = (order) => {
if (!order?.order_id) return;
const packageNames = Array.isArray(order.package_names) ? order.package_names : [];
if (String(order.payment_method || '').toLowerCase() === 'wallet') {
renewalPopupRef.value?.payOrderDirectly(order.order_id, 'wallet');
return;
}
renewalPopupRef.value?.openOrderPayment(order.order_id, packageNames);
};
onShow(() => {
if (!consumePendingPaymentRefresh(PAYMENT_REFRESH_TARGETS.ORDER_LIST)) {
return;
}
scheduleOrderStatusRefresh();
});
onMounted(() => {
loadOrderList();
});
onReachBottom(() => {
loadMore();
});
</script>
<style lang="scss" scoped>
.container {
height: 100vh;
display: flex;
flex-direction: column;
background: #f5f6f7;
gap: 0;
background: var(--bg-secondary);
max-width: 750rpx;
margin: 0 auto;
width: 100%;
box-sizing: border-box;
min-height: 100vh;
padding: 0 0 48rpx;
}
.filter-tabs {
display: flex;
background: #fff;
position: sticky;
top: 0;
border-radius: 10rpx;
z-index: 10;
border-radius: 20rpx;
z-index: 100;
flex-shrink: 0;
margin: 20rpx 24rpx 0;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
.tab-item {
position: relative;
@@ -324,16 +291,12 @@
transform: translateX(-50%);
width: 48rpx;
height: 6rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background: var(--primary);
border-radius: 3rpx;
}
}
}
.order-scroll {
flex: 1;
}
.empty-state {
display: flex;
flex-direction: column;
@@ -342,7 +305,8 @@
padding: 200rpx 40rpx;
.empty-icon {
font-size: 120rpx;
width: 120rpx;
height: 120rpx;
margin-bottom: 30rpx;
opacity: 0.6;
}
@@ -401,12 +365,6 @@
color: #333;
font-family: monospace;
}
.order-id {
font-size: 24rpx;
color: #666;
font-family: monospace;
}
}
.card-body {
@@ -414,19 +372,26 @@
.info-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20rpx;
grid-template-columns: 1fr;
gap: 16rpx;
.info-item {
display: flex;
align-items: baseline;
gap: 8rpx;
.info-label {
font-size: 22rpx;
color: #999;
margin-bottom: 8rpx;
flex-shrink: 0;
}
.info-value {
font-size: 26rpx;
color: #333;
flex: 1;
min-width: 0;
word-break: break-all;
&.amount {
color: #ff6b6b;
@@ -437,53 +402,28 @@
}
}
.divider {
height: 1rpx;
background: #f5f5f5;
margin: 24rpx 0;
}
.package-section {
.section-label {
font-size: 22rpx;
color: #999;
margin-bottom: 16rpx;
}
.package-list {
.package-item {
display: flex;
align-items: center;
gap: 12rpx;
padding: 8rpx 0;
.package-name {
font-size: 26rpx;
color: #333;
}
}
}
}
.card-footer {
margin-top: 24rpx;
padding-top: 24rpx;
border-top: 1rpx solid #f0f0f0;
display: flex;
justify-content: flex-end;
flex-direction: column;
gap: 16rpx;
.btn-pay {
background: #1890ff;
color: #fff;
border: none;
border-radius: 20rpx;
padding: 16rpx 40rpx;
font-size: 26rpx;
font-weight: 500;
width:100%;
.order-action-button {
width: 100%;
min-width: 0;
margin: 0;
}
&::after {
border: none;
.payment-action-buttons {
display: flex;
width: 100%;
gap: 16rpx;
.order-action-button {
flex: 1;
width: 0;
}
}
}
@@ -502,8 +442,8 @@
}
&.tag-success {
background: #e6f7ff;
color: #1890ff;
background: #eaf6ec;
color: var(--primary);
}
&.tag-secondary {
@@ -523,4 +463,296 @@
color: #999;
font-size: 24rpx;
}
</style>
.loading-state {
display: flex;
align-items: center;
justify-content: center;
min-height: 500rpx;
}
/* Screenshot-aligned order list skin */
.container {
position: fixed;
top: 88rpx;
right: 0;
bottom: 0;
left: 0;
background: #f8f9fb;
padding: 0;
gap: 0;
padding-top: 0;
height: auto;
min-height: 0;
overflow: hidden;
}
.filter-tabs {
display: flex;
align-items: stretch;
flex-shrink: 0;
margin-top: 0;
padding: 0 20rpx;
background: #fff;
border-radius: 0;
border-bottom: 1rpx solid #f0f1f3;
box-shadow: none;
overflow: hidden;
}
.filter-tabs .tab-item {
position: relative;
flex: 1;
min-width: 128rpx;
padding: 28rpx 12rpx 24rpx;
color: #777b84;
font-size: 28rpx;
text-align: center;
white-space: nowrap;
box-sizing: border-box;
}
.filter-tabs .tab-item.active {
color: var(--primary);
font-size: 28rpx;
font-weight: 600;
}
.filter-tabs .tab-line {
bottom: 0;
width: 42rpx;
height: 6rpx;
background: var(--primary);
border-radius: 8rpx;
}
.container .filter-tabs {
position: relative;
margin-top: 0;
padding: 8rpx;
background: #fff;
border: 0;
border-radius: 16rpx;
overflow: hidden;
}
.container .filter-tabs .tab-item {
position: relative;
z-index: 1;
min-width: 0;
padding: 20rpx 4rpx;
color: var(--text-tertiary);
font-size: 26rpx;
transition: color 0.3s;
}
.container .filter-tabs .tab-item.active {
background: transparent;
color: #fff;
font-size: 26rpx;
font-weight: 600;
}
.filter-tab-indicator {
position: absolute;
top: 8rpx;
width: calc(20% - 16rpx);
height: calc(100% - 16rpx);
background: var(--primary);
border-radius: 12rpx;
transition: left 0.3s ease;
z-index: 0;
}
.order-list {
padding: 20rpx 24rpx 48rpx;
box-sizing: border-box;
}
.order-card {
margin-bottom: 20rpx;
padding: 0 32rpx;
background: #fff;
border: 1rpx solid #f0f1f3;
border-radius: 18rpx;
box-shadow: 0 6rpx 18rpx rgba(31, 35, 41, 0.04);
box-sizing: border-box;
}
.order-card .card-header {
align-items: center;
padding: 32rpx 0 24rpx;
border-bottom: 0;
}
.order-number {
display: flex;
align-items: center;
min-width: 0;
color: #777b84;
font-size: 26rpx;
}
.order-no {
max-width: 410rpx;
overflow: hidden;
color: #777b84;
font-size: 26rpx;
text-overflow: ellipsis;
white-space: nowrap;
}
.copy-icon {
width: 30rpx;
height: 30rpx;
margin-left: 14rpx;
flex-shrink: 0;
}
.order-card .card-body {
padding: 0 0 28rpx;
}
.package-row {
display: flex;
align-items: center;
min-width: 0;
gap: 20rpx;
}
.package-content {
min-width: 0;
flex: 1;
}
.package-name {
color: #16181c;
font-size: 30rpx;
font-weight: 600;
line-height: 1.25;
word-break: break-all;
}
.package-desc {
margin-top: 14rpx;
color: #8b9099;
font-size: 23rpx;
line-height: 1.35;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.order-amount {
align-self: center;
color: #ff302f;
font-size: 30rpx;
font-weight: 600;
white-space: nowrap;
}
.card-divider {
height: 1rpx;
margin: 28rpx 0 20rpx;
background: #edf0f2;
}
.order-card .card-footer {
display: flex;
align-items: stretch;
justify-content: flex-start;
gap: 16rpx;
margin-top: 0;
padding: 0 0 28rpx;
border-top: 0;
flex-direction: column;
}
.order-card .card-body .card-footer {
display: flex;
flex-direction: column;
align-items: stretch;
justify-content: flex-start;
gap: 16rpx;
margin-top: 0;
padding: 0 0 28rpx;
border-top: 0;
}
.created-time {
width: 100%;
min-width: 0;
flex: none;
color: #777b84;
font-size: 24rpx;
line-height: 1.3;
text-align: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.order-actions {
display: flex;
align-items: center;
justify-content: flex-end;
width: 100%;
gap: 16rpx;
margin-left: 0;
align-self: flex-end;
flex-shrink: 0;
}
.order-card .order-action-button {
width: 180rpx;
height: 58rpx;
min-width: 0;
margin: 0;
padding: 0 16rpx;
border: 1rpx solid transparent;
border-radius: 12rpx;
font-size: 25rpx;
font-weight: 500;
line-height: 56rpx;
box-sizing: border-box;
white-space: nowrap;
-webkit-tap-highlight-color: transparent;
&::after { border: none; }
}
.order-card .card-body .card-footer .order-action-button {
width: 180rpx;
height: 58rpx;
min-width: 0;
margin: 0;
padding: 0 16rpx;
line-height: 56rpx;
}
.primary-action-button {
border-color: var(--primary);
background: var(--primary);
color: #fff;
}
.order-card .status-badge {
padding: 0 0 0 16rpx;
background: transparent;
border-radius: 0;
font-size: 25rpx;
font-weight: 500;
white-space: nowrap;
}
.order-card .status-badge.tag-warning { color: #f08a00; }
.order-card .status-badge.tag-success { color: var(--primary); }
.order-card .status-badge.tag-secondary { color: #7d828b; }
.order-card .status-badge.tag-info { color: #666d78; }
.load-more {
padding: 24rpx 32rpx 40rpx;
color: #9aa0aa;
font-size: 23rpx;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,39 +1,56 @@
<template>
<view class="container">
<view v-if="mchList.length === 0 && !loading" class="empty-state">
<view class="empty-icon">📡</view>
<view v-if="!cardsLoaded || (loading && mchList.length === 0)" class="loading-state">
<up-loading-icon text="加载中" size="30"></up-loading-icon>
</view>
<view v-else-if="mchList.length === 0" class="empty-state">
<image class="empty-icon" src="/static/change.png" mode="aspectFit" alt="切换运营商"></image>
<view class="empty-title">运营商列表为空</view>
<view class="empty-desc">当前设备暂无可切换的运营商</view>
</view>
<view class="card" v-for="item in mchList" :key="item.iccid">
<view class="flex-row-sb mt-30">
<view class="flex-row-g20">
<view class="logo">
<image :src="getLogo(item.category).logo" mode="aspectFit"></image>
<view class="card carrier-card" v-for="item in mchList" :key="item.iccid">
<view class="carrier-main">
<view class="logo-stack">
<image class="carrier-logo" :src="getCarrier(item.carrier_type).logo" mode="aspectFit"></image>
</view>
<view class="carrier-details">
<view class="carrier-heading">
<view class="carrier-name">{{ getCarrier(item.carrier_type).name }}</view>
<image class="slot-badge" :src="getSlotIcon(item.slot_position)" mode="aspectFit"></image>
<view class="carrier-statuses">
<up-tag :type="item.real_name_status === 1 ? 'primary' : 'success'" size="mini">
{{ item.real_name_status === 1 ? '已实名' : '未实名' }}
</up-tag>
<up-tag v-if="item.network_status" type="info" size="mini">{{ item.network_status }}</up-tag>
</view>
</view>
<view class="flex-col-g20">
<view class="flex-row-g20">
<view class="iccid">{{ item.iccid }}</view>
<view class="operator">
<up-tag type="success" size="mini">{{ getLogo(item.category).name }}</up-tag>
</view>
</view>
<view class="flex-row-g20">
<view class="operator">
<up-tag :type="item.real_name_status === 1 ? 'primary' : 'success'" size="mini">{{ item.real_name_status === 1 ? '已实名' : '未实名' }}</up-tag>
</view>
</view>
<view class="carrier-iccid">
<text class="iccid-value-text">{{ item.iccid }}</text>
<image class="copy-icon" src="/static/复制.png" mode="aspectFit"
@tap.stop="copyIccid(item.iccid)" aria-label="复制ICCID"></image>
</view>
<view class="card-actions">
<button v-if="item.is_current" class="btn-apple btn-primary action-button" disabled>当前使用</button>
<button v-else class="btn-apple btn-primary action-button" :disabled="switching" @tap="switchOperator(item)">
切换此运营商
</button>
<button v-if="item.real_name_status !== 1" class="btn-apple btn-secondary action-button" @tap="toReal(item)">
去实名
</button>
</view>
</view>
</view>
<view class="btn flex-row-g20 mt-30">
<up-button class="btn-apple btn-primary" v-if="item.is_current" type="primary" disabled>
当前使用
</up-button>
<up-button class="btn-apple btn-success" v-else type="success" @tap="switchOperator(item)" :loading="switching">
切换此运营商
</up-button>
</view>
<view class="modal-overlay" v-if="showIccidModal" @tap="closeModal">
<view class="modal-content" @tap.stop>
<view class="modal-close" @tap="closeModal"></view>
<view class="modal-body">
<view class="modal-title">实名认证</view>
<view class="iccid-value">{{ currentModalIccid }}</view>
<view class="modal-button" @tap="doRealName">点击复制ICCID并跳转实名</view>
</view>
</view>
</view>
</view>
@@ -41,24 +58,59 @@
<script setup>
import { reactive, ref, onMounted } from 'vue';
import { assetApi, deviceApi } from '@/api/index.js';
import { assetApi, deviceApi, hasActiveOrPendingPackage, realnameApi } from '@/api/index.js';
import { useUserStore } from '@/store/index.js';
import slot1Icon from '@/static/卡槽1.jpeg';
import slot2Icon from '@/static/卡槽2.jpeg';
import slot3Icon from '@/static/卡槽3.jpeg';
import cmccLogo from '@/static/中国移动.png';
import cuccLogo from '@/static/中国联通.png';
import ctccLogo from '@/static/中国电信.png';
import cbnLogo from '@/static/中国广电.png';
const userStore = useUserStore();
let mchList = reactive([]);
let loading = ref(false);
let cardsLoaded = ref(false);
let switching = ref(false);
let showIccidModal = ref(false);
let currentModalIccid = ref('');
let realnameEntryChecking = ref(false);
let opratorList = reactive([
{ category: '124', logo: 'https://img2.baidu.com/it/u=139558247,3893370039&fm=253&fmt=auto?w=529&h=500', name: '中国电信' },
{ category: '125', logo: 'https://img1.baidu.com/it/u=2816777816,1756344384&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', name: '中国联通' },
{ category: '126', logo: 'https://img2.baidu.com/it/u=915783975,1594870591&fm=253&fmt=auto&app=120&f=PNG?w=182&h=182', name: '中国移动' }
]);
const carrierMap = {
CMCC: { name: '中国移动', logo: cmccLogo },
CUCC: { name: '中国联通', logo: cuccLogo },
CTCC: { name: '中国电信', logo: ctccLogo },
CBN: { name: '中国广电', logo: cbnLogo }
};
const getLogo = (category) => {
const operator = opratorList.find(item => item.category === category);
return operator || opratorList[0];
const slotIconMap = {
1: slot1Icon,
2: slot2Icon,
3: slot3Icon
};
const getCarrier = (carrierType) => {
return carrierMap[carrierType] || { name: '-', logo: '' };
};
const getSlotIcon = (slotPosition) => slotIconMap[Number(slotPosition)] || slotIconMap[1];
const sortBySlotPosition = (cards) => cards.sort((left, right) => {
const leftSlot = Number(left.slot_position);
const rightSlot = Number(right.slot_position);
const normalizedLeft = Number.isFinite(leftSlot) && leftSlot > 0 ? leftSlot : Number.MAX_SAFE_INTEGER;
const normalizedRight = Number.isFinite(rightSlot) && rightSlot > 0 ? rightSlot : Number.MAX_SAFE_INTEGER;
return normalizedLeft - normalizedRight;
});
const copyIccid = (value) => {
if (!value) return;
uni.setClipboardData({
data: String(value),
success: () => uni.showToast({ title: 'ICCID已复制', icon: 'success' })
});
};
const loadCards = async () => {
@@ -71,25 +123,29 @@
// 是设备,调用设备卡列表接口
const data = await deviceApi.getCards(userStore.state.identifier);
if (data.cards && data.cards.length > 0) {
mchList.splice(0, mchList.length, ...data.cards.map(card => ({
const cards = data.cards.map(card => ({
iccid: card.iccid,
carrier_type: card.carrier_type,
carrier_name: card.carrier_name,
is_current: card.is_active,
real_name_status: card.real_name_status,
slot_position: card.slot_position,
category: getCarrierCategory(card.carrier_name)
})));
realname_policy: card.realname_policy,
network_status: card.network_status,
slot_position: card.slot_position
}));
mchList.splice(0, mchList.length, ...sortBySlotPosition(cards));
}
} else {
// 不是设备(单卡),直接使用 asset info 数据,只有一个卡
if (assetData.identifier) {
mchList.splice(0, mchList.length, {
iccid: assetData.identifier,
carrier_type: assetData.carrier_type,
carrier_name: assetData.carrier_name,
is_current: true,
real_name_status: assetData.real_name_status,
slot_position: 1,
category: getCarrierCategory(assetData.carrier_name)
network_status: assetData.network_status,
slot_position: 1
});
}
}
@@ -97,21 +153,27 @@
console.error('加载卡列表失败', e);
}
loading.value = false;
cardsLoaded.value = true;
};
const getCarrierCategory = (carrierName) => {
if (!carrierName) return '126';
if (carrierName.includes('电信')) return '124';
if (carrierName.includes('联通')) return '125';
if (carrierName.includes('移动')) return '126';
return '126';
const switchOperator = (item) => {
if (switching.value) return;
uni.showModal({
title: '确认切换',
content: `确定要切换到${getCarrier(item.carrier_type).name}吗?切换后预计 3-5 分钟生效。`,
cancelText: '取消',
confirmText: '确认切换',
success: ({ confirm }) => {
if (confirm) executeSwitch(item);
}
});
};
const switchOperator = async (item) => {
const executeSwitch = async (item) => {
switching.value = true;
try {
await deviceApi.switchCard(userStore.state.identifier, item.iccid);
uni.showToast({ title: '切换成功3-5分钟后生效', icon: 'success' });
uni.showToast({ title: '切换成功3-5分钟后生效', icon: 'none' });
loadCards();
} catch (e) {
console.error('切换运营商失败', e);
@@ -119,6 +181,79 @@
switching.value = false;
};
const openRealnameModal = (iccid) => {
currentModalIccid.value = iccid;
showIccidModal.value = true;
};
const toReal = async (card) => {
if (realnameEntryChecking.value) return;
if (card.realname_policy !== 'after_order') {
openRealnameModal(card.iccid);
return;
}
realnameEntryChecking.value = true;
uni.showLoading({ title: '校验中...', mask: true });
try {
const data = await deviceApi.getCards(userStore.state.identifier);
const cards = Array.isArray(data?.cards) ? data.cards : [];
const currentCard = cards.find(item => item.iccid === card.iccid) || card;
const hasRealNamedCard = cards.some(item => Number(item?.real_name_status) === 1);
if (currentCard.realname_policy !== 'after_order' || hasRealNamedCard ||
await hasActiveOrPendingPackage(userStore.state.identifier)) {
uni.hideLoading();
openRealnameModal(card.iccid);
return;
}
uni.hideLoading();
uni.showModal({
title: '提示',
content: '当前设备所有卡均未实名,且暂无生效中或待生效套餐。请先订购套餐,再进行实名认证。',
confirmText: '去订购',
cancelText: '取消',
success: ({ confirm }) => {
if (confirm) uni.navigateTo({ url: '/pages/package-order/package-order' });
}
});
} catch (error) {
uni.hideLoading();
console.error('校验切换运营商实名条件失败', error);
uni.showToast({ title: '实名条件校验失败,请稍后重试', icon: 'none' });
} finally {
realnameEntryChecking.value = false;
}
};
const closeModal = () => {
showIccidModal.value = false;
};
const doRealName = async () => {
const iccid = currentModalIccid.value;
closeModal();
try {
const data = await realnameApi.getLink(userStore.state.identifier, iccid, { showError: false });
if (data.realname_url) {
uni.setClipboardData({
data: iccid,
success: () => {
uni.showToast({ title: 'ICCID已复制', icon: 'success' });
}
});
setTimeout(() => {
window.location.href = data.realname_url;
}, 1500);
}
} catch (e) {
console.error('获取实名链接失败', e);
uni.showToast({ title: e?.msg || '获取实名链接失败', icon: 'none' });
}
};
onMounted(() => {
loadCards();
});
@@ -126,15 +261,108 @@
<style lang="scss" scoped>
.container {
.card {
.logo {
width: 80rpx;
height: 80rpx;
border-radius: 120rpx;
border: 1rpx solid var(--primary);
overflow: hidden;
image { width: 100%; height: 100%; }
}
.carrier-card {
padding: 28rpx;
}
.carrier-main {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24rpx;
}
.logo-stack {
width: 88rpx;
height: 88rpx;
margin-top: 12rpx;
flex-shrink: 0;
box-sizing: border-box;
}
.carrier-logo {
width: 88rpx;
height: 88rpx;
flex-shrink: 0;
}
.slot-badge {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
}
.carrier-details {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
}
.carrier-name {
color: var(--text-primary);
font-size: 30rpx;
font-weight: 600;
line-height: 1.3;
}
.carrier-heading {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12rpx;
}
.carrier-iccid {
display: flex;
align-items: center;
gap: 10rpx;
margin-top: 14rpx;
min-width: 0;
}
.iccid-value-text {
flex: 0 1 auto;
min-width: 0;
color: var(--text-secondary);
font-size: 24rpx;
line-height: 1.35;
word-break: break-all;
}
.copy-icon {
width: 30rpx;
height: 30rpx;
flex-shrink: 0;
cursor: pointer;
}
.carrier-statuses {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 10rpx;
margin-top: 0;
}
.card-actions {
width: 100%;
margin-top: 20rpx;
display: flex;
flex-direction: row;
gap: 12rpx;
}
.action-button {
flex: 1 1 0;
width: auto;
min-width: 0;
height: 64rpx;
padding: 0 12rpx;
font-size: 24rpx;
line-height: 64rpx;
box-sizing: border-box;
&::after { border: none; }
}
}
@@ -152,12 +380,83 @@
background: var(--gray-100);
color: var(--text-primary);
&.btn-primary {
background: var(--primary);
color: var(--text-inverse);
}
&.btn-success {
background: var(--success);
color: var(--text-inverse);
}
}
.modal-overlay {
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.modal-content {
background: var(--bg-primary);
border-radius: var(--radius-large);
width: 620rpx;
max-width: 90%;
overflow: hidden;
position: relative;
}
.modal-close {
position: absolute;
top: 24rpx; left: 24rpx;
width: 48rpx; height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
color: var(--gray-600);
cursor: pointer;
}
.modal-body {
padding: 60rpx 32rpx 32rpx;
display: flex;
flex-direction: column;
align-items: center;
gap: 32rpx;
}
.modal-title {
font-size: 32rpx;
font-weight: 600;
color: var(--text-primary);
text-align: center;
}
.iccid-value {
font-size: 40rpx;
font-weight: bold;
color: var(--primary);
text-align: center;
word-break: break-all;
line-height: 1.4;
}
.modal-button {
padding: 24rpx 32rpx;
background: var(--success);
color: var(--text-inverse);
font-size: 28rpx;
font-weight: 500;
text-align: center;
border-radius: var(--radius-small);
cursor: pointer;
}
.empty-state {
display: flex;
flex-direction: column;
@@ -165,8 +464,15 @@
justify-content: center;
padding: 120rpx 40rpx;
min-height: 400rpx;
.empty-icon { font-size: 120rpx; margin-bottom: 30rpx; opacity: 0.6; }
.empty-icon { width: 120rpx; height: 120rpx; margin-bottom: 30rpx; opacity: 0.6; }
.empty-title { font-size: 32rpx; font-weight: 600; color: var(--text-primary); margin-bottom: 16rpx; }
.empty-desc { font-size: 26rpx; color: var(--text-tertiary); text-align: center; }
}
</style>
.loading-state {
display: flex;
align-items: center;
justify-content: center;
min-height: 500rpx;
}
</style>

795
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More