优化部分代码,修改店铺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
*/
export function getstoreBaseInfo(storeId) {
export function getStoreBaseInfo(storeId) {
return http.request({
url: `/store/get/detail/${storeId}`,
method: Method.GET,
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商城",
"appid" : "__UNI__C100675",
"description" : "",
"versionName" : "4.0.25",
"versionCode" : 4000025,
"versionName" : "4.0.26",
"versionCode" : 4000026,
"transformPx" : false,
"app-plus" : {
"compatible" : {
@ -178,7 +178,7 @@
"mp-weixin" : {
/* */
"usingComponents" : true,
"appid" : "",
"appid" : "wx6f10f29075dc1b0b",
"optimization" : {
"subPackages" : true
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -223,10 +223,6 @@ export default {
color: #333;
padding: 20rpx 0;
}
.img {
}
.bot {
display: flex;
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 {
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 {
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
padding: 40rpx 20rpx 50rpx;
@ -139,25 +139,22 @@ export default {
.name-star {
flex: 1;
margin-left: 20rpx;
padding: 10rpx 0;
font-size: 30rpx;
.name {
display: flex;
align-items: center;
width: 100%;
line-height: 1;
font-weight: 700;
font-size: 28rpx;
line-height: 24px;
margin-left: 10px;
}
.desc {
font-size: 12px;
color: #999;
margin-left: 10px;
text{
margin-right: 10px;
}
}
.desc {
font-size: 12px;
color: #999;
margin-left: 10px;
text {
margin-right: 10px;
}
}
}
.to-store-btn {

View File

@ -1,63 +1,131 @@
<template>
<view class="store-page">
<view class="status_bar">
<!-- 这里是状态栏 -->
</view>
<view class="header">
<div class="search">
<u-icon @click="back" style="margin:0 10rpx 0;" name="arrow-left" size="40" color="#fff"></u-icon>
<u-search :show-action="false" border-color="#fff" bg-color="#fff" v-model="keyword" @search="search" placeholder="请输入搜索" />
<u-icon @click="shareChange()" style="margin:0 10rpx 0;" name="share-fill" size="40" color="#fff"></u-icon>
<div>
<u-navbar :border-bottom="false">
<u-search v-model="keyword" @search="search" @click="search" placeholder="请输入搜索"></u-search>
</u-navbar>
<div class="wrapper">
<!-- 店铺信息模块 -->
<div class="store flex">
<u-image border-radius="10" width="150" height="150" :src="storeInfo.storeLogo || '/static/logo.png'" mode="aspectFit"></u-image>
<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>
<view class="tab-header">
<text :class="{ cur: tabIndex == 0 }" @click="checkNavigation(0)"></text>
<text :class="{ cur: tabIndex == 1 }" @click="checkNavigation(1)"></text>
<!-- 店铺简介 -->
<div class="store-desc wes-2">
{{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>
<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>
</scroll-view>
<!-- 分享 -->
<shares type="shops" :link="'/pages/product/shopPage?id='+ this.storeId" v-if="shareFlage" @close="shareFlage = false" />
<!-- tab -->
<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>
<script>
import shares from "@/components/m-share/index"; //
import storePageMain from "./shopPageMain.vue";
import storePageGoods from "./shopPageGoods.vue";
import { getStoreBaseInfo, getStoreCategory } 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 {
components: {
shares,
storePageMain,
storePageGoods,
},
data() {
return {
shareFlage: false, //share
tabIndex: 0, //tab
keyword: "", //
load: false,
storeId: undefined, //id
indexCats: [0, 1], //2tab
loadIndex: 1, //
scrollTop: 0,
mainColor: this.$mainColor, //
current: 0, //tabs
tabs: [{ name: "全部商品" }, { name: "分类查看" }], //
storeId: "",
keyword: "",
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) {
this.storeId = options.id;
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
mounted() {
// #ifdef MP-WEIXIN
@ -65,11 +133,48 @@ export default {
uni.showShareMenu({ withShareTicket: true });
// #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: {
//
async shareChange() {
this.shareFlage = true;
/** 获取店铺分类 */
async getCategoryData() {
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) {
if (e.detail.scrollTop > 300 * this.loadIndex) {
this.loadIndex++;
this.load = this.loadIndex;
async getStoreData() {
let res = await getStoreBaseInfo(this.storeId);
res.data.success
? (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() {
if (getCurrentPages().length == 1) {
uni.switchTab({
url: "/pages/tabbar/home/index",
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 {
uni.navigateBack();
collectionGoods("STORE", this.storeId).then((res) => {
if (res.data.success) {
this.isCollection = true;
uni.showToast({
icon: "none",
duration: 3000,
title: "关注成功!",
});
}
});
}
},
/**
* 点击导航栏
* 领取
*/
checkNavigation(index) {
this.tabIndex = index;
},
/**
* 滑动回调
*/
tabChange(e) {
this.tabIndex = e.detail.current;
this.checkNavigation(this.tabIndex);
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>
page {
height: 100%;
}
</style>
<style lang="scss" scoped>
// #ifdef MP-WEIXIN
@import "./mp-shopPage.scss";
// #endif
input[type="search"] {
-webkit-appearance: none;
// border: 0;
.wrapper {
background: #fff;
padding: 32rpx;
}
input::-webkit-search-cancel-button {
display: none;
}
//
.storeScrollBox {
overflow-y: auto;
}
.store-page {
height: 100%;
// background: #fff;
overflow: auto;
.tab-header {
height: 80rpx;
.store {
align-items: center;
> .box {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rpx;
z-index: 9999;
text {
width: 50%;
text-align: center;
position: relative;
color: #fff;
&.cur {
font-size: 30rpx;
font-weight: bold;
color: #fff;
&::after {
content: "";
position: absolute;
width: 30rpx;
border: 1px solid #fff;
bottom: -6rpx;
left: 50%;
margin-left: -15rpx;
flex-direction: column;
justify-content: center;
margin-left: 30rpx;
font-size: 24rpx;
color: #999;
flex: 2;
> .store-name {
font-size: 34rpx;
color: #333;
letter-spacing: 1rpx;
font-weight: bold;
}
> .store-message {
margin-top: 25rpx;
> div {
font-size: 26rpx;
margin: 0 5rpx;
> span {
font-size: 26rpx;
font-weight: bold;
color: #333;
margin-right: 8rpx;
}
}
}
}
.header-line {
height: 1px;
background: #f2f2f2;
position: fixed;
top: 170rpx;
left: 0;
right: 0;
z-index: 999;
}
}
.collection-btn {
background: $main-color;
padding: 6rpx 0;
width: 140rpx;
font-size: 24rpx;
color: #fff;
border-radius: 100px;
text-align: center;
}
.store-desc {
margin: 40rpx 0 0 0;
color: #999;
}
.swiper-box {
width: 750rpx;
height: calc(
100% - var(--status-bar-height) - var(--window-top) - var(--window-bottom) -
(160rpx) - 16rpx - 28rpx
);
// #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 {
.contant {
margin-top: 20rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
> .empty {
width: 100%;
display: flex;
align-items: center;
.back {
width: 90rpx;
height: 90rpx;
justify-content: center;
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;
line-height: 1.4em;
max-height: 2.8em; //heightline-height
overflow: hidden;
}
.input-wrap {
background: $light-color;
width: 600rpx;
height: 58rpx;
padding: 10rpx 30rpx 10rpx 30rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 50rpx;
.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 {
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;
border: 1px solid $light-color;
input {
font-size: 26rpx;
&: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;
}
}
}
}
.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>
<view class="index-content">
<!-- 搜索板块 -->
<view class="index-navs">
<view class="index-nav" :class="{ 'index-nav-active': nav == 1 }" @click="tabClick(1)"></view>
<view class="index-nav-divider"></view>
<div>
<u-navbar :title="title"></u-navbar>
<!-- 商品 -->
<div class="contant">
<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>
<script>
import { getGoodsList } from "@/api/goods.js";
export default {
props: {
storeId: {
value: Number,
},
categoryId: {
value: Number,
default: 0,
},
load: {
value: Number,
},
},
data() {
return {
loadStatus: "loadmore", //
nav: 1,
//
goodsListTemplate: 2,
//
curCateFid: "",
title: "",
routerVal: "",
goodsList: [],
params: {
pageNumber: 1,
pageSize: 10,
storeId: this.storeId,
},
goodsList: [],
cateList: [
{ name: "综合", value: "100001" },
{ name: "推荐", value: "100002" },
{ name: "信用", value: "100003" },
],
typeSort1: true,
typeSort2: false,
order: "desc",
keyword: "",
storeCatId: "",
storeId: "",
},
};
},
watch: {
load(val) {
this.params.pageNumber = val;
this.loadMore();
},
onLoad(options) {
this.routerVal = options;
this.params.storeId = options.storeId;
this.params.storeCatId = options.id;
this.title = options.title;
},
onReachBottom() {
this.loadMore();
},
mounted() {
this.initGoodsInfo();
onShow() {
this.goodsList =[]
this.params.pageNumber = 1;
this.getGoodsData();
},
methods: {
pageScroll(e) {},
loadMore() {
this.initGoodsInfo();
},
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) {
/**
* 跳转到商品详情
*/
navigateToGoodsDetail(val) {
uni.navigateTo({
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
});
},
initGoodsInfo() {
this.params.storeId = this.storeId;
getGoodsList(this.params).then((res) => {
if (
res.data.result.totalElements <=
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;
async getGoodsData() {
let goodsList = await getGoodsList(this.params);
if (goodsList.data.success) {
this.goodsList.push(...goodsList.data.result.content);
}
},
},
};
</script>
<style lang="scss" scoped>
.scoll-page {
height: 100%;
}
.store-items {
padding-top: 20rpx;
display: -webkit-box;
display: -webkit-flex;
.contant {
margin-top: 20rpx;
display: flex;
align-items: center;
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;
flex-wrap: wrap;
justify-content: space-between;
}
.index-item-store-img {
width: 346rpx !important;
height: 320rpx !important;
}
.index-nav {
font-size: 30rpx;
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: center;
align-items: center;
&-active {
color: $aider-light-color;
font-weight: 700;
&::after {
content: "";
position: absolute;
width: 30rpx;
border: 1px solid $aider-light-color;
bottom: -6rpx;
left: 96rpx;
> .empty {
width: 100%;
display: flex;
justify-content: center;
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;
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;
}
}
}
.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.forceUpdate = response.forceUpdate;
result.downloadUrl = response.downloadUrl;
callback && callback(result);
}
});
@ -855,7 +854,7 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
export default function (isPrompt = false) {
getCurrentNo((version) => {
getServerNo((res) => {
if (res.versionCode.replace(/\./g, "") < version.versionCode) {
if (res.versionCode.replace(/\./g, "") <= version.versionCode) {
return false;
}