首页下拉刷新,优化商品促销界面

master
lemon橪 2021-10-15 18:01:54 +08:00
parent fd37087c43
commit 44648e9971
11 changed files with 102 additions and 114 deletions

View File

@ -2,8 +2,8 @@
"name" : "lili商城",
"appid" : "__UNI__C100675",
"description" : "",
"versionName" : "4.0.44",
"versionCode" : 4000044,
"versionName" : "4.0.45",
"versionCode" : 4000045,
"transformPx" : false,
"app-plus" : {
"compatible" : {

View File

@ -10,7 +10,8 @@
"style": {
"navigationBarTitleText": "首页",
"navigationStyle": "custom", //
"navigationBarTextStyle": "black"
"navigationBarTextStyle": "black",
"enablePullDownRefresh":true
}
},

View File

@ -204,24 +204,25 @@
</view>
</view>
<!-- 规格-模态层弹窗 -->
<view class="popup spec" @click="shutMask(false)" v-show="maskFlag">
<view class="spec">
<!-- 促销弹窗 -->
<view class="cuxiao mask" v-show="cuxiao">
<view ref="mask_title" class="title mask_title">
优惠
<span @click="shutMask(false)">×</span>
<u-popup v-model="promotionFlag" :height="setup.height" :mode="setup.mode" :border-radius="setup.radius"
@close="promotionFlag=false" :mask-close-able="setup.close" closeable>
<view class="header-title">优惠</view>
<view class="cuxiao">
<scroll-view class="scroll_mask" :scroll-y="true">
<view class="con-cuxiao">
<view class="cuxiao-title">促销活动</view>
<PromotionDetailsLayout :res="PromotionList" />
</view>
<view class="con-cuxiao coupons">
<view class="cuxiao-title">可领优惠券</view>
<PromotionCoupon @getCoupon="getCoupon" :res="PromotionList" />
</view>
</scroll-view>
</view>
<scroll-view class="scroll_mask" :scroll-y="true">
<view class="con-cuxiao">
<text>促销活动</text>
<PromotionDetailsLayout :res="PromotionList" />
</view>
<view class="con-cuxiao coupons">
<text>可领优惠券</text>
<PromotionCoupon @getCoupon="getCoupon" :res="PromotionList" />
</view>
</scroll-view>
</view>
</u-popup>
<!-- 配送地址弹窗 -->
<popupAddress @closeAddress="closePopupAddress" @deliveryData="deliveryFun" v-if="goodsDetail.id"
@ -266,6 +267,8 @@ import popupGoods from "./product/popup/goods"; //购物车商品的模块
import popupAddress from "./product/popup/address"; //
import shares from "@/components/m-share/index"; //
import popups from "@/components/popups/popups"; //
import setup from "./product/popup/popup";
export default {
components: {
popups,
@ -285,6 +288,8 @@ export default {
},
data() {
return {
setup,
promotionFlag: false,
// #ifdef H5
navbarListX: 110, //x
navbarListY: 80, //y
@ -373,8 +378,7 @@ export default {
imgList: [], //
favorite: false, //flag
recommendList: [], //
maskFlag: false, //
cuxiao: false, //
// maskFlag: false, //
goodsInfo: false, //
addressFlag: false, //
buyMask: false, //
@ -523,9 +527,9 @@ export default {
let response = await getGoods(id, goodsId);
if (!response.data.success) {
setTimeout(()=>{
setTimeout(() => {
uni.navigateBack();
},500)
}, 500);
}
//
if (distributionId || this.$store.state.distributionId) {
@ -625,14 +629,14 @@ export default {
*/
closePopupAddress(val) {
this.addressFlag = val;
this.maskFlag = false;
// this.maskFlag = false;
},
/**
* 商品规格子级关闭回调
*/
closePopupBuy(val) {
this.buyMask = val;
this.maskFlag = false;
// this.maskFlag = false;
},
/** 参与拼团 创建拼团 */
@ -708,7 +712,7 @@ export default {
*/
getGoodsCollectionFun(goodsId) {
if (storage.getHasLogin()) {
API_Members.getGoodsIsCollect("GOODS",goodsId ).then((res) => {
API_Members.getGoodsIsCollect("GOODS", goodsId).then((res) => {
this.favorite = res.data.result;
});
}
@ -730,7 +734,7 @@ export default {
/**
* 获取相似商品列表
*
*
*/
getOtherLikeGoods() {
getGoodsList({
@ -775,22 +779,21 @@ export default {
* 规格弹窗开关
*/
shutMask(flag, buyFlag, type) {
// type
this.promotionFlag = false;
this.buyMask = false;
this.addressFlag = false;
if (flag) {
switch (flag) {
case 1: //
this.maskFlag = true;
this.cuxiao = true;
this.promotionFlag = true;
break;
case 3:
this.maskFlag = true;
this.addressFlag = true;
break;
case 4: //
//
this.maskFlag = true;
this.buyMask = true;
if (buyFlag == "PINTUAN") {
if (type.orderSn) {
@ -804,10 +807,6 @@ export default {
break;
}
} else {
this.maskFlag = false;
this.cuxiao = false;
this.buyMask = false;
}
},
@ -820,7 +819,7 @@ export default {
this.deleteGoodsCollectionFun(id);
return false;
}
API_Members.collectionGoods("GOODS",id ).then((res) => {
API_Members.collectionGoods("GOODS", id).then((res) => {
if (res.data.success) {
uni.showToast({
title: "收藏成功!",

View File

@ -1,5 +1,5 @@
<template>
<u-popup class="popup" v-model="addressFlag" :height="setup.height" :mode="setup.mode" :border-radius="setup.radius" @close="closeAddress()" :mask-close-able="setup.close" :mask="false" closeable>
<u-popup class="popup" v-model="addressFlag" :height="setup.height" :mode="setup.mode" :border-radius="setup.radius" @close="closeAddress()" :mask-close-able="setup.close" closeable>
<view class="header-title">选择地址</view>
<view class="view-box" v-if="addressDetail">
<view class="view-item" v-for="(item, index) in addressDetail" :key="index" @click="clickAddress(item)">

View File

@ -1,11 +1,13 @@
<template>
<div class="wrapper">
<u-popup class="popup" v-model="buyMask" :height="setup.height" closeable :mode="setup.mode" :mask-close-able="isClose" :mask="isMask" :border-radius="setup.radius" @close="closeMask()">
<u-popup class="popup" v-model="buyMask" :height="setup.height" closeable :mode="setup.mode"
:mask-close-able="setup.close" :border-radius="setup.radius" @close="closeMask()">
<!-- 商品 -->
<view class="goods-box bottom">
<view class="goods-header">
<view class="goods-img">
<u-image width="200rpx" border-radius="20" class="uimage" height="200rpx" :src="selectedSpecImg ? selectedSpecImg : goodsDetail.thumbnail"></u-image>
<u-image width="200rpx" border-radius="20" class="uimage" height="200rpx"
:src="selectedSpecImg ? selectedSpecImg : goodsDetail.thumbnail"></u-image>
</view>
<view class="goods-skus">
@ -13,11 +15,11 @@
<view class="goods-price " v-if="goodsDetail.promotionPrice">
<span v-if="goodsDetail.promotionPrice && !pointDetail">
<span class="goods-price-promotionShow goods-price-bigshow">{{ formatPrice(goodsDetail.promotionPrice)[0] }}</span>
<span
class="goods-price-promotionShow goods-price-bigshow">{{ formatPrice(goodsDetail.promotionPrice)[0] }}</span>
.{{ formatPrice(goodsDetail.promotionPrice)[1] }}
</span>
<span v-if="pointDetail.points">
<span class="goods-price-promotionShow goods-price-bigshow">{{ pointDetail.points }}</span>
积分
</span>
@ -56,21 +58,25 @@
<view class="goods-skus-view" :key="specIndex" v-for="(spec, specIndex) in formatList">
<view class="skus-view-list">
<view class="view-class-title">{{ spec.name }}</view>
<view :class="{ active: spec_val.value == currentSelceted[specIndex] }" class="skus-view-item" v-for="(spec_val, spec_index) in spec.values" :key="spec_index"
<view :class="{ active: spec_val.value == currentSelceted[specIndex] }" class="skus-view-item"
v-for="(spec_val, spec_index) in spec.values" :key="spec_index"
@click="handleClickSpec(spec, specIndex, spec_val)">{{ spec_val.value }}</view>
</view>
</view>
<!-- 数量 -->
<view class="goods-skus-number">
<view class="view-class-title">数量</view>
<u-number-box :bg-color="numberBox.bgColor" :max="200" :color="numberBox.color" :input-width="numberBox.width" :input-height="numberBox.height" :size="numberBox.size" :min="1" v-model="num">
<u-number-box :bg-color="numberBox.bgColor" :max="200" :color="numberBox.color"
:input-width="numberBox.width" :input-height="numberBox.height" :size="numberBox.size" :min="1"
v-model="num">
</u-number-box>
</view>
</view>
<!-- 按钮 -->
<view class="btns">
<view class="box-btn card" v-if="buyType != 'PINTUAN' && goodsDetail.goodsType!='VIRTUAL_GOODS'" @click="addToCartOrBuy('cart')"></view>
<view class="box-btn card" v-if="buyType != 'PINTUAN' && goodsDetail.goodsType!='VIRTUAL_GOODS'"
@click="addToCartOrBuy('cart')">加入购物车</view>
<view class="box-btn buy" @click="addToCartOrBuy('buy')"></view>
</view>
</view>
@ -101,7 +107,6 @@ export default {
formatList: [],
currentSelceted: [],
skuList: "",
isMask: false, //
isClose: false, //
};
},
@ -129,8 +134,6 @@ export default {
},
methods: {
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
@ -168,7 +171,10 @@ export default {
};
this.selectName = specValue.value;
this.$emit("handleClickSku", {skuId: selectedSkuId.skuId, goodsId: this.goodsDetail.goodsId});
this.$emit("handleClickSku", {
skuId: selectedSkuId.skuId,
goodsId: this.goodsDetail.goodsId,
});
},
/**
@ -203,11 +209,9 @@ export default {
//
if (this.buyType) {
data.cartType = "PINTUAN";
}
else if(this.goodsDetail.goodsType == 'VIRTUAL_GOODS'){
data.cartType = "VIRTUAL";
}
else {
} else if (this.goodsDetail.goodsType == "VIRTUAL_GOODS") {
data.cartType = "VIRTUAL";
} else {
data.cartType = "BUY_NOW";
}

View File

@ -4,5 +4,5 @@ export default {
height:"1000rpx", //弹出层高度
mode:"bottom", //弹出层位置
radius:"32", //圆角 rpx,
close:false //能否点击遮罩退出
close:true //能否点击遮罩退出
}

View File

@ -34,14 +34,12 @@
height: 15px;
}
}
.scroll_mask{
height: 555px;
.scroll_mask {
height: 868rpx;
// padding-bottom: 100rpx;
overflow-y: auto;
}
.coupons {
padding-bottom: 200rpx !important;
}
.mask {
height: 600px;
}

View File

@ -7,11 +7,19 @@
<view v-if="prom.split('-')[0] == 'FULL_DISCOUNT'">
<div class="res_prom_item" v-if="res[prom].fullMinus">
<u-tag text="满减" type="error"></u-tag>
<span class="proText">{{ res[prom].fullMoney }}立减现金 <span class="price">{{ res[prom].fullMinus}}</span></span>
<!-- TODO 后续将优化为可点击的商品以及优惠券显示明细 -->
<span class="pro-text">{{ res[prom].fullMoney }} 立减现金 <span class="price">{{ res[prom].fullMinus}}</span>
<span v-if="res[prom].isCoupon"> <span>优惠券</span></span>
<span v-if="res[prom].isPoint"> {{res[prom].point}}</span>
<span v-if="res[prom].isGift"> </span>
<span v-if="res[prom].isFreeFreight"></span>
</span>
</div>
<div class="res_prom_item" v-if="res[prom].fullRate">
<u-tag text="打折" type="error"></u-tag>
<span class="proText">{{ res[prom].fullMoney }}立享<span class="price">{{ res[prom].fullRate }}</span>优惠</span>
<span class="pro-text">{{ res[prom].fullMoney }}立享<span
class="price">{{ res[prom].fullRate }}</span>优惠</span>
</div>
</view>
@ -19,14 +27,15 @@
<div class="res_prom_item" v-if="res[prom].requiredNum">
<u-tag text="拼团" type="error"></u-tag>
<span class="proText">{{ res[prom].requiredNum }}人拼团 限购<span class="price">{{ res[prom].limitNum}}</span></span>
<span class="pro-text">{{ res[prom].requiredNum }}人拼团 限购<span
class="price">{{ res[prom].limitNum}}</span></span>
</div>
</view>
<view v-if="prom.split('-')[0] == 'SECKILL'">
<div class="res_prom_item">
<u-tag text="限时抢购" type="error"></u-tag>
<span class="proText">限时抢购</span>
<span class="pro-text">限时抢购</span>
</div>
</view>
</view>
@ -68,13 +77,16 @@ export default {
};
</script>
<style lang="scss" scoped>
.proText {
.pro-text {
font-size: 26rpx;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: 400;
text-align: left;
color: #333333;
margin-left: 20rpx;
> span {
margin-right: 15rpx;
}
}
.wrapper {

View File

@ -16,7 +16,22 @@ page {
border-radius: 200px;
line-height: 18rpx;
}
.header-title{
font-weight: bold;
color: #333;
text-align: center;
height: 90rpx;
line-height: 90rpx;
font-size: 34rpx;
}
.cuxiao-title{
color: #999;
font-size: 24rpx;
}
.cuxiao{
padding:16rpx 32rpx;
}
.detail-btn {
display: flex;
align-items: center;
@ -326,50 +341,6 @@ page {
width: 100%;
height: 100%;
}
/* 弹出层 */
.popup {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: -1px;
z-index: 9;
background: rgba(0, 0, 0, 0.5);
.mask {
position: absolute;
left: 0;
top: 30%;
right: 0;
bottom: 0;
background: #fff;
.title {
position: relative;
height: 90rpx;
line-height: 90rpx;
font-size: 32rpx;
text-align: center;
border-bottom: 1px solid #f2f2f2;
span {
position: absolute;
right: 30rpx;
font-size: 40rpx;
}
}
.con-cuxiao {
padding: 30rpx 30rpx 0 30rpx;
> text {
font-size: 26rpx;
color: #999;
}
}
}
}
}
.u-mode-light-error {

View File

@ -1,14 +1,13 @@
<template>
<div class="wrapper">
<!-- 楼层装修组件 -->
<tpl />
<tpl ref="tpl" />
</div>
</template>
<script>
import tpl from "@/pages/tabbar/home/views.vue";
export default {
data() {
return {
background: {
@ -16,13 +15,16 @@ export default {
},
};
},
onPullDownRefresh() {
this.$refs.tpl.init();
uni.stopPullDownRefresh();
},
components: {
tpl,
},
};
</script>
<style lang="scss" scoped>
</style>

View File

@ -108,6 +108,7 @@ export default {
* 实例化首页数据楼层
*/
init() {
this.pageData = ""
getFloorData().then((res) => {
if (res.data.success) {
this.pageData = JSON.parse(res.data.result.pageData);