input.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254
  1. <template>
  2. <view style="padding: 30rpx;">
  3. <nav-bar title="填写审核资料"></nav-bar>
  4. <view v-show="!agreementModal">
  5. <view class="topBox">
  6. <view>
  7. <u-icon name="error-circle-fill" color="#FF3B30" size="28"></u-icon>
  8. <text style="color: #FF3B30;margin-left: 10rpx;">学习前请提交完整审核资料</text>
  9. </view>
  10. <view style="color: #007AFF;" @click="backPage">稍后再填</view>
  11. </view>
  12. <u-collapse v-if="remarkStatus" :item-style="itemStyle" event-type="close" ref="collapse">
  13. <u-collapse-item title="审核结果反馈">
  14. <view style="padding-bottom: 30rpx;">
  15. <text class="collapse-item">{{ remark }}</text>
  16. </view>
  17. </u-collapse-item>
  18. </u-collapse>
  19. <view class="bodyBox" style="margin-top: 30rpx;padding:0 20rpx;">
  20. <u-form :model="form" ref="uForm" :error-type="errorType">
  21. <template v-for="(item,index) in listData" >
  22. <u-form-item
  23. :key="index"
  24. v-if="item.fieldKey == 'name'"
  25. :label="item.fieldName"
  26. :required="item.required"
  27. :label-width="auto"
  28. :prop="item.required ? item.fieldKey : ''"
  29. >
  30. <u-input v-model="form.name" :placeholder="`请输入${item.fieldName}`" />
  31. </u-form-item>
  32. <u-form-item
  33. :key="index"
  34. v-if="item.fieldKey == 'idcard'"
  35. :label="item.fieldName"
  36. :required="item.required"
  37. :label-width="auto"
  38. :prop="item.required ? item.fieldKey : ''"
  39. >
  40. <u-input v-model="form.idcard" :placeholder="`请输入${item.fieldName}`" />
  41. </u-form-item>
  42. <u-form-item
  43. :key="index"
  44. v-if="item.fieldKey == 'telphone'"
  45. :label="item.fieldName"
  46. :required="item.required"
  47. :label-width="auto"
  48. :prop="item.required ? item.fieldKey : ''"
  49. >
  50. <u-input v-model="form.telphone" :placeholder="`请输入${item.fieldName}`" />
  51. </u-form-item>
  52. <u-form-item
  53. :key="index"
  54. v-if="item.fieldKey == 'school'"
  55. :label="item.fieldName"
  56. :required="item.required"
  57. :label-width="auto"
  58. :prop="item.required ? item.fieldKey : ''"
  59. >
  60. <u-input v-model="form.school" :placeholder="`请输入${item.fieldName}`" />
  61. </u-form-item>
  62. <u-form-item
  63. :key="index"
  64. v-if="item.fieldKey == 'work_unit'"
  65. :label="item.fieldName"
  66. :required="item.required"
  67. :label-width="auto"
  68. :prop="item.required ? item.fieldKey : ''"
  69. >
  70. <u-input v-model="form.work_unit" :placeholder="`请输入${item.fieldName}`" />
  71. </u-form-item>
  72. <u-form-item
  73. :key="index"
  74. v-if="item.fieldKey == 'unit_contact'"
  75. :label="item.fieldName"
  76. :required="item.required"
  77. :label-width="auto"
  78. :prop="item.required ? item.fieldKey : ''"
  79. >
  80. <u-input v-model="form.unit_contact" :placeholder="`请输入${item.fieldName}`" />
  81. </u-form-item>
  82. <u-form-item
  83. :key="index"
  84. v-if="item.fieldKey == 'unit_tel'"
  85. :label="item.fieldName"
  86. :required="item.required"
  87. :label-width="auto"
  88. :prop="item.required ? item.fieldKey : ''"
  89. >
  90. <u-input v-model="form.unit_tel" :placeholder="`请输入${item.fieldName}`" />
  91. </u-form-item>
  92. <u-form-item
  93. :key="index"
  94. v-if="item.fieldKey == 'apply_post'"
  95. :label="item.fieldName"
  96. :required="item.required"
  97. :label-width="auto"
  98. :prop="item.required ? item.fieldKey : ''"
  99. >
  100. <u-input v-model="form.apply_post" :disabled="apply_post_disabled" :placeholder="`请输入${item.fieldName}`" />
  101. </u-form-item>
  102. <u-form-item
  103. :key="index"
  104. v-if="item.fieldKey == 'major'"
  105. :label="item.fieldName"
  106. :required="item.required"
  107. :label-width="auto"
  108. :prop="item.required ? item.fieldKey : ''"
  109. >
  110. <u-input v-model="form.major" :placeholder="`请输入${item.fieldName}`" />
  111. </u-form-item>
  112. <u-form-item
  113. :key="index"
  114. v-if="item.inputType == 2"
  115. :label="item.fieldName"
  116. :label-width="auto"
  117. :required="item.required"
  118. :prop="item.required ? item.fieldKey : ''"
  119. >
  120. <picker @change="bindPickerChange(item.fieldKey, $event)" :value="form[item.fieldKey]" :range="getarrays(item.fieldKey)">
  121. <view class="picker">
  122. {{ returnName(item.fieldKey) }}
  123. <image
  124. src="@/static/icon/clears.png"
  125. v-if="clearWatch(item.fieldKey)"
  126. @click.stop="clearFun(item.fieldKey)"
  127. mode=""
  128. style="width:30rpx;height:30rpx;vertical-align: middle;margin-left:10rpx;"
  129. ></image>
  130. </view>
  131. </picker>
  132. </u-form-item>
  133. <u-form-item
  134. :key="index"
  135. v-if="item.inputType == 5"
  136. :label="item.fieldName"
  137. :label-width="auto"
  138. :required="item.required"
  139. :prop="item.required ? item.fieldKey : ''"
  140. >
  141. <picker mode="date" :value="form[item.fieldKey]" @change="bindDateChange(item.fieldKey, $event)">
  142. <view class="picker">
  143. {{ getTimes(item.fieldKey) }}
  144. <image
  145. src="@/static/icon/clears.png"
  146. v-if="clearWatch(item.fieldKey)"
  147. @click.stop="clearFun(item.fieldKey)"
  148. mode=""
  149. style="width:30rpx;height:30rpx;vertical-align: middle;margin-left:10rpx;"
  150. ></image>
  151. </view>
  152. </picker>
  153. </u-form-item>
  154. <u-form-item
  155. :key="index"
  156. v-if="item.inputType == 3 && item.fieldKey !== 'commitment_electr_signature'"
  157. :label="item.fieldName"
  158. :required="item.required"
  159. :label-width="auto"
  160. label-position="top"
  161. :prop="item.required ? item.fieldKey : ''"
  162. >
  163. <text v-if="item.fieldKey === 'recent_photos'" style="color: #999999;position: absolute;top: 20rpx;left: 130rpx;">竖向证件照 文件大小≤2M</text>
  164. <text
  165. v-if="item.fieldKey === 'idcard_face_photo' || item.fieldKey === 'idcard_national_photo'"
  166. style="color: #999999;position: absolute;top: 20rpx;left: 180rpx;"
  167. >
  168. 文件大小≤2M
  169. </text>
  170. <u-upload
  171. :show-progress="false"
  172. :max-size="2097152"
  173. :ref="
  174. item.fieldKey === 'recent_photos'
  175. ? 'recent_photos'
  176. : item.fieldKey === 'idcard_face_photo'
  177. ? 'idcard_face_photo'
  178. : item.fieldKey === 'idcard_national_photo'
  179. ? 'idcard_national_photo'
  180. : ''
  181. "
  182. @on-list-change="
  183. item.fieldKey === 'recent_photos'
  184. ? changePhotoListHeader1($event)
  185. : item.fieldKey === 'idcard_face_photo'
  186. ? changePhotoListHeader2($event)
  187. : item.fieldKey === 'idcard_national_photo'
  188. ? changePhotoListHeader3($event)
  189. : ''
  190. "
  191. :auto-upload="false"
  192. custom-btn="true"
  193. :action="action"
  194. :file-list="
  195. item.fieldKey === 'recent_photos'
  196. ? fileList1
  197. : item.fieldKey === 'idcard_face_photo'
  198. ? fileList2
  199. : item.fieldKey === 'idcard_national_photo'
  200. ? fileList3
  201. : ''
  202. "
  203. width="120"
  204. height="120"
  205. size-type="['compressed']"
  206. max-count="1"
  207. >
  208. <template v-slot:addBtn>
  209. <image
  210. :src="
  211. item.fieldKey === 'recent_photos'
  212. ? '/static/info_1.png'
  213. : item.fieldKey === 'idcard_face_photo'
  214. ? '/static/info_2.png'
  215. : item.fieldKey === 'idcard_national_photo'
  216. ? '/static/info_3.png'
  217. : ''
  218. "
  219. :style="
  220. item.fieldKey === 'recent_photos'
  221. ? 'width: 120rpx; height: 169rpx;'
  222. : item.fieldKey === 'idcard_face_photo'
  223. ? 'width: 120rpx; height: 82rpx;'
  224. : item.fieldKey === 'idcard_national_photo'
  225. ? 'width: 120rpx; height: 82rpx;'
  226. : ''
  227. "
  228. ></image>
  229. </template>
  230. </u-upload>
  231. </u-form-item>
  232. <view :key="index" v-if="item.inputType == 3 && item.fieldKey === 'commitment_electr_signature'">
  233. <u-form-item
  234. v-if="item.inputType == 3 && item.fieldKey === 'commitment_electr_signature'"
  235. label="承诺书"
  236. :required="item.required"
  237. :label-width="auto"
  238. label-position="top"
  239. >
  240. <view style="line-height: 40rpx;text-indent:2em">
  241. <text>
  242. 本人自愿做出如下承诺:本人己仔细阅读《广东省住房和城乡建设厅关于推进住房和城乡建设领域施工现场专业人员职业培训工作的通知》
  243. 全部内容并知晓和理解,本人的学历证书、身份证、工作年限、相片等所有资料完全真实、符合报名条件、资格审查要求和相关规定,本人在报名、审查、培训、测试等有关的事项中会严格道守相关规定和要求,如有虛假或与实际规定不符等情况造成的一切后果由本人承担。
  244. </text>
  245. <view style="line-height: 40rpx;text-indent:2em"><text>特此承诺!</text></view>
  246. </view>
  247. </u-form-item>
  248. <u-form-item
  249. v-if="item.inputType == 3 && item.fieldKey === 'commitment_electr_signature'"
  250. label="签名板"
  251. :required="item.required"
  252. :label-width="auto"
  253. label-position="top"
  254. :prop="item.required ? item.fieldKey : ''"
  255. >
  256. <view class="dis_stys">
  257. <text style="color: #999999;">请在下方签名区进行签名</text>
  258. <text @click="retDraw" mode="">清空</text>
  259. </view>
  260. <view class="handCenter">
  261. <canvas
  262. v-if="!form[item.fieldKey]"
  263. class="handWriting"
  264. disable-scroll="true"
  265. :catchtouchmove="true"
  266. @touchstart="uploadScaleStart"
  267. @touchmove="uploadScaleMove"
  268. @touchend="uploadScaleEnd"
  269. canvas-id="handWriting"
  270. ></canvas>
  271. <view v-else style="width:100%;height: 100%;position: relative;">
  272. <view class="ctoples">图片</view>
  273. <image style="width:100%;height:100%;" :src="$method.splitImgHost(form[item.fieldKey])" mode=""></image>
  274. </view>
  275. </view>
  276. </u-form-item>
  277. </view>
  278. </template>
  279. </u-form>
  280. </view>
  281. <view @click="submits" class="submit_btn">提交资料</view>
  282. </view>
  283. <u-popup class="modal" catchtouchmove='return' v-model="agreementModal" mode="center" border-radius="24" :mask-close-able="false">
  284. <view class="agreement">
  285. <view class="body">
  286. <scroll-view scroll-y="true" style="height:600rpx;">
  287. <view class="content">
  288. <view>本产品(或服务)提供【{{goodsData.goodsName}}】课程的在线学习功能,为使用这些功能,我们需要使用您设备上的摄像头,并收集以下个人信息:
  289. <text v-for="(item,listIndex) in listData" :key="listIndex">{{item.fieldName}}、</text>
  290. <!-- 姓名、性别、身份证号码、移动电话号码、身份证照片、一寸照、证书名称/岗位、证书编号、有效期、人脸照片(每节课随机拍摄三张)、 -->
  291. 学习详细记录。</view>
  292. <view>我们会将上述信息提供至广东省建设执业注册管理中心等第三方组织使用,用于继续教育备案等。如果您拒绝,将导致这些功能无法实现,但不影响您使用本产品(或服务)的其他业务功能。</view>
  293. </view>
  294. </scroll-view>
  295. </view>
  296. <view class="footer">
  297. <view class="btn cancel" @click="refuseAgreement">取消</view>
  298. <view class="btn ok" @click="agree">同意并继续</view>
  299. </view>
  300. </view>
  301. </u-popup>
  302. </view>
  303. </template>
  304. <script>
  305. import * as baseUrls from '@/common/request.js';
  306. import { mapGetters } from 'vuex';
  307. import Handwriting from '@/common/signature.js';
  308. export default {
  309. data() {
  310. return {
  311. gradeId:0,
  312. errorType: ['message'],
  313. agreementModal:true,
  314. goodsData:{},
  315. itemStyle: {
  316. marginTop: '20px',
  317. backgroundColor: '#fff',
  318. borderRadius: '24rpx',
  319. padding: '0rpx 20rpx'
  320. },
  321. isUploading:false,
  322. form: {
  323. name: '',
  324. sex: '',
  325. idcard: '',
  326. telphone: '',
  327. education: '',
  328. school: '',
  329. graduation_time: '',
  330. work_unit: '',
  331. unit_contact: '',
  332. unit_tel: '',
  333. apply_post: '',
  334. major: '',
  335. working_years: '',
  336. recent_photos: '',
  337. idcard_face_photo: '',
  338. idcard_national_photo: '',
  339. commitment_electr_signature: ''
  340. },
  341. lineColor: 'black',
  342. slideValue: 50,
  343. handwriting: '',
  344. goodsId: null,
  345. listData: [], //页面数据
  346. fileList1: [], //个人近照
  347. fileList2: [], //人像
  348. fileList3: [], //国徽
  349. openVerify: false, // 控制是否手动验证
  350. id: null, //获取修改ID内容
  351. remark: '', //反馈文本
  352. remarkStatus: false, //是否存在审核结果反馈
  353. // nextStatus: false, //是否有下一步
  354. copyData: [], //备份数据
  355. rules: {
  356. name: [
  357. {
  358. required: true,
  359. message: '请输入姓名',
  360. trigger: ['change', 'blur']
  361. }
  362. ],
  363. sex: [
  364. {
  365. required: true,
  366. message: '请选择性别',
  367. trigger: 'change'
  368. }
  369. ],
  370. idcard: [
  371. {
  372. required: true,
  373. message: '请输入身份证号',
  374. trigger: ['change', 'blur']
  375. },
  376. {
  377. validator: (rule, value, callback) => {
  378. return this.$u.test.idCard(value);
  379. },
  380. message: '身份证号不正确',
  381. trigger: ['change', 'blur']
  382. }
  383. ],
  384. telphone: [
  385. {
  386. required: true,
  387. message: '请输入手机号码',
  388. trigger: ['change', 'blur']
  389. },
  390. {
  391. validator: (rule, value, callback) => {
  392. var vartest = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
  393. if (this.$u.test.mobile(value) || vartest.test(value)) {
  394. return true;
  395. } else {
  396. return false;
  397. }
  398. },
  399. message: '手机号码不正确',
  400. trigger: ['change', 'blur']
  401. }
  402. ],
  403. education: [
  404. {
  405. required: true,
  406. message: '请选择学历',
  407. trigger: 'change'
  408. }
  409. ],
  410. school: [
  411. {
  412. required: true,
  413. message: '请输入毕业院校',
  414. trigger: ['change', 'blur']
  415. }
  416. ],
  417. graduation_time: [
  418. {
  419. required: true,
  420. message: '请选择毕业时间',
  421. trigger: 'change'
  422. }
  423. ],
  424. work_unit: [
  425. {
  426. required: true,
  427. message: '请输入工作单位',
  428. trigger: ['change', 'blur']
  429. }
  430. ],
  431. unit_contact: [
  432. {
  433. required: true,
  434. message: '请输入单位联系人',
  435. trigger: ['change', 'blur']
  436. }
  437. ],
  438. unit_tel: [
  439. {
  440. required: true,
  441. message: '请输入单位联系电话',
  442. trigger: ['change', 'blur']
  443. },
  444. {
  445. validator: (rule, value, callback) => {
  446. var vartest = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
  447. var vartest1 = /^([0-9]{3,4})?[0-9]{7,8}$/;
  448. if (this.$u.test.mobile(value) || vartest.test(value) || vartest1.test(value)) {
  449. return true;
  450. } else {
  451. return false;
  452. }
  453. },
  454. message: '单位联系电话不正确',
  455. trigger: ['change', 'blur']
  456. }
  457. ],
  458. apply_post: [
  459. {
  460. required: true,
  461. message: '请输入报名岗位',
  462. trigger: ['change', 'blur']
  463. }
  464. ],
  465. major: [
  466. {
  467. required: true,
  468. message: '请输入所学专业',
  469. trigger: ['change', 'blur']
  470. }
  471. ],
  472. working_years: [
  473. {
  474. required: true,
  475. message: '请选择工作年限',
  476. trigger: 'change'
  477. }
  478. ],
  479. recent_photos: [
  480. {
  481. required: true,
  482. message: '请上传个人近照',
  483. trigger: ['change', 'blur']
  484. }
  485. ],
  486. idcard_face_photo: [
  487. {
  488. required: true,
  489. message: '请上传身份证人像面',
  490. trigger: ['change', 'blur']
  491. }
  492. ],
  493. idcard_national_photo: [
  494. {
  495. required: true,
  496. message: '请上传身份证国徽面',
  497. trigger: ['change', 'blur']
  498. }
  499. ],
  500. commitment_electr_signature: [
  501. {
  502. required: true,
  503. message: '请签写承诺书电子签',
  504. trigger: ['change', 'blur']
  505. }
  506. ]
  507. },
  508. apply_post_disabled:false,
  509. isRequired: false,
  510. orderGoodsId:0,
  511. };
  512. },
  513. created() {
  514. this.$store.getters.dictObj;
  515. },
  516. async onLoad(option) {
  517. this.orderGoodsId = Number(option.orderGoodsId)
  518. this.goodsId = Number(option.id);
  519. this.gradeId = Number(option.gradeId)
  520. await this.getGoodsDetail()
  521. this.getInfo();
  522. },
  523. onReady(res) {
  524. this.handwriting = new Handwriting({
  525. lineColor: this.lineColor,
  526. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  527. canvasName: 'handWriting'
  528. });
  529. this.$refs.uForm.setRules(this.rules);
  530. },
  531. computed: { ...mapGetters(['dictObj','userInfo']) },
  532. watch:{
  533. userInfo(val, oldVal){//普通的watch监听
  534. if(val){
  535. this.listData.forEach(item => {
  536. if(item.fieldKey == "idcard") {
  537. this.form.idcard = this.userInfo.idCard;
  538. }
  539. if(item.fieldKey == "telphone") {
  540. this.form.telphone = this.userInfo.telphone;
  541. }
  542. if(item.fieldKey == "name") {
  543. this.form.name = this.userInfo.realname
  544. }
  545. })
  546. }
  547. },
  548. },
  549. methods: {
  550. getGoodsDetail() {
  551. return new Promise(resolve => {
  552. this.$api.goodsDetail(this.goodsId).then(res => {
  553. this.goodsData = res.data.data;
  554. if(this.goodsData.categoryName) {
  555. this.form.apply_post = this.goodsData.categoryName;
  556. if(this.goodsData.categoryName) {
  557. this.apply_post_disabled = true;
  558. }
  559. }
  560. resolve()
  561. })
  562. })
  563. },
  564. agree() {
  565. this.agreementModal = false;
  566. setTimeout(() => {
  567. this.$refs.collapse.init()
  568. },1000)
  569. },
  570. refuseAgreement() {
  571. uni.navigateBack({
  572. delta:1
  573. })
  574. },
  575. clearFun(key) {
  576. this.form[key] = '';
  577. },
  578. //清除按钮
  579. clearWatch(key) {
  580. if (this.form[key]) {
  581. return true;
  582. } else {
  583. return false;
  584. }
  585. },
  586. cahngeText() {
  587. this.$set(this.form, 'name', '唐');
  588. console.log(this.form.name, 123);
  589. },
  590. uploadDatas(data) {
  591. var self = this;
  592. if (self.remarkStatus) {
  593. var arsty = {};
  594. for (let k in data) {
  595. for (let j in self.copyData) {
  596. if (k === j) {
  597. if (self.copyData[j].value === data[k]) {
  598. arsty[k] = {
  599. fieldKey: k,
  600. value: data[k],
  601. fieldName: (function() {
  602. for (let i = 0; i < self.listData.length; i++) {
  603. if (self.listData[i].fieldKey == k) {
  604. return self.listData[i].fieldName;
  605. }
  606. }
  607. })(),
  608. status: 0
  609. };
  610. } else {
  611. arsty[k] = {
  612. fieldKey: k,
  613. value: data[k],
  614. fieldName: (function() {
  615. for (let i = 0; i < self.listData.length; i++) {
  616. if (self.listData[i].fieldKey == k) {
  617. return self.listData[i].fieldName;
  618. }
  619. }
  620. })(),
  621. status: 1
  622. };
  623. }
  624. }
  625. }
  626. }
  627. var datas = {
  628. id: this.id,
  629. goodsId: this.goodsId,
  630. orderGoodsId:this.orderGoodsId,
  631. keyValue: JSON.stringify(arsty)
  632. };
  633. this.$api.editbaseprofiletp(datas).then(res => {
  634. this.isUploading = false;
  635. if (res.data.code === 200) {
  636. this.$method.showToast('提交成功');
  637. uni.navigateBack();
  638. } else {
  639. this.$method.showToast(res.data.msg);
  640. this.isUploading = false;
  641. }
  642. });
  643. } else {
  644. var objs = {};
  645. for (let k in data) {
  646. objs[k] = {
  647. fieldKey: k,
  648. value: data[k],
  649. fieldName: (function() {
  650. for (let i = 0; i < self.listData.length; i++) {
  651. if (self.listData[i].fieldKey == k) {
  652. return self.listData[i].fieldName;
  653. }
  654. }
  655. })(),
  656. status: 0
  657. };
  658. }
  659. var datas = {
  660. goodsId: this.goodsId,
  661. profileTpId: this.goodsId,
  662. orderGoodsId:this.orderGoodsId,
  663. keyValue: JSON.stringify(objs)
  664. };
  665. this.$api.addbaseprofiletp(datas).then(res => {
  666. this.isUploading = false;
  667. if (res.data.code === 200) {
  668. this.$method.showToast('提交成功');
  669. uni.navigateBack();
  670. } else {
  671. this.$method.showToast(res.data.msg);
  672. this.isUploading = false;
  673. }
  674. });
  675. }
  676. },
  677. backPage() {
  678. uni.navigateBack();
  679. },
  680. //提交表单
  681. async submitApi() {
  682. var data = JSON.parse(JSON.stringify(this.form));
  683. if (data['sex']) {
  684. data.sex = this.dictObj['sys_user_sex'][Number(data.sex)];
  685. }
  686. if (data['education']) {
  687. data.education = this.dictObj['edu_level'][Number(data.education)];
  688. }
  689. if (data['working_years']) {
  690. data.working_years = this.dictObj['working_years'][Number(data.working_years)];
  691. }
  692. if (data['recent_photos']) {
  693. data.recent_photos = await this.$method.uploadFile(data.recent_photos, 0);
  694. }
  695. if (data['idcard_face_photo']) {
  696. data.idcard_face_photo = await this.$method.uploadFile(data.idcard_face_photo, 0);
  697. }
  698. if (data['idcard_national_photo']) {
  699. data.idcard_national_photo = await this.$method.uploadFile(data.idcard_national_photo, 0);
  700. }
  701. if (data['commitment_electr_signature']) {
  702. data.commitment_electr_signature = await this.$method.uploadFile(data.commitment_electr_signature, 0);
  703. }
  704. this.uploadDatas(data);
  705. },
  706. //验证表单
  707. resultForm(int) {
  708. if (this.openVerify) {
  709. if (this.isRequired) {
  710. this.submitApi();
  711. } else {
  712. if(int === 1) {
  713. this.errorType = ['toast'];
  714. } else {
  715. this.errorType = ['message'];
  716. }
  717. this.$nextTick(() => {
  718. this.$refs.uForm.validate(valid => {
  719. if (valid) {
  720. if (int === 1) {
  721. this.submitApi();
  722. }
  723. } else {
  724. this.isUploading = false;
  725. this.errorType = ['message'];
  726. console.log(this.form)
  727. console.log('验证失败');
  728. }
  729. });
  730. })
  731. }
  732. }
  733. },
  734. async submits() {
  735. if(this.isUploading) {
  736. return;
  737. }
  738. this.isUploading = true;
  739. var ast = this.listData.some(item => {
  740. return item.fieldKey === 'commitment_electr_signature';
  741. });
  742. if (ast) {
  743. await this.subCanvas();
  744. }
  745. this.openVerify = true;
  746. this.resultForm(1);
  747. },
  748. faceCertificationIDCardOCR(cardSide,url) {
  749. return new Promise(resolve => {
  750. let fileSystem = uni.getFileSystemManager();
  751. fileSystem.readFile({
  752. filePath: url,
  753. encoding: 'base64',
  754. position: 0,
  755. success:(res) => {
  756. console.log(res)
  757. let base64 = 'data:image/jpg;base64,' + res.data;
  758. console.log(base64)
  759. this.$api.faceCertificationIDCardOCR({
  760. cardSide:cardSide, //1人像 2 国徽
  761. cardImageBase64:base64,
  762. gradeId:this.gradeId
  763. }).then(res => {
  764. resolve(res)
  765. })
  766. },
  767. fail(err) {
  768. console.error(err,'err')
  769. }
  770. })
  771. })
  772. },
  773. async changePhotoListHeader1(lists, name) {
  774. console.log(lists)
  775. if (lists.length) {
  776. this.fileList1 = lists;
  777. console.log(lists,'lists1')
  778. if (lists[0].url.indexOf('//tmp') !== -1 || lists[0].url.indexOf('//temp') !== -1) {
  779. this.$set(this.form, 'recent_photos', await this.$method.imageInfos(lists[0].url));
  780. }
  781. } else {
  782. this.fileList1 = [];
  783. this.$set(this.form, 'recent_photos', '');
  784. console.log(3, this.form.recent_photos);
  785. }
  786. this.$nextTick(function() {
  787. console.log(4);
  788. this.resultForm();
  789. });
  790. },
  791. async changePhotoListHeader2(lists, name) {
  792. if (lists.length) {
  793. this.fileList2 = lists;
  794. if (lists[0].url.indexOf('//tmp') !== -1 || lists[0].url.indexOf('//temp') !== -1) {
  795. let url = lists[0].url
  796. this.$refs.idcard_face_photo[0].remove(0)
  797. let res = await this.faceCertificationIDCardOCR(1,url);
  798. if(res.data.code == 500) {
  799. uni.showToast({
  800. icon:'none',
  801. title:'请上传正确清晰的身份证人像面照片'
  802. })
  803. return;
  804. }
  805. this.$refs.idcard_face_photo[0].lists = [{
  806. url:this.$method.splitImgHost(res.data.data.IdImgPath)
  807. }];
  808. this.$set(this.form, 'idcard_face_photo', res.data.data.IdImgPath,1000);
  809. }
  810. } else {
  811. this.fileList2 = [];
  812. this.$set(this.form, 'idcard_face_photo', '');
  813. }
  814. this.$nextTick(function() {
  815. this.resultForm();
  816. });
  817. },
  818. async changePhotoListHeader3(lists, name) {
  819. if (lists.length) {
  820. this.fileList3 = lists;
  821. if (lists[0].url.indexOf('//tmp') !== -1 || lists[0].url.indexOf('//temp') !== -1) {
  822. console.log('//tem')
  823. let url = lists[0].url
  824. this.$refs.idcard_national_photo[0].remove(0)
  825. let res = await this.faceCertificationIDCardOCR(2,url);
  826. if(res.data.code == 500) {
  827. uni.showToast({
  828. icon:'none',
  829. title:'请上传正确清晰的身份证国徽面照片'
  830. })
  831. return;
  832. }
  833. this.$refs.idcard_national_photo[0].lists = [{
  834. url:this.$method.splitImgHost(res.data.data.IdImgPath)
  835. }];
  836. this.$set(this.form, 'idcard_national_photo', this.$method.splitImgHost(res.data.data.IdImgPath,1000));
  837. }
  838. } else {
  839. this.fileList3 = [];
  840. this.$set(this.form, 'idcard_national_photo', '');
  841. }
  842. this.$nextTick(function() {
  843. this.resultForm();
  844. });
  845. },
  846. getTimes(key) {
  847. if (this.form[key]) {
  848. return this.form[key];
  849. } else {
  850. return '请选择时间';
  851. }
  852. },
  853. getarrays(key) {
  854. if (key === 'sex') {
  855. console.log(this.dictObj)
  856. return this.dictObj['sys_user_sex'];
  857. }
  858. if (key === 'education') {
  859. return this.dictObj['edu_level'];
  860. }
  861. if (key === 'working_years') {
  862. return this.dictObj['working_years'];
  863. }
  864. },
  865. returnName(key) {
  866. if (key === 'sex') {
  867. if (this.form[key]) {
  868. return this.dictObj['sys_user_sex'][Number(this.form[key])];
  869. } else {
  870. return '请选择性别';
  871. }
  872. }
  873. if (key === 'education') {
  874. if (this.form[key]) {
  875. return this.dictObj['edu_level'][Number(this.form[key])];
  876. } else {
  877. return '请选择学历';
  878. }
  879. }
  880. if (key === 'working_years') {
  881. if (this.form[key]) {
  882. return this.dictObj['working_years'][Number(this.form[key])];
  883. } else {
  884. return '请选择工作年限';
  885. }
  886. }
  887. },
  888. /**
  889. * getbaseprofiletpgetInfo接口返回值result.data.data不存在的话说明是第一次填写资料
  890. */
  891. getInfo() {
  892. var self = this;
  893. this.$api.getbaseprofiletpId(this.goodsId).then(res => {
  894. self.listData = JSON.parse(res.data.data.keyValue);
  895. self.listData.forEach(item => {
  896. if(item.fieldKey == "idcard") {
  897. this.form.idcard = this.userInfo.idCard;
  898. }
  899. if(item.fieldKey == "telphone") {
  900. this.form.telphone = this.userInfo.telphone;
  901. }
  902. if(item.fieldKey == "name") {
  903. this.form.name = this.userInfo.realname
  904. }
  905. })
  906. self.isRequired = self.listData.every(ims => {
  907. return ims.required === false;
  908. });
  909. this.$nextTick(() => {
  910. this.agreementModal = true;
  911. })
  912. self.$api.getbaseprofiletpgetInfo({ goodsId: self.goodsId ,orderGoodsId:self.orderGoodsId}).then(result => {
  913. if (result.data.code === 200) {
  914. if (!result.data.data) {
  915. self.$api.getbaseprofiletplistProfile({ pageNum: 1, pageSize: 1, status: 1 }).then(kit => {
  916. if (kit.data.rows.length) {
  917. var ajson = JSON.parse(kit.data.rows[0].keyValue);
  918. self.listData.forEach((zyitem, zyindex) => {
  919. for (let k in ajson) {
  920. if (zyitem.fieldKey == k && ajson[k].value) {
  921. if (k === 'sex') {
  922. const sexIndex = self.dictObj['sys_user_sex'].indexOf(ajson[k].value) + '';
  923. self.$set(self.form, k, sexIndex);
  924. } else if (k === 'education') {
  925. const sexIndex = self.dictObj['edu_level'].indexOf(ajson[k].value) + '';
  926. self.$set(self.form, k, sexIndex);
  927. } else if (k === 'working_years') {
  928. const sexIndex = self.dictObj['working_years'].indexOf(ajson[k].value) + '';
  929. self.$set(self.form, k, sexIndex);
  930. } else if (k === 'recent_photos') {
  931. self.$set(self.form, k, ajson[k].value);
  932. if (ajson[k].value) {
  933. self.fileList1 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  934. }
  935. } else if (k === 'idcard_face_photo') {
  936. self.$set(self.form, k, ajson[k].value);
  937. if (ajson[k].value) {
  938. self.fileList2 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  939. }
  940. } else if (k === 'idcard_national_photo') {
  941. self.$set(self.form, k, ajson[k].value);
  942. if (ajson[k].value) {
  943. self.fileList3 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  944. }
  945. } else {
  946. if(k === 'name'){
  947. self.$set(self.form, k, this.$store.state.userInfo.realname);
  948. } else if(k === 'idcard'){
  949. self.$set(self.form, k, this.$store.state.userInfo.idCard);
  950. } else if(k === 'telphone'){
  951. self.$set(self.form, k, this.$store.state.userInfo.telphone);
  952. } else if(k !== 'commitment_electr_signature'){
  953. self.$set(self.form, k, ajson[k].value);
  954. }
  955. }
  956. }
  957. }
  958. });
  959. }
  960. });
  961. }
  962. if (result.data.data && result.data.data.status === 3) {
  963. self.remark = result.data.data.text;
  964. self.remarkStatus = true;
  965. self.id = result.data.data.id;
  966. var arrays = JSON.parse(result.data.data.keyValue);
  967. self.copyData = JSON.parse(JSON.stringify(arrays));
  968. for (let k in arrays) {
  969. if (k === 'sex') {
  970. if (arrays[k].value) {
  971. const sexIndex = self.dictObj['sys_user_sex'].indexOf(arrays[k].value) + '';
  972. self.$set(self.form, k, sexIndex);
  973. }
  974. } else if (k === 'education') {
  975. if (arrays[k].value) {
  976. const sexIndex = self.dictObj['edu_level'].indexOf(arrays[k].value) + '';
  977. self.$set(self.form, k, sexIndex);
  978. }
  979. } else if (k === 'working_years') {
  980. if (arrays[k].value) {
  981. const sexIndex = self.dictObj['working_years'].indexOf(arrays[k].value) + '';
  982. self.$set(self.form, k, sexIndex);
  983. }
  984. } else if (k === 'recent_photos') {
  985. self.$set(self.form, k, arrays[k].value);
  986. if (arrays[k].value) {
  987. self.fileList1 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  988. }
  989. } else if (k === 'idcard_face_photo') {
  990. self.$set(self.form, k, arrays[k].value);
  991. if (arrays[k].value) {
  992. self.fileList2 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  993. }
  994. } else if (k === 'idcard_national_photo') {
  995. self.$set(self.form, k, arrays[k].value);
  996. if (arrays[k].value) {
  997. self.fileList3 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  998. }
  999. } else {
  1000. self.$set(self.form, k, arrays[k].value);
  1001. }
  1002. }
  1003. } else if (result.data.data && (result.data.data.status === 1 || result.data.data.status === 2)) {
  1004. uni.showModal({
  1005. showCancel: false,
  1006. content:
  1007. result.data.data.status === 1
  1008. ? '该商品审核资料已通过,不可重复提交资料'
  1009. : result.data.data.status === 2
  1010. ? '该商品审核资料处于待审核状态,不可重复提交资料'
  1011. : '请联系管理员',
  1012. success: function(k) {
  1013. if (k.confirm) {
  1014. uni.navigateBack();
  1015. }
  1016. }
  1017. });
  1018. }
  1019. }
  1020. });
  1021. });
  1022. },
  1023. bindPickerChange(key, e) {
  1024. this.$set(this.form, key, e.detail.value);
  1025. this.$nextTick(function() {
  1026. this.resultForm();
  1027. });
  1028. },
  1029. bindDateChange(key, e) {
  1030. this.form[key] = e.detail.value;
  1031. },
  1032. retDraw() {
  1033. this.handwriting.retDraw();
  1034. this.$set(this.form, 'commitment_electr_signature', '');
  1035. this.$nextTick(function() {
  1036. this.resultForm();
  1037. });
  1038. },
  1039. uploadScaleStart(event) {
  1040. this.handwriting.uploadScaleStart(event);
  1041. },
  1042. uploadScaleMove(event) {
  1043. this.handwriting.uploadScaleMove(event);
  1044. },
  1045. uploadScaleEnd(event) {
  1046. this.handwriting.uploadScaleEnd(event);
  1047. },
  1048. subCanvas() {
  1049. return new Promise((resolve, reject) => {
  1050. var self = this;
  1051. if (self.form.commitment_electr_signature) {
  1052. resolve();
  1053. return;
  1054. }
  1055. self.handwriting
  1056. .saveCanvas()
  1057. .then(res => {
  1058. console.log(res,'res')
  1059. if (this.handwriting.linePrack.length) {
  1060. this.$set(this.form, 'commitment_electr_signature', res);
  1061. }
  1062. resolve(res);
  1063. })
  1064. .catch(err => {
  1065. uni.showToast({
  1066. title: '签名上传失败',
  1067. icon: 'error'
  1068. });
  1069. this.isUploading = false;
  1070. });
  1071. });
  1072. }
  1073. }
  1074. };
  1075. </script>
  1076. <style>
  1077. page {
  1078. background: #eaeef1;
  1079. }
  1080. </style>
  1081. <style scope lang="scss">
  1082. .ctoples {
  1083. position: absolute;
  1084. top: 0;
  1085. left: 0;
  1086. padding: 2rpx 23rpx;
  1087. display: inline-block;
  1088. background-color: rgba(0, 0, 0, 0.4);
  1089. font-size: 28rpx;
  1090. color: #fff;
  1091. border-bottom-right-radius: 24rpx;
  1092. }
  1093. .handWriting {
  1094. width: 100%;
  1095. height: 100%;
  1096. }
  1097. /deep/ .u-collapse-title {
  1098. color: #FF3B30;
  1099. font-size: 24rpx;
  1100. }
  1101. .collapse-item {
  1102. color: #666;
  1103. font-size: 24rpx;
  1104. padding-bottom: 30rpx;
  1105. }
  1106. .dis_stys {
  1107. display: flex;
  1108. align-items: center;
  1109. justify-content: space-between;
  1110. }
  1111. .handCenter {
  1112. background: #f7f7f7;
  1113. border: 2rpx solid #eeeeee;
  1114. border-radius: 24rpx;
  1115. width: 100%;
  1116. height: 300rpx;
  1117. overflow: hidden;
  1118. }
  1119. .headerSDels {
  1120. height: 58rpx;
  1121. padding: 0rpx 24rpx;
  1122. font-weight: bold;
  1123. display: flex;
  1124. align-items: center;
  1125. flex-direction: row-reverse;
  1126. }
  1127. .listBox {
  1128. margin: 24rpx 32rpx 0rpx;
  1129. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1130. border-radius: 32rpx;
  1131. background-color: #fff;
  1132. overflow: hidden;
  1133. }
  1134. .imgBoxs {
  1135. width: 156rpx;
  1136. height: 203rpx;
  1137. }
  1138. .imgBoxs2 {
  1139. width: 171rpx;
  1140. height: 108rpx;
  1141. }
  1142. .submit_btn {
  1143. width: 526rpx;
  1144. height: 80rpx;
  1145. background: #007aff;
  1146. border-radius: 40rpx;
  1147. text-align: center;
  1148. line-height: 80rpx;
  1149. color: #ffffff;
  1150. margin: 30rpx auto;
  1151. }
  1152. .picker {
  1153. text-align: right;
  1154. }
  1155. input {
  1156. text-align: right;
  1157. }
  1158. .bodyBox {
  1159. background: #ffffff;
  1160. border-radius: 24rpx;
  1161. width: 100%;
  1162. }
  1163. .topBox {
  1164. height: 80rpx;
  1165. background: #ffffff;
  1166. border-radius: 24rpx;
  1167. width: 100%;
  1168. display: flex;
  1169. justify-content: space-between;
  1170. line-height: 80rpx;
  1171. padding: 0 20rpx;
  1172. font-size: 24rpx;
  1173. }
  1174. .modal {
  1175. .agreement {
  1176. width: 640rpx;
  1177. height: 740rpx;
  1178. background: #FFFFFF;
  1179. display: flex;
  1180. flex-direction: column;
  1181. .body {
  1182. flex:1;
  1183. .content {
  1184. padding:30rpx 40rpx 28rpx;
  1185. line-height: 40rpx;
  1186. font-size: 26rpx;
  1187. color:#666;
  1188. .bold {
  1189. color:#333;
  1190. font-size: 26rpx;
  1191. font-weight: bold;
  1192. }
  1193. .center {
  1194. text-align: center;
  1195. }
  1196. }
  1197. }
  1198. .footer {
  1199. height:140rpx;
  1200. border-top:1px solid #EEEEEE;
  1201. display: flex;
  1202. align-items: center;
  1203. justify-content: center;
  1204. .btn {
  1205. margin:0 12rpx;
  1206. width: 200rpx;
  1207. height: 80rpx;
  1208. color:#007AFF;
  1209. font-size: 30rpx;
  1210. text-align: center;
  1211. line-height: 80rpx;
  1212. background: #F5F5F5;
  1213. border-radius: 40rpx 40rpx 40rpx 40rpx;
  1214. &.ok {
  1215. width: 336rpx;
  1216. height: 80rpx;
  1217. background: #007AFF;
  1218. color:#fff;
  1219. }
  1220. &.close {
  1221. color:#fff;
  1222. width: 560rpx;
  1223. height: 80rpx;
  1224. background: #007AFF;
  1225. border-radius: 40rpx 40rpx 40rpx 40rpx;
  1226. }
  1227. }
  1228. }
  1229. }
  1230. }
  1231. </style>