huangxw 10 miesięcy temu
rodzic
commit
67705f67d9
1 zmienionych plików z 94 dodań i 6 usunięć
  1. 94 6
      src/views/price/models/priceRepordCheck.vue

+ 94 - 6
src/views/price/models/priceRepordCheck.vue

@@ -2,11 +2,13 @@
     <div>
         <div class="pb-16 d-flex j-sb">
             <div>
-                <div><searchTabs v-model="queryParams.auditStatus" @change="handleQuery" :list="tabs" key-label="name" key-value="type" key-count="num"></searchTabs></div>
+                <div>
+                    <searchTabs v-model="queryParams.auditStatus" @change="handleQuery" :list="tabs" key-label="name" key-value="type" key-count="num"></searchTabs>
+                </div>
             </div>
             <div>
-                <el-button type="primary">全部通过</el-button>
-                <el-button type="danger">全部不通过</el-button>
+                <el-button @click="allPass" type="primary">全部通过</el-button>
+                <el-button @click="allNoPass" type="danger">全部不通过</el-button>
             </div>
         </div>
         <vxe-table :loading="loading" border :data="list">
@@ -32,8 +34,10 @@
             <!-- 操作 -->
             <vxe-column title="操作" align="center" fixed="right" width="180">
                 <template #default="{ row }">
-                    <el-button text type="primary">通过</el-button>
-                    <el-button text type="danger">不通过</el-button>
+                    <template v-if="row.auditStatus === '0'">
+                        <el-button @click.stop="passRow(row)" text type="primary">通过</el-button>
+                        <el-button @click.stop="noPassRow(row)" text type="danger">不通过</el-button>
+                    </template>
                 </template>
             </vxe-column>
         </vxe-table>
@@ -43,7 +47,7 @@
 <script setup name="priceRepordCheck" lang="ts">
 import { colNoData } from '@/utils/noData';
 import { listVipPayment } from '@/api/dgtmedicine/vipPayment/index';
-import { originPriceDetail, priceDetailCount } from '@/api/price/report';
+import { approvalPrice, originPriceDetail, priceDetailCount } from '@/api/price/report';
 import { searchTabs } from '@/views/models';
 const { query }: any = useRoute()
 const router = useRouter();
@@ -89,6 +93,90 @@ const getTabs = async () => {
     if (!res || res.code !== 200) return;
     tabs.value = res.data
 };
+const allPass = async () => {
+    const confirm = await proxy?.$modal.confirm('是否确认将本次上报品种的产地价格审核为通过?');
+    if (confirm === 'confirm') {
+        const params = {
+            priceId: query?.id,
+            auditStatus: '1',
+        }
+        auditSubmit(params);
+    }
+};
+const allNoPass = async () => {
+    ElMessageBox.prompt('<div>是否确认将本次上报的全部品种产地价格审核为不通过!</div><div>不通理由:</div>', '审核不通过', {
+        confirmButtonText: '确认不通过',
+        cancelButtonText: '取消',
+        dangerouslyUseHTMLString: true,
+        inputValidator: (value: any) => {
+            if (!value) {
+                return '请填写不通过理由';
+            }
+        },
+        inputPlaceholder: '请填写不通过理由...',
+        inputErrorMessage: '请填写不通过理由...',
+    })
+        .then(({ value }) => {
+            console.log('确认', value);
+            const params = {
+                priceId: query?.id,
+                auditStatus: '2',
+                msg: value
+        }
+        auditSubmit(params);
+        })
+        .catch(() => {
+            console.log('取消');
+
+        })
+};
+const passRow = async (row: any) => {
+    const confirm = await proxy?.$modal.confirm(`是否确认将本次上报品种${row?.varietyName}的产地价格审核为通过?`);
+    if (confirm === 'confirm') {
+        console.log('confirm');
+        const params = {
+            targetIds: [row.id],
+            auditStatus: '1',
+        }
+        auditSubmit(params);
+    }
+};
+const noPassRow = async (row: any) => {
+    ElMessageBox.prompt(`<div>是否确认将品种${row?.varietyName}的产地价格审核为不通过!</div><div>不通理由:</div>`, '审核不通过', {
+        confirmButtonText: '确认不通过',
+        cancelButtonText: '取消',
+        dangerouslyUseHTMLString: true,
+        inputValidator: (value: any) => {
+            if (!value) {
+                return '请填写不通过理由';
+            }
+        },
+        inputPlaceholder: '请填写不通过理由...',
+        inputErrorMessage: '请填写不通过理由...',
+    })
+        .then(({ value }) => {
+            const params = {
+                targetIds: [row.id],
+                auditStatus: '2',
+                msg: value
+            }
+            auditSubmit(params);
+        })
+        .catch(() => {
+            console.log('取消');
+        })
+};
+// 审核提交
+const auditSubmit = async (params) => {
+    proxy?.$modal.loading('审核中...');
+    const res = await approvalPrice(params).finally(() => {
+        proxy?.$modal.closeLoading();
+    });
+    if (!res || res.code !== 200) return;
+    proxy?.$modal.msgSuccess('审核成功');
+    getList();
+};
+
 onMounted(() => {
     getTabs();
     getList();