feedCard.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view class="feed-card-list">
  3. <checkbox-group v-for="(item, index) in list" :key="index" @change="e => selectVal(e, item, index)">
  4. <label>
  5. <view class="card-item" @click="openDetails(item.feedStatus, item.id)">
  6. <!-- 卡片头部:编码 + 状态 -->
  7. <view class="card-header">
  8. <view class="header-left">
  9. <checkbox v-if="item.feedStatus == 0" :checked="item.checked" class="card-checkbox" />
  10. <text class="order-code">{{ item.code }}</text>
  11. </view>
  12. <view class="status-tag" :class="item.feedStatus == 0 ? 'status-pending' : 'status-done'">
  13. {{ item.feedStatus == 0 ? '未投料' : item.feedStatus == 1 ? '已投料' : '' }}
  14. </view>
  15. </view>
  16. <!-- 卡片内容 -->
  17. <view class="card-body">
  18. <view class="info-row">
  19. <view class="info-col">
  20. <text class="info-label">产品编码</text>
  21. <text class="info-value">{{ item.productCode }}</text>
  22. </view>
  23. <view class="info-col">
  24. <text class="info-label">名称</text>
  25. <text class="info-value">{{ item.productName }}</text>
  26. </view>
  27. </view>
  28. <view class="info-row">
  29. <view class="info-col">
  30. <text class="info-label">牌号</text>
  31. <text class="info-value">{{ item.brandNo }}</text>
  32. </view>
  33. <view class="info-col">
  34. <text class="info-label">型号</text>
  35. <text class="info-value">{{ item.model }}</text>
  36. </view>
  37. </view>
  38. <view class="info-row">
  39. <view class="info-col">
  40. <text class="info-label">生产数量</text>
  41. <text class="info-value">{{ item.formingNum }} {{ item.unit }}</text>
  42. </view>
  43. <view class="info-col">
  44. <text class="info-label">状态</text>
  45. <text class="info-value">{{ statusList[item.status] }}</text>
  46. </view>
  47. </view>
  48. <view class="info-row info-row--full">
  49. <view class="info-col info-col--full">
  50. <text class="info-label">工艺路线</text>
  51. <text class="info-value info-value--highlight">{{ item.produceRoutingName }}</text>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </label>
  57. </checkbox-group>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. props: {
  63. list: {
  64. type: Array,
  65. default: () => []
  66. },
  67. },
  68. data() {
  69. return {
  70. statusList: {
  71. 4: '待生产',
  72. 5: '生产中',
  73. 6: '已完成',
  74. 7: '已延期',
  75. 8: '待下达'
  76. }
  77. }
  78. },
  79. methods: {
  80. selectVal(e, val, index) {
  81. this.list[index].checked = !this.list[index].checked
  82. },
  83. openDetails(feedStatus, id) {
  84. if (feedStatus == 1) {
  85. let url = `/pages/pda/feeding/bill/index?id=${id}`
  86. uni.navigateTo({
  87. url
  88. })
  89. }
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .feed-card-list {
  96. padding: 0 24rpx;
  97. }
  98. .card-item {
  99. background-color: #fff;
  100. border-radius: 16rpx;
  101. margin-bottom: 20rpx;
  102. overflow: hidden;
  103. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
  104. }
  105. .card-header {
  106. display: flex;
  107. flex-direction: row;
  108. align-items: center;
  109. justify-content: space-between;
  110. padding: 24rpx 28rpx;
  111. border-bottom: 1rpx solid #f0f0f0;
  112. .header-left {
  113. display: flex;
  114. flex-direction: row;
  115. align-items: center;
  116. flex: 1;
  117. overflow: hidden;
  118. }
  119. .card-checkbox {
  120. flex-shrink: 0;
  121. margin-right: 16rpx;
  122. }
  123. .order-code {
  124. color: $uni-text-color;
  125. font-size: $j-font-text-default;
  126. font-weight: 600;
  127. overflow: hidden;
  128. text-overflow: ellipsis;
  129. white-space: nowrap;
  130. }
  131. .status-tag {
  132. flex-shrink: 0;
  133. font-size: $uni-font-size-ssm;
  134. padding: 6rpx 20rpx;
  135. border-radius: 20rpx;
  136. margin-left: 16rpx;
  137. }
  138. .status-pending {
  139. color: #E6A23C;
  140. background-color: rgba(230, 162, 60, 0.1);
  141. }
  142. .status-done {
  143. color: $theme-color;
  144. background-color: rgba(21, 122, 44, 0.1);
  145. }
  146. /deep/ .uni-checkbox-input-checked {
  147. background-color: $theme-color !important;
  148. border-color: $theme-color !important;
  149. }
  150. }
  151. .card-body {
  152. padding: 20rpx 28rpx 24rpx;
  153. }
  154. .info-row {
  155. display: flex;
  156. flex-direction: row;
  157. margin-bottom: 16rpx;
  158. &:last-child {
  159. margin-bottom: 0;
  160. }
  161. &--full {
  162. flex-direction: column;
  163. }
  164. }
  165. .info-col {
  166. flex: 1;
  167. display: flex;
  168. flex-direction: column;
  169. min-width: 0;
  170. &--full {
  171. flex: none;
  172. width: 100%;
  173. }
  174. .info-label {
  175. font-size: $uni-font-size-ssm;
  176. color: $uni-text-color-grey;
  177. line-height: 36rpx;
  178. margin-bottom: 4rpx;
  179. }
  180. .info-value {
  181. font-size: $uni-font-size-sm;
  182. color: $uni-text-color;
  183. line-height: 40rpx;
  184. word-break: break-all;
  185. &--highlight {
  186. color: $theme-color;
  187. font-weight: 500;
  188. }
  189. }
  190. }
  191. </style>