|
|
@@ -10,7 +10,7 @@
|
|
|
</config>
|
|
|
<template>
|
|
|
<div>
|
|
|
- <nav-header>我的店铺</nav-header>
|
|
|
+ <nav-header>{{ isMineShop ? '我的店铺' : storeInfo.storeName }}</nav-header>
|
|
|
<div class="top">
|
|
|
<van-image
|
|
|
width="100%"
|
|
|
@@ -18,20 +18,12 @@
|
|
|
fit="widthFix"
|
|
|
/>
|
|
|
|
|
|
- <div class="top-card">
|
|
|
- <van-image
|
|
|
- :src="'/native/svgs/img_defaultphoto.svg'"
|
|
|
- width="90"
|
|
|
- height="90"
|
|
|
- round
|
|
|
- class="avatar"
|
|
|
- fit="cover"
|
|
|
- >
|
|
|
- </van-image>
|
|
|
+ <div class="top-card" @click="goNext">
|
|
|
+ <van-image :src="storeLogo" width="90" height="90" round class="avatar" fit="cover"> </van-image>
|
|
|
<div class="name">{{ storeInfo.storeName }}</div>
|
|
|
- <div class="location">
|
|
|
+ <div class="location" v-if="city">
|
|
|
<img src="/native/svgs/icon_kapai_dizhi.svg" alt="" />
|
|
|
- <span>浙江 杭州</span>
|
|
|
+ <span>{{ city }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -75,8 +67,10 @@ import ButtonBg from '../../components/ButtonBg.vue';
|
|
|
import NavHeader from '../../components/NavHeader.vue';
|
|
|
import ProductInfoMine from '../../components/ProductInfoMine.vue';
|
|
|
import SortItem from '../../components/SortItem.vue';
|
|
|
+import store from '../../mixins/store';
|
|
|
export default {
|
|
|
components: { ButtonBg, SortItem, NavHeader, ProductInfoMine },
|
|
|
+ mixins: [store],
|
|
|
data() {
|
|
|
return {
|
|
|
option1: [{ text: '全部商品', value: 0 }, { text: '新款商品', value: 1 }, { text: '活动商品', value: 2 }],
|
|
|
@@ -93,21 +87,52 @@ export default {
|
|
|
list: [],
|
|
|
empty: false,
|
|
|
finish: false,
|
|
|
- storeInfo: {}
|
|
|
+ isMineShop: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['systemInfo', 'userStoreInfo'])
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ if (this.isLogin) {
|
|
|
+ this.loginMethods();
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
loginMethods() {
|
|
|
this.loading = true;
|
|
|
- this.getData();
|
|
|
- this.$store.dispatch('getUserStore').then(res => {
|
|
|
+ this.getStore().then(res => {
|
|
|
this.storeInfo = res;
|
|
|
+ this.getData();
|
|
|
});
|
|
|
},
|
|
|
+ getStore() {
|
|
|
+ console.log(this.userStoreInfo);
|
|
|
+ if (this.userStoreInfo) {
|
|
|
+ if (this.userStoreInfo.id.toString() === this.$mp.options.id || !this.$mp.options.id) {
|
|
|
+ this.isMineShop = true;
|
|
|
+ return this.$store.dispatch('getUserStore');
|
|
|
+ } else {
|
|
|
+ this.isMineShop = false;
|
|
|
+ return this.getStoreById(this.$mp.options.id);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return this.$store.dispatch('getUserStore').then(res => {
|
|
|
+ if (res.id.toString() === this.$mp.options.id || !this.$mp.options.id) {
|
|
|
+ this.isMineShop = true;
|
|
|
+ return Promise.resolve(res);
|
|
|
+ } else {
|
|
|
+ this.isMineShop = false;
|
|
|
+ return this.getStoreById(this.$mp.options.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getStoreById(id) {
|
|
|
+ return this.$http.get('/store/get/' + id);
|
|
|
+ },
|
|
|
getData() {
|
|
|
+ console.log(this.storeInfo.id);
|
|
|
let data = {
|
|
|
page: this.page,
|
|
|
size: 20
|
|
|
@@ -120,13 +145,19 @@ export default {
|
|
|
this.finish = res.last;
|
|
|
this.list = [...this.list, ...res.content];
|
|
|
});
|
|
|
+ },
|
|
|
+ goNext() {
|
|
|
+ if (this.isMineShop) {
|
|
|
+ this.navigateTo('/pages/store/setting');
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
onPageScroll() {},
|
|
|
onShareAppMessage() {
|
|
|
return {
|
|
|
title: '卓卡——' + this.storeInfo.storeName,
|
|
|
- path: '/pages/store/homePage?id=' + this.storeInfo.id
|
|
|
+ path: '/pages/store/homePage?id=' + this.storeInfo.id,
|
|
|
+ imageUrl: this.storeLogo
|
|
|
};
|
|
|
}
|
|
|
};
|