|
@@ -1,5 +1,7 @@
|
|
|
const pages = require('../../mixin/pages')
|
|
|
const { getProductCategoryList } = require('../../api/common')
|
|
|
+const { debounce } = require('../../utils/util')
|
|
|
+const app = getApp()
|
|
|
|
|
|
Page({
|
|
|
|
|
@@ -11,11 +13,16 @@ Page({
|
|
|
listUrl: '/api/user/home/shop/list',
|
|
|
searchForm: {
|
|
|
key_words: '',
|
|
|
- category_id: ''
|
|
|
+ category_id: '',
|
|
|
+ shop_type: ''
|
|
|
},
|
|
|
categoryList: [],
|
|
|
navScrollLeft: -1,
|
|
|
- booLock: false
|
|
|
+ booLock: false,
|
|
|
+ booPopop: true,
|
|
|
+ arrShopType: app.globalData.arrShopType,
|
|
|
+ shop_type: [],
|
|
|
+ handleShoptype: null
|
|
|
},
|
|
|
...pages.methods,
|
|
|
|
|
@@ -25,6 +32,9 @@ Page({
|
|
|
async onLoad(options) {
|
|
|
await this.fetchProductCategoryList()
|
|
|
this.fetchOrderList()
|
|
|
+ this.setData({
|
|
|
+ handleShoptype: debounce(this.refreshOrderList, 2500)
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -117,5 +127,28 @@ Page({
|
|
|
this.refreshOrderList()
|
|
|
})
|
|
|
}
|
|
|
+ },
|
|
|
+ hidePopop() {
|
|
|
+ this.setData({
|
|
|
+ booPopop: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onChange(event) {
|
|
|
+ const temp = event.detail
|
|
|
+ const value = temp[temp.length - 1]
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ shop_type: [],
|
|
|
+ 'searchForm.shop_type': value || ''
|
|
|
+ }, () => {
|
|
|
+ this.data.handleShoptype()
|
|
|
+ })
|
|
|
+
|
|
|
+ const timer = setTimeout(() => {
|
|
|
+ clearTimeout(timer)
|
|
|
+ this.setData({
|
|
|
+ shop_type: value ? [value] : []
|
|
|
+ })
|
|
|
+ }, 200)
|
|
|
}
|
|
|
})
|