index.vue 14 KB

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