Pārlūkot izejas kodu

Merge branch 'develop_szhj' of http://git.chelingzhu.com/jianguan-web/qpls-md-app into develop_szhj

lilei 3 gadi atpakaļ
vecāks
revīzija
56f08eeed9
5 mainītis faili ar 383 papildinājumiem un 609 dzēšanām
  1. 10 3
      pages.json
  2. 186 0
      pages/stock/detaiList.vue
  3. 1 0
      pages/stock/index.vue
  4. 0 606
      pages/stock/stockDetaiList.vue
  5. 186 0
      pages/stock/stockSearch.vue

+ 10 - 3
pages.json

@@ -166,16 +166,23 @@
 			}
 		},
 		{
-			"path": "pages/stock/stockDetaiList", // 库存详情列表
+			"path": "pages/stock/stockSearch", // 库存查询
+			"style": {
+				"navigationBarTitleText": "库存查询",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/stock/detaiList", // 库存详情列表
 			"style": {
 				"navigationBarTitleText": "库存详情",
 				"enablePullDownRefresh": false
 			}
 		},
 		{
-			"path": "pages/stock/stockDetail", // 库存详情列表
+			"path": "pages/stock/stockDetail", // 库存详情
 			"style": {
-				"navigationBarTitleText": "库存详情1",
+				"navigationBarTitleText": "库存详情",
 				"enablePullDownRefresh": false
 			}
 		}

+ 186 - 0
pages/stock/detaiList.vue

@@ -0,0 +1,186 @@
+<template>
+	<view class="st-detailList-wrap">
+		<!-- 统计 -->
+		<view class="panel-box">
+			<view class="item-box">
+				<view>查询结果</view>
+				<u-count-to :end-val="totalNum ? totalNum : 0" separator="," font-size="30"></u-count-to>条
+			</view>
+			<view class="item-box">
+				<view>可用库存数量</view>
+				<u-count-to :end-val="totalData&&totalData.totalCurrentStockQty ? totalData.totalCurrentStockQty : 0" separator="," font-size="30"></u-count-to>个
+			</view>
+			<view class="item-box">
+				<view>可用库存成本</view>
+				¥<u-count-to :end-val="totalData&&totalData.totalCurrentStockCost ? totalData.totalCurrentStockCost : 0" separator="," font-size="30" :decimals="2"></u-count-to>
+			</view>
+		</view>
+		<!-- 查询结果 -->
+		<scroll-view class="st-detailList-con" scroll-y @scrolltolower="onreachBottom">
+			<view class="st-detailList-main">
+				<view class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
+					<view class="st-detailList-tit">
+						<view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view>{{item.productName}}
+					</view>
+					<view class="st-detailList-item-con flex align_center">
+						<view class="pimgs">
+							<u-image :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+						</view>
+						<view class="flex_1">
+							<view>产品编码:{{item.productCode}}</view>
+							<view class="padding_3">原厂编码:{{item.productOrigCode}}</view>
+							<view class="flex align_center justify_between">
+								<view class="font_13">
+									可用数量:
+									<u-count-to :end-val="item.currentStockQty ? item.currentStockQty : 0" separator="," font-size="26"></u-count-to>个
+								</view>
+								<view class="font_13">
+									库存成本:
+									¥<u-count-to :end-val="item.currentStockCost ? item.currentStockCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
+								</view>
+							</view>
+						</view>
+					</view>
+				</view>
+				<view v-if="listData && listData.length == 0">
+					<u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
+				</view>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import { stockList, stockCount } from '@/api/stock'
+	export default{
+		data(){
+			return {
+				totalData: null,
+				totalNum: 0,
+				listData: [],
+				pageNo: 1,
+				pageSize: 6,
+				params: {},
+				noDataText: '暂无数据',
+				theme: ''
+			}
+		},
+		onLoad(option) {
+			this.theme = getApp().globalData.theme
+			this.params = option.data ? JSON.parse(option.data) : {}
+			this.getList()
+		},
+		methods: {
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
+				stockList(params).then(res => {
+					this.getTotal(params)
+					if (res.status == 200) {
+						if(this.pageNo>1){
+							this.listData = this.listData.concat(res.data.list || [])
+						}else{
+							this.listData = res.data.list || []
+						}
+						this.totalNum = res.data.count || 0
+					} else {
+						this.listData = []
+						this.totalNum = 0
+						this.noDataText = res.message
+					}
+				})
+			},
+			// 合计
+			getTotal (params) {
+				stockCount(params).then(res => {
+					if (res.status == 200 && res.data) {
+						this.totalData = res.data
+					} else {
+						this.totalData = null
+					}
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}
+			},
+			// 详情
+			getDetail(data){
+				uni.navigateTo({ url: "/pages/stock/detaiList?data="+JSON.stringify(data) })
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.st-detailList-wrap{
+		width: 100%;
+		height: 100vh;
+		.panel-box {
+			background-color: #ffffff;
+			padding: 20upx 0;
+			box-shadow: 3upx 2upx 6upx #eee;
+			margin-bottom: 20upx;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			.item-box{
+				text-align: center;
+				width: 33.33%;
+				border-right: 1px solid #e4e7ed;
+			}
+			.item-box:last-child{
+				border-right: none;
+			}
+		}
+		.st-detailList-con{
+			height: calc(100vh - 138upx);
+			.st-detailList-main{
+				.st-detailList-main-item{
+					background: #ffffff;
+					padding: 20upx;
+					margin-bottom: 25upx;
+					border-radius: 25upx;
+					box-shadow: 1px 1px 3px #EEEEEE;
+					.st-detailList-tit{
+						padding-bottom: 20upx;
+						border-bottom: 1px solid #e4e7ed;
+						white-space: nowrap;
+						overflow: hidden;
+						text-overflow: ellipsis;
+						.u-line{
+							display: inline-block;
+							width: 6upx;
+							height: 40upx;
+							background-color: red;
+							vertical-align: bottom;
+							margin: 0 20upx 0 10upx;
+						}
+					}
+					.st-detailList-item-con{
+						padding: 20upx 20upx 6upx;
+						font-size: 26upx;
+						.pimgs{
+							margin-right: 16upx;
+						}
+						.font_13{
+							font-size: 26upx;
+						}
+						.padding_3{
+							padding: 6upx 0;
+						}
+					}
+				}
+			}
+			
+			
+		}
+	}
+</style>

+ 1 - 0
pages/stock/index.vue

@@ -114,6 +114,7 @@
 					params.zeroQtyFlag = ''
 				}
 				console.log(params)
+				uni.navigateTo({ url: "/pages/stock/stockSearch?data="+JSON.stringify(params) })
 			},
 			// 选择品牌
 			brandChoose(data){

+ 0 - 606
pages/stock/stockDetaiList.vue

@@ -1,606 +0,0 @@
-<template>
-	<view class="pagesCons">
-		<view class="tab-body flex_column ">
-			<view class="flex_column">
-				<view>
-					<u-tabs-swiper ref="uTabs" bar-width='100' :active-color="$config('primaryColors')" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
-					 swiperWidth="750"></u-tabs-swiper>
-				</view>
-				<view class="stock-con">
-					<view class="stock-tit">
-						<view class="u-line"></view>库存查询
-					</view>
-					<view class="flex align_center align_center" style="margin-top: 10px;">
-						<u-image width="60px" height="60px"/>
-						<view style="padding-left: 10px;height: 80px;" class="flex_column align_center">
-							<view>产品编码:<text>{{'0123456'}}</text></view>
-							<view>原厂编码:<text>{{'0123456'}}</text></view>
-							<view>
-								<text>可用数量:122</text>
-								<text>库存成本:1230000</text>
-							</view>
-						</view>
-					</view>
-				</view>
-			</view>
-				<swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
-					<swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, index) in tabList" :key="index">
-						<scroll-view scroll-y style="width: 100%;overflow: scroll;" @scrolltolower="onreachBottom">
-							<view  
-							class="check-order-list" 
-							v-for="item in 7"
-							>
-								 <view class="check-row" @click="viewRow(item)">
-									 <view class="flex justify_between"> 
-										 <text>2021-12-31 12:12:12</text>
-										 <text>销售退货</text>
-									 </view>
-									 <view class="flex justify_between">
-									 <text>2021-12-31 12:12:12</text>
-									 <text>销售退货</text>
-									 </view>
-								 </view>
-							 </view>
-							 <u-empty text="暂无套餐" :src="`/static/${$config('themePath')}/def_no_meal@3x.png`" icon-size="240" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
-							 <view style="padding: 20upx;">
-								 <u-loadmore :load-text="$config('loadText')" v-if="total>pageSize || status=='loading'" :status="status" />
-							 </view>
-						</scroll-view>
-					</swiper-item>
-				</swiper>
-		</view>
-		
-	</view>
-</template>
-
-<script>
-	// import { listCustomerBundle } from '@/api/customerBundle'
-	// import vSelect from '@/components/select/v-select.vue'
-	// import { searchCustomerList } from '@/api/car.js'
-	export default {
-		// components: {
-		// 	vSelect
-		// },
-		data() {
-			return {
-				showSearch: false,
-				showCustomeList: false,
-				customList: [],
-				tips: {
-					text: '请选择客户信息',
-					color: '#666',
-					fontSize: 34
-				},
-				status: 'loadmore',
-				background: {
-					// 渐变色
-					backgroundImage: this.$config('topBarBackground')
-				},
-				tabList: [
-					{
-						dispName: '出库详情',
-						code:''
-					},
-					{
-						dispName: '出入库明细',
-						code:'1'
-					},
-					
-				],
-				current: 0,
-				swiperCurrent: 0,
-				orderStatus: '', // 订单状态
-				currentId: '',
-				payTypeList: [],
-				pageNo: 1,
-				pageSize: 10,
-				list: [],
-				total: 0,
-				// 查询条件
-				beginDate: null,
-				endDate: null,
-				queryWord: '',
-				bundleName: '',
-				number: '',
-				payTypes: '',
-				sellChannel: '',
-				refundStatus: '',
-				carNumber: '',
-				createChannels: [],
-				createChanneList: [] // 创建渠道列表
-			}
-		},
-		onLoad() {
-			let _this = this
-			this.getpayType()
-			this.pageInit()
-			//创建渠道列表
-			this.createChanneList = this.$store.state.vuex_createChannelList
-			uni.$on('refreshBundle',function(data){
-				 console.log(data.msg,'refreshOrder')
-			     _this.pageInit()
-			})
-			uni.setNavigationBarColor({
-				backgroundColor: this.$config('topBarBackground'),
-				frontColor: this.$config('topBarTitleColors')
-			})
-		},
-		onBackPress() {
-			if(this.showSearch){
-				this.showSearch = false
-				return true
-			}
-		},
-		onNavigationBarButtonTap(e){
-			if(e.index == 0){
-				this.openSearch()
-			}
-		},
-		methods:{ 
-			message(title){
-				uni.showToast({
-					icon:'none',
-					title: title
-				})
-			},
-			// 获取所有收费方式
-			getpayType () {
-				this.payTypeList = this.$store.state.vuex_paymentTypeList
-			},
-			filterpayType (val,dataList) {
-			  var _value = ''
-			    for (let i = 0; i < dataList.length; i++) {
-			      if (val == dataList[i].code) {
-			        _value = dataList[i].dispName
-			        break
-			      }
-			    }
-			  return _value
-			},
-			getpayTypeText(v) {
-				this.payTypes = v
-			},
-			// 选择创建渠道
-			selCreatChannel(items,index){
-				let hasIndex = this.createChannels.findIndex(item=> item == items.code)
-				if(hasIndex>=0){
-					this.createChannels.splice(hasIndex,1)
-					this.createChanneList[index].checked = false
-				}else{
-					this.createChannels.push(items.code)
-					this.createChanneList[index].checked = true
-				}
-				this.createChanneList.splice()
-			},
-			pageInit(showSearch){
-				if(showSearch){
-					if(this.endDate&&!this.beginDate){
-					  this.message('请选择开始日期')
-					  return false
-					}
-					if(this.beginDate&&!this.endDate){
-					  this.message('请选择结束日期')
-					  return false
-					}
-				}
-				this.total = 0
-				this.pageNo = 1
-				this.getRow()
-				this.showSearch = showSearch
-			},
-			// tabs通知swiper切换
-			tabsChange(index) {
-				this.swiperCurrent = index;
-			},
-			swiperChange(event){
-				console.log(event.detail)
-				this.list = []
-				this.status = "loading"
-			},
-			// swiper-item左右移动,通知tabs的滑块跟随移动
-			transition(e) {
-				console.log(e,'eeeeeeeee')
-				let dx = e.detail.dx;
-				this.$refs.uTabs.setDx(dx);
-			},
-			// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
-			// swiper滑动结束,分别设置tabs和swiper的状态
-			animationfinish(e) {
-				console.log('---------')
-				let current = e.detail.current;
-				if(current != this.current){
-					this.$refs.uTabs.setFinishCurrent(current);
-					this.swiperCurrent = current;
-					this.current = current;
-					this.refundStatus = this.tabList.length ? this.tabList[this.current].code : ''
-					this.resetForm(false)
-				}
-			},
-			// scroll-view到底部加载更多
-			onreachBottom() {
-				console.log(this.list.length, this.total)
-				if(this.list.length < this.total){
-					this.pageNo += 1
-					this.getRow()
-				}else{
-					this.status = "nomore"
-				}
-			},
-			checkNums (states, i){
-			  if(states){
-				  let arr = states.split(',')
-				  return arr[i]
-			  }
-				return 0
-			},
-			// 查询列表
-			getRow (pageNo) {
-			  let _this = this
-			  if (pageNo) {
-			    this.pageNo = pageNo
-			  }
-			  
-			  let sdata = {
-			    pageNo: this.pageNo,
-			    pageSize: this.pageSize,
-			    queryWord: this.queryWord,
-				beginDate: this.beginDate||'',
-				endDate: this.endDate||'',
-				createChannels: this.createChannels
-			  }
-			  if (this.number) {
-			    sdata.number = this.number
-			  }
-			  if (this.bundleName) {
-			    sdata.bundleName = this.bundleName
-			  }
-			  if (this.payTypes) {
-				  let arr = []
-				  arr.push(this.payTypes)
-			    sdata.payTypes = arr
-			  }
-			  if (this.sellChannel) {
-			    sdata.sellChannelCode = this.sellChannel
-			  }
-			  if (this.refundStatus) {
-			    sdata.refundStatus = this.refundStatus
-			  }
-			 
-			  _this.status = "loading"
-			  listCustomerBundle(sdata).then(res => {
-				if (res.code == 200 || res.status == 204 || res.status == 200) {
-				  if(_this.pageNo>1){
-					  _this.list = _this.list.concat(res.data.list || [])
-				  }else{
-					  _this.list = res.data.list || []
-				  }
-				  _this.total = res.data.count || 0
-				} else {
-				  _this.list = []
-				  _this.total = 0
-				}
-				_this.status = "loadmore"
-			  })
-			},
-			// 查询条件
-			openSearch(){
-				let _this = this
-				this.showSearch = true
-				if (this.payTypes) {
-					setTimeout(function(){
-						_this.$refs.payType.setVal(_this.payTypes)
-					},300)
-				}
-				if(this.createChanneList.length==0){
-					//创建渠道列表
-					this.createChanneList = this.$store.state.vuex_createChannelList
-					this.createChanneList.map(item=>{item.checked = false})
-				}
-			},
-			bindBeginDateChange(e){
-				this.beginDate = e.target.value
-			},
-			bindEndDateChange(e){
-				this.endDate = e.target.value
-			},
-			// 重置
-			resetForm(flag){
-				this.queryWord = ''
-				this.beginDate = ''
-				this.endDate = ''
-				this.bundleName = ''
-				this.number = ''
-				this.payTypes = ''
-				this.sellChannel = ''
-				this.carNumber = ''
-				this.createChannels= []
-				//创建渠道列表
-				if(flag){
-					this.createChanneList = this.$store.state.vuex_createChannelList
-					this.createChanneList.map(item=>{item.checked = false})
-					this.$refs.payType.resetVal()
-				}
-				this.pageInit(flag)
-			},
-			// 详细页
-			viewRow(item){
-				uni.navigateTo({
-					url: "/pages/workOrder/sellOrder/customBundleDetail?id="+item.id
-				})
-			},
-		   // 付款
-		   payRow (params) {
-		     let _this = this
-		     let id = params.row.id
-		     this.currentId = id
-		     this.$Modal.confirm({
-		       title: '确认付款操作吗',
-		       onOk: () => {
-		         // 打开购买套餐页面
-		         _this.openPackagePay = true
-		       },
-		       onCancel: () => {
-		       }
-		     })
-		   },
-			collectMoney (data){
-                 // 进入收款页面
-				 uni.redirectTo({
-					 url: '/pages/workOrder/sellOrder/bundlePay?id='+data.id
-				 })
-		    },
-			// 车牌号查询客户信息
-			queryCustomByCar (event) {
-				console.log(event.detail.value, '==搜索关键词')
-			   let queryWord = event.detail.value
-			   if (queryWord.length > 0){
-				 let params = {vehicleNumber: ''}
-				 if (queryWord.length == 5 || queryWord.length == 6){
-				   params.vehicle5Number = queryWord.toUpperCase()
-				   this.queryCustomInfo(params)
-				 } else if (queryWord.length == 7 || queryWord.length == 8){
-				   params.vehicleNumber = queryWord.toUpperCase()
-				   this.queryCustomInfo(params)
-				 }
-			   }else{
-				   this.queryWord = ''
-			   }
-			},
-			// 获取客户车辆信息
-			queryCustomInfo (params) {
-			    let _this = this
-				searchCustomerList(params).then(res => {
-				  if (res.status - 0 === 200) {
-					_this.customList = res.data || []
-					if(_this.customList.length){
-						_this.customList.map(item=>{
-							item.text = item.customer.mobile + '-' + item.vehicle.number
-						})
-						if(_this.customList.length > 1){
-							this.showCustomeList = true
-							uni.hideKeyboard()
-						}else{
-							this.selectCustomCar(0)
-						}
-					}else{
-						uni.showToast({
-							icon:'none',
-							title:'此车牌不存在'
-						})
-						this.carNumber = ''
-					}
-				  } 
-				})
-			},
-			// 选择下拉选项
-			selectCustomCar (index){
-				let row = this.customList[index]
-				if (row){
-					this.queryWord = row.customer.mobile
-					this.carNumber = row.vehicle.number
-				}
-			},
-			// 取消选择已存在的客户信息
-			closeSelCust(){
-				this.customList = []
-				this.queryWord = ''
-				this.carNumber = ''
-			},
-		}
-	}
-</script>
-
-<style lang="scss">
-	page{
-		height: 100%;
-	}
-	.pagesCons{
-		width: 100%;
-		height: 100%;
-		background-color: #fff;
-		display: flex;
-		flex-direction: column;
-		.tab-body{
-			height: 100%;
-			display: flex;
-			flex-direction: column;
-			.stock-con{
-				background-color: #ffffff;
-				border-radius: 20upx;
-				box-shadow: 3upx 2upx 6upx #eee;
-				padding: 20upx;
-				// position: fixed;
-				// top:40px;
-				.stock-tit{
-					.u-line{
-						display: inline-block;
-						width: 6upx;
-						height: 40upx;
-						background-color: red;
-						vertical-align: bottom;
-						margin: 0 20upx 0 10upx;
-					}
-				}
-			}
-			.check-list{
-				flex-grow: 1;
-				
-				// height: calc(100vh - 44px);
-			}
-			.check-order-list{
-				background: #ffffff;
-				padding: 10upx 20upx;
-				margin-top: 25upx;
-				border-radius: 30upx;
-				box-shadow: 1px 1px 3px #EEEEEE;
-				.check-row{
-					>view{
-						padding: 5px;
-					}
-					// display: flex;
-					// align-items: center;
-					// padding: 20upx 10upx;
-					// font-size: 28upx;
-					// &:first-child{
-					// 	color: #222222;
-					// 	font-size: 34upx;
-					// 	padding-bottom: 0;
-					// }
-					// &:last-child{
-					// 	color: #666E75;
-					// }
-					// > view{
-					// 	&:first-child{
-					// 		flex-grow: 1;
-					// 	}
-					// }
-					// .state{
-					// 	font-size: 30upx;
-					// 	width: 30%;
-					// 	text-align: right;
-					// }
-					// .customeInfo{
-					// 	color: #999;
-					// 	.uname{
-					// 		margin-right: 20upx;
-					// 	}
-					// }
-					// .action{
-					// 	margin: 0 6rpx;
-					// 	padding: 0 20rpx;
-					// 	color: #fff;
-					// 	border-radius: 100rpx;
-					// 	&:after{
-					// 		border: 0;
-					// 	}
-					// }
-					// .pay{
-					// 	background-color: #ffaa00;
-					// }
-				}
-			}
-		}
-	}
-   .slot-wrap {
-		display: flex;
-		align-items: center;
-		/* 如果您想让slot内容占满整个导航栏的宽度 */
-		flex: 1;
-		/* 如果您想让slot内容与导航栏左右有空隙 */
-		padding: 0 30rpx 0 0;
-		color: #fff;
-		font-size: 28upx;
-		.left-icon{
-			flex-grow: 1;
-			font-size: 32upx;
-		}
-		.right-icon{
-			padding-left:50upx;
-		}
-		.uni-icons{
-			margin-right: 10upx;
-		}
-	}
-	.search-popup{
-		.search-title{
-			text-align: center;
-			padding: 20upx;
-			color: #333; 
-			border-bottom: 1px solid #eee;
-		}
-		uni-picker{
-			width: 100%;
-		}
-		.uni-list{
-			padding:10upx 30upx;
-			margin: 0;
-			border-bottom: 1px solid #EEEEEE;
-			.uni-list-cell{
-				border: 0;
-				.uni-list-cell-db{
-					flex: 1;
-					width: 100%;
-				}
-				.p30{
-					padding-right: 30upx;
-				}
-				.uni-input{
-					height: 2.5em;
-					line-height: 2.5em;
-					font-size: 28upx;
-					display: flex;
-					align-items: center;
-					text-align: right;
-					> view{
-						&:first-child{
-							flex-grow: 1;
-						}
-						&:last-child{
-							color: #999;
-						}
-						.form-input-placeholder{
-							color: #999;
-						}
-					}
-				}
-				.item-icon{
-					margin-left: 10upx;
-				}
-				.checkbox-items{
-					display: flex;
-					flex-wrap: wrap;
-					justify-content: space-between;
-					.checkbox{
-						width: 24%;
-						background: #F8F8F8;
-						text-align: center;
-						margin: 20upx 0;
-						padding: 10upx 0;
-						border-radius: 50upx;
-						font-size: 24upx;
-						border:1upx solid #eee;
-					}
-					.checked{
-						background: rgba(4, 133, 246, 0.15);
-						border-color: rgba(4, 133, 246, 0.5);
-						color: rgba(4, 133, 246, 1);
-					}
-				}
-			}
-		}
-		.uni-list-btns{
-			display: flex;
-			padding: 20upx;
-			uni-button{
-				font-size: 28upx;
-				margin: 25upx 20upx 0;
-				flex:1;
-				border-radius: 100upx;
-				&:after{
-					border: 0;
-				}
-			}
-		}
-		
-	}
-</style>

+ 186 - 0
pages/stock/stockSearch.vue

@@ -0,0 +1,186 @@
+<template>
+	<view class="stockSearch-wrap">
+		<!-- 统计 -->
+		<view class="panel-box">
+			<view class="item-box">
+				<view>查询结果</view>
+				<u-count-to :end-val="totalNum ? totalNum : 0" separator="," font-size="30"></u-count-to>条
+			</view>
+			<view class="item-box">
+				<view>可用库存数量</view>
+				<u-count-to :end-val="totalData&&totalData.totalCurrentStockQty ? totalData.totalCurrentStockQty : 0" separator="," font-size="30"></u-count-to>个
+			</view>
+			<view class="item-box">
+				<view>可用库存成本</view>
+				¥<u-count-to :end-val="totalData&&totalData.totalCurrentStockCost ? totalData.totalCurrentStockCost : 0" separator="," font-size="30" :decimals="2"></u-count-to>
+			</view>
+		</view>
+		<!-- 查询结果 -->
+		<scroll-view class="stockSearch-con" scroll-y @scrolltolower="onreachBottom">
+			<view class="stockSearch-main">
+				<view class="stockSearch-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
+					<view class="stockSearch-tit">
+						<view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view>{{item.productName}}
+					</view>
+					<view class="stockSearch-item-con flex align_center">
+						<view class="pimgs">
+							<u-image :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+						</view>
+						<view class="flex_1">
+							<view>产品编码:{{item.productCode}}</view>
+							<view class="padding_3">原厂编码:{{item.productOrigCode}}</view>
+							<view class="flex align_center justify_between">
+								<view class="font_13">
+									可用数量:
+									<u-count-to :end-val="item.currentStockQty ? item.currentStockQty : 0" separator="," font-size="26"></u-count-to>个
+								</view>
+								<view class="font_13">
+									库存成本:
+									¥<u-count-to :end-val="item.currentStockCost ? item.currentStockCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
+								</view>
+							</view>
+						</view>
+					</view>
+				</view>
+				<view v-if="listData && listData.length == 0">
+					<u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
+				</view>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import { stockList, stockCount } from '@/api/stock'
+	export default{
+		data(){
+			return {
+				totalData: null,
+				totalNum: 0,
+				listData: [],
+				pageNo: 1,
+				pageSize: 6,
+				params: {},
+				noDataText: '暂无数据',
+				theme: ''
+			}
+		},
+		onLoad(option) {
+			this.theme = getApp().globalData.theme
+			this.params = option.data ? JSON.parse(option.data) : {}
+			this.getList()
+		},
+		methods: {
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
+				stockList(params).then(res => {
+					this.getTotal(params)
+					if (res.status == 200) {
+						if(this.pageNo>1){
+							this.listData = this.listData.concat(res.data.list || [])
+						}else{
+							this.listData = res.data.list || []
+						}
+						this.totalNum = res.data.count || 0
+					} else {
+						this.listData = []
+						this.totalNum = 0
+						this.noDataText = res.message
+					}
+				})
+			},
+			// 合计
+			getTotal (params) {
+				stockCount(params).then(res => {
+					if (res.status == 200 && res.data) {
+						this.totalData = res.data
+					} else {
+						this.totalData = null
+					}
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}
+			},
+			// 详情
+			getDetail(data){
+				uni.navigateTo({ url: "/pages/stock/detaiList?data="+JSON.stringify(data) })
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.stockSearch-wrap{
+		width: 100%;
+		height: 100vh;
+		.panel-box {
+			background-color: #ffffff;
+			padding: 20upx 0;
+			box-shadow: 3upx 2upx 6upx #eee;
+			margin-bottom: 20upx;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			.item-box{
+				text-align: center;
+				width: 33.33%;
+				border-right: 1px solid #e4e7ed;
+			}
+			.item-box:last-child{
+				border-right: none;
+			}
+		}
+		.stockSearch-con{
+			height: calc(100vh - 138upx);
+			.stockSearch-main{
+				.stockSearch-main-item{
+					background: #ffffff;
+					padding: 20upx;
+					margin-bottom: 25upx;
+					border-radius: 25upx;
+					box-shadow: 1px 1px 3px #EEEEEE;
+					.stockSearch-tit{
+						padding-bottom: 20upx;
+						border-bottom: 1px solid #e4e7ed;
+						white-space: nowrap;
+						overflow: hidden;
+						text-overflow: ellipsis;
+						.u-line{
+							display: inline-block;
+							width: 6upx;
+							height: 40upx;
+							background-color: red;
+							vertical-align: bottom;
+							margin: 0 20upx 0 10upx;
+						}
+					}
+					.stockSearch-item-con{
+						padding: 20upx 20upx 6upx;
+						font-size: 26upx;
+						.pimgs{
+							margin-right: 16upx;
+						}
+						.font_13{
+							font-size: 26upx;
+						}
+						.padding_3{
+							padding: 6upx 0;
+						}
+					}
+				}
+			}
+			
+			
+		}
+	}
+</style>