input.vue 32 KB

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