dct 1 maand geleden
bovenliggende
commit
027c6bb063

+ 60 - 1
src/utils/order.js

@@ -50,4 +50,63 @@ export const getPaymentStatusText = (status) => {
     'Refunded': '已退款'
   }
   return texts[status] || status
-}
+}
+
+// 退款方式
+export const getRefundMethodType = (method) => {
+  const types = {
+    'Online': 'primary',
+    'Balance': 'warning',
+    'Offline': 'info'
+  }
+  return types[method] || 'info'
+}
+
+export const getRefundMethodText = (method) => {
+  const texts = {
+    'Online': '在线退款',
+    'Balance': '余额退款',
+    'Offline': '线下退款'
+  }
+  return texts[method] || method
+}
+
+// 退款状态
+export const getRefundStatusType = (status) => {
+  const types = {
+    'Pending': 'warning',
+    'Success': 'success',
+    'Failed': 'danger',
+    'Cancelled': 'info'
+  }
+  return types[status] || 'info'
+}
+
+export const getRefundStatusText = (status) => {
+  const texts = {
+    'Pending': '处理中',
+    'Success': '成功',
+    'Failed': '失败',
+    'Cancelled': '已取消'
+  }
+  return texts[status] || status
+}
+
+// 退款审核状态
+export const getAuditStatusType = (status) => {
+  const types = {
+    'Pending': 'warning',
+    'Approved': 'success',
+    'Rejected': 'danger'
+  }
+  return types[status] || 'info'
+}
+
+export const getAuditStatusText = (status) => {
+  const texts = {
+    'Pending': '待审核',
+    'Approved': '审核通过',
+    'Rejected': '审核驳回'
+  }
+  return texts[status] || status
+}

+ 22 - 8
src/views/order/detial.vue

@@ -5,20 +5,21 @@
         <el-descriptions-item label="订单号">{{ orderData.order?.orderNo }}</el-descriptions-item>
         <el-descriptions-item label="旅行社">{{ orderData.order?.agencyName }}</el-descriptions-item>
         <el-descriptions-item label="出行日期">
-          {{ orderData.order?.travelStartDate }} 至 {{ orderData.order?.travelEndDate }}
+          {{ moment(orderData.order?.travelStartDate).format('YYYY-MM-DD') }} 至 {{ getEndDay(orderData.order) }}
         </el-descriptions-item>
         <el-descriptions-item label="行程天数">{{ orderData.order?.travelDays }}天</el-descriptions-item>
         <el-descriptions-item label="游客人数">{{ orderData.order?.touristCount }}人</el-descriptions-item>
         <el-descriptions-item label="订单金额">¥{{ orderData.order?.totalAmount }}</el-descriptions-item>
         <el-descriptions-item label="订单状态">
           <el-tag :type="getOrderStatusType(orderData.order?.status)">{{ getOrderStatusText(orderData.order?.status)
-            }}</el-tag>
+          }}</el-tag>
         </el-descriptions-item>
         <el-descriptions-item label="支付状态">
           <el-tag :type="getPaymentStatusType(orderData.order?.paymentStatus)">{{
             getPaymentStatusText(orderData.order?.paymentStatus) }}</el-tag>
         </el-descriptions-item>
-        <el-descriptions-item label="支付方式">{{ orderData.order?.paymentMethod === 'Online' ? '在线支付' : orderData.order?.paymentMethod }}</el-descriptions-item>
+        <el-descriptions-item label="支付方式">{{ orderData.order?.paymentMethod === 'Online' ? '在线支付' :
+          orderData.order?.paymentMethod }}</el-descriptions-item>
         <el-descriptions-item label="支付时间">{{ orderData.order?.paymentDate }}</el-descriptions-item>
         <el-descriptions-item label="备注" :span="2">{{ orderData.order?.remark }}</el-descriptions-item>
       </el-descriptions>
@@ -27,9 +28,12 @@
 
       <h3>行程安排</h3>
       <el-timeline>
