Commit aa0dfba9 authored by gaodapeng's avatar gaodapeng

增加结算页面回跳,增加获取账户信息的代码

parent 1fa8c4c6
...@@ -24,3 +24,6 @@ export const ACTION_ON_PAY_SUCCESS = "ACTION_ON_PAY_SUCCESS"; ...@@ -24,3 +24,6 @@ export const ACTION_ON_PAY_SUCCESS = "ACTION_ON_PAY_SUCCESS";
//支付失败 //支付失败
export const ACTION_ON_PAY_FAILED = "ACTION_ON_PAY_FAILED"; export const ACTION_ON_PAY_FAILED = "ACTION_ON_PAY_FAILED";
//获取账户信息
export const ACTION_GET_ACCOUNT = "ACTION_GET_ACCOUNT";
...@@ -63,8 +63,9 @@ Page({ ...@@ -63,8 +63,9 @@ Page({
my.ix.onBuddyMessage({ my.ix.onBuddyMessage({
success: (res) => { success: (res) => {
console.info(`onBuddyMessage success: ${JSON.stringify(res)}`); console.info(`onBuddyMessage success: ${JSON.stringify(res)}`);
if(res.action == ACTION_GO_SCAN){ if(res.action == ACTION_GO_SCAN){//返回扫码页
//增加跳转回去的内容 //增加跳转回去的内容
my.navigateBack();
} else { } else {
//未知指令 //未知指令
} }
......
var api = require("../../utils/api.js");
import { Page } from '../../utils/scan'; import { Page } from '../../utils/scan';
import { API_USE_COUPON } from '../../const/apiurl' import { API_USE_COUPON } from '../../const/apiurl'
var api = require("../../utils/api.js");
import { ACTION_GO_SCAN } from '../../const/actioncmd' import { ACTION_GO_SCAN } from '../../const/actioncmd'
import { ACTION_GET_ACCOUNT } from '../../const/actioncmd'
Page({ Page({
data: { data: {
...@@ -36,8 +36,26 @@ Page({ ...@@ -36,8 +36,26 @@ Page({
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`); console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
} }
}); });
} else { } else if(res.action == ACTION_GET_ACCOUNT){
//未知指令 var message = {
data:getApp().globalData.localAccountInfo,
action:ACTION_GET_ACCOUNT
}
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId,
data: {
action: ACTION_GET_ACCOUNT,
data: message
},
success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
},
fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
} }
} }
}); });
......
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