|
|
@ -23,14 +23,16 @@ |
|
|
|
<img class="img pic-img default-img" :src="item.image" |
|
|
|
onerror="this.src='url(http://36.138.125.206:8081/ceres-local-file/image/default.png) no-repeat center';this.οnerrοr=null"> |
|
|
|
</div> |
|
|
|
<image v-if="item.ifCollect === 1" class="collect-img" src="http://36.138.125.206:8081/ceres-local-file/image/prod_collect_active.png" @click.stop="onCollect(item, 0)"/> |
|
|
|
<image v-else class="collect-img" src="http://36.138.125.206:8081/ceres-local-file/image/prod_collect_normal.png" @click.stop="onCollect(item, 1)"/> |
|
|
|
<div class="product-swiper-info"> |
|
|
|
<div class="product-info-content"> |
|
|
|
<div class="product-name-row"> |
|
|
|
<label class="product-name">{{item.productName}}</label> |
|
|
|
<image class="product-star" |
|
|
|
<!-- <image class="product-star" |
|
|
|
src="http://36.138.125.206:8081/ceres-local-file/image/icon_star.png"> |
|
|
|
</image> |
|
|
|
<label class="product-star-text">3.5</label> |
|
|
|
<label class="product-star-text">3.5</label>--> |
|
|
|
</div> |
|
|
|
<div class="product-sku-row" v-if="false"> |
|
|
|
<label class="product-sku-name">规格</label> |
|
|
@ -98,6 +100,8 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
const NET = require('../../../../../utils/request') |
|
|
|
const API = require('../../../../../config/api') |
|
|
|
import { |
|
|
|
commonMixin |
|
|
|
} from '../mixin' |
|
|
@ -112,7 +116,33 @@ |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
|
|
|
|
//state:1收藏,0取消收藏 |
|
|
|
onCollect(item, state){ |
|
|
|
let _this = this; |
|
|
|
if (state === 1){ |
|
|
|
NET.request(API.collect, { |
|
|
|
productId: parseInt(item.productId) |
|
|
|
}, 'POST').then(res => { |
|
|
|
// item.ifCollect = 1; |
|
|
|
_this.$set(item, 'ifCollect', 1); |
|
|
|
uni.showToast({ |
|
|
|
title: this.$t('common.collectsuccess'), |
|
|
|
icon: "success" |
|
|
|
}) |
|
|
|
}) |
|
|
|
}else { |
|
|
|
NET.request(API.cancelCollect, { |
|
|
|
ids: [item.productId] |
|
|
|
}, 'PUT').then(res => { |
|
|
|
// item.ifCollect = 0; |
|
|
|
_this.$set(item, 'ifCollect', 0); |
|
|
|
uni.showToast({ |
|
|
|
title: this.$t('common.cancelcollectsuccess'), |
|
|
|
icon: "success" |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
@ -250,6 +280,15 @@ |
|
|
|
position: relative; |
|
|
|
} |
|
|
|
|
|
|
|
.collect-img { |
|
|
|
width: 56rpx; |
|
|
|
height: 56rpx; |
|
|
|
position: absolute; |
|
|
|
right: 35rpx; |
|
|
|
top: 15rpx; |
|
|
|
z-index: 999; |
|
|
|
} |
|
|
|
|
|
|
|
&-img { |
|
|
|
width: 286upx; |
|
|
|
height: 306upx; |
|
|
|