Commit d07944e2 by wangzhihui

```

feat(cannibalize,purchase): 添加商品库存列表分页功能

- 新增total字段用于存储总数据量
- 修改getList方法参数,统一使用this.keyword进行搜索
- 在API响应中更新total值并控制滚动加载状态
- 修复搜索时关键词传递问题,确保搜索功能正常工作
- 添加条件判断以正确控制滚动加载完成状态
```
1 parent 9aee29ad
...@@ -55,6 +55,7 @@ export default { ...@@ -55,6 +55,7 @@ export default {
pageSize: 10 pageSize: 10
}, },
flag: false, flag: false,
total:0,
StockList: [], StockList: [],
id: this.$route.query.id, id: this.$route.query.id,
orderInfo: {}, orderInfo: {},
...@@ -102,13 +103,15 @@ export default { ...@@ -102,13 +103,15 @@ export default {
} }
}) })
}, },
getList(keyword) { getList() {
let list = this.StockList let list = this.StockList
allocateApi.getAllocateGoodsStockDetail({ ...this.page, merchantName: keyword, upgradeGoodsld: this.orderInfo.goodsId }).then(({ code, data, message }) => { allocateApi.getAllocateGoodsStockDetail({ ...this.page, merchantName: this.keyword, upgradeGoodsld: this.orderInfo.goodsId }).then(({ code, data, message }) => {
this.hideLoading() this.hideLoading()
if (code == 0) { if (code == 0) {
this.total = data.total
this.StockList = [...list, ...data.list] this.StockList = [...list, ...data.list]
if (this.page.currentPage > 1) this.$refs.scrollView.loading = false if (this.page.currentPage > 1) this.$refs.scrollView.loading = false
if( this.StockList.length<this.total) this.$refs.scrollView.finished = false
if (data.list == 0 && this.flag) { if (data.list == 0 && this.flag) {
this.$refs.scrollView.finished = true this.$refs.scrollView.finished = true
} }
...@@ -127,8 +130,9 @@ export default { ...@@ -127,8 +130,9 @@ export default {
const debouncedSearch = utils.debounce( const debouncedSearch = utils.debounce(
val => { val => {
this.StockList = [] this.StockList = []
this.keyword = val
this.page.currentPage = 1 this.page.currentPage = 1
this.getList(val) this.getList()
}, },
200, 200,
true true
......
...@@ -132,13 +132,14 @@ export default { ...@@ -132,13 +132,14 @@ export default {
} }
}) })
}, },
getList(keyword) { getList() {
let list = this.StockList let list = this.StockList
allocateApi.getAllocateGoodsStockDetail({ ...this.page, merchantName: keyword, upgradeGoodsld: this.orderInfo.goodsId }).then(({ code, data, message }) => { allocateApi.getAllocateGoodsStockDetail({ ...this.page, merchantName: this.keyword, upgradeGoodsld: this.orderInfo.goodsId }).then(({ code, data, message }) => {
this.hideLoading() this.hideLoading()
if (code == 0) { if (code == 0) {
this.StockList = [...list, ...data.list] this.StockList = [...list, ...data.list]
if (this.page.currentPage > 1) this.$refs.scrollView.loading = false if (this.page.currentPage > 1) this.$refs.scrollView.loading = false
if (this.StockList.length < this.total) this.$refs.scrollView.finished = false
if (data.list == 0 && this.flag) { if (data.list == 0 && this.flag) {
this.$refs.scrollView.finished = true this.$refs.scrollView.finished = true
} }
...@@ -157,8 +158,9 @@ export default { ...@@ -157,8 +158,9 @@ export default {
const debouncedSearch = utils.debounce( const debouncedSearch = utils.debounce(
val => { val => {
this.StockList = [] this.StockList = []
this.keyword = val
this.page.currentPage = 1 this.page.currentPage = 1
this.getList(val) this.getList()
}, },
200, 200,
true true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!