yyb
2 天以前 b01f86dddbefbd03da6b6fa478ddecc02aabd203
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
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
<template>
  <view class="receipt-payment-detail">
    <!-- 使用通用页面头部组件 -->
    <PageHeader title="产品明细"
                @back="goBack" />
    <!-- 统计信息 -->
    <view class="summary-info">
      <view class="summary-item">
        <text class="summary-label">客户名称</text>
        <text class="summary-value">{{ outData.customerName }}</text>
      </view>
      <view class="summary-item">
        <text class="summary-label">合同金额</text>
        <text class="summary-value">{{ outData.contractAmount }}</text>
      </view>
      <view class="summary-item">
        <text class="summary-label">签订日期</text>
        <text class="summary-value">{{ outData.executionDate }}</text>
      </view>
    </view>
    <!-- 回款记录明细列表 -->
    <view class="detail-list"
          v-if="tableData.length > 0">
      <view v-for="(item, index) in tableData"
            :key="rowKey(item, index)"
            class="detail-item">
        <view class="item-header"
              @click="toggleRow(item, index)">
          <view class="item-left">
            <view class="record-icon">
              <up-icon name="file-text"
                       size="16"
                       color="#ffffff"></up-icon>
            </view>
            <view class="item-title-wrap">
              <text class="item-index">{{ item.productCategory || "产品" }}</text>
            </view>
          </view>
          <view class="item-header-right">
            <text class="toggle-text">{{ rowExpanded(item, index) ? "收起" : "展开" }}</text>
            <up-icon :name="rowExpanded(item, index) ? 'arrow-up' : 'arrow-down'"
                     size="16"
                     color="#999999"></up-icon>
          </view>
        </view>
        <up-divider></up-divider>
        <view v-if="!rowExpanded(item, index)"
              class="item-preview">
          <view class="detail-row">
            <text class="detail-label">楼层编号</text>
            <text class="detail-value">{{ dv(item.floorCode) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">规格型号</text>
            <text class="detail-value">{{ dv(item.specificationModel) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">数量</text>
            <text class="detail-value">{{ dv(item.quantity) }}</text>
          </view>
        </view>
        <view v-else
              class="item-details">
          <view class="detail-row">
            <text class="detail-label">楼层编号</text>
            <text class="detail-value">{{ dv(item.floorCode) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">产品大类</text>
            <text class="detail-value">{{ dv(item.productCategory) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">规格型号</text>
            <text class="detail-value">{{ dv(item.specificationModel) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">厚度</text>
            <text class="detail-value">{{ dv(item.thickness) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">宽(mm)</text>
            <text class="detail-value">{{ dv(item.width) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">高(mm)</text>
            <text class="detail-value">{{ dv(item.height) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">周长(cm)</text>
            <text class="detail-value">{{ dv(item.perimeter) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">总面积(cm²)</text>
            <text class="detail-value">{{ dv(item.actualTotalArea) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">加工要求</text>
            <text class="detail-value">{{ dv(item.processRequirement) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">备注</text>
            <text class="detail-value">{{ dv(item.remark) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">重箱</text>
            <text class="detail-value">{{ dv(item.heavyBox) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">产品状态</text>
            <text v-if="item.approveStatus === 1"
                  class="detail-value highlight">充足</text>
            <text v-else
                  class="detail-value danger">不足</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">快递公司</text>
            <text class="detail-value">{{ dv(item.expressCompany) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">快递单号</text>
            <text class="detail-value">{{ dv(item.expressNumber) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">发货车牌</text>
            <u-tag size="mini"
                   v-if="item.shippingCarNumber"
                   type="success">{{ item.shippingCarNumber }}</u-tag>
            <u-tag v-else
                   size="mini"
                   type="info">-</u-tag>
          </view>
          <view class="detail-row">
            <text class="detail-label">发货日期</text>
            <text class="detail-value">{{ dv(item.shippingDate) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">数量</text>
            <text class="detail-value">{{ dv(item.quantity) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">税率(%)</text>
            <text class="detail-value">{{ dv(item.taxRate) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">含税单价(元)</text>
            <text class="detail-value">{{ dv(item.taxInclusiveUnitPrice) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">含税总价(元)</text>
            <text class="detail-value">{{ dv(item.taxInclusiveTotalPrice) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">不含税总价(元)</text>
            <text class="detail-value">{{ dv(item.taxExclusiveTotalPrice) }}</text>
          </view>
        </view>
      </view>
    </view>
    <view v-else
          class="no-data">
      <text>暂无回款记录</text>
    </view>
  </view>
</template>
 
<script setup>
  import { ref, onMounted } from "vue";
  import { productList } from "@/api/salesManagement/salesLedger";
 
  // 客户信息
  const supplierId = ref("");
 
  // 表格数据
  const tableData = ref([]);
 
  /** 每条明细折叠状态:仅一条时默认展开,多条时默认收起 */
  const expandedRows = ref({});
 
  const rowKey = (item, index) =>
    item?.id != null && item?.id !== "" ? `id-${item.id}` : `idx-${index}`;
 
  const rowExpanded = (item, index) => !!expandedRows.value[rowKey(item, index)];
 
  const toggleRow = (item, index) => {
    const k = rowKey(item, index);
    expandedRows.value = {
      ...expandedRows.value,
      [k]: !expandedRows.value[k],
    };
  };
 
  const dv = v => {
    if (v === null || v === undefined || v === "") return "-";
    if (typeof v === "boolean") return v ? "是" : "否";
    return v;
  };
 
  // 返回上一页
  const goBack = () => {
    uni.removeStorageSync("supplierId");
    uni.navigateBack();
  };
 
  // 获取页面参数
  const getPageParams = () => {
    // 从本地存储获取供应商ID
    const storedSupplierId = uni.getStorageSync("supplierId");
    if (storedSupplierId) {
      supplierId.value = storedSupplierId;
    }
  };
  // 查询列表
  const getList = () => {
    showLoadingToast("加载中...");
    productList({
      salesLedgerId: outData.value.id,
      type: 1,
    })
      .then(res => {
        const list = res.data || res.records || [];
        tableData.value = list;
        if (list.length === 1) {
          const k = rowKey(list[0], 0);
          expandedRows.value = { [k]: true };
        } else {
          expandedRows.value = {};
        }
        closeToast();
      })
      .catch(() => {
        closeToast();
        uni.showToast({
          title: "查询失败",
          icon: "error",
        });
      });
  };
  // 显示加载提示
  const showLoadingToast = message => {
    uni.showLoading({
      title: message,
      mask: true,
    });
  };
 
  // 关闭提示
  const closeToast = () => {
    uni.hideLoading();
  };
  const outData = ref({});
 
  onMounted(() => {
    // 页面加载时获取参数并刷新列表
    getPageParams();
    // 从本地存储获取发货状态数据
    outData.value = JSON.parse(uni.getStorageSync("outData"));
    getList();
  });
</script>
 
<style scoped lang="scss">
  .receipt-payment-detail {
    min-height: 100vh;
    background: #f8f9fa;
    position: relative;
  }
 
  .u-divider {
    margin: 0 !important;
  }
 
  .summary-info {
    background: #ffffff;
    margin: 20px 20px 0 20px;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }
 
  .summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
 
    &:last-child {
      margin-bottom: 0;
    }
  }
 
  .summary-label {
    font-size: 14px;
    color: #666;
  }
 
  .summary-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
  }
 
  .summary-value.highlight {
    color: #2979ff;
    font-weight: 600;
  }
 
  .summary-value.danger {
    color: #ff4757;
    font-weight: 600;
  }
 
  .detail-list {
    padding: 20px;
  }
 
  .detail-item {
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 0 16px;
  }
 
  .item-header {
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
 
  .item-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
 
  .item-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }
 
  .toggle-text {
    font-size: 12px;
    color: #2979ff;
  }
 
  .item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
 
  .item-preview {
    padding: 12px 0 16px;
  }
 
  .preview-tip {
    margin-top: 8px;
    margin-bottom: 0 !important;
    justify-content: center;
  }
 
  .preview-tip-text {
    font-size: 11px;
    color: #bbb;
  }
 
  .record-icon {
    width: 24px;
    height: 24px;
    background: #2979ff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
 
  .item-index {
    font-size: 14px;
    color: #333;
    font-weight: 500;
  }
 
  .item-date {
    font-size: 12px;
    color: #666;
  }
 
  .item-details {
    padding: 16px 0;
  }
 
  .detail-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 8px;
 
    &:last-child {
      margin-bottom: 0;
    }
  }
 
  .detail-label {
    font-size: 12px;
    color: #777777;
    min-width: 60px;
  }
 
  .detail-value {
    font-size: 12px;
    color: #000000;
    text-align: right;
    flex: 1;
    margin-left: 16px;
  }
 
  .detail-value.highlight {
    color: #2979ff;
    font-weight: 500;
  }
 
  .detail-value.danger {
    color: #ff4757;
    font-weight: 500;
  }
 
  .no-data {
    padding: 40px 0;
    text-align: center;
    color: #999;
  }
</style>