123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <template>
- <view class="uni-column container" >
- <scroll-view class="scroll-container" scroll-y>
- <view v-for="(item, index) in listData" :key="index" :class="{'list-item':true,'selected':isSelected(item)}"
- @click="handleSelection(item,index)">
- <view class="title-container uni-row">
- <view class="title uni-row">
- <text class="label">{{ item['door'] }}</text>
- <text class="label code">{{ item['process'] }}</text>
- <text class="label code" style="margin-left: 16rpx;">→</text>
- <text class="label code" style="margin-left: 16rpx;">{{ item['car'] }}</text>
- </view>
- <view class="right-info uni-row">
- <view class="uni-row"><text class="label right" @click="handleDeleteTurnover(item)">删除</text>
- </view>
- </view>
- </view>
- <view class="item-info uni-row"> <text class="label ">产品描述</text>
- <text class="label right" style="color: #000000;">{{ item['description'] }}</text>
- </view>
- <view class="item-info uni-row"> <text class="label">批次</text>
- <text class="label right ">{{ item['batch'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">箱数</text>
- <text class="label right">{{ item['cases'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">箱号</text>
- <text class="label right">{{ item['caseNumber']}}</text>
- </view>
- </view>
- </scroll-view>
- <view class="bottom uni-row">
- <button class="bottom-btn left-btn ">继续扫码</button>
- <button class="bottom-btn right-btn" @click="handleStartTurnover(null)">确认周转</button>
- </view>
- <dialog-turnoverTask ref="turnoverTaskDialog" />
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- onLoad,
- onReady
- } from '@dcloudio/uni-app'
- onLoad((option) => {
- listData.value = JSON.parse(option.turnoverList);
- })
- const active = ref(false)
- const selection = ref([])
- const turnoverTaskDialog = ref(null)
- const listData = ref([
- //{
- // door: "A门",
- // process: "粗磨",
- // car: "NC车",
- // description: "万博_039561419_15*110.1",
- // batch: "DC23727410070",
- // cases: 5,
- // caseNumber: "X12522、X55222、X15522、J5211、J5211"
- // },
- // {
- // door: "A门",
- // process: "粗磨",
- // car: "NC车",
- // description: "万博_039561419_15*110.1",
- // batch: "DC23727410070",
- // cases: 5,
- // caseNumber: "X12522、X55222、X15522、J5211、J5211"
- // },
- // {
- // door: "A门",
- // process: "粗磨",
- // car: "NC车",
- // description: "万博_039561419_15*110.1",
- // batch: "DC23727410070",
- // cases: 5,
- // caseNumber: "X12522、X55222、X15522、J5211、J5211"
- // },
- // {
- // door: "A门",
- // process: "粗磨",
- // car: "NC车",
- // description: "万博_039561419_15*110.1",
- // batch: "DC23727410070",
- // cases: 5,
- // caseNumber: "X12522、X55222、X15522、J5211、J5211"
- // },
- // {
- // door: "A门",
- // process: "粗磨",
- // car: "NC车",
- // description: "万博_039561419_15*110.1",
- // batch: "DC23727410070",
- // cases: 5,
- // caseNumber: "X12522、X55222、X15522、J5211、J5211"
- // }
- ])
- const handleStartTurnover = () => {
- if(selection.value.length >0) {
- turnoverTaskDialog.value.open(selection.value)
- }
- else {
- uni.showToast({
- title: '未选中周转内容',
- icon:'error',
- duration: 1000//1后消失
- });
- }
- // 调用子组件中的方法
-
- }
- const isSelected = (item) => {
- return selection.value.includes(item);
- }
- const handleSelection = (item, index) => {
- const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
- if (buttonIndex > -1) {
- selection.value.splice(buttonIndex, 1); // 取消选中
- } else {
- selection.value.push(item); // 选中
- }
- console.log(selection.value, "selection");
- }
- function handleDeleteTurnover(item) {
- uni.showModal({
- title: '提示', // 标题
- content: '是否删除此条周转', // 提示内容
- cancelText: "取消", // 取消按钮的文字
- confirmText: "确认", // 确认按钮的文字
- //点击确定之后执行的代码
- success(res) {
- if (res.confirm) {
- const checkIndex = listData.value.findIndex(selectedItem => selectedItem === item);
- if (checkIndex > -1) {
- listData.value.splice(checkIndex, 1);
- }
- }
- }
- });
- }
- </script>
- <style lang="scss">
- .container {
- height: 100%;
- background-color: #f5f5f5;
- }
- .scroll-container {
- position: absolute;
- top: 24rpx;
- right: 0;
- bottom: 160rpx;
- left: 0;
- }
- .selected {
- border: 1px solid #1684fc;
- }
- .list-item {
- background-color: #fff;
- position: relative;
- padding: 16rpx;
- padding-bottom: 24rpx;
- margin: 0 24rpx;
- margin-bottom: 24rpx;
- border-radius: 8rpx;
- .title-container {
- justify-content: space-between;
- margin-top: 8rpx;
- margin-bottom: 16rpx;
- .title {
- height: 48rpx;
- align-items: center;
- .label {
- color: #1684fc;
- font-size: 32rpx;
- font-weight: bold;
- &.code {
- color: #000000;
- margin-left: 32rpx;
- }
- }
- }
- }
- .item-info {
- margin-bottom: 16rpx;
- .label {
- font-size: 28rpx;
- width: 152rpx;
- color: #808080;
- &.right {
- flex: 1;
- color: #808080;
- }
- }
- }
- .right-info {
- justify-content: flex-end;
- margin-top: 2rpx;
- .label {
- font-size: 28rpx;
- color: #ff0000;
- }
- }
- }
- .bottom {
- position: absolute;
- right: 0;
- bottom: 0;
- left: 0;
- height: 100rpx;
- padding: 16rpx 24rpx;
- align-items: center;
- background-color: #FFFFFF;
- justify-content: space-between;
- .bottom-btn {
- flex: 1;
- font-size: 28rpx;
- color: #FFFFFF;
- &.left-btn {
- background-color: #1684fc;
- }
- &.right-btn {
- background-color: rgb(255, 121, 1);
- margin-left: 24rpx;
- }
- }
- }
- </style>
|