index.vue 25 KB

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