This commit is contained in:
ljx120 2025-01-10 17:20:05 +08:00
parent bb911f78da
commit 63a6f9cbde
4 changed files with 190 additions and 124 deletions

View File

@ -9,7 +9,7 @@
const showDialog = ref(false) const showDialog = ref(false)
const show = ref(false) const show = ref(false)
const formItem = ref({ jcps: 0, jcms: 0 } as any) const formItem = ref({ jcps: 0, jcms: 0 } as any)
const orderItem = ref({craftComment:{}} as any) const orderItem = ref({ craftComment: {} } as any)
const list = ref() const list = ref()
const orderId = ref() const orderId = ref()
const fabricId = ref() const fabricId = ref()
@ -20,7 +20,7 @@
defineProps<{ defineProps<{
id ?: string; id ?: string;
subId ?: string; subId ?: string;
zt?:string; zt ?: string;
}>(); }>();
onLoad(async (option : any) => { onLoad(async (option : any) => {
@ -28,7 +28,7 @@
try { try {
orderId.value = option.id orderId.value = option.id
fabricId.value = option.subId fabricId.value = option.subId
zt.value=option.zt zt.value = option.zt
} catch (error) { } catch (error) {
console.error('Failed to parse item JSON:', error); console.error('Failed to parse item JSON:', error);
// //
@ -40,14 +40,16 @@
getAction('/customOrder/' + orderId.value).then((res : any) => { getAction('/customOrder/' + orderId.value).then((res : any) => {
if (res.code === 200) { if (res.code === 200) {
form.value = res.data.customOrder form.value = res.data.customOrder
orderItem.value = res.data.orderItems.find((l:any)=>l.id==fabricId.value) orderItem.value = res.data.orderItems.find((l : any) => l.id == fabricId.value)
} }
}) })
getAction('/tribute/'+fabricId.value).then((res:any)=>{ getAction('/tribute/' + fabricId.value).then((res : any) => {
if(res.code===200){ if (res.code === 200) {
res.data.data.mls.forEach((l:any)=>{ res.data.forEach((k : any) => {
l.xxs.forEach((m:any)=>{ k.data.mls.forEach((l : any) => {
tributeList.value.push(m) l.xxs.forEach((m : any) => {
tributeList.value.push(m)
})
}) })
}) })
} }
@ -62,40 +64,40 @@
const onClickLeft = () => { const onClickLeft = () => {
window.history.back() window.history.back()
} }
// //
const onSubmit = () => { const onSubmit = () => {
let val={ let val = {
orderId:fabricId.value, orderId: fabricId.value,
type: '定做单', type: '定做单',
factory: formItem.value.rc, factory: formItem.value.rc,
qty:formItem.value.jcps, qty: formItem.value.jcps,
len:formItem.value.jcms, len: formItem.value.jcms,
tributeDate:formItem.value.phrq, tributeDate: formItem.value.phrq,
data:{ data: {
craft:orderItem.value.craft, craft: orderItem.value.craft,
makeUser:form.value.makeUser, makeUser: form.value.makeUser,
belongTo:form.value.belongTo, belongTo: form.value.belongTo,
zt:typeData.value, zt: typeData.value,
sd:form.value.sd, sd: form.value.sd,
mls:[] mls: []
} }
} }
let set=new Set() let set = new Set()
bhms.value.forEach((l:any)=>{ bhms.value.forEach((l : any) => {
set.add(l.index) set.add(l.index)
}) })
set.forEach((l:any)=>{ set.forEach((l : any) => {
let xxs=[] let xxs = []
bhms.value.forEach((m:any)=>{ bhms.value.forEach((m : any) => {
if(m.index == l){ if (m.index == l) {
xxs.push(m) xxs.push(m)
} }
}) })
val.data.mls.push({name:orderItem.value.fabric[l].name,xxs:xxs}) val.data.mls.push({ name: orderItem.value.fabric[l].name,sh:orderItem.value.color, xxs: xxs })
}) })
postAction('/tribute',val).then((res:any)=>{ postAction('/tribute', val).then((res : any) => {
if(res.code===200){ if (res.code === 200) {
showToast('提交成功!') showToast('提交成功!')
uni.redirectTo({ uni.redirectTo({
url: '/pages/distribution/distribution' url: '/pages/distribution/distribution'
@ -112,19 +114,19 @@
const bhms = ref([] as any[]) const bhms = ref([] as any[])
const indexType = ref() const indexType = ref()
// //
const upScanCode = (index:any) => { const upScanCode = (index : any) => {
indexType.value=index indexType.value = index
scanCode() scanCode()
} }
const conScanCode = () => { const conScanCode = () => {
showDialog.value = false showDialog.value = false
formItem.value.jcps=0 formItem.value.jcps = 0
formItem.value.jcms=0 formItem.value.jcms = 0
bhms.value.forEach((l:any)=>{ bhms.value.forEach((l : any) => {
formItem.value.jcps++ formItem.value.jcps++
formItem.value.jcms+=l.ms*1 formItem.value.jcms += l.ms * 1
}) })
formItem.value.jcms=(formItem.value.jcms).toFixed(1) formItem.value.jcms = (formItem.value.jcms).toFixed(1)
} }
function scanCode() { function scanCode() {
@ -150,7 +152,7 @@
code: res, code: res,
ms: res1.data.len, ms: res1.data.len,
syps: res1.data.len, syps: res1.data.len,
index:indexType.value, index: indexType.value,
}) })
showDialog.value = true showDialog.value = true
} }
@ -205,20 +207,19 @@
<view class="content"> <view class="content">
<van-form @submit="onSubmit"> <van-form @submit="onSubmit">
<van-cell-group inset> <van-cell-group inset>
<van-field v-model="form.id" name="订单编号" label="订单编号" colon class="bor-n" <van-field v-model="form.id" name="订单编号" label="订单编号" colon class="bor-n" label-width="5em"
label-width="5em" readonly /> readonly />
<van-field v-model="form.makeTime" name="做单日期" label="做单日期" colon class="bor-n" <van-field v-model="form.makeTime" name="做单日期" label="做单日期" colon class="bor-n" label-width="5em"
label-width="5em" readonly /> readonly />
<van-field v-model="form.belongTo" name="订单归属" label="订单归属" colon class="bor-n" <van-field v-model="form.belongTo" name="订单归属" label="订单归属" colon class="bor-n" label-width="5em"
label-width="5em" readonly /> readonly />
<van-field v-model="form.sd" name="谁定" label="谁定" colon class="bor-n" readonly <van-field v-model="form.sd" name="谁定" label="谁定" colon class="bor-n" readonly label-width="5em" />
label-width="5em" />
<van-field v-model="orderItem.craft" name="工艺" label="工艺" colon label-width="5em" readonly <van-field v-model="orderItem.craft" name="工艺" label="工艺" colon label-width="5em" readonly
class="bor-n" /> class="bor-n" />
<van-field v-model="orderItem.craftComment.name" name="工艺要求" label="工艺要求" colon label-width="5em" readonly <van-field v-model="orderItem.craftComment.name" name="工艺要求" label="工艺要求" colon label-width="5em"
class="bor-n" />
<van-field v-model="form.interComment" name="内部备注" label="内部备注" colon label-width="5em"
readonly class="bor-n" /> readonly class="bor-n" />
<van-field v-model="form.interComment" name="内部备注" label="内部备注" colon label-width="5em" readonly
class="bor-n" />
<van-field v-model="orderItem.color" name="需求颜色" label="需求颜色" colon label-width="5em" readonly <van-field v-model="orderItem.color" name="需求颜色" label="需求颜色" colon label-width="5em" readonly
class="bor-n" /> class="bor-n" />

View File

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { onLoad, onShow } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue'; import { onMounted, ref } from 'vue';
import { formatDate } from '../../utils/date'; import { formatDate } from '../../utils/date';
import { getAction, postAction } from '../../common/http'; import { getAction, postAction } from '../../common/http';
import { showToast } from 'vant'; import { showToast } from 'vant';
@ -11,27 +11,36 @@
const formItem = ref({ jcps: 0, jcms: 0 } as any) const formItem = ref({ jcps: 0, jcms: 0 } as any)
const list = ref() const list = ref()
const orderId = ref() const orderId = ref()
const phjl = ref([] as any[]) const tributeList = ref([] as any[])
const zt = ref()
// props // props
defineProps<{ defineProps<{
id ?: string; id ?: string;
zt?:string;
}>(); }>();
onLoad(async (option : any) => { onLoad(async (option : any) => {
if (option && option.id) { if (option) {
try { try {
orderId.value = option.id; orderId.value = option.id
zt.value=option.zt
} catch (error) { } catch (error) {
console.error('Failed to parse item JSON:', error); console.error('Failed to parse item JSON:', error);
// //
} }
} }
}) })
onShow(() => { onMounted(() => {
getAction('/tribute/'+orderId.value).then((res:any)=>{ getAction('/tribute/'+orderId.value).then((res:any)=>{
if(res.code===200){ if(res.code===200){
phjl.value=res.data res.data.forEach((k:any)=>{
k.data.mls.forEach((l:any)=>{
l.xxs.forEach((m:any)=>{
tributeList.value.push(m)
})
})
})
} }
}) })
getAction('/interOrder/'+orderId.value).then((res : any) => { getAction('/interOrder/'+orderId.value).then((res : any) => {
@ -51,33 +60,37 @@
} }
const onSubmit = () => { const onSubmit = () => {
let os = [] let val = {
form.value.fabric.forEach((l : any) => { orderId: orderId.value,
if (l.bhms1) { type: '现货单',
if (l.bhms) { factory: formItem.value.rc,
l.bhms = l.bhms.concat(l.bhms1) qty: formItem.value.jcps,
} else { len: formItem.value.jcms,
l.bhms = JSON.parse(JSON.stringify(l.bhms1)) tributeDate: formItem.value.phrq,
} data: {
l.phrq = formItem.value.phrq craft: form.value.craft,
l.rc = formItem.value.rc makeUser: form.value.makeUser,
let item = { belongTo: '',
ms: 0, zt: typeData.value,
ps: 0, sd: form.value.sd,
ml: l.name, mls: []
bh: [],
}
l.bhms1.forEach((m : any) => {
item.ms += m.ms * 1
item.ps++
item.bh.push(m.code)
})
item.ms = Number(item.ms.toFixed(1))
os.push(item)
} }
}
let set = new Set()
bhms.value.forEach((l : any) => {
set.add(l.index)
}) })
// zt: typeData.value, set.forEach((l : any) => {
postAction('/tribute', { orderId: form.value.id, type: '现货单', factory: formItem.value.rc,qty:'',len:'' ,data:''}).then((res : any) => { let xxs = []
bhms.value.forEach((m : any) => {
if (m.index == l) {
xxs.push(m)
}
})
val.data.mls.push({ name: form.value.fabric[l].name,sh:form.value.color, xxs: xxs })
})
postAction('/tribute', val).then((res : any) => {
if (res.code === 200) { if (res.code === 200) {
showToast('提交成功!') showToast('提交成功!')
uni.redirectTo({ uni.redirectTo({
@ -95,13 +108,20 @@
const h5ScanCode = ref(false); const h5ScanCode = ref(false);
const bhms = ref([] as any[]) const bhms = ref([] as any[])
const indexType = ref() const indexType = ref()
//
const upScanCode = (index : any) => { const upScanCode = (index : any) => {
scanCode() scanCode()
indexType.value = index indexType.value = index
bhms.value = []
} }
const conScanCode = () => { const conScanCode = () => {
showDialog.value = false
formItem.value.jcps = 0
formItem.value.jcms = 0
bhms.value.forEach((l : any) => {
formItem.value.jcps++
formItem.value.jcms += l.ms * 1
})
formItem.value.jcms = (formItem.value.jcms).toFixed(1)
} }
function scanCode() { function scanCode() {
@ -123,7 +143,12 @@
h5ScanCode.value = false; h5ScanCode.value = false;
getAction('/rawFabric/qrcode', { barcode: res }, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }).then((res1 : any) => { getAction('/rawFabric/qrcode', { barcode: res }, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }).then((res1 : any) => {
if (res1.code === 200) { if (res1.code === 200) {
bhms.value.push({ code: res, ms: res1.data.len, syps: res1.data.len }) bhms.value.push({
code: res,
ms: res1.data.len,
syps: res1.data.len,
index: indexType.value,
})
showDialog.value = true showDialog.value = true
} }
}) })
@ -203,9 +228,16 @@
<view class="grid-item">{{item.quantity}}</view> <view class="grid-item">{{item.quantity}}</view>
<view class="grid-item">门店</view> <view class="grid-item">门店</view>
<view class="grid-item"> <view class="grid-item">
<view v-for="(itemSecond,indexSecond) in item.bhms1" :key="indexSecond" class="box"> <view v-for="(itemSecond,indexSecond) in tributeList" :key="indexSecond">
{{itemSecond.code}}<br>{{itemSecond.ms}} <view v-if="itemSecond.index==index" class="box">
<van-icon name="cross" color="red" @click="item.bhms1.splice(indexSecond,1)" /> {{itemSecond.code}}<br>{{itemSecond.ms}}
</view>
</view>
<view v-for="(itemSecond,indexSecond) in bhms" :key="indexSecond">
<view v-if="itemSecond.index==index" class="box">
{{itemSecond.code}}<br>{{itemSecond.ms}}
<van-icon name="cross" color="red" @click="bhms.splice(indexSecond,1)" />
</view>
</view> </view>
<view class="a-c"> <view class="a-c">
<van-button type="primary" @click="upScanCode(index)"> <van-button type="primary" @click="upScanCode(index)">

View File

@ -110,12 +110,12 @@
// //
const toDetile = (item : any) => { const toDetile = (item : any) => {
if (item.type === '定做单') { if (item.type === '定做单') {
let url = './detailCus' + '?' + 'id=' + item.orderId + '&subId=' + item.subId+'&zt' + item.zt let url = './detailCus' + '?' + 'id=' + item.orderId + '&subId=' + item.subId+'&zt=' + item.zt
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
}) })
} else if (item.type === '现货单') { } else if (item.type === '现货单') {
let url = './detailSpot' + '?' + 'id=' + item.orderId let url = './detailSpot' + '?' + 'id=' + item.orderId+'&zt=' + item.zt
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
}) })

View File

@ -6,7 +6,7 @@
import { showToast } from 'vant'; import { showToast } from 'vant';
const form = ref({} as any) const form = ref({} as any)
const dataItem = ref({jcrq:formatDate(new Date()),yjccts:5} as any) const dataItem = ref({ jcrq: formatDate(new Date()), yjccts: 5 } as any)
const list = ref([] as any[]) const list = ref([] as any[])
const factory = ref([] as any[]) const factory = ref([] as any[])
const nameList = ref([] as any[]) const nameList = ref([] as any[])
@ -93,14 +93,14 @@
if (isValidJSON(l.craftComment)) { if (isValidJSON(l.craftComment)) {
l.craftComment = JSON.parse(l.craftComment) l.craftComment = JSON.parse(l.craftComment)
} }
if(l.status==='待进厂'){ if (l.status === '待进厂') {
l.butonColor=butonColor.value[0] l.butonColor = butonColor.value[0]
}else if(l.status==='待出厂'){ } else if (l.status === '待出厂') {
l.butonColor=butonColor.value[1] l.butonColor = butonColor.value[1]
}else if(l.status==='已出厂'){ } else if (l.status === '已出厂') {
l.butonColor=butonColor.value[2] l.butonColor = butonColor.value[2]
}else{ } else {
l.butonColor=butonColor.value[getRandomIntInclusive(3,14)] l.butonColor = butonColor.value[getRandomIntInclusive(3, 14)]
} }
list.value.push(l) list.value.push(l)
}) })
@ -113,9 +113,9 @@
} }
function getRandomIntInclusive(min, max) { function getRandomIntInclusive(min, max) {
min = Math.ceil(min); min = Math.ceil(min);
max = Math.floor(max); max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min; // return Math.floor(Math.random() * (max - min + 1)) + min; //
} }
@ -170,9 +170,9 @@
dataType.value = val dataType.value = val
} }
const onConfirmDate = (val : any) => { const onConfirmDate = (val : any) => {
if(dataType.value=='jcrq'){ if (dataType.value == 'jcrq') {
dataItem.value[dataType.value]= formatDate(val) dataItem.value[dataType.value] = formatDate(val)
}else{ } else {
form.value[dataType.value] = formatDate(val) form.value[dataType.value] = formatDate(val)
} }
show.value = false show.value = false
@ -262,15 +262,15 @@
const toDetile = (item : any) => { const toDetile = (item : any) => {
if (item.status === '待进厂') { if (item.status === '待进厂') {
showDialog.value = true showDialog.value = true
itemList.value=item itemList.value = item
} }
} }
const submit = () =>{ const submit = () => {
if(!dataItem.value.yjccts) return showToast('请填写预计出厂天数!') if (!dataItem.value.yjccts) return showToast('请填写预计出厂天数!')
dataItem.value.zt=itemList.value.status dataItem.value.zt = itemList.value.status
postAction('/tracking',{orderId:itemList.value.id,type:itemList.value.type,data:dataItem.value,status:'等待'}).then((res:any)=>{ postAction('/tracking', { orderId: itemList.value.id, type: itemList.value.type, data: dataItem.value, status: '等待' }).then((res : any) => {
if(res.code===200){ if (res.code === 200) {
showDialog.value = false showDialog.value = false
showToast('更新成功!') showToast('更新成功!')
} }
@ -318,7 +318,14 @@
<view class="content"> <view class="content">
<van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"> <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
<view class="grid-container" v-for="(item,index) in list" :key="index"> <view class="grid-container" v-for="(item,index) in list" :key="index">
<view class="grid-item">{{item.fabricName}}<br>{{item.color}}</view> <view class="grid-item">
<view class="grid-container1">
<view :class="indexSecond===(item.mls.length-1)?'grid-item2':'grid-item1'"
v-for="(itemSecond,indexSecond) in item.mls" :key="indexSecond">
{{itemSecond.mz}}<br>{{itemSecond.craft}}&nbsp;&nbsp;&nbsp;{{itemSecond.sd}}
</view>
</view>
</view>
<view class="grid-item"> <view class="grid-item">
{{item.sd}}/{{item.makeUser}}/{{item.belongTo}}<br>{{item.qty}}/{{item.len}} {{item.sd}}/{{item.makeUser}}/{{item.belongTo}}<br>{{item.qty}}/{{item.len}}
</view> </view>
@ -326,8 +333,7 @@
{{item.craft}}<br>{{item.craftComment.name?item.craftComment.name:item.craftComment}} {{item.craft}}<br>{{item.craftComment.name?item.craftComment.name:item.craftComment}}
</view> </view>
<view class="grid-item"> <view class="grid-item">
<van-button <van-button :style="{backgroundColor: item.butonColor,color:'#fff'}"
:style="{backgroundColor: item.butonColor,color:'#fff'}"
@click="toDetile(item)">{{item.status}}</van-button> @click="toDetile(item)">{{item.status}}</van-button>
</view> </view>
</view> </view>
@ -338,9 +344,12 @@
<van-dialog v-model:show="showDialog"> <van-dialog v-model:show="showDialog">
<view style="margin-top: 10rpx;"> <view style="margin-top: 10rpx;">
<van-cell-group inset> <van-cell-group inset>
<van-field v-model="dataItem.gdy" name="跟单员" label="跟单员" colon readonly label-width="6.5em" class="bor-n" label-align="right"/> <van-field v-model="dataItem.gdy" name="跟单员" label="跟单员" colon readonly label-width="6.5em"
<van-field v-model="dataItem.jcrq" name="进厂日期" label="进厂日期" colon label-width="6.5em" class="bor" readonly @click="chooseDate('jcrq')" label-align="right"/> class="bor-n" label-align="right" />
<van-field v-model="dataItem.yjccts" name="预计出厂天数" label="预计出厂天数" type="digit" colon label-width="6.5em" class="bor-a" label-align="right"/> <van-field v-model="dataItem.jcrq" name="进厂日期" label="进厂日期" colon label-width="6.5em" class="bor"
readonly @click="chooseDate('jcrq')" label-align="right" />
<van-field v-model="dataItem.yjccts" name="预计出厂天数" label="预计出厂天数" type="digit" colon label-width="6.5em"
class="bor-a" label-align="right" />
</van-cell-group> </van-cell-group>
</view> </view>
<template #footer> <template #footer>
@ -414,6 +423,30 @@
align-items: center; align-items: center;
text-align: center; text-align: center;
justify-content: center; justify-content: center;
.grid-container1 {
display: grid;
grid-template-columns: 1fr;
width: 100%;
height: 100%;
.grid-item2 {
display: flex;
align-items: center;
text-align: center;
justify-content: center;
padding: 5rpx;
}
.grid-item1 {
border-bottom: 1px solid #f2f2f2;
display: flex;
align-items: center;
text-align: center;
justify-content: center;
padding: 5rpx;
}
}
} }
} }