|
|
@@ -108,52 +108,6 @@
|
|
|
</div>
|
|
|
<el-empty v-if="orderList.length === 0" description="暂无订单" />
|
|
|
</div>
|
|
|
-
|
|
|
- <el-dialog v-model="evaluateDialogVisible" :title="evaluateDialogTitle" width="600px">
|
|
|
- <div class="evaluate-product">
|
|
|
- <div class="product-image">
|
|
|
- <el-image :src="currentProduct?.image" fit="contain">
|
|
|
- <template #error
|
|
|
- ><div class="image-placeholder">
|
|
|
- <el-icon :size="30" color="#ccc"><Picture /></el-icon></div
|
|
|
- ></template>
|
|
|
- </el-image>
|
|
|
- </div>
|
|
|
- <div class="product-info">
|
|
|
- <div class="product-name">{{ currentProduct?.name }}</div>
|
|
|
- <div class="product-spec">{{ currentProduct?.spec1 }} {{ currentProduct?.spec2 }}</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <el-form ref="evaluateFormRef" :model="evaluateForm" :rules="evaluateRules" label-width="80px">
|
|
|
- <el-form-item label="商品评分" prop="deliverGoods">
|
|
|
- <el-rate v-model="evaluateForm.deliverGoods" :colors="['#e60012', '#e60012', '#e60012']" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="评价内容" prop="content">
|
|
|
- <el-input v-model="evaluateForm.content" type="textarea" :rows="4" placeholder="请输入评价内容" maxlength="200" show-word-limit />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="上传图片">
|
|
|
- <el-upload
|
|
|
- class="upload-box"
|
|
|
- :action="action"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="handleEvaluateUrlSuccess"
|
|
|
- :before-upload="beforeAvatarUpload"
|
|
|
- >
|
|
|
- <div v-if="evaluateForm.evaluateUrl" class="upload-preview">
|
|
|
- <el-image :src="evaluateForm.evaluateUrl" fit="cover" />
|
|
|
- </div>
|
|
|
- <div v-else class="upload-placeholder">
|
|
|
- <el-icon :size="24"><Plus /></el-icon>
|
|
|
- <span>上传</span>
|
|
|
- </div>
|
|
|
- </el-upload>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <template #footer>
|
|
|
- <el-button @click="evaluateDialogVisible = false">取消</el-button>
|
|
|
- <el-button type="danger" @click="handleSubmitEvaluate">提交评价</el-button>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -163,21 +117,14 @@ import { useRouter } from 'vue-router';
|
|
|
import { Search, Edit, ChatDotRound, Document, ArrowRight, Picture, Plus } from '@element-plus/icons-vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import { PageTitle, StatusTabs } from '@/components';
|
|
|
-import { getOrderList, getOrderProducts, getEvalutionList, addOrderEvaluation, getOrderEvaluation } from '@/api/pc/enterprise/order';
|
|
|
+import { getOrderList, getOrderProducts, getEvalutionList } from '@/api/pc/enterprise/order';
|
|
|
import type { OrderMain, OrderStatusStats } from '@/api/pc/enterprise/orderTypes';
|
|
|
import { getDeptTree } from '@/api/pc/organization';
|
|
|
import { DeptInfo } from '@/api/pc/organization/types';
|
|
|
-const action = import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const { order_status, pay_method } = toRefs<any>(proxy?.useDict('order_status', 'pay_method'));
|
|
|
-import type { UploadProps } from 'element-plus';
|
|
|
const router = useRouter();
|
|
|
const activeMainTab = ref('0');
|
|
|
-const evaluateDialogVisible = ref(false);
|
|
|
-const evaluateDialogTitle = ref('商品评价');
|
|
|
-const evaluateFormRef = ref();
|
|
|
-const currentOrder = ref<any>(null);
|
|
|
-const currentProduct = ref<any>(null);
|
|
|
|
|
|
const deptList = ref([]);
|
|
|
|
|
|
@@ -188,11 +135,6 @@ const mainTabs = [
|
|
|
];
|
|
|
|
|
|
const queryParams = reactive({ keyword: '', dateRange: null, department: '', status: '', payType: '', evaluationStatus: '' });
|
|
|
-const evaluateForm = reactive({ deliverGoods: 5, content: '', evaluationType: null, evaluateUrl: '' });
|
|
|
-const evaluateRules = {
|
|
|
- deliverGoods: [{ required: true, message: '请选择评分', trigger: 'change' }],
|
|
|
- content: [{ required: true, message: '请输入评价内容', trigger: 'blur' }]
|
|
|
-};
|
|
|
|
|
|
const pendingOrders = ref([]);
|
|
|
const followUpOrders = ref([]);
|
|
|
@@ -232,12 +174,15 @@ const loadOrderProducts = async (orderId: number) => {
|
|
|
if (res.code === 200 && res.rows) {
|
|
|
return res.rows.map((product: any) => ({
|
|
|
id: product.id,
|
|
|
+ productId: product.productId,
|
|
|
name: product.productName || '',
|
|
|
+ productName: product.productName || '',
|
|
|
spec1: product.productUnit || '',
|
|
|
spec2: product.productNo || '',
|
|
|
price: product.orderPrice || 0,
|
|
|
quantity: product.orderQuantity || 0,
|
|
|
- image: product.productImage || ''
|
|
|
+ image: product.productImage || '',
|
|
|
+ productImg: product.productImage || ''
|
|
|
}));
|
|
|
}
|
|
|
return [];
|
|
|
@@ -305,27 +250,6 @@ const getorders = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-//上传成功
|
|
|
-const handleEvaluateUrlSuccess = (res: any) => {
|
|
|
- if (res.code == 200) {
|
|
|
- evaluateForm.evaluateUrl = res.data.url;
|
|
|
- } else {
|
|
|
- ElMessage({
|
|
|
- message: res.msg,
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- }
|
|
|
- console.log(res);
|
|
|
-};
|
|
|
-
|
|
|
-const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => {
|
|
|
- if (rawFile.size / 1024 / 1024 > 2) {
|
|
|
- ElMessage.error('不能大于2MB!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
-};
|
|
|
-
|
|
|
// 监听标签页切换,重新获取数据
|
|
|
watch(activeMainTab, () => {
|
|
|
getorders();
|
|
|
@@ -354,90 +278,28 @@ const loadDeptTree = async () => {
|
|
|
const handleViewDetail = (order: any) => {
|
|
|
router.push(`/order/orderManage/detail/${order.orderId}`);
|
|
|
};
|
|
|
-const handleEvaluate = (order: any) => {
|
|
|
- currentOrder.value = order;
|
|
|
- currentProduct.value = order.products[0];
|
|
|
- evaluateDialogTitle.value = '商品评价';
|
|
|
- evaluateForm.deliverGoods = undefined;
|
|
|
- evaluateForm.content = '';
|
|
|
- evaluateForm.evaluationType = 1;
|
|
|
- evaluateDialogVisible.value = true;
|
|
|
+const navigateToEvaluation = (order: any, type: number) => {
|
|
|
+ router.push({
|
|
|
+ path: '/order/orderEvaluation/evaluation',
|
|
|
+ query: {
|
|
|
+ orderId: order.orderId,
|
|
|
+ orderNo: order.orderNo,
|
|
|
+ orderTime: order.orderTime,
|
|
|
+ type: type
|
|
|
+ },
|
|
|
+ state: {
|
|
|
+ products: JSON.stringify(order.products)
|
|
|
+ }
|
|
|
+ } as any);
|
|
|
};
|
|
|
-const handleFollowUpEvaluate = async (order: any) => {
|
|
|
- const res = await getOrderEvaluation(order.orderId);
|
|
|
- if (res.code === 200 && res.data) {
|
|
|
- currentOrder.value = order;
|
|
|
- currentProduct.value = order.products[0];
|
|
|
- evaluateDialogTitle.value = '追加评价';
|
|
|
- evaluateForm.deliverGoods = res.data.deliverGoods;
|
|
|
- evaluateForm.content = res.data.content;
|
|
|
- evaluateForm.evaluationType = 2;
|
|
|
- evaluateDialogVisible.value = true;
|
|
|
- } else {
|
|
|
- ElMessage.error('获取评价失败');
|
|
|
- }
|
|
|
+const handleEvaluate = (order: any) => {
|
|
|
+ navigateToEvaluation(order, 1);
|
|
|
};
|
|
|
-const handleViewEvaluation = async (order: any) => {
|
|
|
- const res = await getOrderEvaluation(order.orderId);
|
|
|
- if (res.code === 200 && res.data) {
|
|
|
- currentOrder.value = order;
|
|
|
- currentProduct.value = order.products[0];
|
|
|
- evaluateDialogTitle.value = '查看评价';
|
|
|
- evaluateForm.deliverGoods = res.data.deliverGoods;
|
|
|
- evaluateForm.content = res.data.content;
|
|
|
- evaluateDialogVisible.value = true;
|
|
|
- } else {
|
|
|
- ElMessage.error('获取评价失败');
|
|
|
- }
|
|
|
+const handleFollowUpEvaluate = (order: any) => {
|
|
|
+ navigateToEvaluation(order, 2);
|
|
|
};
|
|
|
-const handleSubmitEvaluate = async () => {
|
|
|
- const valid = await evaluateFormRef.value?.validate();
|
|
|
- if (!valid) return;
|
|
|
-
|
|
|
- try {
|
|
|
- const submitData = {
|
|
|
- orderId: currentOrder.value?.orderId,
|
|
|
- productId: currentProduct.value?.id,
|
|
|
- evaluationType: evaluateForm.evaluationType, // 1-评价 2-追评
|
|
|
- deliverGoods: evaluateForm.deliverGoods,
|
|
|
- content: evaluateForm.content,
|
|
|
- // 图片上传暂时留空,后续可以添加
|
|
|
- images: []
|
|
|
- };
|
|
|
-
|
|
|
- const res = await addOrderEvaluation(submitData);
|
|
|
- if (res.code === 200) {
|
|
|
- ElMessage.success('评价提交成功');
|
|
|
- evaluateDialogVisible.value = false;
|
|
|
-
|
|
|
- // 重新获取订单列表
|
|
|
- await getorders();
|
|
|
-
|
|
|
- // 如果需要手动更新本地数据(可选)
|
|
|
- if (activeMainTab.value === '0') {
|
|
|
- const index = pendingOrders.value.findIndex((o) => o.orderId === currentOrder.value.orderId);
|
|
|
- if (index > -1) {
|
|
|
- const order = pendingOrders.value.splice(index, 1)[0];
|
|
|
- if (evaluateForm.evaluationType === '1') {
|
|
|
- followUpOrders.value.push(order);
|
|
|
- } else {
|
|
|
- evaluatedOrders.value.push(order);
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (activeMainTab.value === '1') {
|
|
|
- const index = followUpOrders.value.findIndex((o) => o.orderId === currentOrder.value.orderId);
|
|
|
- if (index > -1) {
|
|
|
- const order = followUpOrders.value.splice(index, 1)[0];
|
|
|
- evaluatedOrders.value.push(order);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- ElMessage.error(res.msg || '评价提交失败');
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error('评价提交失败:', error);
|
|
|
- ElMessage.error('评价提交失败');
|
|
|
- }
|
|
|
+const handleViewEvaluation = (order: any) => {
|
|
|
+ navigateToEvaluation(order, 3);
|
|
|
};
|
|
|
|
|
|
// 页面加载时获取订单列表
|
|
|
@@ -616,80 +478,4 @@ onMounted(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-.upload-box {
|
|
|
- :deep(.el-upload) {
|
|
|
- width: 100px;
|
|
|
- height: 100px;
|
|
|
- border: 1px dashed #d9d9d9;
|
|
|
- border-radius: 6px;
|
|
|
- cursor: pointer;
|
|
|
- overflow: hidden;
|
|
|
-
|
|
|
- &:hover {
|
|
|
- border-color: #e60012;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .upload-placeholder {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- color: #999;
|
|
|
- font-size: 12px;
|
|
|
- gap: 5px;
|
|
|
- }
|
|
|
-
|
|
|
- .upload-preview {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
-
|
|
|
- .el-image {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.evaluate-product {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- gap: 15px;
|
|
|
- padding: 15px;
|
|
|
- background: #f9f9f9;
|
|
|
- border-radius: 4px;
|
|
|
- margin-bottom: 20px;
|
|
|
- .product-image {
|
|
|
- width: 60px;
|
|
|
- height: 60px;
|
|
|
- background: #fff;
|
|
|
- border-radius: 4px;
|
|
|
- overflow: hidden;
|
|
|
- flex-shrink: 0;
|
|
|
- .el-image {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
- .image-placeholder {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- }
|
|
|
- }
|
|
|
- .product-info {
|
|
|
- .product-name {
|
|
|
- font-size: 14px;
|
|
|
- color: #333;
|
|
|
- margin-bottom: 5px;
|
|
|
- }
|
|
|
- .product-spec {
|
|
|
- font-size: 12px;
|
|
|
- color: #999;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
</style>
|