|
@@ -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 = () => {
|