input.vue 33 KB

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