From f8e8ad7f92b351154ebfbda6380a3254ac76a3ae Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期五, 26 七月 2024 17:04:09 +0800
Subject: [PATCH] update
---
mixin/mixin.js | 41 +++++++++++++++++++++++++----------------
1 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/mixin/mixin.js b/mixin/mixin.js
index f197668..c119261 100644
--- a/mixin/mixin.js
+++ b/mixin/mixin.js
@@ -258,9 +258,9 @@
}
return true
},
- async refreshList() {
+ async refreshList(type = 'get') {
this.page.current = 1
- await this.getList()
+ await this.getList(type)
},
async getList(type = 'get') {
if (this.listApi) {
@@ -278,22 +278,31 @@
}
})
if (data) {
- if (this.page.current == 1) {
- this.list = data.records || []
+ if (data && Array.isArray(data)) {
+ this.list = data || []
+ this.page.total = data.length || 0
} else {
- //根据id去重正常
- var ids = []
- for (var item of this.list) {
- ids.push(item.id)
- }
- for (var item of data.records) {
- if (ids.indexOf(item.id) < 0) {
- this.list.push(item)
+ if (this.page.current === 1) {
+ this.list = data.records || []
+ } else {
+ //根据id去重正常
+ var ids = []
+ for (var item of this.list) {
+ ids.push(item.id)
}
- }
+ for (var item of data.records) {
+ if (ids.indexOf(item.id) < 0) {
+ this.list.push(item)
+ }
+ }
+ }
+ this.page.total = data.total || 0
}
- this.page.total = data.total || 0
+
+ if (this.getList_after) {
+ this.getList_after()
+ }
}
this.$message.hideLoading()
}
@@ -495,9 +504,9 @@
// #ifdef PUB_CUSTOMER
,
async submitShopping(dto) {
- //提交到购物车中
+ //提交到购物车中
this.$message.showLoading()
- await this.$store.dispatch('submitShopping',dto);
+ await this.$store.dispatch('submitShopping', dto);
this.$message.hideLoading()
}
// #endif
--
Gitblit v1.9.3