caojunjie 2 年之前
父節點
當前提交
a69b3e814d
共有 3 個文件被更改,包括 90 次插入41 次删除
  1. 9 1
      api/views/sale/index.js
  2. 2 2
      manifest.json
  3. 79 38
      pages/views/salesSlip/selectProduct.vue

+ 9 - 1
api/views/sale/index.js

@@ -153,4 +153,12 @@ export function getStock(data) {
     method: 'post',
     data
   })
-}
+}
+//查询库存
+export function paramservice(params) {
+  return http.request({
+    url: '/blade-system/paramservice/detail',
+    method: 'get',
+    params
+  })
+}

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "易车配批发精灵",
     "appid" : "__UNI__E1B82BE",
     "description" : "",
-    "versionName" : "1.0.43",
-    "versionCode" : 43,
+    "versionName" : "1.0.44",
+    "versionCode" : 44,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 79 - 38
pages/views/salesSlip/selectProduct.vue

@@ -1,10 +1,11 @@
 <template>
 	<view class="u-wrap">
-		<view class="u-search-box">
-			<u-tabs :list="tabbar" @click="click"  lineColor="#fff" :activeStyle="{ color: '#fff' }"
-					:inactiveStyle="{ color: '#ffffff80' }">></u-tabs>
+		<view class="u-search-box">
+			<u-tabs :list="tabbar" @click="click" lineColor="#fff" :activeStyle="{ color: '#fff' }"
+				:inactiveStyle="{ color: '#ffffff80' }">></u-tabs>
 			<view style="padding: 10rpx;">
-				<u-search placeholder="请输入商品名称" :actionStyle="{ color: '#fff' }" :showAction="false" v-model="name" @change="custom"></u-search>
+				<u-search placeholder="请输入商品名称" :actionStyle="{ color: '#fff' }" :showAction="false" v-model="name"
+					@change="custom"></u-search>
 			</view>
 		</view>
 		<view class="u-menu-wrap">
@@ -36,9 +37,10 @@
 										</view>
 										<view style="color: #707070;font-size: 24rpx;">参考售价:{{itemTwo.standardPrice}}
 										</view>
-										<view style="color: #707070;font-size: 24rpx;">
-											单位:{{itemTwo.unit}}
-											<text style="margin-left: 30rpx;color: #FD4B09;">库存:{{itemTwo.stockGoods?itemTwo.stockGoods.surplusRouteQuantity:'0'}}</text>
+										<view style="color: #707070;font-size: 24rpx;">
+											单位:{{itemTwo.unit}}
+											<text
+												style="margin-left: 30rpx;color: #FD4B09;">库存:{{itemTwo.stockGoods?itemTwo.stockGoods.surplusRouteQuantity:'0'}}</text>
 										</view>
 										<view style="color: #707070;font-size: 24rpx;">分类:{{itemTwo.goodsTypeName}}
 										</view>
@@ -155,7 +157,8 @@
 		queryitemType,
 		queryCommodity,
 		secondGoodsType,
-		partsDetails
+		partsDetails,
+		paramservice
 	} from '@/api/views/sale/index.js'
 	export default {
 		data() {
@@ -184,8 +187,8 @@
 					size: 10,
 					current: 1
 				},
-				amount: 0.00,
-				dataListTwo:[]
+				amount: 0.00,
+				dataListTwo: []
 			}
 		},
 		onLoad(params) {
@@ -236,8 +239,8 @@
 					this.tabbarData = []
 					queryCommodity({
 						goodsTypeId: item.id,
-						storageId: this.mainForm.storageId, //仓库id
-						billType:"XS",
+						storageId: this.mainForm.storageId, //仓库id
+						billType: "XS",
 						...this.formTwo
 					}).then(resTwo => {
 						this.total = resTwo.data.total || []
@@ -263,8 +266,8 @@
 					});
 					queryCommodity({
 						goodsTypeId: this.tabbarData[0].id,
-						storageId: this.mainForm.storageId, //仓库id
-						billType:"XS",
+						storageId: this.mainForm.storageId, //仓库id
+						billType: "XS",
 						...this.formTwo
 					}).then(res => {
 						this.total = res.data.total || []
@@ -298,7 +301,7 @@
 				}
 				this.show = false
 				this.form.amount = (Number(this.form.price) * Number(this.form.storageInQuantity)).toFixed(2);
-				this.dataList.push(this.form)
+				this.dataList.push(this.form)
 				this.dataListTwo.push(this.form)
 			},
 			//保存并返回
@@ -320,7 +323,7 @@
 					})
 				}
 				this.form.amount = (Number(this.form.price) * Number(this.form.storageInQuantity)).toFixed(2);
