input.vue 32 KB

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