anhaogxs 4 years ago
parent
commit
e2f037e675
  1. 64
      pages/shop/GoodsList/index.vue
  2. 3
      pages/shop/IntegralGoodsCon/index.vue

64
pages/shop/GoodsList/index.vue

@ -27,7 +27,8 @@
<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 == 'false'">
<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>
@ -45,7 +46,8 @@
</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="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>
@ -67,22 +69,26 @@
<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 Loading from '@/components/Loading'
import Recommend from '@/components/Recommend'
import {
getProducts,
getProductsIntegral
} from '@/api/store'
import Loading from '@/components/Loading'
export default {
export default {
name: 'GoodsList',
components: {
Recommend,
Loading,
},
props: {},
data: function () {
data: function() {
// const { s = "", id = 0, title = "" } = this.$yroute.query;
const s = '',
id = 0,
@ -117,6 +123,18 @@ export default {
title() {
this.updateTitle()
},
isIntegral() {
if (this.isIntegral) {
uni.setNavigationBarTitle({
title: '积分商品'
});
} else {
uni.setNavigationBarTitle({
title: '商品列表'
});
}
},
$yroute(to) {
// if (to.name !== "GoodsList") return;
// const { s = "", id = 0, title = "" } = to.query;
@ -135,8 +153,11 @@ export default {
// }
},
},
mounted: function () {
const { s = '', id = 0, title = '', isIntegral = false } = this.$yroute.query
mounted: function() {
const {
s = '', id = 0, title = '', isIntegral = false
} = this.$yroute.query;
this.where.keyword = s
this.where.isIntegral = isIntegral == 'true' ? 1 : 0
this.isIntegral = isIntegral
@ -144,7 +165,7 @@ export default {
this.getProductList()
},
onReachBottom() {
this.recommendLoading = true
this.recommendLoading = true;
!this.loading && this.getProductList()
},
onHide() {
@ -181,13 +202,18 @@ export default {
})
},
updateTitle() {
uni.setNavigationBarTitle({
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
@ -214,7 +240,7 @@ export default {
that.where.page = that.where.page + 1
})
},
submitForm: function () {
submitForm: function() {
this.$set(this, 'productList', [])
this.where.page = 1
this.loadend = false
@ -222,7 +248,7 @@ export default {
this.getProductList()
},
//
set_where: function (index) {
set_where: function(index) {
let that = this
switch (index) {
case 0:
@ -255,7 +281,7 @@ export default {
that.getProductList()
},
//where
setWhere: function () {
setWhere: function() {
let that = this
if (that.price === 0) {
that.where.priceOrder = ''
@ -273,16 +299,16 @@ export default {
}
that.where.news = that.nows ? '1' : '0'
},
switchTap: function () {
switchTap: function() {
let that = this
that.Switch = !that.Switch
},
},
}
}
</script>
<style scoped lang="less">
.noCommodity {
.noCommodity {
border-top: 3px solid #f5f5f5;
padding-bottom: 1px;
}
}
</style>

3
pages/shop/IntegralGoodsCon/index.vue

@ -10,7 +10,6 @@
<view class="money font-color-red">
<text class="num">{{ attr.productSelect.integral || storeInfo.integral }}积分</text>
</view>
<view class="iconfont icon-fenxiang" @click="listenerActionSheet"></view>
</view>
<view class="introduce">{{ storeInfo.storeName }}</view>
<view class="label acea-row row-between-wrapper">
@ -55,7 +54,7 @@
</view>
<view class="bnt in-bnt acea-row">
<view class="buy" @click="tapBuy">
<text>立即购买</text>
<text>立即兑换</text>
</view>
</view>
</view>

Loading…
Cancel
Save