11
This commit is contained in:
@@ -52,14 +52,14 @@
|
||||
<view class="title"> {{ listinfo.name }} </view>
|
||||
<view class="list_item" v-for="(item,index) in listinfo.details" :key="item.id">
|
||||
<view class="left">
|
||||
<image class="img" :src="item.coverImg" mode="aspectFill"/>
|
||||
<image class="img" :src="item.coverImg || item.productImg || ''" mode="aspectFill"/>
|
||||
<view class="center">
|
||||
<text class="center_title"> {{item.name}} </text>
|
||||
<text class="type"> {{ item.skuName}} </text>
|
||||
<text class="num"> X{{ item.totalNumber}} </text>
|
||||
<text class="center_title"> {{item.name || item.productName || "" }} </text>
|
||||
<text class="type"> {{ item.skuName || item.productSkuName || ""}} </text>
|
||||
<text class="num"> X{{ item.totalNumber || item.num}} </text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="price"> ¥{{ item.totalAmount}} </view>
|
||||
<view class="price"> ¥{{ item.totalAmount || item.priceAmount || 0}} </view>
|
||||
</view>
|
||||
<!-- <view class="favorable" v-for="(item,index) in favorable" :key="index">
|
||||
<view class="favorable_left">
|
||||
@@ -122,7 +122,7 @@
|
||||
<view class="pay-info-wrap">
|
||||
<view class="info-wrap flex-between">
|
||||
<view class="close" @click="ispws = false">
|
||||
<u-icon name="close" color="#999999" size="28"></u-icon>
|
||||
<u-icon name="close" color="#999999" size="40"></u-icon>
|
||||
</view>
|
||||
<text class="title">请输入支付密码</text>
|
||||
<view></view>
|
||||
@@ -242,6 +242,9 @@
|
||||
switch (msg.type) {
|
||||
case 'createOrder':
|
||||
this.listinfoid = msg.data.id
|
||||
console.log(msg)
|
||||
this.listinfo.details = msg.data.detailList;
|
||||
this.listinfo.payAmount = msg.data.amount;
|
||||
uni.$off('getMessage')
|
||||
this.orderorderInfo(1)
|
||||
break;
|
||||
@@ -968,7 +971,7 @@
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
.info-wrap{
|
||||
padding: 30rpx;
|
||||
padding: 64rpx 30rpx 30rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
.title{
|
||||
align-self: center;
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 占位符导航栏 -->
|
||||
<!-- 占位符 接口请求完毕才显示 -->
|
||||
<view v-if="fixedtrue"
|
||||
style="height: 100vh; width: 100%; position: fixed; z-index: 999; top: 0; left: 0; background-color: #fff; display: flex; justify-content: center; align-items: center;">
|
||||
<image style="width: 140rpx; height: 140rpx;" src="@/static/1.gif" mode="aspectFill"></image>
|
||||
<text style="margin-left:10rpx;font-size: 40rpx;color: #7d7d76;">加载中</text>
|
||||
</view>
|
||||
<!-- 顶部面板 -->
|
||||
<view class="top--panel">
|
||||
<navseat :opacity='opacity' :titleshow='true' :heightshow='opacity' @Topdistance='Topdistance'></navseat>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view v-show="isNavShow" :style="{'height':HeighT.customBar+HeighT.heightBar+'px;background-color: #fff;position: fixed;top: 0;left: 0;width: 100%;z-index: 999'}"></view>
|
||||
<!-- #endif -->
|
||||
<navseat :opacity='opacity' :titleshow='true' :heightshow='opacity'></navseat>
|
||||
<!-- 顶部面板,可添加所需要放在页面顶部的内容代码。比如banner图 -->
|
||||
<!-- https://czg-qr-order.oss-cn-beijing.aliyuncs.com/orderfood/shuangyu1.png -->
|
||||
<image class="panelimgbackground"
|
||||
:src="shopInfo.storeInfo.coverImg"
|
||||
mode="aspectFill">
|
||||
<image class="panelimgbackground" :src="shopInfo.storeInfo.coverImg" mode="aspectFill">
|
||||
</image>
|
||||
<view class="panelone">
|
||||
{{ shopInfo.storeInfo.shopName }}
|
||||
@@ -32,9 +31,10 @@
|
||||
本店招牌菜
|
||||
</view>
|
||||
<view class="panelfive">
|
||||
<scroll-view :scroll-x="panelfiveShow" :scroll-into-view="leftIntoView" :scroll-with-animation="false">
|
||||
<scroll-view :scroll-x="true" :scroll-into-view="leftIntoView" :scroll-with-animation="false">
|
||||
<view class="panelfive_list">
|
||||
<view class="panelfiveitem" @click="clickspecifications(item,index,index,'热销')" v-for="(item,index) in shopProductList.hots" :key="index">
|
||||
<view class="panelfiveitem" @click="clickspecifications(item,index,index,'热销')"
|
||||
v-for="(item,index) in shopProductList.hots" :key="index">
|
||||
<image class="panelfiveitemimage" :src="item.coverImg" mode="aspectFill"></image>
|
||||
<view class="panelfiveitemone">
|
||||
{{ item.name }}
|
||||
@@ -65,10 +65,12 @@
|
||||
<view class="sku-wrap flex-center" v-if="item.productSkuResult != null"
|
||||
@click.stop="clickspecifications(item,index,index1)">
|
||||
<text class="t">选规格</text>
|
||||
<text class="dot num" v-if="item.cartNumber != '0'">{{item.cartNumber<99?item.cartNumber:'99+'}}</text>
|
||||
<text class="dot num"
|
||||
v-if="item.cartNumber != '0'">{{item.cartNumber<99?item.cartNumber:'99+'}}</text>
|
||||
</view>
|
||||
<view class="Controls" v-else>
|
||||
<view v-if="item.cartNumber != '0'" @click.stop="cartadd(item,'-',item.productSkuResult == null ? '单规格':'',$event)">
|
||||
<view v-if="item.cartNumber != '0'"
|
||||
@click.stop="cartadd(item,'-',item.productSkuResult == null ? '单规格':'',$event)">
|
||||
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
|
||||
</view>
|
||||
<text class="num"> {{ item.cartNumber }} </text>
|
||||
@@ -91,40 +93,51 @@
|
||||
:scroll-into-view="leftIntoView" :scroll-with-animation="false">
|
||||
<view class="item" v-for="(item,index) in shopProductList.productInfo" :key="index"
|
||||
:class="{ 'active':index==leftIndex }" :id="'left-'+index" :data-index="index"
|
||||
@tap="leftTap($event,index)">{{item.name}}</view>
|
||||
@tap="leftTap">{{item.name}}</view>
|
||||
<view class="items"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="main">
|
||||
<scroll-view :scroll-y="!isFixed" :scroll-top="scrollHeight" :style="{ 'height':scrollHeight + 'px' }" @scroll="mainScroll"
|
||||
:scroll-into-view="scrollInto" :scroll-with-animation="true">
|
||||
<view class="item main-item" v-for="(item,index) in shopProductList.productInfo" :key="index" :id="'item-'+index">
|
||||
<scroll-view :scroll-y="!isFixed" :scroll-top="scrollHeight"
|
||||
:style="{ 'height':scrollHeight + 'px' }" @scroll="mainScroll" :scroll-into-view="scrollInto"
|
||||
:scroll-with-animation="false">
|
||||
<view class="item main-item" v-for="(item,index) in shopProductList.productInfo" :key="index"
|
||||
:id="'item-'+index">
|
||||
<view class="title">
|
||||
<view>{{item.name}}</view>
|
||||
</view>
|
||||
<view class="goods" @click="clickspecifications(item1,index,index1)" v-for="(item1,index1) in item.products" :key="index1">
|
||||
<image class="goodsImg" v-if="item1.coverImg!=null" :lazy-load="true" :src="`${item1.coverImg}?x-oss-process=image/resize,m_lfit,w_90,h_90`"></image>
|
||||
<view class="goods" @click="clickspecifications(item1,index,index1)"
|
||||
v-for="(item1,index1) in item.products" :key="index1">
|
||||
<image class="goodsImg" v-if="item1.coverImg!=null" :lazy-load="true"
|
||||
:src="`${item1.coverImg}?x-oss-process=image/resize,m_lfit,w_90,h_90`"></image>
|
||||
<image class="goodsImg" src="@/static/1.gif" mode="" v-else :lazy-load="true"></image>
|
||||
<view v-if="item.name=='热销'" class="topSort" :class="'c'+(index1+1)">TOP{{index1+1}}</view>
|
||||
<view v-if="item.name=='热销'" class="topSort" :class="'c'+(index1+1)">TOP{{index1+1}}
|
||||
</view>
|
||||
<view class="goods_right">
|
||||
<view class="name">{{ item1.name }}</view>
|
||||
<view class="lookBack" v-if="item.name=='热销'">本店回头客第{{index1+1}}名</view>
|
||||
<view class="describe"> {{item1.shortTitle?item1.shortTitle:''}} </view>
|
||||
<view class="monthlySale">月售{{item1.stockNumber}}</view>
|
||||
<view class="money">¥<text class="money_num">{{ item1.lowPrice }}</text>/份<text class="suit">「{{item1.suit}}份起点」</text></view>
|
||||
<view class="money">¥<text class="money_num">{{ item1.lowPrice }}</text>/份<text
|
||||
class="suit">「{{item1.suit}}份起点」</text></view>
|
||||
|
||||
<view class="flex-end" v-if="item1.productSkuResult != null">
|
||||
<view class="sku-wrap flex-center" @click.stop="clickspecifications(item1,index,index1)">
|
||||
<view class="sku-wrap flex-center"
|
||||
@click.stop="clickspecifications(item1,index,index1)">
|
||||
<text class="t">选规格</text>
|
||||
<text class="dot num" v-if="item1.cartNumber != '0'">{{item1.cartNumber<99?item1.cartNumber:'99+'}}</text>
|
||||
<text class="dot num"
|
||||
v-if="item1.cartNumber != '0'">{{item1.cartNumber<99?item1.cartNumber:'99+'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="Controls" v-else>
|
||||
<view v-if="item1.cartNumber != '0'" @click.stop="cartadd(item1,'-',item1.productSkuResult == null ? '单规格':'',$event)">
|
||||
<view v-if="item1.cartNumber != '0'"
|
||||
@click.stop="cartadd(item1,'-',item1.productSkuResult == null ? '单规格':'',$event)">
|
||||
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
|
||||
</view>
|
||||
<text class="num"> {{ item1.cartNumber }} </text>
|
||||
<view @click.stop="cartadd(item1,'+',item1.productSkuResult == null ? '单规格':'')">
|
||||
<view
|
||||
@click.stop="cartadd(item1,'+',item1.productSkuResult == null ? '单规格':'')">
|
||||
<u-icon name="plus-circle-fill" color="#E9AB7A" size="50"></u-icon>
|
||||
</view>
|
||||
|
||||
@@ -137,20 +150,14 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部面板 底部面板,可添加所需要放在页面底部的内容代码。比如购物车栏目 -->
|
||||
<!-- <view class="bottom-panel">
|
||||
<view style="background-color: #ffaa00;text-align: center;font-size: 28rpx;padding: 10px 0;color: #fff;">
|
||||
<view>这里底部内容占位区域,不需要则删除</view>
|
||||
<view>可添加需放在页面底部的内容,比如购物车栏目</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 购物车悬浮条 -->
|
||||
<view class="cart-wrap" v-if="cartListsdatashow">
|
||||
<view class="cart-content">
|
||||
<view class="left">
|
||||
<view class="iconBox">
|
||||
<image class="icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/shopIcon.png"
|
||||
<image class="icon"
|
||||
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/shopIcon.png"
|
||||
mode="aspectFill" @click="showCart = !showCart">
|
||||
</image>
|
||||
<text class="u-badge"> {{cartLists_count<99?cartLists_count:'99+'}} </text>
|
||||
@@ -166,7 +173,8 @@
|
||||
</view>
|
||||
|
||||
<!-- 购物车 -->
|
||||
<u-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }" @close="showCart = false">
|
||||
<u-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
|
||||
@close="showCart = false">
|
||||
<view class="cart-list-wrap">
|
||||
<view class="cart-header flex-between">
|
||||
<view class="num">已点 {{cartLists_count}} 份</view>
|
||||
@@ -222,7 +230,8 @@
|
||||
<view class="row" style="margin-bottom: 20rpx;">
|
||||
<view class="col">
|
||||
<text class="l">营业时间:</text>
|
||||
<text class="t">{{ shopInfo.storeInfo.businessStartDay +'至'+ shopInfo.storeInfo.businessEndDay +' '+ shopInfo.storeInfo.businessTime }}</text>
|
||||
<text
|
||||
class="t">{{ shopInfo.storeInfo.businessStartDay +'至'+ shopInfo.storeInfo.businessEndDay +' '+ shopInfo.storeInfo.businessTime }}</text>
|
||||
</view>
|
||||
<view class="col">
|
||||
<text class="l">商家地址:</text>
|
||||
@@ -244,7 +253,6 @@
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
|
||||
<!-- 规格 -->
|
||||
<u-popup :show="showShopsku" :round="20" mode="bottom" @close="showShopsku = false"
|
||||
:safeAreaInsetBottom='false'>
|
||||
@@ -254,7 +262,8 @@
|
||||
</view>
|
||||
<image class="shop_skucimage" :src="specifications.coverImg" mode="aspectFill"></image>
|
||||
<view class="shop_sku_name"> {{specifications.name}} </view>
|
||||
<view class="shop_sku_returned" v-if="specifications.typeName&&specifications.typeName=='热销'"> 本店回头客第{{specifications.indexb+1}}名 </view>
|
||||
<view class="shop_sku_returned" v-if="specifications.typeName&&specifications.typeName=='热销'">
|
||||
本店回头客第{{specifications.indexb+1}}名 </view>
|
||||
<view class="shop_sku_description"> {{specifications.shortTitle?specifications.shortTitle:''}} </view>
|
||||
|
||||
<view class="shop_sku_box" v-for="(item,index) in specifications.tagSnap" :key="index"
|
||||
@@ -283,19 +292,21 @@
|
||||
|
||||
<view class="btn"
|
||||
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'-',specifications.tagSnap == null ? '单规格':'')">
|
||||
<u-icon name="minus-circle-fill" color="#E9AB7A" size="40"></u-icon>
|
||||
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
|
||||
</view>
|
||||
<text class="num">{{amountcartNumber}}</text>
|
||||
<view class="btn"
|
||||
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">
|
||||
<u-icon name="plus-circle-fill" color="#E9AB7A" size="40"></u-icon>
|
||||
<u-icon name="plus-circle-fill" color="#E9AB7A" size="50"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="shop_skuselect flex-start" v-if="specifications.tagSnap">
|
||||
<view class="shop_skuselectname">{{skuidname.toString()}}</view>
|
||||
</view>
|
||||
<view class="addShopping" :class="amountcartNumber>0?'active':''" @click="addShopping(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">添加到购物车</view>
|
||||
<view class="addShopping" :class="amountcartNumber>0?'active':''"
|
||||
@click="addShopping(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">
|
||||
添加到购物车</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
@@ -311,6 +322,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fixedtrue: true,
|
||||
userInfo: uni.cache.get('userInfo'), //个人信息
|
||||
opacity: false, //是否显示
|
||||
scrollHeight: 1000,
|
||||
@@ -322,53 +334,47 @@
|
||||
leftIndex: 0,
|
||||
scrollInto: '',
|
||||
isFixed: true,
|
||||
isNavShow: false,
|
||||
heightnav: '' ,//点击获取的距离
|
||||
showShopInfo: false, //店铺信息弹窗是否显示
|
||||
showShopsku: false, //多规格弹窗是否显示
|
||||
skuId: null, // 多规格ID
|
||||
cartLists: {}, //购物车
|
||||
cartLists_count: 0,
|
||||
shopInfo: {}, //店铺信息
|
||||
panelfiveShow: false,
|
||||
shopProductList: {
|
||||
|
||||
}, //商品信息
|
||||
shopProductList: {}, //商品信息
|
||||
specifications: {
|
||||
|
||||
}, // 规格信息
|
||||
socketTicket: null,
|
||||
amountcartNumber: 0,
|
||||
skuNumber: 0,
|
||||
skuSuit: 0,
|
||||
salePrice: '', //钱数
|
||||
cartListsdatashow: false, //是否显示购物车
|
||||
showCart: false,
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
try {
|
||||
if (e.scrollTop <= 44) { //搜索导航栏显示影藏
|
||||
this.isNavShow = false
|
||||
this.opacity = false
|
||||
} else {
|
||||
this.isNavShow = true
|
||||
this.opacity = true
|
||||
}
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
console.log(e.scrollTop,this.scrollTopSize)
|
||||
if (e.scrollTop >= this.scrollTopSize) { //控制大图层
|
||||
this.$u.debounce(() => {
|
||||
if (e.scrollTop + 20 >= this.scrollTopSize) { //控制大图层
|
||||
this.isFixed = false;
|
||||
} else {
|
||||
this.isFixed = true;
|
||||
}
|
||||
}, 10)
|
||||
|
||||
},
|
||||
computed: {
|
||||
/* 计算左侧滚动位置定位 */
|
||||
leftIntoView() {
|
||||
return `left-${this.leftIndex > 20 ? (this.leftIndex-20):0}`;
|
||||
return `left-${this.leftIndex? this.leftIndex:0}`;
|
||||
},
|
||||
HeighT() { //手机类型的尺寸
|
||||
return this.$store.getters.is_BarHeight
|
||||
HeighT() { //手机类型的尺寸 导航栏高度
|
||||
return this.$store.getters.is_BarHeight.heightBar + this.$store.getters.is_BarHeight.customBar
|
||||
},
|
||||
},
|
||||
onReady() {
|
||||
@@ -378,10 +384,7 @@
|
||||
this.scrollHeight = data.windowHeight
|
||||
}
|
||||
})
|
||||
this.panelfiveShow = true;
|
||||
}, 100);
|
||||
/* 在非H5平台,nextTick回调后有概率获取到错误的元素高度,则添加200ms的延迟来减少BUG的产生 */
|
||||
|
||||
},
|
||||
onLoad(e) {
|
||||
if (e.q) {
|
||||
@@ -459,9 +462,9 @@
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.cache.set('shopUser', res.data.storeInfo.id)
|
||||
this.handlemessage() //监听websocket返回
|
||||
this.shopInfo = res.data;
|
||||
this.productqueryProduct() //list 数据
|
||||
this.handlemessage() //监听websocket返回
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.pro.switchTab('index/index')
|
||||
@@ -515,8 +518,8 @@
|
||||
*/
|
||||
shopAdd(item, index, index1, a, b) {
|
||||
if ( a == "+" ){
|
||||
if ( this.amountcartNumber <= 0) {
|
||||
this.amountcartNumber = this.amountcartNumber + item.suit;
|
||||
if ( this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
|
||||
this.amountcartNumber = this.amountcartNumber + (item.suit==0?1:item.suit);
|
||||
}else {
|
||||
this.amountcartNumber++;
|
||||
}
|
||||
@@ -524,8 +527,8 @@
|
||||
|
||||
if (this.amountcartNumber > 0) {
|
||||
console.log(item)
|
||||
if ( this.amountcartNumber <= item.suit) {
|
||||
this.amountcartNumber = this.amountcartNumber - item.suit
|
||||
if ( this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
|
||||
this.amountcartNumber = this.amountcartNumber - (item.suit==0?1:item.suit);
|
||||
} else {
|
||||
this.amountcartNumber = this.amountcartNumber - 1;
|
||||
}
|
||||
@@ -537,7 +540,6 @@
|
||||
* 添加购物车
|
||||
*/
|
||||
addShopping(item, index, index1, a, b) {
|
||||
console.log(item)
|
||||
if (this.amountcartNumber <= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -641,12 +643,10 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
this.cartListsdatashow = this.cartLists.data.length == 0 ? false : true;
|
||||
console.log(this.cartLists)
|
||||
this.cartListsdatashow = this.cartLists.data.length == 0 ? false : true
|
||||
if (this.cartLists.data.length > 0) {
|
||||
this.cartLists_count = 0;
|
||||
this.cartLists.data.forEach((v, e) => {
|
||||
console.log(v)
|
||||
this.cartLists_count += v.number;
|
||||
})
|
||||
}
|
||||
@@ -658,7 +658,6 @@
|
||||
* @param {Object} index1
|
||||
*/
|
||||
clickspecifications(item1, index, index1, type) {
|
||||
console.log(item1)
|
||||
this.skuidname = []
|
||||
this.specifications = item1
|
||||
this.specifications.indexa = index
|
||||
@@ -718,13 +717,6 @@
|
||||
productId: item.id, //商品id
|
||||
spec_tag: this.skuidname.join(",")
|
||||
})
|
||||
if (res.data.stockNumber == 0) {
|
||||
uni.showToast({
|
||||
title: '暂无库存',
|
||||
icon: "none",
|
||||
})
|
||||
} else {
|
||||
this.skuidsearch = res.data.id // 储存skuid 用于筛选数量
|
||||
this.salePrice = res.data.salePrice // 价格
|
||||
let data = null;
|
||||
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
|
||||
@@ -741,10 +733,10 @@
|
||||
} else {
|
||||
this.skuId = res.data.id;
|
||||
this.skuNumber = res.data.number;
|
||||
this.skuSuit = res.data.suit;
|
||||
this.showShopsku = true //打开弹框
|
||||
}
|
||||
this.$set(this, 'amountcartNumber', 0)
|
||||
}
|
||||
} catch (e) {}
|
||||
},
|
||||
|
||||
@@ -781,7 +773,6 @@
|
||||
* @param {Object} msg
|
||||
*/
|
||||
getMessage(msg) { //wss 回显数据
|
||||
console.log(msg.type)
|
||||
if (msg == 1) { // 网络在连接
|
||||
this.fixedtrue = true
|
||||
return false
|
||||
@@ -807,9 +798,12 @@
|
||||
case 'sku': // sku 数量 查询这个商品的价格和数量
|
||||
break;
|
||||
case 'order':
|
||||
this.skuidname = []
|
||||
this.showCart = false
|
||||
this.cartLists = msg
|
||||
this.cartLists_count = 0;
|
||||
this.skuidname = [];
|
||||
this.cartListsdatashow = false;
|
||||
this.showCart = false;
|
||||
this.cartLists = msg;
|
||||
this.productqueryProduct() //list 数据
|
||||
break;
|
||||
case 'addCart': //初始化add
|
||||
this.cartLists = msg
|
||||
@@ -841,61 +835,74 @@
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 导航栏高度 去计算列表页的高度
|
||||
Topdistance(e) {
|
||||
this.heightnav = e ////导航栏高度
|
||||
},
|
||||
|
||||
/* 获取元素顶部信息 */
|
||||
getElementTop() {
|
||||
new Promise((resolve, reject) => {
|
||||
let view = uni.createSelectorQuery().selectAll('.main-item');
|
||||
view.boundingClientRect(data => {
|
||||
view.boundingClientRect(async data => {
|
||||
resolve(data);
|
||||
}).exec();
|
||||
this.$u.getRect('.scroll-panel').then(res => {
|
||||
console.log(res)
|
||||
this.scrollTopSize = res.top - this.heightnav; //元素距离顶部的距离
|
||||
this.scrollHeight = this.scrollHeight - this.heightnav
|
||||
this.scrollTopSize = res.top; //元素距离顶部的距离
|
||||
})
|
||||
}).then((res) => {
|
||||
let topArr = res.map((item) => {
|
||||
return item.top - this.scrollTopSize; /* 减去滚动容器距离顶部的距离 */
|
||||
return item.top; /* 减去滚动容器距离顶部的距离 加导航栏高度*/
|
||||
});
|
||||
this.scrollHeight = this.scrollHeight - this.HeighT
|
||||
this.topArr = topArr;
|
||||
|
||||
/* 获取最后一项的高度,设置填充高度。判断和填充时做了 +-20 的操作,是为了滚动时更好的定位 */
|
||||
let last = res[res.length - 1].height;
|
||||
if (last - 20 < this.scrollHeight) {
|
||||
this.fillHeight = this.scrollHeight - last + 20;
|
||||
this.fillHeight = this.scrollHeight - last + 20; //这是吸到顶部的距离
|
||||
// this.fillHeight = 200;
|
||||
}
|
||||
});
|
||||
},
|
||||
/* 主区域滚动监听 */
|
||||
mainScroll(e) {
|
||||
console.log(e)
|
||||
// 节流方法
|
||||
clearTimeout(this.mainThrottle);
|
||||
this.mainThrottle = setTimeout(() => {
|
||||
scrollFn();
|
||||
}, 10);
|
||||
|
||||
let scrollFn = () => {
|
||||
let top = e.detail.scrollTop;
|
||||
let index = 0;
|
||||
/* 查找当前滚动距离 */
|
||||
for (let i = (this.topArr.length - 1); i >= 0; i--) {
|
||||
/* 在部分安卓设备上,因手机逻辑分辨率与rpx单位计算不是整数,滚动距离与有误差,增加2px来完善该问题 */
|
||||
if ((top + 2) >= this.topArr[i] - this.scrollTopSize) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.leftIndex = (index < 0 ? 0 : index);
|
||||
}
|
||||
},
|
||||
/* 左侧导航点击 */
|
||||
leftTap(e,index) {
|
||||
try {
|
||||
this.leftIndex = (index < 0 ? 0 : index);
|
||||
if (this.isFixed) {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: this.scrollTopSize, //滑动需要的距离 nav+列表距离的高度
|
||||
duration: 100
|
||||
});
|
||||
this.isFixed = false
|
||||
leftTap(e) {
|
||||
let HeighTdata = null
|
||||
if (this.opacity) {
|
||||
HeighTdata = this.HeighT
|
||||
} else {
|
||||
HeighTdata = this.HeighT * 2
|
||||
}
|
||||
|
||||
console.log(this.scrollTopSize + HeighTdata, 11)
|
||||
try {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: this.scrollTopSize + HeighTdata, //滑动需要的距离 nav+列表距离的高度
|
||||
duration: 0
|
||||
});
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
let index = e.currentTarget.dataset.index;
|
||||
this.scrollInto = `item-${index}`;
|
||||
},)
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -915,9 +922,11 @@
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
|
||||
.navbarcontent .active {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
&>view {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -925,6 +934,7 @@
|
||||
.top--panel {
|
||||
padding: 0 20rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.panelimgbackground {
|
||||
width: 382rpx;
|
||||
margin: 82rpx auto 0 auto;
|
||||
@@ -981,15 +991,18 @@
|
||||
|
||||
.panelfive {
|
||||
width: 100%;
|
||||
|
||||
.panelfive_list {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.panelfiveitem {
|
||||
margin-top: 16rpx;
|
||||
width: 340rpx;
|
||||
margin-right: 30rpx;
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
|
||||
.panelfiveitemimage {
|
||||
border-radius: 20rpx 20rpx 0rpx 0rpx;
|
||||
width: 100%;
|
||||
@@ -1067,12 +1080,14 @@
|
||||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
text:nth-child(3) {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
text:nth-child(4) {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
@@ -1081,6 +1096,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.panelfiveitemNum {
|
||||
// position: absolute;
|
||||
// bottom: 82rpx;
|
||||
@@ -1089,6 +1105,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
|
||||
.sku-wrap {
|
||||
width: 138rpx;
|
||||
height: 54rpx;
|
||||
@@ -1096,10 +1113,12 @@
|
||||
border-radius: 32rpx;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
|
||||
.t {
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.dot {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
@@ -1119,6 +1138,7 @@
|
||||
.Controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.num {
|
||||
margin: 8rpx 8rpx 0 8rpx;
|
||||
}
|
||||
@@ -1135,17 +1155,15 @@
|
||||
|
||||
}
|
||||
|
||||
.bottom-panel {
|
||||
padding-bottom: 0;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.shop-info-wrap {
|
||||
padding: 0 30rpx 50rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.info-wrap {
|
||||
padding: 30rpx 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
.shopName {
|
||||
align-self: center;
|
||||
font-size: 32rpx;
|
||||
@@ -1153,21 +1171,26 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.info-wrap-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.row {
|
||||
.col {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.l,.t{
|
||||
|
||||
.l,
|
||||
.t {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.shop_sku {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
@@ -1176,6 +1199,7 @@
|
||||
overflow-y: auto;
|
||||
padding-bottom: 320rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.positionabsolute {
|
||||
position: absolute;
|
||||
top: 30rpx;
|
||||
@@ -1195,12 +1219,14 @@
|
||||
font-size: 32upx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.shop_sku_returned {
|
||||
padding: 0 $paddingSize;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #FF534B;
|
||||
}
|
||||
|
||||
.shop_sku_description {
|
||||
padding: 0 $paddingSize;
|
||||
font-weight: 400;
|
||||
@@ -1273,6 +1299,7 @@
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
|
||||
.price {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
@@ -1305,6 +1332,7 @@
|
||||
|
||||
|
||||
}
|
||||
|
||||
.addShopping {
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
@@ -1317,6 +1345,7 @@
|
||||
color: #FFFFFF;
|
||||
margin-top: 36rpx;
|
||||
}
|
||||
|
||||
.addShopping.active {
|
||||
background: #E8AD7B;
|
||||
}
|
||||
@@ -1341,19 +1370,23 @@
|
||||
border-radius: 58rpx;
|
||||
padding: 0 36rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.left {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
.iconBox {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 76rpx;
|
||||
height: 88rpx;
|
||||
margin-left: 22rpx;
|
||||
}
|
||||
|
||||
.u-badge {
|
||||
position: absolute;
|
||||
top: -30rpx;
|
||||
@@ -1396,6 +1429,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.t {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
@@ -1414,11 +1448,13 @@
|
||||
justify-content: space-between;
|
||||
padding: 20upx $paddingSize;
|
||||
border-radius: 20upx 20upx 0 0;
|
||||
|
||||
.num {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.clear {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -1439,6 +1475,7 @@
|
||||
.list-wrap {
|
||||
padding: $paddingSize 0 0 $paddingSize;
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
display: flex;
|
||||
padding-bottom: $paddingSize;
|
||||
@@ -1490,19 +1527,19 @@
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
|
||||
.i,.num{
|
||||
.i,
|
||||
.num {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.i {
|
||||
position: relative;
|
||||
bottom: 4upx;
|
||||
}
|
||||
|
||||
.num {
|
||||
|
||||
}
|
||||
.num {}
|
||||
}
|
||||
|
||||
.sku-wrap {
|
||||
@@ -1581,6 +1618,7 @@
|
||||
box-sizing: border-box;
|
||||
font-size: 32rpx;
|
||||
|
||||
// padding-bottom: 200rpx;
|
||||
.item {
|
||||
padding: 0 30rpx;
|
||||
height: 92rpx;
|
||||
@@ -1592,6 +1630,7 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
&+.item {
|
||||
margin-top: 1px;
|
||||
|
||||
@@ -1624,6 +1663,7 @@
|
||||
height: 100%;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
@@ -1640,6 +1680,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
.items {
|
||||
height: 180rpx;
|
||||
position: relative;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.fill-last {
|
||||
height: 0;
|
||||
width: 100%;
|
||||
@@ -1680,6 +1728,7 @@
|
||||
justify-content: flex-start;
|
||||
align-content: center;
|
||||
position: relative;
|
||||
|
||||
&+.goods {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
@@ -1690,12 +1739,14 @@
|
||||
margin-right: 18rpx;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.goodsImg {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 18rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.topSort {
|
||||
width: 92rpx;
|
||||
height: 38rpx;
|
||||
@@ -1710,12 +1761,15 @@
|
||||
border-radius: 20rpx 0rpx 20rpx 0rpx;
|
||||
|
||||
}
|
||||
|
||||
.topSort.c1 {
|
||||
background: #FC5C2E;
|
||||
}
|
||||
|
||||
.topSort.c2 {
|
||||
background: #EF994E;
|
||||
}
|
||||
|
||||
.topSort.c3 {
|
||||
background: #F4B951;
|
||||
}
|
||||
@@ -1728,6 +1782,7 @@
|
||||
padding-top: 5rpx;
|
||||
padding-right: 20rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
@@ -1735,19 +1790,24 @@
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.describe,.monthlySale,.lookBack {
|
||||
.describe,
|
||||
.monthlySale,
|
||||
.lookBack {
|
||||
font-weight: 400;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.describe,.name{
|
||||
|
||||
.describe,
|
||||
.name {
|
||||
width: 270rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
.lookBack {
|
||||
color: #FF534B;
|
||||
}
|
||||
@@ -1756,12 +1816,14 @@
|
||||
font-weight: bold;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
|
||||
.money_num {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.suit {
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
@@ -1778,10 +1840,12 @@
|
||||
// right: 20rpx;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
.t {
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.dot {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
@@ -1802,6 +1866,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
|
||||
// position: absolute;
|
||||
// bottom: 10rpx;
|
||||
// right: 20rpx;
|
||||
|
||||
@@ -289,12 +289,12 @@
|
||||
|
||||
<view class="btn"
|
||||
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'-',specifications.tagSnap == null ? '单规格':'')">
|
||||
<u-icon name="minus-circle-fill" color="#E9AB7A" size="40"></u-icon>
|
||||
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
|
||||
</view>
|
||||
<text class="num">{{amountcartNumber}}</text>
|
||||
<view class="btn"
|
||||
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">
|
||||
<u-icon name="plus-circle-fill" color="#E9AB7A" size="40"></u-icon>
|
||||
<u-icon name="plus-circle-fill" color="#E9AB7A" size="50"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -393,6 +393,7 @@
|
||||
this.fixedtrue = true
|
||||
},
|
||||
onShow() {
|
||||
console.log(!uni.cache.get('token'))
|
||||
if (!uni.cache.get('token')) {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
@@ -507,8 +508,9 @@
|
||||
*/
|
||||
shopAdd(item, index, index1, a, b) {
|
||||
if ( a == "+" ){
|
||||
if (this.skuNumber < this.skuSuit) {
|
||||
this.amountcartNumber = this.amountcartNumber + (item.suit == 0 ? 1 : item.suit);
|
||||
|
||||
if ( this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
|
||||
this.amountcartNumber = this.amountcartNumber + (this.skuSuit==0?1:this.skuSuit);
|
||||
}else {
|
||||
this.amountcartNumber++;
|
||||
}
|
||||
@@ -516,8 +518,8 @@
|
||||
|
||||
if (this.amountcartNumber > 0) {
|
||||
console.log(item)
|
||||
if (this.skuNumber < this.skuSuit) {
|
||||
this.amountcartNumber = this.amountcartNumber - (item.suit == 0 ? 1 : item.suit);
|
||||
if ( this.skuNumber < this.skuSuit && this.amountcartNumber <= this.skuSuit) {
|
||||
this.amountcartNumber = this.amountcartNumber - (this.skuSuit==0?1:this.skuSuit);
|
||||
} else {
|
||||
this.amountcartNumber = this.amountcartNumber - 1;
|
||||
}
|
||||
@@ -721,7 +723,7 @@
|
||||
this.addCart(params);
|
||||
} else {
|
||||
this.skuId = res.data.id;
|
||||
this.skuNumber = res.data.number;
|
||||
this.skuNumber = res.data.number||0;
|
||||
this.skuSuit = res.data.suit;
|
||||
this.showShopsku = true //打开弹框
|
||||
}
|
||||
@@ -785,9 +787,12 @@
|
||||
case 'sku': // sku 数量 查询这个商品的价格和数量
|
||||
break;
|
||||
case 'order':
|
||||
this.skuidname = []
|
||||
this.showCart = false
|
||||
this.cartLists = msg
|
||||
this.cartLists_count = 0;
|
||||
this.skuidname = [];
|
||||
this.cartListsdatashow = false;
|
||||
this.showCart = false;
|
||||
this.cartLists = msg;
|
||||
this.productqueryProduct() //list 数据
|
||||
break;
|
||||
case 'addCart': //初始化add
|
||||
this.cartLists = msg
|
||||
|
||||
Reference in New Issue
Block a user