input.vue 31 KB

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