修改商品详情跳转错误的问题
This commit is contained in:
@ -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,26 +67,22 @@
|
|||||||
<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,
|
import Loading from '@/components/Loading'
|
||||||
getProductsIntegral
|
|
||||||
} from '@/api/store'
|
|
||||||
import Loading from '@/components/Loading'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'GoodsList',
|
name: 'GoodsList',
|
||||||
components: {
|
components: {
|
||||||
Recommend,
|
Recommend,
|
||||||
Loading,
|
Loading,
|
||||||
},
|
},
|
||||||
props: {},
|
props: {},
|
||||||
data: function() {
|
data: function () {
|
||||||
// const { s = "", id = 0, title = "" } = this.$yroute.query;
|
// const { s = "", id = 0, title = "" } = this.$yroute.query;
|
||||||
const s = '',
|
const s = '',
|
||||||
id = 0,
|
id = 0,
|
||||||
@ -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;
|
||||||
@ -153,10 +146,8 @@
|
|||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
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
|
||||||
@ -240,7 +238,7 @@
|
|||||||
that.where.page = that.where.page + 1
|
that.where.page = that.where.page + 1
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
submitForm: function() {
|
submitForm: function () {
|
||||||
this.$set(this, 'productList', [])
|
this.$set(this, 'productList', [])
|
||||||
this.where.page = 1
|
this.where.page = 1
|
||||||
this.loadend = false
|
this.loadend = false
|
||||||
@ -248,7 +246,7 @@
|
|||||||
this.getProductList()
|
this.getProductList()
|
||||||
},
|
},
|
||||||
//点击事件处理
|
//点击事件处理
|
||||||
set_where: function(index) {
|
set_where: function (index) {
|
||||||
let that = this
|
let that = this
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -281,7 +279,7 @@
|
|||||||
that.getProductList()
|
that.getProductList()
|
||||||
},
|
},
|
||||||
//设置where条件
|
//设置where条件
|
||||||
setWhere: function() {
|
setWhere: function () {
|
||||||
let that = this
|
let that = this
|
||||||
if (that.price === 0) {
|
if (that.price === 0) {
|
||||||
that.where.priceOrder = ''
|
that.where.priceOrder = ''
|
||||||
@ -299,16 +297,16 @@
|
|||||||
}
|
}
|
||||||
that.where.news = that.nows ? '1' : '0'
|
that.where.news = that.nows ? '1' : '0'
|
||||||
},
|
},
|
||||||
switchTap: function() {
|
switchTap: function () {
|
||||||
let that = this
|
let that = this
|
||||||
that.Switch = !that.Switch
|
that.Switch = !that.Switch
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.noCommodity {
|
.noCommodity {
|
||||||
border-top: 3px solid #f5f5f5;
|
border-top: 3px solid #f5f5f5;
|
||||||
padding-bottom: 1px;
|
padding-bottom: 1px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Reference in New Issue
Block a user