BadItem.vue 2.5 KB

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