廖井涛
2025-05-22 0f7e88d17a2bb96b496a31c6ba6c1837221c3623
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
<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 otherMoney = []
let otherMoney1 = []
let delivery = ref([])
let money = ref("")
let otherMoneys = 0
let sumMoney = 0
let takeCare =ref("注意:请妥善保管好我司的玻璃架,如有丢失或损坏,按1500元只赔偿。谢谢配合!")
let remark =ref(company.deliveryRemark)
 
 
 
let props = defineProps({
  deliveryId:null
})
const form = ref({
})
let produceList2 = ref([])
 
 
 
const getData = () => {
  if(props.deliveryId===null  || props.deliveryId===undefined || props.deliveryId===''){
    return
  }
  form.value.deliveryId=props.deliveryId
  form.value.type=company.productName
 
 
  request.post(`/delivery/getSelectDeliveryPrinting`,form.value).then((res) => {
    if(res.code==200){
      produceList.value = deepClone(res.data)
      for(let i=0;i<produceList.value.length;i++){
        let produceList1= ({
          data:null,
          otherMoney:null,
          otherMoney1:null,
          delivery:null,
          money:null,
          otherMoneys:0,
          sumMoney:0
        })
        produceList1.data=produceList.value[i].data
        produceList1.delivery=produceList.value[i].delivery
        produceList1.money=produceList.value[i].money
        produceList1.otherMoney=produceList.value[i].otherMoney
        for(let j=0;j<produceList1.data.length;j++){
          produceList1.sumMoney+=produceList1.data[j].DeliveryDetail.money
        }
        otherMoney1=[]
        for(let i=0;i<produceList1.otherMoney.length;i++){
          if(produceList1.otherMoney[i].DeliveryDetailOtherMoney.monery!=null){
            produceList1.otherMoneys+=produceList1.otherMoney[i].DeliveryDetailOtherMoney.monery
            if(otherMoney1.length===0){
              otherMoney1.push(produceList1.otherMoney[i])
            }
            else{
              for(let s=0;s<otherMoney1.length;s++){
                if(produceList1.otherMoney[i].DeliveryDetailOtherMoney.alias===otherMoney1[s].DeliveryDetailOtherMoney.alias){
 
                  otherMoney1[s].DeliveryDetailOtherMoney.count=add(produceList1.otherMoney[i].DeliveryDetailOtherMoney.count,otherMoney1[s].DeliveryDetailOtherMoney.count)
                  otherMoney1[s].DeliveryDetailOtherMoney.monery =add(produceList1.otherMoney[i].DeliveryDetailOtherMoney.monery,otherMoney1[s].DeliveryDetailOtherMoney.monery)
                  break
                }
                if(s+1===otherMoney1.length){
                  otherMoney1.push(produceList1.otherMoney[i])
                  break
                }
              }
 
            }
 
          }
 
        }
        produceList1.otherMoney1=otherMoney1
        produceList2.value.push(produceList1)
      }
      for(let j=0;j<produceList2.value.length;j++){
 
        if(produceList2.value[j].delivery.money.toFixed(0)!==(produceList2.value[j].otherMoneys
            +produceList2.value[j].sumMoney+produceList2.value[j].delivery.freight).toFixed(0)){
          console.log(produceList2.value[j])
          console.log(produceList2.value[j].delivery.money)
          console.log((produceList2.value[j].otherMoneys
              +produceList2.value[j].sumMoney).toFixed(0))
          console.log(produceList2.value[j].delivery.deliveryId)
        }
 
      }
 
    }else{
      ElMessage.warning(res.msg)
      router.push("/login")
    }
  })
}
 
onMounted(() => {
  getData()
})
 
const  stringToJson = (productList) => {
  productList.forEach(item => {
    item.otherColumns = JSON.parse(item.otherColumns)
  })
}
 
const getQuantity = (productList) => {
  let quantity = 0
  productList.forEach(item => {
    quantity += item.quantity
  })
  return parseFloat(quantity.toFixed(3))
 
}
 
const getArea = (productList) => {
  let area = 0
  productList.forEach(item => {
    area += item.grossArea
  })
  return parseFloat(area.toFixed(3))
 
}
 
