|
|
@@ -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>
|