zoukankan      html  css  js  c++  java
  • uniapp 微信支付,支付宝支付,公众号H5支付

    1,微信支付

    uni.requestPayment({

    provider: "wxpay",
    orderInfo: res.data.data,
    success: (res) => {
    uni.showToast({
    title: "支付成功!",
    icon: "none",
    duration: 2000
    });
    },
    fail(err) {
    uni.showToast({
    title: "支付失败!",
    icon: "none",
    duration: 2000
    });
    },
    complete(com) {
    }
    });

    2,支付宝支付

    uni.requestPayment({
    provider: 'alipay',
    orderInfo: res.data.data.sign,
    success(e) {
    uni.showToast({
    title: "支付成功!",
    icon: "none",
    duration: 2000
    });
    },
    fail(err) {
    uni.showToast({
    title: "支付失败!",
    icon: "none",
    duration: 2000
    });
    },
    complete(com) {
    }
    });

    3,公众号支付

    let data = res.data.data;
    WeixinJSBridge.invoke('getBrandWCPayRequest', {
    "appId": data.appId, //公众号名称,由商户传入
    "timeStamp": data.timeStamp, //时间戳
    "nonceStr": data.nonceStr, //随机串
    "package": data.package, //扩展包
    "signType": data.signType, //微信签名方式:MD5
    "paySign": data.paySign //微信签名
    }, function(respay) {
    if (respay.err_msg === "get_brand_wcpay_request:ok") {
    that.page = 1;
    that.list = [];
    that.getData();
    } else if (respay.err_msg === "get_brand_wcpay_request:cancel") {
    uni.showToast({
    title:"取消支付",
    icon:"none",
    duration:2000
    });
    that.isClick = true;
    } else if (respay.err_msg === "get_brand_wcpay_request:fail") {
    uni.showToast({
    title:"支付失败",
    icon:"none",
    duration:2000
    })
    that.isClick = true;
    }
    }, function(err) {
    uni.showToast({
    title:res.data.msg,
    icon:"none",
    duration:2000
    });
    });

    ..
  • 相关阅读:
    vss修复
    缓存项增加删除测试
    temp
    jQuery的三种Ajax模式
    Lucene入门与使用(1)转
    详细解析Java中抽象类和接口的区别
    IT人,不要一辈子靠技术生存[转载]
    setTimeout和setInterval的使用 【转载】
    JQuery实现省市区三级联动
    学习jQuery
  • 原文地址:https://www.cnblogs.com/shoolnight/p/15688437.html
Copyright © 2011-2022 走看看