123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598 |
- import plateNumber from '@/components/plate-number/plateNumber.vue';
- import { REG_SOURCE } from '@/constants';
- import LoginDom from '@/components/Login/Login.vue';
- import { mapState } from 'vuex';
- const app = {
- globalData: {
- regSource: '',
- },
- };
- import uni from '@/utils/uniHooks';
- // import blueCom from '../components/blue/home.vue';
- // import greenCom from '../components/green/home.vue';
- // import officeBlueCom from '../components/officeBlue/home.vue';
- // import purpleCom from '../components/purple/home.vue';
- import { parkingLots, checkOut } from '@/api/parking';
- export default {
- components: {
- plateNumber,
- LoginDom,
- // blueCom,
- // greenCom,
- // officeBlueCom,
- // purpleCom,
- },
- data() {
- return {
- vehicleMgt_content_index: -1, //历史车辆选中
- carType: 0, //车辆类型
- init_ch: false, // 字体超出隐藏显示
- search_price: false, //查询按钮隐藏显示
- parkInfoEntity: {},
- show_chinese: false, //是否显示汉字键盘
- show_allBoard: false, //是否显示英文数字键盘
- plate_number: '', //车牌号
- description: '', // 车场描述
- ind: null,
- numArr: ['', '', '', '', '', '', ''],
- active: null,
- carList: [], // 车辆列表
- classifyList: ['燃油车牌', '新能源', '特殊车牌'], // 车牌类型
- vehicleNumber: '',
- localimgPic: '',
- hourMoney: '',
- showSq: false,
- blueHeadBg: 'parkingFee/fee-head-bg.png',
- picUrl: this.$picUrl,
- colorAry: ['', '-blue', '-green'],
- openId: null,
- options: null,
- preUrl: '',
- // custTypeId: 0,
- };
- },
- computed: {
- disabledBtn() {
- return this.numArr.findIndex((val) => !val) !== -1;
- },
- ...mapState({
- groupId: (state) => state.groupId,
- openid: (state) => state.openid,
- mallId: (state) => state.mallId,
- kipUserId: (state) => state.kipUserId,
- userInfo: (state) => state.userInfo,
- member: (state) => state.member,
- mobile: (state) => state.mobile,
- custTypeId: (state) => state.custTypeId,
- }),
- },
- beforeRouteLeave(to, from, next) {
- this.$store.commit('cachedViews/DEL_CACHED_VIEW', to);
- next();
- },
- watch: {
- userInfo() {
- this.initPage();
- },
- openid() {
- if (this.openid) {
- this.getParkInfo();
- this.showSq = false;
- }
- },
- },
- async created(params) {},
- mounted() {
- setTimeout(() => {
- uni.setNavigationBarTitle({
- title: '停车缴费',
- });
- }, 300);
- if (this.openid) {
- console.log(939393939393);
- this.getParkInfo();
- this.showSq = false;
- } else {
- const regSource = REG_SOURCE.PARKING;
- app.globalData.regSource = regSource;
- if (this.options?.regSource) {
- app.globalData.regSource = REG_SOURCE[this.options?.regSource];
- }
- if (this.options?.tpName) {
- app.globalData.tpName = this.options?.tpName;
- }
- this.showSq = true;
- }
- },
- methods: {
- async initPage() {
- // ws()
- console.time('time');
- const name = {
- a: 'label',
- c: 'label',
- };
- // const nameD = Encrypt(JSON.stringify(name))
- // this.options = params;
- // await this.$onLaunched;
- this.localimgPic = this.$staticPicUrl + '/wxminilocalimg/parkingFee/';
- // app.globalData.pullVipcode = params.pullVipcode || '';
- // app.globalData.mallid = params.mallid || app.globalData.mallid
- if (this.userInfo) {
- // this.getParkInfo();
- return;
- // app.globalData.isNewMember = '';
- // 场景二维码记录(是否扫码进入)
- // app.globalData.paramsScene = {};
- // this.$saveSceneQrcodeDetail(
- // 'page',
- // 'parkingFee',
- // '停车缴费',
- // '',
- // '',
- // '',
- // ''
- // );
- }
- // 埋点本地化
- this.preUrl = uni.getStorageSync('previousUrl');
- uni.setStorageSync('previousUrl', '/pages/parkingFee/home.vue');
- },
- toggleType(carType) {
- this.ind = 0;
- this.active = 0;
- this.carType = carType;
- if (carType === 1) {
- this.numArr = [
- this.numArr[0],
- this.numArr[1],
- this.numArr[2],
- this.numArr[3],
- this.numArr[4],
- this.numArr[5],
- this.numArr[6],
- this.numArr[7],
- ];
- } else {
- this.numArr = [
- this.numArr[0],
- this.numArr[1],
- this.numArr[2],
- this.numArr[3],
- this.numArr[4],
- this.numArr[5],
- this.numArr[6],
- ];
- }
- },
- // 获取停车场信息
- getParkInfo: async function () {
- uni.showLoading({
- title: '加载中',
- });
- const openid = uni.getStorageSync('openid') || this.openId;
- /*let params = {
- // mallid: '8a84853b7c91ac5b017c961a9b2a030d',
- // groupId: '8a84853b7c91ac5b017c962dab55030e',
- mallid: this.mallId,
- groupId: this.groupId,
- openid: openid,
- vipcode: this.member?.vipcode,
- };
- console.log(342, params);
- this.$md(params);
- this.$request({
- url: this.$baseURL + 'api/1.0/park/parkInfo',
- data: params,
- method: 'POST',
- header: JSON.parse(uni.getStorageSync('handleUser')),
- })
- .then((res) => {
- if (res.data.code === 0) {
- const data = res.data.data || {};
- this.carList = data.carList;
- this.parkInfoEntity = data.parkInfoEntity;
- this.hourMoney =
- parseFloat(this.parkInfoEntity.needmoney) /
- parseFloat(this.parkInfoEntity.tohours);
- let reg = /[;;]/g;
- this.parkInfoEntity.payinstruction =
- this.parkInfoEntity.payinstruction.replace(reg, '\r\n');
- this.parkInfoEntity.hourMoney = this.hourMoney;
- uni.setStorageSync('parkinfo', JSON.stringify(this.parkInfoEntity));
- } else {
- uni.showToast({
- title: res.data.msg,
- duration: 2000,
- icon: 'none',
- });
- }
- })
- .catch((err) => {
- uni.showToast({
- title: '网络超时请稍后再试',
- duration: 2000,
- icon: 'none',
- });
- console.log(err);
- });*/
- try {
- const res = await parkingLots();
- console.log('223,2323', res);
- const data = {
- "parkName": "杭州停车场",
- "parkCode": "hz01",
- "carList": [],
- "description": "计费基础规则:10元每小时,上不封顶 ;\n线上缴费渠道:CRM小程序 (分会员通道及非会员通道);1\n会员等级减免:铂金卡当日可免费停车4小时,金卡当时可免费停车2小时,银卡无减免 (当日仅限使用1次,可与其它减免共享);\n积分抵扣:1000积分抵扣10元(手动输入抵扣积分);\n消费减免:消费200元可减免2小时,消费400元可减免4小时,消费800元可减免6小时 。仅限会员,当日有效,当日可多次享受该减免,当日最多可享受消费减免6小时。;\n 消费减免举例:;\n (1) 某顾客第一次进场,消费230元 离场时可看到减免2小时的选项,默认为选中;\n (2) 如果顾客未使用减免,顾客第二次进场,消费+270 离场时可看到减免金额提高到4小时;\n 如果顾客使用减免:顾客第二次进场,消费+270 离场时可看到还是只能减免2小时;\n (3) CRM小程序缴费页面停留时长1分钟,1分钟后自动刷新获取最新缴费金额;\n纸质优惠券核销: 顾客在CRM小程序手动扫码获取优惠券金额;\n会员活动及积分兑换优惠 :通过CRM系统获取(详细情况由CRM另行描述)!"
- }
- // let reg = /[;;]/g;
- // this.parkInfoEntity.description = data.description.replace(reg, '\r\n');
- this.description = data.description;
- // const data = res.data.data || {};
- this.carList = data.carList;
- // this.parkInfoEntity = data.parkInfoEntity;
- // this.hourMoney =
- // parseFloat(this.parkInfoEntity.needmoney) /
- // parseFloat(this.parkInfoEntity.tohours);
- // let reg = /[;;]/g;
- // this.parkInfoEntity.payinstruction =
- // this.parkInfoEntity.payinstruction.replace(reg, '\r\n');
- // this.parkInfoEntity.hourMoney = this.hourMoney;
- // uni.setStorageSync('parkinfo', JSON.stringify(this.parkInfoEntity));
- // console.log(233, res);
- } catch (e) {
- console.log(225225, e);
- }
- // return;
- // const data = res.data || {};
- // this.carList = data.carList;
- // this.parkInfoEntity = data.parkInfoEntity;
- // this.hourMoney =
- // parseFloat(this.parkInfoEntity.needmoney) /
- // parseFloat(this.parkInfoEntity.tohours);
- // let reg = /[;;]/g;
- // this.parkInfoEntity.payinstruction =
- // this.parkInfoEntity.payinstruction.replace(reg, '\r\n');
- // this.parkInfoEntity.hourMoney = this.hourMoney;
- // uni.setStorageSync('parkinfo', JSON.stringify(this.parkInfoEntity));
- },
- //缴费说明隐藏显示
- top_display() {
- this.init_ch = !this.init_ch;
- // 缴费说明展开/收起埋点(增加动作参数)
- this.sensorsClick('$ClickExpandPaymentInstructions', {
- action: this.init_ch ? 'open' : 'close',
- redirect_url: '',
- cta_itemno: '',
- cta_name: '',
- });
- },
- // 埋点方法
- sensorsClick(eventName, params) {
- let optionsQuery = uni.getStorageSync('options_query');
- let fixedParams = {
- previous_url: this.preUrl || '',
- // 原previous_url: uni.getStorageSync('previousUrl') || ''
- // previous_url: 使用sdk预置参数$referrer,
- $brand_id: uni.getStorageSync('groupId'),
- $location: uni.getStorageSync('mallid'),
- $channel: optionsQuery?.channel || '',
- // $utm_lbs: this.optionsQuery.utm_lbs || '',
- $utm_channel: optionsQuery?.utm_channel || '',
- $utm_method: optionsQuery?.utm_method || '',
- $utm_source: optionsQuery?.utm_source || '',
- $utm_function: optionsQuery?.utm_function || '',
- $utm_user: optionsQuery?.utm_user || '',
- },
- finalParams = Object.assign(fixedParams, params);
- this.$sensors.track(eventName, finalParams);
- },
- // 唤起键盘
- clickShowKeyboard(index) {
- this.ind = index;
- this.active = index;
- if (index === 0) {
- this.$refs['plateKeyboard'].openKeyboardCN();
- } else {
- this.$refs['plateKeyboard'].closeKeyboardCN();
- this.$refs['plateKeyboard'].openKeyboardEN();
- }
- },
- // 接收子组件数据
- updateCarno(val) {
- this.numArr = val.numArr;
- this.vehicleNumber = this.numArr.join('');
- this.active = val.active;
- this.ind = val.ind;
- },
- // 节流函数
- throttle(fc, waitTime = 500, imme = true) {
- if (imme) {
- if (!this.flag) {
- this.flag = true;
- typeof fc === 'function' && fc();
- this.timer = setTimeout(() => {
- this.flag = false;
- }, waitTime);
- }
- } else {
- if (!this.flag) {
- this.flag = true;
- this.timer = setTimeout(() => {
- this.flag = false;
- typeof fc === 'function' && fc();
- }, waitTime);
- }
- }
- },
- // 校验车牌号
- preHandleSearch() {
- this.throttle(() => {
- this.handleSearch(this.vehicleNumber);
- }, 3000);
- },
- // 历史车牌快速查询
- toHandleSearch(carno) {
- this.throttle(() => {
- this.handleSearch(carno, '$ClickHistoryAndPayment');
- }, 3000);
- },
- // 查询车费信息
- async handleSearch(carno, clickEvent = '$ClickQueryAndPayment') {
- this.vehicleNumber = carno;
- const params = {
- carno,
- mallid: this.mallId,
- openid: this.openid,
- vipcode: this.member?.vipcode,
- mobile: this.mobile,
- groupId: this.groupId,
- createuser: 'sys_miniprogram',
- };
- // 查询缴费按钮埋点
- let [carTypeName, redirectUrl, parkTime] = ['ordinary', '', ''];
- switch (this.carType) {
- case 0:
- carTypeName = 'ordinary';
- break;
- case 1:
- carTypeName = 'newEnergy';
- break;
- case 2:
- carTypeName = 'special';
- break;
- }
- // this.sensorsClick(clickEvent, { $car_type: carTypeName })
- // TODO: 暂定埋点传参为车牌类型,是否需要其他参数比如车牌号码;埋点位置是否要放在查询接口回调函数中
- this.$md(params);
- console.log(539, uni.getStorageSync('handleUser'));
- try {
- const res = await checkOut(carno)
- console.log(res)
- } catch ( err ) {
- console.log('errerrerrerr',err)
- }
- return
- this.$request({
- // url: this.$baseURL + 'api/1.0/park/checkCarIsInPark',
- url: this.$baseURL + 'api/1.0/park/checkCarIsInParkAndCarFee',
- // url: 'http://172.21.90.87:8083/xcrm-api/api/1.0/park/checkCarIsInParkAndCarFee',
- data: params,
- method: 'POST',
- header: JSON.parse(uni.getStorageSync('handleUser')),
- timeout: 60000 * 2, // 120S
- showLoading: {
- title: '加载中',
- duration: 0,
- },
- })
- .then((res) => {
- // console.log(555555, res);
- // ToastObj.clear();
- // uni.hideLoading();
- if (res.data.code === 0) {
- // 清理旧数据
- this.parkingFeeDetailInit();
- uni.setStorageSync('isReload', '3');
- // this.$destroy();
- this.$router.push({
- path: 'parkingFeeDetail',
- query: {
- carno,
- },
- });
- parkTime = res.data?.data?.serviceMin;
- redirectUrl = '/pages/parkingFee/parkingFeeDetail.vue';
- } else if (res.data.code === 1) {
- // 当前车辆没有查到账单
- this.$router.push({
- path: 'parkingFeePayment',
- query: {
- msg: res.data.msg,
- carno,
- },
- });
- redirectUrl = '/pages/parkingFee/parkingFeePayment.vue';
- } else if (res.data.code === 2) {
- // 月租车
- this.$router.push({
- path: './parkingFeeHint/parkingFeeHint',
- query: {
- carno,
- },
- });
- redirectUrl = '/pages/parkingFee/parkingFeeHint/parkingFeeHint.vue';
- } else {
- uni.showToast({
- title: res.data.msg,
- duration: 2000,
- icon: 'none',
- });
- }
- this.sensorsClick(clickEvent, {
- car_type: carTypeName,
- redirect_url: redirectUrl,
- time: parkTime,
- cta_itemno: '',
- cta_name: '',
- });
- })
- .catch((err) => {
- // uni.hideLoading();
- uni.showToast({
- title: '网络超时请稍后再试',
- duration: 2000,
- icon: 'none',
- });
- console.log(err);
- });
- },
- // 页面初始清空缓存
- parkingFeeDetailInit() {
- console.log('清理数据');
- // 优惠减免(首停、会员、消费)
- uni.removeStorageSync('checkedList'); // 选中list
- uni.removeStorageSync('checkedTotal'); // 选中count数
- uni.removeStorageSync('discountTotal'); // 减免信息(时长、费用)
- // 停车减免(优惠、积分、停车券)
- uni.removeStorageSync('parkFee');
- // 电子券优惠信息
- uni.removeStorageSync('checkedCouponList'); // 选中list
- uni.removeStorageSync('couponInfo'); // 减免信息(时长、费用)
- uni.removeStorageSync('list'); // 电子券list
- // 总停车优惠信息(时长、费用)
- uni.removeStorageSync('parkingTotal');
- // 应缴金额
- uni.removeStorageSync('servicefee');
- // 订单号
- uni.removeStorageSync('orderno');
- // 纸质优惠券
- uni.removeStorageSync('paperCouponInfo');
- // uni.removeStorageSync('isReload');
- },
- // 车牌号校验
- // isVehicleNumber(vehicleNumber) {
- // if (vehicleNumber.length == 7) {
- // this.vehicleNumber = vehicleNumber.join('')
- // var express =
- // /^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$/;
- // if (!express.test(this.vehicleNumber)) {
- // uni.showToast({
- // title: '请输入正确的车牌号',
- // duration: 2000,
- // icon: 'none'
- // })
- // return false
- // }
- // return true
- // }
- // if (vehicleNumber.length == 8) {
- // this.vehicleNumber = vehicleNumber.join('')
- // var express =
- // /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[a-zA-Z](([DF]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[DF]))|[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1})$/;
- // if (!express.test(this.vehicleNumber)) {
- // uni.showToast({
- // title: '请输入正确的车牌号',
- // duration: 2000,
- // icon: 'none'
- // })
- // return false
- // }
- // return true
- // }
- // },
- // 缴费记录
- doRouter: function () {
- if (this.$store.state.isLogin === '3') {
- this.$router.push({ path: 'login' });
- return;
- }
- this.$router.push({ path: 'parkingFeeList' });
- this.sensorsClick('$ClickParkRouter', {
- cta_itemno: '',
- cta_name: '缴费记录',
- redirect_url: '/pages/parkingFee/parkingFeeList.vue',
- });
- },
- // 车牌管理
- doRouter2: function () {
- if (this.$store.state.isLogin === '3') {
- this.$router.push({ path: 'login' });
- return;
- }
- uni.removeStorageSync('passLogin');
- this.$router.push({ path: 'vehicleManagement' });
- this.sensorsClick('$ClickParkRouter', {
- cta_itemno: '',
- cta_name: '车牌管理',
- redirect_url: '/pages/parkingFee/vehicleManagement.vue',
- });
- },
- //停车发票
- doRouter1: function () {
- if (this.$store.state.isLogin === '3') {
- this.$router.push({ path: 'login' });
- return;
- }
- // uni.removeStorageSync('passLogin');
- // 北京停车场开票
- // if (this.parkInfoEntity.parkMallCode === 3) {
- // uni.navigateToMiniProgram({
- // appId: this.$etcpAppId,
- // path: this.$etcpAppInvoicePath,
- // envVersion: 'release',
- // })
- // return
- // }
- // this.$router.push({
- // path: './parkingReceipt/parkingReceipt',
- // })
- if (this.$store.state.passLogin) {
- }
- this.$router.push({ path: 'parkingReceipt' });
- this.sensorsClick('$ClickParkRouter', {
- cta_itemno: '',
- cta_name: '停车发票',
- redirect_url: '/pages/parkingFee/parkingReceipt/parkingReceipt.vue',
- });
- },
- //停车券兑换
- doRouter3: function () {
- // this.$router.push({
- // path: '/pages/pointsMall/pointsMall?exchangeTypes=2',
- // })
- // TODO 跳转到crm的积分商城
- // this.$router.push({ path: 'pointsMall?exchangeTypes=2' });
- // this.sensorsClick('$ClickParkRouter', {
- // cta_itemno: '',
- // cta_name: '停车券兑换',
- // redirect_url: '/pages/pointsMall/pointsMall.vue',
- // });
- // uni.navigateTo({
- // url: '/pages/pointsMall/pointsMall?exchangeTypes=2',
- // })
- window.toWXSendMsg({
- type: 'toPage',
- options: {
- fnName: 'navigateTo',
- url: '/pages/pointsMall/pointsMall?exchangeTypes=2',
- },
- });
- },
- blueComChange(value) {
- console.log('blueComChange', value);
- },
- },
- };
|