|
|
|
@ -2,7 +2,8 @@ |
|
|
|
<!-- 拼团单一商家 --> |
|
|
|
<view class="page1"> |
|
|
|
<!-- 固定顶部导航栏(悬浮在背景图之上) --> |
|
|
|
<view class="nav-bar" :style="{'padding-top': menuButtonInfo.top +'px','background':lastScrollTop>200?'#fff':''}"> |
|
|
|
<view class="nav-bar" |
|
|
|
:style="{'padding-top': menuButtonInfo.top +'px','background':lastScrollTop>200?'#fff':''}"> |
|
|
|
<view class="back-btn" @tap="back"> |
|
|
|
<uni-icons type="left" size="28"></uni-icons> |
|
|
|
</view> |
|
|
|
@ -81,14 +82,19 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 分类栏:移到goods-list外层,position:sticky才能生效 --> |
|
|
|
<view class="menu-list" id="menuList" :style="{'top': navBarHeight + 'px','background':lastScrollTop>200?'#fff':''}"> |
|
|
|
<view class="menu1" @tap="checkTab(index)" v-for="(item,index) in menuList" :key="index" :style="{'font-size':item.checked?'40rpx':'30rpx','color':item.checked?'rgba(0, 35, 28, 1)':'#777'}"> |
|
|
|
<view class="menu-list" id="menuList" |
|
|
|
:style="{'top': navBarHeight + 'px','background':lastScrollTop>200?'#fff':''}"> |
|
|
|
<view class="menu1" @tap="checkTab(index)" v-for="(item,index) in menuList" :key="index" |
|
|
|
:style="{'font-size':item.checked?'40rpx':'30rpx','color':item.checked?'rgba(0, 35, 28, 1)':'#777'}"> |
|
|
|
<view style="width: 90px;">{{item.categoryName}}</view> |
|
|
|
<img v-if="item.checked" class="checked-img" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4bb5fc7725cb4a7a84d1d3a15f05b39c.png" alt="" /> |
|
|
|
<img v-if="item.checked" class="checked-img" |
|
|
|
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4bb5fc7725cb4a7a84d1d3a15f05b39c.png" |
|
|
|
alt="" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="goods-list"> |
|
|
|
<view class="goods-member" v-for="(item,index) in productItem" :key="index" @tap="goDetail('product',item)"> |
|
|
|
<view class="goods-member" v-for="(item,index) in productItem" :key="index" |
|
|
|
@tap="goDetail('product',item)"> |
|
|
|
<view class="goods-top"> |
|
|
|
<view class="goods-img"> |
|
|
|
<img :src="item.productPicture" alt="" style="border-radius: 10px;"> |
|
|
|
@ -139,13 +145,15 @@ |
|
|
|
<view style="width: 100%;height: 160rpx;"></view> |
|
|
|
<view class="bottom"> |
|
|
|
<view class="bottom-left"> |
|
|
|
<view style="position: relative;width: 60rpx;height: 80rpx;margin-top: 20rpx;" @tap="openPopup('car','','')"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/60db52398a65459e9541881c926986a4.png" alt="" /> |
|
|
|
<view style="position: relative;width: 60rpx;height: 80rpx;margin-top: 20rpx;" |
|
|
|
@tap="openPopup('car','','')"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/60db52398a65459e9541881c926986a4.png" |
|
|
|
alt="" /> |
|
|
|
<view class="bottom-dot" v-if="cartTotalCount > 0">{{cartTotalCount}}</view> |
|
|
|
</view> |
|
|
|
<view class="bottom-price">¥{{cartTotalPrice}}</view> |
|
|
|
</view> |
|
|
|
<view class="bottom-right" @tap="submitCartCheckout"> |
|
|
|
<view class="bottom-right" @tap="submitCartCheckout"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d93d893296ed46ea99cfd0e8e2835eaa.png" alt="" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -162,9 +170,11 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<scroll-view scroll-y style="max-height: 400rpx;"> |
|
|
|
<view class="goods-top" style="padding: 10px 0;" v-for="(cartItem, index) in cartItems" :key="index"> |
|
|
|
<view class="goods-top" style="padding: 10px 0;" v-for="(cartItem, index) in cartItems" |
|
|
|
:key="index"> |
|
|
|
<view class="goods-img" style="width: 120rpx;height: 120rpx;"> |
|
|
|
<img :src="cartItem.item.productPicture" alt="" style="border-radius: 10px;width:100%;height:100%;"> |
|
|
|
<img :src="cartItem.item.productPicture" alt="" |
|
|
|
style="border-radius: 10px;width:100%;height:100%;"> |
|
|
|
</view> |
|
|
|
<view class="goods-content" style="padding-left: 20rpx;"> |
|
|
|
<view class="goods-name"> |
|
|
|
@ -172,15 +182,18 @@ |
|
|
|
</view> |
|
|
|
<view class="goods-content-center"> |
|
|
|
<view class="goods-deal1" v-if="cartItem.specs"> |
|
|
|
<text style="color: #999; font-size: 20rpx;">已选规格: {{getSpecDisplayString(cartItem.specs)}}</text> |
|
|
|
<text style="color: #999; font-size: 20rpx;">已选规格: |
|
|
|
{{getSpecDisplayString(cartItem.specs)}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="goods-content-bottom" style="margin-top: 10rpx;"> |
|
|
|
<view style="font-size: 28rpx;line-height: 54rpx;margin-right: 20rpx;flex: 1;color: red;"> |
|
|
|
<view |
|
|
|
style="font-size: 28rpx;line-height: 54rpx;margin-right: 20rpx;flex: 1;color: red;"> |
|
|
|
¥{{cartItem.price}} |
|
|
|
</view> |
|
|
|
<view class="goods-num"> |
|
|
|
<view class="num-plus" style="background: #999;color: #fff;" @tap="adjustCart(cartItem.cartId, -1)"> |
|
|
|
<view class="num-plus" style="background: #999;color: #fff;" |
|
|
|
@tap="adjustCart(cartItem.cartId, -1)"> |
|
|
|
- |
|
|
|
</view> |
|
|
|
<view class="num"> |
|
|
|
@ -199,25 +212,29 @@ |
|
|
|
<view class="bottom" style="padding-bottom: 10px;"> |
|
|
|
<view class="bottom-left"> |
|
|
|
<view style="width: 60rpx;height: 80rpx;margin-top: 10rpx;" @tap="$refs.carPopup.close()"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/60db52398a65459e9541881c926986a4.png" alt="" /> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/60db52398a65459e9541881c926986a4.png" |
|
|
|
alt="" /> |
|
|
|
</view> |
|
|
|
<view class="bottom-price" style="line-height: 24px;"> |
|
|
|
<view>¥{{cartTotalPrice}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="bottom-right" @tap="submitCartCheckout"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d93d893296ed46ea99cfd0e8e2835eaa.png" alt="" /> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d93d893296ed46ea99cfd0e8e2835eaa.png" |
|
|
|
alt="" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
|
|
|
|
<!-- 警告弹出层 --> |
|
|
|
<uni-popup ref="warnPopup" background-color="#fff"> |
|
|
|
<view class="warnImg"> |
|
|
|
<img @tap="$refs.warnPopup.close()" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4996043b3987401794b974d359429b8e.png" alt="购物车是空的" style="width:300px;height:370px;" /> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<!-- 警告弹出层 --> |
|
|
|
<uni-popup ref="warnPopup" background-color="#fff"> |
|
|
|
<view class="warnImg"> |
|
|
|
<img @tap="$refs.warnPopup.close()" |
|
|
|
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4996043b3987401794b974d359429b8e.png" |
|
|
|
alt="购物车是空的" style="width:300px;height:370px;" /> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<!-- 拼团和选规格弹窗 --> |
|
|
|
<uni-popup ref="pintuanPopup" background-color="#fff"> |
|
|
|
<view class="car-content"> |
|
|
|
@ -244,8 +261,9 @@ |
|
|
|
<view style="font-size: 28rpx;line-height: 54rpx;margin-right: 20rpx;"> |
|
|
|
¥{{currentItem.attributeListPrice | sliceMsg}} |
|
|
|
</view> |
|
|
|
<view class="pintuan-left-price" v-if="currentItem.productGroupBuyPrices && currentItem.productGroupBuyPrices.length > 0"> |
|
|
|
拼团<text style="color: red;">¥{{currentItem.productGroupBuyPrices | slicePrice}}起</text> |
|
|
|
<view class="pintuan-left-price" |
|
|
|
v-if="currentItem.productGroupBuyPrices && currentItem.productGroupBuyPrices.length > 0"> |
|
|
|
拼团<text style="color: red;">¥{{currentItem.productGroupBuyPrices | slicePrice}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -256,25 +274,26 @@ |
|
|
|
<view class="spec11"> |
|
|
|
选{{spec.name}} |
|
|
|
</view> |
|
|
|
<view class="spec22" > |
|
|
|
<view class="spec22"> |
|
|
|
<view :class="spec.selected === option ? 'spec-check' : 'spec222'" |
|
|
|
v-for="(option, oIndex) in spec.options" |
|
|
|
:key="oIndex" |
|
|
|
@tap="selectSpec(sIndex, option)"> |
|
|
|
v-for="(option, oIndex) in spec.options" :key="oIndex" |
|
|
|
@tap="selectSpec(sIndex, option)"> |
|
|
|
{{option}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<template v-if="isPintuan && currentItem.productGroupBuyPrices && currentItem.productGroupBuyPrices.length > 0"> |
|
|
|
<template |
|
|
|
v-if="isPintuan && currentItem.productGroupBuyPrices && currentItem.productGroupBuyPrices.length > 0"> |
|
|
|
<view class="spec11"> |
|
|
|
成团选择 |
|
|
|
</view> |
|
|
|
<view class="goods-team"> |
|
|
|
<view :class="selectedGroupRule && selectedGroupRule.groupCount === rule.groupCount ? 'team-check' : 'team1'" |
|
|
|
v-for="(rule, rIndex) in currentItem.productGroupBuyPrices" :key="rIndex" |
|
|
|
@tap="selectGroupRule(rule)"> |
|
|
|
<view |
|
|
|
:class="selectedGroupRule && selectedGroupRule.groupCount === rule.groupCount ? 'team-check' : 'team1'" |
|
|
|
v-for="(rule, rIndex) in currentItem.productGroupBuyPrices" :key="rIndex" |
|
|
|
@tap="selectGroupRule(rule)"> |
|
|
|
<view class="team11"> |
|
|
|
¥{{parseFloat(rule.groupPrice).toFixed(2)}} |
|
|
|
</view> |
|
|
|
@ -284,8 +303,9 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="spec11"> |
|
|
|
<view class="spec11" @tap="$refs.pintuanGroupPopup.open('bottom')"> |
|
|
|
他们都在拼 |
|
|
|
<uni-icons type="right" size="12"></uni-icons> |
|
|
|
</view> |
|
|
|
<!-- 占位假数据展示 --> |
|
|
|
<view class=""> |
|
|
|
@ -298,15 +318,12 @@ |
|
|
|
</view> |
|
|
|
<view class="list-right-cha"> |
|
|
|
<view class="cha11"> |
|
|
|
不限拼 |
|
|
|
二人拼 |
|
|
|
</view> |
|
|
|
<view class=""> |
|
|
|
<view style="line-height: 20px;padding-left: 5px;"> |
|
|
|
差<text style="color: red;">1人</text>拼成 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-right-price"> |
|
|
|
去凑单 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-btn" @tap="submitPintuan"> |
|
|
|
去拼单 |
|
|
|
@ -319,15 +336,20 @@ |
|
|
|
<view class="bottom" style="padding-bottom: 20px;height: 80px;z-index: 10;"> |
|
|
|
<view v-if="isPintuan" class="pintuan1"> |
|
|
|
<template v-if="!groupId"> |
|
|
|
<view class="pintuan2" style="border-bottom-left-radius: 50px;border-top-left-radius: 50px;" @tap="submitPintuan(true)"> |
|
|
|
<view class="pintuan2" style="border-bottom-left-radius: 50px;border-top-left-radius: 50px;" |
|
|
|
@tap="submitPintuan(true)"> |
|
|
|
面对面团 |
|
|
|
</view> |
|
|
|
<view class="pintuan2" style="background: rgba(0, 35, 28, 1);border-bottom-right-radius: 50px;border-top-right-radius: 50px;color: rgba(166, 255, 234, 1);" @tap="submitPintuan(false)"> |
|
|
|
<view class="pintuan2" |
|
|
|
style="background: rgba(0, 35, 28, 1);border-bottom-right-radius: 50px;border-top-right-radius: 50px;color: rgba(166, 255, 234, 1);" |
|
|
|
@tap="submitPintuan(false)"> |
|
|
|
发起拼团¥{{selectedGroupRule && selectedGroupRule.groupPrice ? parseFloat(selectedGroupRule.groupPrice).toFixed(2) : '0.00'}} |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<template v-else> |
|
|
|
<view class="pintuan2" style="width: 100%; border-radius: 50px; background: rgba(0, 35, 28, 1); color: rgba(166, 255, 234, 1);" @tap="submitPintuan(false)"> |
|
|
|
<view class="pintuan2" |
|
|
|
style="width: 100%; border-radius: 50px; background: rgba(0, 35, 28, 1); color: rgba(166, 255, 234, 1);" |
|
|
|
@tap="submitPintuan(false)"> |
|
|
|
参与拼团¥{{selectedGroupRule && selectedGroupRule.groupPrice ? parseFloat(selectedGroupRule.groupPrice).toFixed(2) : '0.00'}} |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
@ -338,6 +360,114 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<!-- 拼团和选规格弹窗 --> |
|
|
|
<uni-popup ref="pintuanGroupPopup" background-color="#fff"> |
|
|
|
<view class="car-content"> |
|
|
|
<view class="car-close" @tap="$refs.pintuanPopup.close()"> |
|
|
|
<uni-icons type="close" size="30" color="#fff"></uni-icons> |
|
|
|
</view> |
|
|
|
<view class="goods-top"> |
|
|
|
<view class="goods-img"> |
|
|
|
<img :src="currentItem.productPicture" alt="" style="border-radius: 10px;"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/6c4ab92a43c842d8bb22035bce1f65cc.png" |
|
|
|
alt="" |
|
|
|
style="width:30rpx;height:30rpx;position: absolute;top: 0;left: 0;background-size: 100%;" /> |
|
|
|
</view> |
|
|
|
<view class="goods-content"> |
|
|
|
<view class="goods-name"> |
|
|
|
{{currentItem.productName}} |
|
|
|
</view> |
|
|
|
<view class="goods-content-center"> |
|
|
|
<view class="goods-deal1"> |
|
|
|
月售 <text> 100+</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="goods-content-bottom"> |
|
|
|
<view style="font-size: 28rpx;line-height: 54rpx;margin-right: 20rpx;"> |
|
|
|
¥{{currentItem.attributeListPrice | sliceMsg}} |
|
|
|
</view> |
|
|
|
<view class="pintuan-left-price" |
|
|
|
v-if="currentItem.productGroupBuyPrices && currentItem.productGroupBuyPrices.length > 0"> |
|
|
|
拼团<text style="color: red;">¥{{currentItem.productGroupBuyPrices | slicePrice}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<scroll-view scroll-y style="max-height: 50vh;"> |
|
|
|
<template |
|
|
|
v-if="isPintuan && currentItem.productGroupBuyPrices && currentItem.productGroupBuyPrices.length > 0"> |
|
|
|
<!-- 占位假数据展示 --> |
|
|
|
<view class=""> |
|
|
|
<view class="goods-center"> |
|
|
|
<view class="list-right"> |
|
|
|
<view class="list-right-img"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/94f91382e76c4f289d53fbf858e8732b.png" |
|
|
|
alt="" /> |
|
|
|
<view class="list-weipincheng">+</view> |
|
|
|
</view> |
|
|
|
<view class="list-right-cha"> |
|
|
|
<view class="cha11"> |
|
|
|
二人拼 |
|
|
|
</view> |
|
|
|
<view style="line-height: 20px;padding-left: 5px;"> |
|
|
|
差<text style="color: red;">1人</text>拼成 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-btn" @tap="submitPintuan"> |
|
|
|
去拼单 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class=""> |
|
|
|
<view class="goods-center"> |
|
|
|
<view class="list-right"> |
|
|
|
<view class="list-right-img"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/94f91382e76c4f289d53fbf858e8732b.png" |
|
|
|
alt="" /> |
|
|
|
<view class="list-weipincheng">+</view> |
|
|
|
</view> |
|
|
|
<view class="list-right-cha"> |
|
|
|
<view class="cha11"> |
|
|
|
二人拼 |
|
|
|
</view> |
|
|
|
<view style="line-height: 20px;padding-left: 5px;"> |
|
|
|
差<text style="color: red;">1人</text>拼成 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-btn" @tap="submitPintuan"> |
|
|
|
去拼单 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class=""> |
|
|
|
<view class="goods-center"> |
|
|
|
<view class="list-right"> |
|
|
|
<view class="list-right-img"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/94f91382e76c4f289d53fbf858e8732b.png" |
|
|
|
alt="" /> |
|
|
|
<view class="list-weipincheng">+</view> |
|
|
|
</view> |
|
|
|
<view class="list-right-cha"> |
|
|
|
<view class="cha11"> |
|
|
|
二人拼 |
|
|
|
</view> |
|
|
|
<view style="line-height: 20px;padding-left: 5px;"> |
|
|
|
差<text style="color: red;">1人</text>拼成 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-btn" @tap="submitPintuan"> |
|
|
|
去拼单 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<view style="width: 100%;height: 160rpx;"></view> |
|
|
|
</scroll-view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -346,17 +476,17 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
loadStatus: 'more', |
|
|
|
type:'', |
|
|
|
shopId:'', |
|
|
|
shopItem:{}, |
|
|
|
productId:'', |
|
|
|
productItem:[], |
|
|
|
type: '', |
|
|
|
shopId: '', |
|
|
|
shopItem: {}, |
|
|
|
productId: '', |
|
|
|
productItem: [], |
|
|
|
cartItems: [], |
|
|
|
currentItem: {}, |
|
|
|
parsedSpecs: [], |
|
|
|
selectedGroupRule: {}, |
|
|
|
pageNum:1, |
|
|
|
total:1, |
|
|
|
pageNum: 1, |
|
|
|
total: 1, |
|
|
|
// 导航栏高度(用于sticky top偏移) |
|
|
|
navBarHeight: 0, |
|
|
|
// 分类栏距离页面顶部的距离(用于上滑检测) |
|
|
|
@ -364,21 +494,21 @@ |
|
|
|
lastScrollTop: 0, |
|
|
|
// 防止切换分类之后onPageScroll闪回的标志 |
|
|
|
isSwitching: false, |
|
|
|
searchForm:{ |
|
|
|
shopId:'', |
|
|
|
searchForm: { |
|
|
|
shopId: '', |
|
|
|
delFlag: 1, |
|
|
|
pageNum: 1, |
|
|
|
pageSize: '10', |
|
|
|
categoryId:'' |
|
|
|
categoryId: '' |
|
|
|
}, |
|
|
|
menuButtonInfo: {}, |
|
|
|
isPintuan:true, |
|
|
|
isPintuan: true, |
|
|
|
groupId: '', |
|
|
|
isFaceToFaceGroup: false, |
|
|
|
menuList:[{ |
|
|
|
categoryName:'猜你喜欢', |
|
|
|
id:'', |
|
|
|
checked:true |
|
|
|
menuList: [{ |
|
|
|
categoryName: '猜你喜欢', |
|
|
|
id: '', |
|
|
|
checked: true |
|
|
|
}] |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -407,15 +537,15 @@ |
|
|
|
sliceMsg1(val) { |
|
|
|
var name = '正在有' |
|
|
|
let aa = Math.floor(Math.random() * (15 - 5 + 1)) + 1; |
|
|
|
name+=aa+'人下单' |
|
|
|
name += aa + '人下单' |
|
|
|
return name; |
|
|
|
}, |
|
|
|
slicePrice(val){ |
|
|
|
slicePrice(val) { |
|
|
|
let begin = '' |
|
|
|
if(val != null){ |
|
|
|
if (val != null) { |
|
|
|
begin = val[0].groupPrice |
|
|
|
for(let i = 0;i < val.length;i++){ |
|
|
|
if(val[i].groupPrice < begin){ |
|
|
|
for (let i = 0; i < val.length; i++) { |
|
|
|
if (val[i].groupPrice < begin) { |
|
|
|
begin = val[i].groupPrice |
|
|
|
} |
|
|
|
} |
|
|
|
@ -488,41 +618,41 @@ |
|
|
|
this.searchForm.categoryId = categoryId; |
|
|
|
that.tui.request("/app/product/getShareList", "POST", this.searchForm, false, false).then((res) => { |
|
|
|
that.loadStatus = 'nomore'; |
|
|
|
if (res.code == 200) { |
|
|
|
if (that.searchForm.pageNum == 1) { |
|
|
|
that.productItem = res.result.records; |
|
|
|
} else { |
|
|
|
that.productItem = [...that.productItem, ...res.result.records]; |
|
|
|
} |
|
|
|
console.log(res.result.records) |
|
|
|
that.total = res.result.pages; // pages = 总页数 |
|
|
|
that.pageNum = that.searchForm.pageNum; |
|
|
|
// 当前分类没有商品,自动跳过到下一个分类 |
|
|
|
// 注意:这里不能用isSwitching拦戚,因为_switchCategory本身已置 isSwitching=true |
|
|
|
if (res.result.records.length === 0) { |
|
|
|
const currIdx = that.menuList.findIndex(m => m.checked); |
|
|
|
if (currIdx !== -1 && currIdx < that.menuList.length - 1) { |
|
|
|
// 重置锁再跳过,防止连锁导致永远跳不过 |
|
|
|
that.isSwitching = false; |
|
|
|
that._switchCategory(currIdx + 1); |
|
|
|
if (res.code == 200) { |
|
|
|
if (that.searchForm.pageNum == 1) { |
|
|
|
that.productItem = res.result.records; |
|
|
|
} else { |
|
|
|
that.productItem = [...that.productItem, ...res.result.records]; |
|
|
|
} |
|
|
|
console.log(res.result.records) |
|
|
|
that.total = res.result.pages; // pages = 总页数 |
|
|
|
that.pageNum = that.searchForm.pageNum; |
|
|
|
// 当前分类没有商品,自动跳过到下一个分类 |
|
|
|
// 注意:这里不能用isSwitching拦戚,因为_switchCategory本身已置 isSwitching=true |
|
|
|
if (res.result.records.length === 0) { |
|
|
|
const currIdx = that.menuList.findIndex(m => m.checked); |
|
|
|
if (currIdx !== -1 && currIdx < that.menuList.length - 1) { |
|
|
|
// 重置锁再跳过,防止连锁导致永远跳不过 |
|
|
|
that.isSwitching = false; |
|
|
|
that._switchCategory(currIdx + 1); |
|
|
|
} |
|
|
|
} |
|
|
|
that.$forceUpdate(); |
|
|
|
} else { |
|
|
|
that.tui.toast(res.message); |
|
|
|
return; |
|
|
|
} |
|
|
|
that.$forceUpdate(); |
|
|
|
} else { |
|
|
|
that.tui.toast(res.message); |
|
|
|
return; |
|
|
|
} |
|
|
|
uni.hideLoading(); |
|
|
|
}).catch((res) => {}); |
|
|
|
uni.hideLoading(); |
|
|
|
}).catch((res) => {}); |
|
|
|
}, |
|
|
|
getCategory(id){ |
|
|
|
getCategory(id) { |
|
|
|
let that = this |
|
|
|
that.tui.request("/app/productCategory/list", "GET", { |
|
|
|
shopId:id |
|
|
|
shopId: id |
|
|
|
}, false, true).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
if(res.result.length >0){ |
|
|
|
for(let i = 0;i<res.result.length;i++){ |
|
|
|
if (res.result.length > 0) { |
|
|
|
for (let i = 0; i < res.result.length; i++) { |
|
|
|
res.result[i].checked = false |
|
|
|
that.menuList.push(res.result[i]) |
|
|
|
} |
|
|
|
@ -541,7 +671,9 @@ |
|
|
|
this.isSwitching = true; |
|
|
|
this.checkTab(index); |
|
|
|
// 400ms后解除锁(动画200ms,预留200ms缓冲) |
|
|
|
setTimeout(() => { this.isSwitching = false; }, 400); |
|
|
|
setTimeout(() => { |
|
|
|
this.isSwitching = false; |
|
|
|
}, 400); |
|
|
|
}, |
|
|
|
checkTab(index) { |
|
|
|
for (let i = 0; i < this.menuList.length; i++) { |
|
|
|
@ -556,20 +688,24 @@ |
|
|
|
// 滚动到正确位置:分类栏刚好吸顶在nav-bar下方 |
|
|
|
// menuListOffsetTop - navBarHeight 使分类栏正好在sticky位置,首条商品可见 |
|
|
|
const target = this.menuListOffsetTop - this.navBarHeight; |
|
|
|
uni.pageScrollTo({ scrollTop: target > 0 ? target : 0, duration: 200 }); |
|
|
|
uni.pageScrollTo({ |
|
|
|
scrollTop: target > 0 ? target : 0, |
|
|
|
duration: 200 |
|
|
|
}); |
|
|
|
}, |
|
|
|
openPopup(type,index,item){ |
|
|
|
if(type == 'car'){ |
|
|
|
openPopup(type, index, item) { |
|
|
|
if (type == 'car') { |
|
|
|
this.$refs.carPopup.open('bottom') |
|
|
|
}else if(type == 'xiadan'){ |
|
|
|
} else if (type == 'xiadan') { |
|
|
|
this.currentItem = item; |
|
|
|
// Parse specifications |
|
|
|
this.parsedSpecs = []; |
|
|
|
if(item.attributeList && item.attributeList !== '{}') { |
|
|
|
if (item.attributeList && item.attributeList !== '{}') { |
|
|
|
try { |
|
|
|
let attrs = typeof item.attributeList === 'string' ? JSON.parse(item.attributeList) : item.attributeList; |
|
|
|
for(let key in attrs) { |
|
|
|
if(attrs[key] && attrs[key].title && attrs[key].title.length > 0) { |
|
|
|
let attrs = typeof item.attributeList === 'string' ? JSON.parse(item.attributeList) : item |
|
|
|
.attributeList; |
|
|
|
for (let key in attrs) { |
|
|
|
if (attrs[key] && attrs[key].title && attrs[key].title.length > 0) { |
|
|
|
this.parsedSpecs.push({ |
|
|
|
name: key, |
|
|
|
options: attrs[key].title, |
|
|
|
@ -577,15 +713,15 @@ |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch(e) { |
|
|
|
} catch (e) { |
|
|
|
console.error("Failed to parse specifications", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(index == 'pintuan'){ |
|
|
|
if (index == 'pintuan') { |
|
|
|
this.isPintuan = true; |
|
|
|
// Set default group rule |
|
|
|
if(item.productGroupBuyPrices && item.productGroupBuyPrices.length > 0) { |
|
|
|
if (item.productGroupBuyPrices && item.productGroupBuyPrices.length > 0) { |
|
|
|
this.selectedGroupRule = item.productGroupBuyPrices[0]; |
|
|
|
} else { |
|
|
|
this.selectedGroupRule = {}; |
|
|
|
@ -594,9 +730,12 @@ |
|
|
|
} else { |
|
|
|
this.isPintuan = false; |
|
|
|
// If solo buy and NO specs, add immediately to cart |
|
|
|
if(this.parsedSpecs.length === 0) { |
|
|
|
if (this.parsedSpecs.length === 0) { |
|
|
|
this.addToCart(item, null); |
|
|
|
uni.showToast({ title: '已加入购物车', icon: 'none' }); |
|
|
|
uni.showToast({ |
|
|
|
title: '已加入购物车', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
} else { |
|
|
|
// Open popup to select specs |
|
|
|
this.$refs.pintuanPopup.open('bottom'); |
|
|
|
@ -617,7 +756,10 @@ |
|
|
|
specChoices[spec.name] = spec.selected; |
|
|
|
} |
|
|
|
this.addToCart(this.currentItem, specChoices); |
|
|
|
uni.showToast({ title: '已加入购物车', icon: 'none' }); |
|
|
|
uni.showToast({ |
|
|
|
title: '已加入购物车', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
this.$refs.pintuanPopup.close(); |
|
|
|
}, |
|
|
|
submitPintuan(isFaceToFace) { |
|
|
|
@ -637,7 +779,9 @@ |
|
|
|
}; |
|
|
|
// Directly navigate to checkout |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/package1/buyFood/buyFood?item=' + encodeURIComponent(JSON.stringify(goData)) + '&shopItem=' + encodeURIComponent(JSON.stringify(this.shopItem)) + '&packageFee=' + packageFee |
|
|
|
url: '/package1/buyFood/buyFood?item=' + encodeURIComponent(JSON.stringify(goData)) + |
|
|
|
'&shopItem=' + encodeURIComponent(JSON.stringify(this.shopItem)) + '&packageFee=' + |
|
|
|
packageFee |
|
|
|
}); |
|
|
|
this.$refs.pintuanPopup.close(); |
|
|
|
}, |
|
|
|
@ -645,19 +789,23 @@ |
|
|
|
let specStr = specs ? JSON.stringify(specs) : ''; |
|
|
|
let cartId = item.id + '_' + specStr; |
|
|
|
let existingItem = this.cartItems.find(c => c.cartId === cartId); |
|
|
|
if(existingItem) { |
|
|
|
if (existingItem) { |
|
|
|
existingItem.quantity++; |
|
|
|
} else { |
|
|
|
let priceToUse = 0; |
|
|
|
if(item.attributeListPrice) { |
|
|
|
if (item.attributeListPrice) { |
|
|
|
try { |
|
|
|
let pObj = typeof item.attributeListPrice === 'string' ? JSON.parse(item.attributeListPrice) : item.attributeListPrice; |
|
|
|
if(Array.isArray(pObj) && pObj.length > 0) { |
|
|
|
let pObj = typeof item.attributeListPrice === 'string' ? JSON.parse(item.attributeListPrice) : |
|
|
|
item.attributeListPrice; |
|
|
|
if (Array.isArray(pObj) && pObj.length > 0) { |
|
|
|
priceToUse = parseFloat(pObj[0].specPrice); |
|
|
|
} else { |
|
|
|
for(let k in pObj) { priceToUse = parseFloat(pObj[k].specPrice); break; } |
|
|
|
for (let k in pObj) { |
|
|
|
priceToUse = parseFloat(pObj[k].specPrice); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch(e){} |
|
|
|
} catch (e) {} |
|
|
|
} |
|
|
|
this.cartItems.push({ |
|
|
|
cartId: cartId, |
|
|
|
@ -670,9 +818,9 @@ |
|
|
|
}, |
|
|
|
adjustCart(cartId, delta) { |
|
|
|
let index = this.cartItems.findIndex(c => c.cartId === cartId); |
|
|
|
if(index !== -1) { |
|
|
|
if (index !== -1) { |
|
|
|
let newQty = this.cartItems[index].quantity + delta; |
|
|
|
if(newQty <= 0) { |
|
|
|
if (newQty <= 0) { |
|
|
|
this.cartItems.splice(index, 1); |
|
|
|
} else { |
|
|
|
this.cartItems[index].quantity = newQty; |
|
|
|
@ -680,13 +828,15 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
getSpecDisplayString(specs) { |
|
|
|
if(!specs) return ''; |
|
|
|
if (!specs) return ''; |
|
|
|
let arr = []; |
|
|
|
for(let k in specs) { arr.push(specs[k]); } |
|
|
|
for (let k in specs) { |
|
|
|
arr.push(specs[k]); |
|
|
|
} |
|
|
|
return arr.join(','); |
|
|
|
}, |
|
|
|
submitCartCheckout() { |
|
|
|
if(this.cartItems.length === 0) { |
|
|
|
if (this.cartItems.length === 0) { |
|
|
|
this.$refs.warnPopup.open() |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -698,7 +848,9 @@ |
|
|
|
|
|
|
|
// 类似普通订单结算逻辑 |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/package1/buyFood/buyFood?cart=' + encodeURIComponent(JSON.stringify(this.cartItems)) + '&shopItem=' + encodeURIComponent(JSON.stringify(this.shopItem)) + '&packageFee=' + totalPackageFee |
|
|
|
url: '/package1/buyFood/buyFood?cart=' + encodeURIComponent(JSON.stringify(this.cartItems)) + |
|
|
|
'&shopItem=' + encodeURIComponent(JSON.stringify(this.shopItem)) + '&packageFee=' + |
|
|
|
totalPackageFee |
|
|
|
}); |
|
|
|
}, |
|
|
|
goDetail(type) { |
|
|
|
@ -706,11 +858,11 @@ |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/package1/goods/goodsDetail' |
|
|
|
}) |
|
|
|
}else if(type == 'shopDetail'){ |
|
|
|
} else if (type == 'shopDetail') { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/package1/group/groupBuyDetail?item=' + JSON.stringify(this.shopItem) |
|
|
|
}) |
|
|
|
}else if(type == 'shopEvaluate'){ |
|
|
|
} else if (type == 'shopEvaluate') { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/package1/group/shopEvaluate?item=' + JSON.stringify(this.shopItem) |
|
|
|
}) |
|
|
|
@ -764,7 +916,7 @@ |
|
|
|
.title-search { |
|
|
|
display: flex; |
|
|
|
flex: 1; |
|
|
|
background: rgba(255,255,255,0.9); |
|
|
|
background: rgba(255, 255, 255, 0.9); |
|
|
|
height: 54rpx; |
|
|
|
margin-left: 20rpx; |
|
|
|
border-radius: 54rpx; |
|
|
|
@ -946,9 +1098,12 @@ |
|
|
|
z-index: 97; |
|
|
|
} |
|
|
|
|
|
|
|
.pintuan-right-cha {} |
|
|
|
.pintuan-right-cha { |
|
|
|
line-height: 20px; |
|
|
|
padding-left: 5px; |
|
|
|
} |
|
|
|
|
|
|
|
.goods-member{ |
|
|
|
.goods-member { |
|
|
|
padding: 10px 0; |
|
|
|
margin-top: 10px; |
|
|
|
border-radius: 10px; |
|
|
|
@ -1066,7 +1221,7 @@ |
|
|
|
.bottom-left { |
|
|
|
flex: 1; |
|
|
|
display: flex; |
|
|
|
padding: 20rpx; |
|
|
|
padding: 20rpx; |
|
|
|
|
|
|
|
img { |
|
|
|
width: 60rpx; |
|
|
|
@ -1075,12 +1230,12 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.bottom-price{ |
|
|
|
.bottom-price { |
|
|
|
margin-left: 40rpx; |
|
|
|
font-size: 40rpx; |
|
|
|
color: red; |
|
|
|
font-weight: 700; |
|
|
|
line-height: 110rpx; |
|
|
|
font-size: 40rpx; |
|
|
|
color: red; |
|
|
|
font-weight: 700; |
|
|
|
line-height: 110rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.bottom-right { |
|
|
|
@ -1093,20 +1248,21 @@ |
|
|
|
background-size: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
.bottom-dot{ |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
right: -20rpx; |
|
|
|
background: red; |
|
|
|
color: #fff; |
|
|
|
width: 32rpx; |
|
|
|
height: 32rpx; |
|
|
|
border-radius: 32rpx; |
|
|
|
text-align: center; |
|
|
|
line-height: 32rpx; |
|
|
|
|
|
|
|
.bottom-dot { |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
right: -20rpx; |
|
|
|
background: red; |
|
|
|
color: #fff; |
|
|
|
width: 32rpx; |
|
|
|
height: 32rpx; |
|
|
|
border-radius: 32rpx; |
|
|
|
text-align: center; |
|
|
|
line-height: 32rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.car-content{ |
|
|
|
.car-content { |
|
|
|
position: relative; |
|
|
|
height: 600px; |
|
|
|
width: 100%; |
|
|
|
@ -1116,7 +1272,7 @@ |
|
|
|
overflow: scroll; |
|
|
|
} |
|
|
|
|
|
|
|
.car-close{ |
|
|
|
.car-close { |
|
|
|
width: 30px; |
|
|
|
height: 30px; |
|
|
|
position: absolute; |
|
|
|
@ -1124,14 +1280,15 @@ |
|
|
|
right: 10px; |
|
|
|
} |
|
|
|
|
|
|
|
.car-title{ |
|
|
|
.car-title { |
|
|
|
height: 48px; |
|
|
|
line-height: 30px; |
|
|
|
margin: 0 auto; |
|
|
|
font-size: 14px; |
|
|
|
font-weight: 700; |
|
|
|
} |
|
|
|
.num-plus{ |
|
|
|
|
|
|
|
.num-plus { |
|
|
|
width: 28px; |
|
|
|
height: 28px; |
|
|
|
font-size: 18px; |
|
|
|
@ -1144,20 +1301,23 @@ |
|
|
|
color: rgba(166, 255, 234, 1); |
|
|
|
|
|
|
|
} |
|
|
|
.num{ |
|
|
|
|
|
|
|
.num { |
|
|
|
width: 40px; |
|
|
|
height: 28px; |
|
|
|
text-align: center; |
|
|
|
line-height: 28px; |
|
|
|
font-size: 14px; |
|
|
|
} |
|
|
|
.goods-num{ |
|
|
|
|
|
|
|
.goods-num { |
|
|
|
display: flex; |
|
|
|
height: 28px; |
|
|
|
flex: 1; |
|
|
|
margin-left: 20px; |
|
|
|
} |
|
|
|
.pintuan0{ |
|
|
|
|
|
|
|
.pintuan0 { |
|
|
|
width: 90%; |
|
|
|
height: 50px; |
|
|
|
border-radius: 50px; |
|
|
|
@ -1168,7 +1328,8 @@ |
|
|
|
line-height: 50px; |
|
|
|
margin: auto; |
|
|
|
} |
|
|
|
.pintuan1{ |
|
|
|
|
|
|
|
.pintuan1 { |
|
|
|
width: 90%; |
|
|
|
height: 50px; |
|
|
|
line-height: 50px; |
|
|
|
@ -1178,18 +1339,20 @@ |
|
|
|
font-size: 13px; |
|
|
|
font-weight: 700; |
|
|
|
} |
|
|
|
.pintuan2{ |
|
|
|
|
|
|
|
.pintuan2 { |
|
|
|
flex: 1; |
|
|
|
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1)); |
|
|
|
} |
|
|
|
.spec11{ |
|
|
|
|
|
|
|
.spec11 { |
|
|
|
height: 48px; |
|
|
|
line-height: 48px; |
|
|
|
font-size: 14px; |
|
|
|
font-weight: 700; |
|
|
|
} |
|
|
|
|
|
|
|
.spec222{ |
|
|
|
.spec222 { |
|
|
|
display: inline-block; |
|
|
|
padding: 0 10px; |
|
|
|
background: #eee; |
|
|
|
@ -1200,7 +1363,8 @@ |
|
|
|
border-radius: 10px; |
|
|
|
margin-right: 10px; |
|
|
|
} |
|
|
|
.spec-check{ |
|
|
|
|
|
|
|
.spec-check { |
|
|
|
display: inline-block; |
|
|
|
padding: 0 10px; |
|
|
|
background: rgba(166, 255, 234, 1); |
|
|
|
@ -1210,7 +1374,8 @@ |
|
|
|
border-radius: 10px; |
|
|
|
margin-right: 10px; |
|
|
|
} |
|
|
|
.team1{ |
|
|
|
|
|
|
|
.team1 { |
|
|
|
width: 77px; |
|
|
|
height: 83px; |
|
|
|
background: #eee; |
|
|
|
@ -1221,7 +1386,8 @@ |
|
|
|
float: left; |
|
|
|
margin-right: 20px; |
|
|
|
} |
|
|
|
.team-check{ |
|
|
|
|
|
|
|
.team-check { |
|
|
|
width: 77px; |
|
|
|
height: 83px; |
|
|
|
background: rgba(166, 255, 234, 1); |
|
|
|
@ -1232,13 +1398,16 @@ |
|
|
|
float: left; |
|
|
|
margin-right: 20px; |
|
|
|
} |
|
|
|
.team11{ |
|
|
|
|
|
|
|
.team11 { |
|
|
|
margin-top: 10px; |
|
|
|
} |
|
|
|
.goods-team{ |
|
|
|
|
|
|
|
.goods-team { |
|
|
|
width: 100%; |
|
|
|
min-height: 90px; |
|
|
|
} |
|
|
|
|
|
|
|
.list-right { |
|
|
|
display: flex; |
|
|
|
width: 100%; |
|
|
|
@ -1284,7 +1453,8 @@ |
|
|
|
.list-right-cha { |
|
|
|
margin-left: 10px; |
|
|
|
} |
|
|
|
.list-right-price{ |
|
|
|
|
|
|
|
.list-right-price { |
|
|
|
flex: 1; |
|
|
|
text-align: right; |
|
|
|
line-height: 40px; |
|
|
|
@ -1304,7 +1474,8 @@ |
|
|
|
line-height: 30px; |
|
|
|
margin: 20px; |
|
|
|
} |
|
|
|
.cha11{ |
|
|
|
|
|
|
|
.cha11 { |
|
|
|
font-size: 11px; |
|
|
|
background: rgba(255, 57, 57, 0.2); |
|
|
|
color: red; |
|
|
|
@ -1313,7 +1484,8 @@ |
|
|
|
border-radius: 5px; |
|
|
|
margin-bottom: 5px; |
|
|
|
} |
|
|
|
.menu-list{ |
|
|
|
|
|
|
|
.menu-list { |
|
|
|
height: 45px; |
|
|
|
width: 100%; |
|
|
|
overflow-x: scroll; |
|
|
|
@ -1326,7 +1498,8 @@ |
|
|
|
align-items: center; |
|
|
|
padding-bottom: 4px; |
|
|
|
} |
|
|
|
.checked-img{ |
|
|
|
|
|
|
|
.checked-img { |
|
|
|
width: 90px; |
|
|
|
height: 10px; |
|
|
|
position: absolute; |
|
|
|
@ -1334,7 +1507,7 @@ |
|
|
|
left: 0; |
|
|
|
} |
|
|
|
|
|
|
|
.menu1{ |
|
|
|
.menu1 { |
|
|
|
width: 90px; |
|
|
|
height: 35px; |
|
|
|
position: relative; |
|
|
|
|