pickCard.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="pick-card-container">
  3. <checkbox-group v-for="(item, index) in list" :key="index" @change="e => selectVal(e, item, index)">
  4. <label class="card-label">
  5. <view class="card-wrapper" :class="{'card-active': item.checked}" @click="openDetails(item.pickStatus, item.id)">
  6. <!-- 卡片头部 -->
  7. <view class="card-header">
  8. <view class="header-left">
  9. <checkbox v-if='item.pickStatus == 0' :checked="item.checked" class="card-checkbox" />
  10. <text class="order-code">{{ item.code }}</text>
  11. </view>
  12. <view class="status-badge" :class="getStatusClass(item.pickStatus)">
  13. {{ getStatusText(item.pickStatus) }}
  14. </view>
  15. </view>
  16. <!-- 卡片内容 -->
  17. <view class="card-content">
  18. <!-- 产品信息行 -->
  19. <view class="info-row">
  20. <view class="info-item">
  21. <text class="info-label">产品编码</text>
  22. <text class="info-value">{{ item.productCode }}</text>
  23. </view>
  24. <view class="info-item">
  25. <text class="info-label">名称</text>
  26. <text class="info-value">{{ item.productName }}</text>
  27. </view>
  28. </view>
  29. <!-- 规格信息行 -->
  30. <view class="info-row">
  31. <view class="info-item">
  32. <text class="info-label">牌号</text>
  33. <text class="info-value">{{ item.brandNo }}</text>
  34. </view>
  35. <view class="info-item">
  36. <text class="info-label">型号</text>
  37. <text class="info-value">{{ item.model }}</text>
  38. </view>
  39. </view>
  40. <!-- 数量状态行 -->
  41. <view class="info-row">
  42. <view class="info-item">
  43. <text class="info-label">生产数量</text>
  44. <text class="info-value">{{ item.formingNum }} {{ item.unit }}</text>
  45. </view>
  46. <view class="info-item">
  47. <text class="info-label">状态</text>
  48. <text class="info-value">{{ statusList[item.status] }}</text>
  49. </view>
  50. </view>
  51. <!-- 工艺路线 -->
  52. <view class="info-row route-row">
  53. <text class="info-label">工艺路线</text>
  54. <text class="route-value">{{ item.produceRoutingName }}</text>
  55. </view>
  56. </view>
  57. </view>
  58. </label>
  59. </checkbox-group>
  60. </view>
  61. </template>
  62. <script>
  63. export default {
  64. props: {
  65. list: {
  66. type: Array,
  67. default: () => []
  68. },
  69. },
  70. data() {
  71. return {
  72. statusList: {
  73. 4: '待生产',
  74. 5: '生产中',
  75. 6: '已完成',
  76. 7: '已延期',
  77. 8: '待下达'
  78. }
  79. }
  80. },
  81. methods: {
  82. selectVal(e, val, index) {
  83. this.list[index].checked = !this.list[index].checked
  84. },
  85. openDetails(pickStatus, id) {
  86. if(pickStatus == 1 || pickStatus == 2) {
  87. let url = `/pages/pda/picking/bill/index?id=${id}&status=${pickStatus}`
  88. uni.navigateTo({
  89. url
  90. })
  91. }
  92. },
  93. // 获取状态文本
  94. getStatusText(pickStatus) {
  95. const statusMap = {
  96. 0: '未领料',
  97. 1: '已领料',
  98. 2: '已出库'
  99. }
  100. return statusMap[pickStatus] || ''
  101. },
  102. // 获取状态样式类
  103. getStatusClass(pickStatus) {
  104. const classMap = {
  105. 0: 'status-pending',
  106. 1: 'status-picked',
  107. 2: 'status-out'
  108. }
  109. return classMap[pickStatus] || ''
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .pick-card-container {
  116. width: 100%;
  117. padding: 0;
  118. }
  119. .card-label {
  120. display: block;
  121. width: 100%;
  122. }
  123. .card-wrapper {
  124. margin: 24rpx;
  125. background: #FFFFFF;
  126. border-radius: 16rpx;
  127. box-shadow: 0 4rpx 12rpx 0 rgba(0, 0, 0, 0.05);
  128. overflow: hidden;
  129. transition: all 0.3s ease;
  130. &.card-active {
  131. box-shadow: 0 4rpx 16rpx 0 rgba(64, 158, 255, 0.2);
  132. border: 2rpx solid rgba(64, 158, 255, 0.3);
  133. }
  134. }
  135. /* 卡片头部 */
  136. .card-header {
  137. display: flex;
  138. align-items: center;
  139. justify-content: space-between;
  140. padding: 24rpx 28rpx;
  141. background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  142. border-bottom: 1rpx solid #f0f0f0;
  143. }
  144. .header-left {
  145. display: flex;
  146. align-items: center;
  147. flex: 1;
  148. min-width: 0;
  149. }
  150. .card-checkbox {
  151. flex-shrink: 0;
  152. margin-right: 16rpx;
  153. transform: scale(1.1);
  154. }
  155. .order-code {
  156. font-size: 30rpx;
  157. font-weight: 600;
  158. color: #303133;
  159. flex: 1;
  160. overflow: hidden;
  161. text-overflow: ellipsis;
  162. white-space: nowrap;
  163. }
  164. /* 状态徽章 */
  165. .status-badge {
  166. flex-shrink: 0;
  167. padding: 8rpx 20rpx;
  168. border-radius: 24rpx;
  169. font-size: 24rpx;
  170. font-weight: 500;
  171. margin-left: 16rpx;
  172. &.status-pending {
  173. background: #FFF7E6;
  174. color: #FA8C16;
  175. }
  176. &.status-picked {
  177. background: #E6F7FF;
  178. color: #1890FF;
  179. }
  180. &.status-out {
  181. background: #F6FFED;
  182. color: #52C41A;
  183. }
  184. }
  185. /* 卡片内容 */
  186. .card-content {
  187. padding: 24rpx 28rpx;
  188. }
  189. .info-row {
  190. display: flex;
  191. align-items: flex-start;
  192. margin-bottom: 20rpx;
  193. &:last-child {
  194. margin-bottom: 0;
  195. }
  196. &.route-row {
  197. flex-direction: column;
  198. padding-top: 8rpx;
  199. border-top: 1rpx solid #f5f5f5;
  200. }
  201. }
  202. .info-item {
  203. flex: 1;
  204. display: flex;
  205. flex-direction: column;
  206. min-width: 0;
  207. padding-right: 16rpx;
  208. &:last-child {
  209. padding-right: 0;
  210. }
  211. }
  212. .info-label {
  213. font-size: 24rpx;
  214. color: #909399;
  215. margin-bottom: 8rpx;
  216. line-height: 1.4;
  217. }
  218. .info-value {
  219. font-size: 28rpx;
  220. color: #303133;
  221. font-weight: 500;
  222. line-height: 1.5;
  223. word-break: break-all;
  224. }
  225. .route-value {
  226. font-size: 28rpx;
  227. color: $theme-color;
  228. font-weight: 500;
  229. margin-top: 8rpx;
  230. line-height: 1.6;
  231. word-break: break-all;
  232. }
  233. /* 复选框选中样式 */
  234. /deep/ .uni-checkbox-input {
  235. border-radius: 6rpx;
  236. }
  237. /deep/ .uni-checkbox-input-checked {
  238. background-color: $theme-color !important;
  239. border-color: $theme-color !important;
  240. }
  241. /* 响应式适配 */
  242. @media screen and (max-width: 375px) {
  243. .card-wrapper {
  244. margin: 20rpx;
  245. }
  246. .card-header,
  247. .card-content {
  248. padding: 20rpx 24rpx;
  249. }
  250. .order-code {
  251. font-size: 28rpx;
  252. }
  253. .info-value,
  254. .route-value {
  255. font-size: 26rpx;
  256. }
  257. }
  258. </style>