Commit 50559876 authored by 黄媛媛's avatar 黄媛媛

支付

parent 42d9ac86
let app = getApp();
let md5 = require('../../../utils/md5.js')
Page({
data: {
......@@ -10,6 +12,7 @@ Page({
payBtn: true,
second: 180,
changesecond: true,
dataInfo:{},
},
onLoad: function(options) {
let that = this;
......@@ -17,12 +20,15 @@ Page({
this.getOpenid();
let admin = wx.getStorageSync('admin');
this.setData({
customerId: admin.id
customerId: admin.id,
timestamp: timestamp
})
if (options.data) {
console.log("options", options)
let info = that.data.payInfo;
let payInfo = JSON.parse(options.data)
info.sOrderNo = payInfo.sOrderNo;
// info.sOrderNo = payInfo.sOrderNo;
info.sOrderNo =22;
info.sProductName = payInfo.sProductName;
info.dTotalPrice = payInfo.dTotalPrice;
info.productId = payInfo.productId;
......@@ -47,13 +53,19 @@ Page({
type: '',
};
console.log("msg", msg)
app.$apiSaveFormId('sellorder_get_GetPayInfo', msg).then(res => {
console.log("res", res);
app.$api('sellorder_get_GetPayInfo', msg).then(res => {
let data=JSON.parse(res);
console.log("data", res);
that.setData({
dataInfo: data
})
}).catch(err => {})
},
payBtn() {
let that = this;
let dataInfo = that.data.dataInfo;
if (!that.data.payBtn){
wx.showToast({
title: "您已经超出支付时间!",
......@@ -62,14 +74,24 @@ Page({
})
return;
}
// let paySign="";
// paySign = md5(`appId=${dataInfo.appid}&nonceStr=${dataInfo.noncestr}&package=prepay_id=${dataInfo.prepayid}&signType=MD5&timeStamp=${dataInfo.timestamp}&key=936110e2c2214340b9829a3608bde6b0`)
// paySign = paySign.toUpperCase()
// console.log("paySign", paySign)
wx.requestPayment({
'timeStamp': that.data.timestamp,
'nonceStr': '',
'package': '',
'timeStamp': dataInfo.timeStamp,
'nonceStr': dataInfo.nonceStr,
// 'package': `prepay_id=${dataInfo.prepayid}`,
'package': dataInfo.package,
'signType': 'MD5',
'paySign': '',
'success': function(res) {},
// 'signType': dataInfo.signType,
'paySign': dataInfo.paySign,
// 'paySign': paySign,
'success': function(res) {
console.log("res",res);
},
'fail': function(res) {},
'complete': function(res) {}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment