添加商品描述和价格冗余字段
This commit is contained in:
parent
c1e34b908c
commit
2dc243a18f
@ -98,7 +98,7 @@
|
||||
</div>
|
||||
<van-goods-action>
|
||||
|
||||
<van-goods-action-mini-btn icon="like-o" @click="onFavoriteClicked">
|
||||
<van-goods-action-mini-btn icon="like-o" :class="{active:hasCollectionType === 1 }" @click="onFavoriteClicked">
|
||||
收藏
|
||||
</van-goods-action-mini-btn>
|
||||
<van-goods-action-mini-btn icon="cart" :info="cartCount > 0 ? cartCount : undefined" @click="onClickCart">
|
||||
@ -208,6 +208,7 @@
|
||||
calSkuPriceResult: {
|
||||
|
||||
},
|
||||
hasCollectionType:0
|
||||
|
||||
};
|
||||
},
|
||||
@ -327,11 +328,14 @@
|
||||
// alert("hasCollectionType==" + hasCollectionType);
|
||||
collectionSpu(id,hasCollectionType).then(data =>{
|
||||
let v = data;
|
||||
if (hasCollectionType == 1 && v){
|
||||
alert("商品已收藏");
|
||||
}else if (hasCollectionType == 2 && v){
|
||||
alert("商品已取消");
|
||||
}
|
||||
this.hasCollectionType = hasCollectionType;
|
||||
// if (hasCollectionType == 1 && v){
|
||||
// // alert("商品已收藏");
|
||||
// this.hasCollectionType = hasCollectionType;
|
||||
// }else if (hasCollectionType == 2 && v){
|
||||
// // alert("商品已取消");
|
||||
// this.hasCollectionType = hasCollectionType;
|
||||
// }
|
||||
})
|
||||
});
|
||||
|
||||
@ -448,6 +452,9 @@
|
||||
|
||||
<style lang="less">
|
||||
.goods {
|
||||
.active {
|
||||
color: #e50f3d;
|
||||
}
|
||||
padding-bottom: 50px;
|
||||
|
||||
&-swipe {
|
||||
|
@ -7,19 +7,27 @@
|
||||
@load="onLoad"
|
||||
>
|
||||
<div v-for="(item,index) in list" :key="index">
|
||||
<van-swipe-cell :right-width="65" :on-close="onClose(item)">
|
||||
<product-card :product='item' />
|
||||
<span>{{item.spuName}}</span>
|
||||
<span slot="right" >删除</span>
|
||||
</van-swipe-cell>
|
||||
<!-- <van-swipe-cell :right-width="65" :on-close="onClose(item)">-->
|
||||
<!-- <product-card :product='item' />-->
|
||||
<!-- <span>{{item.spuName}}</span>-->
|
||||
<!-- <span slot="right" >删除</span>-->
|
||||
<!-- </van-swipe-cell>-->
|
||||
<van-card
|
||||
:price="formatPrice(item.price)"
|
||||
:desc="item.sellPoint"
|
||||
:title="item.spuName"
|
||||
:thumb="item.spuImage"
|
||||
/>
|
||||
</div>
|
||||
</van-list>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { Card } from 'vant';
|
||||
import { GetFavoritePage ,DelFavorite} from "../../../api/user.js";
|
||||
|
||||
// Vue.use(Card);
|
||||
export default {
|
||||
data(){
|
||||
return{
|
||||
@ -31,6 +39,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
formatPrice(data) {
|
||||
return (data / 100).toFixed(2);
|
||||
},
|
||||
onClose(item){
|
||||
return function(clickPosition, instance) {
|
||||
switch (clickPosition) {
|
||||
|
@ -37,6 +37,16 @@ public class ProductSpuCollectionMessage {
|
||||
*/
|
||||
private String spuImage;
|
||||
|
||||
/**
|
||||
* 卖点
|
||||
*/
|
||||
private String sellPoint;
|
||||
|
||||
/**
|
||||
* 价格,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
* 1 收藏 2 取消
|
||||
*/
|
||||
|
@ -6,11 +6,14 @@ import cn.iocoder.mall.product.api.constant.ProductErrorCodeEnum;
|
||||
import cn.iocoder.mall.product.api.message.ProductSpuCollectionMessage;
|
||||
import cn.iocoder.mall.product.dao.ProductSpuMapper;
|
||||
import cn.iocoder.mall.product.dataobject.ProductSpuDO;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ProductSpuCollectionServiceImpl
|
||||
@ -47,9 +50,14 @@ public class ProductSpuCollectionServiceImpl implements ProductSpuCollectionServ
|
||||
*/
|
||||
private void sendProductSpuCollectionMessage(final ProductSpuDO productSpuDO, final Integer hasCollectionType,
|
||||
final Integer userId) {
|
||||
List<String> result = Lists.newArrayList(Splitter.on(",").omitEmptyStrings().trimResults().split(productSpuDO.getPicUrls()));
|
||||
ProductSpuCollectionMessage productSpuCollectionMessage = new ProductSpuCollectionMessage()
|
||||
.setSpuId(productSpuDO.getId()).setSpuName(productSpuDO.getName())
|
||||
.setSpuImage(productSpuDO.getPicUrls()).setHasCollectionType(hasCollectionType)
|
||||
.setSpuId(productSpuDO.getId())
|
||||
.setSpuName(productSpuDO.getName())
|
||||
.setSpuImage(result.size() > 0 ? result.get(0) : "")
|
||||
.setSellPoint(productSpuDO.getSellPoint())
|
||||
.setPrice(productSpuDO.getPrice())
|
||||
.setHasCollectionType(hasCollectionType)
|
||||
.setUserId(userId);
|
||||
rocketMQTemplate.convertAndSend(ProductSpuCollectionMessage.TOPIC, productSpuCollectionMessage);
|
||||
}
|
||||
|
@ -45,6 +45,16 @@ public class UserProductSpuCollectionsBO implements Serializable {
|
||||
*/
|
||||
private String spuImage;
|
||||
|
||||
/**
|
||||
* 卖点
|
||||
*/
|
||||
private String sellPoint;
|
||||
|
||||
/**
|
||||
* 价格,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
@ -46,6 +46,16 @@ public class UserProductSpuCollectionsAddDTO implements Serializable {
|
||||
*/
|
||||
private String spuImage;
|
||||
|
||||
/**
|
||||
* 卖点
|
||||
*/
|
||||
private String sellPoint;
|
||||
|
||||
/**
|
||||
* 价格,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
@ -50,6 +50,16 @@ public class UserProductSpuCollectionsDO implements Serializable {
|
||||
*/
|
||||
private String spuImage;
|
||||
|
||||
/**
|
||||
* 卖点
|
||||
*/
|
||||
private String sellPoint;
|
||||
|
||||
/**
|
||||
* 价格,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
@ -11,6 +11,8 @@ import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsUpdateDTO;
|
||||
import cn.iocoder.mall.user.biz.convert.UserProductSpuCollectionsConvert;
|
||||
import cn.iocoder.mall.user.biz.dao.UserProductSpuCollectionsMapper;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserProductSpuCollectionsDO;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@ -33,6 +35,10 @@ public class UserProductSpuCollectionsServiceImpl implements UserProductSpuColle
|
||||
@Autowired
|
||||
private UserProductSpuCollectionsMapper userProductSpuCollectionsMapper;
|
||||
|
||||
// TODO 暂时先使用冗余字段,有需要在对接实时数据查询
|
||||
// @Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}")
|
||||
// private ProductSpuService productSpuService;
|
||||
|
||||
|
||||
@Override
|
||||
public int addUserSkuCollections(UserProductSpuCollectionsAddDTO userProductSpuCollectionsAddDTO) {
|
||||
@ -72,6 +78,11 @@ public class UserProductSpuCollectionsServiceImpl implements UserProductSpuColle
|
||||
return CommonResult.success(
|
||||
new UserProductSpuCollectionsPageBO().setList(Collections.emptyList()).setTotal(totalCount));
|
||||
}
|
||||
for (UserProductSpuCollectionsDO userProductSpuCollectionsDO : list
|
||||
) {
|
||||
List<String> result = Lists.newArrayList(Splitter.on(",").omitEmptyStrings().trimResults().split(userProductSpuCollectionsDO.getSpuImage()));
|
||||
userProductSpuCollectionsDO.setSpuImage(result.size() > 0 ? result.get(0) : "");
|
||||
}
|
||||
|
||||
UserProductSpuCollectionsPageBO userProductSpuCollectionsPageBO = new UserProductSpuCollectionsPageBO();
|
||||
userProductSpuCollectionsPageBO.setList(UserProductSpuCollectionsConvert.INSTANCE.convert(list));
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, user_id, nickname, spu_id, spu_name,
|
||||
spu_image, create_time, update_time,
|
||||
spu_image,sell_point,price, create_time, update_time,
|
||||
deleted
|
||||
</sql>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user