You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.7 KiB
99 lines
2.7 KiB
<template>
|
|
<view class="wishlist_body">
|
|
<view class="status_bar"></view>
|
|
<uni-nav-bar left-icon="left" :rightText="isDelete?'Done':'Delete'" title="Wishlist" color="#000000" @clickLeft="back" @clickRight="$refs.alertDialog.open()"/>
|
|
<view class="wishlist">
|
|
<view class="wishlist_item" v-for="(item,index) in goodsList" :key="index" @click="changeImage(item.id)">
|
|
<view class="wishlist_item_img">
|
|
<image :src="item.goods_img" mode="" class="wishlist_item_img_goods"></image>
|
|
<image src="../../static/img/select.png" mode="" class="select" v-show="isDelete && item.is_select==0"></image>
|
|
<image src="../../static/img/select.png" mode="" class="select" v-show="isDelete && item.is_select==1"></image>
|
|
</view>
|
|
<view class="wishlist_item_bottom">
|
|
<text>US${{item.promote_price?item.promote_price:item.shop_price}}</text>
|
|
<image src="../../static/img/cart2.png" mode="" class="wishlist_item_bottom_icon"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="wishlist_foot" v-show="isDelete">
|
|
<view class="wishlist_foot_left">
|
|
<image src="../../static/img/select2.png" mode=""></image>
|
|
<text>All</text>
|
|
</view>
|
|
<view class="wishlist_foot_right">
|
|
<button @click="removeLike">DELETE</button>
|
|
</view>
|
|
</view>
|
|
<uni-popup ref="alertDialog" type="dialog">
|
|
<uni-popup-dialog type="error" cancelText="Close" confirmText="Delete" title="Tips" content="Whether to delete all favorites?"
|
|
@confirm="removeLike(0)" ></uni-popup-dialog>
|
|
</uni-popup>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {defaultRequest2} from '../../api/index.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
isDelete:false,
|
|
goodsList:[]
|
|
}
|
|
},
|
|
methods:{
|
|
getList(){
|
|
let data={_action:'getfaviouritegoods',page_index:1,page_size:30}
|
|
defaultRequest2(data).then(res=>{
|
|
console.info(res)
|
|
if(res.error==0){
|
|
this.goodsList=res.data
|
|
}
|
|
})
|
|
},
|
|
// 添加收藏
|
|
addLike(id){
|
|
let data={_action:'setfaviouritegoods',goods_id:id}
|
|
defaultRequest2(data).then(res=>{
|
|
console.info(res)
|
|
if(res.error==0){
|
|
uni.showToast({
|
|
title:res.message,
|
|
icon:'none'
|
|
})
|
|
this.changeImage(id,0)
|
|
}
|
|
})
|
|
},
|
|
// 取消收藏
|
|
removeLike(id){
|
|
let data={_action:'unsetfaviouritegoods',goods_id:id}
|
|
defaultRequest2(data).then(res=>{
|
|
console.info(res)
|
|
if(res.error==0){
|
|
uni.showToast({
|
|
title:res.message,
|
|
icon:'none'
|
|
})
|
|
this.getList()
|
|
}
|
|
})
|
|
},
|
|
back(){
|
|
uni.navigateBack()
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.getList()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
page{
|
|
|
|
}
|
|
.uni-navbar{
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
}
|
|
</style>
|