Commit 5b561b5b by 高淑倩

跳转支付宝应用或页面

parent 0cfb8d09
{"undefined::component2":false,"undefined::_enableAutoPush":false,"undefined::_appIdList":[],"undefined::uploadTime":"","undefined::packageSize":0,"tinyType":"alipay","tinyCnName":"支付宝","tinyProjectType":"alipay-mini","alipay:alipay-mini:tinyIcon":"https://gw.alipayobjects.com/zos/rmsportal/rcwFIauzePpMqlTzzanK.svg","alipay:alipay-mini:auditLink":null,"alipay:alipay-mini:whiteListLink":null,"alipay:alipay-mini:createLink":null,"alipay:alipay-mini:component2":true,"alipay:alipay-mini:_enableAutoPush":true,"alipay:alipay-mini:_appIdList":[{"appid":"2019092767841505","name":"广东7-Eleven会员专区"},{"appid":"2019092667869080","name":"大禹prd"},{"appid":"2019092667878018","name":"大禹qa"},{"appid":"2019091967575819","name":"大禹dev"}],"alipay:alipay-mini:uploadTime":"2019-09-29 11:06:21","alipay:alipay-mini:packageSize":null,"alipay:alipay-mini:MockStore":{"_userInfo":{"code":"40006","msg":"Insufficient Permissions","subCode":"isv.insufficient-isv-permissions","subMsg":"ISV权限不足,建议在开发者中心检查对应功能是否已经添加,解决办法详见:https://docs.open.alipay.com/common/isverror"},"_loginCode":"47e04caa0d6b488995c45e8e5ed3SC68","reLoginErr":""},"alipay:alipay-mini:_appId":"2019092767841505","alipay:alipay-mini:_appName":"广东7-Eleven会员专区","alipay:alipay-mini:remoteVersion":"0.0.2","alipay:alipay-mini:currentVersion":"0.0.3","alipay:alipay-mini:whiteList":[],"alipay:alipay-mini:h5WhiteList":[],"alipay:alipay-mini:appLogo":"https://appstoreisvpic.alipayobjects.com/prod/92f5af9e-d902-443e-8789-39c1306cfcdc.png","alipay:alipay-mini:userAuthorization":[],"isSimulatorOpen":false,"isNotFirstToggleSimulator":true,"compilerList":[{"title":"普通编译","query":"","page":""},{"title":"积分商城","page":"pages/IntegralMall/IntegralMall"},{"title":"我的消费","page":"pages/mySpend/mySpend"},{"title":"动态子页面_pageId","page":"subPackage/page/pages/subPage/subPage"},{"title":"积分流水","page":"pages/integralWater/integralWater"},{"title":"优惠券","page":"pages/coupons/coupons"},{"title":"我的会员","page":"pages/memberOfOwn/memberOfOwn"},{"title":"发券组件","page":"subPackage/page/pages/aliPayCoupon/aliPayCoupon"}],"compilerIndex":0,"alipay:alipay-mini:preAuditLimit":5,"alipay:alipay-mini:preAuditUsed":0,"storageVersion":"0.70.7","alipay:alipay-mini:stopRefresh":false} {"undefined::component2":false,"undefined::_enableAutoPush":false,"undefined::_appIdList":[],"undefined::uploadTime":"","undefined::packageSize":0,"tinyType":"alipay","tinyCnName":"支付宝","tinyProjectType":"alipay-mini","alipay:alipay-mini:tinyIcon":"https://gw.alipayobjects.com/zos/rmsportal/rcwFIauzePpMqlTzzanK.svg","alipay:alipay-mini:auditLink":null,"alipay:alipay-mini:whiteListLink":null,"alipay:alipay-mini:createLink":null,"alipay:alipay-mini:component2":true,"alipay:alipay-mini:_enableAutoPush":true,"alipay:alipay-mini:_appIdList":[{"appid":"2019092767841505","name":"广东7-Eleven会员专区"},{"appid":"2019092667869080","name":"大禹prd"},{"appid":"2019092667878018","name":"大禹qa"},{"appid":"2019091967575819","name":"大禹dev"}],"alipay:alipay-mini:uploadTime":"2019-09-29 11:06:21","alipay:alipay-mini:packageSize":0,"alipay:alipay-mini:MockStore":{},"alipay:alipay-mini:_appId":"2019092767841505","alipay:alipay-mini:_appName":"广东7-Eleven会员专区","alipay:alipay-mini:remoteVersion":"0.0.2","alipay:alipay-mini:currentVersion":"0.0.3","alipay:alipay-mini:whiteList":[],"alipay:alipay-mini:h5WhiteList":[],"alipay:alipay-mini:appLogo":"https://appstoreisvpic.alipayobjects.com/prod/92f5af9e-d902-443e-8789-39c1306cfcdc.png","alipay:alipay-mini:userAuthorization":[],"isSimulatorOpen":false,"isNotFirstToggleSimulator":true,"compilerList":[{"title":"普通编译","query":"","page":""},{"title":"积分商城","page":"pages/IntegralMall/IntegralMall"},{"title":"我的消费","page":"pages/mySpend/mySpend"},{"title":"动态子页面_pageId","page":"subPackage/page/pages/subPage/subPage"},{"title":"积分流水","page":"pages/integralWater/integralWater"},{"title":"优惠券","page":"pages/coupons/coupons"},{"title":"我的会员","page":"pages/memberOfOwn/memberOfOwn"},{"title":"发券组件","page":"subPackage/page/pages/aliPayCoupon/aliPayCoupon"}],"compilerIndex":0,"alipay:alipay-mini:preAuditLimit":5,"alipay:alipay-mini:preAuditUsed":0,"storageVersion":"0.70.7","alipay:alipay-mini:stopRefresh":false}
This source diff could not be displayed because it is too large. You can view the blob instead.
if(!self.__appxInited) { if(!self.__appxInited) {
self.__appxInited = 1; self.__appxInited = 1;
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$'); require('./config$');
...@@ -15,7 +15,7 @@ self.abridge = self.my; ...@@ -15,7 +15,7 @@ self.abridge = self.my;
self.Component = AFAppX.WorkerComponent || function(){}; self.Component = AFAppX.WorkerComponent || function(){};
self.$global = AFAppX.$global; self.$global = AFAppX.$global;
if(AFAppX.compilerConfig){ AFAppX.compilerConfig.component2 = true; }
function success() { function success() {
require('../../app'); require('../../app');
require('../../component/authorization-modal/authorization-modal'); require('../../component/authorization-modal/authorization-modal');
......
...@@ -2,6 +2,18 @@ ...@@ -2,6 +2,18 @@
const g = typeof global !== 'undefined' ? global : self; const g = typeof global !== 'undefined' ? global : self;
g.appXAppJson = { g.appXAppJson = {
"app": { "app": {
"$homepage": "pages/userCenter/userCenter" "$homepage": "pages/userCenter/userCenter",
"subPackages": [
{
"root": "subPackage/page",
"pages": [
"pages/subPage/subPage",
"pages/h5/h5page",
"pages/pointGoodsList/pointGoodsList",
"pages/goToHome/goToHome",
"pages/aliPayCoupon/aliPayCoupon"
]
}
]
} }
}; };
...@@ -30,8 +30,3 @@ require('../../pages/integralMallDetail/integralMallDetail'); ...@@ -30,8 +30,3 @@ require('../../pages/integralMallDetail/integralMallDetail');
require('../../pages/activateCard/activateCardCallback'); require('../../pages/activateCard/activateCardCallback');
require('../../pages/pointList/pointList'); require('../../pages/pointList/pointList');
require('../../pages/pointDetail/pointDetail'); require('../../pages/pointDetail/pointDetail');
require('../../subPackage/page/pages/subPage/subPage');
require('../../subPackage/page/pages/h5/h5page');
require('../../subPackage/page/pages/pointGoodsList/pointGoodsList');
require('../../subPackage/page/pages/goToHome/goToHome');
require('../../subPackage/page/pages/aliPayCoupon/aliPayCoupon');
if(!self.__appxInited) { /*BUGME_START*/
const __BUGME_START__ = 1;
(()=>{let CircularJSON=JSON;const originalAddEventListener=self.addEventListener,replacer=(e,t)=>void 0===t?"©undefined":null===t?"©null":t===-1/0?"©- Infinity":t===1/0?"©Infinity":"number"==typeof t&&isNaN(t)?"©NaN":"function"==typeof t?"©function":t;try{CircularJSON=eval('(function(JSON,RegExp){var specialChar="~",safeSpecialChar="\\\\x"+("0"+specialChar.charCodeAt(0).toString(16)).slice(-2),escapedSafeSpecialChar="\\\\"+safeSpecialChar,specialCharRG=new RegExp(safeSpecialChar,"g"),safeSpecialCharRG=new RegExp(escapedSafeSpecialChar,"g"),safeStartWithSpecialCharRG=new RegExp("(?:^|([^\\\\\\\\]))"+escapedSafeSpecialChar),indexOf=[].indexOf||function(v){for(var i=this.length;i--&&this[i]!==v;);return i},$String=String;function generateReplacer(value,replacer,resolve){var doNotIgnore=false,inspect=!!replacer,path=[],all=[value],seen=[value],mapp=[resolve?specialChar:"[Circular]"],last=value,lvl=1,i,fn;if(inspect){fn=typeof replacer==="object"?function(key,value){return key!==""&&replacer.indexOf(key)<0?void 0:value}:replacer}return function(key,value){if(inspect)value=fn.call(this,key,value);if(doNotIgnore){if(last!==this){i=lvl-indexOf.call(all,this)-1;lvl-=i;all.splice(lvl,all.length);path.splice(lvl-1,path.length);last=this}if(typeof value==="object"&&value){if(indexOf.call(all,value)<0){all.push(last=value)}lvl=all.length;i=indexOf.call(seen,value);if(i<0){i=seen.push(value)-1;if(resolve){path.push((""+key).replace(specialCharRG,safeSpecialChar));mapp[i]=specialChar+path.join(specialChar)}else{mapp[i]=mapp[0]}}else{value=mapp[i]}}else{if(typeof value==="string"&&resolve){value=value.replace(safeSpecialChar,escapedSafeSpecialChar).replace(specialChar,safeSpecialChar)}}}else{doNotIgnore=true}return value}}function retrieveFromPath(current,keys){for(var i=0,length=keys.length;i<length;current=current[keys[i++].replace(safeSpecialCharRG,specialChar)]);return current}function generateReviver(reviver){return function(key,value){var isString=typeof value==="string";if(isString&&value.charAt(0)===specialChar){return new $String(value.slice(1))}if(key==="")value=regenerate(value,value,{});if(isString)value=value.replace(safeStartWithSpecialCharRG,"$1"+specialChar).replace(escapedSafeSpecialChar,safeSpecialChar);return reviver?reviver.call(this,key,value):value}}function regenerateArray(root,current,retrieve){for(var i=0,length=current.length;i<length;i++){current[i]=regenerate(root,current[i],retrieve)}return current}function regenerateObject(root,current,retrieve){for(var key in current){if(current.hasOwnProperty(key)){current[key]=regenerate(root,current[key],retrieve)}}return current}function regenerate(root,current,retrieve){return current instanceof Array?regenerateArray(root,current,retrieve):current instanceof $String?current.length?retrieve.hasOwnProperty(current)?retrieve[current]:retrieve[current]=retrieveFromPath(root,current.split(specialChar)):root:current instanceof Object?regenerateObject(root,current,retrieve):current}var CircularJSON={stringify:function stringify(value,replacer,space,doNotResolve){return CircularJSON.parser.stringify(value,generateReplacer(value,replacer,!doNotResolve),space)},parse:function parse(text,reviver){return CircularJSON.parser.parse(text,generateReviver(reviver))},parser:JSON};return CircularJSON})(JSON,RegExp)')}catch(e){console.error(e)}const OriginalFunction=Function,OriginalFetch=self.fetch,OriginalBridgeCall=self.AlipayJSBridge&&self.AlipayJSBridge.call,callInternalAPI=(e,t)=>{const n={data:{method:e,param:t},action:"internalAPI"},o=encodeURIComponent(JSON.stringify(n));OriginalFetch?OriginalFetch(`https://alipay.kylinBridge/?data=${o}`,{mode:"no-cors"}).then(()=>{}).catch(()=>{}):OriginalBridgeCall("internalAPI",{method:e,param:t})},eventHandler=e=>{try{if(e.fromVConsoleToWorker){const{requestId:t}=e;if("exec"===e.method){const n=e=>callInternalAPI("tinyDebugConsole",{type:"msgFromWorkerToVConsole",content:CircularJSON.stringify({requestId:t,returnValue:e},replacer)});try{new OriginalFunction("requestId","sendBack",`\n var res = ${e.script};\n console.log(res);\n `)(t,n)}catch(e){console.error(`${e.name}:${e.message}`)}}}}catch(e){}};setTimeout(()=>{self.document&&self.document.addEventListener("push",e=>{try{eventHandler(JSON.parse(e.data.param.content))}catch(e){}}),originalAddEventListener&&originalAddEventListener("push",e=>{try{const t=JSON.parse(JSON.parse(e.data.text()).param.data.content);eventHandler(t)}catch(e){}})},10),["log","info","error","debug","warn"].forEach(e=>{const t=`o${e}`;console[t]||(console[t]=console[e],console[e]=(...n)=>{let o;console[t](...n);try{o=CircularJSON.stringify(n.map(e=>e instanceof Error?`${e.name}: ${e.message}`:e),replacer)}catch(e){return void console.error(`${e.name}: ${e.message}`)}callInternalAPI("tinyDebugConsole",{content:o,type:`console_${e}`})})})})();
const __BUGME_END__ = 1;
/*BUGME_END*/if(!self.__appxInited) {
self.__appxInited = 1; self.__appxInited = 1;
require('@alipay/appx-compiler/lib/sjsEnvInit'); require('@alipay/appx-compiler/lib/sjsEnvInit');
...@@ -47,11 +51,6 @@ require('../../pages/integralMallDetail/integralMallDetail'); ...@@ -47,11 +51,6 @@ require('../../pages/integralMallDetail/integralMallDetail');
require('../../pages/activateCard/activateCardCallback'); require('../../pages/activateCard/activateCardCallback');
require('../../pages/pointList/pointList'); require('../../pages/pointList/pointList');
require('../../pages/pointDetail/pointDetail'); require('../../pages/pointDetail/pointDetail');
require('../../subPackage/page/pages/subPage/subPage');
require('../../subPackage/page/pages/h5/h5page');
require('../../subPackage/page/pages/pointGoodsList/pointGoodsList');
require('../../subPackage/page/pages/goToHome/goToHome');
require('../../subPackage/page/pages/aliPayCoupon/aliPayCoupon');
} }
self.bootstrapApp ? self.bootstrapApp({ success }) : success(); self.bootstrapApp ? self.bootstrapApp({ success }) : success();
} }
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
// pages/userCenter.js
const app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
var wxbarcode = require('../../codeUtils/index.js');
var count = 0;
wxService.page({
/**
* 页面的初始数据
*/
data: {
avatar: '',
date: '',
focus: false,
memberCardNo: '',
memberInfo: {},
memberId: '',
array: ['男', '女', '保密'],
objectArray: [{
id: 0,
name: '男'
}, {
id: 1,
name: '女'
}, {
id: 2,
name: '保密'
}],
index: 0,
date: ''
},
bindPickerChange(e) {
this.setData({
index: e.detail.value
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('onload');
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
console.log('onshow'); // 取会员卡号
const accreditUserInfo = wx2my.getStorageSync('_accreditUserInfo').data
const userMember = wx2my.getStorageSync('_baseUserInfo').data && wx2my.getStorageSync('_baseUserInfo').data.member;
if (userMember) {
this.setData({
memberCardNo: userMember.code,
memberId: userMember.id,
avatar: accreditUserInfo && accreditUserInfo.avatar || '',
}, () => {
my.hideShareMenu();
// 获取会员信息
this.getMemberFind();
});
}
},
bindDateChange(e) {
this.setData({
date: e.detail.value
});
},
formSubmit(e) {
// 0 男 1 女
const {
sex,
email
} = e.detail.value;
if (sex == 0) {
e.detail.value.sex = '男';
} else if (sex == 1) {
e.detail.value.sex = '女';
} else {
e.detail.value.sex = '保密';
} // 校验邮箱
if (email) {
let emailFlag = utils.validateEmail(email);
if (!emailFlag) {
wx2my.showToast({
title: `请输入正确的邮箱地址!`,
icon: 'none'
});
return false;
}
}
const params = e.detail.value; // 保存接口
this.handelMemberUplate(params);
},
onTapWxPay(){
console.log('跳转支付宝应用或页面')
// 跳转支付宝应用或页面
const appid = '2019092767841505'
my.call('startApp',{
appId: '20000056',
param: {
chInfo:`ch_${appid}`
}
})
// my.ap.navigateToAlipayPage({
// //跳转付款码页面,其 schema 格式为:
// path:`alipays://platformapi/startapp?appId=20000056&source=${appid}`,
// success:(res) => {
// my.alert({content:'系统信息' + JSON.stringify(res)});
// },
// fail:(error) => {
// my.alert({content:'系统信息' + JSON.stringify(error)});
// }
// })
},
// 会员详情
getMemberFind() {
wx2my.showLoading({
title: '加载中'
});
const params = {
cardNoOnline: this.data.memberCardNo
};
wxService.post(`/member/find`, params).then(res => {
if (!res) return false;
const {
result,
data
} = res && res.data || res && res.result;
if (result == 0) {
wx2my.hideLoading();
data.member.birthday = data.member.birthday && data.member.birthday.substring(0, 10) || ''; // 性别
const {
sex
} = data.member;
if (sex == '男') {
data.member.sex = 0;
} else if (sex == '女') {
data.member.sex = 1;
} else {
data.member.sex = 2;
}
this.setData({
memberInfo: data.member,
index: data.member.sex,
date: data.member.birthday
});
wxbarcode.barcode('barcode', this.data.memberCardNo, 500, 120);
setTimeout(() => {
wxbarcode.barcode('barcode', this.data.memberCardNo, 500, 120);
}, 200); // this.setInternal();
}
});
},
//定时刷新 10s
setInternal() {
var timeOut = setInterval(() => {
if (count < 10) {
count++;
wxbarcode.barcode('barcode', this.data.memberCardNo, 500, 120);
} else {
clearInterval(timeOut);
}
}, 500);
},
canvasIdErrorCallback(e) {
console.log('code-me', e.detail.errMsg);
},
// 更新
handelMemberUplate(params) {
wx2my.showLoading({
title: '加载中'
});
params.id = this.data.memberId;
wxService.post(`/member/update`, params).then(res => {
const {
result,
data
} = res.data;
if (result == 0) {
wx2my.hideLoading();
wx2my.showToast({
title: '保存成功',
icon: 'success'
});
} else {
wx2my.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
bindTextAreaBlur: function(e) {
console.log(e.detail.value);
},
//日期选择
bindDateChange(e) {
this.setData({
date: e.detail.value
});
},
handleGoWxCard() {// wechatCardId wechatCode
// const { wechatCardId, wechatCode } = wx.getStorageSync('_baseUserInfo')
// wx.openCard({
// cardList: [{
// cardId: wechatCardId,
// code: wechatCode
// }],
// success(res) {
// console.log('查看微信卡包中的卡券', res)
// }
// })
}
});
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
// pages/userCenter.js
const app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
var wxbarcode = require('../../codeUtils/index.js');
var count = 0;
wxService.page({
/**
* 页面的初始数据
*/
data: {
avatar: '',
date: '',
focus: false,
memberCardNo: '',
memberInfo: {},
memberId: '',
array: ['男', '女', '保密'],
objectArray: [{
id: 0,
name: '男'
}, {
id: 1,
name: '女'
}, {
id: 2,
name: '保密'
}],
index: 0,
date: ''
},
bindPickerChange(e) {
this.setData({
index: e.detail.value
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('onload');
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
console.log('onshow'); // 取会员卡号
const accreditUserInfo = wx2my.getStorageSync('_accreditUserInfo').data
const userMember = wx2my.getStorageSync('_baseUserInfo').data && wx2my.getStorageSync('_baseUserInfo').data.member;
if (userMember) {
this.setData({
memberCardNo: userMember.code,
memberId: userMember.id,
avatar: accreditUserInfo && accreditUserInfo.avatar || '',
}, () => {
my.hideShareMenu();
// 获取会员信息
this.getMemberFind();
});
}
},
bindDateChange(e) {
this.setData({
date: e.detail.value
});
},
formSubmit(e) {
// 0 男 1 女
const {
sex,
email
} = e.detail.value;
if (sex == 0) {
e.detail.value.sex = '男';
} else if (sex == 1) {
e.detail.value.sex = '女';
} else {
e.detail.value.sex = '保密';
} // 校验邮箱
if (email) {
let emailFlag = utils.validateEmail(email);
if (!emailFlag) {
wx2my.showToast({
title: `请输入正确的邮箱地址!`,
icon: 'none'
});
return false;
}
}
const params = e.detail.value; // 保存接口
this.handelMemberUplate(params);
},
onTapWxPay(){
console.log('跳转支付宝应用或页面')
// 跳转支付宝应用或页面
const appid = '2019092767841505'
my.call('startApp',{
appId: '20000056',
param: {
chInfo:`ch_${appid}`
}
})
// my.ap.navigateToAlipayPage({
// //跳转付款码页面,其 schema 格式为:
// path:`alipays://platformapi/startapp?appId=20000056&source=${appid}`,
// success:(res) => {
// my.alert({content:'系统信息' + JSON.stringify(res)});
// },
// fail:(error) => {
// my.alert({content:'系统信息' + JSON.stringify(error)});
// }
// })
},
// 会员详情
getMemberFind() {
wx2my.showLoading({
title: '加载中'
});
const params = {
cardNoOnline: this.data.memberCardNo
};
wxService.post(`/member/find`, params).then(res => {
if (!res) return false;
const {
result,
data
} = res && res.data || res && res.result;
if (result == 0) {
wx2my.hideLoading();
data.member.birthday = data.member.birthday && data.member.birthday.substring(0, 10) || ''; // 性别
const {
sex
} = data.member;
if (sex == '男') {
data.member.sex = 0;
} else if (sex == '女') {
data.member.sex = 1;
} else {
data.member.sex = 2;
}
this.setData({
memberInfo: data.member,
index: data.member.sex,
date: data.member.birthday
});
wxbarcode.barcode('barcode', this.data.memberCardNo, 500, 120);
setTimeout(() => {
wxbarcode.barcode('barcode', this.data.memberCardNo, 500, 120);
}, 200); // this.setInternal();
}
});
},
//定时刷新 10s
setInternal() {
var timeOut = setInterval(() => {
if (count < 10) {
count++;
wxbarcode.barcode('barcode', this.data.memberCardNo, 500, 120);
} else {
clearInterval(timeOut);
}
}, 500);
},
canvasIdErrorCallback(e) {
console.log('code-me', e.detail.errMsg);
},
// 更新
handelMemberUplate(params) {
wx2my.showLoading({
title: '加载中'
});
params.id = this.data.memberId;
wxService.post(`/member/update`, params).then(res => {
const {
result,
data
} = res.data;
if (result == 0) {
wx2my.hideLoading();
wx2my.showToast({
title: '保存成功',
icon: 'success'
});
} else {
wx2my.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
bindTextAreaBlur: function(e) {
console.log(e.detail.value);
},
//日期选择
bindDateChange(e) {
this.setData({
date: e.detail.value
});
},
handleGoWxCard() {// wechatCardId wechatCode
// const { wechatCardId, wechatCode } = wx.getStorageSync('_baseUserInfo')
// wx.openCard({
// cardList: [{
// cardId: wechatCardId,
// code: wechatCode
// }],
// success(res) {
// console.log('查看微信卡包中的卡券', res)
// }
// })
}
});
\ No newline at end of file
const wx2my = require('../../wx2my');
const Behavior = require('../../Behavior');
// pages/userCenter.js
const app = getApp();
const wxService = require('../../utils/wxService');
const utils = require('../../utils/util');
const envInfo = require('../../config/index').envInfo;
var wxbarcode = require('../../codeUtils/index.js');
var count = 0;
wxService.page({
/**
* 页面的初始数据
*/
data: {
avatar: '',
date: '',
focus: false,
memberCardNo: '',
memberInfo: {},
memberId: '',
array: ['男', '女', '保密'],
objectArray: [{
id: 0,
name: '男'
}, {
id: 1,
name: '女'
}, {
id: 2,
name: '保密'
}],
index: 0,
date: ''
},
bindPickerChange(e) {
this.setData({
index: e.detail.value
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('onload');
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
console.log('onshow'); // 取会员卡号
const accreditUserInfo = wx2my.getStorageSync('_accreditUserInfo').data
const userMember = wx2my.getStorageSync('_baseUserInfo').data && wx2my.getStorageSync('_baseUserInfo').data.member;
if (userMember) {
this.setData({
memberCardNo: userMember.code,
memberId: userMember.id,
avatar: accreditUserInfo && accreditUserInfo.avatar || '',
}, () => {
my.hideShareMenu();
// 获取会员信息
this.getMemberFind();
});
}
},
bindDateChange(e) {
this.setData({
date: e.detail.value
});
},
formSubmit(e) {
// 0 男 1 女
const {
sex,
email
} = e.detail.value;
if (sex == 0) {
e.detail.value.sex = '男';
} else if (sex == 1) {
e.detail.value.sex = '女';
} else {
e.detail.value.sex = '保密';
} // 校验邮箱
if (email) {
let emailFlag = utils.validateEmail(email);
if (!emailFlag) {
wx2my.showToast({
title: `请输入正确的邮箱地址!`,
icon: 'none'
});
return false;
}
}
const params = e.detail.value; // 保存接口
this.handelMemberUplate(params);
},
onTapWxPay(){
console.log('跳转支付宝应用或页面')
// 跳转支付宝应用或页面
const appid = '2019092767841505'
my.call('startApp',{
appId: '20000056',
param: {
chInfo:`ch_${appid}`
}
})
// my.ap.navigateToAlipayPage({
// //跳转付款码页面,其 schema 格式为:
// path:`alipays://platformapi/startapp?appId=20000056&source=${appid}`,
// success:(res) => {
// my.alert({content:'系统信息' + JSON.stringify(res)});
// },
// fail:(error) => {
// my.alert({content:'系统信息' + JSON.stringify(error)});
// }
// })
},
// 会员详情
getMemberFind() {
wx2my.showLoading({
title: '加载中'
});
const params = {
cardNoOnline: this.data.memberCardNo
};
wxService.post(`/member/find`, params).then(res => {
if (!res) return false;
const {
result,
data
} = res && res.data || res && res.result;
if (result == 0) {
wx2my.hideLoading();
data.member.birthday = data.member.birthday && data.member.birthday.substring(0, 10) || ''; // 性别
const {
sex
} = data.member;
if (sex == '男') {
data.member.sex = 0;
} else if (sex == '女') {
data.member.sex = 1;
} else {
data.member.sex = 2;
}
this.setData({
memberInfo: data.member,
index: data.member.sex,
date: data.member.birthday
});
wxbarcode.barcode('barcode', this.data.memberCardNo, 500, 120);
setTimeout(() => {
wxbarcode.barcode('barcode', this.data.memberCardNo, 500, 120);
}, 200); // this.setInternal();
}
});
},
//定时刷新 10s
setInternal() {
var timeOut = setInterval(() => {
if (count < 10) {
count++;
wxbarcode.barcode('barcode', this.data.memberCardNo, 500, 120);
} else {
clearInterval(timeOut);
}
}, 500);
},
canvasIdErrorCallback(e) {
console.log('code-me', e.detail.errMsg);
},
// 更新
handelMemberUplate(params) {
wx2my.showLoading({
title: '加载中'
});
params.id = this.data.memberId;
wxService.post(`/member/update`, params).then(res => {
const {
result,
data
} = res.data;
if (result == 0) {
wx2my.hideLoading();
wx2my.showToast({
title: '保存成功',
icon: 'success'
});
} else {
wx2my.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
bindTextAreaBlur: function(e) {
console.log(e.detail.value);
},
//日期选择
bindDateChange(e) {
this.setData({
date: e.detail.value
});
},
handleGoWxCard() {// wechatCardId wechatCode
// const { wechatCardId, wechatCode } = wx.getStorageSync('_baseUserInfo')
// wx.openCard({
// cardList: [{
// cardId: wechatCardId,
// code: wechatCode
// }],
// success(res) {
// console.log('查看微信卡包中的卡券', res)
// }
// })
}
});
\ No newline at end of file
...@@ -24,8 +24,7 @@ const testImgCtx = 'http://testimg3.bigaka.com'; // 测试环境图片地址 ...@@ -24,8 +24,7 @@ const testImgCtx = 'http://testimg3.bigaka.com'; // 测试环境图片地址
const preImgCtx = 'http://testimg3.bigaka.com'; // 预生产环境图片地址 const preImgCtx = 'http://testimg3.bigaka.com'; // 预生产环境图片地址
const prodImgCtx = 'http://testimg3.bigaka.com'; // 预生产环境图片地址 const prodImgCtx = 'https://img3.bigaka.com'// 生产环境图片地址
// const prodImgCtx = 'https://img3.bigaka.com' // 生产环境图片地址
const config = { const config = {
dev: devCtx, dev: devCtx,
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</view> </view>
<view class="user-qr-code"> <view class="user-qr-code">
<canvas id="barcode" binderror="canvasIdErrorCallback"/> <canvas id="barcode" binderror="canvasIdErrorCallback"/>
<view class='wx-pay-code' catchTap="onTapWxPay">微信支付</view> <view class='wx-pay-code' catchTap="onTapWxPay">支付宝支付</view>
</view> </view>
</view> </view>
<view class="form-info"> <view class="form-info">
......
...@@ -115,17 +115,22 @@ onTapWxPay(){ ...@@ -115,17 +115,22 @@ onTapWxPay(){
console.log('跳转支付宝应用或页面') console.log('跳转支付宝应用或页面')
// 跳转支付宝应用或页面 // 跳转支付宝应用或页面
const appid = '2019092767841505' const appid = '2019092767841505'
my.ap.navigateToAlipayPage({ my.call('startApp',{
//跳转付款码页面,其 schema 格式为: appId: '20000056',
path:`alipays://platformapi/startapp?appId=${appid}`, param: {
success:(res) => { chInfo:`ch_${appid}`
my.alert({content:'系统信息' + JSON.stringify(res)});
},
fail:(error) => {
my.alert({content:'系统信息' + JSON.stringify(error)});
} }
}) })
// my.ap.navigateToAlipayPage({
// //跳转付款码页面,其 schema 格式为:
// path:`alipays://platformapi/startapp?appId=20000056&source=${appid}`,
// success:(res) => {
// my.alert({content:'系统信息' + JSON.stringify(res)});
// },
// fail:(error) => {
// my.alert({content:'系统信息' + JSON.stringify(error)});
// }
// })
}, },
// 会员详情 // 会员详情
getMemberFind() { getMemberFind() {
......
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