index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. <template>
  2. <view>
  3. <view v-if="shangxian === '否'">
  4. <view class="padding">
  5. <view class="text-center padding-bottom text-red" v-if="status==3">
  6. 拒绝理由:{{form.auditContent}}
  7. </view>
  8. <view class="text-center padding-bottom text-red" v-if="status==1">审核中</view>
  9. <view class=" padding-lr bg-white " style="border-radius: 24rpx;">
  10. <u-form :model="form" ref="uForm" label-position="top" :label-style='lableStyle'>
  11. <u-form-item label="姓名" :border-bottom='true'>
  12. <u-input placeholder="请输入真实姓名" v-model="form.driverName" />
  13. </u-form-item>
  14. <!-- <u-form-item label="证件号码" :border-bottom='false'>
  15. <u-input placeholder="请填写(必填) " v-model="form.identityCardNumber" />
  16. </u-form-item> -->
  17. <u-form-item label="出生日期" :border-bottom='true'>
  18. <u-input placeholder="请填写(必填)" v-model="form.dateBirth" :disabled="true"
  19. @click="show = true" />
  20. </u-form-item>
  21. <u-form-item label="驾龄(年)" :border-bottom='true'>
  22. <u-input placeholder="请填写(必填) " v-model="form.drivingYears" />
  23. </u-form-item>
  24. <!-- <u-form-item label="省市区" :border-bottom='true'>
  25. <u-input placeholder="请选择位置(必填) " v-model="cityqu" :disabled="true" @click="openMap()" />
  26. </u-form-item> -->
  27. <u-form-item label="车辆品牌" :border-bottom='true'>
  28. <u-input placeholder="请输入车辆品牌(必填) " v-model="form.driverBrand" />
  29. </u-form-item>
  30. <u-form-item label="车牌号" :border-bottom='true'>
  31. <u-input placeholder="请输入车牌号(必填) " v-model="form.driverPlate" />
  32. </u-form-item>
  33. <u-form-item label="车辆颜色" :border-bottom='false'>
  34. <u-input placeholder="请输入车辆颜色(必填) " v-model="form.driverColor" />
  35. </u-form-item>
  36. </u-form>
  37. </view>
  38. <view class=" padding bg-white margin-top" style="border-radius: 24rpx;">
  39. <view class="text-bold text-black">上传身份证件</view>
  40. <view class="flex margin-top justify-between">
  41. <view style="width: 303rpx;height: 180rpx;">
  42. <view @click="addImages(1)"
  43. v-if="!form.frontIdentityCard">
  44. <image v-if="globalImages" :src="globalImages + 'imgs/static/upload/czsfzrx.png'" style="width: 303rpx;height: 180rpx;"></image>
  45. </view>
  46. <image @click="disabled? '':addImages(1)" v-else :src="form.frontIdentityCard"
  47. style="width: 303rpx;height: 180rpx;"></image>
  48. </view>
  49. <view style="width: 303rpx;height: 180rpx;">
  50. <view @click="addImages(2)"
  51. v-if="!form.backIdentityCard">
  52. <image v-if="globalImages" :src="globalImages + 'imgs/static/upload/czsfzfm.png'" style="width: 303rpx;height: 180rpx;"></image>
  53. </view>
  54. <image @click="disabled? '':addImages(2)" v-else :src="form.backIdentityCard"
  55. style="width: 303rpx;height: 180rpx;"></image>
  56. </view>
  57. </view>
  58. <view class="text-bold text-black margin-top-lg">上传车辆信息</view>
  59. <view class="flex margin-top justify-between">
  60. <view style="width: 303rpx;height: 180rpx;">
  61. <view @click="addImages(3)"
  62. v-if="!form.drivingLicense">
  63. <image v-if="globalImages" :src="globalImages + 'imgs/static/upload/czxszzbzm.png'" style="width: 303rpx;height: 180rpx;"></image>
  64. </view>
  65. <image @click="disabled? '':addImages(3)" v-else :src="form.drivingLicense"
  66. style="width: 303rpx;height: 180rpx;"></image>
  67. </view>
  68. <view style="width: 303rpx;height: 180rpx;">
  69. <view @click="addImages(4)"
  70. v-if="!form.driverLicense">
  71. <image v-if="globalImages" :src="globalImages + 'imgs/static/upload/czxszzm.png'" style="width: 303rpx;height: 180rpx;"></image>
  72. </view>
  73. <image @click="disabled? '':addImages(4)" v-else :src="form.driverLicense"
  74. style="width: 303rpx;height: 180rpx;"></image>
  75. </view>
  76. </view>
  77. <!-- <view>
  78. <view class="flex" style="overflow: hidden;flex-wrap: wrap;">
  79. <view v-if="drivingLicence.length">
  80. <view class="margin-top-sm flex margin-right-sm flex-wrap">
  81. <view v-for="(item,index) in drivingLicence" :key="index">
  82. <view class="flex"
  83. style="width: 200rpx;height: 200rpx;margin-right: 2rpx;position: relative;">
  84. <image :src="item" style="width: 100%;height: 100%;"></image>
  85. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  86. @click="removeImg(index)">
  87. <image src="../static/gb.png" style="width:50rpx;height:50rpx;"></image>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="margin-top-sm" @click="addImage()" v-if="drivingLicence.length<=5">
  94. <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;border-radius: 16rpx;"
  95. class="flex justify-center align-center">
  96. <view>
  97. <view class="text-center">
  98. <image src="../static/photo.png" style="width: 65rpx;height: 55rpx;">
  99. </image>
  100. </view>
  101. <view class="text-center text-black">上传驾驶证</view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </view> -->
  107. </view>
  108. <!-- <view class=" padding bg-white margin-top " style="border-radius: 24rpx;">
  109. </view> -->
  110. <!-- <view class="padding bg-white radius margin-top" v-if="!disabled">
  111. <view class="text-bold" style="color: #3699FF;">缴纳保证金</view>
  112. <view class="flex justify-between margin-top-sm">
  113. <view class="text-gray">满足订单量及好评率即可申请退还保证金</view>
  114. <view class="text-bold" style="color:#F1413D;">¥{{money}}</view>
  115. </view>
  116. </view> -->
  117. <view class=" margin-top footer text-xxl" v-if="!disabled">
  118. <text @tap="isShowAgree" class="cuIcon"
  119. :class="showAgree?'cuIcon-radiobox':'cuIcon-round'">同意并接受</text>
  120. <!-- 协议地址 -->
  121. <navigator url="/my/setting/sijixieyi" style="color: #3699FF;" open-type="navigate">《师傅入驻协议 》
  122. </navigator>
  123. </view>
  124. <view class=" margin-top footer text-xxl" v-if="disabled">
  125. 查看
  126. <navigator url="/my/setting/sijixieyi" style="color: #3699FF;" open-type="navigate">《师傅入驻协议 》
  127. </navigator>
  128. </view>
  129. <view style="height: 120rpx;"></view>
  130. </view>
  131. <view class="align-center padding-lr" v-if="!disabled"
  132. style="position: fixed;bottom: 0;width: 100%;height: 120rpx;z-index: 99;">
  133. <!-- <view class="">
  134. <text class="text-lg text-bold text-black">支付:</text>
  135. <text style="color: #F1413D;">¥{{money}}</text>
  136. </view> -->
  137. <view>
  138. <u-button v-if="!disabled" @click="submit" class="" :custom-style="customStyle" shape="circle"
  139. :hair-line="false">确认认证</u-button>
  140. </view>
  141. </view>
  142. <u-picker v-model="show" mode="time" @confirm="confirm"></u-picker>
  143. <u-popup v-model="showpay" mode="bottom">
  144. <view class="popup_pay">
  145. <view class="bg margin-top padding-lr radius">
  146. <view style="padding: 0 20upx;margin-top: 36rpx;">
  147. <view
  148. style="display: flex;height: 100upx;align-items: center;padding: 20upx 0;justify-content: center;"
  149. v-for="(item,index) in openLists" :key='index'>
  150. <image :src="item.image" style="width: 55upx;height: 55upx;border-radius: 50upx;">
  151. </image>
  152. <view style="font-size: 30upx;margin-left: 20upx;width: 70%;">
  153. {{item.name}}
  154. </view>
  155. <radio-group name="openWay" style="margin-left: 45rpx;" @tap='selectWay(item)'>
  156. <label class="tui-radio">
  157. <radio color="#3699FF" :checked="openWay == item.id ? true : false" />
  158. </label>
  159. </radio-group>
  160. </view>
  161. </view>
  162. </view>
  163. <view class="pay_btns" @click="pay()">确认支付</view>
  164. </view>
  165. </u-popup>
  166. </view>
  167. <view v-if="shangxian === '是'">
  168. <view style="line-height: 26px;padding: 32upx;" class="home1">
  169. <view style="font-size: 28upx;" v-html="content"></view>
  170. </view>
  171. </view>
  172. </view>
  173. </template>
  174. <script>
  175. import configdata from '@/common/config.js';
  176. import { waitForGlobalImages } from '@/utils/globalImageLoader'
  177. export default {
  178. data() {
  179. return {
  180. content: '',
  181. form: {
  182. driverName: '',
  183. driverColor: '',
  184. driverPlate: '',
  185. driverBrand: '',
  186. auditContent:'',
  187. // identityCardNumber: '', //证件号码
  188. dateBirth: '', //出生日期
  189. frontIdentityCard: '', //身份证正面
  190. backIdentityCard: '', //身份证反面
  191. drivingLicence: '', //驾驶证
  192. drivingYears: '', //驾龄
  193. drivingLicense: '', //行驶证
  194. driverLicense: '', //驾驶证
  195. checkCertificationMessage: '',
  196. userType: 2,
  197. province: '', // 接单省
  198. city: '', // 接单市
  199. district: '', // 接单区
  200. },
  201. drivingLicence: [],
  202. lableStyle: {
  203. color: '#000',
  204. fontSize: '28upx',
  205. fontWeight: 600,
  206. },
  207. customStyle: {
  208. backgroundColor: '#2D8FFE',
  209. color: '#FFFFFF',
  210. border: 0,
  211. width: '686rpx'
  212. },
  213. btnStyle: {
  214. backgroundColor: '#3699FF',
  215. color: '#FFFFFF',
  216. },
  217. money: 0,
  218. showAgree: false, //协议是否选择
  219. // sessionkey: '',
  220. shangxian: '',
  221. showpay: false,
  222. openWay: 1,
  223. openLists: [],
  224. indentNumber: '',
  225. disabled: false,
  226. show: false,
  227. status: -1,
  228. cityqu: '',
  229. latitude: '',
  230. longitude: '',
  231. globalImages: '',
  232. }
  233. },
  234. onLoad() {
  235. waitForGlobalImages().then((path) => {
  236. console.log('✅ 全局图片路径:', path)
  237. this.globalImages = path
  238. })
  239. this.shangxian = uni.getStorageSync('shangxian')
  240. if (this.shangxian != '是') {
  241. uni.setNavigationBarTitle({
  242. title: '司机入驻'
  243. })
  244. } else {
  245. uni.setNavigationBarTitle({
  246. title: '关于我们'
  247. })
  248. this.$Request.getT('/app/userinfo/userAgreement').then(res => {
  249. if (res.code == 0) {
  250. this.content = res.data.value;
  251. // this.tit = res.data.min
  252. }
  253. });
  254. }
  255. // #ifdef MP-WEIXIN
  256. this.openLists = [{
  257. id: 1,
  258. image: '../../static/image/icon_weixin.png',
  259. name: '微信'
  260. }]
  261. // #endif
  262. // #ifdef H5
  263. let ua = navigator.userAgent.toLowerCase();
  264. if (ua.indexOf('micromessenger') !== -1) {
  265. //公众号是否自动登录 416
  266. this.$Request.get('/app/common/type/416').then(res => {
  267. if (res.data && res.data.value && res.data.value == '是') {
  268. this.openLists = [{
  269. id: 2,
  270. image: '../../static/image/zhifubao.png',
  271. name: '支付宝'
  272. }, {
  273. id: 1,
  274. image: '../../static/image/icon_weixin.png',
  275. name: '微信'
  276. }];
  277. this.openWay = 2;
  278. } else {
  279. this.openLists = [{
  280. id: 2,
  281. image: '../../static/image/zhifubao.png',
  282. name: '支付宝'
  283. }];
  284. this.openWay = 1;
  285. }
  286. })
  287. } else {
  288. this.openLists = [{
  289. id: 2,
  290. image: '../../static/image/zhifubao.png',
  291. name: '支付宝'
  292. }];
  293. this.openWay = 1;
  294. }
  295. // #endif
  296. // #ifdef APP-PLUS
  297. this.openLists = [{
  298. id: 1,
  299. image: '../../static/image/icon_weixin.png',
  300. name: '微信'
  301. },
  302. {
  303. id: 2,
  304. image: '../../static/image/zhifubao.png',
  305. name: '支付宝'
  306. }
  307. ]
  308. // #endif
  309. this.getRZmoney()
  310. this.getUserInfo()
  311. // this.sessionkey = this.$queue.getData("sessionkey");
  312. },
  313. methods: {
  314. openMap() {
  315. let that = this
  316. uni.chooseLocation({
  317. success: function(res) {
  318. console.log('位置名称:' + res.name);
  319. console.log('详细地址:' + res.address);
  320. console.log('纬度:' + res.latitude);
  321. console.log('经度:' + res.longitude);
  322. that.latitude = res.latitude
  323. that.longitude = res.longitude
  324. that.selectCity(that.longitude, that.latitude);
  325. }
  326. });
  327. },
  328. //设置地图标记
  329. selectCity(longitude, latitude) {
  330. this.$Request.getT('/app/Login/selectCity?lat=' + latitude + '&lng=' + longitude).then(res => {
  331. if (res.code == 0) {
  332. this.form.city = res.data.city ? res.data.city : res.data.province
  333. this.form.county = res.data.district
  334. this.form.province = res.data.province
  335. this.cityqu = this.form.province + ' ' + this.form.city + ' ' + this.form.county
  336. } else {
  337. uni.showToast({
  338. title: res.msg,
  339. icon: 'none'
  340. })
  341. }
  342. })
  343. },
  344. confirm(e) {
  345. // console.log(e,'========')
  346. this.form.dateBirth = e.year + '-' + e.month + '-' + e.day
  347. },
  348. removeImg(index) {
  349. this.drivingLicence.splice(index, 1)
  350. },
  351. isShowAgree() {
  352. this.showAgree = !this.showAgree
  353. },
  354. getRZmoney() {
  355. this.$Request.get("/app/common/type/261").then(res => {
  356. if (res.code == 0) {
  357. this.money = res.data.value
  358. // this.form.cashDeposit = res.data.value
  359. }
  360. });
  361. },
  362. selectWay: function(item) {
  363. this.openWay = item.id;
  364. },
  365. submit() {
  366. let that = this
  367. // console.log(that.form)
  368. if (!that.form.driverName) {
  369. uni.showToast({
  370. title: '请输入真实姓名',
  371. icon: 'none',
  372. duration: 1000
  373. })
  374. return;
  375. }
  376. // if (!that.form.identityCardNumber) {
  377. // uni.showToast({
  378. // title: '请输入身份证号',
  379. // icon: 'none',
  380. // duration: 1000
  381. // })
  382. // return;
  383. // }
  384. if (!that.form.dateBirth) {
  385. uni.showToast({
  386. title: '请选择出生日期',
  387. icon: 'none',
  388. duration: 1000
  389. })
  390. return;
  391. }
  392. if (!that.form.drivingYears) {
  393. uni.showToast({
  394. title: '请填写驾龄',
  395. icon: 'none',
  396. duration: 1000
  397. })
  398. return;
  399. }
  400. // if (!that.cityqu) {
  401. // uni.showToast({
  402. // title: '请选择省市区',
  403. // icon: 'none',
  404. // duration: 1000
  405. // })
  406. // return;
  407. // }
  408. if (!that.form.driverBrand) {
  409. uni.showToast({
  410. title: '请填写车辆品牌',
  411. icon: 'none',
  412. duration: 1000
  413. })
  414. return;
  415. }
  416. if (!that.form.driverPlate) {
  417. uni.showToast({
  418. title: '请填写车牌号',
  419. icon: 'none',
  420. duration: 1000
  421. })
  422. return;
  423. }
  424. if (!that.form.driverColor) {
  425. uni.showToast({
  426. title: '请填写车辆颜色',
  427. icon: 'none',
  428. duration: 1000
  429. })
  430. return;
  431. }
  432. if (!that.form.frontIdentityCard) {
  433. uni.showToast({
  434. title: '请上传身份证正面',
  435. icon: 'none',
  436. duration: 1000
  437. })
  438. return;
  439. }
  440. if (!that.form.backIdentityCard) {
  441. uni.showToast({
  442. title: '请上传身份证反面',
  443. icon: 'none',
  444. duration: 1000
  445. })
  446. return;
  447. }
  448. if (!that.form.drivingLicense) {
  449. uni.showToast({
  450. title: '请上传行驶证',
  451. icon: 'none',
  452. duration: 1000
  453. })
  454. return;
  455. }
  456. if (!that.form.driverLicense) {
  457. uni.showToast({
  458. title: '请上传驾驶证',
  459. icon: 'none',
  460. duration: 1000
  461. })
  462. return;
  463. }
  464. if (!that.showAgree) {
  465. uni.showToast({
  466. title: '请勾选师傅入驻协议',
  467. icon: 'none',
  468. duration: 1000
  469. })
  470. return;
  471. }
  472. // that.showpay = true
  473. let userId = this.$queue.getData('userId');
  474. that.$Request.postJson('/app/driver/insertDriver?userId=' + userId,that.form).then(res =>{
  475. uni.hideLoading();
  476. if(res.code == 0){
  477. that.$queue.showToast('提交成功!')
  478. setTimeout(d =>{
  479. uni.navigateBack();
  480. },1500)
  481. }else{
  482. that.$queue.showToast(res.msg);
  483. }
  484. });
  485. },
  486. getUserInfo() {
  487. let userId = this.$queue.getData('userId');
  488. this.$Request.getT("/app/driver/selectDriverByUserId?userId=" + userId).then(res => {
  489. if (res.code == 0 && res.data) {
  490. this.form.driverName = res.data.driverName ? res.data.driverName : ''
  491. // this.form.identityCardNumber = res.data.identityCardNumber ? res.data.identityCardNumber : ''
  492. this.form.auditContent = res.data.auditContent ? res.data.auditContent : ''
  493. this.form.dateBirth = res.data.dateBirth ? res.data.dateBirth : ''
  494. this.form.backIdentityCard = res.data.backIdentityCard ? res.data.backIdentityCard : ''
  495. this.form.frontIdentityCard = res.data.frontIdentityCard ? res.data.frontIdentityCard : ''
  496. this.form.drivingLicense = res.data.drivingLicense ? res.data.drivingLicense : ''
  497. this.form.driverLicense = res.data.driverLicense ? res.data.driverLicense : ''
  498. this.form.driverColor = res.data.driverColor ? res.data.driverColor : ''
  499. this.form.driverPlate = res.data.driverPlate ? res.data.driverPlate : ''
  500. this.form.driverBrand = res.data.driverBrand ? res.data.driverBrand : ''
  501. this.form.drivingYears = res.data.drivingYears ? res.data.drivingYears : ''
  502. this.form.drivingLicence = res.data.drivingLicence ? res.data.drivingLicence : ''
  503. if (res.data.drivingLicence) {
  504. this.drivingLicence = res.data.drivingLicence.split(',')
  505. }
  506. this.form.city = res.data.city ? res.data.city : res.data.province
  507. this.form.county = res.data.district ? res.data.district : ''
  508. this.form.province = res.data.province ? res.data.province : ''
  509. // if (this.form.city) {
  510. // this.cityqu = this.form.province + ' ' + this.form.city + ' ' + this.form.county
  511. // }
  512. if (res.data.status == 1 || res.data.status == 2) {
  513. this.disabled = true
  514. }
  515. // if (res.data.status == 2) {
  516. // this.form.checkCertificationMessage = res.data.checkCertificationMessage ? res.data
  517. // .checkCertificationMessage : ''
  518. // }
  519. this.status = res.data.status
  520. //状态 1待审核 2已通过 3已拒绝
  521. }
  522. });
  523. },
  524. addImages(e) {
  525. uni.chooseImage({
  526. count: 1,
  527. sourceType: ['album', 'camera'],
  528. success: res => {
  529. for (let i = 0; i < 1; i++) {
  530. this.$queue.showLoading("上传中...");
  531. uni.uploadFile({ // 上传接口
  532. // url: this.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  533. url: 'https://shunfengcheshop.xianmxkj.com/sqx_fast/alioss/upload',
  534. filePath: res.tempFilePaths[i],
  535. name: 'file',
  536. success: (uploadFileRes) => {
  537. console.log(uploadFileRes)
  538. if (e == 1) {
  539. this.form.frontIdentityCard = JSON.parse(uploadFileRes
  540. .data).data
  541. } else if (e == 2) {
  542. this.form.backIdentityCard = JSON.parse(uploadFileRes
  543. .data).data
  544. } else if (e == 3) {
  545. this.form.drivingLicense = JSON.parse(uploadFileRes
  546. .data).data
  547. } else if(e == 4){
  548. this.form.driverLicense = JSON.parse(uploadFileRes
  549. .data).data
  550. }
  551. uni.hideLoading();
  552. }
  553. });
  554. }
  555. }
  556. })
  557. },
  558. addImage() {
  559. let count = 6 - this.drivingLicence.length
  560. uni.chooseImage({
  561. count: count,
  562. sourceType: ['album', 'camera'],
  563. success: res => {
  564. for (let i = 0; i < res.tempFilePaths.length; i++) {
  565. this.$queue.showLoading("上传中...");
  566. uni.uploadFile({ // 上传接口
  567. url: this.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  568. filePath: res.tempFilePaths[i],
  569. name: 'file',
  570. success: (uploadFileRes) => {
  571. // console.log(uploadFileRes)
  572. this.drivingLicence.push(JSON.parse(uploadFileRes.data).data)
  573. uni.hideLoading();
  574. }
  575. });
  576. }
  577. }
  578. })
  579. },
  580. config: function(name) {
  581. var info = null;
  582. if (name) {
  583. var name2 = name.split("."); //字符分割
  584. if (name2.length > 1) {
  585. info = configdata[name2[0]][name2[1]] || null;
  586. } else {
  587. info = configdata[name] || null;
  588. }
  589. if (info == null) {
  590. let web_config = cache.get("web_config");
  591. if (web_config) {
  592. if (name2.length > 1) {
  593. info = web_config[name2[0]][name2[1]] || null;
  594. } else {
  595. info = web_config[name] || null;
  596. }
  597. }
  598. }
  599. }
  600. return info;
  601. },
  602. pay() {
  603. if (this.openWay == 0) {
  604. this.$queue.showToast('请选择支付方式!')
  605. return;
  606. }
  607. this.form.drivingLicence = this.drivingLicence
  608. this.form.drivingLicence = this.form.drivingLicence.toString()
  609. if (this.openWay == 1) {
  610. console.log('微信')
  611. // #ifdef APP-PLUS
  612. // 微信APP支付 根据订单id获取支付信息
  613. this.$Request.postJson("/app/wxPayRider/appRiderCertification", this.form).then(res => {
  614. console.log(JSON.stringify(res), '微信支付信息')
  615. this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data));
  616. });
  617. // #endif
  618. // #ifdef H5
  619. // 微信APP支付 根据订单id获取支付信息
  620. this.$Request.postJson("/app/wxPayRider/wxPayMpRiderCertification", this.form).then(res => {
  621. console.log(JSON.stringify(res), '微信支付信息')
  622. this.callPay(res.data);
  623. });
  624. // #endif
  625. // #ifdef MP-WEIXIN
  626. let that = this
  627. that.$Request.postJson("/app/wxPayRider/wxPayJsApiRiderCertification", that.form).then(res => {
  628. if (res.code == 0) {
  629. uni.requestPayment({
  630. provider: 'wxpay',
  631. timeStamp: res.data.timestamp,
  632. nonceStr: res.data.noncestr,
  633. package: res.data.package,
  634. signType: res.data.signType,
  635. paySign: res.data.sign,
  636. success: function(res) {
  637. console.log(res)
  638. uni.hideLoading();
  639. uni.showToast({
  640. title: '实名认证提交成功',
  641. icon: 'none'
  642. });
  643. setTimeout(function() {
  644. uni.navigateBack(1)
  645. }, 1000)
  646. },
  647. fail: function(err) {
  648. console.log('fail:' + JSON.stringify(err));
  649. uni.hideLoading();
  650. that.$queue.showToast('支付失败');
  651. }
  652. });
  653. } else {
  654. uni.showToast({
  655. title: res.msg,
  656. icon: 'none'
  657. })
  658. }
  659. });
  660. // #endif
  661. } else {
  662. // APP支付宝支付
  663. // #ifdef H5
  664. this.form.payType = 5
  665. this.$Request.postJson('/app/aliPay/aliPayRiderCertification', this.form).then(
  666. res => {
  667. if (res.code == 0) {
  668. const div = document.createElement('div')
  669. div.innerHTML = res.data //此处form就是后台返回接收到的数据
  670. document.body.appendChild(div)
  671. document.forms[0].submit()
  672. } else {
  673. uni.showToast({
  674. icon: 'none',
  675. title: '支付失败!'
  676. });
  677. }
  678. });
  679. // #endif
  680. // #ifdef APP
  681. this.form.payType = 4
  682. this.$Request.postJson("/app/aliPay/aliPayRiderCertification", this.form).then(res => {
  683. console.log(JSON.stringify(res), '支付宝支付信息')
  684. this.isCheckPay(res.code, 'alipay', res.data)
  685. });
  686. // #endif
  687. }
  688. },
  689. callPay: function(response) {
  690. if (typeof WeixinJSBridge === "undefined") {
  691. if (document.addEventListener) {
  692. document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
  693. } else if (document.attachEvent) {
  694. document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
  695. document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
  696. }
  697. } else {
  698. this.onBridgeReady(response);
  699. }
  700. },
  701. onBridgeReady: function(response) {
  702. let that = this;
  703. // if (!response.package) {
  704. // return;
  705. // }
  706. console.log(response, 111111)
  707. WeixinJSBridge.invoke(
  708. 'getBrandWCPayRequest', {
  709. "appId": response.appid, //公众号名称,由商户传入
  710. "timeStamp": response.timestamp, //时间戳,自1970年以来的秒数
  711. "nonceStr": response.noncestr, //随机串
  712. "package": response.package,
  713. "signType": response.signType, //微信签名方式:
  714. "paySign": response.sign //微信签名
  715. },
  716. function(res) {
  717. console.log(res, '/*-/*-/*-')
  718. if (res.err_msg === "get_brand_wcpay_request:ok") {
  719. // 使用以上方式判断前端返回,微信团队郑重提示:
  720. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  721. uni.showLoading({
  722. title: '支付成功'
  723. });
  724. setTimeout(function() {
  725. uni.hideLoading();
  726. uni.navigateBack()
  727. }, 1000);
  728. } else {
  729. uni.hideLoading();
  730. }
  731. WeixinJSBridge.log(response.err_msg);
  732. }
  733. );
  734. },
  735. isCheckPay(status, name, order) {
  736. if (status == 0) {
  737. this.setPayment(name, order);
  738. } else {
  739. uni.hideLoading();
  740. uni.showToast({
  741. title: '支付信息有误',
  742. icon: 'none'
  743. });
  744. }
  745. },
  746. setPayment(name, order) {
  747. console.log(name, '*-*-*', order)
  748. uni.requestPayment({
  749. provider: name,
  750. orderInfo: order, //微信、支付宝订单数据
  751. success: function(res) {
  752. console.log(res)
  753. uni.hideLoading();
  754. uni.showLoading({
  755. title: '支付成功'
  756. });
  757. setTimeout(function() {
  758. uni.navigateBack()
  759. }, 1000);
  760. },
  761. fail: function(err) {
  762. console.log(err)
  763. uni.hideLoading();
  764. },
  765. complete() {
  766. uni.hideLoading();
  767. }
  768. });
  769. },
  770. }
  771. }
  772. </script>
  773. <style lang="less">
  774. page {
  775. background: #F5F5F5;
  776. }
  777. .footer {
  778. /* // padding-left: 140upx; */
  779. /* justify-content: center; */
  780. margin-top: 32upx;
  781. font-size: 24upx;
  782. color: #666666;
  783. display: flex;
  784. // text-align: center;
  785. // align-items: center;
  786. }
  787. /* 支付弹框 */
  788. .popup_pay {
  789. width: 100%;
  790. }
  791. .pay_btns {
  792. width: 90%;
  793. margin: 0 auto 40rpx;
  794. text-align: center;
  795. background: #3699FF;
  796. height: 80rpx;
  797. border-radius: 16rpx;
  798. color: #ffffff;
  799. line-height: 80rpx;
  800. margin-top: 20rpx;
  801. }
  802. </style>