"use strict"; const common_vendor = require("../../common/vendor.js"); const api = require("../../api.js"); const common_assets = require("../../common/assets.js"); const _sfc_main = common_vendor.defineComponent({ data() { return { uploadConfig: new UTSJSONObject({ // 上传地址 url: "https://gpt.aiym.run/contract/miniapp/file/upload", // 文件字段名 name: "file", // 请求头 header: new UTSJSONObject({}), // 附带的表单数据 formData: new UTSJSONObject({ "biz": "cert" }), // 是否开启实际上传 enabled: true }), clientInfo: new UTSJSONObject({ appOrderCarList: [ new UTSJSONObject({ buyMoney: 0, buyTax: 0, buyTime: "", carModel: "", carNo: "", carSeries: "", carType: "", createBy: "", createTime: "", engineNo: "", id: "", mileage: "", newCar: 0, orderFkId: "", sysOrgCode: "", updateBy: "", updateTime: "", useType: "", vin: "" }) ], appOrderFinanceList: [ new UTSJSONObject({ createBy: "", createTime: "", id: "", lender: "", lenderMone: 0, lenderYear: "", orderFkId: "", sysOrgCode: "", updateBy: "", updateTime: "" }) ], appOrderVoucherList: [ new UTSJSONObject({ assigneeCardNo: "", assigneeName: "", assigneePhone: "", carInsuranceNo: "", createBy: "", createTime: "", dealerAddress: "", effectiveTime: "", endTime: "", equityPackage: "", firstBeneficiary: "", id: "", insuranceName: "", orderFkId: "", packageMoney: 0, payTime: "", registeredCity: "", serviceMoney: 0, serviceYear: "", sysOrgCode: "", updateBy: "", updateTime: "" }) ], busLicense: "", carPic: "", certBack: "", certFront: "", contractUrl: "", createBy: "", createTime: "", custAddress: "", custCardNo: "", custName: "", custPhone: "", custType: 0, id: "", orderNum: "", payType: "全款", payVoucherUrl: "", payee: "", payeeTime: "", productContractTemp: "", productMone: null, productName: "自动填写所选商品服务分类", productServiceYear: 1, saleName: "", salePort: "售前", status: 0, storeName: "自动填写所选择的门店", sysOrgCode: "", updateBy: "", updateTime: "" }), fileList1: [], departments: ["售前", "售后", "二网车"], carBrands: [], carBrandIndex: -1, serviceAges: ["1年", "2年", "3年"], serviceAgeIndex: -1, payees: [], payeeIndex: -1, // 扫描 positiveImg: "/static/image/组件 4 – 1.png", // 反面身份证 reverseImg: "/static/image/组 71663.png", // 行车驾驶证 carImg: "/static/image/组件 2 – 1.png" //自己图片路径 }; }, mounted() { api.isToken(); this.clientInfo.storeName = getApp().storeName || "自动填写所选择的门店"; this.clientInfo.productName = getApp().productName || "自动填写所选商品服务分类"; this.clientInfo.appOrderVoucherList[0].dealerAddress = getApp().dealerAddress; this.clientInfo.productContractTemp = getApp().productUrl; for (var index = 0; index < getApp().allMsg.length; index++) { this.payees.push(getApp().allMsg[index].storeName); } this.clientInfo.payee = getApp().storeName; this.uploadConfig.header = new UTSJSONObject({ "X-Access-Token": common_vendor.index.getStorageSync("token") }); api.getChildListBatch().then((res = null) => { this.carBrands = []; for (var index2 = 0; index2 < res.result.records.length; index2++) { this.carBrands.push(res.result.records[index2].name); } }); }, methods: { // 凭证上传函数 deletePic(event = null) { this[`fileList${event.name}`].splice(event.index, 1); }, // 新增图片 afterRead(event = null) { return common_vendor.__awaiter(this, void 0, void 0, function* () { let lists = [].concat(event.file); let fileListLen = this[`fileList${event.name}`].length; lists.map((item) => { this[`fileList${event.name}`].push(new UTSJSONObject(Object.assign(Object.assign({}, item), { status: "uploading", message: "上传中" }))); }); for (let i = 0; i < lists.length; i++) { const result = yield this.uploadFilePromise(lists[i].url); let item = this[`fileList${event.name}`][fileListLen]; this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, { status: "success", message: "", url: result })); fileListLen++; } }); }, uploadFilePromise(url = null) { let token = common_vendor.index.getStorageSync("token"); return new Promise((resolve, reject) => { common_vendor.index.uploadFile({ url: "https://www.shengchuangyunkong.com/contract/miniapp/file/upload", filePath: url, name: "file", formData: new UTSJSONObject({ biz: "test" }), header: new UTSJSONObject({ "X-Access-Token": token }), success: (res) => { this.clientInfo.payVoucherUrl = UTS.JSON.parse(res.data).message; setTimeout(() => { resolve(res.data.data); }, 1e3); } }); }); }, get_to() { api.add(UTS.JSON.parse(UTS.JSON.stringify(this.clientInfo))).then((res = null) => { }); common_vendor.index.switchTab({ url: "/pages/index/dingdan" }); }, toBack() { let canNavBack = getCurrentPages(); if (canNavBack && canNavBack.length > 1) { common_vendor.index.navigateBack(); } else { history.back(); } }, handleDepartmentChange(e = null) { this.clientInfo.salePort = e; }, // 修改车辆品牌 bindCarBrandChange(e = null) { this.carBrandIndex = e.detail.value; this.clientInfo.appOrderCarList[0].carSeries = this.carBrands[this.carBrandIndex]; }, // 取服务年限 bindServiceAgeChange(e = null) { this.serviceAgeIndex = e.detail.value; if (this.serviceAges[e.detail.value] == "1年") { this.clientInfo.productServiceYear = 1; } else if (this.serviceAges[e.detail.value] == "2年") { this.clientInfo.productServiceYear = 2; } else { this.clientInfo.productServiceYear = 3; } }, // 选择收款方 bindPayeeChange(e = null) { this.payeeIndex = e.detail.value; this.clientInfo.payee = this.payees[e.detail.value]; }, // 身份证正面上传 uploadPositive() { common_vendor.index.chooseImage({ count: 1, sizeType: ["original", "compressed"], sourceType: ["album", "camera"], success: (res) => { let filePath = res.tempFilePaths[0]; let token = common_vendor.index.getStorageSync("token"); this.uploadIdentify(token, "front", filePath, "sfz"); } }); }, // 身份证反面上传 uploadReverse() { common_vendor.index.chooseImage({ count: 1, sizeType: ["original", "compressed"], sourceType: ["album", "camera"], success: (res) => { let filePath = res.tempFilePaths[0]; let token = common_vendor.index.getStorageSync("token"); this.uploadIdentify(token, "back", filePath, "sfz"); } }); }, uploadCarCert() { common_vendor.index.chooseImage({ count: 1, sizeType: ["original", "compressed"], sourceType: ["album", "camera"], success: (res) => { let filePath = res.tempFilePaths[0]; let token = common_vendor.index.getStorageSync("token"); this.uploadIdentify(token, "", filePath, "carCert"); } }); }, // 上传识别 uploadIdentify(token = null, side = null, filePath = null, type = null) { common_vendor.index.uploadFile({ url: "https://www.shengchuangyunkong.com/contract/miniapp/file/upload", filePath, name: "file", formData: new UTSJSONObject({ "biz": "cert" }), header: new UTSJSONObject({ "X-Access-Token": token }), success: (res) => { let image = UTS.JSON.parse(res.data).message; common_vendor.index.__f__("log", "at pages/index/PayPal.uvue:661", image); if (type == "sfz") { api.idCardInfo(new UTSJSONObject({ "side": side, "url": UTS.JSON.parse(res.data).message })).then((res2 = null) => { if (res2.success) { if (side == "front") { this.clientInfo.custName = res2.result.name; this.clientInfo.appOrderVoucherList[0].firstBeneficiary = res2.result.name; this.clientInfo.custAddress = res2.result.address; this.clientInfo.custCardNo = res2.result.idCard; this.clientInfo.certFront = image; } else { this.clientInfo.certBack = image; } } else { common_vendor.index.showToast({ title: "身份证识别错误,请重新上传!", icon: "error", duration: 500, success: (res3) => { }, fail: (res3) => { } }); } }).catch((err = null) => { common_vendor.index.__f__("log", "at pages/index/PayPal.uvue:687", "catch: ", err); }); } else if (type == "carCert") { api.carCert(new UTSJSONObject({ "url": UTS.JSON.parse(res.data).message })).then((res2 = null) => { if (res2.success) { common_vendor.index.__f__("log", "at pages/index/PayPal.uvue:693", "车辆号", res2); this.clientInfo.appOrderCarList[0].carSeries = res2.result.CarBrand; this.clientInfo.appOrderCarList[0].vin = res2.result.VinNo; this.clientInfo.carPic = image; this.clientInfo.appOrderCarList[0].engineNo = res2.result.EngineNo; this.clientInfo.appOrderCarList[0].carModel = res2.result.CarModel; } else { common_vendor.index.showToast({ title: "识别错误,请重新上传!", icon: "error", duration: 500, success: (res3) => { }, fail: (res3) => { } }); } }).catch((err = null) => { common_vendor.index.__f__("log", "at pages/index/PayPal.uvue:716", "catch: ", err); }); } }, fail: (err) => { common_vendor.index.__f__("log", "at pages/index/PayPal.uvue:723", err); } }); }, onChange(e = null) { common_vendor.index.__f__("log", "at pages/index/PayPal.uvue:728", e); if (e == "个人") { this.clientInfo.custType = 0; } else { this.clientInfo.custType = 1; } }, onChanges(e = null) { if (e == "是") { this.clientInfo.appOrderCarList[0].newCar = 1; } else { this.clientInfo.appOrderCarList[0].newCar = 0; } } } }); if (!Array) { const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons"); const _easycom_l_radio2 = common_vendor.resolveComponent("l-radio"); const _easycom_l_radio_group2 = common_vendor.resolveComponent("l-radio-group"); const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker"); const _easycom_uv_upload2 = common_vendor.resolveComponent("uv-upload"); (_easycom_uni_icons2 + _easycom_l_radio2 + _easycom_l_radio_group2 + _easycom_uni_datetime_picker2 + _easycom_uv_upload2)(); } const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js"; const _easycom_l_radio = () => "../../uni_modules/lime-radio/components/l-radio/l-radio.js"; const _easycom_l_radio_group = () => "../../uni_modules/lime-radio/components/l-radio-group/l-radio-group.js"; const _easycom_uni_datetime_picker = () => "../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js"; const _easycom_uv_upload = () => "../../uni_modules/uv-upload/components/uv-upload/uv-upload.js"; if (!Math) { (_easycom_uni_icons + _easycom_l_radio + _easycom_l_radio_group + _easycom_uni_datetime_picker + _easycom_uv_upload)(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return { a: common_vendor.p({ type: "left", size: "30", color: "#c2d4de" }), b: common_vendor.o((...args) => $options.toBack && $options.toBack(...args)), c: common_vendor.w(({ checked }, s0, i0) => { return { a: checked, b: !checked, c: i0, d: s0 }; }, { name: "icon", path: "c", vueId: "643091e0-1" }), d: common_assets._imports_0$4, e: common_assets._imports_1$3, f: common_vendor.p({ checked: $data.clientInfo.payType === "全款", label: "全款", fontSize: "1rem" }), g: common_vendor.w(({ checked }, s0, i0) => { return { a: checked, b: !checked, c: i0, d: s0 }; }, { name: "icon", path: "g", vueId: "643091e0-3,643091e0-2" }), h: common_assets._imports_0$4, i: common_assets._imports_1$3, j: common_vendor.p({ checked: $data.clientInfo.custType == 0 ? true : false, value: "个人", label: "个人", fontSize: "1rem" }), k: common_vendor.w(({ checked }, s0, i0) => { return { a: checked, b: !checked, c: i0, d: s0 }; }, { name: "icon", path: "k", vueId: "643091e0-4,643091e0-2" }), l: common_assets._imports_0$4, m: common_assets._imports_1$3, n: common_vendor.p({ checked: $data.clientInfo.custType == 1 ? true : false, value: "公司", label: "公司", fontSize: "1rem" }), o: common_vendor.o($options.onChange), p: $data.clientInfo.certFront == "" ? $data.positiveImg : $data.clientInfo.certFront, q: common_vendor.o((...args) => $options.uploadPositive && $options.uploadPositive(...args)), r: $data.clientInfo.certBack == "" ? $data.reverseImg : $data.clientInfo.certBack, s: common_vendor.o((...args) => $options.uploadReverse && $options.uploadReverse(...args)), t: $data.clientInfo.carPic == "" ? $data.carImg : $data.clientInfo.carPic, v: common_vendor.o((...args) => $options.uploadCarCert && $options.uploadCarCert(...args)), w: common_assets._imports_7, x: common_vendor.t($data.clientInfo.productName), y: common_vendor.t($data.clientInfo.storeName), z: $data.clientInfo.custName, A: common_vendor.o(($event) => $data.clientInfo.custName = $event.detail.value), B: $data.clientInfo.custAddress, C: common_vendor.o(($event) => $data.clientInfo.custAddress = $event.detail.value), D: $data.clientInfo.custCardNo, E: common_vendor.o(($event) => $data.clientInfo.custCardNo = $event.detail.value), F: $data.clientInfo.custPhone, G: common_vendor.o(($event) => $data.clientInfo.custPhone = $event.detail.value), H: common_vendor.f($data.departments, (item, k0, i0) => { return { a: common_vendor.w(({ checked }, s1, i1) => { return { a: checked, b: !checked, c: i1, d: s1 }; }, { name: "icon", path: "H[" + i0 + "].a", vueId: "643091e0-6-" + i0 + ",643091e0-5" }), b: "643091e0-6-" + i0 + ",643091e0-5", c: common_vendor.p({ value: item, checked: $data.clientInfo.salePort === item }), d: common_vendor.t(item), e: item }; }), I: common_assets._imports_0$4, J: common_assets._imports_1$3, K: common_vendor.o($options.handleDepartmentChange), L: $data.clientInfo.saleName, M: common_vendor.o(($event) => $data.clientInfo.saleName = $event.detail.value), N: common_assets._imports_7, O: common_vendor.t($data.clientInfo.appOrderCarList[0].carSeries || "请选择车辆品牌 >"), P: common_vendor.o((...args) => $options.bindCarBrandChange && $options.bindCarBrandChange(...args)), Q: $data.carBrandIndex, R: $data.carBrands, S: $data.clientInfo.appOrderCarList[0].vin, T: common_vendor.o(($event) => $data.clientInfo.appOrderCarList[0].vin = $event.detail.value), U: $data.clientInfo.appOrderCarList[0].useType, V: common_vendor.o(($event) => $data.clientInfo.appOrderCarList[0].useType = $event.detail.value), W: common_vendor.w(({ checked }, s0, i0) => { return { a: checked, b: !checked, c: i0, d: s0 }; }, { name: "icon", path: "W", vueId: "643091e0-8,643091e0-7" }), X: common_assets._imports_0$4, Y: common_assets._imports_1$3, Z: common_vendor.p({ checked: $data.clientInfo.appOrderCarList[0].newCar == 1 ? true : false, value: "是", label: "是", fontSize: "1rem" }), aa: common_vendor.w(({ checked }, s0, i0) => { return { a: checked, b: !checked, c: i0, d: s0 }; }, { name: "icon", path: "aa", vueId: "643091e0-9,643091e0-7" }), ab: common_assets._imports_0$4, ac: common_assets._imports_1$3, ad: common_vendor.p({ checked: $data.clientInfo.appOrderCarList[0].newCar == 0 ? true : false, value: "否", label: "否", fontSize: "1rem" }), ae: common_vendor.o($options.onChanges), af: $data.clientInfo.appOrderCarList[0].carModel, ag: common_vendor.o(($event) => $data.clientInfo.appOrderCarList[0].carModel = $event.detail.value), ah: $data.clientInfo.appOrderCarList[0].carNo, ai: common_vendor.o(($event) => $data.clientInfo.appOrderCarList[0].carNo = $event.detail.value), aj: $data.clientInfo.appOrderCarList[0].engineNo, ak: common_vendor.o(($event) => $data.clientInfo.appOrderCarList[0].engineNo = $event.detail.value), al: $data.clientInfo.appOrderCarList[0].mileage, am: common_vendor.o(($event) => $data.clientInfo.appOrderCarList[0].mileage = $event.detail.value), an: common_vendor.o(($event) => $data.clientInfo.appOrderCarList[0].buyTime = $event), ao: common_vendor.p({ type: "datetime", clearIcon: false, border: false, modelValue: $data.clientInfo.appOrderCarList[0].buyTime }), ap: $data.clientInfo.appOrderCarList[0].buyMoney, aq: common_vendor.o(($event) => $data.clientInfo.appOrderCarList[0].buyMoney = $event.detail.value), ar: $data.clientInfo.appOrderCarList[0].buyTax, as: common_vendor.o(($event) => $data.clientInfo.appOrderCarList[0].buyTax = $event.detail.value), at: common_assets._imports_7, av: $data.clientInfo.appOrderVoucherList[0].firstBeneficiary, aw: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].firstBeneficiary = $event.detail.value), ax: $data.clientInfo.appOrderVoucherList[0].lenderMoney, ay: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].lenderMoney = $event.detail.value), az: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].effectiveTime = $event), aA: common_vendor.p({ type: "datetime", clearIcon: false, border: false, modelValue: $data.clientInfo.appOrderVoucherList[0].effectiveTime }), aB: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].endTime = $event), aC: common_vendor.p({ type: "datetime", clearIcon: false, border: false, modelValue: $data.clientInfo.appOrderVoucherList[0].endTime }), aD: $data.clientInfo.appOrderVoucherList[0].serviceYear, aE: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].serviceYear = $event.detail.value), aF: $data.clientInfo.appOrderVoucherList[0].equityPackage, aG: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].equityPackage = $event.detail.value), aH: $data.clientInfo.appOrderVoucherList[0].packageMoney, aI: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].packageMoney = $event.detail.value), aJ: $data.clientInfo.appOrderVoucherList[0].carInsuranceNo, aK: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].carInsuranceNo = $event.detail.value), aL: $data.clientInfo.appOrderVoucherList[0].registeredCity, aM: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].registeredCity = $event.detail.value), aN: $data.clientInfo.appOrderVoucherList[0].insuranceName, aO: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].insuranceName = $event.detail.value), aP: $data.clientInfo.appOrderVoucherList[0].assigneeName, aQ: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].assigneeName = $event.detail.value), aR: $data.clientInfo.appOrderVoucherList[0].assigneePhone, aS: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].assigneePhone = $event.detail.value), aT: $data.clientInfo.appOrderVoucherList[0].assigneeCardNo, aU: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].assigneeCardNo = $event.detail.value), aV: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].payTime = $event), aW: common_vendor.p({ type: "datetime", clearIcon: false, border: false, modelValue: $data.clientInfo.appOrderVoucherList[0].payTime }), aX: $data.clientInfo.appOrderVoucherList[0].dealerAddress, aY: common_vendor.o(($event) => $data.clientInfo.appOrderVoucherList[0].dealerAddress = $event.detail.value), aZ: common_assets._imports_7, ba: $data.clientInfo.appOrderFinanceList[0].lender, bb: common_vendor.o(($event) => $data.clientInfo.appOrderFinanceList[0].lender = $event.detail.value), bc: $data.clientInfo.appOrderFinanceList[0].lenderMoney, bd: common_vendor.o(($event) => $data.clientInfo.appOrderFinanceList[0].lenderMoney = $event.detail.value), be: $data.clientInfo.appOrderFinanceList[0].lenderYear, bf: common_vendor.o(($event) => $data.clientInfo.appOrderFinanceList[0].lenderYear = $event.detail.value), bg: common_assets._imports_7, bh: common_vendor.t($data.clientInfo.productName), bi: common_vendor.t($data.serviceAges[$data.serviceAgeIndex] || "请选择服务年限 >"), bj: common_vendor.o((...args) => $options.bindServiceAgeChange && $options.bindServiceAgeChange(...args)), bk: $data.serviceAgeIndex, bl: $data.serviceAges, bm: $data.clientInfo.productMoney, bn: common_vendor.o(($event) => $data.clientInfo.productMoney = $event.detail.value), bo: common_assets._imports_7, bp: common_vendor.t(this.clientInfo.payee || "请选择收款方 >"), bq: common_vendor.o((...args) => $options.bindPayeeChange && $options.bindPayeeChange(...args)), br: $data.payeeIndex, bs: $data.payees, bt: common_vendor.o(($event) => $data.clientInfo.payeeTime = $event), bv: common_vendor.p({ type: "datetime", clearIcon: false, border: false, modelValue: $data.clientInfo.payeeTime }), bw: common_assets._imports_8, bx: common_vendor.o($options.afterRead), by: common_vendor.o($options.deletePic), bz: common_vendor.p({ fileList: $data.fileList1, name: "1", multiple: true, maxCount: 1 }), bA: common_vendor.o((...args) => $options.get_to && $options.get_to(...args)), bB: common_vendor.sei(_ctx.virtualHostId, "view") }; } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-643091e0"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/PayPal.js.map