zhoujs 5 днів тому
батько
коміт
bda1844a0b
2 змінених файлів з 39 додано та 15 видалено
  1. 7 5
      package-lock.json
  2. 32 10
      src/views/orders/list.vue

+ 7 - 5
package-lock.json

@@ -570,11 +570,6 @@
         "fastq": "^1.6.0"
       }
     },
-    "@popperjs/core": {
-      "version": "npm:@sxzz/popperjs-es@2.11.7",
-      "resolved": "https://mirrors.huaweicloud.com/repository/npm/@sxzz/popperjs-es/-/popperjs-es-2.11.7.tgz",
-      "integrity": "sha512-Ccy0NlLkzr0Ex2FKvh2X+OyERHXJ88XJ1MXtsI9y9fGexlaXaVTPzBCRBwIxFkORuOb+uBqeu+RqnpgYTEZRUQ=="
-    },
     "@rollup/pluginutils": {
       "version": "4.2.1",
       "resolved": "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-4.2.1.tgz",
@@ -2076,6 +2071,13 @@
         "lodash-unified": "^1.0.2",
         "memoize-one": "^6.0.0",
         "normalize-wheel-es": "^1.1.2"
+      },
+      "dependencies": {
+        "@popperjs/core": {
+          "version": "npm:@sxzz/popperjs-es@2.11.7",
+          "resolved": "https://mirrors.cloud.tencent.com/npm/@sxzz/popperjs-es/-/popperjs-es-2.11.7.tgz",
+          "integrity": "sha512-Ccy0NlLkzr0Ex2FKvh2X+OyERHXJ88XJ1MXtsI9y9fGexlaXaVTPzBCRBwIxFkORuOb+uBqeu+RqnpgYTEZRUQ=="
+        }
       }
     },
     "emojis-list": {

+ 32 - 10
src/views/orders/list.vue

@@ -75,7 +75,18 @@
                 </el-table-column>
                 <el-table-column type="index" min-width="80" />
                 <el-table-column label="订单号" prop="number" show-overflow-tooltip></el-table-column>
-                <el-table-column label="订单金额" prop="amount"></el-table-column>
+                <el-table-column label="支付金额" min-width="160" prop="amount">
+                    <template #default="{ row }">
+                        <div>
+                            <div style="text-decoration: line-through;">订单金额:¥{{row.amount}}</div>
+                            <div style="color: #f01414;">实付金额:¥{{row.payAmount || row.amount}}</div>
+                            <div v-if="row.ticketNo" class="refund-info">
+                                <div style="font-size: 12px;">抵扣券券号:{{ row.ticketNo }}</div>
+                                <div style="font-size: 12px;">抵扣券金额:¥{{ row.ticketAmount }}</div>
+                            </div>
+                        </div>
+                    </template>
+                </el-table-column>
                 <el-table-column label="桌号" prop="deskName"></el-table-column>
                 <el-table-column label="备注" prop="remark"></el-table-column>
                 <el-table-column label="类型" prop="type"
@@ -83,10 +94,11 @@
                 <el-table-column label="状态" min-width="160" prop="status" >
                     <template #default="{ row }">
                         <div>
-                            {{ row.status == 4 ? '退款成功' : row.status == 2 ? '已完成' : row.status == 0 ? '待下单' : row.status == 1 ? '待支付' : '已取消' }}
-                            <div v-if="row.status == 4" class="refund-info">
-                                <div>退款时间:{{ row.refundTime }}</div>
-                                <div>退款金额:¥{{ row.refundAmount }}</div>
+                            {{ row.status == 4 ? '退款成功' : row.status == 2 ? '已完成' : row.status == 0 ? '待下单' 
+                            : row.status == 1 ? '待支付' : row.status == 5 ? '退款中' : '已取消' }}
+                            <div v-if="row.refundStatus=='SUCCESS'" class="refund-info">
+                                <div>退款时间:{{ row.refundTime }}</div>
+                                <div>退款金额:¥{{ row.refundAmount }}</div>
                             </div>
                         </div>
                     </template>
@@ -96,7 +108,7 @@
                 <el-table-column label="操作" width="200" fixed="right">
                     <template #default="{ row }">
                         <el-button type="primary" link @click="showDetail(row)">查看已点菜品</el-button>
-                        <el-button v-if="row.type == 1 && row.status=='2'" type="danger" link @click="refund(row)">退款</el-button>
+                        <el-button v-if="row.type == 1 && row.status=='2' && !row.refundAmount" type="danger" link @click="refund(row)">退款</el-button>
                     </template>
                 </el-table-column>
             </el-table>
@@ -175,11 +187,16 @@
     const refundDialogVisible = ref(false)
     const refundAmount = ref(0)
     var refundOrder: {
+        refundTime: string;
+        refundAmount: number;
+        payAmount: number;
+        amount: number;
         status: number; id: any; 
     };
     // 修改refund函数
     const refund = async (row: any) => {
         refundDialogVisible.value = true
+        refundAmount.value = 0
         refundOrder = row;
     }
 
@@ -188,13 +205,18 @@
             if(!refundAmount.value || refundAmount.value<=0){
                 return feedback.msgError('退款金额不合法')
             }
-            if(refundAmount.value > refundOrder.amount){
-                return feedback.msgError('退款金额不能大于订单金额')
+            if(refundAmount.value > (refundOrder.payAmount || refundOrder.amount)){
+                return feedback.msgError('退款金额不能大于订单实付金额')
             }
-            const res = await refundReq({ orderId: refundOrder.id, amount: refundAmount.value })
+            const res = await refundReq({ orderId: refundOrder.id, payAmount: refundAmount.value })
             if (res) {
                 feedback.msgSuccess('退款成功')
-                refundOrder.status = 4;
+                refundOrder.status = 5;
+                // refundOrder.refundAmount = refundAmount.value;
+                // refundOrder.refundTime = "待处理";
+                setTimeout(()=>{
+                    getLists();
+                },200)
             } else {
                 feedback.msgError('退款失败')
             }