选择完成

This commit is contained in:
luyuan 2020-07-21 15:00:39 +08:00
parent d2ddb26479
commit 72f56fe563
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
4 changed files with 68 additions and 14 deletions

View File

@ -12,6 +12,9 @@ const install = (Vue, vm) => {
},
createLivesp({spec_name}){
return vm.$u.post("Streaming/createLivesp",{spec_name})
},
getStoreGoodsList(){
return vm.$u.post("article/getStoreGoodsList")
}
}
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下

View File

@ -1,11 +1,13 @@
<template>
<view class="item">
<image></image>
<view class="title u-line-1" ></view>
<view class="item" @click="xuanzhongs">
<image :src="image"></image>
<view class="title u-line-1" >{{title}}</view>
<view class="info">
<text></text>
<text></text>
<text>{{price}}</text>
<text>销量{{num}}</text>
</view>
<u-checkbox class="xuanzhong" active-color="#FF7A15" :name="sid" v-model="xuanzhong" @change="xuanzhongs">
</u-checkbox>
</view>
</template>
<script>
@ -13,7 +15,14 @@ export default {
name:"shop-item",
data(){
return {
xuanzhong:true,
}
},
props:['image','title','price','num','sid'],
methods:{
xuanzhongs(){
this.xuanzhong = !this.xuanzhong
this.$emit("xuanzhong")
}
}
}
@ -21,7 +30,11 @@ export default {
<style lang="scss" scoped>
.item{
width: 214rpx;
height: 297rpx;
// height: 297rpx;
background-color: #fff;
border-radius:10rpx 10rpx 0 0;
padding-bottom: 14rpx;
overflow: hidden;
position: relative;
>image{
width: 100%;
@ -49,5 +62,10 @@ export default {
}
}
.xuanzhong{
position: absolute;
left: 8rpx;
top: 8rpx;
}
}
</style>

View File

@ -1,9 +1,11 @@
<template>
<view class="selectshop">
<view class="title">我的商品</view>
<view class="list">
<shopItem></shopItem>
</view>
<u-checkbox-group>
<view class="list">
<shopItem @xuanzhong="xuanzhong" 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>
</view>
</u-checkbox-group>
</view>
</template>
<script>
@ -12,29 +14,54 @@ export default {
name:"selectshop",
data(){
return {
list:[],
sele:[]
}
},
components:{
shopItem
},
methods:{
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)
}
},
onLoad(){
this.$u.api.getStoreGoodsList().then((res)=>{
this.list = res.data.list
})
}
}
</script>
<style lang="scss" scoped>
.selectshop{
padding: 15rpx 30rpx;
padding-left: 6rpx;
background-color: #2D2D2D;
min-height: calc(100vh - 45px);
.title{
color: #FF780F;
font-size: 30rpx;
font-weight: 400;
margin-left: 26rpx;
}
.list{
display: flex;
flex-wrap: wrap;
margin-top: 35rpx;
.items{
margin-left: 24rpx;
margin-bottom: 30rpx;
}
}
}
</style>

View File

@ -22,7 +22,7 @@
<view class="values"><text>{{max_two}}</text>/20</view>
<u-form-item label-position="right">
<u-input v-model="form.values" placeholder="我的售货袋" />
<view class="rightes">售货袋</view>
<view class="rightes" @click="navto('selectshop')">售货袋</view>
</u-form-item>
</u-form>
<!-- 标签的引入 -->
@ -86,11 +86,17 @@
tupian(a){
console.log(a)
},
navto(url){
this.$u.route({
url:"/pages/release/" + url
})
},
init(){
this.$u.api.getLiveSpec().then((res)=>{
console.log(res)
this.fileListes = res.data
})
}
},
components: {