diff --git a/CoreCms.Net.RedisMQ/SendWxTemplateMessageSubscribe.cs b/CoreCms.Net.RedisMQ/SendWxTemplateMessageSubscribe.cs index ab59d229..62a79cfa 100644 --- a/CoreCms.Net.RedisMQ/SendWxTemplateMessageSubscribe.cs +++ b/CoreCms.Net.RedisMQ/SendWxTemplateMessageSubscribe.cs @@ -135,7 +135,7 @@ namespace CoreCms.Net.RedisMQ } if (!string.IsNullOrEmpty(parameters["createTime"]!.ToString())) { - templateMessageData[templateData.data03] = new CgibinMessageSubscribeSendRequest.Types.DataItem() { Value = parameters["createTime"].ToString() }; + templateMessageData[templateData.data03] = new CgibinMessageSubscribeSendRequest.Types.DataItem() { Value = Convert.ToDateTime(parameters["createTime"].ToString()).ToString("yyyy年MM月dd日 HH:mm") }; } templateMessageData[templateData.data04] = new CgibinMessageSubscribeSendRequest.Types.DataItem() { Value = "订单即将失效,请及时付款!" }; pageUrl = "/pages/member/order/detail/detail?orderId=" + parameters["orderId"]; @@ -152,7 +152,7 @@ namespace CoreCms.Net.RedisMQ } if (!string.IsNullOrEmpty(parameters["paymentTime"]!.ToString())) { - templateMessageData[templateData.data03] = new CgibinMessageSubscribeSendRequest.Types.DataItem() { Value = parameters["paymentTime"].ToString() }; + templateMessageData[templateData.data03] = new CgibinMessageSubscribeSendRequest.Types.DataItem() { Value = Convert.ToDateTime(parameters["paymentTime"].ToString()).ToString("yyyy年MM月dd日 HH:mm") }; } pageUrl = "/pages/member/order/detail/detail?orderId=" + parameters["orderId"]; } @@ -212,7 +212,7 @@ namespace CoreCms.Net.RedisMQ } if (!string.IsNullOrEmpty(parameters["createTime"]!.ToString())) { - templateMessageData[templateData.data05] = new CgibinMessageSubscribeSendRequest.Types.DataItem() { Value = parameters["createTime"].ToString() }; + templateMessageData[templateData.data05] = new CgibinMessageSubscribeSendRequest.Types.DataItem() { Value = Convert.ToDateTime(parameters["createTime"].ToString()).ToString("yyyy年MM月dd日 HH:mm") }; } } var result = await Send(weChatUserInfo.openid, templateData.templateId, templateMessageData, pageUrl); @@ -311,11 +311,25 @@ namespace CoreCms.Net.RedisMQ { jm.status = true; jm.msg = "消息已发送,请注意查收"; + jm.otherData = new + { + openId, + templateId, + tmpData, + pageUrl + }; } else { jm.status = false; jm.msg = response.ErrorMessage; + jm.otherData = new + { + openId, + templateId, + tmpData, + pageUrl + }; } return jm; diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByWx.vue b/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByWx.vue index 8e1416ee..28975f2a 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByWx.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByWx.vue @@ -92,8 +92,8 @@ }, mounted() { this.getPayments(); - console.log('类型:' + this.type); - console.log('订单号:' + this.orderId); + //console.log('类型:' + this.type); + //console.log('订单号:' + this.orderId); }, methods: { // 获取可用支付方式列表 @@ -164,12 +164,10 @@ signType: res.data.paymentParameters.signType, paySign: res.data.paymentParameters.paySign, success: function (e) { + uni.hideLoading(); if (e.errMsg === 'requestOrderPayment:ok') { _this.$u.route({ type: 'redirectTo', url: '/pages/payment/result/result?id=' + res.data.paymentId }); } - setTimeout(function () { - uni.hideLoading(); - }, 500); }, fail: function (res) { if (res.errMsg === 'requestPayment:fail cancel') { @@ -191,12 +189,10 @@ signType: res.data.signType, paySign: res.data.paySign, success: function (e) { + uni.hideLoading(); if (e.errMsg === 'requestPayment:ok') { _this.$u.route({ type: 'redirectTo', url: '/pages/payment/result/result?id=' + res.data.paymentId }); } - setTimeout(function () { - uni.hideLoading(); - }, 500); }, fail: function (res) { if (res.errMsg === 'requestPayment:fail cancel') { @@ -225,10 +221,8 @@ */ this.$u.api.pay(data).then(res => { if (res.status) { + uni.hideLoading(); this.$u.route({ type: 'redirectTo', url: '/pages/payment/result/result?id=' + res.data.paymentId }); - setTimeout(function () { - uni.hideLoading(); - }, 500); } else { //this.popHide(); setTimeout(function () { diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/payment/result/result.vue b/CoreCms.Net.Uni-App/CoreShop/pages/payment/result/result.vue index b9ad93b4..9d5bf208 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/payment/result/result.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/payment/result/result.vue @@ -64,11 +64,19 @@ if (options.orderId) { this.orderId = options.orderId; } - }, - mounted() { - this.getPaymentInfo(); + this.doGetData(); }, methods: { + doGetData() { + uni.showLoading({ + title: '获取支付结果中', + mask: true + }); + var _this = this; + setTimeout(function () { + _this.getPaymentInfo(); + }, 2000); + }, getPaymentInfo() { if (!this.paymentId) { this.status = true; @@ -93,7 +101,13 @@ this.orderId = info.sourceId; this.status = true; this.paymentInfo = info; + setTimeout(function () { + uni.hideLoading(); + }, 500); } else { + setTimeout(function () { + uni.hideLoading(); + }, 500); this.$u.toast(res.msg); } }); diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/placeOrder/index/index.vue b/CoreCms.Net.Uni-App/CoreShop/pages/placeOrder/index/index.vue index a8a8bc61..4f29f4bc 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/placeOrder/index/index.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/placeOrder/index/index.vue @@ -360,7 +360,7 @@ // #ifdef MP uni.getSystemInfo({ success: (res) => { - console.log("所获取设备数据皆来自设备本身", res) + //console.log("所获取设备数据皆来自设备本身", res) var systemInfo = res; if (systemInfo.deviceType != 'pc') { var values = systemInfo.version.split('.'); @@ -386,7 +386,7 @@ } else { _this.getOrderDistributionModel(); } - + } else { _this.getOrderDistributionModel(); } @@ -481,12 +481,12 @@ }, // 跳转到门店列表 goStorelist() { - console.log("跳转到门店列表"); + //console.log("跳转到门店列表"); this.$u.route('/pages/placeOrder/storeList/storeList') }, // 没有收货地址时跳转 goAddress() { - console.log("没有收货地址时跳转"); + //console.log("没有收货地址时跳转"); this.$u.route('/pages/member/address/list/list?type=order') }, // 获取不同类型营销下单支持的配送方式 @@ -623,13 +623,13 @@ // 优惠券已经过期 15011 let errStatus = [15009, 15010, 15011, 15013, 15014, 15015,] if (errStatus.indexOf(res.data) !== -1) { - console.log('删除使用的优惠券号码'); + //console.log('删除使用的优惠券号码'); // 删除使用的优惠券号码 if (_that.current === 1) { _that.removeCouponCode(_that.inputCouponCode, _that.current) } else { // 取消选择使用的状态 - console.log(_that.optCoupon); + //console.log(_that.optCoupon); if (_that.optCoupon) { _that.userCoupons.forEach(item => { if (item.couponCode === _that.optCoupon) { @@ -638,10 +638,10 @@ }) } _that.removeCouponCode(_that.optCoupon, _that.current) - console.log(_that.optCoupon); + //console.log(_that.optCoupon); } } else { - console.log('未判断出内容'); + //console.log('未判断出内容'); } } }) @@ -835,17 +835,29 @@ subscription() { this.$u.api.getSubscriptionTmplIds(null).then(res => { if (res.status) { - console.log(res.data); + //console.log(res.data); if (res.data.length > 0) { - console.log('进入订阅发起'); - uni.requestSubscribeMessage({ - tmplIds: res.data, - success(ress) { - if (res.errMsg == "requestSubscribeMessage:ok") { - console.log(ress); + wx.getSetting({ + withSubscriptions: true, + success(resSetting) { + //console.log('subscriptionsSetting', resSetting.subscriptionsSetting) + if (wx.requestSubscribeMessage) { + wx.requestSubscribeMessage({ + tmplIds: res.data, //购买,发货,收货通知 + success: function (ress) { + //console.log(ress); + }, + fail: function (ress) { + //console.log(ress); + } + }) + } else { + wx.showToast({ + title: '请更新您微信版本,来获取订阅消息功能', + icon: 'none' + }); } - }, fail(ress) { - console.log(ress); + } }); }