416 lines
17 KiB
HTML
416 lines
17 KiB
HTML
<!--#
|
|
layout("/mobile/platform.html"){
|
|
#-->
|
|
|
|
<div id="app" v-cloak>
|
|
|
|
<van-nav-bar title="申请账号" placeholder fixed></van-nav-bar>
|
|
|
|
<van-form ref="form" @submit="doSubmit" validate-trigger="onSubmit"
|
|
class="mt10"
|
|
scroll-to-error
|
|
input-align="right"
|
|
:show-error-message="false">
|
|
|
|
<van-cell-group inset>
|
|
|
|
<van-field label="申请人姓名" v-model="formData.applyUserName"
|
|
left-icon="contact" required
|
|
placeholder="请填写申请人姓名"
|
|
:rules="[{ required:true, message: '请填写申请人姓名' }]"></van-field>
|
|
<van-field label="供应商名称" v-model="formData.userName"
|
|
left-icon="cart-o" required
|
|
placeholder="请填写完整供应商名称"
|
|
:rules="[{ required:true, message: '请填写完整供应商名称' }]"></van-field>
|
|
|
|
|
|
<van-cell title="申请模块" clickable>
|
|
<template #right-icon>
|
|
<van-radio-group v-model="formData.applyModel" direction="horizontal"
|
|
@change="applyModelChange">
|
|
<van-radio :name="1">福利</van-radio>
|
|
<van-radio :name="2">疗休养</van-radio>
|
|
</van-radio-group>
|
|
</template>
|
|
</van-cell>
|
|
<!-- <van-field label="性别" v-model="formData.sex" readonly
|
|
required
|
|
@click="sexPicker = true"
|
|
placeholder="请选择性别"
|
|
clickable
|
|
:rules="[{ required:true, message: '请选择性别' }]"
|
|
left-icon="ellipsis"></van-field>
|
|
<van-popup v-model="sexPicker" position="bottom">
|
|
<van-picker
|
|
show-toolbar
|
|
:columns="['男','女']"
|
|
@confirm="(val)=>{this.formData.sex = val;sexPicker=false}"
|
|
@cancel="sexPicker = false"
|
|
></van-picker>
|
|
</van-popup>-->
|
|
|
|
<van-field label="联系电话" placeholder="请填写联系电话"
|
|
left-icon="phone-o"
|
|
required
|
|
readonly
|
|
clickable
|
|
:value="formData.mobile"
|
|
@touchstart.native.stop="mobileShow = true"
|
|
:rules="[{ required:true, message: '请填写联系电话' }]"></van-field>
|
|
|
|
<van-number-keyboard
|
|
v-model="formData.mobile"
|
|
:show="mobileShow"
|
|
:maxlength="11"
|
|
@blur="mobileShow = false"
|
|
></van-number-keyboard>
|
|
|
|
<van-field label="身份证号" placeholder="请填写身份证号"
|
|
left-icon="notes-o"
|
|
required
|
|
readonly
|
|
clickable
|
|
:value="formData.idCard"
|
|
@touchstart.native.stop="idCardShow = true"
|
|
:rules="[{ required:true, message: '请填写身份证号' }]"></van-field>
|
|
<van-number-keyboard
|
|
:show="idCardShow"
|
|
extra-key="X"
|
|
close-button-text="完成"
|
|
@blur="idCardShow = false"
|
|
:maxlength="18"
|
|
v-model="formData.idCard"
|
|
></van-number-keyboard>
|
|
|
|
|
|
<template v-if="formData.applyModel===1">
|
|
<div class="van-cell" style="flex-flow: column">
|
|
<div class="van-cell__title van-field__label"
|
|
style="display: flex;justify-content: space-between">
|
|
<div style="display: flex;">
|
|
<div class="van-field__left-icon">
|
|
<i class="van-icon van-icon-friends-o"></i>
|
|
</div>
|
|
<div class="van-cell__title van-field__label" style="width: auto">
|
|
<span>请选择中标的福利项目</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<van-divider></van-divider>
|
|
<div v-if="welfareProjectList&&welfareProjectList.length>0">
|
|
<van-checkbox-group v-model="formData.welfareProjectIds">
|
|
<van-cell-group>
|
|
<van-cell
|
|
v-for="(item, index) in welfareProjectList"
|
|
clickable
|
|
:key="item.id"
|
|
:title="item.name"
|
|
@click="$refs.checkboxes[index].toggle();">
|
|
<template #right-icon>
|
|
<van-checkbox :name="item.id"
|
|
ref="checkboxes"></van-checkbox>
|
|
</template>
|
|
</van-cell>
|
|
</van-cell-group>
|
|
</van-checkbox-group>
|
|
</div>
|
|
|
|
|
|
<div v-else style="height: 100px">
|
|
暂无
|
|
</div>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<template v-if="formData.applyModel===2">
|
|
|
|
|
|
<div class="van-cell" style="flex-flow: column">
|
|
<div class="van-cell__title van-field__label"
|
|
style="display: flex;justify-content: space-between">
|
|
<div style="display: flex;">
|
|
<div class="van-field__left-icon">
|
|
<i class="van-icon van-icon-friends-o"></i>
|
|
</div>
|
|
<div class="van-cell__title van-field__label" style="width: auto">
|
|
<span>请选择中标的目的地/线路</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<van-tabs v-model="formData.applyModelActive">
|
|
<van-tab title="目的地" name="baseManagement"></van-tab>
|
|
<van-tab title="线路" name="line"></van-tab>
|
|
</van-tabs>
|
|
|
|
<template v-if="formData.applyModelActive==='baseManagement'">
|
|
<!-- 目的地-->
|
|
<div v-if="baseManagementList&&baseManagementList.length>0">
|
|
<van-checkbox-group v-model="formData.baseManagementIds">
|
|
<van-cell-group>
|
|
<van-cell
|
|
v-for="(item, index) in baseManagementList"
|
|
clickable
|
|
:key="item.id"
|
|
:title="item.baseName"
|
|
@click="$refs.checkboxes[index].toggle();">
|
|
<template #right-icon>
|
|
<van-checkbox :name="item.id"
|
|
ref="checkboxes"></van-checkbox>
|
|
</template>
|
|
</van-cell>
|
|
</van-cell-group>
|
|
</van-checkbox-group>
|
|
</div>
|
|
<div v-else style="height: 100px">
|
|
暂无
|
|
</div>
|
|
</template>
|
|
|
|
<template v-if="formData.applyModelActive==='line'">
|
|
<!-- 线路-->
|
|
<div v-if="lineList&&lineList.length>0">
|
|
<van-checkbox-group v-model="formData.lineIds">
|
|
<van-cell-group>
|
|
<van-cell
|
|
v-for="(item, index) in lineList"
|
|
clickable
|
|
:key="item.id"
|
|
:title="item.lineName"
|
|
@click="$refs.checkboxes[index].toggle();">
|
|
<template #right-icon>
|
|
<van-checkbox :name="item.id"
|
|
ref="checkboxes"></van-checkbox>
|
|
</template>
|
|
</van-cell>
|
|
</van-cell-group>
|
|
</van-checkbox-group>
|
|
</div>
|
|
<div v-else style="height: 100px">
|
|
暂无
|
|
</div>
|
|
</template>
|
|
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</van-cell-group>
|
|
|
|
|
|
<div style="margin: 20px 20px 10px;">
|
|
<van-button native-type="submit" style="border-radius: 10px" block type="info"
|
|
:color="themeColor" :disabled="disabled">
|
|
提 交
|
|
</van-button>
|
|
</div>
|
|
|
|
|
|
</van-form>
|
|
|
|
<van-tabbar v-model="active">
|
|
<van-tabbar-item icon="user-circle-o" @click="clickTabbar('/mobile/self/applyUser')">申请账号
|
|
</van-tabbar-item>
|
|
<van-tabbar-item icon="friends-o" replace
|
|
@click="clickTabbar('/mobile/self/applyUser/list')">
|
|
我的申请
|
|
</van-tabbar-item>
|
|
</van-tabbar>
|
|
|
|
|
|
</div>
|
|
|
|
<script>
|
|
const vue = new Vue({
|
|
el: '#app',
|
|
mixins: [mobileMixins],
|
|
data() {
|
|
return {
|
|
idCardShow: false,
|
|
mobileShow: false,
|
|
formData: {
|
|
applyModel: 1,
|
|
welfareProjectIds: [],
|
|
lineIds: [],
|
|
baseManagementIds: [],
|
|
},
|
|
disabled: false,
|
|
currentDate: "",
|
|
id: "",
|
|
active: 0,
|
|
sexPicker: false,
|
|
welfareProjectList: [],
|
|
lineList: [],
|
|
baseManagementList: [],
|
|
}
|
|
},
|
|
methods: {
|
|
applyModelChange(val) {
|
|
if (val === 1) {
|
|
this.$set(this.formData, "welfareProjectIds", [])
|
|
}
|
|
if (val === 2) {
|
|
this.$set(this.formData, "applyModelActive", "baseManagement")
|
|
this.$set(this.formData, "lineIds", [])
|
|
this.$set(this.formData, "baseManagementIds", [])
|
|
}
|
|
},
|
|
clickTabbar(val) {
|
|
location.replace(val + "?currentDate=" + this.currentDate)
|
|
},
|
|
async getWelfareProject() {
|
|
const resp = await $.post("/mobile/self/applyUser/welfareProjectList")
|
|
if (resp.code === 0) {
|
|
this.welfareProjectList = resp.data
|
|
}
|
|
|
|
},
|
|
async getBaseManagementList() {
|
|
const resp = await $.post("/mobile/self/applyUser/getBaseManagementList")
|
|
if (resp.code === 0) {
|
|
this.baseManagementList = resp.data
|
|
}
|
|
},
|
|
async getLineList() {
|
|
const resp = await $.post("/mobile/self/applyUser/getLineList")
|
|
if (resp.code === 0) {
|
|
this.lineList = resp.data
|
|
}
|
|
},
|
|
async doSubmit() {
|
|
if (this.formData.applyModel === 1 && this.formData.welfareProjectIds && this.formData.welfareProjectIds.length === 0) {
|
|
vant.Dialog.alert({
|
|
message: '请选择您中标的福利项目!如您已中标且没有可选福利项目,请联系管理员',
|
|
}).then(() => {
|
|
// on close
|
|
});
|
|
return
|
|
}
|
|
|
|
if (this.formData.applyModel === 2 &&
|
|
((this.formData.baseManagementIds && this.formData.baseManagementIds.length === 0)
|
|
|| (this.formData.lineListIds && this.formData.lineListIds.length === 0))) {
|
|
vant.Dialog.alert({
|
|
message: '请选择您中标的疗休养项目!如您已中标且没有可选疗休养项目,请联系管理员',
|
|
}).then(() => {
|
|
// on close
|
|
});
|
|
return
|
|
}
|
|
|
|
if (!this.id) {
|
|
const data = await $.post(loc() + "/getUserByMobile", {mobile: this.formData.mobile})
|
|
if (data) {
|
|
vant.Toast.fail('当前手机号已申请!如有问题请联系管理员');
|
|
return
|
|
}
|
|
}
|
|
let message = ""
|
|
if (this.formData.applyModel === 1) {
|
|
let projectNames = []
|
|
this.formData.welfareProjectIds.forEach(id => {
|
|
const welfare = this.welfareProjectList.find(w => w.id === id)
|
|
if (welfare) {
|
|
projectNames.push(welfare.name)
|
|
}
|
|
|
|
})
|
|
message = "您选择的福利项目有【" + names + "],"
|
|
this.formData.projectNames = names.join(",")
|
|
this.formData.welfareProjectIds = JSON.stringify(this.formData.welfareProjectIds)
|
|
} else {
|
|
let names = []
|
|
|
|
if (this.formData.baseManagementIds && this.formData.baseManagementIds.length > 0) {
|
|
this.formData.baseManagementIds.forEach(id => {
|
|
const baseManagement = this.baseManagementList.find(w => w.id === id)
|
|
if (baseManagement) {
|
|
names.push(baseManagement.baseName)
|
|
}
|
|
})
|
|
this.formData.baseManagementIds = JSON.stringify(this.formData.baseManagementIds)
|
|
}
|
|
|
|
|
|
if (this.formData.lineIds && this.formData.lineIds.length > 0) {
|
|
this.formData.lineIds.forEach(id => {
|
|
const line = this.lineList.find(w => w.id === id)
|
|
if (line) {
|
|
names.push(line.lineName)
|
|
}
|
|
})
|
|
this.formData.lineIds = JSON.stringify(this.formData.lineIds)
|
|
}
|
|
this.formData.projectNames = names.join(",")
|
|
|
|
message = "您选择的疗休养项目有【" + names + "],"
|
|
}
|
|
|
|
|
|
const confirm = await vant.Dialog.confirm({
|
|
title: '温馨提示',
|
|
message: message + '您确定要提交申请吗?您手机号、身份证号仅作为生成密码时使用,请保证正确否则无法登录,审核通过后将以短信通知您,',
|
|
})
|
|
if (confirm === "confirm") {
|
|
const resp = await $.post(loc() + "/doSubmit", this.formData)
|
|
if (resp.code === 0) {
|
|
vant.Toast.success('申请成功');
|
|
setTimeout(() => {
|
|
location.replace("/mobile/self/applyUser/list?currentDate=" + this.currentDate)
|
|
}, 1000)
|
|
} else {
|
|
vant.Toast.fail('申请失败');
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
},
|
|
async created() {
|
|
this.id = GetQueryString("id")
|
|
this.currentDate = GetQueryString("currentDate")
|
|
await this.getWelfareProject()
|
|
await this.getBaseManagementList()
|
|
await this.getLineList()
|
|
|
|
if (this.id) {
|
|
const resp = await $.post(loc() + "/findOne", {id: this.id})
|
|
this.formData = resp.data
|
|
return
|
|
}
|
|
|
|
if (!this.currentDate) {
|
|
this.disabled = true
|
|
vant.Toast.fail('请扫描申请二维码进入');
|
|
return
|
|
} else {
|
|
if (new Date().valueOf() > this.currentDate) {
|
|
this.disabled = true
|
|
vant.Dialog.alert({
|
|
message: '二维码已过期!请联系管理员',
|
|
}).then(() => {
|
|
// on close
|
|
});
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style>
|
|
.van-cell {
|
|
line-height: 30px;
|
|
}
|
|
</style>
|
|
|
|
|
|
<!--#
|
|
}
|
|
#-->
|