diff --git a/pages/coupon/confirmation/confirmation.js b/pages/coupon/confirmation/confirmation.js index 8af8b7e..a8fc660 100644 --- a/pages/coupon/confirmation/confirmation.js +++ b/pages/coupon/confirmation/confirmation.js @@ -16,13 +16,18 @@ Page({ mallTenantId: '' }, onLoad: function (options) { - console.log(options); + console.log(options, 'options'); if (options.mallTenantId) { this.setData({ mallTenantId: options.mallTenantId, }) + } else { + this.setData({ + mallTenantId: tt.getStorageSync('mallTenantId'), + }) } + console.log(this.data.mallTenantId, 'mallTenantId'); tt.showLoading({ title: "加载中..." @@ -298,8 +303,9 @@ Page({ /** * 支付订单更新 */ - payOrderUpdate: (orderId, payOrderId, status, reason, type, _this, composeOrderType) => { + payOrderUpdate(orderId, payOrderId, status, reason, type, _this, composeOrderType) { let that = this; + // 支付成功 Http.post({ url: config.api.payOrderUpdate, @@ -307,21 +313,31 @@ Page({ payOrderId: payOrderId, composeOrderId: orderId, status: status, - reason: reason + reason: reason, + mallTenantId: that.data.mallTenantId } }) .then(res => { tt.hideLoading() // 有价券 if (!type && type != 'free') { - tt.navigateTo({ - url: `/pages/order/detail/index?orderId=${orderId - }` - }); + setTimeout(() => { + let url = "" + if (_this.data.orderFlag) { + tt.redirectTo({ + url: `/pages/order/detail/index?orderId=${orderId}&dingdan=order}&mallTenantId=${that.data.mallTenantId}` + }); + } else { + tt.redirectTo({ + url: `/pages/order/detail/index?orderId=${orderId}}&mallTenantId=${that.data.mallTenantId}` + }); + } + + }, 1600); } else if (type == 'free') { tt.navigateTo({ url: `/pages/order/detail/index?orderId=${orderId - }` + }&mallTenantId=${that.data.mallTenantId}` }); } }) @@ -509,6 +525,7 @@ Page({ goodsList: res.data.goodsList, payment: res.data.payment, success: res => { + console.log('save,success!'); tt.hideLoading(); that.setData({ showbutton: false, @@ -524,6 +541,7 @@ Page({ that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); }, fail: res => { + console.log('save,fail!'); const { orderId, outOrderNo, diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 6014188..ba76fc4 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -483,7 +483,7 @@ Page({ * 获取用户信息 */ onLoad(options) { - console.log(options); + console.log(options, 'options'); if (options.mallTenantId) { this.setData({ mallTenantId: options.mallTenantId, @@ -837,6 +837,8 @@ Page({ data: tempObj }) console.log(this.data.data, "data"); + const mallTenantId = this.data.data.tenantId + tt.setStorageSync('mallTenantId', mallTenantId) } }).catch(err => { tt.showToast({ @@ -871,7 +873,8 @@ Page({ payOrderId: payOrderId, composeOrderId: orderId, status: status, - reason: reason + reason: reason, + mallTenantId: this.data.mallTenantId || '' } }) .then(res => { diff --git a/pages/couponorder/detail/index.js b/pages/couponorder/detail/index.js index 7a2f265..5237656 100644 --- a/pages/couponorder/detail/index.js +++ b/pages/couponorder/detail/index.js @@ -6,31 +6,33 @@ const util = require("../../../utils/util"); const QR = require("../../../utils/memberqrcode.js"); Page({ data: { - showIdFalg:false, + showIdFalg: false, navigationBarHeight, - couponorderstatus:"", - quancode:"", - setInter:"", - validStartDate:"", - validEndDate:"", - pickStartDate:"", - pickEndDate:"", - expiredTime:"", - updateDate:"", - createDate:"", - code:"", - data:{ - + couponorderstatus: "", + quancode: "", + setInter: "", + validStartDate: "", + validEndDate: "", + pickStartDate: "", + pickEndDate: "", + expiredTime: "", + updateDate: "", + createDate: "", + code: "", + data: { + }, - showhieRq:false, - dynamicRq:"", - expiredSeconds:0, - templTiem:"", - curHtml:"", + showhieRq: false, + dynamicRq: "", + expiredSeconds: 0, + couponTenantId: '', + templTiem: "", + curHtml: "", + tenantId: '' }, - showId(){ + showId() { let this_ = this; - if(!this_.data.showIdFalg){ + if (!this_.data.showIdFalg) { tt.showModal({ // title: "查看券码", content: "是否查看完整券码", @@ -38,7 +40,7 @@ Page({ if (res.confirm) { console.log("confirm, continued"); this_.setData({ - showIdFalg:true + showIdFalg: true }) } else if (res.cancel) { //取消 @@ -51,12 +53,12 @@ Page({ console.log(`showModal 调用失败`, err); }, }); - }else{ + } else { this.setData({ - showIdFalg:false + showIdFalg: false }) } - + }, getHtml(couponOrderId) { Http.get({ @@ -80,15 +82,15 @@ Page({ console.log(options); that.setData({ code: options.quancode, - codeS: options.quancode.slice(0,4)+`******`+options.quancode.slice(14), + codeS: options.quancode.slice(0, 4) + `******` + options.quancode.slice(14), couponorderstatus: options.couponorderstatus, - validStatus:options.validStatus + validStatus: options.validStatus }); - if(options.couponorderstatus==0&&options.validStatus!=0){ - that.setRq()//动态二维码 //这个方法必须在拿到 options.quancode 后调用 + if (options.couponorderstatus == 0 && options.validStatus != 0) { + that.setRq() //动态二维码 //这个方法必须在拿到 options.quancode 后调用 } - + //初始数据不能延时收到写一边 Http.get({ url: config.api.couponOrderDetail, @@ -96,6 +98,12 @@ Page({ couponOrderId: options.quancode } }).then(res => { + if (res.data.tenantId) { + that.setData({ + tenantId: res.data.tenantId + }) + that.setRq() + } that.setData({ couponorderstatus: res.data.couponOrderStatus, data: res.data, @@ -120,19 +128,19 @@ Page({ // pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd hh:mm:ss"), }) } - + }).catch(err => { - tt.showToast({ - title: err.message?err.message:err.data, - icon: 'none', - duration: 2000, - mask: false - }); + tt.showToast({ + title: err.message ? err.message : err.data, + icon: 'none', + duration: 2000, + mask: false + }); }) // - + //获得优惠券的详情 let setInter = setInterval(function () { @@ -140,18 +148,25 @@ Page({ options.quancode && that.data.couponorderstatus == 0 ) { - + Http.get({ url: config.api.couponOrderDetail, data: { couponOrderId: options.quancode } }).then(res => { + console.log(res.data, '1233211234567'); that.setData({ couponorderstatus: res.data.couponOrderStatus, data: res.data, }); - + if (res.data.tenantId) { + that.setData({ + tenantId: res.data.tenantId + }) + that.setRq() + } + console.log(that.data.tenantId, 'tenantId'); that.setData({ expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"), updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), @@ -165,62 +180,65 @@ Page({ // pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd hh:mm:ss"), }) } - + }).catch(err => { - tt.showToast({ - title: err.message?err.message:err.data, - icon: 'none', - duration: 2000, - mask: false - }); - }) + tt.showToast({ + title: err.message ? err.message : err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) } }, 2000); that.setData({ - setInter:setInter + setInter: setInter }) }, - setRq(){ + setRq() { let _this = this _this.setData({ showhieRq: false, }) - Http.get({//获取动态二维码 + Http.get({ //获取动态二维码 url: config.api.dynamicId, data: { - couponOrderId: _this.data.code + couponOrderId: _this.data.code, + couponTenantId: _this.data.tenantId || '' } }).then(res => { console.log(res, "res") _this.setData({ dynamicRq: res.data.dynamicId, - expiredSeconds: res.data.expiredSeconds + expiredSeconds: res.data.expiredSeconds, + couponTenantId: res.data.couponTenantId }) let url = JSON.stringify({ END: "C", TYPE: "couponorder", - ID: _this.data.dynamicRq + ID: _this.data.dynamicRq, + couponTenantId: _this.data.couponTenantId }) - if(res.data.expiredSeconds==0){ + if (res.data.expiredSeconds == 0) { - }else{ - let inre = setInterval(()=>{ - if(_this.data.expiredSeconds>1){ + } else { + let inre = setInterval(() => { + if (_this.data.expiredSeconds > 1) { _this.setData({ - expiredSeconds: _this.data.expiredSeconds-1 + expiredSeconds: _this.data.expiredSeconds - 1 }) - console.log("有效",_this.data.expiredSeconds) - }else{ + console.log("有效", _this.data.expiredSeconds) + } else { console.log("无效", _this.data.expiredSeconds) clearInterval(_this.data.templTiem) _this.setData({ - showhieRq:true + showhieRq: true }) - } - },1000) + } + }, 1000) _this.setData({ - templTiem:inre + templTiem: inre }) } // util.qrcode("qrcode", url, 350, 350); @@ -238,7 +256,7 @@ Page({ createQrCode: function (url, canvasId, cavW, cavH) { //调用插件中的draw方法,绘制二维码图片 let that = this; - QR.api.draw(url, canvasId, cavW, cavH, function (res) { + QR.api.draw(url, canvasId, cavW, cavH, function (res) { that.setData({ tempFilePath: res }) diff --git a/pages/integralmall/payIntegcoupondetail/index.js b/pages/integralmall/payIntegcoupondetail/index.js index fd925eb..98178c6 100644 --- a/pages/integralmall/payIntegcoupondetail/index.js +++ b/pages/integralmall/payIntegcoupondetail/index.js @@ -3,7 +3,9 @@ const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'; var config = require("../../../config/config.js"); const Http = require("../../../utils/HttpBasics"); const imgurl = require("../../../utils/imgurl"); -const { spellStatus } = require("../../../utils/spell"); +const { + spellStatus +} = require("../../../utils/spell"); Page({ /** @@ -20,25 +22,25 @@ Page({ data: null, showErr: false, showAlert: false, - remainingPoints:0, - submitAble:true + remainingPoints: 0, + submitAble: true }, getUserInfo: function () { let that = this; // 获取用户信息 Http.get({ - url: config.api.getScore, - data: {} - }) + url: config.api.getScore, + data: {} + }) .then(res => { console.log(res) that.setData({ remainingPoints: Number(res.data.credit) - Number(that.data.data.creditPrice), - userInfo:res.data + userInfo: res.data }) }) }, - cannotPay(){ + cannotPay() { tt.showToast({ title: "您的积分不足", image: './../../../assets/images/fail.png', @@ -56,7 +58,7 @@ Page({ url: `/pages/spellGroup/spellGroup`, }) }, - onShow:function(){ + onShow: function () { this.setData({ submitAble: true }) @@ -68,23 +70,28 @@ Page({ this.setData({ paramData: options }) + if (options.mallTenantId) { + this.setData({ + mallTenantId: options.mallTenantId, + }) + } this.getDetail(options.couponChannelId); // 关闭来自于左上角的分享 tt.hideShareMenu() }, /** - * 发起支付 - */ + * 发起支付 + */ gotoPay() { var that = this; that.setData({ submitAble: false }) Http.get({ - url: config.api.checkPhoneStatus, - data: {} - }) + url: config.api.checkPhoneStatus, + data: {} + }) .then(res => { var data = { couponChannelId: "" + that.data.paramData.couponChannelId, @@ -180,7 +187,7 @@ Page({ */ tt.redirectTo({ url: "/pages/getphoneInfo/index?couponChannelId=" + - that.data.paramData.couponChannelId + "&couponId=" + that.data.paramData.couponId +"&path=jifen" + that.data.paramData.couponChannelId + "&couponId=" + that.data.paramData.couponId + "&path=jifen" }); } else if (err.code == 11006) { // 用户手机已加密 @@ -206,7 +213,7 @@ Page({ }); // console.log(that.data.type) // 免费券 - that.payOrderUpdate(orderId, "0", 1, '',that); + that.payOrderUpdate(orderId, "0", 1, '', that); // that.payOrderUpdate(that.data.orderId, '', 1, '', that); if (that.data.cardType == 100) { tt.setStorage({ @@ -229,14 +236,15 @@ 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, + mallTenantId: this.data.mallTenantId || '' + } + }) .then(res => { tt.hideLoading() tt.navigateTo({ @@ -256,7 +264,7 @@ Page({ */ getDetail(couponChannelId) { let that = this; - Http.get({ + Http.get({ url: config.api.couponDetail, data: { couponChannelId: couponChannelId diff --git a/pages/main/index.js b/pages/main/index.js index 190c59b..b44df8e 100644 --- a/pages/main/index.js +++ b/pages/main/index.js @@ -180,7 +180,7 @@ Page({ if (options && options.orderId && app.globalData.type == 'dt') { //订单详情 tt.redirectTo({ - url: `/pages/order/detail/index?orderId=${options.orderId}` + url: `/pages/order/detail/index?orderId=${options.orderId}&mallTenantId=${options.tenantId}` }) } else if (options && options.orderGroupId) { tt.redirectTo({ @@ -577,7 +577,6 @@ Page({ } }) } - }, getGameOne: function (token, id) { diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js index 3ffda7a..dbac5f0 100644 --- a/pages/order/detail/index.js +++ b/pages/order/detail/index.js @@ -18,6 +18,7 @@ Page({ serviceUrl: '', //客服外部链接 dynamicRq: "", expiredSeconds: 0, + couponTenantId: '', showhieRq: false, mouldType: 0, showFlag: false, @@ -50,6 +51,7 @@ Page({ cardIf: false, contentType: 0, orderFlag: false, //判断是不是线上配送 + tenantId: '' }, handleRefund(event) { const { @@ -227,6 +229,11 @@ Page({ } }).then(res => { tt.hideLoading(); + if (res.data.tenantId) { + that.setData({ + tenantId: res.data.tenantId + }) + } var createDate = util.formatTime(res.data.orders[0].createDate, "yyyy-MM-dd"); let tempData = res.data.orders[0] tempData.deliveryInfo = tempData.deliveryInfo ? JSON.parse(tempData.deliveryInfo) : "" @@ -458,19 +465,22 @@ Page({ Http.get({ //获取动态二维码 url: config.api.dynamicId, data: { - couponOrderId: _this.data.order.couponOrderId + couponOrderId: _this.data.order.couponOrderId, + couponTenantId: _this.data.tenantId || '' } }).then(res => { console.log(res, "res") _this.setData({ dynamicRq: res.data.dynamicId, - expiredSeconds: res.data.expiredSeconds + expiredSeconds: res.data.expiredSeconds, + couponTenantId: res.data.couponTenantId }) let url = JSON.stringify({ END: "C", TYPE: "couponorder", - ID: _this.data.dynamicRq + ID: _this.data.dynamicRq, + couponTenantId: _this.data.couponTenantId }) if (res.data.expiredSeconds == 0) { //倒计时为零直接显示券码 @@ -721,7 +731,7 @@ Page({ }) .then(res => { tt.redirectTo({ - url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.order.productId}&orderGroupId=${res.data.orderGroupId}` + url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.order.productId}&orderGroupId=${res.data.orderGroupId}&mallTenantId=${this.data.mallTenantId}` }); }) .catch(err => { @@ -773,7 +783,10 @@ Page({ orderId, outOrderNo } = res; - // that.setData({ orderId, outOrderNo }); + // that.setData({ + // orderId, + // outOrderNo + // }); that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); }, fail: res => { @@ -1018,7 +1031,7 @@ Page({ /** * 支付订单更新 */ - payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => { + payOrderUpdate(orderId, payOrderId, status, reason, type, _this) { // 支付成功 Http.post({ url: config.api.payOrderUpdate, @@ -1026,7 +1039,8 @@ Page({ payOrderId: payOrderId, composeOrderId: orderId, status: status, - reason: reason + reason: reason, + mallTenantId: this.data.mallTenantId || '' } }) .then(res => { @@ -1048,14 +1062,15 @@ Page({ tt.hideLoading(); }, 1600); setTimeout(() => { + console.log('Here1'); let url = "" if (_this.data.orderFlag) { tt.redirectTo({ - url: `/pages/order/detail/index?orderId=${orderId}&dingdan=order` + url: `/pages/order/detail/index?orderId=${orderId}&dingdan=order}&mallTenantId=${that.data.mallTenantId}` }); } else { tt.redirectTo({ - url: `/pages/order/detail/index?orderId=${orderId}` + url: `/pages/order/detail/index?orderId=${orderId}}&mallTenantId=${that.data.mallTenantId}` }); } @@ -1063,8 +1078,9 @@ Page({ } }); } else if (type == 'free') { + console.log('Here2'); tt.redirectTo({ - url: `/pages/order/detail/index?orderId=${orderId}` + url: `/pages/order/detail/index?orderId=${orderId}}&mallTenantId=${that.data.mallTenantId}` }); } }) diff --git a/pages/orderquanma/index.js b/pages/orderquanma/index.js index a8850c6..0de6429 100644 --- a/pages/orderquanma/index.js +++ b/pages/orderquanma/index.js @@ -39,20 +39,20 @@ Page({ getStaticGame(token) { let _this = this; Http.get({ - url: config.api.getGame, - data: { - triggleAction: 4 // 核销触发 - } - }).then(res => { - if (res.data.id) { + url: config.api.getGame, + data: { + triggleAction: 4 // 核销触发 + } + }).then(res => { + if (res.data.id) { + _this.setData({ + showIf: true + }) + } _this.setData({ - showIf: true + staticGamedata: res.data }) - } - _this.setData({ - staticGamedata: res.data }) - }) .catch(err => { tt.showToast({ title: err.errMsg, @@ -68,7 +68,7 @@ Page({ _this.setData({ showhieRq: false, }) - Http.get({//获取动态二维码 + Http.get({ //获取动态二维码 url: config.api.dynamicId, data: { couponOrderId: _this.data.code @@ -85,9 +85,9 @@ Page({ TYPE: "couponorder", ID: _this.data.dynamicRq }) - if(res.data.expiredSeconds==0){ + if (res.data.expiredSeconds == 0) { - }else{ + } else { let inre = setInterval(() => { if (_this.data.expiredSeconds > 1) { _this.setData({ @@ -106,17 +106,17 @@ Page({ templTiem: inre }) } - + // util.qrcode("qrcode", url, 350, 350); _this.createQrCode(url, "qrcode", 350, 350); - }).catch(err => { - tt.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); - }) + }).catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, onLoad: function (options) { //quancode @@ -134,11 +134,11 @@ Page({ validStatus: options.validstatus, contentType: options.contentType }); - if (options.couponorderstatus==0){ - that.setRq()//动态获取二维码 这个方法必须在拿到 options.quancode 后调用 + if (options.couponorderstatus == 0) { + that.setRq() //动态获取二维码 这个方法必须在拿到 options.quancode 后调用 } - - if (options.contentType != undefined && options.contentType==1) { + + if (options.contentType != undefined && options.contentType == 1) { this.setData({ curHtml: app.globalData.curHtml }) @@ -149,28 +149,28 @@ Page({ that.data.setInter = setInterval(function () { if (that.data.couponorderstatus == 0) { Http.get({ - url: config.api.getStatus, - data: { - couponOrderId: options.quancode - } - }).then(res => { - console.log(res); - that.setData({ - couponorderstatus: res.data.CouponOrderStatus - }); - if (res.data.CouponOrderStatus == 1) { - /** - * 动态改变上一级页面的核销状态 - */ - that.getStaticGame() - var pages = getCurrentPages(); - var prevPage = pages[pages.length - 2]; //上一个页面 - //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 - prevPage.setData({ - mystatus: res.data.CouponOrderStatus + url: config.api.getStatus, + data: { + couponOrderId: options.quancode + } + }).then(res => { + console.log(res); + that.setData({ + couponorderstatus: res.data.CouponOrderStatus }); - } - }) + if (res.data.CouponOrderStatus == 1) { + /** + * 动态改变上一级页面的核销状态 + */ + that.getStaticGame() + var pages = getCurrentPages(); + var prevPage = pages[pages.length - 2]; //上一个页面 + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 + prevPage.setData({ + mystatus: res.data.CouponOrderStatus + }); + } + }) .catch(err => { tt.showToast({ title: err.errMsg, @@ -188,15 +188,15 @@ Page({ * 不需要循环 */ Http.get({ - url: config.api.getStatus, - data: { - couponOrderId: options.quancode - } - }).then(res => { - that.setData({ - couponorderstatus: res.data.CouponOrderStatus - }); - }) + url: config.api.getStatus, + data: { + couponOrderId: options.quancode + } + }).then(res => { + that.setData({ + couponorderstatus: res.data.CouponOrderStatus + }); + }) .catch(err => { tt.showToast({ title: err.errMsg, @@ -237,4 +237,4 @@ Page({ // value: app.globalData.sight, // }) // } -}); +}); \ No newline at end of file