"use strict"; const common_vendor = require("../../../common/vendor.js"); const utils_api = require("../../../utils/api.js"); const utils_tools = require("../../../utils/tools.js"); if (!Array) { const _easycom_bikeCodeScan2 = common_vendor.resolveComponent("bikeCodeScan"); const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item"); const _easycom_uni_list_item2 = common_vendor.resolveComponent("uni-list-item"); const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list"); const _easycom_scanCode2 = common_vendor.resolveComponent("scanCode"); const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons"); const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card"); const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms"); (_easycom_bikeCodeScan2 + _easycom_uni_forms_item2 + _easycom_uni_list_item2 + _easycom_uni_list2 + _easycom_scanCode2 + _easycom_uni_icons2 + _easycom_uni_card2 + _easycom_uni_forms2)(); } const _easycom_bikeCodeScan = () => "../../../components/bikeCodeScan/bikeCodeScan.js"; const _easycom_uni_forms_item = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-forms-item/uni-forms-item.js"; const _easycom_uni_list_item = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-list-item/uni-list-item.js"; const _easycom_uni_list = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-list/uni-list.js"; const _easycom_scanCode = () => "../../../components/scanCode/scanCode.js"; const _easycom_uni_icons = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons.js"; const _easycom_uni_card = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.js"; const _easycom_uni_forms = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-forms/uni-forms.js"; if (!Math) { (_easycom_bikeCodeScan + _easycom_uni_forms_item + _easycom_uni_list_item + _easycom_uni_list + _easycom_scanCode + _easycom_uni_icons + _easycom_uni_card + _easycom_uni_forms)(); } const _sfc_main = { __name: "changebatteries", setup(__props) { let bikeCode = common_vendor.ref(null); const refbikeScan = common_vendor.ref(null); let formdata = common_vendor.ref({ bikeId: "", ecuId: "", latitude: null, longitude: null, oldBatteryCode: "", online: null, soc: "", //电量 timestamp: "" }); let newBatteryCode = common_vendor.ref(""); const systemInfo = common_vendor.index.getSystemInfoSync(); const screenHeight = systemInfo.screenHeight; let scrollHeight = screenHeight - 150; let arrEcuBtn = [{ title: "寻车铃声", url: "findEbike" }, { title: "开锁", url: "unlock" }, { title: "关锁", url: "lock" }]; common_vendor.onLoad((option) => { const { bikeCode: bikeCode2 } = option; getBikeInfo(bikeCode2); }); common_vendor.onMounted(() => { if (bikeCode.value != "") { if (refbikeScan.value) { refbikeScan.value.onSetValue(bikeCode.value); } } }); const getBikeInfo = (bikecode) => { if (bikecode == bikeCode.value) return; const params = { bikeCode: bikecode }; bikeCode.value = bikecode; utils_api.callEbikeBatteryApply("getBikeMsg", params, "get").then((res) => { const { code, data, message } = res; if (code === 500) { utils_tools.showModelMessage(message); formdata.value = {}; return; } if (arrEcuBtn.length < 4) { arrEcuBtn.push({ title: "关电池仓", url: "closeBatteryLock" }); } const timestamp = data.timestamp; let newtime = timestamp ? common_vendor.dayjs(timestamp * 1e3).format("YYYY-MM-DD HH:mm:ss") : ""; const newdata = { ...data, timestamp: newtime }; formdata.value = { ...newdata }; }); }; const checkecu = (url) => { const { ecuId, bikeId } = formdata.value; if (!ecuId) { utils_tools.showModelMessage("请先扫码车辆编号!"); return; } utils_api.callCoreApi(url, { ecuId, bikeId }, "get").then((res) => { const { code, message } = res; utils_tools.showModelMessage(message); }); }; const openfaultreport = () => { const bikecode = bikeCode.value; if (!bikecode) { utils_tools.showModelMessage("请先扫码车辆编号!"); return; } common_vendor.index.navigateTo({ url: "/pages/devops/faultreport/faultreport?bikeCode=" + bikecode }); }; const refresh = () => { const bikecode = bikeCode.value; if (!bikecode) { utils_tools.showModelMessage("请先扫码车辆编号!"); return; } getBikeInfo(bikecode); }; const completebatter = () => { const bikeId = formdata.value.bikeId; const bikecode = bikeCode.value; const newbattercode = newBatteryCode.value; if (!bikecode) { utils_tools.showModelMessage("请先扫码车辆编号!"); return; } if (!newbattercode) { utils_tools.showModelMessage("请先扫码新电池编号!"); return; } const params = { bikeId, newBatteryCode: newbattercode, bikeCode: bikecode }; utils_api.callEbikeBatteryApply("change", params).then((res) => { const { code, message } = res; utils_tools.showModelMessage(message); if (code == 200) { common_vendor.index.navigateBack(); } }); }; return (_ctx, _cache) => { return { a: common_vendor.sr(refbikeScan, "bc6b3874-3,bc6b3874-2", { "k": "refbikeScan" }), b: common_vendor.o(getBikeInfo), c: common_vendor.o(($event) => common_vendor.isRef(bikeCode) ? bikeCode.value = $event : bikeCode = $event), d: common_vendor.p({ modelValue: common_vendor.unref(bikeCode) }), e: common_vendor.p({ label: "车辆编号:" }), f: common_vendor.t(common_vendor.unref(formdata).online), g: common_vendor.t(common_vendor.unref(formdata).timestamp), h: common_vendor.p({ label: "车辆状态:" }), i: common_vendor.t(common_vendor.unref(formdata).oldBatteryCode), j: common_vendor.p({ label: "老电池编号:" }), k: common_vendor.t(common_vendor.unref(formdata).soc ? common_vendor.unref(formdata).soc : 0), l: common_vendor.p({ label: "电池电量:" }), m: common_vendor.p({ showArrow: true, title: "查看地图", note: common_vendor.unref(formdata).latitude ? common_vendor.unref(formdata).latitude + "," + common_vendor.unref(formdata).longitude : "", link: "navigateTo", to: "/pages/map/map-findbike?longitude=" + common_vendor.unref(formdata).longitude + "&latitude=" + common_vendor.unref(formdata).latitude }), n: common_vendor.p({ border: false }), o: common_vendor.p({ label: "车辆位置:" }), p: common_vendor.f(common_vendor.unref(arrEcuBtn), (item, k0, i0) => { return { a: common_vendor.t(item.title), b: common_vendor.o(($event) => checkecu(item.url)) }; }), q: common_vendor.n(common_vendor.unref(formdata).ecuId ? "b-btn-babyblue" : "b-btn-gray"), r: common_vendor.o(($event) => common_vendor.isRef(newBatteryCode) ? newBatteryCode.value = $event : newBatteryCode = $event), s: common_vendor.p({ placeholder: "请输入", modelValue: common_vendor.unref(newBatteryCode) }), t: common_vendor.p({ label: "新电池编号:" }), v: common_vendor.o(($event) => checkecu("openBatteryLock")), w: common_vendor.p({ ["custom-prefix"]: "iconfont", type: "icon-ebikeguzhangshangbao1", size: "20", color: "#999" }), x: common_vendor.o(openfaultreport), y: common_vendor.p({ border: true, ["label-width"]: 90 }), z: common_vendor.unref(scrollHeight) + "px", A: common_vendor.o(refresh), B: common_vendor.o(completebatter) }; }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bc6b3874"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/devops/changebatteries/changebatteries.js.map