index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. <template>
  2. <view v-if="xcxSelect == '是'">
  3. <view class="padding">
  4. <view class=" padding-lr bg-white " style="border-radius: 24rpx;">
  5. <u-form :model="form" ref="uForm" label-position="top" :label-style='lableStyle'>
  6. <u-form-item label="真实姓名" :border-bottom='true'>
  7. <u-input placeholder="请输入真实姓名" v-model="form.realName" />
  8. </u-form-item>
  9. <u-form-item label="证件号码" :border-bottom='false'>
  10. <u-input placeholder="请填写(必填) " v-model="form.identityCardNumber" />
  11. </u-form-item>
  12. <u-form-item label="出生日期" :border-bottom='true'>
  13. <u-input placeholder="请填写(必填)" v-model="form.birthMention" :disabled="true"
  14. @click="show = true" />
  15. </u-form-item>
  16. <u-form-item label="驾龄(年)" :border-bottom='false'>
  17. <u-input placeholder="请填写(必填) " v-model="form.drivingYear" />
  18. </u-form-item>
  19. </u-form>
  20. </view>
  21. <view class=" padding bg-white margin-top " style="border-radius: 24rpx;">
  22. <view class="text-bold text-black">驾驶证和保险证</view>
  23. <view>
  24. <view class="flex" style="overflow: hidden;flex-wrap: wrap;">
  25. <view v-if="drivingLicence.length">
  26. <view class="margin-top-sm flex margin-right-sm flex-wrap">
  27. <view v-for="(item,index) in drivingLicence" :key="index">
  28. <view class="flex"
  29. style="width: 200rpx;height: 200rpx;margin-right: 2rpx;position: relative;">
  30. <image :src="item" style="width: 100%;height: 100%;"></image>
  31. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  32. @click="removeImg(index)">
  33. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="margin-top-sm" @click="addImage()" v-if="drivingLicence.length<=5">
  40. <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;border-radius: 16rpx;"
  41. class="flex justify-center align-center">
  42. <view>
  43. <view class="text-center">
  44. <image src="../static/photo.png" style="width: 65rpx;height: 55rpx;">
  45. </image>
  46. </view>
  47. <view class="text-center text-black">上传驾驶证</view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class=" padding bg-white margin-top" style="border-radius: 24rpx;">
  55. <view class="text-bold text-black">上传身份证件</view>
  56. <view class="margin-top"
  57. style="border: 2rpx dashed #484B74; width: 100%;height: 320rpx;position: relative;">
  58. <view style="text-align: center;margin: 80rpx auto 0;" @click="addImages(1)"
  59. v-if="!form.identityCardFront">
  60. <image src="../static/photo.png" mode="widthFix" style="width: 73rpx;"></image>
  61. <view class="text-sm text-gray margin-top-sm">请拍摄身份证正面</view>
  62. </view>
  63. <image @click="disabled? '':addImages(1)" v-else :src="form.identityCardFront"
  64. style="width: 100%;height: 320rpx;"></image>
  65. </view>
  66. <!-- <view class="text-lg">上传身份证反面</view> -->
  67. <view class="margin-top"
  68. style="border: 2rpx dashed #484B74; width: 100%;height: 320rpx;position: relative;">
  69. <view style="text-align: center;margin: 80rpx auto 0;" @click="addImages(2)"
  70. v-if="!form.identityCardVerso">
  71. <image src="../static/photo.png" mode="widthFix" style="width: 73rpx;"></image>
  72. <view class="text-sm text-gray margin-top-sm">请拍摄身份证反面</view>
  73. </view>
  74. <image @click="disabled? '':addImages(2)" v-else :src="form.identityCardVerso"
  75. style="width: 100%;height: 320rpx;"></image>
  76. </view>
  77. </view>
  78. <view class="padding bg-white radius margin-top">
  79. <view class="text-bold" style="color: #3699FF;">缴纳保证金</view>
  80. <view class="flex justify-between margin-top-sm">
  81. <view class="text-gray">满足订单量及好评率即可申请退还保证金</view>
  82. <view class="text-bold" style="color:#F1413D;">¥{{money}}</view>
  83. </view>
  84. </view>
  85. <view class=" margin-top footer text-xxl flex align-center ">
  86. <text @tap="isShowAgree" class="cuIcon" :class="showAgree?'cuIcon-radiobox':'cuIcon-round'">同意并接受</text>
  87. <!-- 协议地址 -->
  88. <navigator url="/my/setting/sijixieyi" style="color: #3699FF;" open-type="navigate">《司机代驾服务用户协议 》</navigator>
  89. </view>
  90. <view style="height: 120rpx;"></view>
  91. </view>
  92. <view class="bg-white flex justify-between align-center padding-lr"
  93. style="position: fixed;bottom: 0;width: 100%;height: 120rpx;">
  94. <view class="">
  95. <text class="text-lg text-bold text-black">支付:</text>
  96. <text style="color: #F1413D;">¥{{money}}</text>
  97. </view>
  98. <view>
  99. <u-button v-if="!disabled" @click="submit" class="" :custom-style="customStyle" shape="circle"
  100. :hair-line="false">入驻并支付</u-button>
  101. </view>
  102. </view>
  103. <u-picker v-model="show" mode="time" @confirm="confirm"></u-picker>
  104. <u-popup v-model="showpay" mode="bottom">
  105. <view class="popup_pay">
  106. <view class="bg margin-top padding-lr radius">
  107. <view style="padding: 0 20upx;margin-top: 36rpx;">
  108. <view
  109. style="display: flex;height: 100upx;align-items: center;padding: 20upx 0;justify-content: center;"
  110. v-for="(item,index) in openLists" :key='index'>
  111. <image :src="item.image" style="width: 55upx;height: 55upx;border-radius: 50upx;">
  112. </image>
  113. <view style="font-size: 30upx;margin-left: 20upx;width: 70%;">
  114. {{item.name}}
  115. </view>
  116. <radio-group name="openWay" style="margin-left: 45rpx;" @tap='selectWay(item)'>
  117. <label class="tui-radio">
  118. <radio color="#3699FF" :checked="openWay == item.id ? true : false" />
  119. </label>
  120. </radio-group>
  121. </view>
  122. </view>
  123. </view>
  124. <view class="pay_btns" @click="pay()">确认支付</view>
  125. </view>
  126. </u-popup>
  127. </view>
  128. </template>
  129. <script>
  130. import configdata from '@/common/config.js';
  131. export default {
  132. data() {
  133. return {
  134. form: {
  135. realName: '',
  136. identityCardNumber: '', //证件号码
  137. birthMention: '', //出生日期
  138. identityCardFront: '', //身份证正面
  139. identityCardVerso: '', //身份证反面
  140. drivingLicence: '', //驾驶证
  141. drivingYear: '', //驾龄
  142. userType:1
  143. },
  144. drivingLicence: [],
  145. lableStyle: {
  146. color: '#000',
  147. fontSize: '28upx',
  148. fontWeight: 500,
  149. },
  150. customStyle: {
  151. backgroundColor: '#3699FF',
  152. color: '#FFFFFF',
  153. border: 0,
  154. width: '200rpx'
  155. },
  156. btnStyle: {
  157. backgroundColor: '#3699FF',
  158. color: '#FFFFFF',
  159. },
  160. money: 0,
  161. showAgree: false, //协议是否选择
  162. sessionkey: '',
  163. xcxSelect: '否',
  164. showpay: false,
  165. openWay: 1,
  166. openLists: [],
  167. indentNumber: '',
  168. disabled: false,
  169. show: false
  170. }
  171. },
  172. onLoad() {
  173. this.xcxSelect = uni.getStorageSync('xcxSelect')
  174. if (this.xcxSelect == '是') {
  175. uni.setNavigationBarTitle({
  176. title: '司机入驻'
  177. })
  178. } else {
  179. uni.setNavigationBarTitle({
  180. title: '关于我们'
  181. })
  182. }
  183. // #ifdef MP-WEIXIN
  184. this.openLists = [{
  185. id: 1,
  186. image: '../../static/image/icon_weixin.png',
  187. name: '微信'
  188. }]
  189. // #endif
  190. // #ifdef H5
  191. this.openLists = [{
  192. id: 2,
  193. image: '../../static/image/zhifubao.png',
  194. name: '支付宝'
  195. }]
  196. this.openWay = 2
  197. // #endif
  198. // #ifdef APP-PLUS
  199. this.openLists = [{
  200. id: 1,
  201. image: '../../static/image/icon_weixin.png',
  202. name: '微信'
  203. },
  204. {
  205. id: 2,
  206. image: '../../static/image/zhifubao.png',
  207. name: '支付宝'
  208. }
  209. ]
  210. // #endif
  211. this.getRZmoney()
  212. this.sessionkey = this.$queue.getData("sessionkey");
  213. },
  214. methods: {
  215. confirm(e) {
  216. // console.log(e,'========')
  217. this.form.birthMention = e.year + '-' + e.month + '-' + e.day
  218. },
  219. removeImg(index) {
  220. this.drivingLicence.splice(index, 1)
  221. },
  222. isShowAgree() {
  223. this.showAgree = !this.showAgree
  224. },
  225. getRZmoney() {
  226. this.$Request.get("/app/common/type/261").then(res => {
  227. if (res.code == 0) {
  228. this.money = res.data.value
  229. // this.form.cashDeposit = res.data.value
  230. }
  231. });
  232. },
  233. selectWay: function(item) {
  234. this.openWay = item.id;
  235. },
  236. submit() {
  237. let that = this
  238. // console.log(that.form)
  239. if (!that.form.realName) {
  240. uni.showToast({
  241. title: '请输入真实姓名',
  242. icon: 'none',
  243. duration: 1000
  244. })
  245. return;
  246. }
  247. if (!that.form.identityCardNumber) {
  248. uni.showToast({
  249. title: '请输入身份证号',
  250. icon: 'none',
  251. duration: 1000
  252. })
  253. return;
  254. }
  255. if (!that.form.birthMention) {
  256. uni.showToast({
  257. title: '请选择出生日期',
  258. icon: 'none',
  259. duration: 1000
  260. })
  261. return;
  262. }
  263. if (!that.form.drivingYear) {
  264. uni.showToast({
  265. title: '请填写驾龄',
  266. icon: 'none',
  267. duration: 1000
  268. })
  269. return;
  270. }
  271. if (!that.form.identityCardFront) {
  272. uni.showToast({
  273. title: '请上传身份证正面',
  274. icon: 'none',
  275. duration: 1000
  276. })
  277. return;
  278. }
  279. if (!that.form.identityCardVerso) {
  280. uni.showToast({
  281. title: '请上传身份证反面',
  282. icon: 'none',
  283. duration: 1000
  284. })
  285. return;
  286. }
  287. if (that.drivingLicence.length == 0) {
  288. uni.showToast({
  289. title: '请上传驾驶证',
  290. icon: 'none',
  291. duration: 1000
  292. })
  293. return;
  294. }
  295. if (!that.showAgree) {
  296. uni.showToast({
  297. title: '请勾选司机代驾服务用户协议',
  298. icon: 'none',
  299. duration: 1000
  300. })
  301. return;
  302. }
  303. that.showpay = true
  304. },
  305. getUserInfo() {
  306. this.$Request.getT("/app/user/selectUserById").then(res => {
  307. if (res.code == 0&&res.data) {
  308. this.form.realName = res.data.realName ? res.data.realName : ''
  309. this.form.identityCardNumber = res.data.identityCardNumber ? res.data.identityCardNumber :
  310. ''
  311. this.form.birthMention = res.data.birthMention ? res.data.birthMention : ''
  312. this.form.identityCardVerso = res.data.identityCardVerso ? res.data.identityCardVerso : ''
  313. this.form.identityCardFront = res.data.identityCardFront ? res.data.identityCardFront : ''
  314. this.form.drivingYear = res.data.drivingYear ? res.data.drivingYear : ''
  315. this.form.drivingLicence = res.data.drivingLicence ? res.data.drivingLicence : ''
  316. if (res.data.drivingLicence) {
  317. this.drivingLicence = res.data.drivingLicence.split(',')
  318. }
  319. if (res.data.checkCertification == 1 || res.data.checkCertification == 0) {
  320. this.disabled = true
  321. }
  322. if (res.data.checkCertification == 2) {
  323. this.form.checkCertificationMessage = res.data.checkCertificationMessage ? res.data
  324. .checkCertificationMessage : ''
  325. }
  326. this.status = res.data.checkCertification
  327. }
  328. });
  329. },
  330. addImages(e) {
  331. uni.chooseImage({
  332. count: 1,
  333. sourceType: ['album', 'camera'],
  334. success: res => {
  335. for (let i = 0; i < 1; i++) {
  336. this.$queue.showLoading("上传中...");
  337. uni.uploadFile({ // 上传接口
  338. url: this.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  339. filePath: res.tempFilePaths[i],
  340. name: 'file',
  341. success: (uploadFileRes) => {
  342. console.log(uploadFileRes)
  343. if (e == 1) {
  344. this.form.identityCardFront = JSON.parse(uploadFileRes
  345. .data).data
  346. } else if (e == 2) {
  347. this.form.identityCardVerso = JSON.parse(uploadFileRes
  348. .data).data
  349. }
  350. uni.hideLoading();
  351. }
  352. });
  353. }
  354. }
  355. })
  356. },
  357. addImage() {
  358. uni.chooseImage({
  359. count: 6,
  360. sourceType: ['album', 'camera'],
  361. success: res => {
  362. for (let i = 0; i < res.tempFilePaths.length; i++) {
  363. this.$queue.showLoading("上传中...");
  364. uni.uploadFile({ // 上传接口
  365. url: this.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  366. filePath: res.tempFilePaths[i],
  367. name: 'file',
  368. success: (uploadFileRes) => {
  369. // console.log(uploadFileRes)
  370. this.drivingLicence.push(JSON.parse(uploadFileRes.data).data)
  371. uni.hideLoading();
  372. }
  373. });
  374. }
  375. }
  376. })
  377. },
  378. config: function(name) {
  379. var info = null;
  380. if (name) {
  381. var name2 = name.split("."); //字符分割
  382. if (name2.length > 1) {
  383. info = configdata[name2[0]][name2[1]] || null;
  384. } else {
  385. info = configdata[name] || null;
  386. }
  387. if (info == null) {
  388. let web_config = cache.get("web_config");
  389. if (web_config) {
  390. if (name2.length > 1) {
  391. info = web_config[name2[0]][name2[1]] || null;
  392. } else {
  393. info = web_config[name] || null;
  394. }
  395. }
  396. }
  397. }
  398. return info;
  399. },
  400. pay() {
  401. if (this.openWay == 0) {
  402. this.$queue.showToast('请选择支付方式!')
  403. return;
  404. }
  405. this.form.drivingLicence = this.drivingLicence
  406. this.form.drivingLicence = this.form.drivingLicence.toString()
  407. if (this.openWay == 1) {
  408. console.log('微信')
  409. // #ifdef APP-PLUS
  410. // 微信APP支付 根据订单id获取支付信息
  411. this.$Request.postJson("/app/wxPayRider/appRiderCertification", this.form).then(res => {
  412. console.log(JSON.stringify(res), '微信支付信息')
  413. this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data));
  414. });
  415. // #endif
  416. // #ifdef MP-WEIXIN
  417. let that = this
  418. that.$Request.postJson("/app/wxPayRider/wxPayJsApiRiderCertification", that.form).then(res => {
  419. if (res.code == 0) {
  420. uni.requestPayment({
  421. provider: 'wxpay',
  422. timeStamp: res.data.timestamp,
  423. nonceStr: res.data.noncestr,
  424. package: res.data.package,
  425. signType: res.data.signType,
  426. paySign: res.data.sign,
  427. success: function(res) {
  428. console.log(res)
  429. uni.hideLoading();
  430. uni.showToast({
  431. title: '实名认证提交成功',
  432. icon: 'none'
  433. });
  434. setTimeout(function() {
  435. uni.navigateBack(1)
  436. }, 1000)
  437. },
  438. fail: function(err) {
  439. console.log('fail:' + JSON.stringify(err));
  440. uni.hideLoading();
  441. that.$queue.showToast('支付失败');
  442. }
  443. });
  444. } else {
  445. uni.showToast({
  446. title: res.msg,
  447. icon: 'none'
  448. })
  449. }
  450. });
  451. // #endif
  452. } else {
  453. // APP支付宝支付
  454. // #ifdef H5
  455. this.form.payType = 5
  456. this.$Request.postJson('/app/aliPay/aliPayRiderCertification', this.form).then(
  457. res => {
  458. if (res.code == 0) {
  459. const div = document.createElement('div')
  460. div.innerHTML = res.data //此处form就是后台返回接收到的数据
  461. document.body.appendChild(div)
  462. document.forms[0].submit()
  463. } else {
  464. uni.showToast({
  465. icon: 'none',
  466. title: '支付失败!'
  467. });
  468. }
  469. });
  470. // #endif
  471. // #ifdef APP
  472. this.form.payType = 4
  473. this.$Request.postJson("/app/aliPay/aliPayRiderCertification", this.form).then(res => {
  474. console.log(JSON.stringify(res), '支付宝支付信息')
  475. this.isCheckPay(res.code, 'alipay', res.data)
  476. });
  477. // #endif
  478. }
  479. },
  480. callPay: function(response) {
  481. if (typeof WeixinJSBridge === "undefined") {
  482. if (document.addEventListener) {
  483. document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
  484. } else if (document.attachEvent) {
  485. document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
  486. document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
  487. }
  488. } else {
  489. this.onBridgeReady(response);
  490. }
  491. },
  492. onBridgeReady: function(response) {
  493. let that = this;
  494. // if (!response.package) {
  495. // return;
  496. // }
  497. console.log(response, 111111)
  498. WeixinJSBridge.invoke(
  499. 'getBrandWCPayRequest', {
  500. "appId": response.appid, //公众号名称,由商户传入
  501. "timeStamp": response.timestamp, //时间戳,自1970年以来的秒数
  502. "nonceStr": response.noncestr, //随机串
  503. "package": response.package,
  504. "signType": response.signType, //微信签名方式:
  505. "paySign": response.sign //微信签名
  506. },
  507. function(res) {
  508. console.log(res, '/*-/*-/*-')
  509. if (res.err_msg === "get_brand_wcpay_request:ok") {
  510. // 使用以上方式判断前端返回,微信团队郑重提示:
  511. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  512. uni.showLoading({
  513. title: '支付成功'
  514. });
  515. setTimeout(function() {
  516. uni.hideLoading();
  517. uni.navigateBack()
  518. }, 1000);
  519. } else {
  520. uni.hideLoading();
  521. }
  522. WeixinJSBridge.log(response.err_msg);
  523. }
  524. );
  525. },
  526. isCheckPay(status, name, order) {
  527. if (status == 0) {
  528. this.setPayment(name, order);
  529. } else {
  530. uni.hideLoading();
  531. uni.showToast({
  532. title: '支付信息有误',
  533. icon: 'none'
  534. });
  535. }
  536. },
  537. setPayment(name, order) {
  538. console.log(name, '*-*-*', order)
  539. uni.requestPayment({
  540. provider: name,
  541. orderInfo: order, //微信、支付宝订单数据
  542. success: function(res) {
  543. console.log(res)
  544. uni.hideLoading();
  545. uni.showLoading({
  546. title: '支付成功'
  547. });
  548. setTimeout(function() {
  549. uni.navigateBack()
  550. }, 1000);
  551. },
  552. fail: function(err) {
  553. console.log(err)
  554. uni.hideLoading();
  555. },
  556. complete() {
  557. uni.hideLoading();
  558. }
  559. });
  560. },
  561. }
  562. }
  563. </script>
  564. <style lang="less">
  565. page {
  566. background: #F5F5F5;
  567. }
  568. .footer {
  569. /* // padding-left: 140upx; */
  570. /* justify-content: center; */
  571. margin-top: 32upx;
  572. font-size: 24upx;
  573. color: #666666;
  574. display: flex;
  575. // text-align: center;
  576. // align-items: center;
  577. }
  578. /* 支付弹框 */
  579. .popup_pay {
  580. width: 100%;
  581. }
  582. .pay_btns {
  583. width: 90%;
  584. margin: 0 auto 40rpx;
  585. text-align: center;
  586. background: #3699FF;
  587. height: 80rpx;
  588. border-radius: 16rpx;
  589. color: #ffffff;
  590. line-height: 80rpx;
  591. margin-top: 20rpx;
  592. }
  593. </style>