-				this.dataList.push(this.form)
+				this.dataList.push(this.form)
 				this.dataListTwo.push(this.form)
 				let pages = getCurrentPages() // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
 				let prevPage = pages[pages.length - 2] //上一页页面实例
@@ -365,8 +368,8 @@
 						}
 						queryCommodity({
 							goodsTypeId: null,
-							storageId: this.mainForm.storageId, //仓库id
-						billType:"XS",
+							storageId: this.mainForm.storageId, //仓库id
+							billType: "XS",
 							...this.formTwo
 						}).then(resTwo => {
 							this.total = resTwo.data.total || []
@@ -397,8 +400,8 @@
 				});
 				queryCommodity({
 					goodsTypeId: this.tabbarTwo[index].id,
-					storageId: this.mainForm.storageId, //仓库id
-					billType:"XS",
+					storageId: this.mainForm.storageId, //仓库id
+					billType: "XS",
 					...this.formTwo
 				}).then(res => {
 					this.tabbarData = []
@@ -426,12 +429,12 @@
 				});
 				queryCommodity({
 					// goodsTypeId: this.tabbar[index].id,
-					storageId: this.mainForm.storageId, //仓库id
-						billType:"XS",
+					storageId: this.mainForm.storageId, //仓库id
+					billType: "XS",
 					...this.formTwo
 				}).then(res => {
 					this.tabbarData = []
-					this.total = res.data.total || []
+					this.total = res.data.total || []
 					this.current = 0
 					this.tabbarData.push({
 						data: res.data.records || []
@@ -443,19 +446,57 @@
 				})
 			},
 			selectProduct(item) {
-				partsDetails({
-					goodsId: item.id, //商品id
-					storageId: this.mainForm.storageId, //仓库id
+				paramservice({
+					paramKey: "burden"
 				}).then(res => {
-					this.form = res.data
-					this.form.surplusRouteQuantity = res.data.stockGoods ? res.data.stockGoods
-						.surplusRouteQuantity : 0
-					this.form.lotNo = res.data.stockGoods ? res.data.stockGoods.lotNo : ''
-					this.form.storageId = this.mainForm.storageId || ''
-					delete this.form.stockGoods
-					this.form.itemId = this.form.id
-					delete this.form.id
-					this.show = true
+					if (res.msg == "暂无承载数据") {
+						partsDetails({
+							goodsId: item.id, //商品id
+							storageId: this.mainForm.storageId, //仓库id
+						}).then(res => {
+							this.form = res.data
+							this.form.surplusRouteQuantity = res.data.stockGoods ? res.data.stockGoods
+								.surplusRouteQuantity : 0
+							this.form.lotNo = res.data.stockGoods ? res.data.stockGoods.lotNo : ''
+							this.form.storageId = this.mainForm.storageId || ''
+							delete this.form.stockGoods
+							this.form.itemId = this.form.id
+							delete this.form.id
+							this.show = true
+						})
+					} else {
+						if (res.data.paramValue == 0) {
+							if (!item.stockGoods) {
+								return uni.showToast({
+									icon: 'none',
+									title: '当前商品库存不足禁止添加',
+									position: "bottom"
+								})
+							}
+							if (item.stockGoods.surplusRouteQuantity == 0 || item.stockGoods.surplusRouteQuantity <
+								0) {
+								return uni.showToast({
+									icon: 'none',
+									title: '当前商品库存不足禁止下单',
+									position: "bottom"
+								})
+							}
+						}
+						partsDetails({
+							goodsId: item.id, //商品id
+							storageId: this.mainForm.storageId, //仓库id
+						}).then(res => {
+							this.form = res.data
+							this.form.surplusRouteQuantity = res.data.stockGoods ? res.data.stockGoods
+								.surplusRouteQuantity : 0
+							this.form.lotNo = res.data.stockGoods ? res.data.stockGoods.lotNo : ''
+							this.form.storageId = this.mainForm.storageId || ''
+							delete this.form.stockGoods
+							this.form.itemId = this.form.id
+							delete this.form.id
+							this.show = true
+						})
+					}
 				})
 			}
 		}
@@ -481,8 +522,8 @@
 	}
 
 	.u-search-box {
-		padding: 10rpx;
-		padding-top: 0;
+		padding: 10rpx;
+		padding-top: 0;
 		background-color: #FD4B09;
 	}
 
@@ -632,4 +673,4 @@
 	::v-deep .u-popup {
 		flex: 0;
 	}
-</style>
+</style>