commit
ccf4d8b388
9 changed files with 800 additions and 4 deletions
@ -0,0 +1,301 @@ |
|||||||
|
<template> |
||||||
|
<div class="collection"> |
||||||
|
<!-- 收藏列表--> |
||||||
|
<div class="d-flex collectList" v-if="collectList1.length != 0"> |
||||||
|
<div class="item d-flex" v-for="(item,index) in collectList1" :key="index" v-if="index<7"> |
||||||
|
<img :src="item.defaultPicture"> |
||||||
|
<div class="title f_14">{{item.goodsName}}</div> |
||||||
|
<div class="price f_14">¥{{item.unitPrice}}</div> |
||||||
|
<div class="c_75 f_12">{{item.styleNames}}</div> |
||||||
|
<div class="c_75 f_12">{{item.address}}</div> |
||||||
|
<div class="c_75 f_12">{{item.ordersNum}}</div> |
||||||
|
<a class="button1 f_12">删除</a> |
||||||
|
<div class="button2 f_12 c_fff" @click="ingwc(item.id)">加入购物袋</div> |
||||||
|
</div> |
||||||
|
<div class="more d-flex"> |
||||||
|
<!--<a class="c_1B f_20">点击进入选款<a-icon type="right" /></a>--> |
||||||
|
<router-link class="c_1B f_20" to="/shopping/clothType">点击进入选款</router-link> |
||||||
|
<!--<a class="f_14">查看更多收藏</a>--> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<!-- 收藏列表没有数据--> |
||||||
|
<div class="else" v-if="collectList1.length == 0"> |
||||||
|
<p class="c_1B f_30">您的衣橱中没有收藏任何商品。</p> |
||||||
|
<div class="c_fff f_12">前往探索</div> |
||||||
|
</div> |
||||||
|
<div class="recommending d-flex" v-if="collectList.length == 0"> |
||||||
|
<div class="item title d-flex"> |
||||||
|
<p class="f_20">您可能喜欢</p> |
||||||
|
<p class="f_14">根据算法推荐</p> |
||||||
|
</div> |
||||||
|
<div class="item" v-for="(item,index) in recommendList" :key="index" v-if="index<4"> |
||||||
|
<img :src="item.imgUrl"> |
||||||
|
<span v-if="!item.flag" class="iconfont icon-weishoucang" @click="shouCang(item)"></span> |
||||||
|
<span v-if="item.flag" class="iconfont icon-yishoucang" @click="shouCang(item)"></span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import { httpAction, getAction } from '@/api/manage' |
||||||
|
|
||||||
|
|
||||||
|
export default { |
||||||
|
name: "collection", |
||||||
|
components: { }, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
collectList:[ |
||||||
|
{ |
||||||
|
id:1, |
||||||
|
imgUrl:require("../assets/cloth001.png"), |
||||||
|
title:"商品名商品名商品名商品名商品名", |
||||||
|
price:'23500', |
||||||
|
size:"款式名", |
||||||
|
zhuliao:"主料名", |
||||||
|
fuliao:"辅料名", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:2, |
||||||
|
imgUrl:require("../assets/cloth002.png"), |
||||||
|
title:"商品名商品名商品名商品名商品名", |
||||||
|
price:'23500', |
||||||
|
size:"款式名", |
||||||
|
zhuliao:"主料名", |
||||||
|
fuliao:"辅料名", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:3, |
||||||
|
imgUrl:require("../assets/cloth004.png"), |
||||||
|
title:"商品名商品名商品名商品名商品名", |
||||||
|
price:'23500', |
||||||
|
size:"款式名", |
||||||
|
zhuliao:"主料名", |
||||||
|
fuliao:"辅料名", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:4, |
||||||
|
imgUrl:require("../assets/cloth003.png"), |
||||||
|
title:"商品名商品名商品名商品名商品名", |
||||||
|
price:'23500', |
||||||
|
size:"款式名", |
||||||
|
zhuliao:"主料名", |
||||||
|
fuliao:"辅料名", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:5, |
||||||
|
imgUrl:require("../assets/cloth001.png"), |
||||||
|
title:"商品名商品名商品名商品名商品名", |
||||||
|
price:'23500', |
||||||
|
size:"款式名", |
||||||
|
zhuliao:"主料名", |
||||||
|
fuliao:"辅料名", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:6, |
||||||
|
imgUrl:require("../assets/cloth002.png"), |
||||||
|
title:"商品名商品名商品名商品名商品名", |
||||||
|
price:'23500', |
||||||
|
size:"款式名", |
||||||
|
zhuliao:"主料名", |
||||||
|
fuliao:"辅料名", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:7, |
||||||
|
imgUrl:require("../assets/cloth004.png"), |
||||||
|
title:"商品名商品名商品名商品名商品名", |
||||||
|
price:'23500', |
||||||
|
size:"款式名", |
||||||
|
zhuliao:"主料名", |
||||||
|
fuliao:"辅料名", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:8, |
||||||
|
imgUrl:require("../assets/cloth003.png"), |
||||||
|
title:"商品名商品名商品名商品名商品名", |
||||||
|
price:'23500', |
||||||
|
size:"款式名", |
||||||
|
zhuliao:"主料名", |
||||||
|
fuliao:"辅料名", |
||||||
|
} |
||||||
|
], |
||||||
|
collectList1:[], |
||||||
|
recommendList:[ |
||||||
|
{ |
||||||
|
id:1, |
||||||
|
imgUrl:require("../assets/cloth003.png"), |
||||||
|
flag:false//是否点赞 |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:2, |
||||||
|
imgUrl:require("../assets/cloth002.png"), |
||||||
|
flag:false |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:3, |
||||||
|
imgUrl:require("../assets/cloth002.png"), |
||||||
|
flag:false |
||||||
|
}, |
||||||
|
{ |
||||||
|
id:4, |
||||||
|
imgUrl:require("../assets/cloth003.png"), |
||||||
|
flag:false |
||||||
|
}, |
||||||
|
], |
||||||
|
|
||||||
|
|
||||||
|
url: { |
||||||
|
findallcg: "/getuserpersion/findallcg", |
||||||
|
ingwc: "/getuserpersion/ingwc" |
||||||
|
}, |
||||||
|
|
||||||
|
|
||||||
|
}; |
||||||
|
}, |
||||||
|
created() { |
||||||
|
this.findallcg(); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
shouCang(item){ |
||||||
|
console.log(item) |
||||||
|
item.flag = !item.flag |
||||||
|
}, |
||||||
|
findallcg(){ |
||||||
|
getAction(this.url.findallcg).then((res) => { |
||||||
|
if(res.success) { |
||||||
|
this.collectList1 = res.result; |
||||||
|
console.log(res.result) |
||||||
|
this.visible = true; |
||||||
|
} else { |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
}, |
||||||
|
|
||||||
|
ingwc(id){ |
||||||
|
getAction(this.url.ingwc,{id,id}).then((res) => { |
||||||
|
if(res.success) { |
||||||
|
alert('宝贝已经添加到购物了,请查收'); |
||||||
|
} else { |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
}, |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="less" scoped> |
||||||
|
@import '../assets/common.css'; |
||||||
|
.collection{ |
||||||
|
width: 1114px;margin:0 auto; |
||||||
|
.collectList{ |
||||||
|
justify-content: flex-start; |
||||||
|
flex-wrap: wrap; |
||||||
|
.more{ |
||||||
|
width: 240px; |
||||||
|
flex-direction: column; |
||||||
|
align-items: center; |
||||||
|
justify-content: center; |
||||||
|
.c_1B{ |
||||||
|
margin-bottom: 12px; |
||||||
|
} |
||||||
|
.f_14{ |
||||||
|
color: #666; |
||||||
|
} |
||||||
|
} |
||||||
|
.item{ |
||||||
|
width: 240px; |
||||||
|
flex-direction: column; |
||||||
|
align-items: center; |
||||||
|
margin-bottom: 100px; |
||||||
|
margin-right: 30px; |
||||||
|
img{ |
||||||
|
width: 220px; |
||||||
|
height: 220px; |
||||||
|
} |
||||||
|
.title{ |
||||||
|
color: #1A1919; |
||||||
|
} |
||||||
|
.price{ |
||||||
|
color: #1A1919; |
||||||
|
margin-top: 9px; |
||||||
|
margin-bottom: 12px; |
||||||
|
} |
||||||
|
.c_75{ |
||||||
|
color: #757575; |
||||||
|
} |
||||||
|
.button1{ |
||||||
|
margin-top: 10px; |
||||||
|
margin-bottom: 24px; |
||||||
|
color: #1A1919; |
||||||
|
text-decoration: underline; |
||||||
|
} |
||||||
|
.button2{ |
||||||
|
background-color: #000; |
||||||
|
padding: 8px 16px; |
||||||
|
transition: all 0.3s; |
||||||
|
&:hover{ |
||||||
|
opacity: 0.6; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
.else{ |
||||||
|
text-align: center; |
||||||
|
padding-top: 60px; |
||||||
|
margin-bottom: 150px; |
||||||
|
.c_fff{ |
||||||
|
width: 196px; |
||||||
|
height: 42px; |
||||||
|
line-height: 42px; |
||||||
|
background-color: #000; |
||||||
|
margin: 0 auto; |
||||||
|
transition: all 0.3s; |
||||||
|
&:hover{ |
||||||
|
opacity: 0.8; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
.recommending{ |
||||||
|
border: 1px solid #E7E7E7; |
||||||
|
.title{ |
||||||
|
flex-direction: column; |
||||||
|
justify-content: center; |
||||||
|
align-items: center; |
||||||
|
.f_20{ |
||||||
|
color: #313131; |
||||||
|
} |
||||||
|
.f_14{ |
||||||
|
color: #4B4E4B; |
||||||
|
} |
||||||
|
} |
||||||
|
.item{ |
||||||
|
position: relative; |
||||||
|
width: 300px; |
||||||
|
border-right: 1px solid #E7E7E7; |
||||||
|
.iconfont{ |
||||||
|
width: 24px; |
||||||
|
height: 24px; |
||||||
|
text-align: center; |
||||||
|
box-sizing: border-box; |
||||||
|
border: 1px dashed #fff; |
||||||
|
position: absolute; |
||||||
|
transition: all 0.1s; |
||||||
|
top: 5%; |
||||||
|
right: 5%; |
||||||
|
&:hover{ |
||||||
|
border-color: #999; |
||||||
|
} |
||||||
|
} |
||||||
|
img{ |
||||||
|
width: 200px; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
||||||
|
|
@ -0,0 +1,157 @@ |
|||||||
|
package org.jeecg.modules.system.controller; |
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.google.common.base.Joiner; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.apache.shiro.SecurityUtils; |
||||||
|
import org.aspectj.apache.bcel.generic.RET; |
||||||
|
import org.jeecg.common.api.vo.Result; |
||||||
|
import org.jeecg.common.constant.CommonConstant; |
||||||
|
import org.jeecg.common.system.vo.LoginUser; |
||||||
|
import org.jeecg.modules.base.service.BaseCommonService; |
||||||
|
import org.jeecg.modules.demo.customercollectgoods.entity.Customercollectgoods; |
||||||
|
import org.jeecg.modules.demo.customercollectgoods.service.ICustomercollectgoodsService; |
||||||
|
import org.jeecg.modules.demo.customershoppingcart.entity.CustomerShoppingCart; |
||||||
|
import org.jeecg.modules.demo.customershoppingcart.service.ICustomerShoppingCartService; |
||||||
|
import org.jeecg.modules.demo.zygoods.entity.ZyGoods; |
||||||
|
import org.jeecg.modules.demo.zygoods.service.IZyGoodsService; |
||||||
|
import org.jeecg.modules.system.entity.SysUser; |
||||||
|
import org.jeecg.modules.system.service.ISysUserService; |
||||||
|
import org.jeecg.modules.system.vo.Grzx1; |
||||||
|
import org.jeecg.modules.system.vo.Grzx2; |
||||||
|
import org.jeecg.modules.system.vo.Grzx3; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.http.HttpRequest; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.lang.reflect.Field; |
||||||
|
import java.util.*; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/* |
||||||
|
这个是个人中心专用控制器,之前全都写在SysUserController(用户控制器里面,感觉不妥)因此就专门拖出来一个 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RestController |
||||||
|
@RequestMapping("/getuserpersion") |
||||||
|
public class ApeopersionController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ISysUserService sysUserService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ICustomercollectgoodsService customercollectgoodsService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IZyGoodsService zyGoodsService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ICustomerShoppingCartService customerShoppingCartService; |
||||||
|
|
||||||
|
|
||||||
|
/* |
||||||
|
个人中心,我的账户的数据获取 |
||||||
|
*/ |
||||||
|
@RequestMapping(value = "/getneeduser", method = RequestMethod.GET) |
||||||
|
public Result<?> getdingdandh() { |
||||||
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
||||||
|
String id = loginUser.getId(); |
||||||
|
SysUser syu = new SysUser(); |
||||||
|
syu = sysUserService.getneeduser(id); |
||||||
|
findgoods(); |
||||||
|
return Result.ok(syu); |
||||||
|
} |
||||||
|
|
||||||
|
//个人中心的我的账户页面需要的数据
|
||||||
|
@RequestMapping(value = "/updateneeduser", method = RequestMethod.GET) |
||||||
|
public Result<?> updateneeduser(@RequestParam(name = "form", required = true) String form) { |
||||||
|
|
||||||
|
Map map = JSON.parseObject(form,Map.class); |
||||||
|
String id = (String) map.get("id"); |
||||||
|
String sex= map.get("sex").toString(); |
||||||
|
String birthday= (String) map.get("birthday"); |
||||||
|
String realname= (String) map.get("realname"); |
||||||
|
String phone= (String) map.get("phone"); |
||||||
|
String email= (String) map.get("email"); |
||||||
|
sysUserService.updateneed(id,sex,birthday,realname,phone,email); |
||||||
|
|
||||||
|
return Result.ok("success"); |
||||||
|
} |
||||||
|
|
||||||
|
//个人中心的我的收藏的首页需要的数据
|
||||||
|
@RequestMapping(value = "/findallcg", method = RequestMethod.GET) |
||||||
|
public Result<?> findgoods() { |
||||||
|
//获取当前登人的信息
|
||||||
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
||||||
|
String userid = loginUser.getUsername(); |
||||||
|
List<Grzx1> g3 = new ArrayList<>(); |
||||||
|
//根据当前登的人获取收藏夹里面的搜藏的商品的名称及其款式
|
||||||
|
g3 = sysUserService.getscgoods(userid); |
||||||
|
//获取的是辅料
|
||||||
|
List<String> s1 =new ArrayList<>(); |
||||||
|
//获取的是面料
|
||||||
|
List<String> s2 =new ArrayList<>(); |
||||||
|
//把获取的商品信息导入到新的list里面
|
||||||
|
for (int i=0;i<g3.size();i++){ |
||||||
|
if (g3.get(i)!=null) { |
||||||
|
s1=sysUserService.getscgoodfi(g3.get(i).getId()); |
||||||
|
s2=sysUserService.getscgoodml(g3.get(i).getId()); |
||||||
|
g3.get(i).setOrdersNum(s2.toString()); |
||||||
|
if(s2.get(0)==null){ |
||||||
|
}else { |
||||||
|
if (s2.size()==1){ |
||||||
|
g3.get(i).setAddress(s2.get(0).toString().replace("[","").replace("]","")); |
||||||
|
} else{ |
||||||
|
g3.get(i).setAddress(StringUtils.join(s2, ",")); |
||||||
|
} |
||||||
|
} |
||||||
|
if(s1.get(0)==null){ |
||||||
|
}else { |
||||||
|
if (s1.size()==1){ |
||||||
|
g3.get(i).setOrdersNum(s1.get(0).toString().replace("[","").replace("]","")); |
||||||
|
} else{ |
||||||
|
g3.get(i).setOrdersNum(StringUtils.join(s1, ",")); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return Result.ok(g3); |
||||||
|
} |
||||||
|
|
||||||
|
//个人中心的我的收藏的首页需要的数据
|
||||||
|
@RequestMapping(value = "/ingwc", method = RequestMethod.GET) |
||||||
|
public Result<?> findgoods(@RequestParam(name = "id", required = true) String id) { |
||||||
|
//这里方便获取当前登陆信息
|
||||||
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
||||||
|
//这里获取当前登陆的id
|
||||||
|
String userid = loginUser.getId(); |
||||||
|
//这里获取当前登陆的真实姓名
|
||||||
|
String rlname = loginUser.getRealname(); |
||||||
|
//这个是根据goodid查询收藏的场频的信息
|
||||||
|
Customercollectgoods ccs = customercollectgoodsService.getById(id); |
||||||
|
String goodid= ccs.getGoodsId(); |
||||||
|
//根据goodid查询goods的对象
|
||||||
|
ZyGoods zyd =zyGoodsService.getById(goodid); |
||||||
|
//初始化购物车对象
|
||||||
|
CustomerShoppingCart cst =new CustomerShoppingCart(); |
||||||
|
//开始组装购物车对象
|
||||||
|
cst.setUserId(userid); |
||||||
|
cst.setUsername(rlname); |
||||||
|
cst.setGoodsId(zyd.getId()); |
||||||
|
cst.setGoodsname(zyd.getGoodsName()); |
||||||
|
cst.setNumber(1); |
||||||
|
cst.setPrice(zyd.getPromotionPrice()); |
||||||
|
cst.setZj(zyd.getPromotionPrice() * 1); |
||||||
|
cst.setPlaceorigin(zyd.getPlaceOrigin()); |
||||||
|
cst.setGoodimg(zyd.getDefaultPicture()); |
||||||
|
cst.setStyleId(zyd.getStyleId()); |
||||||
|
customerShoppingCartService.save(cst); |
||||||
|
return Result.ok("添加完成"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue