mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-22 02:15:55 +08:00
优化注释
This commit is contained in:
@@ -89,12 +89,12 @@ export default {
|
||||
uni.hideLoading();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
radioGroupChange(e) {
|
||||
console.log(e);
|
||||
|
||||
},
|
||||
radioChange(e) {
|
||||
if (this.anonymous == "YES") {
|
||||
@@ -102,8 +102,6 @@ export default {
|
||||
} else {
|
||||
this.anonymous = "YES";
|
||||
}
|
||||
|
||||
console.log(e);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -75,12 +75,12 @@
|
||||
<view class="-goods-flex">
|
||||
<!-- 如果有积分显示积分 -->
|
||||
<view class="-goods-price" v-if="goodsDetail.price != undefined">
|
||||
<span v-if="pointDetail.points" > <span class="price">{{pointDetail.points}}</span>
|
||||
<span v-if="pointDetail.points"> <span class="price">{{pointDetail.points}}</span>
|
||||
<span>积分</span>
|
||||
</span>
|
||||
|
||||
<span v-else> <span>¥</span><span class="price">{{ Fixed(goodsDetail.price)[0] }}</span>.{{
|
||||
Fixed(goodsDetail.price)[1]
|
||||
<span v-else> <span>¥</span><span class="price">{{ formatPrice(goodsDetail.price)[0] }}</span>.{{
|
||||
formatPrice(goodsDetail.price)[1]
|
||||
}} </span>
|
||||
</view>
|
||||
<view class="-goods-price" v-else> ¥<span class="price">0 </span>.00 </view>
|
||||
@@ -158,7 +158,7 @@
|
||||
|
||||
<view class="page-bottom mp-iphonex-bottom" id="pageBottom">
|
||||
<view class="icon-btn">
|
||||
<view class="icon-btn-item" @click="linkstorePage(goodsDetail.storeId)">
|
||||
<view class="icon-btn-item" @click="navigateToStore(goodsDetail.storeId)">
|
||||
<u-icon size="34" class="red" name="home-fill"></u-icon>
|
||||
<view class="red icon-btn-name">店铺</view>
|
||||
</view>
|
||||
@@ -214,8 +214,8 @@
|
||||
<popupAddress @closeAddress="closePopupAddress" @deliveryData="deliveryFun" v-if="goodsDetail.id" :goodsId="goodsDetail.id" :addressFlag="addressFlag" />
|
||||
|
||||
<!-- 商品规格 商品详情,以及默认参与活动的id-->
|
||||
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy" @queryCart="cartNum()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :id="productId"
|
||||
v-if="goodsDetail.id " :pointDetail="pointDetail" @handleClickSku="init" :buyMask="buyMask" />
|
||||
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy" @queryCart="cartCount()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :id="productId"
|
||||
v-if="goodsDetail.id " :pointDetail="pointDetail" @handleClickSku="init" :buyMask="buyMask" />
|
||||
</view>
|
||||
</view>
|
||||
</div>
|
||||
@@ -245,7 +245,6 @@ import GoodsSwiper from "./product/goods/-goods-swiper"; //轮播图组件
|
||||
import popupGoods from "./product/popup/goods"; //购物车商品的模块
|
||||
import popupAddress from "./product/popup/address"; //地址选择模块
|
||||
import shares from "@/components/m-share/index"; //分享
|
||||
|
||||
export default {
|
||||
components: {
|
||||
shares,
|
||||
@@ -351,7 +350,7 @@ export default {
|
||||
if (val) {
|
||||
let timer = setInterval(() => {
|
||||
this.$refs.popupGoods.buyType = "PINTUAN";
|
||||
console.log(this.$refs.popupGoods.buyType);
|
||||
|
||||
clearInterval(timer);
|
||||
}, 100);
|
||||
|
||||
@@ -394,8 +393,7 @@ export default {
|
||||
},
|
||||
async onLoad(options) {
|
||||
this.routerVal = options;
|
||||
},
|
||||
onShow() {
|
||||
|
||||
this.goodsDetail = {};
|
||||
//如果有参数ids说明事分销短连接,需要获取参数
|
||||
if (this.routerVal.scene) {
|
||||
@@ -409,15 +407,11 @@ export default {
|
||||
this.init(
|
||||
this.routerVal.id,
|
||||
this.routerVal.goodsId,
|
||||
this.routerVal.distributionId,
|
||||
this.routerVal.whetherPoint
|
||||
this.routerVal.distributionId
|
||||
);
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.storeParams.pageNumber++;
|
||||
this.getOtherLikeGoods();
|
||||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
// 循环出当前促销是否为空
|
||||
emptyPromotion() {
|
||||
@@ -430,7 +424,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**初始化信息 */
|
||||
async init(id, goodsId, distributionId, whetherPoint) {
|
||||
async init(id, goodsId, distributionId) {
|
||||
this.isGroup = false; //初始化拼团
|
||||
this.productId = id; // skuId
|
||||
// 这里请求获取到页面数据 解析数据
|
||||
@@ -456,7 +450,6 @@ export default {
|
||||
// 积分
|
||||
if (item.indexOf("POINTS_GOODS") == 0) {
|
||||
this.pointDetail = this.PromotionList[item];
|
||||
console.log(this.pointDetail);
|
||||
}
|
||||
});
|
||||
// 轮播图
|
||||
@@ -466,7 +459,7 @@ export default {
|
||||
this.getstoreBaseInfoFun(this.goodsDetail.storeId);
|
||||
|
||||
// 获取购物车
|
||||
this.cartNum();
|
||||
this.cartCount();
|
||||
|
||||
// 获取店铺推荐商品
|
||||
this.getstoreRecommend();
|
||||
@@ -481,13 +474,14 @@ export default {
|
||||
},
|
||||
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
return val.toFixed(2).split(".");
|
||||
},
|
||||
|
||||
/**选择商品 */
|
||||
changedGoods(val) {
|
||||
this.selectedGoods = val;
|
||||
},
|
||||
@@ -516,7 +510,9 @@ export default {
|
||||
this.shutMask(4, "PINTUAN", order);
|
||||
},
|
||||
|
||||
// 查看购物车
|
||||
/**
|
||||
* 查看购物车
|
||||
*/
|
||||
reluchToCart() {
|
||||
let obj = {
|
||||
from: "product",
|
||||
@@ -528,8 +524,10 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 查询购物车总数量
|
||||
cartNum() {
|
||||
/**
|
||||
* 查询购物车总数量
|
||||
*/
|
||||
cartCount() {
|
||||
if (storage.getHasLogin()) {
|
||||
API_trade.getCartNum().then((res) => {
|
||||
this.nums = res.data.result;
|
||||
@@ -537,11 +535,25 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回
|
||||
*/
|
||||
back() {
|
||||
uni.navigateBack();
|
||||
|
||||
if(getCurrentPages().length ==1){
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/index'
|
||||
});
|
||||
}
|
||||
else{
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 获取店铺信息
|
||||
/**
|
||||
* 获取店铺信息
|
||||
*/
|
||||
getstoreBaseInfoFun(id) {
|
||||
API_store.getstoreBaseInfo(id).then((res) => {
|
||||
if (res.data.success) {
|
||||
@@ -550,9 +562,10 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 删除收藏店铺
|
||||
/**
|
||||
* 删除收藏店铺
|
||||
*/
|
||||
deleteGoodsCollectionFun(id) {
|
||||
// deleteStoreCollection
|
||||
API_Members.deleteGoodsCollection(id).then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
uni.showToast({
|
||||
@@ -564,7 +577,9 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 获取商品是否已被收藏
|
||||
/**
|
||||
* 获取商品是否已被收藏
|
||||
*/
|
||||
getGoodsCollectionFun(goodsId) {
|
||||
if (storage.getHasLogin()) {
|
||||
API_Members.getGoodsIsCollect(goodsId, "GOODS").then((res) => {
|
||||
@@ -573,7 +588,9 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 获取店铺推荐商品列表
|
||||
/**
|
||||
* 获取店铺推荐商品列表
|
||||
*/
|
||||
getstoreRecommend() {
|
||||
getGoodsList({
|
||||
pageNumber: 1,
|
||||
@@ -585,7 +602,9 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 获取相似商品列表
|
||||
/**
|
||||
* 获取相似商品列表
|
||||
*/
|
||||
getOtherLikeGoods() {
|
||||
getGoodsList({
|
||||
pageNumber: 1,
|
||||
@@ -597,7 +616,9 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 领取优惠券
|
||||
/**
|
||||
* 领取优惠券
|
||||
*/
|
||||
receiveCouponsFun(id) {
|
||||
API_Members.receiveCoupons(id).then((res) => {
|
||||
uni.showToast({
|
||||
@@ -607,18 +628,25 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
linkstorePage(store_id) {
|
||||
/**
|
||||
* 跳转到店铺页面
|
||||
*/
|
||||
navigateToStore(store_id) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/shopPage?id=` + store_id,
|
||||
});
|
||||
},
|
||||
|
||||
//获取优惠券按钮
|
||||
/**
|
||||
* 获取优惠券按钮
|
||||
*/
|
||||
getCoupon(item) {
|
||||
this.receiveCouponsFun(item.id);
|
||||
},
|
||||
|
||||
//规格弹窗开关
|
||||
/**
|
||||
* 规格弹窗开关
|
||||
*/
|
||||
shutMask(flag, buyFlag, type) {
|
||||
// type是指是否点击底部按钮
|
||||
if (flag) {
|
||||
@@ -656,14 +684,15 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
//收藏
|
||||
/**
|
||||
* 收藏
|
||||
*/
|
||||
clickFavorite(id) {
|
||||
if (this.favorite) {
|
||||
// 取消收藏
|
||||
this.deleteGoodsCollectionFun(id);
|
||||
return false;
|
||||
}
|
||||
|
||||
API_Members.collectionGoods(id, "GOODS").then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({
|
||||
@@ -672,16 +701,16 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.favorite = !this.favorite;
|
||||
},
|
||||
|
||||
// 顶部header显示或隐藏
|
||||
/**
|
||||
* 顶部header显示或隐藏
|
||||
*/
|
||||
pageScroll(e) {
|
||||
if (this.scrollFlag) {
|
||||
this.calcSize();
|
||||
}
|
||||
|
||||
if (e.detail.scrollTop > 200) {
|
||||
//当距离大于200时显示回到顶部按钮
|
||||
this.headerFlag = true;
|
||||
@@ -702,7 +731,10 @@ export default {
|
||||
this.scrollId = "4";
|
||||
}
|
||||
},
|
||||
//计算每个要跳转到的模块高度信息
|
||||
|
||||
/**
|
||||
* 计算每个要跳转到的模块高度信息
|
||||
*/
|
||||
calcSize() {
|
||||
let h = 0;
|
||||
let that = this;
|
||||
@@ -744,7 +776,10 @@ export default {
|
||||
});
|
||||
this.scrollFlag = false;
|
||||
},
|
||||
// 点击顶部跳转到对应位置
|
||||
|
||||
/**
|
||||
* 点击顶部跳转到对应位置
|
||||
*/
|
||||
headerTab(id) {
|
||||
if (this.scrollFlag) {
|
||||
this.calcSize();
|
||||
@@ -756,7 +791,9 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 点击分享
|
||||
/**
|
||||
* 点击分享
|
||||
*/
|
||||
async shareChange() {
|
||||
this.shareFlage = true;
|
||||
},
|
||||
|
||||
@@ -51,7 +51,7 @@ export default {
|
||||
let res = await getGoodsMessage(this.goodsId);
|
||||
if (res.data.success) {
|
||||
this.goodsDetail = res.data.result;
|
||||
console.log(this.goodsDetail);
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
<view class="price-sales">
|
||||
<div class="item-price" v-if="item.price != undefined">
|
||||
¥
|
||||
<span>{{ Fixed(item.price)[0] }}</span>
|
||||
.{{Fixed(item.price)[1]}}
|
||||
<span>{{ formatPrice(item.price)[0] }}</span>
|
||||
.{{formatPrice(item.price)[1]}}
|
||||
<!-- <text v-if="item.point != undefined">+{{ item.point }}积分</text> -->
|
||||
</div>
|
||||
</view>
|
||||
@@ -48,7 +48,7 @@ export default {
|
||||
});
|
||||
},
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
<view class="goods-price " v-if="goodsDetail.promotionPrice">
|
||||
<span v-if="goodsDetail.promotionPrice && !pointDetail">
|
||||
¥
|
||||
<span class="goods-price-promotionShow goods-price-bigshow" >{{ Fixed(goodsDetail.promotionPrice)[0] }}</span>
|
||||
.{{ Fixed(goodsDetail.promotionPrice)[1] }}
|
||||
<span class="goods-price-promotionShow goods-price-bigshow" >{{ formatPrice(goodsDetail.promotionPrice)[0] }}</span>
|
||||
.{{ formatPrice(goodsDetail.promotionPrice)[1] }}
|
||||
</span>
|
||||
<span v-if="pointDetail.points">
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
<div class="promotion-box">
|
||||
¥
|
||||
<span class="goods-price-bigshow">{{
|
||||
Fixed(goodsDetail.price)[0]
|
||||
formatPrice(goodsDetail.price)[0]
|
||||
}}</span>
|
||||
.{{ Fixed(goodsDetail.price)[1] }}
|
||||
.{{ formatPrice(goodsDetail.price)[1] }}
|
||||
|
||||
</div>
|
||||
</view>
|
||||
@@ -35,9 +35,9 @@
|
||||
<span>
|
||||
¥
|
||||
<span class="goods-price-bigshow">{{
|
||||
Fixed(goodsDetail.price)[0]
|
||||
formatPrice(goodsDetail.price)[0]
|
||||
}}</span>
|
||||
.{{ Fixed(goodsDetail.price)[1] }}
|
||||
.{{ formatPrice(goodsDetail.price)[1] }}
|
||||
|
||||
</span>
|
||||
</view>
|
||||
@@ -129,7 +129,7 @@ export default {
|
||||
|
||||
methods: {
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
@@ -301,7 +301,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
console.log(this.pointDetail)
|
||||
|
||||
this.formatSku(this.goodsSpec);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
<view class="u-group-flex-left" v-if="promotion.__key == 'SECKILL' ">
|
||||
|
||||
<span class="u-group-flex-left-span" v-if="detail.promotionPrice!=undefined">
|
||||
¥ <span class="flex-price"> {{ Fixed(detail.promotionPrice)[0]}}.{{ Fixed(detail.promotionPrice)[1]}}</span>
|
||||
¥ <span class="flex-price"> {{ formatPrice(detail.promotionPrice)[0]}}.{{ formatPrice(detail.promotionPrice)[1]}}</span>
|
||||
|
||||
</span>
|
||||
<view class="u-group-flex" v-if="detail.price!=undefined">
|
||||
<span class="old-price">¥{{ Fixed(detail.price)[0]}}.{{ Fixed(detail.price)[1]}}</span>
|
||||
<span class="old-price">¥{{ formatPrice(detail.price)[0]}}.{{ formatPrice(detail.price)[1]}}</span>
|
||||
<view class="promotion">限时抢购</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -25,12 +25,12 @@
|
||||
<view class="u-group-flex-left" v-if="promotion.__key == 'GROUPBUY' ">
|
||||
<span class="u-group-flex-left-span">
|
||||
<span class="flex-price"
|
||||
v-if="promotion.groupbuy_goods_vo.price !=undefined">¥{{ Fixed(promotion.groupbuy_goods_vo.price )[0]}}.{{ Fixed(promotion.groupbuy_goods_vo.price )[1]}}</span>
|
||||
v-if="promotion.groupbuy_goods_vo.price !=undefined">¥{{ formatPrice(promotion.groupbuy_goods_vo.price )[0]}}.{{ formatPrice(promotion.groupbuy_goods_vo.price )[1]}}</span>
|
||||
<!-- <span v-if="promotion.point">+{{promotion.point}}积分</span> -->
|
||||
</span>
|
||||
<view class="u-group-flex">
|
||||
<span class="old-price"
|
||||
v-if="promotion.groupbuy_goods_vo.original_price!=undefined">¥{{ Fixed(promotion.groupbuy_goods_vo.original_price)[0]}}.{{ Fixed(promotion.groupbuy_goods_vo.original_price)[1]}}</span>
|
||||
v-if="promotion.groupbuy_goods_vo.original_price!=undefined">¥{{ formatPrice(promotion.groupbuy_goods_vo.original_price)[0]}}.{{ formatPrice(promotion.groupbuy_goods_vo.original_price)[1]}}</span>
|
||||
<view class="promotion">团购活动</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -38,10 +38,10 @@
|
||||
<view class="u-group-flex-left" v-if="promotion.__key == 'PINTUAN' ">
|
||||
|
||||
<span class="u-group-flex-left-span" v-if="detail.promotionPrice != undefined">
|
||||
¥<span class="flex-price"> {{ Fixed(detail.promotionPrice)[0]}}.</span>{{ Fixed(detail.promotionPrice)[1]}}
|
||||
¥<span class="flex-price"> {{ formatPrice(detail.promotionPrice)[0]}}.</span>{{ formatPrice(detail.promotionPrice)[1]}}
|
||||
</span>
|
||||
<view class="u-group-flex" v-if="detail.price != undefined">
|
||||
<span class="old-price">¥{{ Fixed(detail.price)[0]}}.{{ Fixed(detail.price)[1]}}</span>
|
||||
<span class="old-price">¥{{ formatPrice(detail.price)[0]}}.{{ formatPrice(detail.price)[1]}}</span>
|
||||
<view class="promotion">拼团活动</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -98,7 +98,7 @@ export default {
|
||||
mounted() {},
|
||||
methods: {
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
@@ -106,14 +106,12 @@ export default {
|
||||
},
|
||||
getCountDownTime(val) {
|
||||
let date = new Date(val.replace(/-/g, "/"))
|
||||
|
||||
let timeSimple = new Date(date).getTime() / 1000;
|
||||
console.log(timeSimple , timeSimple - new Date().getTime() / 1000)
|
||||
return timeSimple - new Date().getTime() / 1000;
|
||||
},
|
||||
getIsTimer(val) {
|
||||
var timestamp = new Date().getTime();
|
||||
// console.log(timestamp);
|
||||
|
||||
|
||||
if (timestamp < val.start_time) {
|
||||
this.startTimer = true;
|
||||
|
||||
@@ -41,16 +41,15 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
res: {
|
||||
handler(val) {
|
||||
console.log(val);
|
||||
// if (this.res && this.res.length != 0) {
|
||||
// Object.keys(this.res).forEach((item) => {
|
||||
// if (item != "COUPON") {
|
||||
// let key = item.split("-")[0];
|
||||
// this.res[item]._key = key;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
handler() {
|
||||
if (this.res && this.res.length != 0) {
|
||||
Object.keys(this.res).forEach((item) => {
|
||||
if (item != "COUPON") {
|
||||
let key = item.split("-")[0];
|
||||
this.res[item]._key = key;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
immediate: true,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{{ item.goodsName }}
|
||||
</view>
|
||||
<view class="item-price" v-if="item.price != undefined">
|
||||
¥<span class="item-price-blod">{{ Fixed(item.price)[0] }}</span>.{{ Fixed(item.price)[1] }}
|
||||
¥<span class="item-price-blod">{{ formatPrice(item.price)[0] }}</span>.{{ formatPrice(item.price)[1] }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -49,7 +49,7 @@ export default {
|
||||
mounted() {},
|
||||
methods: {
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -3,31 +3,22 @@
|
||||
<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="请输入搜索" />
|
||||
<!-- <input /> -->
|
||||
|
||||
<u-icon @click="shareChange()" style="margin:0 10rpx 0;" name="share-fill" size="40" color="#fff"></u-icon>
|
||||
|
||||
</div>
|
||||
<view class="tab-header">
|
||||
<text :class="{ cur: tabIndex == 0 }" @click="setCat(0)">首页</text>
|
||||
<text :class="{ cur: tabIndex == 1 }" @click="setCat(1)">商品</text>
|
||||
<!-- <text :class="{ cur: tabIndex == 2 }" @click="setCat(2)">上新</text> -->
|
||||
<text :class="{ cur: tabIndex == 0 }" @click="checkNavigation(0)">首页</text>
|
||||
<text :class="{ cur: tabIndex == 1 }" @click="checkNavigation(1)">商品</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<swiper :current="tabIndex" class="swiper-box" @change="ontabchange">
|
||||
<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" :pageChange="pageChange" :categoryId="item" :storeId="storeId" v-if="index == 1"></storePageGoods>
|
||||
|
||||
<storePageGoods :load="load" :categoryId="item" :storeId="storeId" v-if="index == 1"></storePageGoods>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
@@ -40,11 +31,8 @@
|
||||
|
||||
<script>
|
||||
import shares from "@/components/m-share/index"; //分享
|
||||
|
||||
import storePageMain from "./shopPageMain.vue";
|
||||
import storePageGoods from "./shopPageGoods.vue";
|
||||
|
||||
import { getstoreBaseInfo } from "@/api/store.js";
|
||||
export default {
|
||||
components: {
|
||||
shares,
|
||||
@@ -53,78 +41,77 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
shareFlage: false,
|
||||
tabIndex: 0,
|
||||
keyword: "",
|
||||
shareFlage: false, //分享share
|
||||
tabIndex: 0, //默认为第一个tab
|
||||
keyword: "", //搜索关键字
|
||||
load: false,
|
||||
storeId: undefined,
|
||||
indexCats: [0, 1],
|
||||
scrollHeight: "",
|
||||
storeId: undefined, //店铺id
|
||||
indexCats: [0, 1], //默认为2个tab
|
||||
loadIndex: 1, //加载的距离
|
||||
pageChange: "",
|
||||
storeInfo: {},
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载
|
||||
*/
|
||||
async onLoad(options) {
|
||||
this.storeId = options.id;
|
||||
console.log(this.storeId);
|
||||
getstoreBaseInfo(this.storeId).then((res) => {
|
||||
this.storeInfo = res.data;
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
const { windowWidth, windowHeight } = uni.getSystemInfoSync();
|
||||
let tabHeader = 0;
|
||||
|
||||
let topHeight = 0;
|
||||
uni.getSystemInfo({
|
||||
success: function (res) {
|
||||
// res - 各种参数
|
||||
let search = uni.createSelectorQuery().select(".header");
|
||||
search
|
||||
.boundingClientRect(function (data) {
|
||||
//data - 各种参数
|
||||
topHeight = data.height; // 获取元素宽度
|
||||
})
|
||||
.exec();
|
||||
let nav = uni.createSelectorQuery().select(".tab-header");
|
||||
nav
|
||||
.boundingClientRect(function (data) {
|
||||
//data - 各种参数
|
||||
tabHeader = data.height; // 获取元素宽度
|
||||
})
|
||||
.exec();
|
||||
},
|
||||
});
|
||||
},
|
||||
mounted() {},
|
||||
|
||||
methods: {
|
||||
// 点击分享
|
||||
async shareChange() {
|
||||
this.shareFlage = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
search() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 下滑加载
|
||||
*/
|
||||
pageScroll(e) {
|
||||
if (e.detail.scrollTop > 300 * this.loadIndex) {
|
||||
this.loadIndex++;
|
||||
this.load = this.loadIndex;
|
||||
}
|
||||
// this.load = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回
|
||||
*/
|
||||
back() {
|
||||
uni.navigateBack();
|
||||
if (getCurrentPages().length == 1) {
|
||||
uni.switchTab({
|
||||
url: "/pages/tabbar/home/index",
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
setCat(type) {
|
||||
this.tabIndex = type;
|
||||
|
||||
/**
|
||||
* 点击导航栏
|
||||
*/
|
||||
checkNavigation(index) {
|
||||
this.tabIndex = index;
|
||||
},
|
||||
ontabchange(e) {
|
||||
|
||||
/**
|
||||
* 滑动回调
|
||||
*/
|
||||
tabChange(e) {
|
||||
this.tabIndex = e.detail.current;
|
||||
this.setCat(this.tabIndex);
|
||||
this.checkNavigation(this.tabIndex);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -107,7 +107,7 @@ export default {
|
||||
},
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log("触发");
|
||||
|
||||
this.loadMore();
|
||||
},
|
||||
mounted() {
|
||||
@@ -148,10 +148,10 @@ export default {
|
||||
res.data.result.totalElements <=
|
||||
res.data.result.number * res.data.result.size
|
||||
) {
|
||||
console.warn(res.data.result.totalElements);
|
||||
|
||||
this.loadStatus = "noMore";
|
||||
} else {
|
||||
console.log(res.data.result.totalElements);
|
||||
|
||||
this.loadStatus = "loadmore";
|
||||
}
|
||||
this.goodsList.push(...res.data.result.content);
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
<view class="name">{{ storeInfo.storeName }}</view>
|
||||
<view>{{ storeInfo.goodsNum || 0 }}关注 {{ storeInfo.collectionNum || 0 }}件商品</view>
|
||||
</view>
|
||||
<view class="follow" @click="handleCollection">
|
||||
<view class="follow" @click="whetherCollection">
|
||||
<view>{{ isCollection == 'success' ? '已关注' : '+ 关注' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="store-intro">
|
||||
<view class="title">店铺简介</view>
|
||||
<view class="text" :class="introFlag ? 'close' : 'open'">
|
||||
<view class="text" >
|
||||
<view v-html="storeInfo.storeDesc"></view>
|
||||
<!-- <view class="zhankai" :class="introFlag ? 'close' : 'open'" @click="shut"></view> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<!-- 优惠券 -->
|
||||
@@ -40,45 +40,21 @@
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 店铺热卖 -->
|
||||
<!-- <view class="hot">
|
||||
<view class="title">店铺热卖</view>
|
||||
<scroll-view scroll-x="true" class="contant">
|
||||
<view v-if="!hotGoods.length" class="no-goods">暂无商品信息</view>
|
||||
<view v-else class="item-box" v-for="(item,index) in hotGoods" :key="index" @click="toGoodsDetail(item.goods_id)">
|
||||
<view class="item">
|
||||
<u-image width="106px" height="106px" class="item-img" :src="item.thumbnail" mode="">
|
||||
<u-loading slot="loading"></u-loading>
|
||||
</u-image>
|
||||
<text class="name">{{ item.goodsName }}</text>
|
||||
<text class="price">
|
||||
<text>¥{{ item.price }}</text>
|
||||
{{ item.point ? '+' + item.point + '积分' : '' }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</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="toGoodsDetail(item)">
|
||||
<u-image width="324rpx" height="324rpx" mode="aspectFit" :src="item.thumbnail">
|
||||
<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>
|
||||
<!-- {{ item.point ? '+' + item.point + '积分' : '' }} -->
|
||||
<!-- <text class="before-price">¥{{ item.price }}</text> -->
|
||||
</div>
|
||||
<view class="buyCount">
|
||||
<div>已售 {{ item.buyCount || "0" }}</div>
|
||||
<text>
|
||||
<!-- 好评{{ 1111 }} -->
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -98,27 +74,22 @@ import {
|
||||
} from "@/api/members.js";
|
||||
import { getGoodsList } from "@/api/goods.js";
|
||||
import { getAllCoupons } from "@/api/promotions.js";
|
||||
import storage from "@/utils/storage.js";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
storeId: {
|
||||
value: Number,
|
||||
},
|
||||
load:{
|
||||
value:Boolean
|
||||
}
|
||||
load: {
|
||||
value: Boolean,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 店铺介绍按钮
|
||||
introFlag: true,
|
||||
storeInfo: [],
|
||||
isCollection: false,
|
||||
hotGoods: [],
|
||||
recommandGoods: [],
|
||||
couponList: [],
|
||||
lingquFlag: true,
|
||||
storeInfo: "", //店铺详情
|
||||
isCollection: false, //是否关注
|
||||
recommandGoods: [], //推荐货物
|
||||
couponList: [], //优惠券列表
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 50,
|
||||
@@ -126,19 +97,21 @@ export default {
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
watch: {},
|
||||
mounted(options) {
|
||||
if (this.$options.filters.isLogin("auth")) {
|
||||
getGoodsIsCollect("STORE", this.storeId).then((res) => {
|
||||
this.isCollection = res.data.message;
|
||||
});
|
||||
}
|
||||
this.initstoreInfo();
|
||||
this.initStoreInfo();
|
||||
},
|
||||
methods: {
|
||||
initstoreInfo() {
|
||||
|
||||
/**
|
||||
* 店铺信息
|
||||
*/
|
||||
initStoreInfo() {
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
});
|
||||
@@ -153,7 +126,6 @@ export default {
|
||||
,
|
||||
]).then((res) => {
|
||||
this.couponList = res[0].data.result.records;
|
||||
this.hotGoods = res[1].data.result.content;
|
||||
this.recommandGoods = res[1].data.result.content;
|
||||
});
|
||||
} else {
|
||||
@@ -163,16 +135,21 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
shut() {
|
||||
this.introFlag = !this.introFlag;
|
||||
},
|
||||
|
||||
toGoodsDetail(val) {
|
||||
|
||||
|
||||
/**
|
||||
* 跳转到商品详情
|
||||
*/
|
||||
navigateToGoodsDetail(val) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
|
||||
});
|
||||
},
|
||||
handleCollection() {
|
||||
|
||||
/**
|
||||
* 是否收藏
|
||||
*/
|
||||
whetherCollection() {
|
||||
if (this.isCollection) {
|
||||
deleteGoodsCollection("STORE", this.storeId).then((res) => {
|
||||
if (res.statusCode === 200) {
|
||||
@@ -197,6 +174,10 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取优惠券
|
||||
*/
|
||||
getCoupon(item) {
|
||||
if (!this.$options.filters.isLogin("auth")) {
|
||||
uni.showToast({
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
<template>
|
||||
<view class="storeNew">
|
||||
<view class="storeNew-item" v-for="(value, key, index) in upGoodsMap" :key="key">
|
||||
<view class="storeNew-item-title">{{ key }}</view>
|
||||
|
||||
<view class="index-items">
|
||||
<view class="index-item" v-for="(item, _index) in value" :key="_index" @click="gotoGoodsDetail(item.goods_id)">
|
||||
<view class="index-item-img">
|
||||
<u-image height="160px" width="173px" class="index-item-store-img" :src="item.thumbnail">
|
||||
<u-loading slot="loading"></u-loading>
|
||||
</u-image>
|
||||
<view class="index-item-title">
|
||||
{{ item.name }}
|
||||
<view class="index-item-title-desc">{{ item.storeName }}</view>
|
||||
</view>
|
||||
<!-- <view class="index-item-price">{{ '¥' + item.price }}{{ item.point ? '+'+item.point + '积分' : '' }}</view> -->
|
||||
<view class="index-item-price">{{ '¥' + item.price }}</view>
|
||||
<!-- <view class="index-item-tags">
|
||||
<view class="index-item-tag"><uni-tag text="限购" type="error" :inverted="true" size="small"></uni-tag></view>
|
||||
<view class="index-item-tag"><uni-tag text="秒杀" type="error" :inverted="true" size="small"></uni-tag></view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniTag from '@/components/uni-tag/uni-tag.vue';
|
||||
import { getGoodsListUplog } from '@/api/goods.js';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
storeId: {
|
||||
value: Number
|
||||
}
|
||||
},
|
||||
components: {
|
||||
uniTag
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
storeId: this.storeId
|
||||
},
|
||||
upGoodsMap: {}
|
||||
};
|
||||
},
|
||||
mounted(options) {
|
||||
this.initUpGoodsInfo();
|
||||
},
|
||||
methods: {
|
||||
gotoGoodsDetail(id) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${id}`
|
||||
});
|
||||
},
|
||||
initUpGoodsInfo() {
|
||||
getGoodsListUplog(this.params).then(res => {
|
||||
this.upGoodsMap = res.data;
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
|
||||
.storeNew {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.storeNew-item {
|
||||
background-color: #fff;
|
||||
}
|
||||
.storeNew-item-title {
|
||||
height: 132rpx;
|
||||
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: 216rpx;
|
||||
}
|
||||
&:after {
|
||||
border-radius: 22rpx 22rpx 0 0;
|
||||
top: 63rpx;
|
||||
right: 216rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.index-items {
|
||||
padding-left: 20 rpx;
|
||||
background-color: #f7f7f7;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.index-item {
|
||||
width: 346 rpx;
|
||||
min-height: 2610 rpx;
|
||||
background-color: #fff;
|
||||
margin: 0 18 rpx 20 rpx 0;
|
||||
border-radius: 16 rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
.index-item-store-img{
|
||||
width: 346 rpx !important;
|
||||
height: 320 rpx !important;
|
||||
}
|
||||
.index-item-img {
|
||||
image {
|
||||
width: 346 rpx;
|
||||
height: 320 rpx;
|
||||
}
|
||||
}
|
||||
.index-item-title {
|
||||
font-size: 26 rpx;
|
||||
color: #333333;
|
||||
padding: 10 rpx 0 0 20 rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.index-item-title-desc {
|
||||
font-size: 25 rpx;
|
||||
color: #999999;
|
||||
margin-top: 10 rpx;
|
||||
}
|
||||
.index-item-price {
|
||||
font-size: 110 rpx;
|
||||
color: #ff5a10;
|
||||
padding: 10 rpx 0 0 20 rpx;
|
||||
}
|
||||
.index-item-tags {
|
||||
padding-left: 20 rpx;
|
||||
padding-top: 10 rpx;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.index-item-tag {
|
||||
width: 100 rpx;
|
||||
margin-right: 10 rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user