Alex 1 年間 前
コミット
2284a444b2

+ 2 - 1
src/views/recycleOrder/components/first-check-modal.vue

@@ -39,7 +39,8 @@ const formItems = computed(() => {
             type: 'dictSelect',
             label: '驳回原因',
             prop: 'auditReason',
-            props: { code: 'audit_reject_reason', class: 'custom-select' }
+            props: { code: 'audit_reject_reason', class: 'custom-select' },
+            vIf: (data) => data.auditStatus == 2
         }
     ];
 });

+ 8 - 1
src/views/recycleOrder/components/order-detail.vue

@@ -7,13 +7,14 @@
         background: '#f8f8f8',
         padding: '0'
     }" position="center">
-        <userDetail :detail="orderDetail" @refresh="getOrderDetail" />
+        <userDetail :detail="orderDetail" @refresh="getOrderDetail" ref="userDetailRef" />
 
         <template #footer>
             <div style="display: flex; justify-content: space-between">
                 <div style="margin-left: 10px"></div>
                 <el-button @click="handleCancel" type="danger">关闭弹窗</el-button>
                 <div style="display: flex">
+                    <el-button type="primary" @click="handleOtherAuditGood">其余审核良好</el-button>
                     <el-button type="warning" @click="handleFirstCheck" v-if="orderDetail.status == 2">初步审核</el-button>
                     <el-button type="success" @click="handleConfirmReceipt"
                         v-if="orderDetail.status == 6">确认收货</el-button>
@@ -62,6 +63,12 @@ const handleOpen = (data) => {
     });
 };
 
+//其余审核良好
+const userDetailRef = ref();
+function handleOtherAuditGood() {
+    userDetailRef.value?.handleOtherAuditGood();
+}
+
 //获取订单详情
 const orderDetail = ref({});
 const getOrderDetail = () => {

+ 10 - 1
src/views/recycleOrder/detail/index.vue

@@ -7,7 +7,7 @@
             <orderBaseInfo :detail="detail"  />
         </ele-card>
         <ele-card class="order-book-list" header="图书清单" :body-style="{ paddingTop: '15px' }">
-            <orderBookList :detail="detail" @refresh="emit('refresh')" />
+            <orderBookList :detail="detail" @refresh="emit('refresh')" ref="bookListRef" />
         </ele-card>
 
         <ele-card class="order-service" header="订单服务">
@@ -38,4 +38,13 @@ const props = defineProps({
         default: () => ({}),
     },
 });
+
+// 其余审核良好
+const bookListRef = ref(null);
+function handleOtherAuditGood() {
+    bookListRef.value?.handleOtherAuditGood();
+}
+defineExpose({
+    handleOtherAuditGood
+});
 </script>

+ 67 - 23
src/views/recycleOrder/detail/order-book-list.vue

@@ -67,7 +67,7 @@
                     <el-radio :value="3">品相极差</el-radio>
                 </el-radio-group>
 
-                <el-select v-model="row.com" style="width: 180px" placeholder="请选择品相极差的原因"
+                <el-select v-model="row.com" style="width: 180px" placeholder="请选择品相极差的原因" multiple
                     :disabled="!(detail.status == 8 || detail.status == 9) || row.sts !== 3" class="reason-select"
                     @change="(value) => handleSelectReason(value, row)">
                     <el-option v-for="item in auditReason" :key="item.dictValue" :label="item.dictValue"
@@ -84,7 +84,7 @@
 </template>
 
 <script setup>
-import { ref, reactive } from 'vue';
+import { ref, reactive, watch, nextTick } from 'vue';
 import orderModifyDiscount from '@/views/recycle/components/modify-discount.vue';
 import orderBlacklist from '@/views/recycleOrder/detail/order-blacklist.vue';
 import orderRecycleLog from '@/views/recycleOrder/detail/order-recycle-log.vue';
