|
|
@@ -1,51 +1,70 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
- <uv-navbar title="店铺信息" placeholder @leftClick="goBack"></uv-navbar>
|
|
|
+ <uv-navbar title="店铺信息" placeholder></uv-navbar>
|
|
|
<view class="top">
|
|
|
<view class="shop">
|
|
|
<view class="shop_l">
|
|
|
- <image :src="details.logo" mode="" />
|
|
|
+ <image :src="details.image" mode="" />
|
|
|
<view>
|
|
|
- <view class="shop_l_title">{{details.businessName}}</view>
|
|
|
- <view class="shop_l_rate">
|
|
|
- <rate :value="Math.round(details.average)" />
|
|
|
+ <view class="shop_l_title">{{ details.businessName }}</view>
|
|
|
+ <view class="shop_l_rate u-flex-center-sb">
|
|
|
+ <view class="u-flex-center">
|
|
|
+ <rate :value="Math.round(details.average)" />
|
|
|
+ <text class="u-font24 u-ml10">{{ details.average }}分</text>
|
|
|
+ </view>
|
|
|
+ <view class="shop_r" @click="goPhone()"> 售后电话 </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="shop_r" @click="goPhone()">
|
|
|
- 售后电话
|
|
|
- </view>
|
|
|
</view>
|
|
|
<view class="searchBox">
|
|
|
<image :src="$handleImageUrl('/common/search.png')" mode=""></image>
|
|
|
- <input @click="searchClick" v-model="value" type="text" placeholder-style="color:#B3B3B3;font-size:28rpx" placeholder="可搜索本店商品" />
|
|
|
+ <input
|
|
|
+ @click="searchClick"
|
|
|
+ v-model="value"
|
|
|
+ type="text"
|
|
|
+ placeholder-style="color:#B3B3B3;font-size:28rpx"
|
|
|
+ placeholder="可搜索本店商品"
|
|
|
+ />
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
+ <!-- 限时秒杀 -->
|
|
|
+ <SeckillGood :currSeckill="list" />
|
|
|
+
|
|
|
<view class="tabsBox">
|
|
|
- <uv-tabs :list="tabList" keyName="categoryName" lineColor="#FA6138" activeStyle="color:#FA6138;" lineWidth="60rpx" @click="tabsClick"></uv-tabs>
|
|
|
+ <uv-tabs
|
|
|
+ :list="tabList"
|
|
|
+ keyName="categoryName"
|
|
|
+ lineColor="#FA6138"
|
|
|
+ activeStyle="color:#FA6138;"
|
|
|
+ lineWidth="60rpx"
|
|
|
+ @click="tabsClick"
|
|
|
+ ></uv-tabs>
|
|
|
</view>
|
|
|
<view class="list">
|
|
|
- <view class="goodsListA_item" v-for="item in list" :key="item.id" @click="goDetails(item)">
|
|
|
+ <view
|
|
|
+ class="goodsListA_item"
|
|
|
+ v-for="item in list"
|
|
|
+ :key="item.id"
|
|
|
+ @click="goDetails(item)"
|
|
|
+ >
|
|
|
<image :src="`${item.coverImage}`" mode=""></image>
|
|
|
<view class="goodsListA_item_title">{{ item.title }}</view>
|
|
|
<view class="goodsListA_item_pirce">
|
|
|
- <text v-if="item.productPaymentMode==1" style="font-size:22rpx;">{{item.minPoints}}积分</text>
|
|
|
- <rich-text v-else :nodes="mUtil.priceBigSmall(item.salePrice||item.minSalePrice)"></rich-text>
|
|
|
- <view>¥ {{ item.marketPrice||item.minMarketPrice }}</view>
|
|
|
+ <text v-if="item.productPaymentMode == 1" style="font-size: 22rpx"
|
|
|
+ >{{ item.minPoints }}积分</text
|
|
|
+ >
|
|
|
+ <rich-text
|
|
|
+ v-else
|
|
|
+ :nodes="$mUtil.priceBigSmall(item.salePrice || item.minSalePrice)"
|
|
|
+ ></rich-text>
|
|
|
+ <view>¥ {{ item.marketPrice || item.minMarketPrice }}</view>
|
|
|
</view>
|
|
|
- <view class="goodsListA_item_num">已售{{ item.showSales}}件</view>
|
|
|
+ <view class="goodsListA_item_num">已售{{ item.showSales }}件</view>
|
|
|
</view>
|
|
|
- <!-- <view class="goodsListA_item" @click="goDetails()" v-for="(v,i) in 10" :key="i">
|
|
|
- <image src="https://jiangxishop.oss-cn-beijing.aliyuncs.com/20250920/b53b0ad4931340258ce217581c6bdcf4.png?x-oss-process=style/w_350" mode=""></image>
|
|
|
- <view class="goodsListA_item_title">陶瓷扒花雕刻品茗杯主人杯咖啡杯中式高档茶杯礼盒装</view>
|
|
|
- <view class="goodsListA_item_pirce">
|
|
|
- <rich-text :nodes="mUtil.priceBigSmall('133')"></rich-text>
|
|
|
- <view>¥ 500</view>
|
|
|
- </view>
|
|
|
- <view class="goodsListA_item_num">已售0件</view>
|
|
|
- </view> -->
|
|
|
</view>
|
|
|
- <view v-if="list.length<=0" style="width: 100%;">
|
|
|
+ <view v-if="list.length <= 0" style="width: 100%">
|
|
|
<noData :config="{ top: 20, content: '暂无商品~' }"></noData>
|
|
|
</view>
|
|
|
<uv-load-more v-else :status="status" />
|
|
|
@@ -53,20 +72,29 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup >
|
|
|
-import { getBusinessInfo, getProductCategoryList, productList } from "@/api/shop.js"
|
|
|
-import { ref, getCurrentInstance } from 'vue'
|
|
|
-import { onShow, onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
|
|
-const { proxy } = getCurrentInstance();
|
|
|
-const mUtil = proxy.$mUtil;
|
|
|
+import {
|
|
|
+ getBusinessInfo,
|
|
|
+ getProductCategoryList,
|
|
|
+ productList,
|
|
|
+} from "@/api/shop.js";
|
|
|
+import { ref, getCurrentInstance } from "vue";
|
|
|
+import {
|
|
|
+ onShow,
|
|
|
+ onLoad,
|
|
|
+ onPullDownRefresh,
|
|
|
+ onReachBottom,
|
|
|
+} from "@dcloudio/uni-app";
|
|
|
+import SeckillGood from "./components/SeckillGood.vue"; // 限时秒杀组件
|
|
|
+
|
|
|
const details = ref({});
|
|
|
const value = ref("");
|
|
|
-const status = ref('loadmore')
|
|
|
-const list = ref([]) // 添加缺失的商品列表数据
|
|
|
+const status = ref("loadmore");
|
|
|
+const list = ref([]); // 添加缺失的商品列表数据
|
|
|
const tabList = ref([
|
|
|
{
|
|
|
id: 1,
|
|
|
- categoryName: "推荐",
|
|
|
- categoryId: "recommend",
|
|
|
+ categoryName: "全部",
|
|
|
+ categoryId: "",
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
|
@@ -77,117 +105,125 @@ const tabList = ref([
|
|
|
id: 3,
|
|
|
categoryName: "新品",
|
|
|
categoryId: "new",
|
|
|
- }
|
|
|
+ },
|
|
|
]);
|
|
|
const params = ref({
|
|
|
- recommendStatus: true,
|
|
|
pageNum: 1,
|
|
|
- pageSize: 10
|
|
|
-})
|
|
|
-onShow(() => {
|
|
|
- let id = uni.getStorageSync('businessId');
|
|
|
+ pageSize: 10,
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
+onLoad((options) => {
|
|
|
+ let id = options.businessId;
|
|
|
if (id) {
|
|
|
params.value.businessId = id;
|
|
|
getDetails();
|
|
|
- getTabs()
|
|
|
+ getTabs();
|
|
|
}
|
|
|
-})
|
|
|
+});
|
|
|
// 下拉刷新
|
|
|
onPullDownRefresh(() => {
|
|
|
- params.value.pageNum = 1
|
|
|
- getProductList()
|
|
|
-})
|
|
|
+ params.value.pageNum = 1;
|
|
|
+ getProductList();
|
|
|
+});
|
|
|
// 上拉加载更多
|
|
|
onReachBottom(() => {
|
|
|
- if (status.value == 'loadmore') {
|
|
|
- params.value.pageNum++
|
|
|
- getProductList()
|
|
|
+ if (status.value == "loadmore") {
|
|
|
+ params.value.pageNum++;
|
|
|
+ getProductList();
|
|
|
}
|
|
|
-})
|
|
|
+});
|
|
|
const goBack = () => {
|
|
|
// uni.navigateBack()
|
|
|
- uni.navigateTo({ url: '/pages/index/index' })
|
|
|
-}
|
|
|
+ uni.navigateTo({ url: "/pages/index/index" });
|
|
|
+};
|
|
|
const getTabs = () => {
|
|
|
- getProductCategoryList({ businessId: params.value.businessId }).then(res => {
|
|
|
- tabList.value = [...tabList.value, ...res.data]
|
|
|
- }
|
|
|
- )
|
|
|
-}
|
|
|
+ getProductCategoryList({ businessId: params.value.businessId }).then(
|
|
|
+ (res) => {
|
|
|
+ tabList.value = [...tabList.value, ...res.data];
|
|
|
+ }
|
|
|
+ );
|
|
|
+};
|
|
|
// 商家电话
|
|
|
const goPhone = () => {
|
|
|
- uni.makePhoneCall({
|
|
|
- phoneNumber: details.value.contactPhone
|
|
|
- });
|
|
|
-}
|
|
|
+ if (details.value.customerServicePhone) {
|
|
|
+ uni.makePhoneCall({
|
|
|
+ phoneNumber: details.value.customerServicePhone,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "暂无商家电话",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
const getDetails = () => {
|
|
|
- getBusinessInfo({ businessId: params.value.businessId }).then(res => {
|
|
|
+ getBusinessInfo({ businessId: params.value.businessId }).then((res) => {
|
|
|
details.value = res.data;
|
|
|
- getProductList()
|
|
|
- })
|
|
|
-}
|
|
|
+ getProductList();
|
|
|
+ });
|
|
|
+};
|
|
|
// 获取商品分页列表
|
|
|
const getProductList = () => {
|
|
|
- status.value = 'loading'
|
|
|
- productList(params.value).then(res => {
|
|
|
- if (params.value.pageNum == 1) {
|
|
|
- list.value = res.rows
|
|
|
- } else {
|
|
|
- list.value = [...list.value, ...res.rows]
|
|
|
- }
|
|
|
- if (list.value.length < res.total) {
|
|
|
- status.value = 'loadmore'
|
|
|
- } else {
|
|
|
- status.value = 'noMore'
|
|
|
- }
|
|
|
- uni.stopPullDownRefresh()
|
|
|
- }).catch(e => {
|
|
|
- uni.stopPullDownRefresh()
|
|
|
- status.value = 'loadmore'
|
|
|
- })
|
|
|
+ status.value = "loading";
|
|
|
+ productList(params.value)
|
|
|
+ .then((res) => {
|
|
|
+ if (!res.rows) return;
|
|
|
+ if (params.value.pageNum == 1) {
|
|
|
+ list.value = res.rows;
|
|
|
+ } else {
|
|
|
+ list.value = [...list.value, ...res.rows];
|
|
|
+ }
|
|
|
+ if (list.value.length < res.total) {
|
|
|
+ status.value = "loadmore";
|
|
|
+ } else {
|
|
|
+ status.value = "noMore";
|
|
|
+ }
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ status.value = "loadmore";
|
|
|
+ });
|
|
|
};
|
|
|
const goDetails = (item) => {
|
|
|
uni.navigateTo({
|
|
|
- url: `/pages/shop/goodsDetails?id=${item.productId}`
|
|
|
+ url: `/pages/shop/goodsDetails?id=${item.productId}`,
|
|
|
});
|
|
|
-}
|
|
|
+};
|
|
|
const searchClick = () => {
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages/shop/goodSearch'
|
|
|
+ url: "/pages/shop/goodSearch",
|
|
|
});
|
|
|
};
|
|
|
const tabsClick = (e) => {
|
|
|
// 重置分页参数
|
|
|
- params.value.pageNum = 1
|
|
|
+ params.value.pageNum = 1;
|
|
|
// 根据选中的标签设置不同的查询参数
|
|
|
if (e.index === 0) {
|
|
|
- // 推荐
|
|
|
- params.value.recommendStatus = true
|
|
|
- delete params.value.productCategoryId
|
|
|
- delete params.value.hot
|
|
|
- delete params.value.newStatus
|
|
|
+ // 全部
|
|
|
+ delete params.value.productCategoryId;
|
|
|
+ delete params.value.hot;
|
|
|
+ delete params.value.newStatus;
|
|
|
} else if (e.index === 1) {
|
|
|
// 热销
|
|
|
- params.value.hot = true
|
|
|
- delete params.value.productCategoryId
|
|
|
- delete params.value.recommendStatus
|
|
|
- delete params.value.newStatus
|
|
|
+ params.value.hot = true;
|
|
|
+ delete params.value.productCategoryId;
|
|
|
+ delete params.value.newStatus;
|
|
|
} else if (e.index === 2) {
|
|
|
// 新品
|
|
|
- params.value.newStatus = true
|
|
|
- delete params.value.productCategoryId
|
|
|
- delete params.value.recommendStatus
|
|
|
- delete params.value.hot
|
|
|
+ params.value.newStatus = true;
|
|
|
+ delete params.value.productCategoryId;
|
|
|
+ delete params.value.hot;
|
|
|
} else {
|
|
|
// 具体分类
|
|
|
- params.value.productCategoryId = tabList.value[e.index].categoryId
|
|
|
- delete params.value.recommendStatus
|
|
|
- delete params.value.hot
|
|
|
- delete params.value.newStatus
|
|
|
+ params.value.productCategoryId = tabList.value[e.index].categoryId;
|
|
|
+ delete params.value.hot;
|
|
|
+ delete params.value.newStatus;
|
|
|
}
|
|
|
// 重新获取商品列表
|
|
|
- getProductList()
|
|
|
-}
|
|
|
+ getProductList();
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
@@ -234,10 +270,10 @@ const tabsClick = (e) => {
|
|
|
border-radius: 25rpx;
|
|
|
background-color: #fff;
|
|
|
border: 1rpx solid #666;
|
|
|
- position: absolute;
|
|
|
- right: 30rpx;
|
|
|
- bottom: 25rpx;
|
|
|
- font-size: 28rpx;
|
|
|
+ // position: absolute;
|
|
|
+ // right: 30rpx;
|
|
|
+ // bottom: 25rpx;
|
|
|
+ // font-size: 28rpx;
|
|
|
}
|
|
|
}
|
|
|
.searchBox {
|
|
|
@@ -262,6 +298,7 @@ const tabsClick = (e) => {
|
|
|
text-align: left;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.tabsBox {
|
|
|
margin-bottom: 20rpx;
|
|
|
padding: 0 30rpx;
|