addEnerprise.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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. authorizationDeadline:'',
  94. certificateAddressUrl:'',
  95. advanceFreightService:''
  96. },
  97. companuList:[],
  98. isshow:false,
  99. isdate:false,
  100. checked:false,
  101. validityPeriod:[],
  102. isShowimgType:false,
  103. uploadType:'',
  104. index:0,
  105. fileList1: []
  106. }
  107. },
  108. computed: {
  109. ...mapState(['hasLogin', 'userInfo']),
  110. },
  111. onLoad(){
  112. if(uni.getStorageSync('cargoOwnerId')){
  113. this.dataDetails.cargoOwnerId=uni.getStorageSync('cargoOwnerId')
  114. }
  115. this.validityPeriod = this.$helper.makeValidityPeriod(0,'长期')
  116. // this.getList()
  117. },
  118. onShow() {
  119. if(uni.getStorageSync('currectcompany')){
  120. this.dataDetails.company=uni.getStorageSync('currectcompany').companyName
  121. this.dataDetails.advanceFreightService=uni.getStorageSync('currectcompany').advanceFreightService
  122. this.dataDetails.legalPersonName=uni.getStorageSync('currectcompany').legalPersonName
  123. }
  124. },
  125. methods: {
  126. getPath(event){
  127. console.log(event);
  128. this.pathArr = event;
  129. },
  130. uploadFilePromise(file,url) {
  131. uploadImage(file,url, 'appData/',
  132. result => {
  133. // 上传成功回调函数
  134. console.log('图片地址', result)
  135. this.dataDetails.certificateAddressUrl += result
  136. }
  137. )
  138. },
  139. // 删除图片
  140. deletePic(event) {
  141. this[`fileList${event.name}`].splice(event.index, 1)
  142. },
  143. // 新增图片
  144. async afterRead(event) {
  145. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  146. let lists = [].concat(event.file)
  147. let fileListLen = this[`fileList${event.name}`].length
  148. lists.map((item) => {
  149. this[`fileList${event.name}`].push({
  150. ...item,
  151. status: 'uploading',
  152. message: '上传中'
  153. })
  154. })
  155. for (let i = 0; i < lists.length; i++) {
  156. const result = await this.uploadFilePromise(lists[i],lists[i].url)
  157. let item = this[`fileList${event.name}`][fileListLen]
  158. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  159. status: 'success',
  160. message: '',
  161. url: result
  162. }))
  163. fileListLen++
  164. }
  165. },
  166. consent(){
  167. this.checked=!this.checked
  168. },
  169. selectdate(){
  170. this.isdate=true
  171. },
  172. selectshow(){
  173. this.goDetailPage('/pages/mine/cargoowner/selectcompany')
  174. },
  175. confirmValidityPeriod(e) {
  176. console.log('confirm', e)
  177. if (e.value[0] == '长期') {
  178. this.dataDetails.authorizationDeadline = e.value[0]
  179. } else {
  180. this.dataDetails.authorizationDeadline = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  181. }
  182. this.isdate = false
  183. },
  184. goDetailPage(src) {
  185. uni.setStorage({key: 'companydata',data: JSON.stringify(this.dataDetails)});
  186. uni.$u.route(src);
  187. },
  188. changeHandler(e) {
  189. const {
  190. columnIndex,
  191. value,
  192. values,
  193. index,
  194. picker = this.$refs.uPicker
  195. } = e
  196. // if (columnIndex === 0) {
  197. //
  198. // if (e.index != 0) {
  199. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  200. // }
  201. // } else if (columnIndex === 1) {
  202. // if (e.index != 0) {
  203. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  204. // }
  205. // }
  206. },
  207. // getList(){
  208. // uni.showLoading({
  209. // title: '加载中',
  210. // mask:true
  211. // })
  212. // var _this=this
  213. // this.$request.baseRequest('get', '/companyInfo/selectAllCompany').then(res => {
  214. // uni.hideLoading()
  215. // this.companyList=res
  216. // })
  217. // .catch(res => {
  218. // uni.hideLoading()
  219. // uni.showToast({
  220. // title: res.message,
  221. // icon: 'none',
  222. // duration: 2000
  223. // })
  224. // });
  225. // },
  226. submit(){
  227. uni.showLoading({
  228. title: '加载中',
  229. mask:true
  230. })
  231. var _this=this
  232. this.dataDetails.commonId=this.userInfo.id
  233. this.$request.baseRequest('post', '/cargoOwnerCompInfo/api/addCargoOwnerComp', _this.dataDetails).then(res => {
  234. uni.hideLoading()
  235. uni.removeStorage('cargoOwnerId')
  236. uni.removeStorage('currectcompany')
  237. uni.$u.toast('提交成功')
  238. _this.goDetailPage('/pages/mine/cargoowner/cargoowner')
  239. })
  240. .catch(res => {
  241. uni.hideLoading()
  242. uni.showToast({
  243. title: res.message,
  244. icon: 'none',
  245. duration: 2000
  246. })
  247. });
  248. },
  249. }
  250. }
  251. </script>
  252. <style lang='scss' scoped>
  253. page{
  254. background: #F5F6FA;
  255. }
  256. .content{
  257. /* background: white; */
  258. /* padding:20rpx */
  259. }
  260. .wrap{
  261. margin: 20rpx;
  262. padding: 20rpx;
  263. border-radius: 20rpx;
  264. background: white;
  265. }
  266. .preview-card-img {
  267. /deep/uni-image>div, uni-image>img {
  268. transform: scale(1.5) rotate(-90deg);
  269. }
  270. }
  271. .picture {
  272. margin-top: 20rpx;
  273. background: #F5F6FA;
  274. width: 212rpx;
  275. height: 212rpx;
  276. border-radius: 20rpx;
  277. display: flex;
  278. flex-direction: column;
  279. justify-content: center;
  280. align-items: center;
  281. color: #6A7282;
  282. }
  283. .content1 {
  284. background:#fff;
  285. padding:40rpx 20rpx 20rpx;
  286. margin:20rpx 0rpx 200rpx;
  287. border-radius: 10rpx;
  288. .row {
  289. border-bottom: 1px solid #EEEEEE;
  290. padding-bottom: 28rpx;
  291. margin-top: 26rpx;
  292. }
  293. .left-text {
  294. // background: red;
  295. width: 320rpx;
  296. color: #333333;
  297. display: flex;
  298. align-items: center;
  299. font-size:14px;
  300. }
  301. .picture {
  302. position: relative;
  303. width: 100%;
  304. height: 440rpx;
  305. display: flex;
  306. justify-content: center;
  307. flex-direction: column;
  308. align-items: center;
  309. .text {
  310. margin-top: 20rpx;
  311. }
  312. }
  313. .picture7 {
  314. background: url(../../../static/mine/cy.png);
  315. background-size: 100% 100%;
  316. }
  317. .xj-image {
  318. width: 100rpx;
  319. height: 100rpx;
  320. }
  321. .title {
  322. color: #999999;
  323. margin: 20rpx 0;
  324. }
  325. }
  326. .u-input{
  327. font-size:16px;
  328. }
  329. .content4 {
  330. position:fixed;
  331. bottom:0;
  332. background: white;
  333. width:100%;
  334. text-align:center;
  335. left:0;
  336. box-sizing: border-box;;
  337. padding:10px 15px;
  338. .line{
  339. position:absolute;
  340. left:0;
  341. margin-top:-9px;
  342. border-top:1px solid #eee;
  343. width:100%;
  344. }
  345. .next-btn {
  346. background: #F1F3F6;
  347. width: 85%;
  348. padding: 20rpx 20rpx;
  349. text-align: center;
  350. color: #C5CAD4;
  351. border-radius: 50rpx;margin:0 auto;
  352. margin-top:10px;
  353. }
  354. .next-btn.active{
  355. background:#2772FB;
  356. color:#fff;
  357. }
  358. }
  359. </style>