good-card.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="good-card">
  3. <view @click="clickItem">
  4. <view class="good-base">
  5. <u-image
  6. :src="goodImg"
  7. width="128rpx"
  8. height="128rpx"
  9. class="good-img"
  10. ></u-image>
  11. <view class="ss-m-l-16">
  12. <view class="good-base-name-box">
  13. <view
  14. :class="['good-base-name', { 'has-status': $slots.status }]"
  15. >{{ goodName }}</view
  16. >
  17. <view class="good-status" v-if="$slots.status">
  18. <slot name="status"></slot>
  19. </view>
  20. </view>
  21. <view class="good-base-txm"
  22. >{{ goodDesTitle }}:{{ goodDesValue }}</view
  23. >
  24. </view>
  25. </view>
  26. <gridForm
  27. :columns="columns"
  28. :formData="item"
  29. @handleClickField="handleClickField"
  30. ></gridForm>
  31. </view>
  32. <slot></slot>
  33. <u-divider></u-divider>
  34. <slot name="action"></slot>
  35. </view>
  36. </template>
  37. <script>
  38. import gridForm from "@/components/grid-form/grid-form.vue";
  39. export default {
  40. components: {
  41. gridForm,
  42. },
  43. props: {
  44. // 货物图片
  45. goodImg: {
  46. type: String,
  47. default: "",
  48. },
  49. // 货物名称
  50. goodName: {
  51. type: String,
  52. default: "",
  53. },
  54. goodDesTitle: {
  55. type: String,
  56. default: "条形码",
  57. },
  58. // 货物额外信息
  59. goodDesValue: {
  60. type: String,
  61. default: "",
  62. },
  63. // 货物信息
  64. item: {
  65. type: Object,
  66. default: () => {},
  67. },
  68. columns: {
  69. type: Array,
  70. default: () => [],
  71. },
  72. },
  73. methods: {
  74. handleClickField(key, formData) {
  75. this.$emit("handleClickField", key, formData);
  76. },
  77. clickItem() {
  78. this.$emit("clickItem", { ...this.item });
  79. },
  80. },
  81. };
  82. </script>
  83. <style lang="scss" scoped>
  84. .good-card {
  85. .good-base {
  86. display: flex;
  87. align-items: center;
  88. padding: 0 24rpx;
  89. &-name-box {
  90. display: flex;
  91. }
  92. &-name {
  93. width: 520rpx;
  94. overflow: hidden;
  95. white-space: nowrap;
  96. text-overflow: ellipsis;
  97. color: #333;
  98. font-family: "PingFang SC";
  99. font-size: 28rpx;
  100. font-weight: 500;
  101. margin-bottom: 16rpx;
  102. &.has-status {
  103. width: 400rpx;
  104. }
  105. }
  106. &-txm {
  107. color: #999;
  108. font-family: "PingFang SC";
  109. font-size: 28rpx;
  110. font-weight: 400;
  111. }
  112. .good-status {
  113. width: 120rpx;
  114. height: 44rpx;
  115. border-radius: 8rpx;
  116. font-family: "PingFang SC";
  117. font-weight: 400;
  118. font-size: 22rpx;
  119. line-height: 44rpx;
  120. text-align: center;
  121. }
  122. }
  123. }
  124. </style>