enter.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <template>
  2. <view class="center">
  3. <image class='bg' src='../../static/img/liangmai/bg@3x.png'></image>
  4. <!-- <view class=""> -->
  5. <view class="back-btn cuIcon-back" @click="navBack"></view>
  6. <!-- <view class='title1'>入驻</view> -->
  7. <view class="titleUp">
  8. 请填写入驻信息
  9. </view>
  10. <u-form class="forList">
  11. <view style='padding-bottom:20px;' class="modular content1-card">
  12. <u-form-item label="公司名称" label-width="30%" class="title Regular">
  13. <u-input maxlength='25' v-model="deptList.compName" input-align="right" class="write Medium"
  14. placeholder="请输入公司名称" />
  15. </u-form-item>
  16. <view>
  17. <view class="title Regular" style="margin-top: 15rpx;">主营类型(可多选,必须为真实经营类型)</view>
  18. <view v-for="(item,index) in management" class="choice">
  19. <!-- <u-tag :type="types[index] == null ? 'info' : types[index]" :text="item" show="show"
  20. @click="singleClick(index)"></u-tag> -->
  21. <view :class="!item.checked ? '' : 'types1'" class='types' @click="singleClick(item)">
  22. {{item.name}}
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="modular">
  28. <u-form-item label="标题" label-width="30%" prop="title" class="title Regular">
  29. <u-input maxlength="16" v-model="deptList.title" input-align="right" class="write Regular"
  30. placeholder="用于封面展示,2-16个字" />
  31. </u-form-item>
  32. <u-form-item label-position='top' label="公司简介" label-width="30%" class="title Regular">
  33. <!-- <u-input input-align="right" type="textarea"
  34. /> -->
  35. <view class='companyProfilewrap'>
  36. <textarea class="write Regular companyProfile" maxlength="60"
  37. placeholder="请输入企业简介,如经营项目、产品类型、企业规模等,10-60个字" v-model="deptList.companyProfile" name=""
  38. id="" cols="10" rows="3">
  39. </textarea>
  40. <view class='companyProfilecontent'>{{deptList.companyProfile.length}}/60个字</view>
  41. </view>
  42. </u-form-item>
  43. </view>
  44. <view class="modular">
  45. <u-form-item label="上传坐标" label-width="30%" class="title Regular">
  46. <text @click='naviageToPage("/pages/grain_pulse/localtion/coordinate")'
  47. class="con-list Regular">{{position.longitude == undefined ? "未上传":'已上传'}}<text
  48. class='tip_text cuIcon-right'></text></text>
  49. </u-form-item>
  50. <u-form-item label="所在区域" label-width="30%" class="title Regular">
  51. <view style='text-align:right;width:100%;padding-right:10px;' v-if='position.province!=undefined'>
  52. {{position.province}}
  53. {{position.city}}
  54. {{position.district}}
  55. </view>
  56. <view style='text-align:right;width:100%;padding-right:10px;' v-if='position.pname!=undefined'>
  57. {{position.pname}}
  58. {{position.cityname}}
  59. {{position.adname}}
  60. </view>
  61. <view style='text-align:right;width:100%;padding-right:10px;'
  62. v-if='position.pname==undefined&&position.province==undefined'>
  63. 未上传坐标
  64. </view>
  65. </u-form-item>
  66. <u-form-item label="详细地址" label-width="30%" class="title Regular">
  67. <u-input v-model="deptList.detailedAddress" input-align="right" class="write Regular"
  68. placeholder="如街道和门牌号,2-12个字" maxlength="12" />
  69. </u-form-item>
  70. <view>
  71. <view class="title Regular" style="margin-top: 15rpx;">上传图片</view>
  72. <view v-if="license1 != ''">
  73. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  74. :size-type="['compressed']" @on-success="getImgUrl" @on-uploaded="isAdd = true"
  75. :before-upload="filterFileType" :options="uploadOptions" customBorder='2px dashed #D8DEF7'
  76. customBtnFontSize="14" customBtnColor="#6A7282" :customBtnHeight='custombtnheight'
  77. :customBtnWidth='custombtnwidth' customBack='#F9FAFE' :customBtnImage="custombtnimage"
  78. :customBtn='custombtn' :custom="uploadCustom"></upload>
  79. </view>
  80. <!-- <view v-if="license2 != ''">
  81. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  82. :size-type="['compressed']" @on-success="getImgUrl1" @on-uploaded="isAdd = true"
  83. :before-upload="filterFileType" :options="uploadOptions1" customBack='#FEF9FA'
  84. customBorder='2px dashed #F9D5DC' customBtnFontSize="14" customBtnColor="#6A7282"
  85. :customBtnHeight='custombtnheight' :customBtnWidth='custombtnwidth'
  86. :customBtnImage="custombtnimage" :customBtn='custombtn' :custom="uploadCustom"></upload>
  87. </view> -->
  88. </view>
  89. </view>
  90. <!-- :disabled="true" -->
  91. <u-button @click="submit" class="commit" type="success">提交</u-button>
  92. </u-form>
  93. <view v-if="show == true">
  94. <u-popup v-model="show" mode="center" border-radius="20" width="560rpx" height="560rpx">
  95. <view class="successImg">
  96. <image src="../../static/img/liangmai/tijiaochenggong@3x.png" mode=""
  97. style="width: 180rpx;height: 180rpx;"></image>
  98. </view>
  99. <view class="successText">提交成功,等待平台审核。</view>
  100. <u-button type="success" style="width: 400rpx; margin: 20rpx auto; " shape="circle" @click="perfect">
  101. 完善更多信息</u-button>
  102. <view style="color: #AFB3BF;text-align: center;" @click="navBack">返回</view>
  103. </u-popup>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import {
  109. mapState,
  110. mapMutations
  111. } from 'vuex';
  112. import upload from '@/components/upload.vue';
  113. export default {
  114. components: {
  115. upload
  116. },
  117. name: "buy",
  118. data() {
  119. return {
  120. action: this.$uploadUrl,
  121. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  122. btnLoading: false,
  123. isAdd: true,
  124. uploadOptions: {
  125. "text": "上传封面图片",
  126. "bgc": ""
  127. },
  128. errorType: ['message'],
  129. uploadOptions1: {
  130. "text": "上传营业执照",
  131. "bgc": ""
  132. },
  133. mainBusinessType: [],
  134. uploadCustom: true,
  135. deptList: {
  136. compName: '',
  137. title: '',
  138. companyProfile: '',
  139. province: '',
  140. city: '',
  141. area: ''
  142. },
  143. management: [{
  144. name: "粮库",
  145. checked: false
  146. },
  147. {
  148. name: "加工厂",
  149. checked: false
  150. },
  151. {
  152. name: "烘干塔",
  153. checked: false
  154. },
  155. {
  156. name: "饲料厂",
  157. checked: false
  158. },
  159. {
  160. name: "养殖场",
  161. checked: false
  162. },
  163. {
  164. name: "粮贸",
  165. checked: false
  166. },
  167. {
  168. name: "期货",
  169. checked: false
  170. },
  171. ],
  172. types: [],
  173. show: false,
  174. // anNiuCss:"types",
  175. anNiuCss: [],
  176. position: {
  177. province: ''
  178. },
  179. custombtn: true,
  180. custombtnimage: '../../static/img/liangmai/ic_shanchuan@3x.png',
  181. custombtnwidth: 50,
  182. custombtnheight: 50,
  183. license1: "../../static/img/authentication/business@3x.png",
  184. license2: "../../static/img/authentication/business@3x.png",
  185. }
  186. },
  187. onLoad(options) {
  188. if (options.position) {
  189. this.position = JSON.parse(options.position)
  190. this.position.city = this.position.city.toString()
  191. }
  192. },
  193. onShow() {
  194. var that = this
  195. try {
  196. this.position = uni.getStorageSync('position');
  197. } catch (e) {
  198. // error
  199. }
  200. uni.getStorage({
  201. key: 'setPosition',
  202. success: (res) => {
  203. console.log(res.data)
  204. that.position = res.data
  205. that.position.longitude = res.data.location.split(',')[0];
  206. that.position.latitude = res.data.location.split(',')[1];
  207. console.log(that.position.longitude)
  208. console.log(that.position.latitude)
  209. // uni.removeStorage({
  210. // key: 'setLocaltion'
  211. // })
  212. },
  213. })
  214. if (this.$store.state.enter.companyProfile) {
  215. this.deptList.companyProfile = this.$store.state.enter.companyProfile
  216. }
  217. if (this.$store.state.enter.compName) {
  218. this.deptList.compName = this.$store.state.enter.compName
  219. }
  220. if (this.$store.state.enter.title) {
  221. this.deptList.title = this.$store.state.enter.title
  222. }
  223. if (this.$store.state.enter.mainBusinessType) {
  224. this.mainBusinessType = this.$store.state.enter.mainBusinessType.split(',')
  225. if (this.mainBusinessType.length > 0) {
  226. for (var i = 0; i < this.management.length; i++) {
  227. if (this.mainBusinessType.indexOf(this.management[i].name) != -1) {
  228. this.management[i].checked = true
  229. }
  230. }
  231. }
  232. }
  233. console.log(this.$store.state.enter)
  234. },
  235. computed: {
  236. ...mapState(['hasLogin', 'userInfo'])
  237. },
  238. methods: {
  239. getImgUrl(res) {
  240. console.log(res)
  241. this.deptList.attachmentAddress = res
  242. },
  243. naviageToPage(item) {
  244. // console.log(this.enter)
  245. var data = {
  246. compName: this.deptList.compName,
  247. title: this.deptList.title,
  248. mainBusinessType: this.mainBusinessType.toString(),
  249. companyProfile: this.deptList.companyProfile,
  250. }
  251. console.log(this.$store)
  252. this.$store.commit('enterchange', data)
  253. // this.$store.dispatch('enterchange',data)
  254. // this.enterchange()
  255. var mainBusinessType = this.mainBusinessType.toString()
  256. uni.navigateTo({
  257. url: item
  258. })
  259. },
  260. getImgUrl1(res) {
  261. console.log(res)
  262. this.deptList.licenseAddress = res
  263. },
  264. singleClick(item) {
  265. if (this.mainBusinessType.indexOf(item.name) == -1) {
  266. this.mainBusinessType.push(item.name)
  267. item.checked = true
  268. } else {
  269. for (var i = 0; i < this.mainBusinessType.length; i++) {
  270. if (this.mainBusinessType[i] == item.name) {
  271. this.mainBusinessType.splice(i, 1)
  272. }
  273. }
  274. item.checked = false
  275. }
  276. },
  277. filterFileType(index, lists) {
  278. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  279. lists.splice(index, 1);
  280. // 当前文件不支持
  281. uni.showModal({
  282. title: '暂不支持当前图片类型',
  283. showCancel: false
  284. });
  285. } else {
  286. this.isAdd = false;
  287. }
  288. },
  289. navBack() {
  290. uni.setStorage({
  291. key: 'setPosition',
  292. data: {},
  293. success: (res) => {}
  294. })
  295. uni.navigateBack()
  296. },
  297. // navBack1() {
  298. // this.$api.doRequest('post', '/settledCompanyInfo/api/addSettledCompanyInfo', this.deptList).then(res => {
  299. // if (res.data.code == 200) {
  300. // var data={
  301. // compName:'',
  302. // title:'',
  303. // mainBusinessType:'',
  304. // companyProfile:'',
  305. // }
  306. // that.$store.commit('enterchange',data)
  307. // uni.switchTab({
  308. // url:'/pages/grain_pulse/home'
  309. // })
  310. // }
  311. // })
  312. // },
  313. upload() {
  314. uni.navigateTo({
  315. url: `/`
  316. })
  317. },
  318. perfect() {
  319. this.show = false
  320. uni.navigateTo({
  321. url: `/pages/grain_pulse/perfect?deptList=` + JSON.stringify(this.deptList)
  322. })
  323. },
  324. submit() {
  325. var that = this
  326. if (!this.deptList.compName) {
  327. this.$api.msg('公司名称不能为空')
  328. return
  329. }
  330. if (this.mainBusinessType.length == 0) {
  331. this.$api.msg('至少选择一个主营类型')
  332. return
  333. }
  334. if (!this.deptList.title) {
  335. this.$api.msg('标题不能为空')
  336. return
  337. }
  338. if (!this.deptList.companyProfile) {
  339. this.$api.msg('企业简介不能为空')
  340. return
  341. }
  342. if (!this.position.longitude && !this.position.latitude) {
  343. this.$api.msg('上传坐标不能为空')
  344. return
  345. }
  346. if (!this.deptList.detailedAddress) {
  347. this.$api.msg('详细地址不能为空')
  348. return
  349. }
  350. if (!this.deptList.attachmentAddress) {
  351. this.$api.msg('封面照片不能为空')
  352. return
  353. }
  354. // if (!this.deptList.licenseAddress) {
  355. // this.$api.msg('营业执照不能为空')
  356. // return
  357. // }
  358. if (this.deptList.compName.length < 2 || this.deptList.compName.length > 25) {
  359. this.$api.msg('公司名称输入错误')
  360. return
  361. }
  362. if (this.deptList.title.length < 2 || this.deptList.title.length > 16) {
  363. this.$api.msg('标题长度2-16个字')
  364. return
  365. }
  366. if (this.deptList.companyProfile.length < 10 || this.deptList.companyProfile.length > 60) {
  367. this.$api.msg('简介长度10-60个字')
  368. return
  369. }
  370. if (this.deptList.detailedAddress.length < 2 || this.deptList.detailedAddress.length > 12) {
  371. this.$api.msg('详细地址2-12个字')
  372. return
  373. }
  374. // this.show = true
  375. // return
  376. this.deptList.mainBusinessType = this.mainBusinessType.toString()
  377. this.deptList.longitude = this.position.longitude
  378. this.deptList.latitude = this.position.latitude
  379. if (this.position.province != undefined) {
  380. this.deptList.province = this.position.province
  381. this.deptList.city = this.position.city
  382. this.deptList.area = this.position.district
  383. } else if (this.position.pname != undefined) {
  384. this.deptList.province = this.position.pname
  385. this.deptList.city = this.position.cityname
  386. this.deptList.area = this.position.adname
  387. }
  388. this.deptList.createPhone = this.userInfo.phone
  389. uni.showModal({
  390. content: "确定提交企业信息?",
  391. showCancel: true,
  392. confirmText: '确定',
  393. success: function(res) {
  394. if (res.confirm) {
  395. uni.showLoading({
  396. title: "正在提交",
  397. mask: true
  398. })
  399. that.$api.doRequest('post', '/settledCompanyInfo/api/addSettledCompanyInfo', that
  400. .deptList).then(res => {
  401. //成功后
  402. console.log("提交企业信息", res)
  403. if (res.data.code == 200) {
  404. that.deptList.id = res.data.data
  405. var data = {
  406. compName: '',
  407. title: '',
  408. mainBusinessType: '',
  409. companyProfile: '',
  410. }
  411. that.$store.commit('enterchange', data)
  412. that.show = true
  413. }
  414. uni.hideLoading()
  415. })
  416. .catch(res => {
  417. console.log("系统异常", res)
  418. uni.hideLoading()
  419. uni.showToast({
  420. title: "系统异常,请联系管理员",
  421. icon: 'none',
  422. duration: 2000
  423. })
  424. })
  425. }
  426. },
  427. })
  428. }
  429. }
  430. }
  431. </script>
  432. <style lang='scss' scoped>
  433. .center {
  434. padding: 10rpx 20rpx;
  435. width: 100vw;
  436. height: 100vh;
  437. overflow: scroll;
  438. position: relative;
  439. z-index: 2;
  440. }
  441. .bg {
  442. position: absolute;
  443. width: 100%;
  444. left: 0;
  445. top: 0;
  446. }
  447. .c-row {
  448. display: -webkit-box;
  449. display: -webkit-flex;
  450. display: flex;
  451. -webkit-box-align: center;
  452. -webkit-align-items: center;
  453. align-items: center;
  454. padding: 20rpx 30rpx;
  455. position: relative;
  456. }
  457. .con-list {
  458. -webkit-box-flex: 1;
  459. -webkit-flex: 1;
  460. flex: 1;
  461. display: -webkit-box;
  462. display: -webkit-flex;
  463. display: flex;
  464. -webkit-box-orient: vertical;
  465. -webkit-box-direction: normal;
  466. -webkit-flex-direction: column;
  467. flex-direction: column;
  468. line-height: 40rpx;
  469. text-align: right;
  470. padding-right: 20rpx;
  471. font-size: 14px;
  472. }
  473. .con-list input {
  474. font-size: 14px !important;
  475. }
  476. .back-btn {
  477. position: absolute;
  478. left: 40upx;
  479. z-index: 9999;
  480. padding-top: var(--status-bar-height);
  481. top: 40upx;
  482. font-size: 40upx;
  483. color: #fff;
  484. }
  485. .title1 {
  486. position: absolute;
  487. left: 50%;
  488. transform: translateX(-50%);
  489. top: 40upx;
  490. padding-top: var(--status-bar-height);
  491. z-index: 9999;
  492. color: #fff;
  493. font-size: 36rpx;
  494. }
  495. .choice {
  496. margin-top: 10px;
  497. display: inline-block;
  498. width: 25%;
  499. }
  500. .title {
  501. color: #71747C;
  502. }
  503. .types {
  504. background-color: #F4FAF8;
  505. text-align: center;
  506. border-radius: 20px;
  507. margin-left: 5px;
  508. padding: 16rpx 20rpx;
  509. }
  510. .types1 {
  511. background-color: #22C572;
  512. text-align: center;
  513. border-radius: 20px;
  514. color: #FFFFFF;
  515. }
  516. .write {
  517. margin-right: 20px;
  518. color: #71747C;
  519. }
  520. .commit {
  521. margin-top: 20px;
  522. border: 0px;
  523. border-radius: 20px;
  524. }
  525. .modular {
  526. background-color: #FFFFFF;
  527. border-radius: 10px;
  528. margin-top: 10px;
  529. position: relative;
  530. z-index: 2;
  531. padding: 0 12.5px;
  532. }
  533. .forList {
  534. margin-top: 20px;
  535. }
  536. .titleUp {
  537. color: #FFFFFF;
  538. font-size: 44rpx;
  539. margin-top: 80px;
  540. margin-left: 10px;
  541. position: relative;
  542. z-index: 2;
  543. }
  544. .upload {
  545. text-align: center;
  546. margin: 20px 0;
  547. margin-bottom: 20px;
  548. }
  549. .popups {
  550. width: 280px;
  551. height: 290px;
  552. border-radius: 20px;
  553. }
  554. .successImg {
  555. width: 90px;
  556. height: 90px;
  557. margin: 30px auto;
  558. }
  559. .successText {
  560. text-align: center;
  561. margin: 0 auto;
  562. font-size: 16px;
  563. }
  564. .companyProfilewrap {
  565. position: relative;
  566. width: 100%;
  567. }
  568. .companyProfile {
  569. width: 100%;
  570. height: 138px;
  571. background: #F9F9FA;
  572. font-size: 13px;
  573. padding: 13px;
  574. border-radius: 5px;
  575. border: 1px solid #eeeeee;
  576. }
  577. .companyProfilecontent {
  578. position: absolute;
  579. bottom: 0px;
  580. right: 20px;
  581. font-size: 13px;
  582. }
  583. .content1-card {
  584. background: linear-gradient(202deg, #D0FAE6 0%, #FFFFFF 100%);
  585. height: 391rpx;
  586. }
  587. </style>