修改商详情页UI
This commit is contained in:
464
.pages-backup/pages.consumer.2026-06-03T00-41-33-509Z.json
Normal file
464
.pages-backup/pages.consumer.2026-06-03T00-41-33-509Z.json
Normal file
@@ -0,0 +1,464 @@
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/main/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/boot",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "用户登录",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/register",
|
||||
"style": {
|
||||
"navigationBarTitleText": "注册"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/forgot-password",
|
||||
"style": {
|
||||
"navigationBarTitleText": "忘记密码"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/terms",
|
||||
"style": {
|
||||
"navigationBarTitleText": "用户协议与隐私政策"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/center",
|
||||
"style": {
|
||||
"navigationBarTitleText": "用户中心"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/profile",
|
||||
"style": {
|
||||
"navigationBarTitleText": "个人资料"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/change-password",
|
||||
"style": {
|
||||
"navigationBarTitleText": "修改密码"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/bind-phone",
|
||||
"style": {
|
||||
"navigationBarTitleText": "绑定手机"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/bind-email",
|
||||
"style": {
|
||||
"navigationBarTitleText": "绑定邮箱"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/main/messages",
|
||||
"style": {
|
||||
"navigationBarTitleText": "消息",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/main/cart",
|
||||
"style": {
|
||||
"navigationBarTitleText": "购物车",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/main/profile",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/main/category",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分类",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "pages/mall/consumer",
|
||||
"pages": [
|
||||
{
|
||||
"path": "settings",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "edit-profile",
|
||||
"style": {
|
||||
"navigationBarTitleText": "编辑资料"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "wallet",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的钱包"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "withdraw",
|
||||
"style": {
|
||||
"navigationBarTitleText": "余额提现"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "search",
|
||||
"style": {
|
||||
"navigationBarTitleText": "搜索",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "product-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "channel-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "频道详情",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "shop-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "店铺详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "coupons",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的优惠券"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "favorites",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的收藏"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "footprint",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的足迹"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "address",
|
||||
"style": {
|
||||
"navigationBarTitleText": "地址"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "address-list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "收货地址"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "address-edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "编辑地址"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "checkout",
|
||||
"style": {
|
||||
"navigationBarTitleText": "确认订单"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "payment",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "payment-success",
|
||||
"style": {
|
||||
"navigationBarTitleText": "支付成功",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "orders",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": true,
|
||||
"backgroundColor": "#f5f5f5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "order-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "logistics",
|
||||
"style": {
|
||||
"navigationBarTitleText": "物流详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "review",
|
||||
"style": {
|
||||
"navigationBarTitleText": "评价晒单"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "refund",
|
||||
"style": {
|
||||
"navigationBarTitleText": "退款/售后"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "apply-refund",
|
||||
"style": {
|
||||
"navigationBarTitleText": "申请售后"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "refund-review",
|
||||
"style": {
|
||||
"navigationBarTitleText": "服务评价"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "chat",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客服聊天",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "chat_new",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客服聊天(新版)"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "subscription/plan-list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "软件订阅"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "subscription/plan-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订阅详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "subscription/subscribe-checkout",
|
||||
"style": {
|
||||
"navigationBarTitleText": "确认订阅"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "subscription/my-subscriptions",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的订阅"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "subscription/followed-shops",
|
||||
"style": {
|
||||
"navigationBarTitleText": "关注店铺"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "points/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "points/signin",
|
||||
"style": {
|
||||
"navigationBarTitleText": "签到"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "points/exchange",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分兑换"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "points/exchange-records",
|
||||
"style": {
|
||||
"navigationBarTitleText": "兑换记录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "red-packets/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的红包"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "bank-cards/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "银行卡管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "bank-cards/add",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加银行卡"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "home-service/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "居家上门服务",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "home-service/apply",
|
||||
"style": {
|
||||
"navigationBarTitleText": "提交服务申请",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "home-service/service-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "预约服务",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "home-service/order-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "服务单详情",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "home-service/feedback",
|
||||
"style": {
|
||||
"navigationBarTitleText": "验收反馈",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "bank-cards/verify",
|
||||
"style": {
|
||||
"navigationBarTitleText": "银行卡验证"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "balance/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "余额"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "my-reviews",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的评价"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "message-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "消息详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "member/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "会员中心"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "product-reviews",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品评价"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"color": "#999999",
|
||||
"selectedColor": "#ff5000",
|
||||
"backgroundColor": "#ffffff",
|
||||
"borderStyle": "black",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/main/index",
|
||||
"text": "首页",
|
||||
"iconPath": "static/tabbar/home.png",
|
||||
"selectedIconPath": "static/tabbar/home-active.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/main/messages",
|
||||
"text": "消息",
|
||||
"iconPath": "static/tabbar/message.png",
|
||||
"selectedIconPath": "static/tabbar/message.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/main/cart",
|
||||
"text": "购物车",
|
||||
"iconPath": "static/tabbar/cart.png",
|
||||
"selectedIconPath": "static/tabbar/cart.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/main/profile",
|
||||
"text": "我的",
|
||||
"iconPath": "static/tabbar/user.png",
|
||||
"selectedIconPath": "static/tabbar/user.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "mall",
|
||||
"navigationBarBackgroundColor": "#FFFFFF",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
"condition": {
|
||||
"current": 0,
|
||||
"list": [
|
||||
{
|
||||
"name": "consumer端",
|
||||
"path": "pages/main/index",
|
||||
"query": "role=consumer"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -313,7 +313,6 @@ export class AkSupaQueryBuilder {
|
||||
params.push(`or=(${orStr})`);
|
||||
}
|
||||
if (this._orString!=null && this._orString !== "") {
|
||||
console.log('[AkSupaQueryBuilder] or字符串:', this._orString)
|
||||
params.push(`or=(${this._orString!!})`);
|
||||
}
|
||||
return params.length > 0 ? params.join('&') : null;
|
||||
@@ -369,7 +368,6 @@ export class AkSupaQueryBuilder {
|
||||
async execute() : Promise<AkReqResponse<any>> {
|
||||
//console.log('execute')
|
||||
const filter = this._buildFilter();
|
||||
console.log('[AkSupaQueryBuilder] execute - 表:', this._table, 'filter:', filter)
|
||||
let res : any;
|
||||
switch (this._action) {
|
||||
case 'select': {
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE public.ml_user_favorites
|
||||
ALTER COLUMN target_id TYPE TEXT USING target_id::text;
|
||||
|
||||
ALTER TABLE public.ml_user_favorites
|
||||
ADD COLUMN IF NOT EXISTS updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ;
|
||||
|
||||
UPDATE public.ml_user_favorites
|
||||
SET updated_at = COALESCE(updated_at, created_at, now())
|
||||
WHERE updated_at IS NULL;
|
||||
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.table_constraints
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name = 'ml_user_favorites'
|
||||
AND constraint_name = 'chk_ml_favorite_type'
|
||||
) THEN
|
||||
ALTER TABLE public.ml_user_favorites DROP CONSTRAINT chk_ml_favorite_type;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
ALTER TABLE public.ml_user_favorites
|
||||
ADD CONSTRAINT chk_ml_favorite_type CHECK (target_type IN (1, 2, 3));
|
||||
|
||||
ALTER TABLE public.ml_user_favorites
|
||||
DROP CONSTRAINT IF EXISTS ml_user_favorites_user_id_target_type_target_id_key;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS uq_ml_user_favorites_user_target_active
|
||||
ON public.ml_user_favorites(user_id, target_type, target_id)
|
||||
WHERE deleted_at IS NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ml_user_favorites_user_deleted_created
|
||||
ON public.ml_user_favorites(user_id, deleted_at, created_at DESC);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ml_user_favorites_target_deleted
|
||||
ON public.ml_user_favorites(target_type, target_id, deleted_at);
|
||||
|
||||
COMMENT ON COLUMN public.ml_user_favorites.target_type IS '1=商品 2=店铺 3=服务';
|
||||
COMMENT ON COLUMN public.ml_user_favorites.target_id IS '收藏目标ID,兼容商品UUID、店铺UUID、服务文本ID';
|
||||
COMMENT ON COLUMN public.ml_user_favorites.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN public.ml_user_favorites.deleted_at IS '软删除时间,NULL为有效收藏';
|
||||
|
||||
ALTER TABLE public.ml_user_favorites ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
DROP POLICY IF EXISTS ml_user_favorites_select_policy ON public.ml_user_favorites;
|
||||
CREATE POLICY ml_user_favorites_select_policy ON public.ml_user_favorites
|
||||
FOR SELECT
|
||||
USING (
|
||||
deleted_at IS NULL
|
||||
AND auth.uid() = (SELECT auth_id FROM public.ak_users WHERE id = user_id)
|
||||
);
|
||||
|
||||
DROP POLICY IF EXISTS ml_user_favorites_insert_policy ON public.ml_user_favorites;
|
||||
CREATE POLICY ml_user_favorites_insert_policy ON public.ml_user_favorites
|
||||
FOR INSERT
|
||||
WITH CHECK (
|
||||
auth.uid() = (SELECT auth_id FROM public.ak_users WHERE id = user_id)
|
||||
);
|
||||
|
||||
DROP POLICY IF EXISTS ml_user_favorites_update_policy ON public.ml_user_favorites;
|
||||
CREATE POLICY ml_user_favorites_update_policy ON public.ml_user_favorites
|
||||
FOR UPDATE
|
||||
USING (
|
||||
auth.uid() = (SELECT auth_id FROM public.ak_users WHERE id = user_id)
|
||||
)
|
||||
WITH CHECK (
|
||||
auth.uid() = (SELECT auth_id FROM public.ak_users WHERE id = user_id)
|
||||
);
|
||||
|
||||
DROP POLICY IF EXISTS ml_user_favorites_delete_policy ON public.ml_user_favorites;
|
||||
CREATE POLICY ml_user_favorites_delete_policy ON public.ml_user_favorites
|
||||
FOR DELETE
|
||||
USING (
|
||||
auth.uid() = (SELECT auth_id FROM public.ak_users WHERE id = user_id)
|
||||
);
|
||||
|
||||
ALTER TABLE public.hss_service_catalog ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
DROP POLICY IF EXISTS hss_service_catalog_public_select ON public.hss_service_catalog;
|
||||
CREATE POLICY hss_service_catalog_public_select ON public.hss_service_catalog
|
||||
FOR SELECT
|
||||
USING (deleted_at IS NULL AND status = 1);
|
||||
|
||||
DROP POLICY IF EXISTS hss_service_catalog_authenticated_select_all_active_record ON public.hss_service_catalog;
|
||||
CREATE POLICY hss_service_catalog_authenticated_select_all_active_record ON public.hss_service_catalog
|
||||
FOR SELECT TO authenticated
|
||||
USING (deleted_at IS NULL);
|
||||
|
||||
COMMIT;
|
||||
14
mall_sql/migrations/20260603_review_public_profiles.sql
Normal file
14
mall_sql/migrations/20260603_review_public_profiles.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- 为商品评价提供最小公开用户资料视图,避免客户端直接访问 auth.users 或整表 ak_users。
|
||||
|
||||
create or replace view public.ak_user_public_profiles as
|
||||
select
|
||||
id,
|
||||
coalesce(nullif(username, ''), '匿名用户') as username,
|
||||
coalesce(avatar_url, '') as avatar_url
|
||||
from public.ak_users;
|
||||
|
||||
comment on view public.ak_user_public_profiles is '商品评价等前台展示使用的最小公开用户资料视图';
|
||||
|
||||
grant select on public.ak_user_public_profiles to anon;
|
||||
grant select on public.ak_user_public_profiles to authenticated;
|
||||
grant select on public.ak_user_public_profiles to service_role;
|
||||
@@ -2094,13 +2094,23 @@ const familyItems = [
|
||||
|
||||
// 初始化页面
|
||||
const initPage = () => {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
statusBarHeight.value = systemInfo.statusBarHeight != null ? systemInfo.statusBarHeight : 20
|
||||
const searchContentHeight = Math.round(68 * systemInfo.screenWidth / 750)
|
||||
const searchTopGap = Math.round(14 * systemInfo.screenWidth / 750)
|
||||
const headerBottomPadding = Math.round(10 * systemInfo.screenWidth / 750)
|
||||
const moduleRowHeight = Math.round(62 * systemInfo.screenWidth / 750)
|
||||
const categoryRowHeight = Math.round(56 * systemInfo.screenWidth / 750)
|
||||
let screenWidth = 375
|
||||
let screenHeight = 667
|
||||
let safeAreaBottom = 0
|
||||
try {
|
||||
const windowInfo = uni.getWindowInfo()
|
||||
statusBarHeight.value = windowInfo.statusBarHeight != null ? windowInfo.statusBarHeight : 20
|
||||
screenWidth = windowInfo.screenWidth != null ? windowInfo.screenWidth : (windowInfo.windowWidth != null ? windowInfo.windowWidth : 375)
|
||||
screenHeight = windowInfo.screenHeight != null ? windowInfo.screenHeight : (windowInfo.windowHeight != null ? windowInfo.windowHeight : 667)
|
||||
safeAreaBottom = windowInfo.safeArea != null ? windowInfo.safeArea.bottom : 0
|
||||
} catch (e) {
|
||||
statusBarHeight.value = 20
|
||||
}
|
||||
const searchContentHeight = Math.round(68 * screenWidth / 750)
|
||||
const searchTopGap = Math.round(14 * screenWidth / 750)
|
||||
const headerBottomPadding = Math.round(10 * screenWidth / 750)
|
||||
const moduleRowHeight = Math.round(62 * screenWidth / 750)
|
||||
const categoryRowHeight = Math.round(56 * screenWidth / 750)
|
||||
|
||||
let menuInfo: CapsuleButtonInfo | null = null
|
||||
// #ifdef MP-WEIXIN || MP-ALIPAY
|
||||
@@ -2116,7 +2126,7 @@ const initPage = () => {
|
||||
const navHeight = (menuInfo.top - statusBarHeight.value) * 2 + menuInfo.height
|
||||
navBarHeight.value = navHeight
|
||||
|
||||
const rightReserve = systemInfo.screenWidth - menuInfo.left + 8
|
||||
const rightReserve = screenWidth - menuInfo.left + 8
|
||||
navBarRight.value = rightReserve
|
||||
const searchRowTotalH = statusBarHeight.value + Math.max(navHeight, moduleRowHeight) + searchTopGap + searchContentHeight + headerBottomPadding
|
||||
searchRowStyle.value = `padding-right:${rightReserve}px;`
|
||||
@@ -2132,10 +2142,9 @@ const initPage = () => {
|
||||
headerStyle.value = ``
|
||||
categoryBarHeightPx.value = categoryRowHeight
|
||||
headerPlaceholderHeight.value = navbarTotalHeight.value + categoryBarHeightPx.value
|
||||
const safeBottom = systemInfo.safeArea != null ? systemInfo.screenHeight - systemInfo.safeArea.bottom : 20
|
||||
const safeBottom = safeAreaBottom > 0 ? (screenHeight - safeAreaBottom) : 20
|
||||
bottomSafeArea.value = safeBottom > 0 ? safeBottom : 20
|
||||
|
||||
const screenWidth = systemInfo.screenWidth
|
||||
isMobile.value = screenWidth < 768
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -21,10 +21,15 @@
|
||||
<text v-for="tag in summaryGuaranteeTags" :key="tag.id" class="summary-tag">{{ tag.label }}</text>
|
||||
</view>
|
||||
<view class="summary-price-row">
|
||||
<view class="summary-price-main">
|
||||
<text class="summary-price-prefix">¥</text>
|
||||
<text class="summary-price">{{ minPriceText }}</text>
|
||||
<text class="summary-price-unit">起</text>
|
||||
</view>
|
||||
<view class="summary-favorite-btn" @click="toggleServiceFavorite">
|
||||
<text class="summary-favorite-btn-text">{{ isFavorite ? '已收藏' : '收藏服务' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<ServicePanel title="Step1 服务地址" subtitle="确认上门地址、楼层与入户条件。">
|
||||
@@ -303,6 +308,7 @@ import { createHomeServiceApplication, fetchHomeServiceCatalog, fetchHomeService
|
||||
import { shouldUseCareTaskPath } from '@/services/serviceOrderService.uts'
|
||||
import { HomeServiceApplicationDraftType, HomeServiceCatalogType, HomeServicePackageType, HomeServiceSelectedAddressType } from '@/types/home-service.uts'
|
||||
import { getCurrentUser, getCurrentUserId } from '@/utils/store.uts'
|
||||
import { supabaseService } from '@/utils/supabaseService.uts'
|
||||
import { goToLogin } from '@/utils/utils.uts'
|
||||
import {
|
||||
HomeServiceAgencyType,
|
||||
@@ -382,6 +388,7 @@ const serviceValidity = ref('预约后 30 天内可服务')
|
||||
const serviceSuitableFor = ref('行动不便、术后恢复、慢病随访老人')
|
||||
const serviceImageText = ref('照护')
|
||||
const serviceExcludeText = ref('高风险处置、住院陪护、急诊陪诊')
|
||||
const isFavorite = ref(false)
|
||||
|
||||
const bookingDays = ref<Array<BookingDayOptionType>>([])
|
||||
const bookingSlots = ref<Array<BookingTimeSlotType>>([])
|
||||
@@ -782,6 +789,7 @@ async function loadData() {
|
||||
}
|
||||
if (matchedService == null) {
|
||||
setUnavailableServiceState()
|
||||
await syncFavoriteState()
|
||||
return
|
||||
}
|
||||
serviceTitle.value = matchedService.name
|
||||
@@ -796,11 +804,34 @@ async function loadData() {
|
||||
servicePackages.value = mapServicePackages(packages)
|
||||
if (servicePackages.value.length == 0) {
|
||||
setUnavailableServiceState()
|
||||
await syncFavoriteState()
|
||||
return
|
||||
}
|
||||
const firstPackage = servicePackages.value[0]
|
||||
servicePrice.value = firstPackage.price
|
||||
serviceDuration.value = firstPackage.duration
|
||||
await syncFavoriteState()
|
||||
}
|
||||
|
||||
async function syncFavoriteState(): Promise<void> {
|
||||
const userId = getCurrentUserId()
|
||||
if (userId == '') {
|
||||
isFavorite.value = false
|
||||
return
|
||||
}
|
||||
isFavorite.value = await supabaseService.checkFavorite(serviceId.value, 'service')
|
||||
}
|
||||
|
||||
async function toggleServiceFavorite(): Promise<void> {
|
||||
if (!(await ensureLogin())) {
|
||||
return
|
||||
}
|
||||
const nextState = await supabaseService.toggleFavorite(serviceId.value, 'service')
|
||||
isFavorite.value = nextState
|
||||
uni.showToast({
|
||||
title: nextState ? '已收藏服务' : '已取消收藏',
|
||||
icon: nextState ? 'success' : 'none'
|
||||
})
|
||||
}
|
||||
|
||||
async function ensureLogin(): Promise<boolean> {
|
||||
@@ -1105,6 +1136,7 @@ function refreshBookingSlots(): void {
|
||||
|
||||
onShow(() => {
|
||||
loadCachedSelectedAddress()
|
||||
syncFavoriteState()
|
||||
const now = new Date()
|
||||
const day = selectedDay.value
|
||||
if (day != null) {
|
||||
@@ -1358,6 +1390,12 @@ onUnload(() => {
|
||||
|
||||
.summary-price-row {
|
||||
margin-top: 12rpx;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.summary-price-main {
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
@@ -1377,6 +1415,26 @@ onUnload(() => {
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.summary-favorite-btn {
|
||||
min-width: 132rpx;
|
||||
height: 56rpx;
|
||||
padding: 0 22rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fff3ee;
|
||||
border-width: 1rpx;
|
||||
border-style: solid;
|
||||
border-color: #ffd0c2;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.summary-favorite-btn-text {
|
||||
font-size: 22rpx;
|
||||
color: #d85b34;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
@@ -1,33 +1,57 @@
|
||||
<!-- 消费者端 - 商品详情页 -->
|
||||
<template>
|
||||
<view class="product-detail-page">
|
||||
<scroll-view class="page-scroll" direction="vertical">
|
||||
<view class="hero-section">
|
||||
<view class="custom-header" :style="`height:${customHeaderHeight}px;`">
|
||||
<view class="header-fade-layer" :style="getHeaderFadeStyle()">
|
||||
<view class="header-main-row">
|
||||
<view class="header-back-space" :style="`width:${navButtonHeight + 20}px;`"></view>
|
||||
<view class="header-search-box" @click="goToSearch">
|
||||
<text class="header-search-icon">⌕</text>
|
||||
<text class="header-search-placeholder">{{ getDisplayTitle() }}</text>
|
||||
</view>
|
||||
<view class="header-capsule-reserve" :style="`width:${navRightReserve}px;`"></view>
|
||||
</view>
|
||||
|
||||
<view class="header-tabs-row">
|
||||
<view class="header-tab-item" @click="scrollToSection('goods')">
|
||||
<text :class="activeTab == 'goods' ? 'header-tab-text active' : 'header-tab-text'">宝贝</text>
|
||||
<view v-if="activeTab == 'goods'" class="header-tab-line"></view>
|
||||
</view>
|
||||
<view class="header-tab-item" @click="scrollToSection('comments')">
|
||||
<text :class="activeTab == 'comments' ? 'header-tab-text active' : 'header-tab-text'">评论</text>
|
||||
<view v-if="activeTab == 'comments'" class="header-tab-line"></view>
|
||||
</view>
|
||||
<view class="header-tab-item" @click="scrollToSection('detail')">
|
||||
<text :class="activeTab == 'detail' ? 'header-tab-text active' : 'header-tab-text'">详情</text>
|
||||
<view v-if="activeTab == 'detail'" class="header-tab-line"></view>
|
||||
</view>
|
||||
<view class="header-tab-item" @click="scrollToSection('recommend')">
|
||||
<text :class="activeTab == 'recommend' ? 'header-tab-text active' : 'header-tab-text'">推荐</text>
|
||||
<view v-if="activeTab == 'recommend'" class="header-tab-line"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="persistent-back-btn" :style="getBackButtonStyle()" @click="goBack">
|
||||
<text class="persistent-back-text">‹</text>
|
||||
</view>
|
||||
|
||||
<scroll-view class="page-scroll" direction="vertical" @scroll="onProductScroll" :scroll-top="targetScrollTop" scroll-with-animation="true">
|
||||
<view id="section-goods" class="hero-section">
|
||||
<swiper class="hero-swiper" :indicator-dots="false" :autoplay="false" @change="onSwiperChange">
|
||||
<swiper-item v-for="(image, index) in getProductImages()" :key="index">
|
||||
<image :src="image" class="hero-image" mode="aspectFill" @error="handleProductImageError(index)" @click="previewImage(index)" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="hero-indicator">{{ currentImageIndex + 1 }}/{{ getProductImages().length }}</view>
|
||||
|
||||
<view class="floating-nav left-nav" :style="getNavLeftStyle()">
|
||||
<view class="floating-btn" @click="goBack">
|
||||
<text class="floating-btn-text">‹</text>
|
||||
</view>
|
||||
<view class="floating-btn" @click="goToSearch">
|
||||
<text class="floating-btn-text">⌕</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="floating-nav right-nav" :style="getNavRightStyle()">
|
||||
<view class="floating-btn" @click="openActionPanel">
|
||||
<text class="floating-btn-text">...</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content-wrap">
|
||||
<view class="info-card price-sales-card">
|
||||
<view v-if="isProductOffShelf()" class="off-shelf-tip">
|
||||
<text class="off-shelf-tip-text">商品已下架,当前仅支持查看,暂不支持购买</text>
|
||||
</view>
|
||||
<view v-if="memberDiscount > 0 && memberPrice > 0 && memberPrice < product.price" class="vip-row">
|
||||
<view class="vip-badge">
|
||||
<text class="vip-badge-text">VIP</text>
|
||||
@@ -126,7 +150,7 @@
|
||||
<text class="enter-shop">进店 ></text>
|
||||
</view>
|
||||
|
||||
<view class="info-card review-card">
|
||||
<view id="section-comments" class="info-card review-card">
|
||||
<view class="card-header-row">
|
||||
<text class="card-title">商品评论</text>
|
||||
<text class="card-link-text" @click="viewAllReviews">查看全部 ></text>
|
||||
@@ -151,7 +175,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="info-card detail-card">
|
||||
<view id="section-detail" class="info-card detail-card">
|
||||
<view class="card-header-row">
|
||||
<text class="card-title">商品详情</text>
|
||||
<text class="card-link-text" @click="showParamsModal">商品参数 ></text>
|
||||
@@ -163,7 +187,7 @@
|
||||
</view>
|
||||
|
||||
<view class="detail-images" v-if="getDetailImages().length > 0">
|
||||
<image v-for="(img, index) in getDetailImages()" :key="'detail-' + index" :src="img" class="detail-image" mode="widthFix" @error="handleDetailImageError(index)" @click="previewDetailImage(index)" />
|
||||
<image v-for="(img, index) in getDetailImages()" :key="'detail-' + index" :src="img" class="detail-image" mode="widthFix" @error="handleDetailImageError(index)" @click="previewDetailImage(index)" @load="onDetailImageLoad" />
|
||||
</view>
|
||||
|
||||
<text v-else-if="getDetailDescription() != ''" class="description-text">{{ getDetailDescription() }}</text>
|
||||
@@ -172,6 +196,15 @@
|
||||
<text class="empty-detail-text">暂无商品详情</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view id="section-recommend" class="info-card recommend-card">
|
||||
<view class="card-header-row">
|
||||
<text class="card-title">推荐</text>
|
||||
</view>
|
||||
<view class="empty-recommend-state">
|
||||
<text class="empty-recommend-text">暂无推荐商品</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
@@ -195,8 +228,8 @@
|
||||
</view>
|
||||
|
||||
<view class="btn-group">
|
||||
<button class="cart-btn" @click="addToCart">加入购物车</button>
|
||||
<button class="buy-btn" @click="buyNow">立即购买</button>
|
||||
<button :class="['cart-btn', { 'btn-disabled': isProductOffShelf() }]" @click="addToCart">{{ isProductOffShelf() ? '已下架' : '加入购物车' }}</button>
|
||||
<button :class="['buy-btn', { 'btn-disabled': isProductOffShelf() }]" @click="buyNow">{{ isProductOffShelf() ? '暂不可购买' : '立即购买' }}</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -441,7 +474,19 @@ export default {
|
||||
reviewPreview: [] as Array<ProductReviewPreviewType>,
|
||||
reviewLoading: false,
|
||||
productGuarantees: [] as Array<ProductGuaranteeType>,
|
||||
detailImages: [] as Array<string>
|
||||
detailImages: [] as Array<string>,
|
||||
currentScrollTop: 0 as number,
|
||||
headerOpacity: 0 as number,
|
||||
activeTab: 'goods' as string,
|
||||
targetScrollTop: 0 as number,
|
||||
customHeaderHeight: 0 as number,
|
||||
sectionOffsets: new UTSJSONObject(),
|
||||
isProgrammaticScrolling: false as boolean,
|
||||
capsuleLeft: 0 as number,
|
||||
capsuleBottom: 0 as number,
|
||||
headerMainRowHeight: 44 as number,
|
||||
headerTabsRowHeight: 40 as number,
|
||||
searchRightReserve: 16 as number
|
||||
}
|
||||
},
|
||||
onLoad(options: any) {
|
||||
@@ -473,7 +518,7 @@ export default {
|
||||
}
|
||||
|
||||
this.productGuarantees = this.getDefaultGuarantees()
|
||||
this.reviewPreview = this.getMockReviews()
|
||||
this.reviewPreview = [] as Array<ProductReviewPreviewType>
|
||||
|
||||
if (productId != null) {
|
||||
this.loadProductDetail(productId, {
|
||||
@@ -485,6 +530,10 @@ export default {
|
||||
this.checkFavoriteStatus(productId)
|
||||
this.saveFootprint(productId)
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.measureSections()
|
||||
}, 600)
|
||||
},
|
||||
onShow() {
|
||||
this.refreshCartBadgeCount()
|
||||
@@ -589,13 +638,25 @@ export default {
|
||||
},
|
||||
|
||||
initImmersiveLayout() {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
this.statusBarHeight = systemInfo.statusBarHeight ?? 0
|
||||
let windowWidth = 375
|
||||
try {
|
||||
const windowInfo = uni.getWindowInfo()
|
||||
this.statusBarHeight = windowInfo.statusBarHeight ?? 0
|
||||
windowWidth = windowInfo.windowWidth ?? 375
|
||||
} catch (e) {
|
||||
this.statusBarHeight = 0
|
||||
}
|
||||
this.capsuleTop = this.statusBarHeight > 0 ? this.statusBarHeight : 12
|
||||
this.capsuleHeight = 32
|
||||
this.navButtonTop = this.capsuleTop
|
||||
this.navButtonHeight = this.capsuleHeight
|
||||
this.navRightReserve = 16
|
||||
this.capsuleLeft = windowWidth - 100
|
||||
this.capsuleBottom = this.capsuleTop + this.capsuleHeight
|
||||
this.headerMainRowHeight = 44
|
||||
this.headerTabsRowHeight = 40
|
||||
this.searchRightReserve = 16
|
||||
this.customHeaderHeight = this.statusBarHeight + this.headerMainRowHeight + this.headerTabsRowHeight
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
try {
|
||||
@@ -605,13 +666,18 @@ export default {
|
||||
this.capsuleHeight = menuBtn.height > 0 ? menuBtn.height : 32
|
||||
this.navButtonTop = menuBtn.top
|
||||
this.navButtonHeight = this.capsuleHeight
|
||||
const screenWidth = systemInfo.screenWidth ?? systemInfo.windowWidth
|
||||
this.navRightReserve = (screenWidth - menuBtn.left) + 12
|
||||
this.navRightReserve = (windowWidth - menuBtn.left) + 12
|
||||
this.capsuleLeft = menuBtn.left
|
||||
this.capsuleBottom = menuBtn.bottom ?? (menuBtn.top + menuBtn.height)
|
||||
this.searchRightReserve = menuBtn.left - 8
|
||||
}
|
||||
} catch (e) {
|
||||
this.navButtonTop = this.statusBarHeight > 0 ? this.statusBarHeight + 6 : 16
|
||||
this.navButtonHeight = 32
|
||||
this.navRightReserve = 16
|
||||
this.capsuleLeft = windowWidth - 100
|
||||
this.capsuleBottom = this.navButtonTop + 32
|
||||
this.searchRightReserve = 16
|
||||
}
|
||||
// #endif
|
||||
|
||||
@@ -624,14 +690,106 @@ export default {
|
||||
if (this.navRightReserve < 16) {
|
||||
this.navRightReserve = 16
|
||||
}
|
||||
if (this.searchRightReserve < 16) {
|
||||
this.searchRightReserve = 16
|
||||
}
|
||||
this.customHeaderHeight = this.statusBarHeight + this.headerMainRowHeight + this.headerTabsRowHeight
|
||||
},
|
||||
|
||||
getNavLeftStyle(): string {
|
||||
return `top:${this.navButtonTop}px;height:${this.navButtonHeight}px;`
|
||||
getHeaderFadeStyle(): string {
|
||||
const opacity = this.headerOpacity
|
||||
const translateY = (1 - opacity) * (-6)
|
||||
const h = this.statusBarHeight + this.headerMainRowHeight + this.headerTabsRowHeight
|
||||
const pt = this.statusBarHeight
|
||||
const pointerEvents = opacity < 0.05 ? 'none' : 'auto'
|
||||
return `opacity:${opacity};transform:translateY(${translateY}px);height:${h}px;padding-top:${pt}px;pointer-events:${pointerEvents};`
|
||||
},
|
||||
|
||||
getNavRightStyle(): string {
|
||||
return `top:${this.navButtonTop}px;height:${this.navButtonHeight}px;right:${this.navRightReserve}px;`
|
||||
getBackButtonStyle(): string {
|
||||
const top = this.navButtonTop
|
||||
const height = this.navButtonHeight
|
||||
const bgOpacity = this.headerOpacity > 0.8 ? 0 : 0.88
|
||||
return `top:${top}px;height:${height}px;background-color:rgba(255,255,255,${bgOpacity});`
|
||||
},
|
||||
|
||||
onProductScroll(e: { detail: { scrollTop: number } }) {
|
||||
const current = e.detail.scrollTop
|
||||
this.currentScrollTop = current
|
||||
|
||||
const fadeStart = 16
|
||||
const fadeEnd = 128
|
||||
const progress = (current - fadeStart) / (fadeEnd - fadeStart)
|
||||
this.headerOpacity = Math.max(0, Math.min(1, progress))
|
||||
|
||||
if (!this.isProgrammaticScrolling) {
|
||||
const offsets = this.sectionOffsets
|
||||
if (offsets != null) {
|
||||
const goodsOffset = offsets.getNumber('goods') ?? 0
|
||||
const commentsOffset = offsets.getNumber('comments') ?? 999999
|
||||
const detailOffset = offsets.getNumber('detail') ?? 999999
|
||||
const recommendOffset = offsets.getNumber('recommend') ?? 999999
|
||||
|
||||
const visualTop = current + this.customHeaderHeight + 20
|
||||
|
||||
let nextTab = 'goods'
|
||||
if (visualTop >= recommendOffset && recommendOffset < 999999) {
|
||||
nextTab = 'recommend'
|
||||
} else if (visualTop >= detailOffset && detailOffset < 999999) {
|
||||
nextTab = 'detail'
|
||||
} else if (visualTop >= commentsOffset && commentsOffset < 999999) {
|
||||
nextTab = 'comments'
|
||||
} else {
|
||||
nextTab = 'goods'
|
||||
}
|
||||
|
||||
if (nextTab != this.activeTab) {
|
||||
this.activeTab = nextTab
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
scrollToSection(tabKey: string) {
|
||||
const offsets = this.sectionOffsets
|
||||
if (offsets == null) return
|
||||
const offset = offsets.getNumber(tabKey)
|
||||
if (offset != null && offset >= 0) {
|
||||
let target = tabKey == 'goods' ? 0 : Math.max(0, offset - this.customHeaderHeight)
|
||||
this.isProgrammaticScrolling = true
|
||||
this.targetScrollTop = -1
|
||||
setTimeout(() => {
|
||||
this.targetScrollTop = target
|
||||
setTimeout(() => { this.isProgrammaticScrolling = false }, 400)
|
||||
}, 20)
|
||||
this.activeTab = tabKey
|
||||
}
|
||||
},
|
||||
|
||||
measureSections() {
|
||||
const sectionIds = ['section-goods', 'section-comments', 'section-detail', 'section-recommend']
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
for (let i = 0; i < sectionIds.length; i++) {
|
||||
query.select('#' + sectionIds[i]).boundingClientRect()
|
||||
}
|
||||
query.exec((res: any) => {
|
||||
if (res == null || !Array.isArray(res)) return
|
||||
const offsets = new UTSJSONObject()
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
const rect = res[i]
|
||||
if (rect != null && rect.top != null) {
|
||||
const key = sectionIds[i].replace('section-', '')
|
||||
offsets.set(key, rect.top + this.currentScrollTop)
|
||||
}
|
||||
}
|
||||
this.sectionOffsets = offsets
|
||||
this.customHeaderHeight = this.statusBarHeight + this.headerMainRowHeight + this.headerTabsRowHeight
|
||||
})
|
||||
},
|
||||
|
||||
onDetailImageLoad() {
|
||||
setTimeout(() => {
|
||||
this.measureSections()
|
||||
}, 300)
|
||||
},
|
||||
|
||||
goBack() {
|
||||
@@ -671,7 +829,7 @@ export default {
|
||||
}
|
||||
})
|
||||
|
||||
const footprintData = uni.getStorageSync('footprints') as string | null
|
||||
const footprintData = uni.getStorageSync('footprints_v2') as string | null
|
||||
let footprints: Array<FootprintItemType> = []
|
||||
|
||||
if (footprintData != null && footprintData !== '') {
|
||||
@@ -685,27 +843,16 @@ export default {
|
||||
const productIdStr = productId
|
||||
footprints = footprints.filter(function(item) {
|
||||
const itemObj = item as UTSJSONObject
|
||||
const itemId = itemObj.getString('id') ?? ''
|
||||
const itemId = itemObj.getString('productId') ?? itemObj.getString('id') ?? ''
|
||||
return itemId != productIdStr
|
||||
})
|
||||
|
||||
const productImage = this.product.images.length > 0 ? this.product.images[0] : this.defaultImage
|
||||
footprints.unshift({
|
||||
id: this.product.id,
|
||||
name: this.product.name,
|
||||
price: this.product.price,
|
||||
original_price: this.product.original_price,
|
||||
image: productImage,
|
||||
sales: this.product.sales,
|
||||
shopId: this.merchant.id,
|
||||
shopName: this.merchant.shop_name,
|
||||
viewTime: Date.now()
|
||||
})
|
||||
footprints.unshift(this.getFootprintCachePayload())
|
||||
|
||||
if (footprints.length > 50) {
|
||||
footprints = footprints.slice(0, 50)
|
||||
if (footprints.length > 200) {
|
||||
footprints = footprints.slice(0, 200)
|
||||
}
|
||||
uni.setStorageSync('footprints', JSON.stringify(footprints))
|
||||
uni.setStorageSync('footprints_v2', JSON.stringify(footprints))
|
||||
},
|
||||
|
||||
async loadProductDetail(productId: string, options: any = {}) {
|
||||
@@ -997,20 +1144,14 @@ export default {
|
||||
this.reviewCount = parsedReviews.length
|
||||
}
|
||||
} else {
|
||||
this.reviewPreview = this.getMockReviews()
|
||||
if (this.reviewCount <= 0) {
|
||||
this.reviewCount = this.reviewPreview.length
|
||||
}
|
||||
this.reviewPreview = [] as Array<ProductReviewPreviewType>
|
||||
if (this.reviewRating <= 0) {
|
||||
this.reviewRating = 5
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载商品评论失败:', e)
|
||||
this.reviewPreview = this.getMockReviews()
|
||||
if (this.reviewCount <= 0) {
|
||||
this.reviewCount = this.reviewPreview.length
|
||||
}
|
||||
this.reviewPreview = [] as Array<ProductReviewPreviewType>
|
||||
if (this.reviewRating <= 0) {
|
||||
this.reviewRating = 5
|
||||
}
|
||||
@@ -1195,6 +1336,10 @@ export default {
|
||||
if (trimmed.indexOf('https://picsum.photos/') == 0) return this.defaultImage
|
||||
if (trimmed.indexOf('http://picsum.photos/') == 0) return this.defaultImage
|
||||
if (trimmed.indexOf('blob:') == 0) return this.defaultImage
|
||||
if (trimmed.indexOf('/static/service/') == 0) return this.defaultImage
|
||||
if (trimmed.indexOf('/static/images/product/') == 0) return this.defaultImage
|
||||
if (trimmed.indexOf('__tmp__/') >= 0) return this.defaultImage
|
||||
if (trimmed.indexOf('http://') == 0) return this.defaultImage
|
||||
return trimmed
|
||||
},
|
||||
|
||||
@@ -1427,6 +1572,30 @@ export default {
|
||||
this.selectedSpec = this.getSkuSpecText(sku)
|
||||
},
|
||||
|
||||
isProductOffShelf(): boolean {
|
||||
return this.product.status != null && this.product.status !== 1
|
||||
},
|
||||
|
||||
showOffShelfToast() {
|
||||
uni.showToast({ title: '该商品已下架', icon: 'none' })
|
||||
},
|
||||
|
||||
getFootprintCachePayload(): UTSJSONObject {
|
||||
const payload = new UTSJSONObject()
|
||||
const productImage = this.product.images.length > 0 ? this.product.images[0] : this.defaultImage
|
||||
payload.set('footprintId', '')
|
||||
payload.set('productId', this.product.id)
|
||||
payload.set('name', this.product.name)
|
||||
payload.set('price', this.product.price)
|
||||
payload.set('originalPrice', this.product.original_price ?? 0)
|
||||
payload.set('image', productImage)
|
||||
payload.set('merchantId', this.merchant.id != '' ? this.merchant.id : this.product.merchant_id)
|
||||
payload.set('viewTime', Date.now())
|
||||
payload.set('saleStatus', this.product.status ?? 0)
|
||||
payload.set('isOffShelf', this.isProductOffShelf())
|
||||
return payload
|
||||
},
|
||||
|
||||
getSkuSpecText(sku: ProductSkuType): string {
|
||||
if (sku.specifications != null) {
|
||||
const specs = sku.specifications as UTSJSONObject
|
||||
@@ -1451,9 +1620,13 @@ export default {
|
||||
},
|
||||
|
||||
async addToCart() {
|
||||
if (this.isProductOffShelf()) {
|
||||
this.showOffShelfToast()
|
||||
return
|
||||
}
|
||||
const userId = supabaseService.getCurrentUserId()
|
||||
if (userId == null || userId === '') {
|
||||
goToLogin(`/pages/mall/consumer/product-detail?id=${this.product.id}`)
|
||||
goToLogin(`/pages/mall/consumer/product-detail?productId=${this.product.id}`)
|
||||
return
|
||||
}
|
||||
if (this.productSkus.length > 0 && (this.selectedSkuId == null || this.selectedSkuId === '')) {
|
||||
@@ -1489,9 +1662,13 @@ export default {
|
||||
},
|
||||
|
||||
buyNow() {
|
||||
if (this.isProductOffShelf()) {
|
||||
this.showOffShelfToast()
|
||||
return
|
||||
}
|
||||
const userId = supabaseService.getCurrentUserId()
|
||||
if (userId == null || userId === '') {
|
||||
goToLogin(`/pages/mall/consumer/product-detail?id=${this.product.id}`)
|
||||
goToLogin(`/pages/mall/consumer/product-detail?productId=${this.product.id}`)
|
||||
return
|
||||
}
|
||||
if (this.productSkus.length > 0 && (this.selectedSkuId == null || this.selectedSkuId === '')) {
|
||||
@@ -1535,7 +1712,7 @@ export default {
|
||||
if (this.product.id == '') return
|
||||
const userId = supabaseService.getCurrentUserId()
|
||||
if (userId == null || userId === '') {
|
||||
goToLogin(`/pages/mall/consumer/product-detail?id=${this.product.id}`)
|
||||
goToLogin(`/pages/mall/consumer/product-detail?productId=${this.product.id}`)
|
||||
return
|
||||
}
|
||||
uni.showLoading({ title: '处理中' })
|
||||
@@ -1838,7 +2015,7 @@ export default {
|
||||
|
||||
copyLink() {
|
||||
this.hideSharePopup()
|
||||
const shareLink = `pages/mall/consumer/product-detail?id=${this.product.id}`
|
||||
const shareLink = `pages/mall/consumer/product-detail?productId=${this.product.id}`
|
||||
uni.setClipboardData({
|
||||
data: shareLink,
|
||||
success: () => {
|
||||
@@ -1928,46 +2105,142 @@ export default {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.floating-nav {
|
||||
.custom-header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.header-fade-layer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: #ffffff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.header-main-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
z-index: 20;
|
||||
flex: 1;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.left-nav {
|
||||
left: 24rpx;
|
||||
.header-back-space {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.right-nav {
|
||||
right: 24rpx;
|
||||
}
|
||||
|
||||
.floating-btn {
|
||||
min-width: 72rpx;
|
||||
height: 100%;
|
||||
padding: 0 20rpx;
|
||||
.header-search-box {
|
||||
flex: 1;
|
||||
height: 64rpx;
|
||||
background-color: #f5f6f8;
|
||||
border-radius: 999rpx;
|
||||
background-color: rgba(255, 255, 255, 0.88);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.header-search-icon {
|
||||
font-size: 28rpx;
|
||||
color: #9aa1ab;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.header-search-placeholder {
|
||||
font-size: 26rpx;
|
||||
color: #9aa1ab;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.header-capsule-reserve {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.header-tabs-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
height: 80rpx;
|
||||
padding-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.header-tab-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 14rpx;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
|
||||
position: relative;
|
||||
height: 100%;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.right-nav .floating-btn {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.floating-btn-text {
|
||||
.header-tab-text {
|
||||
font-size: 28rpx;
|
||||
color: #5f6670;
|
||||
}
|
||||
|
||||
.header-tab-text.active {
|
||||
color: #ff4d24;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.header-tab-line {
|
||||
position: absolute;
|
||||
bottom: 8rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 32rpx;
|
||||
height: 4rpx;
|
||||
background-color: #ff4d24;
|
||||
border-radius: 999rpx;
|
||||
}
|
||||
|
||||
.persistent-back-btn {
|
||||
position: fixed;
|
||||
left: 16rpx;
|
||||
width: 72rpx;
|
||||
border-radius: 999rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 31;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.persistent-back-text {
|
||||
font-size: 36rpx;
|
||||
color: #1f2329;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.recommend-card {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.empty-recommend-state {
|
||||
padding: 40rpx 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.empty-recommend-text {
|
||||
font-size: 24rpx;
|
||||
color: #9aa1ab;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
margin-top: -20rpx;
|
||||
padding: 0 20rpx 180rpx;
|
||||
@@ -1987,6 +2260,19 @@ export default {
|
||||
background: linear-gradient(180deg, #fff8f4 0%, #ffffff 72%);
|
||||
}
|
||||
|
||||
.off-shelf-tip {
|
||||
margin-bottom: 18rpx;
|
||||
padding: 14rpx 18rpx;
|
||||
border-radius: 18rpx;
|
||||
background-color: #fff1f0;
|
||||
}
|
||||
|
||||
.off-shelf-tip-text {
|
||||
font-size: 22rpx;
|
||||
color: #d4380d;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.vip-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -2653,6 +2939,11 @@ export default {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-disabled {
|
||||
background: #d8dbe1 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.spec-modal,
|
||||
.params-modal,
|
||||
.popup-mask,
|
||||
@@ -3067,6 +3358,3 @@ export default {
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
73
sql/20260603_footprint_soft_delete_and_product_status.sql
Normal file
73
sql/20260603_footprint_soft_delete_and_product_status.sql
Normal file
@@ -0,0 +1,73 @@
|
||||
-- 足迹软删除兼容补丁
|
||||
-- 说明:
|
||||
-- 1. 商品上下架状态直接复用 public.ml_products.status
|
||||
-- 1 = 上架
|
||||
-- 2 = 下架
|
||||
-- 3 = 草稿
|
||||
-- 4 = 删除
|
||||
-- 2. 足迹表兼容两种历史命名:
|
||||
-- public.ml_user_footprints
|
||||
-- public.ml_browse_history
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
target_table text;
|
||||
BEGIN
|
||||
FOREACH target_table IN ARRAY ARRAY['ml_user_footprints', 'ml_browse_history']
|
||||
LOOP
|
||||
IF EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name = target_table
|
||||
) THEN
|
||||
EXECUTE format(
|
||||
'ALTER TABLE public.%I ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ',
|
||||
target_table
|
||||
);
|
||||
|
||||
EXECUTE format(
|
||||
'COMMENT ON COLUMN public.%I.deleted_at IS %L',
|
||||
target_table,
|
||||
'软删除时间,NULL 表示有效足迹记录'
|
||||
);
|
||||
|
||||
EXECUTE format(
|
||||
'COMMENT ON COLUMN public.%I.updated_at IS %L',
|
||||
target_table,
|
||||
'最后浏览时间,足迹列表按该字段倒序展示'
|
||||
);
|
||||
|
||||
EXECUTE format(
|
||||
'CREATE INDEX IF NOT EXISTS %I ON public.%I (user_id, updated_at DESC) WHERE deleted_at IS NULL',
|
||||
'idx_' || target_table || '_user_active',
|
||||
target_table
|
||||
);
|
||||
|
||||
EXECUTE format(
|
||||
'CREATE INDEX IF NOT EXISTS %I ON public.%I (user_id, product_id) WHERE deleted_at IS NULL',
|
||||
'idx_' || target_table || '_product_active',
|
||||
target_table
|
||||
);
|
||||
|
||||
IF EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_policies
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename = target_table
|
||||
AND policyname = 'Users can update their own footprints'
|
||||
) THEN
|
||||
EXECUTE format(
|
||||
'DROP POLICY "Users can update their own footprints" ON public.%I',
|
||||
target_table
|
||||
);
|
||||
END IF;
|
||||
|
||||
EXECUTE format(
|
||||
'CREATE POLICY "Users can update their own footprints" ON public.%I FOR UPDATE USING (auth.uid() = user_id) WITH CHECK (auth.uid() = user_id)',
|
||||
target_table
|
||||
);
|
||||
END IF;
|
||||
END LOOP;
|
||||
END
|
||||
$$;
|
||||
@@ -407,14 +407,20 @@ export type UserStats = {
|
||||
// 足迹项类型
|
||||
export type FootprintItemType = {
|
||||
id: string
|
||||
footprintId?: string
|
||||
productId?: string
|
||||
name: string
|
||||
price: number
|
||||
original_price: number | null
|
||||
originalPrice?: number | null
|
||||
image: string
|
||||
sales: number
|
||||
shopId: string
|
||||
shopName: string
|
||||
merchantId?: string
|
||||
viewTime: number
|
||||
saleStatus?: number
|
||||
isOffShelf?: boolean
|
||||
}
|
||||
|
||||
// =========================
|
||||
|
||||
@@ -196,14 +196,7 @@ export class AkReq {
|
||||
if (origRangeUnit != null) currentHeaders['Range-Unit'] = origRangeUnit
|
||||
|
||||
// 请求发出前诊断日志(脱敏:前6位+后4位)
|
||||
const dbgKey = finalApikey != null && finalApikey.length > 14
|
||||
? finalApikey.substring(0, 6) + '...' + finalApikey.substring(finalApikey.length - 4)
|
||||
: (finalApikey != null ? '(short)' : '(MISSING!)')
|
||||
const dbgAuth = finalAuth != null && finalAuth.length > 15
|
||||
? finalAuth.substring(0, 13) + '...' + finalAuth.substring(finalAuth.length - 4)
|
||||
: (finalAuth != null ? finalAuth : '(MISSING!)')
|
||||
console.log('[ak-req]', (options.method ?? 'GET'), options.url)
|
||||
console.log('[ak-req] apikey:', dbgKey, '| Authorization:', dbgAuth, '| auth-mode:', authMode, '| prefer:', origPrefer ?? '(none)')
|
||||
console.log('[ak-req] request', options.method ?? 'GET', 'auth-mode:', authMode, 'prefer:', origPrefer ?? '(none)')
|
||||
|
||||
const timeout = options.timeout ?? 10000;
|
||||
const maxRetry = Math.max(0, options.retryCount ?? 0);
|
||||
@@ -303,7 +296,6 @@ export class AkReq {
|
||||
}
|
||||
console.error('[ak-req] HTTP error response')
|
||||
console.error('[ak-req] status:', res.statusCode)
|
||||
console.error('[ak-req] url:', options.url)
|
||||
console.error('[ak-req] body:', bodyPreview)
|
||||
}
|
||||
resolve(result);
|
||||
@@ -350,10 +342,7 @@ export class AkReq {
|
||||
? sentAuth.substring(0, 13) + '...' + sentAuth.substring(sentAuth.length - 4)
|
||||
: (sentAuth != null ? '(short)' : '(MISSING!)')
|
||||
console.error('[ak-req] ★ 401 Unauthorized')
|
||||
console.error('[ak-req] url:', options.url)
|
||||
console.error('[ak-req] auth-mode: ' + authMode)
|
||||
console.error('[ak-req] 发送 apikey:', dbgSentKey)
|
||||
console.error('[ak-req] 发送 Authorization:', dbgSentAuth)
|
||||
console.error('[ak-req] response body:', JSON.stringify(finalRes.data))
|
||||
// 前端 header 检查
|
||||
if (sentApikey == null || sentApikey === '') {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user