Commit b821d1c2 by Chao Sun

填写问卷部分添加城市id

parent 292566e7
...@@ -52,7 +52,9 @@ input[type="number"] { ...@@ -52,7 +52,9 @@ input[type="number"] {
position: fixed; position: fixed;
height: 65px; height: 65px;
bottom: 0; bottom: 0;
width: 100%; min-width: 320px;
max-width: 640px;
width:100%;
} }
.footer .left { .footer .left {
......
...@@ -83,10 +83,16 @@ $(function () { ...@@ -83,10 +83,16 @@ $(function () {
return nowPrice return nowPrice
} }
$(".right").click(function () { $(".right").click(function () {
$("#phone").val('') if (getQueryString('name') && getQueryString('customerId') && getQueryString('mobileNo')) {
$("#code").val('') $('.modalBox').hide();
$("#name").val('') goTopay()
$('.modalBox').show(); } else {
$("#phone").val('')
$("#code").val('')
$("#name").val('')
$('.modalBox').show();
}
}) })
$('.closeModal').click(function () { $('.closeModal').click(function () {
$('.modalBox').hide(); $('.modalBox').hide();
...@@ -98,6 +104,7 @@ $(function () { ...@@ -98,6 +104,7 @@ $(function () {
window.localStorage.setItem('hmci', getQueryString('hmci')) window.localStorage.setItem('hmci', getQueryString('hmci'))
} }
function getQueryString(name) { function getQueryString(name) {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = decodeURIComponent(gitUrlParam).substr(1).match(reg); const r = decodeURIComponent(gitUrlParam).substr(1).match(reg);
...@@ -286,91 +293,100 @@ $(function () { ...@@ -286,91 +293,100 @@ $(function () {
function getPay() { function getPay() {
$("#pay").click(function () { $("#pay").click(function () {
if (!REG_CODE.test($("#phone").val())) { goTopay()
layer.open({ })
content: '请输入正确的手机号码!', }
skin: 'msg',
time: 3 //2秒后自动关闭 function goTopay() {
}); if (getQueryString('name') && getQueryString('customerId') && getQueryString('mobileNo')) {
return; param.customerId = getQueryString('customerId');
} else { param.name = getQueryString('name');
param.phone = $("#phone").val() param.phone = getQueryString('mobileNo');
} param.verificationCodeValider = true;
if (!param.verificationCodeValider) { } else {
layer.open({ param.name = $("#name").val();
content: '请检查您的验证码是否正确', param.phone = $("#phone").val();
skin: 'msg', }
time: 3 //2秒后自动关闭 if (!REG_CODE.test(param.phone)) {
}); layer.open({
return; content: '请输入正确的手机号码!',
} skin: 'msg',
if (!REG_NAME.test($("#name").val())) { time: 3 //2秒后自动关闭
layer.open({ });
content: '请检查您的姓名是否正确!', return;
skin: 'msg', }
time: 3 //2秒后自动关闭
}); if (!param.verificationCodeValider) {
return; layer.open({
} else { content: '请检查您的验证码是否正确',
param.name = $("#name").val() skin: 'msg',
} time: 3 //2秒后自动关闭
const startDate = new Date(); });
const endDate = new Date(new Date(startDate).setFullYear(new Date(startDate).getFullYear() + 1)); return;
endDate.setDate(endDate.getDate() - 1); }
const data = { if (!REG_NAME.test(param.name)) {
customerId: param.customerId, layer.open({
planId: '424', content: '请检查您的姓名是否正确!',
startDate: startDate.getFullYear() + '-' + dateFormat((Number(startDate.getMonth()) + 1)) + '-' + dateFormat((Number(startDate.getDate()))), skin: 'msg',
endDate: endDate.getFullYear() + '-' + dateFormat((Number(endDate.getMonth()) + 1)) + '-' + dateFormat((Number(endDate.getDate()))), time: 3 //2秒后自动关闭
price: nowPrice, });
holder: { return;
name: param.name, }
mobileNo: param.phone const startDate = new Date();
}, const endDate = new Date(new Date(startDate).setFullYear(new Date(startDate).getFullYear() + 1));
channelLaunchAD: { endDate.setDate(endDate.getDate() - 1);
hmsr: window.localStorage.getItem('hmsr'), const data = {
hmpl: window.localStorage.getItem('hmpl'), customerId: param.customerId,
hmkw: window.localStorage.getItem('hmkw'), planId: '424',
hmci: window.localStorage.getItem('hmci') startDate: startDate.getFullYear() + '-' + dateFormat((Number(startDate.getMonth()) + 1)) + '-' + dateFormat((Number(startDate.getDate()))),
}, endDate: endDate.getFullYear() + '-' + dateFormat((Number(endDate.getMonth()) + 1)) + '-' + dateFormat((Number(endDate.getDate()))),
deviceType: param.deviceType, price: nowPrice,
paymentMethod: '1', holder: {
shareCode: getQueryString('shareCode') name: param.name,
} mobileNo: param.phone
if (isWeiXin()) { },
data.paymentMethod = '1'; channelLaunchAD: {
} else { hmsr: window.localStorage.getItem('hmsr'),
data.paymentMethod = '2'; hmpl: window.localStorage.getItem('hmpl'),
} hmkw: window.localStorage.getItem('hmkw'),
$.ajax({ hmci: window.localStorage.getItem('hmci')
url: api + '/api/voucherBuy', },
type: 'POST', deviceType: param.deviceType,
contentType: "application/json", paymentMethod: '1',
data: JSON.stringify(data), shareCode: getQueryString('shareCode')
headers: { }
"X-Authorization": token if (isWeiXin()) {
}, data.paymentMethod = '1';
success: function (res) { } else {
if (res['commonResult']) { data.paymentMethod = '2';
if (res['content']) { }
const action = res['content']['action']; $.ajax({
const params = res['content']['param']; url: api + '/api/voucherBuy',
const actionType = res['content']['actionType']; type: 'POST',
const charset = res['content']['charset']; contentType: "application/json",
getOrPost(action, params, charset, actionType); data: JSON.stringify(data),
} headers: {
} else { "X-Authorization": token
layer.open({ },
content: res.message, success: function (res) {
skin: 'msg', if (res['commonResult']) {
time: 3 if (res['content']) {
}) const action = res['content']['action'];
const params = res['content']['param'];
const actionType = res['content']['actionType'];
const charset = res['content']['charset'];
getOrPost(action, params, charset, actionType);
} }
} else {
layer.open({
content: res.message,
skin: 'msg',
time: 3
})
} }
}) }
}) })
} }
function dateFormat(e) { function dateFormat(e) {
if (Number(e) < 10) { if (Number(e) < 10) {
return '0' + e; return '0' + e;
......
import {Component, OnInit} from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {CommonService} from '../common.service' import { CommonService } from '../common.service'
import {ActivatedRoute, Router} from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
@Component({ @Component({
selector: 'app-live', selector: 'app-live',
...@@ -38,15 +38,15 @@ export class LiveComponent implements OnInit { ...@@ -38,15 +38,15 @@ export class LiveComponent implements OnInit {
autoEvaluationModal: boolean; autoEvaluationModal: boolean;
constructor(private commonService: CommonService, constructor(private commonService: CommonService,
private router: Router, private router: Router,
private route: ActivatedRoute) { private route: ActivatedRoute) {
this.type = this.route.snapshot.queryParams['type']; this.type = this.route.snapshot.queryParams['type'];
this.pageAnswers = { this.pageAnswers = {
pageId: '', pageId: '',
questions: [{ questions: [{
questionId: '', questionId: '',
questionName: '', questionName: '',
options: [{optionId: '', optionName: '', optionOrder: '', selected: ''}] options: [{ optionId: '', optionName: '', optionOrder: '', selected: '' }]
}], }],
}; };
this.loginData = { this.loginData = {
...@@ -61,7 +61,7 @@ export class LiveComponent implements OnInit { ...@@ -61,7 +61,7 @@ export class LiveComponent implements OnInit {
this.tipsFlag = false; this.tipsFlag = false;
this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 16).pop(); this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 16).pop();
// 获取省份 // 获取省份
this.commonService.provinceqry({insurerId: 11}).then(res => { this.commonService.provinceqry({ insurerId: 11 }).then(res => {
if (res['success']) { if (res['success']) {
this.provinceList = res['data'].provinceList; this.provinceList = res['data'].provinceList;
} }
...@@ -144,7 +144,8 @@ export class LiveComponent implements OnInit { ...@@ -144,7 +144,8 @@ export class LiveComponent implements OnInit {
this.showAddress = true; this.showAddress = true;
this.strAddress = this.provinceName + e.cityName; this.strAddress = this.provinceName + e.cityName;
this.address = { this.address = {
customerInput: this.provinceName + ',' + e.cityName customerInput: this.provinceName + ',' + e.cityName,
optionId: e.cityId
}; };
this.pageAnswers = { this.pageAnswers = {
pageId: this.curPageData['pageId'], pageId: this.curPageData['pageId'],
...@@ -201,7 +202,7 @@ export class LiveComponent implements OnInit { ...@@ -201,7 +202,7 @@ export class LiveComponent implements OnInit {
this.commonService.before(); this.commonService.before();
} }
// 获取验证码 // 获取验证码
sendCode() { sendCode() {
if (this.sendBtnFlag) { if (this.sendBtnFlag) {
return; return;
...@@ -211,7 +212,7 @@ export class LiveComponent implements OnInit { ...@@ -211,7 +212,7 @@ export class LiveComponent implements OnInit {
this.errorModal('手机号码输入有误'); this.errorModal('手机号码输入有误');
return; return;
} else if (this.loginData.mobileNo) { } else if (this.loginData.mobileNo) {
this.commonService.verificationCode({mobileNo: this.loginData.mobileNo, type: '1'}).then(res => { this.commonService.verificationCode({ mobileNo: this.loginData.mobileNo, type: '1' }).then(res => {
if (res['success']) { if (res['success']) {
this.sendBtnFlag = true; this.sendBtnFlag = true;
this.errorModal('发送成功'); this.errorModal('发送成功');
...@@ -232,7 +233,7 @@ export class LiveComponent implements OnInit { ...@@ -232,7 +233,7 @@ export class LiveComponent implements OnInit {
} }
} }
// 注册 // 注册
loginIn() { loginIn() {
this.commonService.compare({ this.commonService.compare({
'mobileNo': this.loginData.mobileNo, 'mobileNo': this.loginData.mobileNo,
...@@ -241,7 +242,7 @@ export class LiveComponent implements OnInit { ...@@ -241,7 +242,7 @@ export class LiveComponent implements OnInit {
}).then(res => { }).then(res => {
if (res['success']) { if (res['success']) {
// 登录 // 登录
this.commonService.login({'mobileNo': this.loginData.mobileNo}).then(response => { this.commonService.login({ 'mobileNo': this.loginData.mobileNo }).then(response => {
if (response['success']) { if (response['success']) {
// 登录成功 // 登录成功
this.loginModalFlag = false; this.loginModalFlag = false;
...@@ -264,7 +265,7 @@ export class LiveComponent implements OnInit { ...@@ -264,7 +265,7 @@ export class LiveComponent implements OnInit {
}) })
} }
// 判断家庭是否存在疾病 // 判断家庭是否存在疾病
hasDisease(arr) { hasDisease(arr) {
const selfArr = arr.filter(item => item.pageId === 11).pop(); const selfArr = arr.filter(item => item.pageId === 11).pop();
const selfQuestionsArr = selfArr.questions || []; const selfQuestionsArr = selfArr.questions || [];
...@@ -277,7 +278,7 @@ export class LiveComponent implements OnInit { ...@@ -277,7 +278,7 @@ export class LiveComponent implements OnInit {
this.diseaseQuestions(childrenQuestionsArr, 15, 99); this.diseaseQuestions(childrenQuestionsArr, 15, 99);
} }
// 循环疾病选项 // 循环疾病选项
diseaseQuestions(arr, questionId, optionId) { diseaseQuestions(arr, questionId, optionId) {
if (arr && arr.length > 0) { if (arr && arr.length > 0) {
arr.forEach((item, index, arr) => { arr.forEach((item, index, arr) => {
...@@ -295,12 +296,12 @@ export class LiveComponent implements OnInit { ...@@ -295,12 +296,12 @@ export class LiveComponent implements OnInit {
} }
// 不能进行自动评测 // 不能进行自动评测
confirm() { confirm() {
this.autoEvaluationModal = false; this.autoEvaluationModal = false;
} }
// 报错信息弹窗 // 报错信息弹窗
errorModal(errorText) { errorModal(errorText) {
this.tipsFlag = true; this.tipsFlag = true;
this.tipsHtml = errorText; this.tipsHtml = errorText;
......
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