orderItem.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="order-card">
  3. <!-- 用户信息 -->
  4. <view class="user-info">
  5. <image class="avatar" :src="item.imgPath" mode="aspectFill"></image>
  6. <view class="user-details">
  7. <text class="username">{{ item.plat == 1 ? "微信用户" : "支付宝用户" }} ({{ maskedNickName }})</text>
  8. <text class="date">共卖出{{ item.totalNum }}本书</text>
  9. <text class="date">来自{{ item.sendSsq }}</text>
  10. </view>
  11. <view class="user-details right-items">
  12. <text class="date">{{ item.schedulePickupStartTime }}</text>
  13. <text class="status" :style="{ color: statusColor }">[{{ statusText }}]</text>
  14. </view>
  15. </view>
  16. <!-- 订单详情 -->
  17. <view class="order-details">
  18. <view class="detail-row flex flex-col">
  19. <view class="flex-1">
  20. <text>订单ID:</text>
  21. <text class="link" @click="copyToClipboard(item.orderId)">{{ item.orderId }}</text>
  22. </view>
  23. <view class="flex-1" style="flex: 1.5">
  24. <text>运单号:</text>
  25. <text class="link" @click="copyToClipboard(item.waybillCode)">{{ item.waybillCode }}</text>
  26. </view>
  27. </view>
  28. <view class="detail-row">
  29. <text class="flex-1">预估金额:{{ item.expectMoney || 0 }}</text>
  30. <text class="flex-1">审核金额:{{ item.finalMoney || "待核算" }}</text>
  31. </view>
  32. <view class="detail-row">
  33. <text>内部备注:{{ item?.manageRemark ? item?.manageRemark[0]?.remark : "-" }}</text>
  34. </view>
  35. </view>
  36. <!-- 操作按钮 -->
  37. <view class="action-buttons">
  38. <u-button size="small" type="primary" @click="handleAudit">到货审核</u-button>
  39. <u-button size="small" @click="handleView">查看</u-button>
  40. </view>
  41. </view>
  42. </template>
  43. <script setup>
  44. import { ref, computed } from "vue";
  45. const props = defineProps({
  46. item: {
  47. type: Object,
  48. default: () => { },
  49. },
  50. });
  51. const statusEnum = {
  52. 0: "创建",
  53. 1: "用户删除",
  54. 2: "下单(待初审)",
  55. 3: "初审(待取书)",
  56. 4: "初审未通过",
  57. 5: "快递取书(待签收)",
  58. 6: "快递签收(待收货)",
  59. 7: "物流签收(路由异常)",
  60. 8: "仓库收货(待审核)",
  61. 9: "审核中(审核未提交)",
  62. 10: "已审核(待付款)",
  63. 11: "已完成",
  64. };
  65. // 处理昵称显示
  66. const maskedNickName = computed(() => {
  67. let nickName = props.item.userNick || props.item.nickName;
  68. if (!nickName) return "";
  69. return nickName.charAt(0) + "*".repeat(nickName.length - 1);
  70. });
  71. let statusText = computed(() => {
  72. return props.item.status ? statusEnum[props.item.status] : "-";
  73. });
  74. // 模拟数据
  75. const statusColor = ref("#FF4D4F");
  76. // 复制到剪贴板
  77. const copyToClipboard = (text) => {
  78. uni.setClipboardData({
  79. data: text,
  80. success: () => {
  81. uni.showToast({
  82. title: "复制成功",
  83. icon: "success",
  84. });
  85. },
  86. });
  87. };
  88. // 到货审核
  89. const handleAudit = () => {
  90. // 处理到货审核逻辑
  91. uni.navigateTo({
  92. url: `/pages/index/detail/index?id=${props.item.orderId}`,
  93. });
  94. };
  95. // 查看
  96. const handleView = () => {
  97. // 处理查看逻辑 type=2 表示查看订单
  98. uni.navigateTo({
  99. url: `/pages/index/detail/index?id=${props.item.orderId}&type=2`,
  100. });
  101. };
  102. </script>
  103. <style lang="scss" scoped>
  104. .order-card {
  105. background: #ffffff;
  106. border-radius: 8rpx;
  107. padding: 20rpx;
  108. margin-bottom: 20rpx;
  109. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  110. .user-info {
  111. display: flex;
  112. align-items: flex-start;
  113. margin-bottom: 20rpx;
  114. .avatar {
  115. width: 80rpx;
  116. height: 80rpx;
  117. border-radius: 40rpx;
  118. margin-right: 20rpx;
  119. }
  120. .user-details {
  121. flex: 1;
  122. display: flex;
  123. flex-direction: column;
  124. &.right-items {
  125. align-items: flex-end;
  126. }
  127. .username {
  128. font-size: 28rpx;
  129. color: #333333;
  130. margin-bottom: 4rpx;
  131. }
  132. .date {
  133. font-size: 24rpx;
  134. color: #999999;
  135. }
  136. .status {
  137. font-size: 24rpx;
  138. font-weight: bold;
  139. }
  140. }
  141. }
  142. .order-details {
  143. font-size: 26rpx;
  144. color: #333333;
  145. margin-bottom: 20rpx;
  146. .detail-row {
  147. display: flex;
  148. justify-content: space-between;
  149. margin-bottom: 12rpx;
  150. .link {
  151. color: #007bff;
  152. text-decoration: underline;
  153. cursor: pointer;
  154. }
  155. }
  156. }
  157. .action-buttons {
  158. display: flex;
  159. justify-content: space-between;
  160. :deep(.u-button) {
  161. flex: 1;
  162. margin: 0 10rpx;
  163. height: 60rpx;
  164. font-size: 26rpx;
  165. }
  166. }
  167. }
  168. </style>