operateList.js 6.4 KB
"use strict";
const common_vendor = require("../common/vendor.js");
const api_work = require("../api/work.js");
if (!Array) {
  const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
  const _easycom_up_modal2 = common_vendor.resolveComponent("up-modal");
  const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
  const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
  const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
  (_easycom_up_textarea2 + _easycom_up_modal2 + _easycom_up_input2 + _easycom_up_radio2 + _easycom_up_radio_group2)();
}
const _easycom_up_textarea = () => "../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_modal = () => "../uni_modules/uview-plus/components/u-modal/u-modal.js";
const _easycom_up_input = () => "../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_radio = () => "../uni_modules/uview-plus/components/u-radio/u-radio.js";
const _easycom_up_radio_group = () => "../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
if (!Math) {
  (_easycom_up_textarea + _easycom_up_modal + _easycom_up_input + _easycom_up_radio + _easycom_up_radio_group)();
}
const _sfc_main = {
  __name: "operateList",
  props: {
    carInfo: {
      type: Object,
      require: true
    }
  },
  emits: ["refreshList"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const deptOptions = common_vendor.ref([]);
    const companyQueryParams = common_vendor.reactive({
      deptName: void 0,
      status: void 0
    });
    const deptId = common_vendor.ref(0);
    const current = common_vendor.ref(9);
    const showDefeat = common_vendor.ref(false);
    const DefeatContent = common_vendor.ref("");
    const showCompany = common_vendor.ref(false);
    const handleSuccess = () => {
      current.value = 0;
      common_vendor.index.showModal({
        title: "提示",
        content: "是否通过",
        success: function(res) {
          if (res.confirm) {
            api_work.disposeUser({ associationapprove: "0" }, props.carInfo.taskId).then((res2) => {
              common_vendor.index.$u.toast("保单已通过");
              emit("refreshList");
            });
          } else if (res.cancel) {
            console.log("用户点击取消");
          }
        }
      });
    };
    const handleReturn = () => {
      current.value = 1;
      common_vendor.index.showModal({
        title: "提示",
        content: "是否退回",
        success: function(res) {
          if (res.confirm) {
            api_work.disposeUser({ associationapprove: "1" }, props.carInfo.taskId).then((res2) => {
              common_vendor.index.$u.toast("保单已退回");
              emit("refreshList");
            });
          } else if (res.cancel) {
            console.log("用户点击取消");
          }
        }
      });
    };
    const handleInvalid = () => {
      current.value = 2;
      showDefeat.value = true;
    };
    const handleUpdate = () => {
      current.value = 3;
      const id = props.carInfo.businessKey;
      common_vendor.index.navigateTo({
        url: `/pages/carDetail/carDetail?carInfoId=${id}&roleId=1`
      });
    };
    const handleCirculation = () => {
      current.value = 4;
      getDeptList();
      showCompany.value = true;
    };
    const getDeptList = () => {
      api_work.listDept(companyQueryParams).then((response) => {
        deptOptions.value = response.data.filter((item) => item.parentId === 100);
      });
    };
    const sunmitDeprecated = () => {
      const data = {
        associationapprove: "2",
        comment: DefeatContent.value
      };
      const taskId = props.carInfo.taskId;
      api_work.disposeUser(data, taskId).then((res) => {
        emit("refreshList");
        common_vendor.index.$u.toast("保单已作废");
        showDefeat.value = false;
      });
    };
    const submitForm = () => {
      const data = {
        associationapprove: "0",
        deptid: deptId.value.toString()
      };
      const taskId = props.carInfo.taskId;
      api_work.disposeUser(data, taskId).then((res) => {
        showCompany.value = false;
        emit("refreshList");
        common_vendor.index.$u.toast("保单已分配成功");
      });
    };
    return (_ctx, _cache) => {
      return {
        a: current.value === 0 ? 1 : "",
        b: common_vendor.o(handleSuccess),
        c: current.value === 1 ? 1 : "",
        d: common_vendor.o(handleReturn),
        e: current.value === 2 ? 1 : "",
        f: common_vendor.o(handleInvalid),
        g: current.value === 3 ? 1 : "",
        h: common_vendor.o(handleUpdate),
        i: current.value === 4 ? 1 : "",
        j: common_vendor.o(handleCirculation),
        k: common_vendor.o(($event) => DefeatContent.value = $event),
        l: common_vendor.p({
          placeholder: "请输入内容",
          modelValue: DefeatContent.value
        }),
        m: common_vendor.o(sunmitDeprecated),
        n: common_vendor.o(($event) => showDefeat.value = false),
        o: common_vendor.p({
          show: showDefeat.value,
          showCancelButton: true,
          title: "填写作废回馈"
        }),
        p: common_vendor.o(($event) => companyQueryParams.deptName = $event),
        q: common_vendor.p({
          placeholder: "请输入承保公司名称",
          prefixIcon: "search",
          modelValue: companyQueryParams.deptName
        }),
        r: common_vendor.o(getDeptList),
        s: common_vendor.f(deptOptions.value, (item, index, i0) => {
          return {
            a: index,
            b: "3d588709-5-" + i0 + ",3d588709-4",
            c: common_vendor.p({
              label: item.deptName,
              name: item.deptId
            })
          };
        }),
        t: common_vendor.o(($event) => deptId.value = $event),
        v: common_vendor.p({
          placement: "column",
          modelValue: deptId.value
        }),
        w: common_vendor.o(submitForm),
        x: common_vendor.o(($event) => showCompany.value = false),
        y: common_vendor.o(($event) => showCompany.value = false),
        z: common_vendor.p({
          show: showCompany.value,
          showCancelButton: true,
          closeOnClickOverlay: true,
          title: "选择分配项"
        })
      };
    };
  }
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3d588709"]]);
wx.createComponent(Component);