| | |
| | | > |
| | | {{ 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" |
| | |
| | | > |
| | | <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> |
| | |
| | | </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-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> |
| | |
| | | </view> |
| | | </uni-popup> |
| | | </template> |
| | | |
| | | |
| | | <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' |
| | | |
| | | const baseUrl = config.imgUrl |
| | | const emit = defineEmits(['scan', 'close']); |
| | | |
| | | |
| | | // 弹窗显示状态 |
| | | const popupRef = ref(); |
| | | const isScanning = ref(false); |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | let barcodeList = barcode.split(","); |
| | | let barcodeId = barcodeList[0]; |
| | | let type = barcodeList[1]; |
| | | let detailApi = null; |
| | | |
| | | |
| | | if (type == 1) { |
| | | detailApi = stockinDetail; |
| | | } else if (type == 2) { |
| | | detailApi = detailManagementByCustom; |
| | | detailApi = detailManagement; |
| | | } |
| | | |
| | | if (!detailApi) { |
| | | uni.showToast({ |
| | | title: "请扫描正确的二维码", |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | // 检查是否已存在 |
| | | console.log("scanList",scanList) |
| | | const existingIndex = scanList.findIndex(item => item.barcodeId === barcodeId && item.type === type); |
| | | if (existingIndex !== -1) { |
| | | uni.showToast({ |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | try { |
| | | uni.showLoading({ |
| | | title: '获取产品信息中...', |
| | | mask: true |
| | | }); |
| | | |
| | | console.log('barcodeId',barcodeId); |
| | | const resp = await detailApi({ id: barcodeId }); |
| | | |
| | | console.log('resp',resp ); |
| | | |
| | | uni.hideLoading(); |
| | | |
| | | |
| | | if (resp.code != 200) { |
| | | uni.showToast({ |
| | | title: resp.msg, |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | if (!resp.data) { |
| | | uni.showToast({ |
| | | title: '商品不存在', |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | // 添加到列表 |
| | | const scanTime = new Date().toLocaleString('zh-CN', { |
| | | year: 'numeric', |
| | |
| | | minute: '2-digit', |
| | | second: '2-digit' |
| | | }); |
| | | |
| | | |
| | | scanList.push({ |
| | | barcodeId: barcodeId, |
| | | type: type, |
| | |
| | | ...resp.data, |
| | | specificationModelUnit: (resp.data.specificationModel || '') + (resp.data.unit || '') |
| | | }); |
| | | |
| | | |
| | | uni.showToast({ |
| | | title: '扫码成功', |
| | | icon: 'success', |
| | | duration: 1500 |
| | | }); |
| | | |
| | | |
| | | // 触发扫码事件 |
| | | emit('scan', resp.data); |
| | | |
| | | |
| | | } catch (error) { |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | |
| | | 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 |
| | | })); |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | // 时间格式化函数 |
| | | // 时间格式化函数 |
| | | 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 = () => { |
| | | // 弹窗打开时的处理 |