弹框确认优化

This commit is contained in:
bb_pan 2025-09-03 18:45:44 +08:00
parent 5605d5a703
commit c6e8299ccd
5 changed files with 82 additions and 10 deletions

View File

@ -27,7 +27,9 @@
<uni-easyinput type="textarea" v-model="remark" placeholder="请输入备注..." autoHeight /> <uni-easyinput type="textarea" v-model="remark" placeholder="请输入备注..." autoHeight />
<view class="popup-btns"> <view class="popup-btns">
<button type="default" @click="closePopup"> </button> <button type="default" @click="closePopup"> </button>
<button type="primary" @click="confirmRemark"> </button> <button type="primary" @click="confirmRemark">
{{ countdown > 0 ? '(' + countdown + ')' : '' }}
</button>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
@ -44,6 +46,8 @@ const total = ref(0)
const remark = ref('') const remark = ref('')
const popup = ref() const popup = ref()
const loading = ref(false) const loading = ref(false)
const countdown = ref(0)
const timer = ref(null)
const finish = computed(() => { const finish = computed(() => {
if (total.value === tableList.value.length) return true if (total.value === tableList.value.length) return true
@ -77,12 +81,27 @@ const handleDetails = (item) => {
} }
const penPopup = () => { const penPopup = () => {
popup.value.open() popup.value.open()
if (timer.value) {
clearInterval(timer.value)
timer.value = null
}
countdown.value = 3
timer.value = setInterval(() => {
if (countdown.value > 0) {
countdown.value--
} else {
clearInterval(timer.value)
timer.value = null
countdown.value = 0
}
}, 1000)
} }
const closePopup = () => { const closePopup = () => {
popup.value.close() popup.value.close()
} }
const confirmRemark = () => { const confirmRemark = () => {
console.log('opts:', opts.value) console.log('opts:', opts.value)
if (countdown.value > 0) return
const params = { const params = {
id: opts.value.id, id: opts.value.id,
leaseSignId: opts.value.leaseSignId, leaseSignId: opts.value.leaseSignId,

View File

@ -101,7 +101,7 @@
</view> </view>
<view class="handle-box"> <view class="handle-box">
<view class="handle-box-btn" style="background: #CCC;color: #FFF;" @click="closePopup">取消</view> <view class="handle-box-btn" style="background: #CCC;color: #FFF;" @click="closePopup">取消</view>
<view class="handle-box-btn" style="background: #3784fb;color: #FFF;" @click="confirmNumInBound">确定</view> <view class="handle-box-btn" style="background: #3784fb;color: #FFF;" @click="confirmNumInBound">确定{{ countdown > 0 ? '(' + countdown + ')' : '' }}</view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
@ -124,7 +124,7 @@
</view> </view>
<view class="handle-box"> <view class="handle-box">
<view class="handle-box-btn" style="background: #CCC;color: #FFF;" @click="closePopup2">取消</view> <view class="handle-box-btn" style="background: #CCC;color: #FFF;" @click="closePopup2">取消</view>
<view class="handle-box-btn" style="background: #3784fb;color: #FFF;" @click="rejectNumInBound">确定</view> <view class="handle-box-btn" style="background: #3784fb;color: #FFF;" @click="rejectNumInBound">确定{{ countdown > 0 ? '(' + countdown + ')' : '' }}</view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
@ -147,6 +147,9 @@ const rejectNumPopup = ref(null);
const inBoundNum = ref(0) const inBoundNum = ref(0)
const rejectBoundNum = ref(0) const rejectBoundNum = ref(0)
const rejectReason = ref('') const rejectReason = ref('')
const countdown = ref(0)
const timer = ref(null)
// //
const getDetailsData = async () => { const getDetailsData = async () => {
let param = { let param = {
@ -192,6 +195,20 @@ const onClick=async (e,item)=> {
} }
} }
if (item.manageType == 1) {// if (item.manageType == 1) {//
if (timer.value) {
clearInterval(timer.value)
timer.value = null
}
countdown.value = 3
timer.value = setInterval(() => {
if (countdown.value > 0) {
countdown.value--
} else {
clearInterval(timer.value)
timer.value = null
countdown.value = 0
}
}, 1000)
if(e.index==0){ if(e.index==0){
// console.log(item) // console.log(item)
if(item.status==0){// if(item.status==0){//
@ -215,6 +232,7 @@ const onClick=async (e,item)=> {
const confirmNumInBound = async () => { const confirmNumInBound = async () => {
console.log(inBoundNum.value) console.log(inBoundNum.value)
if (countdown.value > 0) return
if(inBoundNum.value==0){ if(inBoundNum.value==0){
uni.showToast({ title: '入库数量需大于0',icon: 'none'}) uni.showToast({ title: '入库数量需大于0',icon: 'none'})
}else{ }else{
@ -238,6 +256,7 @@ const closePopup = () => {
const rejectNumInBound = async () => { const rejectNumInBound = async () => {
console.log(rejectBoundNum.value) console.log(rejectBoundNum.value)
if (countdown.value > 0) return
try { try {
uni.showLoading({ title: '操作中...', mask: true }) uni.showLoading({ title: '操作中...', mask: true })
if(rejectBoundNum.value==0){ if(rejectBoundNum.value==0){

View File

@ -165,7 +165,7 @@ const onClick=(e,item, itemIndex)=> {
} }
} }
}) })
}, 300) }, 500)
}else{// }else{//
console.log(item) console.log(item)
setTimeout(() => { setTimeout(() => {
@ -174,8 +174,8 @@ const onClick=(e,item, itemIndex)=> {
content: '是否确认驳回移交?', content: '是否确认驳回移交?',
confirmText: '确定', confirmText: '确定',
cancelText: '取消', cancelText: '取消',
success: async (res) => { success: async (resp) => {
if (res.confirm) { if (resp.confirm) {
let param = { let param = {
boxId:item.boxId boxId:item.boxId
} }
@ -195,7 +195,7 @@ const onClick=(e,item, itemIndex)=> {
} }
} }
}) })
}, 300) }, 500)
} }
} }
swipeRef.value[itemIndex].closeAll() swipeRef.value[itemIndex].closeAll()

View File

@ -73,7 +73,7 @@
<view class="keeper-popup"> <view class="keeper-popup">
<view class="handle-box"> <view class="handle-box">
<view class="handle-box-btn" style="background: #CCC;color: #FFF;" @click="closePopup">取消</view> <view class="handle-box-btn" style="background: #CCC;color: #FFF;" @click="closePopup">取消</view>
<view class="handle-box-btn" style="background: #3784fb;color: #FFF;" @click="confirmTransfer">确定</view> <view class="handle-box-btn" style="background: #3784fb;color: #FFF;" @click="confirmTransfer">确定{{ countdown > 0 ? '(' + countdown + ')' : '' }}</view>
</view> </view>
<scroll-view scroll-y style="padding-bottom: 85rpx" class="keeper-box" v-if="keeperList.length>0"> <scroll-view scroll-y style="padding-bottom: 85rpx" class="keeper-box" v-if="keeperList.length>0">
<view class="table-list-item" v-for="item in keeperList" :key="item.id"> <view class="table-list-item" v-for="item in keeperList" :key="item.id">
@ -176,6 +176,8 @@ const focusTimeout = ref(null)
const systemInfo = ref(null) const systemInfo = ref(null)
const screenHeight = ref(null) const screenHeight = ref(null)
const screenWidth = ref(null) const screenWidth = ref(null)
const countdown = ref(0)
const timer = ref(null)
const getCodeList = () => { const getCodeList = () => {
console.log(boxInfo.value) console.log(boxInfo.value)
@ -822,11 +824,26 @@ const onChangeChecked = (item) => {
} }
const transfer = () => { const transfer = () => {
keeperPopup.value.open('bottom'); keeperPopup.value.open('bottom');
if (timer.value) {
clearInterval(timer.value)
timer.value = null
}
countdown.value = 3
timer.value = setInterval(() => {
if (countdown.value > 0) {
countdown.value--
} else {
clearInterval(timer.value)
timer.value = null
countdown.value = 0
}
}, 1000)
} }
const closePopup = () => { const closePopup = () => {
keeperPopup.value.close(); keeperPopup.value.close();
} }
const confirmTransfer = () => { const confirmTransfer = () => {
if (countdown.value > 0) return
if(transferUser.value!=""){ if(transferUser.value!=""){
let param = { let param = {
"boxId":boxInfo.value.boxId, "boxId":boxInfo.value.boxId,

View File

@ -94,7 +94,7 @@
<view class="keeper-popup"> <view class="keeper-popup">
<view class="handle-box"> <view class="handle-box">
<view class="handle-box-btn" style="background: #CCC;color: #FFF;" @click="closePopup">取消</view> <view class="handle-box-btn" style="background: #CCC;color: #FFF;" @click="closePopup">取消</view>
<view class="handle-box-btn" style="background: #3784fb;color: #FFF;" @click="confirmTransfer">确定</view> <view class="handle-box-btn" style="background: #3784fb;color: #FFF;" @click="confirmTransfer">确定{{ countdown > 0 ? '(' + countdown + ')' : '' }}</view>
</view> </view>
<scroll-view scroll-y style="padding-bottom: 85rpx" class="keeper-box" v-if="keeperList.length>0"> <scroll-view scroll-y style="padding-bottom: 85rpx" class="keeper-box" v-if="keeperList.length>0">
<view class="table-list-item" v-for="item in keeperList" :key="item.id"> <view class="table-list-item" v-for="item in keeperList" :key="item.id">
@ -142,6 +142,8 @@ const keeperPopup = ref(null);
const transferItem = ref({}); const transferItem = ref({});
const keeperList = ref([]) const keeperList = ref([])
const transferUser = ref("") const transferUser = ref("")
const countdown = ref(0)
const timer = ref(null)
// //
const queryParams = ref({ const queryParams = ref({
startTime: dateArray.value[0] || '', startTime: dateArray.value[0] || '',
@ -305,6 +307,20 @@ const getKeeperList = (item) => {
console.log(keeperList) console.log(keeperList)
} }
keeperPopup.value.open('bottom'); keeperPopup.value.open('bottom');
if (timer.value) {
clearInterval(timer.value)
timer.value = null
}
countdown.value = 3
timer.value = setInterval(() => {
if (countdown.value > 0) {
countdown.value--
} else {
clearInterval(timer.value)
timer.value = null
countdown.value = 0
}
}, 1000)
}).catch(error => { }).catch(error => {
console.log(error) console.log(error)
}) })
@ -331,6 +347,7 @@ const onChangeChecked = (item) => {
} }
const confirmTransfer = () => { const confirmTransfer = () => {
if (countdown.value > 0) return
if(transferUser.value!=""){ if(transferUser.value!=""){
let param = { let param = {
@ -674,7 +691,7 @@ const finish = computed(() => {
display: flex; display: flex;
align-items: center;justify-content: space-between; align-items: center;justify-content: space-between;
.handle-box-btn{ .handle-box-btn{
width: 60px; min-width: 60px;
height: 32px;line-height: 32px; height: 32px;line-height: 32px;
text-align: center; text-align: center;
border-radius: 5px; border-radius: 5px;