index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. <template>
  2. <view>
  3. <!-- #ifdef MP -->
  4. <view class="cart_nav">
  5. <nav-bar ref="navBarRef" navTitle="成为骑手" :isBackgroundColor="false">
  6. </nav-bar>
  7. </view>
  8. <!-- #endif -->
  9. <form @submit="formSubmit">
  10. <view class="merchantsSettled">
  11. <view class="merchantBg">
  12. <image class="bag" src="/static/img/rider.jpg" alt="" srcset="" />
  13. </view>
  14. <view class="list">
  15. <view style="padding: 21rpx 0 86rpx 39rpx;">
  16. <view class="item-box">
  17. <view class="title required" style="width: 147rpx;">姓名</view>
  18. <input class="uni-input" v-model="name" focus placeholder="请输入你的姓名" />
  19. </view>
  20. <view class="item-box">
  21. <view class="title required" style="width: 147rpx;">手机号</view>
  22. <input class="uni-input" type='number' v-model="phone" focus placeholder="请输入你的手机号" />
  23. </view>
  24. <view class="item-box">
  25. <view class="title required" style="width: 147rpx;">短信验证</view>
  26. <input class="uni-input" type='number' maxlength="6" v-model="bindingCaptcha" focus placeholder="请输入验证码" />
  27. <button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="code">
  28. {{ text }}
  29. </button>
  30. </view>
  31. <view class="item-box" style="justify-content: space-between;">
  32. <view class="title required">是否有过配送经验</view>
  33. <switch :value="isSwitch" :checked="isSwitch" @change="isSwitch = !isSwitch" color="#12CA00" style="transform:scale(0.9)">
  34. <text style="margin-top: 3rpx;">{{isSwitch ? '是' : '否'}}</text>
  35. </switch>
  36. </view>
  37. <view class="item-box" style="border: none;padding: 0;">
  38. <view class="title required">配送职责(可多选)</view>
  39. </view>
  40. <view class="item-box" style="justify-content: space-between;">
  41. <view class="item-job" :class="checkbox1 ? 'job-border-color' : ''" @tap="checkbox1 = !checkbox1">
  42. <view v-if="checkbox1">
  43. <view class="sjx"></view>
  44. <text class="dg-icon"></text>
  45. </view>
  46. <text class="title">骑手</text>
  47. <view class="job-remark">负责校园外卖配送</view>
  48. </view>
  49. <view class="item-job" :class="checkbox2 ? 'job-border-color' : ''" @tap="checkbox2 = !checkbox2">
  50. <view v-if="checkbox2">
  51. <view class="sjx"></view>
  52. <text class="dg-icon"></text>
  53. </view>
  54. <text class="title">快递员</text>
  55. <view class="job-remark">负责快递代取/代寄</view>
  56. </view>
  57. <!-- <checkbox-group name="checkbox" style="margin-top: 38rpx;" @change="checkboxChange">
  58. <label style="margin-left: 96rpx">
  59. <checkbox class="mycheck" value="1" :checked="checkbox1" /> <text style="margin-left: 10rpx"> 骑手</text>
  60. </label>
  61. <label style="margin-left: 96rpx">
  62. <checkbox class="mycheck" value="2" :checked="checkbox2" /> <text style="margin-left: 10rpx"> 快递员</text>
  63. </label>
  64. </checkbox-group> -->
  65. </view>
  66. <view class="item no-border">
  67. <text class="acea-row row-middle required item-title">请上传身份证证件照正反照</text>
  68. <text v-if="merchantTypeInfo" class="item-title">( {{merchantTypeInfo}} )</text>
  69. <text class="item-desc">(图片最多可上传5张,格式支持JPG、PNG、JPEG)</text>
  70. <view class="upload">
  71. <view class='pictrue' v-for="(item,index) in pics" :key="index" :data-index="index" @click="getPhotoClickIdx">
  72. <image :src='item'></image>
  73. <text class='iconfont icon-guanbi1' @click.stop='DelPic(index)'></text>
  74. </view>
  75. <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic' v-if="pics.length < 5">
  76. <text class='iconfont icon-icon25201'></text>
  77. <view>上传凭证</view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view style="padding: 0 96rpx;margin: 96rpx 0 20rpx 0;">
  83. <label class="radio">
  84. <radio activeBackgroundColor="$bg-color-primary" value="isAgree" @tap="isAgree = !isAgree" :checked="isAgree" />我已阅读相关条款
  85. </label>
  86. <button class="settleAgree" @click="showProtocol = true">《入驻协议》</button>
  87. </view>
  88. <view style="padding: 0 96rpx;">
  89. <button class="sub" @tap="formSubmit">提交</button>
  90. </view>
  91. </view>
  92. </view>
  93. </form>
  94. <view class="settlementAgreement" v-if="showProtocol">
  95. <view class="setAgCount">
  96. <i class="icon iconfont icon-guanbi" @click="showProtocol = false"></i>
  97. <div class="title">骑手入驻协议</div>
  98. <view class="content">
  99. <jyf-parser :html="protocol" ref="article" :tag-style="tagStyle"></jyf-parser>
  100. </view>
  101. </view>
  102. </view>
  103. <Verify @success="handlerOnVerSuccess" :captchaType="'clickWord'" :imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
  104. </view>
  105. </template>
  106. <script>
  107. import {
  108. mapGetters
  109. } from "vuex";
  110. import {
  111. riderSettledCode,
  112. riderSettledApply
  113. } from '@/api/user.js'
  114. import {
  115. Debounce
  116. } from '@/utils/validate.js'
  117. import Verify from '../components/verifition/verify.vue';
  118. import navBar from '@/components/navBar';
  119. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  120. let app = getApp();
  121. export default {
  122. computed: {
  123. ...mapGetters(['isLogin', 'uid'])
  124. },
  125. components: {
  126. Verify,
  127. navBar
  128. },
  129. data() {
  130. return {
  131. showProtocol: false,
  132. protocol: '',
  133. tagStyle: {
  134. img: 'width:100%;display:block;'
  135. },
  136. userInfo: {},
  137. merchantData: {
  138. name: "",
  139. realName: "",
  140. phone: "",
  141. captcha: '',
  142. categoryId: 0,
  143. handlingFee: '',
  144. keywords: '',
  145. qualificationPicture: '',
  146. typeId: 0
  147. },
  148. pics: [],
  149. checkbox1: true,
  150. checkbox2: false,
  151. statusBarHeight: app.globalData.statusBarHeight,
  152. navigationBarHeight: 112,
  153. isAgree: false,
  154. isSwitch: false,
  155. name: '',
  156. phone: '',
  157. bindingCaptcha: '',
  158. disabled: false,
  159. text: '发送验证码',
  160. nums: 60,
  161. timer: '',
  162. merchantTypeInfo: '',
  163. isKey: '',
  164. picsStr: ''
  165. }
  166. },
  167. methods: {
  168. onVerify() {
  169. let that = this;
  170. if (!that.name) return that.$util.Tips({
  171. title: '请填写姓名!'
  172. });
  173. if (!that.phone) return that.$util.Tips({
  174. title: '请填写手机号码!'
  175. });
  176. if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
  177. title: '请输入正确的手机号码!'
  178. });
  179. if (!that.bindingCaptcha) return that.$util.Tips({
  180. title: '请填写验证码!'
  181. });
  182. if (!that.checkbox1 && !that.checkbox2) return that.$util.Tips({
  183. title: '请选择配送职责!'
  184. });
  185. if (!that.isAgree) return that.$util.Tips({
  186. title: '请勾选相关条款!'
  187. });
  188. if (that.pics.length == 0) return that.$util.Tips({
  189. title: "请上传资质图片"
  190. });
  191. if (that.pics) {
  192. that.picsStr = JSON.stringify(that.pics)
  193. }
  194. return true;
  195. },
  196. getUserInfo() {
  197. this.$store.dispatch('USERINFO').then(res => {
  198. this.userInfo = res;
  199. console.log(this.userInfo)
  200. if(this.userInfo.isRider){
  201. this.$util.navigateTo("/pages/rider_index/index");
  202. }else{
  203. this.$util.Tips({
  204. title: "您未注册,请先注册成为骑手"
  205. });
  206. }
  207. });
  208. },
  209. handBack() {
  210. uni.navigateBack({
  211. delta: 1
  212. })
  213. },
  214. //滑块验证成功后
  215. handlerOnVerSuccess(data) {
  216. this.$refs.verify.hide();
  217. uni.showLoading({
  218. title: '加载中',
  219. mask: true
  220. });
  221. riderSettledCode({
  222. phone: +that.phone
  223. }).then(res => {
  224. that.$util.Tips({
  225. title: res.message
  226. });
  227. that.timer = setInterval(that.getTimes, 1000);
  228. that.disabled = true;
  229. uni.hideLoading();
  230. }).catch(err => {
  231. return that.$util.Tips({
  232. title: err
  233. });
  234. uni.hideLoading();
  235. });
  236. },
  237. /**
  238. * 发送验证码
  239. *
  240. */
  241. code: Debounce(function() {
  242. this.nums = 60;
  243. let that = this;
  244. if (!that.phone) return that.$util.Tips({
  245. title: '请填写手机号码!'
  246. });
  247. if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
  248. title: '请输入正确的手机号码!'
  249. });
  250. this.$refs.verify.show();
  251. }),
  252. getTimes() {
  253. this.nums = this.nums - 1;
  254. this.text = "剩余 " + this.nums + "s";
  255. if (this.nums < 0) {
  256. clearInterval(this.timer);
  257. }
  258. this.text = "剩余 " + this.nums + "s";
  259. if (this.text < "剩余 " + 0 + "s") {
  260. this.disabled = false;
  261. this.text = "重新获取";
  262. }
  263. },
  264. checkboxChange(e) {
  265. const arr = e.detail.value
  266. this.checkbox1 = arr.includes('1')
  267. this.checkbox2 = arr.includes('2')
  268. },
  269. formSubmit: function() {
  270. if (this.onVerify()) {
  271. const params = {
  272. jobScope: `${this.checkbox1 ? 1 : 0},${this.checkbox2 ? 1 : 0}`, // 骑手 // 快递员
  273. isExped: this.isSwitch, // 是否有配送经验
  274. name: this.name, // 姓名
  275. phone: this.phone, // 电话
  276. captcha: +this.bindingCaptcha, // 验证码
  277. qualificationPicture: this.picsStr
  278. }
  279. console.log(params)
  280. riderSettledApply(params).then(res => {
  281. this.$util.Tips({
  282. title: '提交成功,等待审核'
  283. });
  284. this.handBack()
  285. }).catch(err => {
  286. return this.$util.Tips({
  287. title: err
  288. });
  289. });
  290. }
  291. },
  292. /**
  293. * 上传文件
  294. *
  295. */
  296. uploadpic: function() {
  297. let that = this;
  298. that.$util.uploadImageOne({
  299. url: 'upload/image',
  300. name: 'multipart',
  301. model: "user",
  302. pid: 0
  303. }, function(res) {
  304. console.log(res)
  305. that.pics.push(res);
  306. that.$set(that, 'pics', that.pics);
  307. });
  308. },
  309. /**
  310. * 删除图片
  311. *
  312. */
  313. DelPic: function(index) {
  314. let that = this,
  315. pic = this.pics[index];
  316. that.pics.splice(index, 1);
  317. that.$set(that, 'pics', that.pics);
  318. },
  319. // 图片预览
  320. // 获得相册 idx
  321. getPhotoClickIdx(e) {
  322. let _this = this;
  323. let idx = e.currentTarget.dataset.index;
  324. _this.imgPreview(_this.pics, idx);
  325. },
  326. // 图片预览
  327. imgPreview: function(list, idx) {
  328. // list:图片 url 数组
  329. if (list && list.length > 0) {
  330. uni.previewImage({
  331. current: list[idx], // 传 Number H5端出现不兼容
  332. urls: list
  333. });
  334. }
  335. },
  336. },
  337. onLoad(options) {
  338. // this.getUserInfo();
  339. },
  340. mounted() {
  341. this.merchantBg = `../static/images/${this.theme}.jpg`;
  342. },
  343. }
  344. </script>
  345. <style scoped lang="scss">
  346. .required::before {
  347. content: '* ';
  348. color: red;
  349. margin-right: 4rpx;
  350. }
  351. .item-box {
  352. display: flex;
  353. align-items: center;
  354. border-bottom: 3rpx solid #D7D8DD;
  355. margin-bottom: 21rpx;
  356. padding-bottom: 21rpx;
  357. margin-right: 38rpx;
  358. .title {
  359. //font-weight: 600;
  360. font-size: 28rpx;
  361. color: #666666;
  362. }
  363. input {
  364. flex: 1;
  365. }
  366. }
  367. .item-job {
  368. border-radius: 8rpx;
  369. position: relative;
  370. padding: 15rpx 25rpx;
  371. text-align: center;
  372. border: 2rpx solid #D7D8DD;
  373. .sjx {
  374. position: absolute;
  375. width: 0;
  376. height: 0;
  377. top: 0;
  378. right: 0;
  379. border-top: 60rpx solid $bg-color-primary;
  380. border-left: 60rpx solid transparent;
  381. }
  382. .dg-icon {
  383. position: absolute;
  384. top: -5rpx;
  385. right: 5rpx;
  386. transform: rotate(14deg);
  387. ::before {
  388. content: '\2713';
  389. color: #fff;
  390. }
  391. }
  392. }
  393. .job-remark {
  394. margin-top: 25rpx;
  395. font-weight: 400;
  396. font-size: 23rpx;
  397. color: #333;
  398. }
  399. .code {
  400. padding: 13rpx 23rpx;
  401. font-weight: 400;
  402. font-size: 21rpx;
  403. color: #FFFFFF;
  404. background-color: $bg-color-primary;
  405. }
  406. .code.on {
  407. color: #b9b9bc !important;
  408. }
  409. .sub {
  410. width: 100%;
  411. margin: 25px auto 25px auto;
  412. background-color: $bg-color-primary;
  413. font-weight: 600;
  414. font-size: 35rpx;
  415. color: #FFFFFF;
  416. padding: 25rpx 0;
  417. }
  418. .order-nav {
  419. font-weight: 500;
  420. font-size: 35rpx;
  421. color: #FFFFFF;
  422. position: relative;
  423. background-color: #FF6702;
  424. display: flex;
  425. align-items: center;
  426. justify-content: center;
  427. .back-button {
  428. position: absolute;
  429. left: 20rpx;
  430. }
  431. }
  432. .back-button {
  433. width: 30rpx;
  434. height: 30rpx;
  435. border-right: 4rpx solid #fff;
  436. border-bottom: 4rpx solid #fff;
  437. transform: rotate(135deg);
  438. margin-left: 10rpx;
  439. display: inline-block;
  440. position: relative;
  441. }
  442. .settlementAgreement {
  443. width: 100%;
  444. height: 100%;
  445. position: fixed;
  446. top: 0;
  447. left: 0;
  448. background: rgba(0, 0, 0, .5);
  449. z-index: 10;
  450. }
  451. .settlementAgreement .setAgCount {
  452. background: #fff;
  453. width: 656rpx;
  454. height: 458px;
  455. position: absolute;
  456. top: 50%;
  457. left: 50%;
  458. border-radius: 12rpx;
  459. -webkit-border-radius: 12rpx;
  460. padding: 20rpx 52rpx !important;
  461. -webkit-transform: translate(-50%, -50%);
  462. -moz-transform: translate(-50%, -50%);
  463. transform: translate(-50%, -50%);
  464. overflow-y: scroll;
  465. .content {
  466. height: 740rpx !important;
  467. overflow-y: scroll;
  468. /deep/ p {
  469. font-size: 13px;
  470. line-height: 22px;
  471. }
  472. /deep/ img {
  473. max-width: 100%;
  474. }
  475. }
  476. }
  477. .settlementAgreement .setAgCount .icon {
  478. font-size: 24rpx;
  479. color: #b4b1b4;
  480. position: absolute;
  481. top: 40rpx;
  482. right: 15rpx;
  483. }
  484. .settlementAgreement .setAgCount .title {
  485. color: #333;
  486. font-size: 32rpx;
  487. text-align: center;
  488. font-weight: bold;
  489. }
  490. .settlementAgreement .setAgCount .content {
  491. margin-top: 32rpx;
  492. color: #333;
  493. font-size: 26rpx;
  494. line-height: 22px;
  495. text-align: justify;
  496. text-justify: distribute-all-lines;
  497. height: 756rpx;
  498. overflow-y: scroll;
  499. }
  500. uni-checkbox-group,
  501. .settleAgree {
  502. display: inline-block;
  503. font-size: 24rpx;
  504. }
  505. .settleAgree {
  506. @include main_color(theme);
  507. }
  508. .acea-row,
  509. .upload {
  510. display: -webkit-box;
  511. display: -moz-box;
  512. display: -webkit-flex;
  513. display: -ms-flexbox;
  514. display: flex;
  515. -webkit-box-lines: multiple;
  516. -moz-box-lines: multiple;
  517. -o-box-lines: multiple;
  518. -webkit-flex-wrap: wrap;
  519. -ms-flex-wrap: wrap;
  520. flex-wrap: wrap;
  521. }
  522. .upload {
  523. margin-top: 20rpx;
  524. }
  525. .pictrue {
  526. width: 130rpx;
  527. height: 130rpx;
  528. margin: 24rpx 22rpx 0 0;
  529. position: relative;
  530. font-size: 11px;
  531. color: #bbb;
  532. &:nth-child(4n) {
  533. margin-right: 0;
  534. }
  535. &:nth-last-child(1) {
  536. border: 0.5px solid #ddd;
  537. box-sizing: border-box;
  538. }
  539. uni-image,
  540. image {
  541. width: 100%;
  542. height: 100%;
  543. border-radius: 1px;
  544. img {
  545. -webkit-touch-callout: none;
  546. -webkit-user-select: none;
  547. -moz-user-select: none;
  548. display: block;
  549. position: absolute;
  550. top: 0;
  551. left: 0;
  552. opacity: 0;
  553. width: 100%;
  554. height: 100%;
  555. }
  556. }
  557. .icon-guanbi1 {
  558. font-size: 33rpx;
  559. position: absolute;
  560. top: -10px;
  561. right: -10px;
  562. }
  563. }
  564. .job-border-color {
  565. border-color: $bg-color-primary;
  566. }
  567. .merchantsSettled {
  568. position: relative;
  569. background-color: $bg-color-primary;
  570. height: 140vh;
  571. }
  572. .merchantsSettled .merchantBg {
  573. width: 100%;
  574. height: 900rpx;
  575. .bag {
  576. width: 100%;
  577. height: 100%;
  578. }
  579. .merchantBg-title {
  580. text-align: center;
  581. color: #fff;
  582. font-size: 60rpx;
  583. font-weight: 600;
  584. margin-bottom: 20rpx;
  585. }
  586. .merchantBg-join {
  587. text-align: center;
  588. color: #fff;
  589. font-size: 36rpx;
  590. }
  591. }
  592. .merchantsSettled .list {
  593. background-color: #fff;
  594. border-radius: 12px;
  595. margin: 0 24rpx;
  596. position: absolute;
  597. top: 18%;
  598. width: calc(100% - 24px);
  599. }
  600. </style>