1.对接银联支付接口

master
杨杰 3 years ago
parent ed6ee63274
commit 105b307fa4
  1. 16
      high-unionPay/App.vue
  2. 5
      high-unionPay/Utils/Api.js
  3. 1
      high-unionPay/index.html
  4. 2
      high-unionPay/pages.json
  5. 4
      high-unionPay/pages/goods/goods.vue
  6. 2
      high-unionPay/pages/goods/refuel/refuel.vue
  7. 252
      high-unionPay/pages/order/confirmation.vue
  8. 7
      high-unionPay/pages/pay/success/success.vue
  9. 6
      high-unionPay/pages/tabBar/user/user.vue
  10. 2
      high-unionPay/pages/unionPay/unionPay-entrance/unionPay-entrance.vue

@ -5,15 +5,15 @@
// brestUrl: 'http://192.168.3.4:9302/brest',
// imgUrl: 'https://192.168.3.4:9301/filesystem/',
//
url: 'https://hsg.dctpay.com/crest',
imgUrl: 'https://hsg.dctpay.com/filesystem/',
brestUrl : 'https://hsg.dctpay.com/brest',
imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/',
// url: 'https://hsg.dctpay.com/crest',
// imgUrl: 'https://hsg.dctpay.com/filesystem/',
// brestUrl : 'https://hsg.dctpay.com/brest',
// imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/',
//
// url: 'https://hsgcs.dctpay.com/crest',
// brestUrl : 'https://hsgcs.dctpay.com/brest',
// imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
// imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/',
url: 'https://hsgcs.dctpay.com/crest',
brestUrl : 'https://hsgcs.dctpay.com/brest',
imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/',
userInfo: "",
brestUserInfo : '',
openId: '',

