index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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" 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" 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" 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">是否有过配送经验</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">配送职责(可多选)</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. riderSettledCode,
  109. riderSettledApply
  110. } from '@/api/user.js'
  111. import {
  112. Debounce
  113. } from '@/utils/validate.js'
  114. import Verify from '../components/verifition/verify.vue';
  115. import navBar from '@/components/navBar';
  116. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  117. let app = getApp();
  118. export default {
  119. components: {
  120. Verify,
  121. navBar
  122. },
  123. data() {
  124. return {
  125. showProtocol: false,
  126. protocol: '',
  127. tagStyle: {
  128. img: 'width:100%;display:block;'
  129. },
  130. merchantData: {
  131. name: "",
  132. realName: "",
  133. phone: "",
  134. captcha: '',
  135. categoryId: 0,
  136. handlingFee: '',
  137. keywords: '',
  138. qualificationPicture: '',
  139. typeId: 0
  140. },
  141. pics: [],
  142. checkbox1: true,
  143. checkbox2: false,
  144. statusBarHeight: app.globalData.statusBarHeight,
  145. navigationBarHeight: 112,
  146. isAgree: false,
  147. isSwitch: false,
  148. name: '',
  149. phone: '',
  150. bindingCaptcha: '',
  151. disabled: false,
  152. text: '发送验证码',
  153. nums: 60,
  154. timer: '',
  155. merchantTypeInfo: '',
  156. isKey: '',
  157. picsStr: ''
  158. }
  159. },
  160. methods: {
  161. onVerify() {
  162. let that = this;
  163. if (!that.name) return that.$util.Tips({
  164. title: '请填写姓名!'
  165. });
  166. if (!that.phone) return that.$util.Tips({
  167. title: '请填写手机号码!'
  168. });
  169. if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
  170. title: '请输入正确的手机号码!'
  171. });
  172. if (!that.bindingCaptcha) return that.$util.Tips({
  173. title: '请填写验证码!'
  174. });
  175. if (!that.checkbox1 && !that.checkbox2) return that.$util.Tips({
  176. title: '请选择配送职责!'
  177. });
  178. if (!that.isAgree) return that.$util.Tips({
  179. title: '请勾选相关条款!'
  180. });
  181. if (that.pics.length == 0) return that.$util.Tips({
  182. title: "请上传资质图片"
  183. });
  184. if (that.pics) {
  185. that.picsStr = JSON.stringify(that.pics)
  186. }
  187. return true;
  188. },
  189. handBack() {
  190. uni.navigateBack({
  191. delta: 1
  192. })
  193. },
  194. //滑块验证成功后
  195. handlerOnVerSuccess(data) {
  196. this.$refs.verify.hide();
  197. uni.showLoading({
  198. title: '加载中',
  199. mask: true
  200. });
  201. riderSettledCode({
  202. phone: +that.phone
  203. }).then(res => {
  204. that.$util.Tips({
  205. title: res.message
  206. });
  207. that.timer = setInterval(that.getTimes, 1000);
  208. that.disabled = true;
  209. uni.hideLoading();
  210. }).catch(err => {
  211. return that.$util.Tips({
  212. title: err
  213. });
  214. uni.hideLoading();
  215. });
  216. },
  217. /**
  218. * 发送验证码
  219. *
  220. */
  221. code: Debounce(function() {
  222. this.nums = 60;
  223. let that = this;
  224. if (!that.phone) return that.$util.Tips({
  225. title: '请填写手机号码!'
  226. });
  227. if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
  228. title: '请输入正确的手机号码!'
  229. });
  230. this.$refs.verify.show();
  231. }),
  232. getTimes() {
  233. this.nums = this.nums - 1;
  234. this.text = "剩余 " + this.nums + "s";
  235. if (this.nums < 0) {
  236. clearInterval(this.timer);
  237. }
  238. this.text = "剩余 " + this.nums + "s";
  239. if (this.text < "剩余 " + 0 + "s") {
  240. this.disabled = false;
  241. this.text = "重新获取";
  242. }
  243. },
  244. checkboxChange(e) {
  245. const arr = e.detail.value
  246. this.checkbox1 = arr.includes('1')
  247. this.checkbox2 = arr.includes('2')
  248. },
  249. formSubmit: function() {
  250. if (this.onVerify()) {
  251. const params = {
  252. jobScope: `${this.checkbox1 ? 1 : 0},${this.checkbox2 ? 1 : 0}`, // 骑手 // 快递员
  253. isExped: this.isSwitch, // 是否有配送经验
  254. name: this.name, // 姓名
  255. phone: this.phone, // 电话
  256. captcha: +this.bindingCaptcha, // 验证码
  257. qualificationPicture: this.picsStr
  258. }
  259. console.log(params)
  260. riderSettledApply(params).then(res => {
  261. this.$util.Tips({
  262. title: '提交成功,等待审核'
  263. });
  264. this.handBack()
  265. }).catch(err => {
  266. return this.$util.Tips({
  267. title: err
  268. });
  269. });
  270. }
  271. },
  272. /**
  273. * 上传文件
  274. *
  275. */
  276. uploadpic: function() {
  277. let that = this;
  278. that.$util.uploadImageOne({
  279. url: 'upload/image',
  280. name: 'multipart',
  281. model: "user",
  282. pid: 0
  283. }, function(res) {
  284. console.log(res)
  285. that.pics.push(res);
  286. that.$set(that, 'pics', that.pics);
  287. });
  288. },
  289. /**
  290. * 删除图片
  291. *
  292. */
  293. DelPic: function(index) {
  294. let that = this,
  295. pic = this.pics[index];
  296. that.pics.splice(index, 1);
  297. that.$set(that, 'pics', that.pics);
  298. },
  299. // 图片预览
  300. // 获得相册 idx
  301. getPhotoClickIdx(e) {
  302. let _this = this;
  303. let idx = e.currentTarget.dataset.index;
  304. _this.imgPreview(_this.pics, idx);
  305. },
  306. // 图片预览
  307. imgPreview: function(list, idx) {
  308. // list:图片 url 数组
  309. if (list && list.length > 0) {
  310. uni.previewImage({
  311. current: list[idx], // 传 Number H5端出现不兼容
  312. urls: list
  313. });
  314. }
  315. },
  316. },
  317. onLoad(options) {},
  318. mounted() {
  319. },
  320. }
  321. </script>
  322. <style scoped lang="scss">
  323. .item-box {
  324. display: flex;
  325. align-items: center;
  326. border-bottom: 3rpx solid #D7D8DD;
  327. margin-bottom: 21rpx;
  328. padding-bottom: 21rpx;
  329. margin-right: 38rpx;
  330. .title {
  331. font-weight: 600;
  332. font-size: 27rpx;
  333. color: #141414;
  334. }
  335. input {
  336. flex: 1;
  337. }
  338. }
  339. .item-job {
  340. border-radius: 8rpx;
  341. position: relative;
  342. padding: 15rpx 25rpx;
  343. text-align: center;
  344. border: 2rpx solid #D7D8DD;
  345. .sjx {
  346. position: absolute;
  347. width: 0;
  348. height: 0;
  349. top: 0;
  350. right: 0;
  351. border-top: 60rpx solid $bg-color-primary;
  352. border-left: 60rpx solid transparent;
  353. }
  354. .dg-icon {
  355. position: absolute;
  356. top: -5rpx;
  357. right: 5rpx;
  358. transform: rotate(14deg);
  359. ::before {
  360. content: '\2713';
  361. color: #fff;
  362. }
  363. }
  364. }
  365. .job-remark {
  366. margin-top: 25rpx;
  367. font-weight: 400;
  368. font-size: 23rpx;
  369. color: #333;
  370. }
  371. .code {
  372. padding: 13rpx 23rpx;
  373. font-weight: 400;
  374. font-size: 21rpx;
  375. color: #FFFFFF;
  376. background-color: $bg-color-primary;
  377. }
  378. .code.on {
  379. color: #b9b9bc !important;
  380. }
  381. .sub {
  382. width: 100%;
  383. margin: 25px auto 25px auto;
  384. background-color: $bg-color-primary;
  385. font-weight: 600;
  386. font-size: 35rpx;
  387. color: #FFFFFF;
  388. padding: 25rpx 0;
  389. }
  390. .order-nav {
  391. font-weight: 500;
  392. font-size: 35rpx;
  393. color: #FFFFFF;
  394. position: relative;
  395. background-color: #FF6702;
  396. display: flex;
  397. align-items: center;
  398. justify-content: center;
  399. .back-button {
  400. position: absolute;
  401. left: 20rpx;
  402. }
  403. }
  404. .back-button {
  405. width: 30rpx;
  406. height: 30rpx;
  407. border-right: 4rpx solid #fff;
  408. border-bottom: 4rpx solid #fff;
  409. transform: rotate(135deg);
  410. margin-left: 10rpx;
  411. display: inline-block;
  412. position: relative;
  413. }
  414. .settlementAgreement {
  415. width: 100%;
  416. height: 100%;
  417. position: fixed;
  418. top: 0;
  419. left: 0;
  420. background: rgba(0, 0, 0, .5);
  421. z-index: 10;
  422. }
  423. .settlementAgreement .setAgCount {
  424. background: #fff;
  425. width: 656rpx;
  426. height: 458px;
  427. position: absolute;
  428. top: 50%;
  429. left: 50%;
  430. border-radius: 12rpx;
  431. -webkit-border-radius: 12rpx;
  432. padding: 20rpx 52rpx !important;
  433. -webkit-transform: translate(-50%, -50%);
  434. -moz-transform: translate(-50%, -50%);
  435. transform: translate(-50%, -50%);
  436. overflow-y: scroll;
  437. .content {
  438. height: 740rpx !important;
  439. overflow-y: scroll;
  440. /deep/ p {
  441. font-size: 13px;
  442. line-height: 22px;
  443. }
  444. /deep/ img {
  445. max-width: 100%;
  446. }
  447. }
  448. }
  449. .settlementAgreement .setAgCount .icon {
  450. font-size: 24rpx;
  451. color: #b4b1b4;
  452. position: absolute;
  453. top: 40rpx;
  454. right: 15rpx;
  455. }
  456. .settlementAgreement .setAgCount .title {
  457. color: #333;
  458. font-size: 32rpx;
  459. text-align: center;
  460. font-weight: bold;
  461. }
  462. .settlementAgreement .setAgCount .content {
  463. margin-top: 32rpx;
  464. color: #333;
  465. font-size: 26rpx;
  466. line-height: 22px;
  467. text-align: justify;
  468. text-justify: distribute-all-lines;
  469. height: 756rpx;
  470. overflow-y: scroll;
  471. }
  472. uni-checkbox-group,
  473. .settleAgree {
  474. display: inline-block;
  475. font-size: 24rpx;
  476. }
  477. .settleAgree {
  478. @include main_color(theme);
  479. }
  480. .acea-row,
  481. .upload {
  482. display: -webkit-box;
  483. display: -moz-box;
  484. display: -webkit-flex;
  485. display: -ms-flexbox;
  486. display: flex;
  487. -webkit-box-lines: multiple;
  488. -moz-box-lines: multiple;
  489. -o-box-lines: multiple;
  490. -webkit-flex-wrap: wrap;
  491. -ms-flex-wrap: wrap;
  492. flex-wrap: wrap;
  493. }
  494. .upload {
  495. margin-top: 20rpx;
  496. }
  497. .pictrue {
  498. width: 130rpx;
  499. height: 130rpx;
  500. margin: 24rpx 22rpx 0 0;
  501. position: relative;
  502. font-size: 11px;
  503. color: #bbb;
  504. &:nth-child(4n) {
  505. margin-right: 0;
  506. }
  507. &:nth-last-child(1) {
  508. border: 0.5px solid #ddd;
  509. box-sizing: border-box;
  510. }
  511. uni-image,
  512. image {
  513. width: 100%;
  514. height: 100%;
  515. border-radius: 1px;
  516. img {
  517. -webkit-touch-callout: none;
  518. -webkit-user-select: none;
  519. -moz-user-select: none;
  520. display: block;
  521. position: absolute;
  522. top: 0;
  523. left: 0;
  524. opacity: 0;
  525. width: 100%;
  526. height: 100%;
  527. }
  528. }
  529. .icon-guanbi1 {
  530. font-size: 33rpx;
  531. position: absolute;
  532. top: -10px;
  533. right: -10px;
  534. }
  535. }
  536. .job-border-color {
  537. border-color: $bg-color-primary;
  538. }
  539. .merchantsSettled {
  540. position: relative;
  541. background-color: $bg-color-primary;
  542. height: 140vh;
  543. }
  544. .merchantsSettled .merchantBg {
  545. width: 100%;
  546. height: 900rpx;
  547. .bag {
  548. width: 100%;
  549. height: 100%;
  550. }
  551. .merchantBg-title {
  552. text-align: center;
  553. color: #fff;
  554. font-size: 60rpx;
  555. font-weight: 600;
  556. margin-bottom: 20rpx;
  557. }
  558. .merchantBg-join {
  559. text-align: center;
  560. color: #fff;
  561. font-size: 36rpx;
  562. }
  563. }
  564. .merchantsSettled .list {
  565. background-color: #fff;
  566. border-radius: 12px;
  567. margin: 0 24rpx;
  568. position: absolute;
  569. top: 18%;
  570. width: calc(100% - 24px);
  571. }
  572. </style>