Merge remote-tracking branch 'origin/master-vue3' into master-vue3
This commit is contained in:
+13
-13
@@ -8,7 +8,7 @@ import PayOrderApi from '@/sheep/api/pay/order';
|
||||
/**
|
||||
* 支付
|
||||
*
|
||||
* @param {String} payment = ['wechat','alipay','wallet','offline'] - 支付方式
|
||||
* @param {String} payment = ['wechat','alipay','wallet','mock'] - 支付方式
|
||||
* @param {String} orderType = ['goods','recharge','groupon'] - 订单类型
|
||||
* @param {String} id - 订单号
|
||||
*/
|
||||
@@ -33,8 +33,8 @@ export default class SheepPay {
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
offline: () => {
|
||||
this.offlinePay();
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
}
|
||||
},
|
||||
WechatMiniProgram: {
|
||||
@@ -47,8 +47,8 @@ export default class SheepPay {
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
offline: () => {
|
||||
this.offlinePay();
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
}
|
||||
},
|
||||
App: {
|
||||
@@ -61,8 +61,8 @@ export default class SheepPay {
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
offline: () => {
|
||||
this.offlinePay();
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
}
|
||||
},
|
||||
H5: {
|
||||
@@ -75,8 +75,8 @@ export default class SheepPay {
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
offline: () => {
|
||||
this.offlinePay();
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -182,10 +182,10 @@ export default class SheepPay {
|
||||
code === 0 && this.payResult('success');
|
||||
}
|
||||
|
||||
// 货到付款 TODO 芋艿:待接入
|
||||
async offlinePay() {
|
||||
const { error } = await this.prepay();
|
||||
error === 0 && this.payResult('success');
|
||||
// 模拟支付
|
||||
async mockPay() {
|
||||
const { code } = await this.prepay('mock');
|
||||
code === 0 && this.payResult('success');
|
||||
}
|
||||
|
||||
// 支付宝复制链接支付 TODO 芋艿:待接入
|
||||
|
||||
@@ -20,6 +20,7 @@ async function load() {
|
||||
// 微信公众号登陆
|
||||
async function login(code = '') {
|
||||
// 获取登陆地址
|
||||
debugger
|
||||
if (!code) {
|
||||
const loginResult = await getLoginUrl();
|
||||
if (loginResult.error === 0 && loginResult.data.login_url) {
|
||||
@@ -38,6 +39,7 @@ async function login(code = '') {
|
||||
|
||||
// 微信公众号绑定
|
||||
async function bind(code = '') {
|
||||
debugger
|
||||
// 获取绑定地址
|
||||
if (code === '') {
|
||||
const loginResult = await getLoginUrl('bind');
|
||||
@@ -57,6 +59,7 @@ async function bind(code = '') {
|
||||
|
||||
// 微信公众号解除绑定
|
||||
async function unbind() {
|
||||
debugger
|
||||
const { error } = await third.wechat.unbind({
|
||||
platform: 'officialAccount',
|
||||
});
|
||||
@@ -65,6 +68,7 @@ async function unbind() {
|
||||
|
||||
// 获取公众号登陆地址
|
||||
function getLoginUrl(event = 'login') {
|
||||
debugger
|
||||
let page = getRootUrl() + 'pages/index/login';
|
||||
|
||||
return third.wechat.oauthLogin({
|
||||
@@ -80,6 +84,7 @@ function getLoginUrl(event = 'login') {
|
||||
|
||||
// 此处使用前端发送code在后端解密,防止用户在后端过长时间停留
|
||||
function loginByCode(code) {
|
||||
debugger
|
||||
return third.wechat.login({
|
||||
platform: 'officialAccount',
|
||||
shareInfo: uni.getStorageSync('shareLog') || {},
|
||||
@@ -93,6 +98,7 @@ function loginByCode(code) {
|
||||
|
||||
// 此处使用前端发送code在后端解密,防止用户在后端过长时间停留
|
||||
function bindByCode(code) {
|
||||
debugger
|
||||
return third.wechat.bind({
|
||||
platform: 'officialAccount',
|
||||
payload: encodeURIComponent(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// 登录
|
||||
import { isEmpty } from 'lodash';
|
||||
import third from '@/sheep/api/third';
|
||||
|
||||
const load = async () => {};
|
||||
@@ -11,6 +10,7 @@ const login = () => {
|
||||
provider: 'weixin',
|
||||
onlyAuthorize: true,
|
||||
});
|
||||
debugger
|
||||
if (loginRes.errMsg == 'login:ok') {
|
||||
const res = await third.wechat.login({
|
||||
platform: 'openPlatform',
|
||||
|
||||
Reference in New Issue
Block a user