This commit is contained in:
2026-08-18 14:46:36 +08:00
parent 9e94385dfc
commit a084fe1fd4
13 changed files with 647 additions and 235 deletions
+115 -13
View File
@@ -29,12 +29,15 @@
<!-- 名称 -->
<text>{{ item.fwmc }}</text>
<!-- 代码 -->
<text>{{ item.fwdm }}</text>
<!-- <text>{{ item.fwdm }}</text> -->
<!-- 重量 单位 -->
<text>{{ item.csl || item.rkl}}{{ item.jldw }}</text>
<!-- 时间 -->
<text>{{ item.cssj }}</text>
</view>
<view class="data-card-text">
<text class="light">{{ item.szsbm }}</text>
</view>
<!-- 选择模式下显示右侧箭头 -->
<view class="select-arrow" v-if="isSelectMode">
<uni-icons type="right" size="16" color="#cccccc"></uni-icons>
@@ -47,6 +50,22 @@
<uni-load-more :contentText="{contentdown: '显示更多'}" v-if="dataList.length > 0" :status="loadMoreStatus" @clickLoadMore="handleLoadMore" />
</view>
</scroll-view>
<!-- 操作选择弹窗撤销 / 补打 -->
<uni-popup ref="actionPopup" type="center">
<view class="action-popup" v-if="selectedItem">
<!-- <view class="action-popup-title">请选择操作</view> -->
<view class="action-popup-info">
<text class="action-popup-name">{{ selectedItem.fwmc }}</text>
<text class="action-popup-name">{{ selectedItem.fwdm }}</text>
<text class="action-popup-code">{{ selectedItem.szsbm }}</text>
</view>
<view class="action-popup-btns">
<button class="btn btn-outline action-btn" @click="handleUndo"> </button>
<button class="btn btn-primary action-btn" @click="handleReprint"> </button>
</view>
</view>
</uni-popup>
</view>
</template>
@@ -77,7 +96,9 @@ export default {
/*手机高度*/
phoneHeight: 0,
/* 选择模式 */
isSelectMode: false,
isSelectMode: true,
/* 弹窗选中的台账条目 */
selectedItem: null,
}
},
onLoad(options) {
@@ -163,19 +184,45 @@ export default {
this.currentPage += 1
this.loadData(true)
},
/** 选择模式下点击数据条目,将数据回传给上一页 */
/** 点击列表项:选择模式下回传数据,普通模式弹出操作选择 */
handleSelectItem(item) {
if (!this.isSelectMode) return
const pages = getCurrentPages()
const prevPage = pages[pages.length - 2]
if (prevPage) {
// 将选中项存入上一页,由上一页根据需要提取字段
prevPage.$vm.selectedItem = item
prevPage.$vm.isSelected = true
}
uni.navigateBack()
// 选择模式:将数据回传给上一页
// if (this.isSelectMode) {
// const pages = getCurrentPages()
// const prevPage = pages[pages.length - 2]
// if (prevPage) {
// // 将选中项存入上一页,由上一页根据需要提取字段
// prevPage.$vm.selectedItem = item
// prevPage.$vm.isSelected = true
// }
// uni.navigateBack()
// return
// }
// 普通模式:弹出撤销/补打选择弹窗
this.selectedItem = item
this.$refs.actionPopup.open()
},
handleScan() { uni.showToast({ title: '扫码查询', icon: 'none' }) }
/** 撤销:跳转数据撤销页并携带数字识别码 */
handleUndo() {
const code = this.selectedItem ? this.selectedItem.szsbm : ''
this.$refs.actionPopup.close()
if (!code) {
uni.showToast({ title: '该条数据无数字识别码,无法撤销', icon: 'none' })
return
}
uni.navigateTo({ url: `/pages/waste/undo?code=${encodeURIComponent(code)}` })
},
/** 补打:跳转标签补打页并携带数字识别码 */
handleReprint() {
const code = this.selectedItem ? this.selectedItem.szsbm : ''
this.$refs.actionPopup.close()
if (!code) {
uni.showToast({ title: '该条数据无数字识别码,无法补打', icon: 'none' })
return
}
uni.navigateTo({ url: `/pages/waste/reprint?code=${encodeURIComponent(code)}` })
},
// handleScan() { uni.showToast({ title: '扫码查询', icon: 'none' }) }
}
}
</script>
@@ -212,6 +259,9 @@ export default {
.data-card-text{
justify-content: space-between;
display: flex;
.light{
opacity: 0.7;
}
}
/* 选择模式右侧箭头 */
@@ -226,4 +276,56 @@ export default {
text-align: center;
padding: $spacing-md 0;
}
/* 撤销/补打操作弹窗 */
.action-popup {
width: 100%;
background: #ffffff;
border-radius: $border-radius-lg;
padding: $spacing-lg $spacing-md $spacing-md;
display: flex;
flex-direction: column;
align-items: center;
.action-popup-title {
font-size: $font-size-lg;
font-weight: 600;
color: $text-primary;
}
.action-popup-info {
width: 100%;
margin-top: $spacing-md;
padding: $spacing-base;
// background: $bg-primary;
// border-radius: $border-radius-sm;
display: flex;
flex-direction: column;
align-items: center;
.action-popup-name {
font-size: $font-size-md;
color: $text-primary;
font-weight: 500;
}
.action-popup-code {
margin-top: $spacing-xs;
font-size: $font-size-sm;
color: $text-secondary;
}
}
.action-popup-btns {
width: 100%;
display: flex;
gap: $spacing-base;
margin-top: $spacing-lg;
.action-btn {
flex: 1;
height: 40px;
}
}
}
</style>