Merge pull request 'collect 8.7' (#128) from zhy into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/128
This commit is contained in:
hansu 2020-08-07 11:59:47 +08:00
commit f4ba942870
10 changed files with 76 additions and 30 deletions

View File

@ -314,10 +314,21 @@ export default {
goodsShelves({live_id}){
return vm.$u.post('Specialci/goodsShelves',{live_id})
},
//
// 收藏店铺
addFavoriteStore({ id }) {
return vm.$u.post('member/addFavoriteStore',{ fid: id })
},
// 收藏商品
addFavoriteGoods({ fid }) {
return vm.$u.post('member/addFavoriteGoods',{ fid: fid })
},
// 取消收藏(商品/店铺)
removeFavorite({ fid, type }) {
return vm.$u.post('Member/removeFavorite',{
fav_id: fid,
type: type
})
}
}
}

View File

@ -48,7 +48,8 @@ const install = (Vue, vm) => {
}
return false;
} else if (res.errCode == 1) {
console.log(res.message);
// console.log(res.message);
return res;
} else {
// 如果返回false则会调用Promise的reject回调
// 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中res为服务端的返回值

View File

@ -3,7 +3,7 @@
<u-empty mode="list" v-if="!list.length" color="#000" img-width="200" font-size="30" margin-top="300"></u-empty>
<u-swipe-action
v-for="(item, index) in list" :key="index"
:index='item.fav_id'
:index='index'
:show="item.show"
:options="options"
@click="removeFavorite"
@ -18,7 +18,7 @@
<view class="item-price">{{ item.favlog_price }}</view>
<view class="item-date">
<image src="@/pageE/static/mine/26.png"></image>
<view>{{ item.fav_time }}</view>
<view>{{ item.fav_time | date }}</view>
</view>
</view>
</view>
@ -31,7 +31,6 @@ export default {
data() {
return {
list: [],
show: false,
options: [
{
text: '删除',
@ -50,16 +49,22 @@ export default {
this.$u.api.getFavoritesList().then(res => {
if(res.errCode == 0) {
this.list = res.data;
this.list.forEach(item => {
Object.assign(item, { show: false });
})
}
})
},
removeFavorite(id) {
removeFavorite(index) {
const id = this.list[index].fav_id;
this.$u.api.removeFavorite({
id: id
fid: id,
type: 'goods'
}).then(res => {
this.$u.toast(res.message);
if(res.errCode == 0) {
this.getGoodsFavoritesList();
} else {
this.$u.toast(res.message);
}
})
},

View File

@ -10,7 +10,7 @@
<view class="price"><span>{{ couponInfo.voucher_price }}</span></view>
<view class="condition">{{ couponInfo.voucher_limit }}使用</view>
</view>
<view class="info-store u-line-1">仅限{{ couponInfo.type == 1 ? '平台' : couponInfo.store_name }}{{ couponInfo.gc_id | showClass(goodsClass) }}商品使用</view>
<view class="info-store u-line-1">仅限{{ couponInfo.type == 1 ? '指定商品' : couponInfo.store_name }}{{ couponInfo.gc_id | showClass(goodsClass) }}商品使用</view>
<view class="info-integral">兑换积分{{ couponInfo.voucher_points }}积分</view>
<view class="info-date">有效期{{ couponInfo.voucher_startdate }}-{{ couponInfo.voucher_enddate }}</view>
</view>

View File

@ -13,7 +13,7 @@
</swiper-item>
</swiper>
<!-- 加载更多 -->
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" @loadmore="loadMore" v-if="goodsList.length>=pageSize"></u-loadmore>
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" @loadmore="loadMore"></u-loadmore>
</view>
</template>
<script>
@ -22,7 +22,7 @@ export default {
name:"list",
data() {
return {
pageSize: 12,
// pageSize: 12,
current: -1,
swiperCurrent: 0,
goodsList: [],

View File

@ -27,10 +27,10 @@
<text>{{ goodsInfo.goods_price }}</text>
<s>{{ goodsInfo.goods_marketprice }}</s>
</view>
<view class="collect">
<u-icon name="star" color="#474747" size="28" v-if="1"></u-icon>
<view class="collect" @click="switchCollect(goodsInfo.goods_collect)">
<u-icon name="star" color="#474747" size="28" v-if="!goodsInfo.goods_collect"></u-icon>
<u-icon name="star-fill" color="#FF7807" size="28" v-else></u-icon>
<text>收藏</text>
<text>{{ !goodsInfo.goods_collect ? '收藏' : '已收藏' }}</text>
</view>
</view>
</view>
@ -227,9 +227,12 @@ export default {
onLoad(option) {
// this.init();
// console.log(option);
this.type = Number(option.type);
// this.type = Number(option.type);
// this.type = 1;
this.id = option.id;
this.setTitle();
//
this.ordinaryDetails(this.id);
},
onShow() {
this.debounce = true;
@ -296,19 +299,15 @@ export default {
},
getGoodsDetails(id) {
switch (this.type) {
case 1:
this.ordinaryDetails(id);
break;
// case 1:
// this.ordinaryDetails(id);
// break;
case 2:
this.pinTuanDetails(id);
break;
case 3:
this.spikeGoodsDetails(id);
break;
case 4:
break;
default:
break;
}
@ -322,7 +321,8 @@ export default {
this.storeInfo = res.data.store;
this.setSwiperList(res.data.goods_image);
this.glist = res.data.spec_list;
// console.log(this.goodsInfo.mobile_body);
this.type = res.data.view_type;
this.getGoodsDetails(this.type);
}
})
},
@ -481,7 +481,32 @@ export default {
urls: arr,
current: arr[index]
})
}
},
switchCollect(status) {
if(status) {
this.removeFavorite();
} else {
this.addFavoriteGoods();
}
},
addFavoriteGoods() {
this.$u.api.addFavoriteGoods({ fid: this.id }).then(res => {
if(res.errCode == 0) {
this.getGoodsDetails(this.id);
} else {
this.$u.toast(res.message);
}
})
},
removeFavorite() {
this.$u.api.removeFavorite({ fid: this.id, type: 'goods' }).then(res => {
if(res.errCode == 0) {
this.getGoodsDetails(this.id);
} else {
this.$u.toast(res.message);
}
})
}
},
}
</script>

View File

@ -51,7 +51,6 @@ export default {
})
},
removeFavorite(id) {
console.log(id);
this.$u.api.removeFavorite({
id: id,
type: 'store'

View File

@ -13,7 +13,7 @@
</view>
</view>
<u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList.length"></u-empty>
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20" v-if="orderList.length >= 15"></u-loadmore>
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
</scroll-view>
</swiper-item>
</swiper>

View File

@ -1030,7 +1030,6 @@
{
"path": "pages/mine/index",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "我的",
"app-plus": {
"titleSize": "36px",

View File

@ -19,10 +19,10 @@
<view class="member-service" @click="toOtherPage('/mine/MemberServe')">会员服务</view>
</view>
<view class="bottom">
<!-- <view @click="toOtherPage('/mine/GoodsCollection')">
<view @click="toOtherPage('/mine/GoodsCollection')">
<view>{{ userInfo.member_fav_goods_num || 0 }}</view>
<view>商品收藏</view>
</view> -->
</view>
<!-- <view @click="toOtherPage('/mine/StoreCollection')">
<view>{{ userInfo.member_fav_store_num || 0 }}</view>
<view>店铺收藏</view>
@ -158,7 +158,7 @@ export default {
methods: {
getUserInfo() {
this.$u.api.getMemberInfo().then(res => {
uni.stopPullDownRefresh();
// uni.stopPullDownRefresh();
if (res.errCode == 0) {
// this.userInfo = res.data.MemberArray;
this.$set(this, 'userInfo', res.data.MemberArray);
@ -329,6 +329,12 @@ export default {
}
.content {
justify-content: space-between;
> view {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
> view:nth-child(1){
@include image-size($image-width: 33rpx, $image-height: 36rpx);
}