Commit eeec3e8d authored by chuan.liu's avatar chuan.liu

部分页面新增下拉刷新 上拉加载功能

parent e7440625
......@@ -96,7 +96,7 @@
"titleAlign": "left",
"titleColor": "#333",
"titleSize": "17px",
"backgroundColor": "#fff",
"backgroundColor": "transparent",
"titleText": "配额订单",
"autoBackButton": true
}
......@@ -110,7 +110,7 @@
"titleAlign": "left",
"titleColor": "#333",
"titleSize": "17px",
"backgroundColor": "#fff",
"backgroundColor": "transparent",
"titleText": "非配额订单",
"autoBackButton": true
}
......@@ -124,7 +124,7 @@
"titleAlign": "left",
"titleColor": "#333",
"titleSize": "17px",
"backgroundColor": "#fff",
"backgroundColor": "transparent",
"titleText": "团购订单",
"autoBackButton": true
}
......@@ -149,7 +149,8 @@
}]
},
"bounce": "none"
}
},
"enablePullDownRefresh": true
}
}, {
"path": "pages/select-product/select-product",
......@@ -170,7 +171,9 @@
}]
},
"bounce": "none"
}
},
"enablePullDownRefresh": true
// "onReachBottomDistance": 0
}
}, {
"path": "pages/select-product-pro/select-product-pro",
......@@ -212,7 +215,8 @@
}]
},
"bounce": "none"
}
},
"enablePullDownRefresh": true
}
}, {
"path": "pages/select-group-client/select-group-client",
......@@ -232,7 +236,8 @@
"color": "#555"
}]
},
"bounce": "none"
"bounce": "none",
"enablePullDownRefresh": true
}
}
}, {
......@@ -247,7 +252,8 @@
"titleText": "收货地址",
"autoBackButton": true
}
}
},
"enablePullDownRefresh": true
}
}, {
"path": "pages/purchase/purchase",
......@@ -419,7 +425,8 @@
"titleText": "采购计划",
"autoBackButton": true
}
}
},
"enablePullDownRefresh": true
}
},
{
......
......@@ -2,7 +2,7 @@
<view class="order view">
<view class="status_bar" :style="navHeight"></view>
<view class="listview">
<list class="cell-list" :show-scrollbar='false'>
<list class="cell-list" :show-scrollbar='false' loadmoreoffset='100' @loadmore="scrolltolower">
<cell @click="handleChecked(item)" v-for="item in lists" :key='item.NUMBER'>
<view class="cell-list-block">
<text class="icon-address">{{item.NAME_ORG1.slice(0,1)}}</text>
......@@ -61,6 +61,12 @@
"PAGE": "1",
"PAGESIZE": "10",
},
loadParams: {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
},
lists: [],
selectedAddress: {},
toPageParams: {
......@@ -88,11 +94,24 @@
this.toPageParams.head = JSON.parse(head)
}
},
onPullDownRefresh() {
console.log('refresh');
this.reset()
this.getAddress(true)
setTimeout(function() {
uni.stopPullDownRefresh();
}, 600);
},
created() {
this.getAddress()
this.reset()
this.getAddress(true)
},
methods: {
async getAddress() {
async getAddress(isRefresh) {
if (this.loadParams.isDone) {
return
}
const {
PARTNER,
NAME_ORG1,
......@@ -108,12 +127,53 @@
C_O_NAME
}
}
uni.showLoading({
title: '加载中'
});
setTimeout(function() {
uni.hideLoading();
}, 2000);
const res = await apiAddressSelect(params)
this.lists = res.DATA.map((item) => {
uni.hideLoading();
const {
DATA,
TOTAL
} = res
this.loadParams.total = TOTAL
this.loadParams.totalPage = Math.ceil(TOTAL * 1 / this.page.PAGESIZE * 1)
const dataMap = DATA && DATA.map((item) => {
item.checked = false
return item
})
console.log('getAddress', res)
if (isRefresh) {
this.lists = dataMap
this.loadParams.isDone = false
} else {
this.lists = this.lists.concat(dataMap)
}
},
scrolltolower() {
console.log('onReachBottom');
if (this.page.PAGE < this.loadParams.totalPage) {
this.page.PAGE++
this.getAddress()
} else {
this.loadParams.isDone = true
}
},
reset() {
this.loadParams = {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
}
this.page.PAGE = 1
this.lists = []
},
handleChecked(item) {
this.selectedAddress = item
......
......@@ -23,16 +23,15 @@
<view class="filter-title">
<button type="default" class="filter-btn filter-btn-active"><text
class="filter-btn__text filter-btn-active__text">一周内</text></button>
<button type="default" @click="handleFilter(item)"
:class="{'filter-btn-active':item === filterActiveIndex}" class="filter-btn" v-for="item in 3"
:key='item'>
<button type="default" @tap="handleFilter(item)" class="filter-btn"
:class="{'filter-btn-active':item === filterActiveIndex}" v-for="item in 3" :key='item'>
<text class="filter-btn__text"
:class="{'filter-btn-active__text':item === filterActiveIndex}">{{item}}月内</text></button>
<image @click="handleShowDetail" class="icon-arrow" :class="{'icon-arrow-rotate':ishowDetail}"
<image @tap="handleShowDetail" class="icon-arrow" :class="{'icon-arrow-rotate':ishowDetail}"
src="@/static/image/arrow_up@3x.png" mode="aspectFit"></image>
</view>
<view class="filter-content">
<button type="default" @click="handleFilter(item+3)" class="filter-btn"
<button type="default" @tap="handleFilter(item+3)" class="filter-btn"
:class="{'filter-btn-active':item+3 === filterActiveIndex}" v-for="item in 9" :key='item'><text
class="filter-btn__text"
:class="{'filter-btn-active__text':item+3 === filterActiveIndex}">{{item+3}}月内</text></button>
......@@ -420,7 +419,7 @@
.icon-arrow {
width: 32rpx;
height: 20rpx;
margin-left: 12rpx;
// margin-left: 12rpx;
margin-top: 24rpx;
transition-property: transform;
transition-duration: 0.15s;
......@@ -453,17 +452,21 @@
line-height: 68rpx;
color: #8e8e8e;
font-size: 24rpx;
text-align: center;
}
.filter-btn-active {
background: #f61d30;
color: #fff;
border: 2rpx solid #f61d30;
box-shadow: 0px 4rpx 12rpx 0px rgba(255, 29, 50, 0.56);
// box-shadow: 0px 4rpx 12rpx 0px rgba(255, 29, 50, 0.56);
}
.filter-btn-active__text {
color: #fff;
height: 68rpx;
line-height: 68rpx;
background: #f61d30;
}
.filter-content {
......@@ -471,6 +474,10 @@
flex-wrap: wrap;
}
uni-button:after {
border: 0
}
.empty {
height: 124rpx;
}
......
......@@ -5,15 +5,15 @@
<view class="filter-title">
<button type="default" class="filter-btn filter-btn-active"><text
class="filter-btn__text filter-btn-active__text">一周内</text></button>
<button type="default" @click="handleFilter(item)"
:class="{'filter-btn-active':item === filterActiveIndex}" class="filter-btn" v-for="item in 3"
:key='item'><text class="filter-btn__text"
<button type="default" @tap="handleFilter(item)" class="filter-btn"
:class="{'filter-btn-active':item === filterActiveIndex}" v-for="item in 3" :key='item'><text
class="filter-btn__text"
:class="{'filter-btn-active__text':item === filterActiveIndex}">{{item}}月内</text></button>
<image @click="handleShowDetail" class="icon-arrow" :class="{'icon-arrow-rotate':ishowDetail}"
<image @tap="handleShowDetail" class="icon-arrow" :class="{'icon-arrow-rotate':ishowDetail}"
src="@/static/image/arrow_up@3x.png" mode="aspectFit"></image>
</view>
<view class="filter-content">
<button type="default" @click="handleFilter(item+3)" class="filter-btn"
<button type="default" @tap="handleFilter(item+3)" class="filter-btn"
:class="{'filter-btn-active':item+3 === filterActiveIndex}" v-for="item in 9" :key='item'>
<text class="filter-btn__text"
:class="{'filter-btn-active__text':item+3 === filterActiveIndex}">{{item+3}}月内</text></button>
......@@ -335,7 +335,7 @@
.icon-arrow {
width: 32rpx;
height: 20rpx;
margin-left: 12rpx;
// margin-left: 12rpx;
margin-top: 24rpx;
transition-property: transform;
transition-duration: 0.15s;
......@@ -370,17 +370,25 @@
line-height: 68rpx;
color: #8e8e8e;
font-size: 24rpx;
text-align: center;
}
.filter-btn-active {
background: #f61d30;
color: #fff;
border: 2rpx solid #f61d30;
box-shadow: 0px 4rpx 12rpx 0px rgba(255, 29, 50, 0.56);
// box-shadow: 0px 4rpx 12rpx 0px rgba(255, 29, 50, 0.56);
}
.filter-btn-active__text {
color: #fff;
height: 68rpx;
line-height: 68rpx;
background: #f61d30;
}
uni-button:after {
border: 0
}
.filter-content {
......
......@@ -5,15 +5,15 @@
<view class="filter-title">
<button type="default" class="filter-btn filter-btn-active"><text
class="filter-btn__text filter-btn-active__text">一周内</text></button>
<button type="default" @click="handleFilter(item)"
:class="{'filter-btn-active':item === filterActiveIndex}" class="filter-btn" v-for="item in 3"
:key='item'><text class="filter-btn__text"
<button type="default" @tap="handleFilter(item)" class="filter-btn"
:class="{'filter-btn-active':item === filterActiveIndex}" v-for="item in 3" :key='item'><text
class="filter-btn__text"
:class="{'filter-btn-active__text':item === filterActiveIndex}">{{item}}月内</text></button>
<image @click="handleShowDetail" class="icon-arrow" :class="{'icon-arrow-rotate':ishowDetail}"
<image @tap="handleShowDetail" class="icon-arrow" :class="{'icon-arrow-rotate':ishowDetail}"
src="@/static/image/arrow_up@3x.png" mode="aspectFit"></image>
</view>
<view class="filter-content">
<button type="default" @click="handleFilter(item+3)" class="filter-btn"
<button type="default" @tap="handleFilter(item+3)" class="filter-btn"
:class="{'filter-btn-active':item+3 === filterActiveIndex}" v-for="item in 9" :key='item'>
<text class="filter-btn__text"
:class="{'filter-btn-active__text':item+3 === filterActiveIndex}">{{item+3}}月内</text></button>
......@@ -108,7 +108,13 @@
page: {
"PAGE": "1",
"PAGESIZE": "10",
}
},
loadParams: {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
},
}
},
computed: {
......@@ -163,6 +169,9 @@
} = res
const data_list = DATA;
this.page.PAGE = PAGE
this.loadParams.total = TOTAL
this.loadParams.totalPage = Math.ceil(TOTAL * 1 / this.page.PAGESIZE * 1)
this.isNoData = (data_list.length <= 0);
......@@ -196,8 +205,12 @@
},
loadMore(e) {
console.log('loadMore')
this.page.PAGE++
this.loadData();
if (this.page.PAGE < this.loadParams.totalPage) {
this.page.PAGE++
this.loadData();
} else {
this.loadingText = '已到底'
}
},
clear() {
this.dataList.length = 0;
......@@ -326,7 +339,7 @@
.icon-arrow {
width: 32rpx;
height: 20rpx;
margin-left: 12rpx;
// margin-left: 12rpx;
margin-top: 24rpx;
transition-property: transform;
transition-duration: 0.15s;
......@@ -360,17 +373,21 @@
height: 68rpx;
line-height: 68rpx;
color: #8e8e8e;
text-align: center;
font-size: 24rpx;
}
.filter-btn-active {
background: #f61d30;
border: 2rpx solid #f61d30;
box-shadow: 0px 4rpx 12rpx 0px rgba(255, 29, 50, 0.56);
// box-shadow: 0px 4rpx 12rpx 0px rgba(255, 29, 50, 0.56);
}
.filter-btn-active__text {
color: #fff;
height: 68rpx;
line-height: 68rpx;
background: #f61d30;
}
.filter-content {
......@@ -378,6 +395,10 @@
flex-wrap: wrap;
}
uni-button:after {
border: 0
}
.refresh {
justify-content: center;
}
......@@ -421,6 +442,7 @@
}
.loading-more {
flex: 1;
align-items: center;
justify-content: center;
padding-top: 14px;
......
......@@ -39,7 +39,7 @@
</view>
</view>
<list class="scroll-area view">
<list class="scroll-area view" loadmoreoffset='100' @loadmore="scrolltolower" :show-scrollbar='false'>
<cell v-for="(item,index) in lists" :key="item.plan_number">
<view class="scroll-item">
<view class="item-block item-block-code">
......@@ -122,6 +122,12 @@
"PAGE": "1",
"PAGESIZE": "10",
},
loadParams: {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
},
selectedSalePlan: {},
selectedSalePlanTypes: [],
typesIndex: 0,
......@@ -147,30 +153,83 @@
},
},
onPullDownRefresh() {
console.log('refresh');
this.reset()
this.getSalesPlan(true)
setTimeout(function() {
uni.stopPullDownRefresh();
}, 600);
},
created() {
this.condition.RT_GJAHR[0].LOW = timeFormat(new Date(), 'yyyy')
this.getSalesPlanTypes();
this.reset()
this.getSalesPlanTypes(true);
},
methods: {
async getSalesPlan() {
async getSalesPlan(isRefresh) {
if (this.loadParams.isDone) {
return
}
const params = {
...this.page,
...this.condition
}
uni.showLoading({
title: '加载中'
});
setTimeout(function() {
uni.hideLoading();
}, 2000);
const res = await apiSalesPlan(params)
uni.hideLoading();
const {
lt_result,
page,
pagesize
pagesize,
total
} = res
this.page.PAGE = page
this.page.PAGESIZE = pagesize
this.lists = lt_result.map((item) => {
this.loadParams.total = total
this.loadParams.totalPage = Math.ceil(total * 1 / this.page.PAGESIZE * 1)
const dataMap = lt_result && lt_result.map((item) => {
item.checked = false
return item
})
if (isRefresh) {
this.lists = dataMap
this.loadParams.isDone = false
} else {
this.lists = this.lists.concat(dataMap)
}
},
scrolltolower() {
console.log('onReachBottom');
if (this.page.PAGE < this.loadParams.totalPage) {
this.page.PAGE++
this.getSalesPlan()
} else {
this.loadParams.isDone = true
}
},
reset() {
this.loadParams = {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
}
this.page.PAGE = 1
this.lists = []
},
async getSalesPlanTypes() {
const res = await apiSalesPlanTypesSelect()
this.selectedSalePlanTypes = res.DATA
......
......@@ -590,9 +590,10 @@
}
.title-first__text {
font-size: 28rpx;
font-size: 28px;
color: #333333;
font-weight: 600;
font-family: AvenirNext, AvenirNext-BoldItalic;
}
......@@ -702,7 +703,7 @@
display: flex;
justify-content: space-between;
height: 40rpx;
margin-top: 48rpx;
margin-top: 38rpx;
margin-bottom: 32rpx;
padding: 0 24rpx;
}
......
......@@ -33,36 +33,40 @@
</button>
</view>
<uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="(item,index) in lists" :key='item.ID' :auto-close="false" :disabled='true'
:show="isOpened" @click="handleClick">
<template v-slot:left>
<view class="swipe-right-block" @click="handleChecked($event,item, index)"><text
class="swipe-right-block__text"
:class="{'swipe-right-block__active':item.checked}"></text>
</view>
</template>
<view class="middle view planout-block-item">
<view class="text-block">
<text class="middle-date middle-date-select">商机编码</text>
<text class="middle-date-des middle-date-des-select">{{item.ID}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">商机名称</text>
<text class="middle-date-des middle-date-des-select">{{item.NAME}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">客户编号</text>
<text class="middle-date-des middle-date-des-select">{{item.CUSTOMERCODE}}</text>
</view>
<view class="text-block text-block-last">
<text class="middle-date middle-date-select">客户名称</text>
<text class="middle-date-des middle-date-des-select">{{item.CUSTOMERNAME}}</text>
<scroll-view class="scroll-area" :style='scrollHeight' scroll-y="true" lower-threshold='150'
@scrolltolower='scrolltolower'>
<uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="(item,index) in lists" :key='item.ID' :auto-close="false"
:disabled='true' :show="isOpened" @click="handleClick">
<template v-slot:left>
<view class="swipe-right-block" @click="handleChecked($event,item, index)"><text
class="swipe-right-block__text"
:class="{'swipe-right-block__active':item.checked}"></text>
</view>
</template>
<view class="middle view planout-block-item">
<view class="text-block">
<text class="middle-date middle-date-select">商机编码</text>
<text class="middle-date-des middle-date-des-select">{{item.ID}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">商机名称</text>
<text class="middle-date-des middle-date-des-select">{{item.NAME}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">客户编号</text>
<text class="middle-date-des middle-date-des-select">{{item.CUSTOMERCODE}}</text>
</view>
<view class="text-block text-block-last">
<text class="middle-date middle-date-select">客户名称</text>
<text class="middle-date-des middle-date-des-select">{{item.CUSTOMERNAME}}</text>
</view>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-swipe-action-item>
</uni-swipe-action>
</scroll-view>
</view>
</view>
</template>
......@@ -89,6 +93,12 @@
"PAGE": "1",
"PAGESIZE": "10",
},
loadParams: {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
},
lists: [],
selectedBusiness: {},
selectedGroupClient: {},
......@@ -104,6 +114,11 @@
'height': `${this.sysinfo.safeArea.top + 44}px`
}
},
scrollHeight() {
return {
'height': `${this.sysinfo.safeArea.height - 297- 44 - 20}px`
}
}
},
onNavigationBarButtonTap(e) {
// console.log('onNavigationBarButtonTap:', e, this.isOpened, this.selectedBusiness);
......@@ -142,8 +157,17 @@
this.toPageParams.page = from
}
},
onPullDownRefresh() {
console.log('refresh');
this.reset()
this.getBusiness(true)
setTimeout(function() {
uni.stopPullDownRefresh();
}, 600);
},
created() {
this.getBusiness();
this.reset()
this.getBusiness(true);
},
mounted() {
console.log('监听到事件来自 update');
......@@ -157,7 +181,11 @@
})
},
methods: {
async getBusiness() {
async getBusiness(isRefresh) {
if (this.loadParams.isDone) {
return
}
const {
BUNAME,
OWNERCODE,
......@@ -171,15 +199,58 @@
CUNAME: ''
},
}
uni.showLoading({
title: '加载中'
});
setTimeout(function() {
uni.hideLoading();
}, 2000);
const res = await apiBusinessSelect(params)
this.lists = res.DATA.map((item) => {
uni.hideLoading();
const {
DATA,
TOTAL
} = res
this.loadParams.total = TOTAL
this.loadParams.totalPage = Math.ceil(TOTAL * 1 / this.page.PAGESIZE * 1)
const dataMap = res.DATA.map((item) => {
item.checked = false
return item
})
console.log('ddd2', res)
if (isRefresh) {
this.lists = dataMap
this.loadParams.isDone = false
} else {
this.lists = this.lists.concat(dataMap)
}
},
scrolltolower() {
console.log('onReachBottom');
if (this.page.PAGE < this.loadParams.totalPage) {
this.page.PAGE++
this.getBusiness()
} else {
this.loadParams.isDone = true
}
},
reset() {
this.loadParams = {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
}
this.page.PAGE = 1
this.lists = []
},
search() {
this.reset()
this.getBusiness(true)
},
bindPickerChange(e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
......
......@@ -32,35 +32,39 @@
</button>
</view>
<uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="(item,index) in lists" :key='item.ID' :auto-close="false" :disabled='true'
:show="isOpened" @click="handleClick">
<template v-slot:left>
<view class="swipe-right-block" @click="handleChecked($event,item, index)"><text
class="swipe-right-block__text"
:class="{'swipe-right-block__active':item.checked}"></text>
</view>
</template>
<view class="middle view planout-block-item">
<view class="text-block">
<text class="middle-date middle-date-select">团购编码</text>
<text class="middle-date-des middle-date-des-select">{{item.ID}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">团购名称</text>
<text class="middle-date-des middle-date-des-select">{{item.OBJNAME}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">城市</text>
<text class="middle-date-des middle-date-des-select">{{item.CITYDESC}}</text>
</view>
<view class="text-block text-block-last">
<text class="middle-date middle-date-select">地址</text>
<text class="middle-date-des middle-date-des-select">{{item.ADDRESS}}</text>
<scroll-view class="scroll-area" :style='scrollHeight' scroll-y="true" lower-threshold='150'
@scrolltolower='scrolltolower'>
<uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="(item,index) in lists" :key='item.ID' :auto-close="false"
:disabled='true' :show="isOpened" @click="handleClick">
<template v-slot:left>
<view class="swipe-right-block" @click="handleChecked($event,item, index)"><text
class="swipe-right-block__text"
:class="{'swipe-right-block__active':item.checked}"></text>
</view>
</template>
<view class="middle view planout-block-item">
<view class="text-block">
<text class="middle-date middle-date-select">团购编码</text>
<text class="middle-date-des middle-date-des-select">{{item.ID}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">团购名称</text>
<text class="middle-date-des middle-date-des-select">{{item.OBJNAME}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">城市</text>
<text class="middle-date-des middle-date-des-select">{{item.CITYDESC}}</text>
</view>
<view class="text-block text-block-last">
<text class="middle-date middle-date-select">地址</text>
<text class="middle-date-des middle-date-des-select">{{item.ADDRESS}}</text>
</view>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-swipe-action-item>
</uni-swipe-action>
</scroll-view>
</view>
</view>
</template>
......@@ -86,6 +90,12 @@
"PAGE": "1",
"PAGESIZE": "10",
},
loadParams: {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
},
lists: [],
selectedGroupClient: {},
selectedSalePlanTypes: [{
......@@ -114,6 +124,11 @@
'height': `${this.sysinfo.safeArea.top + 44}px`
}
},
scrollHeight() {
return {
'height': `${this.sysinfo.safeArea.height - 237- 44 - 20}px`
}
}
},
onNavigationBarButtonTap(e) {
......@@ -154,11 +169,24 @@
this.toPageParams.page = from
}
},
onPullDownRefresh() {
console.log('refresh');
this.reset()
this.getGroupClient(true)
setTimeout(function() {
uni.stopPullDownRefresh();
}, 600);
},
created() {
this.getGroupClient()
this.reset()
this.getGroupClient(true)
},
methods: {
async getGroupClient() {
async getGroupClient(isRefresh) {
if (this.loadParams.isDone) {
return
}
const {
INFOTP,
COMPANY_NAME
......@@ -170,12 +198,52 @@
COMPANY_NAME
},
}
uni.showLoading({
title: '加载中'
});
setTimeout(function() {
uni.hideLoading();
}, 2000);
const res = await apiGroupClientSelect(params)
this.lists = res.DATA.map((item) => {
uni.hideLoading();
const {
DATA,
TOTAL
} = res
this.loadParams.total = TOTAL
this.loadParams.totalPage = Math.ceil(TOTAL * 1 / this.page.PAGESIZE * 1)
const dataMap = DATA && DATA.map((item) => {
item.checked = false
return item
})
console.log('ddd2', res)
if (isRefresh) {
this.lists = dataMap
this.loadParams.isDone = false
} else {
this.lists = this.lists.concat(dataMap)
}
},
scrolltolower() {
console.log('onReachBottom');
if (this.page.PAGE < this.loadParams.totalPage) {
this.page.PAGE++
this.getGroupClient()
} else {
this.loadParams.isDone = true
}
},
reset() {
this.loadParams = {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
}
this.page.PAGE = 1
this.lists = []
},
// async getSalesPlanTypes() {
// const res = await apiSalesPlanTypesSelect()
......@@ -183,8 +251,8 @@
// console.log('getSalesPlanTypes', res)
// },
search() {
this.page.PAGE = 1
this.getGroupClient()
this.reset()
this.getGroupClient(true)
},
bindPickerTypesChange(e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
......@@ -334,7 +402,6 @@
.planout-block-lists {
display: flex;
flex-direction: column;
overflow: hidden;
}
.uni-swipe {
......
......@@ -22,36 +22,39 @@
</button>
</view>
<uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="(item,index) in lists" :key='item.PRODUCT_ID' :auto-close="false"
:disabled='true' :show="isOpened" @click="handleClick">
<template v-slot:left>
<view class="swipe-right-block" @click="handleChecked($event,item, index)"><text
class="swipe-right-block__text"
:class="{'swipe-right-block__active':item.checked}"></text>
<scroll-view class="scroll-area" :style='scrollHeight' scroll-y="true" lower-threshold='150'
@scrolltolower='scrolltolower'>
<uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="(item,index) in lists" :key='item.PRODUCT_ID' :auto-close="false"
:disabled='true' :show="isOpened" @click="handleClick">
<template v-slot:left>
<view class="swipe-right-block" @click="handleChecked($event,item, index)"><text
class="swipe-right-block__text"
:class="{'swipe-right-block__active':item.checked}"></text>
</view>
</template>
<view class="middle view planout-block-item">
<view class="text-block">
<text class="middle-date middle-date-select">产品编码</text>
<text class="middle-date-des middle-date-des-select">{{item.PRODUCT_ID}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">描述</text>
<text class="middle-date-des middle-date-des-select">{{item.SHORT_TEXT}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">产品类型</text>
<text class="middle-date-des middle-date-des-select">{{item.CHFL_D}}</text>
</view>
<view class="text-block text-block-last">
<text class="middle-date middle-date-select">价格</text>
<text class="middle-date-des middle-date-des-select">{{item.NORMS}}</text>
</view>
</view>
</template>
<view class="middle view planout-block-item">
<view class="text-block">
<text class="middle-date middle-date-select">产品编码</text>
<text class="middle-date-des middle-date-des-select">{{item.PRODUCT_ID}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">描述</text>
<text class="middle-date-des middle-date-des-select">{{item.SHORT_TEXT}}</text>
</view>
<view class="text-block">
<text class="middle-date middle-date-select">产品类型</text>
<text class="middle-date-des middle-date-des-select">{{item.CHFL_D}}</text>
</view>
<view class="text-block text-block-last">
<text class="middle-date middle-date-select">价格</text>
<text class="middle-date-des middle-date-des-select">{{item.NORMS}}</text>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-swipe-action-item>
</uni-swipe-action>
</scroll-view>
</view>
</view>
</template>
......@@ -75,8 +78,6 @@
data() {
return {
isOpened: 'none',
array: ['2021', '2020', '2019', '2018'],
index: 0,
condition: {
product: '',
code: '',
......@@ -85,6 +86,12 @@
"PAGE": "1",
"PAGESIZE": "10",
},
loadParams: {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
},
lists: [{
checked: false,
"PRODUCT_ID": "040001005280116160",
......@@ -111,6 +118,11 @@
return {
'height': `${this.sysinfo.safeArea.top + 44}px`
}
},
scrollHeight() {
return {
'height': `${this.sysinfo.safeArea.height - 237- 44 - 20}px`
}
}
},
onNavigationBarButtonTap(e) {
......@@ -143,6 +155,23 @@
// })
// #endif
},
// onLoad(options) {
// setTimeout(function() {
// console.log('start pulldown');
// }, 1000);
// uni.startPullDownRefresh();
// },
onPullDownRefresh() {
console.log('refresh');
this.reset()
this.getProduct(true)
setTimeout(function() {
uni.stopPullDownRefresh();
}, 600);
},
// onReachBottom() {
// console.log('onReachBottom');
// },
onLoad(option) {
console.log('select-product', option)
const {
......@@ -157,14 +186,15 @@
this.toPageParams.head = JSON.parse(head)
},
created() {
this.getProduct();
this.reset()
this.getProduct(true);
},
methods: {
search() {
this.page.PAGE = 1
this.getProduct()
},
async getProduct() {
async getProduct(isRefresh) {
if (this.loadParams.isDone) {
return
}
const params = {
...this.page,
"MODE": modeMap[this.toPageParams.page],
......@@ -174,16 +204,57 @@
"PRODUCT_ID": this.condition.code,
},
}
uni.showLoading({
title: '加载中'
});
setTimeout(function() {
uni.hideLoading();
}, 2000);
const res = await apiProductSelect(params)
uni.hideLoading();
this.lists = res && res.DATA.map((item) => {
const {
DATA,
TOTAL
} = res
this.loadParams.total = TOTAL
this.loadParams.totalPage = Math.ceil(TOTAL * 1 / this.page.PAGESIZE * 1)
const dataMap = DATA && DATA.map((item) => {
item.checked = false
return item
})
if (isRefresh) {
this.lists = dataMap
this.loadParams.isDone = false
} else {
this.lists = this.lists.concat(dataMap)
}
},
bindPickerChange(e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.index = e.detail.value
scrolltolower() {
console.log('onReachBottom');
if (this.page.PAGE < this.loadParams.totalPage) {
this.page.PAGE++
this.getProduct()
} else {
this.loadParams.isDone = true
}
},
reset() {
this.loadParams = {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
}
this.page.PAGE = 1
this.lists = []
},
search() {
this.reset()
this.getProduct(true)
},
handleClick(e, content, index) {
console.log('click当前索引:', e, content, index);
......@@ -324,10 +395,13 @@
z-index: 10;
}
.scroll-area {
overflow-y: scroll;
}
.planout-block-lists {
display: flex;
flex-direction: column;
overflow: hidden;
}
.uni-swipe {
......
......@@ -58,36 +58,40 @@
</button>
</view>
<uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="(item,index) in lists" :key='index' :threshold='100' :auto-close="false"
:disabled='true' :show="isOpened">
<template v-slot:left>
<view class="swipe-right-block" @click.stop="handleChecked($event,item, index)"><text
class="swipe-right-block__text"
:class="{'swipe-right-block__active':item.checked}"></text>
</view>
</template>
<view class="middle view planout-block-item">
<view class="text-block">
<text class="middle-date">计划编码</text>
<text class="middle-date-des">{{item.PLAN_NUMBER}}</text>
</view>
<view class="text-block">
<text class="middle-date">类型</text>
<text class="middle-date-des">{{item.PLAN_TYPE}}</text>
</view>
<view class="text-block">
<text class="middle-date">产品</text>
<text class="middle-date-des">{{item.WLYBRAND}}</text>
</view>
<view class="text-block text-block-last">
<text class="middle-date">可用件数</text>
<text class="middle-date-des">{{item.REMAIN_QTY}}</text>
<scroll-view class="scroll-area" :style='scrollHeight' scroll-y="true" lower-threshold='150'
@scrolltolower='scrolltolower'>
<uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="(item,index) in lists" :key='index' :threshold='100'
:auto-close="false" :disabled='true' :show="isOpened">
<template v-slot:left>
<view class="swipe-right-block" @click.stop="handleChecked($event,item, index)"><text
class="swipe-right-block__text"
:class="{'swipe-right-block__active':item.checked}"></text>
</view>
</template>
<view class="middle view planout-block-item">
<view class="text-block">
<text class="middle-date">计划编码</text>
<text class="middle-date-des">{{item.PLAN_NUMBER}}</text>
</view>
<view class="text-block">
<text class="middle-date">类型</text>
<text class="middle-date-des">{{item.PLAN_TYPE}}</text>
</view>
<view class="text-block">
<text class="middle-date">产品</text>
<text class="middle-date-des">{{item.WLYBRAND}}</text>
</view>
<view class="text-block text-block-last">
<text class="middle-date">可用件数</text>
<text class="middle-date-des">{{item.REMAIN_QTY}}</text>
</view>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-swipe-action-item>
</uni-swipe-action>
</scroll-view>
</view>
</view>
</template>
......@@ -115,6 +119,12 @@
"PAGE": "1",
"PAGESIZE": "10",
},
loadParams: {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
},
lists: [{
checked: false,
"REPORT_TYPE": "正式提报",
......@@ -147,6 +157,11 @@
'height': `${this.sysinfo.safeArea.top + 44}px`
}
},
scrollHeight() {
return {
'height': `${this.sysinfo.safeArea.height - 297- 44 - 20}px`
}
}
},
onNavigationBarButtonTap(e) {
// console.log('onNavigationBarButtonTap:', e, this.isOpened, this.selectedSalePlan);
......@@ -190,13 +205,27 @@
this.toPageParams.head = JSON.parse(head)
}
},
onPullDownRefresh() {
console.log('refresh');
this.reset()
this.getSalesPlan(true)
setTimeout(function() {
uni.stopPullDownRefresh();
}, 600);
},
created() {
this.condition.GJAHR = timeFormat(new Date(), 'yyyy')
this.condition.MONAT = timeFormat(new Date(), 'mm')
this.getSalesPlanTypes();
this.reset()
this.getSalesPlan(true);
},
methods: {
async getSalesPlan() {
async getSalesPlan(isRefresh) {
if (this.loadParams.isDone) {
return
}
const {
GJAHR,
MONAT,
......@@ -213,18 +242,62 @@
PLAN_TYPE
},
}
uni.showLoading({
title: '加载中'
});
setTimeout(function() {
uni.hideLoading();
}, 2000);
const res = await apiSalesPlanSelect(params)
this.lists = res.DATA.map((item) => {
uni.hideLoading();
const {
DATA,
TOTAL
} = res
this.loadParams.total = TOTAL
this.loadParams.totalPage = Math.ceil(TOTAL * 1 / this.page.PAGESIZE * 1)
const dataMap = DATA && DATA.map((item) => {
item.checked = false
return item
})
if (isRefresh) {
this.lists = dataMap
this.loadParams.isDone = false
} else {
this.lists = this.lists.concat(dataMap)
}
},
scrolltolower() {
console.log('onReachBottom');
if (this.page.PAGE < this.loadParams.totalPage) {
this.page.PAGE++
this.getSalesPlan()
} else {
this.loadParams.isDone = true
}
},
reset() {
this.loadParams = {
total: 0,
totalPage: 1,
isDone: false,
isRefresh: false
}
this.page.PAGE = 1
this.lists = []
},
async getSalesPlanTypes() {
const res = await apiSalesPlanTypesSelect()
this.selectedSalePlanTypes = res.DATA
},
search() {
this.getSalesPlan();
this.reset()
this.getSalesPlan(true);
},
bindPickerTypesChange(e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
......
......@@ -23,16 +23,15 @@
<view class="filter-title">
<button type="default" class="filter-btn filter-btn-active"><text
class="filter-btn__text filter-btn-active__text">一周内</text></button>
<button type="default" @click="handleFilter(item)"
:class="{'filter-btn-active':item === filterActiveIndex}" class="filter-btn" v-for="item in 3"
:key='item'>
<button type="default" @tap="handleFilter(item)" class="filter-btn"
:class="{'filter-btn-active':item === filterActiveIndex}" v-for="item in 3" :key='item'>
<text class="filter-btn__text"
:class="{'filter-btn-active__text':item === filterActiveIndex}">{{item}}月内</text></button>
<image @click="handleShowDetail" class="icon-arrow" :class="{'icon-arrow-rotate':ishowDetail}"
<image @tap="handleShowDetail" class="icon-arrow" :class="{'icon-arrow-rotate':ishowDetail}"
src="@/static/image/arrow_up@3x.png" mode="aspectFit"></image>
</view>
<view class="filter-content">
<button type="default" @click="handleFilter(item+3)" class="filter-btn"
<button type="default" @tap="handleFilter(item+3)" class="filter-btn"
:class="{'filter-btn-active':item+3 === filterActiveIndex}" v-for="item in 9" :key='item'><text
class="filter-btn__text"
:class="{'filter-btn-active__text':item+3 === filterActiveIndex}">{{item+3}}月内</text></button>
......@@ -414,7 +413,7 @@
.icon-arrow {
width: 32rpx;
height: 20rpx;
margin-left: 12rpx;
// margin-left: 12rpx;
margin-top: 24rpx;
transition-property: transform;
transition-duration: 0.15s;
......@@ -445,6 +444,7 @@
.filter-btn__text {
height: 68rpx;
line-height: 68rpx;
text-align: center;
color: #8e8e8e;
font-size: 24rpx;
}
......@@ -453,11 +453,14 @@
background: #f61d30;
color: #fff;
border: 2rpx solid #f61d30;
box-shadow: 0px 4rpx 12rpx 0px rgba(255, 29, 50, 0.56);
// box-shadow: 0px 4rpx 12rpx 0px rgba(255, 29, 50, 0.56);
}
.filter-btn-active__text {
color: #fff;
height: 68rpx;
line-height: 68rpx;
background: #f61d30;
}
.filter-content {
......@@ -465,6 +468,10 @@
flex-wrap: wrap;
}
uni-button:after {
border: 0
}
.empty {
height: 124rpx;
}
......
......@@ -125,24 +125,24 @@
...mapState(['sysinfo', 'userInfo'])
},
async created() {
// this.getBpPrice()
const parm = {
"user_bp": "50000215",
"role": "WLY001",
"page": "1",
"pagesize": "1",
"PROCESS_TYPE": [{
"SIGN": "I",
"OPTION": "EQ",
"LOW": "ZS02"
}],
"zzfld00002j": [{
"SIGN": "I",
"OPTION": "EQ",
"LOW": "V013"
}]
}
apiGetSalesOrder(parm)
this.getBpPrice()
// const parm = {
// "user_bp": "50000215",
// "role": "WLY001",
// "page": "1",
// "pagesize": "1",
// "PROCESS_TYPE": [{
// "SIGN": "I",
// "OPTION": "EQ",
// "LOW": "ZS02"
// }],
// "zzfld00002j": [{
// "SIGN": "I",
// "OPTION": "EQ",
// "LOW": "V013"
// }]
// }
// apiGetSalesOrder(parm)
},
methods: {
async getBpPrice() {
......
......@@ -78,6 +78,13 @@ class Request {
// title: response.errMsg
// });
// }
if (response.statusCode == 500) {
uni.showToast({
title: '服务器异常',
duration: 2000,
icon: 'none'
})
}
reject(response)
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment