group.vue 12 KB

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