瀏覽代碼

fix:接口调整

maliang 1 周之前
父節點
當前提交
680b094b5c

+ 9 - 1
common/mixins/blePrintMixin.js

@@ -288,7 +288,15 @@ export default {
                   content: `${obj.barCode}`,
                   rotation: TRotation.ROTATION_0,
                   codeType: TCodeType.CODE128,
-                  showType: 2,
+                  showType: 0,
+                })
+              )
+              .text(
+                new TText({
+                  x: 50,
+                  y: 30 + 100 + 5,
+                  content: `SKU-${obj.barCode}`,
+                  font: TFont.TSS16,
                 })
               )
               .print(num);

+ 1 - 1
common/request/apis/inventoryInquiry.js

@@ -14,7 +14,7 @@ export const inventoryPositionTree = (
   params,
   config = { custom: { auth: true } }
 ) => {
-  return uni.$u.http.get(`/pda/inventoryPositionTree`, config);
+  return uni.$u.http.get(`/pda/inventoryPositionTree`, { params }, config);
 };
 //分类
 export const materialCategoryTree = (

+ 11 - 1
common/store/modules/user.js

@@ -31,6 +31,10 @@ const state = {
 	helpHistory: uni.getStorageSync("helpHistory") || [], //查找帮助历史记录
 	pageParams: {},
 	cangName: uni.getStorageSync('cangName') || '-',//暂时的仓库字段
+	depotInfo: uni.getStorageSync('depotInfo') || {
+		depotName: '',
+		id: ''
+	},//暂时的仓库字段
 }
 // getters 可以获取 computer 进行动态刷新
 const getters = {
@@ -47,7 +51,8 @@ const getters = {
 	videoHistory: videoHistory => state.videoHistory,
 	helpHistory: helpHistory => state.helpHistory,
 	pageParams: pageParams => state.pageParams,
-	cangName: cangName=>state.cangName
+	cangName: cangName=>state.cangName,
+	depotInfo: cangName=>state.depotInfo,
 }
 // actions 异步数据  接口
 const actions = {
@@ -252,6 +257,11 @@ const mutations = {
 	setcangName(state,payload) {
 		state.cangName = payload;
 		uni.setStorageSync('cangName',payload)
+	},
+	// 缓存仓库信息
+	setDepotInfo(state,payload) {
+		state.depotInfo = payload;
+		uni.setStorageSync('depotInfo',payload)
 	}
 }
 

+ 9 - 1
components/scaned-pop/scaned-pop.vue

@@ -7,7 +7,7 @@
 				</view>
 				<view class="tips-value">请确认该商品出库数量</view>
 				<view class="num-box">
-						<u-number-box v-model="numberVal" :inputWidth="56" :min="0">
+						<u-number-box v-model="numberVal" :inputWidth="56" :min="min" :max="max">
 							<!-- <view slot="minus" class="minus">
 								<u-icon name="minus" color="#0256FF" size="12"></u-icon>
 							</view>
@@ -37,6 +37,14 @@
 			scanNum:{
 				type:[Number,String],
 				default:1
+			},
+			min:{
+			  type:[Number,String],
+				default:0
+			},
+			max:{
+			  type:[Number,String],
+				default:Number.MAX_SAFE_INTEGER
 			}
 		},
 		watch:{

+ 82 - 5
pages/inventory-inquiry/index.vue

@@ -7,6 +7,10 @@
       autoBack
       placeholder
     >
+      <view class="u-nav-slot btn-right" slot="right" @click="stashClick">
+        <view class="cang-name">{{ cangName }}</view>
+        <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
+      </view>
     </u-navbar>
     <view class="container_main">
       <view class="head-box">
@@ -102,6 +106,15 @@
       @confirm="pickerConfirm"
       @cancel="typeShow = false"
     ></u-picker>
+    <!-- 中心仓弹窗 -->
+    <u-picker
+      :show="stashShow"
+      keyName="label"
+      :defaultIndex="defaultIndex2"
+      :columns="stashColumns"
+      @confirm="pickerConfirm2"
+      @cancel="stashShow = false"
+    ></u-picker>
   </view>
 </template>
 
@@ -112,6 +125,7 @@ import {
   inventoryPositionTree,
   materialCategoryTree,
 } from "@/common/request/apis/inventoryInquiry";
+import { depotSpinnerList } from "@/common/request/apis/purchase";
 import goodItem from "./components/good-item.vue";
 export default {
   components: {
@@ -162,7 +176,13 @@ export default {
         categoryId: "",
         position: "",
         keyword: "",
+        depotId: "",
       },
+      // 中心仓
+      stashShow: false,
+      cangName: "",
+      stashColumns: [],
+      defaultIndex2: [],
     };
   },
   mounted() {
@@ -183,9 +203,8 @@ export default {
     // let systemInfo = uni.getSystemInfoSync();
     // let statusBarHeight = systemInfo.statusBarHeight;
     // this.offsetTop = statusBarHeight + 40
-    this.getTreeData();
     this.getMaterialCategoryTree();
-    this.loadData();
+    this.getDepotSpinnerList();
   },
   onShow() {
     uni.$on("scanFinish", (data) => {
@@ -200,12 +219,30 @@ export default {
     uni.$off("scanFinish");
   },
   methods: {
+    getDepotSpinnerList() {
+      depotSpinnerList().then((res) => {
+        if (res.code == 200) {
+          this.stashColumns = [res.data];
+          this.cangName = res.data[0].label;
+          this.queryParams.depotId = res.data[0].value;
+          this.$store.commit("setcangName", this.cangName);
+          this.$store.commit("setDepotInfo", {
+            depotName: res.data[0].label,
+            id: res.data[0].value,
+          });
+          this.loadData();
+          this.getTreeData();
+        }
+      });
+    },
     scanCode() {
       this.$scan.scanCode();
     },
     async getTreeData() {
       try {
-        const res = await inventoryPositionTree();
+        const res = await inventoryPositionTree({
+          depotId: this.queryParams.depotId,
+        });
         console.log("res=====", res);
         this.treeData = res.data;
       } catch (error) {}
@@ -244,8 +281,8 @@ export default {
         const pageSize = this.pageSize;
         const params = {
           ...this.queryParams,
-					currentPage,
-					pageSize,
+          currentPage,
+          pageSize,
         };
         const res = await inventoryInquiry(params);
         console.log("inventoryInquiry====", params);
@@ -305,11 +342,51 @@ export default {
       }
       this.typeShow = false;
     },
+    stashClick() {
+      this.defaultIndex2 = this.getDefaultIndex(
+        this.cangName,
+        this.stashColumns
+      );
+      this.stashShow = true;
+    },
+    pickerConfirm2(val) {
+      console.log("pickerConfirm2======", val);
+      this.cangName = val.value[0].label;
+      this.queryParams.depotId = val.value[0].value;
+      this.stashShow = false;
+      this.$store.commit("setcangName", this.cangName);
+      this.$store.commit("setDepotInfo", {
+        depotName: val.value[0].label,
+        id: val.value[0].value,
+      });
+      this.queryParams.position = "";
+      this.getTreeData();
+      this.onRefresh();
+    },
+    // 获取picker默认index
+    getDefaultIndex(val, list) {
+      let arr = [];
+      let index = list[0].findIndex((item) => item.label == val);
+      arr = [index];
+      return arr;
+    },
   },
 };
 </script>
 
 <style lang="scss" scoped>
+.btn-right {
+  display: flex;
+  align-items: center;
+  .cang-name {
+    color: #0256ff;
+    text-align: center;
+    font-family: "PingFang SC";
+    font-size: 28rpx;
+    font-weight: 600;
+    margin-right: 10rpx;
+  }
+}
 .inventory-page {
   min-height: 100vh;
   background: #f0f6fb;

+ 3 - 1
pages/inventory-task/components/inventoryFilterPopup.vue

@@ -197,6 +197,7 @@ import {
 } from "@/common/request/apis/inventoryTask";
 import { inventoryPositionTree } from "@/common/request/apis/inventoryInquiry";
 import { goodsInventoryStatus } from "../utils/index.js";
+import { mapGetters } from "vuex";
 export default {
   name: "InventoryFilterPopup",
   props: {
@@ -302,6 +303,7 @@ export default {
     locationContentList() {
       return this.locationTree[this.currentLocationIndex]?.children || [];
     },
+    ...mapGetters(["depotInfo"]),
   },
   watch: {
     taskId: {
@@ -313,7 +315,7 @@ export default {
             this.userOptions = res.data;
           });
           //库存
-          inventoryPositionTree().then((res) => {
+          inventoryPositionTree({ depotId: this.depotInfo.id }).then((res) => {
             console.log("res=====", res);
             this.locationTree = res.data;
           });

+ 75 - 1
pages/inventory-task/index.vue

@@ -1,6 +1,10 @@
 <template>
   <view class="check-page">
     <u-navbar height="40px" title="盘点" bgColor="#fff" autoBack placeholder>
+      <view class="u-nav-slot btn-right" slot="right" @click="stashClick">
+        <view class="cang-name">{{ cangName }}</view>
+        <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
+      </view>
     </u-navbar>
     <view class="container_main">
       <u-sticky :offsetTop="offsetTop" bgColor="#fff">
@@ -61,6 +65,15 @@
       @confirm="submit"
       :content="actionPop.errorText"
     ></error-pop>
+    <!-- 中心仓弹窗 -->
+    <u-picker
+      :show="stashShow"
+      keyName="label"
+      :defaultIndex="defaultIndex2"
+      :columns="stashColumns"
+      @confirm="pickerConfirm2"
+      @cancel="stashShow = false"
+    ></u-picker>
   </view>
 </template>
 
@@ -75,6 +88,7 @@ import {
   taskStocktakingDetail,
 } from "@/common/request/apis/inventoryTask";
 import { taskStatusList } from "../inventory-task/utils/index.js";
+import { depotSpinnerList } from "@/common/request/apis/purchase";
 
 export default {
   components: {
@@ -88,6 +102,7 @@ export default {
       query: {
         number: "",
         status: "",
+        depotId: "",
       },
       currentPage: 1,
       pageSize: 10,
@@ -103,6 +118,11 @@ export default {
       },
       startTaskId: null,
       toStock: false, //是否跳转盘点
+      // 中心仓
+      stashShow: false,
+      cangName: "",
+      stashColumns: [],
+      defaultIndex2: [],
     };
   },
   onLoad() {
@@ -110,7 +130,7 @@ export default {
     let statusBarHeight = systemInfo.statusBarHeight;
     this.offsetTop = statusBarHeight + 40;
     // 初始化数据
-    this.loadData();
+    this.getDepotSpinnerList();
   },
   onShow() {
     if (this.startTaskId) {
@@ -128,6 +148,21 @@ export default {
     this.onLoadMore();
   },
   methods: {
+    getDepotSpinnerList() {
+      depotSpinnerList().then((res) => {
+        if (res.code == 200) {
+          this.stashColumns = [res.data];
+          this.cangName = res.data[0].label;
+          this.query.depotId = res.data[0].value;
+          this.$store.commit("setcangName", this.cangName);
+          this.$store.commit("setDepotInfo", {
+            depotName: res.data[0].label,
+            id: res.data[0].value,
+          });
+          this.loadData();
+        }
+      });
+    },
     async onRefresh() {
       try {
         await this.loadData(true);
@@ -159,6 +194,7 @@ export default {
           pageSize,
           ...this.query,
         };
+        console.log("params=====", params);
         const res = await taskStocktakingList(params);
         const { rows, total } = res.data;
         this.list = [...this.list, ...rows];
@@ -249,11 +285,49 @@ export default {
         }
       }
     },
+    stashClick() {
+      this.defaultIndex2 = this.getDefaultIndex(
+        this.cangName,
+        this.stashColumns
+      );
+      this.stashShow = true;
+    },
+    pickerConfirm2(val) {
+      console.log("pickerConfirm2======", val);
+      this.cangName = val.value[0].label;
+      this.query.depotId = val.value[0].value;
+      this.stashShow = false;
+      this.$store.commit("setcangName", this.cangName);
+      this.$store.commit("setDepotInfo", {
+        depotName: val.value[0].label,
+        id: val.value[0].value,
+      });
+      this.onRefresh();
+    },
+    // 获取picker默认index
+    getDefaultIndex(val, list) {
+      let arr = [];
+      let index = list[0].findIndex((item) => item.label == val);
+      arr = [index];
+      return arr;
+    },
   },
 };
 </script>
 
 <style lang="scss" scoped>
+.btn-right {
+  display: flex;
+  align-items: center;
+  .cang-name {
+    color: #0256ff;
+    text-align: center;
+    font-family: "PingFang SC";
+    font-size: 28rpx;
+    font-weight: 600;
+    margin-right: 10rpx;
+  }
+}
 .check-page {
   min-height: 100vh;
   background-color: #f0f6fb;

+ 3 - 1
pages/picking-task/delivery.vue

@@ -120,7 +120,7 @@
 		<error-pop v-model="errorShow" @close="errorShow = false" @confirm="confirm" :content="popText.errorText"></error-pop>
 		<success-pop v-model="successShow" @close="successShow = false" @backClick="backClick" :content="popText.successText"></success-pop>
 		<!-- 扫码之后弹窗 -->
-		<scaned-pop v-if="scanedShow" v-model="scanedShow" :scanNum="scanNum" @close="scanedShow = false" @confirm="scanConfirm"></scaned-pop>
+		<scaned-pop v-if="scanedShow" v-model="scanedShow" :scanNum="scanNum" :max="scanMaxNum" @close="scanedShow = false" @confirm="scanConfirm"></scaned-pop>
 		
 		<goods-pop v-model="goodsShow" @close="goodsShow = false"></goods-pop>
 		<!-- 打印条码弹框 -->
@@ -176,6 +176,7 @@
 				voucherPicture:'',
 				scanIndex:-1,
 				scanNum:1,
+				scanMaxNum: 0,
 				status: null
 			}
 		},
@@ -228,6 +229,7 @@
 				if(index == -1) return uni.$u.toast("该货物不属于该任务");
 				this.scanIndex = index
 				this.scanNum = this.goodsList[index].materialNumber
+				this.scanMaxNum = this.goodsList[index].inventory
 				this.scanedShow = true
 			})
 		},

+ 8 - 0
pages/picking-task/index.vue

@@ -137,6 +137,10 @@
 						this.stashColumns = [res.data]
 						this.cangName = res.data[0].label
 						this.$store.commit('setcangName', this.cangName)
+						this.$store.commit("setDepotInfo", {
+							depotName: res.data[0].label,
+							id: res.data[0].value,
+						});
 					}
 				})
 			},
@@ -189,6 +193,10 @@
 				this.cangName = val.value[0].label
 				this.stashShow = false
 				this.$store.commit('setcangName', this.cangName)
+				this.$store.commit("setDepotInfo", {
+					depotName: val.value[0].label,
+					id: val.value[0].value,
+				});
 			},
 			statusConfirm(val) {
 				this.type1 = val.value[0].label

+ 8 - 0
pages/purchase/index.vue

@@ -136,6 +136,10 @@
 						this.stashColumns = [res.data]
 						this.cangName = res.data[0].label
 						this.$store.commit('setcangName', this.cangName)
+						this.$store.commit("setDepotInfo", {
+							depotName: res.data[0].label,
+							id: res.data[0].value,
+						});
 					}
 				})
 			},
@@ -200,6 +204,10 @@
 				this.cangName = val.value[0].label
 				this.stashShow = false
 				this.$store.commit('setcangName', this.cangName)
+				this.$store.commit("setDepotInfo", {
+					depotName: val.value[0].label,
+					id: val.value[0].value,
+				});
 			},
 			statusConfirm(val) {
 				this.type1 = val.value[0].label