|
|
@@ -119,24 +119,43 @@
|
|
|
* 组合地址,发起支付
|
|
|
*/
|
|
|
async jsapi() {
|
|
|
- const res = await this.$myRequest({
|
|
|
- host: 'wecard',
|
|
|
- url: '/cgi-bin/pay/app/mppay',
|
|
|
- method: 'POST',
|
|
|
- header: {
|
|
|
- 'content-type': 'application/json'
|
|
|
- },
|
|
|
- data: {
|
|
|
- 'access_token': this.access_token,
|
|
|
- 'sub_appid': this.sub_appid,
|
|
|
- 'user_id': this.card_number,
|
|
|
- 'order_id': this.order_id = this.$getOrderId('shuifei'),
|
|
|
- 'amount': this.amount * 100,
|
|
|
- 'order_type': 1,
|
|
|
- // 'callback_url': 'http://wvwviw.natappfree.cc/HotWaters/wxpayrecharge.action'
|
|
|
- 'callback_url': this.$code_base_url + '/HotWater/wxpayrecharge.action'
|
|
|
- }
|
|
|
- })
|
|
|
+ if (this.test) { // 测试环境
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ host: 'wecard',
|
|
|
+ url: '/cgi-bin/pay/app/mppay',
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/json'
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ 'access_token': this.access_token,
|
|
|
+ 'sub_appid': this.sub_appid,
|
|
|
+ 'user_id': this.card_number,
|
|
|
+ 'order_id': this.order_id = this.$getOrderId('shuifei'),
|
|
|
+ 'amount': this.amount * 100,
|
|
|
+ 'order_type': 1,
|
|
|
+ 'callback_url': 'http://wvwviw.natappfree.cc/HotWaters/wxpayrecharge.action'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ host: 'wecard',
|
|
|
+ url: '/cgi-bin/pay/app/mppay',
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/json'
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ 'access_token': this.access_token,
|
|
|
+ 'sub_appid': this.sub_appid,
|
|
|
+ 'user_id': this.card_number,
|
|
|
+ 'order_id': this.order_id = this.$getOrderId('shuifei'),
|
|
|
+ 'amount': this.amount * 100,
|
|
|
+ 'order_type': 1,
|
|
|
+ 'callback_url': this.$code_base_url + '/HotWater/wxpayrecharge.action'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
this.pay_info = res.data.data.pay_info
|
|
|
// 发起支付
|
|
|
@@ -145,7 +164,7 @@
|
|
|
// 调起支付
|
|
|
pay_amount() {
|
|
|
var OpenMidas = require("@/static/openMidas.js") // 引入小程序目录下的SDK文件
|
|
|
- if (this.test) { // 是否是测试环境
|
|
|
+ if (this.test) { // 测试环境
|
|
|
// 设置支付配置
|
|
|
wx['OpenMidasConfig'] = {
|
|
|
apiCommonConf: {
|
|
|
@@ -188,22 +207,13 @@
|
|
|
// console.log(innerCode); // 支付响应内部错误码
|
|
|
// console.log(resultMsg); // 支付响应说明
|
|
|
// console.log(appMetaData); // 自定义回调数据
|
|
|
-
|
|
|
- if (resultCode == 0) {
|
|
|
- let pay_info_storage_key = {}
|
|
|
- pay_info_storage_key.resultCode = resultCode
|
|
|
- pay_info_storage_key.resultMsg = resultMsg
|
|
|
- // 保存用户充值成功
|
|
|
- uni.setStorageSync('pay_info_storage_key', pay_info_storage_key)
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1
|
|
|
- })
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: '支付异常',
|
|
|
- icon: 'success'
|
|
|
- })
|
|
|
- }
|
|
|
+
|
|
|
+ this.$store.state.payInfo.from = 'reshui_pay'
|
|
|
+ this.$store.state.payInfo.resultCode = resultCode
|
|
|
+ this.$store.state.payInfo.resultMsg = resultMsg
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
}
|
|
|
// },
|
|
|
// appMetaData
|
|
|
@@ -280,6 +290,7 @@
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+ // 生产环境
|
|
|
if (this.amount < 10 || this.amount > 100) {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|