input.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155
  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">
  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. agreementModal:true,
  302. goodsData:{},
  303. itemStyle: {
  304. marginTop: '20px',
  305. backgroundColor: '#fff',
  306. borderRadius: '24rpx',
  307. padding: '0rpx 20rpx'
  308. },
  309. isUploading:false,
  310. form: {
  311. name: '',
  312. sex: '',
  313. idcard: '',
  314. telphone: '',
  315. education: '',
  316. school: '',
  317. graduation_time: '',
  318. work_unit: '',
  319. unit_contact: '',
  320. unit_tel: '',
  321. apply_post: '',
  322. major: '',
  323. working_years: '',
  324. recent_photos: '',
  325. idcard_face_photo: '',
  326. idcard_national_photo: '',
  327. commitment_electr_signature: ''
  328. },
  329. lineColor: 'black',
  330. slideValue: 50,
  331. handwriting: '',
  332. goodsId: null,
  333. listData: [], //页面数据
  334. fileList1: [], //个人近照
  335. fileList2: [], //人像
  336. fileList3: [], //国徽
  337. openVerify: false, // 控制是否手动验证
  338. id: null, //获取修改ID内容
  339. remark: '', //反馈文本
  340. remarkStatus: false, //是否存在审核结果反馈
  341. // nextStatus: false, //是否有下一步
  342. copyData: [], //备份数据
  343. rules: {
  344. name: [
  345. {
  346. required: true,
  347. message: '请输入姓名',
  348. trigger: ['change', 'blur']
  349. }
  350. ],
  351. sex: [
  352. {
  353. required: true,
  354. message: '请选择性别',
  355. trigger: 'change'
  356. }
  357. ],
  358. idcard: [
  359. {
  360. required: true,
  361. message: '请输入身份证号',
  362. trigger: ['change', 'blur']
  363. },
  364. {
  365. validator: (rule, value, callback) => {
  366. return this.$u.test.idCard(value);
  367. },
  368. message: '身份证号不正确',
  369. trigger: ['change', 'blur']
  370. }
  371. ],
  372. telphone: [
  373. {
  374. required: true,
  375. message: '请输入手机号码',
  376. trigger: ['change', 'blur']
  377. },
  378. {
  379. validator: (rule, value, callback) => {
  380. var vartest = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
  381. if (this.$u.test.mobile(value) || vartest.test(value)) {
  382. return true;
  383. } else {
  384. return false;
  385. }
  386. },
  387. message: '手机号码不正确',
  388. trigger: ['change', 'blur']
  389. }
  390. ],
  391. education: [
  392. {
  393. required: true,
  394. message: '请选择学历',
  395. trigger: 'change'
  396. }
  397. ],
  398. school: [
  399. {
  400. required: true,
  401. message: '请输入毕业院校',
  402. trigger: ['change', 'blur']
  403. }
  404. ],
  405. graduation_time: [
  406. {
  407. required: true,
  408. message: '请选择毕业时间',
  409. trigger: 'change'
  410. }
  411. ],
  412. work_unit: [
  413. {
  414. required: true,
  415. message: '请输入工作单位',
  416. trigger: ['change', 'blur']
  417. }
  418. ],
  419. unit_contact: [
  420. {
  421. required: true,
  422. message: '请输入单位联系人',
  423. trigger: ['change', 'blur']
  424. }
  425. ],
  426. unit_tel: [
  427. {
  428. required: true,
  429. message: '请输入单位联系电话',
  430. trigger: ['change', 'blur']
  431. },
  432. {
  433. validator: (rule, value, callback) => {
  434. var vartest = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
  435. var vartest1 = /^([0-9]{3,4})?[0-9]{7,8}$/;
  436. if (this.$u.test.mobile(value) || vartest.test(value) || vartest1.test(value)) {
  437. return true;
  438. } else {
  439. return false;
  440. }
  441. },
  442. message: '单位联系电话不正确',
  443. trigger: ['change', 'blur']
  444. }
  445. ],
  446. apply_post: [
  447. {
  448. required: true,
  449. message: '请输入报名岗位',
  450. trigger: ['change', 'blur']
  451. }
  452. ],
  453. major: [
  454. {
  455. required: true,
  456. message: '请输入所学专业',
  457. trigger: ['change', 'blur']
  458. }
  459. ],
  460. working_years: [
  461. {
  462. required: true,
  463. message: '请选择工作年限',
  464. trigger: 'change'
  465. }
  466. ],
  467. recent_photos: [
  468. {
  469. required: true,
  470. message: '请上传个人近照',
  471. trigger: ['change', 'blur']
  472. }
  473. ],
  474. idcard_face_photo: [
  475. {
  476. required: true,
  477. message: '请上传身份证正面照',
  478. trigger: ['change', 'blur']
  479. }
  480. ],
  481. idcard_national_photo: [
  482. {
  483. required: true,
  484. message: '请上传身份证国徽照',
  485. trigger: ['change', 'blur']
  486. }
  487. ],
  488. commitment_electr_signature: [
  489. {
  490. required: true,
  491. message: '请签写承诺书电子签',
  492. trigger: ['change', 'blur']
  493. }
  494. ]
  495. },
  496. isRequired: false
  497. };
  498. },
  499. created() {
  500. this.$store.getters.dictObj;
  501. },
  502. async onLoad(option) {
  503. this.goodsId = Number(option.id);
  504. await this.getGoodsDetail()
  505. this.getInfo();
  506. },
  507. onReady(res) {
  508. this.handwriting = new Handwriting({
  509. lineColor: this.lineColor,
  510. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  511. canvasName: 'handWriting'
  512. });
  513. this.$refs.uForm.setRules(this.rules);
  514. },
  515. computed: { ...mapGetters(['dictObj','userInfo']) },
  516. watch:{
  517. userInfo(val, oldVal){//普通的watch监听
  518. if(val){
  519. this.listData.forEach(item => {
  520. if(item.fieldKey == "idcard") {
  521. this.form.idcard = this.userInfo.idCard;
  522. }
  523. if(item.fieldKey == "telphone") {
  524. this.form.telphone = this.userInfo.telphone;
  525. }
  526. if(item.fieldKey == "name") {
  527. this.form.name = this.userInfo.realname
  528. }
  529. })
  530. }
  531. },
  532. },
  533. methods: {
  534. getGoodsDetail() {
  535. return new Promise(resolve => {
  536. this.$api.goodsDetail(this.goodsId).then(res => {
  537. this.goodsData = res.data.data;
  538. resolve()
  539. })
  540. })
  541. },
  542. agree() {
  543. this.agreementModal = false;
  544. },
  545. refuseAgreement() {
  546. uni.navigateBack({
  547. delta:1
  548. })
  549. },
  550. clearFun(key) {
  551. this.form[key] = '';
  552. },
  553. //清除按钮
  554. clearWatch(key) {
  555. if (this.form[key]) {
  556. return true;
  557. } else {
  558. return false;
  559. }
  560. },
  561. cahngeText() {
  562. this.$set(this.form, 'name', '唐');
  563. console.log(this.form.name, 123);
  564. },
  565. uploadDatas(data) {
  566. var self = this;
  567. if (self.remarkStatus) {
  568. var arsty = {};
  569. for (let k in data) {
  570. for (let j in self.copyData) {
  571. if (k === j) {
  572. if (self.copyData[j].value === data[k]) {
  573. arsty[k] = {
  574. fieldKey: k,
  575. value: data[k],
  576. fieldName: (function() {
  577. for (let i = 0; i < self.listData.length; i++) {
  578. if (self.listData[i].fieldKey == k) {
  579. return self.listData[i].fieldName;
  580. }
  581. }
  582. })(),
  583. status: 0
  584. };
  585. } else {
  586. arsty[k] = {
  587. fieldKey: k,
  588. value: data[k],
  589. fieldName: (function() {
  590. for (let i = 0; i < self.listData.length; i++) {
  591. if (self.listData[i].fieldKey == k) {
  592. return self.listData[i].fieldName;
  593. }
  594. }
  595. })(),
  596. status: 1
  597. };
  598. }
  599. }
  600. }
  601. }
  602. var datas = {
  603. id: this.id,
  604. goodsId: this.goodsId,
  605. keyValue: JSON.stringify(arsty)
  606. };
  607. if(this.isUploading) {
  608. return;
  609. }
  610. this.isUploading = true;
  611. this.$api.editbaseprofiletp(datas).then(res => {
  612. this.isUploading = false;
  613. if (res.data.code === 200) {
  614. this.$method.showToast('提交成功');
  615. uni.navigateBack();
  616. }
  617. });
  618. } else {
  619. var objs = {};
  620. for (let k in data) {
  621. objs[k] = {
  622. fieldKey: k,
  623. value: data[k],
  624. fieldName: (function() {
  625. for (let i = 0; i < self.listData.length; i++) {
  626. if (self.listData[i].fieldKey == k) {
  627. return self.listData[i].fieldName;
  628. }
  629. }
  630. })(),
  631. status: 0
  632. };
  633. }
  634. var datas = {
  635. goodsId: this.goodsId,
  636. profileTpId: this.goodsId,
  637. keyValue: JSON.stringify(objs)
  638. };
  639. if(this.isUploading) {
  640. return;
  641. }
  642. this.isUploading = true;
  643. this.$api.addbaseprofiletp(datas).then(res => {
  644. this.isUploading = false;
  645. if (res.data.code === 200) {
  646. this.$method.showToast('提交成功');
  647. uni.navigateBack();
  648. }
  649. });
  650. }
  651. },
  652. backPage() {
  653. uni.navigateBack();
  654. },
  655. //提交表单
  656. async submitApi() {
  657. var data = JSON.parse(JSON.stringify(this.form));
  658. if (data['sex']) {
  659. data.sex = this.dictObj['sys_user_sex'][Number(data.sex)];
  660. }
  661. if (data['education']) {
  662. data.education = this.dictObj['edu_level'][Number(data.education)];
  663. }
  664. if (data['working_years']) {
  665. data.working_years = this.dictObj['working_years'][Number(data.working_years)];
  666. }
  667. if (data['recent_photos']) {
  668. data.recent_photos = await this.$method.uploadFile(data.recent_photos, 0);
  669. }
  670. if (data['idcard_face_photo']) {
  671. data.idcard_face_photo = await this.$method.uploadFile(data.idcard_face_photo, 0);
  672. }
  673. if (data['idcard_national_photo']) {
  674. data.idcard_national_photo = await this.$method.uploadFile(data.idcard_national_photo, 0);
  675. }
  676. if (data['commitment_electr_signature']) {
  677. data.commitment_electr_signature = await this.$method.uploadFile(data.commitment_electr_signature, 0);
  678. }
  679. this.uploadDatas(data);
  680. },
  681. //验证表单
  682. resultForm(int) {
  683. if (this.openVerify) {
  684. if (this.isRequired) {
  685. this.submitApi();
  686. } else {
  687. this.$refs.uForm.validate(valid => {
  688. if (valid) {
  689. if (int === 1) {
  690. this.submitApi();
  691. }
  692. } else {
  693. console.log('验证失败');
  694. }
  695. });
  696. }
  697. }
  698. },
  699. async submits() {
  700. var ast = this.listData.some(item => {
  701. return item.fieldKey === 'commitment_electr_signature';
  702. });
  703. if (ast) {
  704. await this.subCanvas();
  705. }
  706. this.openVerify = true;
  707. this.resultForm(1);
  708. },
  709. async changePhotoListHeader1(lists, name) {
  710. if (lists.length) {
  711. this.fileList1 = lists;
  712. if (lists[0].url.indexOf('//tmp') !== -1 || lists[0].url.indexOf('//temp') !== -1) {
  713. this.$set(this.form, 'recent_photos', await this.$method.imageInfos(lists[0].url));
  714. }
  715. } else {
  716. this.fileList1 = [];
  717. this.$set(this.form, 'recent_photos', '');
  718. console.log(3, this.form.recent_photos);
  719. }
  720. this.$nextTick(function() {
  721. console.log(4);
  722. this.resultForm();
  723. });
  724. },
  725. async changePhotoListHeader2(lists, name) {
  726. if (lists.length) {
  727. this.fileList2 = lists;
  728. console.log(lists,'lists')
  729. if (lists[0].url.indexOf('//tmp') !== -1 || lists[0].url.indexOf('//temp') !== -1) {
  730. this.$set(this.form, 'idcard_face_photo', await this.$method.imageInfos(lists[0].url));
  731. }
  732. } else {
  733. this.fileList2 = [];
  734. this.$set(this.form, 'idcard_face_photo', '');
  735. }
  736. this.$nextTick(function() {
  737. this.resultForm();
  738. });
  739. },
  740. async changePhotoListHeader3(lists, name) {
  741. if (lists.length) {
  742. this.fileList3 = lists;
  743. if (lists[0].url.indexOf('//tmp') !== -1 || lists[0].url.indexOf('//temp') !== -1) {
  744. this.$set(this.form, 'idcard_national_photo', await this.$method.imageInfos(lists[0].url));
  745. }
  746. } else {
  747. this.fileList3 = [];
  748. this.$set(this.form, 'idcard_national_photo', '');
  749. }
  750. this.$nextTick(function() {
  751. this.resultForm();
  752. });
  753. },
  754. getTimes(key) {
  755. if (this.form[key]) {
  756. return this.form[key];
  757. } else {
  758. return '请选择时间';
  759. }
  760. },
  761. getarrays(key) {
  762. if (key === 'sex') {
  763. return this.dictObj['sys_user_sex'];
  764. }
  765. if (key === 'education') {
  766. return this.dictObj['edu_level'];
  767. }
  768. if (key === 'working_years') {
  769. return this.dictObj['working_years'];
  770. }
  771. },
  772. returnName(key) {
  773. if (key === 'sex') {
  774. if (this.form[key]) {
  775. return this.dictObj['sys_user_sex'][Number(this.form[key])];
  776. } else {
  777. return '请选择性别';
  778. }
  779. }
  780. if (key === 'education') {
  781. if (this.form[key]) {
  782. return this.dictObj['edu_level'][Number(this.form[key])];
  783. } else {
  784. return '请选择学历';
  785. }
  786. }
  787. if (key === 'working_years') {
  788. if (this.form[key]) {
  789. return this.dictObj['working_years'][Number(this.form[key])];
  790. } else {
  791. return '请选择工作年限';
  792. }
  793. }
  794. },
  795. /**
  796. * getbaseprofiletpgetInfo接口返回值result.data.data不存在的话说明是第一次填写资料
  797. */
  798. getInfo() {
  799. var self = this;
  800. this.$api.getbaseprofiletpId(this.goodsId).then(res => {
  801. self.listData = JSON.parse(res.data.data.keyValue);
  802. self.listData.forEach(item => {
  803. if(item.fieldKey == "idcard") {
  804. this.form.idcard = this.userInfo.idCard;
  805. }
  806. if(item.fieldKey == "telphone") {
  807. this.form.telphone = this.userInfo.telphone;
  808. }
  809. if(item.fieldKey == "name") {
  810. this.form.name = this.userInfo.realname
  811. }
  812. })
  813. self.isRequired = self.listData.every(ims => {
  814. return ims.required === false;
  815. });
  816. this.$nextTick(() => {
  817. this.agreementModal = true;
  818. })
  819. self.$api.getbaseprofiletpgetInfo({ goodsId: self.goodsId }).then(result => {
  820. if (result.data.code === 200) {
  821. if (!result.data.data) {
  822. self.$api.getbaseprofiletplistProfile({ pageNum: 1, pageSize: 1, status: 1 }).then(kit => {
  823. if (kit.data.rows.length) {
  824. var ajson = JSON.parse(kit.data.rows[0].keyValue);
  825. self.listData.forEach((zyitem, zyindex) => {
  826. for (let k in ajson) {
  827. if (zyitem.fieldKey == k && ajson[k].value) {
  828. if (k === 'sex') {
  829. const sexIndex = self.dictObj['sys_user_sex'].indexOf(ajson[k].value) + '';
  830. self.$set(self.form, k, sexIndex);
  831. } else if (k === 'education') {
  832. const sexIndex = self.dictObj['edu_level'].indexOf(ajson[k].value) + '';
  833. self.$set(self.form, k, sexIndex);
  834. } else if (k === 'working_years') {
  835. const sexIndex = self.dictObj['working_years'].indexOf(ajson[k].value) + '';
  836. self.$set(self.form, k, sexIndex);
  837. } else if (k === 'recent_photos') {
  838. self.$set(self.form, k, ajson[k].value);
  839. if (ajson[k].value) {
  840. self.fileList1 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  841. }
  842. } else if (k === 'idcard_face_photo') {
  843. self.$set(self.form, k, ajson[k].value);
  844. if (ajson[k].value) {
  845. self.fileList2 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  846. }
  847. } else if (k === 'idcard_national_photo') {
  848. self.$set(self.form, k, ajson[k].value);
  849. if (ajson[k].value) {
  850. self.fileList3 = [{ url: baseUrls.BASE_IMG_URL + ajson[k].value }];
  851. }
  852. } else {
  853. if(k === 'name'){
  854. self.$set(self.form, k, this.$store.state.userInfo.realname);
  855. } else if(k === 'idcard'){
  856. self.$set(self.form, k, this.$store.state.userInfo.idCard);
  857. } else if(k === 'telphone'){
  858. self.$set(self.form, k, this.$store.state.userInfo.telphone);
  859. } else if(k !== 'commitment_electr_signature'){
  860. self.$set(self.form, k, ajson[k].value);
  861. }
  862. }
  863. }
  864. }
  865. });
  866. }
  867. });
  868. }
  869. if (result.data.data && result.data.data.status === 3) {
  870. self.remark = result.data.data.text;
  871. self.remarkStatus = true;
  872. self.id = result.data.data.id;
  873. var arrays = JSON.parse(result.data.data.keyValue);
  874. self.copyData = JSON.parse(JSON.stringify(arrays));
  875. for (let k in arrays) {
  876. if (k === 'sex') {
  877. if (arrays[k].value) {
  878. const sexIndex = self.dictObj['sys_user_sex'].indexOf(arrays[k].value) + '';
  879. self.$set(self.form, k, sexIndex);
  880. }
  881. } else if (k === 'education') {
  882. if (arrays[k].value) {
  883. const sexIndex = self.dictObj['edu_level'].indexOf(arrays[k].value) + '';
  884. self.$set(self.form, k, sexIndex);
  885. }
  886. } else if (k === 'working_years') {
  887. if (arrays[k].value) {
  888. const sexIndex = self.dictObj['working_years'].indexOf(arrays[k].value) + '';
  889. self.$set(self.form, k, sexIndex);
  890. }
  891. } else if (k === 'recent_photos') {
  892. self.$set(self.form, k, arrays[k].value);
  893. if (arrays[k].value) {
  894. self.fileList1 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  895. }
  896. } else if (k === 'idcard_face_photo') {
  897. self.$set(self.form, k, arrays[k].value);
  898. if (arrays[k].value) {
  899. self.fileList2 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  900. }
  901. } else if (k === 'idcard_national_photo') {
  902. self.$set(self.form, k, arrays[k].value);
  903. if (arrays[k].value) {
  904. self.fileList3 = [{ url: baseUrls.BASE_IMG_URL + arrays[k].value }];
  905. }
  906. } else {
  907. self.$set(self.form, k, arrays[k].value);
  908. }
  909. }
  910. } else if (result.data.data && (result.data.data.status === 1 || result.data.data.status === 2)) {
  911. uni.showModal({
  912. showCancel: false,
  913. content:
  914. result.data.data.status === 1
  915. ? '该商品审核资料已通过,不可重复提交资料'
  916. : result.data.data.status === 2
  917. ? '该商品审核资料处于待审核状态,不可重复提交资料'
  918. : '请联系管理员',
  919. success: function(k) {
  920. if (k.confirm) {
  921. uni.navigateBack();
  922. }
  923. }
  924. });
  925. }
  926. }
  927. });
  928. });
  929. },
  930. bindPickerChange(key, e) {
  931. this.$set(this.form, key, e.detail.value);
  932. this.$nextTick(function() {
  933. this.resultForm();
  934. });
  935. },
  936. bindDateChange(key, e) {
  937. this.form[key] = e.detail.value;
  938. },
  939. retDraw() {
  940. this.handwriting.retDraw();
  941. this.$set(this.form, 'commitment_electr_signature', '');
  942. this.$nextTick(function() {
  943. this.resultForm();
  944. });
  945. },
  946. uploadScaleStart(event) {
  947. this.handwriting.uploadScaleStart(event);
  948. },
  949. uploadScaleMove(event) {
  950. this.handwriting.uploadScaleMove(event);
  951. },
  952. uploadScaleEnd(event) {
  953. this.handwriting.uploadScaleEnd(event);
  954. },
  955. subCanvas() {
  956. return new Promise((resolve, reject) => {
  957. var self = this;
  958. if (self.form.commitment_electr_signature) {
  959. resolve();
  960. return;
  961. }
  962. self.handwriting
  963. .saveCanvas()
  964. .then(res => {
  965. if (this.handwriting.linePrack.length) {
  966. this.$set(this.form, 'commitment_electr_signature', res);
  967. }
  968. resolve(res);
  969. })
  970. .catch(err => {
  971. uni.showToast({
  972. title: '签名上传失败',
  973. icon: 'error'
  974. });
  975. });
  976. });
  977. }
  978. }
  979. };
  980. </script>
  981. <style>
  982. page {
  983. background: #eaeef1;
  984. }
  985. </style>
  986. <style scope lang="scss">
  987. .ctoples {
  988. position: absolute;
  989. top: 0;
  990. left: 0;
  991. padding: 2rpx 23rpx;
  992. display: inline-block;
  993. background-color: rgba(0, 0, 0, 0.4);
  994. font-size: 28rpx;
  995. color: #fff;
  996. border-bottom-right-radius: 24rpx;
  997. }
  998. .handWriting {
  999. width: 100%;
  1000. height: 100%;
  1001. }
  1002. /deep/ .u-collapse-title {
  1003. color: #FF3B30;
  1004. font-size: 24rpx;
  1005. }
  1006. .collapse-item {
  1007. color: #666;
  1008. font-size: 24rpx;
  1009. padding-bottom: 30rpx;
  1010. }
  1011. .dis_stys {
  1012. display: flex;
  1013. align-items: center;
  1014. justify-content: space-between;
  1015. }
  1016. .handCenter {
  1017. background: #f7f7f7;
  1018. border: 2rpx solid #eeeeee;
  1019. border-radius: 24rpx;
  1020. width: 100%;
  1021. height: 300rpx;
  1022. overflow: hidden;
  1023. }
  1024. .headerSDels {
  1025. height: 58rpx;
  1026. padding: 0rpx 24rpx;
  1027. font-weight: bold;
  1028. display: flex;
  1029. align-items: center;
  1030. flex-direction: row-reverse;
  1031. }
  1032. .listBox {
  1033. margin: 24rpx 32rpx 0rpx;
  1034. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1035. border-radius: 32rpx;
  1036. background-color: #fff;
  1037. overflow: hidden;
  1038. }
  1039. .imgBoxs {
  1040. width: 156rpx;
  1041. height: 203rpx;
  1042. }
  1043. .imgBoxs2 {
  1044. width: 171rpx;
  1045. height: 108rpx;
  1046. }
  1047. .submit_btn {
  1048. width: 526rpx;
  1049. height: 80rpx;
  1050. background: #007aff;
  1051. border-radius: 40rpx;
  1052. text-align: center;
  1053. line-height: 80rpx;
  1054. color: #ffffff;
  1055. margin: 30rpx auto;
  1056. }
  1057. .picker {
  1058. text-align: right;
  1059. }
  1060. input {
  1061. text-align: right;
  1062. }
  1063. .bodyBox {
  1064. background: #ffffff;
  1065. border-radius: 24rpx;
  1066. width: 100%;
  1067. }
  1068. .topBox {
  1069. height: 80rpx;
  1070. background: #ffffff;
  1071. border-radius: 24rpx;
  1072. width: 100%;
  1073. display: flex;
  1074. justify-content: space-between;
  1075. line-height: 80rpx;
  1076. padding: 0 20rpx;
  1077. font-size: 24rpx;
  1078. }
  1079. .modal {
  1080. .agreement {
  1081. width: 640rpx;
  1082. height: 740rpx;
  1083. background: #FFFFFF;
  1084. display: flex;
  1085. flex-direction: column;
  1086. .body {
  1087. flex:1;
  1088. .content {
  1089. padding:30rpx 40rpx 28rpx;
  1090. line-height: 40rpx;
  1091. font-size: 26rpx;
  1092. color:#666;
  1093. .bold {
  1094. color:#333;
  1095. font-size: 26rpx;
  1096. font-weight: bold;
  1097. }
  1098. .center {
  1099. text-align: center;
  1100. }
  1101. }
  1102. }
  1103. .footer {
  1104. height:140rpx;
  1105. border-top:1px solid #EEEEEE;
  1106. display: flex;
  1107. align-items: center;
  1108. justify-content: center;
  1109. .btn {
  1110. margin:0 12rpx;
  1111. width: 200rpx;
  1112. height: 80rpx;
  1113. color:#007AFF;
  1114. font-size: 30rpx;
  1115. text-align: center;
  1116. line-height: 80rpx;
  1117. background: #F5F5F5;
  1118. border-radius: 40rpx 40rpx 40rpx 40rpx;
  1119. &.ok {
  1120. width: 336rpx;
  1121. height: 80rpx;
  1122. background: #007AFF;
  1123. color:#fff;
  1124. }
  1125. &.close {
  1126. color:#fff;
  1127. width: 560rpx;
  1128. height: 80rpx;
  1129. background: #007AFF;
  1130. border-radius: 40rpx 40rpx 40rpx 40rpx;
  1131. }
  1132. }
  1133. }
  1134. }
  1135. }
  1136. </style>