var n = require("../../common/vendor.js"), t = require("../../enums/index.js"), o = require("../../data/index.js"), u = n.defineStore("app", { state: function () { return { token: "", openId: "", userId: "", userInfo: null, config: null, channelName: "", smsCountDown: 60, totalOrderNum: 0, showAgreementPopup: !1, }; }, getters: { nickName: function (n) { return n.userInfo ? n.userInfo.nickName : ""; }, avatar: function (n) { return n.userInfo ? n.userInfo.avatar : "/static/images/icon_avatar.png"; }, vip: function (n) { return n.userInfo ? n.userInfo.vip : t.RoleEnum.NORMAL; }, vipLimitTime: function (n) { return n.userInfo ? n.userInfo.vipLimitTime : ""; }, mobile: function (n) { return n.userInfo ? n.userInfo.mobile : ""; }, actionList: function (u) { if (!u.config) return []; var r = n._.concat( n._.map(u.config.product, function (n) { return n.product_id; }), t.ProductTypeEnum.OVERALL, t.ProductTypeEnum.VEHICLE_INFO ); return n._.filter(o.theActionList1, function (t) { return ( n._.findIndex(r, function (n) { return n === t.params.productType; }) > -1 ); }); }, insuranceMaintainProduct: function (o) { return o.config ? n._.assign( n._.find(o.config.product, function (n) { return n.product_id == t.ProductTypeEnum.INSURANCE_MAINTAIN; }), { product_name: "维保查询", product_desc: "了解车辆维修保养记录,掌握细节不吃亏", } ) : null; }, accidentProduct: function (o) { return o.config ? n._.assign( n._.find(o.config.product, function (n) { return n.product_id == t.ProductTypeEnum.ACCIDENT; }), { product_name: "出险查询", product_desc: "查询历史车况,杜绝事故车", } ) : null; }, vehicleFiveProduct: function (o) { return o.config ? n._.assign( n._.find(o.config.product, function (n) { return n.product_id == t.ProductTypeEnum.VEHICLE_FIVE; }), { product_name: "查车五项", product_desc: "精准查询车辆重要信息" } ) : null; }, saliProduct: function (o) { return o.config ? n._.assign( n._.find(o.config.product, function (n) { return n.product_id == t.ProductTypeEnum.SALI; }), { product_name: "交强险信息", product_desc: "根据车辆车架号,查车辆的保单号、保险公司等", } ) : null; }, saliCheckProduct: function (o) { return o.config ? n._.assign( n._.find(o.config.product, function (n) { return n.product_id == t.ProductTypeEnum.SALI_CHECK; }), { product_name: "交强险投保日期", product_desc: "查交强险保期、最近投保期始末", } ) : null; }, commercialInsuranceProduct: function (o) { return o.config ? n._.assign( n._.find(o.config.product, function (n) { return n.product_id == t.ProductTypeEnum.COMMERICAL_INSURANCE; }), { product_name: "商业险查询", product_desc: "根据车辆车架号,查车辆的保单号、保险公司等", } ) : null; }, violationProduct: function (o) { return o.config ? n._.assign( n._.find(o.config.product, function (n) { return n.product_id == t.ProductTypeEnum.VIOLATION; }), { product_name: "违章查询", product_desc: "车辆违章扣分、罚款查询", } ) : null; }, vehicleStatusProduct: function (o) { return o.config ? n._.assign( n._.find(o.config.product, function (n) { return n.product_id == t.ProductTypeEnum.VEHICLE_STATUS; }), { product_name: "查车辆状态", product_desc: "查询车辆是否查封、锁定、抵押等信息", } ) : null; }, payMethodList: function (n) { return n.config ? JSON.parse(n.config.pay_method) : []; }, }, actions: { setUserData: function (t) { var o = t.token, u = t.openId, r = t.userId, e = t.userInfo; n.index.setStorageSync("token", o), n.index.setStorageSync("openId", u), this.$patch({ token: o, openId: u, userId: r, userInfo: e }); }, setConfig: function (n) { var t = n.config; this.config = t; }, setChannelName: function (n) { var t = n.channelName; this.channelName = t; }, reduceSmsCountDown: function () { this.smsCountDown > 0 && this.smsCountDown--; }, resetSmsCountDown: function () { this.smsCountDown = 60; }, userLogout: function () { n.index.setStorageSync("token", ""), n.index.setStorageSync("openId", ""), this.$patch({ token: "", openId: "", userId: "", userInfo: null, totalOrderNum: 0, }); }, setTotalOrderNum: function (n) { var t = n.totalOrderNum; this.totalOrderNum = t; }, setAgreementPopupShow: function (n) { this.showAgreementPopup = n; }, }, }); exports.useAppStore = u;