Browse Source

新增农资 修改搜索供应商

master
邓宏 2 years ago
parent
commit
05ef86b63f
  1. 27
      pages/purchase/search.vue

27
pages/purchase/search.vue

@ -16,9 +16,10 @@
</style> </style>
<template> <template>
<view class="container flex"> <view class="container flex">
<d-search v-model="searchVal" @search="search"/> <d-search v-model="searchVal.supplier" @search="clean();search()"/>
<scroll-view scroll-y> <scroll-view scroll-y @scrolltoloer="search">
<view v-for="(v,k) in list" :key="k" @click="select(v)">{{v}}</view> <view v-for="(v,k) in list" :key="k" @click="select(v)">{{v}}</view>
<u-empty v-if="list.length<=0" text=" " width="70%" icon="/static/noData.png"/>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
@ -27,23 +28,36 @@ import request from '@/common/request'
export default { export default {
data(){ data(){
return{ return{
searchVal:"", searchVal:{
supplier:"",
pageNo:1,
pageSize:20
},
list:[], list:[],
total:0,
eventChannel:null, eventChannel:null,
} }
}, },
onLoad(options){ onLoad(options){
this.eventChannel=this.getOpenerEventChannel() this.eventChannel=this.getOpenerEventChannel()
this.searchVal=options.data this.searchVal.supplier=options.data||""
this.search() this.search()
}, },
methods:{ methods:{
clean(){
this.searchVal.pageNo=1
this.list=[]
this.total=0
},
async search(){ async search(){
if(this.total==0 || this.list.length<this.total){
var res=await request("/api/goods/supplierShow",{ var res=await request("/api/goods/supplierShow",{
params:{supplier: this.searchVal} params: this.searchVal
}) })
if(res.statu){ if(res.statu){
this.list=res.data this.list=res.data.list
this.total=res.data.total
this.searchVal.pageNo++
}else{ }else{
uni.showModal({ uni.showModal({
title:"提示", title:"提示",
@ -51,6 +65,7 @@ export default {
showCancel:false, showCancel:false,
}) })
} }
}
}, },
select(e){ select(e){
this.eventChannel.emit("update",e) this.eventChannel.emit("update",e)

Loading…
Cancel
Save