소스 검색

Merge branch 'zc-fix-bug' into lzw

Lzw 2 주 전
부모
커밋
d27cba4df4

+ 70 - 4
src/pages.json

@@ -86,7 +86,7 @@
       }
     },
     {
-      "path": "pages/weigh/instockLog",
+      "path": "pages/weigh/logList",
       "style": {
         "navigationBarTitleText": "录入历史"
       }
@@ -94,19 +94,79 @@
     {
       "path": "pages/warehouseScan/warehouseScan",
       "style": {
-        "navigationBarTitleText": "仓库扫描"
+        "navigationBarTitleText": "仓库扫描",
+        "app-plus": {
+          "bounce": "none",
+          "titleNView": {
+            "buttons": [
+              {
+                "fontSize": "16px",
+                "text": "历史"
+              }
+            ],
+            "backButton": {
+              "background": "#00FF00"
+            }
+          }
+        }
+      }
+    },
+    {
+      "path": "pages/warehouseScan/logList",
+      "style": {
+        "navigationBarTitleText": "录入历史"
       }
     },
     {
       "path": "pages/printer/printer",
       "style": {
-        "navigationBarTitleText": "打印"
+        "navigationBarTitleText": "打印",
+        "app-plus": {
+          "bounce": "none",
+          "titleNView": {
+            "buttons": [
+              {
+                "fontSize": "16px",
+                "text": "历史"
+              }
+            ],
+            "backButton": {
+              "background": "#00FF00"
+            }
+          }
+        }
+      }
+    },
+    {
+      "path": "pages/printer/logList",
+      "style": {
+        "navigationBarTitleText": "录入历史"
       }
     },
     {
       "path": "pages/scanLotno/scanLotno",
       "style": {
-        "navigationBarTitleText": "托盘/批次"
+        "navigationBarTitleText": "托盘/批次",
+        "app-plus": {
+          "bounce": "none",
+          "titleNView": {
+            "buttons": [
+              {
+                "fontSize": "16px",
+                "text": "历史"
+              }
+            ],
+            "backButton": {
+              "background": "#00FF00"
+            }
+          }
+        }
+      }
+    },
+    {
+      "path": "pages/scanLotno/logList",
+      "style": {
+        "navigationBarTitleText": "录入历史"
       }
     },
     {
@@ -141,6 +201,12 @@
         "navigationBarTitleText": "库位历史"
       }
     },
