1
This commit is contained in:
@ -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_LIST = "/product/list";
|
||||
export const GET_GOODS_LIST = "/douyin/goods/product/online/query";
|
||||
// 商品详情
|
||||
export const GET_GOODS_DETAIL = "/product/detail";
|
||||
|
||||
|
||||
@ -178,6 +178,8 @@ export default {
|
||||
if (this.pendingPhoneNumber) {
|
||||
this.doMakePhoneCall(this.pendingPhoneNumber)
|
||||
this.pendingPhoneNumber = null
|
||||
// 拨号后关闭选择弹窗
|
||||
this.$emit('close')
|
||||
}
|
||||
},
|
||||
|
||||
@ -282,12 +284,12 @@ export default {
|
||||
this.checkPrivacyAuthorization(phoneNumber, (authorized) => {
|
||||
if (authorized) {
|
||||
this.doMakePhoneCall(phoneNumber)
|
||||
// 已授权拨号后,关闭选择弹窗
|
||||
this.$emit('close')
|
||||
}
|
||||
// 未授权时,checkPrivacyAuthorization 已经显示了隐私弹窗
|
||||
// 此时不关闭选择弹窗,让隐私弹窗能够正常显示
|
||||
})
|
||||
|
||||
// 关闭选择弹窗
|
||||
this.$emit('close')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,13 +45,13 @@
|
||||
// text: "立即预约",
|
||||
// isSpecial: true, // 特殊样式标记(中间突出的按钮)
|
||||
// },
|
||||
// {
|
||||
// pageId: "shopPage",
|
||||
// iconPath: `${imgPrefix}tabBar-mall.png`,
|
||||
// selectedIconPath: `${imgPrefix}tabBar-selectdMall.png`,
|
||||
// text: "分类",
|
||||
// isSpecial: false,
|
||||
// },
|
||||
{
|
||||
pageId: "shopPage",
|
||||
iconPath: `${imgPrefix}tabBar-mall.png`,
|
||||
selectedIconPath: `${imgPrefix}tabBar-selectdMall.png`,
|
||||
text: "分类",
|
||||
isSpecial: false,
|
||||
},
|
||||
{
|
||||
pageId: "minePage",
|
||||
iconPath: `${imgPrefix}tabBar-mine.png`,
|
||||
|
||||
@ -94,15 +94,15 @@
|
||||
"privacy": {
|
||||
"usePrivacyCheck": true,
|
||||
"requiredPrivateInfos": ["makePhoneCall"]
|
||||
}
|
||||
},
|
||||
|
||||
"plugins": {
|
||||
"myTradePlugin" : {
|
||||
"lifeServicePlugin": {
|
||||
"version": "*",
|
||||
"provider": "tta5a3d31e3aecfb9b11"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"mp-qq" : {
|
||||
"usingComponents" : true
|
||||
}
|
||||
|
||||
@ -183,9 +183,9 @@ export default {
|
||||
}
|
||||
getGoodsListData(params)
|
||||
.then((res) => {
|
||||
const list = res?.data || [];
|
||||
this.goodsList =
|
||||
this.goodPage === 1 ? list : [...this.goodsList, ...list];
|
||||
const list = res?.data.data.products || [];
|
||||
this.goodsList = list;
|
||||
console.log(this.goodsList,'???')
|
||||
this.goodsTotal = res?.count || 0;
|
||||
})
|
||||
.finally(() => {
|
||||
@ -328,13 +328,13 @@ export default {
|
||||
res.eventChannel.emit("createOrder", {
|
||||
goodList: [{
|
||||
...this.goodsData,
|
||||
goods_id:goodsData.product_id,
|
||||
price_id:goodsData.prices[0].price_id,
|
||||
goods_id:goodsData.product.out_id,
|
||||
// price_id:goodsData.prices[0].price_id,
|
||||
number:1,
|
||||
goods_name: goodsData.product_name,
|
||||
price_name: goodsData?.product_name,
|
||||
goods_price: goodsData.prices[0].actual_price,
|
||||
product_pic:goodsData.product_pic
|
||||
goods_name: goodsData.product.product_name,
|
||||
price_name: goodsData?.product.product_name,
|
||||
goods_price: goodsData.product.product_type,
|
||||
product_pic:goodsData.product.product_type
|
||||
}, ],
|
||||
});
|
||||
},
|
||||
|
||||
@ -219,7 +219,7 @@ export default {
|
||||
});
|
||||
}
|
||||
const params = {
|
||||
id: this.orderData[0].goods_id,
|
||||
id: Number(this.orderData[0].goods_id),
|
||||
};
|
||||
|
||||
// console.log(this.orderData,'???')
|
||||
@ -232,12 +232,9 @@ export default {
|
||||
quantity: 10, // 购买数量 必填
|
||||
price: 1, // 商品价格 必填
|
||||
goodsName: "测试商品", // 商品名称 必填
|
||||
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", // 商品图片链接 必填
|
||||
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", // 商品图片链接 必填
|
||||
goodsId: "123", // 商品ID 必填(请务必使用小程序商品)
|
||||
goodsType: 2, // 商品类型 必填
|
||||
goodsLabels: ["不可退"], // 商品标签 非必填
|
||||
dateRule: "", // 使用规则 非必填
|
||||
},
|
||||
],
|
||||
payment: {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<view class="goods-item" >
|
||||
<image class="goods-img" :src="data.product_pic" mode="aspectFill" />
|
||||
<view class=" fs-24 app-fc-main goods-name">
|
||||
{{ data.product_name || "" }}
|
||||
{{ data.product.product_name || "" }}
|
||||
</view>
|
||||
<!-- <view class="flex-row-start label">
|
||||
<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">{{
|
||||
data.prices[0].actual_price || 0
|
||||
data.product.product_type || 0
|
||||
}}</text>
|
||||
</text>
|
||||
<!-- <text class="fs-24 origin-price">
|
||||
@ -92,13 +92,13 @@
|
||||
|
||||
.goods-name {
|
||||
margin: 20rpx 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
// overflow: hidden;
|
||||
// text-overflow: ellipsis;
|
||||
// display: -webkit-box;
|
||||
// -webkit-line-clamp: 1;
|
||||
// -webkit-box-orient: vertical;
|
||||
// word-wrap: break-word;
|
||||
// word-break: break-all;
|
||||
}
|
||||
|
||||
.label {
|
||||
|
||||
@ -2,14 +2,24 @@
|
||||
<view class="flex-column-start shop-container">
|
||||
<!-- 自定义导航栏 -->
|
||||
<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="back-btn" @click="handleBack">
|
||||
<view class="back-icon"></view>
|
||||
</view> -->
|
||||
<view class="search-input-wrapper" style="width:80%;" @click="jumpToSearch">
|
||||
<input class="search-input" type="text" placeholder="搜索商品" v-model="searchKeyword"
|
||||
@confirm="handleSearch" @focus="handleSearchFocus" />
|
||||
<view
|
||||
class="search-input-wrapper"
|
||||
style="width: 80%"
|
||||
@click="jumpToSearch"
|
||||
>
|
||||
<input
|
||||
class="search-input"
|
||||
type="text"
|
||||
placeholder="搜索商品"
|
||||
v-model="searchKeyword"
|
||||
@confirm="handleSearch"
|
||||
@focus="handleSearchFocus"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -17,10 +27,18 @@
|
||||
<view class="flex-row-start category-content">
|
||||
<!-- 左侧:一级分类列表 -->
|
||||
<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,
|
||||
}" 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 }}
|
||||
</text>
|
||||
<view v-if="selectCategoryId === item.id" class="border-line"></view>
|
||||
@ -29,12 +47,23 @@
|
||||
<!-- 右侧内容区域 -->
|
||||
<view class="category-right-wrapper">
|
||||
<!-- 右侧下方:商品列表 -->
|
||||
<scroll-view class="category-right" scroll-y :refresher-enabled="true"
|
||||
:refresher-triggered="refreshTriggered" @refresherrefresh="onRefresh"
|
||||
@scrolltolower="onLoadMore">
|
||||
<scroll-view
|
||||
class="category-right"
|
||||
scroll-y
|
||||
:refresher-enabled="true"
|
||||
:refresher-triggered="refreshTriggered"
|
||||
@refresherrefresh="onRefresh"
|
||||
@scrolltolower="onLoadMore"
|
||||
>
|
||||
<view class="goods-list">
|
||||
<good-item v-for="good in goodsList" :key="good.product_id" :ref="`goodItem_${good.product_id}`"
|
||||
:data="good" @addToCar="addToCar" @buyNow="handleBuyNow" />
|
||||
<good-item
|
||||
v-for="good in goodsList"
|
||||
:key="good.product_id"
|
||||
:ref="`goodItem_${good.product_id}`"
|
||||
:data="good"
|
||||
@addToCar="addToCar"
|
||||
@buyNow="handleBuyNow"
|
||||
/>
|
||||
</view>
|
||||
<view v-if="isLoading" class="loading-wrapper flex-center">
|
||||
<uni-load-more status="loading" :show-text="false" />
|
||||
@ -54,17 +83,20 @@
|
||||
<!-- 可拖动联系客服组件 -->
|
||||
<DraggableContact ref="draggableContact" :onClick="handleContactClick" />
|
||||
|
||||
<add-goods-modal v-if="showModal" :data="addGoodInfo" optText="加入购物车" @change="(val) => (showModal = val)"
|
||||
@optAction="optAction" />
|
||||
<add-goods-modal
|
||||
v-if="showModal"
|
||||
:data="addGoodInfo"
|
||||
optText="加入购物车"
|
||||
@change="(val) => (showModal = val)"
|
||||
@optAction="optAction"
|
||||
/>
|
||||
<contact-modal v-if="showContactModal" @close="showContactModal = false" />
|
||||
<WeChatCopyModal ref="wechatCopyModal" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
imgPrefix
|
||||
} from '@/utils/common';
|
||||
import { imgPrefix } from "@/utils/common";
|
||||
|
||||
import GoodItem from "../category/components/GoodItem.vue";
|
||||
import AddGoodsModal from "@/components/goods/AddGoodsModal.vue";
|
||||
@ -76,11 +108,9 @@ import GoodItem from "../category/components/GoodItem.vue";
|
||||
getGoodsClassify,
|
||||
getGoodsListData,
|
||||
addCart,
|
||||
getCartList
|
||||
getCartList,
|
||||
} from "@/api/shop";
|
||||
import {
|
||||
jumpToWeChat
|
||||
} from "@/utils/common";
|
||||
import { jumpToWeChat } from "@/utils/common";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -104,17 +134,23 @@ export default {
|
||||
const backBtnMargin = 20; // 返回按钮右边距
|
||||
// 右侧需要留出的空间:屏幕宽度 (px) - 胶囊按钮左边距 (px) + 额外间距 (px),然后转换为 rpx
|
||||
const rightSpacePx = systemInfo.windowWidth - menuButtonInfo.left + 20;
|
||||
const rightSpaceRpx = (rightSpacePx / systemInfo.windowWidth) * screenWidthRpx;
|
||||
searchInputWidth = screenWidthRpx - leftPadding - backBtnWidth - backBtnMargin - rightSpaceRpx;
|
||||
const rightSpaceRpx =
|
||||
(rightSpacePx / systemInfo.windowWidth) * screenWidthRpx;
|
||||
searchInputWidth =
|
||||
screenWidthRpx -
|
||||
leftPadding -
|
||||
backBtnWidth -
|
||||
backBtnMargin -
|
||||
rightSpaceRpx;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('获取胶囊按钮信息失败', e);
|
||||
console.log("获取胶囊按钮信息失败", e);
|
||||
}
|
||||
return {
|
||||
statusBarHeight: systemInfo.statusBarHeight || 0,
|
||||
searchInputWidth: searchInputWidth,
|
||||
imgPrefix,
|
||||
searchKeyword: '',
|
||||
searchKeyword: "",
|
||||
activeCategoryIndex: 0,
|
||||
categoryList: [],
|
||||
selectCategoryId: "",
|
||||
@ -129,14 +165,15 @@ export default {
|
||||
showContactModal: false,
|
||||
cartCount: 0,
|
||||
cartCountBounce: false,
|
||||
petOrderId: '',
|
||||
petOrderAddressId: '',
|
||||
petOrderId: "",
|
||||
petOrderAddressId: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
selectCategory() {
|
||||
return (
|
||||
this.categoryList.find((item) => item.id === this.selectCategoryId) || {}
|
||||
this.categoryList.find((item) => item.id === this.selectCategoryId) ||
|
||||
{}
|
||||
);
|
||||
},
|
||||
cartShowCount() {
|
||||
@ -177,33 +214,33 @@ export default {
|
||||
// console.log('[shop.vue] $refs.wechatCopyModal:', this.$refs.wechatCopyModal)
|
||||
if (this.$refs.wechatCopyModal && this.$refs.wechatCopyModal.show) {
|
||||
this.$refs.wechatCopyModal.show({
|
||||
title: '请添加客服号',
|
||||
weChatCode: 'Wagoo2025'
|
||||
title: "请添加客服号",
|
||||
weChatCode: "Wagoo2025",
|
||||
});
|
||||
// console.log('[shop.vue] wechatCopyModal.show called')
|
||||
} else {
|
||||
// console.error('[shop.vue] wechatCopyModal not available, using fallback')
|
||||
// 降级方案:直接显示系统弹窗
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请添加客服号:Wagoo2025',
|
||||
confirmText: '复制微信号',
|
||||
title: "提示",
|
||||
content: "请添加客服号:Wagoo2025",
|
||||
confirmText: "复制微信号",
|
||||
showCancel: true,
|
||||
cancelText: '取消',
|
||||
cancelText: "取消",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.setClipboardData({
|
||||
data: 'Wagoo2025',
|
||||
data: "Wagoo2025",
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '已复制微信号',
|
||||
icon: 'success'
|
||||
})
|
||||
title: "已复制微信号",
|
||||
icon: "success",
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
jumpToWeChat,
|
||||
@ -265,7 +302,7 @@ export default {
|
||||
.then(() => {
|
||||
uni.showToast({
|
||||
title: "已加入购物车!",
|
||||
icon: "none"
|
||||
icon: "none",
|
||||
});
|
||||
this.getCartListData();
|
||||
// 触发购物车数量徽章动画
|
||||
@ -274,20 +311,13 @@ export default {
|
||||
.catch((err) => {
|
||||
uni.showToast({
|
||||
title: err || "加入购物车失败!",
|
||||
icon: "none"
|
||||
icon: "none",
|
||||
});
|
||||
});
|
||||
},
|
||||
optAction(data) {
|
||||
const {
|
||||
product_id,
|
||||
type,
|
||||
prices,
|
||||
product_name,
|
||||
product_pic,
|
||||
number
|
||||
} = data;
|
||||
|
||||
const { product_id, type, prices, product_name, product_pic, number } =
|
||||
data;
|
||||
this.addCartAction({
|
||||
item_id: product_id,
|
||||
item_type: type,
|
||||
@ -297,7 +327,7 @@ export default {
|
||||
item_price: prices?.[0]?.actual_price,
|
||||
number,
|
||||
item_pic: product_pic,
|
||||
is_select: 1
|
||||
is_select: 1,
|
||||
});
|
||||
this.showModal = false;
|
||||
// 触发对应商品项的动画
|
||||
@ -322,14 +352,14 @@ export default {
|
||||
addToCar(good) {
|
||||
this.showModal = true;
|
||||
this.addGoodInfo = {
|
||||
...good
|
||||
...good,
|
||||
};
|
||||
},
|
||||
// 购物车列表
|
||||
getCartListData() {
|
||||
getCartList({
|
||||
p: 1,
|
||||
num: 999
|
||||
num: 999,
|
||||
}).then((res) => {
|
||||
this.cartCount = (res?.data.list || []).reduce(
|
||||
(total, prev) => total + prev.number,
|
||||
@ -354,8 +384,9 @@ export default {
|
||||
success: (res) => {
|
||||
// 通过 eventChannel 向被打开页面传送数据
|
||||
res.eventChannel.emit("createOrder", {
|
||||
goodList: [{
|
||||
item_id: good.product_id,
|
||||
goodList: [
|
||||
{
|
||||
goods_id: good.product_id,
|
||||
item_type: good.type,
|
||||
price_id: good.prices?.[0]?.price_id,
|
||||
price_desc: good.prices?.[0]?.price_desc,
|
||||
@ -370,7 +401,8 @@ export default {
|
||||
product_price: good.prices?.[0]?.actual_price,
|
||||
original_price: good.prices?.[0]?.original_price,
|
||||
yunfei: good.yunfei || 0,
|
||||
}],
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
@ -466,14 +498,14 @@ export default {
|
||||
background: #f7f8fa;
|
||||
|
||||
.category-item-left-name {
|
||||
color: #3D3D3D;
|
||||
color: #3d3d3d;
|
||||
}
|
||||
|
||||
&.category-item-left-active {
|
||||
background-color: #fff;
|
||||
|
||||
.category-item-left-name {
|
||||
color: #FF19A0;
|
||||
color: #ff19a0;
|
||||
}
|
||||
|
||||
.border-line {
|
||||
@ -483,7 +515,7 @@ export default {
|
||||
left: 0;
|
||||
width: 10rpx;
|
||||
border-radius: 28rpx;
|
||||
background: #FF19A0;
|
||||
background: #ff19a0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,9 +562,9 @@ export default {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 30rpx;
|
||||
background: #FF19A0;
|
||||
background: #ff19a0;
|
||||
z-index: 10;
|
||||
border: 1px solid #FFFFFF;
|
||||
border: 1px solid #ffffff;
|
||||
transition: transform 0.3s ease;
|
||||
|
||||
&.cart-count-bounce {
|
||||
|
||||
Reference in New Issue
Block a user