carDetail.js 15.0 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
"use strict";
const common_vendor = require("../../common/vendor.js");
require("../../uni_modules/uview-plus/index.js");
const api_user = require("../../api/user.js");
const api_car = require("../../api/car.js");
const uni_modules_uviewPlus_libs_function_debounce = require("../../uni_modules/uview-plus/libs/function/debounce.js");
if (!Array) {
  const _easycom_uni_data_select2 = common_vendor.resolveComponent("uni-data-select");
  const _easycom_up_form_item2 = common_vendor.resolveComponent("up-form-item");
  const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
  const _easycom_up_transition2 = common_vendor.resolveComponent("up-transition");
  const _easycom_up_form2 = common_vendor.resolveComponent("up-form");
  const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup");
  (_easycom_uni_data_select2 + _easycom_up_form_item2 + _easycom_up_input2 + _easycom_up_transition2 + _easycom_up_form2 + _easycom_up_popup2)();
}
const _easycom_uni_data_select = () => "../../uni_modules/uni-data-select/components/uni-data-select/uni-data-select.js";
const _easycom_up_form_item = () => "../../uni_modules/uview-plus/components/u-form-item/u-form-item.js";
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_transition = () => "../../uni_modules/uview-plus/components/u-transition/u-transition.js";
const _easycom_up_form = () => "../../uni_modules/uview-plus/components/u-form/u-form.js";
const _easycom_up_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
  (navTop + _easycom_uni_data_select + _easycom_up_form_item + _easycom_up_input + _easycom_up_transition + _easycom_up_form + _easycom_up_popup)();
}
const navTop = () => "../../components/navTop.js";
const _sfc_main = {
  __name: "carDetail",
  setup(__props) {
    const showTip = common_vendor.ref(true);
    const brandTitle = common_vendor.ref("请选择中文品牌");
    common_vendor.ref(false);
    const labelStyle = {
      fontSize: "28rpx",
      lineHeight: "38rpx",
      color: "#3D3D3D"
    };
    const isShowHeader = common_vendor.ref(false);
    const isCustom = common_vendor.ref(false);
    const searchList = common_vendor.ref([]);
    const showList = common_vendor.ref(false);
    const form = common_vendor.ref({
      name: "",
      identificationNumber: "",
      sysDeptId: "",
      customizeVehicleBrand: "",
      customizeVehicleModel: "",
      licensePlateNumber: "",
      lincensePlateTypeId: "",
      isCustomizeBrandAndModel: "1",
      frameNumber: "",
      engineNumber: "",
      vehicleTypeId: "",
      vehicleNatureId: "",
      passengersNumber: "",
      passengerCapacity: "",
      emissions: "",
      vehicleModelId: "",
      vehicleBrandId: "",
      tractionMass: "",
      requirementsId: ""
    });
    const queryParams = common_vendor.reactive({
      pageSize: 100,
      pageNum: 1
    });
    const queryModelParams = common_vendor.reactive({
      pageSize: 100,
      pageNum: 1,
      modelName: void 0
    });
    common_vendor.onLoad(async (options) => {
      if (options.carInfoId !== void 0) {
        const { data } = await api_car.getCarDetail(options.carInfoId);
        form.value = data;
        isCustom.value = data.isCustomizeBrandAndModel == "0";
        isShowHeader.value = true;
      }
    });
    const companyOption = common_vendor.ref([]);
    const getCompanyOption = () => {
      api_car.getListDeptApi().then((res) => {
        const { data } = res;
        const newList = data.filter((item) => item.parentId === 100);
        const arrList = newList.map((item) => {
          return {
            value: item.deptId,
            text: item.deptName
          };
        });
        companyOption.value = arrList;
      });
    };
    getCompanyOption();
    const carNumOption = common_vendor.ref([]);
    const getCarNumOption = () => {
      api_car.getCarNumApi(queryParams).then((res) => {
        const { data } = res;
        const arrList = data.records.map((item) => {
          return {
            value: item.id,
            text: item.name
          };
        });
        carNumOption.value = arrList;
      });
    };
    getCarNumOption();
    const carTypeOption = common_vendor.ref([]);
    const getCarTypeOption = () => {
      api_car.getCarTypeApi(queryParams).then((res) => {
        const { data } = res;
        const arrList = data.records.map((item) => {
          return {
            value: item.id,
            text: item.name
          };
        });
        carTypeOption.value = arrList;
      });
    };
    getCarTypeOption();
    const carNatureOption = common_vendor.ref([]);
    const getCarNatureOption = () => {
      api_car.getCarNatureApi(queryParams).then((res) => {
        const { data } = res;
        const arrList = data.records.map((item) => {
          return {
            value: item.id,
            text: item.name
          };
        });
        carNatureOption.value = arrList;
      });
    };
    getCarNatureOption();
    const carBrandOption = common_vendor.ref([]);
    const getCarBrandOption = () => {
      api_car.getCarBrandApi(queryParams).then((res) => {
        const { data } = res;
        const arrList = data.records.map((item) => {
          return {
            value: item.id,
            text: item.name
          };
        });
        carBrandOption.value = arrList;
      });
    };
    getCarBrandOption();
    const needOption = common_vendor.ref([]);
    const getNeedOption = () => {
      api_car.getNeedApi(queryParams).then((res) => {
        const { data } = res;
        const arrList = data.records.map((item) => {
          return {
            value: item.id,
            text: item.name
          };
        });
        needOption.value = arrList;
      });
    };
    getNeedOption();
    const getSearch = (value) => {
      if (common_vendor.index.$u.trim(value)) {
        queryModelParams.modelName = value;
        uni_modules_uviewPlus_libs_function_debounce.debounce(getModelList, 500);
      } else {
        showList.value = false;
      }
    };
    const getModelList = async () => {
      const res = await api_car.getCarModelApi(queryModelParams);
      const { data } = res;
      const listData = data.records;
      searchList.value = listData;
      showList.value = true;
    };
    const selectModel = (item) => {
      form.value.vehicleModelId = item.id;
      form.value.customizeVehicleModel = item.name;
      brandTitle.value = item.brandName;
      form.value.vehicleBrandId = item.brandId;
      showList.value = false;
      isCustom.value = true;
      form.value.isCustomizeBrandAndModel = "0";
    };
    const submitInfo = async () => {
      await api_user.carInfoAdd(form.value);
      common_vendor.index.$u.toast("添加成功");
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          carNum: form.value.licensePlateNumber
        }),
        b: common_vendor.t(form.value.customizeVehicleBrand || form.value.vehicleBran),
        c: common_vendor.t(form.value.customizeVehicleModel || form.value.vehicleModel),
        d: isShowHeader.value,
        e: common_vendor.o(($event) => form.value.sysDeptId = $event),
        f: common_vendor.p({
          localdata: companyOption.value,
          placeholder: "请选择上年承保公司",
          modelValue: form.value.sysDeptId
        }),
        g: common_vendor.p({
          label: "上年承保公司",
          prop: "sysDeptId"
        }),
        h: common_vendor.o(($event) => form.value.name = $event),
        i: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请输入真实姓名",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.name
        }),
        j: common_vendor.p({
          label: "车主姓名",
          prop: "name"
        }),
        k: common_vendor.o(($event) => form.value.identificationNumber = $event),
        l: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请输入身份证号",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.identificationNumber
        }),
        m: common_vendor.p({
          label: "身份证号",
          prop: "identificationNumber"
        }),
        n: common_vendor.o(($event) => form.value.licensePlateNumber = $event),
        o: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请输入车牌号码",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.licensePlateNumber
        }),
        p: common_vendor.p({
          label: "车牌号码",
          prop: "licensePlateNumber"
        }),
        q: common_vendor.o(($event) => form.value.lincensePlateTypeId = $event),
        r: common_vendor.p({
          localdata: carNumOption.value,
          placeholder: "请选择号牌种类",
          modelValue: form.value.lincensePlateTypeId
        }),
        s: common_vendor.p({
          label: "号牌种类",
          prop: "lincensePlateType"
        }),
        t: common_vendor.o(($event) => form.value.frameNumber = $event),
        v: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请输入车架号",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.frameNumber
        }),
        w: common_vendor.p({
          label: "车架号",
          prop: "frameNumber"
        }),
        x: common_vendor.o(($event) => form.value.engineNumber = $event),
        y: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请输入发动机号",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.engineNumber
        }),
        z: common_vendor.p({
          label: "发动机号",
          prop: "engineNumber"
        }),
        A: common_vendor.o(($event) => form.value.vehicleTypeId = $event),
        B: common_vendor.p({
          localdata: carTypeOption.value,
          placeholder: "请选择车辆类型",
          modelValue: form.value.vehicleTypeId
        }),
        C: common_vendor.p({
          label: "车辆类型",
          prop: "vehicleType"
        }),
        D: common_vendor.o(($event) => form.value.vehicleNatureId = $event),
        E: common_vendor.p({
          localdata: carNatureOption.value,
          placeholder: "请选择车辆使用性质",
          modelValue: form.value.vehicleNatureId
        }),
        F: common_vendor.p({
          label: "车辆使用性质",
          prop: "vehicleNature"
        }),
        G: common_vendor.o(($event) => form.value.passengersNumber = $event),
        H: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请输入核载人数",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.passengersNumber
        }),
        I: common_vendor.p({
          label: "核定客载数(人)",
          prop: "passengersNumber"
        }),
        J: common_vendor.o(($event) => form.value.passengerCapacity = $event),
        K: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请输入核载重量",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.passengerCapacity
        }),
        L: common_vendor.p({
          label: "核定载质量(千克)",
          prop: "passengerCapacity"
        }),
        M: common_vendor.o(($event) => form.value.emissions = $event),
        N: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请输入排放量",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.emissions
        }),
        O: common_vendor.p({
          label: "排量毫升",
          prop: "emissions"
        }),
        P: common_vendor.o(getSearch),
        Q: common_vendor.o(($event) => showList.value = false),
        R: common_vendor.o(($event) => form.value.customizeVehicleModel = $event),
        S: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请填写车辆型号",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.customizeVehicleModel
        }),
        T: common_vendor.f(searchList.value, (item, k0, i0) => {
          return {
            a: common_vendor.t(item.name),
            b: item,
            c: common_vendor.o(($event) => selectModel(item), item)
          };
        }),
        U: searchList.value.length == 0
      }, searchList.value.length == 0 ? {} : {}, {
        V: common_vendor.p({
          show: showList.value
        }),
        W: isCustom.value
      }, isCustom.value ? {
        X: common_vendor.o(($event) => form.value.vehicleBrandId = $event),
        Y: common_vendor.p({
          localdata: carBrandOption.value,
          placeholder: brandTitle.value,
          modelValue: form.value.vehicleBrandId
        }),
        Z: common_vendor.p({
          label: "中文品牌",
          prop: "vehicleBrand"
        })
      } : {
        aa: common_vendor.o(($event) => form.value.customizeVehicleBrand = $event),
        ab: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请填写中文品牌",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.customizeVehicleBrand
        }),
        ac: common_vendor.p({
          label: "中文品牌",
          prop: "vehicleBrand"
        })
      }, {
        ad: common_vendor.o(($event) => form.value.tractionMass = $event),
        ae: common_vendor.p({
          fontSize: "28rpx",
          color: "#999",
          placeholder: "请填写准牵引准质量",
          border: "none",
          inputAlign: "right",
          modelValue: form.value.tractionMass
        }),
        af: common_vendor.p({
          label: "准牵引质量",
          prop: "tractionMass"
        }),
        ag: common_vendor.o(($event) => form.value.requirementsId = $event),
        ah: common_vendor.p({
          localdata: needOption.value,
          placeholder: "请选择保险需求",
          modelValue: form.value.requirementsId
        }),
        ai: common_vendor.p({
          label: "保险需求",
          prop: "requirements"
        }),
        aj: common_vendor.o(submitInfo),
        ak: common_vendor.sr("uFormRef", "1c0b8627-0"),
        al: common_vendor.p({
          model: form.value,
          ["label-width"]: "130",
          labelStyle
        }),
        am: common_vendor.o(($event) => showTip.value = false),
        an: common_vendor.o(($event) => showTip.value = false),
        ao: common_vendor.p({
          show: showTip.value,
          mode: "center",
          safeAreaInsetBottom: false,
          round: "20"
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1c0b8627"]]);
wx.createPage(MiniProgramPage);