group.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  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="unit_name" placeholder="请输入单位名称"
  11. placeholder-class="placeholder" />
  12. </view>
  13. <view class="box-1">
  14. <view class="box-left">
  15. 单位性质
  16. <text class="imp"></text>
  17. </view>
  18. <input type="text" value="" class="list-input" v-model="unit_type" placeholder="请输入单位性质"
  19. placeholder-class="placeholder" />
  20. </view>
  21. <view class="box-1">
  22. <view class="box-left">
  23. 法人代表
  24. <text class="imp"></text>
  25. </view>
  26. <input type="text" value="" class="list-input" v-model="unit_peo" placeholder="请输入法人代表"
  27. placeholder-class="placeholder" />
  28. </view>
  29. <view class="box-1">
  30. <view class="box-left">
  31. 单位人数
  32. <text class="imp"></text>
  33. </view>
  34. <input type="number" value="" class="list-input" v-model="unit_num" placeholder="请输入单位人数" placeholder-class="placeholder" />
  35. </view>
  36. <view class="box-1">
  37. <view class="box-left">
  38. 联系人
  39. <text class="imp"></text>
  40. </view>
  41. <input type="text" value="" class="list-input" v-model="unit_concat" placeholder="请输入联系人"
  42. placeholder-class="placeholder" />
  43. </view>
  44. <view class="box-1">
  45. <view class="box-left">
  46. 常驻地区
  47. <text class="imp"></text>
  48. </view>
  49. <input type="text" value="" class="list-input" v-model="usually_area" placeholder="请输入常驻地区"
  50. placeholder-class="placeholder" />
  51. </view>
  52. <view class="box-1">
  53. <view class="box-left">
  54. 邮政编码
  55. <text class="imp"></text>
  56. </view>
  57. <input type="number" value="" class="list-input" v-model="postal_code" placeholder="请输入邮政编码"
  58. placeholder-class="placeholder" />
  59. </view>
  60. <view class="box-1">
  61. <view class="box-left">
  62. 联系电话
  63. <text class="imp"></text>
  64. </view>
  65. <input type="number" value="" class="list-input" v-model="concat_phone" placeholder="请输入联系电话"
  66. placeholder-class="placeholder" />
  67. </view>
  68. <view class="box-1">
  69. <view class="box-left">
  70. 电子邮箱
  71. <text class="imp"></text>
  72. </view>
  73. <input type="text" value="" class="list-input" v-model="email" placeholder="请输入电子邮箱"
  74. placeholder-class="placeholder" />
  75. </view>
  76. <view class="box-1">
  77. <view class="box-left">
  78. 联系地址
  79. <text class="imp"></text>
  80. </view>
  81. <input type="text" value="" class="list-input" v-model="concat_address" placeholder="请输入联系地址"
  82. placeholder-class="placeholder" />
  83. </view>
  84. </view>
  85. <!-- <view class="buttom-ts" ></view> -->
  86. <view class="buttom" :class="{ action: loding }" @click="!loding ? join() : ''">提交申请</view>
  87. </view>
  88. </template>
  89. <script>
  90. import {
  91. mapState,
  92. mapMutations
  93. } from 'vuex';
  94. import {
  95. saveUrl,
  96. interceptor
  97. } from '@/utils/loginUtils.js';
  98. import {
  99. vip,
  100. getVipmoney,
  101. createOrder
  102. } from '@/api/index.js';
  103. import {
  104. upload
  105. } from '@/api/ask.js';
  106. export default {
  107. data() {
  108. const currentDate = this.getDate({
  109. format: true
  110. });
  111. return {
  112. loding: false, //是否提交中
  113. unit_name: '', //单位名称
  114. unit_peo: '', //法人代表
  115. unit_type: '', //单位性质
  116. unit_num: '', //单位人数
  117. unit_concat: '', //单位联系人
  118. usually_area: '', //常驻地区
  119. postal_code: '', //邮政编码
  120. concat_phone: '', //联系电话
  121. email: '', //电子邮箱
  122. id: '',
  123. money: '',
  124. concat_address: '' //联系地址
  125. };
  126. },
  127. onShow() {
  128. if (this.hasLogin) {
  129. // this.loadBaseData();
  130. const obj = this
  131. console.log('getVipmoney+++++')
  132. getVipmoney().then(({
  133. data
  134. }) => {
  135. console.log(data, 'getVipmoney');
  136. data.forEach(e => {
  137. if (e.user_type == 2) {
  138. obj.money = e.pay_price;
  139. obj.id = e.id;
  140. console.log(obj.money, obj.id)
  141. }
  142. });
  143. });
  144. } else {
  145. saveUrl();
  146. uni.showModal({
  147. title: '登录',
  148. content: '您未登录,是否马上登陆?',
  149. success: e => {
  150. if (e.confirm) {
  151. interceptor();
  152. }
  153. },
  154. fail: e => {
  155. console.log(e);
  156. }
  157. });
  158. }
  159. },
  160. computed: {
  161. ...mapState('user', ['hasLogin', 'userInfo']),
  162. ...mapState(['weichatObj']),
  163. // startDate() {
  164. // return this.getDate('start');
  165. // },
  166. // endDate() {
  167. // return this.getDate('end');
  168. // }
  169. },
  170. methods: {
  171. async join() {
  172. let obj = this;
  173. if (obj.unit_name == '') {
  174. obj.$api.msg('请填写单位名称');
  175. return;
  176. }
  177. if (obj.unit_type == '') {
  178. obj.$api.msg('请填写单位性质');
  179. return;
  180. }
  181. if (obj.unit_peo == '') {
  182. obj.$api.msg('请填写法人代表');
  183. return;
  184. }
  185. if (obj.unit_num == '') {
  186. obj.$api.msg('请填写单位人数');
  187. return;
  188. }
  189. if (obj.unit_concat == '') {
  190. obj.$api.msg('请填写联系人');
  191. return;
  192. }
  193. if (obj.usually_area == '') {
  194. obj.$api.msg('请填写常驻地址');
  195. return;
  196. }
  197. if (obj.postal_code == '') {
  198. obj.$api.msg('请填写邮政编码');
  199. return;
  200. }
  201. if (obj.concat_phone == '') {
  202. obj.$api.msg('请填写联系电话');
  203. return;
  204. }
  205. if (!/^((\+?86)|(\(\+86\)))?1\d{10}$/.test(obj.concat_phone)) {
  206. obj.$api.msg('请填写正确的联系电话');
  207. return;
  208. }
  209. if (obj.email == '') {
  210. obj.$api.msg('请填写电子邮箱');
  211. return;
  212. }
  213. if (!/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(obj.email)) {
  214. obj.$api.msg('请填写正确的邮箱');
  215. return;
  216. }
  217. if (obj.concat_address == '') {
  218. obj.$api.msg('请填写联系地址');
  219. return;
  220. }
  221. // obj.loding = true;
  222. vip({
  223. company_name: obj.unit_name, //单位名称
  224. nature: obj.unit_type, //性质
  225. legal_person: obj.unit_peo, //法人
  226. company_member: obj.unit_num * 1, //公司人数
  227. company_address: obj.concat_address, //联系地址
  228. zip_code: obj.postal_code, //邮编
  229. mobile: obj.concat_phone, //联系电话
  230. company_email: obj.email, //邮箱
  231. address: obj.usually_area, //常驻地址
  232. full_name: obj.unit_concat, //联系人
  233. user_type: 2
  234. })
  235. .then(e => {
  236. if (e.status == 400) {
  237. obj.$api.msg(e.msg);
  238. return;
  239. }
  240. uni.showModal({
  241. title: '提示',
  242. content: '成为企业会员需要缴纳' + obj.money + '元年费,是否前往提交',
  243. success: function(res) {
  244. if (res.confirm) {
  245. console.log('用户点击确定');
  246. console.log(obj.money,obj.id,'obj.id+++++')
  247. createOrder({
  248. level_id: obj.id,
  249. body: '企业红会年费',
  250. pay_type: 0,
  251. // name: obj.name,
  252. pay_price: obj.money,
  253. from: 'weixin'
  254. }).then(({
  255. data
  256. }) => {
  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. obj.unit_name = '';
  267. obj.unit_type = '';
  268. obj.unit_num = '';
  269. obj.concat_address = '';
  270. obj.postal_code = '';
  271. obj.concat_phone = '';
  272. obj.email = '';
  273. obj.usually_area = '';
  274. uni.navigateTo({
  275. url: '../joinSuc/joinNow'
  276. });
  277. },
  278. fail: function(res) {
  279. this.$refs.popup1.open();
  280. console.log(res, '失败');
  281. console.log(res.errMsg);
  282. }
  283. });
  284. });
  285. } else if (res.cancel) {
  286. console.log('用户点击取消');
  287. }
  288. }
  289. });
  290. })
  291. .catch(function(e) {
  292. console.log('出错了');
  293. console.log(e);
  294. });
  295. },
  296. imgsub() {
  297. console.log('imgsub');
  298. upload({
  299. filename: ''
  300. }).then(data => {
  301. this.cardimg = data[0].url;
  302. });
  303. },
  304. // 选择性别
  305. bindPickerSex: function(e) {
  306. console.log(this.array[e.target.value]);
  307. this.sex = this.array[e.target.value];
  308. this.index = e.target.value + 1;
  309. },
  310. // 选择教育程度
  311. bindPickerEdu: function(e) {
  312. this.education = this.chooseEdu[e.target.value];
  313. this.index = e.target.value + 1;
  314. },
  315. // 选择日期
  316. bindDateChange: function(e) {
  317. this.birth = e.target.value;
  318. },
  319. // 是否参加志愿活动
  320. bindPickerVol: function(e) {
  321. this.is_vol = this.chooseVol[e.target.value];
  322. this.index = e.target.value + 1;
  323. },
  324. // 有无服务经验
  325. bindPickerExp: function(e) {
  326. this.is_experience = this.chooseExp[e.target.value];
  327. this.index = e.target.value + 1;
  328. },
  329. getDate(type) {
  330. const date = new Date();
  331. let year = date.getFullYear();
  332. let month = date.getMonth() + 1;
  333. let day = date.getDate();
  334. if (type === 'start') {
  335. year = year - 60;
  336. } else if (type === 'end') {
  337. year = year + 2;
  338. }
  339. month = month > 9 ? month : '0' + month;
  340. day = day > 9 ? day : '0' + day;
  341. return `${year}-${month}-${day}`;
  342. },
  343. // 选择可提供时间
  344. // this.quantum = item.detail.value.join(',');
  345. checktime1(e) {
  346. // var items = this.timeList,
  347. // let quantum = [];
  348. this.quantum = e.detail.value.join(',');
  349. console.log(this.quantum);
  350. },
  351. checktime2(e) {
  352. // var items = this.timeList,
  353. let values = e.detail.value;
  354. // let quantum = [];
  355. console.log(values);
  356. },
  357. checktime3(e) {
  358. // var items = this.timeList,
  359. let values = e.detail.value;
  360. // let quantum = [];
  361. console.log(values);
  362. },
  363. //选择有兴趣参与的工作
  364. checkjob(item) {
  365. this.taste = item.detail.value.join(',');
  366. },
  367. // 选择专长checkspeciality
  368. checkspeciality(item) {
  369. this.speciali = item.detail.value.join(',');
  370. }
  371. }
  372. };
  373. </script>
  374. <style lang="scss">
  375. page {
  376. background-color: #fdcbc2;
  377. height: 100%;
  378. }
  379. .content {
  380. max-height: 100%;
  381. padding-top: 44rpx;
  382. background-color: #fdcbc2;
  383. .buttom-ts {
  384. height: 120rpx;
  385. }
  386. .buttom {
  387. margin: 60rpx auto 0;
  388. // position: absolute;
  389. // bottom: 0;
  390. width: 600rpx;
  391. height: 100rpx;
  392. border-radius: 50rpx;
  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>