+    {
+      "path": "pages/pickup/waybillPickUpOrder",
+      "style": {
+        "navigationBarTitleText": "取件单"
+      }
+    },
     {
       "path": "pages/waybillDeliveryOrder/waybillDeliveryOrder",
       "style": {

+ 6 - 0
src/pages/index/index.vue

@@ -36,6 +36,12 @@ const categoryList = ref<CategoryItem[]>([
     icon: '/static/home/link.png',
     name: '库位绑定',
   },
+  {
+    colors: ['#2af598', '#009efd'],
+    target: '/pages/pickup/waybillPickUpOrder',
+    icon: '/static/home/pickup.png',
+    name: '取件单',
+  },
   {
     colors: ['#4facfe', '#00f2fe'],
     target: '/pages/waybillDeliveryOrder/waybillDeliveryOrder',

+ 2 - 2
src/pages/login/login.vue

@@ -39,7 +39,7 @@ const loginSuccess = (profile: LoginResult) => {
 // #ifdef H5
 // 传统表单登录,测试账号:13123456789 密码:123456,测试账号仅开发学习使用。
 const form = ref({
-  account: '13123456789',
+  account: 'admin',
   password: '',
   captcha: '',
 })
@@ -79,7 +79,7 @@ const onSubmit = async () => {
     username: form.value.account,
     password: form.value.password,
     captcha: form.value.captcha,
-    keep: false,
+    keep: true,
     loading: true,
     captcha_id: data.captcha_id,
   }

+ 452 - 0
src/pages/pickup/waybillPickUpOrder.vue

@@ -0,0 +1,452 @@
+<template>
+  <view class="list">
+    <!-- <uni-search-bar @confirm="search" :focus="true" v-model="searchValue" @blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear"></uni-search-bar> -->
+    <uni-easyinput
+      v-model="searchValue"
+      placeholder="请输入单号"
+      suffixIcon="scan"
+      @iconClick="scanInput"
+    />
+    <view class="item" v-for="(item, i) in waybillDelivery" :key="i" @click="itemClick(item)">
+      <view class="order-no">
+        <text> 派送单号: {{ item.order_no }} </text>
+        <image
+          @click="copyOrderNo(item.order_no)"
+          class="icon"
+          src="/static/copy.png"
+          mode="aspectFill"
+        />
+      </view>
+      <view class="address-info">
+        <view class="info">
+          <view class="user">
+            <text>
+              {{ item.address.first_name + ' ' + item.address.last_name }}
+              {{ '+' + item.address.mobile_code + ' ' + item.address.mobile }}
+            </text>
+            <image
+              @click="callPhone(item.address.mobile_code + ' ' + item.address.mobile)"
+              class="icon"
+              src="/static/call.png"
+              mode="aspectFill"
+            />
+          </view>
+          <view>
+            <text class="address">
+              <text class="city">{{ item.address.city }}</text>
+              {{ item.address.zip_code }}
+            </text>
+            <image
+              @click="copyOrderNo(item.address.zip_code)"
+              class="icon"
+              src="/static/copy.png"
+              mode="aspectFill"
+            />
+          </view>
+        </view>
+        <view class="info"></view>
+      </view>
+      <view></view>
+      <view class="operations">
+        <button
+          v-for="(operation, i) in item.operations"
+          :key="i"
+          @click="onButtonClick(item, operation.value)"
+          type="info"
+          size="mini"
+        >
+          {{ operation.text }}
+        </button>
+      </view>
+    </view>
+
+    <view v-if="waybillDelivery.length === 0" class="is-empty">暂无派送单</view>
+
+    <uni-popup ref="messageRef" type="message">
+      <uni-popup-message
+        :type="messageType"
+        :message="messageText"
+        :duration="2000"
+      ></uni-popup-message>
+    </uni-popup>
+    <uni-drawer ref="showRightRef" mode="right" :mask-click="true">
+      <scroll-view style="height: 100%" scroll-y="true">
+        <view class="button-group">
+          <button @click="resetForm" type="info">重置</button>
+          <button @click="confirmForm" type="primary">确认</button>
+        </view>
+      </scroll-view>
+    </uni-drawer>
+  </view>
+</template>
+
+<script setup lang="ts">
+import { reactive, ref } from 'vue'
+import { onLoad, onNavigationBarButtonTap } from '@dcloudio/uni-app'
+import { checkPermission } from '@/utils'
+
+let pickupWaybillDeliveryOrderURL = ''
+let sendOutURL = ''
+let deliveredURL = ''
+let refuseURL = ''
+let createTrackPodURL = ''
+let cancelFedExPickUpURL = ''
+
+const loading = ref(false)
+const loadingBtn = ref(false)
+const token = ref()
+const searchValue = ref()
+const waybillDelivery = ref([] as any)
+const messageType = ref()
+const messageText = ref()
+const messageRef = ref()
+const showRightRef = ref()
+
+const resetForm = () => {}
+const confirmForm = () => {
+  showRightRef.value.close()
+}
+
+const copyOrderNo = (order_no: string) => {
+  uni.setClipboardData({
+    data: order_no,
+    success: function () {
+      uni.showToast({
+        title: '复制成功',
+        icon: 'success',
+        duration: 2000,
+      })
+    },
+    fail: function () {
+      console.log('复制失败')
+    },
+  })
+}
+
+const callPhone = (phoneNumber: string) => {
+  console.log(phoneNumber)
+  // #ifdef APP-PLUS
+  uni.makePhoneCall({
+    phoneNumber: phoneNumber,
+    success: function () {
+      console.log('拨打电话成功!')
+    },
+    fail: function () {
+      console.log('拨打电话失败!')
+    },
+  })
+  // #endif
+
+  // #ifdef MP-WEIXIN
+  wx.makePhoneCall({
+    phoneNumber: phoneNumber,
+    success: function () {
+      console.log('拨打电话成功!')
+    },
+    fail: function () {
+      console.log('拨打电话失败!')
+    },
+  })
+  // #endif
+}
+
+const scanInput = async () => {
+  // #ifdef APP-PLUS
+  let status = await checkPermission()
+  if (status !== 1) {
+    return
+  }
+  // #endif
+  uni.scanCode({
+    success: (res: any) => {
+      // valiFormData.value.order_code = res.result;
+      // onsubmit();
+    },
+    fail: (err) => {
+      // 需要注意的是小程序扫码不需要申请相机权限
+    },
+  })
+}
+
+const itemClick = (item: any) => {
+  uni.setStorageSync('selectItem', item)
+
+  uni.navigateTo({
+    url: '/pages/waybillDeliveryOrder/orderInfo?id=' + item.id,
+  })
+}
+
+const onButtonClick = async (row: { id: any }, value: string) => {
+  if (value === 'send_out') {
+    sendOut({ id: row.id })
+  } else if (value === 'delivered') {
+    //确认送达
+    updateDelivered({ id: row.id })
+  } else if (value === 'refuse') {
+    updateRefuse({ id: row.id })
+  } else if (value === 'create_track_pod') {
+    createTrackPod({ id: row.id })
+  } else if (value === 'edit') {
+    // baTable.form.items = row;
+    // baTable.form.operate = 'edit';
+  } else if (value === 'generate_label') {
+    // baTable.form.items = row;
+    // generateLabelForm.id = row.id;
+    // generateLabelVisible.value = true;
+  } else if (value === 'fedex_appointment_pick_up') {
+    // baTable.form.items = row;
+    // baTable.form.operate = 'FedExPickUp';
+  } else if (value === 'print_get_back_label') {
+    // toPrintRetrieve(row);
+  } else if (value === 'fedex_cancel_pick_up') {
+    cancelFedExPickUp({ id: row.id })
+  }
+}
+
+const sendOut = (data: { id: any }) => {
+  loadingBtn.value = true
+  uni.request({
+    url: sendOutURL,
+    method: 'POST',
+    header: {
+      batoken: token.value,
+    },
+    data: data,
+    success: ({ data }: any) => {
+      loadingBtn.value = false
+      messageType.value = 'success'
+      messageText.value = '发出成功'
+      messageRef.value.open()
+    },
+    fail: (err) => {
+      loadingBtn.value = false
+      messageType.value = 'error'
+      messageText.value = '发出失败,请稍后重试'
+      messageRef.value.open()
+    },
+  })
+}
+
+const updateDelivered = (data: { id: any }) => {
+  loadingBtn.value = true
+  uni.request({
+    url: deliveredURL,
+    method: 'POST',
+    header: {
+      batoken: token.value,
+    },
+    data: data,
+    success: ({ data }: any) => {
+      loadingBtn.value = false
+      messageType.value = 'success'
+      messageText.value = '确认送达成功'
+      messageRef.value.open()
+    },
+    fail: (err) => {
+      loadingBtn.value = false
+      messageType.value = 'error'
+      messageText.value = '确认送达失败,请稍后重试'
+      messageRef.value.open()
+    },
+  })
+}
+
+const updateRefuse = (data: { id: any }) => {
+  loadingBtn.value = true
+  uni.request({
+    url: refuseURL,
+    method: 'POST',
+    header: {
+      batoken: token.value,
+    },
+    data: data,
+    success: ({ data }: any) => {
+      loadingBtn.value = false
+      messageType.value = 'success'
+      messageText.value = '已拒绝签收'
+      messageRef.value.open()
+    },
+    fail: (err) => {
+      loadingBtn.value = false
+      messageType.value = 'error'
+      messageText.value = '修改失败,请稍后重试'
+      messageRef.value.open()
+    },
+  })
+}
+
+const createTrackPod = (data: { id: any }) => {
+  loadingBtn.value = true
+  uni.request({
+    url: createTrackPodURL,
+    method: 'POST',
+    header: {
+      batoken: token.value,
+    },
+    data: data,
+    success: ({ data }: any) => {
+      loadingBtn.value = false
+      messageType.value = 'success'
+      messageText.value = '同步成功'
+      messageRef.value.open()
+    },
+    fail: (err) => {
+      loadingBtn.value = false
+      messageType.value = 'error'
+      messageText.value = '同步失败,请稍后重试'
+      messageRef.value.open()
+    },
+  })
+}
+
+const cancelFedExPickUp = (data: { id: any }) => {
+  loadingBtn.value = true
+  uni.request({
+    url: cancelFedExPickUpURL,
+    method: 'POST',
+    header: {
+      batoken: token.value,
+    },
+    data: data,
+    success: ({ data }: any) => {
+      loadingBtn.value = false
+      messageType.value = 'success'
+      messageText.value = '操作成功'
+      messageRef.value.open()
+    },
+    fail: (err) => {
+      loadingBtn.value = false
+      messageType.value = 'error'
+      messageText.value = '操作失败,请稍后重试'
+      messageRef.value.open()
+    },
+  })
+}
+
+const getList = () => {
+  loading.value = true
+  uni.request({
+    url: pickupWaybillDeliveryOrderURL + '/index',
+    method: 'GET',
+    header: {
+      batoken: token.value,
+    },
+    success: ({ data }: any) => {
+      loading.value = false
+      console.log(data)
+      if (data.code == 1) {
+        waybillDelivery.value = data.data.list
+      } else {
+        messageType.value = 'error'
+        messageText.value = data.msg
+        messageRef.value.open()
+      }
+    },
+    fail: (err) => {
+      loading.value = false
+    },
+  })
+}
+onLoad(() => {
+  token.value = uni.getStorageSync('token')
+  getList()
+})
+onNavigationBarButtonTap((event) => {
+  if (event.index === 0) {
+    showRightRef.value.open()
+  }
+})
+</script>
+
+<style lang="scss" scoped>
+.list {
+  margin: 0 auto;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  flex: 1;
+
+  .uni-easyinput {
+    margin-top: 20rpx;
+    width: calc(100% - 40rpx);
+  }
+
+  .item {
+    margin-top: 20rpx;
+    width: 95%;
+    box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.2);
+    border-radius: 20rpx;
+    background-color: #fff;
+
+    .order-no {
+      padding: 14rpx;
+      font-size: 16rpx;
+    }
+
+    .icon {
+      margin-left: 5rpx;
+      width: 24rpx;
+      height: 24rpx;
+    }
+
+    .address-info {
+      padding: 14rpx;
+      font-size: 16rpx;
+      margin-bottom: 10rpx;
+
+      .info {
+        display: flex;
+        flex-direction: column;
+
+        .user {
+          margin-bottom: 10rpx;
+          font-weight: bold;
+        }
+
+        .address {
+          .city {
+            font-size: 30rpx;
+            font-weight: bold;
+          }
+        }
+      }
+    }
+  }
+  .is-empty {
+    margin-top: 20rpx;
+  }
+}
+
+.operations {
+  display: flex;
+  flex-direction: row;
+  justify-content: flex-end;
+  width: 100%;
+
+  button {
+    font-size: 16rpx;
+    margin: 10rpx;
+  }
+}
+
+.button-group {
+  margin-top: 15px;
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+
+  button {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    height: 35px;
+    width: 50%;
+    margin-left: 10px;
+    font-size: 16rpx;
+  }
+
+  .uni-icons {
+    margin-right: 10px;
+  }
+}
+</style>

+ 76 - 0
src/pages/printer/logList.vue

@@ -0,0 +1,76 @@
+<template>
+  <view class="history">
+    <view class="item" v-for="(item, i) in printLogHistory" :key="i">
+      <text class="code" :style="{ color: item.status ? 'green' : '#666' }"
+        >{{ item.type }} {{ item.order_code }}</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="printLogHistory.length === 0" class="is-empty">暂无历史</view>
+  </view>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
+const printLogHistory = ref([] as any)
+const getHistory = () => {
+  printLogHistory.value = uni.getStorageSync('printLogHistory')
+}
+onLoad(() => {
+  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;
+
+    .status {
+      padding-left: 20rpx;
+    }
+
+    .fail {
+      font-weight: 600;
+      color: #f00;
+    }
+  }
+
+  .is-empty {
+    text-align: center;
+    margin: 40px 0;
+    color: #999;
+  }
+}
+</style>

+ 23 - 23
src/pages/printer/printer.vue

@@ -264,30 +264,30 @@ const printConfirm = async () => {
     messageText.value = res.msg
     messageRef.value.open()
 
-    // const historyItem = {
-    //   order_code: valiFormData.value.order_code,
-    //   createTime: new Date(),
-    //   type: type,
-    //   status: res.data.code,
-    // }
-    // printLogHistory.value.unshift(historyItem)
-    // uni.setStorageSync('printLogHistory', printLogHistory.value)
-    // getHistory()
+    const historyItem = {
+      order_code: valiFormData.value.order_code,
+      createTime: new Date(),
+      type: type,
+      status: res.code,
+    }
+    printLogHistory.value.unshift(historyItem)
+    uni.setStorageSync('printLogHistory', printLogHistory.value)
+    getHistory()
     close()
   } else {
     subLoading.value = false
     messageType.value = 'error'
     messageText.value = '打印失败'
     messageRef.value.open()
-    // const historyItem = {
-    //   order_code: valiFormData.value.order_code,
-    //   createTime: new Date(),
-    //   type: type,
-    //   status: false,
-    // }
-    // printLogHistory.value.unshift(historyItem)
-    // uni.setStorageSync('printLogHistory', printLogHistory.value)
-    // getHistory()
+    const historyItem = {
+      order_code: valiFormData.value.order_code,
+      createTime: new Date(),
+      type: type,
+      status: false,
+    }
+    printLogHistory.value.unshift(historyItem)
+    uni.setStorageSync('printLogHistory', printLogHistory.value)
+    getHistory()
     close()
   }
 }
@@ -317,9 +317,9 @@ const onsubmit = async () => {
   loading.value = false
 }
 
-// const getHistory = () => {
-//   printLogHistory.value = uni.getStorageSync('printLogHistory') || []
-// }
+const getHistory = () => {
+  printLogHistory.value = uni.getStorageSync('printLogHistory') || []
+}
 const keypress = (e: any) => {
   // 102  左侧    103  右侧   104  中间按键
   if (e.keyCode === 102 || e.keyCode === 103 || e.keyCode === 104) {
@@ -372,14 +372,14 @@ onBackPress(() => {
 
 onShow(() => {
   hidePage.value = false
-  // getHistory()
+  getHistory()
   _getPrinterList()
 })
 
 onNavigationBarButtonTap((event) => {
   if (event.index === 0) {
     uni.navigateTo({
-      url: '/pages/warehouseScan/warehouseLog',
+      url: '/pages/printer/logList',
     })
   }
 })

+ 77 - 0
src/pages/scanLotno/logList.vue

@@ -0,0 +1,77 @@
+<template>
+  <view class="history">
+    <view class="item" v-for="(item, i) in scanLotnoHistory" :key="i">
+      <text class="type">{{ item.type }}</text>
+      <text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{
+        item.orderNum
+      }}</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="scanLotnoHistory.length === 0" class="is-empty">暂无历史</view>
+  </view>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
+const scanLotnoHistory = ref([] as any)
+const getHistory = () => {
+  scanLotnoHistory.value = uni.getStorageSync('scanLotnoHistory')
+}
+onLoad(() => {
+  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;
+
+    .status {
+      padding-left: 20rpx;
+    }
+
+    .fail {
+      font-weight: 600;
+      color: #f00;
+    }
+  }
+
+  .is-empty {
+    text-align: center;
+    margin: 40px 0;
+    color: #999;
+  }
+}
+</style>

+ 28 - 28
src/pages/scanLotno/scanLotno.vue

@@ -66,11 +66,11 @@
         提交
       </button>
     </view>
-    <view v-if="lotnoLogHistory.length > 0" class="history">
+    <view v-if="scanLotnoHistory.length > 0" class="history">
       <text class="title">记录(最近5条)</text>
     </view>
     <view class="history">
-      <view class="item" v-for="(item, i) in lotnoLogHistory.slice(0, 5)" :key="i">
+      <view class="item" v-for="(item, i) in scanLotnoHistory.slice(0, 5)" :key="i">
         <text class="type">{{ item.type }}</text>
         <text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{
           item.orderNum
@@ -118,7 +118,7 @@ const hidePage = ref(false)
 const focusType = ref(true)
 const editBatchNum = ref(false)
 const editPalletNum = ref(false)
-const lotnoLogHistory = ref([] as any)
+const scanLotnoHistory = ref([] as any)
 const messageRef = ref()
 const messageType = ref()
 const messageText = ref()
@@ -157,7 +157,7 @@ const scanInput = async () => {
   uni.scanCode({
     success: (res: any) => {
       valiFormData.value.orderNum = res.result
-      // onsubmit();
+      onsubmit()
     },
     fail: (err) => {
       // 需要注意的是小程序扫码不需要申请相机权限
@@ -291,29 +291,29 @@ const onsubmit = async () => {
       // 	window.open(path, '_blank');
       // });
     }
-    // const historyItem = {
-    //   orderNum: valiFormData.value.orderNum,
-    //   createTime: new Date(),
-    //   type: valiFormData.value.batchNum ? '绑定批次' : '绑定托盘',
-    //   status: true,
-    // }
-    // console.log('lotnoLogHistory--', lotnoLogHistory)
-    // lotnoLogHistory.value.unshift(historyItem)
-    // uni.setStorageSync('lotnoLogHistory', lotnoLogHistory.value)
-    // getHistory()
+    const historyItem = {
+      orderNum: valiFormData.value.orderNum,
+      createTime: new Date(),
+      type: valiFormData.value.batchNum ? '绑定批次' : '绑定托盘',
+      status: true,
+    }
+    console.log('scanLotnoHistory--', scanLotnoHistory)
+    scanLotnoHistory.value.unshift(historyItem)
+    uni.setStorageSync('scanLotnoHistory', scanLotnoHistory.value)
+    getHistory()
   } else {
     messageType.value = 'error'
     messageText.value = res.msg
     messageRef.value.open()
-    // const historyItem = {
-    //   orderNum: valiFormData.value.orderNum,
-    //   createTime: new Date(),
-    //   type: valiFormData.value.batchNum ? '绑定批次' : '绑定托盘',
-    //   status: false,
-    // }
-    // lotnoLogHistory.value.unshift(historyItem)
-    // uni.setStorageSync('lotnoLogHistory', lotnoLogHistory.value)
-    // getHistory()
+    const historyItem = {
+      orderNum: valiFormData.value.orderNum,
+      createTime: new Date(),
+      type: valiFormData.value.batchNum ? '绑定批次' : '绑定托盘',
+      status: false,
+    }
+    scanLotnoHistory.value.unshift(historyItem)
+    uni.setStorageSync('scanLotnoHistory', scanLotnoHistory.value)
+    getHistory()
   }
   st = setTimeout(() => {
     reset()
@@ -322,9 +322,9 @@ const onsubmit = async () => {
   }, 1000)
 }
 
-// const getHistory = () => {
-//   lotnoLogHistory.value = uni.getStorageSync('lotnoLogHistory') || []
-// }
+const getHistory = () => {
+  scanLotnoHistory.value = uni.getStorageSync('scanLotnoHistory') || []
+}
 const keypress = (e: any) => {
   // 102  左侧    103  右侧   104  中间按键
   if (e.keyCode === 102 || e.keyCode === 103 || e.keyCode === 104) {
@@ -377,7 +377,7 @@ onBackPress(() => {
 onShow(() => {
   hidePage.value = false
   _getBindParams()
-  // getHistory()
+  getHistory()
 })
 const setFocus = () => {
   if (hidePage.value) {
@@ -418,7 +418,7 @@ const _getBindParams = async () => {
 onNavigationBarButtonTap((event) => {
   if (event.index === 0) {
     uni.navigateTo({
-      url: '/pages/scanLotno/lotnoLog',
+      url: '/pages/scanLotno/logList',
     })
   }
 })

+ 77 - 0
src/pages/warehouseScan/logList.vue

@@ -0,0 +1,77 @@
+<template>
+  <view class="history">
+    <view class="item" v-for="(item, i) in warehouseLogHistory" :key="i">
+      <text class="type">{{ item.type }}</text>
+      <text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{
+        item.order_code
+      }}</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="warehouseLogHistory.length === 0" class="is-empty">暂无历史</view>
+  </view>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
+const warehouseLogHistory = ref([] as any)
+const getHistory = () => {
+  warehouseLogHistory.value = uni.getStorageSync('warehouseLogHistory')
+}
+onLoad(() => {
+  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;
+
+    .status {
+      padding-left: 20rpx;
+    }
+
+    .fail {
+      font-weight: 600;
+      color: #f00;
+    }
+  }
+
+  .is-empty {
+    text-align: center;
+    margin: 40px 0;
+    color: #999;
+  }
+}
+</style>

+ 24 - 24
src/pages/warehouseScan/warehouseScan.vue

@@ -20,7 +20,7 @@
       </uni-forms-item>
     </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>
         提交
@@ -148,28 +148,28 @@ const onsubmit = async () => {
     messageText.value = res.msg
     messageRef.value.open()
 
-    // const historyItem = {
-    //   order_code: valiFormData.value.order_code,
-    //   createTime: new Date(),
-    //   type: '单据扫描',
-    //   status: true,
-    // }
-    // warehouseLogHistory.value.unshift(historyItem)
-    // uni.setStorageSync('warehouseLogHistory', warehouseLogHistory.value)
-    // getHistory()
+    const historyItem = {
+      order_code: valiFormData.value.order_code,
+      createTime: new Date(),
+      type: '单据扫描',
+      status: true,
+    }
+    warehouseLogHistory.value.unshift(historyItem)
+    uni.setStorageSync('warehouseLogHistory', warehouseLogHistory.value)
+    getHistory()
   } else {
     messageType.value = 'error'
     messageText.value = res.msg
     messageRef.value.open()
-    // const historyItem = {
-    //   order_code: valiFormData.value.order_code,
-    //   createTime: new Date(),
-    //   type: '单据扫描',
-    //   status: false,
-    // }
-    // warehouseLogHistory.value.unshift(historyItem)
-    // uni.setStorageSync('warehouseLogHistory', warehouseLogHistory.value)
-    // getHistory()
+    const historyItem = {
+      order_code: valiFormData.value.order_code,
+      createTime: new Date(),
+      type: '单据扫描',
+      status: false,
+    }
+    warehouseLogHistory.value.unshift(historyItem)
+    uni.setStorageSync('warehouseLogHistory', warehouseLogHistory.value)
+    getHistory()
   }
   st = setTimeout(() => {
     reset()
@@ -177,9 +177,9 @@ const onsubmit = async () => {
   }, 1000)
 }
 
-// const getHistory = () => {
-//   warehouseLogHistory.value = uni.getStorageSync('warehouseLogHistory') || []
-// }
+const getHistory = () => {
+  warehouseLogHistory.value = uni.getStorageSync('warehouseLogHistory') || []
+}
 const keypress = (e: any) => {
   // 102  左侧    103  右侧   104  中间按键
   if (e.keyCode === 102 || e.keyCode === 103 || e.keyCode === 104) {
@@ -232,13 +232,13 @@ onBackPress(() => {
 
 onShow(() => {
   hidePage.value = false
-  // getHistory()
+  getHistory()
 })
 
 onNavigationBarButtonTap((event) => {
   if (event.index === 0) {
     uni.navigateTo({
-      url: '/pages/warehouseScan/warehouseLog',
+      url: '/pages/warehouseScan/logList',
     })
   }
 })

+ 1 - 1
src/pages/weigh/instockLog.vue → src/pages/weigh/logList.vue

@@ -24,7 +24,7 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from 'vue'
+import { ref } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 const instockHistory = ref([] as any[])
 const getHistory = () => {

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

@@ -403,7 +403,7 @@ onHide(() => {
 onNavigationBarButtonTap((event: any) => {
   if (event.index === 0) {
     uni.navigateTo({
-      url: '/pages/weigh/instockLog',
+      url: '/pages/weigh/logList',
     })
   }
 })

+ 15 - 0
src/services/login.ts

@@ -1,5 +1,6 @@
 import type { LoginResult } from '@/types/member'
 import { http } from '@/utils/http'
+import { useMemberStore } from '@/stores'
 
 type LoginWxMinParams = {
   code: string
@@ -62,3 +63,17 @@ export const getVerifyCodeImg = (captcha_id: string) => {
     responseType: 'arraybuffer', //设置响应类型
   })
 }
+/**
+ * 刷新token
+ * @param data 请求参数
+ */
+export const refreshToken = () => {
+  const memberStore = useMemberStore()
+  const refreshToken = memberStore.profile?.refreshToken
+
+  return http<{ token: string; type: string }>({
+    method: 'POST',
+    url: '/api/common/refreshToken',
+    data: { refresh_token: refreshToken },
+  })
+}

BIN
src/static/home/pickup.png


+ 9 - 1
src/utils/http.ts

@@ -71,7 +71,15 @@ export const http = <T>(options: UniApp.RequestOptions) => {
           // 2.1 提取核心数据 res.data
           const data = res.data as Data<T>
           if (data.code === 302) {
-            // 401错误  -> 清理用户信息,跳转到登录页
+            // 未登录 -> 清理用户信息,跳转到登录页
+            console.log('未登录 -> 清理用户信息,跳转到登录页---')
+            const memberStore = useMemberStore()
+            memberStore.clearProfile()
+            uni.navigateTo({ url: '/pages/login/login' })
+            reject(res)
+          } else if (data.code === 409) {
+            // 登录态过期,刷新token
+            console.log('登录态过期,请重新登录!---')
             const memberStore = useMemberStore()
             memberStore.clearProfile()
             uni.navigateTo({ url: '/pages/login/login' })