diff --git a/components/tab-bar/myCenter.vue b/components/tab-bar/myCenter.vue index 7a64d72..9b60aee 100644 --- a/components/tab-bar/myCenter.vue +++ b/components/tab-bar/myCenter.vue @@ -346,7 +346,7 @@ desc: '待处理订单', icon: this.getMyCenterImage('identityShop'), count: this.shopCounts, - action: this.hasShop ? 'merchantCenter' : 'merchant' + action: 'merchantCenter' }, { type: 'delivery', title: '兼职主页', @@ -566,6 +566,64 @@ } return typeof list == 'object' ? [list] : [] }, + setCurrentShop(item) { + uni.setStorageSync('shopId', item.id) + uni.setStorageSync('shopName', item.shopName) + uni.setStorageSync('shopIcon', item.shopIcon) + uni.setStorageSync('shopScore', item.shopScore) + uni.setStorageSync('shopMerchantType', item.merchantType) + uni.setStorageSync('shopTakeaway', item.shopTakeaway) + uni.setStorageSync('attrId', item.attrId) + }, + openMerchantCenterWithShops(shops) { + const area = this.getArea() + let shopItem = [] + for (let aa = 0; aa < shops.length; aa++) { + if (!area.id || shops[aa].regionId == area.id) { + shopItem.push(shops[aa]) + } + } + this.schoolShop = shopItem + if (this.schoolShop.length > 1) { + this.$refs.shopPopup.open() + return + } else if (this.schoolShop.length == 1) { + this.setCurrentShop(this.schoolShop[0]) + uni.navigateTo({ + url: '/package2/shop/merchantCenter' + }) + return + } + uni.showModal({ + title: '提示', + content: '您还没有注册成为商家,要去注册吗?', + cancelText: '暂时不了', + confirmText: '去注册', + success: function(res) { + if (res.confirm) { + uni.navigateTo({ + url: '/package2/shop/merchantRegister' + }) + } + } + }) + }, + getShopInfoByUserid() { + return this.tui.request("/app/shop/getShopInfoByUserid", "GET", { + userId: uni.getStorageSync('id') + }, false, true).then((res) => { + if (res.code == 200) { + const shops = this.normalizeShopList(res.result) + uni.setStorageSync('schoolShop', shops) + this.openMerchantCenterWithShops(shops) + } else { + this.tui.toast(res.message) + } + uni.hideLoading() + }).catch(() => { + uni.hideLoading() + }) + }, showComingSoon(title) { this.tui.toast(title + '即将开放') }, @@ -636,13 +694,7 @@ }) }, clickShop(item) { - uni.setStorageSync('shopId', item.id) - uni.setStorageSync('shopName', item.shopName) - uni.setStorageSync('shopIcon', item.shopIcon) - uni.setStorageSync('shopScore', item.shopScore) - uni.setStorageSync('shopMerchantType', item.merchantType) - uni.setStorageSync('shopTakeaway', item.shopTakeaway) - uni.setStorageSync('attrId', item.attrId) + this.setCurrentShop(item) this.$refs.shopPopup.close() uni.navigateTo({ url: '/package2/shop/merchantCenter' @@ -687,45 +739,8 @@ if (e == 'addgoods') { url = '/package2/myCenter/addGoods' } else if (e == 'merchantCenter') { - this.schoolShop = this.normalizeShopList(this.schoolShop.length ? this.schoolShop : uni.getStorageSync('schoolShop')) - if (this.schoolShop && this.schoolShop.length) { - let shopItem = [] - const area = this.getArea() - for (let aa = 0; aa < this.schoolShop.length; aa++) { - if (!area.id || this.schoolShop[aa].regionId == area.id) { - shopItem.push(this.schoolShop[aa]) - } - } - this.schoolShop = shopItem - if (this.schoolShop.length > 1) { - this.$refs.shopPopup.open() - return - } else if (this.schoolShop.length == 1) { - uni.setStorageSync('shopId', this.schoolShop[0].id) - uni.setStorageSync('attrId', this.schoolShop[0].attrId) - uni.setStorageSync('shopName', this.schoolShop[0].shopName) - uni.setStorageSync('shopIcon', this.schoolShop[0].shopIcon) - uni.setStorageSync('shopMerchantType', this.schoolShop[0].merchantType) - uni.setStorageSync('shopScore', this.schoolShop[0].shopScore) - uni.setStorageSync('shopTakeaway', this.schoolShop[0].shopTakeaway) - url = '/package2/shop/merchantCenter' - } - } else { - uni.showModal({ - title: '提示', - content: '您还没有注册成为商家,要去注册吗?', - cancelText: '暂时不了', - confirmText: '去注册', - success: function(res) { - if (res.confirm) { - uni.navigateTo({ - url: '/package2/shop/merchantRegister' - }) - } - } - }) - return - } + this.getShopInfoByUserid() + return } else if (e == 'dingdan') { url = '/package1/order/orderList' } else if (e == 'groupPending') { @@ -763,7 +778,7 @@ this.showComingSoon('星球券') return } else if (e == 'fishRelease') { - url = '/package1/tabbar/release' + url = '/package1/tabbar/fishRelease' } else if (e == 'myPost') { url = '/package2/myCenter/myPost' } else if (e == 'idleTrad') { diff --git a/components/tab-bar/postList.vue b/components/tab-bar/postList.vue index b0833ef..5799399 100644 --- a/components/tab-bar/postList.vue +++ b/components/tab-bar/postList.vue @@ -29,9 +29,10 @@ scroll-y :style="{ paddingTop: headerHeight + 'px' }" :show-scrollbar="false" + @scrolltolower="loadMore" > - + - + {{item.name}} - {{item.desc}} + {{item.action == 'publishSell' ? '点我发布' : item.desc}} @@ -90,7 +97,7 @@ :data-goods-id="item.id" @load="onImageLoad" > - 距离{{item.distance}} + {{item.regionName}} {{item.text}} @@ -103,7 +110,7 @@ - {{item.shopName}} + 半径卖家