扫码弹窗:改用自定义弹窗(仿zhizhu编辑弹窗样式),去除uni.showModal

This commit is contained in:
97694732@qq.com 2026-06-04 17:38:38 +08:00
parent 48839d8fc5
commit 9357474966

View File

@ -785,6 +785,35 @@
</view>
</view>
</view>
<!-- 扫码结果弹窗 -->
<view class="scan-result-overlay" v-if="showScanPopup" @click="closeScanPopup">
<view class="scan-result-popup" @click.stop>
<view class="popup-scan-header">
<text class="popup-scan-title">扫码结果</text>
<text class="popup-scan-close" @click="closeScanPopup"></text>
</view>
<view class="popup-scan-content">
<view class="scan-result-row" v-if="scanPopupWhCode">
<text class="scan-result-label">仓库编码</text>
<text class="scan-result-value">{{ scanPopupWhCode }}</text>
</view>
<view class="scan-result-row" v-if="scanPopupLocCode">
<text class="scan-result-label">货位号</text>
<text class="scan-result-value">{{ scanPopupLocCode }}</text>
</view>
<view class="scan-result-row" v-if="!scanPopupWhCode && !scanPopupLocCode">
<text class="scan-result-label">条码内容</text>
<text class="scan-result-value">{{ scanPopupRaw }}</text>
</view>
<text class="scan-result-hint">点击搜索查询匹配货位</text>
</view>
<view class="popup-scan-footer">
<view class="popup-scan-btn popup-scan-cancel" @click="closeScanPopup">取消</view>
<view class="popup-scan-btn popup-scan-confirm" @click="confirmScanSearch">搜索</view>
</view>
</view>
</view>
</view>
</template>
@ -891,6 +920,12 @@ export default {
_pendingPreselectWh: null,
_pendingPreselectLoc: null,
//
showScanPopup: false,
scanPopupWhCode: '',
scanPopupLocCode: '',
scanPopupRaw: '',
//
isLoggedIn: false,
shopName: '',
@ -1546,15 +1581,36 @@ export default {
const whCode = scanned.substring(0, sepIdx).trim()
const locCode = scanned.substring(sepIdx + 2).trim()
if (whCode && locCode) {
//
uni.showModal({
title: '扫码结果',
content: '仓库编码:' + whCode + '\n货位号' + locCode + '\n\n点击"搜索"查询货位',
confirmText: '搜索',
cancelText: '取消',
success: async (modalRes) => {
if (!modalRes.confirm) return
//
this.scanPopupWhCode = whCode
this.scanPopupLocCode = locCode
this.scanPopupRaw = ''
this.showScanPopup = true
return
}
}
//
this.scanPopupWhCode = ''
this.scanPopupLocCode = ''
this.scanPopupRaw = scanned
this.showScanPopup = true
},
fail: () => {}
})
},
closeScanPopup() {
this.showScanPopup = false
},
async confirmScanSearch() {
this.showScanPopup = false
const whCode = this.scanPopupWhCode
const locCode = this.scanPopupLocCode
const raw = this.scanPopupRaw
if (whCode && locCode) {
// NS##a5-4
const whIdx = this.popupWarehouseList.findIndex(w => {
const code = (w.code || '').toLowerCase()
const name = (w.name || '').toLowerCase()
@ -1562,11 +1618,9 @@ export default {
return code === search || name === search || code.includes(search)
})
if (whIdx !== -1) {
// ,
await this.loadPopupLocations(this.popupWarehouseList[whIdx].id, false, locCode)
this.popupActiveWhIndex = whIdx
this.popupSelectedWh = this.popupWarehouseList[whIdx]
// ,
if (this.popupLocationList.length > 0) {
this.popupSelectedLoc = this.popupLocationList[0]
this.popupLocationSearch = ''
@ -1577,21 +1631,9 @@ export default {
} else {
uni.showToast({ title: '未找到仓库: ' + whCode, icon: 'none' })
}
}
})
return
}
}
// ##
uni.showModal({
title: '扫码结果',
content: '条码内容:' + scanned + '\n\n点击"搜索"在当前仓库中查询货位',
confirmText: '搜索',
cancelText: '取消',
success: async (modalRes) => {
if (!modalRes.confirm) return
const search = scanned.toLowerCase()
} else if (raw) {
//
const search = raw.toLowerCase()
const matched = this.popupAllLocationList.find(l => {
const code = (l.code || '').toLowerCase()
const name = (l.name || '').toLowerCase()
@ -1607,10 +1649,6 @@ export default {
uni.showToast({ title: '未找到匹配货位', icon: 'none' })
}
}
})
},
fail: () => {}
})
},
// -
@ -3464,6 +3502,98 @@ picker {
opacity: 0.6;
}
/* ========== 扫码结果弹窗 ========== */
.scan-result-overlay {
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background-color: rgba(0,0,0,0.3);
z-index: 2000;
display: flex;
align-items: center;
justify-content: center;
}
.scan-result-popup {
width: 560rpx;
background-color: #ffffff;
border-radius: 12rpx;
overflow: hidden;
}
.popup-scan-header {
padding: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1rpx solid #f0f0f0;
}
.popup-scan-title {
font-size: 32rpx;
font-weight: bold;
color: #333333;
}
.popup-scan-close {
font-size: 36rpx;
color: #999999;
padding: 0 10rpx;
}
.popup-scan-content {
padding: 30rpx;
min-height: 120rpx;
}
.scan-result-row {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.scan-result-label {
font-size: 28rpx;
color: #666666;
margin-right: 20rpx;
min-width: 120rpx;
}
.scan-result-value {
font-size: 30rpx;
color: #333333;
font-weight: 500;
}
.scan-result-hint {
font-size: 26rpx;
color: #999999;
margin-top: 10rpx;
display: block;
}
.popup-scan-footer {
display: flex;
border-top: 1rpx solid #f0f0f0;
}
.popup-scan-btn {
flex: 1;
height: 90rpx;
line-height: 90rpx;
text-align: center;
font-size: 32rpx;
}
.popup-scan-cancel {
background-color: #f5f5f5;
color: #333333;
}
.popup-scan-confirm {
background-color: #007aff;
color: #ffffff;
}
/* ========== 定价策略 ========== */
.mode-tabs {
display: flex;