Browse Source

修改页面搜索接口

master
邓宏 2 years ago
parent
commit
42d1104562
  1. 9
      pages/stock/already.vue
  2. 58
      pages/stock/record.vue

9
pages/stock/already.vue

@ -98,6 +98,8 @@ export default {
return{
searchVal:{
baseId: "1611250480973049857"||this.$store.state.plantBaseInfoId,
userId:"",
enterpriseId:"",
search: "",
pageNo:1,
pageSize:6,
@ -107,6 +109,13 @@ export default {
}
},
onLoad(options){
if (this.$store.getters['userInfo'].roleCode=="baseAdmin") {
this.searchVal.userId = this.$store.getters['userInfo'].id
this.searchVal.enterpriseId = ''
} else {
this.searchVal.enterpriseId = this.$store.getters.userInfo.companyId
this.searchVal.userId = ''
}
this.search()
},
methods:{

58
pages/stock/record.vue

@ -1,8 +1,32 @@
<style lang="scss">
.container{
min-height: 100%;
height: 100%;
background:#f6f6f6;
padding:30rpx 0;
&>.btns{
flex-shrink: 0;
margin:0 30rpx 30rpx;
display:flex;
border-radius: 30rpx;
button{
width:50%;
color:#999;
&:first-child{
border-radius: 30rpx 0 0 30rpx;
}
&:nth-child(2){
border-radius:0 30rpx 30rpx 0;
}
&.active{
background:#10C176;
color:#fff;
}
}
}
scroll-view{
flex-grow: 1;
height:1rpx;
.card{
margin-top:0;
&>.head{
@ -63,9 +87,19 @@
}
}
}
}
</style>
<template>
<view class="container">
<view class="container flex">
<d-search v-model="searchVal.search" @search="clean();search()"/>
<view class="btns shadow bg-white">
<button class="cu-btn bg-white" :class="{active:searchVal.type=='nz'}" @click="trigger('nz')">农资</button>
<button class="cu-btn bg-white" :class="{active:searchVal.type=='ncp'}" @click="trigger('ncp')">农产品</button>
</view>
<scroll-view scroll-y >
<view class="card" v-for="(v,k) in list" :key="k" @click="toDetail(v)">
<view class="head">
<text class="plant-rili"/> <text>批次号{{v.inOutBatchNo}}</text> <text>{{v.inOutType}}</text>
@ -76,6 +110,7 @@
</view>
</view>
<u-empty v-if="list.length<=0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view>
</view>
</template>
<script>
@ -88,22 +123,35 @@ export default {
enterpriseId: '',
pageNo:1,
pageSize:6,
type:"nz"
},
list:[],
total:0,
}
},
onLoad(options){
this.search()
if (this.$store.getters['userInfo'].roleCode=="baseAdmin") {
this.searchVal.userId = this.$store.getters['userInfo'].id
this.searchVal.enterpriseId = ''
} else {
this.searchVal.enterpriseId = this.$store.getters.userInfo.companyId
this.searchVal.enterpriseId = this.$store.getters['userInfo'].companyId
this.searchVal.userId = ''
}
this.search()
},
methods:{
trigger(e){
if(this.searchVal.type!=e){
this.searchVal.type=e;
this.clean();
this.search()
}
},
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/Inventory/queryOutInRecord",{

Loading…
Cancel
Save