index.vue 12 KB

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