Browse Source

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

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

Loading…
Cancel
Save