This commit is contained in:
2026-04-04 15:07:31 +08:00
parent 9312eceb94
commit 73e2580c43
8 changed files with 606 additions and 575 deletions

View File

@ -196,7 +196,7 @@ export const ADD_SERVICE_FEE = "/app/chongwu_order/order_fuwufei";
// 商品分类 // 商品分类
export const GET_GOODS_CATEGORY = "/product/type/list"; export const GET_GOODS_CATEGORY = "/product/type/list";
// 商品列表 // 商品列表
export const GET_GOODS_LIST = "/product/list"; export const GET_GOODS_LIST = "/douyin/goods/product/online/query";
// 商品详情 // 商品详情
export const GET_GOODS_DETAIL = "/product/detail"; export const GET_GOODS_DETAIL = "/product/detail";

View File

@ -178,6 +178,8 @@ export default {
if (this.pendingPhoneNumber) { if (this.pendingPhoneNumber) {
this.doMakePhoneCall(this.pendingPhoneNumber) this.doMakePhoneCall(this.pendingPhoneNumber)
this.pendingPhoneNumber = null this.pendingPhoneNumber = null
// 拨号后关闭选择弹窗
this.$emit('close')
} }
}, },
@ -282,12 +284,12 @@ export default {
this.checkPrivacyAuthorization(phoneNumber, (authorized) => { this.checkPrivacyAuthorization(phoneNumber, (authorized) => {
if (authorized) { if (authorized) {
this.doMakePhoneCall(phoneNumber) this.doMakePhoneCall(phoneNumber)
// 已授权拨号后,关闭选择弹窗
this.$emit('close')
} }
// 未授权时checkPrivacyAuthorization 已经显示了隐私弹窗 // 未授权时checkPrivacyAuthorization 已经显示了隐私弹窗
// 此时不关闭选择弹窗,让隐私弹窗能够正常显示
}) })
// 关闭选择弹窗
this.$emit('close')
} }
} }
} }

View File

@ -45,13 +45,13 @@
// text: "立即预约", // text: "立即预约",
// isSpecial: true, // 特殊样式标记(中间突出的按钮) // isSpecial: true, // 特殊样式标记(中间突出的按钮)
// }, // },
// { {
// pageId: "shopPage", pageId: "shopPage",
// iconPath: `${imgPrefix}tabBar-mall.png`, iconPath: `${imgPrefix}tabBar-mall.png`,
// selectedIconPath: `${imgPrefix}tabBar-selectdMall.png`, selectedIconPath: `${imgPrefix}tabBar-selectdMall.png`,
// text: "分类", text: "分类",
// isSpecial: false, isSpecial: false,
// }, },
{ {
pageId: "minePage", pageId: "minePage",
iconPath: `${imgPrefix}tabBar-mine.png`, iconPath: `${imgPrefix}tabBar-mine.png`,

View File

@ -94,15 +94,15 @@
"privacy": { "privacy": {
"usePrivacyCheck": true, "usePrivacyCheck": true,
"requiredPrivateInfos": ["makePhoneCall"] "requiredPrivateInfos": ["makePhoneCall"]
}
}, },
"plugins": { "plugins": {
"myTradePlugin" : { "lifeServicePlugin": {
"version": "*", "version": "*",
"provider": "tta5a3d31e3aecfb9b11" "provider": "tta5a3d31e3aecfb9b11"
} }
}
}, },
"mp-qq" : { "mp-qq" : {
"usingComponents" : true "usingComponents" : true
} }

View File

