order_payment.js 2.47 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
//articleLists.js 文章列表
// 网络请求工具类
var networkUtil = require('../../utils/network_util.js')
var api = require('../../utils/apiFile.js')
// 事件监听
var event = require('../../utils/event.js')
var util = require('../../utils/util.js')

// 获取应用实例
var app = getApp()
Page({
data: {
orderId:'',
OriginalorderId: '',
orderTime:'',
realPrice:'',
orderName:'',
orderContent: '',
orderIcon:''
},
onLoad: function (options) {
networkUtil.showLoading()
var content = []
var checked = {
"hId": app.globalData.userInfo.hospitalId,
"goodId": options.id
}
content.push(checked)
this.getOrderDetail(content)
},
getOrderDetail(content){
var self = this
var param = JSON.stringify(content)
networkUtil._post(api.order, { param: param }, function (res) {

console.log(res)
if (res.data.goodsOrderId.length>27){
self.setData({
orderId: res.data.goodsOrderId.slice(0,27),
})
}else{
self.setData({
orderId: res.data.goodsOrderId,
})
}
self.setData({
OriginalorderId: res.data.goodsOrderId,
orderTime: res.data.now,
realPrice: res.data.realPrice,
orderName: res.data.data[0].goodName,
orderContent: res.data.data[0].desc,
orderIcon: res.data.data[0].icon,
})
}, function (res) {

})
},
getPayMessage(){
networkUtil.showLoading()
var self = this
networkUtil._get(api.buy + '?goodsOrderId=' + self.data.OriginalorderId, { }, function (res) {

console.log(res)
wx.requestPayment({
timeStamp: res.data.payParams.timeStamp + "",
nonceStr: res.data.payParams.nonceStr,
package: res.data.payParams.package,
signType: res.data.payParams.signType,
paySign: res.data.payParams.paySign,
'success': function (res1) {
console.log(res1)
app.globalData.userInfo.status = 1
event.emit('userStatusChange', { });
wx.navigateBack({
})
},
'fail': function (res1) {
console.log('fali', res1)
wx.showToast({
title: '支付失败',
})
}
})
}, function (res) {

})
},
payClick:function(e){
this.getPayMessage()
}
})