优化部分代码,修改店铺ui以及功能

master
lemon橪 2021-08-09 18:40:06 +08:00
parent e02fa75274
commit 209060fd76
14 changed files with 559 additions and 1143 deletions

View File

@ -118,17 +118,6 @@ export function getCategoryList(id) {
}); });
} }
/**
* 获取商品分类
* @param parent_id
*/
export function getCategory(parent_id = 0) {
return http.request({
url: `goods/categories/${parent_id}/children`,
method: Method.GET,
loading: false,
});
}

View File

@ -20,10 +20,21 @@ export function getstoreList(params) {
* 获取店铺基本信息 * 获取店铺基本信息
* @param storeId * @param storeId
*/ */
export function getstoreBaseInfo(storeId) { export function getStoreBaseInfo(storeId) {
return http.request({ return http.request({
url: `/store/get/detail/${storeId}`, url: `/store/get/detail/${storeId}`,
method: Method.GET, method: Method.GET,
loading: false, loading: false,
}); });
} }
/**
* 获取店铺分类
* @param id
*/
export function getStoreCategory(id) {
return http.request({
url: `/store/label/get/${id}`,
method: Method.GET,
});
}

View File

@ -2,8 +2,8 @@
"name" : "lili商城", "name" : "lili商城",
"appid" : "__UNI__C100675", "appid" : "__UNI__C100675",
"description" : "", "description" : "",
"versionName" : "4.0.25", "versionName" : "4.0.26",
"versionCode" : 4000025, "versionCode" : 4000026,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
"compatible" : { "compatible" : {
@ -178,7 +178,7 @@
"mp-weixin" : { "mp-weixin" : {
/* */ /* */
"usingComponents" : true, "usingComponents" : true,
"appid" : "", "appid" : "wx6f10f29075dc1b0b",
"optimization" : { "optimization" : {
"subPackages" : true "subPackages" : true
}, },

View File

@ -335,12 +335,18 @@
{ {
"root": "pages/product", "root": "pages/product",
"pages": [{ "pages": [{
"path": "shopPage", "path": "shopPage",
"style": { "style": {
"navigationBarTitleText": "详情展示", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },{
"path": "shopPageGoods",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{ {
"path": "goods", "path": "goods",
"style": { "style": {

View File

@ -151,6 +151,7 @@
parms.clientType = this.paymentType; parms.clientType = this.paymentType;
API_Trade.getCashierData(parms).then((res) => { API_Trade.getCashierData(parms).then((res) => {
if(res.data.success){ if(res.data.success){
this.cashierParams = res.data.result; this.cashierParams = res.data.result;
@ -160,9 +161,11 @@
}); });
// #endif // #endif
// #ifndef APP-PLUS
// //
var ua = window.navigator.userAgent.toLowerCase(); var ua = window.navigator.userAgent.toLowerCase();
// #endif

View File

@ -26,7 +26,7 @@ export default {
walletNum: 0, walletNum: 0,
}; };
}, },
async mounted() { async onShow() {
if (this.$options.filters.isLogin("auth")) { if (this.$options.filters.isLogin("auth")) {
let result = await getUserWallet(); // let result = await getUserWallet(); //
this.walletNum = result.data.result.memberWallet; this.walletNum = result.data.result.memberWallet;

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="wrapper"> <div class="wrapper">
<div v-html="res.content"></div> <u-parse v-html="res.content"></u-parse>
</div> </div>
</template> </template>

View File

@ -506,21 +506,16 @@ export default {
* 初始化信息 * 初始化信息
*/ */
async init(id, goodsId, distributionId) { async init(id, goodsId, distributionId) {
console.log(id, goodsId);
this.isGroup = false; // this.isGroup = false; //
this.productId = id; // skuId this.productId = id; // skuId
// //
uni.showLoading({
title: "加载中",
mask: true,
});
let response = await getGoods(id, goodsId); let response = await getGoods(id, goodsId);
if (!response.data.success) { if (!response.data.success) {
uni.navigateBack(); uni.navigateBack();
return false; return false;
} }
// //
if (distributionId || this.$store.state.distributionId) { if (distributionId || this.$store.state.distributionId) {
let disResult = await getGoodsDistribution(distributionId); let disResult = await getGoodsDistribution(distributionId);
@ -528,7 +523,6 @@ export default {
this.$store.state.distributionId = distributionId; this.$store.state.distributionId = distributionId;
} }
} }
uni.hideLoading();
/**商品信息以及规格信息存储 */ /**商品信息以及规格信息存储 */
this.goodsDetail = response.data.result.data; this.goodsDetail = response.data.result.data;
this.goodsSpec = response.data.result.specs; this.goodsSpec = response.data.result.specs;
@ -551,7 +545,7 @@ export default {
this.imgList = this.goodsDetail.goodsGalleryList; this.imgList = this.goodsDetail.goodsGalleryList;
// //
this.getstoreBaseInfoFun(this.goodsDetail.storeId); this.getStoreBaseInfoFun(this.goodsDetail.storeId);
// //
this.cartCount(); this.cartCount();
@ -675,8 +669,8 @@ export default {
/** /**
* 获取店铺信息 * 获取店铺信息
*/ */
getstoreBaseInfoFun(id) { getStoreBaseInfoFun(id) {
API_store.getstoreBaseInfo(id).then((res) => { API_store.getStoreBaseInfo(id).then((res) => {
if (res.data.success) { if (res.data.success) {
this.storeDetail = res.data.result; this.storeDetail = res.data.result;
} }

View File

@ -223,10 +223,6 @@ export default {
color: #333; color: #333;
padding: 20rpx 0; padding: 20rpx 0;
} }
.img {
}
.bot { .bot {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -106,22 +106,22 @@ export default {
} }
} }
.shopTag{
background: $main-color;
font-size: 24rpx;
padding: 0 12rpx;
margin-left: 10rpx;
font-weight: normal;
border-radius: 10rpx;
color: #fff;
}
.recommend-list-view { .recommend-list-view {
width: 100%; width: 100%;
} }
.shopTag {
background: $main-color;
font-size: 24rpx;
margin-left: 10rpx;
padding: 6rpx 12rpx;
border-radius: 10rpx;
font-weight: normal;
color: #fff;
}
.store-info { .store-info {
display: flex; display: flex;
align-items: center;
justify-content: space-between; justify-content: space-between;
background: #fff; background: #fff;
padding: 40rpx 20rpx 50rpx; padding: 40rpx 20rpx 50rpx;
@ -139,25 +139,22 @@ export default {
.name-star { .name-star {
flex: 1; flex: 1;
margin-left: 20rpx; margin-left: 20rpx;
padding: 10rpx 0;
font-size: 30rpx;
.name { .name {
display: flex; display: flex;
align-items: center;
width: 100%; width: 100%;
line-height: 1;
font-weight: 700; font-weight: 700;
font-size: 28rpx; font-size: 28rpx;
line-height: 24px;
margin-left: 10px;
} }
.desc { .desc {
font-size: 12px; font-size: 12px;
color: #999; color: #999;
margin-left: 10px; margin-left: 10px;
text{ text {
margin-right: 10px; margin-right: 10px;
} }
} }
} }
.to-store-btn { .to-store-btn {

View File

@ -1,63 +1,131 @@
<template> <template>
<view class="store-page"> <div>
<view class="status_bar"> <u-navbar :border-bottom="false">
<!-- 这里是状态栏 --> <u-search v-model="keyword" @search="search" @click="search" placeholder="请输入搜索"></u-search>
</view> </u-navbar>
<view class="header"> <div class="wrapper">
<div class="search"> <!-- 店铺信息模块 -->
<u-icon @click="back" style="margin:0 10rpx 0;" name="arrow-left" size="40" color="#fff"></u-icon> <div class="store flex">
<u-search :show-action="false" border-color="#fff" bg-color="#fff" v-model="keyword" @search="search" placeholder="请输入搜索" /> <u-image border-radius="10" width="150" height="150" :src="storeInfo.storeLogo || '/static/logo.png'" mode="aspectFit"></u-image>
<u-icon @click="shareChange()" style="margin:0 10rpx 0;" name="share-fill" size="40" color="#fff"></u-icon> <div class="box">
<div class="store-name">
{{ storeInfo.storeName || ''}}
</div>
<div class="flex store-message">
<div> <span>{{ storeInfo.goodsNum || 0 }}</span>关注 </div>
<div> <span>{{ storeInfo.collectionNum || 0 }}</span>件商品 </div>
</div>
</div>
<div class="collection">
<div class="collection-btn" @click="whetherCollection"> {{ isCollection ? '' : '+ ' }}</div>
</div>
</div> </div>
<view class="tab-header"> <!-- 店铺简介 -->
<text :class="{ cur: tabIndex == 0 }" @click="checkNavigation(0)"></text> <div class="store-desc wes-2">
<text :class="{ cur: tabIndex == 1 }" @click="checkNavigation(1)"></text> {{storeInfo.storeDesc}}
</div>
</div>
<!-- 优惠券 -->
<scroll-view scroll-x="true" show-scrollbar="false" class="discount" v-if="couponList.length > 0">
<view class="card-box" v-for="(item, index) in couponList" :key="index">
<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>
</view> </scroll-view>
<swiper :current="tabIndex" class="swiper-box" @change="tabChange">
<swiper-item class="swiper-item" v-for="(item, index) in indexCats" :key="index">
<scroll-view class="scroll-v" scroll-anchoring enableBackToTop="true" scroll-y @refresherrefresh="refresh()" @scroll="pageScroll">
<storePageMain :load="load" :storeId="storeId" v-if="index == 0"></storePageMain>
<storePageGoods :load="load" :categoryId="item" :storeId="storeId" v-if="index == 1"></storePageGoods>
</scroll-view>
</swiper-item>
</swiper>
<!-- 分享 --> <!-- tab -->
<shares type="shops" :link="'/pages/product/shopPage?id='+ this.storeId" v-if="shareFlage" @close="shareFlage = false" /> <u-tabs :list="tabs" :active-color="mainColor" :is-scroll="false" :current="current" @change="changeTab"></u-tabs>
<!-- menu -->
</view> <!-- 商品 -->
<div class="contant" v-if="current == 0">
<view v-if="!goodsList.length" class="empty"></view>
<view v-else class="item" v-for="(item,index) in goodsList" :key="index" @click="navigateToGoodsDetail(item)">
<u-image width="100%" height="324rpx" :src="item.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
<div class="name">{{ item.goodsName }}</div>
<div class="price">
<div>{{ item.price | unitPrice }}</div>
</div>
<view class="buyCount">
<div>已售 {{ item.buyCount || "0" }}</div>
</view>
</view>
</div>
<!-- 全部分类 -->
<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)" v-for="(child,i) in item.children">{{child.labelName}}</div>
</div>
</div>
</div>
<u-back-top :scroll-top="scrollTop"></u-back-top>
</div>
</template> </template>
<script> <script>
import shares from "@/components/m-share/index"; // import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js";
import storePageMain from "./shopPageMain.vue"; import {
import storePageGoods from "./shopPageGoods.vue"; receiveCoupons,
deleteStoreCollection,
collectionGoods,
getGoodsIsCollect,
} from "@/api/members.js";
import { getGoodsList } from "@/api/goods.js";
import { getAllCoupons } from "@/api/promotions.js";
export default { export default {
components: {
shares,
storePageMain,
storePageGoods,
},
data() { data() {
return { return {
shareFlage: false, //share scrollTop: 0,
tabIndex: 0, //tab mainColor: this.$mainColor, //
keyword: "", // current: 0, //tabs
load: false, tabs: [{ name: "全部商品" }, { name: "分类查看" }], //
storeId: undefined, //id storeId: "",
indexCats: [0, 1], //2tab keyword: "",
loadIndex: 1, // storeInfo: {}, //
isCollection: false, //
goodsList: [], //
couponList: [], //
categoryList: [],
couponParams: { pageNumber: 1, pageSize: 50, storeId: "" },
goodsParams: { pageNumber: 1, pageSize: 50, storeId: "" },
}; };
}, },
watch: {
current(val) {
val == 0 ? this.getGoodsData() : this.getCategoryData();
},
},
/** /**
* 加载 * 加载
*/ */
async onLoad(options) { async onLoad(options) {
this.storeId = options.id; this.storeId = options.id;
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
}, },
mounted() { mounted() {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
@ -65,11 +133,48 @@ export default {
uni.showShareMenu({ withShareTicket: true }); uni.showShareMenu({ withShareTicket: true });
// #endif // #endif
}, },
onShow() {
this.goodsList = []
this.categoryList = []
this.couponList = []
this.goodsParams.pageNumber = 1;
if (this.$options.filters.isLogin("auth")) {
this.enableGoodsIsCollect();
}
//
this.getStoreData();
//
this.getGoodsData();
//
this.getCouponsData();
},
//
onReachBottom() {
this.goodsParams.pageNumber++;
this.getGoodsData();
},
methods: { methods: {
// /** 获取店铺分类 */
async shareChange() { async getCategoryData() {
this.shareFlage = true; let res = await getStoreCategory(this.storeId);
if (res.data.success) {
this.categoryList = res.data.result;
}
},
/**是否收藏店铺 */
async enableGoodsIsCollect() {
let res = await getGoodsIsCollect("STORE", this.storeId);
if (res.data.success) {
this.isCollection = res.data.result;
}
},
/**商品分类中商品集合 */
getCategoryGoodsList(val){
uni.navigateTo({
url: `/pages/product/shopPageGoods?title=${val.labelName}&id=${val.id}&storeId=${this.storeId}`
});
}, },
/** /**
@ -81,184 +186,297 @@ export default {
}); });
}, },
/** 点击tab */
changeTab(index) {
this.current = index;
},
/** /**
* 下滑加载 * 店铺信息
*/ */
pageScroll(e) { async getStoreData() {
if (e.detail.scrollTop > 300 * this.loadIndex) { let res = await getStoreBaseInfo(this.storeId);
this.loadIndex++; res.data.success
this.load = this.loadIndex; ? (this.storeInfo = res.data.result)
: uni.reLaunch({ url: "/" });
},
/** 加载商品 */
async getGoodsData() {
let res = await getGoodsList(this.goodsParams);
if (res.data.success) {
this.goodsList.push(...res.data.result.content);
}
},
/** 加载优惠券 */
async getCouponsData() {
this.couponParams.storeId = this.storeId;
let res = await getAllCoupons(this.couponParams);
if (res.data.success) {
this.couponList.push(...res.data.result.records);
} }
}, },
/** /**
* 返回 * 跳转到商品详情
*/ */
back() { navigateToGoodsDetail(val) {
if (getCurrentPages().length == 1) { uni.navigateTo({
uni.switchTab({ url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
url: "/pages/tabbar/home/index", });
},
/**
* 是否收藏
*/
whetherCollection() {
if (this.isCollection) {
deleteStoreCollection(this.storeId).then((res) => {
if (res.data.success) {
this.isCollection = false;
uni.showToast({
icon: "none",
duration: 3000,
title: "取消关注成功!",
});
}
}); });
} else { } else {
uni.navigateBack(); collectionGoods("STORE", this.storeId).then((res) => {
if (res.data.success) {
this.isCollection = true;
uni.showToast({
icon: "none",
duration: 3000,
title: "关注成功!",
});
}
});
} }
}, },
/** /**
* 点击导航栏 * 领取
*/ */
checkNavigation(index) { getCoupon(item) {
this.tabIndex = index; if (!this.$options.filters.isLogin("auth")) {
}, uni.showToast({
icon: "none",
/** duration: 3000,
* 滑动回调 title: "请先登录!",
*/ });
tabChange(e) { uni.redirectTo({
this.tabIndex = e.detail.current; url: "/pages/passport/login",
this.checkNavigation(this.tabIndex); });
return false;
}
receiveCoupons(item.id).then((res) => {
if (res.data.success) {
uni.showToast({
icon: "none",
duration: 3000,
title: "领取成功!",
});
}
});
}, },
}, },
}; };
</script> </script>
<style>
page {
height: 100%;
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
// #ifdef MP-WEIXIN .wrapper {
@import "./mp-shopPage.scss"; background: #fff;
// #endif padding: 32rpx;
input[type="search"] {
-webkit-appearance: none;
// border: 0;
} }
.store {
input::-webkit-search-cancel-button { align-items: center;
display: none; > .box {
}
//
.storeScrollBox {
overflow-y: auto;
}
.store-page {
height: 100%;
// background: #fff;
overflow: auto;
.tab-header {
height: 80rpx;
display: flex; display: flex;
flex-direction: column;
justify-content: space-between; justify-content: center;
align-items: center; margin-left: 30rpx;
font-size: 28rpx; font-size: 24rpx;
z-index: 9999; color: #999;
flex: 2;
text { > .store-name {
width: 50%; font-size: 34rpx;
text-align: center; color: #333;
position: relative; letter-spacing: 1rpx;
color: #fff; font-weight: bold;
&.cur { }
font-size: 30rpx; > .store-message {
font-weight: bold; margin-top: 25rpx;
color: #fff; > div {
font-size: 26rpx;
&::after { margin: 0 5rpx;
content: ""; > span {
position: absolute; font-size: 26rpx;
width: 30rpx; font-weight: bold;
border: 1px solid #fff; color: #333;
bottom: -6rpx; margin-right: 8rpx;
left: 50%;
margin-left: -15rpx;
} }
} }
} }
} }
}
.header-line { .collection-btn {
height: 1px; background: $main-color;
background: #f2f2f2; padding: 6rpx 0;
position: fixed; width: 140rpx;
top: 170rpx; font-size: 24rpx;
left: 0; color: #fff;
right: 0; border-radius: 100px;
z-index: 999; text-align: center;
} }
.store-desc {
margin: 40rpx 0 0 0;
color: #999;
} }
.swiper-box { .contant {
width: 750rpx; margin-top: 20rpx;
display: flex;
height: calc( flex-wrap: wrap;
100% - var(--status-bar-height) - var(--window-top) - var(--window-bottom) - justify-content: space-between;
(160rpx) - 16rpx - 28rpx > .empty {
);
// #ifdef H5
height: calc(
100% - var(--status-bar-height) - var(--window-top) - var(--window-bottom) -
(160rpx)
);
// #endif
}
.swiper-item {
height: 100%;
}
.scroll-v {
width: 750rpx;
height: 100%;
overflow-y: auto;
}
.status_bar {
height: calc(var(--status-bar-height) + 160rpx);
width: 100%;
background-image: linear-gradient(
25deg,
$main-color,
$light-color,
$aider-light-color
);
}
.header {
width: 100%;
position: fixed;
top: var(--status-bar-height);
padding: 16rpx 0 0;
font-size: 30rpx;
z-index: 9999;
> .search {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; justify-content: center;
.back { margin-top: 40rpx;
width: 90rpx; }
height: 90rpx; .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;
line-height: 1.4em;
max-height: 2.8em; //heightline-height
overflow: hidden;
} }
.price {
.input-wrap { font-weight: 500;
background: $light-color; color: $main-color;
width: 600rpx; font-size: 30rpx;
height: 58rpx; padding: 0 20rpx;
padding: 10rpx 30rpx 10rpx 30rpx; margin-top: 20rpx;
box-sizing: border-box; white-space: nowrap;
background-color: #fff; }
border-radius: 50rpx; .buyCount {
display: flex;
padding: 0 20rpx;
font-size: 24upx;
justify-content: space-between;
color: #999;
}
}
}
.discount {
height: 154rpx;
border-top: 1px solid #f6f6f6;
border-bottom: 18rpx solid #f6f6f6;
background: #f6f6f6;
overflow: hidden;
white-space: nowrap;
.card-box {
display: inline-block;
padding-top: 25rpx;
}
.card {
width: 324rpx;
height: 116rpx;
background: #fff;
margin-left: 20rpx;
border-radius: 5px;
display: flex;
align-items: center;
.money {
width: 45%;
color: #fd6466;
font-weight: 500;
text-align: center;
text {
font-size: 50rpx;
}
}
.xian {
height: 66rpx;
border: 1px dashed #f6f6f6;
position: relative; position: relative;
border: 1px solid $light-color; &:before,
&:after {
input { content: "";
font-size: 26rpx; width: 22rpx;
height: 12rpx;
position: absolute;
background: #f6f6f6;
}
&:before {
border-radius: 0 0 22rpx 22rpx;
top: -30rpx;
left: -10rpx;
}
&:after {
border-radius: 22rpx 22rpx 0 0;
bottom: -30rpx;
left: -10rpx;
}
}
.text {
flex: 1;
color: $aider-light-color;
font-size: 24rpx;
display: flex;
flex-direction: column;
margin-left: 14rpx;
text:nth-of-type(2) {
color: #ccc;
}
.cur:nth-of-type(1) {
color: #ccc;
} }
} }
} }
} }
</style> .category-item {
background: #fff;
padding: 22rpx;
margin: 20rpx 10rpx;
> .flex {
color: #666;
justify-content: space-between;
}
> .child-list {
display: flex;
margin: 20rpx 0;
flex-wrap: wrap;
> .child {
justify-content: center;
margin: 1% 0;
display: flex;
width: 48%;
font-size: 24rpx;
color: #999;
margin-right: 1%;
border: 1rpx solid #ededed;
box-sizing: border-box;
height: 70rpx;
text-align: center;
line-height: 70rpx;
}
}
}
</style>

View File

@ -1,340 +1,124 @@
<template> <template>
<view class="index-content"> <div>
<!-- 搜索板块 --> <u-navbar :title="title"></u-navbar>
<view class="index-navs"> <!-- 商品 -->
<view class="index-nav" :class="{ 'index-nav-active': nav == 1 }" @click="tabClick(1)"></view> <div class="contant">
<view class="index-nav-divider"></view> <view v-if="!goodsList.length" class="empty"></view>
<view v-else class="item" v-for="(item,index) in goodsList" :key="index" @click="navigateToGoodsDetail(item)">
<u-image width="100%" height="324rpx" :src="item.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
<div class="name">{{ item.goodsName }}</div>
<div class="price">
<div>{{ item.price | unitPrice }}</div>
</div>
<view class="buyCount">
<div>已售 {{ item.buyCount || "0" }}</div>
</view>
</view>
</div>
</div>
<view class="index-nav" :class="{ 'index-nav-active': nav == 2}" @click="tabClick(2,'buyCount')">
销量
<view class="index-nav-arrows">
<view class="index-nav-arrow">
<image src="/static/index/arrow-up-1.png" v-if="params.sort === 'buyCount' && params.order === 'asc'" mode="aspectFit"></image>
<image src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
</view>
<view class="index-nav-arrow">
<image src="/static/index/arrow-down.png" v-if="params.sort === 'buyCount' && params.order === 'desc'" mode="aspectFit"></image>
<image src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
</view>
</view>
</view>
<view class="index-nav-divider"></view>
<view class="index-nav" :class="{ 'index-nav-active': nav == 3}" @click="tabClick(3,'price')">
价格
<view class="index-nav-arrows">
<view class="index-nav-arrow">
<image src="/static/index/arrow-up-1.png" v-if="params.sort === 'price' && params.order === 'asc'" mode="aspectFit"></image>
<image src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
</view>
<view class="index-nav-arrow">
<image src="/static/index/arrow-down.png" v-if="params.sort === 'price' && params.order === 'desc'" mode="aspectFit"></image>
<image src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
</view>
</view>
</view>
</view>
<scroll-view scroll-with-animation scroll-y class="scoll-page" @scroll="pageScroll">
<view class="index-items">
<view class="index-item" v-for="(goods, index) in goodsList" :key="index" @click="toGoodsDetail(goods)">
<view class="index-item-img">
<u-image mode="aspectFit" height="160px" width="173px" class="index-item-store-img" :src="goods.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
<view class="index-item-title">
<div> {{ goods.goodsName }}</div>
<view class="index-item-title-desc" v-if="goods.sellingPoint ">{{ goods.sellingPoint }}</view>
</view>
<view class="index-item-price">
<div class="price">{{ goods.price | unitPrice }}</div>
<view class="index-item-sale">
已售 {{ goods.buyCount || "0" }}
<!-- 好评90% -->
</view>
</view>
</view>
</view>
</view>
<u-loadmore bg-color="#f6f6f6" @loadmore="loadMore" :status="loadStatus" />
</scroll-view>
</view>
</template> </template>
<script> <script>
import { getGoodsList } from "@/api/goods.js"; import { getGoodsList } from "@/api/goods.js";
export default { export default {
props: {
storeId: {
value: Number,
},
categoryId: {
value: Number,
default: 0,
},
load: {
value: Number,
},
},
data() { data() {
return { return {
loadStatus: "loadmore", // title: "",
nav: 1, routerVal: "",
// goodsList: [],
goodsListTemplate: 2,
//
curCateFid: "",
params: { params: {
pageNumber: 1, pageNumber: 1,
pageSize: 10, pageSize: 10,
storeId: this.storeId,
},
goodsList: [],
cateList: [
{ name: "综合", value: "100001" },
{ name: "推荐", value: "100002" },
{ name: "信用", value: "100003" },
],
typeSort1: true, order: "desc",
typeSort2: false, keyword: "",
storeCatId: "",
storeId: "",
},
}; };
}, },
watch: { onLoad(options) {
load(val) { this.routerVal = options;
this.params.pageNumber = val; this.params.storeId = options.storeId;
this.loadMore(); this.params.storeCatId = options.id;
}, this.title = options.title;
}, },
onReachBottom() { onShow() {
this.goodsList =[]
this.loadMore(); this.params.pageNumber = 1;
}, this.getGoodsData();
mounted() {
this.initGoodsInfo();
}, },
methods: { methods: {
pageScroll(e) {}, /**
loadMore() { * 跳转到商品详情
this.initGoodsInfo(); */
}, navigateToGoodsDetail(val) {
tabClick(index, type) {
this.goodsList = [];
this.params.pageNumber = 0;
this.params.pageSize = 10;
this.nav = index;
if (this.params.sort == type) {
this.params.order == "asc"
? (this.params.order = "desc")
: (this.params.order = "asc");
this.$set(this.params, "sort", type);
} else {
this.params.order = "desc";
this.$set(this.params, "sort", type);
}
this.initGoodsInfo();
},
toGoodsDetail(val) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`, url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
}); });
}, },
initGoodsInfo() {
this.params.storeId = this.storeId; async getGoodsData() {
getGoodsList(this.params).then((res) => { let goodsList = await getGoodsList(this.params);
if ( if (goodsList.data.success) {
res.data.result.totalElements <= this.goodsList.push(...goodsList.data.result.content);
res.data.result.number * res.data.result.size }
) {
this.loadStatus = "noMore";
} else {
this.loadStatus = "loadmore";
}
this.goodsList.push(...res.data.result.content);
});
},
//
goodsTemplateChanged(templateValue) {
this.goodsListTemplate = templateValue;
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.scoll-page { .contant {
height: 100%; margin-top: 20rpx;
}
.store-items {
padding-top: 20rpx;
display: -webkit-box;
display: -webkit-flex;
display: flex; display: flex;
align-items: center; flex-wrap: wrap;
flex-direction: column;
}
.store-item {
width: 710rpx;
height: 226rpx;
padding-left: 20rpx;
margin-bottom: 10rpx;
border-radius: 12rpx;
background-color: #fff;
position: relative;
display: -webkit-box;
display: -webkit-flex;
display: flex;
align-items: center;
}
.store-item-img {
margin-right: 20rpx;
image {
width: 186rpx;
height: 186rpx;
border-radius: 8rpx;
}
}
.store-item-title {
font-size: 28rpx;
color: #333;
}
.store-item-title-desc {
font-size: 22rpx;
color: #999;
}
.store-item-price {
font-size: 110rpx;
color: #ff5a10;
padding-top: 10rpx;
}
.store-item-sale {
font-size: 25rpx;
color: #999;
padding-top: 10rpx;
}
.index-navs {
height: 120rpx;
margin-top: -10rpx;
padding: 0 52rpx;
background-color: #f7f7f7;
display: -webkit-box;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: space-between; justify-content: space-between;
} > .empty {
.index-item-store-img { width: 100%;
width: 346rpx !important; display: flex;
height: 320rpx !important; justify-content: center;
} margin-top: 40rpx;
.index-nav { }
font-size: 30rpx; .item {
display: -webkit-box; overflow: hidden;
display: -webkit-flex;
display: flex; background: #fff;
justify-content: center; width: 49%;
align-items: center; height: 484rpx;
&-active { font-size: 26rpx;
color: $aider-light-color; display: flex;
font-weight: 700; flex-direction: column;
&::after { border: 1px solid #f8f8f8;
content: ""; margin-bottom: 20rpx;
position: absolute;
width: 30rpx; .name {
border: 1px solid $aider-light-color; text-align: left !important;
bottom: -6rpx; color: #333;
left: 96rpx; padding: 0 20rpx;
margin-top: 20rpx;
line-height: 1.4em;
max-height: 2.8em; //heightline-height
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;
} }
} }
} }
</style>
.index-nav-desc {
margin-top: 8rpx;
font-size: 22rpx;
color: #999;
}
.index-nav-divider {
height: 64rpx;
border-left: 1px solid #dddddd;
}
.index-nav-arrows {
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.index-nav-arrow {
image {
width: 26rpx;
height: 26rpx;
}
}
.index-nav-arrow:last-child {
margin-top: -26rpx;
}
.index-items {
padding-left: 20rpx;
background-color: #f7f7f7;
display: -webkit-box;
display: -webkit-flex;
display: flex;
align-items: center;
flex-wrap: wrap;
}
.index-item {
width: 346rpx;
padding-bottom: 10rpx;
background-color: #fff;
margin: 0 18rpx 20rpx 0;
border-radius: 16rpx;
box-sizing: border-box;
overflow: hidden;
}
.index-item-img {
image {
width: 346rpx;
height: 320rpx;
}
}
.index-item-title {
font-size: 26rpx;
color: #333333;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
padding: 0 0 0 20rpx;
box-sizing: border-box;
}
.index-item-title-desc {
font-size: 25rpx;
color: #999999;
margin-top: 10rpx;
}
.index-item-price {
padding: 0 20rpx;
> .price {
font-weight: 500;
color: $main-color;
font-size: 30rpx;
margin-top: 20rpx;
white-space: nowrap;
}
> .index-item-sale {
font-size: 24upx;
color: #999;
}
}
</style>

View File

@ -1,581 +0,0 @@
<template>
<view class="store-page">
<view>
<!-- 商店信息 -->
<view class="store-info">
<view class="logo">
<image :src="storeInfo.storeLogo || '/static/logo.png'" mode="aspectFit"></image>
</view>
<view class="store-name">
<view class="name">{{ storeInfo.storeName }}</view>
<view>{{ storeInfo.goodsNum || 0 }}关注 {{ storeInfo.collectionNum || 0 }}件商品</view>
</view>
<view class="follow" @click="whetherCollection">
<view>{{ isCollection ? '已关注' : '+ 关注' }}</view>
</view>
</view>
<view class="store-intro">
<view class="title">店铺简介</view>
<view class="text">
<view v-html="storeInfo.storeDesc"></view>
</view>
</view>
<!-- 优惠券 -->
<scroll-view scroll-x="true" show-scrollbar="false" class="discount" v-if="couponList.length > 0">
<view class="card-box" v-for="(item, index) in couponList" :key="index">
<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>
</scroll-view>
<!-- 精选商品 -->
<view class="handpick">
<view class="title">精选商品</view>
<view class="contant">
<view v-if="!recommandGoods.length" class="no-goods"></view>
<view v-else class="item" v-for="(item,index) in recommandGoods" :key="index" @click="navigateToGoodsDetail(item)">
<u-image width="324rpx" height="324rpx" mode="aspectFit" :src="item.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
<div class="name">{{ item.goodsName }}</div>
<div class="price">
<div>{{ item.price | unitPrice }}</div>
</div>
<view class="buyCount">
<div>已售 {{ item.buyCount || "0" }}</div>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { getstoreBaseInfo } from "@/api/store.js";
import {
receiveCoupons,
deleteStoreCollection,
collectionGoods,
getGoodsIsCollect,
} from "@/api/members.js";
import { getGoodsList } from "@/api/goods.js";
import { getAllCoupons } from "@/api/promotions.js";
export default {
props: {
storeId: {
value: Number,
},
load: {
value: Boolean,
},
},
data() {
return {
//
storeInfo: "", //
isCollection: false, //
recommandGoods: [], //
couponList: [], //
params: {
pageNumber: 1,
pageSize: 50,
storeId: "",
},
};
},
watch: {},
mounted(options) {
if (this.$options.filters.isLogin("auth")) {
getGoodsIsCollect("STORE", this.storeId).then((res) => {
this.isCollection = res.data.result;
});
}
this.initStoreInfo();
},
methods: {
/**
* 店铺信息
*/
initStoreInfo() {
uni.showLoading({
title: "加载中",
});
this.params.storeId = this.storeId;
getstoreBaseInfo(this.storeId).then((res) => {
if (res.data.success) {
this.storeInfo = res.data.result;
uni.hideLoading();
Promise.all([
getAllCoupons(this.params),
getGoodsList({ storeId: this.storeId }),
,
]).then((res) => {
this.couponList = res[0].data.result.records;
this.recommandGoods = res[1].data.result.content;
});
} else {
uni.reLaunch({
url: "/",
});
}
});
},
/**
* 跳转到商品详情
*/
navigateToGoodsDetail(val) {
uni.navigateTo({
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
});
},
/**
* 是否收藏
*/
whetherCollection() {
if (this.isCollection) {
deleteStoreCollection(this.storeId).then((res) => {
if (res.data.success) {
this.isCollection = false;
uni.showToast({
icon: "none",
duration: 3000,
title: "取消关注成功!",
});
}
});
} else {
collectionGoods("STORE", this.storeId).then((res) => {
if (res.data.success) {
this.isCollection = true;
uni.showToast({
icon: "none",
duration: 3000,
title: "关注成功!",
});
}
});
}
},
/**
* 获取优惠券
*/
getCoupon(item) {
if (!this.$options.filters.isLogin("auth")) {
uni.showToast({
icon: "none",
duration: 3000,
title: "请先登录!",
});
uni.redirectTo({
url: "/pages/passport/login",
});
return false;
}
receiveCoupons(item.id).then((res) => {
if (res.data.success) {
uni.showToast({
icon: "none",
duration: 3000,
title: "领取成功!",
});
}
});
},
},
};
</script>
<style lang="scss" scoped>
.store-page {
height: 100%;
background: #fff;
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
background: #fff;
display: flex;
justify-content: space-between;
align-items: center;
height: 90rpx;
line-height: 90rpx;
font-size: 30rpx;
z-index: 9999;
}
.tab-header {
position: fixed;
top: 90rpx;
left: 0;
right: 0;
height: 100rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 30rpx;
z-index: 9999;
background: #fff;
text {
width: 30%;
text-align: center;
&.cur {
color: #29bb9c;
font-size: 34rpx;
font-weight: 500;
}
}
}
.header-line {
height: 1px;
background: #f2f2f2;
position: fixed;
top: 190rpx;
left: 0;
right: 0;
z-index: 999;
}
.store-info {
display: flex;
justify-content: space-between;
padding: 40rpx 40rpx 30rpx;
.logo {
width: 128rpx;
height: 128rpx;
overflow: hidden;
border-radius: 6px;
image {
width: 128rpx;
height: 128rpx;
}
}
.store-name {
text-align: center;
font-size: 26rpx;
color: #999;
margin-left: -50rpx;
.name {
margin: 20rpx 0 16rpx;
font-size: 30rpx;
color: #333;
text-align: left;
}
}
.follow {
padding: 40rpx 0;
> view {
font-size: 26rpx;
color: #fff;
padding: 0 30rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
background: $aider-light-color;
border-radius: 28rpx;
text {
font-size: 40rpx;
}
}
}
}
.store-intro {
padding: 0 40rpx 18rpx;
.title,
.text {
font-size: 26rpx;
color: #999999;
line-height: 48rpx;
}
.title {
padding-left: 20rpx;
position: relative;
&:before {
content: "";
width: 1px;
height: 45rpx;
background: #999;
position: absolute;
left: 0;
top: 0;
}
}
.text {
position: relative;
&.close {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-right: 46rpx;
}
&.open {
padding-right: 0;
white-space: wrap;
overflow: auto;
text-overflow: clip;
}
.zhankai {
width: 20rpx;
height: 20rpx;
position: absolute;
right: 10rpx;
bottom: 0;
border-top: 3px solid #999;
border-right: 3px solid #999;
&.close {
transform: rotateZ(135deg);
bottom: 15rpx;
}
&.open {
transform: rotateZ(-45deg);
}
}
}
}
.discount {
height: 189rpx;
border-top: 1px solid #f6f6f6;
border-bottom: 18rpx solid #f6f6f6;
background: #f6f6f6;
overflow: hidden;
white-space: nowrap;
.card-box {
display: inline-block;
padding-top: 25rpx;
}
.card {
width: 324rpx;
height: 116rpx;
background: #fff;
margin-left: 20rpx;
border-radius: 5px;
display: flex;
align-items: center;
.money {
width: 45%;
color: #fd6466;
font-weight: 500;
text-align: center;
text {
font-size: 50rpx;
}
}
.xian {
height: 66rpx;
border: 1px dashed #f6f6f6;
position: relative;
&:before,
&:after {
content: "";
width: 22rpx;
height: 12rpx;
position: absolute;
background: #f6f6f6;
}
&:before {
border-radius: 0 0 22rpx 22rpx;
top: -30rpx;
left: -10rpx;
}
&:after {
border-radius: 22rpx 22rpx 0 0;
bottom: -30rpx;
left: -10rpx;
}
}
.text {
flex: 1;
color: $aider-light-color;
font-size: 24rpx;
display: flex;
flex-direction: column;
margin-left: 14rpx;
text:nth-of-type(2) {
color: #ccc;
}
.cur:nth-of-type(1) {
color: #ccc;
}
}
}
}
.hot,
.handpick {
.title {
height: 132rpx;
padding: 0 20rpx;
line-height: 132rpx;
font-size: 32rpx;
text-align: center;
position: relative;
&:before,
&:after {
content: "";
width: 44rpx;
height: 6rpx;
position: absolute;
background: #f0f1fc;
}
&:before {
top: 63rpx;
left: 236rpx;
}
&:after {
border-radius: 22rpx 22rpx 0 0;
top: 63rpx;
right: 236rpx;
}
}
.no-goods {
width: 100%;
height: 364rpx;
text-align: center;
line-height: 364rpx;
color: #999999;
}
}
.hot {
.contant {
height: 364rpx;
display: flex;
padding: 0 20rpx;
overflow: hidden;
white-space: nowrap;
.item-box {
display: inline-block;
}
.item {
width: 216rpx;
margin-left: 15rpx;
font-size: 24rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
image {
width: 212rpx;
height: 212rpx;
}
.name {
color: #333;
overflow: hidden;
text-overflow: ellipsis;
height: 66rpx;
}
.price {
font-weight: 500;
margin-bottom: 20rpx;
color: #fd6466;
text {
font-size: 26rpx;
}
}
}
}
border-bottom: 18rpx solid #f9f9f9;
}
.item-img-recommand {
width: 324rpx !important;
height: 324rpx !important;
}
.item-img {
width: 212rpx !important;
height: 212rpx !important;
}
.handpick {
background: #fff;
.contant {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 40rpx;
.item {
width: 324rpx;
height: 484rpx;
font-size: 26rpx;
display: flex;
flex-direction: column;
border: 1px solid #f8f8f8;
margin-bottom: 20rpx;
image {
width: 324rpx;
height: 260rpx;
}
.name {
text-align: left !important;
color: #333;
padding: 0 20rpx;
margin-top: 20rpx;
line-height: 1.4em;
max-height: 2.8em; //heightline-height
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;
}
}
}
}
.bottom {
background: #fff;
height: 90rpx;
text-align: center;
text {
color: #ccc;
font-size: 24rpx;
position: relative;
&:before {
content: "";
display: block;
width: 180rpx;
height: 1px;
background: #f0f1fc;
position: absolute;
top: 20rpx;
left: -270rpx;
}
&:after {
content: "";
display: block;
width: 180rpx;
height: 1px;
background: #f0f1fc;
position: absolute;
top: 20rpx;
right: -200rpx;
}
}
}
}
</style>

View File

@ -37,7 +37,6 @@ export const getServerNo = function (callback) {
result.versionInfo = response.content || "暂无"; result.versionInfo = response.content || "暂无";
result.forceUpdate = response.forceUpdate; result.forceUpdate = response.forceUpdate;
result.downloadUrl = response.downloadUrl; result.downloadUrl = response.downloadUrl;
callback && callback(result); callback && callback(result);
} }
}); });
@ -855,7 +854,7 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
export default function (isPrompt = false) { export default function (isPrompt = false) {
getCurrentNo((version) => { getCurrentNo((version) => {
getServerNo((res) => { getServerNo((res) => {
if (res.versionCode.replace(/\./g, "") < version.versionCode) { if (res.versionCode.replace(/\./g, "") <= version.versionCode) {
return false; return false;
} }