feat:商户列表/品牌详情页改版 + 云闪付付款码接入

- 新增 pages/shop/detail 品牌详情页:头部卡(logo/角标/付款码按钮)、富文本优惠说明(数字标红)、适用门店清单(距离排序+高德导航+拨号,无二级页);付款码走 upsdk.qrCodePay 容器原生拉起,非云闪付环境 3s 超时给引导弹窗
- 折扣列表行按参考图改版:logo/品牌名/券类型标签/付款方式纵排,右侧结构化优惠数字放大红色+直线距离;搜索区瘦身;未迁移门店全字段回退旧文案不断档
- 首页宫格与列表统一跳新详情页
- docs:brand 建表 DDL、后端需求文档、终版收集表(187 品牌/197 门店已导入 UAT+DEV,脚本按名称幂等)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jacobxu666
2026-10-26 16:40:38 +08:00
co-authored by Claude Fable 5
parent 6747501963
commit 9f13a21263
15 changed files with 594 additions and 83 deletions
+48
View File
@@ -0,0 +1,48 @@
-- ============================================================
-- 怀化社保卡商户板块改版 · 品牌表 DDL
-- 需求文档:品牌表建表与接口需求_2026-10-26.md
-- 执行顺序:① 本文件建表/加列 → ② 导入脚本回填(另交) → ③ 接口发布
-- 环境:dscp_business_uat 与 生产库 各执行一次(两库不同机器)
-- ============================================================
-- 1. 品牌表(平台通用命名风格,无前缀;其他项目通过自有方式关联 brand_id)
CREATE TABLE `brand` (
`id` BIGINT NOT NULL COMMENT '雪花ID',
`name` VARCHAR(50) NOT NULL COMMENT '品牌名称(唯一业务名,收集表①B列)',
`logo` VARCHAR(255) COMMENT '品牌LOGO图片URL(OSS)',
`brand_type` VARCHAR(30) COMMENT '品牌类型(连锁餐饮/连锁商超等,运营自定文本)',
`introduction` TEXT COMMENT '品牌简介',
`discount_type` TINYINT COMMENT '优惠类型:1满减券 2折扣券 3立减券 4余额券 5免费体验 6固定价 9其他',
`discount_display` VARCHAR(50) COMMENT '列表展示文案(如:满200减8元 / 9.8折)',
`threshold_fen` INT COMMENT '优惠门槛(分;折扣类为空)',
`discount_value` INT COMMENT '优惠力度(满减/立减=减额分;折扣=折数×10,如9.8折存98)',
`pay_mode` VARCHAR(30) COMMENT '付款方式(付款码,扫一扫…多值逗号分隔)',
`pay_rule` VARCHAR(50) COMMENT '付款规则(如:付款立减)',
`discount_rules` TEXT COMMENT '优惠说明(富文本HTML,后台富文本编辑器维护,详情页编号列表直接渲染)',
`service_phone` VARCHAR(20) COMMENT '客服电话(详情页/列表拨号用)',
`remark` VARCHAR(500) COMMENT '优惠原文备份(迁移追溯,兼容 shop_relation.remark)',
`status` TINYINT DEFAULT 1 COMMENT '1上架 0下架',
`sort` INT DEFAULT 0 COMMENT '排序',
`is_deleted` BIT(1) DEFAULT b'0',
`created_by` VARCHAR(50),
`created_time` DATETIME,
`updated_by` VARCHAR(50),
`updated_time` DATETIME,
PRIMARY KEY (`id`),
KEY `idx_brand_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='品牌表';
-- 2. 商铺表挂品牌(其余字段复用现有:logo/lat/lng/mobile/business_time/main_pic 均已存在)
ALTER TABLE `shop`
ADD COLUMN `brand_id` BIGINT NULL COMMENT 'FK brand.id' AFTER `merchant_id`,
ADD INDEX `idx_shop_brand_id` (`brand_id`);
-- 3. 权益项目:card_resource_rule 大部分复用现有字段,仅新增一列 use_mode——
-- 权益内容物 → resource_name/introduce;可用次数 → total_times/month_times/day_times;
-- 是否预约 → is_appointment/can_appointment/advance_days/advance_hour;
-- 使用规则/注意事项 → notice/card_instruction;状态 → status/resource_status。
-- ⚠ settlement_way/check_settlement_type 属于财务结算域(结算单/分成/买断链路),
-- 不可挪用为用户端核销方式。用户端"核销方式"用新列:
ALTER TABLE `card_resource_rule`
ADD COLUMN `use_mode` VARCHAR(30) NULL COMMENT '使用/核销方式(展示用):付款码/扫一扫/权益券核销/出示页面/现场登记' AFTER `settlement_way`;
@@ -0,0 +1,73 @@
# 商户品牌改版 · 后端需求说明(建表 + 接口 + 数据导入)
日期:2026-10-26 前端:hhrs(怀化人社 H5)+ 管理后台 配套:`brand_ddl_2026-10-26.sql`、《怀化商户信息优化模板_终版预填v2》收集表
## 1. 背景与目标
商户折扣列表页、详情页按新版 UI 改版(品牌头图卡 + 结构化红色权益 + 优惠说明富文本 + 同品牌门店清单)。数据模型:
```
brand(品牌:统一优惠信息) 1 ── N shop(门店:地址/坐标/电话)
card_resource_rule(权益项 126 条,复用现有字段) N ── 1 shop
```
新增仅一张 `brand` 表 + `shop.brand_id` 一列;权益项零 DDL(复用 card_resource_rule 现有字段)。
## 2. DDL(见 brand_ddl_2026-10-26.sql)
- 新建 `brand`:字段与枚举注释齐全;`discount_rules` 为 **TEXT 富文本 HTML**(后台富文本编辑器维护,口径同 shop.description);
- `shop` 加 `brand_id`(索引);
- UAT 与生产两套库各执行一次。
## 3. 接口改动(jxxx-dscp)
### 3.1 `mp-api/hhrsStore/list`、`hhrsStore/detail`
现有链路:shop_relation(channel_type=15) → shop。改动:
- shop 查询后按 `brand_id` join `brand`(status=1 且未删除),Response 增加:
`brandId、brandName、brandLogo、brandType、brandIntroduction、discountType、discountDisplay、thresholdFen、discountValue、payMode、payRule、discountRules(富文本)、servicePhone`;
- **兼容回退**:`brand_id` 为空或品牌未上架 → 沿用现有 `merchantDiscount`(shop_relation.remark),保证未迁移门店不断档;
- `detail` 增加 `brandShops`:同 `brand_id` 门店清单(id/name/address/lat/lng/distance/mobile/businessTime),供详情页"适用门店"展示+导航+拨号(**该清单只展示,不跳二级页**);
- `list` 增加透出 `lng/lat`(地图/距离已算,前端导航按钮要用原始坐标)。
### 3.2 `mp-api/hhrsRights/list`、`hhrsRights/detail`
Response 补充映射 card_resource_rule 现有列:
`totalTimes、monthTimes、dayTimes(可用次数)、isAppointment/advanceDays/advanceHour(预约)、notice、cardInstruction(使用说明)、useMode(核销方式,新列见 DDL)`。
⚠ 注意:`settlement_way/check_settlement_type` 为财务结算域字段(结算单导出/分成/买断 Handler 在用),与用户端"核销方式"语义不同,本次不复用、不改动,新增 `use_mode` 承载展示口径。
### 3.3 管理后台(dscp-html-manage)——2026-10-26 确认同批执行
**后端新增管理端接口(与 mp 接口分开,走后台鉴权域):**
- `brand/page`(名称/类型/状态筛选+分页)、`brand/save`(新增/编辑)、`brand/delete`(软删)、`brand/simpleList`(下拉数据源:id+name,仅上架);
- shop 保存接口支持 `brand_id` 字段;card_resource_rule 保存接口支持 `use_mode` 字段。
**前端管理页:**
1. 新菜单「品牌管理」(位置:与商铺管理同组;权限码沿用平台现有规范);
2. 品牌列表页:名称/类型/优惠文案/状态列 + 搜索、新增、编辑、上下架、删除;
3. 品牌表单:名称(必填、重名提示)、LOGO(复用现有 OSS 上传组件)、品牌类型、客服电话、优惠类型(下拉枚举 1-6/9)、优惠信息(展示文案)、门槛/力度(表单填"元/折",提交转分/×10)、付款方式(多选)、付款规则、品牌简介、**优惠说明(富文本编辑器,复用 shop.description 同款组件,走 XSS 过滤链)**、排序、状态;
4. 商铺表单(shop/form):新增「所属品牌」下拉(远程搜索 brand/simpleList,写入 shop.brand_id);现有渠道 remark 输入保留(长期双轨);
5. 权益资源规则表单:「核销方式 use_mode」下拉(付款码/扫一扫/权益券核销/出示页面/现场登记)。
**上线顺序建议**:建表 → 后端接口 → 管理页 → Excel 导入存量 → 前端两页面改版。
## 4. 数据导入(回收《终版预填v2》后由前端侧脚本执行,SQL 交后端审核)
1. 读收集表①:按品牌建 `brand` 187 行(优惠类型文案→枚举、优惠信息拆 threshold/value、优惠说明三段转富文本 `<p>` 并自动标色数字);
2. 读收集表②:按"门店ID"列 UPDATE `shop`:`brand_id`(名称→新id映射)、`logo`、`lat/lng`、`mobile`、`business_time`、`main_pic`;无 brand_id 锚点的新店按 INSERT 走后台新增流程;
3. 读收集表③:按"规则ID"列 UPDATE `card_resource_rule` 现有字段(times/预约/notice)+ 新列 `use_mode`(核销方式);
4. 图片:logo(Pxxx_logo.png)与门头照(Sxxxx_photo.jpg)打包批量传 OSS(hn12301 bucket),URL 回填;
5. 流程:脚本先 **dry-run 输出匹配统计**(命中/未匹配/冲突清单)→ 事务内执行 UAT → 页面验收 → 同包生产;
6. 表内 14 家无坐标门店、27 条解析失败品牌文案,业务已补齐后再导。
## 5. 确认结论(2026-10-26 后端已答复)
| # | 事项 | 结论 |
|---|---|---|
| 1 | brand 表规范 | **照抄本 DDL** |
| 2 | 核销方式落位 | 查实 `settlement_way/check_settlement_type` 属财务结算域(结算单/分成/买断链路在用),**不可挪用**;改为 `card_resource_rule` 新增 `use_mode VARCHAR(30)` 列承载(DDL 已更新)——待产品/后端确认这唯一新增列 |
| 3 | discount_type 枚举 | **按暂定 1-6/9 执行** |
| 4 | 富文本 XSS | **走现有过滤链**(同 shop.description 口径) |
| 5 | remark 回退 | **长期双轨**:brand_id 缺失/未上架时前端永远回退 shop_relation.remark;导入脚本对已迁品牌行两边同步写,remark 不下线 |
@@ -0,0 +1,54 @@
# 商户列表/详情页改版 · 后端数据需求说明(2026-10-23 · v4 修订)
## 〇、模型澄清(重要,业务已确认)
**商铺 = 品牌,权益直接挂在现有商铺(shop 表)记录上,不新增品牌层级**;
详情页 = 商铺权益详情页,页内"适用门店"仅是同品牌商铺的展示清单(导航/电话),**没有门店二级页面**。
同品牌多店优惠统一:数据上各店行相同即可(由收集表"代表行 + 同组引用"机制导入时自动扩展,见收集表 v4 说明)。
## 一、调研结论(基于 dscp_business_dev 库实查 + UAT 接口实测)
| 现有资产 | 与本次的关系 |
|---|---|
| `shop` 表 | 已有 `logo`、`lat/lng`、`business_time`、`mobile`、`main_pic`、`ticket_info`、`merchant_id`(主体/开票方,营销维度不使用它) |
| `promotion_coupon(_template)` | 已有结构化优惠字段(discount_type/percent/price/limit_price),仅作字段设计参考,本次不接入券体系 |
| `card_resource_rule` | 权益包 126 条权益项规则表,②收集表数据源 |
hhrs 接口 `mp-api/hhrsStore/list` 目前只透出部分字段(image=门头照、merchantDiscount=拼接文本、坐标未返回)。
**环境注意**:UAT 接口返回的 177 家与 120.26.254.65 的 dev 库仅 15 条重合,dscp-uat 服务连的是另一套库——补数据前先确认目标库(问题③)。
## 二、数据规模实测
- 商铺全集 **197**(折扣 177 + 场馆 25,重叠 5);
- 权益包权益项 **126** 条(`hhrsRights/list`);
- 数据缺口(按 UAT/dev 实测):`logo` 基本为默认图、`lat/lng` 大面积缺失、结构化优惠字段无 → 全部走收集表补齐。
## 三、需要后端做的(存储方案已随模型定死,二选一取消)
`shop` 表新增结构化权益列(或等价方案),并透出到 hhrsStore 接口:
```
discount_type 券类型枚举(满减/折扣/立减/固定价/免费体验/其他)
threshold_fen 门槛(分,可空)
discount_value 力度(折扣=折数×10;满减=减让分)
pay_mode 核销方式枚举(社保卡付款码/云闪付扫一扫/权益券核销/出示页面/现场登记)
discount_display 列表展示文案(如“满100减10元”)
rules_json 优惠说明条目数组(详情页编号列表,含限次/低消/除外)
brand_group 品牌组名(同优惠多店归组的键,导入时按组扩展权益列)
```
接口:`hhrsStore/list`、`hhrsStore/detail` 增加透出 `logo、lat、lng、上述新列、同组门店清单(brand_group 下各店 名称/地址/坐标/电话,详情页适用门店用)`。
兼容:结构化列/`logo` 为空时前端回退 `merchantDiscount` 文本与门头照,可逐店迁移不断档。
## 四、需要后端回答的三个问题
① `shop.usage_note`/`ticket_info` 原始设计语义,可否承载"核销说明/付款码配置"?
② 核销方式=付款码的商铺,三方商户号存 `shop_relation` 还是新列?
③ dscp-uat 与生产 hhrs 服务各自的 DB 指向(导入前必须确认,dev 库≠UAT 库已实锤)。
## 五、前端改造范围(数据就绪后)
- 列表页 `pages/discount/discount.vue`:行样式重构(logo + 券类型标签 + 右侧结构化红色权益 + 距离),一行=一个商铺权益;
- 详情页(新增或在 venue/detail 上改造):商铺权益详情 = 头部卡(logo/角标/付款码按钮)+ 优惠说明编号卡 + 同品牌门店清单卡(展示 + 导航/电话,**不跳二级页**);
- 权益包详情(rights)套用同一套样式,数据来自权益项规则扩展字段;
- 「付款码」按钮动作待产品确认渠道;首页「全城好礼商户」宫格同源受益。
Binary file not shown.
+6
View File
@@ -51,6 +51,12 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "pages/shop/detail",
"style": {
"navigationStyle": "custom"
}
},
{ {
"path": "pages/petrol/orderConfirm", "path": "pages/petrol/orderConfirm",
"style": { "style": {
+97 -80
View File
@@ -4,11 +4,11 @@
<view class="search-area"> <view class="search-area">
<view class="nav-row"> <view class="nav-row">
<view class="back-btn" @click="goBack"> <view class="back-btn" @click="goBack">
<u-icon name="arrow-left" color="#333333" size="40"></u-icon> <u-icon name="arrow-left" color="#333333" size="32"></u-icon>
<text class="back-text">返回</text> <text class="back-text">返回</text>
</view> </view>
<view class="search-bar"> <view class="search-bar">
<u-icon name="search" color="#8e8e93" size="36"></u-icon> <u-icon name="search" color="#8e8e93" size="30"></u-icon>
<input class="search-input" v-model="keyword" placeholder="请搜索商户名" confirm-type="search" @confirm="onSearch" /> <input class="search-input" v-model="keyword" placeholder="请搜索商户名" confirm-type="search" @confirm="onSearch" />
<view class="search-btn" @click="onSearch">搜索</view> <view class="search-btn" @click="onSearch">搜索</view>
</view> </view>
@@ -18,25 +18,24 @@
:district-id="districtId" :category="category" @change="onFilterChange" /> :district-id="districtId" :category="category" @change="onFilterChange" />
</view> </view>
<!-- 商户列表 --> <!-- 商户列表(xuchao: 参考图行样式——logo+券类型标签+付款方式,右列结构化优惠+距离;未迁移门店回退旧文案) -->
<view class="list-area"> <view class="list-area">
<view class="venue-card" v-for="item in list" :key="item.shopId" @click="goDetail(item)"> <view class="venue-card" v-for="item in list" :key="item.shopId" @click="goDetail(item)">
<view class="card-thumb"> <view class="card-thumb">
<image class="card-img" :src="item.image" mode="aspectFill" /> <image class="card-img" :src="item.brandLogo || item.image" mode="aspectFill" />
<!-- xuchao: 左上角所属地区角标(districtName 来自商铺「所在地区」,未录入则不显示) -->
<text class="card-area" v-if="item.districtName">{{ shortDistrict(item.districtName) }}</text>
</view> </view>
<view class="card-info"> <view class="card-info">
<text class="card-name">{{ item.name }}</text> <text class="card-name">{{ item.brandName || item.name }}</text>
<text class="card-category">{{ item.category }}</text> <!-- xuchao: 参考图为纵向三行——店名 / 券类型标签 / 付款方式,标签与付款码不同行 -->
<!-- xuchao: 地址与距离同属一个模块 --> <text class="tag-coupon" v-if="couponLabel(item)">{{ couponLabel(item) }}</text>
<view class="card-address-row"> <text class="card-pay">{{ item.payMode || item.category || '' }}</text>
<text class="card-address">{{ item.address }}</text>
<view class="card-distance" v-if="item.distance !== null">
<u-icon name="map" color="#999999" size="24"></u-icon>
<text class="distance-text">{{ item.distance < 1 ? Math.round(item.distance * 1000) + 'm' : Math.round(item.distance) + 'km' }}</text>
</view> </view>
<view class="offer-col">
<view class="offer" v-if="item.discountDisplay">
<text v-for="(seg, si) in splitOffer(item.discountDisplay)" :key="si" :class="seg.n ? 'offer-num' : 'offer-txt'">{{ seg.t }}</text>
</view> </view>
<text class="offer-fallback" v-else>{{ item.merchantDiscount || item.category || '' }}</text>
<text class="offer-dist" v-if="item.distance !== null && item.distance !== undefined">直线{{ item.distance < 1 ? Math.round(item.distance * 1000) + 'm' : Math.round(item.distance) + 'km' }}</text>
</view> </view>
</view> </view>
<view v-if="hasScrolled" class="nomore-area"> <view v-if="hasScrolled" class="nomore-area">
@@ -47,8 +46,6 @@
</template> </template>
<script> <script>
// xuchao: 角标区县简称(后端返回的是行政区划全称)
import { shortDistrict } from '@/common/district.js'
// xuchao: 县区 + 类型筛选条,三个列表页共用(pages.json 的 easycom 只给 u- 前缀配了规则,这里显式引入) // xuchao: 县区 + 类型筛选条,三个列表页共用(pages.json 的 easycom 只给 u- 前缀配了规则,这里显式引入)
import HhrsFilterBar from '@/components/hhrs-filter-bar/hhrs-filter-bar.vue' import HhrsFilterBar from '@/components/hhrs-filter-bar/hhrs-filter-bar.vue'
@@ -95,7 +92,16 @@ export default {
this.loadMore() this.loadMore()
}, },
methods: { methods: {
shortDistrict, // xuchao: 券类型角标:品牌结构化类型优先;无品牌的未迁移门店不显示角标(避免与业态文字重复)
couponLabel(item) {
const map = { 1: '满减券', 2: '折扣券', 3: '立减券', 4: '余额券', 5: '免费体验', 6: '固定价', 9: '其他' }
return item.discountType ? map[item.discountType] : (item.brandId ? '优惠' : '')
},
// xuchao: 优惠文案拆「数字段/文字段」,数字放大红色(对齐参考图)
splitOffer(s) {
const parts = String(s).split(/(\d+(?:\.\d+)?)/).filter(x => x !== '')
return parts.map(t => ({ t, n: /^\d/.test(t) }))
},
loadList() { loadList() {
// xuchao: 请求序号 —— 新请求直接取代在途请求,过期响应整体丢弃(修复搜索竞态,故不再用 loading 提前 return) // xuchao: 请求序号 —— 新请求直接取代在途请求,过期响应整体丢弃(修复搜索竞态,故不再用 loading 提前 return)
const seq = ++this.reqSeq const seq = ++this.reqSeq
@@ -158,8 +164,8 @@ export default {
} }
}, },
goDetail(item) { goDetail(item) {
// xuchao: type=2 标记商户折扣入口,详情页据此展示商品信息+商户优惠模块 // xuchao: 商户折扣行跳品牌详情页(含适用门店/优惠说明);文旅场馆仍走 venue/detail
uni.navigateTo({ url: '/pages/venue/detail?id=' + item.shopId + '&type=2' }) uni.navigateTo({ url: '/pages/shop/detail?id=' + item.shopId })
}, },
onSearch() { onSearch() {
this.pageNo = 1 this.pageNo = 1
@@ -185,7 +191,8 @@ export default {
.search-area { .search-area {
background-color: #ffffff; background-color: #ffffff;
padding: 6px 12px 0; // xuchao: 底部留 8px,与下方列表灰色间隔衔接,白块不再贴死卡片
padding: 6px 12px 8px;
// xuchao: 滚动时固定在页面顶部;z-index 高于筛选遮罩(90),保证面板与选中态不被压住 // xuchao: 滚动时固定在页面顶部;z-index 高于筛选遮罩(90),保证面板与选中态不被压住
position: sticky; position: sticky;
top: 0; top: 0;
@@ -202,7 +209,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 44px; height: 36px;
flex-shrink: 0; flex-shrink: 0;
gap: 2px; gap: 2px;
} }
@@ -216,25 +223,25 @@ export default {
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
height: 44px; height: 36px;
background-color: #ffffff; background-color: #ffffff;
border: 1px solid #f2f2f7; border: 1px solid #f2f2f7;
border-radius: 100px; border-radius: 100px;
padding: 4px 8px; padding: 4px 8px;
gap: 12px; gap: 10px;
} }
.search-input { .search-input {
flex: 1; flex: 1;
font-size: 16px; font-size: 14px;
color: #333; color: #333;
} }
.search-btn { .search-btn {
background-color: #0088ff; background-color: #0088ff;
color: #ffffff; color: #ffffff;
font-size: 14px; font-size: 13px;
padding: 4px 10px; padding: 3px 10px;
border-radius: 50px; border-radius: 50px;
white-space: nowrap; white-space: nowrap;
} }
@@ -248,25 +255,26 @@ export default {
.venue-card { .venue-card {
display: flex; display: flex;
align-items: flex-end; align-items: center;
box-sizing: border-box; box-sizing: border-box;
background-color: #ffffff; background-color: #ffffff;
border: 1px solid #f2f2f7; border: 1px solid #f2f2f7;
border-radius: 6px; border-radius: 16rpx;
width: 702rpx; width: 702rpx;
padding: 24px 12px; padding: 28rpx 24rpx;
gap: 12px; gap: 20rpx;
box-shadow: 0 2px 3px #f2f2f7; box-shadow: 0 2px 3px #f2f2f7;
margin-bottom: 12px; margin-bottom: 12px;
} }
.card-thumb { .card-thumb {
width: 75px; width: 88rpx;
height: 75px; height: 88rpx;
border-radius: 6px; border-radius: 16rpx;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
flex-shrink: 0; flex-shrink: 0;
background-color: #f7f7f7;
} }
/* xuchao: image 由 thumb 裁圆角,自身不再设圆角 */ /* xuchao: image 由 thumb 裁圆角,自身不再设圆角 */
@@ -276,35 +284,19 @@ export default {
display: block; display: block;
} }
.card-area {
position: absolute;
top: 0;
left: 0;
display: block;
max-width: 100%;
padding: 1px 5px;
border-radius: 0 0 6px 0;
background: rgba(0, 0, 0, 0.45);
color: #ffffff;
font-size: 10px;
line-height: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.card-info { .card-info {
flex: 1; flex: 1;
// xuchao: min-width:0 允许 flex 子项收缩到内容宽度以下,配合 nowrap 文本出省略号 // xuchao: min-width:0 允许 flex 子项收缩到内容宽度以下,配合 nowrap 文本出省略号
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0; align-items: flex-start;
gap: 8rpx;
} }
.card-name { .card-name {
font-size: 16px; font-size: 30rpx;
font-weight: 500; font-weight: 600;
color: #000000; color: #000000;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
@@ -312,43 +304,68 @@ export default {
white-space: nowrap; white-space: nowrap;
} }
.card-category { .tag-coupon {
font-size: 14px; flex-shrink: 0;
color: #727272; font-size: 20rpx;
margin-top: 8px; color: #666666;
// xuchao: 分类为空也预留一行高度,防止卡片内容底部对齐时名称上下跳动 background: #f2f3f5;
min-height: 20px; border-radius: 6rpx;
line-height: 20px; padding: 4rpx 10rpx;
line-height: 1.4;
} }
.card-address-row { .card-pay {
display: flex; font-size: 22rpx;
align-items: center; color: #999999;
gap: 8px; max-width: 100%;
width: 100%;
margin-top: 8px;
}
.card-address {
flex: 1;
min-width: 0;
font-size: 14px;
color: #727272;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.card-distance { /* xuchao: 右侧优惠列——数字放大红色(对齐参考图),offer 与直线距离间隔一行行距 */
display: flex; .offer-col {
align-items: center;
gap: 2px;
flex-shrink: 0; flex-shrink: 0;
max-width: 230rpx;
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 16rpx;
} }
.distance-text { .offer {
font-size: 12px; display: flex;
color: #727272; align-items: baseline;
flex-wrap: wrap;
justify-content: flex-end;
}
.offer-num {
font-size: 34rpx;
font-weight: 800;
color: #E60012;
line-height: 1.1;
}
.offer-txt {
font-size: 22rpx;
font-weight: 600;
color: #E60012;
}
.offer-fallback {
font-size: 22rpx;
color: #E60012;
text-align: right;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.offer-dist {
font-size: 22rpx;
color: #999999;
} }
.nomore-area { .nomore-area {
+2 -2
View File
@@ -211,8 +211,8 @@
this.queryVisible = true this.queryVisible = true
}, },
goStore(s) { goStore(s) {
// xuchao: 与商户折扣页同款跳转,type=2 标记商户折扣入口 // xuchao: 与商户折扣页同款跳转——品牌详情页
uni.navigateTo({ url: '/pages/venue/detail?id=' + s.shopId + '&type=2' }) uni.navigateTo({ url: '/pages/shop/detail?id=' + s.shopId })
}, },
goRights() { goRights() {
// xuchao: 免密登录还没返回时不放行,避免带着空/旧身份进权益页 // xuchao: 免密登录还没返回时不放行,避免带着空/旧身份进权益页
+313
View File
@@ -0,0 +1,313 @@
<template>
<!-- xuchao: 商户(品牌)详情页,按参考图三卡布局;brand 未关联/后端未发布时全部字段走回退,页面不留白 -->
<view class="page">
<!-- 导航 -->
<view class="nav-bar">
<view class="back-btn" @click="goBack">
<u-icon name="arrow-left" color="#333333" size="40"></u-icon>
<text class="back-text">返回</text>
</view>
<text class="nav-title">商户详情</text>
<view style="width: 100rpx;"></view>
</view>
<view class="body" v-if="shop">
<!-- 头部卡 -->
<view class="head-card">
<view class="head-top">
<view class="logo-box">
<image class="logo" :src="shop.brandLogo || shop.image" mode="aspectFill"></image>
</view>
<text class="head-name">{{ shop.brandName || shop.name }}</text>
<view class="badge" v-if="badgeMain">
<text class="badge-main">{{ badgeMain }}</text>
<text class="badge-sub" v-if="badgeSub">{{ badgeSub }}</text>
</view>
</view>
<view class="head-divider"></view>
<view class="head-meta">
<text class="meta-line" v-if="shop.brandType || shop.category">{{ shop.brandType || shop.category }}</text>
<text class="meta-line" v-if="shop.businessTime">营业时间:{{ shop.businessTime }}</text>
</view>
<view class="pay-btn" @click="onPayCode">
<svg width="17" height="17" viewBox="0 0 24 24" fill="none"><rect x="3" y="3" width="7" height="7" rx="1.5" stroke="#fff" stroke-width="2"/><rect x="14" y="3" width="7" height="7" rx="1.5" stroke="#fff" stroke-width="2"/><rect x="3" y="14" width="7" height="7" rx="1.5" stroke="#fff" stroke-width="2"/><path d="M14 14h3v3h-3zM18 18h3v3h-3z" fill="#fff"/></svg>
<text class="pay-btn-text">付款码</text>
</view>
</view>
<!-- 优惠说明 -->
<view class="card">
<view class="card-title"><view class="bar"></view><text>优惠说明</text></view>
<!-- 品牌富文本优先 -->
<rich-text v-if="shop.discountRules" :nodes="shop.discountRules" class="rules-rich"></rich-text>
<!-- 回退:merchantDiscount/remark 按分号换行拆编号列表 -->
<view v-else-if="fallbackRules.length">
<view class="rule-line" v-for="(r, i) in fallbackRules" :key="i">
<text class="rule-no">{{ i + 1 }}</text>
<text class="rule-txt">{{ r }}</text>
</view>
</view>
<text v-else class="rule-empty">到店出示社保卡咨询店员</text>
</view>
<!-- 适用门店 -->
<view class="card" v-if="shops.length">
<view class="shops-head">
<text class="shops-title">适用门店<text class="shops-count">(共{{ shops.length }}家)</text></text>
<view class="shops-more" v-if="shops.length > 4 && !showAll" @click="showAll = true">
<text>查看全部</text><view class="chev"></view>
</view>
</view>
<view class="shop-row" v-for="(s, i) in visibleShops" :key="s.shopId">
<view class="pin">
<svg width="15" height="19" viewBox="0 0 15 19"><path d="M7.5 1C4 1 1.2 3.8 1.2 7.3c0 4.5 6.3 10.7 6.3 10.7s6.3-6.2 6.3-10.7C13.8 3.8 11 1 7.5 1z" fill="#E8542F"/><circle cx="7.5" cy="7.2" r="2.4" fill="#fff"/></svg>
</view>
<view class="shop-info">
<text class="shop-name">{{ s.name }}</text>
<text class="shop-addr">{{ s.address }}</text>
</view>
<view class="shop-right">
<text class="shop-dist" v-if="s.distance != null">{{ s.distance < 1 ? Math.round(s.distance * 1000) + 'm' : s.distance.toFixed(1) + 'km' }}</text>
<view class="icon-btn" @click.stop="navTo(s)">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M12 2 20 21l-8-5.2L4 21Z" fill="#333"/></svg>
</view>
<view class="icon-btn" @click.stop="callShop(s)" v-if="s.mobile">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M5 4h4l1.8 4.3-2.4 1.7a12 12 0 0 0 5.6 5.6l1.7-2.4L20 15v4a1.8 1.8 0 0 1-2 1.8C9.7 20 4 14.3 3.2 6A1.8 1.8 0 0 1 5 4Z" fill="#333"/></svg>
</view>
</view>
</view>
<view class="collapse" v-if="showAll && shops.length > 4" @click="showAll = false">收起 <text class="chev up"></text></view>
</view>
</view>
<view class="loading-tip" v-else>加载中…</view>
</view>
</template>
<script>
export default {
data() {
return {
shopId: '',
shop: null,
showAll: false
}
},
computed: {
// xuchao: 角标主文案 = 结构化优惠文案;未迁移回退从原文提取优惠词(X折/满X减X),避免整段撑爆角标
badgeMain() {
if (!this.shop) return ''
if (this.shop.discountDisplay) return this.shop.discountDisplay
const m = (this.shop.merchantDiscount || '').match(/(\d+(?:\.\d+)?折|满\s*\d+(?:\.\d+)?\s*(?:元)?\s*减\s*\d+(?:\.\d+)?\s*元|立减\s*\d+(?:\.\d+)?\s*元|免费体验)/)
if (m) return m[1].replace(/\s/g, '')
const t = (this.shop.merchantDiscount || '').split(/[;;\n]/)[0]
return t ? t.slice(0, 8) : ''
},
badgeSub() {
if (!this.shop) return ''
if (this.shop.discountDisplay) return this.shop.payRule || (this.shop.payMode ? '付款立减' : '付款立减')
return ''
},
fallbackRules() {
const t = (this.shop && (this.shop.merchantDiscount || this.shop.usageNote)) || ''
return t.split(/[;;\n]/).map(x => x.trim()).filter(Boolean)
},
shops() {
if (!this.shop) return []
if (this.shop.brandShops && this.shop.brandShops.length) return this.shop.brandShops
// xuchao: 品牌未关联时退化为当前单店一行,模块结构不消失
return [{ shopId: this.shop.shopId, name: this.shop.name, address: this.shop.address,
distance: this.shop.distance, mobile: this.shop.servicePhone,
lng: this.shop.lng, lat: this.shop.lat }]
},
visibleShops() {
return this.showAll ? this.shops : this.shops.slice(0, 4)
}
},
onLoad(options) {
this.shopId = options.id || options.shopId
const lng = uni.getStorageSync('lng')
const lat = uni.getStorageSync('lat')
const params = { shopId: this.shopId }
if (lng) params.lng = lng
if (lat) params.lat = lat
this.$u.api.getStoreDetail(params).then(res => {
if (res.errcode === 0 && res.data) {
this.shop = res.data
} else {
uni.showToast({ title: res.errmsg || '门店不存在', icon: 'none' })
}
})
},
methods: {
goBack() {
const pages = getCurrentPages()
if (pages.length > 1) uni.navigateBack()
else uni.reLaunch({ url: '/pages/index/index' })
},
// xuchao: 付款码——对齐 ysf 项目首页做法:upsdk.qrCodePay() 由云闪付容器原生拉起付款码,无 web 跳转。
// SDK 加载复用加油页验证过的注入模式;非云闪付环境(微信/普通浏览器)给使用引导。
onPayCode() {
this.loadUpSdk().then(ready => {
if (!ready) {
uni.showModal({
title: '请在云闪付App内使用',
content: '付款码需在云闪付App中打开本页面后使用:打开云闪付App → 搜索怀化社保卡活动进入 → 点击付款码。',
showCancel: false,
confirmText: '知道了'
})
return
}
try {
// xuchao: 微信等普通浏览器里 upsdk 脚本能加载但桥永不就绪,pluginReady 回调不到;
// 3 秒无响应即判定非云闪付容器,给使用引导(容器内通常 <1s 已拉起付款码)
let bridged = false
const timer = setTimeout(() => {
if (!bridged) {
uni.showModal({
title: '请在云闪付App内使用',
content: '付款码需在云闪付App中打开本页面后使用:打开云闪付App → 搜索怀化社保卡活动进入 → 点击付款码。',
showCancel: false,
confirmText: '知道了'
})
}
}, 3000)
window.upsdk.pluginReady(() => {
bridged = true
clearTimeout(timer)
try { window.upsdk.qrCodePay() }
catch (e) { uni.showToast({ title: '拉起付款码失败,请重试', icon: 'none' }) }
})
} catch (e) {
uni.showToast({ title: '拉起付款码失败,请重试', icon: 'none' })
}
})
},
// xuchao: upsdk 运行时注入并返回就绪 Promise(与 petrol/orderConfirm 同一模式,全局只注入一次;
// 不能依赖 index.html 静态标签——HBuilderX 构建的 H5 模板不吃根 index.html)
loadUpSdk(timeout = 9000) {
if (typeof window === 'undefined' || typeof document === 'undefined') return Promise.resolve(false)
if (window.upsdk) return Promise.resolve(true)
if (this._upSdkPromise) return this._upSdkPromise
const loading = new Promise(resolve => {
let done = false
const finish = v => { if (!done) { done = true; resolve(v) } }
const exists = document.querySelector('script[data-upsdk]')
if (exists) {
const t0 = Date.now()
const timer = setInterval(() => {
if (window.upsdk) { clearInterval(timer); finish(true) }
else if (Date.now() - t0 > timeout) { clearInterval(timer); finish(false) }
}, 200)
return
}
const s = document.createElement('script')
s.src = 'https://open.95516.com/s/open/js/upsdk.js'
s.setAttribute('data-upsdk', '1')
s.onload = () => finish(!!window.upsdk)
s.onerror = () => finish(false)
document.head.appendChild(s)
setTimeout(() => finish(!!window.upsdk), timeout)
})
this._upSdkPromise = loading
return loading
},
navTo(s) {
if (!s.lng || !s.lat) {
uni.showToast({ title: '该门店暂未录入坐标', icon: 'none' })
return
}
// #ifdef H5
window.open('https://uri.amap.com/marker?position=' + s.lng + ',' + s.lat + '&name=' + encodeURIComponent(s.name), '_blank')
// #endif
},
callShop(s) {
if (!s.mobile) return
uni.makePhoneCall({ phoneNumber: String(s.mobile), fail: () => uni.showToast({ title: '拨号取消', icon: 'none' }) })
}
}
}
</script>
<style>
.page { min-height: 100vh; background: #F6EFE6; }
</style>
<style lang="less" scoped>
.nav-bar {
display: flex; align-items: center; justify-content: space-between;
height: 88rpx; padding: 0 24rpx; padding-top: var(--status-bar-height);
background: #FFF;
}
.back-btn { display: flex; align-items: center; width: 100rpx; }
.back-text { font-size: 28rpx; color: #333; margin-left: 4rpx; }
.nav-title { font-size: 34rpx; font-weight: 600; color: #333; }
.body { padding: 24rpx; }
.head-card {
background: linear-gradient(180deg, #FFF7EC 0%, #FFFDF9 40%, #FFFFFF 100%);
border-radius: 28rpx; padding: 28rpx;
}
.head-top { display: flex; align-items: center; gap: 20rpx; }
.logo-box {
width: 96rpx; height: 96rpx; border-radius: 16rpx; overflow: hidden;
background: #fff; border: 1rpx solid #F2E4D0; flex-shrink: 0;
}
.logo { width: 100%; height: 100%; display: block; }
.head-name {
flex: 1; min-width: 0; font-size: 36rpx; font-weight: 800; color: #33200F;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge {
flex-shrink: 0; min-width: 132rpx; border-radius: 14rpx; padding: 12rpx 16rpx;
background: linear-gradient(160deg, #F0623A, #D8431F);
display: flex; flex-direction: column; align-items: center;
box-shadow: 0 6rpx 14rpx rgba(216, 67, 31, .35);
}
.badge-main { font-size: 30rpx; font-weight: 900; color: #fff; line-height: 1.2; white-space: nowrap; }
.badge-sub { font-size: 18rpx; color: rgba(255, 255, 255, .92); margin-top: 4rpx; white-space: nowrap; }
.head-divider { height: 1rpx; background: #F3E7D7; margin: 24rpx 0 18rpx; }
.head-meta { display: flex; flex-direction: column; gap: 8rpx; }
.meta-line { font-size: 24rpx; color: #8A6E56; }
.pay-btn {
margin-top: 28rpx; height: 88rpx; border-radius: 16rpx;
background: linear-gradient(90deg, #D8431F, #E8542F 55%, #F0703C);
display: flex; align-items: center; justify-content: center; gap: 12rpx;
box-shadow: 0 8rpx 18rpx rgba(216, 67, 31, .28);
}
.pay-btn-text { font-size: 32rpx; font-weight: 700; color: #fff; letter-spacing: 2rpx; }
.card { background: #fff; border-radius: 28rpx; padding: 28rpx; margin-top: 24rpx; }
.card-title { display: flex; align-items: center; gap: 14rpx; font-size: 32rpx; font-weight: 800; color: #33200F; }
.bar { width: 8rpx; height: 30rpx; border-radius: 4rpx; background: linear-gradient(180deg, #F6613C, #E01818); }
.rules-rich { display: block; margin-top: 20rpx; font-size: 28rpx; color: #4A3A2E; line-height: 1.7; }
.rule-line { display: flex; margin-top: 20rpx; }
.rule-no { width: 32rpx; flex-shrink: 0; font-size: 28rpx; color: #4A3A2E; line-height: 1.7; }
.rule-txt { flex: 1; font-size: 28rpx; color: #4A3A2E; line-height: 1.7; }
.rule-empty { display: block; margin-top: 16rpx; font-size: 26rpx; color: #B8A28E; }
.shops-head { display: flex; align-items: center; justify-content: space-between; }
.shops-title { font-size: 32rpx; font-weight: 800; color: #33200F; }
.shops-count { font-size: 24rpx; font-weight: 400; color: #A78D75; }
.shops-more { display: flex; align-items: center; gap: 4rpx; font-size: 26rpx; color: #E0342B; font-weight: 600; }
.chev { width: 10rpx; height: 10rpx; border-top: 3rpx solid #E0342B; border-right: 3rpx solid #E0342B; transform: rotate(45deg); }
.chev.up { transform: rotate(-135deg); width: 8rpx; height: 8rpx; }
.shop-row {
display: flex; align-items: center; gap: 16rpx;
padding: 26rpx 0; border-bottom: 1rpx solid #F5EDE2;
}
.shop-row:last-child { border-bottom: none; }
.pin { flex-shrink: 0; }
.shop-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6rpx; }
.shop-name { font-size: 28rpx; font-weight: 700; color: #33200F; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-addr { font-size: 22rpx; color: #A78D75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-right { display: flex; align-items: center; gap: 14rpx; flex-shrink: 0; }
.shop-dist { font-size: 22rpx; color: #C8542B; margin-right: 4rpx; }
.icon-btn {
width: 56rpx; height: 56rpx; border-radius: 50%; background: #F6F2EC;
display: flex; align-items: center; justify-content: center;
}
.collapse { text-align: center; font-size: 24rpx; color: #A78D75; padding-top: 20rpx; display: flex; align-items: center; justify-content: center; gap: 8rpx; }
.loading-tip { text-align: center; color: #B8A28E; font-size: 26rpx; padding: 120rpx 0; }
</style>