input.vue 31 KB

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