indent.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. <template>
  2. <view class="info">
  3. <view class="popup" v-if="isDisable"></view>
  4. <view class="content" >
  5. <view class="title">
  6. 基 本 信 息
  7. </view>
  8. <view class="page-section">
  9. <view class="page-section-title">姓名</view>
  10. <view class="weui-cells weui-cells_after-title">
  11. <u-input v-model="form.cName" :type="type" placeholder="请输入姓名,最多四个字" maxlength='4'/>
  12. </view>
  13. </view>
  14. <view class="page-section">
  15. <view class="page-section-title">性别</view>
  16. <view class="sex" @click="isShow = true">
  17. {{changeSex}}
  18. </view>
  19. <u-select v-model="isShow" :list="sex" @confirm="confirm"></u-select>
  20. </view>
  21. <view class="page-section">
  22. <view class="page-section-title">手机号</view>
  23. <view class="weui-cells weui-cells_after-title">
  24. <!-- <input class="weui-input" v-model="form.cPhone" placeholder="请输入手机号" /> -->
  25. <u-input v-model="form.cPhone" placeholder="请输入手机号" maxlength='11'/>
  26. </view>
  27. </view>
  28. <view class="page-section">
  29. <view class="page-section-title">入驻城市</view>
  30. <view class="weui-cells weui-cells_after-title">
  31. <u-select v-model="show" :list="citylist" @confirm="select"></u-select>
  32. <view class="city" @click="selectCity" v-if="form.city == ''">
  33. 入驻城市
  34. </view>
  35. <view class="city" @click="selectCity" v-else>
  36. {{form.city}}
  37. </view>
  38. </view>
  39. </view>
  40. <view class="page-section" style="border:0;">
  41. <view class="page-section-title">上传近期生活照</view>
  42. <view class="images">
  43. <u-upload :action="uploadUrl" :file-list="LifeList" @on-success="handleUploadSuccess"
  44. @on-remove="handleUploadRemove" :header="header"></u-upload>
  45. </view>
  46. </view>
  47. <view class="title">
  48. 详 细 信 息
  49. </view>
  50. <view class="page-section">
  51. <view class="page-section-title">昵称</view>
  52. <view class="weui-cells weui-cells_after-title">
  53. <u-input v-model="form.cNickName" :type="type" placeholder="请输入昵称" maxlength='4' />
  54. </view>
  55. </view>
  56. <view class="page-section" style="border:0;">
  57. <view class="page-section-title">上传头像</view>
  58. <view class="">
  59. <u-upload :action="uploadUrl" :max-count="1" :file-list="headImg" @on-success="handleUploadHeaderSuccess"
  60. @on-remove="handleUploadHeaderRemove" :header="header" upload-text="点击上传图片" />
  61. </view>
  62. <!-- <view class="head_img" v-else>
  63. <image :src="headImg" mode=""></image>
  64. </view> -->
  65. </view>
  66. <view class="page-section">
  67. <view class="page-section-title">您所在的位置</view>
  68. <view class="weui-cells weui-cells_after-title location" @click="getAddress">
  69. <text class="point" v-if="!form.address">请选择</text>
  70. <text class="point active" v-else>{{form.address}}{{form.name}}</text>
  71. </view>
  72. </view>
  73. <view class="page-section">
  74. <view class="page-section-title">商户简介</view>
  75. <view class="weui-cells weui-cells_after-title textareas" style="border:none">
  76. <textarea value="" v-model="form.cJianjie" bindinput="jianIn" placeholder="请输入您的简介"></textarea>
  77. </view>
  78. </view>
  79. <view class="page-section" style="border:0;">
  80. <view class="page-section-title">上传身份证照片</view>
  81. <view class="images" style="padding-bottom: 0;">
  82. <!-- <u-upload :action="action" :file-list="idCard"></u-upload> -->
  83. <u-upload :action="uploadUrl" :file-list="codeList" @on-success="handleUploadIdcardSuccess"
  84. @on-remove="handleUploadIdcardRemove" :header="header" maxCount="2" />
  85. </view>
  86. </view>
  87. <view class="page-section" style="border:0;">
  88. <view class="page-section-title">上传健康证照片</view>
  89. <view class="images" style="padding-bottom: 0;">
  90. <u-upload :action="uploadUrl" :file-list="healthCertificate" @on-success="handleUploadHealthSuccess"
  91. @on-remove="handleUploadHealthRemove" :header="header" :max-count="1" />
  92. </view>
  93. </view>
  94. <view class="page-section" style="border:0;">
  95. <view class="page-section-title">上传从业资格证照片</view>
  96. <view class="images" style="padding-bottom: 0;">
  97. <!-- <u-upload :action="action" :file-list="idCard"></u-upload> -->
  98. <u-upload :action="uploadUrl" :file-list="certification" @on-success="handleUploadCertifiSuccess"
  99. @on-remove="handleUploadCertifiRemove" :header="header" :max-count="1" />
  100. </view>
  101. </view>
  102. <view class="page-section" style="border:0;">
  103. <view class="page-section-title">上传营业执照照片</view>
  104. <view class="images" style="padding-bottom: 0;">
  105. <!-- <u-upload :action="action" :file-list="idCard"></u-upload> -->
  106. <u-upload :action="uploadUrl" :file-list="businessLicense" @on-success="handleUploadLicenseSuccess"
  107. @on-remove="handleUploadLicenseRemove" :header="header" :max-count="1" />
  108. </view>
  109. </view>
  110. <view class="page-section" style="border:0;">
  111. <view class="page-section-title">上传无犯罪证明照片</view>
  112. <view class="images" style="padding-bottom: 0;">
  113. <!-- <u-upload :action="action" :file-list="idCard"></u-upload> -->
  114. <u-upload :action="uploadUrl" :file-list="noCrime" @on-success="handleUploadnoCrimeSuccess"
  115. @on-remove="handleUploadnoCrimeRemove" :header="header" :max-count="1" />
  116. </view>
  117. </view>
  118. <view class="submits">
  119. <button style="margin: 30rpx 0" type="primary" @click="submit">提交</button>
  120. </view>
  121. </view>
  122. </view>
  123. </template>
  124. <script>
  125. import {
  126. addEngineer,
  127. project,
  128. UpdateEngine,
  129. engineDetail,
  130. imgUpload,
  131. getCityList
  132. } from '../.././api/index.js'
  133. import uUpload from 'uview-ui/components/u-upload/u-upload.vue';
  134. export default {
  135. components: {
  136. uUpload,
  137. },
  138. data() {
  139. return {
  140. isDisable:false,
  141. citylist:[],
  142. show:false,
  143. type: 'text',
  144. token: '',
  145. uploadId: '',
  146. isShow: false,
  147. // uploadUrl: 'https://test.baoxianzhanggui.com/nightFragrance/common/upload',
  148. uploadUrl:'https://city.baoxianzhanggui.com/nightFragrance/common/upload',
  149. headImgList: [],
  150. title: '商户入驻',
  151. details: '',
  152. sex: [
  153. {
  154. value: '0',
  155. label: '女'
  156. },
  157. {
  158. value: '1',
  159. label: '男'
  160. }
  161. ],
  162. changeSex: '女',
  163. index: 0,
  164. location: '',
  165. imglist: [],
  166. urlImg: [],
  167. pictures: [],
  168. pojectList: [],
  169. form: {
  170. id: '',
  171. cName: '',
  172. cNickName: '',
  173. cPortrait: '',
  174. cPhone: '',
  175. cJianjie: '',
  176. nSex: 0,
  177. cSfzImg: [],
  178. cImgList: [],
  179. latitude: '',
  180. longitude: '',
  181. name: '',
  182. address: '',
  183. cOpenId: '',
  184. cBhList: '',
  185. city: '',
  186. certification: '',
  187. healthCertificate: '',
  188. businessLicense: ''
  189. },
  190. headImg: [], //展示头像用
  191. imgsShow: true,
  192. idCard: [],
  193. LifeList: [], //展示生活照用
  194. codeList: [], //展示身份证用
  195. healthCertificate: [], //展示健康证
  196. businessLicense: [], //展示营业执照
  197. certification: [], //展示资格证
  198. noCrime:[],//展示无犯罪记录证明
  199. }
  200. },
  201. computed: {
  202. header() {
  203. return {
  204. Authorization: `tf: ${this.token}`, // 携带Token的请求头
  205. };
  206. },
  207. },
  208. mounted() {
  209. // 在页面加载时获取Token,可以从本地缓存中获取
  210. this.token = uni.getStorageSync('access-token'); // 假设token保存在本地缓存中
  211. },
  212. methods: {
  213. select(e) {
  214. this.form.city = e[0].label
  215. this.form.deptId = e[0].value
  216. },
  217. goCity() {
  218. uni.navigateTo({
  219. url: '/pages/identify/city?type=' + 'indent'
  220. })
  221. },
  222. getAddress() {
  223. uni.chooseLocation({
  224. success: res => {
  225. this.form.name = res.name;
  226. this.form.latitude = res.latitude;
  227. this.form.longitude = res.longitude;
  228. this.form.address = res.address
  229. }
  230. });
  231. },
  232. //上传头像
  233. handleUploadHeaderSuccess(response) {
  234. this.form.cPortrait = response.fileName
  235. },
  236. handleUploadHeaderRemove(index) {
  237. this.headImgList.splice(index, 1);
  238. },
  239. //上传身份证
  240. handleUploadIdcardSuccess(response) {
  241. this.form.cSfzImg.push(response.fileName);
  242. },
  243. handleUploadIdcardRemove(index) {
  244. this.idCard.splice(index, 1);
  245. this.form.cSfzImg.splice(index, 1)
  246. },
  247. //上传生活照
  248. handleUploadSuccess(response) {
  249. this.form.cImgList.push(response.fileName)
  250. },
  251. handleUploadRemove(index) {
  252. this.urlImg.splice(index, 1);
  253. this.form.cImgList.splice(index, 1)
  254. },
  255. //上传健康证
  256. handleUploadHealthSuccess(response) {
  257. this.form.healthCertificate = response.fileName
  258. },
  259. handleUploadHealthRemove(index) {
  260. this.healthCertificate.splice(index, 1);
  261. },
  262. //上传营业执照
  263. handleUploadLicenseSuccess(response) {
  264. this.form.businessLicense = response.fileName
  265. },
  266. handleUploadLicenseRemove(index) {
  267. this.businessLicense.splice(index, 1);
  268. },
  269. //上传资格证
  270. handleUploadCertifiSuccess(response) {
  271. this.form.certification = response.fileName
  272. },
  273. handleUploadCertifiRemove(index) {
  274. this.certification.splice(index, 1);
  275. },
  276. //上传无犯罪记录证明
  277. handleUploadnoCrimeSuccess(response){
  278. this.form.noCrime = response.fileName
  279. },
  280. handleUploadCertifiRemove(index) {
  281. this.noCrime.splice(index, 1);
  282. },
  283. //提交
  284. submit() {
  285. var that = this
  286. var openids = uni.getStorageSync('wx_copenid')
  287. this.form.cOpenId = openids
  288. // this.form.cAddress =this.form.cAddress
  289. this.form.nSex = this.index
  290. // this.form.cImgList = this.urlImg
  291. // this.form.cSfzImg = this.idCard
  292. // that.data.form.cBhList = that.data.form.cBhList.join(", ")
  293. if (this.form.cName == '') {
  294. uni.showToast({
  295. title: '请输入您的姓名',
  296. icon: 'none'
  297. })
  298. return
  299. }
  300. if (this.form.cPortrait == '') {
  301. uni.showToast({
  302. title: '请上传头像',
  303. icon: 'none'
  304. })
  305. return
  306. }
  307. if (this.form.cNickName == '') {
  308. uni.showToast({
  309. title: '请输入您的昵称',
  310. icon: 'none'
  311. })
  312. return
  313. }
  314. if (!/^1[3456789]\d{9}$/.test(this.form.cPhone)) {
  315. uni.showToast({
  316. title: '请输入正确的手机号',
  317. icon: 'none'
  318. });
  319. return;
  320. }
  321. if (this.form.city == '') {
  322. uni.showToast({
  323. title: '请选择所在城市',
  324. icon: 'none'
  325. });
  326. return
  327. }
  328. if (this.form.address == '') {
  329. uni.showToast({
  330. title: '请选择位置',
  331. icon: 'none'
  332. });
  333. return
  334. }
  335. if (this.form.cJianjie == '') {
  336. uni.showToast({
  337. title: '请填写您的简介',
  338. icon: 'none'
  339. });
  340. return
  341. }
  342. if (this.form.cSfzImg.length < 2) {
  343. uni.showToast({
  344. title: '请上传身份证照片正反面',
  345. icon: 'none'
  346. });
  347. return
  348. }
  349. if (this.form.cImgList.length < 1) {
  350. uni.showToast({
  351. title: '最少上传一张生活照片',
  352. icon: 'none'
  353. });
  354. return
  355. }
  356. if (this.title == '编辑资料') {
  357. UpdateEngine(this.form).then(res => {
  358. if (res.data.code == 200) {
  359. uni.showToast({
  360. title: "修改成功",
  361. })
  362. setTimeout(() => {
  363. uni.navigateBack()
  364. }, 1000)
  365. } else {
  366. uni.showToast({
  367. title: res.data.msg,
  368. icon: 'none'
  369. })
  370. }
  371. })
  372. } else {
  373. addEngineer(this.form).then(res => {
  374. if (res.data.code == 200) {
  375. uni.showToast({
  376. title: "添加成功",
  377. })
  378. setTimeout(() => {
  379. uni.navigateBack()
  380. }, 1000)
  381. } else {
  382. uni.showToast({
  383. title: res.data.msg,
  384. icon: 'none'
  385. })
  386. }
  387. })
  388. }
  389. },
  390. // 选中某个复选框时,由checkbox时触发
  391. checkboxChange(item) {},
  392. checkboxGroupChange(e) {
  393. this.form.cBhList = e.join(',')
  394. },
  395. //选择性别
  396. confirm(e) {
  397. this.changeSex = e[0].label
  398. },
  399. // 项目列表
  400. getPro() {
  401. project({
  402. current: 1,
  403. size: 10
  404. }).then(res => {
  405. var list = res.data.data
  406. setTimeout(() => {
  407. list.forEach(ele => {
  408. this.form.cBhList.split(',').forEach(eles => {
  409. if (ele.cId == eles) {
  410. ele.checked = true
  411. }
  412. })
  413. });
  414. this.pojectList = list
  415. }, 1000)
  416. })
  417. },
  418. getDetails() {
  419. var that = this
  420. var openid = {
  421. cOpenId: uni.getStorageSync('wx_copenid')
  422. }
  423. engineDetail(openid).then(res => {
  424. this.form = res.data.data
  425. if(res.data.data.nTong && res.data.data.nTong == 0 || res.data.data.nTong == 1 ){
  426. this.isDisable = true
  427. }
  428. //头像
  429. if (!this.form.cPortrait == '') {
  430. let header = {
  431. url: this.$globalData.publicUrl + this.form.cPortrait
  432. }
  433. this.headImg.push(header)
  434. }
  435. //健康证
  436. if (!this.form.healthCertificate == '') {
  437. let healthCertificate = {
  438. url: this.$globalData.publicUrl + this.form.healthCertificate
  439. }
  440. this.healthCertificate.push(healthCertificate)
  441. }
  442. //资格证
  443. if (!this.form.certification == '') {
  444. let certification = {
  445. url: this.$globalData.publicUrl + this.form.certification
  446. }
  447. this.certification.push(certification)
  448. }
  449. //营业执照
  450. if (!this.form.businessLicense == '') {
  451. let businessLicense = {
  452. url: this.$globalData.publicUrl + this.form.businessLicense
  453. }
  454. this.businessLicense.push(businessLicense)
  455. }
  456. //无犯罪证明
  457. if (!this.form.noCrime == '') {
  458. let noCrime = {
  459. url: this.$globalData.publicUrl + this.form.noCrime
  460. }
  461. this.noCrime.push(noCrime)
  462. }
  463. //生活照
  464. res.data.data.cImgList.forEach(item => {
  465. let obj = {
  466. url: this.$globalData.publicUrl + item
  467. }
  468. this.LifeList.push(obj)
  469. })
  470. //身份证
  471. res.data.data.cSfzImg.forEach(item => {
  472. let card = {
  473. url: this.$globalData.publicUrl + item
  474. }
  475. this.codeList.push(card)
  476. })
  477. this.imgsShow = false,
  478. this.index = res.data.data.nSex
  479. // this.form.cBhList = res.data.data.cBhList
  480. })
  481. },
  482. getCity() {
  483. getCityList().then(res => {
  484. this.citylist = res.data.data.map(({
  485. deptId,
  486. deptName
  487. }) => ({
  488. value: deptId,
  489. label: deptName
  490. }))
  491. });
  492. },
  493. selectCity(){
  494. this.show = true
  495. },
  496. },
  497. onLoad(options) {
  498. // uni.setStorageSync('access-token', 'eyJhbGciOiJIUzUxMiJ9.eyJ0ZjoiOiJiNGQ2NzJiMi0xNzcxLTRmYTMtYjM1OS01NmRhMjk4ZDcwZjAifQ.acq9x8MrF3aXzY3mYJIuG8MLeRtMQ2hybesrN8t5txI4H5HDthn07nq5QYZmCJ1_ZPL8ZDbYczN6qmIa8ckrrA')
  499. // uni.setStorageSync('wx_copenid','o-HEJ6VP2YNi0HPeLaIHCQsQD69s')
  500. this.getCity()
  501. this.title = options.title
  502. if (options.title == '编辑资料') {
  503. this.getDetails()
  504. }
  505. },
  506. onShow() {
  507. }
  508. }
  509. </script>
  510. <style lang="scss" scoped>
  511. .info{
  512. width: 100%;
  513. height: auto;
  514. padding-top: 20rpx;
  515. position: relative;
  516. .popup{
  517. width: 100%;
  518. height: 100%;
  519. position: absolute;
  520. top: 0;
  521. left: 0;
  522. background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色遮罩 */
  523. z-index: 9999;
  524. overflow-y: auto;
  525. }
  526. }
  527. .title {
  528. border-left: 3px solid #2cb8d4;
  529. padding-left: 5px;
  530. font-size: 30rpx;
  531. // margin-top: 10px;
  532. }
  533. .head_img {
  534. width: 200rpx;
  535. height: 200rpx;
  536. image {
  537. width: 100%;
  538. height: 100%;
  539. }
  540. }
  541. .sex {
  542. width: 100%;
  543. height: 60rpx;
  544. line-height: 60rpx;
  545. border-bottom: 1px solid #333;
  546. // padding-bottom: 10rpx;
  547. }
  548. .weui-cells {
  549. margin-top: 10rpx;
  550. border-bottom: 1px solid #333333;
  551. }
  552. .listAll {
  553. background-color: #f8f8f8;
  554. height: 100vh;
  555. }
  556. .content {
  557. padding: 0 30rpx;
  558. .page-section-title {
  559. font-size: 32rpx;
  560. padding-top: 20rpx;
  561. }
  562. .weui-cells:before {
  563. border-top: 0;
  564. }
  565. .piker {
  566. border-bottom: 1px solid #ccc;
  567. height: 88rpx;
  568. line-height: 88rpx;
  569. }
  570. .location {
  571. // height: 88rpx;
  572. color: rgb(145, 145, 145);
  573. line-height: 60rpx;
  574. }
  575. .textareas {
  576. margin-top: 20rpx;
  577. textarea {
  578. border: 1px solid #b8b6b6;
  579. width: auto;
  580. padding: 20rpx;
  581. background-color: #f8f8f8;
  582. }
  583. }
  584. .images {
  585. display: flex;
  586. margin-top: 20rpx;
  587. // padding-bottom: 240rpx;
  588. width: 100%;
  589. .imagesPho {
  590. position: relative;
  591. image {
  592. width: 200rpx;
  593. height: 200rpx;
  594. margin-right: 20rpx;
  595. }
  596. .closeimg {
  597. position: absolute;
  598. right: -5px;
  599. top: -10rpx;
  600. position: absolute;
  601. z-index: 9;
  602. color: #f03d38 !important;
  603. width: 40rpx;
  604. height: 40rpx;
  605. }
  606. }
  607. }
  608. .uploadImg {
  609. border: 0;
  610. .image {
  611. width: 200rpx;
  612. height: 200rpx;
  613. display: flex;
  614. align-items: center;
  615. justify-content: center;
  616. border: 1px solid #b8b6b6;
  617. }
  618. }
  619. .proList {
  620. margin-top: 20rpx;
  621. label {
  622. margin-right: 40rpx;
  623. margin-bottom: 20rpx;
  624. display: inline-block;
  625. }
  626. }
  627. .submits {
  628. width: 100%;
  629. background-color: #fff;
  630. border-top: 1px solid #b8b6b6;
  631. text-align: center;
  632. z-index: 10;
  633. button {
  634. width: 80%;
  635. display: inline-block;
  636. background-color: #2cb8d4;
  637. }
  638. }
  639. .heads {
  640. .uploadImg {
  641. width: 200rpx;
  642. height: 200rpx;
  643. border: 1px solid #ccc;
  644. text-align: center;
  645. line-height: 200rpx;
  646. image {
  647. width: 200rpx;
  648. height: 200rpx;
  649. }
  650. }
  651. }
  652. }
  653. </style>