BadItem.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="bad-item">
  3. <u-swipe-action>
  4. <u-swipe-action-item :options="options" @click="handleAction">
  5. <view class="item-content">
  6. <view class="item-row">
  7. <text class="label">订单编号:</text>
  8. <text class="value">{{ data.orderId }}</text>
  9. <u-icon name="edit-pen" color="#4CAF50" size="20" class="edit-icon"
  10. @click="$emit('edit')"></u-icon>
  11. </view>
  12. <view class="item-row">
  13. <text class="label">不良数量:</text>
  14. <text class="value">{{ data.badNum }}</text>
  15. </view>
  16. <view class="item-row">
  17. <text class="label">物流单号:</text>
  18. <text class="value">{{ data.waybillCode }}</text>
  19. </view>
  20. <view class="item-row">
  21. <text class="label">验货完成日期:</text>
  22. <text class="value">{{ data.auditFinishTime }}</text>
  23. </view>
  24. <view class="item-row">
  25. <text class="label">录入人:</text>
  26. <text class="value">{{ data.auditUserName }}</text>
  27. </view>
  28. </view>
  29. </u-swipe-action-item>
  30. </u-swipe-action>
  31. </view>
  32. </template>
  33. <script setup>
  34. import { ref } from 'vue'
  35. const props = defineProps({
  36. data: {
  37. type: Object,
  38. required: true,
  39. default: () => ({
  40. orderNo: '',
  41. badCount: '',
  42. logisticsNo: '',
  43. checkDate: '',
  44. operator: ''
  45. })
  46. }
  47. })
  48. const emit = defineEmits(['delete', 'edit'])
  49. // 左滑操作按钮配置
  50. const options = ref([
  51. {
  52. text: '删除',
  53. style: {
  54. backgroundColor: '#ff4444'
  55. }
  56. }
  57. ])
  58. // 处理左滑操作
  59. const handleAction = (e) => {
  60. if (e.index === 0) {
  61. uni.showModal({
  62. title: '提示',
  63. content: '确定要删除该订单吗?',
  64. success: (res) => {
  65. if (res.confirm) {
  66. emit('delete')
  67. }
  68. }
  69. })
  70. }
  71. }
  72. </script>
  73. <style scoped>
  74. .bad-item {
  75. margin-bottom: 12px;
  76. background-color: #ffffff;
  77. border-radius: 8px;
  78. overflow: hidden;
  79. }
  80. .item-content {
  81. padding: 12px 15px;
  82. }
  83. .item-row {
  84. display: flex;
  85. align-items: center;
  86. margin-bottom: 8px;
  87. position: relative;
  88. }
  89. .item-row:last-child {
  90. margin-bottom: 0;
  91. }
  92. .label {
  93. color: #666;
  94. font-size: 16px;
  95. width: 120px;
  96. }
  97. .value {
  98. color: #333;
  99. font-size: 16px;
  100. flex: 1;
  101. }
  102. .edit-icon {
  103. position: absolute;
  104. right: 0;
  105. top: 50%;
  106. transform: translateY(-50%);
  107. }
  108. </style>