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

支付

parent 42d9ac86
let app = getApp(); let app = getApp();
let md5 = require('../../../utils/md5.js')
Page({ Page({
data: { data: {
...@@ -10,6 +12,7 @@ Page({ ...@@ -10,6 +12,7 @@ Page({
payBtn: true, payBtn: true,
second: 180, second: 180,
changesecond: true, changesecond: true,
dataInfo:{},
}, },
onLoad: function(options) { onLoad: function(options) {
let that = this; let that = this;
...@@ -17,12 +20,15 @@ Page({ ...@@ -17,12 +20,15 @@ Page({
this.getOpenid(); this.getOpenid();
let admin = wx.getStorageSync('admin'); let admin = wx.getStorageSync('admin');
this.setData({ this.setData({
customerId: admin.id customerId: admin.id,
timestamp: timestamp
}) })
if (options.data) { if (options.data) {
console.log("options", options)
let info = that.data.payInfo; let info = that.data.payInfo;
let payInfo = JSON.parse(options.data) let payInfo = JSON.parse(options.data)
info.sOrderNo = payInfo.sOrderNo; // info.sOrderNo = payInfo.sOrderNo;
info.sOrderNo =22;
info.sProductName = payInfo.sProductName; info.sProductName = payInfo.sProductName;
info.dTotalPrice = payInfo.dTotalPrice; info.dTotalPrice = payInfo.dTotalPrice;
info.productId = payInfo.productId; info.productId = payInfo.productId;
...@@ -47,13 +53,19 @@ Page({ ...@@ -47,13 +53,19 @@ Page({
type: '', type: '',
}; };
console.log("msg", msg) app.$api('sellorder_get_GetPayInfo', msg).then(res => {
app.$apiSaveFormId('sellorder_get_GetPayInfo', msg).then(res => { let data=JSON.parse(res);
console.log("res", res); console.log("data", res);
that.setData({
dataInfo: data
})
}).catch(err => {}) }).catch(err => {})
}, },
payBtn() { payBtn() {
let that = this; let that = this;
let dataInfo = that.data.dataInfo;
if (!that.data.payBtn){ if (!that.data.payBtn){
wx.showToast({ wx.showToast({
title: "您已经超出支付时间!", title: "您已经超出支付时间!",
...@@ -62,14 +74,24 @@ Page({ ...@@ -62,14 +74,24 @@ Page({
}) })
return; 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({ wx.requestPayment({
'timeStamp': that.data.timestamp, 'timeStamp': dataInfo.timeStamp,
'nonceStr': '', 'nonceStr': dataInfo.nonceStr,
'package': '', // 'package': `prepay_id=${dataInfo.prepayid}`,
'package': dataInfo.package,
'signType': 'MD5', 'signType': 'MD5',
'paySign': '', // 'signType': dataInfo.signType,
'success': function(res) {}, 'paySign': dataInfo.paySign,
// 'paySign': paySign,
'success': function(res) {
console.log("res",res);
},
'fail': function(res) {}, 'fail': function(res) {},
'complete': 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