editEnerprise.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <template>
  2. <view class='content'>
  3. <view class="wrap">
  4. <view style='border-bottom:1px solid #eee;padding:10px 0 10px;' class="flex flex-space-between row">
  5. <view class="left-text">企业</view>
  6. <view style='' class='flex flex-space-between'>
  7. <view :style="{'color':dataDetails.company ? '#000':'#C6CBD5'}">
  8. {{dataDetails.company?dataDetails.company:'选择所属企业'}}
  9. </view>
  10. <view>
  11. <u-icon name="arrow-right" color="#ccc" size="14"></u-icon>
  12. </view>
  13. </view>
  14. </view>
  15. <view style='padding:10px 0 10px;' class="flex flex-space-between items-center">
  16. <view style=''>法定代表人姓名</view>
  17. <view class="flex">
  18. <u--input disabledColor='#fff' disabled placeholder="自动获取" inputAlign='right' border="none"
  19. v-model="dataDetails.legalPersonName1">
  20. </u--input>
  21. </view>
  22. </view>
  23. </view>
  24. <view class='content1'>
  25. <!-- <view class="title">上传企业授权书</view> -->
  26. <view class="flex flex-space-between">
  27. <view class="title">上传企业授权书</view>
  28. <view class="title title_css" @click="formWork">授权书模板</view>
  29. </view>
  30. <!-- {{show}} -->
  31. <!-- <button type="default" @click="()=>{show = true}" style="width: 80%;background-color: #007AFF;color: #fff;margin-top: 60rpx;">选择文件</button>
  32. <view class="textStyle" v-for="(item,index) in pathArr" :key="index">
  33. <view>
  34. 文件名:{{item.name}}
  35. </view>
  36. <view>
  37. 文件地址:{{item.url}}
  38. </view>
  39. <view>
  40. 文件大小:{{item.sizeMB}}
  41. </view>
  42. </view>
  43. <nk-select-file v-model="show" @confirm="getPath"></nk-select-file> -->
  44. <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
  45. name="1" multiple :maxCount="1"></u-upload>
  46. <!-- <view style='position:relative;'>
  47. <view v-if='!dataDetails.certificateAddressUrl' @click="uploadImg(1)" class="picture picture7">
  48. <image class="xj-image" src="@/static/mine/ic_shanchuan@2x.png"></image>
  49. <view class="text">上传企业授权书</view>
  50. </view>
  51. <view v-if='dataDetails.certificateAddressUrl' @click.stop="uploadImg(1)"
  52. class="preview-card-img picture ">
  53. <view @click.stop="delCard(1)">
  54. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  55. </image>
  56. </view>
  57. <image class="" :src="dataDetails.certificateAddressUrl" mode="aspectFit"></image>
  58. </view>
  59. </view> -->
  60. <view class="flex row noborder flex-space-between">
  61. <view stlye='' class="left-text">授权截止日期</view>
  62. <view style='' class='flex flex-space-between' @click="selectdate">
  63. <view style='padding-left:20px;'
  64. :style="{'color':dataDetails.authorizationDeadline ? '#000':'#C6CBD5'}">
  65. {{dataDetails.authorizationDeadline?dataDetails.authorizationDeadline:'选择期限截止日期'}}
  66. </view>
  67. <view>
  68. <u-icon name="arrow-right" color="#ccc" size="14"></u-icon>
  69. </view>
  70. </view>
  71. </view>
  72. <!-- <u-picker :show="isdate" ref="uPicker" :columns="validityPeriod" @confirm="confirmValidityPeriod"
  73. @change="changeHandler" @cancel="isdate=false">
  74. </u-picker> -->
  75. <itmister-date-picker :overdueContent="'授权已过期'" :dateStatus="1" :checkYear="year" :checkMonth="month" :periodOfValidity="true" :futureYear="30" ref="dateAuthorization" @dateConfirm="confirmValidityPeriod"></itmister-date-picker>
  76. </view>
  77. <u-action-sheet :actions="$helper.imgTypeList" :title="$helper.imgType" :show="isShowimgType"
  78. @select="imgTypeSelect" @cancel='isShowimgType=false' :closeOnClickOverlay="true" :closeOnClickAction="true"
  79. @close="isShowimgType=false">
  80. </u-action-sheet>
  81. <view class="content4">
  82. <view style='margin:0 0 18px;font-size:12px;color:#999;align-items:center' class='flex'>
  83. <u--image style='margin-right:5px;' @click='consent'
  84. :src="checked?'../../../static/mine/duihao@2x.png':'../../../static/mine/wxz.png'" width="12px"
  85. height="12px"></u--image>
  86. 我已阅读并同意全部细则
  87. </view>
  88. <view class='line'></view>
  89. <view
  90. :class="{'active':dataDetails.certificateAddressUrl&&dataDetails.company&&dataDetails.legalPersonName&&dataDetails.authorizationDeadline}"
  91. class="next-btn" @click="$u.throttle(submit, 1000)">
  92. 提交
  93. </view>
  94. </view>
  95. <u-picker :show="formWorkShow" @cancel="formWorkShow = false" @close="formWorkShow = false"
  96. :columns="formWorkColumns" @confirm="formWorkSubmit"></u-picker>
  97. </view>
  98. </template>
  99. <script>
  100. import {
  101. mapState
  102. } from 'vuex';
  103. import upload from '@/components/upload.vue';
  104. import permision from "@/js_sdk/wa-permission/permission.js"
  105. import uploadImage from '@/components/ossutil/uploadFile.js';
  106. export default {
  107. components: {},
  108. data() {
  109. return {
  110. show: false,
  111. pathArr: [],
  112. dataDetails: {},
  113. companuList: [],
  114. isshow: false,
  115. isdate: false,
  116. checked: false,
  117. year:'',
  118. month:'',
  119. day:'',
  120. validityPeriod: [],
  121. isShowimgType: false,
  122. uploadType: '',
  123. index: 0,
  124. fileList1: [],
  125. urlList: [],
  126. formWorkShow: false,
  127. formWorkColumns: [
  128. ["复制下载链接", "预览模板"]
  129. ]
  130. }
  131. },
  132. computed: {
  133. ...mapState(['hasLogin', 'userInfo']),
  134. },
  135. onLoad(options) {
  136. this.get_camera_permission()
  137. if (uni.getStorageSync('cargoOwnerId')) {
  138. this.dataDetails.cargoOwnerId = uni.getStorageSync('cargoOwnerId')
  139. }
  140. // this.getList()
  141. this.dataDetails = options
  142. if(this.dataDetails.authorizationDeadline&&this.dataDetails.authorizationDeadline!='长期'){
  143. const arr=this.dataDetails.authorizationDeadline.split('-')
  144. this.year=arr[0]
  145. this.month=arr[1]
  146. this.day=arr[2]
  147. }
  148. if(this.dataDetails.authorizationDeadline=='长期'){
  149. this.year='长期'
  150. }
  151. if (this.dataDetails.legalPersonName.length == 2) {
  152. this.dataDetails.legalPersonName1 = this.dataDetails.legalPersonName.toString().replace(
  153. /^([^\x00-\xff])([^\x00-\xff]{0,})([^\x00-\xff])/g, '$1*')
  154. } else if (this.dataDetails.legalPersonName.length == 3) {
  155. this.dataDetails.legalPersonName1 = this.dataDetails.legalPersonName.toString().replace(
  156. /^([^\x00-\xff])([^\x00-\xff]{0,})([^\x00-\xff])/g, '$1*$3')
  157. } else if (this.dataDetails.legalPersonName.length == 4) {
  158. this.dataDetails.legalPersonName1 = this.dataDetails.legalPersonName.toString().replace(
  159. /^([^\x00-\xff])([^\x00-\xff]{0,2})([^\x00-\xff])/g, '$1**$3')
  160. }
  161. console.log(this.dataDetails)
  162. if (options.certificateAddressUrl) {
  163. this.urlList = options.certificateAddressUrl
  164. this.fileList1 = []
  165. this.fileList1.push({
  166. url: this.urlList
  167. })
  168. }
  169. },
  170. onShow() {
  171. },
  172. methods: {
  173. formWork() {
  174. this.formWorkShow = true
  175. },
  176. formWorkSubmit(e) {
  177. let that = this
  178. console.log(e.value[0])
  179. if (e.value[0] == "复制下载链接") {
  180. uni.setClipboardData({
  181. data: 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/contractPdf/1069f84fcbbe4c2d9ce048bf98ea7a63.pdf',
  182. success: function() {
  183. uni.showToast({
  184. title: '复制成功',
  185. });
  186. that.formWorkShow = false
  187. },
  188. fail: function() {
  189. uni.showToast({
  190. title: '复制失败',
  191. });
  192. }
  193. });
  194. } else {
  195. uni.downloadFile({
  196. url: 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/contractPdf/1069f84fcbbe4c2d9ce048bf98ea7a63.pdf',
  197. success: function(res) {
  198. var filePath = res.tempFilePath;
  199. uni.openDocument({
  200. filePath: filePath,
  201. showMenu: true,
  202. success: function(res) {
  203. console.log('打开文档成功');
  204. that.formWorkShow = false
  205. }
  206. });
  207. }
  208. });
  209. }
  210. },
  211. async get_camera_permission() {
  212. var photol = await permision.requestAndroidPermission("android.permission.CAMERA")
  213. if (photol == false) {
  214. uni.showModal({
  215. title: '提示',
  216. content: '您已经关闭相机权限,去设置',
  217. success: function(res) {
  218. if (res.confirm) {
  219. permision.gotoAppPermissionSetting()
  220. // plus.runtime.openURL("app-settings:");
  221. } else if (res.cancel) {
  222. console.log('用户点击取消');
  223. }
  224. }
  225. });
  226. }
  227. },
  228. uploadFilePromise(file, url) {
  229. uploadImage('image', url, 'appData/',
  230. result => {
  231. // 上传成功回调函数
  232. console.log('图片地址', result)
  233. this.urlList = result
  234. // this.dataDetails.certificateAddressUrl=this.dataDetails.certificateAddressUrl +',' +result
  235. }
  236. )
  237. },
  238. // 删除图片
  239. deletePic(event) {
  240. this.urlList = ''
  241. this[`fileList${event.name}`].splice(event.index, 1)
  242. },
  243. // 新增图片
  244. async afterRead(event) {
  245. // console.log(this[`fileList${event.name}`])
  246. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  247. let lists = [].concat(event.file)
  248. let fileListLen = this[`fileList${event.name}`].length
  249. lists.map((item) => {
  250. this[`fileList${event.name}`].push({
  251. ...item,
  252. status: 'uploading',
  253. message: '上传中'
  254. })
  255. })
  256. for (let i = 0; i < lists.length; i++) {
  257. const result = await this.uploadFilePromise(lists[i], lists[i].url)
  258. // console.log(result)
  259. let item = this[`fileList${event.name}`][fileListLen]
  260. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  261. status: 'success',
  262. message: '',
  263. url: result
  264. }))
  265. fileListLen++
  266. }
  267. },
  268. consent() {
  269. this.checked = !this.checked
  270. },
  271. selectdate() {
  272. this.$refs.dateAuthorization.show();
  273. },
  274. selectshow() {
  275. this.goDetailPage('/pages/mine/cargoowner/selectcompany')
  276. },
  277. confirmValidityPeriod(date) {
  278. this.dataDetails.authorizationDeadline =date.date
  279. },
  280. goDetailPage(src) {
  281. uni.setStorage({
  282. key: 'companydata',
  283. data: JSON.stringify(this.dataDetails)
  284. });
  285. uni.$u.route(src);
  286. },
  287. changeHandler(e) {
  288. const {
  289. columnIndex,
  290. value,
  291. values,
  292. index,
  293. picker = this.$refs.uPicker
  294. } = e
  295. // if (columnIndex === 0) {
  296. //
  297. // if (e.index != 0) {
  298. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  299. // }
  300. // } else if (columnIndex === 1) {
  301. // if (e.index != 0) {
  302. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  303. // }
  304. // }
  305. },
  306. // getList(){
  307. // uni.showLoading({
  308. // title: '加载中',
  309. // mask:true
  310. // })
  311. // var _this=this
  312. // this.$request.baseRequest('get', '/companyInfo/selectAllCompany').then(res => {
  313. // uni.hideLoading()
  314. // this.companyList=res
  315. // })
  316. // .catch(res => {
  317. // uni.hideLoading()
  318. // uni.showToast({
  319. // title: res.message,
  320. // icon: 'none',
  321. // duration: 2000
  322. // })
  323. // });
  324. // },
  325. submit() {
  326. if (!this.checked) {
  327. uni.showToast({
  328. title: '请勾选协议',
  329. icon: 'none',
  330. duration: 2000
  331. })
  332. return
  333. }
  334. uni.showLoading({
  335. title: '加载中',
  336. mask: true
  337. })
  338. var _this = this
  339. this.dataDetails.commonId = this.userInfo.id
  340. this.dataDetails.certificateAddressUrl = this.urlList.toString()
  341. this.$request.baseRequest('post', '/cargoOwnerCompInfo/api/editCargoOwnerComp', _this.dataDetails).then(
  342. res => {
  343. uni.hideLoading()
  344. uni.removeStorage('cargoOwnerId')
  345. uni.removeStorage('currectcompany')
  346. uni.$u.toast('提交成功')
  347. uni.navigateBack({
  348. delta: 1
  349. })
  350. })
  351. .catch(res => {
  352. uni.hideLoading()
  353. uni.showToast({
  354. title: res.message,
  355. icon: 'none',
  356. duration: 2000
  357. })
  358. });
  359. },
  360. }
  361. }
  362. </script>
  363. <style lang='scss' scoped>
  364. page {
  365. background: #F5F6FA;
  366. }
  367. .content {
  368. height: 100vh;
  369. /* background: white; */
  370. /* padding:20rpx */
  371. }
  372. .wrap {
  373. margin: 20rpx;
  374. padding: 20rpx;
  375. border-radius: 20rpx;
  376. background: white;
  377. }
  378. .preview-card-img {
  379. /deep/uni-image>div,
  380. uni-image>img {
  381. transform: scale(1.5) rotate(-90deg);
  382. }
  383. }
  384. .picture {
  385. margin-top: 20rpx;
  386. background: #F5F6FA;
  387. width: 212rpx;
  388. height: 212rpx;
  389. border-radius: 20rpx;
  390. display: flex;
  391. flex-direction: column;
  392. justify-content: center;
  393. align-items: center;
  394. color: #6A7282;
  395. }
  396. .content1 {
  397. background: #fff;
  398. padding: 20rpx;
  399. margin: 20rpx;
  400. border-radius: 10rpx;
  401. .row {
  402. border-bottom: 1px solid #EEEEEE;
  403. padding-bottom: 28rpx;
  404. margin-top: 26rpx;
  405. }
  406. .left-text {
  407. // background: red;
  408. width: 320rpx;
  409. color: #333333;
  410. display: flex;
  411. align-items: center;
  412. }
  413. .picture {
  414. position: relative;
  415. width: 100%;
  416. height: 440rpx;
  417. display: flex;
  418. justify-content: center;
  419. flex-direction: column;
  420. align-items: center;
  421. .text {
  422. margin-top: 20rpx;
  423. }
  424. }
  425. .picture7 {
  426. background: url(../../../static/mine/cy.png);
  427. background-size: 100% 100%;
  428. }
  429. .xj-image {
  430. width: 100rpx;
  431. height: 100rpx;
  432. }
  433. .title {
  434. color: #999999;
  435. }
  436. .title_css {
  437. color: #F5BA3C;
  438. }
  439. }
  440. .u-input {}
  441. .content4 {
  442. position: fixed;
  443. bottom: 0;
  444. background: white;
  445. width: 100%;
  446. text-align: center;
  447. left: 0;
  448. box-sizing: border-box;
  449. ;
  450. padding: 10px 15px;
  451. .line {
  452. position: absolute;
  453. left: 0;
  454. margin-top: -9px;
  455. border-top: 1px solid #eee;
  456. width: 100%;
  457. }
  458. .next-btn {
  459. background: #F1F3F6;
  460. width: 85%;
  461. padding: 20rpx 20rpx;
  462. text-align: center;
  463. color: #C5CAD4;
  464. border-radius: 50rpx;
  465. margin: 0 auto;
  466. margin-top: 10px;
  467. }
  468. .next-btn.active {
  469. background: #F5BA3C;
  470. color: #fff;
  471. }
  472. }
  473. </style>