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

修改企业

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