orderItem.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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">
  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 {
  45. ref,
  46. computed
  47. } from 'vue'
  48. const props = defineProps({
  49. item: {
  50. type: Object,
  51. default: () => { }
  52. }
  53. })
  54. const statusEnum = {
  55. "0": '创建',
  56. "1": '用户删除',
  57. "2": '下单(待初审)',
  58. "3": '初审(待取书)',
  59. "4": '初审未通过',
  60. "5": '快递取书(待签收)',
  61. "6": '快递签收(待收货)',
  62. "7": '物流签收(路由异常)',
  63. "8": '仓库收货(待审核)',
  64. "9": '审核中(审核未提交)',
  65. "10": '已审核(待付款)',
  66. "11": '已完成'
  67. };
  68. // 处理昵称显示
  69. const maskedNickName = computed(() => {
  70. if (!props.item.nickName) return '';
  71. return props.item.nickName.charAt(0) + '*'.repeat(props.item.nickName.length - 1);
  72. });
  73. let statusText = computed(() => {
  74. return props.item.status ? statusEnum[props.item.status] : '-';
  75. });
  76. // 模拟数据
  77. const statusColor = ref('#FF4D4F')
  78. // 复制到剪贴板
  79. const copyToClipboard = (text) => {
  80. uni.setClipboardData({
  81. data: text,
  82. success: () => {
  83. uni.showToast({
  84. title: '复制成功',
  85. icon: 'success'
  86. })
  87. }
  88. })
  89. }
  90. // 到货审核
  91. const handleAudit = () => {
  92. // 处理到货审核逻辑
  93. uni.navigateTo({
  94. url: `/pages/index/detail/index?id=${props.item.orderId}`
  95. })
  96. }
  97. // 查看
  98. const handleView = () => {
  99. // 处理查看逻辑 type=2 表示查看订单
  100. uni.navigateTo({
  101. url: `/pages/index/detail/index?id=${props.item.orderId}&type=2`
  102. })
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .order-card {
  107. background: #FFFFFF;
  108. border-radius: 8rpx;
  109. padding: 20rpx;
  110. margin-bottom: 20rpx;
  111. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  112. .user-info {
  113. display: flex;
  114. align-items: flex-start;
  115. margin-bottom: 20rpx;
  116. .avatar {
  117. width: 80rpx;
  118. height: 80rpx;
  119. border-radius: 40rpx;
  120. margin-right: 20rpx;
  121. }
  122. .user-details {
  123. flex: 1;
  124. display: flex;
  125. flex-direction: column;
  126. &.right-items {
  127. align-items: flex-end;
  128. }
  129. .username {
  130. font-size: 28rpx;
  131. color: #333333;
  132. margin-bottom: 4rpx;
  133. }
  134. .date {
  135. font-size: 24rpx;
  136. color: #999999;
  137. }
  138. .status {
  139. font-size: 24rpx;
  140. font-weight: bold;
  141. }
  142. }
  143. }
  144. .order-details {
  145. font-size: 26rpx;
  146. color: #333333;
  147. margin-bottom: 20rpx;
  148. .detail-row {
  149. display: flex;
  150. justify-content: space-between;
  151. margin-bottom: 12rpx;
  152. .link {
  153. color: #007BFF;
  154. text-decoration: underline;
  155. cursor: pointer;
  156. }
  157. }
  158. }
  159. .action-buttons {
  160. display: flex;
  161. justify-content: space-between;
  162. :deep(.u-button) {
  163. flex: 1;
  164. margin: 0 10rpx;
  165. height: 60rpx;
  166. font-size: 26rpx;
  167. }
  168. }
  169. }
  170. </style>