|
@@ -23,12 +23,14 @@
|
|
|
<view class="product-button">
|
|
|
<view class="price-txt">¥<text>{{item.cost}}</text></view>
|
|
|
<view @click="chooseProduct(item)">
|
|
|
- <view class="cart-add" :class="!item.checked?'colr-add':'colr-checks'">
|
|
|
+ <!-- <view class="cart-add" :class="!item.checked?'colr-add':'colr-checks'">
|
|
|
<u-icon v-if="!item.checked" color="#fff" name="plus"></u-icon>
|
|
|
<view v-else>
|
|
|
<u-icon name="plus" color="#fff"></u-icon>{{item.qty}}
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
+ <u-button v-if="!item.checked" :throttle-time="50" @click="chooseProduct(item)" size="mini" type="primary" shape="circle"><u-icon name="plus"></u-icon></u-button>
|
|
|
+ <u-button v-else :throttle-time="50" @click="chooseProduct(item)" size="mini" type="success" shape="circle"><u-icon name="plus"></u-icon>{{item.qty}}</u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -67,10 +69,10 @@
|
|
|
:show="showChoosePopu"
|
|
|
:round="true"
|
|
|
position="bottom"
|
|
|
- custom-style="height:80%"
|
|
|
+ custom-style="height:90%"
|
|
|
@enter="openRender"
|
|
|
@afterleave="closePopu">
|
|
|
- <scroll-view :style="{width:screenWidth + 'px',height:'100%'}" scroll-y="true" @scrolltolower="onreachPopuBottom">
|
|
|
+ <scroll-view :style="{width:screenWidth + 'px',height:'100%'}" scroll-y="true">
|
|
|
<view class="choose-title">
|
|
|
<view class="flex align_center">
|
|
|
<view>已选<text class="p-nums">{{chooseLength}}</text>款产品 </view>
|
|
@@ -109,6 +111,10 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</u-swipe-action>
|
|
|
+ <!-- 分页 -->
|
|
|
+ <view class="choose-product-pages" v-if="totalSelPages>1">
|
|
|
+ <uni-pages-nav :totalPages="totalSelPages" :showShadow="false" :currentPage="choosePageNo" @pagechanged="onreachPopuBottom"></uni-pages-nav>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
</page-container>
|
|
@@ -130,7 +136,7 @@
|
|
|
queryWord: '',// 关键词查询列表
|
|
|
// 查询条件
|
|
|
pageNo: 1, // 当前页
|
|
|
- pageSize: 12,//每页条数
|
|
|
+ pageSize: 24,//每页条数
|
|
|
list: [], // 产品列表
|
|
|
total: 0, // 总记录
|
|
|
showChoosePopu: false,//已选列表弹框
|
|
@@ -147,7 +153,7 @@
|
|
|
screenWidth: 750, // 屏幕宽度
|
|
|
showSwipeAction: false, // 已选弹框是否一打开
|
|
|
choosePageNo: 1, // 已选产品当前页
|
|
|
- choosePageSize: 4, // 已选产品每页数
|
|
|
+ choosePageSize: 6, // 已选产品每页数
|
|
|
chooseTotal: 0 ,// 已选产品总记录数
|
|
|
promoActiveSn: null, // 活动sn
|
|
|
submitOk: false,
|
|
@@ -184,6 +190,10 @@
|
|
|
// 总页数
|
|
|
totalPages(){
|
|
|
return Math.ceil(this.total / this.pageSize)
|
|
|
+ },
|
|
|
+ // 已选产品分页总数
|
|
|
+ totalSelPages(){
|
|
|
+ return Math.ceil(this.chooseTotal/this.choosePageSize)
|
|
|
}
|
|
|
},
|
|
|
onLoad(opts) {
|
|
@@ -297,28 +307,33 @@
|
|
|
// 默认加载第一页数据
|
|
|
this.chooseTotal = this.chooseList.length
|
|
|
this.choosePageNo = 0
|
|
|
- this.onreachPopuBottom()
|
|
|
+ // this.onreachPopuBottom()
|
|
|
+ this.onreachPopuBottom(1)
|
|
|
}
|
|
|
}else{
|
|
|
this.$u.toast(`请选择产品`);
|
|
|
}
|
|
|
},
|
|
|
// 已选产品滚动到底部
|
|
|
- onreachPopuBottom(){
|
|
|
- const totalPages = Math.ceil(this.chooseTotal/this.choosePageSize)
|
|
|
- if(this.choosePageNo>=totalPages){
|
|
|
- return
|
|
|
- }
|
|
|
+ onreachPopuBottom(pages){
|
|
|
+ console.log(pages)
|
|
|
+ this.chooseProductList = []
|
|
|
+ console.log(pages,this.totalSelPages)
|
|
|
+ // if(this.choosePageNo>=this.totalSelPages){
|
|
|
+ // return
|
|
|
+ // }
|
|
|
uni.showLoading({
|
|
|
title: '加载中',
|
|
|
mask: true
|
|
|
})
|
|
|
- this.choosePageNo = this.choosePageNo + 1
|
|
|
+ // this.choosePageNo = this.choosePageNo + 1
|
|
|
+ this.choosePageNo = pages
|
|
|
const start = (this.choosePageNo-1)*this.choosePageSize
|
|
|
const end = this.choosePageNo*this.choosePageSize
|
|
|
const list = this.chooseTotal > this.choosePageSize ? this.chooseList.slice(start,end>this.chooseTotal?this.chooseTotal:end) : this.chooseList
|
|
|
- this.chooseProductList = this.chooseProductList.concat(list)
|
|
|
- this.chooseProductList.splice()
|
|
|
+ // this.chooseProductList = this.chooseProductList.concat(list)
|
|
|
+ this.chooseProductList = list
|
|
|
+ // this.chooseProductList.splice()
|
|
|
this.$nextTick(()=>{
|
|
|
uni.hideLoading()
|
|
|
})
|
|
@@ -358,11 +373,24 @@
|
|
|
const rindex = this.chooseProductList.findIndex(item => item.id == index)
|
|
|
if(rindex>=0){
|
|
|
this.chooseProductList.splice(rindex, 1);
|
|
|
- this.chooseList.splice(rindex, 1);
|
|
|
+ // this.chooseList.splice(rindex, 1);
|
|
|
+ }
|
|
|
+ const aindex = this.chooseList.findIndex(item => item.id == index)
|
|
|
+ if(aindex>=0){
|
|
|
+ this.chooseList.splice(aindex, 1);
|
|
|
}
|
|
|
+ // 重新计算分页,并更新当前页
|
|
|
+ this.chooseTotal = this.chooseList.length
|
|
|
+ this.onreachPopuBottom(this.choosePageNo>this.totalSelPages?this.totalSelPages:this.choosePageNo)
|
|
|
+
|
|
|
// 如果数量小于每页数量,自动加载下一页
|
|
|
- if(this.chooseProductList.length < this.choosePageSize){
|
|
|
- this.onreachPopuBottom()
|
|
|
+ // if(this.chooseProductList.length < this.choosePageSize){
|
|
|
+ // this.onreachPopuBottom()
|
|
|
+ // }
|
|
|
+
|
|
|
+ // 如果没有数据了
|
|
|
+ if(this.chooseTotal==0){
|
|
|
+ this.clearChooseData()
|
|
|
}
|
|
|
this.$u.toast(`删除成功!`);
|
|
|
}
|
|
@@ -422,6 +450,10 @@
|
|
|
promoActiveSn: this.promoActiveSn
|
|
|
}
|
|
|
this.status = "loading"
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
queryPromoProductByPage(params).then(res => {
|
|
|
if (res.code == 200 || res.status == 204 || res.status == 200) {
|
|
|
const list = res.data.list||[]
|
|
@@ -457,11 +489,14 @@
|
|
|
_this.noDataText = res.message
|
|
|
}
|
|
|
// 滚动到顶部
|
|
|
- _this.showPage = false
|
|
|
- uni.pageScrollTo({
|
|
|
- scrollTop: 0,
|
|
|
- duration: 300
|
|
|
- });
|
|
|
+ _this.$nextTick(()=>{
|
|
|
+ _this.showPage = false
|
|
|
+ uni.pageScrollTo({
|
|
|
+ scrollTop: 0,
|
|
|
+ duration: 300
|
|
|
+ });
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
_this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
|
|
|
})
|
|
|
},
|
|
@@ -513,7 +548,7 @@
|
|
|
.pages-box{
|
|
|
position: fixed;
|
|
|
left: 10%;
|
|
|
- bottom: 140rpx;
|
|
|
+ bottom: 150rpx;
|
|
|
z-index: 90;
|
|
|
width: 80%;
|
|
|
display: flex;
|
|
@@ -537,7 +572,7 @@
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
flex-grow: 1;
|
|
|
- padding: 90rpx 0 130rpx 0;
|
|
|
+ padding: 90rpx 0 170rpx 0;
|
|
|
.product-list{
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
@@ -686,9 +721,20 @@
|
|
|
font-size: 24rpx;
|
|
|
}
|
|
|
}
|
|
|
+ .choose-product-pages{
|
|
|
+ padding: 10rpx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ bottom: 150rpx;
|
|
|
+ z-index: 20;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
.choose-product-list{
|
|
|
- padding: 100rpx 20rpx 130rpx;
|
|
|
+ padding: 100rpx 20rpx 280rpx;
|
|
|
width: 100%;
|
|
|
+ position: relative;
|
|
|
.choose-product-item{
|
|
|
display: flex;
|
|
|
align-items: center;
|