Commit a2870eca authored by 潘永坪's avatar 潘永坪

支付宝小程序开发

parent 651379ce
......@@ -113,6 +113,7 @@
timeStamp: "", //时间戳
nonceStr: "", //随机字符串
package: "", //订单详情扩展字符串
orderInfo:"",//支付宝订单号
flag: "", //setTimeout函数
couponData: "", //所有劵数据
chooseCouponObj: "", //默认选中最优价格优惠券
......@@ -154,8 +155,9 @@
}
},
onLoad(option) {
this.companyId=(new RegExp('[?|&]companyId=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(option.q)) || [, ""])[1].replace(/\+/g, '%20') || ""
this.merchantId=(new RegExp('[?|&]merchantId=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(option.q)) || [, ""])[1].replace(/\+/g, '%20') || ""
this.enterUrl=option.q
let channelId=this.getUrlKey("channelId")
let companyId=this.getUrlKey("companyId")
if (this.merchantId) { //大商家的有merchantId
this.init()
} else { //小商家没有merchantId
......@@ -164,6 +166,9 @@
this.initCoupon()
},
methods: {
getUrlKey(name){//---------------------------------------------------------------获取url
return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ""])[1].replace(/\+/g, '%20') || "";
},
clickNum(i,index,a) {//---------------------------------------------------------------------输入数字
this.buyMoney += i
this.leftList[index].child[a].background="#dddddd"
......@@ -314,6 +319,8 @@
this.timeStamp = res.data.timestamp
this.nonceStr = res.data.noncestr
this.package = res.data.package
//支付宝入参
this.orderInfo = res.data.payInfo || ""
this.goPay()
} else {
uni.showToast({
......@@ -349,21 +356,21 @@
//#endif
// #ifdef MP-ALIPAY
uni.requestPayment({
provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay
orderInfo: this.payInfo.orderNo, // 支付宝订单号
success: function (res) {
uni.redirectTo({
url:"../paySuccess/paySuccess"
})
},
fail: function (err) {
uni.showToast({
title:err.errMsg,
icon:"none"
})
}
})
// uni.requestPayment({
// provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay
// orderInfo: this.orderInfo, // 支付宝订单号
// success: function (res) {
// uni.redirectTo({
// url:"../paySuccess/paySuccess"
// })
// },
// fail: function (err) {
// uni.showToast({
// title:err.errMsg,
// icon:"none"
// })
// }
// })
// #endif
}
},
......
(my["webpackJsonp"]=my["webpackJsonp"]||[]).push([["pages/login/login"],{"2c9f":function(e,n,t){"use strict";var o;t.d(n,"b",(function(){return c})),t.d(n,"c",(function(){return r})),t.d(n,"a",(function(){return o}));var c=function(){var e=this,n=e.$createElement;e._self._c},r=[]},"9fb8":function(e,n,t){"use strict";t.r(n);var o=t("2c9f"),c=t("a824");for(var r in c)"default"!==r&&function(e){t.d(n,e,(function(){return c[e]}))}(r);var a,i=t("f0c5"),u=Object(i["a"])(c["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],a);n["default"]=u.exports},a824:function(e,n,t){"use strict";t.r(n);var o=t("bae4"),c=t.n(o);for(var r in o)"default"!==r&&function(e){t.d(n,e,(function(){return o[e]}))}(r);n["default"]=c.a},bae4:function(e,n,t){"use strict";(function(e){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var t={data:function(){return{}},methods:{},onLoad:function(){var n=this;e.getProvider({service:"oauth",success:function(t){e.login({provider:t.provider[0],success:function(o){if(o.code){var c="";"weixin"==t.provider[0]?c=3:"alipay"==t.provider[0]&&(c=4);var r={code:o.code,source:c};e.showToast({title:o.code+"source"+c,icon:"none"}),n.$request("wechat/wx/getUserInfoByCode",r).then((function(n){if("00"==n.code){e.showToast({title:3,icon:"none"});var t=n.data.openid;e.setStorageSync("openid",t),e.navigateBack({delta:1})}else e.removeStorageSync("openid"),e.showToast({title:n.message,icon:"none"})})).catch((function(n){e.removeStorageSync("openid")}))}}})}})}};n.default=t}).call(this,t("c11b")["default"])},d263:function(e,n,t){"use strict";(function(e){t("6909"),t("921b");o(t("66fd"));var n=o(t("9fb8"));function o(e){return e&&e.__esModule?e:{default:e}}e(n.default)}).call(this,t("c11b")["createPage"])}},[["d263","common/runtime","common/vendor"]]]);
\ No newline at end of file
(my["webpackJsonp"]=my["webpackJsonp"]||[]).push([["pages/login/login"],{"88f6":function(e,n,t){"use strict";var o;t.d(n,"b",(function(){return r})),t.d(n,"c",(function(){return c})),t.d(n,"a",(function(){return o}));var r=function(){var e=this,n=e.$createElement;e._self._c},c=[]},"9fb8":function(e,n,t){"use strict";t.r(n);var o=t("88f6"),r=t("a824");for(var c in r)"default"!==c&&function(e){t.d(n,e,(function(){return r[e]}))}(c);var a,i=t("f0c5"),u=Object(i["a"])(r["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],a);n["default"]=u.exports},a824:function(e,n,t){"use strict";t.r(n);var o=t("bae4"),r=t.n(o);for(var c in o)"default"!==c&&function(e){t.d(n,e,(function(){return o[e]}))}(c);n["default"]=r.a},bae4:function(e,n,t){"use strict";(function(e){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var t={data:function(){return{}},methods:{},onLoad:function(){var n=this;e.getProvider({service:"oauth",success:function(t){e.login({provider:t.provider[0],success:function(o){if(o.code){var r="";"weixin"==t.provider[0]?r=3:"alipay"==t.provider[0]&&(r=4);var c={code:o.code,source:r};n.$request("wechat/wx/getUserInfoByCode",c).then((function(n){if("00"==n.code){var t=n.data.openid;e.setStorageSync("openid",t),e.navigateBack({delta:1})}else e.removeStorageSync("openid"),e.showToast({title:n.message,icon:"none"})})).catch((function(n){e.removeStorageSync("openid")}))}}})}})}};n.default=t}).call(this,t("c11b")["default"])},d263:function(e,n,t){"use strict";(function(e){t("6909"),t("921b");o(t("66fd"));var n=o(t("9fb8"));function o(e){return e&&e.__esModule?e:{default:e}}e(n.default)}).call(this,t("c11b")["createPage"])}},[["d263","common/runtime","common/vendor"]]]);
\ No newline at end of file
......@@ -6,8 +6,37 @@
"setting": {
"urlCheck": true,
"es6": true,
"enhance": false,
"postcss": true,
"minified": true
"preloadBackgroundData": false,
"minified": true,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
},
"compileType": "miniprogram",
"libVersion": "",
......@@ -15,19 +44,15 @@
"projectname": "uni-pdtravel",
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"current": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
......
......@@ -254,6 +254,7 @@ __webpack_require__.r(__webpack_exports__);
timeStamp: "", //时间戳
nonceStr: "", //随机字符串
package: "", //订单详情扩展字符串
orderInfo: "", //支付宝订单号
flag: "", //setTimeout函数
couponData: "", //所有劵数据
chooseCouponObj: "", //默认选中最优价格优惠券
......@@ -295,8 +296,9 @@ __webpack_require__.r(__webpack_exports__);
},
onLoad: function onLoad(option) {
this.companyId = (new RegExp('[?|&]companyId=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(option.q)) || [, ""])[1].replace(/\+/g, '%20') || "";
this.merchantId = (new RegExp('[?|&]merchantId=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(option.q)) || [, ""])[1].replace(/\+/g, '%20') || "";
this.enterUrl = option.q;
var channelId = this.getUrlKey("channelId");
var companyId = this.getUrlKey("companyId");
if (this.merchantId) {//大商家的有merchantId
this.init();
} else {//小商家没有merchantId
......@@ -305,6 +307,9 @@ __webpack_require__.r(__webpack_exports__);
this.initCoupon();
},
methods: {
getUrlKey: function getUrlKey(name) {//---------------------------------------------------------------获取url
return (new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ""])[1].replace(/\+/g, '%20') || "";
},
clickNum: function clickNum(i, index, a) {var _this = this; //---------------------------------------------------------------------输入数字
this.buyMoney += i;
this.leftList[index].child[a].background = "#dddddd";
......@@ -455,6 +460,8 @@ __webpack_require__.r(__webpack_exports__);
_this6.timeStamp = res.data.timestamp;
_this6.nonceStr = res.data.noncestr;
_this6.package = res.data.package;
//支付宝入参
_this6.orderInfo = res.data.payInfo || "";
_this6.goPay();
} else {
uni.showToast({
......@@ -490,21 +497,21 @@ __webpack_require__.r(__webpack_exports__);
uni.requestPayment({
provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay
orderInfo: this.payInfo.orderNo, // 支付宝订单号
success: function success(res) {
uni.redirectTo({
url: "../paySuccess/paySuccess" });
},
fail: function fail(err) {
uni.showToast({
title: err.errMsg,
icon: "none" });
} });
// uni.requestPayment({
// provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay
// orderInfo: this.orderInfo, // 支付宝订单号
// success: function (res) {
// uni.redirectTo({
// url:"../paySuccess/paySuccess"
// })
// },
// fail: function (err) {
// uni.showToast({
// title:err.errMsg,
// icon:"none"
// })
// }
// })
} },
......
......@@ -254,6 +254,7 @@ __webpack_require__.r(__webpack_exports__);
timeStamp: "", //时间戳
nonceStr: "", //随机字符串
package: "", //订单详情扩展字符串
orderInfo: "", //支付宝订单号
flag: "", //setTimeout函数
couponData: "", //所有劵数据
chooseCouponObj: "", //默认选中最优价格优惠券
......@@ -295,8 +296,9 @@ __webpack_require__.r(__webpack_exports__);
},
onLoad: function onLoad(option) {
this.companyId = (new RegExp('[?|&]companyId=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(option.q)) || [, ""])[1].replace(/\+/g, '%20') || "";
this.merchantId = (new RegExp('[?|&]merchantId=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(option.q)) || [, ""])[1].replace(/\+/g, '%20') || "";
this.enterUrl = option.q;
var channelId = this.getUrlKey("channelId");
var companyId = this.getUrlKey("companyId");
if (this.merchantId) {//大商家的有merchantId
this.init();
} else {//小商家没有merchantId
......@@ -305,6 +307,9 @@ __webpack_require__.r(__webpack_exports__);
this.initCoupon();
},
methods: {
getUrlKey: function getUrlKey(name) {//---------------------------------------------------------------获取url
return (new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ""])[1].replace(/\+/g, '%20') || "";
},
clickNum: function clickNum(i, index, a) {var _this = this; //---------------------------------------------------------------------输入数字
this.buyMoney += i;
this.leftList[index].child[a].background = "#dddddd";
......@@ -455,6 +460,8 @@ __webpack_require__.r(__webpack_exports__);
_this6.timeStamp = res.data.timestamp;
_this6.nonceStr = res.data.noncestr;
_this6.package = res.data.package;
//支付宝入参
_this6.orderInfo = res.data.payInfo || "";
_this6.goPay();
} else {
uni.showToast({
......
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