input.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169
  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">
  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 :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. isRequired: false
  499. };
  500. },
  501. created() {
  502. this.$store.getters.dictObj;
  503. },
  504. async onLoad(option) {
  505. this.goodsId = Number(option.id);
  506. await this.getGoodsDetail()
  507. this.getInfo();
  508. },
  509. onReady(res) {
  510. this.handwriting = new Handwriting({
  511. lineColor: this.lineColor,
  512. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  513. canvasName: 'handWriting'
  514. });
  515. this.$refs.uForm.setRules(this.rules);
  516. },
  517. computed: { ...mapGetters(['dictObj','userInfo']) },
  518. watch:{
  519. userInfo(val, oldVal){//普通的watch监听
  520. if(val){
  521. this.listData.forEach(item => {
  522. if(item.fieldKey == "idcard") {
  523. this.form.idcard = this.userInfo.idCard;
  524. }
  525. if(item.fieldKey == "telphone") {
  526. this.form.telphone = this.userInfo.telphone;
  527. }
  528. if(item.fieldKey == "name") {
  529. this.form.name = this.userInfo.realname
  530. }
  531. })
  532. }
  533. },
  534. },
  535. methods: {
  536. getGoodsDetail() {
  537. return new Promise(resolve => {
  538. this.$api.goodsDetail(this.goodsId).then(res => {
  539. this.goodsData = res.data.data;
  540. if(this.goodsData.categoryName) {
  541. this.form.apply_post = this.goodsData.categoryName;
  542. }
  543. resolve()
  544. })
  545. })
  546. },
  547. agree() {
  548. this.agreementModal = false;
  549. },
  550. refuseAgreement() {
  551. uni.navigateBack({
  552. delta:1
  553. })
  554. },
  555. clearFun(key) {
  556. this.form[key] = '';
  557. },
  558. //清除按钮
  559. clearWatch(key) {
  560. if (this.form[key]) {
  561. return true;
  562. } else {
  563. return false;
  564. }
  565. },
  566. cahngeText() {
  567. this.$set(this.form, 'name', '唐');
  568. console.log(this.form.name, 123);
  569. },
  570. uploadDatas(data) {
  571. var self = this;
  572. if (self.remarkStatus) {
  573. var arsty = {};
  574. for (let k in data) {
  575. for (let j in self.copyData) {
  576. if (k === j) {
  577. if (self.copyData[j].value === data[k]) {
  578. arsty[k] = {
  579. fieldKey: k,
  580. value: data[k],
  581. fieldName: (function() {
  582. for (let i = 0; i < self.listData.length; i++) {
  583. if (self.listData[i].fieldKey == k) {
  584. return self.listData[i].fieldName;
  585. }
  586. }
  587. })(),
  588. status: 0
  589. };
  590. } else {
  591. arsty[k] = {
  592. fieldKey: k,
  593. value: data[k],
  594. fieldName: (function() {
  595. for (let i = 0; i < self.listData.length; i++) {
  596. if (self.listData[i].fieldKey == k) {
  597. return self.listData[i].fieldName;
  598. }
  599. }
  600. })(),
  601. status: 1
  602. };
  603. }
  604. }
  605. }
  606. }
  607. var datas = {
  608. id: this.id,
  609. goodsId: this.goodsId,
  610. keyValue: JSON.stringify(arsty)
  611. };
  612. if(this.isUploading) {
  613. return;
  614. }
  615. this.isUploading = true;
  616. this.$api.editbaseprofiletp(datas).then(res => {
  617. this.isUploading = false;
  618. if (res.data.code === 200) {
  619. this.$method.showToast('提交成功');
  620. uni.navigateBack();
  621. }
  622. });
  623. } else {
  624. var objs = {};
  625. for (let k in data) {
  626. objs[k] = {
  627. fieldKey: k,
  628. value: data[k],
  629. fieldName: (function() {
  630. for (let i = 0; i < self.listData.length; i++) {
  631. if (self.listData[i].fieldKey == k) {
  632. return self.listData[i].fieldName;
  633. }
  634. }
  635. })(),
  636. status: 0
  637. };
  638. }
  639. var datas = {
  640. goodsId: this.goodsId,
  641. profileTpId: this.goodsId,
  642. keyValue: JSON.stringify(objs)
  643. };
  644. if(this.isUploading) {
  645. return;
  646. }
  647. this.isUploading = true;
  648. this.$api.addbaseprofiletp(datas).then(res => {
  649. this.isUploading = false;
  650. if (res.data.code === 200) {
  651. this.$method.showToast('提交成功');
  652. uni.navigateBack();
  653. }
  654. });
  655. }
  656. },
  657. backPage() {
  658. uni.navigateBack();
  659. },
  660. //提交表单
  661. async submitApi() {
  662. var data = JSON.parse(JSON.stringify(this.form));
  663. if (data['sex']) {
  664. data.sex = this.dictObj['sys_user_sex'][Number(data.sex)];
  665. }
  666. if (data['education']) {
  667. data.education = this.dictObj['edu_level'][Number(data.education)];
  668. }
  669. if (data['working_years']) {
  670. data.working_years = this.dictObj['working_years'][Number(data.working_years)];
  671. }
  672. if (data['recent_photos']) {
  673. data.recent_photos = await this.$method.uploadFile(data.recent_photos, 0);
  674. }
  675. if (data['idcard_face_photo']) {
  676. data.idcard_face_photo = await this.$method.uploadFile(data.idcard_face_photo, 0);
  677. }
  678. if (data['idcard_national_photo']) {
  679. data.idcard_national_photo = await this.$method.uploadFile(data.idcard_national_photo, 0);
  680. }
  681. if (data['commitment_electr_signature']) {
  682. data.commitment_electr_signature = await this.$method.uploadFile(data.commitment_electr_signature, 0);
  683. }
  684. this.uploadDatas(data);
  685. },
  686. //验证表单
  687. resultForm(int) {
  688. if (this.openVerify) {
  689. if (this.isRequired) {
  690. this.submitApi();
  691. } else {
  692. if(int === 1) {
  693. this.errorType = ['toast'];
  694. } else {
  695. this.errorType = ['message'];
  696. }
  697. this.$nextTick(() => {
  698. this.$refs.uForm.validate(valid => {
  699. if (valid) {
  700. if (int === 1) {
  701. this.submitApi();
  702. }
  703. } else {
  704. this.errorType = ['message'];
  705. console.log('验证失败');
  706. }
  707. });
  708. })
  709. }
  710. }
  711. },
  712. async submits() {
  713. var ast = this.listData.some(item => {
  714. return item.fieldKey === 'commitment_electr_signature';
  715. });
  716. if (ast) {
  717. await this.subCanvas();
  718. }
  719. this.openVerify = true;
  720. this.resultForm(1);
  721. },
  722. async changePhotoListHeader1(lists, name) {
  723. if (lists.length) {
  724. this.fileList1 = lists;
  725. if (lists[0].url.indexOf('//tmp') !== -1 || lists[0].url.indexOf('//temp') !== -1) {
  726. this.$set(this.form, 'recent_photos', await this.$method.imageInfos(lists[0].url));
  727. }
  728. } else {
  729. this.fileList1 = [];
  730. this.$set(this.form, 'recent_photos', '');
  731. console.log(3, this.form.recent_photos);
  732. }
  733. this.$nextTick(function() {
  734. console.log(4);
  735. this.resultForm();
  736. });
  737. },
  738. async changePhotoListHeader2(lists, name) {
  739. if (lists.length) {
  740. this.fileList2 = lists;
  741. console.log(lists,'lists')
  742. if (lists[0].url.indexOf('//tmp') !== -1 || lists[0].url.indexOf('//temp') !== -1) {
  743. this.$set(this.form, 'idcard_face_photo', await this.$method.imageInfos(lists[0].url));
  744. }
  745. } else {
  746. this.fileList2 = [];
  747. this.$set(this.form, 'idcard_face_photo', '');
  748. }
  749. this.$nextTick(function() {
  750. this.resultForm();
  751. });
  752. },
  753. async changePhotoListHeader3(lists, name) {
  754. if (lists.length) {
  755. this.fileList3 = lists;
  756. if (lists[0].url.indexOf('//tmp') !== -1 || lists[0].url.indexOf('//temp') !== -1) {
  757. this.$set(this.form, 'idcard_national_photo', await this.$method.imageInfos(lists[0].url));
  758. }
  759. } else {
  760. this.fileList3 = [];
  761. this.$set(this.form, 'idcard_national_photo', '');
  762. }
  763. this.$nextTick(function() {
  764. this.resultForm();
  765. });
  766. },
  767. getTimes(key) {
  768. if (this.form[key]) {
  769. return this.form[key];
  770. } else {
  771. return '请选择时间';
  772. }
  773. },
  774. getarrays(key) {
  775. if (key === 'sex') {
  776. return this.dictObj['sys_user_sex'];
  777. }
  778. if (key === 'education') {
  779. return this.dictObj['edu_level'];
  780. }
  781. if (key === 'working_years') {
  782. return this.dictObj['working_years'];
  783. }
  784. },
  785. returnName(key) {
  786. if (key === 'sex') {
  787. if (this.form[key]) {
  788. return this.dictObj['sys_user_sex'][Number(this.form[key])];
  789. } else {
  790. return '请选择性别';
  791. }
  792. }
  793. if (key === 'education') {
  794. if (this.form[key]) {
  795. return this.dictObj['edu_level'][Number(this.form[key])];
  796. } else {
  797. return '请选择学历';
  798. }
  799. }
  800. if (key === 'working_years') {
  801. if (this.form[key]) {
  802. return this.dictObj['working_years'][Number(this.form[key])];
  803. } else {
  804. return '请选择工作年限';
  805. }
  806. }
  807. },
  808. /**
  809. * getbaseprofiletpgetInfo接口返回值result.data.data不存在的话说明是第一次填写资料
  810. */
  811. getInfo() {
  812. var self = this;
  813. this.$api.getbaseprofiletpId(this.goodsId).then(res => {
  814. self.listData = JSON.parse(res.data.data.keyValue);
  815. self.listData.forEach(item => {
  816. if(item.fieldKey == "idcard") {
  817. this.form.idcard = this.userInfo.idCard;
  818. }
  819. if(item.fieldKey == "telphone") {
  820. this.form.telphone = this.userInfo.telphone;
  821. }
  822. if(item.fieldKey == "name") {
  823. this.form.name = this.userInfo.realname
  824. }
  825. })
  826. self.isRequired = self.listData.every(ims => {
  827. return ims.required === false;
  828. });
  829. this.$nextTick(() => {
  830. this.agreementModal = true;
  831. })
  832. self.$api.getbaseprofiletpgetInfo({ goodsId: self.goodsId }).then(result => {
  833. if (result.data.code === 200) {
  834. if (!result.data.data) {
  835. self.$api.getbaseprofiletplistProfile({ pageNum: 1, pageSize: 1, status: 1 }).then(kit => {
  836. if (kit.data.rows.length) {
  837. var ajson = JSON.parse(kit.data.rows[0].keyValue);
  838. self.listData.forEach((zyitem, zyindex) => {
  839. for (let k in ajson) {
  840. if (zyitem.fieldKey == k && ajson[k].value) {
  841. if (k === 'sex') {
  842. const sexIndex = self.dictObj['sys_user_sex'].indexOf(ajson[k].value) + '';
  843. self.$set(self.form, k, sexIndex);
  844. } else if (k === 'education') {
  845. const sexIndex = self.dictObj['edu_level'].indexOf(ajson[k].value) + '';
  846. self.$set(self.form, k, sexIndex);
  847. } else if (k === 'working_years') {
  848. const sexIndex = self.dictObj['working_years'].indexOf(ajson[k].value) + '';
  849. self.$set(self.form, k, sexIndex);
  850. } else if (k === 'recent_photos') {
  851. self.$set(self.form, k, ajson[k].value);
  852. if (ajson[k].value) {
  853. self.fileList1 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  854. }
  855. } else if (k === 'idcard_face_photo') {
  856. self.$set(self.form, k, ajson[k].value);
  857. if (ajson[k].value) {
  858. self.fileList2 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  859. }
  860. } else if (k === 'idcard_national_photo') {
  861. self.$set(self.form, k, ajson[k].value);
  862. if (ajson[k].value) {
  863. self.fileList3 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  864. }
  865. } else {
  866. if(k === 'name'){
  867. self.$set(self.form, k, this.$store.state.userInfo.realname);
  868. } else if(k === 'idcard'){
  869. self.$set(self.form, k, this.$store.state.userInfo.idCard);
  870. } else if(k === 'telphone'){
  871. self.$set(self.form, k, this.$store.state.userInfo.telphone);
  872. } else if(k !== 'commitment_electr_signature'){
  873. self.$set(self.form, k, ajson[k].value);
  874. }
  875. }
  876. }
  877. }
  878. });
  879. }
  880. });
  881. }
  882. if (result.data.data && result.data.data.status === 3) {
  883. self.remark = result.data.data.text;
  884. self.remarkStatus = true;
  885. self.id = result.data.data.id;
  886. var arrays = JSON.parse(result.data.data.keyValue);
  887. self.copyData = JSON.parse(JSON.stringify(arrays));
  888. for (let k in arrays) {
  889. if (k === 'sex') {
  890. if (arrays[k].value) {
  891. const sexIndex = self.dictObj['sys_user_sex'].indexOf(arrays[k].value) + '';
  892. self.$set(self.form, k, sexIndex);
  893. }
  894. } else if (k === 'education') {
  895. if (arrays[k].value) {
  896. const sexIndex = self.dictObj['edu_level'].indexOf(arrays[k].value) + '';
  897. self.$set(self.form, k, sexIndex);
  898. }
  899. } else if (k === 'working_years') {
  900. if (arrays[k].value) {
  901. const sexIndex = self.dictObj['working_years'].indexOf(arrays[k].value) + '';
  902. self.$set(self.form, k, sexIndex);
  903. }
  904. } else if (k === 'recent_photos') {
  905. self.$set(self.form, k, arrays[k].value);
  906. if (arrays[k].value) {
  907. self.fileList1 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  908. }
  909. } else if (k === 'idcard_face_photo') {
  910. self.$set(self.form, k, arrays[k].value);
  911. if (arrays[k].value) {
  912. self.fileList2 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  913. }
  914. } else if (k === 'idcard_national_photo') {
  915. self.$set(self.form, k, arrays[k].value);
  916. if (arrays[k].value) {
  917. self.fileList3 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  918. }
  919. } else {
  920. self.$set(self.form, k, arrays[k].value);
  921. }
  922. }
  923. } else if (result.data.data && (result.data.data.status === 1 || result.data.data.status === 2)) {
  924. uni.showModal({
  925. showCancel: false,
  926. content:
  927. result.data.data.status === 1
  928. ? '该商品审核资料已通过,不可重复提交资料'
  929. : result.data.data.status === 2
  930. ? '该商品审核资料处于待审核状态,不可重复提交资料'
  931. : '请联系管理员',
  932. success: function(k) {
  933. if (k.confirm) {
  934. uni.navigateBack();
  935. }
  936. }
  937. });
  938. }
  939. }
  940. });
  941. });
  942. },
  943. bindPickerChange(key, e) {
  944. this.$set(this.form, key, e.detail.value);
  945. this.$nextTick(function() {
  946. this.resultForm();
  947. });
  948. },
  949. bindDateChange(key, e) {
  950. this.form[key] = e.detail.value;
  951. },
  952. retDraw() {
  953. this.handwriting.retDraw();
  954. this.$set(this.form, 'commitment_electr_signature', '');
  955. this.$nextTick(function() {
  956. this.resultForm();
  957. });
  958. },
  959. uploadScaleStart(event) {
  960. this.handwriting.uploadScaleStart(event);
  961. },
  962. uploadScaleMove(event) {
  963. this.handwriting.uploadScaleMove(event);
  964. },
  965. uploadScaleEnd(event) {
  966. this.handwriting.uploadScaleEnd(event);
  967. },
  968. subCanvas() {
  969. return new Promise((resolve, reject) => {
  970. var self = this;
  971. if (self.form.commitment_electr_signature) {
  972. resolve();
  973. return;
  974. }
  975. self.handwriting
  976. .saveCanvas()
  977. .then(res => {
  978. console.log(res,'res')
  979. if (this.handwriting.linePrack.length) {
  980. this.$set(this.form, 'commitment_electr_signature', res);
  981. }
  982. resolve(res);
  983. })
  984. .catch(err => {
  985. uni.showToast({
  986. title: '签名上传失败',
  987. icon: 'error'
  988. });
  989. });
  990. });
  991. }
  992. }
  993. };
  994. </script>
  995. <style>
  996. page {
  997. background: #eaeef1;
  998. }
  999. </style>
  1000. <style scope lang="scss">
  1001. .ctoples {
  1002. position: absolute;
  1003. top: 0;
  1004. left: 0;
  1005. padding: 2rpx 23rpx;
  1006. display: inline-block;
  1007. background-color: rgba(0, 0, 0, 0.4);
  1008. font-size: 28rpx;
  1009. color: #fff;
  1010. border-bottom-right-radius: 24rpx;
  1011. }
  1012. .handWriting {
  1013. width: 100%;
  1014. height: 100%;
  1015. }
  1016. /deep/ .u-collapse-title {
  1017. color: #FF3B30;
  1018. font-size: 24rpx;
  1019. }
  1020. .collapse-item {
  1021. color: #666;
  1022. font-size: 24rpx;
  1023. padding-bottom: 30rpx;
  1024. }
  1025. .dis_stys {
  1026. display: flex;
  1027. align-items: center;
  1028. justify-content: space-between;
  1029. }
  1030. .handCenter {
  1031. background: #f7f7f7;
  1032. border: 2rpx solid #eeeeee;
  1033. border-radius: 24rpx;
  1034. width: 100%;
  1035. height: 300rpx;
  1036. overflow: hidden;
  1037. }
  1038. .headerSDels {
  1039. height: 58rpx;
  1040. padding: 0rpx 24rpx;
  1041. font-weight: bold;
  1042. display: flex;
  1043. align-items: center;
  1044. flex-direction: row-reverse;
  1045. }
  1046. .listBox {
  1047. margin: 24rpx 32rpx 0rpx;
  1048. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1049. border-radius: 32rpx;
  1050. background-color: #fff;
  1051. overflow: hidden;
  1052. }
  1053. .imgBoxs {
  1054. width: 156rpx;
  1055. height: 203rpx;
  1056. }
  1057. .imgBoxs2 {
  1058. width: 171rpx;
  1059. height: 108rpx;
  1060. }
  1061. .submit_btn {
  1062. width: 526rpx;
  1063. height: 80rpx;
  1064. background: #007aff;
  1065. border-radius: 40rpx;
  1066. text-align: center;
  1067. line-height: 80rpx;
  1068. color: #ffffff;
  1069. margin: 30rpx auto;
  1070. }
  1071. .picker {
  1072. text-align: right;
  1073. }
  1074. input {
  1075. text-align: right;
  1076. }
  1077. .bodyBox {
  1078. background: #ffffff;
  1079. border-radius: 24rpx;
  1080. width: 100%;
  1081. }
  1082. .topBox {
  1083. height: 80rpx;
  1084. background: #ffffff;
  1085. border-radius: 24rpx;
  1086. width: 100%;
  1087. display: flex;
  1088. justify-content: space-between;
  1089. line-height: 80rpx;
  1090. padding: 0 20rpx;
  1091. font-size: 24rpx;
  1092. }
  1093. .modal {
  1094. .agreement {
  1095. width: 640rpx;
  1096. height: 740rpx;
  1097. background: #FFFFFF;
  1098. display: flex;
  1099. flex-direction: column;
  1100. .body {
  1101. flex:1;
  1102. .content {
  1103. padding:30rpx 40rpx 28rpx;
  1104. line-height: 40rpx;
  1105. font-size: 26rpx;
  1106. color:#666;
  1107. .bold {
  1108. color:#333;
  1109. font-size: 26rpx;
  1110. font-weight: bold;
  1111. }
  1112. .center {
  1113. text-align: center;
  1114. }
  1115. }
  1116. }
  1117. .footer {
  1118. height:140rpx;
  1119. border-top:1px solid #EEEEEE;
  1120. display: flex;
  1121. align-items: center;
  1122. justify-content: center;
  1123. .btn {
  1124. margin:0 12rpx;
  1125. width: 200rpx;
  1126. height: 80rpx;
  1127. color:#007AFF;
  1128. font-size: 30rpx;
  1129. text-align: center;
  1130. line-height: 80rpx;
  1131. background: #F5F5F5;
  1132. border-radius: 40rpx 40rpx 40rpx 40rpx;
  1133. &.ok {
  1134. width: 336rpx;
  1135. height: 80rpx;
  1136. background: #007AFF;
  1137. color:#fff;
  1138. }
  1139. &.close {
  1140. color:#fff;
  1141. width: 560rpx;
  1142. height: 80rpx;
  1143. background: #007AFF;
  1144. border-radius: 40rpx 40rpx 40rpx 40rpx;
  1145. }
  1146. }
  1147. }
  1148. }
  1149. }
  1150. </style>