|
@@ -16,12 +16,12 @@
|
|
|
class="product-list"
|
|
|
@click="productDetail(pro.productId)"
|
|
|
>
|
|
|
- <view class="product-image"> <image :src="pro.image" mode=""></image> </view>
|
|
|
+ <view class="product-image"> <image :src="pro.mainImage" mode=""></image> </view>
|
|
|
<view class="product-mains">
|
|
|
<view class="product-name"> {{ pro.name }} </view>
|
|
|
<view class="product-price" v-if="hasLogin">
|
|
|
<!-- 价格 -->
|
|
|
- ¥{{ pro.originalPrice | NumFormat }}
|
|
|
+ ¥{{ pro.price | NumFormat }}
|
|
|
</view>
|
|
|
<view v-else class="product-price-none">
|
|
|
<uni-grader :grade="Number(pro.priceGrade)"></uni-grader>
|
|
@@ -53,16 +53,6 @@ export default {
|
|
|
return {
|
|
|
skeletonShow:true,
|
|
|
isModallayer: false,
|
|
|
- banner: '',
|
|
|
- listQuery: {
|
|
|
- userId: 0,
|
|
|
- source: 2,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10
|
|
|
- },
|
|
|
- vipFlag: 0,
|
|
|
- userIdentity: 0,
|
|
|
- firstClubType:0,
|
|
|
productList: [],
|
|
|
nomoreText: '上拉显示更多',
|
|
|
hasNextPage: false,
|
|
@@ -71,8 +61,8 @@ export default {
|
|
|
pullFlag: true,
|
|
|
}
|
|
|
},
|
|
|
- onLoad() {
|
|
|
- this.initGetStotage()
|
|
|
+ onLoad(option) {
|
|
|
+ this.mallOrganizeProducts(option.id)
|
|
|
},
|
|
|
filters: {
|
|
|
NumFormat: function(text) {
|
|
@@ -81,91 +71,19 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(['hasLogin', 'clubType'])
|
|
|
+ ...mapState(['hasLogin'])
|
|
|
},
|
|
|
methods: {
|
|
|
- async initGetStotage() {
|
|
|
- const userInfo = await this.$api.getStorage()
|
|
|
- this.listQuery.userId = userInfo.userId ? userInfo.userId : 0
|
|
|
- this.vipFlag = userInfo.vipFlag ? userInfo.vipFlag : 0
|
|
|
- this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
|
|
|
- this.firstClubType = this.clubType
|
|
|
- this.getSvipProductPage()
|
|
|
- },
|
|
|
- getSvipProductPage() {
|
|
|
- // 获取会员优惠商品列表
|
|
|
- this.coupinList = []
|
|
|
- this.listQuery.pageNum = 1
|
|
|
- this.ProductService.getSvipProductPage(this.listQuery)
|
|
|
- .then(response => {
|
|
|
- let data = response.data.svipProductPage
|
|
|
- this.banner = response.data.adsImage
|
|
|
- if (data.results && data.results.length > 0) {
|
|
|
- this.showEmpty = false
|
|
|
- this.hasNextPage = data.hasNextPage
|
|
|
- this.productList = data.results
|
|
|
- this.pullFlag = false
|
|
|
- setTimeout(() => {
|
|
|
- this.pullFlag = true
|
|
|
- }, 500)
|
|
|
- if (this.hasNextPage) {
|
|
|
- this.pullUpOn = false
|
|
|
- this.nomoreText = '上拉显示更多'
|
|
|
- } else {
|
|
|
- if (this.coupinList.length < 8) {
|
|
|
- this.pullUpOn = true
|
|
|
- } else {
|
|
|
- this.pullUpOn = false
|
|
|
- this.loadding = false
|
|
|
- this.nomoreText = '已至底部'
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.showEmpty = true
|
|
|
- }
|
|
|
- this.isRequest = true
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- this.$util.msg(error.msg, 2000)
|
|
|
- })
|
|
|
- },
|
|
|
- getOnReachBottomData() {
|
|
|
- // 上滑加载分页
|
|
|
- this.listQuery.pageNum += 1
|
|
|
- this.ProductService.getSvipProductPage(this.listQuery)
|
|
|
- .then(response => {
|
|
|
- let data = response.data.svipProductPage
|
|
|
- if (data.results && data.results.length > 0) {
|
|
|
- this.hasNextPage = data.hasNextPage
|
|
|
- this.productList = this.productList.concat(data.results)
|
|
|
- this.pullFlag = false // 防上拉暴滑
|
|
|
- setTimeout(() => {
|
|
|
- this.pullFlag = true
|
|
|
- }, 500)
|
|
|
- if (this.hasNextPage) {
|
|
|
- this.pullUpOn = false
|
|
|
- this.nomoreText = '上拉显示更多'
|
|
|
- } else {
|
|
|
- this.pullUpOn = false
|
|
|
- this.loadding = false
|
|
|
- this.nomoreText = '已至底部'
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- this.$util.msg(error.msg, 2000)
|
|
|
- })
|
|
|
- },
|
|
|
- PromotionsFormat(promo) {
|
|
|
- //促销活动类型数据处理
|
|
|
- if (promo != null) {
|
|
|
- if (promo.type == 1 && promo.mode == 1) {
|
|
|
- return true
|
|
|
- } else {
|
|
|
- return false
|
|
|
- }
|
|
|
+ async mallOrganizeProducts(floorId){
|
|
|
+ //初始化首页数据
|
|
|
+ try{
|
|
|
+ const res = await this.CommonService.mallOrganizeProducts({ floorId: floorId })
|
|
|
+ this.productList = res.data
|
|
|
+ this.skeletonShow = false
|
|
|
+ }catch(error){
|
|
|
+ //TODO handle the exception
|
|
|
+ console.log('error',error)
|
|
|
}
|
|
|
- return false
|
|
|
},
|
|
|
productDetail(productId) {
|
|
|
// 跳转商品详情
|
|
@@ -173,31 +91,6 @@ export default {
|
|
|
this.$api.navigateTo(`/pages/goods/product?id=${productId}`)
|
|
|
this.isModallayer = false
|
|
|
},
|
|
|
- isShowVipFlag(pros) {
|
|
|
- /**
|
|
|
- *显示SVIP和超级会员价格:
|
|
|
- * 个人机构(不是超级会员,但价格所有机构可见),
|
|
|
- * 资质机构(不是超级会员,但价格所有机构可见或仅会员可见),
|
|
|
- * 超级会员(价格所有机构可见或仅会员可见),超级会员(是医美机构,价格仅医美可见)
|
|
|
- *商品价格是否可见:priceFlag 0:所有机构可见 1:未公开价格 2:仅会员可见 3:仅医美机构可见
|
|
|
- * 普通机构
|
|
|
- * 超级会员 && priceFlag === 0
|
|
|
- * 资质机构
|
|
|
- * priceFlag !== 1 ||
|
|
|
- * 超级会员
|
|
|
- * 商品priceFlag === 3 && 是否是医美机构
|
|
|
- */
|
|
|
- // 未登录 || 非会员
|
|
|
- if(!this.hasLogin || !this.vipFlag === 1) return false
|
|
|
- // 商品所有机构可见
|
|
|
- if(pros.priceFlag === 0 ) return true
|
|
|
- // 商品价格仅资质机构可见
|
|
|
- if(pros.priceFlag === 2 && this.userIdentity === 2) return true
|
|
|
- // 商品价格仅医美机构可见
|
|
|
- if(pros.priceFlag === 3 && this.userIdentity === 2 && this.firstClubType == 1) return true
|
|
|
- // 其它
|
|
|
- return false
|
|
|
- },
|
|
|
},
|
|
|
onPullDownRefresh() {
|
|
|
setTimeout(() => {
|