跟单
This commit is contained in:
parent
bb911f78da
commit
63a6f9cbde
@ -9,7 +9,7 @@
|
||||
const showDialog = ref(false)
|
||||
const show = ref(false)
|
||||
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 orderId = ref()
|
||||
const fabricId = ref()
|
||||
@ -20,7 +20,7 @@
|
||||
defineProps<{
|
||||
id ?: string;
|
||||
subId ?: string;
|
||||
zt?:string;
|
||||
zt ?: string;
|
||||
}>();
|
||||
|
||||
onLoad(async (option : any) => {
|
||||
@ -28,7 +28,7 @@
|
||||
try {
|
||||
orderId.value = option.id
|
||||
fabricId.value = option.subId
|
||||
zt.value=option.zt
|
||||
zt.value = option.zt
|
||||
} catch (error) {
|
||||
console.error('Failed to parse item JSON:', error);
|
||||
// 可以选择在这里显示错误消息给用户
|
||||
@ -40,14 +40,16 @@
|
||||
getAction('/customOrder/' + orderId.value).then((res : any) => {
|
||||
if (res.code === 200) {
|
||||
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)=>{
|
||||
if(res.code===200){
|
||||
res.data.data.mls.forEach((l:any)=>{
|
||||
l.xxs.forEach((m:any)=>{
|
||||
tributeList.value.push(m)
|
||||
getAction('/tribute/' + fabricId.value).then((res : any) => {
|
||||
if (res.code === 200) {
|
||||
res.data.forEach((k : any) => {
|
||||
k.data.mls.forEach((l : any) => {
|
||||
l.xxs.forEach((m : any) => {
|
||||
tributeList.value.push(m)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -62,40 +64,40 @@
|
||||
const onClickLeft = () => {
|
||||
window.history.back()
|
||||
}
|
||||
// 提交
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
let val={
|
||||
orderId:fabricId.value,
|
||||
let val = {
|
||||
orderId: fabricId.value,
|
||||
type: '定做单',
|
||||
factory: formItem.value.rc,
|
||||
qty:formItem.value.jcps,
|
||||
len:formItem.value.jcms,
|
||||
tributeDate:formItem.value.phrq,
|
||||
data:{
|
||||
craft:orderItem.value.craft,
|
||||
makeUser:form.value.makeUser,
|
||||
belongTo:form.value.belongTo,
|
||||
zt:typeData.value,
|
||||
sd:form.value.sd,
|
||||
mls:[]
|
||||
qty: formItem.value.jcps,
|
||||
len: formItem.value.jcms,
|
||||
tributeDate: formItem.value.phrq,
|
||||
data: {
|
||||
craft: orderItem.value.craft,
|
||||
makeUser: form.value.makeUser,
|
||||
belongTo: form.value.belongTo,
|
||||
zt: typeData.value,
|
||||
sd: form.value.sd,
|
||||
mls: []
|
||||
}
|
||||
}
|
||||
let set=new Set()
|
||||
bhms.value.forEach((l:any)=>{
|
||||
let set = new Set()
|
||||
bhms.value.forEach((l : any) => {
|
||||
set.add(l.index)
|
||||
})
|
||||
set.forEach((l:any)=>{
|
||||
let xxs=[]
|
||||
bhms.value.forEach((m:any)=>{
|
||||
if(m.index == l){
|
||||
set.forEach((l : any) => {
|
||||
let xxs = []
|
||||
bhms.value.forEach((m : any) => {
|
||||
if (m.index == l) {
|
||||
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)=>{
|
||||
if(res.code===200){
|
||||
|
||||
postAction('/tribute', val).then((res : any) => {
|
||||
if (res.code === 200) {
|
||||
showToast('提交成功!')
|
||||
uni.redirectTo({
|
||||
url: '/pages/distribution/distribution'
|
||||
@ -112,19 +114,19 @@
|
||||
const bhms = ref([] as any[])
|
||||
const indexType = ref()
|
||||
//点击扫一扫
|
||||
const upScanCode = (index:any) => {
|
||||
indexType.value=index
|
||||
const upScanCode = (index : any) => {
|
||||
indexType.value = index
|
||||
scanCode()
|
||||
}
|
||||
const conScanCode = () => {
|
||||
showDialog.value = false
|
||||
formItem.value.jcps=0
|
||||
formItem.value.jcms=0
|
||||
bhms.value.forEach((l:any)=>{
|
||||
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 += l.ms * 1
|
||||
})
|
||||
formItem.value.jcms=(formItem.value.jcms).toFixed(1)
|
||||
formItem.value.jcms = (formItem.value.jcms).toFixed(1)
|
||||
}
|
||||
|
||||
function scanCode() {
|
||||
@ -147,10 +149,10 @@
|
||||
getAction('/rawFabric/qrcode', { barcode: res }, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }).then((res1 : any) => {
|
||||
if (res1.code === 200) {
|
||||
bhms.value.push({
|
||||
code: res,
|
||||
ms: res1.data.len,
|
||||
code: res,
|
||||
ms: res1.data.len,
|
||||
syps: res1.data.len,
|
||||
index:indexType.value,
|
||||
index: indexType.value,
|
||||
})
|
||||
showDialog.value = true
|
||||
}
|
||||
@ -205,20 +207,19 @@
|
||||
<view class="content">
|
||||
<van-form @submit="onSubmit">
|
||||
<van-cell-group inset>
|
||||
<van-field v-model="form.id" name="订单编号" label="订单编号" colon class="bor-n"
|
||||
label-width="5em" readonly />
|
||||
<van-field v-model="form.makeTime" name="做单日期" label="做单日期" colon class="bor-n"
|
||||
label-width="5em" readonly />
|
||||
<van-field v-model="form.belongTo" name="订单归属" label="订单归属" colon class="bor-n"
|
||||
label-width="5em" readonly />
|
||||
<van-field v-model="form.sd" name="谁定" label="谁定" colon class="bor-n" readonly
|
||||
label-width="5em" />
|
||||
<van-field v-model="form.id" name="订单编号" label="订单编号" colon class="bor-n" label-width="5em"
|
||||
readonly />
|
||||
<van-field v-model="form.makeTime" name="做单日期" label="做单日期" colon class="bor-n" label-width="5em"
|
||||
readonly />
|
||||
<van-field v-model="form.belongTo" name="订单归属" label="订单归属" colon class="bor-n" label-width="5em"
|
||||
readonly />
|
||||
<van-field v-model="form.sd" name="谁定" label="谁定" colon class="bor-n" readonly label-width="5em" />
|
||||
<van-field v-model="orderItem.craft" name="工艺" label="工艺" colon label-width="5em" readonly
|
||||
class="bor-n" />
|
||||
<van-field v-model="orderItem.craftComment.name" name="工艺要求" label="工艺要求" colon label-width="5em" readonly
|
||||
class="bor-n" />
|
||||
<van-field v-model="form.interComment" name="内部备注" label="内部备注" colon label-width="5em"
|
||||
<van-field v-model="orderItem.craftComment.name" name="工艺要求" label="工艺要求" colon label-width="5em"
|
||||
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
|
||||
class="bor-n" />
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { formatDate } from '../../utils/date';
|
||||
import { getAction, postAction } from '../../common/http';
|
||||
import { showToast } from 'vant';
|
||||
@ -11,27 +11,36 @@
|
||||
const formItem = ref({ jcps: 0, jcms: 0 } as any)
|
||||
const list = ref()
|
||||
const orderId = ref()
|
||||
const phjl = ref([] as any[])
|
||||
const tributeList = ref([] as any[])
|
||||
const zt = ref()
|
||||
|
||||
// 定义 props
|
||||
defineProps<{
|
||||
id ?: string;
|
||||
zt?:string;
|
||||
}>();
|
||||
|
||||
|
||||
onLoad(async (option : any) => {
|
||||
if (option && option.id) {
|
||||
if (option) {
|
||||
try {
|
||||
orderId.value = option.id;
|
||||
orderId.value = option.id
|
||||
zt.value=option.zt
|
||||
} catch (error) {
|
||||
console.error('Failed to parse item JSON:', error);
|
||||
// 可以选择在这里显示错误消息给用户
|
||||
}
|
||||
}
|
||||
})
|
||||
onShow(() => {
|
||||
onMounted(() => {
|
||||
getAction('/tribute/'+orderId.value).then((res:any)=>{
|
||||
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) => {
|
||||
@ -51,33 +60,37 @@
|
||||
}
|
||||
|
||||
const onSubmit = () => {
|
||||
let os = []
|
||||
form.value.fabric.forEach((l : any) => {
|
||||
if (l.bhms1) {
|
||||
if (l.bhms) {
|
||||
l.bhms = l.bhms.concat(l.bhms1)
|
||||
} else {
|
||||
l.bhms = JSON.parse(JSON.stringify(l.bhms1))
|
||||
}
|
||||
l.phrq = formItem.value.phrq
|
||||
l.rc = formItem.value.rc
|
||||
let item = {
|
||||
ms: 0,
|
||||
ps: 0,
|
||||
ml: l.name,
|
||||
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 val = {
|
||||
orderId: orderId.value,
|
||||
type: '现货单',
|
||||
factory: formItem.value.rc,
|
||||
qty: formItem.value.jcps,
|
||||
len: formItem.value.jcms,
|
||||
tributeDate: formItem.value.phrq,
|
||||
data: {
|
||||
craft: form.value.craft,
|
||||
makeUser: form.value.makeUser,
|
||||
belongTo: '',
|
||||
zt: typeData.value,
|
||||
sd: form.value.sd,
|
||||
mls: []
|
||||
}
|
||||
}
|
||||
let set = new Set()
|
||||
bhms.value.forEach((l : any) => {
|
||||
set.add(l.index)
|
||||
})
|
||||
// zt: typeData.value,
|
||||
postAction('/tribute', { orderId: form.value.id, type: '现货单', factory: formItem.value.rc,qty:'',len:'' ,data:''}).then((res : any) => {
|
||||
set.forEach((l : 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) {
|
||||
showToast('提交成功!')
|
||||
uni.redirectTo({
|
||||
@ -95,13 +108,20 @@
|
||||
const h5ScanCode = ref(false);
|
||||
const bhms = ref([] as any[])
|
||||
const indexType = ref()
|
||||
//点击扫一扫
|
||||
const upScanCode = (index : any) => {
|
||||
scanCode()
|
||||
indexType.value = index
|
||||
bhms.value = []
|
||||
}
|
||||
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() {
|
||||
@ -123,7 +143,12 @@
|
||||
h5ScanCode.value = false;
|
||||
getAction('/rawFabric/qrcode', { barcode: res }, { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }).then((res1 : any) => {
|
||||
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
|
||||
}
|
||||
})
|
||||
@ -203,9 +228,16 @@
|
||||
<view class="grid-item">{{item.quantity}}</view>
|
||||
<view class="grid-item">门店</view>
|
||||
<view class="grid-item">
|
||||
<view v-for="(itemSecond,indexSecond) in item.bhms1" :key="indexSecond" class="box">
|
||||
{{itemSecond.code}}<br>{{itemSecond.ms}}米
|
||||
<van-icon name="cross" color="red" @click="item.bhms1.splice(indexSecond,1)" />
|
||||
<view v-for="(itemSecond,indexSecond) in tributeList" :key="indexSecond">
|
||||
<view v-if="itemSecond.index==index" class="box">
|
||||
{{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 class="a-c">
|
||||
<van-button type="primary" @click="upScanCode(index)">
|
||||
|
@ -110,12 +110,12 @@
|
||||
//详情
|
||||
const toDetile = (item : any) => {
|
||||
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({
|
||||
url: url,
|
||||
})
|
||||
} else if (item.type === '现货单') {
|
||||
let url = './detailSpot' + '?' + 'id=' + item.orderId
|
||||
let url = './detailSpot' + '?' + 'id=' + item.orderId+'&zt=' + item.zt
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
})
|
||||
|
@ -6,7 +6,7 @@
|
||||
import { showToast } from 'vant';
|
||||
|
||||
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 factory = ref([] as any[])
|
||||
const nameList = ref([] as any[])
|
||||
@ -93,14 +93,14 @@
|
||||
if (isValidJSON(l.craftComment)) {
|
||||
l.craftComment = JSON.parse(l.craftComment)
|
||||
}
|
||||
if(l.status==='待进厂'){
|
||||
l.butonColor=butonColor.value[0]
|
||||
}else if(l.status==='待出厂'){
|
||||
l.butonColor=butonColor.value[1]
|
||||
}else if(l.status==='已出厂'){
|
||||
l.butonColor=butonColor.value[2]
|
||||
}else{
|
||||
l.butonColor=butonColor.value[getRandomIntInclusive(3,14)]
|
||||
if (l.status === '待进厂') {
|
||||
l.butonColor = butonColor.value[0]
|
||||
} else if (l.status === '待出厂') {
|
||||
l.butonColor = butonColor.value[1]
|
||||
} else if (l.status === '已出厂') {
|
||||
l.butonColor = butonColor.value[2]
|
||||
} else {
|
||||
l.butonColor = butonColor.value[getRandomIntInclusive(3, 14)]
|
||||
}
|
||||
list.value.push(l)
|
||||
})
|
||||
@ -111,14 +111,14 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function getRandomIntInclusive(min, max) {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min; // 包括最大值
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min; // 包括最大值
|
||||
}
|
||||
|
||||
|
||||
|
||||
function isValidJSON(str : any) {
|
||||
if (typeof str !== 'string') return false; // 确保输入是一个字符串
|
||||
try {
|
||||
@ -170,9 +170,9 @@
|
||||
dataType.value = val
|
||||
}
|
||||
const onConfirmDate = (val : any) => {
|
||||
if(dataType.value=='jcrq'){
|
||||
dataItem.value[dataType.value]= formatDate(val)
|
||||
}else{
|
||||
if (dataType.value == 'jcrq') {
|
||||
dataItem.value[dataType.value] = formatDate(val)
|
||||
} else {
|
||||
form.value[dataType.value] = formatDate(val)
|
||||
}
|
||||
show.value = false
|
||||
@ -262,15 +262,15 @@
|
||||
const toDetile = (item : any) => {
|
||||
if (item.status === '待进厂') {
|
||||
showDialog.value = true
|
||||
itemList.value=item
|
||||
itemList.value = item
|
||||
}
|
||||
}
|
||||
|
||||
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)=>{
|
||||
if(res.code===200){
|
||||
|
||||
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) => {
|
||||
if (res.code === 200) {
|
||||
showDialog.value = false
|
||||
showToast('更新成功!')
|
||||
}
|
||||
@ -318,7 +318,14 @@
|
||||
<view class="content">
|
||||
<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-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}} {{itemSecond.sd}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="grid-item">
|
||||
{{item.sd}}/{{item.makeUser}}/{{item.belongTo}}<br>{{item.qty}}匹/{{item.len}}米
|
||||
</view>
|
||||
@ -326,8 +333,7 @@
|
||||
{{item.craft}}<br>{{item.craftComment.name?item.craftComment.name:item.craftComment}}
|
||||
</view>
|
||||
<view class="grid-item">
|
||||
<van-button
|
||||
:style="{backgroundColor: item.butonColor,color:'#fff'}"
|
||||
<van-button :style="{backgroundColor: item.butonColor,color:'#fff'}"
|
||||
@click="toDetile(item)">{{item.status}}</van-button>
|
||||
</view>
|
||||
</view>
|
||||
@ -338,9 +344,12 @@
|
||||
<van-dialog v-model:show="showDialog">
|
||||
<view style="margin-top: 10rpx;">
|
||||
<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.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-field v-model="dataItem.gdy" name="跟单员" label="跟单员" colon readonly label-width="6.5em"
|
||||
class="bor-n" 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>
|
||||
</view>
|
||||
<template #footer>
|
||||
@ -414,6 +423,30 @@
|
||||
align-items: center;
|
||||
text-align: 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user