扫码弹窗:改用自定义弹窗(仿zhizhu编辑弹窗样式),去除uni.showModal
This commit is contained in:
parent
48839d8fc5
commit
9357474966
@ -785,6 +785,35 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -891,6 +920,12 @@ export default {
|
|||||||
_pendingPreselectWh: null,
|
_pendingPreselectWh: null,
|
||||||
_pendingPreselectLoc: null,
|
_pendingPreselectLoc: null,
|
||||||
|
|
||||||
|
// 扫码弹窗
|
||||||
|
showScanPopup: false,
|
||||||
|
scanPopupWhCode: '',
|
||||||
|
scanPopupLocCode: '',
|
||||||
|
scanPopupRaw: '',
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
isLoggedIn: false,
|
isLoggedIn: false,
|
||||||
shopName: '',
|
shopName: '',
|
||||||
@ -1546,15 +1581,36 @@ export default {
|
|||||||
const whCode = scanned.substring(0, sepIdx).trim()
|
const whCode = scanned.substring(0, sepIdx).trim()
|
||||||
const locCode = scanned.substring(sepIdx + 2).trim()
|
const locCode = scanned.substring(sepIdx + 2).trim()
|
||||||
if (whCode && locCode) {
|
if (whCode && locCode) {
|
||||||
// 弹窗显示识别内容,让用户确认后搜索
|
this.scanPopupWhCode = whCode
|
||||||
uni.showModal({
|
this.scanPopupLocCode = locCode
|
||||||
title: '扫码结果',
|
this.scanPopupRaw = ''
|
||||||
content: '仓库编码:' + whCode + '\n货位号:' + locCode + '\n\n点击"搜索"查询货位',
|
this.showScanPopup = true
|
||||||
confirmText: '搜索',
|
return
|
||||||
cancelText: '取消',
|
}
|
||||||
success: async (modalRes) => {
|
}
|
||||||
if (!modalRes.confirm) 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 whIdx = this.popupWarehouseList.findIndex(w => {
|
||||||
const code = (w.code || '').toLowerCase()
|
const code = (w.code || '').toLowerCase()
|
||||||
const name = (w.name || '').toLowerCase()
|
const name = (w.name || '').toLowerCase()
|
||||||
@ -1562,11 +1618,9 @@ export default {
|
|||||||
return code === search || name === search || code.includes(search)
|
return code === search || name === search || code.includes(search)
|
||||||
})
|
})
|
||||||
if (whIdx !== -1) {
|
if (whIdx !== -1) {
|
||||||
// 切换到该仓库,携带货位号请求后端过滤
|
|
||||||
await this.loadPopupLocations(this.popupWarehouseList[whIdx].id, false, locCode)
|
await this.loadPopupLocations(this.popupWarehouseList[whIdx].id, false, locCode)
|
||||||
this.popupActiveWhIndex = whIdx
|
this.popupActiveWhIndex = whIdx
|
||||||
this.popupSelectedWh = this.popupWarehouseList[whIdx]
|
this.popupSelectedWh = this.popupWarehouseList[whIdx]
|
||||||
// 如果后端返回了匹配的货位,自动选中
|
|
||||||
if (this.popupLocationList.length > 0) {
|
if (this.popupLocationList.length > 0) {
|
||||||
this.popupSelectedLoc = this.popupLocationList[0]
|
this.popupSelectedLoc = this.popupLocationList[0]
|
||||||
this.popupLocationSearch = ''
|
this.popupLocationSearch = ''
|
||||||
@ -1577,21 +1631,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: '未找到仓库: ' + whCode, icon: 'none' })
|
uni.showToast({ title: '未找到仓库: ' + whCode, icon: 'none' })
|
||||||
}
|
}
|
||||||
}
|
} else if (raw) {
|
||||||
})
|
// 纯条码,在当前仓库的货位列表中查找
|
||||||
return
|
const search = raw.toLowerCase()
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 无##格式,在当前仓库的货位列表中查找匹配的货位
|
|
||||||
uni.showModal({
|
|
||||||
title: '扫码结果',
|
|
||||||
content: '条码内容:' + scanned + '\n\n点击"搜索"在当前仓库中查询货位',
|
|
||||||
confirmText: '搜索',
|
|
||||||
cancelText: '取消',
|
|
||||||
success: async (modalRes) => {
|
|
||||||
if (!modalRes.confirm) return
|
|
||||||
const search = scanned.toLowerCase()
|
|
||||||
const matched = this.popupAllLocationList.find(l => {
|
const matched = this.popupAllLocationList.find(l => {
|
||||||
const code = (l.code || '').toLowerCase()
|
const code = (l.code || '').toLowerCase()
|
||||||
const name = (l.name || '').toLowerCase()
|
const name = (l.name || '').toLowerCase()
|
||||||
@ -1607,10 +1649,6 @@ export default {
|
|||||||
uni.showToast({ title: '未找到匹配货位', icon: 'none' })
|
uni.showToast({ title: '未找到匹配货位', icon: 'none' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
},
|
|
||||||
fail: () => {}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 比价切换 - 切换后触发搜索
|
// 比价切换 - 切换后触发搜索
|
||||||
@ -3464,6 +3502,98 @@ picker {
|
|||||||
opacity: 0.6;
|
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 {
|
.mode-tabs {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user