input.vue 31 KB

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