廖井涛
2025-07-03 733ad4523cb3e32876dc2155d12c1c527c590f6b
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
<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("具体规格详见清单")
let remark =ref(company.deliveryRemark)
 
 
 
let props = defineProps({
  deliveryId:null,
  type: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){
      console.log(res.data)
      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">
    <div v-for="(item, index) in produceList2" :key="index">
 
 
    <div id="header">
      <div id="header-pane">
        <div>洛阳玻璃公司</div>
        <div style="margin: auto;">{{item.delivery.deliveryId}}</div>
        <div>{{item.delivery.deliveryDate }}</div>
      </div>
 
      <div id="header-customer" style="display: flex;height: 50px;line-height: 50px">
        <div>{{item.delivery.customerName }}</div>
        <div style="margin-left: 60%;">{{item.delivery.project }}</div>
      </div>
 
      <div id="header-order-id" style="height: 50px;line-height: 50px">
        <div>{{item.delivery.orderId }}</div>
      </div>
    </div>
 
    <div id="content">
      <div style="display:flex;margin-top: 20px" id="content-pane" v-for="(items, index) in item.data" :key="index">
        <div style="width: 200px;">
          <el-input  class="textarea" type="textarea" :autosize="{ minRows: 2, maxRows: 20 }" v-model="items.DeliveryDetail.orderDetail.productName" />
        </div>
        <div style="width: 200px">
          <el-input  class="textarea" type="textarea" :autosize="{ minRows: 2, maxRows: 20 }" v-model="takeCare" />
        </div>
        <div style="width: 70px">{{items.DeliveryDetail.quantity}}</div>
        <div style="width: 70px">{{items.DeliveryDetail.area}}</div>
        <div style="width: 70px" v-if="props.type===1">{{items.DeliveryDetail.price}}</div>
        <div style="width: 70px" v-if="props.type===1">{{items.DeliveryDetail.money}}</div>
      </div>
      <div style="display:flex;height: 50px" id="content-total">
        <div style="width: 200px;"></div>
        <div style="width: 200px"></div>
        <div style="width: 70px">{{item.delivery.quantity}}</div>
        <div style="width: 70px">{{item.delivery.area}}</div>
        <div style="width: 70px"></div>
        <div style="width: 70px" v-if="props.type===1">{{item.delivery.money }}</div>
      </div>
      <div style="height: 70px" id="content-name">
        <div style="margin-left: 610px">{{item.delivery.creator }}</div>
      </div>
      <div style="display:flex;" id="content-customer">
        <div style="margin-left: 80px">{{item.delivery.contacts}}&nbsp;{{item.delivery.contactNumber }}</div>
        <div style="margin-left: 200px">{{item.delivery.deliveryAddress}}</div>
      </div>
 
    </div>
 
  </div>
  </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添加页码 */
    }
  }
}
#header-pane{
  display: flex;
  width: 100%;
  height: 90px;
  line-height: 90px;
}
.textarea{
--el-border-color: rgba(255,255,255,0.0);
--el-input-focus-border-color: rgba(255,255,255,0.0);
--el-input-focus-border-width: 0px;
--el-input-hover-border-color: rgba(255,255,255,0.0);
--el-input-hover-border-width: 0px;
}
 
 
 
</style>