feat: 增加楼层装修

master
paulGao 2022-11-04 17:56:02 +08:00
parent 524666f6e4
commit eaa04e395b
2 changed files with 331 additions and 117 deletions

View File

@ -44,10 +44,22 @@ export function getHotKeywords(count) {
* @param client_type * @param client_type
* @param page_type * @param page_type
*/ */
export function getFloorData() { export function getFloorData(params) {
return http.request({ return http.request({
url: `/other/pageData/getIndex?clientType=H5`, url: `/other/pageData/getIndex?clientType=H5`,
method: "get", method: "get",
params
});
}
/**
* 获取店铺楼层数据
*/
export function getFloorStoreData(params) {
return http.request({
url: `/other/pageData?pageClientType=H5`,
method: "get",
params
}); });
} }

View File

@ -1,91 +1,154 @@
<template> <template>
<div> <view>
<u-navbar :border-bottom="false"> <!-- 楼层装修店铺信息 -->
<u-search v-model="keyword" @custom='search' :show-action="true" action-text="搜索" :animation="true" @search="search" @click="search" placeholder="请输入搜索"></u-search> <div>
</u-navbar> <u-navbar :border-bottom="false">
<div class="wrapper"> <u-search
<!-- 店铺信息模块 --> v-model="keyword"
<div class="store flex"> @search="search"
<u-image border-radius="10" width="150" height="150" :src="storeInfo.storeLogo || config.logo" mode="aspectFit"> @click="search"
</u-image> placeholder="请输入搜索"
<div class="box"> ></u-search>
<div class="store-name" @click="getStoreLicencePhoto"> </u-navbar>
{{ storeInfo.storeName || ''}} <div class="wrapper">
<u-icon style="margin-left:10rpx;" name="arrow-right"></u-icon> <!-- 店铺信息模块 -->
<div class="store flex">
<u-image
border-radius="10"
width="150"
height="150"
:src="storeInfo.storeLogo || config.logo"
mode="aspectFit"
>
</u-image>
<div class="box">
<div class="store-name" @click="getStoreLicencePhoto">
{{ storeInfo.storeName || "" }}
<u-icon style="margin-left: 10rpx" name="arrow-right"></u-icon>
</div>
<div class="flex store-message">
<div>
<span>{{ storeInfo.collectionNum || 0 }}</span
>关注
</div>
<div>
<span>{{ storeInfo.goodsNum || 0 }}</span
>件商品
</div>
</div>
</div> </div>
<div class="flex store-message"> <div class="collection">
<div> <span>{{ storeInfo.collectionNum || 0 }}</span>关注 </div> <div class="collection-btn" @click="whetherCollection">
<div> <span>{{ storeInfo.goodsNum || 0 }}</span>件商品 </div> {{ isCollection ? "已关注" : "+ 关注" }}
</div>
</div> </div>
</div> </div>
<div class="collection"> <!-- 店铺简介 -->
<div class="collection-btn" @click="whetherCollection"> {{ isCollection ? '' : '+ ' }}</div> <div class="store-desc wes-2">
{{ storeInfo.storeDesc }}
</div> </div>
</div>
<!-- 店铺简介 -->
<div class="store-desc wes-2">
{{storeInfo.storeDesc}}
</div>
<!-- 联系客服 --> <!-- 联系客服 -->
<div class="kefu" @click="linkKefuDetail"> <div class="kefu" @click="linkKefuDetail">
<u-icon name="kefu-ermai"></u-icon> <u-icon name="kefu-ermai"></u-icon>
联系客服 联系客服
</div>
</div> </div>
</div> <!-- 优惠券 -->
<!-- 优惠券 --> <scroll-view
<scroll-view scroll-x="true" show-scrollbar="false" class="discount" v-if="couponList.length > 0"> scroll-x="true"
<view class="card-box" v-for="(item, index) in couponList" :key="index"> show-scrollbar="false"
<view class="card" @click="getCoupon(item)"> class="discount"
<view class="money"> v-if="couponList.length > 0"
<view> >
<span v-if="item.couponType == 'DISCOUNT'">{{ item.couponDiscount }}</span> <view class="card-box" v-for="(item, index) in couponList" :key="index">
<span v-else>{{ item.price }}</span> <view class="card" @click="getCoupon(item)">
<view class="money">
<view>
<span v-if="item.couponType == 'DISCOUNT'"
>{{ item.couponDiscount }}</span
>
<span v-else>{{ item.price }}</span>
</view>
</view>
<view class="xian"></view>
<view class="text">
<text>{{ "领取优惠券" }}</text>
<text>{{ item.consumeThreshold | unitPrice }}元可用</text>
</view> </view>
</view>
<view class="xian"></view>
<view class="text">
<text>{{'领取优惠券'}}</text>
<text>{{ item.consumeThreshold | unitPrice }}元可用</text>
</view> </view>
</view> </view>
</view> </scroll-view>
</scroll-view> <!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
<div v-for="(item, index) in pageData.list" :key="index">
<!-- 搜索栏如果在楼层装修顶部则会自动浮动否则不浮动 -->
<u-navbar
class="navbar"
v-if="item.type == 'search'"
:is-fixed="index === 1 ? false : true"
>
<div class="navbar-right"></div>
<!-- tab --> <search style="width: 100%" :res="item.options" />
<u-tabs :list="tabs" :active-color="mainColor" :is-scroll="false" :current="current" @change="changeTab"></u-tabs> </u-navbar>
<!-- menu --> <carousel v-if="item.type == 'carousel'" :res="item.options" />
<titleLayout v-if="item.type == 'title'" :res="item.options" />
<leftOneRightTwo
v-if="item.type == 'leftOneRightTwo'"
:res="item.options"
/>
<leftTwoRightOne
v-if="item.type == 'leftTwoRightOne'"
:res="item.options"
/>
<topOneBottomTwo
v-if="item.type == 'topOneBottomTwo'"
:res="item.options"
/>
<topTwoBottomOne
v-if="item.type == 'topTwoBottomOne'"
:res="item.options"
/>
<flexThree v-if="item.type == 'flexThree'" :res="item.options" />
<flexFive v-if="item.type == 'flexFive'" :res="item.options" />
<flexFour v-if="item.type == 'flexFour'" :res="item.options" />
<flexTwo v-if="item.type == 'flexTwo'" :res="item.options" />
<textPicture v-if="item.type == 'textPicture'" :res="item.options" />
<menuLayout v-if="item.type == 'menu'" :res="item.options" />
<flexOne v-if="item.type == 'flexOne'" :res="item.options" />
<!-- 商品 --> <goods v-if="item.type == 'goods'" :res="item.options" />
<div class="contant" v-if="current == 0">
<group v-if="item.type == 'group'" :res="item.options" />
<u-empty style='margin-top:100rpx' v-if="goodsList.length == 0" class="empty" text='暂无商品信息'></u-empty> <!-- <joinGroup v-if="item.type == 'joinGroup'" :res="item.options" /> -->
<goodsTemplate v-else :res="goodsList" :storeName="false" /> <!-- <integral v-if="item.type == 'integral'" :res="item.options" /> -->
</div> <!-- <spike v-if="item.type == 'spike'" :res="item.options" /> -->
<!-- 全部分类 -->
<div class="category" v-if="current == 1">
<div class="category-item" v-for="(item,index) in categoryList" :key="index">
<div class="flex" @click="getCategoryGoodsList(item)">
<div>{{item.labelName}}</div>
<div>
<u-icon color="#999" name="arrow-right"></u-icon>
</div>
</div>
<!-- 分类子级 -->
<div class="child-list" v-if="item.children && item.children.length!=0">
<div class="child" @click="getCategoryGoodsList(child)" :key='i' v-for="(child,i) in item.children">{{child.labelName}}
</div>
</div>
</div> </div>
<u-no-network></u-no-network>
</div> </div>
<u-back-top :scroll-top="scrollTop"></u-back-top> </view>
</div>
</template> </template>
<script> <script>
//
import tpl_banner from "@/pages/tabbar/home/template/tpl_banner"; //
import tpl_title from "@/pages/tabbar/home/template/tpl_title"; //
import tpl_left_one_right_two from "@/pages/tabbar/home/template/tpl_left_one_right_two"; //
import tpl_left_two_right_one from "@/pages/tabbar/home/template/tpl_left_two_right_one"; //
import tpl_top_one_bottom_two from "@/pages/tabbar/home/template/tpl_top_one_bottom_two"; //
import tpl_top_two_bottom_one from "@/pages/tabbar/home/template/tpl_top_two_bottom_one"; //
import tpl_flex_one from "@/pages/tabbar/home/template/tpl_flex_one"; //
import tpl_flex_two from "@/pages/tabbar/home/template/tpl_flex_two"; //
import tpl_flex_three from "@/pages/tabbar/home/template/tpl_flex_three"; //
import tpl_flex_five from "@/pages/tabbar/home/template/tpl_flex_five"; //
import tpl_flex_four from "@/pages/tabbar/home/template/tpl_flex_four"; //
import tpl_text_picture from "@/pages/tabbar/home/template/tpl_text_picture"; //
import tpl_menu from "@/pages/tabbar/home/template/tpl_menu"; //
import tpl_search from "@/pages/tabbar/home/template/tpl_search"; //
import tpl_group from "@/pages/tabbar/home/template/tpl_group"; //
import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //
import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js"; import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js";
import goodsTemplate from '@/components/m-goods-list/list'
import { import {
receiveCoupons, receiveCoupons,
deleteStoreCollection, deleteStoreCollection,
@ -96,14 +159,25 @@ import config from "@/config/config";
import storage from "@/utils/storage"; import storage from "@/utils/storage";
import { getGoodsList } from "@/api/goods.js"; import { getGoodsList } from "@/api/goods.js";
import { getAllCoupons } from "@/api/promotions.js"; import { getAllCoupons } from "@/api/promotions.js";
import { getFloorStoreData } from "@/api/home"; //
export default { export default {
data() { data() {
return { return {
config, config,
pageData: "", //
enablePageData: false, //
basePageData: false, //
scrollTop: 0, scrollTop: 0,
mainColor: this.$mainColor, // mainColor: this.$mainColor, //
current: 0, //tabs current: 0, //tabs
tabs: [{ name: "全部商品" }, { name: "分类查看" }], // tabs: [
{
name: "全部商品",
},
{
name: "分类查看",
},
], //
storeId: "", storeId: "",
keyword: "", keyword: "",
storeInfo: {}, // storeInfo: {}, //
@ -111,16 +185,49 @@ export default {
goodsList: [], // goodsList: [], //
couponList: [], // couponList: [], //
categoryList: [], categoryList: [],
couponParams: { pageNumber: 1, pageSize: 50, storeId: "" }, couponParams: {
goodsParams: { pageNumber: 1, pageSize: 10, storeId: "" }, pageNumber: 1,
pageSize: 50,
storeId: "",
},
goodsParams: {
pageNumber: 1,
pageSize: 50,
storeId: "",
},
}; };
}, },
components: {
carousel: tpl_banner,
titleLayout: tpl_title,
leftOneRightTwo: tpl_left_one_right_two,
leftTwoRightOne: tpl_left_two_right_one,
topOneBottomTwo: tpl_top_one_bottom_two,
topTwoBottomOne: tpl_top_two_bottom_one,
flexThree: tpl_flex_three,
flexFive: tpl_flex_five,
flexFour: tpl_flex_four,
flexTwo: tpl_flex_two,
textPicture: tpl_text_picture,
menuLayout: tpl_menu,
search: tpl_search,
flexOne: tpl_flex_one,
goods: tpl_goods,
group: tpl_group,
// spike: tpl_spike,
// joinGroup: tpl_join_group,
// integral: tpl_integral,
},
watch: { watch: {
current(val) { current(val) {
val == 0 ? ()=>{ this.goodsList = []; this.getGoodsData()} : this.getCategoryData(); val == 0
? () => {
this.goodsList = [];
this.getGoodsData();
}
: this.getCategoryData();
}, },
}, },
components:{goodsTemplate},
/** /**
* 加载 * 加载
@ -139,7 +246,9 @@ export default {
mounted() { mounted() {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// //
uni.showShareMenu({ withShareTicket: true }); uni.showShareMenu({
withShareTicket: true,
});
// #endif // #endif
this.init(); this.init();
}, },
@ -151,13 +260,30 @@ export default {
}, },
methods: { methods: {
back() {
uni.navigateBack();
},
/**
* 实例化首页数据楼层
*/
initPageData() {
this.pageData = "";
getFloorStoreData({
pageType: "STORE",
num: this.storeId,
}).then((res) => {
if (res.data.success) {
this.pageData = JSON.parse(res.data.result.pageData);
}
});
},
getStoreLicencePhoto() { getStoreLicencePhoto() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/licencePhoto?id=${this.storeId}`, url: `/pages/product/licencePhoto?id=${this.storeId}`,
}); });
}, },
/** /**
* 初始化信息 * 初始化信息
*/ */
init() { init() {
this.goodsList = []; this.goodsList = [];
@ -169,45 +295,35 @@ export default {
} }
// //
this.getStoreData(); this.getStoreData();
//
this.getGoodsData();
//
this.getCouponsData();
//
this.getCategoryData();
}, },
/** /**
* 联系客服 * 联系客服
*/ */
linkKefuDetail() { linkKefuDetail() {
// // //
// // #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// const params = { const params = {
// // originalPrice: this.goodsDetail.original || this.goodsDetail.price, // originalPrice: this.goodsDetail.original || this.goodsDetail.price,
// uuid: storage.getUuid(), uuid: storage.getUuid(),
// token: storage.getAccessToken(), token: storage.getAccessToken(),
// sign: this.storeInfo.yzfSign, sign: this.storeInfo.yzfSign,
// mpSign: this.storeInfo.yzfMpSign, mpSign: this.storeInfo.yzfMpSign,
// }; };
// uni.navigateTo({ uni.navigateTo({
// url: url:
// "/pages/product/customerservice/index?params=" + "/pages/product/customerservice/index?params=" +
// encodeURIComponent(JSON.stringify(params)), encodeURIComponent(JSON.stringify(params)),
// }); });
// // #endif // #endif
// // #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
// const sign = this.storeInfo.yzfSign; const sign = this.storeInfo.yzfSign;
// uni.navigateTo({ uni.navigateTo({
// url: url:
// "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" +
// sign, sign,
// }); });
// // #endif // #endif
uni.navigateTo({
url: `/pages/tabbar/home/web-view?IM=${this.storeId}`,
});
}, },
/** 获取店铺分类 */ /** 获取店铺分类 */
@ -236,7 +352,6 @@ export default {
* 搜索 * 搜索
*/ */
search() { search() {
console.log("点击")
uni.navigateTo({ uni.navigateTo({
url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`, url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`,
}); });
@ -252,9 +367,23 @@ export default {
*/ */
async getStoreData() { async getStoreData() {
let res = await getStoreBaseInfo(this.storeId); let res = await getStoreBaseInfo(this.storeId);
res.data.success if (res.data.success) {
? (this.storeInfo = res.data.result) this.storeInfo = res.data.result;
: uni.reLaunch({ url: "/" });
//
this.initPageData();
//
//
this.getGoodsData();
//
this.getCouponsData();
//
this.getCategoryData();
} else {
uni.reLaunch({
url: "/",
});
}
}, },
/** 加载商品 */ /** 加载商品 */
@ -262,7 +391,6 @@ export default {
let res = await getGoodsList(this.goodsParams); let res = await getGoodsList(this.goodsParams);
if (res.data.success) { if (res.data.success) {
this.goodsList.push(...res.data.result.content); this.goodsList.push(...res.data.result.content);
console.log(this.goodsList)
} }
}, },
@ -275,6 +403,15 @@ export default {
} }
}, },
/**
* 跳转到商品详情
*/
navigateToGoodsDetail(val) {
uni.navigateTo({
url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`,
});
},
/** /**
* 是否收藏 * 是否收藏
*/ */
@ -337,8 +474,10 @@ export default {
background: #fff; background: #fff;
padding: 32rpx; padding: 32rpx;
} }
.store { .store {
align-items: center; align-items: center;
> .box { > .box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -347,17 +486,21 @@ export default {
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
flex: 2; flex: 2;
> .store-name { > .store-name {
font-size: 34rpx; font-size: 34rpx;
color: #333; color: #333;
letter-spacing: 1rpx; letter-spacing: 1rpx;
font-weight: bold; font-weight: bold;
} }
> .store-message { > .store-message {
margin-top: 25rpx; margin-top: 25rpx;
> div { > div {
font-size: 26rpx; font-size: 26rpx;
margin: 0 5rpx; margin: 0 5rpx;
> span { > span {
font-size: 26rpx; font-size: 26rpx;
font-weight: bold; font-weight: bold;
@ -368,6 +511,7 @@ export default {
} }
} }
} }
.collection-btn { .collection-btn {
background: $main-color; background: $main-color;
padding: 6rpx 0; padding: 6rpx 0;
@ -377,6 +521,7 @@ export default {
border-radius: 100px; border-radius: 100px;
text-align: center; text-align: center;
} }
.store-desc { .store-desc {
margin: 40rpx 0 0 0; margin: 40rpx 0 0 0;
color: #999; color: #999;
@ -387,13 +532,54 @@ export default {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
> .empty { > .empty {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 40rpx; margin-top: 40rpx;
} }
.item {
overflow: hidden;
background: #fff;
width: 49%;
height: 484rpx;
font-size: 26rpx;
display: flex;
flex-direction: column;
border: 1px solid #f8f8f8;
margin-bottom: 20rpx;
.name {
text-align: left !important;
color: #333;
padding: 0 20rpx;
margin-top: 20rpx;
height: 80rpx;
overflow: hidden;
}
.price {
font-weight: 500;
color: $main-color;
font-size: 30rpx;
padding: 0 20rpx;
margin-top: 20rpx;
white-space: nowrap;
}
.buyCount {
display: flex;
padding: 0 20rpx;
font-size: 24upx;
justify-content: space-between;
color: #999;
}
}
} }
.discount { .discount {
height: 154rpx; height: 154rpx;
border-top: 1px solid #f6f6f6; border-top: 1px solid #f6f6f6;
@ -401,10 +587,12 @@ export default {
background: #f6f6f6; background: #f6f6f6;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
.card-box { .card-box {
display: inline-block; display: inline-block;
padding-top: 25rpx; padding-top: 25rpx;
} }
.card { .card {
width: 324rpx; width: 324rpx;
height: 116rpx; height: 116rpx;
@ -413,19 +601,23 @@ export default {
border-radius: 5px; border-radius: 5px;
display: flex; display: flex;
align-items: center; align-items: center;
.money { .money {
width: 45%; width: 45%;
color: #fd6466; color: #fd6466;
font-weight: 500; font-weight: 500;
text-align: center; text-align: center;
text { text {
font-size: 50rpx; font-size: 50rpx;
} }
} }
.xian { .xian {
height: 66rpx; height: 66rpx;
border: 1px dashed #f6f6f6; border: 1px dashed #f6f6f6;
position: relative; position: relative;
&:before, &:before,
&:after { &:after {
content: ""; content: "";
@ -434,17 +626,20 @@ export default {
position: absolute; position: absolute;
background: #f6f6f6; background: #f6f6f6;
} }
&:before { &:before {
border-radius: 0 0 22rpx 22rpx; border-radius: 0 0 22rpx 22rpx;
top: -30rpx; top: -30rpx;
left: -10rpx; left: -10rpx;
} }
&:after { &:after {
border-radius: 22rpx 22rpx 0 0; border-radius: 22rpx 22rpx 0 0;
bottom: -30rpx; bottom: -30rpx;
left: -10rpx; left: -10rpx;
} }
} }
.text { .text {
flex: 1; flex: 1;
color: $aider-light-color; color: $aider-light-color;
@ -452,27 +647,33 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: 14rpx; margin-left: 14rpx;
text:nth-of-type(2) { text:nth-of-type(2) {
color: #ccc; color: #ccc;
} }
.cur:nth-of-type(1) { .cur:nth-of-type(1) {
color: #ccc; color: #ccc;
} }
} }
} }
} }
.category-item { .category-item {
background: #fff; background: #fff;
padding: 22rpx; padding: 22rpx;
margin: 20rpx 10rpx; margin: 20rpx 10rpx;
> .flex { > .flex {
color: #666; color: #666;
justify-content: space-between; justify-content: space-between;
} }
> .child-list { > .child-list {
display: flex; display: flex;
margin: 20rpx 0; margin: 20rpx 0;
flex-wrap: wrap; flex-wrap: wrap;
> .child { > .child {
justify-content: center; justify-content: center;
margin: 1% 0; margin: 1% 0;
@ -489,6 +690,7 @@ export default {
} }
} }
} }
.kefu { .kefu {
background: #f7f7f7; background: #f7f7f7;
height: 70rpx; height: 70rpx;
@ -500,4 +702,4 @@ export default {
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }
</style> </style>