Parcourir la source

fix 重量那里增加仓库选择

ylong il y a 3 mois
Parent
commit
0bf46fa4f4
1 fichiers modifiés avec 66 ajouts et 3 suppressions
  1. 66 3
      pages/index/express/weight-modify.vue

+ 66 - 3
pages/index/express/weight-modify.vue

@@ -2,12 +2,13 @@
     <view class="container">
         <u--form ref="formRef" :model="form" :rules="rules" label-width="165px" label-position="top"
             :labelStyle="{ fontSize: '32rpx' }" errorType="toast">
+            
             <!-- 物流单号输入 -->
             <u-form-item label="" prop="packageCode">
                 <u-input :placeholderStyle="placeholderStyle" :customStyle="customStyle" v-model="form.packageCode"
                     placeholder="扫描/输入物流单号" border="surround" name="packageCode" />
             </u-form-item>
-
+            
             <!-- 重量输入 -->
             <u-form-item label="重量(kg)" prop="actualWeight">
                 <u-input :placeholderStyle="placeholderStyle" :customStyle="customStyle" v-model="form.actualWeight"
@@ -48,10 +49,13 @@ const customStyle = reactive({
 })
 
 const formRef = ref(null);
+const selectedWarehouse = ref('');
+const showSelector = ref(false);
 const form = ref({
     "packageCode": "",
     "batchNum": "",
     "godownId": '',
+    "godownName": '',
     "otherInfo": "",
     "actualWeight": '',
     "imgUrlList": []
@@ -67,9 +71,26 @@ const rules = {
         required: true,
         message: '请输入重量',
         trigger: 'blur'
+    }],
+    godownId: [{
+        required: true,
+        message: '请选择仓库',
+        trigger: 'blur'
     }]
 };
 
+
+//获取用户绑定的仓库
+function getUserBindWarehouse() {
+    uni.$u.http.get('/app/appUser/getUserBindGodown').then(res => {
+        if (res.code == 200) {
+            selectedWarehouse.value = res.data?.godownName || ''
+            form.value.godownId = res.data?.id || ''
+            form.value.godownName = res.data?.godownName || ''
+        }
+    })
+}
+
 function scanCode() {
     uni.scanCode({
         success: (res) => {
@@ -87,10 +108,10 @@ function submitForm() {
             uni.$u.http.post('/app/ordersign/changeWeight', form.value).then(res => {
                 if (res.code == 200) {
                     uni.$u.toast('重量修改成功')
-                    let text = code + '已提交审核'
+                    let text = form.value.packageCode + '已提交审核'
                     uni.$u.ttsModule.speak(text)
                 } else {
-                    let text = code + '订单不存在'
+                    let text = form.value.packageCode + '订单不存在'
                     uni.$u.ttsModule.speak(text)
                 }
             })
@@ -104,6 +125,10 @@ const { unregister } = uni.$u.useEventListener((e) => {
 });
 // #endif
 
+onLoad(() => {
+    getUserBindWarehouse()
+})
+
 onUnmounted(() => {
     // #ifdef APP-PLUS
     unregister();
@@ -122,4 +147,42 @@ page {
     flex-direction: column;
     padding: 20px;
 }
+
+.input-group {
+    display: flex;
+    gap: 10px;
+    margin-bottom: 30rpx;
+}
+
+.input-group :deep(.u-button) {
+    width: 160rpx
+}
+
+.input-group .u-input {
+    background-color: #fff;
+}
+
+.fixed-bottom {
+    position: fixed;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    display: flex;
+    gap: 20rpx;
+    padding: 20rpx;
+    background-color: white;
+    border-top: 1px solid #eee;
+}
+
+.scan-button {
+    flex: 1;
+    background-color: #ff9500 !important;
+    border-color: #ff9500 !important;
+}
+
+.submit-button {
+    flex: 1;
+    background-color: #52c41a !important;
+    border-color: #52c41a !important;
+}
 </style>