htc 1 năm trước cách đây
mục cha
commit
30da00ebf8
1 tập tin đã thay đổi với 26 bổ sung10 xóa
  1. 26 10
      pages/login/select.vue

+ 26 - 10
pages/login/select.vue

@@ -3,8 +3,8 @@
 		<c-nav-bar title="选择门店" backUrl="/pages/login/index" @goBack="goBack" :showHome="false"></c-nav-bar>
 		<view class="card" v-for="(item,index) in list" :key="index" @tap="toHome(item)">
 			<view>
-				<text>{{item.name}}</text>
-				<text>{{item.type}}</text>
+				<text>{{item.merchantName}}</text>
+				<text>{{item.typeName}}</text>
 			</view>
 			<view>进店</view>
 		</view>
@@ -16,9 +16,14 @@
 		data() {
 			return {
 				userInfo:null,
+				merchantId:'',
+				types:[],
 				list:[]
 			}
 		},
+		created() {
+			this.getType();
+		},
 		onLoad(option) {
 			if(option.userInfo) this.userInfo = JSON.parse(decodeURIComponent(option.userInfo));
 			this.getList();
@@ -27,16 +32,27 @@
 			goBack(e){
 				uni.clearStorageSync();
 			},
+			getType(){
+				this.$api.post('/api/dict/getListByTypes',['BusinessType']).then(res=>{
+					if(res.data.code===0){
+						this.types = res.data.data
+					}else this.$showToast(res.data.msg);
+				})
+			},
 			getList(){
-				this.list = [
-					{ name:'一家民宿', type:'酒店民宿'},
-					{ name:'石柱村渔家乐', type:'渔家乐' },
-					{ name:'周游嵊泗', type:'旅行社' }
-				]
+				this.$api.post('/merchant/register/getMerchantStoreList').then(res=>{
+					if(res.data.code===0){
+						this.list = res.data.data;
+						this.list.forEach(l=>{
+							let t = this.types.find(t=>t.dictValue==l.merchantType);
+							l.typeName = t?t.dictLabel:''
+						})
+					}else this.$showToast(res.data.msg);
+				})
 			},
-			toHome(item){
-				console.log(item)
-				this.$store.state.moduleHouse.homestayId=item.merchantId||'1711268640588517378';
+			toHome(item){//1711268640588517378
+				if(item.merchantType==2) uni.setStorageSync('homestayId',item.merchantId);
+				else uni.setStorageSync('merchantId',item.merchantId);
 				uni.setStorageSync('userInfo',this.userInfo);
 				uni.reLaunch({
 					url:'/pages/home/index'