input.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997
  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, index) 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. </view>
  272. </template>
  273. <script>
  274. import * as baseUrls from '@/common/request.js';
  275. import { mapGetters } from 'vuex';
  276. import Handwriting from '@/common/signature.js';
  277. export default {
  278. data() {
  279. return {
  280. itemStyle: {
  281. marginTop: '20px',
  282. backgroundColor: '#fff',
  283. borderRadius: '24rpx',
  284. padding: '0rpx 20rpx'
  285. },
  286. form: {
  287. name: '',
  288. sex: '',
  289. idcard: '',
  290. telphone: '',
  291. education: '',
  292. school: '',
  293. graduation_time: '',
  294. work_unit: '',
  295. unit_contact: '',
  296. unit_tel: '',
  297. apply_post: '',
  298. major: '',
  299. working_years: '',
  300. recent_photos: '',
  301. idcard_face_photo: '',
  302. idcard_national_photo: '',
  303. commitment_electr_signature: ''
  304. },
  305. lineColor: 'black',
  306. slideValue: 50,
  307. handwriting: '',
  308. goodsId: null,
  309. listData: [], //页面数据
  310. fileList1: [], //个人近照
  311. fileList2: [], //人像
  312. fileList3: [], //国徽
  313. openVerify: false, // 控制是否手动验证
  314. id: null, //获取修改ID内容
  315. remark: '', //反馈文本
  316. remarkStatus: false, //是否存在审核结果反馈
  317. // nextStatus: false, //是否有下一步
  318. copyData: [], //备份数据
  319. rules: {
  320. name: [
  321. {
  322. required: true,
  323. message: '请输入姓名',
  324. trigger: ['change', 'blur']
  325. }
  326. ],
  327. sex: [
  328. {
  329. required: true,
  330. message: '请选择性别',
  331. trigger: 'change'
  332. }
  333. ],
  334. idcard: [
  335. {
  336. required: true,
  337. message: '请输入身份证号',
  338. trigger: ['change', 'blur']
  339. },
  340. {
  341. validator: (rule, value, callback) => {
  342. return this.$u.test.idCard(value);
  343. },
  344. message: '身份证号不正确',
  345. trigger: ['change', 'blur']
  346. }
  347. ],
  348. telphone: [
  349. {
  350. required: true,
  351. message: '请输入手机号码',
  352. trigger: ['change', 'blur']
  353. },
  354. {
  355. validator: (rule, value, callback) => {
  356. var vartest = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
  357. if (this.$u.test.mobile(value) || vartest.test(value)) {
  358. return true;
  359. } else {
  360. return false;
  361. }
  362. },
  363. message: '手机号码不正确',
  364. trigger: ['change', 'blur']
  365. }
  366. ],
  367. education: [
  368. {
  369. required: true,
  370. message: '请选择学历',
  371. trigger: 'change'
  372. }
  373. ],
  374. school: [
  375. {
  376. required: true,
  377. message: '请输入毕业院校',
  378. trigger: ['change', 'blur']
  379. }
  380. ],
  381. graduation_time: [
  382. {
  383. required: true,
  384. message: '请选择毕业时间',
  385. trigger: 'change'
  386. }
  387. ],
  388. work_unit: [
  389. {
  390. required: true,
  391. message: '请输入工作单位',
  392. trigger: ['change', 'blur']
  393. }
  394. ],
  395. unit_contact: [
  396. {
  397. required: true,
  398. message: '请输入单位联系人',
  399. trigger: ['change', 'blur']
  400. }
  401. ],
  402. unit_tel: [
  403. {
  404. required: true,
  405. message: '请输入单位联系电话',
  406. trigger: ['change', 'blur']
  407. },
  408. {
  409. validator: (rule, value, callback) => {
  410. var vartest = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
  411. var vartest1 = /^([0-9]{3,4})?[0-9]{7,8}$/;
  412. if (this.$u.test.mobile(value) || vartest.test(value) || vartest1.test(value)) {
  413. return true;
  414. } else {
  415. return false;
  416. }
  417. },
  418. message: '单位联系电话不正确',
  419. trigger: ['change', 'blur']
  420. }
  421. ],
  422. apply_post: [
  423. {
  424. required: true,
  425. message: '请输入报名岗位',
  426. trigger: ['change', 'blur']
  427. }
  428. ],
  429. major: [
  430. {
  431. required: true,
  432. message: '请输入所学专业',
  433. trigger: ['change', 'blur']
  434. }
  435. ],
  436. working_years: [
  437. {
  438. required: true,
  439. message: '请选择工作年限',
  440. trigger: 'change'
  441. }
  442. ],
  443. recent_photos: [
  444. {
  445. required: true,
  446. message: '请上传个人近照',
  447. trigger: ['change', 'blur']
  448. }
  449. ],
  450. idcard_face_photo: [
  451. {
  452. required: true,
  453. message: '请上传身份证正面照',
  454. trigger: ['change', 'blur']
  455. }
  456. ],
  457. idcard_national_photo: [
  458. {
  459. required: true,
  460. message: '请上传身份证国徽照',
  461. trigger: ['change', 'blur']
  462. }
  463. ],
  464. commitment_electr_signature: [
  465. {
  466. required: true,
  467. message: '请签写承诺书电子签',
  468. trigger: ['change', 'blur']
  469. }
  470. ]
  471. },
  472. isRequired: false
  473. };
  474. },
  475. created() {
  476. this.$store.getters.dictObj;
  477. },
  478. onLoad(option) {
  479. this.goodsId = Number(option.id);
  480. this.getInfo();
  481. },
  482. onReady(res) {
  483. this.handwriting = new Handwriting({
  484. lineColor: this.lineColor,
  485. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  486. canvasName: 'handWriting'
  487. });
  488. this.$refs.uForm.setRules(this.rules);
  489. },
  490. computed: { ...mapGetters(['dictObj']) },
  491. methods: {
  492. clearFun(key) {
  493. this.form[key] = '';
  494. },
  495. //清除按钮
  496. clearWatch(key) {
  497. if (this.form[key]) {
  498. return true;
  499. } else {
  500. return false;
  501. }
  502. },
  503. cahngeText() {
  504. this.$set(this.form, 'name', '唐');
  505. console.log(this.form.name, 123);
  506. },
  507. uploadDatas(data) {
  508. var self = this;
  509. if (self.remarkStatus) {
  510. var arsty = {};
  511. for (let k in data) {
  512. for (let j in self.copyData) {
  513. if (k === j) {
  514. if (self.copyData[j].value === data[k]) {
  515. arsty[k] = {
  516. fieldKey: k,
  517. value: data[k],
  518. fieldName: (function() {
  519. for (let i = 0; i < self.listData.length; i++) {
  520. if (self.listData[i].fieldKey == k) {
  521. return self.listData[i].fieldName;
  522. }
  523. }
  524. })(),
  525. status: 0
  526. };
  527. } else {
  528. arsty[k] = {
  529. fieldKey: k,
  530. value: data[k],
  531. fieldName: (function() {
  532. for (let i = 0; i < self.listData.length; i++) {
  533. if (self.listData[i].fieldKey == k) {
  534. return self.listData[i].fieldName;
  535. }
  536. }
  537. })(),
  538. status: 1
  539. };
  540. }
  541. }
  542. }
  543. }
  544. var datas = {
  545. id: this.id,
  546. goodsId: this.goodsId,
  547. keyValue: JSON.stringify(arsty)
  548. };
  549. this.$api.editbaseprofiletp(datas).then(res => {
  550. if (res.data.code === 200) {
  551. this.$method.showToast('提交成功');
  552. uni.navigateBack();
  553. }
  554. });
  555. } else {
  556. var objs = {};
  557. for (let k in data) {
  558. objs[k] = {
  559. fieldKey: k,
  560. value: data[k],
  561. fieldName: (function() {
  562. for (let i = 0; i < self.listData.length; i++) {
  563. if (self.listData[i].fieldKey == k) {
  564. return self.listData[i].fieldName;
  565. }
  566. }
  567. })(),
  568. status: 0
  569. };
  570. }
  571. var datas = {
  572. goodsId: this.goodsId,
  573. keyValue: JSON.stringify(objs)
  574. };
  575. this.$api.addbaseprofiletp(datas).then(res => {
  576. if (res.data.code === 200) {
  577. this.$method.showToast('提交成功');
  578. uni.navigateBack();
  579. }
  580. });
  581. }
  582. },
  583. backPage() {
  584. uni.navigateBack();
  585. },
  586. //提交表单
  587. async submitApi() {
  588. var data = JSON.parse(JSON.stringify(this.form));
  589. if (data['sex']) {
  590. data.sex = this.dictObj['sys_user_sex'][Number(data.sex)];
  591. }
  592. if (data['education']) {
  593. data.education = this.dictObj['edu_level'][Number(data.education)];
  594. }
  595. if (data['working_years']) {
  596. data.working_years = this.dictObj['working_years'][Number(data.working_years)];
  597. }
  598. if (data['recent_photos']) {
  599. data.recent_photos = await this.$method.uploadFile(data.recent_photos, 0);
  600. }
  601. if (data['idcard_face_photo']) {
  602. data.idcard_face_photo = await this.$method.uploadFile(data.idcard_face_photo, 0);
  603. }
  604. if (data['idcard_national_photo']) {
  605. data.idcard_national_photo = await this.$method.uploadFile(data.idcard_national_photo, 0);
  606. }
  607. if (data['commitment_electr_signature']) {
  608. data.commitment_electr_signature = await this.$method.uploadFile(data.commitment_electr_signature, 0);
  609. }
  610. this.uploadDatas(data);
  611. },
  612. //验证表单
  613. resultForm(int) {
  614. if (this.openVerify) {
  615. if (this.isRequired) {
  616. this.submitApi();
  617. } else {
  618. this.$refs.uForm.validate(valid => {
  619. if (valid) {
  620. if (int === 1) {
  621. this.submitApi();
  622. }
  623. } else {
  624. console.log('验证失败');
  625. }
  626. });
  627. }
  628. }
  629. },
  630. async submits() {
  631. var ast = this.listData.some(item => {
  632. return item.fieldKey === 'commitment_electr_signature';
  633. });
  634. if (ast) {
  635. await this.subCanvas();
  636. }
  637. this.openVerify = true;
  638. this.resultForm(1);
  639. },
  640. async changePhotoListHeader1(lists, name) {
  641. console.log(lists[0].url);
  642. if (lists.length) {
  643. this.fileList1 = lists;
  644. if (lists[0].url.indexOf('//tmp') !== -1) {
  645. this.$set(this.form, 'recent_photos', await this.$method.imageInfos(lists[0].url));
  646. }
  647. } else {
  648. this.fileList1 = [];
  649. this.$set(this.form, 'recent_photos', '');
  650. console.log(3, this.form.recent_photos);
  651. }
  652. this.$nextTick(function() {
  653. console.log(4);
  654. this.resultForm();
  655. });
  656. },
  657. async changePhotoListHeader2(lists, name) {
  658. if (lists.length) {
  659. this.fileList2 = lists;
  660. if (lists[0].url.indexOf('//tmp') !== -1) {
  661. this.$set(this.form, 'idcard_face_photo', await this.$method.imageInfos(lists[0].url));
  662. }
  663. } else {
  664. this.fileList2 = [];
  665. this.$set(this.form, 'idcard_face_photo', '');
  666. }
  667. this.$nextTick(function() {
  668. this.resultForm();
  669. });
  670. },
  671. async changePhotoListHeader3(lists, name) {
  672. if (lists.length) {
  673. this.fileList3 = lists;
  674. if (lists[0].url.indexOf('//tmp') !== -1) {
  675. this.$set(this.form, 'idcard_national_photo', await this.$method.imageInfos(lists[0].url));
  676. }
  677. } else {
  678. this.fileList3 = [];
  679. this.$set(this.form, 'idcard_national_photo', '');
  680. }
  681. this.$nextTick(function() {
  682. this.resultForm();
  683. });
  684. },
  685. getTimes(key) {
  686. if (this.form[key]) {
  687. return this.form[key];
  688. } else {
  689. return '请选择时间';
  690. }
  691. },
  692. getarrays(key) {
  693. if (key === 'sex') {
  694. return this.dictObj['sys_user_sex'];
  695. }
  696. if (key === 'education') {
  697. return this.dictObj['edu_level'];
  698. }
  699. if (key === 'working_years') {
  700. return this.dictObj['working_years'];
  701. }
  702. },
  703. returnName(key) {
  704. if (key === 'sex') {
  705. if (this.form[key]) {
  706. return this.dictObj['sys_user_sex'][Number(this.form[key])];
  707. } else {
  708. return '请选择性别';
  709. }
  710. }
  711. if (key === 'education') {
  712. if (this.form[key]) {
  713. return this.dictObj['edu_level'][Number(this.form[key])];
  714. } else {
  715. return '请选择学历';
  716. }
  717. }
  718. if (key === 'working_years') {
  719. if (this.form[key]) {
  720. return this.dictObj['working_years'][Number(this.form[key])];
  721. } else {
  722. return '请选择工作年限';
  723. }
  724. }
  725. },
  726. /**
  727. * getbaseprofiletpgetInfo接口返回值result.data.data不存在的话说明是第一次填写资料
  728. */
  729. getInfo() {
  730. var self = this;
  731. this.$api.getbaseprofiletpId(this.goodsId).then(res => {
  732. self.listData = JSON.parse(res.data.data.keyValue);
  733. self.isRequired = self.listData.every(ims => {
  734. return ims.required === false;
  735. });
  736. self.$api.getbaseprofiletpgetInfo({ goodsId: self.goodsId }).then(result => {
  737. if (result.data.code === 200) {
  738. if (!result.data.data) {
  739. self.$api.getbaseprofiletplistProfile({ pageNum: 1, pageSize: 1, status: 1 }).then(kit => {
  740. if (kit.data.rows.length) {
  741. var ajson = JSON.parse(kit.data.rows[0].keyValue);
  742. self.listData.forEach((zyitem, zyindex) => {
  743. for (let k in ajson) {
  744. if (zyitem.fieldKey == k && ajson[k].value) {
  745. if (k === 'sex') {
  746. const sexIndex = self.dictObj['sys_user_sex'].indexOf(ajson[k].value) + '';
  747. self.$set(self.form, k, sexIndex);
  748. } else if (k === 'education') {
  749. const sexIndex = self.dictObj['edu_level'].indexOf(ajson[k].value) + '';
  750. self.$set(self.form, k, sexIndex);
  751. } else if (k === 'working_years') {
  752. const sexIndex = self.dictObj['working_years'].indexOf(ajson[k].value) + '';
  753. self.$set(self.form, k, sexIndex);
  754. } else if (k === 'recent_photos') {
  755. self.$set(self.form, k, ajson[k].value);
  756. if (ajson[k].value) {
  757. self.fileList1 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  758. }
  759. } else if (k === 'idcard_face_photo') {
  760. self.$set(self.form, k, ajson[k].value);
  761. if (ajson[k].value) {
  762. self.fileList2 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  763. }
  764. } else if (k === 'idcard_national_photo') {
  765. self.$set(self.form, k, ajson[k].value);
  766. if (ajson[k].value) {
  767. self.fileList3 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  768. }
  769. } else {
  770. if(k === 'name'){
  771. self.$set(self.form, k, this.$store.state.userInfo.realname);
  772. } else if(k === 'idcard'){
  773. self.$set(self.form, k, this.$store.state.userInfo.idCard);
  774. } else if(k === 'telphone'){
  775. self.$set(self.form, k, this.$store.state.userInfo.telphone);
  776. } else if(k !== 'commitment_electr_signature'){
  777. self.$set(self.form, k, ajson[k].value);
  778. }
  779. }
  780. }
  781. }
  782. });
  783. }
  784. });
  785. }
  786. if (result.data.data && result.data.data.status === 3) {
  787. self.remark = result.data.data.text;
  788. self.remarkStatus = true;
  789. self.id = result.data.data.id;
  790. var arrays = JSON.parse(result.data.data.keyValue);
  791. self.copyData = JSON.parse(JSON.stringify(arrays));
  792. for (let k in arrays) {
  793. if (k === 'sex') {
  794. if (arrays[k].value) {
  795. const sexIndex = self.dictObj['sys_user_sex'].indexOf(arrays[k].value) + '';
  796. self.$set(self.form, k, sexIndex);
  797. }
  798. } else if (k === 'education') {
  799. if (arrays[k].value) {
  800. const sexIndex = self.dictObj['edu_level'].indexOf(arrays[k].value) + '';
  801. self.$set(self.form, k, sexIndex);
  802. }
  803. } else if (k === 'working_years') {
  804. if (arrays[k].value) {
  805. const sexIndex = self.dictObj['working_years'].indexOf(arrays[k].value) + '';
  806. self.$set(self.form, k, sexIndex);
  807. }
  808. } else if (k === 'recent_photos') {
  809. self.$set(self.form, k, arrays[k].value);
  810. if (arrays[k].value) {
  811. self.fileList1 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  812. }
  813. } else if (k === 'idcard_face_photo') {
  814. self.$set(self.form, k, arrays[k].value);
  815. if (arrays[k].value) {
  816. self.fileList2 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  817. }
  818. } else if (k === 'idcard_national_photo') {
  819. self.$set(self.form, k, arrays[k].value);
  820. if (arrays[k].value) {
  821. self.fileList3 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  822. }
  823. } else {
  824. self.$set(self.form, k, arrays[k].value);
  825. }
  826. }
  827. } else if (result.data.data && (result.data.data.status === 1 || result.data.data.status === 2)) {
  828. uni.showModal({
  829. showCancel: false,
  830. content:
  831. result.data.data.status === 1
  832. ? '该商品审核资料已通过,不可重复提交资料'
  833. : result.data.data.status === 2
  834. ? '该商品审核资料处于待审核状态,不可重复提交资料'
  835. : '请联系管理员',
  836. success: function(k) {
  837. if (k.confirm) {
  838. uni.navigateBack();
  839. }
  840. }
  841. });
  842. }
  843. }
  844. });
  845. });
  846. },
  847. bindPickerChange(key, e) {
  848. this.$set(this.form, key, e.detail.value);
  849. this.$nextTick(function() {
  850. this.resultForm();
  851. });
  852. },
  853. bindDateChange(key, e) {
  854. this.form[key] = e.detail.value;
  855. },
  856. retDraw() {
  857. this.handwriting.retDraw();
  858. this.$set(this.form, 'commitment_electr_signature', '');
  859. this.$nextTick(function() {
  860. this.resultForm();
  861. });
  862. },
  863. uploadScaleStart(event) {
  864. this.handwriting.uploadScaleStart(event);
  865. },
  866. uploadScaleMove(event) {
  867. this.handwriting.uploadScaleMove(event);
  868. },
  869. uploadScaleEnd(event) {
  870. this.handwriting.uploadScaleEnd(event);
  871. },
  872. subCanvas() {
  873. return new Promise((resolve, reject) => {
  874. var self = this;
  875. if (self.form.commitment_electr_signature) {
  876. resolve();
  877. return;
  878. }
  879. self.handwriting
  880. .saveCanvas()
  881. .then(res => {
  882. if (this.handwriting.linePrack.length) {
  883. this.$set(this.form, 'commitment_electr_signature', res);
  884. }
  885. resolve(res);
  886. })
  887. .catch(err => {
  888. uni.showToast({
  889. title: '签名上传失败',
  890. icon: 'error'
  891. });
  892. });
  893. });
  894. }
  895. }
  896. };
  897. </script>
  898. <style>
  899. page {
  900. background: #eaeef1;
  901. }
  902. </style>
  903. <style scope>
  904. .ctoples {
  905. position: absolute;
  906. top: 0;
  907. left: 0;
  908. padding: 2rpx 23rpx;
  909. display: inline-block;
  910. background-color: rgba(0, 0, 0, 0.4);
  911. font-size: 28rpx;
  912. color: #fff;
  913. border-bottom-right-radius: 24rpx;
  914. }
  915. .handWriting {
  916. width: 100%;
  917. height: 100%;
  918. }
  919. /deep/ .u-collapse-title {
  920. color: red;
  921. font-size: 24rpx;
  922. }
  923. .collapse-item {
  924. color: #666;
  925. font-size: 24rpx;
  926. padding-bottom: 30rpx;
  927. }
  928. .dis_stys {
  929. display: flex;
  930. align-items: center;
  931. justify-content: space-between;
  932. }
  933. .handCenter {
  934. background: #f7f7f7;
  935. border: 2rpx solid #eeeeee;
  936. border-radius: 24rpx;
  937. width: 100%;
  938. height: 300rpx;
  939. overflow: hidden;
  940. }
  941. .headerSDels {
  942. height: 58rpx;
  943. padding: 0rpx 24rpx;
  944. font-weight: bold;
  945. display: flex;
  946. align-items: center;
  947. flex-direction: row-reverse;
  948. }
  949. .listBox {
  950. margin: 24rpx 32rpx 0rpx;
  951. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  952. border-radius: 32rpx;
  953. background-color: #fff;
  954. overflow: hidden;
  955. }
  956. .imgBoxs {
  957. width: 156rpx;
  958. height: 203rpx;
  959. }
  960. .imgBoxs2 {
  961. width: 171rpx;
  962. height: 108rpx;
  963. }
  964. .submit_btn {
  965. width: 526rpx;
  966. height: 80rpx;
  967. background: #007aff;
  968. border-radius: 40rpx;
  969. text-align: center;
  970. line-height: 80rpx;
  971. color: #ffffff;
  972. margin: 30rpx auto;
  973. }
  974. .picker {
  975. text-align: right;
  976. }
  977. input {
  978. text-align: right;
  979. }
  980. .bodyBox {
  981. background: #ffffff;
  982. border-radius: 24rpx;
  983. width: 100%;
  984. }
  985. .topBox {
  986. height: 80rpx;
  987. background: #ffffff;
  988. border-radius: 24rpx;
  989. width: 100%;
  990. display: flex;
  991. justify-content: space-between;
  992. line-height: 80rpx;
  993. padding: 0 20rpx;
  994. font-size: 24rpx;
  995. }
  996. </style>