persondata.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <template>
  2. <view class="content">
  3. <view class="headbox">
  4. <text v-if="state==1" class="headtitle">供货商个人资料</text>
  5. <text v-if="state==0" class="headtitle">业务管理员个人资料</text>
  6. <view class="logobox">
  7. <image src="../../static/img/logo.png" mode="aspectFill"></image>
  8. </view>
  9. </view>
  10. <view class="acountbox">
  11. <view v-if="state==1" class="inacount">
  12. <text class="acoutitle">供货商名称</text>
  13. <input type="text" v-model="form.name" class="checkword" placeholder="请输入供货商名称"
  14. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  15. </view>
  16. <view v-if="state==0" class="inacount">
  17. <text class="acoutitle">业务管理员名称</text>
  18. <input type="text" v-model="formData.realName" class="checkword" placeholder="请输入业务管理员名称"
  19. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  20. </view>
  21. <view class="inacount checked" v-if="state==1">
  22. <text class="acoutitle">供货商账号</text>
  23. <input type="text" disabled="true" v-model="form.account" class="checkword " placeholder="请输入供货商账号"
  24. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  25. </view>
  26. <view class="inacount checked" v-if="state==0">
  27. <text class="acoutitle">业务管理员账号</text>
  28. <input type="text" disabled="true" v-model="formData.account" class="checkword" placeholder="请输入业务管理员账号"
  29. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  30. </view>
  31. <view class="inacount checked" v-if="state==1">
  32. <text class="acoutitle">统一社会信用代码</text>
  33. <input type="text" disabled="true" v-model="form.socialCode" class="checkword" placeholder="请输入统一社会信用代码"
  34. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  35. </view>
  36. <view class="inacount" v-if="state==1">
  37. <text class="acoutitle">法人姓名</text>
  38. <input type="text" v-model="form.legalPerson" class="checkword" placeholder="请输入法人姓名"
  39. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  40. </view>
  41. <view class="inacount" v-if="state==1">
  42. <text class="acoutitle">联系人</text>
  43. <input type="text" v-model="form.contacts" class="checkword" placeholder="请输入联系人"
  44. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  45. </view>
  46. <view class="inacount" v-if="state==1">
  47. <text class="acoutitle">联系电话</text>
  48. <input type="number" v-model="form.contactsMobile" class="checkword" placeholder="请输入联系电话"
  49. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  50. </view>
  51. <view class="inacount" v-if="state==0">
  52. <text class="acoutitle">联系电话</text>
  53. <input type="number" v-model="formData.mobile" class="checkword" placeholder="请输入联系电话"
  54. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  55. </view>
  56. <view>
  57. <view v-if="state==1" class="inacount"
  58. style="flex-direction: column;align-items: center;background-color: #fff;">
  59. <text class="acoutitle" style="flex: 1;width: 100%;">认证照片</text>
  60. <view class="upmsg">
  61. <view class="uppic" style="padding-top: 80rpx;font-weight:600 ;" @click="upImages(1)"
  62. v-if="form.identifyPicList.length==0">
  63. <text>点击上传照片</text>
  64. </view>
  65. <view class="img-up" style="width: 690rpx;height: 399rpx;" v-for="item in form.identifyPicList" v-if="form.identifyPicList.length>0">
  66. <image :src="item" mode="aspectFill" v-if="form.identifyPicList.length>0" @click="upImages(1)">
  67. </image>
  68. <image @click="deletImg(index)" class="delet-img" src="../../static/icon/delet.png" style="width: 25px;height: 25px;" mode="aspectFill"></image>
  69. </view>
  70. </view>
  71. <text style="font-size: 24rpx;color: #D05C39;padding-top: 20rpx;">*注意上传法人手持身份证半身照</text>
  72. </view>
  73. </view>
  74. <view>
  75. <view v-if="state==1" class="inacount"
  76. style="flex-direction: column;align-items: center;background-color: #fff;margin-top:0 ;">
  77. <view style="justify-content: space-between;display: flex;width: 100%;">
  78. <text class="acoutitle" style="flex: 1;width: 100%;">授权委托书</text>
  79. <text class="acoutitle" style="flex: 1;width: 100%;text-align: right;" @click="addpdf"
  80. :style="[{color:(addpdfin?'#D05C39':'#000')},{fontSize:'28rpx'}]">点击获取授权委托书</text>
  81. </view>
  82. <view class="upmsg" >
  83. <view class="uppic" style="padding-top: 80rpx;font-weight:600 ;" @click="upImages(2)"
  84. v-if="form.proxyFileList.length==0">
  85. <text>点击上传照片</text>
  86. </view>
  87. <view class="img-up" style="width: 690rpx;height: 399rpx;"v-if="form.proxyFileList.length>0"
  88. v-for="item in form.proxyFileList"
  89. >
  90. <image :src="item" mode="aspectFill" @click="upImages(2)">
  91. </image>
  92. <image @click="deletImg2(index)" class="delet-img" src="../../static/icon/delet.png" style="width: 25px;height: 25px;"
  93. mode="aspectFill"></image>
  94. </view>
  95. </view>
  96. <text style="font-size: 24rpx;color: #D05C39;padding-top: 20rpx;">*注意上传法人签署的授权委托书</text>
  97. </view>
  98. </view>
  99. </view>
  100. <view class="logininbtn" @click="acountRegister" v-if="state==1">
  101. <text>保存修改</text>
  102. </view>
  103. <view class="logininbtn" @click="acountModify" v-if="state==0">
  104. <text>保存修改</text>
  105. </view>
  106. <view class="safebt"></view>
  107. </view>
  108. </template>
  109. <script>
  110. import {
  111. mainUrl
  112. } from '@/http/baseUrl.js';
  113. let that
  114. export default {
  115. data() {
  116. return {
  117. identifyPics: [],
  118. proxyFile: [],
  119. checked: 1,
  120. state: '',
  121. form: {
  122. name: '',
  123. account: '',
  124. socialCode: '',
  125. legalPerson: '',
  126. password: '',
  127. contacts: '',
  128. contactsMobile: '',
  129. identifyPicList: [],
  130. proxyFileList: [],
  131. addpdfin: false
  132. },
  133. formData: {},
  134. }
  135. },
  136. onLoad(o) {
  137. that = this
  138. this.state = this.$store.state.admin
  139. uni.getSystemInfo({
  140. success: function(res) {
  141. console.log(res.safeArea.bottom); // print 610
  142. let bottom = res.safeArea.bottom
  143. let height = res.safeArea.height
  144. let cacl = bottom - height
  145. that.wagesheight = cacl
  146. console.log(that.wagesheight); // print 292
  147. }
  148. })
  149. this.init()
  150. if (o.checked) {
  151. this.checked = o.checked
  152. }
  153. },
  154. methods: {
  155. init() {
  156. uni.showLoading()
  157. if (this.state == 0) {
  158. uni.$u.http.get('/api/Account', {
  159. custom: {
  160. auth: true
  161. }
  162. }).then((res) => {
  163. uni.hideLoading()
  164. this.formData = res
  165. }).catch((err) => {
  166. uni.hideLoading()
  167. console.log(err)
  168. })
  169. } else if (this.state == 1) {
  170. uni.$u.http.get('/api/Supplier', {
  171. custom: {
  172. auth: true
  173. }
  174. }).then((res) => {
  175. uni.hideLoading()
  176. this.form = res
  177. console.log(res);
  178. }).catch((err) => {
  179. uni.hideLoading()
  180. console.log(err)
  181. })
  182. }
  183. },
  184. acountModify() {
  185. let formData = this.formData
  186. if (formData.realName.length == 0) {
  187. this.$toast("请输入业务管理员名称")
  188. return
  189. }
  190. if (formData.account.length == 0) {
  191. this.$toast("请输入业务管理员账号")
  192. return
  193. }
  194. if (formData.mobile.length == 0) {
  195. this.$toast("请输入联系电话")
  196. return
  197. }
  198. uni.$u.http.post(`/api/Account/update`, formData, {
  199. custom: {
  200. auth: true
  201. }
  202. }).then((res) => {
  203. console.log(res.data)
  204. if (res) {
  205. this.$toast("修改成功")
  206. uni.hideLoading()
  207. setTimeout(() => {
  208. uni.reLaunch({
  209. url: '/pages/mine/mine'
  210. })
  211. }, 1000)
  212. }
  213. }).catch((err) => {
  214. uni.hideLoading()
  215. })
  216. },
  217. acountRegister() {
  218. let that = this
  219. let form = this.form
  220. if (form.name.length == 0) {
  221. this.$toast("请输入供货商名称")
  222. return
  223. }
  224. if (form.account.length == 0) {
  225. this.$toast("请输入供货商账号")
  226. return
  227. }
  228. if (form.socialCode.length == 0) {
  229. this.$toast("请输入统一社会信用代码")
  230. return
  231. }
  232. if (form.legalPerson.length == 0) {
  233. this.$toast("请输入法人姓名")
  234. return
  235. }
  236. if (form.contacts.length == 0) {
  237. this.$toast("请输入联系人")
  238. return
  239. }
  240. if (form.contactsMobile.length == 0) {
  241. this.$toast("请输入联系电话")
  242. return
  243. }
  244. if (form.identifyPicList.length == 0) {
  245. this.$toast("请上传认证照片")
  246. return
  247. }
  248. if (form.proxyFileList.length == 0) {
  249. this.$toast("请上传授权委托书")
  250. return
  251. }
  252. console.log(form);
  253. form.checked = 1
  254. uni.hideLoading()
  255. uni.$u.http.post(`/api/Supplier/update`, {
  256. identifyPics: [...that.form.identifyPicList],
  257. proxyFile: [...that.form.proxyFileList],
  258. account: that.form.account,
  259. name: that.form.name,
  260. socialCode: that.form.socialCode,
  261. legalPerson: that.form.legalPerson,
  262. contacts: that.form.contacts,
  263. contactsMobile: that.form.contactsMobile,
  264. id: that.form.id
  265. }, {
  266. custom: {
  267. auth: true
  268. }
  269. }).then((res) => {
  270. console.log(res.data)
  271. if (res) {
  272. this.$toast("修改成功")
  273. uni.hideLoading()
  274. setTimeout(() => {
  275. uni.reLaunch({
  276. url: '/pages/mine/mine'
  277. })
  278. }, 1000)
  279. }
  280. }).catch((err) => {
  281. uni.hideLoading()
  282. })
  283. },
  284. deletImg(i){
  285. this.form.identifyPicList.splice(i,1)
  286. console.log(this.form.identifyPicList);
  287. },
  288. deletImg2(i){
  289. this.form.proxyFileList.splice(i,1)
  290. console.log(this.form.identifyPicList);
  291. },
  292. addpdf() {
  293. this.addpdfin = true
  294. uni.showModal({
  295. title: '提示',
  296. content: "是否获取授权委托书?",
  297. success: function(res) {
  298. if (res.confirm) {
  299. uni.showLoading()
  300. uni.$u.http.get('/api/Setting/attorney', {
  301. custom: {
  302. auth: true
  303. }
  304. }).then((res) => {
  305. uni.hideLoading()
  306. uni.setClipboardData({
  307. data: res,
  308. success: function() {
  309. that.$toast("复制成功,请到浏览器下载")
  310. }
  311. });
  312. // that.downloadPdf(res)
  313. }).catch((err) => {
  314. uni.hideLoading()
  315. that.$toast(err.msg)
  316. })
  317. } else if (res.cancel) {
  318. }
  319. }
  320. })
  321. },
  322. downloadPdf(url) {
  323. console.log(url)
  324. uni.downloadFile({
  325. url: url, //下载地址接口返回
  326. header: {
  327. },
  328. success: (data) => {
  329. if (data.statusCode === 200) {
  330. console.log(22222)
  331. //文件保存到本地
  332. uni.saveFile({
  333. tempFilePath: data.tempFilePath, //临时路径
  334. success: function(res) {
  335. uni.showToast({
  336. icon: 'none',
  337. mask: true,
  338. title: '文件已保存:' + res.savedFilePath, //保存路径
  339. duration: 3000,
  340. });
  341. setTimeout(() => {
  342. //打开文档查看
  343. uni.openDocument({
  344. filePath: res.savedFilePath,
  345. success: function(res) {
  346. // console.log('打开文档成功');
  347. }
  348. });
  349. }, 3000)
  350. }
  351. });
  352. }
  353. },
  354. fail: (err) => {
  355. console.log(err);
  356. uni.showToast({
  357. icon: 'none',
  358. mask: true,
  359. title: '失败请重新下载',
  360. });
  361. },
  362. });
  363. },
  364. upImages(e) {
  365. if (e == 1) {
  366. this.chooseImage(1)
  367. } else if (e == 2) {
  368. this.chooseImage(2)
  369. }
  370. },
  371. chooseImage(u) {
  372. uni.chooseImage({
  373. count: 1,
  374. success: function(e) {
  375. for (let i in e.tempFilePaths) {
  376. let ui = that.upText(e.tempFilePaths[i], u)
  377. }
  378. },
  379. complete: function(e) {
  380. // 触发事件 tabEvent
  381. return []
  382. }
  383. })
  384. },
  385. upText(e, i) {
  386. var list = []
  387. uni.showLoading({
  388. })
  389. uni.uploadFile({
  390. url: mainUrl + '/api/File',
  391. filePath: e,
  392. name: 'File',
  393. fileType: 'image',
  394. header: {
  395. "User-Agent": "apifox/1.0.0 (https://www.apifox.cn)"
  396. },
  397. formData: {
  398. File: JSON.stringify(e),
  399. // file_name: fileName,
  400. },
  401. success(re) {
  402. uni.hideLoading()
  403. let res = JSON.parse(re.data)
  404. if (res.code == 200) {
  405. if (i == 1) {
  406. that.form.identifyPicList.push(res.data.file)
  407. that.identifyPics.push(res.data.file)
  408. } else if (i == 2) {
  409. that.form.proxyFileList.push(res.data.file)
  410. that.proxyFile.push(res.data.file)
  411. }
  412. } else {
  413. uni.showModal({
  414. title: '',
  415. content: res.msg,
  416. showCancel: false,
  417. });
  418. }
  419. },
  420. fail(e) {
  421. if (e && e.msg) {
  422. uni.showModal({
  423. title: '错误',
  424. content: e.msg,
  425. showCancel: false,
  426. });
  427. }
  428. },
  429. });
  430. }
  431. }
  432. }
  433. </script>
  434. <style lang="scss" scoped>
  435. .content {
  436. padding: 0 30rpx;
  437. box-sizing: border-box;
  438. }
  439. .headbox {
  440. display: flex;
  441. justify-content: space-between;
  442. align-items: flex-end;
  443. }
  444. .headtitle {
  445. font-size: 40rpx;
  446. font-weight: 600;
  447. padding-bottom: 36rpx;
  448. }
  449. .logobox {
  450. width: 269rpx;
  451. height: 191rpx;
  452. image {
  453. width: 100%;
  454. height: 100%;
  455. }
  456. }
  457. .acountbox {
  458. height: 100%;
  459. .upmsg {
  460. margin-top: 20rpx;
  461. background-color: #F6F6F6;
  462. width: 690rpx;
  463. // height: 350rpx;
  464. border-radius: 20rpx;
  465. display: flex;
  466. flex-direction: column;
  467. align-items: center;
  468. justify-content: center;
  469. // overflow: hidden;
  470. image {
  471. width: 100%;
  472. height: 100%;
  473. }
  474. }
  475. .uppic {
  476. display: flex;
  477. align-items: center;
  478. justify-content: center;
  479. width: 500rpx;
  480. height: 250rpx;
  481. background-image: url("@/static/img/upuer.png");
  482. background-size: 100%;
  483. }
  484. .inacount {
  485. flex: 1;
  486. display: flex;
  487. padding: 35rpx 20rpx;
  488. box-sizing: border-box;
  489. // width: 606rpx;
  490. margin-top: 40rpx;
  491. background-color: #F6F6F6;
  492. border-radius: 20rpx;
  493. font-size: 30rpx;
  494. color: #1F242A;
  495. input {
  496. width: 360rpx;
  497. }
  498. }
  499. .acoutitle {
  500. font-weight: 600;
  501. }
  502. .checkword {
  503. padding-left: 20rpx;
  504. color: #1F242A;
  505. font-size: 30rpx;
  506. }
  507. }
  508. .logininbtn {
  509. box-sizing: border-box;
  510. margin-top: 80rpx;
  511. // width: 606rpx;
  512. border-radius: 20rpx;
  513. background: linear-gradient(to right, #FFE1AD, #D07539);
  514. height: 100rpx;
  515. text-align: center;
  516. color: #fff;
  517. line-height: 100rpx;
  518. }
  519. .acountall {
  520. display: flex;
  521. justify-content: flex-end;
  522. margin-top: 30rpx;
  523. font-size: 24rpx;
  524. }
  525. .checkag {
  526. margin-top: 200rpx;
  527. font-size: 28rpx;
  528. margin-bottom: 150rpx;
  529. }
  530. ::v-deep .checked {
  531. // color: #f5f7fa !important;
  532. opacity: 1 !important;
  533. background-color: darken($color: #f5f7fa, $amount: 4) !important;
  534. }
  535. .img-up{
  536. position: relative;
  537. }
  538. .delet-img{
  539. position: absolute;
  540. top: 0px;
  541. right: 0px;
  542. }
  543. </style>