group.vue 13 KB

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