|
|
@@ -150,7 +150,7 @@ export default {
|
|
|
amount: '',
|
|
|
payWay: 0,
|
|
|
payCallData: null,
|
|
|
- id:0,
|
|
|
+ hdId:0,
|
|
|
salt:'',
|
|
|
account:0,
|
|
|
hdInfo:{balance:0},
|
|
|
@@ -205,21 +205,14 @@ export default {
|
|
|
this.beginInit();
|
|
|
},
|
|
|
beginInit() {
|
|
|
-
|
|
|
- let that = this
|
|
|
- let id = 0
|
|
|
- let salt = ''
|
|
|
- let account = 0
|
|
|
- if(this.option.id){
|
|
|
- //if(this.option.id && this.option.salt){
|
|
|
- id = this.option.id?this.option.id:0
|
|
|
- account = this.option.account?this.option.account:0
|
|
|
- //salt = this.option.salt?this.option.salt:''
|
|
|
+ if(this.option.hdId){
|
|
|
+ this.hdId = this.option.hdId?this.option.hdId:0
|
|
|
+ this.account = this.option.account?this.option.account:0
|
|
|
}else{
|
|
|
- if(this.option.q){
|
|
|
- let currentUrl = decodeURIComponent(this.option.q)
|
|
|
- let str = currentUrl.substring(currentUrl.lastIndexOf("?") + 1)
|
|
|
- var sceneItem = str.split("&");
|
|
|
+ //这个获取小程序码扫码后的参数
|
|
|
+ if(this.option.scene){
|
|
|
+ const scene = decodeURIComponent(this.option.scene);
|
|
|
+ var sceneItem = scene.split("&");
|
|
|
var arr, name, value;
|
|
|
var sceneArray = new Array();
|
|
|
for (var i = 0, l = sceneItem.length; i < l; i++) {
|
|
|
@@ -228,19 +221,19 @@ export default {
|
|
|
value = arr[1];
|
|
|
sceneArray[name] = value;
|
|
|
}
|
|
|
- if(sceneArray.id){
|
|
|
- id =sceneArray.id
|
|
|
+ if(sceneArray.s){
|
|
|
+ this.account = sceneArray.s
|
|
|
+ //将account保存到storage,下面的getHdInfo需要使用,因为是扫码进来的要加这一层
|
|
|
+ uni.setStorageSync('account', this.account)
|
|
|
+ this.hdId = 0
|
|
|
}
|
|
|
- if(sceneArray.salt){
|
|
|
- salt = sceneArray.salt
|
|
|
+ if(sceneArray.a){
|
|
|
+ //预留参数,后面使用
|
|
|
+ let staffId = sceneArray.a
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.id = id
|
|
|
- this.salt = salt
|
|
|
- this.account = account
|
|
|
-
|
|
|
- getHdInfo({id:this.id}).then(res=>{
|
|
|
+ getHdInfo({id:this.hdId}).then(res=>{
|
|
|
let that = this
|
|
|
if(res.code == 1){
|
|
|
that.hdInfo = res.data.hd ? res.data.hd : []
|
|
|
@@ -248,6 +241,13 @@ export default {
|
|
|
if(that.hdInfo.balance < 0){
|
|
|
that.hint = '请输入结账金额'
|
|
|
}
|
|
|
+
|
|
|
+ //通过扫码进来的,要把hdId保存到storage,为后面请求api做准备
|
|
|
+ if(this.option.hdId == undefined){
|
|
|
+ uni.setStorageSync('hdId', that.hdInfo.id)
|
|
|
+ this.hdId = that.hdInfo.id
|
|
|
+ }
|
|
|
+
|
|
|
if (!that.$util.isEmpty(that.customInfo)){
|
|
|
getMemberWeal().then(ret=>{
|
|
|
if(ret.code == 1){
|
|
|
@@ -258,6 +258,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
toPay() {
|
|
|
if (!this.amount) {
|
|
|
@@ -271,7 +273,6 @@ export default {
|
|
|
}
|
|
|
let currentMiniOpenId = uni.getStorageSync('miniOpenId')
|
|
|
params.currentMiniOpenId = currentMiniOpenId
|
|
|
- params.hdId = this.id
|
|
|
params.salt = this.salt
|
|
|
rechargeFn(params).then(res => {
|
|
|
this.payCallData = res.data
|
|
|
@@ -333,18 +334,18 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
paySuccess() {
|
|
|
- this.$util.pageTo({url: '/pages/member/rechargeResult?id='+this.id+'&salt='+this.salt,type: 2})
|
|
|
+ this.$util.pageTo({url: '/pages/member/rechargeResult?id='+this.hdId+'&salt='+this.salt,type: 2})
|
|
|
},
|
|
|
payFail() {
|
|
|
},
|
|
|
viewHasBill(){
|
|
|
- this.pageTo({ url:'/pages/settle/list?id='+this.id+'&account='+this.account})
|
|
|
+ this.pageTo({ url:'/pages/settle/list?id='+this.hdId+'&account='+this.account})
|
|
|
},
|
|
|
viewBill() {
|
|
|
- this.pageTo({ url: '/pages/settle/debt?id='+this.id+'&account='+this.account})
|
|
|
+ this.pageTo({ url: '/pages/settle/debt?id='+this.hdId+'&account='+this.account})
|
|
|
},
|
|
|
viewChange() {
|
|
|
- this.pageTo({ url:'/pages/balance/changeList?id='+this.id+'&account='+this.account})
|
|
|
+ this.pageTo({ url:'/pages/balance/changeList?id='+this.hdId+'&account='+this.account})
|
|
|
},
|
|
|
// 显示支付确认弹框
|
|
|
showPayConfirm() {
|