17755135699 1 년 전
부모
커밋
de9466f46e
2개의 변경된 파일48개의 추가작업 그리고 6개의 파일을 삭제
  1. 4 0
      pages/home/index.vue
  2. 44 6
      pagesHouse/home/index.vue

+ 4 - 0
pages/home/index.vue

@@ -204,6 +204,10 @@
 						this.list = [];
 						uni.setStorageSync('homestayId', '');
 						uni.setStorageSync('merchantId', t.merchantId);
+						uni.setStorageSync('merchantName', t.merchantName);
+						uni.reLaunch({
+							url: '/pagesHouse/home/index'
+						})
 					}
 				}
 			},

+ 44 - 6
pagesHouse/home/index.vue

@@ -1,10 +1,12 @@
 <template>
 	<view class="page" :style="{'min-height':(h-th)+'px'}">
 		<u-navbar bgColor="transparent">
-			<view class="u-nav-slot" slot="left">
-				<text>{{merchantName}}</text>
+			<view class="u-nav-slot" slot="left" @tap="shShow=true">
+				<text>{{name}}</text>
 			</view>
 		</u-navbar>
+		<u-picker :show="shShow" :columns="nameList" @close="shShow=false" @cancel="shShow=false"
+			@confirm="confirm" :immediateChange="true" itemHeight="88"></u-picker>
 		<view class="bg" :style="{'padding-top':(mt+10)+'px'}">
 			<view class="dataBox">
 				<view class="item">
@@ -99,24 +101,60 @@
 	export default {
 		data() {
 			return {
-				merchantName:uni.getStorageSync('merchantName'),
+				name:uni.getStorageSync('merchantName'),
 				emg: 'https://i.ringzle.com/file/20240224/91173dde1cb44b139129e12ad4971f1d.png',
 				icons: ['https://i.ringzle.com/file/20240224/70ab9f9d1a144c95927dedc6e84bcce7.png',
 					'https://i.ringzle.com/file/20240224/3f990c250f444ac9a5d9f334f322c98e.png',
 					'https://i.ringzle.com/file/20240224/7ca1bfa6e348438e83edc5af0589f847.png'
 				],
 				info:{},
+				shShow:false,
 				list:[],
+				shList:[],
+				nameList:[],
 			}
 		},
 		onLoad(opt){
-			// if(opt.merchantName ){
-			// 	this.merchantName =opt.merchantName ;
-			// }
 			this.getData();
 			this.getList();
+			this.getType();
 		},
 		methods: {
+			getType() {
+				this.$api.post('/merchant/register/getMerchantStoreList').then(res => {
+					if (res.data.code === 0) {
+						this.shList = res.data.data;
+						let shs = [];
+						this.shList.forEach(d => shs.push(d.merchantName));
+						this.nameList = [shs];
+						let id = uni.getStorageSync('merchantId');
+						if(!uni.getStorageSync('merchantId')) id = uni.getStorageSync('merchantId');
+						let t = this.shList.find(d => d.merchantId == id);
+						this.name = t ? t.merchantName : ''
+						console.log(this.nameList)
+					} else this.$showToast(res.data.msg);
+				})
+			},
+			confirm(e) {
+				this.name = e.value[0];
+				this.shShow = false;
+				let t = this.shList.find(d => d.merchantName == this.name);
+				if (t) {
+					if (t.merchantType == 2) { //酒店民宿
+						uni.setStorageSync('homestayId', t.merchantId);
+						uni.setStorageSync('merchantId', '');
+						uni.reLaunch({
+							url: '/pages/home/index'
+						})
+					} else {
+						uni.setStorageSync('homestayId', '');
+						uni.setStorageSync('merchantId', t.merchantId);
+						uni.setStorageSync('merchantName', t.merchantName);
+						this.getData();
+						this.getList();
+					}
+				}
+			},
 			getData() {
 				this.$api.get('/merchant/merchantFisherman/home/getMerchantFishermanAppHome/'+ uni.getStorageSync('merchantId')).then(res => {
 					if (res.data.code === 0) {