在【微信支付商家助手】的【收款详情】中,通过云函数获取支付参数时,怎么获取用户提交订单中的手机号?
发布于 4 年前 作者 yan91 8222 次浏览 来自 官方Issues

大佬好!

想要在商户收款详情中添加的手机号,效果如下:

用的是云函数获取参数:

exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  //let orderId = event.currentTarget.dataset.orderid;
  let {
    orderid,
    totalPrice,
    phone,
  } = event;
  //3,初始化支付
  const api = tenpay.init(config);
  //4获取支付参数
  let result = await api.getPayParams({
    // out_trade_no: '13796590155015090',
    out_trade_no: orderid,
    body: '产品名称',
    //body: phone,
   // phone: uphone,
    phone: phone,
    //total_fee: 1, //订单金额(分),
    total_fee: totalPrice*100,
    openid: wxContext.OPENID //付款用户的openid
  });
  return result;
} 

在其js文件中传递用户填写的手机号:

wx.cloud.callFunction({
     name: "getOpenid",
     data: {
       orderid: orderId,
      // totalPrice: 0.01,
       totalPrice: totalPrice003,
       phone: uphone,
     },
     success(res) {
       //var that = this;
       console.log("提交成功101", res.result)
       that.getOpenid(res.result);
       console.log("订单上传001", res.result);
     },
     fail(res) {
       console.log("提交失败101", res)
     },
   }),

尝试多次都无法获取。。。

请教大佬!!!

谢大佬

2 回复

商户收款详情 这个是你小程序的页面吗

回到顶部