This commit is contained in:
ljx120 2025-01-10 15:37:21 +08:00
parent 592e271a58
commit 099464e429
4 changed files with 156 additions and 311 deletions

View File

@ -379,10 +379,10 @@
@click="choosePic('craftFlow',index)" />
<view v-for="(itemSecond,indexSecond) in item.fabric" :key="index">
<view class="a-c">
<van-icon name="add" color="red" size="25" v-if="index===0"
<van-icon name="add" color="red" size="25" v-if="indexSecond===0"
@click="item.fabric.push({})" />
<van-icon name="clear" color="red" size="25" v-if="index!=0"
@click="item.fabric.splice(index,1)" />
<van-icon name="clear" color="red" size="25" v-if="indexSecond!=0"
@click="item.fabric.splice(indexSecond,1)" />
<van-field v-model="itemSecond.name" name="面料名称" label="面料名称" colon readonly
label-width="5em" @click="selectChoose(index,indexSecond)" class="bor"
:rules="[{ required: true, message: '请填写' }]" />

View File

@ -1,30 +1,42 @@
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
import { onMounted, ref } from 'vue';
import { getAction, postAction } from '../../common/http';
import { showToast } from 'vant';
import { formatDate } from '../../utils/date';
import { showToast } from 'vant';
const form = ref({} as any)
const showDialog = ref(false)
const show = ref(false)
const formItem = ref({ jcps: 0, jcms: 0 } as any)
const list = ref()
const orderId = ref()
const fabrics = ref()
// props
defineProps<{
id ?: string;
item ?: string;
}>();
onLoad(async (option : any) => {
if (option && option.item) {
if (option && option.id && option.item) {
try {
form.value = JSON.parse(option.item);
orderId.value = option.id;
fabrics.value = JSON.parse(option.item)
} catch (error) {
console.error('Failed to parse item JSON:', error);
//
}
}
})
onMounted(() => {
getAction('/customOrder/' + orderId.value).then((res : any) => {
if (res.code === 200) {
form.value = res.data.customOrder
}
})
getAction('/factory').then((res : any) => {
if (res.code === 200) {
list.value = res.data.map((l : any) => ({ text: l.name, value: l.name }))
@ -32,39 +44,32 @@
})
})
const onClickLeft = () => {
window.history.back()
}
//
const onSubmit = () => {
let os = []
form.value.orderItems.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:fabrics.value.orderId,
type: '定做单',
factory: formItem.value.rc,
qty:formItem.value.jcps,
len:formItem.value.jcms,
tributeDate:formItem.value.phrq,
data:{
craft:fabrics.value.craft,
makeUser:form.value.makeUser,
belongTo:form.value.belongTo,
zt:typeData.value,
sd:form.value.sd,
mls:[{
name:fabrics.value.name,
xxs:bhms.value,
}]
}
})
postAction('/cos', { sid: form.value.orderItems.id, fabric: form.value.orderItems.fabric, os: os, zt: typeData.value,rc:formItem.value.rc}).then((res : any) => {
if (res.code === 200) {
}
postAction('/tribute',val).then((res:any)=>{
if(res.code===200){
showToast('提交成功!')
uni.redirectTo({
url: '/pages/distribution/distribution'
@ -79,31 +84,23 @@
//
const h5ScanCode = ref(false);
const bhms = ref([] as any[])
const indexType = ref()
const upScanCode = (index : any) => {
//
const upScanCode = () => {
scanCode()
indexType.value = index
bhms.value = []
}
const conScanCode = () => {
if (form.value.orderItems.fabric[indexType.value].bhms1) {
form.value.orderItems.fabric[indexType.value].bhms1 = form.value.orderItems.fabric[indexType.value].bhms1.concat(bhms.value)
} else {
form.value.orderItems.fabric[indexType.value].bhms1 = JSON.parse(JSON.stringify(bhms.value))
}
showDialog.value = false
let jcms = 0
formItem.value.jcps = 0
form.value.orderItems.fabric.forEach((l : any) => {
l.bhms1.forEach((k : any) => {
jcms += k.ms * 1
formItem.value.jcps++
})
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 = jcms.toFixed(1)
formItem.value.jcms=(formItem.value.jcms).toFixed(1)
}
function scanCode() {
showDialog.value = false
h5ScanCode.value = true;
uni.scanCode({
success: (res) => {
@ -121,7 +118,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:fabrics.value.id,
})
showDialog.value = true
}
})
@ -175,21 +177,21 @@
<view class="content">
<van-form @submit="onSubmit">
<van-cell-group inset>
<van-field v-model="form.customOrder.id" name="订单编号" label="订单编号" colon class="bor-n"
<van-field v-model="form.id" name="订单编号" label="订单编号" colon class="bor-n"
label-width="5em" readonly />
<van-field v-model="form.customOrder.makeTime" name="做单日期" label="做单日期" colon class="bor-n"
<van-field v-model="form.makeTime" name="做单日期" label="做单日期" colon class="bor-n"
label-width="5em" readonly />
<van-field v-model="form.customOrder.belongTo" name="订单归属" label="订单归属" colon class="bor-n"
<van-field v-model="form.belongTo" name="订单归属" label="订单归属" colon class="bor-n"
label-width="5em" readonly />
<van-field v-model="form.customOrder.sd" name="谁定" label="谁定" colon class="bor-n" readonly
<van-field v-model="form.sd" name="谁定" label="谁定" colon class="bor-n" readonly
label-width="5em" />
<van-field v-model="form.orderItems.craft" name="工艺" label="工艺" colon label-width="5em" readonly
<van-field v-model="fabrics.craft" name="工艺" label="工艺" colon label-width="5em" readonly
class="bor-n" />
<van-field v-model="form.orderItems.craftComment.name" name="工艺要求" label="工艺要求" colon
label-width="5em" readonly class="bor-n" />
<van-field v-model="form.customOrder.interComment" name="内部备注" label="内部备注" colon label-width="5em"
<van-field v-model="fabrics.craftCmt.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="form.orderItems.color" name="需求颜色" label="需求颜色" colon label-width="5em" readonly
<van-field v-model="fabrics.color" name="需求颜色" label="需求颜色" colon label-width="5em" readonly
class="bor-n" />
<view class="grid-container">
@ -198,33 +200,27 @@
<view class="grid-item">米数</view>
<view class="grid-item">面料编号/米数</view>
</view>
<template v-for="(item,index) in form.orderItems.fabric" :key="index">
<view class="grid-container">
<view class="grid-item">{{item.name}}</view>
<view class="grid-item">{{item.qty}}</view>
<view class="grid-item">{{item.len}}</view>
<view class="grid-item">
<view v-for="(itemSecond,indexSecond) in item.bhms" :key="indexSecond" class="box">
{{itemSecond.code}}<br>{{itemSecond.ms}}
</view>
<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.bhms.splice(indexSecond,1)" />
</view>
<view class="a-c" v-if="form.orderItems.zt!='已配全'&&(item.bhms?item.bhms1?item.bhms.length+item.bhms1.length<item.qty:item.bhms.length<item.qty:item.bhms1?item.bhms1.length<item.qty:true)" >
<van-button type="primary" @click="upScanCode(index)">
扫一扫
</van-button>
</view>
<view class="grid-container">
<view class="grid-item">{{fabrics.name}}</view>
<view class="grid-item">{{fabrics.qty}}</view>
<view class="grid-item">{{fabrics.len}}</view>
<view class="grid-item">
<view v-for="(item,index) in bhms" :key="index" class="box">
{{item.code}}<br>{{item.ms}}
<van-icon name="cross" color="red" @click="bhms.splice(index,1)" />
</view>
<view class="a-c">
<van-button type="primary" @click="upScanCode()">
扫一扫
</van-button>
</view>
</view>
</template>
</view>
<cshaptx4869-scancode v-if="h5ScanCode" @success="handleSuccess" @fail="handleFail"
@close="handleClose">
</cshaptx4869-scancode>
<view v-if="form.orderItems.zt!='已配全'">
<view>
<van-field v-model="formItem.phrq" name="配货日期" label="配货日期" colon class="bor" label-width="5em"
readonly :rules="[{ required: true, message: '请填写' }]" @click="chooseDate()" />
<van-field v-model="formItem.rc" name="染厂选择" label="染厂选择" colon class="bor" label-width="5em"
@ -236,7 +232,7 @@
</view>
</van-cell-group>
<view style="margin: 16px;display: flex;" v-if="form.orderItems.zt!='已配全'">
<view style="margin: 16px;display: flex;">
<van-button round block type="primary" native-type="submit" @click="beforeSubmit('部分配货')">
部分配货
</van-button>
@ -367,7 +363,8 @@
border: 1rpx solid #d7d7d7;
border-radius: 10rpx;
}
.line{
.line {
border-bottom: 1rpx solid #d7d7d7;
margin-bottom: 10rpx;
}

View File

@ -10,16 +10,18 @@
const show = ref(false)
const formItem = ref({ jcps: 0, jcms: 0 } as any)
const list = ref()
const orderId = ref()
const phjl = ref([] as any[])
// props
defineProps<{
item ?: string;
id ?: string;
}>();
onLoad(async (option : any) => {
if (option && option.item) {
if (option && option.id) {
try {
form.value = JSON.parse(option.item);
orderId.value = option.id;
} catch (error) {
console.error('Failed to parse item JSON:', error);
//
@ -27,6 +29,16 @@
}
})
onShow(() => {
getAction('/tribute/'+orderId.value).then((res:any)=>{
if(res.code===200){
phjl.value=res.data
}
})
getAction('/interOrder/'+orderId.value).then((res : any) => {
if (res.code === 200) {
form.value = res.data
}
})
getAction('/factory').then((res : any) => {
if (res.code === 200) {
list.value = res.data.map((l : any) => ({ text: l.name, value: l.name }))
@ -64,7 +76,8 @@
os.push(item)
}
})
postAction('/ios', { orderId: form.value.id, fabric: form.value.fabric, os: os, zt: typeData.value, rc: formItem.value.rc }).then((res : any) => {
// zt: typeData.value,
postAction('/tribute', { orderId: form.value.id, type: '现货单', factory: formItem.value.rc,qty:'',len:'' ,data:''}).then((res : any) => {
if (res.code === 200) {
showToast('提交成功!')
uni.redirectTo({
@ -88,23 +101,7 @@
bhms.value = []
}
const conScanCode = () => {
if (form.value.fabric[indexType.value].bhms1) {
form.value.fabric[indexType.value].bhms1 = form.value.fabric[indexType.value].bhms1.concat(bhms.value)
} else {
form.value.fabric[indexType.value].bhms1 = JSON.parse(JSON.stringify(bhms.value))
}
showDialog.value = false
let jcms = 0
formItem.value.jcps = 0
form.value.fabric.forEach((l : any) => {
if (l.bhms1) {
l.bhms1.forEach((k : any) => {
jcms += k.ms * 1
formItem.value.jcps++
})
}
})
formItem.value.jcms = jcms.toFixed(1)
}
function scanCode() {
@ -204,11 +201,11 @@
<view class="grid-container">
<view class="grid-item">{{item.name}}</view>
<view class="grid-item">{{item.quantity}}</view>
<view class="grid-item">{{item.belongTo}}</view>
<view class="grid-item">门店</view>
<view class="grid-item">
<view v-for="(itemSecond,indexSecond) in item.bhms" :key="indexSecond" class="box">
<!-- <view v-for="(itemSecond,indexSecond) in phjl" :key="indexSecond" class="box">
{{itemSecond.code}}<br>{{itemSecond.ms}}
</view>
</view> -->
<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 File

@ -5,8 +5,9 @@
import { onShow } from '@dcloudio/uni-app';
import { showToast } from 'vant';
const form = ref({ status: '已通过' } as any)
const form = ref({} as any)
const list = ref([] as any[])
const mlList = ref([] as any[])
const statusList = ref([
{ status: "部分配货", type: "warning" },
{ status: "待配货", type: "primary" },
@ -56,63 +57,10 @@
history.back()
}
const total = ref(0)
const currentPage = ref(1)
const finished = ref(false)
const loading = ref(false);
//
const onLoad = () => {
if (list.value.length < total.value) {
currentPage.value++
init()
} else {
finished.value = true
}
};
function init() {
total.value = 0
getAction('/customOrder', { page: currentPage.value, size: 10, ...form.value }).then((res : any) => {
getAction('/tribute/getUnTribute', form.value).then((res : any) => {
if (res.code === 200) {
res.data.record.forEach((l : any) => {
l.lx = 1
if (l.orderItems.length) {
list.value.push(l)
}
l.orderItems.forEach((m : any) => {
let item = statusList.value.find((k : any) => k.status == m.zt)
m.statusColor = item.type
m.ypps=0
m.wpps=0
m.fabric.forEach((k:any)=>{
m.ypps+=k.bhms.length
m.wpps+=(k.quantity-k.bhms.length)
})
})
})
total.value += res.data.total * 1
loading.value = false;
finished.value = false
}
})
getAction('/interOrder', { page: currentPage.value, size: 10, ...form.value }).then((res : any) => {
if (res.code === 200) {
res.data.record.forEach((l : any) => {
l.lx = 2
list.value.push(l)
let item = statusList.value.find((m : any) => m.status == l.zt)
l.statusColor = item.type
l.ypps=0
l.wpps=0
l.fabric.forEach((m:any)=>{
l.ypps+=m.bhms.length
l.wpps+=(m.quantity-m.bhms.length)
})
})
total.value += res.data.total * 1
loading.value = false;
finished.value = false
list.value = res.data
}
})
}
@ -160,96 +108,26 @@
}
//
const toDetile = (item : any, item2 : any) => {
if (item.lx === 1) {
let a = { customOrder: item.customOrder, orderItems: item2 }
let url = './detailCus' + '?' + 'item=' + JSON.stringify(a)
const toDetile = (item : any, item2 : any, index2 : any) => {
if (item.type === '定做单') {
item2.craftCmt = item.craftCmt
item2.id = index2
item2.orderId = item.subId
let url = './detailCus' + '?' + 'id=' + item.orderId + '&item=' + JSON.stringify(item2)
uni.navigateTo({
url: url,
})
} else if (item.lx === 2) {
let url = './detailSpot' + '?' + 'item=' + JSON.stringify(item)
} else if (item.type === '现货单') {
let url = './detailSpot' + '?' + 'id=' + item.orderId
uni.navigateTo({
url: url,
})
}
}
const pickerList = ref([])//
const pickerContainerList = ref([])
const showPickerList = ref(false)
const searchValue = ref('')//
const searchIndex = ref(0)//
const mlList = ref([])
//
const selectChoose = () => {
showPickerList.value = true
}
//
const mlmcOpen = () => {
pickerList.value = mlList.value
pickerContainerList.value = pickerList.value
searchValue.value = ''
}
//
const pickerCancel = () => {
showPickerList.value = false
}
//
const selectedValue = ref()
const getSeachList = () => {
searchIndex.value = 0
let reg = new RegExp(searchValue.value)
let arr = []
pickerList.value.forEach(l => {
if (reg.test(l.text)) {
arr.push(l)
}
})
pickerContainerList.value = arr
}
//
const upSearch = () => {
if (searchIndex.value === 0 && pickerContainerList.value.length) {
searchIndex.value = pickerContainerList.value.length - 1
selectedValue.value = [pickerContainerList.value[searchIndex.value].text]
} else if (pickerContainerList.value.length) {
searchIndex.value--
selectedValue.value = [pickerContainerList.value[searchIndex.value].text]
} else {
showToast('没有了!')
}
}
//
const downSearch = () => {
if (pickerContainerList.value.length) {
if (searchIndex.value === pickerContainerList.value.length) {
searchIndex.value = 0
selectedValue.value = [pickerContainerList.value[searchIndex.value].text]
} else {
searchIndex.value++
selectedValue.value = [pickerContainerList.value[searchIndex.value].text]
}
} else {
showToast('没有了!')
}
}
//
const timer = ref()
const searchTo = () => {
if (timer.value) {
clearTimeout(timer.value)
}
timer.value = setTimeout(() => {
getSeachList()
}, 800)
}
const onConfirm = (val : any) => {
form.value.category = val.selectedValues[2] + '/' + val.selectedValues[0] + val.selectedValues[1]
pickerCancel()
const showColor = (zt : any) => {
let item = statusList.value.find((l : any) => l.status === zt)
return item.type
}
</script>
@ -275,61 +153,58 @@
<view class="grid-item">状态</view>
</view>
<view class="content">
<van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
<view v-for="(item,index) in list" :key="index">
<template v-if="item.lx===1">
<view class="grid-container" v-for="(itemSecond,indexSecond) in item.orderItems"
:key="indexSecond">
<view class="grid-item">{{item.customOrder.makeTime}}<br>{{itemSecond.color}}</view>
<view class="grid-item">
<view class="grid-container1">
<view :class="indexThird===(itemSecond.fabric.length-1)?'grid-item2':'grid-item1'"
v-for="(itemThird,indexThird) in itemSecond.fabric" :key="indexThird">
{{itemThird.name}}<br>{{itemSecond.craft}}&nbsp;&nbsp;&nbsp;{{item.customOrder.sd}}
</view>
</view>
</view>
<view class="grid-item">
<view class="grid-container1">
<view :class="indexThird===(itemSecond.fabric.length-1)?'grid-item2':'grid-item1'"
v-for="(itemThird,indexThird) in itemSecond.fabric" :key="indexThird">
{{itemThird.qty}}
</view>
</view>
</view>
<view class="grid-item" @click="toDetile(item,itemSecond)">
<van-button :type="itemSecond.statusColor">{{itemSecond.zt}}</van-button>
<p>已配货{{itemSecond.ypps}}</p>
<p>待配货{{itemSecond.wpps}}</p>
</view>
</view>
</template>
<view class="grid-container" v-if="item.lx===2">
<view class="grid-item">{{item.makeTime}}<br>{{item.color}}</view>
<view v-for="(item,index) in list" :key="index">
<template v-if="item.type==='定做单'">
<view class="grid-container">
<view class="grid-item">{{item.makeTime}}<br>{{item.fabrics[0].color}}</view>
<view class="grid-item">
<view class="grid-container1">
<view :class="indexSecond===(item.fabric.length-1)?'grid-item2':'grid-item1'"
v-for="(itemSecond,indexSecond) in item.fabric" :key="indexSecond">
{{itemSecond.name}}<br>{{item.craft}}&nbsp;&nbsp;&nbsp;{{itemSecond.belongTo}}
<view :class="indexSecond===(item.fabrics.length-1)?'grid-item2':'grid-item1'"
v-for="(itemSecond,indexSecond) in item.fabrics" :key="indexSecond">
{{itemSecond.name}}<br>{{itemSecond.craft}}&nbsp;&nbsp;&nbsp;{{itemSecond.sd}}
</view>
</view>
</view>
<view class="grid-item">
<view class="grid-container1">
<view :class="indexSecond===(item.fabric.length-1)?'grid-item2':'grid-item1'"
v-for="(itemSecond,indexSecond) in item.fabric" :key="indexSecond">
{{itemSecond.quantity}}
<view :class="indexSecond===(item.fabrics.length-1)?'grid-item2':'grid-item1'"
v-for="(itemSecond,indexSecond) in item.fabrics" :key="indexSecond">
{{itemSecond.qty}}
</view>
</view>
</view>
<view class="grid-item" @click="toDetile(item)">
<van-button :type="item.statusColor">{{item.zt}}</van-button>
<van-button :type="showColor(item.zt)">{{item.zt}}</van-button>
<p>已配货{{item.ypps}}</p>
<p>待配货{{item.wpps}}</p>
</view>
</view>
</template>
<view class="grid-container" v-if="item.type==='现货单'">
<view class="grid-item">{{item.makeTime}}<br>{{item.fabrics[0].color}}</view>
<view class="grid-item">
<view class="grid-container1">
<view :class="indexSecond===(item.fabrics.length-1)?'grid-item2':'grid-item1'"
v-for="(itemSecond,indexSecond) in item.fabrics" :key="indexSecond">
{{itemSecond.name}}<br>{{itemSecond.craft}}&nbsp;&nbsp;&nbsp;{{itemSecond.sd}}
</view>
</view>
</view>
<view class="grid-item">
<view class="grid-container1">
<view :class="indexSecond===(item.fabrics.length-1)?'grid-item2':'grid-item1'"
v-for="(itemSecond,indexSecond) in item.fabrics" :key="indexSecond">
{{itemSecond.qty}}
</view>
</view>
</view>
<view class="grid-item" @click="toDetile(item)">
<van-button :type="showColor(item.zt)">{{item.zt}}</van-button>
<p>已配货{{item.ypps}}</p>
<p>待配货{{item.wpps}}</p>
</view>
</view>
</van-list>
</view>
</view>
</view>
@ -341,31 +216,6 @@
<van-calendar v-model:show="show" @confirm="onConfirmDate" :min-date="new Date(2010, 0, 1)"
:max-date="new Date(2050, 0, 31)" />
<!-- 面料选择框-->
<van-popup v-model:show="showPickerList" position="bottom" @open="mlmcOpen">
<view class="select-model">
<van-picker :columns="pickerContainerList" @cancel="pickerCancel" v-model="selectedValue"
@confirm="onConfirm" />
<view>
<view class="top-select">
<view class="confirm-select">
<p>请选择品种</p>
</view>
<view class="search-box">
<view>
<van-search placeholder="请输入品种名字" v-model="searchValue" label="面料搜索:" background="#ffffff"
@input="searchTo()" :clearable="false" />
</view>
<view class="flex-btn">
<button class="search-btn" @click="upSearch()"></button>
<button class="search-btn" @click="downSearch()"></button>
</view>
</view>
</view>
</view>
</view>
</van-popup>
</template>
<style lang="scss" scoped>
@ -389,6 +239,7 @@
border: 1px solid #f2f2f2;
display: flex;
flex-direction: column;
text-align: center;
align-items: center;
justify-content: center;