Browse Source

代码优化

Hello小健 2 weeks ago
parent
commit
220f8c8b60

+ 1 - 1
src/pages.json

@@ -196,7 +196,7 @@
       }
     },
     {
-      "path": "pages/waybillNo/waybillNoHistory",
+      "path": "pages/waybillNo/logList",
       "style": {
         "navigationBarTitleText": "库位历史"
       }

+ 11 - 0
src/pages/printer/printer.vue

@@ -410,6 +410,7 @@ onNavigationBarButtonTap((event) => {
     height: 35px;
     width: 50%;
     margin-left: 10px;
+    font-size: 24rpx;
   }
 
   .uni-icons {
@@ -417,6 +418,16 @@ onNavigationBarButtonTap((event) => {
   }
 }
 
+.uni-popup {
+  button {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    height: 35px;
+    font-size: 24rpx;
+  }
+}
+
 .history {
   display: flex;
   width: 100%;

+ 4 - 1
src/pages/scanLotno/scanLotno.vue

@@ -452,9 +452,12 @@ onNavigationBarButtonTap((event) => {
   }
 
   button {
+    display: flex;
+    align-items: center;
+    justify-content: center;
     height: 35px;
     font-size: 24rpx;
-    margin-left: 10rpx;
+    margin-left: 20rpx;
   }
 }
 

+ 1 - 0
src/pages/warehouseScan/warehouseScan.vue

@@ -263,6 +263,7 @@ onNavigationBarButtonTap((event) => {
     height: 35px;
     width: 50%;
     margin-left: 10px;
+    font-size: 24rpx;
   }
 
   .uni-icons {

+ 0 - 0
src/pages/waybillNo/waybillNoHistory.vue → src/pages/waybillNo/logList.vue


+ 17 - 64
src/pages/waybillNo/waybillNo.vue

@@ -30,7 +30,7 @@
       </view>
     </uni-forms>
     <view class="button-group">
-      <button type="info" @click="reset">重置</button>
+      <button type="default" @click="reset">重置</button>
       <button type="primary" @click="onsubmit" :loading="loading">
         <uni-icons v-if="!loading" type="checkmarkempty" size="18" color="white"></uni-icons>
         提交
@@ -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"
@@ -114,7 +104,6 @@ const waybillNoHistory = ref([] as any)
 const messageRef = ref()
 const messageType = ref()
 const messageText = ref()
-const historyPopup = ref()
 let st: any
 
 const valiFormData = ref({
@@ -157,7 +146,6 @@ const scanInput = async () => {
 const reset = () => {
   loading.value = false
   valiFormData.value.code = ''
-  // editSpaceNo.value && (valiFormData.value.space_id = '');
 }
 
 const submitSpace = () => {
@@ -201,7 +189,6 @@ const onsubmit = async () => {
     })
     loading.value = false
     const space = options.space.find((item: any) => item.value === valiFormData.value.space_id)
-    console.log('res--', res)
 
     if (res.code == 1) {
       messageType.value = 'success'
@@ -222,16 +209,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()
@@ -256,7 +243,6 @@ const getHistory = () => {
   waybillNoHistory.value = uni.getStorageSync('waybillNoHistory') || []
 }
 const keypress = (e: any) => {
-  console.log(e, '按键码')
   // 102  左侧    103  右侧   104  中间按键
   if (e.keyCode === 102 || e.keyCode === 103 || e.keyCode === 104) {
     //这里按键成功
@@ -264,7 +250,6 @@ const keypress = (e: any) => {
 
   if (e.keyCode == 66) {
     //enter按键
-    //这里input已经拿到数据了,在这里把拿到的数据,通过接口数据联调起来
     onsubmit()
   }
 }
@@ -307,17 +292,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 +307,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 = () => {
@@ -365,7 +322,7 @@ const setFocus = () => {
 onNavigationBarButtonTap((event) => {
   if (event.index === 0) {
     uni.navigateTo({
-      url: '/pages/waybillNo/waybillNoHistory',
+      url: '/pages/waybillNo/logList',
     })
   }
 })
@@ -389,7 +346,7 @@ button {
   justify-content: center;
   height: 35px;
   margin-left: 20rpx;
-  font-size: 16rpx;
+  font-size: 24rpx;
 }
 
 .weight-tip {
@@ -410,7 +367,7 @@ button {
     height: 35px;
     width: 50%;
     margin-left: 10px;
-    font-size: 16rpx;
+    font-size: 24rpx;
   }
 
   .uni-icons {
@@ -430,11 +387,6 @@ button {
     font-weight: 600;
   }
 
-  // .type {
-  //   padding-right: 20rpx;
-  //   font-size: 24rpx;
-  // }
-
   .code {
     font-weight: 600;
   }
@@ -443,8 +395,9 @@ button {
     padding: 20rpx;
     font-size: 20rpx;
     color: #666;
-    // display: flex;
-    // flex-direction: row;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
 
     .status {
       padding-left: 20rpx;

+ 0 - 92
src/pages/waybillNo/waybillNoLog.vue

@@ -1,92 +0,0 @@
-<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>
-      <view class="space-time">
-        <text>
-          {{ item.createTime }}
-        </text>
-      </view>
-    </view>
-    }
-    <text> class="status fail" v-else>F</text>
-  </view>
-  <view v-if="waybillNoHistory.length === 0" class="is-empty">暂无历史</view>
-</template>
-
-<template>
-  <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>
-    </view></view
-  >
-</template>
-
-<script setup lang="ts">
-import { reactive, ref } from 'vue'
-import { onLoad } from '@dcloudio/uni-app'
-const waybillNoHistory = ref([])
-const getHistory = async () => {
-  waybillNoHistory.value = await uni.getStorageSync('waybillNoHistory')
-}
-onLoad(async () => {
-  await getHistory()
-})
-</script>
-
-<style lang="scss" scoped>
-.history {
-  display: flex;
-  width: 100%;
-  flex-direction: column;
-  justify-items: start;
-
-  .title {
-    padding: 20rpx;
-    font-size: 24rpx;
-    font-weight: 600;
-  }
-
-  .type {
-    padding-right: 20rpx;
-    font-size: 24rpx;
-  }
-
-  .code {
-    font-weight: 600;
-  }
-
-  .item {
-    padding: 20rpx;
-    font-size: 20rpx;
-    color: #666;
-    display: flex;
-    flex-direction: row;
-
-    .status {
-      padding-left: 20rpx;
-    }
-
-    .fail {
-      font-weight: 600;
-      color: #f00;
-    }
-  }
-
-  .is-empty {
-    text-align: center;
-    margin: 40px 0;
-    color: #999;
-  }
-}
-</style>

+ 1 - 1
src/pages/weigh/weigh.vue

@@ -900,7 +900,7 @@ const closePreview = () => {
     height: 35px;
     width: 50%;
     margin-left: 10px;
-    font-size: 16rpx;
+    font-size: 24rpx;
   }
 
   .uni-icons {