Commit 96dc1dcb authored by pengguangpu's avatar pengguangpu

修复bug;手机端自测流程;

parent 00ccd3d6
...@@ -11,6 +11,6 @@ App({ ...@@ -11,6 +11,6 @@ App({
version: "1.0.6.20200310", version: "1.0.6.20200310",
BASE_URL: "https://hhms.miyapay.com/", BASE_URL: "https://hhms.miyapay.com/",
localAccountInfo:null, localAccountInfo:null,
useTestPayInfo:false useTestPayInfo:true
} }
}) })
\ No newline at end of file
...@@ -31,8 +31,6 @@ Page({ ...@@ -31,8 +31,6 @@ Page({
*/ */
initData(){ initData(){
this.data.baseUrl = getApp().globalData.BASE_URL;
var localAccountInfo = getApp().globalData.localAccountInfo; var localAccountInfo = getApp().globalData.localAccountInfo;
console.info("localAccountInfo==>" + JSON.stringify(localAccountInfo)); console.info("localAccountInfo==>" + JSON.stringify(localAccountInfo));
if (localAccountInfo.code == 200 && localAccountInfo.data != null) { if (localAccountInfo.code == 200 && localAccountInfo.data != null) {
...@@ -45,7 +43,7 @@ Page({ ...@@ -45,7 +43,7 @@ Page({
this.data.posId = localAccountInfo.data.store.posId; this.data.posId = localAccountInfo.data.store.posId;
this.data.cashierCode = localAccountInfo.data.store.operatorId; this.data.cashierCode = localAccountInfo.data.store.operatorId;
this.data.signKey = localAccountInfo.data.store.miyaPayPlatformSignKey; this.data.signKey = localAccountInfo.data.store.miyaPayPlatformSignKey;
this.data.baseUrl = localAccountInfo.data.store.miyaPayPlatformUrl + "miya/miyapay_response.action"; this.data.baseUrl = localAccountInfo.data.store.miyaPayPlatformUrl;
this.data.apiVersion = localAccountInfo.data.store.miyaPayApiVersion; this.data.apiVersion = localAccountInfo.data.store.miyaPayApiVersion;
console.log('1112') console.log('1112')
if (getApp().globalData.useTestPayInfo == true) { if (getApp().globalData.useTestPayInfo == true) {
...@@ -55,7 +53,7 @@ Page({ ...@@ -55,7 +53,7 @@ Page({
this.data.marketId = "slzf"; this.data.marketId = "slzf";
this.data.posId = "1"; this.data.posId = "1";
this.data.cashierCode = "1"; this.data.cashierCode = "1";
this.data.baseUrl = "https://paytest.miyapay.com/miya/miyapay_response.action"; this.data.baseUrl = "https://miniprograms-165.miyapay.com/miya/miyapay_response.action";
} }
} }
}, },
...@@ -97,6 +95,7 @@ Page({ ...@@ -97,6 +95,7 @@ Page({
}) })
//todo //todo
var orderNo = (new Date()).getTime() + ""; var orderNo = (new Date()).getTime() + "";
var tempThis = this;
miyapay.requestPay({ miyapay.requestPay({
baseUrl: this.data.baseUrl, baseUrl: this.data.baseUrl,
type: miyapay.TYPE_BARCODE_PAY, type: miyapay.TYPE_BARCODE_PAY,
...@@ -107,22 +106,20 @@ Page({ ...@@ -107,22 +106,20 @@ Page({
version: "1.5", version: "1.5",
orderNo: orderNo, orderNo: orderNo,
token: payCode, token: payCode,
payPrice:"1", payPrice:miyapay.yuan2Fen(this.data.payPriceYuan),
// payPrice:miyapay.yuan2Fen(this.data.payPriceYuan),
signKey: this.data.signKey, signKey: this.data.signKey,
callback: (res) => { callback: (res) => {
wx.hideLoading({
success: (res) => {},
})
console.log("支付回调==>" + JSON.stringify(res)); console.log("支付回调==>" + JSON.stringify(res));
if (res.code == 0) { if (res.code == 0) {
//支付成功 //支付成功
this.paySuccess(); tempThis.paySuccess();
} else { } else {
this.payFail(res.data); tempThis.payFail(res.data);
} }
wx.hideLoading({
success: (res) => {},
})
} }
}); });
}, },
......
...@@ -109,6 +109,15 @@ Page({ ...@@ -109,6 +109,15 @@ Page({
}) })
}, },
onLogoutClicked:function(){
getApp().globalData.localAccountInfo = null
wx.setStorageSync('localAccountInfo', null)
wx.setStorageSync('loginInfo', null)
wx.redirectTo({
url: '/pages/login/login',
})
},
onCloseClicked:function(){ onCloseClicked:function(){
wx.navigateBack() wx.navigateBack()
} }
......
...@@ -50,6 +50,16 @@ Page({ ...@@ -50,6 +50,16 @@ Page({
// } // }
// }) // })
//被扫码回调事件,just for test
wx.scanCode({
onlyFromCamera: true,
success (res) {
console.log(res)
startRefund(res.result)
}
})
}, },
onImageClicked:function(){ onImageClicked:function(){
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<!--提示文字--> <!--提示文字-->
<text style="color:black;font-weight:bold;font-size:40rpx;margin-left:auto;margin-right:auto;margin-top:112rpx;">请扫描订单条码退款</text> <text style="color:black;font-weight:bold;font-size:40rpx;margin-left:auto;margin-right:auto;margin-top:112rpx;">请扫描订单条码退款</text>
<image src="" style="width:567rpx;height:567rpx;background-color:black;margin-left:auto;margin-right:auto;margin-top:224rpx;" bindtap="onImageClicked"></image> <image src="../../images/img_refund_guide.png" style="width:567rpx;height:567rpx;margin-left:auto;margin-right:auto;margin-top:224rpx;" bindtap="onImageClicked"></image>
......
...@@ -121,6 +121,7 @@ function checkOrderState({ baseUrl, saasid, marketId, posId, cashierCode, versio ...@@ -121,6 +121,7 @@ function checkOrderState({ baseUrl, saasid, marketId, posId, cashierCode, versio
//请求 //请求
var checkOrderRequestXmlStr = "<xml>" + json2xml(checkOrderRequest) + "</xml>"; var checkOrderRequestXmlStr = "<xml>" + json2xml(checkOrderRequest) + "</xml>";
console.log("payUrl==>"+baseUrl);
console.log("checkOrderRequestXmlStr==>" + checkOrderRequestXmlStr); console.log("checkOrderRequestXmlStr==>" + checkOrderRequestXmlStr);
wx.request({ wx.request({
headers: { headers: {
...@@ -385,6 +386,7 @@ function requestPay({ baseUrl, type, saasid, marketId, posId, cashierCode, versi ...@@ -385,6 +386,7 @@ function requestPay({ baseUrl, type, saasid, marketId, posId, cashierCode, versi
//请求 //请求
payRequestXmlStr = "<xml>" + json2xml(payRequest) + "</xml>"; payRequestXmlStr = "<xml>" + json2xml(payRequest) + "</xml>";
console.log("payUrl==>"+baseUrl);
console.log("payRequestXmlStr==>" + payRequestXmlStr); console.log("payRequestXmlStr==>" + payRequestXmlStr);
wx.request({ wx.request({
headers: { headers: {
...@@ -508,6 +510,7 @@ function refund({ baseUrl, saasid, marketId, posId, cashierCode, version, orderN ...@@ -508,6 +510,7 @@ function refund({ baseUrl, saasid, marketId, posId, cashierCode, version, orderN
refundRequest.request.A8 = getSign(refundRequest, signKey); refundRequest.request.A8 = getSign(refundRequest, signKey);
refundRequestXmlStr = "<xml>" + json2xml(refundRequest) + "</xml>"; refundRequestXmlStr = "<xml>" + json2xml(refundRequest) + "</xml>";
console.log("payUrl==>"+baseUrl);
console.log("refundRequestXmlStr==>" + refundRequestXmlStr); console.log("refundRequestXmlStr==>" + refundRequestXmlStr);
wx.request({ wx.request({
headers: { headers: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment