This commit is contained in:
ljx120 2025-01-10 16:32:41 +08:00
parent 099464e429
commit bb911f78da
3 changed files with 65 additions and 42 deletions

View File

@ -9,21 +9,26 @@
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 list = ref() const list = ref()
const orderId = ref() const orderId = ref()
const fabrics = ref() const fabricId = ref()
const tributeList = ref([] as any[])
const zt = ref()
// props // props
defineProps<{ defineProps<{
id ?: string; id ?: string;
item ?: string; subId ?: string;
zt?:string;
}>(); }>();
onLoad(async (option : any) => { onLoad(async (option : any) => {
if (option && option.id && option.item) { if (option) {
try { try {
orderId.value = option.id; orderId.value = option.id
fabrics.value = JSON.parse(option.item) fabricId.value = option.subId
zt.value=option.zt
} catch (error) { } catch (error) {
console.error('Failed to parse item JSON:', error); console.error('Failed to parse item JSON:', error);
// //
@ -35,6 +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)
}
})
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('/factory').then((res : any) => { getAction('/factory').then((res : any) => {
@ -50,24 +65,35 @@
// //
const onSubmit = () => { const onSubmit = () => {
let val={ let val={
orderId:fabrics.value.orderId, 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:fabrics.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:[]
name:fabrics.value.name,
xxs:bhms.value,
}]
} }
} }
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){
xxs.push(m)
}
})
val.data.mls.push({name:orderItem.value.fabric[l].name,xxs:xxs})
})
postAction('/tribute',val).then((res:any)=>{ postAction('/tribute',val).then((res:any)=>{
if(res.code===200){ if(res.code===200){
showToast('提交成功!') showToast('提交成功!')
@ -84,8 +110,10 @@
// //
const h5ScanCode = ref(false); const h5ScanCode = ref(false);
const bhms = ref([] as any[]) const bhms = ref([] as any[])
const indexType = ref()
// //
const upScanCode = () => { const upScanCode = (index:any) => {
indexType.value=index
scanCode() scanCode()
} }
const conScanCode = () => { const conScanCode = () => {
@ -122,7 +150,7 @@
code: res, code: res,
ms: res1.data.len, ms: res1.data.len,
syps: res1.data.len, syps: res1.data.len,
index:fabrics.value.id, index:indexType.value,
}) })
showDialog.value = true showDialog.value = true
} }
@ -185,13 +213,13 @@
label-width="5em" readonly /> label-width="5em" 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="fabrics.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="fabrics.craftCmt.name" name="工艺要求" label="工艺要求" colon label-width="5em" readonly <van-field v-model="orderItem.craftComment.name" name="工艺要求" label="工艺要求" colon label-width="5em" readonly
class="bor-n" /> class="bor-n" />
<van-field v-model="form.interComment" name="内部备注" label="内部备注" colon label-width="5em" <van-field v-model="form.interComment" name="内部备注" label="内部备注" colon label-width="5em"
readonly class="bor-n" /> readonly class="bor-n" />
<van-field v-model="fabrics.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 class="grid-container"> <view class="grid-container">
@ -200,17 +228,24 @@
<view class="grid-item">米数</view> <view class="grid-item">米数</view>
<view class="grid-item">面料编号/米数</view> <view class="grid-item">面料编号/米数</view>
</view> </view>
<view class="grid-container"> <view class="grid-container" v-for="(item,index) in orderItem.fabric" :key="index">
<view class="grid-item">{{fabrics.name}}</view> <view class="grid-item">{{item.name}}</view>
<view class="grid-item">{{fabrics.qty}}</view> <view class="grid-item">{{item.qty}}</view>
<view class="grid-item">{{fabrics.len}}</view> <view class="grid-item">{{item.len}}</view>
<view class="grid-item"> <view class="grid-item">
<view v-for="(item,index) in bhms" :key="index" class="box"> <view v-for="(itemSecond,indexSecond) in tributeList" :key="indexSecond">
{{item.code}}<br>{{item.ms}} <view v-if="itemSecond.index==index" class="box">
<van-icon name="cross" color="red" @click="bhms.splice(index,1)" /> {{itemSecond.code}}<br>{{itemSecond.ms}}
</view> </view>
<view class="a-c"> </view>
<van-button type="primary" @click="upScanCode()"> <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" v-if="zt!='已配全'">
<van-button type="primary" @click="upScanCode(index)">
扫一扫 扫一扫
</van-button> </van-button>
</view> </view>
@ -220,7 +255,7 @@
@close="handleClose"> @close="handleClose">
</cshaptx4869-scancode> </cshaptx4869-scancode>
<view> <view v-if="zt!='已配全'">
<van-field v-model="formItem.phrq" name="配货日期" label="配货日期" colon class="bor" label-width="5em" <van-field v-model="formItem.phrq" name="配货日期" label="配货日期" colon class="bor" label-width="5em"
readonly :rules="[{ required: true, message: '请填写' }]" @click="chooseDate()" /> readonly :rules="[{ required: true, message: '请填写' }]" @click="chooseDate()" />
<van-field v-model="formItem.rc" name="染厂选择" label="染厂选择" colon class="bor" label-width="5em" <van-field v-model="formItem.rc" name="染厂选择" label="染厂选择" colon class="bor" label-width="5em"
@ -230,9 +265,8 @@
<van-field v-model="formItem.jcms" name="进厂米数" label="进厂米数" colon class="bor-n" readonly <van-field v-model="formItem.jcms" name="进厂米数" label="进厂米数" colon class="bor-n" readonly
label-width="5em" /> label-width="5em" />
</view> </view>
</van-cell-group> </van-cell-group>
<view style="margin: 16px;display: flex;"> <view style="margin: 16px;display: flex;" v-if="zt!='已配全'">
<van-button round block type="primary" native-type="submit" @click="beforeSubmit('部分配货')"> <van-button round block type="primary" native-type="submit" @click="beforeSubmit('部分配货')">
部分配货 部分配货
</van-button> </van-button>

View File

@ -203,15 +203,11 @@
<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 phjl" :key="indexSecond" class="box">
{{itemSecond.code}}<br>{{itemSecond.ms}}
</view> -->
<view v-for="(itemSecond,indexSecond) in item.bhms1" :key="indexSecond" class="box"> <view v-for="(itemSecond,indexSecond) in item.bhms1" :key="indexSecond" class="box">
{{itemSecond.code}}<br>{{itemSecond.ms}} {{itemSecond.code}}<br>{{itemSecond.ms}}
<van-icon name="cross" color="red" @click="item.bhms1.splice(indexSecond,1)" /> <van-icon name="cross" color="red" @click="item.bhms1.splice(indexSecond,1)" />
</view> </view>
<view class="a-c" <view class="a-c">
v-if="form.zt!='已配全'&&(item.bhms?item.bhms1?item.bhms.length+item.bhms1.length<item.quantity:item.bhms.length<item.quantity:item.bhms1?item.bhms1.length<item.quantity:true)">
<van-button type="primary" @click="upScanCode(index)"> <van-button type="primary" @click="upScanCode(index)">
扫一扫 扫一扫
</van-button> </van-button>

View File

@ -108,12 +108,9 @@
} }
// //
const toDetile = (item : any, item2 : any, index2 : any) => { const toDetile = (item : any) => {
if (item.type === '定做单') { if (item.type === '定做单') {
item2.craftCmt = item.craftCmt let url = './detailCus' + '?' + 'id=' + item.orderId + '&subId=' + item.subId+'&zt' + item.zt
item2.id = index2
item2.orderId = item.subId
let url = './detailCus' + '?' + 'id=' + item.orderId + '&item=' + JSON.stringify(item2)
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
}) })
@ -175,8 +172,6 @@
</view> </view>
<view class="grid-item" @click="toDetile(item)"> <view class="grid-item" @click="toDetile(item)">
<van-button :type="showColor(item.zt)">{{item.zt}}</van-button> <van-button :type="showColor(item.zt)">{{item.zt}}</van-button>
<p>已配货{{item.ypps}}</p>
<p>待配货{{item.wpps}}</p>
</view> </view>
</view> </view>
</template> </template>
@ -200,8 +195,6 @@
</view> </view>
<view class="grid-item" @click="toDetile(item)"> <view class="grid-item" @click="toDetile(item)">
<van-button :type="showColor(item.zt)">{{item.zt}}</van-button> <van-button :type="showColor(item.zt)">{{item.zt}}</van-button>
<p>已配货{{item.ypps}}</p>
<p>待配货{{item.wpps}}</p>
</view> </view>
</view> </view>
</view> </view>