ZN
8 天以前 796c6f914284aacd7b4abdaf50e6ff06df7faf71
feat(扫码弹窗): 优化扫码列表显示并调整API调用

- 新增detailManagement API用于获取扫码详情
- 替换detailManagementByCustom为detailManagement API调用
- 优化扫码列表显示字段,增加产品高度、美元单价等信息
- 添加时间格式化函数,美化时间显示格式
- 注释导出表格按钮功能
- 调整字段映射关系,如productName替换productCategory
已修改2个文件
73 ■■■■■ 文件已修改
src/api/inventoryManagement/receiptManagement.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/components/ScanListPopup.vue 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inventoryManagement/receiptManagement.js
@@ -51,6 +51,13 @@
    params: query,
  });
}
export function detailManagement(query) {
    return request({
      url: "/stockInventory/getById",
      method: "get",
        params:query,
    });
}
// 采购入库-详情
export function stockinDetail(query) {
  return request({
src/pages/components/ScanListPopup.vue
@@ -25,13 +25,13 @@
                >
                    {{ isScanning ? '扫码中...' : '继续扫码' }}
                </up-button>
                <up-button
                    type="success"
                    size="small"
                    @click="exportToCSV"
                >
                    导出表格
                </up-button>
<!--                <up-button -->
<!--                    type="success" -->
<!--                    size="small" -->
<!--                    @click="exportToCSV"-->
<!--                >-->
<!--                    导出表格-->
<!--                </up-button>-->
                <up-button 
                    type="error" 
                    size="small" 
@@ -56,7 +56,7 @@
                    >
                        <view class="item-header">
                            <text class="item-index">#{{ index + 1 }}</text>
                            <text class="item-time">{{ item.scanTime }}</text>
                            <text class="item-time">{{  formatTime(item.scanTime) }}</text>
                            <view class="item-delete" @click="deleteItem(index)">
                                <up-icon name="trash" size="16" color="#f56c6c"></up-icon>
                            </view>
@@ -69,35 +69,43 @@
                            </view>
                            <view class="item-row">
                                <text class="item-label">产品名称:</text>
                                <text class="item-value">{{ item.productCategory || '-' }}</text>
                                <text class="item-value">{{ item.productName || '-' }}</text>
                            </view>
                            <view class="item-row">
                                <text class="item-label">产品高度:</text>
                            <text class="item-value">{{ item.height || '-' }}</text>
                          </view>
                          <view class="item-row">
                            <text class="item-label">单位:</text>
                                <text class="item-value">{{ item.specificationModelUnit || '-' }}</text>
                            </view>
                            <view class="item-row">
                                <text class="item-label">单价(美元)/件:</text>
                                <text class="item-label">单价(人民币)/件:</text>
                                <text class="item-value">{{ item.taxInclusiveUnitPrice || '-' }}</text>
                            </view>
                            <view class="item-row">
                            <text class="item-label">单价(美元)/件:</text>
                            <text class="item-value">{{ item.dollarPrice || '-' }}</text>
                          </view>
                            <view class="item-row">
                                <text class="item-label">入库数量/件:</text>
                                <text class="item-value">{{ item.inboundNum || '-' }}</text>
                                <text class="item-value">{{ item.qualitity || '-' }}</text>
                            </view>
                            <view class="item-row">
                                <text class="item-label">每件数量/支:</text>
                                <text class="item-value">{{ item.boxNum || '-' }}</text>
                            </view>
                            <view class="item-row">
                                <text class="item-label">纸箱规格:</text>
                                <text class="item-value">{{ item.cartonSpecifications || '-' }}</text>
                                <text class="item-label">规格型号:</text>
                                <text class="item-value">{{ item.model || '-' }}</text>
                            </view>
                            <view class="item-row">
                                <text class="item-label">入库人:</text>
                                <text class="item-value">{{ item.createBy || '-' }}</text>
                                <text class="item-value">{{ item.createUserName || '-' }}</text>
                            </view>
                            <view class="item-row">
                                <text class="item-label">入库时间:</text>
                                <text class="item-value">{{ item.inboundDate || '-' }}</text>
                                <text class="item-value">{{ item.createTime || '-' }}</text>
                            </view>
                        </view>
                    </view>
@@ -109,7 +117,7 @@
 
<script setup>
import { ref, reactive } from 'vue';
import { stockinDetail, detailManagementByCustom, exportScanList } from '@/api/inventoryManagement/receiptManagement'
import { stockinDetail, detailManagementByCustom,detailManagement, exportScanList } from '@/api/inventoryManagement/receiptManagement'
import config from '@/config'
import { getToken } from '@/utils/auth'
import request from '@/utils/request'
@@ -174,9 +182,8 @@
    if (type == 1) {
        detailApi = stockinDetail;
    } else if (type == 2) {
        detailApi = detailManagementByCustom;
        detailApi = detailManagement;
    }
    if (!detailApi) {
        uni.showToast({
            title: "请扫描正确的二维码",
@@ -187,6 +194,7 @@
    }
    
    // 检查是否已存在
  console.log("scanList",scanList)
    const existingIndex = scanList.findIndex(item => item.barcodeId === barcodeId && item.type === type);
    if (existingIndex !== -1) {
        uni.showToast({
@@ -202,8 +210,9 @@
            title: '获取产品信息中...',
            mask: true
        });
        console.log('barcodeId',barcodeId);
        const resp = await detailApi({ id: barcodeId });
        console.log('resp',resp );
        
        uni.hideLoading();
        
@@ -320,16 +329,16 @@
            barcodeId: item.barcodeId,
            type: item.type,
            scanTime: item.scanTime,
            productCategory: item.productCategory,
          productName: item.productName,
            specificationModel: item.specificationModel,
            unit: item.unit,
            specificationModelUnit: item.specificationModelUnit,
            taxInclusiveUnitPrice: item.taxInclusiveUnitPrice,
            inboundNum: item.inboundNum,
            qualitity: item.qualitity,
            boxNum: item.boxNum,
            cartonSpecifications: item.cartonSpecifications,
            createBy: item.createBy,
            inboundDate: item.inboundDate,
            model: item.model,
            createUserName: item.createUserName,
            createTime: item.createTime,
            url: item.url
        }));
@@ -443,6 +452,15 @@
    }
};
// 时间格式化函数
// 时间格式化函数
const formatTime = (timestamp) => {
  if (!timestamp) return '';
  const time = timestamp.toString().length === 10 ? timestamp * 1000 : timestamp;
  const date = new Date(time);
  return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}:${String(date.getSeconds()).padStart(2, '0')}`;
};
// 弹窗打开事件
const handleOpen = () => {
    // 弹窗打开时的处理