detail.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="order-detail-box">
  3. <div class="detail-header">
  4. <el-button @click="goBack"> 返回 </el-button>
  5. <h2 class="detail-title">订单详情</h2>
  6. </div>
  7. <div class="detail-content">
  8. <div class="product-title">
  9. {{ formData.productName || "--" }}
  10. </div>
  11. <el-row :gutter="40" class="detail-row">
  12. <el-col :span="12">
  13. <div class="detail-section">
  14. <el-form :model="formData" label-width="120px">
  15. <el-form-item label="订单编号:">
  16. <span>{{ formData.orderNo || "--" }}</span>
  17. </el-form-item>
  18. <el-form-item label="下单时间:">
  19. <span>{{ formData.orderTime || "--" }}</span>
  20. </el-form-item>
  21. <el-form-item label="原价:">
  22. <span>¥{{ formData.originalPrice || 0 }}</span>
  23. </el-form-item>
  24. <el-form-item label="优惠价:">
  25. <span>¥{{ formData.discountedPrice || 0 }}</span>
  26. </el-form-item>
  27. <el-form-item label="数量:">
  28. <span>{{ formData.quantity || 0 }}</span>
  29. </el-form-item>
  30. <el-form-item label="优惠券减免:">
  31. <span>¥{{ formData.couponDiscount || 0 }}</span>
  32. </el-form-item>
  33. <el-form-item label="优惠券类型:">
  34. <span>{{ formData.couponType || "--" }}</span>
  35. </el-form-item>
  36. <el-form-item label="预留手机号:">
  37. <span>{{ formData.phone || "--" }}</span>
  38. </el-form-item>
  39. <el-form-item label="预计收入:">
  40. <span>¥{{ formData.estimatedIncome || 0 }}</span>
  41. </el-form-item>
  42. </el-form>
  43. </div>
  44. </el-col>
  45. <el-col :span="12">
  46. <div class="detail-section">
  47. <div class="coupon-list">
  48. <div v-for="(coupon, index) in couponList" :key="index" class="coupon-item">
  49. <el-form :model="coupon" label-width="100px">
  50. <el-form-item label="状态:">
  51. <span>{{ getCouponStatusName(coupon.status) }}</span>
  52. </el-form-item>
  53. <el-form-item label="券码:">
  54. <span>{{ coupon.code || "--" }}</span>
  55. </el-form-item>
  56. <el-form-item v-if="coupon.status === '2'" label="核销时间:">
  57. <span>{{ coupon.verifyTime || "--" }}</span>
  58. </el-form-item>
  59. <el-form-item v-if="coupon.status === '3'" label="退款时间:">
  60. <span>{{ coupon.refundTime || "--" }}</span>
  61. </el-form-item>
  62. </el-form>
  63. <el-divider v-if="index < couponList.length - 1" />
  64. </div>
  65. </div>
  66. </div>
  67. </el-col>
  68. </el-row>
  69. </div>
  70. </div>
  71. </template>
  72. <script setup lang="tsx" name="orderManagementDetail">
  73. import { ref, onMounted } from "vue";
  74. import { useRoute, useRouter } from "vue-router";
  75. import { ElMessage } from "element-plus";
  76. import { getStaffConfigDeatail } from "@/api/modules/staffConfig";
  77. const route = useRoute();
  78. const router = useRouter();
  79. const formData = ref<any>({});
  80. const couponList = ref<any[]>([]);
  81. const id = ref((route.query.id as string) || "");
  82. // 券码状态映射
  83. const getCouponStatusName = (status: string) => {
  84. const statusMap: Record<string, string> = {
  85. "1": "未核销",
  86. "2": "已核销",
  87. "3": "已退款"
  88. };
  89. return statusMap[status] || "--";
  90. };
  91. onMounted(async () => {
  92. await initData();
  93. });
  94. const initData = async () => {
  95. if (id.value) {
  96. try {
  97. // TODO: 根据实际API获取订单详情
  98. // const response = await getOrderDetail({ id: id.value });
  99. // if (response.code === 200) {
  100. // formData.value = response.data;
  101. // couponList.value = response.data.couponList || [];
  102. // }
  103. // 临时模拟数据
  104. formData.value = {
  105. productName: "4拼冰淇淋蛋糕套餐",
  106. orderNo: "17554469202966300062",
  107. orderTime: "2025/01/01 12:00:00",
  108. originalPrice: 400,
  109. discountedPrice: 380,
  110. quantity: 3,
  111. couponDiscount: 20,
  112. couponType: "商家优惠券/平台优惠券",
  113. phone: "18900000000",
  114. estimatedIncome: 380
  115. };
  116. couponList.value = [
  117. {
  118. status: "1",
  119. code: "B844556562220"
  120. },
  121. {
  122. status: "2",
  123. code: "B844556562220",
  124. verifyTime: "2025/01/01 12:00:00"
  125. },
  126. {
  127. status: "3",
  128. code: "B844556562220",
  129. refundTime: "2025/01/01 12:00:00"
  130. }
  131. ];
  132. } catch (error) {
  133. ElMessage.error("获取详情失败");
  134. }
  135. }
  136. };
  137. const goBack = () => {
  138. router.go(-1);
  139. };
  140. </script>
  141. <style lang="scss" scoped>
  142. .order-detail-box {
  143. height: 100%;
  144. padding: 20px;
  145. background: #ffffff;
  146. }
  147. .detail-header {
  148. display: flex;
  149. align-items: center;
  150. margin-bottom: 20px;
  151. .detail-title {
  152. margin: 0 auto;
  153. font-size: 20px;
  154. font-weight: 500;
  155. }
  156. }
  157. .detail-content {
  158. .product-title {
  159. padding-bottom: 15px;
  160. margin-bottom: 30px;
  161. font-size: 18px;
  162. font-weight: 500;
  163. border-bottom: 1px solid #e4e7ed;
  164. }
  165. .detail-row {
  166. margin-top: 20px;
  167. }
  168. .detail-section {
  169. min-height: 400px;
  170. padding: 20px;
  171. //background: #fafafa;
  172. border-radius: 4px;
  173. }
  174. .coupon-list {
  175. .coupon-item {
  176. margin-bottom: 20px;
  177. &:last-child {
  178. margin-bottom: 0;
  179. }
  180. }
  181. }
  182. }
  183. :deep(.el-form-item) {
  184. margin-bottom: 20px;
  185. .el-form-item__label {
  186. font-weight: normal;
  187. color: #606266;
  188. }
  189. span {
  190. color: #303133;
  191. }
  192. }
  193. </style>