Commit 9c5a6abe authored by 小耗子's avatar 小耗子

修改企业

parent 0de602de
...@@ -41,34 +41,32 @@ ...@@ -41,34 +41,32 @@
...mapActions(['getPhoneNumber', 'registerInfoFn', 'authCheck', 'getUserInfo','enterprise']), ...mapActions(['getPhoneNumber', 'registerInfoFn', 'authCheck', 'getUserInfo','enterprise']),
// 马上进入 // 马上进入
enter() { enter() {
// if (this.unregistered && !this.loading) { if (this.unregistered && !this.loading) {
// uni.navigateTo({ uni.navigateTo({
// url: '/pages/h5/index', url: '/pages/h5/index',
// }) })
// }else{ }else{
console.log("x2") this.getInfoPhoneNumber()
this.getInfoPhoneNumber(e) }
// }
}, },
// 获取手机号 // 获取手机号
async getInfoPhoneNumber(e) { async getInfoPhoneNumber(e) {
console.log(e)
let number = await this.getPhoneNumber(e);
let list = await this.enterprise() let list = await this.enterprise()
console.log(list) console.log(list)
if(list.length == 1) { if(list.length == 1) {
let register = await this.registerInfoFn(list[0].companyId); let register = await this.registerInfoFn(list[0].companyId);
if (register) { //注册成功
this.unregistered = true;
uni.navigateTo({
url: '/pages/h5/index',
})
}
}else{ }else{
uni.navigateTo({
url: '/pages/user/enterprise',
})
} }
// let number = await this.getPhoneNumber(e);
// let register = await this.registerInfoFn();
// if (register) { //注册成功
// this.unregistered = true;
// uni.navigateTo({
// url: '/pages/h5/index',
// })
// }
}, },
async auth() { async auth() {
let auth = await this.authCheck(); let auth = await this.authCheck();
...@@ -165,7 +163,7 @@ ...@@ -165,7 +163,7 @@
this.getAuth(); this.getAuth();
}, },
onShareAppMessage(res){ onShareAppMessage(res){
return { return {
path: 'pages/index/defalutScreen' path: 'pages/index/defalutScreen'
} }
} }
......
<template> <template>
<view class="enterprise-boxs"> <view class="enterprise-boxs">
<view class="enterprise-ul"> <view class="enterprise-ul">
<view class="enterprice-li"> <view class="enterprice-li" v-for="item in enterpriseList" :key="item.companyId" @click="selectEnterprise(item)">
<view class="lf"> <view class="lf">
米粒优选商城 {{item.businessName}}
<view class="icon-tips"> <view class="icon-tips">
<!-- <image class="enterprise_icon" src="../../static/img/user/enterprise_icon.png" mode="widthFix"></image> -->
<image class="enterprise_icon" src="../../static/img/user/enterprise_icon1.png" mode="widthFix"></image>
<text class="tips">欢迎访问</text> <text class="tips">欢迎访问</text>
</view> </view>
</view> </view>
<view class="rt"> <view class="rt">
<u-icon name="arrow-right" color="#2979ff" size="28"></u-icon> <!-- <u-icon name="arrow-right" color="#2979ff" size="28"></u-icon> -->
</view> <image class="next_icon2" src="../../static/img/user/enterprise_icon2.png" mode="widthFix"></image>
</view>
<view class="enterprice-li">
<view class="lf">
米粒优选商城
<view class="icon-tips">
<text class="tips">欢迎访问</text>
</view>
</view>
<view class="rt">
<u-icon name="arrow-right" color="#2979ff" size="28"></u-icon>
</view> </view>
</view> </view>
</view> </view>
<image class="bg" src="../../static/img/user/bg.png" mode="scaleToFill"></image> <image class="bg" src="../../static/img/user/bg.png" mode="scaleToFill"></image>
<!-- <view v-for="item in list" :key="item.companyId" @click="selectEnterprise(item)">
{{item.businessName}}
</view> -->
</view> </view>
</template> </template>
<script> <script>
/** /**
* loginType 1需要注册页,0不需要,直接注册 * loginType 1需要注册页,0不需要,直接注册
* mallType 1开放、封闭 * mallType 1开放、0封闭
* registerPageType * registerPageType
* 此字段是当loginType为普通登录时有意义 * 此字段是当loginType为普通登录时有意义
0-页面有 手机号+验证码 0-页面有 手机号+验证码
...@@ -44,9 +32,14 @@ ...@@ -44,9 +32,14 @@
3-页面有 礼品卡+密码 3-页面有 礼品卡+密码
4-页面有 手机号验证码+姓名+工号 4-页面有 手机号验证码+姓名+工号
*/ */
import {
mapActions,
mapGetters
} from 'vuex'
import http from '@/shopro/request/index' import http from '@/shopro/request/index'
export default { export default {
computed: { computed: {
...mapGetters(['enterpriseList'])
}, },
data() { data() {
return { return {
...@@ -60,48 +53,31 @@ ...@@ -60,48 +53,31 @@
} }
}, },
onLoad() { onLoad() {
this.companysList()
this.enterprise()
console.log(this.enterpriseList)
}, },
onShow(){ onShow(){
uni.hideHomeButton() uni.hideHomeButton()
}, },
methods: { methods: {
/** ...mapActions(['enterprise','registerInfoFn']),
* 获取企业列表
*/
companysList(){
let that = this;
console.log(http)
http('user.companysList').then(res => {
if (!res.code) {
this.list = res.data
}else{
that.$u.toast(res.msg);
}
});
},
/** /**
* 选择企业 * 选择企业
*/ */
selectEnterprise(item){ async selectEnterprise(item){
console.log(item)
if(item.loginType){ //1需要注册页 if(item.loginType){ //1需要注册页
}else{//不需要注册 }else{//不需要注册
this.registerInfo.companyId = item.companyId let register = await this.registerInfoFn(item.companyId);
http('user.register',this.registerInfo).then(res => { if (register) { //注册成功
if (!res.code) { uni.navigateTo({
this.list = res.data; url: '/pages/h5/index',
// this.$Router.push({ path: '/pages/index/category' }); })
uni.redirectTo({ }
url: '/pages/index/category',
})
}else{
that.$u.toast(res.msg);
}
})
} }
} }
} }
...@@ -128,15 +104,23 @@ ...@@ -128,15 +104,23 @@
font-weight: bold; font-weight: bold;
.icon-tips{ .icon-tips{
margin-top: 10rpx; margin-top: 10rpx;
.enterprise_icon{
width:24rpx ;
margin-right: 10rpx;
}
.tips{ .tips{
font-size: 24rpx; font-size: 24rpx;
color:#7f7f7f; color:#7f7f7f;
font-weight: normal; font-weight: normal;
vertical-align: text-top;
} }
} }
} }
.rt{ .rt{
width:50rpx ; width:50rpx ;
.next_icon2{
width:48rpx ;
}
} }
} }
} }
......
...@@ -29,7 +29,7 @@ const getters = { ...@@ -29,7 +29,7 @@ const getters = {
wxCode: state=> state.wxCode, wxCode: state=> state.wxCode,
sessionStatus: state=> state.sessionStatus, sessionStatus: state=> state.sessionStatus,
mallId: state=>state.mallId, mallId: state=>state.mallId,
enterpriseList:state=>state.enterpriseList, enterpriseList:state=>state.enterpriseList
} }
...@@ -155,32 +155,32 @@ const actions = { ...@@ -155,32 +155,32 @@ const actions = {
// }); // });
// } // }
state.registerInfo.companyId = companyId state.registerInfo.companyId = companyId
conosole.log(state.registerInfo) http('user.register', state.registerInfo).then(res => {
// http('user.register', state.registerInfo).then(res => { if (res.code==0||res.code==3761) {
// if (res.code==0||res.code==3761) { resolve(1);
// resolve(1); } else{
// } else{ uni.showToast({
// uni.showToast({ title: res.msg,
// title: res.msg, duration: 2000,
// duration: 2000, icon:'none'
// icon:'none' });
// }); reject(res.data);
// reject(res.data); }
// } })
// })
}) })
}, },
// 获取企业 // 获取企业
enterprise({commit,state},e){ enterprise({commit,state},e){
this.enterpriseList = []
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
let that = this; let that = this;
http('user.companysList').then(res => { http('user.companysList').then(res => {
if (!res.code) { if (!res.code) {
this.enterpriseList = res.data; state.enterpriseList = res.data;
resolve(this.enterpriseList); resolve(res.data);
}else{ }else{
resolve([]); resolve([]);
this.enterpriseList = [] state.enterpriseList = [];
uni.showToast(res.msg); uni.showToast(res.msg);
} }
}); });
......
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