diff --git a/pages.json b/pages.json index 5234d2a..c012f99 100644 --- a/pages.json +++ b/pages.json @@ -351,6 +351,30 @@ "bounce": "none" } } + }, + { + "path" : "pages/documentary/history", + "style" : + { + "navigationStyle": "custom", + "enablePullDownRefresh": false, + "disableScroll": true, + "app-plus": { + "bounce": "none" + } + } + }, + { + "path" : "pages/Delivery/Delivery", + "style" : + { + "navigationStyle": "custom", + "enablePullDownRefresh": false, + "disableScroll": true, + "app-plus": { + "bounce": "none" + } + } } ], "globalStyle": { diff --git a/pages/Delivery/Delivery.vue b/pages/Delivery/Delivery.vue new file mode 100644 index 0000000..c04aad0 --- /dev/null +++ b/pages/Delivery/Delivery.vue @@ -0,0 +1,665 @@ + + + + + + + + + + + + + + + + + + + + + + + 面料/颜色 + 谁定/做单人/归属人匹数/米数 + 工厂 + 状态 + + + + + + + + {{itemSecond.mz}}{{itemSecond.sh}} + + + + + + + {{item.sd}}/{{item.makeUser}}/{{item.belongTo}}{{itemSecond.xxs.length}}匹/{{computing(itemSecond.xxs)}}米 + + + + + {{item.rc}} + + + {{item.status}} + {{item.processes.processes.find(l=>!l.id)?.name}} + + + + + + + + + + + + + + + + + 取消 + + + 提交 + + + + + + + + + + + + + + + + + + + + 请选择品种 + + + + + + + ↑ + ↓ + + + + + + + + + \ No newline at end of file diff --git a/pages/documentary/detail.vue b/pages/documentary/detail.vue index bb6ca1a..32ae0b6 100644 --- a/pages/documentary/detail.vue +++ b/pages/documentary/detail.vue @@ -293,7 +293,7 @@ subId: itemList.value.subId, trackingLogId: itemList.value.id, details: { - zt: indexData.value + 2 === processes.value.processes.length ? '待出厂' : status.value, + zt: status.value == processes.value.processes[processes.value.processes.length-1].name ? '待出厂' : status.value, list: list.value, form: form.value, }, diff --git a/pages/documentary/documentary.vue b/pages/documentary/documentary.vue index d7694fa..b029a31 100644 --- a/pages/documentary/documentary.vue +++ b/pages/documentary/documentary.vue @@ -90,16 +90,34 @@ getAction('/tracking', { page: currentPage.value, size: 10, ...form.value }).then((res : any) => { if (res.code === 200) { res.data.record.forEach((l : any) => { + let a=[] + l.logs.forEach((l:any)=>{ + if(l.details.trackingLog){ + a=a.concat(l.details.trackingLog) + } + a.push(l) + }) + l={...l.trackingLog,logs:a} if (isValidJSON(l.craftComment)) { l.craftComment = JSON.parse(l.craftComment) } if (l.zt === '待进厂') { + l.zcts=0 l.butonColor = butonColor.value[0] } else if (l.zt === '待出厂') { + l.jcrq=l.logs[0].details.form.czrq + l.ccrq=l.logs[0].details.form.yjccts?addDaysToDate(l.jcrq,Number(l.logs[0].details.form.yjccts)):'' + l.zcts=dateDiffInDays(l.logs[0].createTime,new Date()) l.butonColor = butonColor.value[1] } else if (l.zt === '已出厂') { + l.jcrq=l.logs[0].details.form.czrq + l.ccrq=l.logs[0].details.form.yjccts?addDaysToDate(l.jcrq,Number(l.logs[0].details.form.yjccts)):'' + l.zcts=dateDiffInDays(l.logs[0].createTime,l.logs[l.logs.length-1].createTime) l.butonColor = butonColor.value[2] } else { + l.jcrq=l.logs[0].details.form.czrq + l.ccrq=l.logs[0].details.form.yjccts?addDaysToDate(l.jcrq,Number(l.logs[0].details.form.yjccts)):'' + l.zcts=dateDiffInDays(l.logs[0].createTime,new Date()) l.butonColor = butonColor.value[getRandomIntInclusive(3, 14)] } list.value.push(l) @@ -111,6 +129,34 @@ } }) } + //日期差 + function dateDiffInDays(date1:any, date2:any) { + // 将日期字符串转换为 Date 对象 + const dt1 = new Date(date1); + const dt2 = new Date(date2); + + // 计算时间差(以毫秒为单位) + const timeDifference = dt2 - dt1; + + // 将时间差转换为天数 + const daysDifference = timeDifference / (1000 * 3600 * 24); + + // 返回绝对值,因为结果可能是负数,取决于哪个日期更早 + return Math.abs(Math.round(daysDifference)); + } + function addDaysToDate(date:any, days:any) { + // 将传入的 date 转换为 Date 对象 + const result = new Date(date); + + // 设置时间为0点,以避免时区影响 + result.setHours(0, 0, 0, 0); + + // 增加天数 + result.setDate(result.getDate() + days); + + // 返回新的日期 + return formatDate(result); + } function getRandomIntInclusive(min, max) { min = Math.ceil(min); @@ -156,7 +202,7 @@ const handleOpen = () => { if (typeData.value === 'factory') { popuList.value = factory.value - } else if (typeData.value === 'status') { + } else if (typeData.value === 'zt') { popuList.value = [{ text: '待进厂', value: '待进厂' }, { text: '进行中', value: '进行中' }, { text: '待出厂', value: '待出厂' }, { text: '已出厂', value: '已出厂' }] } else { popuList.value = nameList.value @@ -261,10 +307,23 @@ const submit = () => { if (!dataItem.value.yjccts) return showToast('请填写预计出厂天数!') - dataItem.value.zt = itemList.value.status - postAction('/tracking', { orderId: itemList.value.id, type: itemList.value.type, data: dataItem.value, status: '等待' }).then((res : any) => { + let data = { + subId: itemList.value.subId, + trackingLogId: itemList.value.id, + details: { + zt: '等待', + list: [], + form: { + czrq:dataItem.value.jcrq, + yjccts:dataItem.value.yjccts, + gdy:dataItem.value.gdy, + }, + }, + } + postAction('/tracking', data).then((res : any) => { if (res.code === 200) { showDialog.value = false + itemList.value.zt='等待' showToast('更新成功!') } }) @@ -283,6 +342,13 @@ uni.navigateTo({ url:'./ex-factory?item='+JSON.stringify(item) }) + }else if(item.zt==='已出厂'){ + uni.navigateTo({ + url:'./history?item='+JSON.stringify(item) + }) + }else if(item.zt==='待进厂'){ + showDialog.value = true + itemList.value=item }else{ uni.navigateTo({ url:'./detail?item='+JSON.stringify(item) @@ -319,8 +385,8 @@ - + 面料/颜色 @@ -330,31 +396,41 @@ - - - - - {{itemSecond.mz}}{{itemSecond.sh}} + + + + + + {{itemSecond.mz}}{{itemSecond.sh}} + - - - - - {{item.sd}}/{{item.makeUser}}/{{item.belongTo}}{{itemSecond.xxs.length}}匹/{{computing(itemSecond.xxs)}}米 + + + + {{item.sd}}/{{item.makeUser}}/{{item.belongTo}}{{itemSecond.xxs.length}}匹/{{computing(itemSecond.xxs)}}米 + + + {{item.craft}}{{item.craftCmt.name?item.craftCmt.name:''}} + + + {{item.zt}} + - - {{item.craft}}{{item.craftCmt.name?item.craftCmt.name:''}} + + 在厂天数:{{item.zcts}}天 + + 进厂:{{item.jcrq}} + + 预计:{{item.ccrq}} + - - {{item.zt}} - - + diff --git a/pages/documentary/ex-factory.vue b/pages/documentary/ex-factory.vue index 4e74c95..132fc69 100644 --- a/pages/documentary/ex-factory.vue +++ b/pages/documentary/ex-factory.vue @@ -2,7 +2,7 @@ import { onLoad } from '@dcloudio/uni-app'; import { showToast } from 'vant'; import { ref } from 'vue'; - import { getAction, uploadAction } from '../../common/http'; + import { getAction, postAction, uploadAction } from '../../common/http'; import { formatDate } from '../../utils/date'; // 定义 props defineProps<{ @@ -13,6 +13,7 @@ const processes = ref({} as any) const list = ref([] as any[]) const form = ref({ czrq: formatDate(new Date()), yjxybrq: formatDate(new Date()) } as any) + const history = ref([] as any[]) onLoad(async (option : any) => { if (option) { @@ -38,28 +39,41 @@ } else { processes.value = itemList.value.processes } - getAction('/tracking/getLog?id='+itemList.value.id).then((res:any)=>{ - if(res.code===200){ + getAction('/tracking/getLog?id=' + itemList.value.id).then((res : any) => { + if (res.code === 200) { processes.value.processes.forEach((m : any) => { if (!m.id) { let a = res.data.find((l : any) => l.details.zt == m.name) if (a) { m.rq = a.details.form.czrq - res.data=res.data.concat(a.details.trackingLog) + res.data = res.data.concat(a.details.trackingLog) } } }) processes.value.processes.forEach((m : any) => { - let a = res.data.find((l : any) => l.details.zt == m.name && l.trackingLogId == itemList.value.id) + let a = res.data.find((l : any) => l.details.zt == m.name) if (a) { m.rq = a.details.form.czrq + history.value=history.value.concat(a.details.list) + } + }) + let b = res.data.find((l : any) => l.trackingLogId == itemList.value.id && l.details.zt === '待出厂') + processes.value.processes[processes.value.processes.length - 1].rq = b.details.form.czrq + history.value=history.value.concat(b.details.list) + history.value.map((l:any)=>{ + if(l.pic){ + l.pic=[{url:l.pic}] } }) - let b=res.data.find((l:any)=>l.trackingLogId==itemList.value.id&&l.details.zt==='待出厂') - processes.value.processes[processes.value.processes.length-1].rq=b.details.form.czrq } }) - console.log(processes.value); + postAction('/craftComment/getByIds',itemList.value.craftCmt.value).then((res:any)=>{ + if(res.code===200){ + res.data.forEach((l:any)=>{ + list.value=list.value.concat(l.content) + }) + } + }) } catch (error) { console.error('Failed to parse item JSON:', error); // 可以选择在这里显示错误消息给用户 @@ -68,7 +82,7 @@ }) const onClickLeft = () => { - history.back() + window.history.back(); } //选择框事件 @@ -108,9 +122,22 @@ //提交 const onSubmit = () => { - + let data = { + subId: itemList.value.subId, + trackingLogId: itemList.value.id, + details: { + zt: '已出厂', + list: list.value, + }, + } + postAction('/tracking', data).then((res : any) => { + if (res.code === 200) { + showToast('提交成功!') + window.history.back() + } + }) } - + const fileList = ref([] as any[]) const afterRead = (file : any) => { file.status = 'uploading'; @@ -136,11 +163,32 @@ - {{item.name}} + {{item.name}} {{item.rq}} + + + + + + + + + + + + + + + @@ -151,10 +199,10 @@ @click="choosePic(index)" /> - - - - @@ -213,23 +255,25 @@ text-align: center; align-items: center; margin-top: 10rpx; - - .btn { - border: 1rpx solid #d7d7d7; - padding: 10rpx 30rpx; - border-radius: 10rpx; - } - - .btn1 { - border: 1rpx solid #169bd5; - padding: 10rpx 30rpx; - border-radius: 10rpx; - background-color: #169bd5; - color: #fff; - } } } + .btn2 { + border: 1rpx solid red; + padding: 10rpx 30rpx; + border-radius: 10rpx; + background-color: red; + color: #fff; + } + + .btn1 { + border: 1rpx solid #169bd5; + padding: 10rpx 30rpx; + border-radius: 10rpx; + background-color: #169bd5; + color: #fff; + } + .content { flex: 1; overflow-y: scroll; @@ -237,35 +281,6 @@ } } - .grid-container1 { - display: grid; - grid-template-columns: 1fr 1fr; - padding: 10rpx 15rpx; - - .grid-item { - display: flex; - flex-direction: column; - text-align: center; - align-items: center; - justify-content: center; - margin-top: 10rpx; - - .btn { - border: 1rpx solid #d7d7d7; - padding: 10rpx 30rpx; - border-radius: 10rpx; - } - - .btn1 { - border: 1rpx solid #169bd5; - padding: 10rpx 30rpx; - border-radius: 10rpx; - background-color: #169bd5; - color: #fff; - } - } - } - .bor { ::v-deep .van-field__control { border: 1px solid #d7d7d7; diff --git a/pages/documentary/history.vue b/pages/documentary/history.vue new file mode 100644 index 0000000..0829e42 --- /dev/null +++ b/pages/documentary/history.vue @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + {{item.name}} + {{item.rq}} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index 74b0f13..c29f15d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -102,6 +102,11 @@ const ListData =ref([ path:'../documentary/documentary', name:'跟单列表', type:'', + }, + { + path:'../Delivery/Delivery', + name:'待收货列表', + type:'', } ] as any[])
{{item.processes.processes.find(l=>!l.id)?.name}}
请选择品种
在厂天数:{{item.zcts}}天
+ 进厂:{{item.jcrq}} + + 预计:{{item.ccrq}} +
{{item.rq}}