const getPerimeter = (productList) => {
  let perimeter = 0
  productList.forEach(item => {
    perimeter += item.perimeter
  })
  return parseFloat(perimeter.toFixed(3))
}
 
const printSheet = () => {
}
 
 
 
 
defineExpose({
  printSheet
});
</script>
 
<template>
  <div id="sheet">
    <table class="pages" v-for="(itme1, index) in produceList2" :key="index" >
      <thead>
      <tr class="title-s">
        <th colspan="9">
          <h1>
            {{company.companyName}}
          </h1>
        </th>
      </tr>
 
      <tr  class="title-s">
        <th colspan="2" style="width: 30%"></th>
        <th colspan="5" style="width: 40%;">
          <h3>销售发货单</h3>
        </th>
        <th colspan="2" style="width: 30%;text-align: left;">发货单号:<span>{{itme1.delivery.deliveryId}}</span></th>
      </tr>
      <tr>
        <th style="text-align: left;border:none;" colspan="4">客户名称:<span>{{itme1.delivery.customerName}}</span></th>
        <th style="text-align: left;border:none;" colspan="3">项目名称:<span>{{itme1.delivery.project}}</span></th>
        <th style="text-align: left;border:none;" colspan="2">联系人:<span>{{itme1.delivery.contacts}}</span></th>
      </tr>
      <tr>
        <th style="text-align: left;border:none;" colspan="7">送货地址:<span>{{itme1.delivery.deliveryAddress}}</span></th>
        <th style="text-align: left;border:none;" colspan="2">联系电话:<span>{{itme1.delivery.contactNumber}}</span></th>
      </tr>
 
 
      </thead>
      <tr style="border-style: none">
        <td colspan="9" style="border-style: none">
          <table style="border-style: none;width: 100%;height: 100%;">
            <template v-for="(item, index) in itme1.data" :key="index" >
              <thead>
              <tr v-if="index===0">
                <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 style="width: 20%;" colspan="2">加工要求</th>
              </tr>
 
 
              </thead>
              <tr>
                <td style="font-size: 15px;text-align: left" colspan="4">产品名称:<span>{{item.DeliveryDetail.orderDetail.productName}}</span></td>
                <td v-if="company.showDeliveryCreator" style="font-size: 15px;text-align: left" colspan="2">订货日期:<span>{{item.DeliveryDetail.order.contractId}}</span></td>
                <td style="font-size: 15px;text-align: left" colspan="3">订单编号:<span>{{item.DeliveryDetail.orderDetail.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="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.area}}</td>
                <td>{{items.price}}</td>
                <td>{{items.money}}</td>
                <td colspan="2">{{items.processingNote}}</td>
              </tr>
              <tr class="day-in" >
                <td style="font-size: 15px;" colspan="3">小计:</td>
                <td>{{item.DeliveryDetail.quantity}}</td>
                <td>{{item.DeliveryDetail.area}}</td>
                <td></td>
                <td>{{item.DeliveryDetail.money}}</td>
                <td colspan="2"></td>
              </tr>
 
            </template>
            <tr class="day-in">
              <td style="font-size: 15px;" colspan="3">合计:</td>
              <td>{{itme1.delivery.quantity}}</td>
              <td>{{itme1.delivery.area}}</td>
              <td></td>
              <td>{{parseFloat(itme1.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>&nbsp;
                  <span  style="width: 25%">单价</span>&nbsp;
                  <span  style="width: 25%">数量</span>&nbsp;
                  <span  style="width: 25%">金额</span>
                </div>
              </td>
              <td style="text-align: left;border:none;font-size: 15px;" colspan="5">总金额:&nbsp;&nbsp;&nbsp;&nbsp;{{itme1.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 itme1.otherMoney1" :key="index2">
                  <span style="width: 25%">{{item.DeliveryDetailOtherMoney.alias}}</span>&nbsp;
                  <span  style="width: 25%">{{item.DeliveryDetailOtherMoney.price}}</span>&nbsp;
                  <span  style="width: 25%">{{item.DeliveryDetailOtherMoney.count}}</span>&nbsp;
                  <span  style="width: 25%">{{parseFloat(item.DeliveryDetailOtherMoney.monery).toFixed(2)}}</span>
                </div>
                <div style="display: flex;font-size: 10px;text-align: center" v-if="itme1.delivery.freight>0">
                  <span style="width: 25%">运费</span>&nbsp;
                  <span  style="width: 25%">{{itme1.delivery.freightPrice}}</span>&nbsp;
                  <span  style="width: 25%">{{itme1.delivery.freightQuantity}}</span>&nbsp;
                  <span  style="width: 25%">{{itme1.delivery.freight}}</span>
                </div>
              </td>
              <td style="text-align: left;border:none;font-size: 15px;" colspan="5">大写金额:&nbsp;&nbsp;&nbsp;&nbsp;{{itme1.money}}</td>
            </tr>
 
 
            <!--      <el-row :gutter="24">
                    <el-col :span="4"><div style="font-size: 12px" class="bottom">制单员:{{data.order.creator}}<span style="font-size: 10px"></span></div></el-col>
                    <el-col :span="6"><div style="font-size: 12px" class="bottom">制单日期:{{data.order.createTime}}<span style="font-size: 10px"></span></div></el-col>
                    <el-col :span="4"><div style="font-size: 12px" class="bottom">审核员:{{data.order.verifier}}</div></el-col>
                    <el-col :span="6"><div style="font-size: 12px" class="bottom">审核日期:{{data.order.updateTime}}</div></el-col>
                    <el-col :span="4"><div style="font-size: 12px" class="bottom">打印人:{{username}}</div></el-col>
 
                  </el-row>-->
 
            <tr class="day-in" style="border: 0;" v-if="company.showDeliveryCreator">
              <td colspan="9" style="border: 0">
                <div style="display:flex;text-align: left"  class="bottom">
                  <div style="width: 15%">制单员:{{ itme1.delivery.creator }}</div>
                  <div style="width: 25%">制单日期:{{ itme1.delivery.createTime }}</div>
                  <div style="width: 10%">发货员:</div>
                  <div style="width: 10%">司机:</div>
                  <div style="width: 15%">客户签字:</div>
                  <div style="width: 15%">签收日期:</div>
                </div>
              </td>
            </tr>
            <tr class="day-in" style="border: 0;" v-if="company.showDeliveryCreator">
              <td colspan="9" style="border: 0;">
                <div style="display:flex;" class="bottom">
                  架子&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;只&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  {{takeCare}}
                </div>
              </td>
            </tr>
            <tr class="day-in" style="border: 0;">
              <td colspan="9" style="border: 0;">
                <div style="display:flex;text-align: left;border: 0;margin-top: 10px " class="bottom" >
                  <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 20 }" v-model="remark"/>
                </div>
 
              </td>
            </tr>
 
            <tr class="day-in" style="border: 0" v-if="!company.showDeliveryCreator">
              <td colspan="9" style="border: 0">
                <div style="width: 100%;height: 50px"></div>
              </td>
            </tr>
            <tr class="day-in" style="border: 0" v-if="!company.showDeliveryCreator">
              <td colspan="9" style="border: 0">
                <div style="display:flex;text-align: left"  class="bottom">
                  <div style="width: 15%">制单员:{{ itme1.delivery.creator }}</div>
                  <div style="width: 15%">制单日期:{{ itme1.delivery.createTime1 }}</div>
                  <div style="width: 15%">发货员:</div>
                  <div style="width: 15%">司机:</div>
                  <div style="width: 15%">客户签字:</div>
                  <div style="width: 15%">签收日期:</div>
                </div>
              </td>
            </tr>
 
          </table>
        </td>
      </tr>
 
    </table>
 
 
 
  </div>
 
 
</template>
 
 
 
 
<style scoped>
@media print {
  @page {
    margin: 12mm 10mm 20mm 10mm !important;
  }
  .pages {
    page-break-after: always;
  }
 
  @page {
    @top-right {
      margin-top: 50px;
      content: "第 " counter(page)  " 页"; /* 使用counter添加页码 */
    }
  }
}
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;
}
table {
  border-collapse: collapse;
  width: 100%;
 
}
td > table {
  margin: 0;
  padding: 0;
}
 
 
 
</style>