|
@@ -1,7 +1,7 @@
|
|
import axios from 'axios'
|
|
import axios from 'axios'
|
|
import config from './config'
|
|
import config from './config'
|
|
import qs from 'qs'
|
|
import qs from 'qs'
|
|
-// import pingpp from '../../../webapp/common/js/pingpp'
|
|
|
|
|
|
+import pingpp from '../../../webapp/common/js/pingpp'
|
|
// let apiPath = 'http://commontest.yiguanjia.me/index.php?r='
|
|
// let apiPath = 'http://commontest.yiguanjia.me/index.php?r='
|
|
|
|
|
|
export default ({
|
|
export default ({
|
|
@@ -61,41 +61,40 @@ export default ({
|
|
console.log(61)
|
|
console.log(61)
|
|
console.log(res.data)
|
|
console.log(res.data)
|
|
// let WxPay = res.data
|
|
// let WxPay = res.data
|
|
- /* if (false) {
|
|
|
|
- pingpp.createPayment(res.data.data, function (result, err) {
|
|
|
|
- if (result === 'success') {
|
|
|
|
- // 只有微信公众账号 wx_pub 支付成功的结果会在这里返回,其他的支付结果都会跳转到 extra 中对应的 URL。
|
|
|
|
- var res = {
|
|
|
|
- success: true
|
|
|
|
- }
|
|
|
|
- console.log(res)
|
|
|
|
- } else if (result === 'fail') {
|
|
|
|
- // charge 不正确或者微信公众账号支付失败时会在此处返回
|
|
|
|
- console.log(err)
|
|
|
|
- } else if (result === 'cancel') {
|
|
|
|
- // 微信公众账号支付取消支付
|
|
|
|
- console.log(err)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- */
|
|
|
|
- // window.location.href='http://commontest.yiguanjia.me/index.php?r=o2o/web/index';
|
|
|
|
- // 支付凭据
|
|
|
|
- console.log(82)
|
|
|
|
- let wxPay = res.data.data
|
|
|
|
- console.log(wxPay.credential)
|
|
|
|
- let option = wxPay.credential.wx_pub
|
|
|
|
|
|
+ if (!config.test) {
|
|
|
|
+ pingpp.createPayment(res.data.data, function (result, err) {
|
|
|
|
+ if (result === 'success') {
|
|
|
|
+ // 只有微信公众账号 wx_pub 支付成功的结果会在这里返回,其他的支付结果都会跳转到 extra 中对应的 URL。
|
|
|
|
+ var res = {
|
|
|
|
+ success: true
|
|
|
|
+ }
|
|
|
|
+ console.log(res)
|
|
|
|
+ } else if (result === 'fail') {
|
|
|
|
+ // charge 不正确或者微信公众账号支付失败时会在此处返回
|
|
|
|
+ console.log(err)
|
|
|
|
+ } else if (result === 'cancel') {
|
|
|
|
+ // 微信公众账号支付取消支付
|
|
|
|
+ console.log(err)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ // window.location.href='http://commontest.yiguanjia.me/index.php?r=o2o/web/index';
|
|
|
|
+ // 支付凭据
|
|
|
|
+ console.log(82)
|
|
|
|
+ let wxPay = res.data.data
|
|
|
|
+ console.log(wxPay.credential)
|
|
|
|
+ let option = wxPay.credential.wx_pub
|
|
|
|
|
|
- let prepay = option['package'].replace('prepay_id=', '')
|
|
|
|
- window.location.href = 'http://common.yiguanjia.me/webapp/o2o/module/pay/index.html?appId=' +
|
|
|
|
- option.appId + '&nonceStr=' + option.nonceStr +
|
|
|
|
- '&package=' + prepay + '&signType=' +
|
|
|
|
- option.signType + '&timeStamp=' +
|
|
|
|
- option.timeStamp + '&paySign=' +
|
|
|
|
- option.paySign + '&amount=' + wxPay.amount +
|
|
|
|
- '&created=' + wxPay.created + '&body=' +
|
|
|
|
- wxPay.body + '&bookingTime=' + bookingTime
|
|
|
|
- // }
|
|
|
|
|
|
+ let prepay = option['package'].replace('prepay_id=', '')
|
|
|
|
+ window.location.href = 'http://common.yiguanjia.me/webapp/o2o/module/pay/index.html?appId=' +
|
|
|
|
+ option.appId + '&nonceStr=' + option.nonceStr +
|
|
|
|
+ '&package=' + prepay + '&signType=' +
|
|
|
|
+ option.signType + '&timeStamp=' +
|
|
|
|
+ option.timeStamp + '&paySign=' +
|
|
|
|
+ option.paySign + '&amount=' + wxPay.amount +
|
|
|
|
+ '&created=' + wxPay.created + '&body=' +
|
|
|
|
+ wxPay.body + '&bookingTime=' + bookingTime
|
|
|
|
+ }
|
|
|
|
|
|
// cb(tmp)
|
|
// cb(tmp)
|
|
}).catch(function (e) {
|
|
}).catch(function (e) {
|