diff --git a/app.js b/app.js index daf1263..abf04f3 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,5 @@ let config = require("./config/config.js"); -const { defaultObj,huanLeChengObj } = require("./utils/mouldStyle.js") +const { defaultObj, huanLeChengObj } = require("./utils/mouldStyle.js") const Http = require("./utils/HttpBasics"); const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {} @@ -11,7 +11,7 @@ App({ businessSwitch: businessSwitch, //判断是否开启商圈自助积分 }, - onLaunch: function(options) { + onLaunch: function (options) { // wx.hideTabBar() var that = this; if (that.globalData.previewFlag) { //解决微信图片预览重复进入app.js onshow @@ -38,10 +38,10 @@ App({ }, - onShow: function(options) { + onShow: function (options) { //自助积分 需要openId 且必须写在onshow里面 let _this = this - if (businessSwitch && wx.getStorageSync('openId')){ + if (businessSwitch && wx.getStorageSync('openId')) { myPluginInterface.getLocation(wx.getStorageSync('openId')).then(res => { console.log("商圈位置授权onS") }) } // if (businessSwitch) { @@ -78,11 +78,11 @@ App({ /** * 用户登录 */ - userLogin: function(sceneAddress) { + userLogin: function (sceneAddress) { let that = this; // 登录 wx.login({ - success: ({ + success: ({ code }) => { let usrdata = { @@ -96,34 +96,34 @@ App({ usrdata.MId = that.globalData.newArr[2] } Http.post({ - url: config.api.login, - data: usrdata - }) + url: config.api.login, + data: usrdata + }) .then(res => { - if (res.data.mall){ + if (res.data.mall) { that.globalData.marketName = res.data.mall.name ? res.data.mall.name : "" } wx.setStorageSync('openId', res.data.openId) if (businessSwitch && res.data.openId) { - myPluginInterface.getLocation(res.data.openId).then(res => { console.log("商圈位置授权onL") }).catch(err=>{ - console.log(err,"商圈位置授权onL err") + myPluginInterface.getLocation(res.data.openId).then(res => { console.log("商圈位置授权onL") }).catch(err => { + console.log(err, "商圈位置授权onL err") }) } - if (res.data&&res.data.mouldType==0){//原风格尺寸 - this.globalData.goHomeUrl="/index/index" + if (res.data && res.data.mouldType == 0) {//原风格尺寸 + this.globalData.goHomeUrl = "/index/index" this.globalData.mouldConfig = defaultObj - } else if (res.data&&res.data.mouldType == 1){ + } else if (res.data && res.data.mouldType == 1) { this.globalData.goHomeUrl = "/pages/theme/index1/index" this.globalData.mouldConfig = huanLeChengObj } - that.globalData.mouldType = res.data.mouldType ? res.data.mouldType:0 + that.globalData.mouldType = res.data.mouldType ? res.data.mouldType : 0 if (res.data.subMalls) { const squareList = JSON.parse(res.data.subMalls) wx.setStorageSync("squareList", squareList) - if (res.data.mall){ + if (res.data.mall) { wx.setStorageSync("selectedMall", res.data.mall.tenantId) } - + } if (res.data && res.data.score) { if (res.data.score != 0) { @@ -132,9 +132,9 @@ App({ } Http.setToken(res.data.token); that.globalData.token = res.data.token; - console.log(that.tokenCallback,"that.tokenCallback") + console.log(that.tokenCallback, "that.tokenCallback") + - if (that.tokenCallback) { that.tokenCallback(res.data.token); } @@ -145,7 +145,7 @@ App({ title: '提示', showCancel: false, content: '登录失败,请重新尝试', - success: function(res) { + success: function (res) { if (res.cancel) { //点击取消,默认隐藏弹框 } else { @@ -160,19 +160,19 @@ App({ } }) }, - autoUpdate: function() { + autoUpdate: function () { let that = this; if (wx.canIUse('getUpdateManager')) { const updateManager = wx.getUpdateManager() // 1. 检查小程序是否有新版本发布 - updateManager.onCheckForUpdate(function(res) { + updateManager.onCheckForUpdate(function (res) { // 请求完新版本信息的回调 if (res.hasUpdate) { // 检测到新版本,需要更新,给出提示 wx.showModal({ title: '更新提示', content: '检测到新版本,是否下载新版本并重启小程序?', - success: function(res) { + success: function (res) { if (res.confirm) { //2. 用户确定下载更新小程序,小程序下载及更新静默进行 that.downLoadAndUpdate(updateManager) @@ -183,7 +183,7 @@ App({ content: '本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦~', showCancel: false, //隐藏取消按钮 confirmText: "确定更新", //只保留确定更新按钮 - success: function(res) { + success: function (res) { if (res.confirm) { //下载新版本,并重新应用 that.downLoadAndUpdate(updateManager) @@ -207,16 +207,16 @@ App({ /** * 下载小程序新版本并重启应用 */ - downLoadAndUpdate: function(updateManager) { + downLoadAndUpdate: function (updateManager) { let that = this wx.showLoading(); //静默下载更新小程序新版本 - updateManager.onUpdateReady(function() { + updateManager.onUpdateReady(function () { wx.hideLoading() //新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() }) - updateManager.onUpdateFailed(function() { + updateManager.onUpdateFailed(function () { // 新的版本下载失败 wx.showModal({ title: '已经有新版本了哟~', @@ -225,11 +225,11 @@ App({ }) }, globalData: { - userName:"",//用户名 - userAvatarUrl:"",//用户头像地址 - goHomeUrl:'/index/index', - mouldConfig:{},//模板尺寸 - mouldType:0,//主题风格模板 + userName: "",//用户名 + userAvatarUrl: "",//用户头像地址 + goHomeUrl: '/index/index', + mouldConfig: {},//模板尺寸 + mouldType: 0,//主题风格模板 styleLsit: {}, previewFlag: false, //解决图片预览调用noshow activityId: '', //活动id方便授权数据回传 @@ -252,19 +252,19 @@ App({ // ETCP token etcpToken: null, carLogin: false, - marketName:"",//商场,名称 + marketName: "",//商场,名称 // 当前商场信息 market: { name: "" }, // websocket socketClient: null, - socketReceiver: function(e) {}, //收到消息回调 + socketReceiver: function (e) { }, //收到消息回调 curHtml: '', //富文本相关,由于浏览器传参长度有限制 }, // 初始化websocket - initSocket: function() { + initSocket: function () { let that = this; // socket是否连接 let socketConnected = false; @@ -313,7 +313,7 @@ App({ connect(); // 监听 WebSocket 连接打开事件 - wx.onSocketOpen(function(res) { + wx.onSocketOpen(function (res) { console.log("WebSocket 连接成功") socketConnected = true; ws.onopen(); @@ -325,12 +325,12 @@ App({ }) // 监听 WebSocket 接受到服务器的消息事件 - wx.onSocketMessage(function(res) { + wx.onSocketMessage(function (res) { ws.onmessage(res); }) // 监听 WebSocket 错误事件 - wx.onSocketError(function(res) { + wx.onSocketError(function (res) { console.log("WebSocket 错误事件") if (!socketConnected) { // 断线重连 @@ -341,7 +341,7 @@ App({ }) // 监听 WebSocket 连接关闭事件 - wx.onSocketClose(function(res) { + wx.onSocketClose(function (res) { console.log("WebSocket 连接关闭") socketConnected = false; // 断线重连 @@ -357,11 +357,11 @@ App({ * The heart-beating is using window.setInterval() to regularly send heart-beats and/or check server heart-beats. * 可看stomp.js的源码(195,207,489行),由于小程序没有window对象,所以我们要调用小程序的定时器api实现 */ - Stomp.setInterval = function(interval, f) { + Stomp.setInterval = function (interval, f) { return setInterval(f, interval); }; // 结束定时器的循环调用 - Stomp.clearInterval = function(id) { + Stomp.clearInterval = function (id) { return clearInterval(id); }; @@ -369,17 +369,17 @@ App({ that.globalData.socketClient = stompClient; - stompClient.connect({}, function(callback) { + stompClient.connect({}, function (callback) { // 订阅自己的 - stompClient.subscribe('/user/' + config.weapp.AppId + '/' + that.globalData.openId + '/message', function(message, headers) { + stompClient.subscribe('/user/' + config.weapp.AppId + '/' + that.globalData.openId + '/message', function (message, headers) { console.log('收到只发送给我的消息:', message); that.globalData.socketReceiver(JSON.parse(message.body)); // 通知服务端收到消息 message.ack(); }); - stompClient.subscribe('/topic/' + config.weapp.AppId, function(message, headers) { + stompClient.subscribe('/topic/' + config.weapp.AppId, function (message, headers) { console.log('收到TOPIC的消息:', message); that.globalData.socketReceiver(JSON.parse(message.body)); // 通知服务端收到消息 @@ -394,7 +394,9 @@ App({ }, //统一发送消息 - sendSocketMessage: function(msg) { + sendSocketMessage: function (msg) { this.globalData.socketClient.send("/app/message", {}, JSON.stringify(msg)); } -}); \ No newline at end of file +}); +// wxfa336cad86ed598d 测试 +// wx453ae0d37f3550d0 生产 \ No newline at end of file diff --git a/ext.json b/ext.json index 948869d..34dfe10 100644 --- a/ext.json +++ b/ext.json @@ -1,7 +1,14 @@ { "ext": { "attr": { - "mchId": "1623869862", + "car": { + "etcp": { + "etcpAppId": "wx192b7d2e8dcbefd0", + "etcpVersion": "release", + "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback" + } + }, + "mchId": "1604439800", "imgProxy": [ { "newUrl": "https://ctest.malls.iformall.com/img", @@ -17,16 +24,12 @@ } ], "configUrl": "https://ctest.malls.iformall.com/C/api", - "etcpAppId": "wx219a81b9c87aa4f7", - "etcpVersion": "release", - "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback", "businessSwitch": "1", - "businessVersion": "1", "ifHaveWebSocket": "0", "ifHaveCarModular": "1" }, - "name": "富茂光谷测试版", - "weappId": "wx219a81b9c87aa4f7", + "name": "金泸商务", + "weappId": "wx649b3be73c1afe47", "appVersion": "C.test.5.2.0" }, "debug": false, @@ -74,15 +77,15 @@ }, "plugins": { "auto-points-plugin": { - "version": "2.4.0", + "version": "1.3.0", "provider": "wxfab2bf944bfc4da6" }, "live-player-plugin": { - "version": "1.2.5", + "version": "1.3.4", "provider": "wx2b03c6e691cd7370" } }, - "extAppid": "wx219a81b9c87aa4f7", + "extAppid": "wx649b3be73c1afe47", "extEnable": true, "permission": { "scope.userLocation": { diff --git a/index/passCar.js b/index/passCar.js index 38b614e..3b186f0 100644 --- a/index/passCar.js +++ b/index/passCar.js @@ -53,7 +53,7 @@ Page({ remark: '', generalPayPath: '', generalExtraData: {}, - goHomeUrl:"", + goHomeUrl: "", }, getMoreList(e) { let totalNum = this.data.ticketList.length; @@ -68,7 +68,7 @@ Page({ /** * 选择使用的优惠券 */ - choicecoupon: function(e) { + choicecoupon: function (e) { var that = this; wx.showModal({ title: '确定是否使用停车券', @@ -98,53 +98,53 @@ Page({ title: "加载中" }); Http.get({ - url: config.api.couponOrderCarList, - data: { - pageNum: pageNum, - pageSize: 15, - couponOrderStatus: key - } - }).then(res => { + url: config.api.couponOrderCarList, + data: { + pageNum: pageNum, + pageSize: 15, + couponOrderStatus: key + } + }).then(res => { + that.setData({ + curTotalpageNum: res.data.pages, + curPageNum: res.data.pageNum, + totalTicketNum: res.data.total + }) + res.data.list.map(file => { + file.expiredTime = format.formatTime( + file.expiredTime, + "yyyy-MM-dd hh:mm:ss" + ); + }); + setTimeout(function () { + wx.hideLoading(); + }, 1200); + if (pageNum >= res.data.pages) { that.setData({ - curTotalpageNum: res.data.pages, - curPageNum: res.data.pageNum, - totalTicketNum: res.data.total - }) - res.data.list.map(file => { - file.expiredTime = format.formatTime( - file.expiredTime, - "yyyy-MM-dd hh:mm:ss" - ); + allow_load: false }); - setTimeout(function() { - wx.hideLoading(); - }, 1200); - if (pageNum >= res.data.pages) { - that.setData({ - allow_load: false - }); - } - /** - * 先赋值后渲染页面 - * concat 不会改变原数组值 - * push 会改变原数组值,但不会一条一条插入,而是整个数组插入 - */ - if (pageNum == 1) { - that.setData({ - ticketList: res.data.list, - curPageNum: pageNum - }); - } else { - that.setData({ - ticketList: that.data.ticketList.concat(res.data.list) - }); - } - // that.data.ticketList = that.data.ticketList.concat(res.data.list); + } + /** + * 先赋值后渲染页面 + * concat 不会改变原数组值 + * push 会改变原数组值,但不会一条一条插入,而是整个数组插入 + */ + if (pageNum == 1) { + that.setData({ + ticketList: res.data.list, + curPageNum: pageNum + }); + } else { + that.setData({ + ticketList: that.data.ticketList.concat(res.data.list) + }); + } + // that.data.ticketList = that.data.ticketList.concat(res.data.list); - wx.hideLoading(); - }) + wx.hideLoading(); + }) .catch(err => { - setTimeout(function() { + setTimeout(function () { wx.hideLoading(); }, 1200); wx.showToast({ @@ -154,21 +154,20 @@ Page({ mask: false }); }) - } else {} + } else { } }, //点击跳转到券详情页面 - gotouse: function(e) { + gotouse: function (e) { wx.navigateTo({ - url: `/pages/passCar/couponDetail/couponDetail?quancode=${ - e.currentTarget.dataset.quancode + url: `/pages/passCar/couponDetail/couponDetail?quancode=${e.currentTarget.dataset.quancode }`, - success: function(res) { + success: function (res) { // success }, - fail: function() { + fail: function () { // fail }, - complete: function() { + complete: function () { // complete } }); @@ -176,7 +175,7 @@ Page({ /** * 车牌轮播滑动 */ - onSlideChangeEnd: function(e) { + onSlideChangeEnd: function (e) { var that = this; /** * 获得当前的车牌号码 @@ -194,7 +193,7 @@ Page({ }, //停车费用为0 - paySuccess: function() { + paySuccess: function () { wx.showModal({ title: '支付成功', content: '请15分钟内离场', @@ -202,16 +201,16 @@ Page({ }) }, - gotomange: function() { + gotomange: function () { wx.navigateTo({ url: '/pages/managelicenseplate/managelicenseplate', }) }, - bindfail: function(res) { + bindfail: function (res) { console.log(123) console.log(res) }, - gotoCarMini: function(e) { + gotoCarMini: function (e) { console.log(478) var that = this // etcp parkVendor1 @@ -232,19 +231,19 @@ Page({ }) } }, - showquan: function() { + showquan: function () { wx.navigateTo({ url: '/pages/passCar/couponList/couponList', }) }, - gotodetail: function(e) { + gotodetail: function (e) { wx.showModal({ title: '缴费规则', content: e.target.dataset.rule, showCancel: false, }) }, - onShow: function(options) { + onShow: function (options) { this.setData({ goHomeUrl: app.globalData.goHomeUrl }) @@ -262,6 +261,7 @@ Page({ payPath: extConfig.attr.car.etcp.payPath, ifHaveCarModular: extConfig.attr.ifHaveCarModular }) + console.log(this.data.ifHaveCarModular, 'ifHaveCarModular'); if (app.globalData.token) { that.getList(); that.init(); @@ -305,11 +305,11 @@ Page({ }, - cancelMove: function() { + cancelMove: function () { console.log(111) return false; }, - onHide: function() { + onHide: function () { this.setData({ allow_load: true, showTicketModal: false, @@ -317,8 +317,8 @@ Page({ ticketList: [] }) }, - onLoad: function(options) { - + onLoad: function (options) { + var that = this; /** * 获得分享小程序的 @@ -326,11 +326,11 @@ Page({ * desc */ Http.get({ - url: config.api.getWeapNote, - data: { - appId: config.weapp.AppId, - } - }) + url: config.api.getWeapNote, + data: { + appId: config.weapp.AppId, + } + }) .then(res => { let weapNote = JSON.parse(res.data.weapNote); that.setData({ @@ -346,7 +346,7 @@ Page({ that.setData({ scene: scene }); - if (app.globalData.token) {} else { + if (app.globalData.token) { } else { // app.getLocation(); that.userLogin() } @@ -355,7 +355,7 @@ Page({ /** * 用户登录 */ - userLogin: function() { + userLogin: function () { var that = this; // 登录 wx.login({ @@ -363,7 +363,7 @@ Page({ code }) => { wx.getSystemInfo({ - success: function(res) { + success: function (res) { that.setData({ systemInfo: JSON.stringify(res) }) @@ -388,9 +388,9 @@ Page({ }; } Http.post({ - url: config.api.login, - data: usrdata - }) + url: config.api.login, + data: usrdata + }) .then(res => { app.globalData.token = res.data.token; Http.setToken(res.data.token); @@ -403,7 +403,7 @@ Page({ data: {} }); }) - .then(res => {}) + .then(res => { }) .catch(err => { if (err.code == 11004) { // 用户昵称未授权 @@ -424,33 +424,33 @@ Page({ /** * 检查用户是否有车 */ - checkUserCarStatus: function() { + checkUserCarStatus: function () { var that = this; Http.get({ - url: config.api.userCarCount, - data: {} - }).then(res => { - if (res.data > 0) { - // 用户名下有车 - app.globalData.phone = res.data.phone; - app.globalData.supportCar = true; - // 共同登录 - that.userCarLogin(); - } - }) - .catch(err => {}) + url: config.api.userCarCount, + data: {} + }).then(res => { + if (res.data > 0) { + // 用户名下有车 + app.globalData.phone = res.data.phone; + app.globalData.supportCar = true; + // 共同登录 + that.userCarLogin(); + } + }) + .catch(err => { }) }, - jumpToAdd: function() { + jumpToAdd: function () { wx.navigateTo({ url: `/pages/addPark/addPark?flags=managepalte` }); }, - passc: function() { + passc: function () { wx.navigateTo({ url: '/pages/ques/ques', }) }, - goExplain: function() { + goExplain: function () { wx.navigateTo({ url: '/pages/tcExplain/tcExplain', }) @@ -460,7 +460,7 @@ Page({ /** * 券绑定车牌 */ - bindCoupon: function(quanid, quantitle) { + bindCoupon: function (quanid, quantitle) { wx.showLoading({ title: '使用中...', }) @@ -504,9 +504,9 @@ Page({ } } Http.post({ - url: config.api.getCarCoupon, - data: postCouponData - }) + url: config.api.getCarCoupon, + data: postCouponData + }) .then(res => { wx.hideLoading() // if(res.data){ @@ -554,7 +554,7 @@ Page({ // } // }, - closeTicketModal: function() { + closeTicketModal: function () { this.setData({ showTicketModal: false }) @@ -562,7 +562,7 @@ Page({ /** * 停车券 弹框 */ - openTicketModal: function() { + openTicketModal: function () { this.setData({ showTicketModal: true, allow_load: true, @@ -581,17 +581,17 @@ Page({ getList() { var that = this; Http.get({ - url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", - data: { - pageNum: 1, - pageSize: 15, - couponOrderStatus: 0 - } - }).then(res => { - that.setData({ - couponList: res.data.list - }); - }) + url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0", + data: { + pageNum: 1, + pageSize: 15, + couponOrderStatus: 0 + } + }).then(res => { + that.setData({ + couponList: res.data.list + }); + }) .catch(err => { console.log(err) }) @@ -601,7 +601,7 @@ Page({ /** * 共同登录 */ - init: function(carNumber) { + init: function (carNumber) { var that = this; app.parkInitCallback = token => { that.initPark(); @@ -616,9 +616,9 @@ Page({ * 判断是否授权手机号 */ Http.get({ - url: config.api.checkPhoneStatus, - data: {} - }) + url: config.api.checkPhoneStatus, + data: {} + }) .then(res => { Http.post({ url: config.api.carInit, @@ -685,7 +685,7 @@ Page({ } }, - bindCar: function(carNum) { + bindCar: function (carNum) { var that = this; // ETCP var etcpData = { @@ -697,9 +697,9 @@ Page({ }; var postData = app.globalData.parkVendor == 1 ? etcpData : otherData; Http.post({ - url: config.api.bindCar, - data: postData - }) + url: config.api.bindCar, + data: postData + }) .then(res => { that.setData({ addCar: null @@ -709,7 +709,7 @@ Page({ title: "提示", showCancel: false, content: "绑车牌成功!", - success: function() {} + success: function () { } }); }) .catch(error => { @@ -717,19 +717,19 @@ Page({ title: "提示", showCancel: false, content: error.data.message, - success: function() {} + success: function () { } }); }); }, /** * 车场信息获取 */ - initPark: function() { + initPark: function () { var that = this; Http.get({ - url: config.api.getParkInfo, - data: {} - }) + url: config.api.getParkInfo, + data: {} + }) .then(res => { that.setData({ park: res.data @@ -784,11 +784,11 @@ Page({ /** * 车场状态获取 */ - getParkStatus: function() { + getParkStatus: function () { var that = this; Http.get({ - url: config.api.getParkStatus, - }) + url: config.api.getParkStatus, + }) .then(res => { console.log(res) }) @@ -805,30 +805,30 @@ Page({ /** * 绑定车获取 */ - initUsrCarList: function(flag) { + initUsrCarList: function (flag) { var that = this; Http.get({ - url: config.api.getUserCarList, - data: {} - }).then(res => { + url: config.api.getUserCarList, + data: {} + }).then(res => { + that.setData({ + carList: res.data + }); + /** + * flag ==flags + * 表示从首页onShow进来的 + */ + if (flag == "flags" && res.data.length > 0) { + var listCardNum = res.data[0].carNumber; that.setData({ - carList: res.data - }); + listCardNum: listCardNum + }) /** - * flag ==flags - * 表示从首页onShow进来的 + * 获得停车费用 */ - if (flag == "flags" && res.data.length > 0) { - var listCardNum = res.data[0].carNumber; - that.setData({ - listCardNum: listCardNum - }) - /** - * 获得停车费用 - */ - that.getStopFee(listCardNum); - } - }) + that.getStopFee(listCardNum); + } + }) .catch(err => { wx.showToast({ title: err.message, @@ -842,19 +842,19 @@ Page({ /** * 获得停车费用修改 */ - getStopFee: function(carNumber) { + getStopFee: function (carNumber) { let that = this; let postData = app.globalData.parkVendor == 1 ? { etcpToken: app.globalData.etcpToken, carNumber: carNumber } : { - carNumber: carNumber - }; + carNumber: carNumber + }; Http.post({ - url: config.api.getCarStopFee, - data: postData - }) + url: config.api.getCarStopFee, + data: postData + }) .then(res => { console.log(res) if (app.globalData.parkVendor == 1) { // ETCP @@ -955,7 +955,7 @@ Page({ /** * 下拉刷新 */ - onPullDownRefresh: function(e) { + onPullDownRefresh: function (e) { let that = this; that.initUsrCarList("flags"); that.setData({ diff --git a/index/passCar.wxml b/index/passCar.wxml index ccf2c0e..dbe9a3b 100644 --- a/index/passCar.wxml +++ b/index/passCar.wxml @@ -1,10 +1,11 @@ - + - + {{park.addr}} - ({{park.number}}车位) + ({{park.number}}车位) + @@ -48,7 +49,7 @@ 备注: - {{remark}} + {{remark}} @@ -63,14 +64,14 @@ 立即支付 - 立即支付 + 立即支付 立即支付 - 立即支付 + 立即支付 @@ -80,23 +81,23 @@ 立即支付 - + 立即支付 - 立即支付 + 立即支付 - - + + 立即支付 - 立即支付 + 立即支付 - 立即支付 + 立即支付 @@ -150,7 +151,7 @@ - + 智慧停车即将上线 敬请期待 @@ -172,9 +173,9 @@ - - - + + + @@ -185,8 +186,8 @@ {{item.subTitle}} - 售价:{{item.salePrice/100}}元{{item.price/100}}元 - {{item.price/100}}小时 + 售价:{{item.salePrice/100}}元{{item.price/100}}元 + {{item.price/100}}小时 @@ -196,7 +197,7 @@ {{item.expiredTime}} - + {{content}} diff --git a/pages/coupon/childDetail/childDetail.js b/pages/coupon/childDetail/childDetail.js index 57a5b5c..1324efc 100644 --- a/pages/coupon/childDetail/childDetail.js +++ b/pages/coupon/childDetail/childDetail.js @@ -754,14 +754,12 @@ Page({ // 有价券 if (!type && type != 'free') { wx.navigateTo({ - url: `/pages/order/detail/index?orderId=${ - orderId + url: `/pages/order/detail/index?orderId=${orderId }&cardIf=true&contentType=${_this.data.contentType}&composeOrderType=${composeOrderType}` }); } else if (type == 'free') { wx.navigateTo({ - url: `/pages/order/detail/index?orderId=${ - orderId + url: `/pages/order/detail/index?orderId=${orderId }&contentType=${_this.data.contentType}&composeOrderType=${composeOrderType}` }); } diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 589c449..5c9461b 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -9,7 +9,7 @@ Page({ priceAndStockObj: {},//存放价格和库存 goHomeUrl: "", mouldType: 0, - mouldConfig:{}, + mouldConfig: {}, navigationBarHeight, homeSelectedO: imgurl.homeSelectedO.url, isshowposter: false, //是否显示分享弹框 @@ -29,7 +29,7 @@ Page({ swiperCurrent: 0, detailPicture: [], coverPicture: [], - couponList:[], + couponList: [], data: { title: null }, @@ -61,7 +61,7 @@ Page({ scaleData: null, skewData: null, matrixData: null, - opacity: 0, + opacity: 0, queueData: null, zIndex: 11, display: "none", @@ -93,18 +93,18 @@ Page({ //图文混排 curHtml: '', contentType: 0, - page:1,//查询商户优惠券page - idList:[], + page: 1,//查询商户优惠券page + idList: [], }, /** * 显示分享弹框 */ - showshare: function() { + showshare: function () { this.setData({ isshowposter: true, }) }, - getCouponList: function(id) { + getCouponList: function (id) { let that = this; let data; data = { @@ -114,39 +114,39 @@ Page({ pageSize: 5, } Http.post({ - url: config.api.listByMerchant, - data: data - }).then(res => { - if (res.data.page.list<=0){ - return - } - let dataLsit = [] - // dataLsit = that.data.couponList - dataLsit=res.data.page.list - dataLsit.map((item,index)=>{ - if (item.id == that.data.couponChannelId){ - dataLsit.splice(index,1) - } - }) - if (that.data.page>1){ - let tmpeLsit = that.data.couponList - tmpeLsit.push(...dataLsit) - that.setData({ - couponList: tmpeLsit, - }) - }else{ - that.setData({ - couponList: dataLsit, - }) + url: config.api.listByMerchant, + data: data + }).then(res => { + if (res.data.page.list <= 0) { + return + } + let dataLsit = [] + // dataLsit = that.data.couponList + dataLsit = res.data.page.list + dataLsit.map((item, index) => { + if (item.id == that.data.couponChannelId) { + dataLsit.splice(index, 1) } - - - // if (res.data && res.data.qrCode){ - // that.setData({ - // qrCode: res.data.qrCode, - // }) - // } }) + if (that.data.page > 1) { + let tmpeLsit = that.data.couponList + tmpeLsit.push(...dataLsit) + that.setData({ + couponList: tmpeLsit, + }) + } else { + that.setData({ + couponList: dataLsit, + }) + } + + + // if (res.data && res.data.qrCode){ + // that.setData({ + // qrCode: res.data.qrCode, + // }) + // } + }) .catch(err => { wx.showToast({ title: err.errMsg, @@ -159,7 +159,7 @@ Page({ /** * 隐藏分享弹框 */ - hidemodal: function() { + hidemodal: function () { this.setData({ isshowposter: false, }) @@ -176,7 +176,7 @@ Page({ url: `/pages/canvas/index?couponChannelId=${this.data.data.id}` }) }, */ - showPoster: function() { + showPoster: function () { //跳转到海报生成页 let that = this; Http.get({ @@ -199,32 +199,32 @@ Page({ }) }, - swiperChange: function(e) { + swiperChange: function (e) { this.setData({ swiperCurrent: e.detail.current }); }, - gohome(e){ - console.log(e.currentTarget.dataset.id,"123") + gohome(e) { + console.log(e.currentTarget.dataset.id, "123") wx.navigateTo({ url: `/pages/fillIndent/fillIndent?couponChannelId=${e.currentTarget.dataset.couponchannelid}&couponId=${e.currentTarget.dataset.couponid}&shippingtype=${e.currentTarget.dataset.shippingtype}`, }) }, - gochild(e){ + gochild(e) { let id = e.currentTarget.dataset.id wx.navigateTo({ url: `/pages/coupon/childDetail/childDetail?couponIds=${id}`, }) }, //获取当前登录用户信息 - getUserInfo: function() { + getUserInfo: function () { let that = this; // 获取用户信息 Http.get({ - url: config.api.getScore, - data: {} - }) + url: config.api.getScore, + data: {} + }) .then(res => { console.log(res) that.getQueryCardStatus() @@ -245,9 +245,9 @@ Page({ updateDate: util.formatTime(Number(that.data.cardData.updateDate), "yyyy-MM-dd hh:mm:ss") } Http.get({ - url: config.api.queryCardStatus, - data: param - }) + url: config.api.queryCardStatus, + data: param + }) .then(res => { console.log(res, 333333333333) }) @@ -270,9 +270,9 @@ Page({ receivedDisabled: true }) Http.post({ - url: config.api.cardAccept, - data: param - }) + url: config.api.cardAccept, + data: param + }) .then(res => { wx.showToast({ title: '领取成功!', @@ -301,7 +301,7 @@ Page({ showCardOffer: false }) }, - goback: function() { + goback: function () { let this_ = this wx.switchTab({ url: this_.data.goHomeUrl, @@ -310,7 +310,7 @@ Page({ /** * 点击提交问题单选 */ - formSubmit: function(e) { + formSubmit: function (e) { console.log(e); let that = this; /** @@ -328,12 +328,12 @@ Page({ console.log(answserIs) console.log(e.currentTarget.dataset.questionid) Http.post({ - url: config.api.answerQuestion, - data: { - answer: answserIs, - questionId: e.currentTarget.dataset.questionid - } - }) + url: config.api.answerQuestion, + data: { + answer: answserIs, + questionId: e.currentTarget.dataset.questionid + } + }) .then(res => { that.closeQuestion(); }) @@ -349,29 +349,29 @@ Page({ /** * 多选 */ - checkboxChange: function(e) { + checkboxChange: function (e) { console.log(e) this.setData({ anwserId: e.detail.value }) }, - closeQuestion: function() { + closeQuestion: function () { let that = this; that.setData({ display: "none", zIndex: 11, opacity: 0 }) - setTimeout(function() { + setTimeout(function () { that.orderFunc(); }, 500) }, - gotopay: function(e) { + gotopay: function (e) { app.globalData.previewFlag = true /* 判断是否授权*/ Http.get({ - url: config.api.checkUserStatus, + url: config.api.checkUserStatus, data: { token: app.globalData.token } @@ -394,13 +394,13 @@ Page({ queueData: null, showbutton: true, formId: formId - }) + }) Http.get({ - url: config.api.getQuestion, - data: { - couponType: JSON.stringify(that.data.data.type) - } - }) + url: config.api.getQuestion, + data: { + couponType: JSON.stringify(that.data.data.type) + } + }) .then(res => { wx.hideLoading(); if (res.data == undefined) { @@ -448,7 +448,7 @@ Page({ }, setIntervalTime(end_time) { - + let that = this; var EndTime = end_time; var NowTime = new Date().getTime(); @@ -473,19 +473,19 @@ Page({ }) //如果倒计时结束,需要重新查询一下券的状态 // 给getDetail一个标识 - + setTimeout(function () { console.log("当前时间", new Date().getTime()); that.getDetail(that.data.couponChannelId, 'endclock'); }, 300); - + } total_micro_second -= 1000; }, - countdown: function(end_time) { + countdown: function (end_time) { let that = this; that.setIntervalTime(end_time); - that.data.setInterval = setInterval(function() { + that.data.setInterval = setInterval(function () { that.setIntervalTime(end_time); }, 1000) }, @@ -516,7 +516,7 @@ Page({ onLoad(options) { this.setData({ mouldType: app.globalData.mouldType, - + }) let that = this; if (options.g) { @@ -529,19 +529,19 @@ Page({ onshow: false }) if (options && (options.couponChannelId || options.couponIds)) { - if (options.couponIds){ + if (options.couponIds) { this.setData({ couponIds: options.couponIds }) that.getDetail(options.couponIds, 'notendclock'); - }else{ + } else { that.getDetail(options.couponChannelId, 'notendclock'); } - + } /** - * 转赠判断 + * 转赠判断 */ if (options.cuserId) { this.setData({ @@ -617,23 +617,23 @@ Page({ }) }, - - getDetail: function(couponChannelId, flag) { + + getDetail: function (couponChannelId, flag) { let that = this; - let data={}; + let data = {}; that.getCouponMerchant(couponChannelId);//获取适用门店 that.getCouponPriceAndStock(couponChannelId);//获取券价格和库存 - if (that.data.couponIds){ + if (that.data.couponIds) { data.couponId = couponChannelId - }else{ + } else { data.couponChannelId = couponChannelId } var parmer = { url: config.api.couponDetail, - data:data + data: data }; Http.get(parmer) .then(res => { @@ -736,7 +736,7 @@ Page({ that.setData({ data: res.data, }); - if(res.data.type == 10){ + if (res.data.type == 10) { that.setData({ salePriceStr: res.data.salePriceStr, pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd"), @@ -772,7 +772,7 @@ Page({ /** * 邀请好友继续砍价 */ - inviteFriend: function(e) { + inviteFriend: function (e) { let that = this; let formId = e.detail.formId; that.setData({ @@ -788,27 +788,25 @@ Page({ let that = this; // 支付成功 Http.post({ - url: config.api.payOrderUpdate, - data: { - payOrderId: payOrderId, - composeOrderId: orderId, - status: status, - reason: reason - } - }) + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + composeOrderId: orderId, + status: status, + reason: reason + } + }) .then(res => { wx.hideLoading() // 有价券 if (!type && type != 'free') { wx.navigateTo({ - url: `/pages/order/detail/index?orderId=${ - orderId + url: `/pages/order/detail/index?orderId=${orderId }&cardIf=true&contentType=${_this.data.contentType}&composeOrderType=${composeOrderType}` }); } else if (type == 'free') { wx.navigateTo({ - url: `/pages/order/detail/index?orderId=${ - orderId + url: `/pages/order/detail/index?orderId=${orderId }&contentType=${_this.data.contentType}&composeOrderType=${composeOrderType}` }); } @@ -816,18 +814,18 @@ Page({ .catch(err => { console.log(err); if (!type) { - setTimeout(function() { + setTimeout(function () { _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this, composeOrderType); }, 2000) } }) }, - checkPhoneStatus: function() { + checkPhoneStatus: function () { let that = this; Http.get({ - url: config.api.checkPhoneStatus, - data: {} - }) + url: config.api.checkPhoneStatus, + data: {} + }) .then(res => { console.log(666, '授权成功!') that.receiveCard() @@ -857,7 +855,7 @@ Page({ }) }, // 券包支付 - + /** * 发起支付 */ @@ -870,9 +868,9 @@ Page({ } }).then(res => { Http.get({ - url: config.api.checkPhoneStatus, - data: {} - }) + url: config.api.checkPhoneStatus, + data: {} + }) .then(res => { // 发起砍价 if (discount == 'discount') { @@ -899,24 +897,24 @@ Page({ couponChannelId: "" + that.data.couponChannelId, couponId: "" + that.data.couponId, formId: "" + that.data.formId, - } + } } - console.log(data,"data") + console.log(data, "data") let url = "" let tempObj; let tempArr = [] - if(that.data.data.type==12){ + if (that.data.data.type == 12) { url = config.api.couponPackageSave - tempObj={ - signleOrder:{ + tempObj = { + signleOrder: { couponChannelId: "" + that.data.couponChannelId, couponId: "" + that.data.couponId, formId: "" + that.data.formId, }, - count:"1" + count: "1" } tempArr.push(tempObj) - }else{ + } else { url = config.api.orderSave } /** @@ -924,7 +922,7 @@ Page({ */ return Http.post({ url: url, - data: that.data.data.type == 12 ? JSON.stringify(tempArr):data + data: that.data.data.type == 12 ? JSON.stringify(tempArr) : data }); }) .catch(err => { @@ -1016,9 +1014,9 @@ Page({ } }) .then(res => { - console.log(res,"res123") + console.log(res, "res123") if (discount != 'discount') { - if (typeof(res) != "undefined") { + if (typeof (res) != "undefined") { let orderId = "" + res.data.mainOrderId; that.setData({ orderId: orderId, @@ -1030,12 +1028,12 @@ Page({ * 支付订单创建 */ Http.post({ - url: config.api.payOrderCreate, - data: { - orderId: orderId, - composeOrderType: res.data.composeOrderType - } - }) + url: config.api.payOrderCreate, + data: { + orderId: orderId, + composeOrderType: res.data.composeOrderType + } + }) .then(res => { var payOrderId = "" + res.data.payOrderId; wx.hideLoading(); @@ -1078,7 +1076,7 @@ Page({ }) return; }, - complete: res => {} + complete: res => { } }); /// End payment -------- }) @@ -1158,7 +1156,7 @@ Page({ title: '提示', content: "您有未支付订单,请到“我的-我的砍价”进行支付", confirmText: "我的砍价", - success: function(res) { + success: function (res) { if (res.confirm) { wx.navigateTo({ url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.disOrderNumber}&composeOrderType=${that.data.composeOrderType}`, @@ -1171,19 +1169,19 @@ Page({ title: '提示', content: '您有未支付订单,请先进行支付', confirmText: "去支付", - success: function(res1) { + success: function (res1) { if (res1.confirm) { - - if (that.data.composeOrderType>0){//券包 + + if (that.data.composeOrderType > 0) {//券包 wx.navigateTo({ url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}&contentType=${that.data.contentType}&composeOrderType=${that.data.composeOrderType}`, - }) - }else{ + }) + } else { wx.navigateTo({ url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}&contentType=${that.data.contentType}&composeOrderType=${that.data.composeOrderType}`, }) } - + } } }) @@ -1210,26 +1208,26 @@ Page({ this.countdown(this.data.begin_time) } }, - onUnload: function() { + onUnload: function () { let that = this; clearInterval(that.data.setInterval) }, - onHide: function() { + onHide: function () { let that = this; clearInterval(that.data.setInterval) }, - onShareAppMessage: function(options) { + onShareAppMessage: function (options) { app.globalData.previewFlag = true var that = this; console.log(options) var shareObj = { title: that.data.data.title, path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`, - success: function(res) { - if (res.errMsg == 'shareAppMessage:ok') {} + success: function (res) { + if (res.errMsg == 'shareAppMessage:ok') { } }, - fail: function(error) { - if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} + fail: function (error) { + if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { } } }; // 来自页面内的按钮的转发 @@ -1242,16 +1240,16 @@ Page({ return shareObj; }, // 下拉刷新 - onPullDownRefresh: function() { + onPullDownRefresh: function () { this.getDetail(this.data.couponChannelId); wx.stopPullDownRefresh() }, - onReachBottom:function(){ + onReachBottom: function () { this.setData({ - page:this.data.page+1 + page: this.data.page + 1 }) - - if (this.data.idList.length>0){ + + if (this.data.idList.length > 0) { this.getCouponList(this.data.idList) } } diff --git a/pages/coupon/detail/index.json b/pages/coupon/detail/index.json index 20677fc..0af1d50 100644 --- a/pages/coupon/detail/index.json +++ b/pages/coupon/detail/index.json @@ -6,6 +6,6 @@ "c-coupons": "../../../components/coupons/index" }, "navigationBarTitleText": "", - "backgroundColor":"#f4f4f4", + "backgroundColor": "#f4f4f4", "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/coupon/detail/index.wxss b/pages/coupon/detail/index.wxss index e502b34..8de95ee 100644 --- a/pages/coupon/detail/index.wxss +++ b/pages/coupon/detail/index.wxss @@ -551,7 +551,7 @@ button::after { border-bottom: 1rpx solid #eee; } -.quessss >view:last-child { +.quessss>view:last-child { border-bottom: 0; } @@ -628,7 +628,8 @@ button::after { bottom: 15rpx; } -.btns .fr, .btns .fl { +.btns .fr, +.btns .fl { width: 270rpx; height: 95rpx; border-radius: 48rpx; @@ -796,7 +797,8 @@ button::after { background: rgba(201, 201, 201, 0.1); } -checkbox-group, radio-group { +checkbox-group, +radio-group { height: 400rpx; overflow-y: scroll; } @@ -986,4 +988,4 @@ checkbox-group, radio-group { font-size: 24rpx; margin: 10px; text-decoration: line-through; -} +} \ No newline at end of file diff --git a/pages/freeBannerDetail/index.js b/pages/freeBannerDetail/index.js index 4fe9a8d..02fd45b 100644 --- a/pages/freeBannerDetail/index.js +++ b/pages/freeBannerDetail/index.js @@ -23,7 +23,7 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { + onLoad: function (options) { if (app.globalData.token) { const that = this; that.setData({ @@ -42,7 +42,7 @@ Page({ header: { 'content-type': 'application/html' }, - success: function(res) { + success: function (res) { var temp = WxParse.wxParse('article', 'html', res.data, that, 5); } }) @@ -66,7 +66,7 @@ Page({ header: { 'content-type': 'application/html' }, - success: function(res) { + success: function (res) { var temp = WxParse.wxParse('article', 'html', res.data, that, 5); } }) @@ -78,22 +78,22 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow: function() { + onShow: function () { this.setData({ date: new Date() }) }, - onShareAppMessage: function(options) { + onShareAppMessage: function (options) { var that = this; console.log(`/pages/freeBannerDetail/index?id=${that.data.data.id}`) var shareObj = { title: that.data.title, path: `/pages/freeBannerDetail/index?id=${that.data.data.id}`, - success: function(res) { - if (res.errMsg == 'shareAppMessage:ok') {} + success: function (res) { + if (res.errMsg == 'shareAppMessage:ok') { } }, - fail: function(error) { - if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} + fail: function (error) { + if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { } } }; diff --git a/project.config.json b/project.config.json index 66f60cf..b799cdd 100644 --- a/project.config.json +++ b/project.config.json @@ -7,7 +7,7 @@ "setting": { "urlCheck": true, "es6": true, - "enhance": false, + "enhance": true, "postcss": true, "minified": true, "newFeature": true, diff --git a/project.private.config.json b/project.private.config.json index dc2cbdc..6692461 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -4,5 +4,5 @@ "setting": { "compileHotReLoad": true }, - "libVersion": "2.21.4" + "libVersion": "2.26.2" } \ No newline at end of file