-        <el-timeline-item v-for="schedule in orderData.schedules" :key="schedule.id" :timestamp="schedule.scheduleDate">
-          <h4>{{ schedule.title }}</h4>
-          <p>{{ schedule.description }}</p>
+        <el-timeline-item v-for="schedule in orderData.schedules" :key="schedule.id"
+          :timestamp="moment(schedule.scheduleDate).format('YYYY-MM-DD')">
+          <div style="display: inline-flex;">
+            <h4>{{ schedule.title }}</h4>
+            <p>{{ schedule.description }}</p>
+          </div>
         </el-timeline-item>
       </el-timeline>
 
@@ -46,7 +50,11 @@
             </el-tag>
           </template>
         </el-table-column>
-        <el-table-column prop="useDate" label="使用日期" width="180" />
+        <el-table-column prop="useDate" label="使用日期" width="150">
+          <template #default="scope">
+            {{ moment(scope.row.useDate).format('YYYY-MM-DD') }}
+          </template>
+        </el-table-column>
         <el-table-column prop="quantity" label="数量" width="80" />
         <el-table-column prop="unitPrice" label="单价" width="100">
           <template #default="{ row }">¥{{ row.unitPrice }}</template>
@@ -112,6 +120,12 @@ const orderData = reactive({
   paymentInfo: []
 })
 
