Browse Source

店铺详情数据页面查询优化

master
wanghongjun 2 years ago
parent
commit
99dcf53e90
  1. 18
      pages/category/economybusiness/list.vue
  2. 8
      pages/category/tradingentity/detail.vue
  3. 16
      pages/category/tradingentity/list.vue
  4. 7
      pages/goods/list.vue

18
pages/category/economybusiness/list.vue

@ -151,12 +151,7 @@
methods: { methods: {
// //
async onSearch() { async onSearch() {
if (this.searchValue == '') { await this.upCallback(1)
this.$error('请输入搜索关键词');
} else {
await this.getGoodsList()
await this.getHomeListImage()
}
}, },
// tab // tab
async changeTab(val) { async changeTab(val) {
@ -165,8 +160,7 @@
this.$navTo('pages/category/tradingentity/detail',{name}) this.$navTo('pages/category/tradingentity/detail',{name})
} else { } else {
this.targetTab = val this.targetTab = val
await this.getGoodsList() await this.upCallback(1)
await this.getHomeListImage()
} }
}, },
/** /**
@ -208,6 +202,9 @@
source_type: '', source_type: '',
is_user_data: '1', is_user_data: '1',
} }
GoodsApi.nbgoods(param).then(resultTotal => {
app.total = resultTotal.data.total
})
if (app.searchValue != '') { if (app.searchValue != '') {
param.goods_name = app.searchValue param.goods_name = app.searchValue
} }
@ -219,10 +216,9 @@
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
GoodsApi.nbgoods(param) GoodsApi.nbgoods(param)
.then(result => { .then(result => {
if (result.data.length > 0) { if (result.data.data.length > 0) {
// //
const newList = app.initList(result.data) const newList = app.initList(result.data)
app.total = result.data.total
app.list.data = getMoreListData(newList, app.list, pageNo) app.list.data = getMoreListData(newList, app.list, pageNo)
app.userList = newList.data[0].user app.userList = newList.data[0].user
app.userList.stateStr = this.getUserStateStr(app.userList.state) app.userList.stateStr = this.getUserStateStr(app.userList.state)
@ -230,7 +226,7 @@
resolve(newList) resolve(newList)
} else { } else {
app.$error('该店铺信息不存在,即将返回分类页面!') app.$error('该店铺信息不存在,即将返回分类页面!')
setTimeout(app.jumpReturn,2000) setTimeout(app.jumpReturn, 2000)
} }
}) })
.catch(reject) .catch(reject)

8
pages/category/tradingentity/detail.vue

@ -114,14 +114,12 @@ export default {
methods: { methods: {
// //
async onSearch() { async onSearch() {
await this.getHomeList(1) await this.upCallback(1)
await this.getHomeListImage()
}, },
// tab // tab
async changeTab(val) { async changeTab(val) {
this.targetTab = val this.targetTab = val
await this.getHomeList(1) await this.upCallback(1)
await this.getHomeListImage()
}, },
/** /**
* 上拉加载的回调 (页面初始化时也会执行一次) * 上拉加载的回调 (页面初始化时也会执行一次)
@ -134,7 +132,7 @@ export default {
await app.getHomeList(page.num) await app.getHomeList(page.num)
.then(list => { .then(list => {
const curPageLen = list.data.length const curPageLen = list.data.length
const totalSize = list.data.total const totalSize = list.total
app.mescroll.endBySize(curPageLen, totalSize) app.mescroll.endBySize(curPageLen, totalSize)
}) })
.catch(() => app.mescroll.endErr()) .catch(() => app.mescroll.endErr())

16
pages/category/tradingentity/list.vue

@ -151,12 +151,7 @@
methods: { methods: {
// //
async onSearch() { async onSearch() {
if (this.searchValue == '') { await this.upCallback(1)
this.$error('请输入搜索关键词');
} else {
await this.getGoodsList()
await this.getHomeListImage()
}
}, },
// tab // tab
async changeTab(val) { async changeTab(val) {
@ -165,8 +160,7 @@
this.$navTo('pages/category/tradingentity/detail',{name}) this.$navTo('pages/category/tradingentity/detail',{name})
} else { } else {
this.targetTab = val this.targetTab = val
await this.getGoodsList() await this.upCallback(1)
await this.getHomeListImage()
} }
}, },
/** /**
@ -208,6 +202,9 @@
source_type: '', source_type: '',
is_user_data: '1', is_user_data: '1',
} }
GoodsApi.nbgoods(param).then(resultTotal => {
app.total = resultTotal.data.total
})
if (app.searchValue != '') { if (app.searchValue != '') {
param.goods_name = app.searchValue param.goods_name = app.searchValue
} }
@ -220,9 +217,8 @@
GoodsApi.nbgoods(param) GoodsApi.nbgoods(param)
.then(result => { .then(result => {
// //
if (result.data.length > 0) { if (result.data.data.length > 0) {
const newList = app.initList(result.data) const newList = app.initList(result.data)
app.total = result.data.total
app.list.data = getMoreListData(newList, app.list, pageNo) app.list.data = getMoreListData(newList, app.list, pageNo)
app.userList = newList.data[0].user app.userList = newList.data[0].user
app.userList.stateStr = this.getUserStateStr(app.userList.state) app.userList.stateStr = this.getUserStateStr(app.userList.state)

7
pages/goods/list.vue

@ -197,6 +197,9 @@
source_type: '', source_type: '',
is_user_data: '1', is_user_data: '1',
} }
GoodsApi.nbgoods(param).then(resultTotal => {
app.total = resultTotal.data.total
})
if (app.searchValue != '') { if (app.searchValue != '') {
param.goods_name = app.searchValue param.goods_name = app.searchValue
} }
@ -205,10 +208,6 @@
} else if (app.targetTab === 3) { } else if (app.targetTab === 3) {
param.order_type = 'price' param.order_type = 'price'
} }
GoodsApi.nbgoods(param).then(resultTotal => {
param.goods_name = ''
app.total = resultTotal.data.total
})
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
GoodsApi.nbgoods(param) GoodsApi.nbgoods(param)
.then(result => { .then(result => {

Loading…
Cancel
Save