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

40
pages/shop/GoodsList/index.vue

@ -27,7 +27,8 @@
<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 == 'false'"> <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'"> <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>
@ -45,7 +46,8 @@
</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" :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'"> <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>
@ -67,12 +69,16 @@
<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" @changeRecommendLoading="changeRecommendLoading"></Recommend> <Recommend v-if="productList.length === 0 && where.page > 1" :recommendLoading="recommendLoading"
@changeRecommendLoading="changeRecommendLoading"></Recommend>
</view> </view>
</template> </template>
<script> <script>
import Recommend from '@/components/Recommend' import Recommend from '@/components/Recommend'
import { getProducts, getProductsIntegral } from '@/api/store' import {
getProducts,
getProductsIntegral
} from '@/api/store'
import Loading from '@/components/Loading' import Loading from '@/components/Loading'
export default { export default {
@ -117,6 +123,18 @@ export default {
title() { title() {
this.updateTitle() this.updateTitle()
}, },
isIntegral() {
if (this.isIntegral) {
uni.setNavigationBarTitle({
title: '积分商品'
});
} else {
uni.setNavigationBarTitle({
title: '商品列表'
});
}
},
$yroute(to) { $yroute(to) {
// if (to.name !== "GoodsList") return; // if (to.name !== "GoodsList") return;
// const { s = "", id = 0, title = "" } = to.query; // const { s = "", id = 0, title = "" } = to.query;
@ -136,7 +154,10 @@ export default {
}, },
}, },
mounted: function() { 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.keyword = s
this.where.isIntegral = isIntegral == 'true' ? 1 : 0 this.where.isIntegral = isIntegral == 'true' ? 1 : 0
this.isIntegral = isIntegral this.isIntegral = isIntegral
@ -144,7 +165,7 @@ export default {
this.getProductList() this.getProductList()
}, },
onReachBottom() { onReachBottom() {
this.recommendLoading = true this.recommendLoading = true;
!this.loading && this.getProductList() !this.loading && this.getProductList()
}, },
onHide() { onHide() {
@ -181,13 +202,18 @@ export default {
}) })
}, },
updateTitle() { updateTitle() {
uni.setNavigationBarTitle({
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 { s = '', id = 0, title = '' } = this.$yroute.query const {
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

3
pages/shop/IntegralGoodsCon/index.vue

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

Loading…
Cancel
Save