From 6bc3939a1b895d98e092327abfdf56a37a8b94c5 Mon Sep 17 00:00:00 2001
From: 18650502300 <18650502300@163.com>
Date: Tue, 26 Dec 2023 17:19:30 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=A2=E5=8D=95=E5=AE=A1?=
 =?UTF-8?q?=E6=A0=B8=E6=93=8D=E4=BD=9C:=E5=A2=9E=E5=8A=A0=E5=88=B0?=
 =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E3=80=81=E5=AE=A1=E6=A0=B8=E5=A4=B1=E8=B4=A5?=
 =?UTF-8?q?=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/api/order.js          |  12 ++++
 src/views/order/index.vue | 113 +++++++++++++++++++++++++++++---------
 2 files changed, 99 insertions(+), 26 deletions(-)

diff --git a/src/api/order.js b/src/api/order.js
index e1bd724..aa55a33 100644
--- a/src/api/order.js
+++ b/src/api/order.js
@@ -122,6 +122,18 @@ export function orderRefuseApi(params) {
   });
 }
 
+/**
+ * 订单 审核失败
+ * @param prams
+ */
+export function orderAuditApi(audit,params) {
+  return request({
+    url: `/admin/store/order/audit/${audit}`,
+    method: 'get',
+    params,
+  });
+}
+
 /**
  * 订单 立即退款
  * @param prams
diff --git a/src/views/order/index.vue b/src/views/order/index.vue
index 3ceb9c2..6fe6b7f 100644
--- a/src/views/order/index.vue
+++ b/src/views/order/index.vue
@@ -19,6 +19,9 @@
                 <el-radio-button label="unPaid"
                   >未支付 {{ '(' + orderChartType.unPaid ? orderChartType.unPaid : 0 + ')' }}</el-radio-button
                 >
+                <el-radio-button label="audit"
+                  >待审核 {{ '(' + orderChartType.audit ? orderChartType.audit : 0 + ')' }}</el-radio-button
+                >
                 <el-radio-button label="notShipped"
                   >未发货 {{ '(' + orderChartType.notShipped ? orderChartType.notShipped : 0 + ')' }}</el-radio-button
                 >
@@ -41,6 +44,9 @@
                 <el-radio-button label="refunded"
                   >已退款 {{ '(' + orderChartType.refunded ? orderChartType.refunded : 0 + ')' }}</el-radio-button
                 >
+                <el-radio-button label="auditReject"
+                  >已驳回 {{ '(' + orderChartType.auditReject ? orderChartType.auditReject : 0 + ')' }}</el-radio-button
+                >
                 <el-radio-button label="deleted"
                   >已删除 {{ '(' + orderChartType.deleted ? orderChartType.deleted : 0 + ')' }}</el-radio-button
                 >
@@ -203,6 +209,14 @@
               class="mr10"
               >编辑</el-button
             >
+            <el-button
+              v-if="scope.row.orderType == '[分期订单]' && scope.row.statusStr.key === 'audit' && checkPermi(['admin:order:audit'])"
+              type="text"
+              size="small"
+              @click="onAudit(scope.row)"
+              class="mr10"
+              >审核</el-button
+            >
             <el-button
               v-if="
                 scope.row.statusStr.key === 'notShipped' &&
@@ -253,15 +267,9 @@
                 <el-dropdown-item
                   @click.native="onInstallmentBills(scope.row.id)"
                   v-if="checkPermi(['admin:order:info'])"
-                  v-show="scope.row.orderType == '[分期订单]'"
+                  v-show="scope.row.orderType == '[分期订单]' && scope.row.statusStr.key != 'audit' && scope.row.statusStr.key != 'auditReject'"
                 >查看账单</el-dropdown-item
                 >
-                <el-dropdown-item
-                  @click.native="onAudit(scope.row.id)"
-                  v-if="checkPermi(['admin:order:info'])"
-                  v-show="scope.row.orderType == '[分期订单]'"
-                >审核</el-dropdown-item
-                >
                 <el-dropdown-item
                   @click.native="onOrderLog(scope.row.orderId)"
                   v-if="checkPermi(['admin:order:status:list'])"
@@ -379,6 +387,25 @@
     <!--详情-->
     <details-from ref="orderDetail" :orderId="orderId" />
 
+
+    <!--审核-->
+    <el-dialog
+      title="审核"
+      v-if="AuditVisible"
+      :visible.sync="AuditVisible"
+      width="500px"
+      :before-close="AudithandleClose"
+    >
+      <zb-parser
+        :form-id="145"
+        :is-create="1"
+        :edit-data="AuditData"
+        @submit="AudithandlerSubmit"
+        @resetForm="resetFormAudithand"
+      />
+    </el-dialog>
+
+
     <!-- 发送货 -->
     <order-send
       ref="send"
@@ -424,20 +451,20 @@
 </template>
 
 <script>
-import {
-  orderListDataApi,
-  orderStatusNumApi,
-  writeUpdateApi,
-  orderListApi,
-  updatePriceApi,
-  orderLogApi,
-  orderMarkApi,
-  orderDeleteApi,
-  orderRefuseApi,
-  orderRefundApi,
-  orderPrint,
-  orderDetailApi,
-} from '@/api/order';
+  import {
+    orderListDataApi,
+    orderStatusNumApi,
+    writeUpdateApi,
+    orderListApi,
+    updatePriceApi,
+    orderLogApi,
+    orderMarkApi,
+    orderDeleteApi,
+    orderRefuseApi,
+    orderRefundApi,
+    orderPrint,
+    orderDetailApi, orderAuditApi
+  } from '@/api/order'
 import zbParser from '@/components/FormGenerator/components/parser/ZBParser';
 import detailsFrom from './orderDetail';
 import orderSend from './orderSend';
@@ -479,6 +506,8 @@ export default {
       ],
       RefuseVisible: false,
       RefuseData: {},
+      AuditVisible: false,//审核弹窗
+      AuditData: {},
       orderId: '',
       refundVisible: false,
       refundData: {},
@@ -576,6 +605,9 @@ export default {
     resetFormRefusehand() {
       this.RefuseVisible = false;
     },
+    resetFormAudithand() {
+      this.AuditVisible = false;
+    },
     resetForm(formValue) {
       this.dialogVisible = false;
     },
@@ -598,6 +630,10 @@ export default {
     RefusehandleClose() {
       this.RefuseVisible = false;
     },
+    //关闭 审核
+    AudithandleClose() {
+      this.AuditVisible = false;
+    },
     onOrderRefuse(row) {
       this.orderids = row.orderId;
       this.RefuseData = {
@@ -613,6 +649,25 @@ export default {
         this.getList();
       });
     },
+    //审核提交
+    AudithandlerSubmit(formValue) {
+      let data;
+      if(formValue.audit == "reject" && (formValue.reason == undefined || formValue.reason == "")){
+        this.$message.error("驳回原因不能为空");
+        return
+      }
+      if(formValue.audit == "pass"){
+        data = { orderNo: this.orderids, reason: "" ,audit:formValue.audit};
+      }else{
+        data = { orderNo: this.orderids, reason: formValue.reason ,audit:formValue.audit};
+      }
+      console.log("formValue-------"+JSON.stringify(data));
+      orderAuditApi(formValue.audit,data).then((res) => {
+        this.$message.success('操作成功');
+        this.AuditVisible = false;
+        this.getList();
+      });
+    },
     // 立即退款
     refundhandleClose() {
       this.refundVisible = false;
@@ -707,11 +762,14 @@ export default {
       this.getInstallmentList(id);
     },
     // 审核
-    onAudit(id) {
-      this.tableFromLog.limit = 10;
-      this.orderId = id;
-      this.dialogVisibleInstallment = true;
-      // this.getInstallmentList(id);
+    onAudit(row) {
+      this.orderids = row.orderId;
+      this.AuditData = {
+        orderId: row.orderId,
+        audit: "pass",
+        reason: ""
+      };
+      this.AuditVisible = true;
     },
     // 订单记录
     onOrderLog(id) {
@@ -1015,4 +1073,7 @@ export default {
 ::v-deep .el-checkbox__input.is-checked + .el-checkbox__label {
   color: #606266;
 }
+.el-form-item__content{
+  float: right;
+}
 </style>