editEnerprise.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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='font-size:16px;width:50%;' class='flex flex-space-between' @click="selectshow">
  7. <view :style="{'color':dataDetails.company ? '#000':'#C6CBD5'}">{{dataDetails.company?dataDetails.company:'选择所属企业'}}</view>
  8. <view><u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon></view>
  9. </view>
  10. </view>
  11. <view style='padding:10px 0 10px;' class="flex flex-space-between items-center width100">
  12. <view style='width:100px;font-size:14px;'>法定代表人姓名</view>
  13. <view class="flex">
  14. <u--input disabledColor='#fff' disabled placeholder="自动获取" inputAlign='left' border="none" v-model="dataDetails.legalPersonName">
  15. </u--input>
  16. </view>
  17. </view>
  18. </view>
  19. <view class='content1'>
  20. <view class="title">上传企业授权书</view>
  21. <!-- {{show}} -->
  22. <!-- <button type="default" @click="()=>{show = true}" style="width: 80%;background-color: #007AFF;color: #fff;margin-top: 60rpx;">选择文件</button>
  23. <view class="textStyle" v-for="(item,index) in pathArr" :key="index">
  24. <view>
  25. 文件名:{{item.name}}
  26. </view>
  27. <view>
  28. 文件地址:{{item.url}}
  29. </view>
  30. <view>
  31. 文件大小:{{item.sizeMB}}
  32. </view>
  33. </view>
  34. <nk-select-file v-model="show" @confirm="getPath"></nk-select-file> -->
  35. <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
  36. name="1" multiple :maxCount="9"></u-upload>
  37. <!-- <view style='position:relative;'>
  38. <view v-if='!dataDetails.certificateAddressUrl' @click="uploadImg(1)" class="picture picture7">
  39. <image class="xj-image" src="@/static/mine/ic_shanchuan@2x.png"></image>
  40. <view class="text">上传企业授权书</view>
  41. </view>
  42. <view v-if='dataDetails.certificateAddressUrl' @click.stop="uploadImg(1)"
  43. class="preview-card-img picture ">
  44. <view @click.stop="delCard(1)">
  45. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  46. </image>
  47. </view>
  48. <image class="" :src="dataDetails.certificateAddressUrl" mode="aspectFit"></image>
  49. </view>
  50. </view> -->
  51. <view class="flex row noborder">
  52. <view class="left-text">营业期限截止日期</view>
  53. <view style='font-size:16px;width:50%;' class='flex flex-space-between' @click="selectdate">
  54. <view :style="{'color':dataDetails.authorizationDeadline ? '#000':'#C6CBD5'}">{{dataDetails.authorizationDeadline?dataDetails.authorizationDeadline:'选择期限截止日期'}}</view>
  55. <view><u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon></view>
  56. </view>
  57. </view>
  58. <u-picker :show="isdate" ref="uPicker" :columns="validityPeriod"
  59. @confirm="confirmValidityPeriod" @change="changeHandler" @cancel="isdate=false">
  60. </u-picker>
  61. </view>
  62. <u-action-sheet :actions="$helper.imgTypeList" :title="$helper.imgType" :show="isShowimgType"
  63. @select="imgTypeSelect" @cancel='isShowimgType=false' :closeOnClickOverlay="true" :closeOnClickAction="true" @close="isShowimgType=false">
  64. </u-action-sheet>
  65. <view class="content4">
  66. <view style='margin:0 0 18px;font-size:12px;color:#999;' class='flex items-center'>
  67. <u--image style='margin-right:5px;' @click='consent'
  68. :src="checked?'../../../static/mine/duihao@2x.png':'../../../static/mine/wxz.png'"
  69. width="12px" height="12px"></u--image>
  70. 我已阅读并同意全部细则
  71. </view>
  72. <view class='line'></view>
  73. <view :class="{'active':dataDetails.certificateAddressUrl&&dataDetails.company&&dataDetails.legalPersonName&&dataDetails.authorizationDeadline}" class="next-btn" @click="submit()">
  74. 提交
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. import {
  81. mapState
  82. } from 'vuex';
  83. import upload from '@/components/upload.vue';
  84. import uploadImage from '@/components/ossutil/uploadFile.js';
  85. export default {
  86. components: {
  87. },
  88. data() {
  89. return {
  90. show:false,
  91. pathArr: [],
  92. dataDetails:{},
  93. companuList:[],
  94. isshow:false,
  95. isdate:false,
  96. checked:false,
  97. validityPeriod:[],
  98. isShowimgType:false,
  99. uploadType:'',
  100. index:0,
  101. fileList1: []
  102. }
  103. },
  104. computed: {
  105. ...mapState(['hasLogin', 'userInfo']),
  106. },
  107. onLoad(options){
  108. if(uni.getStorageSync('cargoOwnerId')){
  109. this.dataDetails.cargoOwnerId=uni.getStorageSync('cargoOwnerId')
  110. }
  111. this.validityPeriod = this.$helper.makeValidityPeriod(0,'长期')
  112. // this.getList()
  113. this.dataDetails = options
  114. this.fileList1 = [{
  115. url:options.certificateAddressUrl
  116. }]
  117. },
  118. onShow() {
  119. },
  120. methods: {
  121. uploadFilePromise(file,url) {
  122. uploadImage('image',file,url, 'appData/',
  123. result => {
  124. // 上传成功回调函数
  125. console.log('图片地址', result)
  126. this.dataDetails.addressUrl += result
  127. }
  128. )
  129. },
  130. // 删除图片
  131. deletePic(event) {
  132. this[`fileList${event.name}`].splice(event.index, 1)
  133. },
  134. // 新增图片
  135. async afterRead(event) {
  136. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  137. let lists = [].concat(event.file)
  138. let fileListLen = this[`fileList${event.name}`].length
  139. lists.map((item) => {
  140. this[`fileList${event.name}`].push({
  141. ...item,
  142. status: 'uploading',
  143. message: '上传中'
  144. })
  145. })
  146. for (let i = 0; i < lists.length; i++) {
  147. const result = await this.uploadFilePromise(lists[i],lists[i].url)
  148. let item = this[`fileList${event.name}`][fileListLen]
  149. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  150. status: 'success',
  151. message: '',
  152. url: result
  153. }))
  154. fileListLen++
  155. }
  156. },
  157. consent(){
  158. this.checked=!this.checked
  159. },
  160. selectdate(){
  161. this.isdate=true
  162. },
  163. selectshow(){
  164. this.goDetailPage('/pages/mine/cargoowner/selectcompany')
  165. },
  166. confirmValidityPeriod(e) {
  167. console.log('confirm', e)
  168. if (e.value[0] == '长期') {
  169. this.dataDetails.authorizationDeadline = e.value[0]
  170. } else {
  171. this.dataDetails.authorizationDeadline = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  172. }
  173. this.isdate = false
  174. },
  175. goDetailPage(src) {
  176. uni.setStorage({key: 'companydata',data: JSON.stringify(this.dataDetails)});
  177. uni.$u.route(src);
  178. },
  179. changeHandler(e) {
  180. const {
  181. columnIndex,
  182. value,
  183. values,
  184. index,
  185. picker = this.$refs.uPicker
  186. } = e
  187. // if (columnIndex === 0) {
  188. //
  189. // if (e.index != 0) {
  190. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  191. // }
  192. // } else if (columnIndex === 1) {
  193. // if (e.index != 0) {
  194. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  195. // }
  196. // }
  197. },
  198. // getList(){
  199. // uni.showLoading({
  200. // title: '加载中',
  201. // mask:true
  202. // })
  203. // var _this=this
  204. // this.$request.baseRequest('get', '/companyInfo/selectAllCompany').then(res => {
  205. // uni.hideLoading()
  206. // this.companyList=res
  207. // })
  208. // .catch(res => {
  209. // uni.hideLoading()
  210. // uni.showToast({
  211. // title: res.message,
  212. // icon: 'none',
  213. // duration: 2000
  214. // })
  215. // });
  216. // },
  217. submit(){
  218. uni.showLoading({
  219. title: '加载中',
  220. mask:true
  221. })
  222. var _this=this
  223. this.dataDetails.commonId=this.userInfo.id
  224. this.$request.baseRequest('post', '/cargoOwnerCompInfo/api/editCargoOwnerComp', _this.dataDetails).then(res => {
  225. uni.hideLoading()
  226. uni.removeStorage('cargoOwnerId')
  227. uni.removeStorage('currectcompany')
  228. uni.$u.toast('提交成功')
  229. _this.goDetailPage('/pages/mine/cargoowner/cargoowner')
  230. })
  231. .catch(res => {
  232. uni.hideLoading()
  233. uni.showToast({
  234. title: res.message,
  235. icon: 'none',
  236. duration: 2000
  237. })
  238. });
  239. },
  240. }
  241. }
  242. </script>
  243. <style lang='scss' scoped>
  244. page{
  245. background: #F5F6FA;
  246. }
  247. .content{
  248. /* background: white; */
  249. /* padding:20rpx */
  250. }
  251. .wrap{
  252. margin: 20rpx;
  253. padding: 20rpx;
  254. border-radius: 20rpx;
  255. background: white;
  256. }
  257. .preview-card-img {
  258. /deep/uni-image>div, uni-image>img {
  259. transform: scale(1.5) rotate(-90deg);
  260. }
  261. }
  262. .picture {
  263. margin-top: 20rpx;
  264. background: #F5F6FA;
  265. width: 212rpx;
  266. height: 212rpx;
  267. border-radius: 20rpx;
  268. display: flex;
  269. flex-direction: column;
  270. justify-content: center;
  271. align-items: center;
  272. color: #6A7282;
  273. }
  274. .content1 {
  275. background:#fff;
  276. padding:40rpx 20rpx 20rpx;
  277. margin:20rpx 0rpx 200rpx;
  278. border-radius: 10rpx;
  279. .row {
  280. border-bottom: 1px solid #EEEEEE;
  281. padding-bottom: 28rpx;
  282. margin-top: 26rpx;
  283. }
  284. .left-text {
  285. // background: red;
  286. width: 320rpx;
  287. color: #333333;
  288. display: flex;
  289. align-items: center;
  290. font-size:14px;
  291. }
  292. .picture {
  293. position: relative;
  294. width: 100%;
  295. height: 440rpx;
  296. display: flex;
  297. justify-content: center;
  298. flex-direction: column;
  299. align-items: center;
  300. .text {
  301. margin-top: 20rpx;
  302. }
  303. }
  304. .picture7 {
  305. background: url(../../../static/mine/cy.png);
  306. background-size: 100% 100%;
  307. }
  308. .xj-image {
  309. width: 100rpx;
  310. height: 100rpx;
  311. }
  312. .title {
  313. color: #999999;
  314. margin: 20rpx 0;
  315. }
  316. }
  317. .u-input{
  318. font-size:16px;
  319. }
  320. .content4 {
  321. position:fixed;
  322. bottom:0;
  323. background: white;
  324. width:100%;
  325. text-align:center;
  326. left:0;
  327. box-sizing: border-box;;
  328. padding:10px 15px;
  329. .line{
  330. position:absolute;
  331. left:0;
  332. margin-top:-9px;
  333. border-top:1px solid #eee;
  334. width:100%;
  335. }
  336. .next-btn {
  337. background: #F1F3F6;
  338. width: 85%;
  339. padding: 20rpx 20rpx;
  340. text-align: center;
  341. color: #C5CAD4;
  342. border-radius: 50rpx;margin:0 auto;
  343. margin-top:10px;
  344. }
  345. .next-btn.active{
  346. background:#2772FB;
  347. color:#fff;
  348. }
  349. }
  350. </style>