input.vue 33 KB

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