Commit d3083f70 authored by 王建威's avatar 王建威

小程序支付

parent a1e87df7
......@@ -48,6 +48,44 @@
$draggable.on('staticClick', function( event, pointer ) {
$('#qidian_dom').click();
})
const { origin } = window.location;
let url = '';
// 测试环境
if(origin.indexOf('local') > -1 || origin.indexOf('test') > -1){
if(origin.indexOf('test') > -1){
url = `${origin}/mobile/index.php?`;
}else{
url = 'https://test.pet-dbc.cn/mobile/index.php?';
}
}else if(origin.indexOf('jingxiang') > -1){
url = 'https://jingxiang.pet-dbc.cn/mobile/index.php?';
}else{
url = 'https://shop.pet-dbc.cn/mobile/index.php?';
}
var search = window.location.href.split('?');
if(search[1]) {
var arr = search[1].split('&');
arr.every((item, index) => {
var kv = item.split('=');
if(kv[0] === 'openId') {
localStorage.openId = kv[1];
$.ajax({
url: url + 'app=weixin&act=autoLogin',
type: 'get',
data: {
openid: kv[1]
},
dataType: 'json',
success: function(res) {
alert(JSON.stringify(res))
}
})
}
if(kv[0] === 'inionid') {
localStorage.unionid = kv[1];
}
});
}
</script>
<!-- built files will be auto injected -->
</body>
......
......@@ -51,7 +51,7 @@
"mode": "history",
"base": "/uni"
},
"publicPath": "https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/uni/mirror/1.0.13/",
"publicPath": "https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/uni/test/1.0.13/",
"optimization": {
"treeShaking": {
"enable": true
......
{
"name": "shop_mobile_uni",
"version": "1.0.13",
"version": "1.0.14",
"description": "谛宝多多商城",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
......
......@@ -78,6 +78,11 @@
},2000);
return;
}
wx.miniProgram.getEnv(function (res) {
if(res.miniprogram){
var path = '/pages/pay/index?payParam='+encodeURIComponent(JSON.stringify(res))+'&type=uni';
wx.miniProgram.navigateTo({url: path});
} else {
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId": res.app_id, //公众号名称,由商户传入
......@@ -137,6 +142,8 @@
}
}
);
}
})
},
goBack(){
this.$backup();
......
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