personal.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  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. uni.showModal({
  235. title: '提示',
  236. content: '成为个人会员需要缴纳' + obj.money + '元年费,是否前往提交',
  237. success: function(res) {
  238. if (res.confirm) {
  239. console.log('用户点击确定');
  240. createOrder({
  241. level_id: obj.id,
  242. body: '个人红会年费',
  243. pay_type: 0,
  244. // name: obj.name,
  245. pay_price: obj.money,
  246. from: 'weixin'
  247. }).then(({data}) =>{
  248. obj.name = '';
  249. obj.sex = '';
  250. obj.educationid = '';
  251. obj.birth = '';
  252. (obj.mz = ''), (obj.phone = '');
  253. obj.address = '';
  254. obj.work = '';
  255. obj.specialty = '';
  256. (obj.cardimg = ''), (obj.card = '');
  257. let res = data.jsConfig;
  258. console.log(res)
  259. obj.weichatObj.chooseWXPay({
  260. timestamp: res.timestamp,
  261. nonceStr: res.nonceStr,
  262. package: res.package,
  263. signType: res.signType,
  264. paySign: res.paySign,
  265. success: function(res) {
  266. uni.navigateTo({
  267. url: '../joinSuc/joinNow'
  268. });
  269. },
  270. fail: function(res) {
  271. this.$refs.popup1.open()
  272. console.log(res, "失败")
  273. console.log(res.errMsg)
  274. }
  275. });
  276. })
  277. } else if (res.cancel) {
  278. console.log('用户点击取消');
  279. }
  280. }
  281. });
  282. })
  283. .catch(function(e) {
  284. console.log('出错了');
  285. console.log(e);
  286. });
  287. },
  288. cancel1() {
  289. this.$refs.popup1.close();
  290. },
  291. comfirmExit() {
  292. console.log('点击comfirmExit')
  293. this.$refs.popup1.close()
  294. uni.switchTab({
  295. url: '/pages/index/index'
  296. });
  297. },
  298. imgsub() {
  299. console.log('imgsub');
  300. upload({
  301. filename: ''
  302. }).then(data => {
  303. this.cardimg = data[0].fullurl;
  304. });
  305. },
  306. // 选择性别
  307. bindPickerSex: function(e) {
  308. this.sex = e.target.value;
  309. this.index = e.target.value + 1;
  310. },
  311. // 选择教育程度
  312. bindPickerEdu: function(e) {
  313. this.education = this.chooseEdu[e.target.value];
  314. this.educationid = e.target.value;
  315. console.log(this.educationid);
  316. },
  317. // 选择日期
  318. bindDateChange: function(e) {
  319. this.birth = e.target.value;
  320. },
  321. // 是否参加志愿活动
  322. bindPickerVol: function(e) {
  323. this.is_vol = this.chooseVol[e.target.value];
  324. this.index = e.target.value + 1;
  325. },
  326. // 有无服务经验
  327. bindPickerExp: function(e) {
  328. this.is_experience = this.chooseExp[e.target.value];
  329. this.index = e.target.value + 1;
  330. },
  331. getDate(type) {
  332. const date = new Date();
  333. let year = date.getFullYear();
  334. let month = date.getMonth() + 1;
  335. let day = date.getDate();
  336. if (type === 'start') {
  337. year = year - 60;
  338. } else if (type === 'end') {
  339. year = year + 2;
  340. }
  341. month = month > 9 ? month : '0' + month;
  342. day = day > 9 ? day : '0' + day;
  343. return `${year}-${month}-${day}`;
  344. },
  345. // 选择可提供时间
  346. // this.quantum = item.detail.value.join(',');
  347. checktime1(e) {
  348. // var items = this.timeList,
  349. // let quantum = [];
  350. this.quantum = e.detail.value.join(',');
  351. console.log(this.quantum);
  352. },
  353. checktime2(e) {
  354. // var items = this.timeList,
  355. let values = e.detail.value;
  356. // let quantum = [];
  357. console.log(values);
  358. },
  359. checktime3(e) {
  360. // var items = this.timeList,
  361. let values = e.detail.value;
  362. // let quantum = [];
  363. console.log(values);
  364. },
  365. //选择有兴趣参与的工作
  366. checkjob(item) {
  367. this.taste = item.detail.value.join(',');
  368. },
  369. // 选择专长checkspeciality
  370. checkspeciality(item) {
  371. this.speciali = item.detail.value.join(',');
  372. }
  373. }
  374. };
  375. </script>
  376. <style lang="scss">
  377. page {
  378. background-color: #fdcbc2;
  379. }
  380. .content {
  381. padding-top: 44rpx;
  382. background-color: #fdcbc2;
  383. .buttom {
  384. margin: 60rpx auto 0;
  385. width: 750rpx;
  386. height: 100rpx;
  387. background: #fa7e67;
  388. font-size: 34rpx;
  389. font-family: PingFang SC;
  390. font-weight: 500;
  391. color: #ffffff;
  392. line-height: 100rpx;
  393. text-align: center;
  394. &.action {
  395. background: #999999;
  396. }
  397. }
  398. .box {
  399. // margin-top: 44rpx;
  400. width: 690rpx;
  401. margin: 20rpx auto 0;
  402. background-color: #ffffff;
  403. border-radius: 20rpx;
  404. // padding: 28rpx 20rpx 32rpx 20rpx;
  405. position: relative;
  406. .red-box {
  407. width: 405rpx;
  408. line-height: 66rpx;
  409. text-align: center;
  410. background: linear-gradient(0deg, #c90f1b, #f14d33);
  411. // background-color: #c62316;
  412. border-radius: 10rpx;
  413. font-size: 30rpx;
  414. font-weight: 500;
  415. color: #ffffff;
  416. // position: relative;
  417. position: absolute;
  418. top: -36rpx;
  419. left: 50%;
  420. transform: translateX(-50%);
  421. z-index: 1;
  422. }
  423. .box-check {
  424. font-size: 28rpx;
  425. font-weight: 500;
  426. color: #666666;
  427. line-height: 100rpx;
  428. }
  429. .imp {
  430. color: red;
  431. margin-left: 5rpx;
  432. }
  433. .box-1 {
  434. height: 98rpx;
  435. padding: 0 20rpx;
  436. display: flex;
  437. justify-content: space-between;
  438. border-bottom: 1px solid #f0f0f0;
  439. line-height: 98rpx;
  440. align-items: center;
  441. font-size: 28rpx;
  442. font-family: PingFang SC;
  443. font-weight: 500;
  444. color: #333333;
  445. // .box-left {
  446. // width: 120rpx;
  447. // }
  448. // .list-input {
  449. // width: 440rpx;
  450. // }
  451. // .box-right {
  452. // width: 440rpx
  453. // }
  454. .list-input {
  455. width: 440rpx;
  456. // height: 26rpx;
  457. font-size: 28rpx;
  458. font-family: PingFang SC;
  459. font-weight: 500;
  460. color: #000;
  461. }
  462. .placeholder {
  463. color: #999999;
  464. }
  465. .box-right {
  466. width: 440rpx;
  467. }
  468. }
  469. }
  470. }
  471. .upload-box {
  472. // height: 247rpx;
  473. background: #ffffff;
  474. border-radius: 27rpx;
  475. display: flex;
  476. flex-direction: column;
  477. padding: 30rpx 40rpx 30rpx 0;
  478. margin: 15rpx auto 30rpx;
  479. width: 690rpx;
  480. background: #ffffff;
  481. border-radius: 10rpx;
  482. .upload-left {
  483. padding-left: 20rpx;
  484. font-weight: 400;
  485. color: #000;
  486. }
  487. .upload-right {
  488. flex: 1;
  489. display: flex;
  490. align-items: center;
  491. justify-content: center;
  492. .upload-img {
  493. width: 160rpx;
  494. height: 160rpx;
  495. margin-top: 24rpx;
  496. }
  497. }
  498. }
  499. .top-box {
  500. height: 58rpx;
  501. font-size: 38rpx;
  502. line-height: 58rpx;
  503. font-family: PingFang SC;
  504. font-weight: bold;
  505. color: #fa7e67;
  506. text-align: center;
  507. position: relative;
  508. &::before {
  509. content: '';
  510. width: 215rpx;
  511. height: 17rpx;
  512. background: #fff;
  513. opacity: 0.26;
  514. position: absolute;
  515. left: 0;
  516. right: 0;
  517. bottom: 0;
  518. margin: 0 auto;
  519. }
  520. }
  521. </style>