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.

133 lines
2.7 KiB

2 years ago
<style lang="scss">
2 years ago
.container{
2 years ago
height:100%;
2 years ago
background:#f6f6f6;
scroll-view{
flex-grow: 1;
height:1rpx;
border-bottom:1rpx solid transparent;
.card{
margin-top:0;
.name{
display: flex;
align-items: center;
margin-bottom:20rpx;
text{
&:first-child{
font-size:20rpx;
color:#fff;
background:#10C176;
2 years ago
min-width:70rpx;
height:40rpx;
text-align: center;
line-height: 40rpx;
border-radius: 0 20rpx 0 20rpx;
margin-right:10rpx;
2 years ago
padding:0 8rpx;
}
&.plant-youbian{
margin-left: auto;
}
2 years ago
}
}
.company{
2 years ago
display:flex;
align-items: center;
text{
&:first-child{
2 years ago
flex-shrink: 0;
color:#FBA83C;
margin-right:14rpx;
}
&:nth-child(2){
color:#999;
}
2 years ago
}
}
}
}
}
</style>
<template>
<view class="container flex">
2 years ago
<d-navbar text="农资列表" isBack style="--bg:#10C176;--c:#fff;">
2 years ago
<text slot="right" class="plant-xinjian" @click="toAddPage"/>
2 years ago
</d-navbar>
2 years ago
2 years ago
<d-search v-model="searchVal.goodsName" @search="clean();search()"/>
2 years ago
<scroll-view scroll-y @scrolltolower="search">
2 years ago
<view class="card" v-for="(v,k) in list" :key="k" @click="toAddSepc(v.id)">
<view class="name">
2 years ago
<text>{{v.goodsName}}</text> {{v.detailedType}} <text class="plant-youbian"/>
</view>
<view class="company">
2 years ago
<text>{{v.detailedParentName}}</text> <text class="over">{{v.supplier}}</text>
</view>
2 years ago
</view>
<u-empty v-if="list.length==0" icon="http://cdn.uviewui.com/uview/empty/data.png"/>
</scroll-view>
2 years ago
</view>
</template>
<script>
import request from '@/common/request'
2 years ago
export default {
data(){
return{
searchVal:{
goodsName:"",
pageNo:1,
pageSize:5,
},
list:[],
total:0,
2 years ago
eventChannel:null,
}
},
onLoad(){
2 years ago
this.eventChannel=this.getOpenerEventChannel()
this.search()
},
methods:{
2 years ago
clean(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
},
async search(){
if(this.total==0||this.list.length<this.total){
var res=await request("/api/goods/goodsList",{
params: this.searchVal
})
if(res.statu){
this.list=this.list.concat(res.data.records)
this.total=res.data.total
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取农资列表失败!",
showCancel:false,
})
}
}
2 years ago
},
toAddPage(){
uni.navigateTo({
url:"/pages/purchase/newAgr",
events:{update:()=>{ this.clean();this.search() }}
})
},
2 years ago
toAddSepc(id){
uni.navigateTo({
url:`/pages/purchase/specs?id=${id}`,
events:{submit: e=>{
uni.navigateBack()
this.eventChannel.emit("submit",e)
}}
})
},
}
2 years ago
}
</script>