personal.vue 14 KB

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