@ -170,6 +170,11 @@ export const orderToUNionPay = params => {
return POST('POST', `${base}/outRechargeOrder/orderToPay`, params).then(res => res.data);
}
//银联提交订单
export const unionPay = params => {
return POST('POST', `${base}/order/unionPay`, params).then(res => res.data);
}
/**

@ -8,7 +8,6 @@
<%= htmlWebpackPlugin.options.title %>
</title>
<script>
console.log('=========')
document.addEventListener('DOMContentLoaded', function() {
document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
})

@ -490,7 +490,7 @@
"path" : "pages/unionPay/unionPay-entrance/unionPay-entrance",
"style" :
{
"navigationBarTitleText": "银联入口",
"navigationBarTitleText": "嗨加油",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#0083f5",
"backgroundColorTop": "#0083f5",

@ -81,7 +81,7 @@
</image>
</view>
</view>
<wybPopup ref="popup" type="bottom" width="500" scrollY="true" radius="6" :showCloseIcon="true">
<wybPopup ref="popup" type="bottom" width="500" radius="6" :showCloseIcon="true">
<view class="fotct font18 fontwig6 fcor333 mart10 height30">赠送卡券</view>
<view class="width92 height110 tccs mart10" v-for="product in goodsData[0].handselCouponList"
:key="product.id">
@ -89,7 +89,7 @@
<image mode="widthFix" class="flleft" src="../../static/img/logo.png"></image>
<view class="tcrig">
<view class="font16 fontwig6 fcor333 text1">{{ product.highCouponModel.couponName }}</view>
<view class="font13 fcor999 mart5">有效期至201-05-15 225959(待改)</view>
<view class="font13 fcor999 mart5">有效期至:{{product.highCouponModel.salesEndTime | formatDate('-')}}</view>
<view class="info mart5" v-if="product.highCouponModel.payType == 1">
<view class="price">{{ product.highCouponModel.discountPrice}}</view>
<view class="slogan"

@ -459,7 +459,7 @@
}
.stuMenu {
width: 33.3%;
width: 33%;
height: 30px;
line-height: 30px;
font-size: 14px;

@ -73,8 +73,7 @@
</view>
</view>
<view class="width94 line1 mart5 marb5"></view>
<view class="height50 width100 backcorfff" v-if="couponList.payType == 2 || couponList.payType==3 "
@tap="paytype='jinbi'">
<view class="height50 width100 backcorfff" @tap="paytype='jinbi'">
<view class="width70 flleft fcor333 fontwig6 font16 text1" style="padding-left: 4%;">
积分支付<text class="font14 fcor666 margle">可用积分: {{user.gold}}</text>
</view>
@ -83,25 +82,14 @@
<radio :checked="paytype=='jinbi'" color="#0083f5" />
</view>
</view>
<view class="width94 line1 mart5 marb5" v-if="couponList.payType == 2 || couponList.payType==3 "></view>
<view class="height50 width100 backcorfff" @tap="paytype='weixin'"
v-if="couponList.payType == 1 || couponList.payType==3 ">
<view class="width94 line1 mart5 marb5"></view>
<view class="height50 width100 backcorfff" @tap="paytype='unionPay'">
<view class="width50 flleft fcor333 fontwig6 font16" style="padding-left: 4%;">
微信支付
银联支付
</view>
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;">
<radio :checked="paytype=='weixin'" color="#0083f5" />
</view>
</view>
<view class="width94 line1 mart5 marb5" v-if="couponList.payType == 1 || couponList.payType==3 "></view>
<view class="height50 width100 backcorfff" @tap="paytype='gonghuika'">
<view class="width70 flleft fcor333 fontwig6 font16 text1" style="padding-left: 4%;">
汇联通工会卡<text class="font14 fcor666 margle">可用余额: {{tongCardPrice}}</text>
</view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;">
<radio :checked="paytype=='gonghuika'" @click="changeRiado()" color="#0083f5" />
<radio :checked="paytype=='unionPay'" color="#0083f5" />
</view>
</view>
</view>
@ -139,7 +127,7 @@
</view>
</view>
<wybPopup ref="popup" type="bottom" width="500" scrollY="true" radius="6" :showCloseIcon="true">
<wybPopup ref="popup" type="bottom" width="500" radius="6" :showCloseIcon="true">
<view class="fotct font18 fontwig6 fcor333 mart10 height30">优惠券选择</view>
<view class="width92 height110 tccs mart10" v-for="(items, index) in UserNormalDiscountList" :key="items"
@click="radioChanges(items)">
@ -168,15 +156,13 @@
orderToPay,
orderToGoldPay,
findUser,
unionPay,
hltUnionCardPay,
getHuiLianTongCardBalance
} from '../../Utils/Api.js';
import wybPopup from '../../components/wyb-popup/wyb-popup.vue';
import ssPaymentPassword from '../../components/sanshui-payment-password'
let app = getApp();
// #ifdef H5
var jweixin = require('jweixin-module');
// #endif
export default {
components: {
wybPopup,
@ -255,7 +241,6 @@
if (res.return_code == '000000') {
app.globalData.userInfo = res.return_data;
this.user = res.return_data;
this.getHuiLianTongCardBalance();
uni.setStorage({
key: "user",
data: res.return_data
@ -331,19 +316,6 @@
}
})
},
//
//
getHuiLianTongCardBalance() {
let params = {
cardNo: this.user.hltCardNo.cardNo
}
getHuiLianTongCardBalance(params).then(res => {
if (res.return_code == '000000') {
this.tongCardPrice = res.return_data.balance;
}
});
},
// H5
jumpH5Bding() {
uni.navigateTo({
@ -400,12 +372,6 @@
addOrder(goods).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
// uni.redirectTo({
// url: '../pay/payment/payment?amount=' + res.return_data.payPrice +
// '&paytype=' + this.couponList.payType + '&orderId=' + res.return_data.id +
// '&couponId=' + this.couponId + '&typeaout=' + res.return_data
// .highChildOrderList[0].ext1
// })
this.jumpType = res.return_data.highChildOrderList[0].ext1;
this.orderId = res.return_data.id;
this.orderToPay(res.return_data);
@ -440,55 +406,7 @@
//
orderToPay(item) {
let that = this;
if (that.paytype == 'weixin') {
let params = {
"orderId": item.id,
"openId": app.globalData.openId,
"orderScene": "GOODS_ORDER"
}
orderToPay(params).then(res => {
if (res.return_code == '000000') {
// #ifdef MP
uni.showLoading({
title: '支付中...'
})
uni.requestPayment({
"appId": res.return_data.appId,
"nonceStr": res.return_data.nonceStr,
"package": res.return_data.package,
"paySign": res.return_data.sign,
"signType": "MD5",
"timeStamp": res.return_data.timeStamp,
success: function(res) {
uni.hideLoading();
uni.showToast({
title: '支付成功'
})
uni.reLaunch({
url: '../pay/success/success?id=' + that.couponId
});
},
fail: function(err) {
uni.hideLoading();
uni.navigateBack({})
},
});
// #endif
//
// #ifdef H5
//
that.payRequest(res);
// #endif
} else {
uni.showToast({
title: res.return_msg,
icon: 'none'
})
}
})
} else if (that.paytype == 'jinbi') {
if (that.paytype == 'jinbi') {
if (!that.user.isSetPayPwd) {
uni.navigateTo({
url: '../login/updatePas/updatePas'
@ -496,37 +414,59 @@
return;
}
that.$refs.paymentPassword.modalFun('show');
} else if (that.paytype == 'gonghuika') {
if (!that.user.isSetPayPwd) {
uni.navigateTo({
url: '../login/updatePas/updatePas'
})
return;
}
if (!that.user.isSetHltCard) {
} else if (that.paytype == 'unionPay') {
this.unionPay();
} else {
uni.showToast({
title: '请选择支付方式',
icon: 'none',
title: '当前账号还未绑定,前往绑定',
duration: 2000,
success() {
setTimeout(() => {
uni.navigateTo({
url: '../user/bindingCard/bindingCard'
duration: 2000
})
}, 1000)
}
});
return;
},
//
unionPay() {
let goods = {
"orderId": this.orderId
}
that.$refs.paymentPassword.modalFun('show');
unionPay(goods).then(res => {
if (res.return_code == '000000') {
this.uniontopay(res.return_data.prepayid);
} else {
uni.showToast({
title: '请选择支付方式',
title: res.return_msg,
icon: 'none',
duration: 2000
});
}
})
},
//
uniontopay(item) {
let that = this;
upsdk.pluginReady(function() {
upsdk.pay({
tn: item,
success: function(res) {
uni.showToast({
title: '支付成功'
})
uni.reLaunch({
url: '../pay/success/success?id=' + that.couponId
});
},
fail: function(err) {
uni.showToast({
title: err.msg,
icon: 'none',
duration: 2000
})
// , err.msg , TN,
}
});
});
},
//
submitHandle(e) {
this.PaymentPassword = e.value;
if (this.PaymentPassword == '') {
@ -540,7 +480,6 @@
uni.showLoading({
title: '支付中...'
})
if (this.paytype == 'jinbi') {
let params = {
"orderId": this.orderId,
"password": this.PaymentPassword
@ -554,109 +493,18 @@
uni.reLaunch({
url: '../pay/success/success?id=' + this.couponId
});
return;
}
if (res.return_code == '102130') {
uni.navigateTo({
url: '../../login/updatePas/updatePas'
})
return;
}
uni.showToast({
title: res.return_msg,
icon: 'none'
})
})
return;
}
let params = {
"orderId": this.orderId,
"cardNo": this.user.hltCardNo.cardNo,
"password": this.PaymentPassword
}
hltUnionCardPay(params).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
uni.showToast({
title: '支付成功'
})
uni.reLaunch({
url: '../pay/success/success?id=' + this.couponId
});
return;
}
if (res.return_code == '102130') {
uni.navigateTo({
url: '../../login/updatePas/updatePas'
})
return;
}
uni.showToast({
title: res.return_msg,
icon: 'none'
})
})
},
payRequest: function(self) {
uni.showLoading({
title: '支付中...'
})
jweixin.config({
// debug: false, // ,apialertpclogpc
appId: self.return_data.appId, //
timestamp: self.return_data.timeStamp, //
nonceStr: self.return_data.nonceStr, //
signature: self.return_data.sign, // 1
jsApiList: ['chooseWXPay'] // 使JSJS2
});
uni.hideLoading();
jweixin.ready(function() {
jweixin.checkJsApi({
jsApiList: ['chooseWXPay'], // JSJS2,
success: function(res) {},
fail: function(res) {}
});
jweixin.chooseWXPay({
appId: self.return_data.appId,
timestamp: self.return_data
.timeStamp, // jssdk使timestamp使timeStampS
nonceStr: self.return_data.nonceStr, // 32
package: self.return_data
.package, // prepay_idprepay_id=***
signType: 'MD5', // 'SHA1'使'MD5'
paySign: self.return_data.sign, //
success: function(res) {
//
uni.showToast({
title: '支付成功'
})
if (that.jumpType == 4) {
uni.reLaunch({
url: '/pages/tabBar/user/user'
});
return;
}
uni.reLaunch({
url: '../success/success?id=' + that.couponId
});
},
cancel: function(r) {},
fail: function(res) {}
});
});
jweixin.error(function(res) {
uni.showToast({
icon: 'none',
title: '支付失败了',
duration: 4000
});
});
},
}
}
</script>

@ -228,9 +228,12 @@
})
},
toUser() {
uni.switchTab({
// uni.switchTab({
// url: '/pages/tabBar/user/user'
// });
uni.reLaunch({
url: '/pages/tabBar/user/user'
});
})
},
scan() {
uni.scanCode({

@ -243,9 +243,9 @@
});
},
onShow() {
// if (app.globalData.userInfo) {
// this.findUser();
// }
if (app.globalData.userInfo) {
this.findUser();
}
if (!app.globalData.userInfo.isSetPayPwd) {
this.czList = [

@ -23,7 +23,7 @@
jumprecharge(item) {
if (item == 1) {
uni.navigateTo({
url: '../../goods/goods-list/goods-list?id=1'
url: '../../goods/goods-list/goods-list?id=2'
})
return;
}

Loading…
Cancel
Save