<template> <u-popup :show="show" mode="right" :closeable="true" @close="handleClose"> <view class="c-dialog-filter"> <view class="title">{{ isShipment ? "出货" : "收货" }}产品</view> <view class="dialog-product-layout"> <text v-for="(item, index) in state.list" :class="{ active: state.current === item.id }" @click="handleSelect(item)" :key="index" >{{isShipment ? item.shmProductsName : item.reProductsName }}</text > </view> <!-- <view class="btn-confirm"> <view class="btn"> <u-button type="primary" :text="'确认'"></u-button> </view> </view> --> </view> </u-popup> </template> <script setup lang="ts"> import { ReceiveProductApi, GoodsApi } from "@/services"; const props = defineProps<{ show: boolean; isShipment: boolean; }>(); const emit = defineEmits(["handleDialog", "changeProduct"]); const handleClose = () => { emit("handleDialog", false); }; const state = reactive<any>({ list: [], current: -1, }); const handleSelect = (item: any) => { state.current = item.id; emit("changeProduct", item); emit("handleDialog", false); }; const getList = () => { if (props.isShipment) { GoodsApi.getShipmentProductList().then((res) => { if (res.code === 200) { state.list = res.data; } }); } else { ReceiveProductApi.getAllReProducts().then((res) => { if (res.code === 200) { state.list = res.data; } }); } }; onMounted(() => { getList(); }); </script> <style lang="scss" scoped> .c-dialog-filter { width: 95vw; padding: 25rpx; .title { font-weight: 500; font-size: 32rpx; color: #000000; text-align: center; } } // 产品dialog .dialog-product-layout { box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12); border-radius: 13rpx; margin: 42rpx 25rpx; padding: 19rpx; display: flex; justify-content: flex-start; align-items: center; flex-flow: row wrap; max-height: 70vh; overflow: auto; text { font-weight: 400; font-size: 26rpx; color: #999999; background: #ffffff; border-radius: 6rpx; border: 1px solid rgba(153, 153, 153, 0.64); text-align: center; cursor: pointer; padding: 0rpx 20rpx; margin-bottom: 20rpx; margin-left: 10rpx; margin-right: 10rpx; } .active { border-color: $u-primary; color: $u-primary; } } .btn-confirm { box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12); border-radius: 13rpx 13rpx 0rpx 0rpx; position: absolute; bottom: 0rpx; width: 100%; left: 0rpx; padding: 27.56rpx; .btn { text-align: center; ::v-deep button { width: 80%; border-radius: 43rpx; } } } </style>