personal.vue 13 KB

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