diff --git a/src/pages/wms/Raw/SapStock/index.vue b/src/pages/wms/Raw/SapStock/index.vue
index d0ec491..e006b11 100644
--- a/src/pages/wms/Raw/SapStock/index.vue
+++ b/src/pages/wms/Raw/SapStock/index.vue
@@ -14,25 +14,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
查询
@@ -48,22 +44,16 @@ import { Component } from 'vue-property-decorator';
import jPicker from '@/components/J-Picker/jPicker.vue';
import LjRowList from '@/components/lanju/lj-list-row/index.vue';
import LjListRow from '@/components/lanju/lj-list-row/index.vue';
-import model from './model';
+import { getSapStockList } from './model';
import { removeLeadingZeros } from '@/utils/tool';
import ljPagination from '@/components/lanju/lj-pagination/index.vue';
interface QueryParamsPo {
matnr: string;
maktx: string;
- pdaSearch: '1';
- pageNum: 1;
- pageSize: 10;
-}
-
-interface SapStockPo {
- materialCode: string;
- materialDesc: string;
- storageAmount: string;
+ pdaSearch: string;
+ pageNum: number;
+ pageSize: number;
}
@Component({
@@ -76,11 +66,10 @@ interface SapStockPo {
PageHead,
},
})
-export default class sapStockPo extends BasePage implements SapStockPo {
+export default class sapStockPo extends BasePage {
materialCode: string;
materialDesc: string;
storageAmount: string;
- model = model;
queryParams: QueryParamsPo = {
matnr: undefined,
maktx: undefined,
@@ -90,7 +79,32 @@ export default class sapStockPo extends BasePage implements SapStockPo {
};
sapStockList: any[] = [];
total = 0;
-
+ listHeight = 500;
+ onReady() {
+ //等待页面加载完成
+ this.$nextTick(() => {
+ let buttonTop = 0;
+ //获取底部按钮信息
+ const query = uni.createSelectorQuery().in(this);
+ query
+ .select('#button')
+ .boundingClientRect((data) => {
+ //获取底部按钮到顶部距离
+ buttonTop = data.top;
+ })
+ .exec();
+ //获取列表信息
+ query
+ .select('#list')
+ .boundingClientRect((data) => {
+ //获取列表到顶部距离
+ const listTop = data.top;
+ //
+ this.listHeight = buttonTop - listTop - 10;
+ })
+ .exec();
+ });
+ }
async search() {
this.queryParams.pageNum = 1;
this.getList();
@@ -106,10 +120,11 @@ export default class sapStockPo extends BasePage implements SapStockPo {
this.getList();
}
- async getList() {
- await this.model.getSapStockList(this.queryParams);
- this.sapStockList = this.model.rows;
- this.total = this.model.total;
+ getList() {
+ getSapStockList(this.queryParams).then((res) => {
+ this.sapStockList = res.rows;
+ this.total = res.total;
+ });
}
removeLastZeros(data: any) {
@@ -118,6 +133,16 @@ export default class sapStockPo extends BasePage implements SapStockPo {
}
return data;
}
+ //滚动到底部
+ onScrollToLower() {
+ if (this.total === this.sapStockList.length) {
+ return;
+ }
+ this.queryParams.pageNum = this.queryParams.pageNum + 1;
+ getSapStockList(this.queryParams).then((res) => {
+ this.sapStockList = this.sapStockList.concat(res.rows);
+ });
+ }
}
@@ -134,16 +159,26 @@ export default class sapStockPo extends BasePage implements SapStockPo {
}
}
-.scroll {
- height: 100%;
- overflow: scroll;
+.list {
+ background-color: #fff;
+ margin-top: 20rpx;
+ padding: 20rpx 20rpx 25rpx;
+ border-radius: 10rpx;
+ box-shadow: 0 0 20rpx 0 rgba(128, 128, 128, 0.2);
+ color: #8d8989;
- .form2 {
- background-color: #fff;
- padding: 20rpx 20rpx 25rpx;
- border-radius: 10rpx;
- box-shadow: 0 0 20rpx 0 rgba(128, 128, 128, 0.2);
- color: #8d8989;
+ .list-item {
+ padding: 20rpx;
+ }
+
+ /* 奇数行背景色 */
+ .list-item:nth-child(odd) {
+ background-color: #ffffff;
+ }
+
+ /* 偶数行背景色 */
+ .list-item:nth-child(even) {
+ background-color: #f5f5f5;
}
}
diff --git a/src/pages/wms/Raw/SapStock/model.ts b/src/pages/wms/Raw/SapStock/model.ts
index 612cc9e..575ee23 100644
--- a/src/pages/wms/Raw/SapStock/model.ts
+++ b/src/pages/wms/Raw/SapStock/model.ts
@@ -1,33 +1,8 @@
-import { getModule, Module, MutationAction, VuexModule } from 'vuex-module-decorators';
-import store from '@/store';
import http from '@/utils/request';
import { url } from '@/utils/url';
-@Module({
- namespaced: true,
- dynamic: true,
- store,
- name: 'page.raw.sapStockPo',
-})
-export class sapStockPo extends VuexModule {
- WlList = [];
- rows: any = [];
- total = 0;
- @MutationAction
- async getSapStockList(data: any): Promise<{ rows: any; total: number }> {
- const result: any = await http.get(url.lanjuwms.raw.SapStockPo.getSapStockList, {
- params: data,
- });
- let rows: any;
- let total: number;
- if (result.total > 0) {
- rows = result.rows;
- total = result.total;
- } else {
- rows = [];
- total = 0;
- }
- return { rows, total };
- }
-}
-export default getModule(sapStockPo);
+export function getSapStockList(data: any): Promise {
+ return http.get(url.lanjuwms.raw.SapStockPo.getSapStockList, {
+ params: data,
+ });
+}