|
@@ -32,8 +32,6 @@
|
|
|
</uni-td>
|
|
|
</uni-tr>
|
|
|
</uni-table>
|
|
|
- <uni-fab ref="fab" :horizontal="right" :vertical="bottom"
|
|
|
- @fabClick="fabClick()"/>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -64,11 +62,11 @@ export default {
|
|
|
quotationsList: [
|
|
|
// 这里是列表的数据
|
|
|
],
|
|
|
- //查询参数
|
|
|
queryParams: {
|
|
|
- // pageNum: 1,
|
|
|
- // pageSize: 10,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 15,
|
|
|
id: null,
|
|
|
+ type: null,
|
|
|
},
|
|
|
//表单数据
|
|
|
form: {},
|
|
@@ -77,6 +75,19 @@ export default {
|
|
|
imageList: []
|
|
|
}
|
|
|
},
|
|
|
+ onPullDownRefresh() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.quotationsList = [];
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ //上拉加载
|
|
|
+ onReachBottom() {
|
|
|
+ if (this.status === 'noMore') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.queryParams.pageNum++;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
onLoad(e) {
|
|
|
this.FatherType = e.type;
|
|
|
this.getList();
|
|
@@ -84,23 +95,36 @@ export default {
|
|
|
methods: {
|
|
|
getList(row) {
|
|
|
// 这里是获取列表的方法
|
|
|
- this.form.type = this.FatherType
|
|
|
- listQuotations(this.form).then(response => {
|
|
|
- this.quotationsList = response.rows.map(item => {
|
|
|
- let date = new Date(item.createTime);
|
|
|
- item.createTime = date.toLocaleDateString('zh-CN', {dateStyle: 'short'});
|
|
|
- return item;
|
|
|
- });
|
|
|
+ this.queryParams.type = this.FatherType
|
|
|
+ listQuotations(this.queryParams).then(response => {
|
|
|
+ if (this.queryParams.pageNum === 1) {
|
|
|
+ this.quotationsList = this.dataFormat(response.rows)
|
|
|
+ } else {
|
|
|
+ this.quotationsList = this.quotationsList.concat(this.dataFormat(response.rows));
|
|
|
+ }
|
|
|
+ // 判断是否还有更多数据
|
|
|
+ if (response.rows.length < this.queryParams.pageSize) {
|
|
|
+ this.status = 'noMore'; // 没有更多数据
|
|
|
+ } else {
|
|
|
+ this.status = 'more'; // 还有更多数据
|
|
|
+ }
|
|
|
});
|
|
|
this.forms.parentId = this.FatherType
|
|
|
//获取分类树的方法
|
|
|
QuotationsList(this.forms).then(response => {
|
|
|
//取出response.rows中所有homeDisplay为1的数据
|
|
|
- this.categories = response.rows.filter(item => item.homeDisplay === 1);
|
|
|
+ this.categories = response.rows
|
|
|
+ });
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ },
|
|
|
+ //格式化时间
|
|
|
+ dataFormat(rows) {
|
|
|
+ return rows.map(item => {
|
|
|
+ let date = new Date(item.createTime);
|
|
|
+ item.createTime = date.toLocaleDateString('zh-CN', {dateStyle: 'short'});
|
|
|
+ return item;
|
|
|
});
|
|
|
},
|
|
|
- //递归查询分类的父级
|
|
|
-
|
|
|
//根据分类id查询列表
|
|
|
change(e) {
|
|
|
this.queryParams.type = e.detail.index;
|
|
@@ -112,12 +136,6 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- //悬浮按钮点击事件
|
|
|
- fabClick() {
|
|
|
- uni.navigateTo({
|
|
|
- url: '../quotations/quotationsForm'
|
|
|
- });
|
|
|
- },
|
|
|
updateImg(imgList) {
|
|
|
this.imageList = imgList;
|
|
|
}
|