From 0256141ad70be0d254fd9958e8d28867db1d7531 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期三, 06 九月 2023 13:47:07 +0800
Subject: [PATCH] 小程序
---
minipro_standard/pages_adjust/components/Material.vue | 79 +++++++++++++++++++++++++++++----------
1 files changed, 58 insertions(+), 21 deletions(-)
diff --git a/minipro_standard/pages_adjust/components/Material.vue b/minipro_standard/pages_adjust/components/Material.vue
index 0685993..b0dd60e 100644
--- a/minipro_standard/pages_adjust/components/Material.vue
+++ b/minipro_standard/pages_adjust/components/Material.vue
@@ -5,25 +5,23 @@
</view>
<view class="content">
<view class="content_search">
- <u-search :showAction="false" placeholder="鎼滅储鐗╂枡鍚嶇О" v-model="keyword"></u-search>
+ <u-search :showAction="false" placeholder="鎼滅储鐗╂枡鍚嶇О" v-model="form.name" @search="searchInput"></u-search>
</view>
<div class="content_total">鍏眥{total}}鏉℃暟鎹�</div>
- <view class="content_list">
- <u-list @scrolltolower="scrolltolower">
- <u-list-item v-for="(item, index) in indexList" :key="index">
- <div class="content_list_item" @click="getVal(item)">
- <div class="content_list_item_name">
- <span>{{item.name}}</span>
- </div>
- </div>
- </u-list-item>
- </u-list>
- </view>
+ <scroll-view scroll-y class="content_list" @scrolltolower="loadmore">
+ <div class="content_list_item" v-for="(item, index) in list" :key="index" @click="getVal(item)">
+ <div class="content_list_item_name">
+ <span>{{item.mmodelUnionName}}</span>
+ </div>
+ </div>
+ </scroll-view>
</view>
</u-popup>
</template>
<script>
+ import { materialDistributeExt } from '@/util/api/ExWarehouse'
+
export default {
props: {
show: Boolean
@@ -32,25 +30,64 @@
return {
keyword: '',
total: 0,
- indexList: []
+ list: [],
+ loading: false,
+ finished: false,
+ refreshing: false,
+ form: {
+ capacity: 50,
+ page: 0,
+ total: 0,
+ name: ''
+ }
};
},
methods: {
+ searchInput() {
+ this.form.page = 0
+ this.finished = false
+ this.list = []
+ this.loadmore()
+ },
getVal(item) {
this.$emit('value', item)
},
open() {
- this.indexList = []
- this.loadmore()
- },
- scrolltolower() {
+ this.form.page = 0
+ this.finished = false
+ this.list = []
this.loadmore()
},
loadmore() {
- for (let i = 0; i < 20; i++) {
- this.indexList.push({
- id: i,
- name: `浠撳簱${i}`
+ if (!this.finished) {
+ this.loading = true;
+ this.form.page = this.form.page += 1
+ materialDistributeExt({
+ capacity: this.form.capacity,
+ page: this.form.page,
+ model: {
+ mmodelUnionName: this.form.name,
+ status: 1
+ }
+ }).then(res => {
+ if (this.refreshing) {
+ this.list = []
+ this.refreshing = false;
+ }
+ this.loading = false;
+ if (res.code === 200 && res.data.records && res.data.records.length !== 0) {
+ this.form.total = res.data.total
+ this.list.push(...res.data.records)
+ } else {
+ this.finished = true;
+ }
+ }).catch(err => {
+ this.loading = false;
+ this.finished = true;
+ if (this.refreshing) {
+ this.list = []
+ this.refreshing = false;
+ }
})
}
},
--
Gitblit v1.9.3