good-item.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view>
  3. <view class="good-item">
  4. <view class="" @click="toDetail">
  5. <view class="good-msg">
  6. <u-image
  7. :src="item.imgNameArr[0] || ''"
  8. width="128rpx"
  9. height="128rpx"
  10. ></u-image>
  11. <view class="ss-m-l-16">
  12. <view class="good-msg-name">{{ item.materialName }}</view>
  13. <view class="good-msg-txm">条形码:{{ item.barCode }}</view>
  14. </view>
  15. </view>
  16. <view class="good-cont">
  17. <view class="good-cont-item">
  18. <view class="item-label">规格</view>
  19. <view class="item-value">{{ item.materialStandard || "-" }}</view>
  20. </view>
  21. <view class="good-cont-item" @click.stop="calendarClick">
  22. <view class="item-label">生产日期</view>
  23. <view class="item-value">{{
  24. item.productionDate
  25. ? $u.timeFormat(item.productionDate, "yyyy-mm-dd")
  26. : "-"
  27. }}</view>
  28. </view>
  29. <view class="good-cont-item">
  30. <view class="item-label">库存</view>
  31. <view class="item-value"
  32. >{{ item.inventory ? (item.inventory * 1).toFixed(0) : "0"
  33. }}{{ item.commodityUnit || "" }}</view
  34. >
  35. </view>
  36. <view
  37. class="good-cont-item"
  38. @click.stop="handleClickField('position')"
  39. >
  40. <view class="item-label">库位</view>
  41. <view class="item-value">{{ item.position || "-" }}</view>
  42. </view>
  43. <view class="good-cont-item">
  44. <view class="item-label">订单数量</view>
  45. <view class="item-value"
  46. >{{ item.operNumber || "0" }}{{ item.materialUnit || "" }}</view
  47. >
  48. </view>
  49. </view>
  50. </view>
  51. <slot></slot>
  52. <view class="action-btn-box" v-if="showPrint">
  53. <view class="print-btn" @click="clickPrint"> 打印条码 </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. props: {
  61. item: {
  62. type: Object,
  63. default: () => {},
  64. },
  65. showPrint: {
  66. type: Boolean,
  67. default: false,
  68. },
  69. },
  70. data() {
  71. return {
  72. calendarShow: false,
  73. value1: Number(new Date()),
  74. maxDate: Number(new Date()),
  75. };
  76. },
  77. methods: {
  78. toDetail() {
  79. this.$emit("toDetail", this.item);
  80. },
  81. calendarClick() {
  82. this.$emit("calendarClick", this.item);
  83. },
  84. handleClickField(field) {
  85. this.$emit("handleClickField", field, { ...this.item });
  86. },
  87. clickPrint() {
  88. this.$emit("print", this.item);
  89. },
  90. },
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. .good-item {
  95. padding: 24rpx 0;
  96. border-bottom: 4rpx solid #f0f6fb;
  97. .good-msg {
  98. display: flex;
  99. align-items: center;
  100. padding: 0 24rpx;
  101. &-name {
  102. color: #333;
  103. font-family: "PingFang SC";
  104. font-size: 28rpx;
  105. font-weight: 500;
  106. margin-bottom: 16rpx;
  107. }
  108. &-txm {
  109. color: #999;
  110. font-family: "PingFang SC";
  111. font-size: 28rpx;
  112. font-weight: 400;
  113. }
  114. }
  115. .good-cont {
  116. display: grid;
  117. grid-template-columns: 25% 45% 30%;
  118. margin-top: 16rpx;
  119. padding: 0 24rpx;
  120. &-item {
  121. font-family: "PingFang SC";
  122. font-weight: 400;
  123. margin-bottom: 24rpx;
  124. .item-label {
  125. color: #999;
  126. font-size: 24rpx;
  127. margin-bottom: 16rpx;
  128. }
  129. .item-value {
  130. color: #000;
  131. font-size: 28rpx;
  132. }
  133. }
  134. }
  135. }
  136. .action-btn-box {
  137. text-align: right;
  138. padding: 30rpx 48rpx 0 26rpx;
  139. .print-btn {
  140. font-family: PingFang SC;
  141. font-weight: 500;
  142. font-size: 28rpx;
  143. color: #0256ff;
  144. }
  145. }
  146. </style>