二手回收后台,师傅端,用户端
刘帅
2026-08-21 71f4ef6f2a61de63c38b97cbe017bb6301d919d7
手机端and管理端:改派问题
3个文件已修改
141 ■■■■■ 已修改文件
management/src/pages/reassignment/index.jsx 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/reassignment/service.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
master/pageA/againAssign/againAssign.vue 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/reassignment/index.jsx
@@ -1,21 +1,68 @@
import { buildProTableDataSource, sendRequest, showDelConfirm } from '@/utils/antdUtils';
import { PageContainer, ProTable } from '@ant-design/pro-components';
import { Button, Space, Tag } from 'antd';
import { Button, DatePicker, Form, Input, message, Modal, Space, Tag } from 'antd';
import moment from 'moment';
import { useRef, useState } from 'react';
import { history, useAccess, Access } from 'umi';
import AddAndEdit from './components/addAndEdit';
import { maskPhoneNumber, maskString } from '@/utils/utils'
import { batchDelete, getList, refuse } from './service';
import { maskString } from '@/utils/utils'
import { batchDelete, getList, manualHandle, refuse } from './service';
const formItemLayout = {
  labelCol: { span: 5 },
  wrapperCol: { span: 16 },
};
const Banner = () => {
  const actionRef = useRef();
  const addViewRef = useRef();
  const access = useAccess();
  const [form] = Form.useForm();
  const [modalVisible, handleModalVisible] = useState(false);
  const [reassignmentRecord, setReassignmentRecord] = useState({});
  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
  const [selectedRows, setSelectedRows] = useState([]);
  const isPendingReassignment = (state) => [0, 997].includes(Number(state));
  const disabledDate = (current) => current && current < moment().subtract(1, 'days').endOf('day');
  const openReassignmentModal = (record) => {
    setReassignmentRecord(record || {});
    form.resetFields();
    form.setFieldsValue({
      time: record?.newDoorTime ? moment(record.newDoorTime) : undefined,
      applyReason: record?.applyReason,
    });
    handleModalVisible(true);
  };
  const closeReassignmentModal = () => {
    handleModalVisible(false);
    setReassignmentRecord({});
    form.resetFields();
  };
  const parseDispatchResponse = (res) => {
    if (res.code == 200) {
      const result = res.data || {};
      const msg = result.message || res.msg || '操作成功';
      if (result.success === false) {
        message.warning(msg);
      } else {
        message.success(msg);
      }
      return true;
    }
    message.error(res.msg || '操作失败');
    return false;
  };
  const submitReassignment = async () => {
    const values = await form.validateFields();
    const res = await manualHandle({
      orderId: reassignmentRecord.orderId,
      time: moment(values.time).format('YYYY-MM-DD'),
      applyReason: reassignmentRecord.applyReason,
    });
    if (parseDispatchResponse(res)) {
      closeReassignmentModal();
      actionRef.current?.reload();
    }
  };
  const columns = [
    {
      title: '申请司机',
@@ -123,8 +170,7 @@
                <Button
                  type="link"
                  onClick={() => {
                    addViewRef.current.refreshData(record);
                    handleModalVisible(true);
                    openReassignmentModal(record);
                  }}
                >
                  改派
@@ -241,15 +287,35 @@
          ]}
        />
        <AddAndEdit
          ref={addViewRef}
          visible={modalVisible}
          onCancel={() => handleModalVisible(false)}
          onSuccess={async () => {
            handleModalVisible(false);
            actionRef.current?.reload();
          }}
        />
        <Modal
          getContainer={false}
          width="40%"
          destroyOnClose
          cancelText="取消"
          okText="确认改派"
          title="改派"
          open={modalVisible}
          onCancel={closeReassignmentModal}
          onOk={submitReassignment}
        >
          <Form scrollToFirstError layout="horizontal" {...formItemLayout} form={form}>
            <Form.Item
              name="time"
              label="上门时间"
              rules={[{ required: true, message: '请选择上门时间' }]}
            >
              <DatePicker
                placeholder="请选择上门时间"
                disabledDate={disabledDate}
                format="YYYY-MM-DD"
                style={{ width: '250px' }}
              />
            </Form.Item>
            <Form.Item name="applyReason" label="再投原因">
              <Input.TextArea disabled autoSize={{ minRows: 2, maxRows: 4 }} />
            </Form.Item>
          </Form>
        </Modal>
      </PageContainer>
    </div>
  );
management/src/pages/reassignment/service.js
@@ -43,10 +43,17 @@
        params,
    });
}
// 修改上门时间并自动派单
export const manualHandle = async (data) => {
    return request('/order/manualHandle', {
        method: 'POST',
        data,
    });
}
// 拒绝改派师傅
export const refuse = async (params) => {
    return request('/changeDispatch/refuse', {
        method: 'GET',
        params,
    });
}
}
master/pageA/againAssign/againAssign.vue
@@ -31,7 +31,7 @@
                <image v-else @tap.stop="checkRegio(2)" class="w-38 h-38" src="../../static/public/noActive.png" />
            </view>
            <view>
                <textarea :disabled="type !== 2" @input="areaChange" class="text_area"
                <textarea :value="remark" @input="areaChange" class="text_area"
                    placeholder="在此可输入具体描述"></textarea>
            </view>
        </view>
@@ -89,6 +89,7 @@
                type: 0,
                orderId: '',
                reason: '客户电话无法接听',
                remark: '',
                showSuccess: false,
                newDoorTime: '',
                showDoorTimePicker: false,
@@ -126,25 +127,25 @@
                    case 0:
                        this.type = 0
                        this.reason = '客户电话无法接听'
                        this.value = ''
                        this.remark = ''
                        this.newDoorTime = ''
                        break;
                    case 1:
                        this.type = 1
                        this.reason = '师傅个人原因'
                        this.value = ''
                        this.remark = ''
                        this.newDoorTime = ''
                        break;
                    case 2:
                        this.type = 2
                        this.reason = ''
                        this.value = ''
                        this.remark = ''
                        this.newDoorTime = ''
                        break;
                    case 3:
                        this.type = 3
                        this.reason = '客户修改上门时间'
                        this.value = ''
                        this.remark = ''
                        this.setDoorTimeValueByDate(new Date())
                        break;
                    default:
@@ -152,10 +153,25 @@
                }
            },
            areaChange(e) {
                this.reason = e.target.value
                this.remark = e.target.value
            },
            getSubmitReason() {
                const remark = this.remark.trim()
                if (this.type == 2) {
                    return remark
                }
                const reasonList = [this.reason]
                if (this.type == 3) {
                    reasonList.push(this.newDoorTime)
                }
                if (remark) {
                    reasonList.push(remark)
                }
                return reasonList.join(' ')
            },
            submit() {
                if (this.type == 2 && !this.reason) {
                const submitReason = this.getSubmitReason()
                if (this.type == 2 && !submitReason) {
                    uni.showToast({
                        title: '请输入原因',
                        icon: 'none',
@@ -171,10 +187,10 @@
                    })
                    return
                }
                console.log(this.orderId, this.reason);
                console.log(this.orderId, submitReason);
                applyChange({
                    orderId: this.orderId,
                    reason: this.reason,
                    reason: submitReason,
                    newDoorTime: this.newDoorTime
                }).then(res => {
                    console.log(res);