index.vue 27 KB

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