index.vue 14 KB

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