|
@@ -38,7 +38,9 @@
|
|
|
<view class="list-none"><view class="price-small">¥未公开价格</view></view>
|
|
|
</view>
|
|
|
<view class="list-details-price" v-else-if="pros.priceFlag == 2">
|
|
|
- <view class="list-none"><view class="price-small">¥价格仅会员可见</view></view>
|
|
|
+ <view class="list-none"
|
|
|
+ ><view class="price-small">¥价格仅会员可见</view></view
|
|
|
+ >
|
|
|
</view>
|
|
|
<template v-else>
|
|
|
<view class="list-details-price">
|
|
@@ -46,13 +48,15 @@
|
|
|
<text
|
|
|
class="price-larger"
|
|
|
:class="
|
|
|
- PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
|
|
|
+ PromotionsFormat(pros.promotions) ||
|
|
|
+ pros.svipProductFlag == 1
|
|
|
? 'none'
|
|
|
: ''
|
|
|
"
|
|
|
>
|
|
|
¥{{
|
|
|
- (PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
|
|
|
+ (PromotionsFormat(pros.promotions) ||
|
|
|
+ pros.svipProductFlag == 1
|
|
|
? pros.originalPrice
|
|
|
: pros.price) | NumFormat
|
|
|
}}
|
|
@@ -69,8 +73,7 @@
|
|
|
type="number"
|
|
|
maxlength="4"
|
|
|
v-model="pros.number"
|
|
|
- @blur="changeNumber($event,pros)"
|
|
|
- @focus="changeInput(pros)"
|
|
|
+ @blur="changeNumber($event, pros)"
|
|
|
/>
|
|
|
<view
|
|
|
class="iconfont icon-jiahao"
|
|
@@ -81,23 +84,33 @@
|
|
|
</view>
|
|
|
<view class="list-details-price none">
|
|
|
<view class="floor-item-act">
|
|
|
- <view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
|
|
|
+ <view class="coupon-tags" v-if="item.product.couponsLogo"
|
|
|
+ >优惠券</view
|
|
|
+ >
|
|
|
<template v-if="pros.actStatus == 1">
|
|
|
<view
|
|
|
class="floor-tags"
|
|
|
- v-if="pros.actStatus == 1 && PromotionsFormat(pros.promotions)"
|
|
|
+ v-if="
|
|
|
+ pros.actStatus == 1 && PromotionsFormat(pros.promotions)
|
|
|
+ "
|
|
|
>
|
|
|
{{ pros.promotions.name }}
|
|
|
<text
|
|
|
- v-if="hasLogin && userIdentity == 2 && pros.priceFlag != 1"
|
|
|
+ v-if="
|
|
|
+ hasLogin && userIdentity == 2 && pros.priceFlag != 1
|
|
|
+ "
|
|
|
>:¥{{ pros.price | NumFormat }}</text
|
|
|
>
|
|
|
</view>
|
|
|
- <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
|
|
|
+ <view class="floor-tags" v-else>{{
|
|
|
+ pros.promotions.name
|
|
|
+ }}</view>
|
|
|
</template>
|
|
|
<template v-if="pros.svipProductFlag == 1">
|
|
|
<view class="svip-tags">
|
|
|
- <view class="tags" :class="{ none: vipFlag == 0 }">SVIP</view>
|
|
|
+ <view class="tags" :class="{ none: vipFlag == 0 }"
|
|
|
+ >SVIP</view
|
|
|
+ >
|
|
|
<view class="price" v-if="isShowVipFlag(pros)">{{
|
|
|
pros.svipPriceTag
|
|
|
}}</view>
|
|
@@ -117,13 +130,15 @@
|
|
|
<text
|
|
|
class="price-larger"
|
|
|
:class="
|
|
|
- PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
|
|
|
+ PromotionsFormat(pros.promotions) ||
|
|
|
+ pros.svipProductFlag == 1
|
|
|
? 'none'
|
|
|
: ''
|
|
|
"
|
|
|
>
|
|
|
¥{{
|
|
|
- (PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
|
|
|
+ (PromotionsFormat(pros.promotions) ||
|
|
|
+ pros.svipProductFlag == 1
|
|
|
? pros.originalPrice
|
|
|
: pros.price) | NumFormat
|
|
|
}}
|
|
@@ -141,8 +156,7 @@
|
|
|
type="number"
|
|
|
maxlength="4"
|
|
|
v-model="pros.number"
|
|
|
- @blur="changeNumber($event,pros)"
|
|
|
- @focus="changeInput(pros)"
|
|
|
+ @blur="changeNumber($event, pros)"
|
|
|
/>
|
|
|
<view
|
|
|
class="iconfont icon-jiahao"
|
|
@@ -157,19 +171,27 @@
|
|
|
<template v-if="pros.actStatus == 1">
|
|
|
<view
|
|
|
class="floor-tags"
|
|
|
- v-if="pros.actStatus == 1 && PromotionsFormat(pros.promotions)"
|
|
|
+ v-if="
|
|
|
+ pros.actStatus == 1 && PromotionsFormat(pros.promotions)
|
|
|
+ "
|
|
|
>
|
|
|
{{ pros.promotions.name }}
|
|
|
<text
|
|
|
- v-if="hasLogin && userIdentity == 2 && pros.priceFlag != 1"
|
|
|
+ v-if="
|
|
|
+ hasLogin && userIdentity == 2 && pros.priceFlag != 1
|
|
|
+ "
|
|
|
>:¥{{ pros.price | NumFormat }}</text
|
|
|
>
|
|
|
</view>
|
|
|
- <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
|
|
|
+ <view class="floor-tags" v-else>{{
|
|
|
+ pros.promotions.name
|
|
|
+ }}</view>
|
|
|
</template>
|
|
|
<template v-if="pros.svipProductFlag == 1">
|
|
|
<view class="svip-tags">
|
|
|
- <view class="tags" :class="{ none: vipFlag == 0 }">SVIP</view>
|
|
|
+ <view class="tags" :class="{ none: vipFlag == 0 }"
|
|
|
+ >SVIP</view
|
|
|
+ >
|
|
|
<view class="price" v-if="isShowVipFlag(pros)">{{
|
|
|
pros.svipPriceTag
|
|
|
}}</view>
|
|
@@ -198,12 +220,8 @@
|
|
|
maxlength="4"
|
|
|
v-model="pros.number"
|
|
|
@blur="changeNumber($event, pros)"
|
|
|
- @focus="changeInput(pros)"
|
|
|
/>
|
|
|
- <view
|
|
|
- class="iconfont icon-jiahao"
|
|
|
- @click="changeCountAdd(pros)"
|
|
|
- ></view>
|
|
|
+ <view class="iconfont icon-jiahao" @click="changeCountAdd(pros)"></view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -219,9 +237,7 @@
|
|
|
<view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
|
|
|
</template>
|
|
|
<template v-if="pros.svipProductFlag == 1">
|
|
|
- <view class="svip-tags">
|
|
|
- <view class="tags none">SVIP</view>
|
|
|
- </view>
|
|
|
+ <view class="svip-tags"> <view class="tags none">SVIP</view> </view>
|
|
|
</template>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -277,11 +293,6 @@ import tuiNomore from '@/components/tui-components/nomore/nomore'
|
|
|
import uniGrader from '@/components/uni-grade/uni-grade.vue'
|
|
|
|
|
|
import { mapState, mapMutations } from 'vuex'
|
|
|
-const defaultListQuery = {
|
|
|
- userId: 0,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10
|
|
|
-}
|
|
|
export default {
|
|
|
components: {
|
|
|
tuiLoadmore,
|
|
@@ -310,7 +321,13 @@ export default {
|
|
|
totalRecord: 0,
|
|
|
cartQuantity: 0,
|
|
|
popupShow: true,
|
|
|
- listQuery: Object.assign({}, defaultListQuery),
|
|
|
+ listQuery: {
|
|
|
+ userId: 0,
|
|
|
+ productId: 0,
|
|
|
+ source: 2,
|
|
|
+ pageNum:1,
|
|
|
+ pageSize:10
|
|
|
+ },
|
|
|
productList: [],
|
|
|
handleData: {},
|
|
|
number: 0,
|
|
@@ -320,6 +337,7 @@ export default {
|
|
|
scrollTop: 0,
|
|
|
isEmpty: false,
|
|
|
isAllChecked: false,
|
|
|
+ navbarHeight: '',
|
|
|
loadding: false,
|
|
|
pullUpOn: true,
|
|
|
pullFlag: true,
|
|
@@ -331,10 +349,11 @@ export default {
|
|
|
vipFlag: 0,
|
|
|
userIdentity: 0,
|
|
|
isQuantity: false,
|
|
|
- isStock: false,
|
|
|
+ isStock: false
|
|
|
}
|
|
|
},
|
|
|
- onLoad() {
|
|
|
+ onLoad(option) {
|
|
|
+ this.listQuery.productId = option.productId
|
|
|
this.initGetStotage()
|
|
|
},
|
|
|
filters: {
|
|
@@ -355,58 +374,54 @@ export default {
|
|
|
this.listQuery.userId = userInfo.userId ? userInfo.userId : 0
|
|
|
this.vipFlag = userInfo.vipFlag ? userInfo.vipFlag : 0
|
|
|
this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
|
|
|
- this.GetProductListInfo()
|
|
|
- this.shoppingHeaderCartNumber()
|
|
|
+ this.getCommodityCombinationList()
|
|
|
},
|
|
|
- GetProductListInfo() {
|
|
|
- this.productList = []
|
|
|
- this.listQuery.pageNum = 1
|
|
|
- this.ProductService.getProductUserLikeList(this.listQuery)
|
|
|
+ getCommodityCombinationList() {
|
|
|
+ // 初始化商品详情配套商品
|
|
|
+ this.ProductService.getCommodityCombinationList(this.listQuery)
|
|
|
.then(response => {
|
|
|
- let data = response.data
|
|
|
- if (data.results && data.results.length > 0) {
|
|
|
- this.isEmpty = false
|
|
|
- this.hasNextPage = data.hasNextPage
|
|
|
- this.totalRecord = data.totalRecord
|
|
|
- this.productList = data.results.map((el,index)=>{
|
|
|
- el.isChecked = false
|
|
|
- el.number = el.minBuyNumber
|
|
|
- return el
|
|
|
- })
|
|
|
- this.pullFlag = false
|
|
|
- setTimeout(() => {
|
|
|
- this.pullFlag = true
|
|
|
- }, 500)
|
|
|
- if (this.hasNextPage) {
|
|
|
- this.pullUpOn = false
|
|
|
- this.nomoreText = '上拉显示更多'
|
|
|
+ let data = response.data
|
|
|
+ this.hasNextPage = data.hasNextPage
|
|
|
+ this.productList = data.results.map((el, index) => {
|
|
|
+ el.isChecked = false
|
|
|
+ el.number = el.minBuyNumber
|
|
|
+ return el
|
|
|
+ })
|
|
|
+ this.pullFlag = false
|
|
|
+ setTimeout(() => {
|
|
|
+ this.pullFlag = true
|
|
|
+ }, 500)
|
|
|
+ if (this.hasNextPage) {
|
|
|
+ this.pullUpOn = false
|
|
|
+ this.nomoreText = '上拉显示更多'
|
|
|
+ } else {
|
|
|
+ if (this.productList.length < 8) {
|
|
|
+ this.pullUpOn = true
|
|
|
} else {
|
|
|
- if (this.productList.length < 8) {
|
|
|
- this.pullUpOn = true
|
|
|
- } else {
|
|
|
- this.pullUpOn = false
|
|
|
- this.loadding = false
|
|
|
- this.nomoreText = '已至底部'
|
|
|
- }
|
|
|
+ this.pullUpOn = false
|
|
|
+ this.loadding = false
|
|
|
+ this.nomoreText = '已至底部'
|
|
|
}
|
|
|
- } else {
|
|
|
- this.isEmpty = true
|
|
|
}
|
|
|
- this.isRequest = true
|
|
|
})
|
|
|
.catch(error => {
|
|
|
- this.$util.msg(error.msg, 2000)
|
|
|
+ console.log('获取组合商品列表失败')
|
|
|
})
|
|
|
},
|
|
|
- GetOnReachBottomData(index) {
|
|
|
+ GetOnReachBottomData() {
|
|
|
//上拉加载
|
|
|
this.listQuery.pageNum += 1
|
|
|
- this.ProductService.getProductUserLikeList(this.listQuery)
|
|
|
+ this.ProductService.getCommodityCombinationList(this.listQuery)
|
|
|
.then(response => {
|
|
|
let data = response.data
|
|
|
if (data.results && data.results.length > 0) {
|
|
|
this.hasNextPage = data.hasNextPage
|
|
|
- this.productList = this.productList.concat(data.results)
|
|
|
+ let list = data.results.map((el, index) => {
|
|
|
+ el.isChecked = false
|
|
|
+ el.number = el.minBuyNumber
|
|
|
+ return el
|
|
|
+ })
|
|
|
+ this.productList = this.productList.concat(list)
|
|
|
this.pullFlag = false // 防上拉暴滑
|
|
|
setTimeout(() => {
|
|
|
this.pullFlag = true
|
|
@@ -425,32 +440,49 @@ export default {
|
|
|
this.$util.msg(error.msg, 2000)
|
|
|
})
|
|
|
},
|
|
|
- shoppingHeaderCartNumber() {
|
|
|
- // 获取用户购物车储量
|
|
|
- this.ProductService.shoppingHeaderCartNumber({
|
|
|
- userId: this.listQuery.userId
|
|
|
- })
|
|
|
- .then(response => {
|
|
|
- this.cartQuantity = response.data.length
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- console.log('获取购物车数量失败')
|
|
|
- })
|
|
|
- },
|
|
|
- handleSupportingSubmit(type){
|
|
|
- if(this.hasLogin){
|
|
|
- switch(type){
|
|
|
+ handleSupportingSubmit(type) {
|
|
|
+ if (this.hasLogin) {
|
|
|
+ switch (type) {
|
|
|
case 'buy':
|
|
|
console.log('立即购买')
|
|
|
+ this.toConfirmation()
|
|
|
break
|
|
|
case 'add':
|
|
|
console.log('加入购物车')
|
|
|
+ this.getAddProductCart()
|
|
|
break
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.$api.navigateTo('/pages/login/login')
|
|
|
}
|
|
|
},
|
|
|
+ getAddProductCart() {
|
|
|
+ //增加购物车成功和toast弹窗提示成功
|
|
|
+ this.ProductService.shoppingAddCart({
|
|
|
+ productID: this.handleData.productId,
|
|
|
+ userID: this.listQuery.userId,
|
|
|
+ productCount: this.number
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ this.$util.msg('加入购物车成功', 1500, true, 'success')
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ this.$util.msg(error.msg, 2000)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toConfirmation() {
|
|
|
+ //跳转确认订单页面
|
|
|
+ let data = []
|
|
|
+ this.productList.map((el, index) => {
|
|
|
+ if(el.isChecked){
|
|
|
+ data.push({ id:el.productId , count: el.number })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('勾选商品',data)
|
|
|
+ this.$api.navigateTo(
|
|
|
+ `/pages/user/order/create-order?type=3&data=${JSON.stringify({ data: data })}`
|
|
|
+ )
|
|
|
+ },
|
|
|
handleClick(e) {
|
|
|
//取消收藏
|
|
|
if (e.index == 1) {
|
|
@@ -466,9 +498,6 @@ export default {
|
|
|
})
|
|
|
.then(response => {
|
|
|
this.$util.msg('取消收藏成功', 2000, true, 'success')
|
|
|
- setTimeout(() => {
|
|
|
- this.GetProductListInfo()
|
|
|
- }, 2000)
|
|
|
})
|
|
|
.catch(error => {
|
|
|
this.$util.msg(error.msg, 2000)
|
|
@@ -551,7 +580,7 @@ export default {
|
|
|
this.isQuantity = false
|
|
|
}
|
|
|
},
|
|
|
- changeNumber(e,pros) {
|
|
|
+ changeNumber(e, pros) {
|
|
|
let _value = e.detail.value
|
|
|
if (!this.$api.isNumber(_value)) {
|
|
|
pros.number = pros.minBuyNumber
|
|
@@ -576,69 +605,9 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- toConfirmation() {
|
|
|
- //跳转确认订单页面
|
|
|
- this.popupShow1 = false
|
|
|
- let productStp = {
|
|
|
- allPrice: this.number * this.buyRetailPrice,
|
|
|
- allCount: this.number,
|
|
|
- productID: this.handleData.productId,
|
|
|
- productCount: this.number
|
|
|
- }
|
|
|
- this.$api.navigateTo(
|
|
|
- `/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({ data: productStp })}`
|
|
|
- )
|
|
|
- },
|
|
|
- getAddProductCart() {
|
|
|
- //增加购物车成功和toast弹窗提示成功
|
|
|
- this.ProductService.shoppingAddCart({
|
|
|
- productID: this.handleData.productId,
|
|
|
- userID: this.listQuery.userId,
|
|
|
- productCount: this.number
|
|
|
- })
|
|
|
- .then(response => {
|
|
|
- this.popupShow1 = false
|
|
|
- this.$util.msg('加入购物车成功', 1500, true, 'success')
|
|
|
- this.shoppingHeaderCartNumber()
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- this.$util.msg(error.msg, 2000)
|
|
|
- })
|
|
|
- },
|
|
|
- showPopup(index, pros) {
|
|
|
- // 弹窗显示
|
|
|
- switch (index) {
|
|
|
- case 0:
|
|
|
- this.popupShow = true
|
|
|
- break
|
|
|
- case 1:
|
|
|
- this.popupShow1 = true
|
|
|
- this.handleData = pros
|
|
|
- console.log(this.handleData)
|
|
|
- this.buyRetailPrice = this.handleData.price
|
|
|
- this.buyRetailPriceStep = this.handleData.step
|
|
|
- if (this.handleData.ladderPriceFlag == 1) {
|
|
|
- this.number = this.handleData.maxBuyNumber ? this.handleData.maxBuyNumber : 1
|
|
|
- } else {
|
|
|
- this.number = this.handleData.minBuyNumber
|
|
|
- }
|
|
|
- break
|
|
|
- }
|
|
|
- },
|
|
|
- hidePopup(index) {
|
|
|
- // 弹窗隐藏
|
|
|
- switch (index) {
|
|
|
- case 0:
|
|
|
- this.popupShow = false
|
|
|
- break
|
|
|
- case 1:
|
|
|
- this.popupShow1 = false
|
|
|
- break
|
|
|
- }
|
|
|
- },
|
|
|
isShowVipFlag(pros) {
|
|
|
// 超级会员价格显示控制
|
|
|
- if(this.hasLogin){
|
|
|
+ if (this.hasLogin) {
|
|
|
if (pros.priceFlag != 1) {
|
|
|
if (this.userIdentity == 4 && this.vipFlag == 1) {
|
|
|
return true
|
|
@@ -652,15 +621,6 @@ export default {
|
|
|
this.isModallayer = true
|
|
|
this.$api.navigateTo(`/pages/goods/product?id=${id}`)
|
|
|
this.isModallayer = false
|
|
|
- },
|
|
|
- btnClick() {
|
|
|
- this.$api.switchTabTo('/pages/tabBar/cart/index')
|
|
|
- },
|
|
|
- btnTouchstart() {
|
|
|
- // console.log('btnTouchstart');
|
|
|
- },
|
|
|
- btnTouchend() {
|
|
|
- // console.log('btnTouchend');
|
|
|
}
|
|
|
},
|
|
|
onPageScroll(e) {
|
|
@@ -670,12 +630,12 @@ export default {
|
|
|
if (this.hasNextPage) {
|
|
|
this.loadding = true
|
|
|
this.pullUpOn = true
|
|
|
- // this.GetOnReachBottomData()
|
|
|
+ this.GetOnReachBottomData()
|
|
|
}
|
|
|
},
|
|
|
onPullDownRefresh() {
|
|
|
setTimeout(() => {
|
|
|
- this.listQuery.pageNum = 1
|
|
|
+ this.getCommodityCombinationList()
|
|
|
uni.stopPullDownRefresh()
|
|
|
}, 200)
|
|
|
},
|
|
@@ -816,7 +776,7 @@ page {
|
|
|
float: left;
|
|
|
.p-stars {
|
|
|
float: left;
|
|
|
- .p-no{
|
|
|
+ .p-no {
|
|
|
font-size: $font-size-28;
|
|
|
color: $text-color;
|
|
|
display: block;
|