审核模式

This commit is contained in:
Dev
2026-10-15 15:16:17 +08:00
parent 1c9927efd5
commit 3bc5ea70fe
11 changed files with 75 additions and 8 deletions
@@ -195,6 +195,8 @@ class Common extends Api
'platform_commission_ratio' => (float)DemandService::getPlatformCommissionRatio(),
// 推广分享卡片预览图,未配置时为空
'promotion_share_image' => $shareImage ? cdnurl($shareImage, true) : '',
// 商品按案例展示:不显示价格和购买入口
'goods_case_view' => (string)(config('site.miniapp_review_mode') ?? '0') === '1',
];
$this->success('', $config);
@@ -37,6 +37,11 @@ Component({
type: Boolean,
value: false,
},
// 是否展示价格(案例展示时关闭)
showPrice: {
type: Boolean,
value: true,
},
thresholds: {
type: Array,
@@ -16,9 +16,9 @@
<view wx:if="{{ goods.tags && !!goods.tags.length }}" class="goods-card__tags">
<view wx:for="{{ goods.tags }}" wx:key="index" wx:for-item="tag" class="goods-card__tag">{{ tag }}</view>
</view>
<view class="goods-card__down">
<price wx:if="{{ goods.price }}" wr-class="spec-for-price" symbol-class="spec-for-symbol" symbol="{{currency}}" price="{{goods.price}}" />
<price wx:if="{{ goods.originPrice && isValidityLinePrice }}" wr-class="goods-card__origin-price" symbol="{{currency}}" price="{{goods.originPrice}}" type="delthrough" />
<view class="goods-card__down" wx:if="{{(showPrice && (goods.price || (goods.originPrice && isValidityLinePrice))) || showBuy}}">
<price wx:if="{{ showPrice && goods.price }}" wr-class="spec-for-price" symbol-class="spec-for-symbol" symbol="{{currency}}" price="{{goods.price}}" />
<price wx:if="{{ showPrice && goods.originPrice && isValidityLinePrice }}" wr-class="goods-card__origin-price" symbol="{{currency}}" price="{{goods.originPrice}}" type="delthrough" />
<view wx:if="{{showBuy}}" class="goods-card__buy" hover-class="goods-card__buy--hover" hover-stay-time="60" catchtap="clickHandle" data-goods="{{ goods }}">
<t-icon name="cart" size="28rpx" color="#ffffff" />
</view>
@@ -22,6 +22,11 @@ Component({
type: Boolean,
value: false,
},
// 是否展示价格(案例展示时关闭)
showPrice: {
type: Boolean,
value: true,
},
},
data: {
@@ -1,5 +1,5 @@
<view class="goods-list-wrap wr-class" id="{{independentID}}">
<block wx:for="{{goodsList}}" wx:for-item="item" wx:key="index">
<goods-card id="{{independentID}}-gd-{{index}}" data="{{item}}" currency="{{item.currency || '¥'}}" thresholds="{{thresholds}}" show-buy="{{showBuy}}" class="goods-card-inside" data-index="{{index}}" bind:click="onClickGoods" />
<goods-card id="{{independentID}}-gd-{{index}}" data="{{item}}" currency="{{item.currency || '¥'}}" thresholds="{{thresholds}}" show-buy="{{showBuy}}" show-price="{{showPrice}}" class="goods-card-inside" data-index="{{index}}" bind:click="onClickGoods" />
</block>
</view>
@@ -6,6 +6,7 @@ import {
} from '../../../services/good/fetchGoodsDetailsComments';
import { cdnBase } from '../../../config/index';
import { fetchGoodsCaseView } from '../../../services/home/home';
import { withPromoter, promoterQuery } from '../../../utils/promoter';
const imgPrefix = `${cdnBase}/`;
@@ -74,6 +75,7 @@ Page({
duration: 500,
interval: 5000,
soldNum: 0, // 已售数量
caseView: wx.getStorageSync('goodsCaseView') === true, // 案例展示:使用默认标题,不显示购买和规格
},
handlePopupHide() {
@@ -409,8 +411,20 @@ Page({
this.setData({
spuId: spuId,
});
this.applyCaseView();
this.getDetail(spuId);
this.getCommentsList(spuId);
this.getCommentsStatistics(spuId);
},
async applyCaseView() {
if (this.data.caseView) {
wx.setNavigationBarTitle({ title: '' });
}
const caseView = await fetchGoodsCaseView();
this.setData({ caseView });
if (caseView) {
wx.setNavigationBarTitle({ title: '' });
}
},
});
@@ -1,4 +1,4 @@
<view class="goods-detail-page">
<view class="goods-detail-page {{caseView ? 'goods-detail-page--case' : ''}}">
<view class="goods-head">
<view class="goods-gallery">
<t-swiper wx:if="{{details.images.length > 0}}" height="750rpx" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}" list="{{details.images}}"></t-swiper>
@@ -45,7 +45,7 @@
<view class="goods-intro" wx:if="{{details.intro}}">{{details.intro}}</view>
</view>
<view class="spu-select" bindtap="onSelectSkuTap">
<view class="spu-select" wx:if="{{!caseView}}" bindtap="onSelectSkuTap">
<view class="label">已选</view>
<view class="content">
<view class="content-text {{!selectedAttrStr ? 'tintColor' : ''}}">
@@ -97,7 +97,7 @@
</view>
</view>
<view class="goods-bottom-operation">
<view class="goods-bottom-operation" wx:if="{{!caseView}}">
<buy-bar soldout="{{soldout}}" isStock="{{isStock}}" buttonType="{{buttonType}}" bind:toBuyNow="buyItNow" />
</view>
@@ -11,6 +11,10 @@ page {
background-color: var(--bg-page);
}
.goods-detail-page--case {
padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
}
.goods-head {
--td-swiper-radius: 0;
}
@@ -1,5 +1,6 @@
import { fetchGoodsList } from '../../../services/good/fetchGoodsList';
import { getCategoryList } from '../../../services/good/fetchCategoryList';
import { fetchGoodsCaseView } from '../../../services/home/home';
import Toast from 'tdesign-miniprogram/toast/index';
const initFilters = {
@@ -27,6 +28,7 @@ Page({
loadMoreStatus: 0,
loading: true,
tabList: [],
caseView: wx.getStorageSync('goodsCaseView') === true, // 案例展示:标题改为软件案例,不显示价格和购物车
},
handleFilterChange(e) {
@@ -147,10 +149,20 @@ Page({
onLoad() {
this.applyCaseView();
this.init();
this.loadGoodsList(true);
},
async applyCaseView() {
if (this.data.caseView) {
wx.setNavigationBarTitle({ title: '软件案例' });
}
const caseView = await fetchGoodsCaseView();
this.setData({ caseView });
wx.setNavigationBarTitle({ title: caseView ? '软件案例' : '软件列表' });
},
onReachBottom() {
const { goodsList, total } = this.data;
if (goodsList.length === total) {
+1 -1
View File
@@ -29,7 +29,7 @@
</view>
</view>
<view class="category-goods-list" wx:if="{{goodsList.length}}">
<goods-list wr-class="wr-goods-list" goodsList="{{goodsList}}" show-buy="{{true}}" bind:click="gotoGoodsDetail" />
<goods-list wr-class="wr-goods-list" goodsList="{{goodsList}}" show-buy="{{!caseView}}" show-price="{{!caseView}}" bind:click="gotoGoodsDetail" />
</view>
<view class="empty-wrap" wx:if="{{goodsList.length === 0 && hasLoaded}}">
<t-empty t-class="empty-tips" size="240rpx" description="暂无相关产品" />
+25
View File
@@ -82,6 +82,31 @@ export async function fetchPlatformCommissionRatio() {
return DEFAULT_COMMISSION_RATIO;
}
const CASE_VIEW_STORAGE_KEY = 'goodsCaseView';
let caseViewCache = null;
/**
* 商品是否按案例展示(不显示价格和购买入口)
* 成功后缓存;失败时用上次成功的本地记录
* @returns {Promise<boolean>}
*/
export async function fetchGoodsCaseView() {
if (caseViewCache !== null) {
return caseViewCache;
}
try {
const res = await fetchConfig();
if (res.code === 1) {
caseViewCache = res.data?.goods_case_view === true || res.data?.goods_case_view === 1;
wx.setStorageSync(CASE_VIEW_STORAGE_KEY, caseViewCache);
return caseViewCache;
}
} catch (err) {
console.error('fetchGoodsCaseView failed:', err);
}
return wx.getStorageSync(CASE_VIEW_STORAGE_KEY) === true;
}
/**
* 计算扣除平台服务费后的预计到手金额(保留两位小数)
* @param {number|string} amount 报价/总费用(元)