index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. <template>
  2. <view style="padding-bottom: 100upx;">
  3. <view class="text-center text-red bg-white">{{form.remek}}</view>
  4. <view class="hb" style="width: 100%;">
  5. <view class="flex text-center text-white text-lg bg">
  6. <view class="title_btn flex-sub bg" @click="cut(1)" :class="title_color==1?'bgCol2': ''">个人认证
  7. </view>
  8. <view class="title_btn flex-sub bg" @click="cut(2)" :class="title_color==2?'bgCol2': ''">企业认证
  9. </view>
  10. </view>
  11. <view class=" padding" v-if="title_color==1">
  12. <view class=" padding bg radius">
  13. <u-form :model="form" ref="uForm" label-position="top" :label-style='lableStyle'>
  14. <u-form-item label="真实姓名" :border-bottom='false'>
  15. <u-input placeholder="请输入真实姓名" v-model="form.name" maxlength="11" />
  16. </u-form-item>
  17. <u-form-item label="证件号码" :border-bottom='false'>
  18. <u-input placeholder="请输入身份证号码" v-model="form.idNumber" />
  19. </u-form-item>
  20. <u-form-item label="出生日期" :border-bottom='false'>
  21. <u-input placeholder="请填写(必填)" v-model="form.birthdate" type="select"
  22. @click="birthData()" />
  23. </u-form-item>
  24. <u-form-item label="性别" :border-bottom='false'>
  25. <u-input placeholder="请填写(必填)" v-model="form.sex" type="select" @click="bindSex()" />
  26. </u-form-item>
  27. <u-form-item label="联系方式" :border-bottom='false'>
  28. <u-input placeholder="请填写(必填)" v-model="form.phone" type="number" maxlength="11" />
  29. </u-form-item>
  30. </u-form>
  31. </view>
  32. <view class=" padding bg radius margin-top">
  33. <view>
  34. <view class="text-lg margin-top-sm">上传身份证正面</view>
  35. <view class="flex" style="overflow: hidden;flex-direction: initial;">
  36. <view v-if="form.front.length">
  37. <view class="margin-top flex margin-right-sm">
  38. <view class="flex"
  39. style="width: 200rpx;height: 200rpx;margin-right: 10rpx;position: relative;">
  40. <image :src="form.front" style="width: 100%;height: 100%;"></image>
  41. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  42. @click="frontRemove(1)">
  43. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="margin-top" @click="addImage(1)" v-if="form.front.length<=0">
  49. <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
  50. class="flex justify-center align-center">
  51. <view>
  52. <view class="text-center">
  53. <image src="../../static/images/my/add.png"
  54. style="width: 65rpx;height: 55rpx;"></image>
  55. </view>
  56. <view class="text-center">添加图片</view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view>
  63. <view class="text-lg margin-top-sm">上传身份证反面</view>
  64. <view class="flex" style="overflow: hidden;flex-direction: initial;">
  65. <view v-if="form.back.length">
  66. <view class="margin-top flex margin-right-sm">
  67. <view class="flex"
  68. style="width: 200rpx;height: 200rpx;margin-right: 10rpx;position: relative;">
  69. <image :src="form.back" style="width: 100%;height: 100%;"></image>
  70. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  71. @click="backRemove()">
  72. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="margin-top" @click="addImage(2)" v-if="form.back.length<=0">
  78. <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
  79. class="flex justify-center align-center">
  80. <view>
  81. <view class="text-center">
  82. <image src="../../static/images/my/add.png"
  83. style="width: 65rpx;height: 55rpx;"></image>
  84. </view>
  85. <view class="text-center">添加图片</view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <view>
  92. <view class="text-lg margin-top-sm">母婴护理师证</view>
  93. <view class="flex" style="overflow: hidden;flex-wrap: wrap;">
  94. <view v-if="infantImg.length">
  95. <view class="margin-top flex margin-right-sm flex-wrap">
  96. <view class="flex"
  97. style="width: 200rpx;height: 200rpx;margin-right: 5rpx;position: relative;"
  98. v-for="(image,index) in infantImg" :key="index">
  99. <image :src="image" style="width: 100%;height: 100%;"></image>
  100. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  101. @click="infantImgremove(index)">
  102. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <view class="margin-top" @click="addImages(3)" v-if="infantImg.length<6">
  108. <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
  109. class="flex justify-center align-center">
  110. <view>
  111. <view class="text-center">
  112. <image src="../../static/images/my/add.png"
  113. style="width: 65rpx;height: 55rpx;"></image>
  114. </view>
  115. <view class="text-center">添加图片</view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <view>
  122. <view class="text-lg margin-top-sm">育婴师资格证书</view>
  123. <view class="flex" style="overflow: hidden;flex-wrap: wrap;">
  124. <view v-if="infantImgs.length">
  125. <view class="margin-top flex margin-right-sm flex-wrap">
  126. <view class="flex"
  127. style="width: 200rpx;height: 200rpx;margin-right: 5rpx;position: relative;"
  128. v-for="(image,index) in infantImgs" :key="index">
  129. <image :src="image" style="width: 100%;height: 100%;"></image>
  130. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  131. @click="infantImgsremove(index)">
  132. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. <view class="margin-top" @click="addImages(4)" v-if="infantImgs.length<6">
  138. <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
  139. class="flex justify-center align-center">
  140. <view>
  141. <view class="text-center">
  142. <image src="../../static/images/my/add.png"
  143. style="width: 65rpx;height: 55rpx;"></image>
  144. </view>
  145. <view class="text-center">添加图片</view>
  146. </view>
  147. </view>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. <view class="tabbar">
  153. <view>
  154. 支付:<text style="color: #F1413D;">¥200</text>
  155. </view>
  156. <view v-if="renzheng==0||renzheng==6||renzheng==3">
  157. <u-button @click="submit" class="margin-top" :custom-style="customStyle" shape="circle"
  158. :hair-line="false">提交并支付
  159. </u-button>
  160. </view>
  161. </view>
  162. </view>
  163. <view class=" padding" v-if="title_color==2">
  164. <view class=" padding bg radius">
  165. <u-form :model="forms" ref="uForm" label-position="top" :label-style='lableStyle'>
  166. <u-form-item label="企业姓名" :border-bottom='false'>
  167. <u-input placeholder="请输入企业姓名" v-model="forms.name" />
  168. </u-form-item>
  169. <u-form-item label="企业地址" :border-bottom='false'>
  170. <u-input placeholder="请输入企业地址" v-model="forms.address" />
  171. </u-form-item>
  172. <u-form-item label="联系方式" :border-bottom='false'>
  173. <u-input placeholder="请输入电话号码" v-model="forms.phone" type="number" maxlength="11" />
  174. </u-form-item>
  175. </u-form>
  176. </view>
  177. <view class=" padding bg radius margin-top">
  178. <view>
  179. <view class="text-lg margin-top-sm">上传营业执照正面</view>
  180. <view class="flex" style="overflow: hidden;flex-direction: initial;">
  181. <view v-if="forms.front.length">
  182. <view class="margin-top flex margin-right-sm">
  183. <view class="flex"
  184. style="width: 200rpx;height: 200rpx;margin-right: 10rpx;position: relative;">
  185. <image :src="forms.front" style="width: 100%;height: 100%;"></image>
  186. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  187. @click="frontRemove(2)">
  188. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  189. </view>
  190. </view>
  191. </view>
  192. </view>
  193. <view class="margin-top" @click="addImage(0)" v-if="forms.front.length<=0">
  194. <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
  195. class="flex justify-center align-center">
  196. <view>
  197. <view class="text-center">
  198. <image src="../../static/images/my/add.png"
  199. style="width: 65rpx;height: 55rpx;"></image>
  200. </view>
  201. <view class="text-center">添加图片</view>
  202. </view>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. </view>
  209. <view class="margin-lr bg radius " style="margin-bottom: 240rpx;">
  210. <view class="padding">
  211. <view style="color: #005DFF;">缴纳保证金</view>
  212. <view class="flex justify-between align-center" style="line-height: 60rpx;">
  213. <view style="color: #999999;" class="text-sm">满足一定条件即可申请返还保证金</view>
  214. <view style="color: #F1413D;">¥{{money}}</view>
  215. </view>
  216. </view>
  217. </view>
  218. <view class="tabbar">
  219. <view>
  220. 支付:<text style="color: #F1413D;">¥{{money}}</text>
  221. </view>
  222. <view v-if="renzheng==0||renzheng==6||renzheng==3">
  223. <u-button @click="submit" class="margin-top" :custom-style="customStyle" shape="circle"
  224. :hair-line="false">提交并支付
  225. </u-button>
  226. </view>
  227. </view>
  228. </view>
  229. <!-- 性别选择 -->
  230. <u-action-sheet :list="actionSheetList" v-model="show" @click="actionSheetCallback"></u-action-sheet>
  231. <!-- 出生日期 -->
  232. <u-picker v-model="showData" :params="params" @confirm="bindData"></u-picker>
  233. <!-- 支付方式 -->
  234. <u-popup v-model="showpay" mode="bottom" :closeable="closeable">
  235. <view class="popup_pay">
  236. <view style="background-color: #fff;">
  237. <view style="padding: 0 20upx;margin-top: 60rpx;margin-bottom: 20rpx;">
  238. <view
  239. style="display: flex;height: 100upx;align-items: center;padding: 20upx 0;justify-content: center;"
  240. v-for="(item,index) in openLists" :key='index'>
  241. <image :src="item.image" style="width: 55upx;height: 55upx;border-radius: 50upx;">
  242. </image>
  243. <view style="font-size: 30upx;margin-left: 20upx;width: 70%;">
  244. {{item.text}}
  245. </view>
  246. <radio-group name="openWay" style="margin-left: 45upx;" @tap='selectWay(item)'>
  247. <label class="tui-radio">
  248. <radio color="#2FB57A" :checked="openWay === item.id ? true : false" />
  249. </label>
  250. </radio-group>
  251. </view>
  252. </view>
  253. </view>
  254. <view class="pay_btn" @click="pay()">确认支付</view>
  255. </view>
  256. </u-popup>
  257. </view>
  258. </template>
  259. <script>
  260. import configdata from '../../common/config.js';
  261. export default {
  262. data() {
  263. return {
  264. title_color: 1,
  265. classify: 1,
  266. bgCol2: '#557EFD',
  267. form: {
  268. name: '',
  269. idNumber: '',
  270. front: '',
  271. back: '',
  272. remek: '',
  273. sex: '',
  274. sexs: 0,
  275. birthdate: '',
  276. birth: '',
  277. phone: '',
  278. //母婴护理师证
  279. infant: [],
  280. //育婴师资格证书
  281. infantImgs: [],
  282. },
  283. forms: {
  284. name: '',
  285. address: '',
  286. idNumber: '',
  287. front: '',
  288. back: ''
  289. },
  290. // disabled: false,
  291. lableStyle: {
  292. color: '#000000',
  293. fontSize: '36upx'
  294. },
  295. customStyle: {
  296. backgroundColor: '#005DFF',
  297. color: '#ffffff',
  298. border: 0
  299. },
  300. customStyle1: {
  301. backgroundColor: '#ccc',
  302. color: '#000000',
  303. border: 0
  304. },
  305. renzheng: '',
  306. show: false,
  307. actionSheetList: [{
  308. text: '男',
  309. }, {
  310. text: '女',
  311. }],
  312. showData: false,
  313. params: {
  314. year: true,
  315. month: true,
  316. day: true,
  317. hour: false,
  318. minute: false,
  319. second: false
  320. },
  321. //母婴护理师证
  322. infantImg: [],
  323. //育婴师资格证书
  324. infantImgs: [],
  325. money: 0,
  326. showpay: false,
  327. openLists: [],
  328. openWay: 1,
  329. sex: 0,
  330. closeable: true
  331. }
  332. },
  333. onLoad(e) {
  334. console.log(e)
  335. this.classify = parseInt(e.classify)
  336. // console.log(parseInt(e.classify))
  337. this.title_color = this.classify
  338. // console.log(this.title_color,this.classify)
  339. this.getUserInfo()
  340. this.renzheng = uni.getStorageSync("renzheng")
  341. // #ifdef APP
  342. this.openLists = [{
  343. image: '../../static/images/icon_weixin.png',
  344. text: '微信支付',
  345. id: 1
  346. }, {
  347. image: '../../static/images/zhifubao.png',
  348. text: '支付宝支付',
  349. id: 2
  350. }],
  351. this.openWay = 1;
  352. // #endif
  353. // #ifdef MP-WEIXIN
  354. this.openLists = [{
  355. image: '../../static/images/icon_weixin.png',
  356. text: '微信支付',
  357. id: 1
  358. }],
  359. this.openWay = 1;
  360. // #endif
  361. // #ifdef H5
  362. this.openLists = [{
  363. image: '../../static/images/zhifubao.png',
  364. text: '支付宝支付',
  365. id: 2
  366. }]
  367. this.openWay = 2;
  368. // #endif
  369. },
  370. onShow() {
  371. this.Getmoney()
  372. },
  373. methods: {
  374. //日期弹框
  375. birthData() {
  376. this.showData = true
  377. },
  378. //性别选择
  379. bindSex() {
  380. this.show = true
  381. },
  382. //支付方式
  383. selectWay(item) {
  384. this.openWay = item.id;
  385. },
  386. // 保证金
  387. Getmoney() {
  388. this.$Request.get("/app/common/type/239").then(res => {
  389. console.log(res)
  390. if (res.code == 0) {
  391. this.money = res.data.value
  392. }
  393. });
  394. },
  395. // 点击actionSheet回调 性别
  396. actionSheetCallback(index) {
  397. console.log(index)
  398. this.sex = index
  399. this.form.sex = this.actionSheetList[index].text;
  400. // this.from.sexs = this.actionSheetList[index].label;
  401. console.log(this.sex)
  402. },
  403. //出生日期
  404. bindData(e) {
  405. console.log(e)
  406. this.form.birthdate = e.year + '年' + e.month + '月' + e.day + '日'
  407. this.form.birth = e.year + '-' + e.month + '-' + e.day
  408. },
  409. cut(e) {
  410. this.title_color = e
  411. console.log(this.title_color)
  412. if (this.title_color == 1) {
  413. this.classify = this.title_color
  414. console.log(this.title_color, this.classify)
  415. } else if (this.title_color == 2) {
  416. this.classify = this.title_color
  417. console.log(this.title_color, this.classify)
  418. }
  419. this.getUserInfo()
  420. },
  421. //身份证删除
  422. frontRemove(index) {
  423. if (index == 1) {
  424. this.form.front = ''
  425. } else if (index == 2) {
  426. this.forms.front = ''
  427. }
  428. },
  429. backRemove() {
  430. this.form.back = ''
  431. },
  432. infantImgremove(index) {
  433. this.infantImg.splice(index, 1)
  434. },
  435. infantImgsremove(index) {
  436. this.infantImgs.splice(index, 1)
  437. },
  438. submit() {
  439. this.form.infantImg = this.infantImg
  440. this.form.infantImg = this.form.infantImg.toString();
  441. this.form.infantImgs = this.infantImgs
  442. this.form.infantImgs = this.form.infantImgs.toString();
  443. if (this.classify == 1) {
  444. if (!this.form.name) {
  445. uni.showToast({
  446. title: '请输入真实姓名',
  447. icon: 'none',
  448. duration: 1000
  449. })
  450. return;
  451. }
  452. if (!this.form.idNumber) {
  453. uni.showToast({
  454. title: '请输入身份证号',
  455. icon: 'none',
  456. duration: 1000
  457. })
  458. return;
  459. }
  460. let regX =
  461. /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
  462. if (!regX.test(this.form.idNumber)) {
  463. uni.showToast({
  464. title: '请输入正确的身份证号',
  465. icon: 'none',
  466. duration: 1000
  467. })
  468. return;
  469. }
  470. if (!this.form.birthdate) {
  471. uni.showToast({
  472. title: '请输入出生日期',
  473. icon: 'none',
  474. duration: 1000
  475. })
  476. return;
  477. }
  478. if (!this.form.sex) {
  479. uni.showToast({
  480. title: '请输入性别',
  481. icon: 'none',
  482. duration: 1000
  483. })
  484. return;
  485. }
  486. if (!this.form.phone) {
  487. uni.showToast({
  488. title: '请输入联系方式',
  489. icon: 'none',
  490. duration: 1000
  491. })
  492. return;
  493. }
  494. if (!this.form.front) {
  495. uni.showToast({
  496. title: '请上传身份证正面',
  497. icon: 'none',
  498. duration: 1000
  499. })
  500. return;
  501. }
  502. if (!this.form.back) {
  503. uni.showToast({
  504. title: '请上传身份证反面',
  505. icon: 'none',
  506. duration: 1000
  507. })
  508. return;
  509. }
  510. if (!this.form.infantImg) {
  511. uni.showToast({
  512. title: '请上传母婴护理师证',
  513. icon: 'none',
  514. duration: 1000
  515. })
  516. return;
  517. }
  518. if (!this.form.infantImgs) {
  519. uni.showToast({
  520. title: '请上传育婴师资格证书',
  521. icon: 'none',
  522. duration: 1000
  523. })
  524. return;
  525. }
  526. }
  527. if (this.classify == 2) {
  528. if (!this.forms.name) {
  529. uni.showToast({
  530. title: '请输入企业姓名',
  531. icon: 'none',
  532. duration: 1000
  533. })
  534. return;
  535. }
  536. if (!this.forms.address) {
  537. uni.showToast({
  538. title: '请输入企业地址',
  539. icon: 'none',
  540. duration: 1000
  541. })
  542. return;
  543. }
  544. if (!this.forms.phone) {
  545. uni.showToast({
  546. title: '请输入电话号码',
  547. icon: 'none',
  548. duration: 1000
  549. })
  550. return;
  551. }
  552. if (!this.forms.front) {
  553. uni.showToast({
  554. title: '请上传营业执照正面',
  555. icon: 'none',
  556. duration: 1000
  557. })
  558. return;
  559. }
  560. }
  561. this.showpay = true
  562. },
  563. getUserInfo() {
  564. console.log(this.classify, '222222222')
  565. this.$Request.get("/app/userCertification/queryInsert?classify=" + this.classify).then(res => {
  566. console.log(res)
  567. if (res.code == 0) {
  568. uni.setStorageSync('classify', res.data.classify)
  569. // this.classify = res.data.classify
  570. if (res.data.classify == 1) {
  571. this.form.name = res.data.name ? res.data.name : ''
  572. this.form.idNumber = res.data.idNumber ? res.data.idNumber : ''
  573. this.form.front = res.data.front ? res.data.front : ''
  574. this.form.back = res.data.back ? res.data.back : ''
  575. this.classify = res.data.classify
  576. this.form.birthdate = res.data.birthdate
  577. this.sex = res.data.sex
  578. if (res.data.sex == 0) {
  579. this.form.sex = '男'
  580. } else if (res.data.sex == 1) {
  581. this.form.sex = '女'
  582. }
  583. this.form.phone = res.data.phone
  584. this.infantImg = res.data.infantImg.split(',')
  585. this.form.infantImg = res.data.infantImg
  586. this.infantImgs = res.data.infantImgs.split(',')
  587. this.form.infantImgs = res.data.infantImgs;
  588. } else if (res.data.classify == 2) {
  589. this.classify = res.data.classify
  590. this.forms.name = res.data.name ? res.data.name : ''
  591. this.forms.address = res.data.address ? res.data.address : ''
  592. this.forms.phone = res.data.phone ? res.data.phone : ''
  593. this.forms.front = res.data.front ? res.data.front : ''
  594. }
  595. if (res.data.status == 1) {
  596. this.disabled = true
  597. }
  598. if (res.data.status == 2) {
  599. this.form.remek = res.data.remek ? res.data.remek : ''
  600. }
  601. }
  602. });
  603. },
  604. addImages(e) {
  605. uni.chooseImage({
  606. count: 6,
  607. sourceType: ['album', 'camera'],
  608. success: res => {
  609. for (let i = 0; i < res.tempFilePaths.length; i++) {
  610. this.$queue.showLoading("上传中...");
  611. uni.uploadFile({ // 上传接口
  612. url: this.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  613. filePath: res.tempFilePaths[i],
  614. name: 'file',
  615. success: (uploadFileRes) => {
  616. if (e == 1) {
  617. this.form.front = JSON.parse(uploadFileRes.data).data
  618. // that.form.front.push(JSON.parse(uploadFileRes.data).data)
  619. } else if (e == 2) {
  620. this.form.back = JSON.parse(uploadFileRes.data).data
  621. } else if (e == 3) {
  622. if (this.infantImg.length <= 5) {
  623. this.infantImg.push(JSON.parse(uploadFileRes.data)
  624. .data)
  625. }
  626. } else if (e == 4) {
  627. if (this.infantImgs.length <= 5) {
  628. this.infantImgs.push(JSON.parse(uploadFileRes.data)
  629. .data)
  630. }
  631. } else if (e == 0) {
  632. this.forms.front = JSON.parse(uploadFileRes.data).data
  633. }
  634. uni.hideLoading();
  635. }
  636. });
  637. }
  638. }
  639. })
  640. },
  641. addImage(e) {
  642. uni.chooseImage({
  643. count: 1,
  644. sourceType: ['album', 'camera'],
  645. success: res => {
  646. for (let i = 0; i < res.tempFilePaths.length; i++) {
  647. this.$queue.showLoading("上传中...");
  648. uni.uploadFile({ // 上传接口
  649. url: this.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  650. filePath: res.tempFilePaths[i],
  651. name: 'file',
  652. success: (uploadFileRes) => {
  653. if (e == 1) {
  654. this.form.front = JSON.parse(uploadFileRes.data).data
  655. // that.form.front.push(JSON.parse(uploadFileRes.data).data)
  656. } else if (e == 2) {
  657. this.form.back = JSON.parse(uploadFileRes.data).data
  658. } else if (e == 0) {
  659. this.forms.front = JSON.parse(uploadFileRes.data).data
  660. }
  661. uni.hideLoading();
  662. }
  663. });
  664. }
  665. }
  666. })
  667. },
  668. config: function(name) {
  669. var info = null;
  670. if (name) {
  671. var name2 = name.split("."); //字符分割
  672. if (name2.length > 1) {
  673. info = configdata[name2[0]][name2[1]] || null;
  674. } else {
  675. info = configdata[name] || null;
  676. }
  677. if (info == null) {
  678. let web_config = cache.get("web_config");
  679. if (web_config) {
  680. if (name2.length > 1) {
  681. info = web_config[name2[0]][name2[1]] || null;
  682. } else {
  683. info = web_config[name] || null;
  684. }
  685. }
  686. }
  687. }
  688. return info;
  689. },
  690. pay() {
  691. let data
  692. if (this.classify == 1) {
  693. let userId = uni.getStorageSync('userId')
  694. data = {
  695. name: this.form.name,
  696. idNumber: this.form.idNumber,
  697. birthdate: this.form.birth,
  698. sex: this.sex,
  699. phone: this.form.phone,
  700. front: this.form.front,
  701. back: this.form.back,
  702. remek: this.form.remek,
  703. infantImg: this.form.infantImg,
  704. infantImgs: this.form.infantImgs,
  705. classify: this.classify,
  706. userId: userId
  707. }
  708. }
  709. if (this.classify == 2) {
  710. let userId = uni.getStorageSync('userId')
  711. data = {
  712. name: this.forms.name,
  713. address: this.forms.address,
  714. phone: this.forms.phone,
  715. classify: this.classify,
  716. front: this.forms.front,
  717. userId: userId,
  718. }
  719. }
  720. console.log(data, 'pppp1')
  721. this.showpay = false
  722. if (this.openWay == 1) { //微信支付
  723. // #ifdef MP-WEIXIN
  724. this.$Request.postJson('/app/wxPay/wxPayJsApiUserCertification', data).then(res => {
  725. console.log(res)
  726. if (res.code == 0) {
  727. // this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data));
  728. uni.requestPayment({
  729. provider: 'wxpay',
  730. timeStamp: res.data.timestamp,
  731. nonceStr: res.data.noncestr,
  732. package: res.data.package,
  733. signType: res.data.signType,
  734. paySign: res.data.sign,
  735. success: function(res) {
  736. console.log(res)
  737. // uni.showLoading({
  738. // title: '支付成功',
  739. // icon:'nones'
  740. // });
  741. // this.$queue.showToast('支付成功');
  742. uni.switchTab({
  743. url: '/pages/my/index'
  744. })
  745. },
  746. fail: function(err) {
  747. this.$queue.showToast('支付失败');
  748. }
  749. });
  750. }
  751. });
  752. // #endif
  753. // #ifdef H5
  754. this.$Request.postJson('/app/wxPay/wxPayMpUserCertification', data).then(res => {
  755. this.showpay = false
  756. that.callPay(res);
  757. });
  758. // #endif
  759. // #ifdef APP
  760. this.$Request.postJson('/app/wxPay/payAppUserCertification', data).then(res => {
  761. console.log(res)
  762. this.showpay = false
  763. if (res.code == 0) {
  764. this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data));
  765. }
  766. });
  767. // #endif
  768. } else if (this.openWay == 2) { //支付宝支付
  769. // #ifdef H5
  770. this.$Request.postJson('/app/aliPay/payOrderUserCertification', data).then(
  771. res => {
  772. this.showpay = false
  773. const div = document.createElement('div')
  774. div.innerHTML = res.data //此处form就是后台返回接收到的数据
  775. document.body.appendChild(div)
  776. document.forms[0].submit()
  777. });
  778. // #endif
  779. // #ifdef APP-PLUS
  780. this.$Request.postJson('/app/aliPay/payAppUserCertification', data).then(
  781. res => {
  782. this.showpay = false
  783. this.setPayment('alipay', res.data);
  784. });
  785. // #endif
  786. }
  787. },
  788. callPay: function(response) {
  789. if (typeof WeixinJSBridge === "undefined") {
  790. if (document.addEventListener) {
  791. document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
  792. } else if (document.attachEvent) {
  793. document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
  794. document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
  795. }
  796. } else {
  797. this.onBridgeReady(response);
  798. }
  799. },
  800. onBridgeReady: function(response) {
  801. let that = this;
  802. if (!response.package) {
  803. return;
  804. }
  805. WeixinJSBridge.invoke(
  806. 'getBrandWCPayRequest', {
  807. "appId": response.appid, //公众号名称,由商户传入
  808. "timeStamp": response.timestamp, //时间戳,自1970年以来的秒数
  809. "nonceStr": response.noncestr, //随机串
  810. "package": response.package,
  811. "signType": response.signType, //微信签名方式:
  812. "paySign": response.sign //微信签名
  813. },
  814. function(res) {
  815. if (res.err_msg === "get_brand_wcpay_request:ok") {
  816. // 使用以上方式判断前端返回,微信团队郑重提示:
  817. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  818. uni.showLoading({
  819. title: '支付成功'
  820. });
  821. uni.hideLoading();
  822. uni.navigateTo({
  823. url: '/pages/my/index'
  824. })
  825. } else {
  826. uni.hideLoading();
  827. }
  828. WeixinJSBridge.log(response.err_msg);
  829. }
  830. );
  831. },
  832. isCheckPay(code, name, order) {
  833. if (code == 0) {
  834. console.log('999999999999')
  835. this.setPayment(name, order);
  836. } else {
  837. uni.hideLoading();
  838. uni.showToast({
  839. title: '支付信息有误'
  840. });
  841. }
  842. },
  843. setPayment(name, order) {
  844. console.log(777777777, name, order)
  845. uni.requestPayment({
  846. provider: name,
  847. orderInfo: order, //微信、支付宝订单数据
  848. success: function(res) {
  849. uni.hideLoading();
  850. uni.showLoading({
  851. title: '支付成功'
  852. });
  853. uni.switchTab({
  854. url: '/pages/my/index'
  855. })
  856. },
  857. fail: function(err) {
  858. uni.hideLoading();
  859. },
  860. complete() {
  861. uni.hideLoading();
  862. }
  863. });
  864. }
  865. }
  866. }
  867. </script>
  868. <style>
  869. page {
  870. background-color: #F7F7F7;
  871. }
  872. .bg {
  873. background-color: #FFFFFF;
  874. }
  875. .u-input__input {
  876. color: balck !important;
  877. }
  878. .title_btn {
  879. height: 78upx;
  880. line-height: 78upx;
  881. /* background: #f7f7f7; */
  882. }
  883. .tabbar {
  884. width: 100%;
  885. height: 130rpx;
  886. background-color: #FFFFFF;
  887. padding: 20rpx 30rpx;
  888. position: fixed;
  889. bottom: 0rpx;
  890. left: 0rpx;
  891. right: 0rpx;
  892. display: flex;
  893. justify-content: space-between;
  894. align-items: center;
  895. }
  896. .popup_pay {
  897. width: 100%;
  898. position: relative;
  899. padding-bottom: 45rpx;
  900. /* height: 160px; */
  901. /* #ifndef MP-WEIXIN */
  902. /* height: 130px; */
  903. /* #endif */
  904. }
  905. .pay_btn {
  906. width: 90%;
  907. margin: 0 auto;
  908. text-align: center;
  909. background: #2FB57A;
  910. height: 80rpx;
  911. border-radius: 16rpx;
  912. color: #ffffff;
  913. line-height: 80rpx;
  914. }
  915. .hb {
  916. /* #ifdef H5 */
  917. padding-bottom: 180rpx;
  918. /* #endif */
  919. }
  920. .bgCol2 {
  921. color: #557EFD;
  922. }
  923. </style>