Commit 689b48c6 authored by 李俊赕's avatar 李俊赕

入驻基本信息页面静态及交互

parent 87c0ca9e
...@@ -16,7 +16,9 @@ import { ...@@ -16,7 +16,9 @@ import {
import { import {
take_orderApiFun take_orderApiFun
} from '@/common/api/take_order.js'; } from '@/common/api/take_order.js';
import {
settledApiFun
} from '@/common/api/settled.js';
let apiFun = function(vm) { let apiFun = function(vm) {
let codeApi = codeApiFun(vm); let codeApi = codeApiFun(vm);
let datumApi = datumApiFun(vm); let datumApi = datumApiFun(vm);
...@@ -24,7 +26,7 @@ let apiFun = function(vm) { ...@@ -24,7 +26,7 @@ let apiFun = function(vm) {
let mineApi = mineApiFun(vm); let mineApi = mineApiFun(vm);
let searchApi = searchApiFun(vm); let searchApi = searchApiFun(vm);
let take_orderApi = take_orderApiFun(vm); let take_orderApi = take_orderApiFun(vm);
let settledApi = settledApiFun(vm)
let apiUrl = { let apiUrl = {
...codeApi, ...codeApi,
...datumApi, ...datumApi,
...@@ -32,6 +34,7 @@ let apiFun = function(vm) { ...@@ -32,6 +34,7 @@ let apiFun = function(vm) {
...mineApi, ...mineApi,
...searchApi, ...searchApi,
...take_orderApi, ...take_orderApi,
...settledApi
} }
return apiUrl return apiUrl
} }
......
import globalUrl from '@/common/base_url.js'
let settledApiFun = function(vm){
/* 查询用户基本信息 */
let getSettleBaseInfo = async (params = {}) => await vm.$u.get('/v1/h5/settled/get-settled-info', params);
/* 获取认证区域信息 */
let getSettleArea = async (params = {}) => await vm.$u.get('/v1/h5/settled/area', params);
/* 提交用户基本信息 */
let submitSettleBaseInfo = async (params = {}) => await vm.$u.get('/v1/h5/settled/save-info', params);
const settledApi = {
getSettleBaseInfo,
getSettleArea,
submitSettleBaseInfo
}
return settledApi
}
module.exports = {
settledApiFun
}
\ No newline at end of file
...@@ -38,7 +38,11 @@ let noLoginUrl = [ ...@@ -38,7 +38,11 @@ let noLoginUrl = [
'/addons/recharge/api.recharge/config', '/addons/recharge/api.recharge/config',
'/addons/third/api/getAuthUrl', '/addons/third/api/getAuthUrl',
'/addons/third/api/callback', '/addons/third/api/callback',
'/addons/third/api/account' '/addons/third/api/account',
'/v1/h5/settled/get-settled-info',
'/v1/h5/settled/area',
'/v1/h5/settled/save-info'
]; ];
//设置session_id //设置session_id
const getSessionId = function(vm) { const getSessionId = function(vm) {
......
{ {
/*
"easycom": { "easycom": {
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
}, },
*/
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
...@@ -21,6 +21,13 @@ ...@@ -21,6 +21,13 @@
"navigationBarTitleText": "入驻信息" "navigationBarTitleText": "入驻信息"
} }
},
{
"path": "pages/settle/select",
"style": {
"navigationBarTitleText": "选择可服务的城市"
}
}, },
{ {
...@@ -242,12 +249,9 @@ ...@@ -242,12 +249,9 @@
"path": "pages/photo/try", //启动页面,必选 "path": "pages/photo/try", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到 "query": "" //启动参数,在页面的onLoad函数里面得到
},{ },{
"name": "考试", //模式名称 "name": "基本信息", //模式名称
"path": "pages/exam/index", //启动页面,必选 "path": "pages/settle/base", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到 "query": "" //启动参数,在页面的onLoad函数里面得到
}] }]
} }
} }
...@@ -12,18 +12,19 @@ ...@@ -12,18 +12,19 @@
<span class="required">*</span> <span class="required">*</span>
<input placeholder="请输入您的电话" v-model="baseInfo.mobile" class="input flex1" /> <input placeholder="请输入您的电话" v-model="baseInfo.mobile" class="input flex1" />
</view> </view>
<view class="item item-select u-row-between" @click="areaBoxShow = true"> <view class="item item-select u-row-between" @click="gopage('/pages/settle/select?selectType=area')">
<view class="label">接单城市:</view> <view class="label">接单城市:</view>
<p class="flex1 u-text-right txt">{{ areaSelectTxtArr.join(',') || "广东人" }}</p> <p class="u-flex-1 u-text-right txt">{{ areaTxts.join(',') || "" }}</p>
<i class="iconfont icon-xiangyou"></i> <u-icon name="arrow-right" color="#999" size="28"></u-icon>
</view> </view>
<view class="tips">(必选项)选择你可以服务的城市,可选多个</view> <view class="tips">(必选项)选择你可以服务的城市,可选多个</view>
<view class="item item-select flex-yc" @click="ageBoxShow = true"> <view class="item item-select flex-yc" @click="gopage('/pages/settle/select?selectType=working_age')">
<view class="label">电工工龄(年):</view> <view class="label">电工工龄(年):</view>
<p class="flex1 u-text-right" v-show="baseInfo.working_age !== ''"> <p class="u-flex-1 u-text-right" v-show="baseInfo.working_age !== ''">
{{ workingAgeTxt }} {{ workingAgeTxt }}
</p> </p>
<i class="iconfont icon-xiangyou"></i> <u-icon name="arrow-right" color="#999" size="28"></u-icon>
<!-- <i class="iconfont icon-xiangyou"></i> -->
</view> </view>
<view class="tips">(必选项)选择你从事电工工作的工龄</view> <view class="tips">(必选项)选择你从事电工工作的工龄</view>
</view> </view>
...@@ -46,14 +47,13 @@ ...@@ -46,14 +47,13 @@
service_area: [], service_area: [],
working_age: "", working_age: "",
}, },
submitStatus: false,
saving: false, saving: false,
areaSelectTxtArr:[], areaTxts: [],
workingAgeTxt: '',
protocolContent: '' protocolContent: ''
} }
}, },
onLoad(e) { onLoad(e) {
if (e && e.activeService && e.activeService.length > 0) { if (e && e.activeService && e.activeService.length > 0) {
//console.log(e.activeService) //console.log(e.activeService)
this.activeService = e.activeService this.activeService = e.activeService
...@@ -66,14 +66,97 @@ ...@@ -66,14 +66,97 @@
return flag && !this.saving; return flag && !this.saving;
}, },
}, },
methods: { components: {
//拨打客服 点击 },
phoneCallClick: function(phone) { methods: {
uni.makePhoneCall({ gopage(url) {
phoneNumber: phone uni.navigateTo({
url,
});
},
initBaseInfo() {
Indicator.open();
let params = {
id: '',
}
const res = this.$u.api.getSettleBaseInfo(params)
uni.hideLoading()
if (res.status != 200) {
uni.showToast({
title: res.message,
icon: 'success'
});
return;
}
this.baseInfo = res.data
uni.showToast({
title: '入驻基本信息提交成功',
icon: 'success'
}); });
}, },
checkBaseInfo() {
const baseInfo = this.baseInfo;
let rulesObj = {
name: function(value) {
if (!value) {
uni.showToast({
title: '请输入您的姓名',
icon: 'none'
});
return false;
}
},
mobile: function(value) {
const mobileReg = /^[1][3,4,5,7,8][0-9]{9}$/;
if (!value) {
uni.showToast({
title: '请输入您的电话',
icon: 'none'
});
return false;
return false;
} else if (!mobileReg.test(value)) {
uni.showToast({
title: '请输入正确的电话',
icon: 'none'
});
return false;
}
},
service_area: function(value) {
if (!value) {
uni.showToast({
title: '请选择您的接单城市',
icon: 'none'
});
return false;
}
},
working_age: function(value) {
if (value === '') {
uni.showToast({
title: '请选择您的工龄',
icon: 'none'
});
return false;
}
},
};
const flagArr = Object.keys(baseInfo).some((key) => {
// 返回验证失败的数组
let flag = true;
if (rulesObj.hasOwnProperty(key)) {
const func = rulesObj[key];
const value = baseInfo[key];
if (typeof func === "function") {
flag = func(value) === false ? false : true;
}
}
return !flag;
});
return !flagArr || flagArr.length < 1;
},
submitBaseInfo() { submitBaseInfo() {
const baseInfo = this.baseInfo; const baseInfo = this.baseInfo;
if (!this.checkBaseInfo()) { if (!this.checkBaseInfo()) {
...@@ -87,31 +170,26 @@ ...@@ -87,31 +170,26 @@
...baseInfo, ...baseInfo,
} }
params.service_area = baseInfo.service_area.join(',') params.service_area = baseInfo.service_area.join(',')
api.post("@u/v1/h5/settled/save-info", params).then((res) => { const res = this.$u.api.submitSettleBaseInfo(params)
this.saving = false; this.saving = false;
uni.hideLoading() uni.hideLoading()
if (res.status != 200) { if (res.status != 200) {
return;
}
uni.showToast({ uni.showToast({
title: '入驻基本信息提交成功', title: res.message,
icon: 'success' icon: 'success'
}); });
let timer = setTimeout(() => { return;
clearTimeout(timer) }
// this.$router.push({ uni.showToast({
// path: '/activity/settled_2021/file_info', title: '入驻基本信息提交成功',
// query: { icon: 'success'
// id: res.data.id,
// ...this.$route.query
// }
// })
}, 2000)
}).catch((res) => {
this.saving = false;
Indicator.close();
MessageBox("提示", res.message);
}); });
let timer = setTimeout(() => {
clearTimeout(timer)
uni.navigateTo({
url:'/pages/settle/base'
})
}, 2000)
}, },
}, },
} }
...@@ -261,6 +339,7 @@ ...@@ -261,6 +339,7 @@
.seat { .seat {
padding-bottom: 144rpx; padding-bottom: 144rpx;
} }
/*提交按钮*/ /*提交按钮*/
.btn-wrap { .btn-wrap {
position: fixed; position: fixed;
...@@ -270,6 +349,7 @@ ...@@ -270,6 +349,7 @@
bottom: 0; bottom: 0;
padding: 30rpx 0; padding: 30rpx 0;
background: #f3f3f3; background: #f3f3f3;
.btn-submit { .btn-submit {
width: 600rpx; width: 600rpx;
// left: 5%; // left: 5%;
...@@ -279,6 +359,7 @@ ...@@ -279,6 +359,7 @@
background: #2272ff; background: #2272ff;
font-size: 32rpx; font-size: 32rpx;
color: #fff; color: #fff;
&:disabled { &:disabled {
border: 2rpx solid #999; border: 2rpx solid #999;
background-color: #f3f3f3; background-color: #f3f3f3;
...@@ -286,6 +367,7 @@ ...@@ -286,6 +367,7 @@
} }
} }
} }
/* .back_view{ /* .back_view{
background-color: #FFFFFF; background-color: #FFFFFF;
position: absolute; position: absolute;
......
<template>
<view class="content">
<view class="area-nav flex" v-if="selectType == 'area'">
<view class="nav-left">
<view :class="['nav-item',{'active':currentProvinceIndex===index}]" v-for="(areaItem, index) in areaList" :key="index"
@click="getareaList(areaItem.id,1,index)">
{{ areaItem.name }}
</view>
</view>
<view class="nav-right">
<view class="nav-item" :class="['nav-item',{'active':selected.areaIds.indexOf(areaItem.id)>=0}]" v-for="(areaItem, index) in cityList"
@click="selectArea(areaItem)" :key="index">
{{ areaItem.name }}
<u-icon class="iconfont" name="checkbox-mark" color="#2272ff" size="28"></u-icon>
<!-- <i class="iconfont icon-tijiao"></i> -->
</view>
</view>
</view>
<view class="age-box" v-if="selectType == 'working_age'">
<view class="age-item">选择工龄</view>
<view :class="[
'age-item',
{ active: ageItem.value === selected.working_age },
]"
@click="selectAge(ageItem)" v-for="(ageItem, index) in workingAgeList" :key="index">
{{ ageItem.name }}
<u-icon class="iconfont" name="checkbox-mark" color="#2272ff" size="28"></u-icon>
<!-- <i class="iconfont icon-tijiao"></i> -->
</view>
</view>
<view class="btn-wrap fixed flex flex-xc">
<button class="btn-submit" @click="goBack('confirm')">
确定
</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
areaList: [{
id: 1,
name: '北京市',
children: [{
id: 11,
name: '北京市辖区',
}, {
id: 12,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}, {
id: 2,
name: '田径市',
children: [{
id: 21,
name: '田径辖区',
}, {
id: 22,
name: '县',
}]
}],
workingAgeList: [],
selected: {
areaIds: [],
areaTxts: [],
working_age: '',
workingAgeTxt:''
},
currentIndex: 0,
selectedArea: [],
selectType: '',
protocolContent: ''
}
},
computed: {
cityList() {
const areaList = this.areaList
const currentIndex = this.currentIndex
return areaList[currentIndex] && areaList[currentIndex].children || []
}
},
onLoad(option) {
this.initPage(option)
this.initworkingAgeList();
this.getareaList()
uni.setNavigationBarTitle({
title: '新的标题'
});
},
methods: {
goBack(type) {
if (type) {
this.setPrevPageData()
}
uni.navigateBack({
delta: 2
});
},
initPage(option) {
const selectType = option.selectType
this.selectType = selectType
let pages = getCurrentPages()
if (pages.length < 2) {
return
}
let prevVue = pages[pages.length - 2].$vm
if (selectType === 'area') {
this.selected = {
areaIds: prevVue.baseInfo.service_area,
areaTxts: prevVue.areaTxts
}
} else if (selectType === 'working_age') {
this.selected = {
working_age: prevVue.baseInfo.working_age,
workingAgeTxt: prevVue.workingAgeTxt
}
}
},
setPrevPageData() {
let pages = getCurrentPages()
if (pages.length < 2) {
return
}
let selected = this.selected
let prevVue = pages[pages.length - 2].$vm
const selectType = this.selectType
if (prevVue.baseInfo) {
if (selectType === 'area') {
prevVue.baseInfo.service_area = selected.areaIds
prevVue.areaTxts = selected.areaTxts
} else if (selectType === 'working_age') {
prevVue.baseInfo.working_age = selected.working_age
prevVue.workingAgeTxt = selected.workingAgeTxt
}
}
},
initworkingAgeList() {
let list = [{
value: 0,
name: "1年内",
}, ];
for (let i = 1; i < 10; i++) {
const item = {
value: i,
name: i + "年",
};
list.push(item);
}
list.push({
value: 10,
name: "10年+",
});
this.workingAgeList = list;
},
getareaList(code, level, provinceIndex) {
provinceIndex = provinceIndex || 0
this.currentIndex = provinceIndex
let areaList = this.areaList
if (level) {
if (areaList[provinceIndex].children) {
return
}
}
uni.showLoading({
title: '加载中'
});
let params = {
type: '充电桩安装',
level: level || 0,
code: code
}
const res = this.$u.api.getSettleArea(params)
uni.hideLoading()
if (res.status != 200) {
return;
}
if (!level) {
this.areaList = res.data
const parmas = [res.data[0].id, 1]
this.getareaList(...parmas)
} else {
this.$set(areaList[provinceIndex], 'children', res.data)
}
},
selectAge(item) {
this.selected.working_age = item.value
this.selected.workingAgeTxt = item.name
},
selectArea(areaItem) {
const code = areaItem.id
const selected = this.selected
const idx = selected.areaIds.indexOf(code)
const currentProvince = this.areaList[this.currentIndex]
let txt = currentProvince.name + '-' + areaItem.name
if (idx >= 0) {
selected.areaTxts.splice(idx, 1)
selected.areaIds.splice(idx, 1)
} else {
selected.areaIds.push(code)
selected.areaTxts.push(txt)
}
this.selected = selected
},
},
}
</script>
<style lang="scss">
.nav-item,
.age-item {
position: relative;
padding: 22rpx 0;
border-bottom: 2rpx solid #f3f3f3;
text-align: center;
line-height: 42rpx;
font-size: 30rpx;
color: #333;
background: #fff;
&:last-child {
border: none;
}
}
.area-nav {
display: flex;
padding: 30rpx 0;
height: calc(100vh - 120rpx);
overflow: hidden;
.nav-left {
width: 375rpx;
height: 100%;
overflow: auto;
// overflow: hidden;
.nav-item {
border-right: 2rpx solid #f3f3f3;
}
.nav-item.active {
background-color: #ededed;
}
}
.nav-right {
height: 100%;
overflow: auto;
width: 375rpx;
.nav-item {
.iconfont {
display: none;
}
}
.nav-item.active {
color: #2272ff;
.iconfont {
position: absolute;
display: inline-block;
margin-left: 46rpx;
color: #2272ff;
}
}
}
}
.age-box {
padding-top: 40rpx;
height: calc(100vh - 180rpx);
overflow: auto;
.age-item {
position: relative;
}
.age-item .iconfont {
display: none;
}
.age-item.active {
color: #2272ff;
.iconfont {
position: absolute;
display: inline-block;
margin-left: 54rpx;
color: #2272ff;
}
}
}
.seat {
padding-bottom: 144rpx;
}
/*提交按钮*/
.btn-wrap {
position: fixed;
// margin: px2rem(36);
left: 0;
right: 0;
bottom: 0;
padding: 30rpx 0;
background: #f3f3f3;
.btn-submit {
width: 600rpx;
// left: 5%;
// bottom: px2rem(36);
height: 104rpx;
line-height: 104rpx;
background: #2272ff;
font-size: 32rpx;
color: #fff;
&:disabled {
border: 2rpx solid #999;
background-color: #f3f3f3;
color: #999;
}
}
}
/* .back_view{
background-color: #FFFFFF;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
}
*/
</style>
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