|
@@ -73,6 +73,16 @@
|
|
</view>
|
|
</view>
|
|
</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 ref="messageRef" type="message">
|
|
<uni-popup-message
|
|
<uni-popup-message
|
|
:type="messageType"
|
|
:type="messageType"
|
|
@@ -104,6 +114,7 @@ const waybillNoHistory = ref([] as any)
|
|
const messageRef = ref()
|
|
const messageRef = ref()
|
|
const messageType = ref()
|
|
const messageType = ref()
|
|
const messageText = ref()
|
|
const messageText = ref()
|
|
|
|
+const historyPopup = ref()
|
|
let st: any
|
|
let st: any
|
|
|
|
|
|
const valiFormData = ref({
|
|
const valiFormData = ref({
|
|
@@ -184,23 +195,17 @@ const onsubmit = async () => {
|
|
if (valiFormData.value.space_id && valiFormData.value.code) {
|
|
if (valiFormData.value.space_id && valiFormData.value.code) {
|
|
st && clearTimeout(st)
|
|
st && clearTimeout(st)
|
|
loading.value = true
|
|
loading.value = true
|
|
- // 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 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)
|
|
const space = options.space.find((item: any) => item.value === valiFormData.value.space_id)
|
|
- if (res.data.code == 1) {
|
|
|
|
|
|
+ console.log('res--', res)
|
|
|
|
+
|
|
|
|
+ if (res.code == 1) {
|
|
messageType.value = 'success'
|
|
messageType.value = 'success'
|
|
- messageText.value = res.data.msg
|
|
|
|
|
|
+ messageText.value = res.msg
|
|
messageRef.value.open()
|
|
messageRef.value.open()
|
|
const historyItem = {
|
|
const historyItem = {
|
|
code: valiFormData.value.code,
|
|
code: valiFormData.value.code,
|
|
@@ -209,45 +214,30 @@ const onsubmit = async () => {
|
|
space: space.text,
|
|
space: space.text,
|
|
status: true,
|
|
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()
|
|
|
|
- }
|
|
|
|
- st = setTimeout(() => {
|
|
|
|
- reset()
|
|
|
|
- setFocus()
|
|
|
|
- st && clearTimeout(st)
|
|
|
|
- }, 1000)
|
|
|
|
|
|
+ waybillNoHistory.value.unshift(historyItem)
|
|
|
|
+ uni.setStorageSync('waybillNoHistory', waybillNoHistory.value)
|
|
|
|
+ getHistory()
|
|
|
|
+ } else {
|
|
|
|
+ messageType.value = 'error'
|
|
|
|
+ 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()
|
|
}
|
|
}
|
|
|
|
+ st = setTimeout(() => {
|
|
|
|
+ reset()
|
|
|
|
+ setFocus()
|
|
|
|
+ st && clearTimeout(st)
|
|
|
|
+ }, 1000)
|
|
} else {
|
|
} else {
|
|
if (!valiFormData.value.space_id) {
|
|
if (!valiFormData.value.space_id) {
|
|
messageType.value = 'error'
|
|
messageType.value = 'error'
|
|
@@ -319,12 +309,27 @@ onShow(() => {
|
|
hidePage.value = false
|
|
hidePage.value = false
|
|
// token.value = uni.getStorageSync('token')
|
|
// token.value = uni.getStorageSync('token')
|
|
getOptions()
|
|
getOptions()
|
|
- // getHistory()
|
|
|
|
|
|
+ getHistory()
|
|
})
|
|
})
|
|
|
|
|
|
-const getOptions = () => {
|
|
|
|
|
|
+// 获取选项
|
|
|
|
+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) {
|
|
|
|
+ // 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 })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
uni.request({
|
|
uni.request({
|
|
- url: waybillNoOptions,
|
|
|
|
|
|
+ url: 'url',
|
|
method: 'GET',
|
|
method: 'GET',
|
|
header: {
|
|
header: {
|
|
// batoken: token.value,
|
|
// batoken: token.value,
|
|
@@ -344,6 +349,7 @@ const getOptions = () => {
|
|
console.log('fail--', e)
|
|
console.log('fail--', e)
|
|
},
|
|
},
|
|
})
|
|
})
|
|
|
|
+ */
|
|
}
|
|
}
|
|
|
|
|
|
const setFocus = () => {
|
|
const setFocus = () => {
|
|
@@ -359,7 +365,7 @@ const setFocus = () => {
|
|
onNavigationBarButtonTap((event) => {
|
|
onNavigationBarButtonTap((event) => {
|
|
if (event.index === 0) {
|
|
if (event.index === 0) {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url: '/pages/waybillNo/waybillNoLog',
|
|
|
|
|
|
+ url: '/pages/waybillNo/waybillNoHistory',
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -424,10 +430,10 @@ button {
|
|
font-weight: 600;
|
|
font-weight: 600;
|
|
}
|
|
}
|
|
|
|
|
|
- .type {
|
|
|
|
- padding-right: 20rpx;
|
|
|
|
- font-size: 24rpx;
|
|
|
|
- }
|
|
|
|
|
|
+ // .type {
|
|
|
|
+ // padding-right: 20rpx;
|
|
|
|
+ // font-size: 24rpx;
|
|
|
|
+ // }
|
|
|
|
|
|
.code {
|
|
.code {
|
|
font-weight: 600;
|
|
font-weight: 600;
|
|
@@ -437,8 +443,8 @@ button {
|
|
padding: 20rpx;
|
|
padding: 20rpx;
|
|
font-size: 20rpx;
|
|
font-size: 20rpx;
|
|
color: #666;
|
|
color: #666;
|
|
- display: flex;
|
|
|
|
- flex-direction: row;
|
|
|
|
|
|
+ // display: flex;
|
|
|
|
+ // flex-direction: row;
|
|
|
|
|
|
.status {
|
|
.status {
|
|
padding-left: 20rpx;
|
|
padding-left: 20rpx;
|