起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 3159|回复: 0

[未处理] 支付宝支付成功后逻辑处理问题

[复制链接]

56

主题

245

帖子

535

积分

高级会员

Rank: 4

积分
535
QQ
发表于 2020-9-24 16:56:55 | 显示全部楼层 |阅读模式
本帖最后由 苦瓜很甜 于 2020-9-24 16:59 编辑

支付宝支付成功后进入图1界面,这个时候不点击右上角的完成按钮而是点击左上角红框里的返回,这个时候不会走程序中的function(message) {}的逻辑,这个应该怎么处理呢?还有支付成功后,用户不点击完成而是进行了支付宝APP和点菜APP进行后台切换也不会走function(message) {}的逻辑,这个该如何处理呢?经调试程序执行到图2箭头位值就没有往下执行,没有返回responseCode

                    var isPay = "";
                    // var self = this;
                    var dtd = $.Deferred();
                    var wait = function(dtd) {
                        var tasks = function() {
                            if (!navigator.alipay) {
                                alert("没有插件");
                                /*
                                 * justep.Util.hint("没有插件", { "type" :
                                 * "warning", // "delay" : 100, "position" :
                                 * "bottom", });
                                 */
                                return;
                            }
                            var notifyUrl = location.origin;
                            var tradeNo = justep.UUID.createUUID();
                            var alipay = navigator.alipay;
                            alipay.pay({
                                "seller" : "zndzzfb@eastsoft.com.cn", // 卖家支付宝账号或对应的支付宝唯一用户号   huangyx@justep.com   zndzzfb@eastsoft.com.cn
                                "subject" : storename, // 商品名称
                                "body" : "预约点餐", // 商品详情
                                "price" : orderPrice, // 金额,单位为RMB
                                "tradeNo" : tradeNo, // 唯一订单号
                                "timeout" : "30m", // 超时设置
                                "notifyUrl" : notifyUrl
                            }, // 服务器通知路径
                            function(message) {
                                var responseCode = parseInt(message);
                                if (responseCode === 9000) {
//                                    alert("成功");
                                    dtd.resolve(3);
                                } else {
//                                    alert("失败");
                                    dtd.reject(-30);
                                }
                            }, function(msg) {
//                                alert(777);
                                justep.Util.hint("支付失败2", {
                                    "type" : "warning",
                                    // "delay" : 100,
                                    "position" : "bottom",
                                });
                            });
                        };
                        tasks();
                        // setTimeout(tasks, 1000);
                        return dtd;
                    };
                    $.when(wait(dtd)).done(function() {
                        // justep.Shell.fireEvent("onContent3Content", {});
                        // var url = require.toUrl("$UI/orderdishes/main.w");
                        // justep.Shell.showPage(url);
                        justep.Shell.closePage();
                        justep.Util.hint("支付成功", {
                            "type" : "warning",
                            // "delay" : 100,
                            "position" : "bottom",
                        });
                    }).fail(function() {
                        justep.Shell.closePage();
                        // justep.Shell.closePage(undefined,false,require.toUrl("$UI/orderdishes/main.w"));
                        justep.Util.hint("支付失败", {
                            "type" : "warning",
                            // "delay" : 100,
                            "position" : "bottom",
                        });
                    });

               


图1

图1

图2

图2
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-5-2 10:42 , Processed in 0.110377 second(s), 26 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表