Lzw 2 週間 前
コミット
a5785750ba

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

@@ -42,12 +42,6 @@ const categoryList = ref<CategoryItem[]>([
     icon: '/static/home/dispatch.png',
     name: '派送单',
   },
-  {
-    colors: ['#4facfe', '#00f2fe'],
-    target: '/pages/waybillDeliveryOrder/waybillDeliveryOrder',
-    icon: '/static/home/dispatch.png',
-    name: '派送单',
-  },
 ])
 </script>
 

+ 82 - 48
src/pages/waybillNo/waybillNo.vue

@@ -184,47 +184,70 @@ const onsubmit = async () => {
   if (valiFormData.value.space_id && valiFormData.value.code) {
     st && clearTimeout(st)
     loading.value = true
-    const res = await addWaybillNo({
-      code: valiFormData.value.code,
-      space_id: valiFormData.value.space_id,
-    })
-    loading.value = false
-    // const space = options.space.find((item: any) => item.value === valiFormData.value.space_id)
+    // uni.request({
+    //   url: addWaybillNoURL
+    //   method:'post',
+    //   header:{
+    //     batoken:token.value
+    //   },
+    //   data: {
+    //     code: valiFormData.value.code,
+    //     space_id: valiFormData.value.space_id,
+    //   },
+    // success: (res : any) => {
+
+    //     loading.value = false;
+    const space = options.space.find((item: any) => item.value === valiFormData.value.space_id)
     if (res.data.code == 1) {
       messageType.value = 'success'
       messageText.value = res.data.msg
       messageRef.value.open()
-      // const historyItem = {
-      //   code: valiFormData.value.code,
-      //   createTime: new Date(),
-      //   type: '运单号',
-      //   space: space.text,
-      //   status: true,
-      // }
-      // waybillNoHistory.value.unshift(historyItem)
-      // uni.setStorageSync('waybillNoHistory', waybillNoHistory.value)
-      // getHistory()
-    } else {
-      messageType.value = 'error'
-      messageText.value = res.data.msg
-      messageRef.value.open()
+      const historyItem = {
+        code: valiFormData.value.code,
+        createTime: new Date(),
+        type: '运单号',
+        space: space.text,
+        status: true,
+      }
+      const res = await addWaybillNo({
+        code: valiFormData.value.code,
+        space_id: valiFormData.value.space_id,
+      })
+      loading.value = false
+      // const space = options.space.find((item: any) => item.value === valiFormData.value.space_id)
+      if (res.data.code == 1) {
+        const historyItem = {
+          code: valiFormData.value.code,
+          createTime: new Date(),
+          type: '运单号',
+          space: space.text,
+          status: true,
+        }
+        waybillNoHistory.value.unshift(historyItem)
+        uni.setStorageSync('waybillNoHistory', waybillNoHistory.value)
+        getHistory()
+      } else {
+        messageType.value = 'error'
+        messageText.value = res.data.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()
+        setFocus()
+        st && clearTimeout(st)
+      }, 1000)
     }
-    st = setTimeout(() => {
-      reset()
-      setFocus()
-      st && clearTimeout(st)
-    }, 1000)
   } else {
     if (!valiFormData.value.space_id) {
       messageType.value = 'error'
@@ -239,9 +262,9 @@ const onsubmit = async () => {
   }
 }
 
-// const getHistory = () => {
-//   waybillNoHistory.value = uni.getStorageSync('waybillNoHistory') || []
-// }
+const getHistory = () => {
+  waybillNoHistory.value = uni.getStorageSync('waybillNoHistory') || []
+}
 const keypress = (e: any) => {
   console.log(e, '按键码')
   // 102  左侧    103  右侧   104  中间按键
@@ -299,17 +322,28 @@ onShow(() => {
   // getHistory()
 })
 
-const getOptions = async () => {
-  const res = await waybillNoOptions()
-  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 })
+const getOptions = () => {
+  uni.request({
+    url: waybillNoOptions,
+    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 = () => {

+ 26 - 41
src/pages/waybillNo/waybillNoLog.vue

@@ -17,13 +17,23 @@
         </text>
       </view>
     </view>
-    <view>
-      <uni-iconsn v-if="item.status" type="checkmarkempty" class="statis" size="16" color="green">
-      </uni-iconsn>
-      <text> class="status fail" v-else>F</text>
-    </view>
-    <view v-if="waybillNoHistory.length === 0" class="is-empty">暂无历史</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">
@@ -84,40 +94,15 @@ onLoad(async () => {
   }
 }
 </style>
-
-<!-- <template>
+<template>
   <view class="history">
     <view class="title">历史运单号</view>
-    <view class="item" v-for="(item, index) in waybillNoHistory" :key="index">
-      <view class="type">{{ item.type }}</view>
-      <view class="code">{{ item.code }}</view>
-  text-align: center;
-export default Vue.extend({
-  components: {},
-  data() {
-    return {}
-  },
-  computed: {},
-  methods: {},
-  watch: {},
-
-  // 页面周期函数--监听页面加载
-  onLoad() {},
-  // 页面周期函数--监听页面初次渲染完成
-  onReady() {},
-  // 页面周期函数--监听页面显示(not-nvue)
-  onShow() {},
-  // 页面周期函数--监听页面隐藏
-  onHide() {},
-  // 页面周期函数--监听页面卸载
-  onUnload() {},
-  // 页面处理函数--监听用户下拉动作
-  // onPullDownRefresh() { uni.stopPullDownRefresh(); },
-  // 页面处理函数--监听用户上拉触底
-  // onReachBottom() {},
-  // 页面处理函数--监听页面滚动(not-nvue)
-  // onPageScroll(event) {},
-  // 页面处理函数--用户点击右上角分享
-  // onShareAppMessage(options) {},
-})
-</script> -->
+    <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>