收藏
回答

微信支付失败,前端提示缺少TOTAL_FEE

后端统一下单返回成功结果如下:

【请求数据】:<xml>
  <appid>wx9f428beea2933fd2</appid>
  <mch_id>*******</mch_id> //不给你看
  <nonce_str>1574779640225</nonce_str>
  <sign>2C8264B42C2642F9EF29EB1F022AC0D3</sign>
  <version>1.0</version>
  <device_info>WEB</device_info>
  <body>慧缘文化电商平台-商品购买</body>
  <out_trade_no>201911260202000015</out_trade_no>
  <fee_type>CNY</fee_type>
  <total_fee>101</total_fee>
  <spbill_create_ip>192.168.0.106</spbill_create_ip>
  <time_start>20191126224720</time_start>
  <time_expire>20191126230220</time_expire>
  <notify_url>http://raymee.vipgz2.idcfengye.com/wxh5/pay/notify/callback</notify_url>
  <trade_type>JSAPI</trade_type>
  <openid>oYxXbvucsZwC3qmBJRpdA1tngazI</openid>
</xml>
【响应数据】:<xml>
  <trade_type><![CDATA[JSAPI]]></trade_type>
  <prepay_id><![CDATA[wx20191126224725605985]]></prepay_id>
  <nonce_str><![CDATA[1574779640225]]></nonce_str>
  <return_code><![CDATA[SUCCESS]]></return_code>
  <err_code_des><![CDATA[ok]]></err_code_des>
  <sign><![CDATA[5382FCE0AC1656B2F5C2E9F882650DEA]]></sign>
  <mch_id><![CDATA[*******]]></mch_id> //此处屏蔽了
  <return_msg><![CDATA[OK]]></return_msg>
  <appid><![CDATA[wx9f428beea2933fd2]]></appid>
  <device_info><![CDATA[WEB]]></device_info>
  <result_code><![CDATA[SUCCESS]]></result_code>
  <err_code><![CDATA[SUCCESS]]></err_code>
</xml>
2019-11-26 22:47:23.200  INFO 16056 --- [nio-8082-exec-2] c.m.m.service.impl.H5OrderServiceImpl    : com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult@40788298[
  appId=wx9f428beea2933fd2
  timeStamp=1574779643
  nonceStr=1574779643200
  packageValue=prepay_id=wx20191126224725605985
  signType=MD5
  paySign=EE3BF603C85BC01900DCCE05F295C9AF
]


前端的配置如下(debug模式下提示配置config:ok):

const wx = require('jweixin-module');
 
// const wxpay = (data, cb, errorCb) => {
 
    GetJsapiSignature(location.href).then(res => {
        wx.config({
            debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
            appId: res.data.appId, // 必填,公众号的唯一标识
            timestamp: res.data.timestamp, // 必填,生成签名的时间戳
            nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
            signature: res.data.signature, // 必填,签名,见附录1
            jsApiList: ['chooseWXPay'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
        });
    })

前端调用JSapi的chooseWXPay的参数如下:

await CreatePayOrder(obj).then(res => {
                    console.log('CreatePayOrder:', res)
                    _self.$wxpay.chooseWXPay({
                        appId: res.data.appId,
                        timeStamp: res.data.timeStamp,
                        nonceStr: res.data.nonceStr,
                        package: res.data.packageValue,
                        signType: res.data.signType,
                        paySign: res.data.paySign,
                        success(d){
                            uni.showModal({
                                title: "提示",
                                content: JSON.stringify(d),
                                complete() {
                                    _self.fullLoading = false;
                                }
                            })
                        },
                        cancel(c){
                            uni.showModal({
                                title: "提示",
                                content: JSON.stringify(c),
                                complete() {
                                    _self.fullLoading = false;
                                }
                            })
                        },
                        fail(err){
                            _self.fullLoading = false;
                            uni.showModal({
                                title: "提示",
                                content: JSON.stringify(err),
                                complete() {
                                    uni. redirectTo({
                                        url: "../myorders/myorders"
                                    })
                                }
                            })
                        }
                    })
                }).catch(res => {
                    console.log('catch:', res)
                    _self.fullLoading = false;
                })


前端返回的提示信息如下:


请各路大神帮帮看看,是哪里出了问题哟?

最后一次编辑于  11-27
回答关注问题邀请回答
收藏

2 个回答

  • 南岳衡山祥云农家乐官网
    南岳衡山祥云农家乐官网
    11-27

    如果官方看到,请不要回复以下拷贝:

    你好, 请按照以下两点检查:

    1)package参数格式错误,package参数格式应该是这样: package:"prepay_id=wx201612032137789b201de80e0661234657"

     2)package参数没有获取,返回null。


    谢谢!

    11-27
    赞同
    回复
  • 少年啦
    少年啦
    11-27

    你这样大方的把信息全展示出来

    11-27
    赞同
    回复
问题标签