addEnerprise.vue 14 KB

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