|
|
@@ -0,0 +1,434 @@
|
|
|
+<template>
|
|
|
+ <ele-page flex-table>
|
|
|
+ <!-- 搜索表单 -->
|
|
|
+ <order-search @search="reload" />
|
|
|
+ <ele-card :body-style="{ paddingTop: '8px' }" flex-table>
|
|
|
+ <!-- 表格 -->
|
|
|
+ <ele-pro-table
|
|
|
+ ref="tableRef"
|
|
|
+ row-key="postId"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="datasource"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ v-model:selections="selections"
|
|
|
+ highlight-current-row
|
|
|
+ :export-config="{ fileName: pageConfig.fileName }"
|
|
|
+ :cache-key="pageConfig.cacheKey"
|
|
|
+ >
|
|
|
+ <template #toolbar>
|
|
|
+ <slot name="toolbar"></slot>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #status="{ row }">
|
|
|
+ <dict-data
|
|
|
+ code="sys_normal_disable"
|
|
|
+ type="tag"
|
|
|
+ :model-value="row.status"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template #orderNumber="{ row }">
|
|
|
+ <order-number :row="row"></order-number>
|
|
|
+ </template>
|
|
|
+ <template #customer="{ row }">
|
|
|
+ <order-customer :row="row"></order-customer>
|
|
|
+ </template>
|
|
|
+ <template #amount="{ row }">
|
|
|
+ <order-amount :row="row"></order-amount>
|
|
|
+ </template>
|
|
|
+ <template #time="{ row }">
|
|
|
+ <order-time :row="row"></order-time>
|
|
|
+ </template>
|
|
|
+ <template #remarks="{ row }">
|
|
|
+ <el-popover trigger="hover" width="240px">
|
|
|
+ <template #reference>
|
|
|
+ <el-button
|
|
|
+ :icon="Flag"
|
|
|
+ link
|
|
|
+ style="font-size: 20px"
|
|
|
+ @click="handleRemarks(row)"
|
|
|
+ >
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <orderTimeline
|
|
|
+ :records="activities"
|
|
|
+ title="备注历史记录"
|
|
|
+ ></orderTimeline>
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #action="{ row }">
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ link
|
|
|
+ v-permission="usePermission('detail')"
|
|
|
+ @click="toOrderDetail(row)"
|
|
|
+ >
|
|
|
+ [订单详情]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ link
|
|
|
+ v-permission="usePermission('log')"
|
|
|
+ @click="openOrderLog(row)"
|
|
|
+ >
|
|
|
+ [订单日志]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ link
|
|
|
+ v-if="row.status == 2"
|
|
|
+ v-permission="usePermission('audit')"
|
|
|
+ @click="cancelOrder(row)"
|
|
|
+ >
|
|
|
+ [初步审核]
|
|
|
+ </el-button>
|
|
|
+ <!-- 3 已初审-带上门取件 5已揽件-待签收 6已签收-待确认到货 -->
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ link
|
|
|
+ v-if="[3, 5, 6].includes(row.status)"
|
|
|
+ v-permission="usePermission('cancel')"
|
|
|
+ @click="cancelOrder(row)"
|
|
|
+ >
|
|
|
+ [取消订单]
|
|
|
+ </el-button>
|
|
|
+ <!-- 3 已初审-带上门取件 5已揽件-待签收 6已签收-待确认到货 8待回收审核 9审核未提交 10待付款 -->
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ v-if="[3, 5, 6, 8, 9, 10].includes(row.status)"
|
|
|
+ v-permission="usePermission('fallback')"
|
|
|
+ @click="fallbackOrder(row)"
|
|
|
+ >
|
|
|
+ [回退状态]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ link
|
|
|
+ v-if="row.status == 3"
|
|
|
+ v-permission="usePermission('materialPickup')"
|
|
|
+ @click="materialPickup(row)"
|
|
|
+ >
|
|
|
+ [物流揽件]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ link
|
|
|
+ v-if="row.status == 5"
|
|
|
+ v-permission="usePermission('receive')"
|
|
|
+ @click="materialPickup(row)"
|
|
|
+ >
|
|
|
+ [物流签收]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ link
|
|
|
+ v-if="row.status == 6"
|
|
|
+ v-permission="usePermission('confirmReceipt')"
|
|
|
+ @click="materialPickup(row)"
|
|
|
+ >
|
|
|
+ [确认收货]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ link
|
|
|
+ v-if="[8, 9].includes(row.status)"
|
|
|
+ v-permission="usePermission('arrivalAudit')"
|
|
|
+ @click="handleArrivalAudit(row)"
|
|
|
+ >
|
|
|
+ [到货审核]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ link
|
|
|
+ v-if="[8, 9, 10, 11].includes(row.status)"
|
|
|
+ v-permission="usePermission('auditScreenshot')"
|
|
|
+ @click="handleAuditScreenshot(row)"
|
|
|
+ >
|
|
|
+ [审核截图]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ link
|
|
|
+ v-if="row.status == 10"
|
|
|
+ v-permission="usePermission('payment')"
|
|
|
+ @click="handleBatchPayment(row)"
|
|
|
+ >
|
|
|
+ [支付书款]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ link
|
|
|
+ v-if="row.status == 11"
|
|
|
+ v-permission="usePermission('afterSalesPayment')"
|
|
|
+ @click="handleAfterSalesPayment(row)"
|
|
|
+ >
|
|
|
+ [售后补款]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ link
|
|
|
+ v-permission="usePermission('userTag')"
|
|
|
+ @click="openEditUserTag(row)"
|
|
|
+ >
|
|
|
+ [用户标签]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ link
|
|
|
+ v-if="row.status == 2"
|
|
|
+ v-permission="usePermission('modifyAddress')"
|
|
|
+ @click="cancelOrder(row)"
|
|
|
+ >
|
|
|
+ [修改地址]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ link
|
|
|
+ v-if="[8, 9, 10, 11].includes(row.status)"
|
|
|
+ v-permission="usePermission('sendSMS')"
|
|
|
+ @click="handleSendSMS(row)"
|
|
|
+ >
|
|
|
+ [推送短信]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="info"
|
|
|
+ link
|
|
|
+ v-if="[8, 9, 10].includes(row.status)"
|
|
|
+ v-permission="usePermission('smsLog')"
|
|
|
+ @click="handleSmsLog(row)"
|
|
|
+ >
|
|
|
+ [短信记录]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ color="#7728f5"
|
|
|
+ link
|
|
|
+ plain
|
|
|
+ v-if="row.status == 11"
|
|
|
+ v-permission="usePermission('applyForOrderClaim')"
|
|
|
+ @click="applyForOrderClaim(row)"
|
|
|
+ >
|
|
|
+ [申请订单理赔]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ color="#7728f5"
|
|
|
+ link
|
|
|
+ plain
|
|
|
+ v-if="[7].includes(row.status)"
|
|
|
+ v-permission="usePermission('applyForOrderRestore')"
|
|
|
+ @click="handleApplyForOrderRestore(row)"
|
|
|
+ >
|
|
|
+ [申请恢复订单]
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ link
|
|
|
+ v-if="[5, 6].includes(row.status)"
|
|
|
+ v-permission="usePermission('interception')"
|
|
|
+ @click="applyForInterception(row)"
|
|
|
+ >
|
|
|
+ [申请拦截退回]
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </ele-card>
|
|
|
+
|
|
|
+ <slot></slot>
|
|
|
+ <orderRemarks ref="remarksRef" />
|
|
|
+ </ele-page>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+ import { ref, getCurrentInstance } from 'vue';
|
|
|
+ import { ElMessageBox } from 'element-plus/es';
|
|
|
+ import { EleMessage } from 'ele-admin-plus/es';
|
|
|
+ import { DownloadOutlined } from '@/components/icons';
|
|
|
+ import { Flag, ChatDotSquare } from '@element-plus/icons-vue';
|
|
|
+ import OrderSearch from '../components/order-search.vue';
|
|
|
+ import OrderNumber from '@/views/recycleOrder/components/order-number.vue';
|
|
|
+ import OrderCustomer from '@/views/recycleOrder/components/order-customer.vue';
|
|
|
+ import OrderAmount from '@/views/recycleOrder/components/order-amount.vue';
|
|
|
+ import OrderTime from '@/views/recycleOrder/components/order-time.vue';
|
|
|
+ import { useDictData } from '@/utils/use-dict-data';
|
|
|
+ import { download, toFormData, checkDownloadRes } from '@/utils/common';
|
|
|
+ import orderRemarks from '@/views/recycleOrder/components/order-remarks.vue';
|
|
|
+ import orderTimeline from '@/views/recycleOrder/components/order-timeline.vue';
|
|
|
+
|
|
|
+ let props = defineProps({
|
|
|
+ pageConfig: {
|
|
|
+ type: Object,
|
|
|
+ default: () => ({
|
|
|
+ cacheKey: 'recycleOrderTable',
|
|
|
+ fileName: '回收订单查询'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ pageUrl: { type: String, default: '/system/post/list' },
|
|
|
+ exportUrl: { type: String, default: '/system/post/export' },
|
|
|
+ permissionKey: { type: String, default: 'search' }
|
|
|
+ });
|
|
|
+ const usePermission = computed(() => (opts) => {
|
|
|
+ return `recycleOrder:${props.permissionKey}:${opts}`;
|
|
|
+ });
|
|
|
+
|
|
|
+ let { proxy } = getCurrentInstance();
|
|
|
+ /** 字典数据 */
|
|
|
+ const [statusDicts] = useDictData(['sys_normal_disable']);
|
|
|
+
|
|
|
+ /** 表格实例 */
|
|
|
+ const tableRef = ref(null);
|
|
|
+
|
|
|
+ /** 表格列配置 */
|
|
|
+ const columns = ref([
|
|
|
+ {
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ width: 50,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ { label: '单号', prop: 'orderNumber', slot: 'orderNumber', minWidth: 180 },
|
|
|
+ { label: '客户', prop: 'customer', slot: 'customer', minWidth: 360 },
|
|
|
+ { label: '金额', prop: 'amount', slot: 'amount', minWidth: 160 },
|
|
|
+ {
|
|
|
+ label: '状态',
|
|
|
+ prop: 'status',
|
|
|
+ slot: 'status',
|
|
|
+ formatter: (row) =>
|
|
|
+ statusDicts.value.find((d) => d.dictValue == row.status)?.dictLabel
|
|
|
+ },
|
|
|
+ { label: '时间', prop: 'time', slot: 'time', minWidth: 200 },
|
|
|
+ { label: '备注', prop: 'remarks', slot: 'remarks' },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 180,
|
|
|
+ align: 'center',
|
|
|
+ slot: 'action',
|
|
|
+ hideInPrint: true,
|
|
|
+ hideInExport: true
|
|
|
+ }
|
|
|
+ ]);
|
|
|
+
|
|
|
+ /** 表格选中数据 */
|
|
|
+ const selections = ref([]);
|
|
|
+
|
|
|
+ /** 当前编辑数据 */
|
|
|
+ const current = ref(null);
|
|
|
+
|
|
|
+ /** 是否显示编辑弹窗 */
|
|
|
+ const showEdit = ref(false);
|
|
|
+
|
|
|
+ async function queryPage(params) {
|
|
|
+ const res = await proxy.$http.get(props.pageUrl, { params });
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ return res.data;
|
|
|
+ }
|
|
|
+ return Promise.reject(new Error(res.data.msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 表格数据源 */
|
|
|
+ const datasource = ({ pages, where, orders }) => {
|
|
|
+ return queryPage({ ...where, ...orders, ...pages });
|
|
|
+ };
|
|
|
+
|
|
|
+ /** 搜索 */
|
|
|
+ const reload = (where) => {
|
|
|
+ tableRef.value?.reload?.({ page: 1, where });
|
|
|
+ };
|
|
|
+
|
|
|
+ /** 批量操作 */
|
|
|
+ const operatBatch = ({ row, url, title }) => {
|
|
|
+ const rows = row == null ? selections.value : [row];
|
|
|
+ if (!rows.length) {
|
|
|
+ EleMessage.error('请至少选择一条数据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ title = title || '是否确认当前操作?';
|
|
|
+ ElMessageBox.confirm(title, '提示', {
|
|
|
+ type: 'warning',
|
|
|
+ draggable: true
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ const loading = EleMessage.loading({
|
|
|
+ message: '请求中..',
|
|
|
+ plain: true
|
|
|
+ });
|
|
|
+
|
|
|
+ proxy.$http
|
|
|
+ .delete(url)
|
|
|
+ .then(() => {
|
|
|
+ loading.close();
|
|
|
+ EleMessage.success('操作成功');
|
|
|
+ reload();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ EleMessage.error(e.message);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ };
|
|
|
+
|
|
|
+ /// 导出数据
|
|
|
+ async function exportPage(params, name) {
|
|
|
+ const res = await proxy.$http({
|
|
|
+ url: props.exportUrl,
|
|
|
+ method: 'POST',
|
|
|
+ data: toFormData(params),
|
|
|
+ responseType: 'blob'
|
|
|
+ });
|
|
|
+ await checkDownloadRes(res);
|
|
|
+ download(
|
|
|
+ res.data,
|
|
|
+ name ? `${name}_${Date.now()}.xlsx` : `post_${Date.now()}.xlsx`
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 导出数据 */
|
|
|
+ const exportData = (name) => {
|
|
|
+ const loading = EleMessage.loading({
|
|
|
+ message: '请求中..',
|
|
|
+ plain: true
|
|
|
+ });
|
|
|
+ tableRef.value?.fetch?.(({ where, orders }) => {
|
|
|
+ exportPage({ ...where, ...orders }, name)
|
|
|
+ .then(() => {
|
|
|
+ loading.close();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ EleMessage.error(e.message);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ //修改备注
|
|
|
+ const remarksRef = ref(null);
|
|
|
+ function handleRemarks(row) {
|
|
|
+ remarksRef.value?.handleOpen(row);
|
|
|
+ }
|
|
|
+ const activities = [
|
|
|
+ {
|
|
|
+ content: 'Event start',
|
|
|
+ timestamp: '2018-04-15',
|
|
|
+ color: '#0bbd87',
|
|
|
+ icon: ChatDotSquare
|
|
|
+ },
|
|
|
+ {
|
|
|
+ content: 'Approved',
|
|
|
+ timestamp: '2018-04-13',
|
|
|
+ color: '#0bbd87',
|
|
|
+ icon: ChatDotSquare
|
|
|
+ },
|
|
|
+ {
|
|
|
+ content: 'Success',
|
|
|
+ timestamp: '2018-04-11',
|
|
|
+ color: '#0bbd87',
|
|
|
+ icon: ChatDotSquare
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ defineExpose({ reload, exportData, operatBatch });
|
|
|
+</script>
|