|
@@ -174,30 +174,6 @@
|
|
|
shang: '',
|
|
|
xia: '',
|
|
|
condList: [ // 筛选
|
|
|
- {
|
|
|
- name: '默认',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '销量',
|
|
|
- shang: 'icon-shangjiantou',
|
|
|
- shangActive: 'icon-shangjiantou-copy',
|
|
|
- xia: 'icon-xiajiantou',
|
|
|
- xiaActive: 'icon-xiajiantou-copy'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '价格',
|
|
|
- shang: 'icon-shangjiantou',
|
|
|
- shangActive: 'icon-shangjiantou-copy',
|
|
|
- xia: 'icon-xiajiantou',
|
|
|
- xiaActive: 'icon-xiajiantou-copy'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '浏览量',
|
|
|
- shang: 'icon-shangjiantou',
|
|
|
- shangActive: 'icon-shangjiantou-copy',
|
|
|
- xia: 'icon-xiajiantou',
|
|
|
- xiaActive: 'icon-xiajiantou-copy'
|
|
|
- }
|
|
|
],
|
|
|
// 数据是否触底
|
|
|
is_bottom: false,
|
|
@@ -208,16 +184,20 @@
|
|
|
},
|
|
|
onLoad: async function(e) {
|
|
|
const that = this;
|
|
|
- let id = '6333d71d32c5f69745f9bd32';
|
|
|
+ let id = '';
|
|
|
if (e && e.id) id = e.id;
|
|
|
else id = decodeURIComponent(e.q).split('id=')[1];
|
|
|
that.$set(that, `id`, id);
|
|
|
that.searchConfig();
|
|
|
+ await that.searchOther();
|
|
|
await that.watchLogin();
|
|
|
await that.search();
|
|
|
- await that.searchOther();
|
|
|
- // 下拉刷新
|
|
|
-
|
|
|
+ },
|
|
|
+ onPullDownRefresh: async function() {
|
|
|
+ const that = this;
|
|
|
+ that.clearPages();
|
|
|
+ await that.search();
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
},
|
|
|
methods: {
|
|
|
// 查询基本设置
|
|
@@ -233,6 +213,27 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 查询其他信息
|
|
|
+ async searchOther() {
|
|
|
+ const that = this;
|
|
|
+ let config = that.$config;
|
|
|
+ if (config) {
|
|
|
+ // 筛选条件
|
|
|
+ that.$set(that, `condList`, config.condList)
|
|
|
+ }
|
|
|
+ let user = that.user;
|
|
|
+ let shop = that.info;
|
|
|
+ if (user && user._id && shop && shop._id) {
|
|
|
+ // 商铺是否收藏
|
|
|
+ let arr = await that.$api(`/storeShop/check`, `GET`, {
|
|
|
+ customer: user._id,
|
|
|
+ shop: shop._id
|
|
|
+ });
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ that.$set(that, `collection`, arr.data)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
// 监听用户是否登录
|
|
|
watchLogin() {
|
|
|
const that = this;
|
|
@@ -389,22 +390,6 @@
|
|
|
that.clearPage();
|
|
|
that.searchAll();
|
|
|
},
|
|
|
- // 查询其他信息
|
|
|
- async searchOther() {
|
|
|
- const that = this;
|
|
|
- let user = that.user;
|
|
|
- let shop = that.info;
|
|
|
- if (user && user._id && shop && shop._id) {
|
|
|
- // 商铺是否收藏
|
|
|
- let arr = await that.$api(`/storeShop/check`, `GET`, {
|
|
|
- customer: user._id,
|
|
|
- shop: shop._id
|
|
|
- });
|
|
|
- if (arr.errcode == '0') {
|
|
|
- that.$set(that, `collection`, arr.data)
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
// 收藏
|
|
|
async toCollect() {
|
|
|
const that = this;
|
|
@@ -444,20 +429,19 @@
|
|
|
const that = this;
|
|
|
that.$set(that, `list`, [])
|
|
|
that.$set(that, `skip`, 0)
|
|
|
- that.$set(that, `limit`, 5)
|
|
|
+ that.$set(that, `limit`, 6)
|
|
|
+ that.$set(that, `page`, 0)
|
|
|
+ },
|
|
|
+ // 清空总列表
|
|
|
+ clearPages() {
|
|
|
+ const that = this;
|
|
|
+ that.$set(that, `info`, {})
|
|
|
+ that.$set(that, `shoplist`, [])
|
|
|
+ that.$set(that, `list`, [])
|
|
|
+ that.$set(that, `skip`, 0)
|
|
|
+ that.$set(that, `limit`, 6)
|
|
|
that.$set(that, `page`, 0)
|
|
|
}
|
|
|
- },
|
|
|
- onPullDownRefresh: async function() {
|
|
|
- const that = this;
|
|
|
- that.$set(that, `info`, {})
|
|
|
- that.$set(that, `shoplist`, [])
|
|
|
- that.$set(that, `list`, [])
|
|
|
- that.$set(that, `skip`, 0)
|
|
|
- that.$set(that, `limit`, 6)
|
|
|
- that.$set(that, `page`, 0)
|
|
|
- await that.search();
|
|
|
- uni.stopPullDownRefresh();
|
|
|
}
|
|
|
}
|
|
|
</script>
|