Bladeren bron

库存列表、出入库明细列表

chenrui 3 jaren geleden
bovenliggende
commit
0bec01f9f2
5 gewijzigde bestanden met toevoegingen van 153 en 95 verwijderingen
  1. 22 0
      api/stock.js
  2. 7 0
      pages.json
  3. 113 92
      pages/stock/detaiList.vue
  4. 3 3
      pages/stock/stockSearch.vue
  5. 8 0
      pages/stock/warehouseDetail.vue

+ 22 - 0
api/stock.js

@@ -18,4 +18,26 @@ export const stockCount = (params) => {
     data: params,
     method: 'post'
   })
+}
+//  库存 详情列表  分页
+export const stockDetailList = (params) => {
+  const url = `stock/detail/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  库存流水(出入库明细) 列表  有分页
+export const stockFlowList = (params) => {
+  const url = `stockFlow/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
 }

+ 7 - 0
pages.json

@@ -185,6 +185,13 @@
 				"navigationBarTitleText": "库存详情",
 				"enablePullDownRefresh": false
 			}
+		},
+		{
+			"path": "pages/stock/warehouseDetail", // 出入库明细详情
+			"style": {
+				"navigationBarTitleText": "出入库明细",
+				"enablePullDownRefresh": false
+			}
 		}
     ],
 	"globalStyle": {

+ 113 - 92
pages/stock/detaiList.vue

@@ -1,45 +1,58 @@
 <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 class="type-box">
+				<u-subsection @change="sectionChange" mode="subsection" height="60" :list="list" :current="curNow" :active-color="$config('primaryColor')"></u-subsection>
 			</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 class="st-detailList-info">
+				<view class="st-detailList-tit">
+					<view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view>{{stockInfo&&stockInfo.productName ? stockInfo.productName : '--'}}
+				</view>
+				<view class="st-detailList-info-con flex align_center">
+					<view class="pimgs">
+						<u-image :src="stockInfo&&stockInfo.product&&stockInfo&&stockInfo.product.productMsg?stockInfo&&stockInfo.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+					</view>
+					<view class="flex_1">
+						<view>产品编码:{{stockInfo&&stockInfo.productCode ? stockInfo.productCode : '--'}}</view>
+						<view class="padding_3">原厂编码:{{stockInfo&&stockInfo.productOrigCode ? stockInfo.productOrigCode : '--'}}</view>
+						<view class="flex align_center justify_between">
+							<view class="font_13">
+								可用数量:
+								<u-count-to :end-val="stockInfo&&stockInfo.currentStockQty ? stockInfo&&stockInfo.currentStockQty : 0" separator="," font-size="26"></u-count-to>个
+							</view>
+							<view class="font_13">
+								库存成本:
+								¥<u-count-to :end-val="stockInfo&&stockInfo.currentStockCost ? stockInfo&&stockInfo.currentStockCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
+							</view>
+						</view>
+					</view>
+				</view>
 			</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 v-if="curNow==0" class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
+					<view class="flex align_center justify_between margin-b20">
+						<view :style="{color: $config('infoColor')}">{{item.putTime || '--'}}</view>
+						<u-tag :text="item.putBizTypeDictValue" :border-color="$config('primaryColor')" shape="circle" size="mini" />
 					</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 class="flex align_center justify_between">
+						<view v-if="item.warehouseName || item.warehouseLocationName">{{item.warehouseName}} > {{item.warehouseLocationName}}</view>
+						<view v-else>--</view>
+						<view>¥{{item.putCost}} * {{item.currentQty}}{{item.productUnit}}</view>
+					</view>
+				</view>
+				<!-- 出入库明细 -->
+				<view v-if="curNow==1" class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
+					<view class="flex align_center justify_between margin-b20">
+						<view :style="{color: $config('infoColor')}">{{item.auditTime || '--'}}</view>
+						<u-tag :text="item.bizTypeDictValue" :border-color="$config('primaryColor')" shape="circle" size="mini" />
+					</view>
+					<view class="flex align_center justify_between">
+						<view>{{item.unitName || '--'}}</view>
+						<view :style="{color: item.flowType=='PUT' ? 'green':'red'}"><text v-if="item.qty!=0">{{ item.flowType=='PUT' ? '+':'-' }}</text>{{ item.qty }}{{item.productUnit}}</view>
 					</view>
 				</view>
 				<view v-if="listData && listData.length == 0">
@@ -51,23 +64,28 @@
 </template>
 
 <script>
-	import { stockList, stockCount } from '@/api/stock'
+	import { stockDetailList, stockFlowList } from '@/api/stock'
 	export default{
 		data(){
 			return {
+				list: [
+					{ name: '库存详情' },
+					{ name: '出入库明细' }
+				],
 				totalData: null,
 				totalNum: 0,
 				listData: [],
 				pageNo: 1,
-				pageSize: 6,
-				params: {},
+				pageSize: 10,
+				stockInfo: null,
 				noDataText: '暂无数据',
+				curNow: 0,
 				theme: ''
 			}
 		},
 		onLoad(option) {
 			this.theme = getApp().globalData.theme
-			this.params = option.data ? JSON.parse(option.data) : {}
+			this.stockInfo = option.data ? JSON.parse(option.data) : null
 			this.getList()
 		},
 		methods: {
@@ -77,9 +95,13 @@
 				if (pageNo) {
 					this.pageNo = pageNo
 				}
-				let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
-				stockList(params).then(res => {
-					this.getTotal(params)
+				let url = stockDetailList
+				if(this.curNow == 0){  // 库存详情
+					url = stockDetailList
+				}else if(this.curNow == 1){  // 出入库明细
+					url = stockFlowList
+				}
+				url({ pageNo: this.pageNo, pageSize: this.pageSize }).then(res => {
 					if (res.status == 200) {
 						if(this.pageNo>1){
 							this.listData = this.listData.concat(res.data.list || [])
@@ -94,16 +116,6 @@
 					}
 				})
 			},
-			// 合计
-			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){
@@ -113,7 +125,15 @@
 			},
 			// 详情
 			getDetail(data){
-				uni.navigateTo({ url: "/pages/stock/detaiList?data="+JSON.stringify(data) })
+				if(this.curNow == 0){  // 库存详情
+					uni.navigateTo({ url: "/pages/stock/stockDetail?productData="+JSON.stringify(this.stockInfo)+"&data="+JSON.stringify(data) })
+				}else if(this.curNow == 1){  // 出入库明细
+					uni.navigateTo({ url: "/pages/stock/warehouseDetail?productData="+JSON.stringify(this.stockInfo)+"&data="+JSON.stringify(data) })
+				}
+			},
+			sectionChange(index) {
+				this.curNow = index
+				this.getList(1)
 			}
 		}
 	}
@@ -125,62 +145,63 @@
 		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;
+			.type-box{
+				margin: 0 auto 20upx;
+				width: 65%;
 			}
-			.item-box:last-child{
-				border-right: none;
+			.st-detailList-info{
+				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-info-con{
+					padding: 20upx 20upx 6upx;
+					font-size: 26upx;
+					.pimgs{
+						margin-right: 16upx;
+					}
+					.font_13{
+						font-size: 26upx;
+					}
+					.padding_3{
+						padding: 6upx 0;
+					}
+				}
 			}
 		}
 		.st-detailList-con{
-			height: calc(100vh - 138upx);
+			height: calc(100vh - 356upx);
 			.st-detailList-main{
 				.st-detailList-main-item{
-					background: #ffffff;
-					padding: 20upx;
-					margin-bottom: 25upx;
+					background-color: #fff;
+					margin: 0 20upx 10upx;
 					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;
-						}
+					padding: 20upx 20upx;
+					.margin-b20{
+						margin-bottom: 20upx;
 					}
 				}
 			}
 			
-			
 		}
 	}
 </style>

+ 3 - 3
pages/stock/stockSearch.vue

@@ -27,12 +27,12 @@
 							<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>产品编码:{{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>
+									<u-count-to :end-val="item.currentStockQty ? item.currentStockQty : 0" separator="," font-size="26"></u-count-to>{{item.productUnit}}
 								</view>
 								<view class="font_13">
 									库存成本:

+ 8 - 0
pages/stock/warehouseDetail.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>