From 1f0d01e0f07f9d833207104ebc24db747f2664a8 Mon Sep 17 00:00:00 2001 From: chenrx Date: Wed, 29 May 2024 21:22:20 +0800 Subject: [PATCH] 20240529 --- app.json | 20 +- commons/js/config.js | 141 ++--- commons/js/utils/apiQuery.js | 28 + commons/js/utils/httpRequest.js | 75 +-- commons/js/utils/stringEncrypt.js | 2 +- pages/customer/detail/index.wxml | 4 +- pages/login/index.wxml | 2 +- pages/order/register/index.js | 972 +++++++++++++----------------- pages/signup/code.js | 59 +- pages/signup/code.wxml | 21 +- pages/signup/index.js | 141 +++-- pages/signup/index.wxml | 15 +- pages/signup/index.wxss | 12 + pages/signup/status.js | 7 +- pages/signup/status.wxml | 13 +- pages/signup/status.wxss | 3 - project.config.json | 2 +- project.private.config.json | 7 + 18 files changed, 747 insertions(+), 777 deletions(-) diff --git a/app.json b/app.json index 8fa9c05..d69c339 100644 --- a/app.json +++ b/app.json @@ -70,14 +70,17 @@ "pages/clues/index", "pages/clues/detail/index" ], - "echarts": [ - { - "root": "ecCanvas", - "pages": [ - "pages/index/index" - ] + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序打卡签到" } - ], + }, + "echarts": [{ + "root": "ecCanvas", + "pages": [ + "pages/index/index" + ] + }], "window": { "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#fff", @@ -96,8 +99,7 @@ "lcb-backChannel": "/components/backChannel/index", "kefuSuccess": "/components/kefuSuccess/index" }, - "plugins": { - }, + "plugins": {}, "navigateToMiniProgramAppIdList": [ "wx98e64c11aac45966" ] diff --git a/commons/js/config.js b/commons/js/config.js index ccbb830..783a387 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -2,10 +2,10 @@ const env = "d"; const version = 1, -//理车宝 -app_id = '1c156bb57cd6984a' + - '', -key = '71fd71173b776766a2ae1209d9a2c2ed'; + //理车宝 + app_id = '1c156bb57cd6984a' + + '', + key = '71fd71173b776766a2ae1209d9a2c2ed'; //好店云 // app_id = 'ebb6d3808b2fa324', @@ -26,6 +26,7 @@ api = { appUserUkey: "app/user/ukey", //登录/退出登录 appUser: "app/user", //用户信息 appSms: "app/sms", //获取验证码 + appUserTel: "app/user/tel", //获取用户手机号 appSeriesCars: "app/series/cars", //获取车型库 appSeriesAttrs: "app/series/attrs", //获取车型属性 appCustomersTabs: "app/customers/tabs", //获取tab @@ -87,92 +88,96 @@ api = { materialStatisticsChart: 'material/statistics/chart', //数据分析_图表 appCusorder2: 'app/cusorder2', //新建订单(新)/修改订单信息 - + appCustomersDefeats: 'app/customers/defeats', //战败客户列表 /战败/再战申请 - appServices:'app/services', //获取代办服务列表 - appFine:'app/fine', //获取精品赠送列表 /获取精品选装 + appServices: 'app/services', //获取代办服务列表 + appFine: 'app/fine', //获取精品赠送列表 /获取精品选装 - materialHomeBiz:'material/home/biz', //店铺海报 - materialHomePosters:'material/home/posters', //保存店铺海报 + materialHomeBiz: 'material/home/biz', //店铺海报 + materialHomePosters: 'material/home/posters', //保存店铺海报 - appDelivery:'app/delivery', //获取车辆确定随车资料 + appDelivery: 'app/delivery', //获取车辆确定随车资料 - materialHomeBiz_posters:'material/home/biz_posters', //店铺海报模版 + materialHomeBiz_posters: 'material/home/biz_posters', //店铺海报模版 - appTransferLists:'app/transfer/lists', //调拨记录 - appTransfer:'app/transfer', //调拨详情 /确认发车/接车 /报备异常 - appTransferRemind:'app/transfer/remind', //调拨提醒 + appTransferLists: 'app/transfer/lists', //调拨记录 + appTransfer: 'app/transfer', //调拨详情 /确认发车/接车 /报备异常 + appTransferRemind: 'app/transfer/remind', //调拨提醒 - appCusorderCdata:'app/cusorder/cdata', //上传资料 + appCusorderCdata: 'app/cusorder/cdata', //上传资料 - appBrokerageOrders:'app/brokerage/orders', //转介绍列表 - appBrokerage:'app/brokerage', //获取佣金设置 /更新佣金设置 /创建佣金设置 - - appTransferTabs:'app/transfer/tabs', //调拨记录_tab - appTransferTransport:'app/transfer/transport', //上传运输单 + appBrokerageOrders: 'app/brokerage/orders', //转介绍列表 + appBrokerage: 'app/brokerage', //获取佣金设置 /更新佣金设置 /创建佣金设置 - appBizSituation_tabs:'app/biz/situation_tabs', //店铺概况_tab - appBizSituation:'app/biz/situation', //店铺概况 /店铺概况保存 - appBizStreet:'app/biz/street', //获取乡镇 - - appCusorderV2Inten:'app/cusorderV2/inten', //新增意向金订单 - appCusorderV2:'app/cusorderV2', //新建订单 /获取订单列表 /订单详情 /修改订单信息 - appCusorderV2Tabs:'app/cusorderV2/tabs', //获取订单列表tab - appCusorderdata:'app/Cusorderdata', //获取订单图片 /上传编辑国补资料 - appCusorderV2Info:'app/cusorderV2/info', //修改订单基本信息 - appCusorderV2Status:'app/cusorderV2/status', //删除订单 + appTransferTabs: 'app/transfer/tabs', //调拨记录_tab + appTransferTransport: 'app/transfer/transport', //上传运输单 - appSytactivityTabs:'app/sytactivity/tabs', //私域通_tab - appSytactivityList:'app/sytactivity/list', //活动列表 - appSytactivityDetail:'app/sytactivity/detail', //活动详情 - appSytactivityLog:'app/sytactivity/log', //实时战报 - appSytactivityRanking:'app/sytactivity/ranking', //活动排名 + appBizSituation_tabs: 'app/biz/situation_tabs', //店铺概况_tab + appBizSituation: 'app/biz/situation', //店铺概况 /店铺概况保存 + appBizStreet: 'app/biz/street', //获取乡镇 - appInventoryTabs:'app/inventory/tabs', //盘点记录_tab - appInventoryLists:'app/inventory/lists', //盘点记录 - appInventory:'app/inventory', //盘点详情 /盘点上传图片 - appInventoryRemind:'app/inventory/remind', //盘点提醒 + appCusorderV2Inten: 'app/cusorderV2/inten', //新增意向金订单 + appCusorderV2: 'app/cusorderV2', //新建订单 /获取订单列表 /订单详情 /修改订单信息 + appCusorderV2Tabs: 'app/cusorderV2/tabs', //获取订单列表tab + appCusorderdata: 'app/Cusorderdata', //获取订单图片 /上传编辑国补资料 + appCusorderV2Info: 'app/cusorderV2/info', //修改订单基本信息 + appCusorderV2Status: 'app/cusorderV2/status', //删除订单 - appGoodsRemind:'app/goods/remind', //库存提醒/预警 - appGoodsLists:'app/goods/lists', //库存列表 + appSytactivityTabs: 'app/sytactivity/tabs', //私域通_tab + appSytactivityList: 'app/sytactivity/list', //活动列表 + appSytactivityDetail: 'app/sytactivity/detail', //活动详情 + appSytactivityLog: 'app/sytactivity/log', //实时战报 + appSytactivityRanking: 'app/sytactivity/ranking', //活动排名 - appCustomersOffline_sources:'app/customers/offline_sources', //客户来源 - appCustomersTag:'app/customers/tag', //客户标签 + appInventoryTabs: 'app/inventory/tabs', //盘点记录_tab + appInventoryLists: 'app/inventory/lists', //盘点记录 + appInventory: 'app/inventory', //盘点详情 /盘点上传图片 + appInventoryRemind: 'app/inventory/remind', //盘点提醒 - appCityOncard:'app/city/oncard', //获取上牌城市 - appFinanceNums:'app/finance/nums', //获取金融分期期数 + appGoodsRemind: 'app/goods/remind', //库存提醒/预警 + appGoodsLists: 'app/goods/lists', //库存列表 - appCusorderV2Customer:'app/cusorderV2/customer', //获取客户订单 + appCustomersOffline_sources: 'app/customers/offline_sources', //客户来源 + appCustomersTag: 'app/customers/tag', //客户标签 - appCustomersVisit_tabs:'app/customers/visit_tabs', //回访待跟进tab + appCityOncard: 'app/city/oncard', //获取上牌城市 + appFinanceNums: 'app/finance/nums', //获取金融分期期数 - appIdcardInfo:'app/idcard/info', //识别身份证号码 + appCusorderV2Customer: 'app/cusorderV2/customer', //获取客户订单 - appCustomersComments:'app/customers/comments', //用户评论 + appCustomersVisit_tabs: 'app/customers/visit_tabs', //回访待跟进tab - appCityArea:'app/city/area', //获取省/市/区/街道 + appIdcardInfo: 'app/idcard/info', //识别身份证号码 - appEmployeesLeave:'app/employees/leave', //获取离职 //提交离职 + appCustomersComments: 'app/customers/comments', //用户评论 - appCusorderV2Admins:'app/cusorderV2/admins', //分配订单 + appCityArea: 'app/city/area', //获取省/市/区/街道 - appCusorderdataInfo:'app/cusorderdata/info', //保单信息确认 + appEmployeesLeave: 'app/employees/leave', //获取离职 //提交离职 - appBizStats:'app/biz/stats', //数据看板首页 - appBizStats_customer:'app/biz/stats_customer', //客户数据 - appBizStats_wxqy:'app/biz/stats_wxqy', //企微数据 - appBizStats_order:'app/biz/stats_order', //订单数据 - appBizStats_days:'app/biz/stats_days', //客户/订单走势图 - appBizStats_customer_pid:'app/biz/stats_customer_pid', //客户数据二级 - appBizStats_order_series:'app/biz/stats_order_series', //品牌数据二级 + appCusorderV2Admins: 'app/cusorderV2/admins', //分配订单 - appOptions:'app/options', //获取车辆选装包 + appCusorderdataInfo: 'app/cusorderdata/info', //保单信息确认 - appResetgroupid:'app/user/resetgroupid', //切换角色 + appBizStats: 'app/biz/stats', //数据看板首页 + appBizStats_customer: 'app/biz/stats_customer', //客户数据 + appBizStats_wxqy: 'app/biz/stats_wxqy', //企微数据 + appBizStats_order: 'app/biz/stats_order', //订单数据 + appBizStats_days: 'app/biz/stats_days', //客户/订单走势图 + appBizStats_customer_pid: 'app/biz/stats_customer_pid', //客户数据二级 + appBizStats_order_series: 'app/biz/stats_order_series', //品牌数据二级 + + appOptions: 'app/options', //获取车辆选装包 + + appResetgroupid: 'app/user/resetgroupid', //切换角色 appClues: "app/clues", //获取线索列表 获取线索详情 appCluesLogs: "app/clueslogs", //线索日志 + + appSignConf: "app/sign/conf", //签到配置信息 + appUserConf: "app/sign/userConf", //用户签到配置信息 + appSign: "app/sign", //用户签到 } //远程图片存储地址 @@ -192,17 +197,17 @@ var elementScrollTop = '150' /** * 提醒模板id -*/ -var bookTmpId ='zT5wqntUU0ipSJY7Hlw4T4lKfWwTddn3tv8udUv-rdo' + */ +var bookTmpId = 'zT5wqntUU0ipSJY7Hlw4T4lKfWwTddn3tv8udUv-rdo' /** * 开奖模板id -*/ + */ var getLotteryTmpId = '5Lv1DATQLG23omDhIA8DS2ZBM6zU9prvt94BO7S9exc' /** * 模板id -*/ + */ var subscribeTmpId = { book: 'zT5wqntUU0ipSJY7Hlw4T4lKfWwTddn3tv8udUv-rdo', getlottery: '5Lv1DATQLG23omDhIA8DS2ZBM6zU9prvt94BO7S9exc' @@ -210,9 +215,9 @@ var subscribeTmpId = { /** * 接口白名单 -*/ + */ var white401UrlList = { - 'app/home/qrcode':'app/home/qrcode' + 'app/home/qrcode': 'app/home/qrcode' } /** diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js index e94a572..b128031 100644 --- a/commons/js/utils/apiQuery.js +++ b/commons/js/utils/apiQuery.js @@ -1006,4 +1006,32 @@ apiQuery.getAppCluesLogs = function (params) { HttpRequest(true, Config.api.appCluesLogs, 2, params, "GET", resolve, reject) }) } + +//获取签到配置信息 +apiQuery.getappSignConf = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(true, Config.api.appSignConf, 2, params, "GET", resolve, reject) + }) +} + +//获取用户签到配置信息 +apiQuery.getappUserConf = function (params) { + return new Promise(function (resolve, reject) { + HttpNoUkeyRequest(false, Config.api.appUserConf, 2, params, "GET", resolve, reject) + }) +} + +//获取签到配置信息 +apiQuery.getappUserTel = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(true, Config.api.appUserTel, 2, params, "GET", resolve, reject) + }) +} +//用户签到 +apiQuery.postAppSign = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appSign, 2, params, "POST", resolve, reject) + }) +} + export default apiQuery; \ No newline at end of file diff --git a/commons/js/utils/httpRequest.js b/commons/js/utils/httpRequest.js index 3249eae..21146b4 100644 --- a/commons/js/utils/httpRequest.js +++ b/commons/js/utils/httpRequest.js @@ -1,6 +1,8 @@ - import Config from '../config'; -import { toEncrypt, randomString } from 'stringEncrypt'; +import { + toEncrypt, + randomString +} from 'stringEncrypt'; let app = getApp(); function HttpNoUkeyRequest(loading, url, sessionChoose, params, method, callBack, reject) { @@ -10,8 +12,8 @@ function HttpNoUkeyRequest(loading, url, sessionChoose, params, method, callBack let paramSession = sessionChoose == 1 ? { 'content-type': 'application/x-www-form-urlencoded' } : { - 'content-type': 'application/json' - }; + 'content-type': 'application/json' + }; var params = Object.prototype.toString.call(params) == "[object Object]" ? params : {}; params["version"] = Config.version; params["nonce_str"] = randomString(); @@ -45,7 +47,7 @@ function HttpNoUkeyRequest(loading, url, sessionChoose, params, method, callBack } else { app.printErrorClient('failrequest', ['api地址:' + url, '传入数据:' + JSON.stringify(serectParams), '响应数据:' + JSON.stringify(res.data)]) reject(res.data); - if (Config.white401UrlList[url] === url) {//接口白名单 + if (Config.white401UrlList[url] === url) { //接口白名单 return } wx.showToast({ @@ -75,8 +77,8 @@ function HttpRequest(loading, url, sessionChoose, params, method, callBack, reje let paramSession = sessionChoose == 1 ? { 'content-type': 'application/x-www-form-urlencoded' } : { - 'content-type': 'application/json' - }; + 'content-type': 'application/json' + }; var params = Object.prototype.toString.call(params) == "[object Object]" ? params : {}; params["ukey"] = ukey; params["version"] = Config.version; @@ -104,21 +106,21 @@ function HttpRequest(loading, url, sessionChoose, params, method, callBack, reje // HttpRequest(loading, url, sessionChoose, params, method, callBack, reject) // }) //if (getCurrentPages().pop().route != 'pages/login/index'){ - wx.clearStorage() - wx.reLaunch({ - url: '/pages/login/index' - }) + wx.clearStorage() + wx.reLaunch({ + url: '/pages/login/index' + }) //} - }else{ - if (res.data.code==200){ + } else { + if (res.data.code == 200) { callBack(res.data); - }else{ - app.printErrorClient('failrequest',['api地址:'+url,'传入数据:'+JSON.stringify(serectParams),'响应数据:'+JSON.stringify(res.data)]) + } else { + app.printErrorClient('failrequest', ['api地址:' + url, '传入数据:' + JSON.stringify(serectParams), '响应数据:' + JSON.stringify(res.data)]) reject(res.data); - if (Config.white401UrlList[url] === url) {//接口白名单 + if (Config.white401UrlList[url] === url) { //接口白名单 return } - if(res.data.msg){ + if (res.data.msg) { wx.showToast({ title: res.data.msg, icon: "none" @@ -129,7 +131,7 @@ function HttpRequest(loading, url, sessionChoose, params, method, callBack, reje }, fail: function (res) { console.warn("HttpRequst当中wx.request fail 执行了:调用失败") - app.printErrorClient('failrequest',['HttpRequst当中wx.request fail 执行了:调用失败','api地址:'+url,'传入数据:'+JSON.stringify(serectParams),'响应数据:'+JSON.stringify(res.data)]) + app.printErrorClient('failrequest', ['HttpRequst当中wx.request fail 执行了:调用失败', 'api地址:' + url, '传入数据:' + JSON.stringify(serectParams), '响应数据:' + JSON.stringify(res.data)]) } }) } else { @@ -140,16 +142,16 @@ function HttpRequest(loading, url, sessionChoose, params, method, callBack, reje // HttpRequest(loading, url, sessionChoose, params, method, callBack, reject) // }) //if (getCurrentPages().pop().route != 'pages/login/index') { - wx.clearStorage() - wx.reLaunch({ - url: '/pages/login/index' - }) + wx.clearStorage() + wx.reLaunch({ + url: '/pages/login/index' + }) //} } } function asyncLogin(flag) { - + return new Promise((reslove, reject) => { if (app.globalData.loginRuning) { //已经在执行了 @@ -158,7 +160,7 @@ function asyncLogin(flag) { app.globalData.loginRuning = true; work(reslove, reject, flag) } - + }) } @@ -177,7 +179,7 @@ function _resloveRun() { function work(reslove, reject, flag) { wx.checkSession({ success: function () { - + //同步获取token let ukey = app.getStorageByKey("ukey"); console.log("asyncLogin(checkSession-success)-ukey:" + ukey) @@ -196,20 +198,22 @@ function work(reslove, reject, flag) { } }) } + function wxLogin(reslove) { wx.login({ success(res) { - console.log("执行了wx.login-code:"+res.code) + console.log("执行了wx.login-code:" + res.code) if (res.code) { let params = { code: res.code, + by_code: 1, app_id: Config.app_id, nonce_str: randomString() } - let sendData={ + let sendData = { ...params, sign: toEncrypt(params) - } + } wx.request({ url: Config.api.baseUrl + Config.api.appUserUkey, data: sendData, @@ -219,7 +223,7 @@ function wxLogin(reslove) { }, method: "GET", success: function (res) { - console.log("wx.login-ukey:"+res.data.data.ukey) + console.log("wx.login-ukey:" + res.data.data.ukey) if (res.data.code == 200) { app.globalData.ukey = res.data.data.ukey; app.setStorage("ukey", res.data.data.ukey, function () { @@ -246,10 +250,9 @@ app.asyncLogin = asyncLogin; -export { HttpNoUkeyRequest, HttpRequest, asyncLogin, app } - - - - - - +export { + HttpNoUkeyRequest, + HttpRequest, + asyncLogin, + app +} \ No newline at end of file diff --git a/commons/js/utils/stringEncrypt.js b/commons/js/utils/stringEncrypt.js index 0e50452..dc49e6d 100644 --- a/commons/js/utils/stringEncrypt.js +++ b/commons/js/utils/stringEncrypt.js @@ -134,7 +134,7 @@ let combineUrl = (DATA) => { let toEncrypt = (DATA) => { // let secretKey = randomString() let data = combineUrl(DATA) - //console.log(data)//加密原始数据 + // console.log(data)//加密原始数据 return md5.hex_md5(data); } diff --git a/pages/customer/detail/index.wxml b/pages/customer/detail/index.wxml index 801d416..71e4aa6 100644 --- a/pages/customer/detail/index.wxml +++ b/pages/customer/detail/index.wxml @@ -270,11 +270,11 @@ 未见客户 - + 到店客户 - 战败客户 + 申请战败 diff --git a/pages/login/index.wxml b/pages/login/index.wxml index fbebb98..a90d954 100644 --- a/pages/login/index.wxml +++ b/pages/login/index.wxml @@ -19,7 +19,7 @@ {{text}} - + 《理车用户注册协议》 diff --git a/pages/order/register/index.js b/pages/order/register/index.js index 77eecba..ff949dc 100644 --- a/pages/order/register/index.js +++ b/pages/order/register/index.js @@ -2,111 +2,109 @@ import _ from '../../../commons/js/commons' const app = getApp() Page({ data: { - tab:[ - { - title:'客户信息', - step:1, + tab: [{ + title: '客户信息', + step: 1, }, { - title:'车辆信息', - step:2, + title: '车辆信息', + step: 2, }, { - title:'其他信息', - step:3, + title: '其他信息', + step: 3, }, ], - step:1, - name:'',//姓名 - mobile:'',//手机号 - cardid:'',//身份证 - address:'',//地址 - owner_name:'',//车主姓名 - owner_mobile:'',//车主手机号 - owner_cardid:'',//车主身份证 - company:'',//企业名称 - credit:'',//企业信用代码 - brand_id:'',//品牌 - car_id:'',//车系id - v_id:'',//车辆版本id - color_id:'',//车身颜色id - incolor_id:'',//内饰颜色id - b_s_id:'',//备选车型id - buy_time:'',//预计购车时间 - brandIndex:-1,//车辆品牌索引 - modelIndex:-1,//车系车型索引 - spareIndex:-1,//备选车型索引 - colorArray:[],//车身颜色列表 - levelArray:[],//车辆版本列表 - interiorArray:[],//内饰颜色 - colorIndex:-1,//车身颜色索引 - levelIndex:-1,//车辆版本索引 - interiorIndex:-1,//内饰颜色索引 - priceinfo:'',//车辆价格 - delry_time:'',//期望交付时间 - inten_money:'',//意向金 - submitFlag:false, + step: 1, + name: '', //姓名 + mobile: '', //手机号 + cardid: '', //身份证 + address: '', //地址 + owner_name: '', //车主姓名 + owner_mobile: '', //车主手机号 + owner_cardid: '', //车主身份证 + company: '', //企业名称 + credit: '', //企业信用代码 + brand_id: '', //品牌 + car_id: '', //车系id + v_id: '', //车辆版本id + color_id: '', //车身颜色id + incolor_id: '', //内饰颜色id + b_s_id: '', //备选车型id + buy_time: '', //预计购车时间 + brandIndex: -1, //车辆品牌索引 + modelIndex: -1, //车系车型索引 + spareIndex: -1, //备选车型索引 + colorArray: [], //车身颜色列表 + levelArray: [], //车辆版本列表 + interiorArray: [], //内饰颜色 + colorIndex: -1, //车身颜色索引 + levelIndex: -1, //车辆版本索引 + interiorIndex: -1, //内饰颜色索引 + priceinfo: '', //车辆价格 + delry_time: '', //期望交付时间 + inten_money: '', //意向金 + submitFlag: false, - paymentIndex:-1,//付款方式 - payment:['全款', '按揭',], - main_type:0,//购车主体 - main:[ - { - title:'个人', - value:0, + paymentIndex: -1, //付款方式 + payment: ['全款', '按揭', ], + main_type: 0, //购车主体 + main: [{ + title: '个人', + value: 0, }, { - title:'公司', - value:1, + title: '公司', + value: 1, }, ], - isPreview:false,//是否预览 - isFill:false,//是否已填完成 - isShowcheck:false,//是否显示预览核对弹框 + isPreview: false, //是否预览 + isFill: false, //是否已填完成 + isShowcheck: false, //是否显示预览核对弹框 checkCount: 2, checktext: '3s', - srv_total:0,//代办费用 - agencyList:[],//代办数组 - fine_total:0,//精品费用 + srv_total: 0, //代办费用 + agencyList: [], //代办数组 + fine_total: 0, //精品费用 - isShowSuccess:false,//是否显示成功提示 - isShowContract:false,//是否显示生成合同 + isShowSuccess: false, //是否显示成功提示 + isShowContract: false, //是否显示生成合同 //if_fine:false,//精品尊享包 - fines:[],//精品赠送 + fines: [], //精品赠送 - business_type:0,//0未执行到商务政策 1商务政策执行中 2商务政策成功 3商务政策失败 + business_type: 0, //0未执行到商务政策 1商务政策执行中 2商务政策成功 3商务政策失败 - isShowIntenMoney:false,//是否显示意向金弹框 - isShowAddress:false,//是否显示地址弹框 + isShowIntenMoney: false, //是否显示意向金弹框 + isShowAddress: false, //是否显示地址弹框 //region: ['福建省', '', ''], - c_city_id:'', - oncardArray:[],//上牌城市 - oncardIndex:-1,//上牌城市索引 + c_city_id: '', + oncardArray: [], //上牌城市 + oncardIndex: -1, //上牌城市索引 - sa:'',//特别约定 + sa: '', //特别约定 - if_local_bill:0,//本地开具发票 + if_local_bill: 0, //本地开具发票 - customer_cardidpic:'',//客户身份证正面照 - owner_cardidpic:'',//车主身份证正面照 + customer_cardidpic: '', //客户身份证正面照 + owner_cardidpic: '', //车主身份证正面照 - fineArr:[],//精品选装 - finedIndex:-1,//精品选装索引 + fineArr: [], //精品选装 + finedIndex: -1, //精品选装索引 - addressFocus:false, - customer_address:'', - packageList:[],//车辆选装包 - options_ids:[],//选装包id数组 - options_total:0,//选装包费用 - if_zero_firstpay:0,//是否零首付 - price_loan0:'',//首付按揭金额 - firstPayArr:['现金','0首付','按揭',],//首付类型 - firstPayIndex:0,//首付类型 - is_get_brand: false,//20240526是否店内上牌 - is_get_insure: false,//20240526是否店内投保 + addressFocus: false, + customer_address: '', + packageList: [], //车辆选装包 + options_ids: [], //选装包id数组 + options_total: 0, //选装包费用 + if_zero_firstpay: 0, //是否零首付 + price_loan0: '', //首付按揭金额 + firstPayArr: ['现金', '0首付', '按揭', ], //首付类型 + firstPayIndex: 0, //首付类型 + is_get_brand: false, //20240526是否店内上牌 + is_get_insure: false, //20240526是否店内投保 }, //生命周期函数--监听页面加载 onLoad: function (options) { @@ -117,46 +115,42 @@ Page({ } this.setData({ - org_mobile:this.data.mobile, + org_mobile: this.data.mobile, }) this.getAppSeriesBrands() this.getUserInfo() - this.getAppCityOncard() - this.getAppFine() - }, //修改步骤 - optstep(e){ + optstep(e) { this.setData({ - step:e.currentTarget.dataset.step, + step: e.currentTarget.dataset.step, }) }, //下一步 - nextstep(){ + nextstep() { switch (this.data.step) { case 1: this.setData({ - mobile:this.trimAll(this.data.mobile), - cardid:this.trimAll(this.data.cardid), - owner_mobile:this.trimAll(this.data.owner_mobile), - owner_cardid:this.trimAll(this.data.owner_cardid), + mobile: this.trimAll(this.data.mobile), + cardid: this.trimAll(this.data.cardid), + owner_mobile: this.trimAll(this.data.owner_mobile), + owner_cardid: this.trimAll(this.data.owner_cardid), }) - if (this.data.name == '' ) { + if (this.data.name == '') { wx.showToast({ title: '请输入客户姓名', icon: 'none' }) - }else if (this.data.mobile != this.data.org_mobile && !/^1[3456789]\d{9}$/.test(this.data.mobile)){ + } else if (this.data.mobile != this.data.org_mobile && !/^1[3456789]\d{9}$/.test(this.data.mobile)) { wx.showToast({ title: '请输入客户手机号', icon: 'none' }) - } - else if(this.data.cardid == ''|| !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/.test(this.data.cardid)){ + } else if (this.data.cardid == '' || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/.test(this.data.cardid)) { wx.showToast({ title: '请填写正确客户身份证', icon: 'none' @@ -186,13 +180,12 @@ Page({ // icon: 'none' // }) // } - else if(this.data.main_type == 1&&this.data.company == ''){ + else if (this.data.main_type == 1 && this.data.company == '') { wx.showToast({ title: '请填写企业名称', icon: 'none' }) - } - else if(this.data.main_type == 1&&this.data.credit == ''){ + } else if (this.data.main_type == 1 && this.data.credit == '') { wx.showToast({ title: '请填写企业信用代码', icon: 'none' @@ -204,41 +197,41 @@ Page({ // icon: 'none' // }) // } - else{ + else { this.setData({ - step:2, + step: 2, }) } break; case 2: - if(this.data.car_id == '' ){ + if (this.data.car_id == '') { wx.showToast({ title: '请选择车系车型', icon: 'none' }) - }else if(this.data.v_id == '' ){ + } else if (this.data.v_id == '') { wx.showToast({ title: '请选择车辆版本', icon: 'none' }) - // }else if(this.data.color_id == '' ){ - // wx.showToast({ - // title: '请选择车身颜色', - // icon: 'none' - // }) - // }else if(this.data.incolor_id == '' ){ - // wx.showToast({ - // title: '请选择内饰颜色', - // icon: 'none' - // }) - }else{ + // }else if(this.data.color_id == '' ){ + // wx.showToast({ + // title: '请选择车身颜色', + // icon: 'none' + // }) + // }else if(this.data.incolor_id == '' ){ + // wx.showToast({ + // title: '请选择内饰颜色', + // icon: 'none' + // }) + } else { this.setData({ - step:3, + step: 3, }) } break; case 3: - if(this.data.paymentIndex == -1 ){ + if (this.data.paymentIndex == -1) { wx.showToast({ title: '请选择付款方式', icon: 'none' @@ -250,26 +243,25 @@ Page({ // icon: 'none' // }) // } - else if(this.data.if_zero_firstpay!=1&&(!this.data.priceinfo.sdeposit||this.data.priceinfo.sdeposit == '')){ + else if (this.data.if_zero_firstpay != 1 && (!this.data.priceinfo.sdeposit || this.data.priceinfo.sdeposit == '')) { wx.showToast({ title: '请设置定金', icon: 'none' }) - } - else{ + } else { let that = this that.setData({ isPreview: true, - isFill:true, + isFill: true, }) wx.pageScrollTo({ scrollTop: 0 }) - + that.setData({ - isShowcheck:true, - checkCount:2, + isShowcheck: true, + checkCount: 2, checktext: 3 + 's' }) let interval = setInterval(res => { @@ -286,7 +278,7 @@ Page({ }) } }, 1000) - + } break; @@ -294,135 +286,123 @@ Page({ }, //获取用户信息 - getUserInfo(){ + getUserInfo() { _.apiQuery.getUserInfo().then(res => { this.setData({ userInfo: res, }) - if(res.biz_type != 1){ + if (res.biz_type != 1) { this.setData({ - fines:[{"id":"-1","txt":"服务费","price":""}],//身份证 + fines: [{ + "id": "-1", + "txt": "服务费", + "price": "" + }], //身份证 }) } - if(res.biz_name == '测试门店'){ + if (res.biz_name == '测试门店') { this.setData({ - cardid:'350000202101010000',//身份证 + cardid: '350000202101010000', //身份证 }) } }); }, - //获取上牌城市 - getAppCityOncard(){ - _.apiQuery.getAppCityOncard().then(res => { - if(res.data.list.length>0){ - let oncardArray = [] - res.data.list.forEach(item => { - oncardArray.push(item.name) - }) - this.setData({ - oncardArray, - oncardList:res.data.list, - }) - } - }); - }, - //获取车型品牌 - getAppSeriesBrands(){ + getAppSeriesBrands() { _.apiQuery.getAppSeriesBrands().then(res => { - if(res.data.list.length>0){ + if (res.data.list.length > 0) { let brandArray = [] res.data.list.forEach(item => { brandArray.push(item.name) }) this.setData({ - brandArray:brandArray, - brandList:res.data.list, + brandArray: brandArray, + brandList: res.data.list, }) } }); }, //获取车系车型 - getAppSeries(){ + getAppSeries() { let params = {}; params['brand_id'] = this.data.brand_id; _.apiQuery.getAppSeries(params).then(res => { - if(res.data.list.length>0){ + if (res.data.list.length > 0) { let modelArray = [] res.data.list.forEach(item => { modelArray.push(item.name) }) this.setData({ - modelArray:modelArray, - modelList:res.data.list, + modelArray: modelArray, + modelList: res.data.list, }) } }); }, //获取车辆版本 - getAppSeriesAttrslevel(){ + getAppSeriesAttrslevel() { let params = {}; params['id'] = this.data.car_id; params['type'] = 0; _.apiQuery.getAppSeriesAttrs(params).then(res => { - if(res.data.total>0){ + if (res.data.total > 0) { let levelArray = [] res.data.list.forEach(item => { levelArray.push(item.title) }) this.setData({ - levelArray:levelArray, - levelList:res.data.list, - levelIndex:-1, + levelArray: levelArray, + levelList: res.data.list, + levelIndex: -1, }) } }); }, //获取车身颜色 - getAppSeriesAttrscolor(){ + getAppSeriesAttrscolor() { let params = {}; params['id'] = this.data.car_id; params['type'] = 1; params['v_id'] = this.data.v_id; _.apiQuery.getAppSeriesAttrs(params).then(res => { - if(res.data.total>0){ + if (res.data.total > 0) { let colorArray = [] res.data.list.forEach(item => { colorArray.push(item.title) }) this.setData({ - colorArray:colorArray, - colorList:res.data.list, - colorIndex:-1, + colorArray: colorArray, + colorList: res.data.list, + colorIndex: -1, }) } }); }, //获取车型内饰颜色 - getAppSeriesAttrsinterior(){ + getAppSeriesAttrsinterior() { let params = {}; params['id'] = this.data.car_id; params['type'] = 2; params['v_id'] = this.data.v_id; params['color_id'] = this.data.color_id; _.apiQuery.getAppSeriesAttrs(params).then(res => { - if(res.data.total>0){ + if (res.data.total > 0) { let interiorArray = [] res.data.list.forEach(item => { interiorArray.push(item.title) }) this.setData({ - interiorArray:interiorArray, - interiorList:res.data.list, - interiorIndex:-1, + interiorArray: interiorArray, + interiorList: res.data.list, + interiorIndex: -1, }) } }); @@ -430,28 +410,28 @@ Page({ //选择品牌 changeBrand(e) { - if(this.data.brandIndex != e.detail.value && e.detail.value >= 0){ + if (this.data.brandIndex != e.detail.value && e.detail.value >= 0) { this.setData({ - brand_id:this.data.brandList[e.detail.value].id, - brandIndex:e.detail.value, - car_id:'',//车系id - packageList:[],//车辆选装包 - options_ids:[],//选装包id数组 - options_total:0,//选装包费用 - v_id:'',//车辆版本id - color_id:'',//车身颜色id - incolor_id:'',//内饰颜色id - b_s_id:'',//备选车型id - modelIndex:-1,//车系车型索引 - spareIndex:-1,//备选车型索引 - colorArray:[],//车身颜色列表 - levelArray:[],//车辆版本列表 - interiorArray:[],//内饰颜色 - colorIndex:-1,//车身颜色索引 - levelIndex:-1,//车辆版本索引 - interiorIndex:-1,//内饰颜色索引 - priceinfo:'', - business_type:0, + brand_id: this.data.brandList[e.detail.value].id, + brandIndex: e.detail.value, + car_id: '', //车系id + packageList: [], //车辆选装包 + options_ids: [], //选装包id数组 + options_total: 0, //选装包费用 + v_id: '', //车辆版本id + color_id: '', //车身颜色id + incolor_id: '', //内饰颜色id + b_s_id: '', //备选车型id + modelIndex: -1, //车系车型索引 + spareIndex: -1, //备选车型索引 + colorArray: [], //车身颜色列表 + levelArray: [], //车辆版本列表 + interiorArray: [], //内饰颜色 + colorIndex: -1, //车身颜色索引 + levelIndex: -1, //车辆版本索引 + interiorIndex: -1, //内饰颜色索引 + priceinfo: '', + business_type: 0, }) this.getAppSeries() } @@ -459,25 +439,25 @@ Page({ //选择车系 changeModel(e) { - if(this.data.modelIndex != e.detail.value && e.detail.value >= 0){ + if (this.data.modelIndex != e.detail.value && e.detail.value >= 0) { this.setData({ - car_id:this.data.modelList[e.detail.value].id, - modelIndex:e.detail.value, - v_id:'',//车辆版本id - color_id:'',//车身颜色id - incolor_id:'',//内饰颜色id - b_s_id:'',//备选车型id - spareIndex:-1,//备选车型索引 - colorArray:[],//车身颜色列表 - levelArray:[],//车辆版本列表 - interiorArray:[],//内饰颜色 - colorIndex:-1,//车身颜色索引 - levelIndex:-1,//车辆版本索引 - interiorIndex:-1,//内饰颜色索引 - priceinfo:'', - business_type:0, - options_ids:[],//选装包id数组 - options_total:0,//选装包费用 + car_id: this.data.modelList[e.detail.value].id, + modelIndex: e.detail.value, + v_id: '', //车辆版本id + color_id: '', //车身颜色id + incolor_id: '', //内饰颜色id + b_s_id: '', //备选车型id + spareIndex: -1, //备选车型索引 + colorArray: [], //车身颜色列表 + levelArray: [], //车辆版本列表 + interiorArray: [], //内饰颜色 + colorIndex: -1, //车身颜色索引 + levelIndex: -1, //车辆版本索引 + interiorIndex: -1, //内饰颜色索引 + priceinfo: '', + business_type: 0, + options_ids: [], //选装包id数组 + options_total: 0, //选装包费用 }) this.getAppSeriesAttrslevel() //获取车辆选装包 @@ -487,18 +467,18 @@ Page({ //车辆版本 changeLevel(e) { - if(this.data.levelIndex != e.detail.value && e.detail.value >= 0){ + if (this.data.levelIndex != e.detail.value && e.detail.value >= 0) { this.setData({ - v_id:this.data.levelList[e.detail.value].id, - levelIndex:e.detail.value, - color_id:'',//车身颜色id - incolor_id:'',//内饰颜色id - colorArray:[],//车身颜色列表 - interiorArray:[],//内饰颜色 - colorIndex:-1,//车身颜色索引 - interiorIndex:-1,//内饰颜色索引 - priceinfo:'', - business_type:0, + v_id: this.data.levelList[e.detail.value].id, + levelIndex: e.detail.value, + color_id: '', //车身颜色id + incolor_id: '', //内饰颜色id + colorArray: [], //车身颜色列表 + interiorArray: [], //内饰颜色 + colorIndex: -1, //车身颜色索引 + interiorIndex: -1, //内饰颜色索引 + priceinfo: '', + business_type: 0, }) this.getAppSeriesAttrscolor() } @@ -506,15 +486,15 @@ Page({ //车身颜色 changeColor(e) { - if(this.data.colorIndex != e.detail.value && e.detail.value >= 0){ + if (this.data.colorIndex != e.detail.value && e.detail.value >= 0) { this.setData({ - color_id:this.data.colorList[e.detail.value].id, - colorIndex:e.detail.value, - incolor_id:'',//内饰颜色id - interiorArray:[],//内饰颜色 - interiorIndex:-1,//内饰颜色索引 - priceinfo:'', - business_type:0, + color_id: this.data.colorList[e.detail.value].id, + colorIndex: e.detail.value, + incolor_id: '', //内饰颜色id + interiorArray: [], //内饰颜色 + interiorIndex: -1, //内饰颜色索引 + priceinfo: '', + business_type: 0, }) this.getAppSeriesAttrsinterior() } @@ -522,11 +502,11 @@ Page({ //内饰颜色 changeInterior(e) { - if(this.data.interiorIndex != e.detail.value && e.detail.value >= 0){ + if (this.data.interiorIndex != e.detail.value && e.detail.value >= 0) { this.setData({ - incolor_id:this.data.interiorList[e.detail.value].id, - interiorIndex:e.detail.value, - business_type:0, + incolor_id: this.data.interiorList[e.detail.value].id, + interiorIndex: e.detail.value, + business_type: 0, }) this.getAppBusiness() } @@ -534,12 +514,12 @@ Page({ //付款方式 changePayment(e) { - if(this.data.paymentIndex != e.detail.value && e.detail.value >= 0){ + if (this.data.paymentIndex != e.detail.value && e.detail.value >= 0) { this.setData({ - paymentIndex:e.detail.value, - price_loan0:'', - if_zero_firstpay:0, - firstPayIndex:0, + paymentIndex: e.detail.value, + price_loan0: '', + if_zero_firstpay: 0, + firstPayIndex: 0, }) //代办列表 this.getAppServices() @@ -549,21 +529,21 @@ Page({ //购车主体 changeMain(e) { this.setData({ - main_type:e.detail.value, - owner_name:'', - owner_mobile:'', - owner_cardid:'', - company:'', - credit:'', - address:'', + main_type: e.detail.value, + owner_name: '', + owner_mobile: '', + owner_cardid: '', + company: '', + credit: '', + address: '', }) }, //获取车辆价格 - getAppBusiness(){ - if(this.data.car_id != ''&&this.data.v_id != ''&&this.data.color_id != ''&&this.data.incolor_id != ''){ + getAppBusiness() { + if (this.data.car_id != '' && this.data.v_id != '' && this.data.color_id != '' && this.data.incolor_id != '') { this.setData({ - business_type:1, + business_type: 1, }) let params = {}; params['main_type'] = this.data.main_type; @@ -573,22 +553,22 @@ Page({ params['incolor_id'] = this.data.incolor_id; _.apiQuery.getAppBusiness(params).then(res => { this.setData({ - business_type:2, - priceinfo:res.data, + business_type: 2, + priceinfo: res.data, }) }).catch(res => { this.setData({ - business_type:3, + business_type: 3, }) }); } }, //获取代办服务列表 - getAppServices(){ - if(this.data.paymentIndex != -1&&this.data.car_id != ''&&this.data.v_id != ''){ + getAppServices() { + if (this.data.paymentIndex != -1 && this.data.car_id != '' && this.data.v_id != '') { let params = {}; - params['payway'] = this.data.paymentIndex==0?'1':'0'; + params['payway'] = this.data.paymentIndex == 0 ? '1' : '0'; params['cus_id'] = this.data.cus_id; params['car_id'] = this.data.car_id; params['v_id'] = this.data.v_id; @@ -600,11 +580,11 @@ Page({ let srv_total = 0 agencyList.forEach(item => { item.sprice = item.price - if(this.data.userInfo.biz_type==1){ - if(item.id==1||item.id==2){ + if (this.data.userInfo.biz_type == 1) { + if (item.id == 1 || item.id == 2) { item.checked = true - if(parseFloat(item.price)>0){ - srv_total = srv_total + parseFloat(item.price) + if (parseFloat(item.price) > 0) { + srv_total = srv_total + parseFloat(item.price) } } } @@ -619,20 +599,20 @@ Page({ }, //建卡时间 - delryTime(e){ + delryTime(e) { this.setData({ delry_time: e.detail.value, }) }, //一件同步购车人信息 - synchroCustomer(e){ + synchroCustomer(e) { this.setData({ - owner_name:this.data.name, - owner_mobile:this.data.mobile, - owner_cardid:this.data.cardid, - owner_cardidpic:this.data.customer_cardidpic, - address:this.data.customer_address?this.data.customer_address:this.data.address, + owner_name: this.data.name, + owner_mobile: this.data.mobile, + owner_cardid: this.data.cardid, + owner_cardidpic: this.data.customer_cardidpic, + address: this.data.customer_address ? this.data.customer_address : this.data.address, }) }, @@ -645,7 +625,7 @@ Page({ let fines = [] that.data.fines.forEach(item => { - if(item.txt!=''){ + if (item.txt != '') { fines.push(item) } }); @@ -654,13 +634,13 @@ Page({ params['main_type'] = that.data.main_type; params['cus_id'] = that.data.cus_id; params['name'] = that.data.name; - if(that.data.mobile == that.data.org_mobile){ + if (that.data.mobile == that.data.org_mobile) { params['mobile'] = that.data.complete_mobile; - }else{ + } else { params['mobile'] = that.data.mobile; } params['c_city_id'] = that.data.c_city_id; - if(that.data.address != ''){ + if (that.data.address != '') { //params['pro'] = that.data.region; params['address'] = that.data.address; } @@ -669,58 +649,58 @@ Page({ params['v_id'] = that.data.v_id; params['color_id'] = that.data.color_id; params['incolor_id'] = that.data.incolor_id; - if(that.data.options_ids.length>0){ + if (that.data.options_ids.length > 0) { params['options_ids'] = that.data.options_ids; } params['price'] = that.data.priceinfo.price; - if(that.data.if_zero_firstpay!=1){ + if (that.data.if_zero_firstpay != 1) { params['deposit'] = that.data.priceinfo.sdeposit; } - params['payway'] = that.data.paymentIndex==0?'1':'0'; + params['payway'] = that.data.paymentIndex == 0 ? '1' : '0'; params['delry_time'] = that.data.delry_time; params['business_id'] = that.data.priceinfo.id; - if(that.data.owner_name != ''){ + if (that.data.owner_name != '') { params['owner_name'] = that.data.owner_name; } - if(that.data.owner_mobile != ''){ - if(that.data.owner_mobile == that.data.org_mobile){ + if (that.data.owner_mobile != '') { + if (that.data.owner_mobile == that.data.org_mobile) { params['owner_mobile'] = that.data.complete_mobile; - }else{ + } else { params['owner_mobile'] = that.data.owner_mobile; } } - if(that.data.owner_cardid != ''){ + if (that.data.owner_cardid != '') { params['owner_cardid'] = that.data.owner_cardid; } - if(that.data.company != ''){ + if (that.data.company != '') { params['company'] = that.data.company; } - if(that.data.credit != ''){ + if (that.data.credit != '') { params['credit'] = that.data.credit; } - if(!!that.data.priceinfo.sdisc_money && that.data.priceinfo.sdisc_money != '' ){ + if (!!that.data.priceinfo.sdisc_money && that.data.priceinfo.sdisc_money != '') { params['disc_money'] = that.data.priceinfo.sdisc_money; } - if(that.data.sa != ''){ + if (that.data.sa != '') { params['sa'] = that.data.sa; } - if(that.data.priceinfo.show_local_bill){ + if (that.data.priceinfo.show_local_bill) { params['if_local_bill'] = that.data.if_local_bill; } let srv_arr = [] that.data.agencyList.forEach(item => { - if(item.checked){ + if (item.checked) { srv_arr.push({ - id:item.id, - key:item.key, - price:item.sprice, + id: item.id, + key: item.key, + price: item.sprice, }) } }) - if(srv_arr.length>0){ + if (srv_arr.length > 0) { params['srv_arr'] = srv_arr; } - if(fines.length>0){ + if (fines.length > 0) { params['fines'] = fines; } // if(that.data.priceinfo.fine_money){ @@ -729,10 +709,10 @@ Page({ // params['disc_fine_money'] = that.data.priceinfo.sdisc_fine_money; // } // } - if(that.data.paymentIndex==1){ + if (that.data.paymentIndex == 1) { params['if_zero_firstpay'] = that.data.if_zero_firstpay; } - if(that.data.price_loan0 > 0){ + if (that.data.price_loan0 > 0) { params['price_loan0'] = that.data.price_loan0; } _.apiQuery.postAppCusorderV2(params).then(res => { @@ -742,17 +722,17 @@ Page({ let prevPage = null; //上一个页面 if (pages.length >= 2) { prevPage = pages[pages.length - 2]; //上一个页面 - if(prevPage.route == 'pages/order/index'){ + if (prevPage.route == 'pages/order/index') { prevPage.onPullDownRefresh() } } that.setData({ - isShowSuccess:true,//是否显示成功提示 - details:res.data, + isShowSuccess: true, //是否显示成功提示 + details: res.data, }) - if(that.data.owner_cardidpic != ''){ + if (that.data.owner_cardidpic != '') { let oparams = {}; oparams['id'] = res.data.id; oparams['cardida'] = that.data.owner_cardidpic; @@ -773,17 +753,17 @@ Page({ // }) // } // }) - }).catch(res=>{ + }).catch(res => { that.setData({ submitFlag: false, }) }); }, - //显示隐藏预览 - optPreview(e) { + //显示隐藏预览 + optPreview(e) { this.setData({ - isPreview:!this.data.isPreview, + isPreview: !this.data.isPreview, }) wx.pageScrollTo({ scrollTop: 0 @@ -791,50 +771,46 @@ Page({ }, //显示隐藏预览提示 - optShowcheck(){ + optShowcheck() { this.setData({ - isShowcheck:!this.data.isShowcheck, + isShowcheck: !this.data.isShowcheck, }) }, - //点击收取意向金 + //点击收取意向金 createV2Inten() { this.setData({ - mobile:this.trimAll(this.data.mobile), - cardid:this.trimAll(this.data.cardid), - owner_mobile:this.trimAll(this.data.owner_mobile), - owner_cardid:this.trimAll(this.data.owner_cardid), + mobile: this.trimAll(this.data.mobile), + cardid: this.trimAll(this.data.cardid), + owner_mobile: this.trimAll(this.data.owner_mobile), + owner_cardid: this.trimAll(this.data.owner_cardid), }) - if (this.data.name == '' ) { + if (this.data.name == '') { wx.showToast({ title: '请输入客户姓名', icon: 'none' }) - }else if (this.data.mobile != this.data.org_mobile && !/^1[3456789]\d{9}$/.test(this.data.mobile)){ + } else if (this.data.mobile != this.data.org_mobile && !/^1[3456789]\d{9}$/.test(this.data.mobile)) { wx.showToast({ title: '请输入客户手机号', icon: 'none' }) - } - else if(this.data.cardid == ''|| !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/.test(this.data.cardid)){ + } else if (this.data.cardid == '' || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/.test(this.data.cardid)) { wx.showToast({ title: '请填写正确客户身份证', icon: 'none' }) - } - else if(this.data.main_type == 0&&this.data.owner_name == ''){ + } else if (this.data.main_type == 0 && this.data.owner_name == '') { wx.showToast({ title: '请填写车主姓名', icon: 'none' }) - } - else if(this.data.main_type == 0&&this.data.owner_mobile != this.data.org_mobile && !/^1[3456789]\d{9}$/.test(this.data.owner_mobile)){ + } else if (this.data.main_type == 0 && this.data.owner_mobile != this.data.org_mobile && !/^1[3456789]\d{9}$/.test(this.data.owner_mobile)) { wx.showToast({ title: '请填写车主手机号', icon: 'none' }) - } - else if(this.data.main_type == 0&&(this.data.owner_cardid == ''|| !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/.test(this.data.owner_cardid))){ + } else if (this.data.main_type == 0 && (this.data.owner_cardid == '' || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/.test(this.data.owner_cardid))) { wx.showToast({ title: '请填写正确车主身份证', icon: 'none' @@ -846,44 +822,41 @@ Page({ // icon: 'none' // }) // } - else if(this.data.main_type == 1&&this.data.company == ''){ + else if (this.data.main_type == 1 && this.data.company == '') { wx.showToast({ title: '请填写企业名称', icon: 'none' }) - } - else if(this.data.main_type == 1&&this.data.credit == ''){ + } else if (this.data.main_type == 1 && this.data.credit == '') { wx.showToast({ title: '请填写企业信用代码', icon: 'none' }) - } - else if(this.data.c_city_id == ''){ + } else if (this.data.c_city_id == '') { wx.showToast({ title: '请选择上牌城市', icon: 'none' }) - } - else{ + } else { this.setData({ - isShowIntenMoney:true, + isShowIntenMoney: true, }) } }, //显示隐藏意向金弹框 - optIntenMoney(){ + optIntenMoney() { this.setData({ - isShowIntenMoney:!this.data.isShowIntenMoney, + isShowIntenMoney: !this.data.isShowIntenMoney, }) }, //收取意向金新建订单 postAppCusorderV2Inten() { - if(this.data.inten_money == ''){ + if (this.data.inten_money == '') { wx.showToast({ title: '请输入意向金', icon: 'none' }) - }else{ + } else { let that = this wx.showModal({ title: '确定创建订单,收取意向金?', @@ -898,56 +871,56 @@ Page({ params['main_type'] = that.data.main_type; params['cus_id'] = that.data.cus_id; params['name'] = that.data.name; - if(that.data.mobile == that.data.org_mobile){ + if (that.data.mobile == that.data.org_mobile) { params['mobile'] = that.data.complete_mobile; - }else{ + } else { params['mobile'] = that.data.mobile; } params['inten_money'] = that.data.inten_money; params['c_city_id'] = that.data.c_city_id; - if(that.data.address != ''){ + if (that.data.address != '') { //params['pro'] = that.data.region; params['address'] = that.data.address; } params['cardid'] = that.data.cardid; - if(that.data.owner_name != ''){ + if (that.data.owner_name != '') { params['owner_name'] = that.data.owner_name; } - if(that.data.owner_mobile != ''){ - if(that.data.owner_mobile == that.data.org_mobile){ + if (that.data.owner_mobile != '') { + if (that.data.owner_mobile == that.data.org_mobile) { params['owner_mobile'] = that.data.complete_mobile; - }else{ + } else { params['owner_mobile'] = that.data.owner_mobile; } } - if(that.data.owner_cardid != ''){ + if (that.data.owner_cardid != '') { params['owner_cardid'] = that.data.owner_cardid; } - if(that.data.company != ''){ + if (that.data.company != '') { params['company'] = that.data.company; } - if(that.data.credit != ''){ + if (that.data.credit != '') { params['credit'] = that.data.credit; } _.apiQuery.postAppCusorderV2Inten(params).then(res => { - + //刷新列表页 let pages = getCurrentPages(); let prevPage = null; //上一个页面 if (pages.length >= 2) { prevPage = pages[pages.length - 2]; //上一个页面 - if(prevPage.route == 'pages/order/index'){ + if (prevPage.route == 'pages/order/index') { prevPage.onPullDownRefresh() } } that.setData({ - isShowIntenMoney:false,//关闭意向金弹框 - isShowSuccess:true,//是否显示成功提示 - details:res.data, + isShowIntenMoney: false, //关闭意向金弹框 + isShowSuccess: true, //是否显示成功提示 + details: res.data, }) - if(that.data.owner_cardidpic != ''){ + if (that.data.owner_cardidpic != '') { let oparams = {}; oparams['id'] = res.data.id; oparams['cardida'] = that.data.owner_cardidpic; @@ -955,8 +928,8 @@ Page({ }) } - - }).catch(res=>{ + + }).catch(res => { that.setData({ submitFlag: false, }) @@ -975,10 +948,10 @@ Page({ agencyList.forEach(item1 => { item1.checked = false values.forEach(item2 => { - if(item1.id == item2){ + if (item1.id == item2) { item1.checked = true - if(parseFloat(item1.sprice)>0){ - srv_total = srv_total + parseFloat(item1.sprice) + if (parseFloat(item1.sprice) > 0) { + srv_total = srv_total + parseFloat(item1.sprice) } } }) @@ -991,61 +964,61 @@ Page({ }, //精品尊享版 - changeFineBag(){ + changeFineBag() { this.setData({ - if_fine:!this.data.if_fine, - 'priceinfo.sdisc_fine_money':'', + if_fine: !this.data.if_fine, + 'priceinfo.sdisc_fine_money': '', }) }, //推送链接 - viewDetails(e){ + viewDetails(e) { wx.redirectTo({ url: '/pages/order/detail/index2?id=' + this.data.details.id }) }, //修改步骤 - optShowContract(e){ + optShowContract(e) { this.setData({ - isShowSuccess:false, - isShowContract:!this.data.isShowContract, + isShowSuccess: false, + isShowContract: !this.data.isShowContract, }) }, //修改成功 - optShowSuccess(e){ + optShowSuccess(e) { this.setData({ - isShowSuccess:!this.data.isShowSuccess, + isShowSuccess: !this.data.isShowSuccess, }) }, //添加精品 - addFine(){ + addFine() { this.data.fines.push({ - txt:'', - price:'', + txt: '', + price: '', }) this.setData({ - fines:this.data.fines, + fines: this.data.fines, }) }, //添加精品 - inputFines(e){ - if(e.currentTarget.dataset.type=='txt'){ + inputFines(e) { + if (e.currentTarget.dataset.type == 'txt') { this.setData({ - ['fines['+e.currentTarget.dataset.index+'].txt']:e.detail.value, + ['fines[' + e.currentTarget.dataset.index + '].txt']: e.detail.value, }) } - if(e.currentTarget.dataset.type=='price'){ + if (e.currentTarget.dataset.type == 'price') { this.setData({ - ['fines['+e.currentTarget.dataset.index+'].price']:Number(e.detail.value), + ['fines[' + e.currentTarget.dataset.index + '].price']: Number(e.detail.value), }) let fine_total = 0 this.data.fines.forEach(item => { - if(parseFloat(item.price)>0){ - fine_total = fine_total + parseFloat(item.price) + if (parseFloat(item.price) > 0) { + fine_total = fine_total + parseFloat(item.price) } }) this.setData({ @@ -1055,14 +1028,14 @@ Page({ }, //快截输入代办价格 - fillAgency(e){ + fillAgency(e) { this.setData({ - ['agencyList['+e.currentTarget.dataset.index+'].sprice']:parseFloat(e.currentTarget.dataset.sprice), + ['agencyList[' + e.currentTarget.dataset.index + '].sprice']: parseFloat(e.currentTarget.dataset.sprice), }) let srv_total = 0 this.data.agencyList.forEach(item => { - if(item.checked&&parseFloat(item.sprice)>0){ - srv_total = srv_total + parseFloat(item.sprice) + if (item.checked && parseFloat(item.sprice) > 0) { + srv_total = srv_total + parseFloat(item.sprice) } }) this.setData({ @@ -1071,14 +1044,14 @@ Page({ }, //修改代办金额 - inputAgency(e){ + inputAgency(e) { this.setData({ - ['agencyList['+e.currentTarget.dataset.index+'].sprice']:parseFloat(e.detail.value), + ['agencyList[' + e.currentTarget.dataset.index + '].sprice']: parseFloat(e.detail.value), }) let srv_total = 0 this.data.agencyList.forEach(item => { - if(item.checked&&parseFloat(item.sprice)>0){ - srv_total = srv_total + parseFloat(item.sprice) + if (item.checked && parseFloat(item.sprice) > 0) { + srv_total = srv_total + parseFloat(item.sprice) } }) this.setData({ @@ -1087,19 +1060,19 @@ Page({ }, //判断修改代办金额 - inputBlurAgency(e){ - if(!this.data.agencyList[e.currentTarget.dataset.index].sprice||this.data.agencyList[e.currentTarget.dataset.index].price>parseFloat(this.data.agencyList[e.currentTarget.dataset.index].sprice)){ + inputBlurAgency(e) { + if (!this.data.agencyList[e.currentTarget.dataset.index].sprice || this.data.agencyList[e.currentTarget.dataset.index].price > parseFloat(this.data.agencyList[e.currentTarget.dataset.index].sprice)) { wx.showToast({ title: '代办费设置过低', icon: 'none' }) this.setData({ - ['agencyList['+e.currentTarget.dataset.index+'].sprice']:this.data.agencyList[e.currentTarget.dataset.index].price, + ['agencyList[' + e.currentTarget.dataset.index + '].sprice']: this.data.agencyList[e.currentTarget.dataset.index].price, }) let srv_total = 0 this.data.agencyList.forEach(item => { - if(item.checked&&parseFloat(item.sprice)>0){ - srv_total = srv_total + parseFloat(item.sprice) + if (item.checked && parseFloat(item.sprice) > 0) { + srv_total = srv_total + parseFloat(item.sprice) } }) this.setData({ @@ -1109,99 +1082,97 @@ Page({ }, //选择定金 - fillDeposit(e){ + fillDeposit(e) { this.setData({ - 'priceinfo.sdeposit':parseFloat(e.currentTarget.dataset.deposit), + 'priceinfo.sdeposit': parseFloat(e.currentTarget.dataset.deposit), }) }, //修改定金 - inputDeposit(e){ + inputDeposit(e) { this.setData({ - 'priceinfo.sdeposit':parseFloat(e.detail.value), + 'priceinfo.sdeposit': parseFloat(e.detail.value), }) }, //判断修改定金是否小于限制 - inputBlurDeposit(e){ - if(!this.data.priceinfo.sdeposit||this.data.priceinfo.deposit>parseFloat(this.data.priceinfo.sdeposit)){ + inputBlurDeposit(e) { + if (!this.data.priceinfo.sdeposit || this.data.priceinfo.deposit > parseFloat(this.data.priceinfo.sdeposit)) { wx.showToast({ title: '定金设置过低', icon: 'none' }) this.setData({ - 'priceinfo.sdeposit':this.data.priceinfo.deposit, + 'priceinfo.sdeposit': this.data.priceinfo.deposit, }) } }, //选择车身优惠 - fillDisc_money(e){ + fillDisc_money(e) { this.setData({ - 'priceinfo.sdisc_money':parseFloat(e.currentTarget.dataset.disc_money), + 'priceinfo.sdisc_money': parseFloat(e.currentTarget.dataset.disc_money), }) }, //修改车身优惠 - inputDisc_money(e){ + inputDisc_money(e) { this.setData({ - 'priceinfo.sdisc_money':parseFloat(e.detail.value), + 'priceinfo.sdisc_money': parseFloat(e.detail.value), }) }, //判断修改车身优惠是否小于限制 - inputBlurDisc_money(e){ - if(this.data.priceinfo.dis_money= 0){ + if (this.data.oncardIndex != e.detail.value && e.detail.value >= 0) { this.setData({ - c_city_id:this.data.oncardList[e.detail.value].city_id, - oncardIndex:e.detail.value, + c_city_id: this.data.oncardList[e.detail.value].city_id, + oncardIndex: e.detail.value, }) } }, //需开具本地发票 - switchAddrDef:function(e){ + switchAddrDef: function (e) { this.setData({ - if_local_bill:e.detail.value ? 1 :0 + if_local_bill: e.detail.value ? 1 : 0 }) }, @@ -1241,7 +1212,7 @@ Page({ chooseImg(e) { let that = this //上传身份证正面-客户身份证 - if(e.currentTarget.dataset.type=='customer'){ + if (e.currentTarget.dataset.type == 'customer') { wx.chooseImage({ count: 1, // 默认9 sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 @@ -1251,8 +1222,8 @@ Page({ title: '识别中', }) wx.uploadFile({ - url:_.config.api.upImg, - filePath:res.tempFilePaths[0], + url: _.config.api.upImg, + filePath: res.tempFilePaths[0], name: 'img', formData: { 'app': 'liche' @@ -1265,10 +1236,10 @@ Page({ _.apiQuery.getAppIdcardInfo(params).then(res2 => { wx.hideLoading(); that.setData({ - cardid:res2.data.IdNum, - name:res2.data.Name, - customer_address:res2.data.Address, - customer_cardidpic:resp.data.data.url, + cardid: res2.data.IdNum, + name: res2.data.Name, + customer_address: res2.data.Address, + customer_cardidpic: resp.data.data.url, }) }) } @@ -1289,7 +1260,7 @@ Page({ } //上传身份证正面-车主身份证 - if(e.currentTarget.dataset.type=='owner'){ + if (e.currentTarget.dataset.type == 'owner') { wx.chooseImage({ count: 1, // 默认9 sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 @@ -1299,8 +1270,8 @@ Page({ title: '识别中', }) wx.uploadFile({ - url:_.config.api.upImg, - filePath:res.tempFilePaths[0], + url: _.config.api.upImg, + filePath: res.tempFilePaths[0], name: 'img', formData: { 'app': 'liche' @@ -1313,10 +1284,10 @@ Page({ _.apiQuery.getAppIdcardInfo(params).then(res2 => { wx.hideLoading(); that.setData({ - owner_cardid:res2.data.IdNum, - owner_name:res2.data.Name, - address:res2.data.Address, - owner_cardidpic:resp.data.data.url, + owner_cardid: res2.data.IdNum, + owner_name: res2.data.Name, + address: res2.data.Address, + owner_cardidpic: resp.data.data.url, }) }) } @@ -1337,128 +1308,32 @@ Page({ } }, - //获取精品选装 - getAppFine(){ - let params = {}; - params['limbiz'] = 1; - params['page'] = 1; - params['size'] = 100; - _.apiQuery.getAppFine(params).then(res => { - let fineList = res.data.list - let fineArr = [] - fineList.forEach(item => { - fineArr.push(item.title) - item.price='' - }) - fineArr.push('其他') - this.setData({ - fineArr, - fineList, - }) - }); - }, - - //添加精品选装 - changeFine(e) { - if(this.data.fineArr[e.detail.value]=='其他'){ - this.data.fines.push({ - txt:'', - price:'', - }) - this.setData({ - finedIndex:-1, - fines:this.data.fines, - }) - }else{ - let fid = this.data.fineList[e.detail.value].id - let isadd = false - this.data.fines.forEach(item => { - if(item.id == fid){ - isadd = true - } - }) - if(isadd){ - wx.showToast({ - title: '您已添加过了', - icon: 'none', - duration: 2000 - }) - }else{ - this.data.fineList.forEach(item => { - if(item.id == fid){ - this.data.fines.push({ - id:item.id, - txt:item.title, - price:'', - }) - this.setData({ - finedIndex:-1, - fines:this.data.fines, - }) - } - }) - } - } - - }, - - //删除精品选装 - delFine(e){ - let that = this - wx.showModal({ - title: '确定删除吗?', - content: '', - confirmText: "确定删除", - confirmColor: "#36afa2", - cancelText: "取消", - cancelColor: "#666", - success(res) { - if (res.confirm) { - let fines = that.data.fines - fines.splice(e.currentTarget.dataset.index, 1) - that.setData({ - fines, - }) - let fine_total = 0 - that.data.fines.forEach(item => { - if(parseFloat(item.price)>0){ - fine_total = fine_total + parseFloat(item.price) - } - }) - that.setData({ - fine_total, - }) - } - } - }) - }, - //去除空格 - trimAll(ele){ - if(typeof ele === 'string'){ - return ele.split(' ').join(''); - }else{ - console.error(`${typeof ele} is not the expected type, but the string type is expected`) + trimAll(ele) { + if (typeof ele === 'string') { + return ele.split(' ').join(''); + } else { + console.error(`${typeof ele} is not the expected type, but the string type is expected`) } }, - focusAddress(){ + focusAddress() { this.setData({ - addressFocus:true, + addressFocus: true, }) }, - blurAddress(){ + blurAddress() { this.setData({ - addressFocus:false, + addressFocus: false, }) }, //获取车辆选装包 - getAppOptions(){ + getAppOptions() { let params = {}; params['id'] = this.data.car_id; _.apiQuery.getAppOptions(params).then(res => { - if(res.data.list.length>0){ + if (res.data.list.length > 0) { let packageList = res.data.list packageList.forEach(item => { item.checked = false @@ -1478,10 +1353,10 @@ Page({ packageList.forEach(itemA => { itemA.checked = false options_ids.forEach(itemB => { - if(itemA.id === itemB){ + if (itemA.id === itemB) { itemA.checked = true - if(parseFloat(itemA.price)>0){ - options_total = options_total + parseFloat(itemA.price) + if (parseFloat(itemA.price) > 0) { + options_total = options_total + parseFloat(itemA.price) } } }) @@ -1496,36 +1371,35 @@ Page({ //选择首付类型 changeFirstPay(e) { - if(this.data.firstPayIndex != e.detail.value && e.detail.value >= 0){ + if (this.data.firstPayIndex != e.detail.value && e.detail.value >= 0) { this.setData({ - firstPayIndex:e.detail.value, - price_loan0:'', - 'priceinfo.sdeposit':'', + firstPayIndex: e.detail.value, + price_loan0: '', + 'priceinfo.sdeposit': '', }) - if(this.data.firstPayArr[this.data.firstPayIndex]=='0首付'||this.data.firstPayArr[this.data.firstPayIndex]=='按揭'){ + if (this.data.firstPayArr[this.data.firstPayIndex] == '0首付' || this.data.firstPayArr[this.data.firstPayIndex] == '按揭') { this.setData({ - if_zero_firstpay:1, + if_zero_firstpay: 1, }) - } - else{ + } else { this.setData({ - if_zero_firstpay:0, + if_zero_firstpay: 0, }) } } }, //20240526是否店内上牌 - changeIsGetBrand(e){ - console.log('是否店内上牌',e.detail.value) + changeIsGetBrand(e) { + console.log('是否店内上牌', e.detail.value) this.setData({ is_get_brand: e.detail.value }) }, //20240526是否店内投保 - changeIsGetInsure(e){ - console.log('是否店内投保',e.detail.value) + changeIsGetInsure(e) { + console.log('是否店内投保', e.detail.value) this.setData({ is_get_insure: e.detail.value }) diff --git a/pages/signup/code.js b/pages/signup/code.js index 93a9871..26ba63e 100644 --- a/pages/signup/code.js +++ b/pages/signup/code.js @@ -17,11 +17,13 @@ Page({ isShowBg: true, showHomeIcon: true }, - qrcode_img: 'http://qnimg.banping.com/20240511/171539407575215900.png', + qrcode_img: '', qrcode_count_time: 30, wxTimerList: {}, wxTimer: null, - nowTime: "" + nowTime: "", + item: {}, + info: "", }, /** @@ -30,7 +32,7 @@ Page({ onLoad(options) { let that = this wx.getScreenBrightness({ - success: (res)=>{ + success: (res) => { that.setData({ ori_screen_bright: res.value }) @@ -42,13 +44,10 @@ Page({ * 生命周期函数--监听页面显示 */ onShow() { - this.postMpQrcode() - this.setData({ - nowTime:_.utils.getNowTimeFormate("TIME") - }) + this.getappSignConf() }, - - onHide(){ + + onHide() { if (wxTimer) { wxTimer.stop(); wxTimer = null @@ -78,8 +77,8 @@ Page({ /** * 接口请求小程序码 */ - postMpQrcode(){ - if(this.loading) return + getappSignConf() { + if (this.loading) return wx.showLoading({ title: '重新生成中...', mask: true @@ -95,30 +94,38 @@ Page({ }) /////接口方法 - this.setData({ - qrcode_img: this.data.qrcode_img, - loading:false - },()=>{ - wx.hideLoading() - this.getTimes(this.data.qrcode_count_time).then(()=>{ - this.postMpQrcode() + _.apiQuery.getappSignConf().then(res => { + this.setData({ + qrcode_img: res.data.qcode, + qrcode_count_time: res.data.qrcode_count_time, + loading: false, + info: res.data + }, () => { + wx.hideLoading() + this.getTimes(this.data.qrcode_count_time).then(() => { + this.getappSignConf() + }) + this.setScreenBright() }) - this.setScreenBright() }) }, /** * 设置亮度 */ - setScreenBright(){ - wx.setScreenBrightness({value: 1 }) + setScreenBright() { + wx.setScreenBrightness({ + value: 1 + }) }, /** * 恢复亮度 - */ - resetScreenBright(){ - wx.setScreenBrightness({value: this.data.ori_screen_bright }) + */ + resetScreenBright() { + wx.setScreenBrightness({ + value: this.data.ori_screen_bright + }) }, /** @@ -145,8 +152,8 @@ Page({ }, //推送链接 - pushLink(e){ - if(e.currentTarget.dataset.url){ + pushLink(e) { + if (e.currentTarget.dataset.url) { _.$router.openUrlScheme(e.currentTarget.dataset.url) } }, diff --git a/pages/signup/code.wxml b/pages/signup/code.wxml index 879cc6a..5d24ad8 100644 --- a/pages/signup/code.wxml +++ b/pages/signup/code.wxml @@ -4,11 +4,11 @@ - {{nowTime}} + {{info.time}} - 车管家 XXX - 长沙- 长沙店 + {{info.uname}} + {{info.shop}} @@ -16,17 +16,20 @@ 邀请客户微信扫码 - + - {{wxTimerList.wxTimer.tim||0}}秒后失效立即刷新 + {{wxTimerList.wxTimer.tim||0}}秒后失效 + 立即刷新 客户点击签到,授权手机号及地理位置方可签到成功 - - 本期到店礼 - - + + {{info.item.title}} + + + + \ No newline at end of file diff --git a/pages/signup/index.js b/pages/signup/index.js index 9e6271f..9872797 100644 --- a/pages/signup/index.js +++ b/pages/signup/index.js @@ -14,35 +14,31 @@ Page({ isShowBg: true, showHomeIcon: false }, - list: [{ - icon: 'iconfont icon-yonghu', - title: '用户全程0负担', - content: '无需额外付费,即可享受报价权益' - }, { - icon: 'iconfont icon-yonghu', - title: '1次覆盖全范围', - content: '权益覆盖空间站所有合作品牌' - }, { - icon: 'iconfont icon-yonghu', - title: '赔付至高2万元', - content: '根据所购车型官方指导价划分,赔付差价' - }, { - icon: 'iconfont icon-yonghu', - title: '保价长达3个月', - content: '自购车之日起(含购车当日)90天' - }], + list: [], userinfo: {}, has_mobile: false, lat: 0, - lng: 0 + lng: 0, + qkey: '', + info: '', + show_sign: false, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + var obj = wx.getEnterOptionsSync() + if (obj.query.key) { + this.setData({ + qkey: obj.query.key + }) + } + this.getappUserConf({ + 'key': this.data.qkey + }) + this.isBindMobile() }, /** @@ -73,74 +69,109 @@ Page({ }, + getappUserConf(params) { + _.apiQuery.getappUserConf(params).then(res => { + this.setData({ + info: res.data, + show_sign: true + }) + }) + }, /** * 是否绑定用户手机号 */ isBindMobile() { - _.userManager.isBindMobile().then(re => { - if (re) { - this.setData({ - has_mobile: true - }) - } else { - this.setData({ - has_mobile: false - }) - } - }) - }, - //授权手机号码 - getPhoneNumber(e) { - if (e.detail.errMsg && e.detail.errMsg.indexOf('ok') > -1){ - let that = this; - _.apiQuery.authUserPhone(e).then(res=>{ - _.apiQuery.getUserInfo() + let that = this + _.apiQuery.asyncLogin().then(res => { + _.apiQuery.getappUserTel().then(res => { + var isBinMobile = false + if (res.data.mobile) { + isBinMobile = true + } that.setData({ has_mobile: true }) }) - }else{ - app.printErrorClient('failGetPhoneNumber',['用户拒绝授权手机号码:'+JSON.stringify(e)]) + }) + }, + //授权手机号码 + getPhoneNumber(e) { + if (e.detail.errMsg && e.detail.errMsg.indexOf('ok') > -1) { + let that = this; + _.apiQuery.authUserPhone(e).then(res => { + _.apiQuery.getappUserTel().then(res => { + if (res.data.mobile) { + that.setData({ + has_mobile: true + }) + this.bindsignup() + } else { + that.setData({ + has_mobile: false + }) + wx.showToast({ + title: '授权手机号失败', //提示的内容 + duration: 2000, //持续的时间 + icon: 'none', //图标有success、error、loading、none四种 + }) + } + }) + }) + } else { + app.printErrorClient('failGetPhoneNumber', ['用户拒绝授权手机号码:' + JSON.stringify(e)]) } }, /** * 授权地理位置 - */ - getUserLocation(){ + */ + getUserLocation() { let that = this return new Promise(function (resolve, reject) { - if(app.getStorageByKey('u_lat')&&app.getStorageByKey('u_lng')){ + if (app.getStorageByKey('u_lat') && app.getStorageByKey('u_lng')) { that.setData({ lat: app.getStorageByKey('u_lat'), lng: app.getStorageByKey('u_lng') - },()=>{ + }, () => { resolve() }) - }else{ - //u_lat u_lng + } else { + //u_lat u_lng _.userManager.getUserLocation().then(location => { console.log(location) that.setData({ lat: location.lat, lng: location.lng - },()=>{ + }, () => { resolve() }) - }).catch(res=>{ + }).catch(res => { reject(res) }) } }) - }, + }, - /** - * 签到 + /** + * 签到 */ - bindsignup(){ - this.getUserLocation().then(()=>{ - ///...... - //签到方法 + bindsignup() { + this.getUserLocation().then(() => { + let params = { + 'key': this.data.qkey, + 'lng': this.data.lng.toFixed(11), + 'lat': this.data.lat.toFixed(11) + } + _.apiQuery.postAppSign(params).then(res => { + let arr = []; + for (const key in res.data) { + arr.push(`${key}=${res.data[key]}`) + } + let string = '?' + arr.join('&') + wx.navigateTo({ + url: '/pages/signup/status' + string, + }) + }) }) - } + } }) \ No newline at end of file diff --git a/pages/signup/index.wxml b/pages/signup/index.wxml index b1a8956..53654c5 100644 --- a/pages/signup/index.wxml +++ b/pages/signup/index.wxml @@ -4,21 +4,19 @@ - 欢迎到访 - 汽车之家空间中·娄底娄星车卖场 + 欢迎到访 + {{info.biz_name}} - 专属管家 张三 为您服务 + 专属管家 {{info.biz_uname}} 为您服务 - - 价格不用比,买贵赔给你 - + @@ -28,10 +26,11 @@ - - + + + \ No newline at end of file diff --git a/pages/signup/index.wxss b/pages/signup/index.wxss index 7527266..1a07d1a 100644 --- a/pages/signup/index.wxss +++ b/pages/signup/index.wxss @@ -10,4 +10,16 @@ page{ .card{ background-image:linear-gradient(to right,#fff,#fff3d4) +} +.popup{ + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 200px; /* 弹出框宽度 */ + height: 100px; /* 弹出框高度 */ + background-color: #fff; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); + text-align: center; + padding: 20px; } \ No newline at end of file diff --git a/pages/signup/status.js b/pages/signup/status.js index 95d25ce..7b9d15e 100644 --- a/pages/signup/status.js +++ b/pages/signup/status.js @@ -10,7 +10,8 @@ Page({ txtColor: '#fff', bgColor: '#1a1c26', isShowBg: true, - showHomeIcon: false + showHomeIcon: false, + result:[] } }, @@ -18,7 +19,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - + this.setData({ + result:options + }) }, /** diff --git a/pages/signup/status.wxml b/pages/signup/status.wxml index fff5e93..03e0ab6 100644 --- a/pages/signup/status.wxml +++ b/pages/signup/status.wxml @@ -2,24 +2,23 @@ - + 打卡成功 - 您将获得XXX一份,请及时领取 - - + 您将获得{{result.item_title}}一份,请及时领取 + + - - + 打卡失败 - 您未在门店的有效范围之内 + {{result.msg}} \ No newline at end of file diff --git a/pages/signup/status.wxss b/pages/signup/status.wxss index 7883d50..a613016 100644 --- a/pages/signup/status.wxss +++ b/pages/signup/status.wxss @@ -1,7 +1,4 @@ /* pages/signup/status.wxss */ -//- page{ -//- background-image:linear-gradient(to bottom, #f9fdff, #fff); -//- } page{ background-repeat:no-repeat; background-position:center bottom; diff --git a/project.config.json b/project.config.json index 67d4405..de99dab 100644 --- a/project.config.json +++ b/project.config.json @@ -1,5 +1,5 @@ { - "appid": "wx71095d4049de3ed1", + "appid": "wx4733380c110313ec", "compileType": "miniprogram", "libVersion": "3.0.0", "packOptions": { diff --git a/project.private.config.json b/project.private.config.json index a1753b1..572b88f 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -8,6 +8,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "pages/signup/index", + "pathName": "pages/signup/index", + "query": "key=2juXoYIdOE1HZ4s6lMUtJ", + "launchMode": "default", + "scene": null + }, { "name": "待跟进客户", "pathName": "pages/customer/filterList/index",