Commit b821d1c2 by Chao Sun

填写问卷部分添加城市id

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