input.vue 32 KB

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