personal.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <template>
  2. <view class="content">
  3. <view class="top-box">个人报名</view>
  4. <view class="box">
  5. <view class="box-1">
  6. <view class="box-left">
  7. 姓名
  8. <text class="imp"></text>
  9. </view>
  10. <input type="text" value="" class="list-input" v-model="name" placeholder="请输入您的姓名" placeholder-class="placeholder" />
  11. </view>
  12. <view class="box-1">
  13. <view class="box-left">出生年月:</view>
  14. <picker mode="date" :value="birth" :start="startDate" :end="endDate" @change="bindDateChange" class="box-right">
  15. <view class="placeholder" v-if="birth === ''">请输入您的生日</view>
  16. <view v-else>{{ birth }}</view>
  17. </picker>
  18. </view>
  19. <view class="box-1">
  20. <view class="box-left">性别:</view>
  21. <picker @change="bindPickerSex" :value="sex" :range="array" class="box-right">
  22. <view class="placeholder" v-if="sex === ''">请输入您的性别</view>
  23. <text>{{ sex == '0' ? '男' : sex == '1' ? '女' : sex }}</text>
  24. </picker>
  25. </view>
  26. <view class="box-1">
  27. <view class="box-left">文化程度:</view>
  28. <picker @change="bindPickerEdu" :value="education" :range="chooseEdu" class="box-right">
  29. <view class="placeholder" v-if="education === ''">请输入您的文化程度</view>
  30. <text>{{ education }}</text>
  31. </picker>
  32. </view>
  33. <view class="box-1">
  34. <view class="box-left">民族:</view>
  35. <input type="text" value="" class="list-input" v-model="mz" placeholder="请输入您的民族" placeholder-class="placeholder" />
  36. </view>
  37. <view class="box-1">
  38. <view class="box-left">地址:</view>
  39. <input type="text" value="" class="list-input" v-model="address" placeholder="请输入您的地址" placeholder-class="placeholder" />
  40. </view>
  41. <view class="box-1">
  42. <view class="box-left">身份证号码:</view>
  43. <input type="text" value="" class="list-input" v-model="card" placeholder="请输入您的身份证号码" placeholder-class="placeholder" />
  44. </view>
  45. <view class="box-1">
  46. <view class="box-left">联系方式:</view>
  47. <input type="text" value="" class="list-input" v-model="phone" placeholder="请输入您的联系方式" placeholder-class="placeholder" />
  48. </view>
  49. <view class="box-1">
  50. <view class="box-left">工作单位:</view>
  51. <input type="text" value="" class="list-input" v-model="work" placeholder="请输入您的工作单位" placeholder-class="placeholder" />
  52. </view>
  53. <view class="box-1">
  54. <view class="box-left">职位:</view>
  55. <input type="text" value="" class="list-input" v-model="specialty" placeholder="请输入您的职位" placeholder-class="placeholder" />
  56. </view>
  57. <view class="upload-box">
  58. <view class="upload-left">证件:</view>
  59. <view class="upload-right">
  60. <image :src="cardimg" mode="" class="upload-img" @click.stop="imgsub" v-if="cardimg"></image>
  61. <image src="../../static/images/upload.png" class="upload-img" mode="" v-if="!cardimg" @click.stop="imgsub"></image>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="buttom" :class="{ action: loding }" @click="!loding ? join() : ''">提交申请</view>
  66. <uni-popup ref="popup1" type="center">
  67. <view class="popup-box">
  68. <!-- <view class="img">
  69. <image src="../../static/img/WechatIMG662.png" mode=""></image>
  70. </view> -->
  71. <view class="mian">
  72. <view class="delivery">
  73. 支付失败
  74. <!-- {{ i18n.qrhwsdm }} -->
  75. </view>
  76. <view class="nocancel">
  77. 请退出页面,重新登录
  78. <!-- {{ i18n.wfcx }} -->
  79. </view>
  80. <view class="comfirm-box">
  81. <view class="cancel" @click="cancel1">
  82. 取消
  83. </view>
  84. <view class="comfirm" @click="comfirmExit()">
  85. 确认
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </uni-popup>
  91. </view>
  92. </template>
  93. <script>
  94. import { vip, getVipmoney,createOrder } from '@/api/index.js';
  95. import { upload } from '@/api/ask.js';
  96. import { mapState, mapMutations } from 'vuex';
  97. export default {
  98. data() {
  99. const currentDate = this.getDate({
  100. format: true
  101. });
  102. return {
  103. loding: false, //是否提交中
  104. array: ['男', '女'],
  105. chooseEdu: ['小学以下', '小学', '初中', '高中/中专', '大专/高职','本科','研究生', '硕士', '博士', '博士后'],
  106. chooseVol: ['是', '否'],
  107. chooseExp: ['是', '否'],
  108. index: 0,
  109. mz: '',
  110. cardimg: '', //证件照
  111. card: '',
  112. checklist: [],
  113. name: '',
  114. sex: '',
  115. birth: '',
  116. phone: '',
  117. address: '',
  118. work: '',
  119. specialty: '',
  120. education: '',
  121. educationid: '',
  122. money: '',
  123. id:''
  124. };
  125. },
  126. computed: {
  127. ...mapState('user', ['hasLogin', 'userInfo']),
  128. ...mapState(['weichatObj']),
  129. startDate() {
  130. return this.getDate('start');
  131. },
  132. endDate() {
  133. return this.getDate('end');
  134. }
  135. },
  136. onLoad() {
  137. console.log(this.userInfo)
  138. const obj = this;
  139. getVipmoney().then(({ data }) => {
  140. console.log(data);
  141. data.forEach(e => {
  142. if (e.user_type == 1) {
  143. obj.money = e.pay_price;
  144. obj.id = e.id;
  145. }
  146. });
  147. });
  148. },
  149. methods: {
  150. async join() {
  151. let obj = this;
  152. if (obj.name == '') {
  153. obj.$api.msg('请输入您的姓名');
  154. return;
  155. }
  156. if (obj.birth == '') {
  157. obj.$api.msg('请选择出生年月');
  158. return;
  159. }
  160. if (obj.sex === '') {
  161. obj.$api.msg('请输入您的性别');
  162. return;
  163. }
  164. if (obj.education == '') {
  165. obj.$api.msg('请选择您的文化程度');
  166. return;
  167. }
  168. if (obj.mz == '') {
  169. obj.$api.msg('请填写您所属的民族');
  170. return;
  171. }
  172. if (obj.specialty == '') {
  173. obj.$api.msg('请填写您的职位');
  174. return;
  175. }
  176. if (obj.address == '') {
  177. obj.$api.msg('请填写您的地址');
  178. return;
  179. }
  180. let reg1 = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
  181. if (!reg1.test(obj.card)) {
  182. obj.$api.msg('请填写正确的身份证信息');
  183. return;
  184. }
  185. const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
  186. if (!reg.test(obj.phone)) {
  187. obj.$api.msg('请填写正确的手机号码');
  188. return;
  189. }
  190. // /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/
  191. if (obj.work == '') {
  192. obj.$api.msg('请填写您的工作单位');
  193. return;
  194. }
  195. if (obj.cardimg == '') {
  196. obj.$api.msg('请上传您的证件');
  197. return;
  198. }
  199. if (obj.specialty == '') {
  200. obj.$api.msg('请填写您的职位');
  201. return;
  202. }
  203. // if (obj.education == '') {
  204. // obj.$api.msg('请填写您的教育程度');
  205. // return;
  206. // }
  207. // if (obj.is_vol == '') {
  208. // obj.$api.msg('请填写您的是否受过志愿服务');
  209. // return;
  210. // }
  211. // if (obj.is_experience == '') {
  212. // obj.$api.msg('请填写您的有无服务经验');
  213. // return;
  214. // }
  215. // obj.loding = true;
  216. vip({
  217. full_name: obj.name, //姓名
  218. gender: obj.sex, //性别
  219. education: obj.educationid, //学历
  220. birthday: obj.birth, //生日
  221. nation: obj.mz, //民族
  222. mobile: obj.phone,
  223. address: obj.address, //居住地址
  224. company_name: obj.work, //工作单位
  225. position: obj.specialty, //职位
  226. certificateimage: obj.cardimg,
  227. id_card: obj.card,
  228. user_type: 1
  229. })
  230. .then(e => {
  231. // uni.navigateTo({
  232. // url: '../joinSuc/joinNow'
  233. // });
  234. if(obj.money) {
  235. uni.showModal({
  236. title: '提示',
  237. content: '成为个人会员需要缴纳' + obj.money + '元年费,是否前往提交',
  238. success: function(res) {
  239. if (res.confirm) {
  240. console.log('用户点击确定');
  241. createOrder({
  242. level_id: obj.id,
  243. body: '个人红会年费',
  244. pay_type: 0,
  245. // name: obj.name,
  246. pay_price: obj.money,
  247. from: 'weixin'
  248. }).then(({data}) =>{
  249. obj.name = '';
  250. obj.sex = '';
  251. obj.educationid = '';
  252. obj.birth = '';
  253. (obj.mz = ''), (obj.phone = '');
  254. obj.address = '';
  255. obj.work = '';
  256. obj.specialty = '';
  257. (obj.cardimg = ''), (obj.card = '');
  258. let res = data.jsConfig;
  259. console.log(res)
  260. obj.weichatObj.chooseWXPay({
  261. timestamp: res.timestamp,
  262. nonceStr: res.nonceStr,
  263. package: res.package,
  264. signType: res.signType,
  265. paySign: res.paySign,
  266. success: function(res) {
  267. uni.navigateTo({
  268. url: '../joinSuc/joinNow'
  269. });
  270. },
  271. fail: function(res) {
  272. this.$refs.popup1.open()
  273. console.log(res, "失败")
  274. console.log(res.errMsg)
  275. }
  276. });
  277. })
  278. } else if (res.cancel) {
  279. console.log('用户点击取消');
  280. }
  281. }
  282. });
  283. }else {
  284. uni.navigateTo({
  285. url: '../joinSuc/joinNow'
  286. });
  287. }
  288. })
  289. .catch(function(e) {
  290. console.log('出错了');
  291. console.log(e);
  292. });
  293. },
  294. cancel1() {
  295. this.$refs.popup1.close();
  296. },
  297. comfirmExit() {
  298. console.log('点击comfirmExit')
  299. this.$refs.popup1.close()
  300. uni.switchTab({
  301. url: '/pages/index/index'
  302. });
  303. },
  304. imgsub() {
  305. console.log('imgsub');
  306. upload({
  307. filename: ''
  308. }).then(data => {
  309. this.cardimg = data[0].fullurl;
  310. });
  311. },
  312. // 选择性别
  313. bindPickerSex: function(e) {
  314. this.sex = e.target.value;
  315. this.index = e.target.value + 1;
  316. },
  317. // 选择教育程度
  318. bindPickerEdu: function(e) {
  319. this.education = this.chooseEdu[e.target.value];
  320. this.educationid = e.target.value;
  321. console.log(this.educationid);
  322. },
  323. // 选择日期
  324. bindDateChange: function(e) {
  325. this.birth = e.target.value;
  326. },
  327. // 是否参加志愿活动
  328. bindPickerVol: function(e) {
  329. this.is_vol = this.chooseVol[e.target.value];
  330. this.index = e.target.value + 1;
  331. },
  332. // 有无服务经验
  333. bindPickerExp: function(e) {
  334. this.is_experience = this.chooseExp[e.target.value];
  335. this.index = e.target.value + 1;
  336. },
  337. getDate(type) {
  338. const date = new Date();
  339. let year = date.getFullYear();
  340. let month = date.getMonth() + 1;
  341. let day = date.getDate();
  342. if (type === 'start') {
  343. year = year - 60;
  344. } else if (type === 'end') {
  345. year = year + 2;
  346. }
  347. month = month > 9 ? month : '0' + month;
  348. day = day > 9 ? day : '0' + day;
  349. return `${year}-${month}-${day}`;
  350. },
  351. // 选择可提供时间
  352. // this.quantum = item.detail.value.join(',');
  353. checktime1(e) {
  354. // var items = this.timeList,
  355. // let quantum = [];
  356. this.quantum = e.detail.value.join(',');
  357. console.log(this.quantum);
  358. },
  359. checktime2(e) {
  360. // var items = this.timeList,
  361. let values = e.detail.value;
  362. // let quantum = [];
  363. console.log(values);
  364. },
  365. checktime3(e) {
  366. // var items = this.timeList,
  367. let values = e.detail.value;
  368. // let quantum = [];
  369. console.log(values);
  370. },
  371. //选择有兴趣参与的工作
  372. checkjob(item) {
  373. this.taste = item.detail.value.join(',');
  374. },
  375. // 选择专长checkspeciality
  376. checkspeciality(item) {
  377. this.speciali = item.detail.value.join(',');
  378. }
  379. }
  380. };
  381. </script>
  382. <style lang="scss">
  383. page {
  384. background-color: #fdcbc2;
  385. }
  386. .content {
  387. padding-top: 44rpx;
  388. background-color: #fdcbc2;
  389. .buttom {
  390. margin: 60rpx auto 0;
  391. width: 750rpx;
  392. height: 100rpx;
  393. background: #fa7e67;
  394. font-size: 34rpx;
  395. font-family: PingFang SC;
  396. font-weight: 500;
  397. color: #ffffff;
  398. line-height: 100rpx;
  399. text-align: center;
  400. &.action {
  401. background: #999999;
  402. }
  403. }
  404. .box {
  405. // margin-top: 44rpx;
  406. width: 690rpx;
  407. margin: 20rpx auto 0;
  408. background-color: #ffffff;
  409. border-radius: 20rpx;
  410. // padding: 28rpx 20rpx 32rpx 20rpx;
  411. position: relative;
  412. .red-box {
  413. width: 405rpx;
  414. line-height: 66rpx;
  415. text-align: center;
  416. background: linear-gradient(0deg, #c90f1b, #f14d33);
  417. // background-color: #c62316;
  418. border-radius: 10rpx;
  419. font-size: 30rpx;
  420. font-weight: 500;
  421. color: #ffffff;
  422. // position: relative;
  423. position: absolute;
  424. top: -36rpx;
  425. left: 50%;
  426. transform: translateX(-50%);
  427. z-index: 1;
  428. }
  429. .box-check {
  430. font-size: 28rpx;
  431. font-weight: 500;
  432. color: #666666;
  433. line-height: 100rpx;
  434. }
  435. .imp {
  436. color: red;
  437. margin-left: 5rpx;
  438. }
  439. .box-1 {
  440. height: 98rpx;
  441. padding: 0 20rpx;
  442. display: flex;
  443. justify-content: space-between;
  444. border-bottom: 1px solid #f0f0f0;
  445. line-height: 98rpx;
  446. align-items: center;
  447. font-size: 28rpx;
  448. font-family: PingFang SC;
  449. font-weight: 500;
  450. color: #333333;
  451. // .box-left {
  452. // width: 120rpx;
  453. // }
  454. // .list-input {
  455. // width: 440rpx;
  456. // }
  457. // .box-right {
  458. // width: 440rpx
  459. // }
  460. .list-input {
  461. width: 440rpx;
  462. // height: 26rpx;
  463. font-size: 28rpx;
  464. font-family: PingFang SC;
  465. font-weight: 500;
  466. color: #000;
  467. }
  468. .placeholder {
  469. color: #999999;
  470. }
  471. .box-right {
  472. width: 440rpx;
  473. }
  474. }
  475. }
  476. }
  477. .upload-box {
  478. // height: 247rpx;
  479. background: #ffffff;
  480. border-radius: 27rpx;
  481. display: flex;
  482. flex-direction: column;
  483. padding: 30rpx 40rpx 30rpx 0;
  484. margin: 15rpx auto 30rpx;
  485. width: 690rpx;
  486. background: #ffffff;
  487. border-radius: 10rpx;
  488. .upload-left {
  489. padding-left: 20rpx;
  490. font-weight: 400;
  491. color: #000;
  492. }
  493. .upload-right {
  494. flex: 1;
  495. display: flex;
  496. align-items: center;
  497. justify-content: center;
  498. .upload-img {
  499. width: 160rpx;
  500. height: 160rpx;
  501. margin-top: 24rpx;
  502. }
  503. }
  504. }
  505. .top-box {
  506. height: 58rpx;
  507. font-size: 38rpx;
  508. line-height: 58rpx;
  509. font-family: PingFang SC;
  510. font-weight: bold;
  511. color: #fa7e67;
  512. text-align: center;
  513. position: relative;
  514. &::before {
  515. content: '';
  516. width: 215rpx;
  517. height: 17rpx;
  518. background: #fff;
  519. opacity: 0.26;
  520. position: absolute;
  521. left: 0;
  522. right: 0;
  523. bottom: 0;
  524. margin: 0 auto;
  525. }
  526. }
  527. </style>