提交 76839f36 authored 作者: xiaofeng's avatar xiaofeng

修改前端样式效果

上级 631a571a
...@@ -292,6 +292,20 @@ ...@@ -292,6 +292,20 @@
} }
}); });
}, },
initHasUserSpuFavorite(spuId){
if (!checkLogin()) {
this.hasCollectionType = 0;
return;
}
//初始化验证商品收藏
hasUserSpuFavorite(spuId).then(data => {
let hasCollection = data;
// alert("是否收藏==" + hasCollection);
if (hasCollection) {
this.hasCollectionType = 1;
}
});
},
onClickCart() { onClickCart() {
this.$router.push('/cart'); this.$router.push('/cart');
...@@ -430,6 +444,7 @@ ...@@ -430,6 +444,7 @@
// 初始化 attrValueMap // 初始化 attrValueMap
this.attrValueMap.set(attr.attrValueId, attr.attrValueName); this.attrValueMap.set(attr.attrValueId, attr.attrValueName);
} }
} }
// debugger; // debugger;
this.vanSku = vanSku; this.vanSku = vanSku;
...@@ -439,6 +454,9 @@ ...@@ -439,6 +454,9 @@
this.initialSku.quantity = 1; this.initialSku.quantity = 1;
// 执行 sku 价格计算 // 执行 sku 价格计算
this.doCalcSkuPrice(this.initialSku.id); this.doCalcSkuPrice(this.initialSku.id);
this.initHasUserSpuFavorite(id);
}); });
// 获得购物车数量 // 获得购物车数量
if (checkLogin()) { if (checkLogin()) {
...@@ -453,7 +471,7 @@ ...@@ -453,7 +471,7 @@
<style lang="less"> <style lang="less">
.goods { .goods {
.active { .active {
color: #e50f3d; color: #f44;
} }
padding-bottom: 50px; padding-bottom: 50px;
......
<template> <template>
<div> <div>
<headerNav title="我的收藏"/> <headerNav title="我的收藏"/>
<van-list <van-list
v-model="loading" v-model="loading"
:finished="finished" :finished="finished"
@load="onLoad" @load="onLoad"
> >
<div v-for="(item,index) in list" :key="index"> <div v-for="(item,index) in list" :key="index">
<!-- <van-swipe-cell :right-width="65" :on-close="onClose(item)">--> <van-swipe-cell :right-width="65" :on-close="onClose(item)">
<!-- <product-card :product='item' />--> <van-card
<!-- <span>{{item.spuName}}</span>--> :price="formatPrice(item.price)"
<!-- <span slot="right" >删除</span>--> :desc="item.sellPoint"
<!-- </van-swipe-cell>--> :title="item.spuName"
<van-card :thumb="item.spuImage"
:price="formatPrice(item.price)" @click="skipProductSpuInfo(item.spuId)"
:desc="item.sellPoint" >
:title="item.spuName" </van-card>
:thumb="item.spuImage" <template slot="right">
/> <van-button square type="danger" text="删除"/>
</div> </template>
</van-list>
</div> </van-swipe-cell>
</div>
</van-list>
</div>
</template> </template>
<script> <script>
// import { Card } from 'vant'; import {GetFavoritePage, DelFavorite} from "../../../api/user.js";
import { GetFavoritePage ,DelFavorite} from "../../../api/user.js"; export default {
data() {
// Vue.use(Card); return {
export default { loading: false,
data(){ finished: false,
return{ list: [],
loading:false, page: 0,
finished:false, pageSize: 10
list:[], }
page:0,
pageSize:10
}
},
methods:{
formatPrice(data) {
return (data / 100).toFixed(2);
}, },
onClose(item){ methods: {
return function(clickPosition, instance) { formatPrice(data) {
switch (clickPosition) { return (data / 100).toFixed(2);
case 'left': },
case 'cell': skipProductSpuInfo(data) {
case 'outside': // return getProductSpuInfo(data);
instance.close(); this.$router.push('/product/'+data);
break; },
case 'right': onClose(item) {
this.$dialog.confirm({ return function (clickPosition, instance) {
message: '确定删除吗?' switch (clickPosition) {
}).then(() => { case 'left':
DelFavorite(item.spuId).then(response=>{ case 'cell':
this.$toast('删除成功'); case 'outside':
this.$router.go(0);
})
instance.close(); instance.close();
}).catch(() => { break;
// on cancel case 'right':
}); this.$dialog.confirm({
break; message: '确定删除吗?'
}).then(() => {
DelFavorite(item.spuId).then(response => {
this.$toast('删除成功');
this.$router.go(0);
})
instance.close();
}).catch(() => {
// on cancel
});
break;
}
} }
},
onLoad() {
let pageNo = this.page + 1;
GetFavoritePage(pageNo, this.pageSize).then(response => {
this.page = pageNo;
this.list.push(...response.list);
// response.list.forEach(item => {
// this.list.push(item);
// });
this.loading = false;
if (this.list.length >= response.total) {
this.finished = true;
}
})
} }
}, },
onLoad() { }
let pageNo = this.page + 1;
GetFavoritePage(pageNo,this.pageSize).then(response=>{
this.page = pageNo;
this.list.push(...response.list);
// response.list.forEach(item => {
// this.list.push(item);
// });
this.loading = false;
if(this.list.length >= response.total){
this.finished = true;
}
})
}
},
}
</script> </script>
<style lang="less"> <style lang="less">
.van-swipe-cell{ .van-swipe-cell {
&__left, &__left,
&__right { &__right {
color: #FFFFFF; color: #FFFFFF;
font-size: 15px; font-size: 15px;
width: 65px; width: 65px;
height: 100px; height: 100px;
display: inline-block; display: inline-block;
text-align: center; text-align: center;
line-height: 100px; line-height: 100px;
background-color: #F44; background-color: #F44;
}
} }
}
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论