Browse Source

修改商品详情跳转错误的问题

zyh
anhaogxs 4 years ago
parent
commit
fa00b519ce
  1. 46
      pages/shop/GoodsList/index.vue

46
pages/shop/GoodsList/index.vue

@ -27,8 +27,7 @@
<view class="item" :class="nows ? 'font-color-red' : ''" @click="set_where(3)">新品</view>
</view>
<view class="list acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'" ref="container" v-if="!isIntegral">
<view @click="goGoodsCon(item)" class="item" :class="Switch === true ? '' : 'on'" v-for="(item, productListIndex) in productList"
:key="productListIndex" :title="item.storeName">
<view @click="goGoodsCon(item)" class="item" :class="Switch === true ? '' : 'on'" v-for="(item, productListIndex) in productList" :key="productListIndex" :title="item.storeName">
<view class="pictrue" :class="Switch === true ? '' : 'on'">
<image :src="item.image" :class="Switch === true ? '' : 'on'" />
</view>
@ -46,8 +45,7 @@
</view>
</view>
<view class="list acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'" ref="container" v-if="isIntegral == 'true'">
<view @click="goGoodsCon(item)" class="item" :class="Switch === true ? '' : 'on'" v-for="(item, productListIndex) in productList"
:key="productListIndex" :title="item.storeName">
<view @click="goIntegralGoodsCon(item)" class="item" :class="Switch === true ? '' : 'on'" v-for="(item, productListIndex) in productList" :key="productListIndex" :title="item.storeName">
<view class="pictrue" :class="Switch === true ? '' : 'on'">
<image :src="item.image" :class="Switch === true ? '' : 'on'" />
</view>
@ -69,16 +67,12 @@
<image src="@/static/images/noGood.png" class="image" />
</view>
</view>
<Recommend v-if="productList.length === 0 && where.page > 1" :recommendLoading="recommendLoading"
@changeRecommendLoading="changeRecommendLoading"></Recommend>
<Recommend v-if="productList.length === 0 && where.page > 1" :recommendLoading="recommendLoading" @changeRecommendLoading="changeRecommendLoading"></Recommend>
</view>
</template>
<script>
import Recommend from '@/components/Recommend'
import {
getProducts,
getProductsIntegral
} from '@/api/store'
import { getProducts, getProductsIntegral } from '@/api/store'
import Loading from '@/components/Loading'
export default {
@ -126,14 +120,13 @@
isIntegral() {
if (this.isIntegral) {
uni.setNavigationBarTitle({
title: '积分商品'
});
title: '积分商品',
})
} else {
uni.setNavigationBarTitle({
title: '商品列表'
});
title: '商品列表',
})
}
},
$yroute(to) {
// if (to.name !== "GoodsList") return;
@ -154,9 +147,7 @@
},
},
mounted: function () {
const {
s = '', id = 0, title = '', isIntegral = false
} = this.$yroute.query;
const { s = '', id = 0, title = '', isIntegral = false } = this.$yroute.query
this.where.keyword = s
this.where.isIntegral = isIntegral == 'true' ? 1 : 0
@ -165,7 +156,7 @@
this.getProductList()
},
onReachBottom() {
this.recommendLoading = true;
this.recommendLoading = true
!this.loading && this.getProductList()
},
onHide() {
@ -193,6 +184,15 @@
this.recommendLoading = recommendLoading
},
goGoodsCon(item) {
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: item.id,
isIntegral: this.isIntegral,
},
})
},
goIntegralGoodsCon(item) {
this.$yrouter.push({
path: '/pages/shop/IntegralGoodsCon/index',
query: {
@ -203,17 +203,15 @@
},
updateTitle() {
uni.setNavigationBarTitle({
title: this.title
});
title: this.title,
})
// document.title = this.title || this.$yroute.meta.title;
},
getProductList() {
var that = this
this.setWhere()
// if (to.name !== "GoodsList") return;
const {
s = '', id = 0, title = ''
} = this.$yroute.query
const { s = '', id = 0, title = '' } = this.$yroute.query
if (s !== this.where.keyword || id !== this.where.sid) {
this.loadend = false
this.loading = false

Loading…
Cancel
Save