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

@ -45,11 +45,13 @@
}) })
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) => {
k.data.mls.forEach((l : any) => {
l.xxs.forEach((m : any) => { l.xxs.forEach((m : any) => {
tributeList.value.push(m) tributeList.value.push(m)
}) })
}) })
})
} }
}) })
getAction('/factory').then((res : any) => { getAction('/factory').then((res : any) => {
@ -91,7 +93,7 @@
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) => {
@ -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: {
craft: form.value.craft,
makeUser: form.value.makeUser,
belongTo: '',
zt: typeData.value,
sd: form.value.sd,
mls: []
} }
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) => { let set = new Set()
item.ms += m.ms * 1 bhms.value.forEach((l : any) => {
item.ps++ set.add(l.index)
item.bh.push(m.code)
}) })
item.ms = Number(item.ms.toFixed(1)) set.forEach((l : any) => {
os.push(item) let xxs = []
bhms.value.forEach((m : any) => {
if (m.index == l) {
xxs.push(m)
} }
}) })
// zt: typeData.value, val.data.mls.push({ name: form.value.fabric[l].name,sh:form.value.color, xxs: xxs })
postAction('/tribute', { orderId: form.value.id, type: '现货单', factory: formItem.value.rc,qty:'',len:'' ,data:''}).then((res : any) => { })
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">
<view v-if="itemSecond.index==index" class="box">
{{itemSecond.code}}<br>{{itemSecond.ms}} {{itemSecond.code}}<br>{{itemSecond.ms}}
<van-icon name="cross" color="red" @click="item.bhms1.splice(indexSecond,1)" /> </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

@ -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;
}
}
} }
} }