|  | @@ -9,7 +9,7 @@
 | 
											
												
													
														|  |  		<view class="container_main">
 |  |  		<view class="container_main">
 | 
											
												
													
														|  |  			<u-sticky :offsetTop="offsetTop" bgColor="#F0F6FB">
 |  |  			<u-sticky :offsetTop="offsetTop" bgColor="#F0F6FB">
 | 
											
												
													
														|  |  				<view class="search-box">
 |  |  				<view class="search-box">
 | 
											
												
													
														|  | -					<u-search placeholder="请输入单据编号" bgColor="#fff" shape="square" v-model="searchKey" :showAction="false"></u-search>
 |  | 
 | 
											
												
													
														|  | 
 |  | +					<u-search placeholder="请输入单据编号" bgColor="#fff" shape="square" v-model="params.number" :showAction="false" @search="searchClick"></u-search>
 | 
											
												
													
														|  |  					<view class="flex_box">
 |  |  					<view class="flex_box">
 | 
											
												
													
														|  |  						<view class="scan-text">扫描单据二维码</view>
 |  |  						<view class="scan-text">扫描单据二维码</view>
 | 
											
												
													
														|  |  						<view class="scan-icon">
 |  |  						<view class="scan-icon">
 | 
											
										
											
												
													
														|  | @@ -18,11 +18,11 @@
 | 
											
												
													
														|  |  					</view>
 |  |  					</view>
 | 
											
												
													
														|  |  				</view>
 |  |  				</view>
 | 
											
												
													
														|  |  				<view class="type-box flex_box">
 |  |  				<view class="type-box flex_box">
 | 
											
												
													
														|  | -					<view class="type-item">
 |  | 
 | 
											
												
													
														|  | 
 |  | +					<view class="type-item" @click="tabClick(1)">
 | 
											
												
													
														|  |  						<view class="type-val">{{type1}}</view>
 |  |  						<view class="type-val">{{type1}}</view>
 | 
											
												
													
														|  |  						<u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
 |  |  						<u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
 | 
											
												
													
														|  |  					</view>
 |  |  					</view>
 | 
											
												
													
														|  | -					<view class="type-item">
 |  | 
 | 
											
												
													
														|  | 
 |  | +					<view class="type-item" @click="tabClick(2)">
 | 
											
												
													
														|  |  						<view class="type-val">{{type2}}</view>
 |  |  						<view class="type-val">{{type2}}</view>
 | 
											
												
													
														|  |  						<u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
 |  |  						<u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
 | 
											
												
													
														|  |  					</view>
 |  |  					</view>
 | 
											
										
											
												
													
														|  | @@ -32,16 +32,22 @@
 | 
											
												
													
														|  |  				<block v-for="(item,i) in taskList" :key="i">
 |  |  				<block v-for="(item,i) in taskList" :key="i">
 | 
											
												
													
														|  |  					<task-item :item="item" @toStorage="toStorage" @toDetail="toDetail" type="caigou"></task-item>
 |  |  					<task-item :item="item" @toStorage="toStorage" @toDetail="toDetail" type="caigou"></task-item>
 | 
											
												
													
														|  |  				</block>
 |  |  				</block>
 | 
											
												
													
														|  | 
 |  | +				<u-empty mode="data" v-if="taskList.length == 0"></u-empty>
 | 
											
												
													
														|  |  			</view>
 |  |  			</view>
 | 
											
												
													
														|  |  		</view>
 |  |  		</view>
 | 
											
												
													
														|  |  		<!-- 中心仓弹窗 -->
 |  |  		<!-- 中心仓弹窗 -->
 | 
											
												
													
														|  | -		<u-picker :show="stashShow" :defaultIndex="defaultIndex" :columns="columnsList" @confirm="pickerConfirm" @cancel="stashShow= false"></u-picker>
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +		<u-picker :show="stashShow" :defaultIndex="defaultIndex" :columns="stashColumns" @confirm="pickerConfirm" @cancel="stashShow= false"></u-picker>
 | 
											
												
													
														|  | 
 |  | +		<!-- 状态 -->
 | 
											
												
													
														|  | 
 |  | +		<u-picker :show="statusShow" keyName="name" :defaultIndex="defaultIndex2" :columns="statusColumns" @confirm="statusConfirm" @cancel="statusShow= false"></u-picker>
 | 
											
												
													
														|  | 
 |  | +		<!-- 月份 -->
 | 
											
												
													
														|  | 
 |  | +		<u-picker :show="dateShow" :defaultIndex="defaultIndex3" :columns="dateColumns" @confirm="dateConfirm" @cancel="dateShow= false"></u-picker>
 | 
											
												
													
														|  | 
 |  | +		
 | 
											
												
													
														|  |  	</view>
 |  |  	</view>
 | 
											
												
													
														|  |  </template>
 |  |  </template>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  <script>
 |  |  <script>
 | 
											
												
													
														|  |  	import taskItem from '@/components/task-item/task-item.vue'
 |  |  	import taskItem from '@/components/task-item/task-item.vue'
 | 
											
												
													
														|  | 
 |  | +	import {purchaseInventory} from '@/common/request/apis/purchase'
 | 
											
												
													
														|  |  	export default{
 |  |  	export default{
 | 
											
												
													
														|  |  		components:{
 |  |  		components:{
 | 
											
												
													
														|  |  			taskItem
 |  |  			taskItem
 | 
											
										
											
												
													
														|  | @@ -54,44 +60,120 @@
 | 
											
												
													
														|  |  				type1:'全部',
 |  |  				type1:'全部',
 | 
											
												
													
														|  |  				type2:'月份',
 |  |  				type2:'月份',
 | 
											
												
													
														|  |  				stashShow:false,
 |  |  				stashShow:false,
 | 
											
												
													
														|  | -				columnsList:[],
 |  | 
 | 
											
												
													
														|  | 
 |  | +				stashShow:false,
 | 
											
												
													
														|  | 
 |  | +				statusShow:false,
 | 
											
												
													
														|  | 
 |  | +				dateShow:false,
 | 
											
												
													
														|  |  				stashColumns:[
 |  |  				stashColumns:[
 | 
											
												
													
														|  |  					['鹏越中心仓','美团中心仓']
 |  |  					['鹏越中心仓','美团中心仓']
 | 
											
												
													
														|  |  				],
 |  |  				],
 | 
											
												
													
														|  | 
 |  | +				statusColumns:[
 | 
											
												
													
														|  | 
 |  | +					[{
 | 
											
												
													
														|  | 
 |  | +						name:'全部',
 | 
											
												
													
														|  | 
 |  | +						id:''
 | 
											
												
													
														|  | 
 |  | +					},{
 | 
											
												
													
														|  | 
 |  | +						name:'待入库',
 | 
											
												
													
														|  | 
 |  | +						id:'1'
 | 
											
												
													
														|  | 
 |  | +					},{
 | 
											
												
													
														|  | 
 |  | +						name:'入库中',
 | 
											
												
													
														|  | 
 |  | +						id:'4'
 | 
											
												
													
														|  | 
 |  | +					},{
 | 
											
												
													
														|  | 
 |  | +						name:'已入库',
 | 
											
												
													
														|  | 
 |  | +						id:'2'
 | 
											
												
													
														|  | 
 |  | +					}]
 | 
											
												
													
														|  | 
 |  | +				],
 | 
											
												
													
														|  | 
 |  | +				dateColumns:[
 | 
											
												
													
														|  | 
 |  | +					['全年','一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
 | 
											
												
													
														|  | 
 |  | +				],
 | 
											
												
													
														|  |  				defaultIndex:[],
 |  |  				defaultIndex:[],
 | 
											
												
													
														|  | -				pickType:0,//1.中心仓
 |  | 
 | 
											
												
													
														|  | -				taskList:[
 |  | 
 | 
											
												
													
														|  | -					{
 |  | 
 | 
											
												
													
														|  | -						type:0
 |  | 
 | 
											
												
													
														|  | -					},
 |  | 
 | 
											
												
													
														|  | -					{
 |  | 
 | 
											
												
													
														|  | -						type:1
 |  | 
 | 
											
												
													
														|  | -					}
 |  | 
 | 
											
												
													
														|  | -				]
 |  | 
 | 
											
												
													
														|  | 
 |  | +				defaultIndex2:[],
 | 
											
												
													
														|  | 
 |  | +				defaultIndex3:[],
 | 
											
												
													
														|  | 
 |  | +				taskList:[],
 | 
											
												
													
														|  | 
 |  | +				params:{
 | 
											
												
													
														|  | 
 |  | +					beginTime:'',
 | 
											
												
													
														|  | 
 |  | +					endTime:'',
 | 
											
												
													
														|  | 
 |  | +					number:'',
 | 
											
												
													
														|  | 
 |  | +					status:'',
 | 
											
												
													
														|  | 
 |  | +					pageNum:1,
 | 
											
												
													
														|  | 
 |  | +					pageSize:10
 | 
											
												
													
														|  | 
 |  | +				}
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  |  		},
 |  |  		},
 | 
											
												
													
														|  |  		onLoad() {
 |  |  		onLoad() {
 | 
											
												
													
														|  |  			let systemInfo = uni.getSystemInfoSync();
 |  |  			let systemInfo = uni.getSystemInfoSync();
 | 
											
												
													
														|  |  			let statusBarHeight = systemInfo.statusBarHeight;
 |  |  			let statusBarHeight = systemInfo.statusBarHeight;
 | 
											
												
													
														|  |  			this.offsetTop = statusBarHeight + 40
 |  |  			this.offsetTop = statusBarHeight + 40
 | 
											
												
													
														|  | 
 |  | +			this.init()
 | 
											
												
													
														|  |  		},
 |  |  		},
 | 
											
												
													
														|  |  		methods:{
 |  |  		methods:{
 | 
											
												
													
														|  | 
 |  | +			init() {
 | 
											
												
													
														|  | 
 |  | +				uni.showLoading()
 | 
											
												
													
														|  | 
 |  | +				this.params.pageNum = 1
 | 
											
												
													
														|  | 
 |  | +				this.getPurchaseInventory()
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  | 
 |  | +			searchClick() {
 | 
											
												
													
														|  | 
 |  | +				this.init()
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  | 
 |  | +			tabClick(type) {
 | 
											
												
													
														|  | 
 |  | +				if(type == 1) {
 | 
											
												
													
														|  | 
 |  | +					this.defaultIndex = this.getDefaultIndex(this.type1,this.statusColumns)
 | 
											
												
													
														|  | 
 |  | +					this.statusShow = true
 | 
											
												
													
														|  | 
 |  | +				}else {
 | 
											
												
													
														|  | 
 |  | +					this.defaultIndex = this.getDefaultIndex(this.type2,this.dateColumns)
 | 
											
												
													
														|  | 
 |  | +					this.dateShow = true
 | 
											
												
													
														|  | 
 |  | +				}
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  | 
 |  | +			getPurchaseInventory() {
 | 
											
												
													
														|  | 
 |  | +				purchaseInventory(this.params)
 | 
											
												
													
														|  | 
 |  | +				.then(res=>{
 | 
											
												
													
														|  | 
 |  | +					if(res.code == 200) {
 | 
											
												
													
														|  | 
 |  | +						this.taskList = res.data.rows;
 | 
											
												
													
														|  | 
 |  | +					}
 | 
											
												
													
														|  | 
 |  | +					uni.hideLoading()
 | 
											
												
													
														|  | 
 |  | +				})
 | 
											
												
													
														|  | 
 |  | +				.catch(err=>{
 | 
											
												
													
														|  | 
 |  | +					uni.hideLoading()
 | 
											
												
													
														|  | 
 |  | +				})
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  |  			stashClick() {
 |  |  			stashClick() {
 | 
											
												
													
														|  | -				this.pickType = 1
 |  | 
 | 
											
												
													
														|  | -				this.columnsList = this.stashColumns
 |  | 
 | 
											
												
													
														|  | -				this.defaultIndex = this.getDefaultIndex(this.cangName)
 |  | 
 | 
											
												
													
														|  | 
 |  | +				this.defaultIndex = this.getDefaultIndex(this.cangName,this.stashColumns)
 | 
											
												
													
														|  |  				this.stashShow = true
 |  |  				this.stashShow = true
 | 
											
												
													
														|  |  			},
 |  |  			},
 | 
											
												
													
														|  |  			pickerConfirm(val) {
 |  |  			pickerConfirm(val) {
 | 
											
												
													
														|  | -				if(this.pickType == 1) {
 |  | 
 | 
											
												
													
														|  | -					this.cangName = val.value[0]
 |  | 
 | 
											
												
													
														|  | -				}
 |  | 
 | 
											
												
													
														|  | 
 |  | +				this.cangName = val.value[0]
 | 
											
												
													
														|  |  				this.stashShow = false
 |  |  				this.stashShow = false
 | 
											
												
													
														|  |  			},
 |  |  			},
 | 
											
												
													
														|  | 
 |  | +			statusConfirm(val) {
 | 
											
												
													
														|  | 
 |  | +				this.type1 = val.value[0].name
 | 
											
												
													
														|  | 
 |  | +				this.params.status = val.value[0].id
 | 
											
												
													
														|  | 
 |  | +				this.statusShow = false
 | 
											
												
													
														|  | 
 |  | +				this.params.pageNum = 1
 | 
											
												
													
														|  | 
 |  | +				this.getPurchaseInventory()
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  | 
 |  | +			dateConfirm(val) {
 | 
											
												
													
														|  | 
 |  | +				this.type2 = val.value[0]
 | 
											
												
													
														|  | 
 |  | +				this.dateShow = false
 | 
											
												
													
														|  | 
 |  | +				let month = val.indexs[0]
 | 
											
												
													
														|  | 
 |  | +				this.getLastDayOfMonth(month)
 | 
											
												
													
														|  | 
 |  | +				uni.showLoading()
 | 
											
												
													
														|  | 
 |  | +				this.init()
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  | 
 |  | +			// 获取开始时间、结束时间
 | 
											
												
													
														|  | 
 |  | +			getLastDayOfMonth(month) {
 | 
											
												
													
														|  | 
 |  | +				let year = new Date().getFullYear()
 | 
											
												
													
														|  | 
 |  | +				if(month !=0) {
 | 
											
												
													
														|  | 
 |  | +					let monthStart = new Date(year, month, 0).getDate();
 | 
											
												
													
														|  | 
 |  | +					this.params.beginTime = `${year}-${month}-01`
 | 
											
												
													
														|  | 
 |  | +					this.params.endTime = `${year}-${month}-${monthStart}`
 | 
											
												
													
														|  | 
 |  | +				}else {
 | 
											
												
													
														|  | 
 |  | +					this.params.beginTime = ''
 | 
											
												
													
														|  | 
 |  | +					this.params.endTime = ''
 | 
											
												
													
														|  | 
 |  | +				}
 | 
											
												
													
														|  | 
 |  | +				
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  |  			// 获取picker默认index
 |  |  			// 获取picker默认index
 | 
											
												
													
														|  | -			getDefaultIndex(val) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +			getDefaultIndex(val,list) {
 | 
											
												
													
														|  |  				let arr = []
 |  |  				let arr = []
 | 
											
												
													
														|  | -				let index = this.columnsList[0].findIndex(item=>item == val)
 |  | 
 | 
											
												
													
														|  | 
 |  | +				let index = list[0].findIndex(item=>item == val)
 | 
											
												
													
														|  |  				arr = [index]
 |  |  				arr = [index]
 | 
											
												
													
														|  |  				return arr
 |  |  				return arr
 | 
											
												
													
														|  |  			},
 |  |  			},
 | 
											
										
											
												
													
														|  | @@ -103,7 +185,7 @@
 | 
											
												
													
														|  |  			},
 |  |  			},
 | 
											
												
													
														|  |  			toDetail(val) {
 |  |  			toDetail(val) {
 | 
											
												
													
														|  |  				uni.navigateTo({
 |  |  				uni.navigateTo({
 | 
											
												
													
														|  | -					url:'/pages/picking-task/detail'
 |  | 
 | 
											
												
													
														|  | 
 |  | +					url:`/pages/purchase/detail?id=${val.id}`
 | 
											
												
													
														|  |  				})
 |  |  				})
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  |  		}
 |  |  		}
 |