Browse Source

库位绑定

Lzw 1 tháng trước cách đây
mục cha
commit
c7e7908e5b
2 tập tin đã thay đổi với 55 bổ sung107 xóa
  1. 20 59
      src/pages/waybillNo/waybillNo.vue
  2. 35 48
      src/pages/waybillNo/waybillNoHistory.vue

+ 20 - 59
src/pages/waybillNo/waybillNo.vue

@@ -42,14 +42,14 @@
     <view class="history">
       <view class="item" v-for="(item, i) in waybillNoHistory.slice(0, 5)" :key="i">
         <view>
-          <view>
-            <text class="type">库位</text>
+          <view class="mb-10">
+            <text>库位: </text>
             <text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{
               item.space
             }}</text>
           </view>
-          <view>
-            <text class="type">单号</text>
+          <view class="mb-10">
+            <text class="type">单号: </text>
             <text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{
               item.code
             }}</text>
@@ -73,16 +73,6 @@
       </view>
     </view>
 
-    <!-- <uni-popup ref="historypopup" type="bottom">
-      <view class="history">
-        <view class="title">历史</view>
-        <view class="item" v-for="(item, i) in waybillNoHistory" :key="i">
-          <view class="type">库位</view>
-          <view class="code">{{ item.space }}</view>
-        </view>
-      </view>
-    </uni-popup> -->
-
     <uni-popup ref="messageRef" type="message">
       <uni-popup-message
         :type="messageType"
@@ -222,16 +212,16 @@ const onsubmit = async () => {
       messageText.value = res.msg
       messageRef.value.open()
 
-      // const historyItem = {
-      //   code: valiFormData.value.code,
-      //   createTime: new Date(),
-      //   type: '运单号',
-      //   space: space.text,
-      //   status: false,
-      // }
-      // waybillNoHistory.value.unshift(historyItem)
-      // uni.setStorageSync('waybillNoHistory', waybillNoHistory.value)
-      // getHistory()
+      const historyItem = {
+        code: valiFormData.value.code,
+        createTime: new Date(),
+        type: '运单号',
+        space: space.text,
+        status: false,
+      }
+      waybillNoHistory.value.unshift(historyItem)
+      uni.setStorageSync('waybillNoHistory', waybillNoHistory.value)
+      getHistory()
     }
     st = setTimeout(() => {
       reset()
@@ -307,17 +297,12 @@ onBackPress(() => {
 })
 onShow(() => {
   hidePage.value = false
-  // token.value = uni.getStorageSync('token')
   getOptions()
   getHistory()
 })
 
 // 获取选项
 const getOptions = async () => {
-  // 1 调用services定义的方法 获取选项数据
-  // 2 判断获取的数据是否成功,code === 1
-  // 3 如果成功,将数据赋值给options.space数组中
-
   const res = await waybillNoOptions()
   if (res.code === 1) {
     for (let key in res.data.space_id) {
@@ -327,29 +312,6 @@ const getOptions = async () => {
       }
     }
   }
-  /**
-  uni.request({
-    url: 'url',
-    method: 'GET',
-    header: {
-      // batoken: token.value,
-    },
-    success: (res: any) => {
-      console.log(res)
-      if (res.code === 1) {
-        for (let key in res.data.space_id) {
-          // eslint-disable-next-line no-prototype-builtins
-          if (res.data.space_id.hasOwnProperty(key)) {
-            options.space.push({ text: res.data.space_id[key], value: key })
-          }
-        }
-      }
-    },
-    fail(e) {
-      console.log('fail--', e)
-    },
-  })
-     */
 }
 
 const setFocus = () => {
@@ -430,21 +392,20 @@ button {
     font-weight: 600;
   }
 
-  // .type {
-  //   padding-right: 20rpx;
-  //   font-size: 24rpx;
-  // }
-
   .code {
     font-weight: 600;
   }
 
+  .mb-10 {
+    margin-bottom: 4px;
+  }
   .item {
     padding: 20rpx;
     font-size: 20rpx;
     color: #666;
-    // display: flex;
-    // flex-direction: row;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
 
     .status {
       padding-left: 20rpx;

+ 35 - 48
src/pages/waybillNo/waybillNoHistory.vue

@@ -1,59 +1,49 @@
 <template>
   <view class="history">
     <view class="item" v-for="(item, i) in waybillNoHistory" :key="i">
-      <!-- <text class="type">库位</text>
-      <text clsaa="code" :style="{ color: item.status ? 'green' : '#666' }">{{ item.space }}</text>
       <view>
-        <text class="type">单号</text>
-        <text class="code" ;style="{color : item.status ? 'green' : '#666'}">{{ item.code }}</text>
+        <view class="mb-10">
+          <text class="type">库位: </text>
+          <text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{
+            item.space
+          }}</text>
+        </view>
+        <view class="mb-10">
+          <text class="type">单号: </text>
+          <text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{
+            item.code
+          }}</text>
+        </view>
+        <view class="space-time">
+          <text>
+            {{ item.createTime }}
+          </text>
+        </view>
       </view>
-      <view class="space-time">
-        <text>
-          {{ item.createTime }}
-        </text>
+      <view>
+        <uni-icons
+          v-if="item.status"
+          type="checkmarkempty"
+          class="status"
+          size="16"
+          color="green"
+        ></uni-icons>
+        <text class="status fail" v-else>F</text>
       </view>
     </view>
-  </view>
-
-  <view v-if="waybillNoHistory.length === 0" class="is-empty">暂无历史</view>
-  <view class="history">
-    <view class="title">历史运单号</view>
-    <view v-for="(item, index) in waybillNoHistory" :key="index" class="item">
-      <view class="type">运单号:</view>
-      <view class="code">{{ item }}</view>
-      <view class="status">
-        <text class="fail">已失效</text>
-      </view>---><text class="code" :style="{ color: item.status ? 'green' : '#666' }">
-        {{ item.orderNum }}
-        <text v-if="item.batch_text"> 单号 {{ item.batch_text }}</text>
-        <text v-if="item.space"> 库位 {{ item.space }}</text>
-        {{ item.type }}
-      </text>
-      <uni-icons
-        v-if="item.status"
-        type="checkmarkempty"
-        class="status"
-        size="16"
-        color="green"
-      ></uni-icons>
-      <text class="status fail" v-else>F</text>
-      <text style="margin-left: 10rpx; font-weight: 300">
-        {{ '\r\n' + item.createTime }}
-      </text>
-    </view>
     <view v-if="waybillNoHistory.length === 0" class="is-empty">暂无历史</view>
   </view>
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from 'vue'
+import { ref } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 const waybillNoHistory = ref([] as any[])
-const getHistory = async () => {
+const getHistory = () => {
   waybillNoHistory.value = uni.getStorageSync('waybillNoHistory')
 }
-onLoad(async () => {
-  await getHistory()
+onLoad(() => {
+  getHistory()
 })
 </script>
 
@@ -70,22 +60,19 @@ onLoad(async () => {
     font-weight: 600;
   }
 
-  .type {
-    padding-right: 20rpx;
-    font-size: 24rpx;
-  }
-
   .code {
     font-weight: 600;
   }
-
+  .mb-10 {
+    margin-bottom: 4px;
+  }
   .item {
     padding: 20rpx;
     font-size: 20rpx;
     color: #666;
-    // display: flex;
+    display: flex;
     flex-direction: row;
-
+    align-items: center;
     .status {
       padding-left: 20rpx;
     }