demingshangjia/pages/release/selectshop.vue

94 lines
2.5 KiB
Vue
Raw Normal View History

2020-07-17 09:49:42 +08:00
<template>
<view class="selectshop">
<view class="title">我的商品</view>
2020-07-21 15:00:39 +08:00
<u-checkbox-group>
<view class="list">
2020-08-08 16:53:44 +08:00
<shopItem @xuanzhong="xuanzhong" :wxuanzhong="sele.indexOf(i.goods_id + '') > -1" class="items" v-for="(i,j) in list" :key="j" :image="i.goods_image" :title="i.goods_name" :price="i.goods_marketprice" :num="i.goods_salenum" :sid="i.goods_id" ref="shop"></shopItem>
2020-07-21 15:00:39 +08:00
</view>
</u-checkbox-group>
2020-08-08 16:53:44 +08:00
<view class="jiaru" @click="jiaru" :style="{'background-color': sele.length > 0 ? 'rgba(255, 120, 15, 1' : ''}">加入售货袋</view>
2020-07-17 09:49:42 +08:00
</view>
</template>
<script>
2020-07-21 08:57:48 +08:00
import shopItem from "../../components/release/shop-item"
2020-07-17 09:49:42 +08:00
export default {
name:"selectshop",
data(){
return {
2020-07-21 15:00:39 +08:00
list:[],
sele:[]
2020-07-17 09:49:42 +08:00
}
},
2020-07-21 08:57:48 +08:00
components:{
shopItem
},
2020-07-17 09:49:42 +08:00
methods:{
2020-07-21 15:00:39 +08:00
xuanzhong(){
// console.log(this.$refs.shop)
this.sele = []
for(let i of this.$refs.shop){
// console.log(i)
if(i.xuanzhong){
this.sele.push(i.sid)
}
}
console.log(this.sele)
2020-07-21 17:03:59 +08:00
},
jiaru(){
let that = this
2020-07-21 19:50:26 +08:00
uni.setStorageSync("gouwudai",that.sele.join(","))
2020-07-21 17:03:59 +08:00
this.$u.route({
type:"back",
delta:1
})
2020-07-21 15:00:39 +08:00
}
2020-07-17 09:49:42 +08:00
},
onLoad(){
2020-08-08 16:53:44 +08:00
this.sele = uni.getStorageSync("gouwudai").split(',')
if(this.sele[0] == ""){
this.sele = []
}
console.log(this.sele[0])
2020-07-21 15:00:39 +08:00
this.$u.api.getStoreGoodsList().then((res)=>{
this.list = res.data.list
})
2020-07-17 09:49:42 +08:00
}
}
</script>
<style lang="scss" scoped>
.selectshop{
padding: 15rpx 30rpx;
2020-07-21 15:00:39 +08:00
padding-left: 6rpx;
2020-07-21 08:57:48 +08:00
background-color: #2D2D2D;
min-height: calc(100vh - 45px);
2020-07-17 09:49:42 +08:00
.title{
color: #FF780F;
font-size: 30rpx;
font-weight: 400;
2020-07-21 15:00:39 +08:00
margin-left: 26rpx;
}
.list{
display: flex;
flex-wrap: wrap;
margin-top: 35rpx;
.items{
margin-left: 24rpx;
margin-bottom: 30rpx;
}
2020-07-17 09:49:42 +08:00
}
2020-07-21 17:03:59 +08:00
.jiaru{
position: fixed;
bottom: 33rpx;
right: 30rpx;
height: 80rox;
width: 348rpx;
background-color: #999;
font-size: 36rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 40rpx;
}
2020-07-17 09:49:42 +08:00
}
</style>