"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_section2 = common_vendor.resolveComponent("uni-section"); const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card"); const _easycom_scanCode2 = common_vendor.resolveComponent("scanCode"); const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms"); const _easycom_uni_goods_nav2 = common_vendor.resolveComponent("uni-goods-nav"); (_easycom_bikeCodeScan2 + _easycom_uni_forms_item2 + _easycom_uni_section2 + _easycom_uni_card2 + _easycom_scanCode2 + _easycom_uni_forms2 + _easycom_uni_goods_nav2)(); } 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_section = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-section/uni-section.js"; const _easycom_uni_card = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.js"; const _easycom_scanCode = () => "../../../components/scanCode/scanCode.js"; const _easycom_uni_forms = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-forms/uni-forms.js"; const _easycom_uni_goods_nav = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-goods-nav/uni-goods-nav.js"; if (!Math) { (_easycom_bikeCodeScan + _easycom_uni_forms_item + _easycom_uni_section + _easycom_uni_card + _easycom_scanCode + _easycom_uni_forms + _easycom_uni_goods_nav)(); } const _sfc_main = { __name: "bindhelmet", setup(__props) { const bikeCode = common_vendor.ref(); const ebikeInfo = common_vendor.ref({ bikeId: "", bikeCode: "", helmetId: "", helmetCode: "", helmetExit: "", updatedAt: "" }); const newhelmetInfo = common_vendor.ref(null); const newhelmetCode = common_vendor.ref(""); const scrollHeight = common_vendor.ref(0); const userInfo = common_vendor.ref(null); const getBikeInfo = (res) => { bikeCode.value = res; const params = { bikeCode: res }; getDataInfo(params, (data) => { ebikeInfo.value = data; }); }; const navButtonGroup = [{ text: "确定绑定", backgroundColor: "rgb(0,120,212)", color: "#fff" }]; const refresh = () => { if (!checkscan()) { return; } getBikeInfo(bikeCode.value); }; const getHelmetInfo = (res) => { const params = { helmetCode: res }; getDataInfo(params, (data) => { newhelmetInfo.value = data; }); }; const btnBind = (index, content) => { if (!checkscan()) { return; } if (!newhelmetCode.value) { utils_tools.showModelMessage("请先扫头盔码或输入头盔码"); return false; } const params = { "bikeId": ebikeInfo.value.bikeId, "bikeCode": bikeCode.value, "nhelmetId": newhelmetInfo.value.helmetId, "ohelmetId": ebikeInfo.value.helmetId, "nhelmetCode": newhelmetInfo.value.helmetCode, "ohelmetCode": ebikeInfo.value.helmetCode, "helmetReign": ebikeInfo.value.helmetExit }; common_vendor.index.showModal({ title: "确认提交", content: "您确定要进行提交操作吗?", success: (res) => { if (res.confirm) { utils_api.callEbikeInfo("updateEbikeHelmet", params).then((res2) => { const { code, data, message } = res2; if (code == 200) { common_vendor.index.showToast({ title: "绑定成功", icon: "success", duration: 1e3, success: function() { setTimeout(function() { common_vendor.index.switchTab({ url: "/pages/mine/mine" }); }, 1e3); } }); } else { utils_tools.showModelMessage(message); } }); } else if (res.cancel) { common_vendor.index.__f__("log", "at pages/warehouse/bindhelmet/bindhelmet.vue:140", "用户取消出库"); } } }); }; const getDataInfo = (params, callback) => { utils_api.callEbikeInfo("getHelmetINfoData", params).then((res) => { const { code, data, message } = res; if (code == 200) { callback(data); } else { utils_tools.showModelMessage(message); } }); }; const checkscan = () => { if (!bikeCode.value) { utils_tools.showModelMessage("请先扫车辆码或输入车辆码"); return false; } if (!ebikeInfo.value.bikeId) { utils_tools.showModelMessage("车辆信息不存在"); return false; } return true; }; common_vendor.onLoad((options) => { userInfo.value = common_vendor.index.getStorageSync("userInfo"); const systemInfo = common_vendor.index.getSystemInfoSync(); const screenHeight = systemInfo.screenHeight; const statusBarHeight = systemInfo.statusBarHeight; scrollHeight.value = screenHeight - statusBarHeight - 130; }); return (_ctx, _cache) => { return { a: common_vendor.o(getBikeInfo), b: common_vendor.o(($event) => bikeCode.value = $event), c: common_vendor.p({ modelValue: bikeCode.value }), d: common_vendor.p({ label: "车辆编号:" }), e: common_vendor.t(ebikeInfo.value.helmetCode), f: common_vendor.p({ label: "原头盔编号:" }), g: common_vendor.t(ebikeInfo.value.helmetExit), h: common_vendor.p({ label: "头盔在位:" }), i: common_vendor.t(ebikeInfo.value.updatedAt), j: common_vendor.p({ label: "更新时间:" }), k: common_vendor.o(refresh), l: common_vendor.p({ title: "车辆", type: "line" }), m: common_vendor.o(getHelmetInfo), n: common_vendor.o(($event) => newhelmetCode.value = $event), o: common_vendor.p({ modelValue: newhelmetCode.value }), p: common_vendor.p({ label: "新头盔编号", name: "newtkbh" }), q: common_vendor.p({ title: "头盔", type: "line" }), r: common_vendor.p({ ["label-width"]: 90 }), s: common_vendor.o(btnBind), t: common_vendor.p({ fill: true, options: [], buttonGroup: navButtonGroup }) }; }; } }; wx.createPage(_sfc_main); //# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/warehouse/bindhelmet/bindhelmet.js.map