@ -183,9 +183,9 @@ export default {
} }
getGoodsListData(params) getGoodsListData(params)
.then((res) => { .then((res) => {
const list = res?.data || []; const list = res?.data.data.products || [];
this.goodsList = this.goodsList = list;
this.goodPage === 1 ? list : [...this.goodsList, ...list]; console.log(this.goodsList,'???')
this.goodsTotal = res?.count || 0; this.goodsTotal = res?.count || 0;
}) })
.finally(() => { .finally(() => {
@ -328,13 +328,13 @@ export default {
res.eventChannel.emit("createOrder", { res.eventChannel.emit("createOrder", {
goodList: [{ goodList: [{
...this.goodsData, ...this.goodsData,
goods_id:goodsData.product_id, goods_id:goodsData.product.out_id,
price_id:goodsData.prices[0].price_id, // price_id:goodsData.prices[0].price_id,
number:1, number:1,
goods_name: goodsData.product_name, goods_name: goodsData.product.product_name,
price_name: goodsData?.product_name, price_name: goodsData?.product.product_name,
goods_price: goodsData.prices[0].actual_price, goods_price: goodsData.product.product_type,
product_pic:goodsData.product_pic product_pic:goodsData.product.product_type
}, ], }, ],
}); });
}, },

View File

@ -219,7 +219,7 @@ export default {
}); });
} }
const params = { const params = {
id: this.orderData[0].goods_id, id: Number(this.orderData[0].goods_id),
}; };
// console.log(this.orderData,'???') // console.log(this.orderData,'???')
@ -232,12 +232,9 @@ export default {
quantity: 10, // 购买数量 必填 quantity: 10, // 购买数量 必填
price: 1, // 商品价格 必填 price: 1, // 商品价格 必填
goodsName: "测试商品", // 商品名称 必填 goodsName: "测试商品", // 商品名称 必填
goodsPhoto: goodsPhoto:"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.ibaotu.com%2Fgif%2F19%2F48%2F47%2F76Z888piCd6W.gif%21fwpaa50%2Ffw%2F700&refer=http%3A%2F%2Fpic.ibaotu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1644654365&t=5fc9b5fdad0a16264a9a9c09c14b3af9", // 商品图片链接 必填
"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.ibaotu.com%2Fgif%2F19%2F48%2F47%2F76Z888piCd6W.gif%21fwpaa50%2Ffw%2F700&refer=http%3A%2F%2Fpic.ibaotu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1644654365&t=5fc9b5fdad0a16264a9a9c09c14b3af9", // 商品图片链接 必填
goodsId: "123", // 商品ID 必填(请务必使用小程序商品) goodsId: "123", // 商品ID 必填(请务必使用小程序商品)
goodsType: 2, // 商品类型 必填 goodsType: 2, // 商品类型 必填
goodsLabels: ["不可退"], // 商品标签 非必填
dateRule: "", // 使用规则 非必填
}, },
], ],
payment: { payment: {

View File

@ -2,7 +2,7 @@
<view class="goods-item" > <view class="goods-item" >
<image class="goods-img" :src="data.product_pic" mode="aspectFill" /> <image class="goods-img" :src="data.product_pic" mode="aspectFill" />
<view class=" fs-24 app-fc-main goods-name"> <view class=" fs-24 app-fc-main goods-name">
{{ data.product_name || "" }} {{ data.product.product_name || "" }}
</view> </view>
<!-- <view class="flex-row-start label"> <!-- <view class="flex-row-start label">
<image class="hot-icon" :src="`${imgPrefix}mall-hot.png`"></image> <image class="hot-icon" :src="`${imgPrefix}mall-hot.png`"></image>
@ -13,7 +13,7 @@
<text class="fs-28" style="color: #3D3D3D;"> <text class="fs-28" style="color: #3D3D3D;">
¥ ¥
<text class="fs-28">{{ <text class="fs-28">{{
data.prices[0].actual_price || 0 data.product.product_type || 0
}}</text> }}</text>
</text> </text>
<!-- <text class="fs-24 origin-price"> <!-- <text class="fs-24 origin-price">
@ -92,13 +92,13 @@
.goods-name { .goods-name {
margin: 20rpx 0; margin: 20rpx 0;
overflow: hidden; // overflow: hidden;
text-overflow: ellipsis; // text-overflow: ellipsis;
display: -webkit-box; // display: -webkit-box;
-webkit-line-clamp: 1; // -webkit-line-clamp: 1;
-webkit-box-orient: vertical; // -webkit-box-orient: vertical;
word-wrap: break-word; // word-wrap: break-word;
word-break: break-all; // word-break: break-all;
} }
.label { .label {

View File

@ -2,14 +2,24 @@
<view class="flex-column-start shop-container"> <view class="flex-column-start shop-container">
<!-- 自定义导航栏 --> <!-- 自定义导航栏 -->
<view class="custom-navbar"> <view class="custom-navbar">
<view class="status-bar" style="height:60px;"></view> <view class="status-bar" style="height: 60px"></view>
<view class="navbar-content"> <view class="navbar-content">
<!-- <view class="back-btn" @click="handleBack"> <!-- <view class="back-btn" @click="handleBack">
<view class="back-icon"></view> <view class="back-icon"></view>
</view> --> </view> -->
<view class="search-input-wrapper" style="width:80%;" @click="jumpToSearch"> <view
<input class="search-input" type="text" placeholder="搜索商品" v-model="searchKeyword" class="search-input-wrapper"
@confirm="handleSearch" @focus="handleSearchFocus" /> style="width: 80%"
@click="jumpToSearch"
>
<input
class="search-input"
type="text"
placeholder="搜索商品"
v-model="searchKeyword"
@confirm="handleSearch"
@focus="handleSearchFocus"
/>
</view> </view>
</view> </view>
</view> </view>
@ -17,10 +27,18 @@
<view class="flex-row-start category-content"> <view class="flex-row-start category-content">
<!-- 左侧一级分类列表 --> <!-- 左侧一级分类列表 -->
<view v-if="categoryList.length" class="category-list-left"> <view v-if="categoryList.length" class="category-list-left">
<view class="flex-center category-item-left" :class="{ <view
class="flex-center category-item-left"
:class="{
'category-item-left-active': item.id === selectCategoryId, 'category-item-left-active': item.id === selectCategoryId,
}" v-for="(item, index) in categoryList" :key="index" @click="changeCategory(item)"> }"
<text class="fs-28 app-fc-main app-text-ellipse category-item-left-name"> v-for="(item, index) in categoryList"
:key="index"
@click="changeCategory(item)"
>
<text
class="fs-28 app-fc-main app-text-ellipse category-item-left-name"
>
{{ item.type_name }} {{ item.type_name }}
</text> </text>
<view v-if="selectCategoryId === item.id" class="border-line"></view> <view v-if="selectCategoryId === item.id" class="border-line"></view>
@ -29,12 +47,23 @@
<!-- 右侧内容区域 --> <!-- 右侧内容区域 -->
<view class="category-right-wrapper"> <view class="category-right-wrapper">
<!-- 右侧下方商品列表 --> <!-- 右侧下方商品列表 -->
<scroll-view class="category-right" scroll-y :refresher-enabled="true" <scroll-view
:refresher-triggered="refreshTriggered" @refresherrefresh="onRefresh" class="category-right"
@scrolltolower="onLoadMore"> scroll-y
:refresher-enabled="true"
:refresher-triggered="refreshTriggered"
@refresherrefresh="onRefresh"
@scrolltolower="onLoadMore"
>
<view class="goods-list"> <view class="goods-list">
<good-item v-for="good in goodsList" :key="good.product_id" :ref="`goodItem_${good.product_id}`" <good-item
:data="good" @addToCar="addToCar" @buyNow="handleBuyNow" /> v-for="good in goodsList"
:key="good.product_id"
:ref="`goodItem_${good.product_id}`"
:data="good"
@addToCar="addToCar"
@buyNow="handleBuyNow"
/>
</view> </view>
<view v-if="isLoading" class="loading-wrapper flex-center"> <view v-if="isLoading" class="loading-wrapper flex-center">
<uni-load-more status="loading" :show-text="false" /> <uni-load-more status="loading" :show-text="false" />
@ -54,17 +83,20 @@
<!-- 可拖动联系客服组件 --> <!-- 可拖动联系客服组件 -->
<DraggableContact ref="draggableContact" :onClick="handleContactClick" /> <DraggableContact ref="draggableContact" :onClick="handleContactClick" />
<add-goods-modal v-if="showModal" :data="addGoodInfo" optText="加入购物车" @change="(val) => (showModal = val)" <add-goods-modal
@optAction="optAction" /> v-if="showModal"
:data="addGoodInfo"
optText="加入购物车"
@change="(val) => (showModal = val)"
@optAction="optAction"
/>
<contact-modal v-if="showContactModal" @close="showContactModal = false" /> <contact-modal v-if="showContactModal" @close="showContactModal = false" />
<WeChatCopyModal ref="wechatCopyModal" /> <WeChatCopyModal ref="wechatCopyModal" />
</view> </view>
</template> </template>
<script> <script>
import { import { imgPrefix } from "@/utils/common";
imgPrefix
} from '@/utils/common';
import GoodItem from "../category/components/GoodItem.vue"; import GoodItem from "../category/components/GoodItem.vue";
import AddGoodsModal from "@/components/goods/AddGoodsModal.vue"; import AddGoodsModal from "@/components/goods/AddGoodsModal.vue";
@ -76,11 +108,9 @@ import GoodItem from "../category/components/GoodItem.vue";
getGoodsClassify, getGoodsClassify,
getGoodsListData, getGoodsListData,
addCart, addCart,
getCartList getCartList,
} from "@/api/shop"; } from "@/api/shop";
import { import { jumpToWeChat } from "@/utils/common";
jumpToWeChat
} from "@/utils/common";
export default { export default {
components: { components: {
@ -104,17 +134,23 @@ export default {
const backBtnMargin = 20; // 返回按钮右边距 const backBtnMargin = 20; // 返回按钮右边距
// 右侧需要留出的空间:屏幕宽度 (px) - 胶囊按钮左边距 (px) + 额外间距 (px),然后转换为 rpx // 右侧需要留出的空间:屏幕宽度 (px) - 胶囊按钮左边距 (px) + 额外间距 (px),然后转换为 rpx
const rightSpacePx = systemInfo.windowWidth - menuButtonInfo.left + 20; const rightSpacePx = systemInfo.windowWidth - menuButtonInfo.left + 20;
const rightSpaceRpx = (rightSpacePx / systemInfo.windowWidth) * screenWidthRpx; const rightSpaceRpx =
searchInputWidth = screenWidthRpx - leftPadding - backBtnWidth - backBtnMargin - rightSpaceRpx; (rightSpacePx / systemInfo.windowWidth) * screenWidthRpx;
searchInputWidth =
screenWidthRpx -
leftPadding -
backBtnWidth -
backBtnMargin -
rightSpaceRpx;
} }
} catch (e) { } catch (e) {
console.log('获取胶囊按钮信息失败', e); console.log("获取胶囊按钮信息失败", e);
} }
return { return {
statusBarHeight: systemInfo.statusBarHeight || 0, statusBarHeight: systemInfo.statusBarHeight || 0,
searchInputWidth: searchInputWidth, searchInputWidth: searchInputWidth,
imgPrefix, imgPrefix,
searchKeyword: '', searchKeyword: "",
activeCategoryIndex: 0, activeCategoryIndex: 0,
categoryList: [], categoryList: [],
selectCategoryId: "", selectCategoryId: "",
@ -129,14 +165,15 @@ export default {
showContactModal: false, showContactModal: false,
cartCount: 0, cartCount: 0,
cartCountBounce: false, cartCountBounce: false,
petOrderId: '', petOrderId: "",
petOrderAddressId: '', petOrderAddressId: "",
}; };
}, },
computed: { computed: {
selectCategory() { selectCategory() {
return ( return (
this.categoryList.find((item) => item.id === this.selectCategoryId) || {} this.categoryList.find((item) => item.id === this.selectCategoryId) ||
{}
); );
}, },
cartShowCount() { cartShowCount() {
@ -177,33 +214,33 @@ export default {
// console.log('[shop.vue] $refs.wechatCopyModal:', this.$refs.wechatCopyModal) // console.log('[shop.vue] $refs.wechatCopyModal:', this.$refs.wechatCopyModal)
if (this.$refs.wechatCopyModal && this.$refs.wechatCopyModal.show) { if (this.$refs.wechatCopyModal && this.$refs.wechatCopyModal.show) {
this.$refs.wechatCopyModal.show({ this.$refs.wechatCopyModal.show({
title: '请添加客服号', title: "请添加客服号",
weChatCode: 'Wagoo2025' weChatCode: "Wagoo2025",
}); });
// console.log('[shop.vue] wechatCopyModal.show called') // console.log('[shop.vue] wechatCopyModal.show called')
} else { } else {
// console.error('[shop.vue] wechatCopyModal not available, using fallback') // console.error('[shop.vue] wechatCopyModal not available, using fallback')
// 降级方案:直接显示系统弹窗 // 降级方案:直接显示系统弹窗
uni.showModal({ uni.showModal({
title: '提示', title: "提示",
content: '请添加客服号Wagoo2025', content: "请添加客服号Wagoo2025",
confirmText: '复制微信号', confirmText: "复制微信号",
showCancel: true, showCancel: true,
cancelText: '取消', cancelText: "取消",
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
uni.setClipboardData({ uni.setClipboardData({
data: 'Wagoo2025', data: "Wagoo2025",
success: () => { success: () => {
uni.showToast({ uni.showToast({
title: '已复制微信号', title: "已复制微信号",
icon: 'success' icon: "success",
}) });
},
});
} }
}) },
} });
}
})
} }
}, },
jumpToWeChat, jumpToWeChat,
@ -265,7 +302,7 @@ export default {
.then(() => { .then(() => {
uni.showToast({ uni.showToast({
title: "已加入购物车!", title: "已加入购物车!",
icon: "none" icon: "none",
}); });
this.getCartListData(); this.getCartListData();
// 触发购物车数量徽章动画 // 触发购物车数量徽章动画
@ -274,20 +311,13 @@ export default {
.catch((err) => { .catch((err) => {
uni.showToast({ uni.showToast({
title: err || "加入购物车失败!", title: err || "加入购物车失败!",
icon: "none" icon: "none",
}); });
}); });
}, },
optAction(data) { optAction(data) {
const { const { product_id, type, prices, product_name, product_pic, number } =
product_id, data;
type,
prices,
product_name,
product_pic,
number
} = data;
this.addCartAction({ this.addCartAction({
item_id: product_id, item_id: product_id,
item_type: type, item_type: type,
@ -297,7 +327,7 @@ export default {
item_price: prices?.[0]?.actual_price, item_price: prices?.[0]?.actual_price,
number, number,
item_pic: product_pic, item_pic: product_pic,
is_select: 1 is_select: 1,
}); });
this.showModal = false; this.showModal = false;
// 触发对应商品项的动画 // 触发对应商品项的动画
@ -322,14 +352,14 @@ export default {
addToCar(good) { addToCar(good) {
this.showModal = true; this.showModal = true;
this.addGoodInfo = { this.addGoodInfo = {
...good ...good,
}; };
}, },
// 购物车列表 // 购物车列表
getCartListData() { getCartListData() {
getCartList({ getCartList({
p: 1, p: 1,
num: 999 num: 999,
}).then((res) => { }).then((res) => {
this.cartCount = (res?.data.list || []).reduce( this.cartCount = (res?.data.list || []).reduce(
(total, prev) => total + prev.number, (total, prev) => total + prev.number,
@ -354,8 +384,9 @@ export default {
success: (res) => { success: (res) => {
// 通过 eventChannel 向被打开页面传送数据 // 通过 eventChannel 向被打开页面传送数据
res.eventChannel.emit("createOrder", { res.eventChannel.emit("createOrder", {
goodList: [{ goodList: [
item_id: good.product_id, {
goods_id: good.product_id,
item_type: good.type, item_type: good.type,
price_id: good.prices?.[0]?.price_id, price_id: good.prices?.[0]?.price_id,
price_desc: good.prices?.[0]?.price_desc, price_desc: good.prices?.[0]?.price_desc,
@ -370,7 +401,8 @@ export default {
product_price: good.prices?.[0]?.actual_price, product_price: good.prices?.[0]?.actual_price,
original_price: good.prices?.[0]?.original_price, original_price: good.prices?.[0]?.original_price,
yunfei: good.yunfei || 0, yunfei: good.yunfei || 0,
}], },
],
}); });
}, },
}); });
@ -466,14 +498,14 @@ export default {
background: #f7f8fa; background: #f7f8fa;
.category-item-left-name { .category-item-left-name {
color: #3D3D3D; color: #3d3d3d;
} }
&.category-item-left-active { &.category-item-left-active {
background-color: #fff; background-color: #fff;
.category-item-left-name { .category-item-left-name {
color: #FF19A0; color: #ff19a0;
} }
.border-line { .border-line {
@ -483,7 +515,7 @@ export default {
left: 0; left: 0;
width: 10rpx; width: 10rpx;
border-radius: 28rpx; border-radius: 28rpx;
background: #FF19A0; background: #ff19a0;
} }
} }
} }
@ -530,9 +562,9 @@ export default {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
border-radius: 30rpx; border-radius: 30rpx;
background: #FF19A0; background: #ff19a0;
z-index: 10; z-index: 10;
border: 1px solid #FFFFFF; border: 1px solid #ffffff;
transition: transform 0.3s ease; transition: transform 0.3s ease;
&.cart-count-bounce { &.cart-count-bounce {