Browse Source

交易信息 添加买方名称搜索

master
邓宏 2 years ago
parent
commit
a9e47ce1a7
  1. 11
      pages/massif/add_transaction.vue
  2. 91
      pages/massif/search.vue
  3. 11
      router/massif.js

11
pages/massif/add_transaction.vue

@ -60,7 +60,7 @@
<d-form style="width:max-content;margin-top:40rpx;" type="select" placeholder=" " @select="formData.packUnit=$event.value[0].value" :columns="[packWeightList]" :value="[formData.packUnit]"/>
</view>
<d-form label="交易数量" disabled type="digit" :suffix="formData.packUnit" :value="tradeNum"/>
<d-form label="买方名称" required field="buyerName" :value="formData.buyerName" @input="formData.buyerName=$event"/>
<d-form label="买方名称" required field="buyerName" btnIcon="plant-sousuo" :btnFun="searchBuy" :value="formData.buyerName" @input="formData.buyerName=$event"/>
<d-form label="买方类型" required field="buyerType" type="select" :columns="[buyerType.list]" :value="buyerType.value" @select="buyerType.value=$event.value.map(v=>v.value);formData.buyerType=buyerType.value[1]"/>
<d-form label="收货地址" required field="buyerAddress" type="textarea" :value="formData.buyerAddress" @input="formData.buyerAddress=$event"/>
</u-form>
@ -171,6 +171,15 @@ export default {
}
})
},
searchBuy(){
uni.navigateTo({
url:`/pages/massif/search?data=${this.formData.buyerName||''}`,
events:{update:e=>{
this.formData.buyerName=e.buyerName
this.formData.buyerAddress=e.address
}}
})
},
}
}
</script>

91
pages/massif/search.vue

@ -0,0 +1,91 @@
<style lang="scss">
.container{
height:100%;
background:#f6f6f6;
scroll-view{
flex-grow: 1;
height:1rpx;
background:#fff;
view{
color:#777;
padding:20rpx 30rpx;
border-bottom:1rpx solid rgba(221, 221, 221, 0.5);
}
}
.u-popup{
flex:0;
}
}
</style>
<template>
<view class="container flex">
<d-search v-model="searchVal.supplier" @search="clean();search()"/>
<scroll-view scroll-y @scrolltolower="search">
<view v-for="(v,k) in list" :key="k" @click="select(v)">{{v.buyerName}}</view>
<u-empty v-if="list.length<=0" text=" " width="70%" icon="/static/noData.png"/>
</scroll-view>
<u-picker
:show="show"
closeOnClickOverlay
:columns="columns"
@close="show=false"
@cancel="show=false"
@confirm="eventChannel.emit('update',{buyerName:selectVal.buyerName,address:$event.value[0]});$u.route({type:'back'})"/>
</view>
</template>
<script>
import request from '@/common/request'
export default {
data(){
return{
searchVal:{
buyerName:"",
pageNo:1,
pageSize:20
},
list:[],
total:0,
show:false,
selectVal:{},
columns:[],
eventChannel:null,
}
},
onLoad(options){
this.eventChannel=this.getOpenerEventChannel()
this.searchVal.buyerName=options.data||""
this.search()
},
methods:{
clean(){
this.searchVal.pageNo=1
this.list=[]
this.total=0
},
async search(){
if(this.total==0 || this.list.length<this.total){
var res=await request("/api/plantTrade/getBuyerNameByLike",{
params: this.searchVal
})
if(res.statu){
this.list=res.data.records
this.total=res.data.total
this.searchVal.pageNo++
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取供应商列表失败!",
showCancel:false,
})
}
}
},
select(e){
this.show=true
this.selectVal=e
this.columns=[e.address]
}
}
}
</script>

11
router/massif.js

@ -112,4 +112,15 @@ module.exports=[
}
}
},
{
path:"pages/massif/search",
style:{
navigationBarTitleText:"查询列表",
navigationBarBackgroundColor:"#10C176",
navigationBarTextStyle:"white",
"app-plus":{
titleNView:true,
}
}
},
]
Loading…
Cancel
Save