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}){ goodsShelves({live_id}){
return vm.$u.post('Specialci/goodsShelves',{live_id}) return vm.$u.post('Specialci/goodsShelves',{live_id})
}, },
// // 收藏店铺
addFavoriteStore({ id }) { addFavoriteStore({ id }) {
return vm.$u.post('member/addFavoriteStore',{ fid: 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; return false;
} else if (res.errCode == 1) { } else if (res.errCode == 1) {
console.log(res.message); // console.log(res.message);
return res;
} else { } else {
// 如果返回false则会调用Promise的reject回调 // 如果返回false则会调用Promise的reject回调
// 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中res为服务端的返回值 // 并将进入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-empty mode="list" v-if="!list.length" color="#000" img-width="200" font-size="30" margin-top="300"></u-empty>
<u-swipe-action <u-swipe-action
v-for="(item, index) in list" :key="index" v-for="(item, index) in list" :key="index"
:index='item.fav_id' :index='index'
:show="item.show" :show="item.show"
:options="options" :options="options"
@click="removeFavorite" @click="removeFavorite"
@ -18,7 +18,7 @@
<view class="item-price">{{ item.favlog_price }}</view> <view class="item-price">{{ item.favlog_price }}</view>
<view class="item-date"> <view class="item-date">
<image src="@/pageE/static/mine/26.png"></image> <image src="@/pageE/static/mine/26.png"></image>
<view>{{ item.fav_time }}</view> <view>{{ item.fav_time | date }}</view>
</view> </view>
</view> </view>
</view> </view>
@ -31,7 +31,6 @@ export default {
data() { data() {
return { return {
list: [], list: [],
show: false,
options: [ options: [
{ {
text: '删除', text: '删除',
@ -50,16 +49,22 @@ export default {
this.$u.api.getFavoritesList().then(res => { this.$u.api.getFavoritesList().then(res => {
if(res.errCode == 0) { if(res.errCode == 0) {
this.list = res.data; 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({ this.$u.api.removeFavorite({
id: id fid: id,
type: 'goods'
}).then(res => { }).then(res => {
this.$u.toast(res.message);
if(res.errCode == 0) { if(res.errCode == 0) {
this.getGoodsFavoritesList(); 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="price"><span>{{ couponInfo.voucher_price }}</span></view>
<view class="condition">{{ couponInfo.voucher_limit }}使用</view> <view class="condition">{{ couponInfo.voucher_limit }}使用</view>
</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-integral">兑换积分{{ couponInfo.voucher_points }}积分</view>
<view class="info-date">有效期{{ couponInfo.voucher_startdate }}-{{ couponInfo.voucher_enddate }}</view> <view class="info-date">有效期{{ couponInfo.voucher_startdate }}-{{ couponInfo.voucher_enddate }}</view>
</view> </view>

View File

@ -13,7 +13,7 @@
</swiper-item> </swiper-item>
</swiper> </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> </view>
</template> </template>
<script> <script>
@ -22,7 +22,7 @@ export default {
name:"list", name:"list",
data() { data() {
return { return {
pageSize: 12, // pageSize: 12,
current: -1, current: -1,
swiperCurrent: 0, swiperCurrent: 0,
goodsList: [], goodsList: [],

View File

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

View File

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

View File

@ -13,7 +13,7 @@
</view> </view>
</view> </view>
<u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList.length"></u-empty> <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> </scroll-view>
</swiper-item> </swiper-item>
</swiper> </swiper>

View File

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

View File

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