浏览代码

新增库存查询页面

chenrui 3 月之前
父节点
当前提交
c8f05f9991
共有 6 个文件被更改,包括 257 次插入13 次删除
  1. 11 0
      api/stock.js
  2. 8 3
      pages.json
  3. 1 1
      pages/sales/gather.vue
  4. 1 1
      pages/sales/index.vue
  5. 22 8
      pages/stock/index.vue
  6. 214 0
      pages/stock/stockSearchGroup.vue

+ 11 - 0
api/stock.js

@@ -60,4 +60,15 @@ export const stockByProductSn = (params) => {
     data: params,
     method: 'post'
   })
+}
+
+export const stockQueryLinkPage = (params) => {
+  const url = `stock/queryLinkPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
 }

+ 8 - 3
pages.json

@@ -310,6 +310,13 @@
 				"enablePullDownRefresh": false
 			}
 		},
+		{
+			"path": "pages/stock/stockSearchGroup", // 连锁库存查询
+			"style": {
+				"navigationBarTitleText": "库存查询",
+				"enablePullDownRefresh": false
+			}
+		},
 		{
 			"path": "pages/stock/detaiList", // 库存详情列表
 			"style": {
@@ -718,8 +725,7 @@
         }
         ,{
             "path" : "pages/batchShelves/searchProduct",
-            "style" :                                                                                    
-            {
+            "style" :{
                 "navigationBarTitleText": "产品编码搜索",
                 "enablePullDownRefresh": false,
 				"app-plus":{
@@ -737,7 +743,6 @@
 					}
 				}
             }
-            
         }
         ,{
             "path" : "pages/batchShelves/cartList",

+ 1 - 1
pages/sales/gather.vue

@@ -41,7 +41,7 @@
 		methods:{
 			getList() {
 				getLookUpDatas({
-					lookupCode: 'OFFLINE_SETTLE_STYLE',
+					lookupCode: 'SETTLE_STYLE',
 					pageNo: 1,
 					pageSize: 1000
 				}).then(result => {

+ 1 - 1
pages/sales/index.vue

@@ -153,7 +153,7 @@
 			// 获取数据字典
 			this.getListLookUp();
 			// 获取支付,收款方式
-			this.getLookUpList('OFFLINE_SETTLE_STYLE', 'vuex_paymentTypeList');
+			this.getLookUpList('SETTLE_STYLE', 'vuex_paymentTypeList');
 			// 获取单据来源
 			this.getLookUpList('SALES_SOURCE', 'vuex_salesSourceList');
 			// 获取产品状态

+ 22 - 8
pages/stock/index.vue

@@ -23,13 +23,16 @@
 				<u-form-item label="产品名称"><u-input v-model.trim="form.productName" placeholder="请输入产品名称" input-align="right" /></u-form-item>
 				<u-form-item label="产品品牌"><u-input v-model="brandName" @click="brandModal=true" clearable @clear="brandClean" type="select" placeholder="请选择产品品牌" input-align="right" /></u-form-item>
 				<u-form-item label="产品分类"><u-input v-model="productTypeNameArr" @click="showTypeModal=true" clearable @clear="typeClean" type="select" placeholder="请选择产品分类" input-align="right" /></u-form-item>
-				<u-form-item label="滞销天数">
-					<u-input type="number" :min="0" :max="999999" v-model.trim="form.minUnsalableDays" placeholder="起始天数" input-align="left" />
-					<text style="display: block;text-align: center;line-height: 32px;">至</text>
-					<u-input type="number" :min="0" :max="999999" v-model.trim="form.maxUnsalableDays" placeholder="截止天数" input-align="right" />
-				</u-form-item>
-				<u-form-item label="只查看有库存"><u-switch slot="right" v-model="form.zeroQtyFlag"></u-switch></u-form-item>
-				<u-form-item label="包括禁用产品"><u-switch slot="right" v-model="form.enableFlag"></u-switch></u-form-item>
+				<template v-if="!form.lockFlag">
+					<u-form-item label="滞销天数">
+						<u-input type="number" :min="0" :max="999999" v-model.trim="form.minUnsalableDays" placeholder="起始天数" input-align="left" />
+						<text style="display: block;text-align: center;line-height: 32px;">至</text>
+						<u-input type="number" :min="0" :max="999999" v-model.trim="form.maxUnsalableDays" placeholder="截止天数" input-align="right" />
+					</u-form-item>
+					<u-form-item label="只查看有库存"><u-switch slot="right" v-model="form.zeroQtyFlag"></u-switch></u-form-item>
+					<u-form-item label="包括禁用产品"><u-switch slot="right" v-model="form.enableFlag"></u-switch></u-form-item>
+				</template>
+				<u-form-item label="连锁组"><u-switch slot="right" v-model="form.lockFlag"></u-switch></u-form-item>
 			</u-form>
 			<view class="form-footer-btn">
 				<u-button size="medium" shape="circle" hover-class="none" @click="handleClean">清空</u-button>
@@ -61,6 +64,7 @@
 					productTypeSn2: undefined, //  产品分类2
 					productTypeSn3: undefined, //  产品分类3
 					zeroQtyFlag: false ,//  库存情况
+					lockFlag:false,//连锁组
 					enableFlag: true, // 显示禁用产品
 					minUnsalableDays: undefined, // 滞销天数最小值
 					maxUnsalableDays: undefined // 滞销天数最大值
@@ -110,6 +114,10 @@
 			},
 			// 校验滞销天数数值范围
 			checkValueRange () {
+			  if(this.form.lockFlag&&(!this.form.productCode||this.form.productCode&&this.form.productCode.length==0)){
+				 this.$message('请输入产品编码!')
+				 return false
+			  }
 			  const a =	!this.form.minUnsalableDays
 			  const b = !this.form.maxUnsalableDays
 			  
@@ -155,6 +163,7 @@
 				this.form.productTypeSn1 = undefined
 				this.form.productTypeSn2 = undefined
 				this.form.productTypeSn3 = undefined
+				this.form.lockFlag = false
 				this.form.zeroQtyFlag = false
 				this.form.minUnsalableDays = undefined // 滞销天数最小值
 				this.form.maxUnsalableDays = undefined // 滞销天数最大值
@@ -166,7 +175,12 @@
 					let params = JSON.parse(JSON.stringify(this.form))
 					params.zeroQtyFlag = params.zeroQtyFlag ? '0' : ''
 					params.enableFlag = params.enableFlag ? '' : '1'
-					uni.navigateTo({ url: "/pages/stock/stockSearch?data="+JSON.stringify(params) })
+					if(params.lockFlag){
+						uni.navigateTo({ url: "/pages/stock/stockSearchGroup?data="+JSON.stringify(params) })
+					}else{
+						uni.navigateTo({ url: "/pages/stock/stockSearch?data="+JSON.stringify(params) })
+					}
+					
 				}
 			},
 			// 选择品牌

+ 214 - 0
pages/stock/stockSearchGroup.vue

@@ -0,0 +1,214 @@
+<template>
+	<view class="stockSearch-wrap">
+		<!-- 查询结果 -->
+		<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">
+					<view class="stockSearch-tit flex">
+						<view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view>
+						<view class="u-name">
+							{{item.productEntity?item.productEntity.name?item.productEntity.name:'--':'--'}}
+						</view>
+						<view class="u-last" v-if="item.productEntity">
+							<copyText :text="item.productEntity.name" label="产品名称"></copyText>
+						</view>
+					</view>
+					<view class="stockSearch-item-con flex align_center">
+						<view class="pimgs" v-if="item.productEntity">
+							<u-image :src="item.productEntity.productMsg?item.productEntity.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+						</view>
+						<view class="flex_1" v-if="item.productEntity">
+							<view>产品编码:{{item.productEntity.code || '--'}} <copyText :text="item.productEntity.code" label="产品编码"></copyText></view>
+							<view class="padding_3">原厂编码:{{item.productEntity.origCode && item.productEntity.origCode !== ' '? item.productEntity.origCode : '--'}}</view>
+						</view>
+					</view>
+					<view class="stockSearch-item-footer flex align_center">
+						<view class="font_13" v-if="$hasPermissions('M_showCostPrice_mobile')">
+								门店名称
+								<view class="u-line-1">{{item.dealerName}}</view>
+							</view>
+						<view class="font_13">
+							可用库存数量
+							<view>{{toThousands(item.currentStockQty||0)}}{{item.productEntity?item.productEntity.unit?item.productEntity.unit:'--':'--'}}</view>
+						</view>
+					</view>
+				</view>
+				<view v-if="listData&&listData.length==0">
+					<u-empty v-if="status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" mode="list" :margin-top="50"></u-empty>
+				</view>
+				<view style="padding: 20upx;" v-if="totalNum>pageSize || status=='loading'">
+					<u-loadmore :status="status" />
+				</view>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import { toThousands } from '@/libs/tools'
+	import { stockQueryLinkPage } from '@/api/stock'
+	import copyText from '@/pages/common/copyText.vue'
+	export default{
+		components:{copyText},
+		data(){
+			return {
+				totalData: null,
+				totalNum: 0,
+				status: 'loading',
+				listData: [],
+				pageNo: 1,
+				pageSize: 50,
+				params: {},
+				noDataText: '暂无数据',
+				theme: '',
+				toThousands
+			}
+		},
+		onLoad(option) {
+			this.theme = getApp().globalData.theme
+			this.params = option.data ? JSON.parse(option.data) : {}
+			this.getList()
+		},
+		methods: {
+			// 格式化滞销天数为几个月零几天
+			num (val) {
+			  let days
+			  if (val != null && val != undefined) {
+			    if (val >= 30) {
+			      const a = Math.floor(val / 30)
+			      const b = val - a * 30
+			      if (b > 0) {
+			        days = a + '个月' + b + '天'
+			      } else {
+			        days = a + '个月'
+			      }
+			    } else {
+			      days = val + '天'
+			    }
+			  } else {
+			    days = '--'
+			  }
+			  return days
+			},
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				this.status = 'loading'
+				let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
+				stockQueryLinkPage(params).then(res => {
+					if(res.status == 200){
+						let list = res.data.list
+						if (list && list.length){
+							// 分页 拼接数据
+							if (_this.pageNo != 1) {
+								_this.listData = _this.listData ? _this.listData.concat(list) : list
+							} else {
+								_this.listData = list
+							}
+							this.totalNum = res.data.count
+							if (_this.listData.length == res.data.count) {
+								_this.status = 'nomore'
+							} else {
+								_this.status = 'loadmore'
+							}
+						} else {
+							_this.listData = list || []
+							this.totalNum = 0
+							_this.status = 'nomore'
+						}
+						_this.noDataText = '暂无配件'
+					}else{
+						_this.status = 'loadmore'
+						_this.listData = []
+						_this.totalNum = 0
+						_this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
+					}
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}else{
+					this.status = "nomore"
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.stockSearch-wrap{
+		width: 100%;
+		height: 100vh;
+		.stockSearch-con{
+			height: calc(100vh - 138upx);
+			.stockSearch-main{
+				padding-top:25upx;
+				.stockSearch-main-item{
+					background: #ffffff;
+					padding: 20upx;
+					margin: 25upx;
+					border-radius: 20upx;
+					box-shadow: 1px 1px 3px #EEEEEE;
+					&:first-child{
+						margin-top: 0;
+					}
+					.stockSearch-tit{
+						padding-bottom: 20upx;
+						border-bottom: 1px solid #e4e7ed;
+						font-weight: 900;
+						// white-space: nowrap;
+						// overflow: hidden;
+						// text-overflow: ellipsis;
+						.u-line{
+							display: inline-block;
+							width: 6upx;
+							height: 30upx;
+							margin: 6upx 10upx 0 10upx;
+							border-radius: 5upx;
+						}
+						.u-name{
+							flex-grow: 1;
+							width: 80%;
+						}
+						.u-last{
+							width: 100upx;
+							text-align: center;
+						}
+					}
+					.stockSearch-item-con{
+						padding: 20upx;
+						font-size: 28upx;
+						.pimgs{
+							margin-right: 16upx;
+						}
+						.padding_3{
+							padding: 6upx 0;
+							word-break: break-all;
+						}
+					}
+					.stockSearch-item-footer{
+						border-top: 2upx solid #eee;
+						.font_13{
+							width: 50%;
+							font-size: 26upx;
+							text-align: center;
+							border-left: 2upx solid #eee;
+							padding-top: 20upx;
+							&:first-child{
+								border: 0;
+							}
+						}
+					}
+				}
+			}
+			
+			
+		}
+	}
+</style>