<script setup>
|
import request from "@/utils/request"
|
import {computed, onMounted, ref} from "vue"
|
import PrintFoot from "@/components/sd/order/PrintFoot.vue"
|
import companyInfo from "@/stores/sd/companyInfo"
|
import deepClone from "@/utils/deepClone";
|
import {ElMessage} from "element-plus";
|
import {add,multiply,multiplyAuto,divideAuto} from '@/utils/decimal';
|
const company = companyInfo()
|
let produceList = ref([])
|
let delivery = ref([])
|
let otherMoney = []
|
let otherMoney1 = []
|
let money = ref("")
|
let dialogVisible = ref(false)
|
let otherMoneys = 0
|
let sumMoney = 0
|
let takeCare = "注意:请妥善保管好我司的玻璃架,如有丢失或损坏,按1500元只赔偿。谢谢配合!"
|
let remark = "备注:本批玻璃为优等合格品,请在卸货时,当面消点验收、如有质量问题在一周内与本公司联系,否则概不负责!"
|
|
|
|
let props = defineProps({
|
orderId:null
|
})
|
const form = ref({
|
})
|
const selectedValues = ref([])
|
let productIdData = ref({
|
})
|
const getData = () => {
|
if(props.orderId===null || props.orderId===undefined || props.orderId===''){
|
return
|
}
|
form.value.orderId=props.orderId
|
|
request.post(`/delivery/getSelectOrderPrinting/null`,form.value).then((res) => {
|
if(res.code==200){
|
productIdData.value=deepClone(res.data.data)
|
produceList.value = deepClone(res.data.data)
|
|
delivery.value=deepClone(res.data.delivery)
|
money.value=deepClone(res.data.money)
|
produceList.value.forEach(item => {
|
sumMoney+=item.DeliveryDetail.grossAmount
|
})
|
otherMoney1=[]
|
otherMoney=deepClone(res.data.otherMoney)
|
for(let i=0;i<otherMoney.length;i++){
|
if(otherMoney[i].DeliveryDetailOtherMoney.monery!=null){
|
otherMoneys+=otherMoney[i].DeliveryDetailOtherMoney.monery
|
if(otherMoney1.length===0){
|
otherMoney1.push(otherMoney[i])
|
}
|
else{
|
for(let s=0;s<otherMoney1.length;s++){
|
if(otherMoney[i].DeliveryDetailOtherMoney.alias===otherMoney1[s].DeliveryDetailOtherMoney.alias){
|
otherMoney1[s].DeliveryDetailOtherMoney.count=add(otherMoney[i].DeliveryDetailOtherMoney.count,otherMoney1[s].DeliveryDetailOtherMoney.count)
|
otherMoney1[s].DeliveryDetailOtherMoney.monery =add(otherMoney[i].DeliveryDetailOtherMoney.monery,otherMoney1[s].DeliveryDetailOtherMoney.monery)
|
break
|
}
|
if(s+1===otherMoney1.length){
|
otherMoney1.push(otherMoney[i])
|
break
|
}
|
}
|
|
}
|
}
|
|
}
|
/*let otherMoney2=[]
|
otherMoney.value.forEach(item => {
|
if(item.DeliveryDetailOtherMoney.monery!=null){
|
otherMoneys+=item.DeliveryDetailOtherMoney.monery
|
let otherMoney3
|
if(otherMoney2.length===0){
|
console.log(item)
|
otherMoney3=item
|
console.log(otherMoney3)
|
otherMoney2.push(otherMoney3)
|
console.log(otherMoney2)
|
}else{
|
console.log(otherMoney2)
|
otherMoney2.forEach(items=>{
|
|
if(item.DeliveryDetailOtherMoney.alias===items.DeliveryDetailOtherMoney.alias){
|
items.DeliveryDetailOtherMoney.count+=item.DeliveryDetailOtherMoney.count
|
items.DeliveryDetailOtherMoney.monery +=item.DeliveryDetailOtherMoney.monery
|
otherMoney2.push(items)
|
console.log(11)
|
}else{
|
otherMoney2.push(item)
|
console.log(22)
|
}
|
|
})
|
console.log(otherMoney2)
|
}
|
|
|
}
|
|
})*/
|
}else{
|
ElMessage.warning(res.msg)
|
router.push("/login")
|
}
|
})
|
}
|
|
const handleChange = () => {
|
if(selectedValues.value.length===0){
|
selectedValues.value=null;
|
}
|
|
request.post(`/delivery/getSelectOrderPrinting/${selectedValues.value}`,form.value).then((res) => {
|
if(res.code==200){
|
sumMoney=0
|
produceList.value = deepClone(res.data.data)
|
delivery.value=deepClone(res.data.delivery)
|
money.value=deepClone(res.data.money)
|
produceList.value.forEach(item => {
|
sumMoney+=item.DeliveryDetail.grossAmount
|
})
|
otherMoney1=[]
|
otherMoney=deepClone(res.data.otherMoney)
|
for(let i=0;i<otherMoney.length;i++){
|
if(otherMoney[i].DeliveryDetailOtherMoney.monery!=null){
|
otherMoneys+=otherMoney[i].DeliveryDetailOtherMoney.monery
|
if(otherMoney1.length===0){
|
otherMoney1.push(otherMoney[i])
|
}
|
else{
|
for(let s=0;s<otherMoney1.length;s++){
|
if(otherMoney[i].DeliveryDetailOtherMoney.alias===otherMoney1[s].DeliveryDetailOtherMoney.alias){
|
otherMoney1[s].DeliveryDetailOtherMoney.count=add(otherMoney[i].DeliveryDetailOtherMoney.count,otherMoney1[s].DeliveryDetailOtherMoney.count)
|
otherMoney1[s].DeliveryDetailOtherMoney.monery =add(otherMoney[i].DeliveryDetailOtherMoney.monery,otherMoney1[s].DeliveryDetailOtherMoney.monery)
|
break
|
}
|
if(s+1===otherMoney1.length){
|
otherMoney1.push(otherMoney[i])
|
break
|
}
|
}
|
|
}
|
}
|
|
}
|
}else{
|
ElMessage.warning(res.msg)
|
router.push("/login")
|
}
|
})
|
|
}
|
|
onMounted(() => {
|
getData()
|
})
|
|
const handleDoubleClick = () => {
|
dialogVisible.value=true
|
}
|
|
|
|
|
|
|
|
|
</script>
|
|
|
<template>
|
<div id="sheet" @dblclick="handleDoubleClick">
|
<table border="1" >
|
<thead>
|
<tr class="title-s">
|
<th colspan="9">
|
<h1>
|
{{company.companyName}}
|
</h1>
|
</th>
|
</tr>
|
|
<tr class="title-s">
|
<th colspan="2"></th>
|
<th colspan="5">
|
<h3>销售确认单</h3>
|
</th>
|
<th colspan="2" style="text-align: left;font-weight: bold;" v-if="company.showDeliveryCreator">发货单号:<span>{{delivery.deliveryId}}</span></th>
|
</tr>
|
<tr>
|
<th style="text-align: left;border:none;font-weight: bold;" colspan="4">客户名称:<span>{{delivery.customerName}}</span></th>
|
<th style="text-align: left;border:none;font-weight: bold;" colspan="3">项目名称:<span>{{delivery.project}}</span></th>
|
<th style="text-align: left;border:none;font-weight: bold;" colspan="2">联系人:<span>{{delivery.contacts}}</span></th>
|
</tr>
|
<tr>
|
<th style="text-align: left;border:none;font-weight: bold;" colspan="7">送货地址:<span>{{delivery.deliveryAddress}}</span></th>
|
<th style="text-align: left;border:none;font-weight: bold;" colspan="2">联系电话:<span>{{delivery.contactNumber}}</span></th>
|
</tr>
|
<tr>
|
<th style="width: 6%;">序号</th>
|
<th style="width: 15%;">楼层编号</th>
|
<th style="width: 17%;" colspan="1">宽X高</th>
|
<th style="width: 10%;">数量</th>
|
<th style="width: 10%;">总面积</th>
|
<th style="width: 10%;">单价</th>
|
<th style="width: 12%;">金额</th>
|
<th v-if="company.showDeliveryCreator" style="width: 20%;" colspan="2">加工要求</th>
|
<th v-if="!company.showDeliveryCreator" style="width: 10%;" colspan="1">加工要求</th>
|
<th v-if="!company.showDeliveryCreator" style="width: 10%;" colspan="1">备注</th>
|
</tr>
|
</thead>
|
<template v-for="(item, index) in produceList" :key="index" >
|
<tr>
|
<td style="font-size: 15px;font-weight: bold;text-align: left" colspan="4">产品名称:
|
<span v-if="company.productName!=='product_abbreviation'">{{item.productName}}</span>
|
<span v-else >{{item.remarks}}</span>
|
</td>
|
<td v-if="company.showDeliveryCreator" style="font-size: 15px;font-weight: bold;text-align: left" colspan="2">订货日期:<span>{{delivery.contractId}}</span></td>
|
<td v-else style="font-size: 15px;font-weight: bold;text-align: left" colspan="2"></td>
|
<td style="font-size: 15px;font-weight: bold;text-align: left" colspan="3">订单编号:<span>{{item.DeliveryDetail.orderId}}</span></td>
|
</tr>
|
|
<tr class="day-in" v-for="(items, index1) in item.DeliveryDetailList" :key="index1">
|
<td>{{items.order_number}}</td>
|
<td>{{items.buildingNumber}}</td>
|
<td colspan="1" style="font-size: 15px;font-weight: bold;" v-if="company.showDeliveryCreator&&items.other_columns!=null&&(JSON.parse(items.other_columns).S02!=null)">{{JSON.parse(items.other_columns).S02}}</td>
|
<td colspan="1" style="font-size: 15px;font-weight: bold;" v-else>{{items.width}}x{{items.height}}</td>
|
<td>{{items.quantity}}</td>
|
<td>{{items.compute_gross_area}}</td>
|
<td>{{items.price}}</td>
|
<td>{{items.gross_amount}}</td>
|
<td v-if="company.showDeliveryCreator" colspan="2">{{items.processingNote}}</td>
|
<td v-if="!company.showDeliveryCreator" >{{items.processingNote}}</td>
|
<td v-if="!company.showDeliveryCreator" >{{items.remarks}}</td>
|
</tr>
|
<tr class="day-in" >
|
<td style="font-size: 15px;font-weight: bold;" colspan="3">小计:</td>
|
<td>{{item.DeliveryDetail.quantity}}</td>
|
<td>{{item.DeliveryDetail.area}}</td>
|
<td></td>
|
<td>{{item.DeliveryDetail.grossAmount}}</td>
|
<td colspan="2"></td>
|
</tr>
|
|
</template>
|
<tr class="day-in">
|
<td style="font-size: 15px;font-weight: bold;" colspan="3">合计:</td>
|
<td>{{delivery.quantity}}</td>
|
<td>{{delivery.area}}</td>
|
<td></td>
|
<td>{{parseFloat(sumMoney.toFixed(2))}}</td>
|
<td colspan="2"></td>
|
</tr>
|
<tr class="day-in">
|
<td style="text-align: left;border-width: 0 1px 0 0; border-style: solid; border-color: #d3dce6" colspan="4">
|
<div style="display: flex;font-size: 10px;text-align: center;">
|
<span style="width: 25%">加工费用</span>
|
<span style="width: 25%">单价</span>
|
<span style="width: 25%">数量</span>
|
<span style="width: 25%">金额</span>
|
</div>
|
</td>
|
<td style="text-align: left;border:none;font-size: 15px;font-weight: bold;" colspan="5">总金额: {{delivery.money}}</td>
|
</tr>
|
<tr class="day-in">
|
<td style="text-align: left;border-width: 0 1px 0 0; border-style: solid; border-color: #d3dce6;" colspan="4" >
|
<div style="display: flex;font-size: 10px;text-align: center" v-for="(item, index2) in otherMoney1" :key="index2">
|
<span style="width: 25%">{{item.DeliveryDetailOtherMoney.alias}}</span>
|
<span style="width: 25%">{{item.DeliveryDetailOtherMoney.price}}</span>
|
<span style="width: 25%">{{item.DeliveryDetailOtherMoney.count}}</span>
|
<span style="width: 25%">{{parseFloat(item.DeliveryDetailOtherMoney.monery).toFixed(2)}}</span>
|
</div>
|
</td>
|
<td style="text-align: left;border:none;font-size: 15px;font-weight: bold;" colspan="5">大写金额: {{money}}</td>
|
</tr>
|
|
</table>
|
<el-row :gutter="20">
|
<el-col :span="4">制单员:<span style="font-size: 10px">{{delivery.creator}}</span></el-col>
|
<el-col :span="4">制单日期:<span style="font-size: 10px">{{delivery.createTime}}</span></el-col>
|
<el-col v-if="company.showDeliveryCreator" :span="4">发货员:</el-col>
|
<el-col v-if="company.showDeliveryCreator" :span="3">司机:</el-col>
|
<el-col v-if="company.showDeliveryCreator" :span="4">客户签字:</el-col>
|
<el-col v-if="company.showDeliveryCreator" :span="4">签收日期:</el-col>
|
|
</el-row>
|
<el-row :gutter="20" style="margin-top: 20px;" v-if="company.showDeliveryCreator">
|
<el-col :span="4"><div class="bottom">架子 只</div></el-col>
|
<el-col :span="20"><div class="bottom">{{takeCare}}</div></el-col>
|
</el-row>
|
<el-row :gutter="20" style="margin-top: 20px;" v-if="company.showDeliveryCreator">
|
<el-col :span="24"><div class="bottom">{{remark}}</div></el-col>
|
</el-row>
|
<el-row :gutter="20" style="margin-top: 20px;" v-if="!company.showDeliveryCreator">
|
<!-- <el-input
|
v-model=""
|
autosize
|
type="textarea"
|
placeholder="Please input"
|
/>-->
|
<el-col :span="24"><div class="bottom">{{delivery.processingNote}}</div></el-col>
|
</el-row>
|
|
<el-dialog v-model="dialogVisible" style="width: 40%;height: 20%;margin-top: 10%" >
|
<el-select v-model="selectedValues" style="width: 100%" @change="handleChange" multiple placeholder="请选择">
|
<el-option
|
v-for="item in productIdData"
|
:key="item"
|
:label='item.productId+" "+item.productName'
|
:value="item.productId">
|
</el-option>
|
</el-select>
|
</el-dialog>
|
|
</div>
|
|
|
</template>
|
|
|
|
<style scoped>
|
h1,h3{
|
left:0;
|
right:0;
|
top:0;
|
bottom:0;
|
margin:auto;
|
}
|
h1{
|
font-size: 1.5rem;
|
}
|
h3{
|
font-size: 1.2rem;
|
font-weight: bolder;
|
}
|
|
|
table{
|
border-collapse: collapse;
|
width: 100%;
|
text-align: center;
|
}
|
tr,td,th{
|
border: 1px solid black;
|
}
|
|
th,.no-change-row {
|
white-space: nowrap;
|
}
|
|
.title-1{
|
width: 76px;
|
}
|
.title-s,.title-s th{
|
border:0
|
}
|
|
.hr-border{
|
height: 2px;
|
width: 100%;
|
background-color: black;
|
color: black;
|
}
|
|
|
</style>
|