shish 1 год назад
Родитель
Сommit
7b8d6db83f
2 измененных файлов с 34 добавлено и 37 удалено
  1. 4 8
      mallApp/src/pages/home/recent.vue
  2. 30 29
      mallApp/src/pages/member/recharge.vue

+ 4 - 8
mallApp/src/pages/home/recent.vue

@@ -1,9 +1,5 @@
 <template>
-  <scroll-view
-    scroll-y
-    style="height: 100vh; width: 100vw;"
-    @scrolltolower="toBottom"
-  >
+  <scroll-view scroll-y style="height: 100vh; width: 100vw;" @scrolltolower="toBottom" >
     <view class="shop-list_box">
       <block v-if="loginStyle  == 0">
         <view style="width:100vw;height:500upx;display:flex;align-items:center;justify-content:center;">
@@ -108,7 +104,7 @@ export default {
     return {
       //0没有登录 1有登录
       loginStyle :0,
-      activePopupIndex: -1, // 控制弹出菜单的显示
+      activePopupIndex: -1,
       pageAction:{refresh:0}
     };
   },
@@ -138,8 +134,8 @@ export default {
 
   },
   methods: {
-    recharge (item) {
-      this.pageTo({ url: '/pages/member/recharge?id='+item.id+'&account='+item.shopId})
+    recharge(item) {
+      this.pageTo({ url: '/pages/member/recharge?hdId='+item.id+'&account='+item.shopId})
     },
     toBottom(){
       if (!this.list.finished) {

+ 30 - 29
mallApp/src/pages/member/recharge.vue

@@ -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() {