|
@@ -15,7 +15,10 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="u-m-t-20">
|
|
|
- <u-cell-group>
|
|
|
+ <u-cell-group>
|
|
|
+ <u-cell-item title="贵州银行支付" @click="guizhouPay()">
|
|
|
+ <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
|
|
|
+ </u-cell-item>
|
|
|
<u-cell-item title="我的车辆" @click="openPage('pages/myCars/myCars')">
|
|
|
<u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
|
|
|
</u-cell-item>
|
|
@@ -132,6 +135,56 @@
|
|
|
uni.makePhoneCall({
|
|
|
phoneNumber: phone
|
|
|
});
|
|
|
+ },
|
|
|
+ // 贵州银行支付
|
|
|
+ guizhouPay(){
|
|
|
+ let tradeNo = new Date().getTime();
|
|
|
+ uni.setStorage({
|
|
|
+ key:'gzbankTradeNo',
|
|
|
+ data:tradeNo
|
|
|
+ });
|
|
|
+ this.$u.api.gzbank({orderId:tradeNo,openid:'111'})
|
|
|
+ .then(res=>{
|
|
|
+ let resData = res.data;
|
|
|
+ function toQueryPair(key, value) {
|
|
|
+ if (typeof value == 'undefined') {
|
|
|
+ return `&${key}=`;
|
|
|
+ }
|
|
|
+ return `&${key}=${value}`;
|
|
|
+ };
|
|
|
+ function objToParam(param) {
|
|
|
+ if (Object.prototype.toString.call(param) !== '[object Object]') {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ let queryParam = '';
|
|
|
+ for (let key in param) {
|
|
|
+ if (param.hasOwnProperty(key)) {
|
|
|
+ let value = param[key];
|
|
|
+ queryParam += toQueryPair(key, encodeURIComponent(value));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('queryParam',queryParam)
|
|
|
+ return queryParam.substr(1);
|
|
|
+ }
|
|
|
+ let bankLink = 'http://222.85.178.210:80/gateway/Merchantforurl.do?'+objToParam(resData);
|
|
|
+ console.log('gzbank',res);
|
|
|
+ console.log('bankLink',bankLink);
|
|
|
+ // console.log('URLEncode',URLEncode);
|
|
|
+ // let divForm = document.getElementsByTagName('divform')
|
|
|
+ // if (divForm.length) {
|
|
|
+ // document.body.removeChild(divForm[0])
|
|
|
+ // }
|
|
|
+ // const div = document.createElement('divform')
|
|
|
+ // div.innerHTML = res.retBody // res.data就是sb支付宝返回给你的form
|
|
|
+ // document.body.appendChild(div);
|
|
|
+ // // document.forms[0].setAttribute('target', '_blank') // 加了_blank可能出问题所以我注释了
|
|
|
+ // document.punchout_form.submit();
|
|
|
+ // // document.getElementById('alipay_submit').submit();
|
|
|
+ // console.log('alipage',res);
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('gzbank err',err);
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|