Compare commits

..

No commits in common. '8bc34356a291c6a207bab55f14aa3753211fd83d' and 'ba900b6440609ac2d0cf61400d1c573743111068' have entirely different histories.

  1. 21
      App.vue
  2. 5
      Utils/Api.js
  3. 1998
      Utils/js/alipay.js
  4. 2
      index.html
  5. 129
      pages/index/index.vue
  6. 48
      pages/welcome/welcome.vue

@ -26,21 +26,18 @@
// imageWxImg: 'https://hsgcs.dctpay.com/filesystem/wxApplets/',
},
onLaunch: function() {
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.match(/Alipay/i) == "alipay") {
this.platformType = 'ALIPAY';
} else if (userAgent.match(/MicroMessenger/i) == "micromessenger") {
this.platformType = 'WECHAT';
} else {
this.platformType = 'UQRCODEPAY';
}
},
onShow: function() {
console.log('App Show')
let that = this;
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.match(/Alipay/i) == "alipay") {
that.globalData.platformType = 'ALIPAY';
} else if (userAgent.match(/MicroMessenger/i) == "micromessenger") {
that.globalData.platformType = 'WECHAT';
} else {
that.globalData.platformType = 'UQRCODEPAY';
}
let that = this;
uni.getStorage({
key: 'openId',
success(e) {

@ -31,11 +31,6 @@ export const calculation = params => {
export const getH5AccessToken = params => {
return POST('GET', `${base}/wechat/getH5AccessToken`, params).then(res => res.data);
}
//支付宝获取openid
export const getAlipayUserId = params => {
return POST('GET', `${grabase}/login/getAlipayUserId`, params).then(res => res.data);
}
//获取登录验证码
export const getLoginSMSCode = params => {

File diff suppressed because it is too large Load Diff

@ -6,7 +6,7 @@
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<title></title>
<!--preload-links-->
<!--app-context-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>

@ -207,7 +207,6 @@
import passwordInput from "../../components/password-input/password-input.vue";
import cjSlider from '../../components/cj-slider/cj-slider.vue';
import wybPopup from '../../components/wyb-popup/wyb-popup.vue';
import alipayApi from '../../Utils/js/alipay.js';
import {
getQrCodeDetail,
getH5AccessToken,
@ -461,14 +460,14 @@
let storetype = '';
let storeprice = '';
if (this.storeList.discountActivity != '' && this.storeList.discountActivity != null) {
if (item >= this.storediscountCondition) {
if (item >= this.storediscountCondition && (this.storediscountType == 1 || this.storediscountType ==
2)) {
storetype = this.storediscountType;
storeprice = this.storediscountPrice;
}
// else {
// storetype = this.storediscountType;
// storeprice = this.storediscountPrice;
// }
} else {
storetype = this.storediscountType;
storeprice = this.storediscountPrice;
}
}
let phone = '';
if (app.globalData.userInfo) {
@ -676,10 +675,7 @@
// }
},
//
createJSAPIOrder(item) {
uni.showLoading({
title:'请求中'
})
createJSAPIOrder(item) {
// "WECHAT ALIPAY UQRCODEPAY",
let phone = '';
if (app.globalData.userInfo) {
@ -694,8 +690,7 @@
"userDiscountId": this.memDiscountId,
"userPhone": phone
}
createJSAPIOrder(datas).then(res => {
uni.hideLoading();
createJSAPIOrder(datas).then(res => {
if (res.return_code == '000000') {
this.jsapiPay(res.return_data.outTradeNo);
} else {
@ -719,12 +714,12 @@
return;
}
if (res.return_data.payParam && app.globalData.platformType == 'ALIPAY') {
this.alipayRequest(res.return_data.payParam.acc_resp_fields.prepay_id);
this.alipayRequest(res.return_data.acc_resp_fields.paepay_id);
return;
}
if (res.return_data.payParam && app.globalData.platformType == 'UQRCODEPAY') {
// this.unionPayRequest(res.return_data);
location.href = res.return_data.payParam.acc_resp_fields.redirect_url;
window.location.href = res.return_data.acc_resp_fields.redirect_url;
return;
}
uni.showToast({
@ -798,11 +793,11 @@
}
//
if (this.plateNumberList1[0] == '.') {
// uni.showToast({
// title: '',
// duration: 2000,
// icon: 'none'
// })
uni.showToast({
title: '请输入正确的金额',
duration: 2000,
icon: 'none'
})
this.plateNumberList1.pop();
return;
}
@ -815,21 +810,21 @@
// }
//
if (strdata1.length == 3 && !strdata2) {
// uni.showToast({
// title: '',
// duration: 2000,
// icon: 'none'
// })
uni.showToast({
title: '请输入正确的金额',
duration: 2000,
icon: 'none'
})
this.plateNumberList1.pop();
return;
}
//
if (this.plateNumberList.indexOf('.') != -1 && !strdata2) {
// uni.showToast({
// title: '',
// duration: 2000,
// icon: 'none'
// })
uni.showToast({
title: '请输入正确的金额',
duration: 2000,
icon: 'none'
})
this.plateNumberList1.pop();
return;
}
@ -853,11 +848,11 @@
})
if (self.platformType == 1) {
jweixin.config({
debug: false, // ,apialertpclogpc
appId: self.payParam.acc_resp_fields.app_id, //
timestamp: self.payParam.acc_resp_fields.time_stamp, //
nonceStr: self.payParam.acc_resp_fields.nonce_str, //
signature: self.payParam.acc_resp_fields.pay_sign, // 1
debug: true, // ,apialertpclogpc
appId: self.acc_resp_fields.app_id, //
timestamp: self.acc_resp_fields.time_stamp, //
nonceStr: self.acc_resp_fields.nonce_str, //
signature: self.acc_resp_fields.pay_sign, // 1
jsApiList: ['chooseWXPay'] // 使JSJS2
});
uni.hideLoading();
@ -868,15 +863,14 @@
fail: function(res) {}
});
jweixin.chooseWXPay({
appId: self.payParam.acc_resp_fields.app_id,
timestamp: self.payParam.acc_resp_fields
appId: self.acc_resp_fields.app_id,
timestamp: self.acc_resp_fields
.time_stamp, // jssdk使timestamp使timeStampS
nonceStr: self.payParam.acc_resp_fields.nonce_str, // 32
package: self.payParam.acc_resp_fields
nonceStr: self.acc_resp_fields.nonce_str, // 32
package: self.acc_resp_fields
.package, // prepay_idprepay_id=***
signType: self.payParam.acc_resp_fields
.sign_type, // 'SHA1'使'MD5'
paySign: self.payParam.acc_resp_fields.pay_sign, //
signType: self.acc_resp_fields.sign_type, // 'SHA1'使'MD5'
paySign: self.acc_resp_fields.pay_sign, //
success: function(res) {
//
uni.showToast({
@ -897,10 +891,10 @@
} else {
jweixin.config({
debug: false, // ,apialertpclogpc
appId: self.payParam.appId, //
timestamp: self.payParam.timeStamp, //
nonceStr: self.payParam.nonceStr, //
signature: self.payParam.sign, // 1
appId: self.appId, //
timestamp: self.timeStamp, //
nonceStr: self.nonceStr, //
signature: self.sign, // 1
jsApiList: ['chooseWXPay'] // 使JSJS2
});
uni.hideLoading();
@ -939,13 +933,40 @@
},
//
alipayRequest(item) {
alipayApi.tradePay({
tradeNO: item
}, function(res) {
// alert(JSON.stringify(res));
//
// // provideralipay
uni.requestPayment({ // uniapp
provider: 'alipay', // wxpay
orderInfo: item, //
success: function(res) {
this.show1 = false
uni.showToast({
title: "支付成功",
icon: 'success',
duration: 2000
// success: () => {
// setTimeout(() => {
// uni.switchTab({
// url: '/pages/index/index'
// })
// }, 500)
// }
})
},
fail: function(err) {
uni.showToast({
title: "支付失败请稍后再试",
icon: 'none',
duration: 2000
// success: () => {
// setTimeout(() => {
// uni.switchTab({
// url: '/pages/my/my'
// })
// }, 500)
// }
})
}
});
},
}
@ -954,10 +975,6 @@
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
.form {
width: 100%;
border-radius: 8px;

@ -7,7 +7,6 @@
<script>
import {
getH5AccessToken,
getAlipayUserId
} from '../../Utils/Api.js';
let app = getApp();
export default {
@ -19,7 +18,7 @@
onLoad(options) {
var arr1 = window.location.href;
var arr2 = arr1.split('=');
if (app.globalData.platformType == 'WECHAT' || app.globalData.platformType == 'ALIPAY') {
if (app.globalData.platformType == 'WECHAT') {
if (arr2[1].length == 12) {
var arr3 = arr2[1].split('#/');
app.globalData.snNo = arr3[0];
@ -30,26 +29,20 @@
this.jumpWeb();
} else {
let that = this;
var arr4;
arr4 = arr2[2].split('&');
var arr4 = arr2[2].split('&');
app.globalData.code = arr4[0];
uni.getStorage({
key: 'snNumber',
success(e) {
app.globalData.snNo = e.data;
// that.getQrCodeDetail();
}
})
}
if (app.globalData.code && app.globalData.platformType == 'WECHAT') {
if (app.globalData.code) {
this.getH5AccessToken();
}
if (app.globalData.code && app.globalData.platformType == 'ALIPAY') {
this.getAlipayUserId();
}
} else {
var arr1 = window.location.href;
var arr2 = arr1.split('=');
var arr3 = arr2[1].split('#/');
app.globalData.snNo = arr3[0];
uni.setStorage({
@ -60,10 +53,11 @@
url: '../index/index'
})
}
},
methods: {
//H5 openId
//H5 openId
getH5AccessToken() {
let params = {
code: app.globalData.code
@ -83,36 +77,10 @@
}
});
},
//openid
getAlipayUserId() {
let params = {
code: app.globalData.code
}
getAlipayUserId(params).then(res => {
if (res.return_code == '000000' && res.return_data.userId) {
app.globalData.openId = res.return_data.userId;
uni.setStorage({
key: "openId",
data: res.return_data.userId
})
uni.reLaunch({
url: '../index/index'
})
} else {
this.jumpWeb();
}
});
},
//
jumpWeb() {
if (app.globalData.platformType == 'WECHAT') {
location.href =
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https://hsg.dctpay.com/wechat_authorize/?redirect_uri=https://pay.dctpay.com/scanPay&response_type=code&scope=snsapi_base#wechat_redirect';
}
if (app.globalData.platformType == 'ALIPAY') {
location.href =
'https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=2021003176605875&scope=auth_base&redirect_uri=https://pay.dctpay.com/redirect?redirect_uri=https%3A%2F%2Fpay.dctpay.com%2FscanPay%3Fsn%3D1000017476';
}
location.href =
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https://hsg.dctpay.com/wechat_authorize/?redirect_uri=https://hsg.dctpay.com/scanPay&response_type=code&scope=snsapi_base#wechat_redirect';
},
}
}

Loading…
Cancel
Save