+const getEndDay = (order) => {
+  if (!order || !order.travelStartDate || !order.travelDays) return ''
+  const startDate = moment(order.travelStartDate)
+  const endDate = startDate.add(order.travelDays - 1, 'days')
+  return endDate.format('YYYY-MM-DD')
+}
 const open = async (orderID) => {
   dialogVisible.value = true
   loading.value = true
@@ -124,7 +138,7 @@ const open = async (orderID) => {
     }
     const paymentResponse = await getPaymentInfoByOrderId(orderID)
     if (paymentResponse.code === 200) {
-      orderData.paymentInfo = paymentResponse.data
+      orderData.paymentInfo = paymentResponse.data?.filter(item => item.status === 'Success') || []
     } else {
       console.error('获取支付信息失败:', paymentResponse.message)
     }

+ 36 - 24
src/views/order/index.vue

@@ -72,11 +72,11 @@
       <el-table-column type="index" label="序号" align="center" width="60"></el-table-column>
       <el-table-column prop="orderNo" label="订单号" min-width="180"></el-table-column>
       <el-table-column prop="agencyName" label="旅行社名称" min-width="180" show-overflow-tooltip></el-table-column>
-      <el-table-column prop="travelStartDate" label="游玩日期" width="200">
+      <el-table-column prop="travelStartDate" label="游玩日期" width="160">
         <template #default="scope">
-          <div>开始日期: {{ scope.row.travelStartDate }}</div>
-          <div>结束日期: {{ scope.row.travelEndDate }}</div>
-          <div>共: <el-tag size="small">{{ scope.row.travelDays + 1 }}天</el-tag></div>
+          <div>开始日期: {{ moment(scope.row.travelStartDate).format('YYYY-MM-DD') }}</div>
+          <div>结束日期: {{ getEndDay(scope.row) }}</div>
+          <div>共: <el-tag size="small">{{ scope.row.travelDays }}天</el-tag></div>
         </template>
       </el-table-column>
       <el-table-column prop="touristCount" label="人数" width="80" align="center"></el-table-column>
@@ -95,10 +95,8 @@
       </el-table-column>
       <el-table-column prop="auditStatus" label="审核状态" width="100">
         <template #default="scope">
-          <el-tag :type="scope.row.auditStatus === 'Approved' ? 'success' :
-            scope.row.auditStatus === 'Rejected' ? 'danger' : 'warning'">
-            {{ scope.row.auditStatus === 'Approved' ? '已通过' :
-              scope.row.auditStatus === 'Rejected' ? '已驳回' : '待审核' }}
+          <el-tag :type="getAuditStatusType(scope.row.auditStatus)">
+            {{ getAuditStatusText(scope.row.auditStatus) }}
           </el-tag>
         </template>
       </el-table-column>
@@ -120,14 +118,14 @@
           <div>
             <!-- <el-button type="primary" link size="small" @click="edit(scope.row)">编辑</el-button> -->
             <!-- <el-button type="success" link size="small" @click="audit(scope.row)">审核</el-button> -->
-            <el-button type="info" link size="small" @click="attachment(scope.row)">附件</el-button>
+            <el-button type="info" link size="small" @click="view(scope.row)">详情</el-button>
             <el-button type="info" link size="small" @click="editSchedule(scope.row)">行程</el-button>
             <el-button type="info" link size="small" @click="editTourists(scope.row)">游客</el-button>
-            <el-button type="info" link size="small" @click="view(scope.row)">详情</el-button>
+            <el-button type="info" link size="small" @click="attachment(scope.row)">附件</el-button>
           </div>
           <div>
-            <el-button v-if="userAccountId === 'testuser' && orderCanPay(scope.row)" type="success" link size="small"
-              @click="payment(scope.row)">款</el-button>
+            <el-button v-if="orderCanPay(scope.row)" type="success" link size="small"
+              @click="payment(scope.row)">款</el-button>
             <!-- <el-button v-if="!['Completed', 'Cancelled'].includes(scope.row.status)" type="warning" link size="small"
               @click="cancel(scope.row)">取消</el-button> -->
             <el-button v-if="scope.row.status === 'Submitted'" type="danger" link size="small"
@@ -508,14 +506,15 @@
       </div> -->
 
       <el-table :data="scheduleList" border style="width: 100%" size="small">
-        <el-table-column type="index" label="序号" width="50" align="center" />
+        <!-- <el-table-column type="index" label="序号" width="50" align="center" /> -->
         <el-table-column prop="dayNumber" label="天数" width="80" align="center" />
         <el-table-column prop="scheduleDate" label="日期" width="120">
           <template #default="scope">
-            {{ scope.row.scheduleDate }}
+            {{ moment(scope.row.scheduleDate).format('YYYY-MM-DD') }}
           </template>
         </el-table-column>
-        <el-table-column prop="title" label="标题" />
+        <el-table-column prop="title" label="标题" width="100" />
+        <el-table-column prop="description" label="内容" show-overflow-tooltip />
         <!-- <el-table-column label="操作" width="120" align="center">
           <template #default="scope">
             <el-button type="primary" link size="small" @click="editScheduleItem(scope.row)">编辑</el-button>
@@ -855,9 +854,9 @@
 
     </el-dialog>
 
-    <el-dialog :title="`款`" v-model="paymentDialogVisible" width="500px" append-to-body @close="cancelPayment">
+    <el-dialog :title="`款`" v-model="paymentDialogVisible" width="500px" append-to-body @close="cancelPayment">
       <el-form :model="paymentForm" ref="paymentFormRef" label-width="100px">
-        <el-form-item label="款方式" prop="method">
+        <el-form-item label="款方式" prop="method">
           <el-radio-group v-model="paymentForm.method">
             <el-radio-button label="Online">在线支付</el-radio-button>
             <!-- <el-radio-button label="Balance">余额扣款</el-radio-button>
@@ -872,7 +871,7 @@
         </el-form-item>
 
 
-        <el-form-item label="款金额" prop="amount">
+        <el-form-item label="款金额" prop="amount">
           <el-input-number v-model.number="paymentForm.amount" disabled :min="0" :precision="2" style="width:200px" />
         </el-form-item>
 
@@ -889,11 +888,11 @@
       </template>
     </el-dialog>
 
-    <el-dialog title="款二维码" v-model="onlinePaymentDialogVisible" width="420px" append-to-body
+    <el-dialog title="款二维码" v-model="onlinePaymentDialogVisible" width="420px" append-to-body
       @close="cancelOnlinePayment">
       <div style="text-align:center; padding: 10px 0;">
         <div style="margin-bottom:8px; font-size:16px;">
-          款金额:<strong style="color:#f56c6c">¥{{ (paymentForm.amount || 0).toFixed(2) }}</strong>
+          款金额:<strong style="color:#f56c6c">¥{{ (paymentForm.amount || 0).toFixed(2) }}</strong>
         </div>
 
         <div style="margin-bottom:10px; color:#666;">请使用支付客户端扫码支付</div>
@@ -946,7 +945,14 @@ import moment from 'moment/moment';
 import { ProductTypes, FileTypeMap } from '@/constant';
 import utils from '@/utils/util';
 import QRCode from 'qrcode';
-import { getOrderStatusText, getOrderStatusType, getPaymentStatusText, getPaymentStatusType } from '@/utils/order';
+import {
+  getOrderStatusText,
+  getOrderStatusType,
+  getPaymentStatusText,
+  getPaymentStatusType,
+  getAuditStatusText,
+  getAuditStatusType,
+} from '@/utils/order';
 import OrderDetailDialog from './detial.vue';
 
 const QRCodeOpts = {
@@ -1151,6 +1157,11 @@ export default {
     };
   },
   methods: {
+    moment,
+    getEndDay(row) {
+      if (!row.travelStartDate || !row.travelDays) return '-';
+      return moment(row.travelStartDate).add(row.travelDays - 1, 'days').format('YYYY-MM-DD');
+    },
     getProductCategories() {
       getProductCategories({
         keyword: "",
@@ -1352,7 +1363,7 @@ export default {
         });
       } else {
         // TODO
-        this.$message.success('款成功');
+        this.$message.success('款成功');
         this.paymentDialogVisible = false;
         this.getOrderList();
       }
@@ -1361,7 +1372,7 @@ export default {
       const { orderNo, amount } = this.paymentForm;
       const qrCodeContainer = document.getElementById('payment-qr-code');
       qrCodeContainer.innerHTML = '';
-      const state = { amount };
+      const state = { amount, orderNo };
       const redirectUrl = encodeURIComponent(`${window.location.origin}/payment/detail/${orderNo}`); // 回调地址,获取到 code 之后重定向的 URL
       // const res = await getAuthUrl(redirectUrl, JSON.stringify(state));
       // const authUrl = res?.data?.authUrl?.replaceAll('ljyx.', 'ljyxweb.');
@@ -1600,6 +1611,8 @@ export default {
     getOrderStatusText,
     getPaymentStatusType,
     getPaymentStatusText,
+    getAuditStatusType,
+    getAuditStatusText,
     orderCanPay(row) {
       return row.paymentStatus !== 'Paid';
     },
@@ -1621,7 +1634,6 @@ export default {
     getScheduleList(orderId) {
       // 调用API获取行程列表
       getScheduleByOrderId(orderId).then(res => {
-        console.log(res, 'scheduleList');
         this.scheduleList = res.data;
       });
     },

+ 29 - 49
src/views/order/refund.vue

@@ -65,7 +65,9 @@
       </el-table-column>
       <el-table-column prop="refundMethod" label="退款方式" width="100" align="center">
         <template #default="scope">
-          {{ scope.row.refundMethod === 'Online' ? '在线退款' : scope.row.refundMethod }}
+          <el-tag :type="getRefundMethodType(scope.row.refundMethod)">
+            {{ getRefundMethodText(scope.row.refundMethod) }}
+          </el-tag>
         </template>
       </el-table-column>
       <el-table-column prop="refundUserName" label="申请人" width="120"></el-table-column>
@@ -167,9 +169,9 @@
         <el-descriptions-item label="实退金额">¥{{ refundForm.actualRefundAmount }}</el-descriptions-item>
         <el-descriptions-item label="退款方式">
           <el-select v-model="refundForm.refundMethod" style="width: 100%">
-            <el-option label="原路退回" value="Original"></el-option>
-            <el-option label="银行转账" value="BankTransfer"></el-option>
-            <el-option label="现金退款" value="Cash"></el-option>
+            <el-option label="在线退款" value="Online"></el-option>
+            <el-option label="余额退款" value="Balance"></el-option>
+            <el-option label="线下退款" value="Offline"></el-option>
           </el-select>
         </el-descriptions-item>
       </el-descriptions>
@@ -235,7 +237,18 @@ import {
   getPaymentInfoByOrderId,
 } from '@/api/order';
 import moment from 'moment';
-import { getOrderStatusText, getOrderStatusType, getPaymentStatusText, getPaymentStatusType } from '@/utils/order';
+import {
+  getOrderStatusText,
+  getOrderStatusType,
+  getPaymentStatusText,
+  getPaymentStatusType,
+  getRefundStatusType,
+  getRefundStatusText,
+  getRefundMethodText,
+  getRefundMethodType,
+  getAuditStatusText,
+  getAuditStatusType,
+} from '@/utils/order';
 import OrderDetailDialog from './detial.vue';
 
 export default {
@@ -300,7 +313,16 @@ export default {
   },
   methods: {
     moment,
-
+    getOrderStatusType,
+    getOrderStatusText,
+    getRefundStatusType,
+    getRefundStatusText,
+    getPaymentStatusType,
+    getPaymentStatusText,
+    getRefundMethodType,
+    getRefundMethodText,
+    getAuditStatusType,
+    getAuditStatusText,
     sizeHandler(val) {
       this.forms.rows = val;
       this.getRefundList();
@@ -445,52 +467,10 @@ export default {
     },
     paymentRecord(row) {
       getPaymentInfoByOrderId(row.orderID).then((res) => {
-        this.paymentRecordData = res.data || [];
+        this.paymentRecordData = res.data?.filter(item => item.status === 'Success') || [];
         this.paymentRecordDialogVisible = true;
       });
     },
-
-    getOrderStatusType,
-    getOrderStatusText,
-    getPaymentStatusType,
-    getPaymentStatusText,
-    getAuditStatusType(status) {
-      const types = {
-        'Pending': 'warning',
-        'Approved': 'success',
-        'Rejected': 'danger',
-      };
-      return types[status] || 'info';
-    },
-    getAuditStatusText(status) {
-      const texts = {
-        'Pending': '待审核',
-        'Approved': '已通过',
-        'Rejected': '已驳回',
-      };
-      return texts[status] || status;
-    },
-    getRefundStatusType(status) {
-      const types = {
-        'Pending': 'warning',
-        'Approved': 'success',
-        'Rejected': 'danger',
-        'Refunding': 'info',
-        'Refunded': 'success',
-      };
-      return types[status] || 'info';
-    },
-
-    getRefundStatusText(status) {
-      const texts = {
-        'Pending': '退款中',
-        'Approved': '已通过',
-        'Rejected': '已驳回',
-        'Refunding': '退款中',
-        'Refunded': '已退款',
-      };
-      return texts[status] || status;
-    },
     viewOrderDetail(orderID) {
       this.$refs.orderDetailDialog.open(orderID);
     },

+ 9 - 4
src/views/order/review.vue

@@ -38,9 +38,9 @@
       <el-table-column prop="agencyName" label="旅行社名称" min-width="180" show-overflow-tooltip></el-table-column>
       <el-table-column prop="travelStartDate" label="游玩日期" width="200">
         <template #default="scope">
-          <div>开始日期: {{ scope.row.travelStartDate }}</div>
-          <div>结束日期: {{ scope.row.travelEndDate }}</div>
-          <div>共: <el-tag size="small">{{ scope.row.travelDays + 1 }}天</el-tag></div>
+          <div>开始日期: {{ moment(scope.row.travelStartDate).format('YYYY-MM-DD') }}</div>
+          <div>结束日期: {{ getEndDay(scope.row) }}</div>
+          <div>共: <el-tag size="small">{{ scope.row.travelDays }}天</el-tag></div>
         </template>
       </el-table-column>
       <el-table-column prop="touristCount" label="人数" width="80" align="center"></el-table-column>
@@ -86,7 +86,7 @@
             {{ scope.row.status === 'Cancelling' ? '退费' : '订单' }}审核
           </el-button>
           <el-button type="info" link size="small" @click="view(scope.row)">详情</el-button>
-          <!-- <el-button type="warning" link size="small" @click="payment(scope.row)">款</el-button>
+          <!-- <el-button type="warning" link size="small" @click="payment(scope.row)">款</el-button>
           <el-button type="info" link size="small" @click="editSchedule(scope.row)">行程</el-button>
           <el-button type="primary" link size="small" @click="editTourists(scope.row)">游客</el-button>
           <el-button type="danger" link size="small" @click="del(scope.row)">删除</el-button> -->
@@ -207,6 +207,11 @@ export default {
     };
   },
   methods: {
+    moment,
+    getEndDay(row) {
+      if (!row.travelStartDate || !row.travelDays) return '-';
+      return moment(row.travelStartDate).add(row.travelDays - 1, 'days').format('YYYY-MM-DD');
+    },
     sizeHandler(val) {
       this.forms.rows = val;
       this.getOrderList();

+ 7 - 12
src/views/payment/success.vue

@@ -14,11 +14,7 @@
       <div class="info">
         <div class="row">
           <span class="label">订单号</span>
-          <span class="value order" @click="copyOrder">{{ orderId || '—' }}</span>
-        </div>
-        <div class="row">
-          <span class="label">支付方式</span>
-          <span class="value">{{ paymentMethod || '—' }}</span>
+          <span class="value order" @click="copyOrder">{{ orderNo || '—' }}</span>
         </div>
         <div class="row">
           <span class="label">支付金额</span>
@@ -42,11 +38,10 @@ import { useRoute } from 'vue-router'
 const route = useRoute()
 
 // 从路由 query 或 params 获取信息(兼容常见场景)
-const orderId = route.query.orderId || route.params.orderId || route.query.order || ''
-const amountRaw = route.query.amount || route.query.total || route.params.amount || ''
-const paymentMethod = route.query.method || route.query.payMethod || route.params.method || '未知'
+const state = route.query.state ? JSON.parse(route.query.state) : {}
+const orderNo = state.orderNo || route.query.orderNo || route.params.id || ''
+const amountRaw = state.amount || route.query.total || route.params.amount || ''
 const paidAt = route.query.time || new Date().toLocaleString()
-
 const amount = computed(() => {
   const n = parseFloat(amountRaw)
   return Number.isFinite(n) ? n : null
@@ -59,14 +54,14 @@ const formattedAmount = computed(() => {
 
 // 简单复制订单号
 const copyOrder = async () => {
-  if (!orderId) return
+  if (!orderNo) return
   try {
-    await navigator.clipboard.writeText(String(orderId))
+    await navigator.clipboard.writeText(String(orderNo))
     toast('订单号已复制')
   } catch {
     // 退回到选择文本方式(兼容性)
     const el = document.createElement('textarea')
-    el.value = String(orderId)
+    el.value = String(orderNo)
     document.body.appendChild(el)
     el.select()
     document.execCommand('copy')

+ 1 - 3
src/views/product/index.vue

@@ -413,7 +413,6 @@ export default {
     },
     getProductList() {
       getProducts(this.forms || {}).then((res) => {
-        console.log(res);
         this.tableData = res.data?.data || []
         this.total = res.data?.records || 0
       });
@@ -422,7 +421,6 @@ export default {
     submit() {
       this.$refs.formRef.validate((valid) => {
         if (!valid) return;
-        console.log(this.formData, 'formdata');
         submitProduct(this.formData).then((res) => {
           if (res.code === 200) {
             this.$message({
@@ -448,7 +446,7 @@ export default {
         .then(() => {
           delProduct(row.id).then((res) => {
             if (res.code === 200) {
-              globalThis.$message({
+              this.$message({
                 type: "success",
                 message: "删除成功",
               });