@@ -104,19 +104,26 @@ const dataList = ref([]);
 
 // 处理detailVoList数据
 const processDetailList = (list) => {
+    if (!list) return [];
     const result = [];
     let currentIndex = 0;
     list.forEach(item => {
         let auditInfo = item.auditCommentList
         // 根据num拆分对象
         for (let i = 0; i < item.num; i++) {
-            let audit = auditInfo ? auditInfo[i] : { sts: 0, com: '' }
+            let audit = auditInfo ? auditInfo[i] ? auditInfo[i] : { sts: 0, com: [] } : { sts: 0, com: [] }
+            // 如果com存在且包含逗号,则分割为数组
+            if (audit.com && typeof audit.com === 'string') {
+                audit.com = audit.com.split(',').filter(Boolean);
+            } else if (!Array.isArray(audit.com)) {
+                audit.com = [];
+            }
             result.push({
                 ...item,
                 ...audit,
                 _index: i,
-                _groupIndex: currentIndex, // 用于标识分组
-                _isFirstRow: i === 0 // 标识是否是组内第一行
+                _groupIndex: currentIndex,
+                _isFirstRow: i === 0
             });
         }
         currentIndex++;
@@ -124,14 +131,13 @@ const processDetailList = (list) => {
     return result;
 };
 
+// 修改watch为immediate模式,并使用nextTick
 watch(() => props.detail.detailVoList, (newVal) => {
     if (!newVal) return;
-    dataList.value = processDetailList(newVal);
-    console.log(dataList.value);
-    if (auditReason.value.length == 0) {
-        getAuditReason();
-    }
-}, { deep: true });
+    nextTick(() => {
+        dataList.value = processDetailList(newVal);
+    });
+}, { deep: true, immediate: true });
 
 // 处理单元格合并
 const handleSpanMethod = ({ row, column, rowIndex }) => {
@@ -159,13 +165,40 @@ const handleSpanMethod = ({ row, column, rowIndex }) => {
 };
 //审核书籍
 function handleAudit(row) {
-    request.post('/order/orderInfo/adminCheckOrder', {
-        "orderId": props.detail.orderId,
-        "isbn": row.isbn,
-        "inx": row._index,
-        "sts": row.sts,
-        "com": row.com
-    }).then((res) => {
+    const payload = {
+        orderId: props.detail.orderId,
+        isbn: row.isbn,
+        inx: row._index,
+        sts: row.sts,
+        com: Array.isArray(row.com) ? row.com.join(',') : ''
+    };
+    
+    request.post('/order/orderInfo/adminCheckOrder', payload).then((res) => {
+        if (res.data.code == 200) {
+            ElMessage.success('操作成功');
+        } else {
+            ElMessage.error(res.data.msg)
+        }
+    });
+}
+
+//其余审核良好 列表中sts为0的设置为1,并提交
+function handleOtherAuditGood() {
+    let stsList = [];
+    dataList.value.forEach(item => {
+        if (item.sts == 0) {
+            item.sts = 1;
+            stsList.push({
+                orderId: props.detail.orderId,
+                isbn: item.isbn,
+                sts: 1,
+                com: '',
+                inx: item._index
+            });
+        }
+    });
+    //后端接口批量审核
+    request.post('/order/orderInfo/adminCheckOrder', stsList).then((res) => {
         if (res.data.code == 200) {
             ElMessage.success('操作成功');
         } else {
@@ -177,17 +210,23 @@ function handleAudit(row) {
 //单选框选择变化
 function handleAuditInfo(value, row) {
     if (value == 1) {
-        row.com = '';
-        handleAudit(row)
-    } else if (value == 3 && row.com) {
-        handleAudit(row)
+        row.com = [];
+        nextTick(() => {
+            handleAudit(row);
+        });
+    } else if (value == 3 && row.com.length > 0) {
+        nextTick(() => {
+            handleAudit(row);
+        });
     }
 }
 //选择审核原因
 function handleSelectReason(value, row) {
     if (row.sts == 3) {
         row.com = value;
-        handleAudit(row)
+        nextTick(() => {
+            handleAudit(row);
+        });
     }
 }
 
@@ -247,6 +286,7 @@ const getAuditReason = async () => {
     auditReason.value = res.data.data;
     console.log(res, 'xxxx')
 };
+getAuditReason();
 
 
 //查看当当、淘宝、豆瓣链接
@@ -327,6 +367,10 @@ const handleRefresh = (type) => {
         dataList.value = newList;
     }
 };
+
+defineExpose({
+    handleOtherAuditGood
+});
 </script>
 
 <style lang="scss" scoped>