approve.vue 17 KB

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