Browse Source

修改页面搜索接口

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

9
pages/stock/already.vue

@ -98,6 +98,8 @@ export default {
return{ return{
searchVal:{ searchVal:{
baseId: "1611250480973049857"||this.$store.state.plantBaseInfoId, baseId: "1611250480973049857"||this.$store.state.plantBaseInfoId,
userId:"",
enterpriseId:"",
search: "", search: "",
pageNo:1, pageNo:1,
pageSize:6, pageSize:6,
@ -107,6 +109,13 @@ export default {
} }
}, },
onLoad(options){ 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() this.search()
}, },
methods:{ methods:{

172
pages/stock/record.vue

@ -1,63 +1,88 @@
<style lang="scss"> <style lang="scss">
.container{ .container{
min-height: 100%; height: 100%;
background:#f6f6f6; background:#f6f6f6;
padding:30rpx 0;
.card{ &>.btns{
margin-top:0; flex-shrink: 0;
&>.head{ margin:0 30rpx 30rpx;
display:flex; display:flex;
align-items: center; border-radius: 30rpx;
border-bottom: 2rpx solid #D8D8D8; button{
padding-bottom:20rpx; width:50%;
text{ color:#999;
&:first-child{ &:first-child{
flex-shrink: 0; border-radius: 30rpx 0 0 30rpx;
color:#10C176; }
margin-right:20rpx; &:nth-child(2){
} border-radius:0 30rpx 30rpx 0;
&:nth-child(2){ }
flex-grow: 1; &.active{
color:#10C176; background:#10C176;
} color:#fff;
&:nth-child(3){
flex-shrink: 0;
color:#FBB65C;
margin-left:10rpx;
}
} }
} }
&>.plant-youbian{ }
margin-top:20rpx; scroll-view{
display:flex; flex-grow: 1;
flex-direction: row-reverse; height:1rpx;
align-items: center;
justify-content: flex-end; .card{
text{ margin-top:0;
flex-grow: 1; &>.head{
font-weight: bold;
display:flex; display:flex;
align-items: center; align-items: center;
&:after{ border-bottom: 2rpx solid #D8D8D8;
content:"("attr(data-unit)")"; padding-bottom:20rpx;
font-size:20rpx; text{
color:#999; &:first-child{
margin-left:6rpx; flex-shrink: 0;
color:#10C176;
margin-right:20rpx;
}
&:nth-child(2){
flex-grow: 1;
color:#10C176;
}
&:nth-child(3){
flex-shrink: 0;
color:#FBB65C;
margin-left:10rpx;
}
} }
} }
} &>.plant-youbian{
&>.company{ margin-top:20rpx;
margin-top:12rpx; display:flex;
display: flex; flex-direction: row-reverse;
align-items: center; align-items: center;
justify-content: space-between; justify-content: flex-end;
text{ text{
&:first-child{ flex-grow: 1;
font-size:24rpx; font-weight: bold;
color:#999; display:flex;
align-items: center;
&:after{
content:"("attr(data-unit)")";
font-size:20rpx;
color:#999;
margin-left:6rpx;
}
} }
&:nth-child(2){ }
color:#10C176; &>.company{
margin-top:12rpx;
display: flex;
align-items: center;
justify-content: space-between;
text{
&:first-child{
font-size:24rpx;
color:#999;
}
&:nth-child(2){
color:#10C176;
}
} }
} }
} }
@ -65,17 +90,27 @@
} }
</style> </style>
<template> <template>
<view class="container"> <view class="container flex">
<view class="card" v-for="(v,k) in list" :key="k" @click="toDetail(v)">
<view class="head"> <d-search v-model="searchVal.search" @search="clean();search()"/>
<text class="plant-rili"/> <text>批次号{{v.inOutBatchNo}}</text> <text>{{v.inOutType}}</text>
</view> <view class="btns shadow bg-white">
<view class="plant-youbian"> <text :data-unit="v.specDescribe">{{v.substanceName}}</text> </view> <button class="cu-btn bg-white" :class="{active:searchVal.type=='nz'}" @click="trigger('nz')">农资</button>
<view class="company"> <button class="cu-btn bg-white" :class="{active:searchVal.type=='ncp'}" @click="trigger('ncp')">农产品</button>
<text>{{v.supplier}}</text> <text>{{v.number}}{{v.packgeUnit}}({{v.equivalentAmount}}{{v.unit}})</text>
</view>
</view> </view>
<u-empty v-if="list.length<=0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
<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>
</view>
<view class="plant-youbian"> <text :data-unit="v.specDescribe">{{v.substanceName}}</text> </view>
<view class="company">
<text>{{v.supplier}}</text> <text>{{v.number}}{{v.packgeUnit}}({{v.equivalentAmount}}{{v.unit}})</text>
</view>
</view>
<u-empty v-if="list.length<=0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view>
</view> </view>
</template> </template>
<script> <script>
@ -88,22 +123,35 @@ export default {
enterpriseId: '', enterpriseId: '',
pageNo:1, pageNo:1,
pageSize:6, pageSize:6,
type:"nz"
}, },
list:[], list:[],
total:0, total:0,
} }
}, },
onLoad(options){ onLoad(options){
this.search()
if (this.$store.getters['userInfo'].roleCode=="baseAdmin") { if (this.$store.getters['userInfo'].roleCode=="baseAdmin") {
this.searchVal.userId = this.$store.getters['userInfo'].id this.searchVal.userId = this.$store.getters['userInfo'].id
this.searchVal.enterpriseId = '' this.searchVal.enterpriseId = ''
} else { } else {
this.searchVal.enterpriseId = this.$store.getters.userInfo.companyId this.searchVal.enterpriseId = this.$store.getters['userInfo'].companyId
this.searchVal.userId = '' this.searchVal.userId = ''
} }
this.search()
}, },
methods:{ 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(){ async search(){
if(this.total==0 || this.list.length<this.total){ if(this.total==0 || this.list.length<this.total){
var res=await request("/api/Inventory/queryOutInRecord",{ var res=await request("/api/Inventory/queryOutInRecord",{

Loading…
Cancel
Save