hwq hace 3 años
padre
commit
0be5e61628
Se han modificado 3 ficheros con 260 adiciones y 145 borrados
  1. 19 11
      api/index.js
  2. 107 93
      pages/cart/group.vue
  3. 134 41
      pages/cart/personal.vue

+ 19 - 11
api/index.js

@@ -75,9 +75,9 @@ export function add_volunteers(data) {
 }
 
 // joinSec
-export function joinSec(data) {
+export function vip(data) {
 	return request({
-		url: '/api/add_volunteers',
+		url: '/api/User/setuser',
 		method: 'post',
 		data
 	});
@@ -195,15 +195,6 @@ export function getListMechanism(data) {
 	});
 }
 
-
-export function add_company(data) {
-	return request({
-		url: '/api/add_company',
-		method: 'post',
-		data
-	});
-}
-
 // 爱心帮扶
 export function one_help(data) {
 	return request({
@@ -219,4 +210,21 @@ export function getCompany(data) {
 		method: 'get',
 		data
 	});
+}
+
+export function getVipmoney(data) {
+	return request({
+		url: '/api/Level/ify',
+		method: 'get',
+		data
+	});
+}
+
+//创建入会订单
+export function createOrder(data) {
+	return request({
+		url: '/api/Level/create',
+		method: 'post',
+		data
+	});
 }

+ 107 - 93
pages/cart/group.vue

@@ -1,8 +1,6 @@
 <template>
 	<view class="content">
-		<view class="top-box">
-			团队报名
-		</view>
+		<view class="top-box">团队报名</view>
 		<view class="box">
 			<view class="box-1">
 				<view class="box-left">
@@ -28,14 +26,14 @@
 				</view>
 				<input type="text" value="" class="list-input" v-model="unit_peo" placeholder="请输入法人代表" placeholder-class="placeholder" />
 			</view>
-			<view class="box-1">
+			<!-- <view class="box-1">
 				<view class="box-left">
 					单位人数
 					<text class="imp"></text>
 				</view>
 				<input type="number" value="" class="list-input" v-model="unit_num" placeholder="请输入单位人数" placeholder-class="placeholder" />
-			</view>
+			</view> -->
 			<view class="box-1">
 				<view class="box-left">
 					联系人
@@ -91,15 +89,9 @@
 </template>
 
 <script>
-	import {
-		mapState,
-		mapMutations
-	} from 'vuex';
-	import {
-		saveUrl,
-		interceptor
-	} from '@/utils/loginUtils.js';
-import { joinSec,add_company } from '@/api/index.js';
+import { mapState, mapMutations } from 'vuex';
+import { saveUrl, interceptor } from '@/utils/loginUtils.js';
+import { vip, getVipmoney, createOrder } from '@/api/index.js';
 import { upload } from '@/api/ask.js';
 export default {
 	data() {
@@ -108,38 +100,34 @@ export default {
 		});
 		return {
 			loding: false, //是否提交中
-			// array: ['男', '女'],
-			// chooseEdu: ['博士后', '博士', '硕士', '本科', '专科', '其他'],
-			// chooseVol: ['是', '否'],
-			// chooseExp: ['是', '否'],
-			// index: 0,
-			// mz: '',
-			// cardimg: '', //证件照
-			// card: '',
-			// checklist: [],
-			// name: '',
-			// sex: '',
-			// birth: '',
-			// phone: '',
-			// address: '',
-			// work: '',
-			// specialty: '',
-			// education: '',
-			unit_name: '',//单位名称
-			unit_peo: '',//法人代表
-			unit_type: '',//单位性质
-			unit_num: '',//单位人数
-			unit_concat: '',//单位联系人
-			usually_area: '',//常驻地区
-			postal_code: '',//邮政编码
-			concat_phone: '',//联系电话
-			email: '',//电子邮箱
-			concat_address: ''//联系地址
+			unit_name: '', //单位名称
+			unit_peo: '', //法人代表
+			unit_type: '', //单位性质
+			unit_num: '', //单位人数
+			unit_concat: '', //单位联系人
+			usually_area: '', //常驻地区
+			postal_code: '', //邮政编码
+			concat_phone: '', //联系电话
+			email: '', //电子邮箱
+			id: '',
+			money: '',
+			concat_address: '' //联系地址
 		};
 	},
 	onShow() {
 		if (this.hasLogin) {
 			// this.loadBaseData();
+			const obj = this
+			getVipmoney().then(({ data }) => {
+				console.log(data);
+				data.forEach(e => {
+					if (e.name == '企业会员') {
+						obj.money = e.pay_price;
+						obj.id = e.id;
+						console.log(obj.money,obj.id)
+					}
+				});
+			});
 		} else {
 			saveUrl();
 			uni.showModal({
@@ -168,93 +156,120 @@ export default {
 	methods: {
 		async join() {
 			let obj = this;
-			if(obj.unit_name == '') {
+			if (obj.unit_name == '') {
 				obj.$api.msg('请填写单位名称');
 				return;
 			}
-			if(obj.unit_type == '') {
+			if (obj.unit_type == '') {
 				obj.$api.msg('请填写单位性质');
 				return;
 			}
-			if(obj.unit_peo == '') {
+			if (obj.unit_peo == '') {
 				obj.$api.msg('请填写法人代表');
 				return;
 			}
-			if(obj.unit_num == '') {
-				obj.$api.msg('请填写单位人数');
-				return;
-			}
-			if(obj.unit_concat == '') {
+			// if (obj.unit_num == '') {
+			// 	obj.$api.msg('请填写单位人数');
+			// 	return;
+			// }
+			if (obj.unit_concat == '') {
 				obj.$api.msg('请填写联系人');
 				return;
 			}
-			if(obj.usually_area == '') {
+			if (obj.usually_area == '') {
 				obj.$api.msg('请填写常驻地址');
 				return;
 			}
-			if(obj.postal_code == '') {
+			if (obj.postal_code == '') {
 				obj.$api.msg('请填写邮政编码');
 				return;
 			}
-			if(obj.concat_phone == '') {
+			if (obj.concat_phone == '') {
 				obj.$api.msg('请填写联系电话');
 				return;
 			}
-			if(!/^((\+?86)|(\(\+86\)))?1\d{10}$/.test(obj.concat_phone)) {
+			if (!/^((\+?86)|(\(\+86\)))?1\d{10}$/.test(obj.concat_phone)) {
 				obj.$api.msg('请填写正确的联系电话');
 				return;
 			}
-			if(obj.email == '') {
+			if (obj.email == '') {
 				obj.$api.msg('请填写电子邮箱');
 				return;
 			}
-			
+
 			if (!/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(obj.email)) {
 				obj.$api.msg('请填写正确的邮箱');
 				return;
 			}
-			if(obj.concat_address == '') {
+			if (obj.concat_address == '') {
 				obj.$api.msg('请填写联系地址');
 				return;
 			}
-			obj.loding = true;
-			add_company({
-				
-				company: obj.unit_name,//单位名称
-				company_nature: obj.unit_type,//性质
-				company_person: obj.unit_peo,//负责人
-				company_member: obj.unit_num*1,//公司人数
-				address: obj.concat_address,//联系地址
-				zip: obj.postal_code,//邮编
-				company_tel: obj.concat_phone,//联系电话
-				email: obj.email,//邮箱
-				permanent_address: obj.usually_area,//常驻地址
-				person: obj.unit_concat,//联系人
+			// obj.loding = true;
+			vip({
+				company: obj.unit_name, //单位名称
+				nature: obj.unit_type, //性质
+				legal_person: obj.unit_peo, //法人
+				// company_member: obj.unit_num * 1, //公司人数
+				company_address: obj.concat_address, //联系地址
+				zip_code: obj.postal_code, //邮编
+				mobile: obj.concat_phone, //联系电话
+				company_email: obj.email, //邮箱
+				address: obj.usually_area, //常驻地址
+				full_name: obj.unit_concat ,//联系人
+				user_type: 2
 			})
 				.then(e => {
-					// obj.name = '';
-					// obj.sex = '';
-					// obj.education = '';
-					// obj.birth = '';
-					// (obj.mz = ''), (obj.phone = '');
-					// obj.address = '';
-					// obj.work = '';
-					// obj.specialty = '';
-					// (obj.cardimg = ''), (obj.card = '');
-					if(e.status == 400) {
+					if (e.status == 400) {
 						obj.$api.msg(e.msg);
 						return;
 					}
-					obj.unit_name = ''
-					obj.unit_type= ''
-					obj.unit_num= ''
-					obj.concat_address= ''
-					obj.postal_code= ''
-					obj.concat_phone= ''
-					obj.email= ''
-					obj.usually_area= ''
-					uni.navigateTo({
-						url: '../joinSuc/joinNow'
+					uni.showModal({
+						title: '提示',
+						content: '成为企业会员需要缴纳' + obj.money + '员年费,是否前往提交',
+						success: function(res) {
+							if (res.confirm) {
+								console.log('用户点击确定');
+								createOrder({
+									level_id: obj.id,
+									body: '企业红会年费',
+									pay_type: 0,
+									// name: obj.name,
+									pay_price: obj.money,
+									from: 'weixin'
+								}).then(({ data }) => {
+									let res = data.jsConfig;
+									console.log(res);
+									obj.weichatObj.chooseWXPay({
+										timestamp: res.timestamp,
+										nonceStr: res.nonceStr,
+										package: res.package,
+										signType: res.signType,
+										paySign: res.paySign,
+										success: function(res) {
+											obj.unit_name = '';
+											obj.unit_type = '';
+											obj.unit_num = '';
+											obj.concat_address = '';
+											obj.postal_code = '';
+											obj.concat_phone = '';
+											obj.email = '';
+											obj.usually_area = '';
+											uni.navigateTo({
+												url: '../joinSuc/joinNow'
+											});
+										},
+										fail: function(res) {
+											this.$refs.popup1.open();
+											console.log(res, '失败');
+											console.log(res.errMsg);
+										}
+									});
+								});
+							} else if (res.cancel) {
+								console.log('用户点击取消');
+							}
+						}
 					});
 				})
 				.catch(function(e) {
@@ -364,11 +379,11 @@ page {
 		width: 600rpx;
 		height: 100rpx;
 		border-radius: 50rpx;
-		background: #FA7E67;
+		background: #fa7e67;
 		font-size: 34rpx;
 		font-family: PingFang SC;
 		font-weight: 500;
-		color: #FFFFFF;
+		color: #ffffff;
 		line-height: 100rpx;
 		text-align: center;
 		&.action {
@@ -488,7 +503,7 @@ page {
 	line-height: 58rpx;
 	font-family: PingFang SC;
 	font-weight: bold;
-	color: #FA7E67;
+	color: #fa7e67;
 	text-align: center;
 	position: relative;
 	&::before {
@@ -504,5 +519,4 @@ page {
 		margin: 0 auto;
 	}
 }
-
 </style>

+ 134 - 41
pages/cart/personal.vue

@@ -1,8 +1,6 @@
 <template>
 	<view class="content">
-		<view class="top-box">
-			个人报名
-		</view>
+		<view class="top-box">个人报名</view>
 		<view class="box">
 			<view class="box-1">
 				<view class="box-left">
@@ -14,7 +12,7 @@
 			</view>
 			<view class="box-1">
 				<view class="box-left">出生年月:</view>
-				<picker mode="date" :value="birth" fields="month" :start="startDate" :end="endDate" @change="bindDateChange" class="box-right">
+				<picker mode="date" :value="birth" :start="startDate" :end="endDate" @change="bindDateChange" class="box-right">
 					<view class="placeholder" v-if="birth === ''">请输入您的生日</view>
 					<view v-else>{{ birth }}</view>
 				</picker>
@@ -23,7 +21,7 @@
 				<view class="box-left">性别:</view>
 				<picker @change="bindPickerSex" :value="sex" :range="array" class="box-right">
 					<view class="placeholder" v-if="sex === ''">请输入您的性别</view>
-					<text>{{ sex }}</text>
+					<text>{{ sex == '0' ? '男' : sex == '1' ? '女' : sex }}</text>
 				</picker>
 			</view>
 			<view class="box-1">
@@ -66,12 +64,39 @@
 			</view>
 		</view>
 		<view class="buttom" :class="{ action: loding }" @click="!loding ? join() : ''">提交申请</view>
+		<uni-popup ref="popup1" type="center">
+			<view class="popup-box">
+				<!-- <view class="img">
+					<image src="../../static/img/WechatIMG662.png" mode=""></image>
+				</view> -->
+				<view class="mian">
+					<view class="delivery">
+						支付失败
+						<!-- {{ i18n.qrhwsdm }} -->
+					</view>
+					<view class="nocancel">
+						请退出页面,重新登录
+						<!-- {{ i18n.wfcx }} -->
+					</view>
+					<view class="comfirm-box">
+						<view class="cancel" @click="cancel1">
+							取消
+						</view>
+						<view class="comfirm" @click="comfirmExit()">
+							确认
+						</view>
+					</view>
+				</view>
+			</view>
+		
+		</uni-popup>
 	</view>
 </template>
 
 <script>
-import { joinSec } from '@/api/index.js';
+import { vip, getVipmoney,createOrder } from '@/api/index.js';
 import { upload } from '@/api/ask.js';
+import { mapState, mapMutations } from 'vuex';
 export default {
 	data() {
 		const currentDate = this.getDate({
@@ -80,7 +105,7 @@ export default {
 		return {
 			loding: false, //是否提交中
 			array: ['男', '女'],
-			chooseEdu: ['博士后', '博士', '硕士', '本科', '专科', '其他'],
+			chooseEdu: ['小学以下', '小学', '初中', '高中/中专', '大专/本科', '硕士', '博士', '博士后'],
 			chooseVol: ['是', '否'],
 			chooseExp: ['是', '否'],
 			index: 0,
@@ -95,10 +120,15 @@ export default {
 			address: '',
 			work: '',
 			specialty: '',
-			education: ''
+			education: '',
+			educationid: '',
+			money: '',
+			id:''
 		};
 	},
 	computed: {
+		...mapState('user', ['hasLogin', 'userInfo']),
+		...mapState(['weichatObj']),
 		startDate() {
 			return this.getDate('start');
 		},
@@ -106,6 +136,19 @@ export default {
 			return this.getDate('end');
 		}
 	},
+	onLoad() {
+		console.log(this.userInfo)
+		const obj = this;
+		getVipmoney().then(({ data }) => {
+			console.log(data);
+			data.forEach(e => {
+				if (e.name == '个人会员') {
+					obj.money = e.pay_price;
+					obj.id = e.id;
+				}
+			});
+		});
+	},
 	methods: {
 		async join() {
 			let obj = this;
@@ -117,7 +160,7 @@ export default {
 				obj.$api.msg('请选择出生年月');
 				return;
 			}
-			if (obj.sex == '') {
+			if (obj.sex === '') {
 				obj.$api.msg('请输入您的性别');
 				return;
 			}
@@ -175,32 +218,72 @@ export default {
 			// 	obj.$api.msg('请填写您的有无服务经验');
 			// 	return;
 			// }
-			obj.loding = true;
-			joinSec({
-				name: obj.name,
-				sex: obj.sex,
-				education: obj.education,
-				birth: obj.birth,
-				mz: obj.mz,
-				phone: obj.phone,
-				address: obj.address,
-				work: obj.work,
-				specialty: obj.specialty,
-				img: obj.cardimg,
-				card: obj.card
+			// obj.loding = true;
+			vip({
+				full_name: obj.name, //姓名
+				sex: obj.sex, //性别
+				education: obj.educationid, //学历
+				birth: obj.birth, //生日
+				nation: obj.mz, //民族
+				mobile: obj.phone,
+				address: obj.address, //居住地址
+				company_name: obj.work, //工作单位
+				position: obj.specialty, //职位
+				certificateimage: obj.cardimg,
+				id_card: obj.card,
+				user_type: 1
 			})
 				.then(e => {
-					obj.name = '';
-					obj.sex = '';
-					obj.education = '';
-					obj.birth = '';
-					(obj.mz = ''), (obj.phone = '');
-					obj.address = '';
-					obj.work = '';
-					obj.specialty = '';
-					(obj.cardimg = ''), (obj.card = '');
-					uni.navigateTo({
-						url: '../joinSuc/joinNow'
+					// uni.navigateTo({
+					// 	url: '../joinSuc/joinNow'
+					// });
+					uni.showModal({
+						title: '提示',
+						content: '成为个人会员需要缴纳' + obj.money + '员年费,是否前往提交',
+						success: function(res) {
+							if (res.confirm) {
+								console.log('用户点击确定');
+								createOrder({
+									level_id: obj.id,
+									body: '个人红会年费',
+									pay_type: 0,
+									// name: obj.name,
+									pay_price: obj.money,
+									from: 'weixin'
+								}).then(({data}) =>{
+									obj.name = '';
+									obj.sex = '';
+									obj.educationid = '';
+									obj.birth = '';
+									(obj.mz = ''), (obj.phone = '');
+									obj.address = '';
+									obj.work = '';
+									obj.specialty = '';
+									(obj.cardimg = ''), (obj.card = '');
+									let res = data.jsConfig;
+									console.log(res)
+									obj.weichatObj.chooseWXPay({
+										timestamp: res.timestamp,
+										nonceStr: res.nonceStr,
+										package: res.package,
+										signType: res.signType,
+										paySign: res.paySign,
+										success: function(res) {
+											uni.navigateTo({
+												url: '../joinSuc/joinNow'
+											});
+										},
+										fail: function(res) {
+											this.$refs.popup1.open()
+											console.log(res, "失败")
+											console.log(res.errMsg)
+										}
+									});
+								})
+							} else if (res.cancel) {
+								console.log('用户点击取消');
+							}
+						}
 					});
 				})
 				.catch(function(e) {
@@ -208,24 +291,35 @@ export default {
 					console.log(e);
 				});
 		},
+		cancel1() {
+			this.$refs.popup1.close();
+		},
+		comfirmExit() {
+			console.log('点击comfirmExit')
+			this.$refs.popup1.close()
+			uni.switchTab({
+				url: '/pages/index/index'
+			});
+		
+		},
 		imgsub() {
 			console.log('imgsub');
 			upload({
 				filename: ''
 			}).then(data => {
-				this.cardimg = data[0].url;
+				this.cardimg = data[0].fullurl;
 			});
 		},
 		// 选择性别
 		bindPickerSex: function(e) {
-			console.log(this.array[e.target.value]);
-			this.sex = this.array[e.target.value];
+			this.sex = e.target.value;
 			this.index = e.target.value + 1;
 		},
 		// 选择教育程度
 		bindPickerEdu: function(e) {
 			this.education = this.chooseEdu[e.target.value];
-			this.index = e.target.value + 1;
+			this.educationid = e.target.value;
+			console.log(this.educationid);
 		},
 		// 选择日期
 		bindDateChange: function(e) {
@@ -303,11 +397,11 @@ page {
 		margin: 60rpx auto 0;
 		width: 750rpx;
 		height: 100rpx;
-		background: #FA7E67;
+		background: #fa7e67;
 		font-size: 34rpx;
 		font-family: PingFang SC;
 		font-weight: 500;
-		color: #FFFFFF;
+		color: #ffffff;
 		line-height: 100rpx;
 		text-align: center;
 		&.action {
@@ -427,7 +521,7 @@ page {
 	line-height: 58rpx;
 	font-family: PingFang SC;
 	font-weight: bold;
-	color: #FA7E67;
+	color: #fa7e67;
 	text-align: center;
 	position: relative;
 	&::before {
@@ -443,5 +537,4 @@ page {
 		margin: 0 auto;
 	}
 }
-
 </style>