|
@@ -451,9 +451,16 @@
|
|
|
<view class="item-bt" @click="this.$api.switchTabTo('/pages/tabBar/home/index')">
|
|
|
<image src="../../static/icon-home-active@3x.png"></image> <text>首页</text>
|
|
|
</view>
|
|
|
- <button class="item-bt" open-type="contact" @click="handleContact">
|
|
|
- <image src="../../static/severs@3x.png"></image> <text>客服</text>
|
|
|
- </button>
|
|
|
+ <view class="item-bt" @click="handleCollection">
|
|
|
+ <image
|
|
|
+ :src="
|
|
|
+ collectionType
|
|
|
+ ? StaticUrl + 'icon/icon-collection@2x.png'
|
|
|
+ : StaticUrl + 'icon/icon-collection-none@2x.png'
|
|
|
+ "
|
|
|
+ ></image>
|
|
|
+ <text>{{ collectionType ? '已收藏' : '收藏' }}</text>
|
|
|
+ </view>
|
|
|
<view class="item-bt" @click="buyProductCart()">
|
|
|
<image src="https://static.caimei365.com/app/img/icon/icon-cart-active@3x.png"></image>
|
|
|
<text>购物车</text>
|
|
@@ -655,7 +662,8 @@ export default {
|
|
|
bottomCartNumber: 0,
|
|
|
navbar: [{ name: '未领取', num: 0 }, { name: '已领取', num: 0 }],
|
|
|
isPreviewImage: false,
|
|
|
- opentype: ''
|
|
|
+ opentype: '',
|
|
|
+ collectionType: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -735,6 +743,11 @@ export default {
|
|
|
this.shop = response.data.shop
|
|
|
this.shopId = response.data.shopID
|
|
|
this.product = response.data
|
|
|
+ if (this.product.userLike && this.product.userLike == 1) {
|
|
|
+ this.collectionType = true
|
|
|
+ } else {
|
|
|
+ this.collectionType = false
|
|
|
+ }
|
|
|
//已删除/已冻结
|
|
|
if (this.product.validFlag === 0 || this.product.validFlag == 10) {
|
|
|
this.isInvalid = true
|
|
@@ -1128,6 +1141,24 @@ export default {
|
|
|
imageUrl: `${this.productImage[0]}`
|
|
|
}
|
|
|
},
|
|
|
+ handleCollection() {
|
|
|
+ // 收藏
|
|
|
+ if (this.hasLogin) {
|
|
|
+ this.ProductService.getProductUserLike({
|
|
|
+ userId: this.userId,
|
|
|
+ productId: this.product.productId
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ this.collectionType = !this.collectionType
|
|
|
+ this.$util.msg(response.data, 1500, true, 'success')
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ this.$util.msg(error.msg, 2000)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$api.navigateTo('/pages/login/login')
|
|
|
+ }
|
|
|
+ },
|
|
|
showPopup(index) {
|
|
|
switch (index) {
|
|
|
case 0:
|
|
@@ -2626,4 +2657,4 @@ rich-text.img {
|
|
|
width: 100%;
|
|
|
height: auto;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|