enter.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  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. pcUserInfo :uni.getStorageSync('pcUserInfo'),
  122. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  123. btnLoading: false,
  124. isAdd: true,
  125. uploadOptions: {
  126. "text": "上传封面图片",
  127. "bgc": ""
  128. },
  129. errorType: ['message'],
  130. uploadOptions1: {
  131. "text": "上传营业执照",
  132. "bgc": ""
  133. },
  134. mainBusinessType: [],
  135. uploadCustom: true,
  136. deptList: {
  137. compName: '',
  138. title: '',
  139. companyProfile: '',
  140. province: '',
  141. city: '',
  142. area: ''
  143. },
  144. management: [{
  145. name: "粮库",
  146. checked: false
  147. },
  148. {
  149. name: "加工厂",
  150. checked: false
  151. },
  152. {
  153. name: "烘干塔",
  154. checked: false
  155. },
  156. {
  157. name: "饲料厂",
  158. checked: false
  159. },
  160. {
  161. name: "养殖场",
  162. checked: false
  163. },
  164. {
  165. name: "粮贸",
  166. checked: false
  167. },
  168. {
  169. name: "期货",
  170. checked: false
  171. },
  172. ],
  173. types: [],
  174. show: false,
  175. // anNiuCss:"types",
  176. anNiuCss: [],
  177. position: {
  178. province: ''
  179. },
  180. custombtn: true,
  181. custombtnimage: '../../static/img/liangmai/ic_shanchuan@3x.png',
  182. custombtnwidth: 50,
  183. custombtnheight: 50,
  184. license1: "../../static/img/authentication/business@3x.png",
  185. license2: "../../static/img/authentication/business@3x.png",
  186. }
  187. },
  188. onLoad(options) {
  189. if (options.position) {
  190. this.position = JSON.parse(options.position)
  191. this.position.city = this.position.city.toString()
  192. }
  193. },
  194. onShow() {
  195. var that = this
  196. try {
  197. this.position = uni.getStorageSync('position');
  198. } catch (e) {
  199. // error
  200. }
  201. uni.getStorage({
  202. key: 'setPosition',
  203. success: (res) => {
  204. console.log(res.data)
  205. that.position = res.data
  206. that.position.longitude = res.data.location.split(',')[0];
  207. that.position.latitude = res.data.location.split(',')[1];
  208. console.log(that.position.longitude)
  209. console.log(that.position.latitude)
  210. // uni.removeStorage({
  211. // key: 'setLocaltion'
  212. // })
  213. },
  214. })
  215. if (this.$store.state.enter.companyProfile) {
  216. this.deptList.companyProfile = this.$store.state.enter.companyProfile
  217. }
  218. if (this.$store.state.enter.compName) {
  219. this.deptList.compName = this.$store.state.enter.compName
  220. }
  221. if (this.$store.state.enter.title) {
  222. this.deptList.title = this.$store.state.enter.title
  223. }
  224. if (this.$store.state.enter.mainBusinessType) {
  225. this.mainBusinessType = this.$store.state.enter.mainBusinessType.split(',')
  226. if (this.mainBusinessType.length > 0) {
  227. for (var i = 0; i < this.management.length; i++) {
  228. if (this.mainBusinessType.indexOf(this.management[i].name) != -1) {
  229. this.management[i].checked = true
  230. }
  231. }
  232. }
  233. }
  234. console.log(this.$store.state.enter)
  235. },
  236. computed: {
  237. ...mapState(['hasLogin', 'userInfo'])
  238. },
  239. methods: {
  240. getImgUrl(res) {
  241. console.log(res)
  242. this.deptList.attachmentAddress = res.data.appendixPath
  243. },
  244. naviageToPage(item) {
  245. // console.log(this.enter)
  246. var data = {
  247. compName: this.deptList.compName,
  248. title: this.deptList.title,
  249. mainBusinessType: this.mainBusinessType.toString(),
  250. companyProfile: this.deptList.companyProfile,
  251. }
  252. console.log(this.$store)
  253. this.$store.commit('enterchange', data)
  254. // this.$store.dispatch('enterchange',data)
  255. // this.enterchange()
  256. var mainBusinessType = this.mainBusinessType.toString()
  257. uni.navigateTo({
  258. url: item
  259. })
  260. },
  261. getImgUrl1(res) {
  262. console.log(res)
  263. this.deptList.licenseAddress = res
  264. },
  265. singleClick(item) {
  266. if (this.mainBusinessType.indexOf(item.name) == -1) {
  267. this.mainBusinessType.push(item.name)
  268. item.checked = true
  269. } else {
  270. for (var i = 0; i < this.mainBusinessType.length; i++) {
  271. if (this.mainBusinessType[i] == item.name) {
  272. this.mainBusinessType.splice(i, 1)
  273. }
  274. }
  275. item.checked = false
  276. }
  277. },
  278. filterFileType(index, lists) {
  279. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  280. lists.splice(index, 1);
  281. // 当前文件不支持
  282. uni.showModal({
  283. title: '暂不支持当前图片类型',
  284. showCancel: false
  285. });
  286. } else {
  287. this.isAdd = false;
  288. }
  289. },
  290. navBack() {
  291. uni.setStorage({
  292. key: 'setPosition',
  293. data: {},
  294. success: (res) => {}
  295. })
  296. uni.navigateBack()
  297. },
  298. // navBack1() {
  299. // this.$api.doRequest('post', '/settledCompanyInfo/api/addSettledCompanyInfo', this.deptList).then(res => {
  300. // if (res.data.code == 200) {
  301. // var data={
  302. // compName:'',
  303. // title:'',
  304. // mainBusinessType:'',
  305. // companyProfile:'',
  306. // }
  307. // that.$store.commit('enterchange',data)
  308. // uni.switchTab({
  309. // url:'/pages/grain_pulse/home'
  310. // })
  311. // }
  312. // })
  313. // },
  314. upload() {
  315. uni.navigateTo({
  316. url: `/`
  317. })
  318. },
  319. perfect() {
  320. this.show = false
  321. uni.navigateTo({
  322. url: `/pages/grain_pulse/perfect?deptList=` + JSON.stringify(this.deptList)
  323. })
  324. },
  325. submit() {
  326. var that = this
  327. if (!this.deptList.compName) {
  328. this.$api.msg('公司名称不能为空')
  329. return
  330. }
  331. if (this.mainBusinessType.length == 0) {
  332. this.$api.msg('至少选择一个主营类型')
  333. return
  334. }
  335. if (!this.deptList.title) {
  336. this.$api.msg('标题不能为空')
  337. return
  338. }
  339. if (!this.deptList.companyProfile) {
  340. this.$api.msg('企业简介不能为空')
  341. return
  342. }
  343. if (!this.position.longitude && !this.position.latitude) {
  344. this.$api.msg('上传坐标不能为空')
  345. return
  346. }
  347. if (!this.deptList.detailedAddress) {
  348. this.$api.msg('详细地址不能为空')
  349. return
  350. }
  351. if (!this.deptList.attachmentAddress) {
  352. this.$api.msg('封面照片不能为空')
  353. return
  354. }
  355. // if (!this.deptList.licenseAddress) {
  356. // this.$api.msg('营业执照不能为空')
  357. // return
  358. // }
  359. if (this.deptList.compName.length < 2 || this.deptList.compName.length > 25) {
  360. this.$api.msg('公司名称输入错误')
  361. return
  362. }
  363. if (this.deptList.title.length < 2 || this.deptList.title.length > 16) {
  364. this.$api.msg('标题长度2-16个字')
  365. return
  366. }
  367. if (this.deptList.companyProfile.length < 10 || this.deptList.companyProfile.length > 60) {
  368. this.$api.msg('简介长度10-60个字')
  369. return
  370. }
  371. if (this.deptList.detailedAddress.length < 2 || this.deptList.detailedAddress.length > 12) {
  372. this.$api.msg('详细地址2-12个字')
  373. return
  374. }
  375. // this.show = true
  376. // return
  377. this.deptList.mainBusinessType = this.mainBusinessType.toString()
  378. this.deptList.longitude = this.position.longitude
  379. this.deptList.latitude = this.position.latitude
  380. if (this.position.province != undefined) {
  381. this.deptList.province = this.position.province
  382. this.deptList.city = this.position.city
  383. this.deptList.area = this.position.district
  384. } else if (this.position.pname != undefined) {
  385. this.deptList.province = this.position.pname
  386. this.deptList.city = this.position.cityname
  387. this.deptList.area = this.position.adname
  388. }
  389. this.deptList.createPhone = this.userInfo.phone
  390. uni.showModal({
  391. content: "确定提交企业信息?",
  392. showCancel: true,
  393. confirmText: '确定',
  394. success: function(res) {
  395. if (res.confirm) {
  396. uni.showLoading({
  397. title: "正在提交",
  398. mask: true
  399. })
  400. that.$api.doRequest('post', '/settledCompanyInfo/api/addSettledCompanyInfo', that
  401. .deptList).then(res => {
  402. //成功后
  403. console.log("提交企业信息", res)
  404. if (res.data.code == 200) {
  405. that.deptList.id = res.data.data
  406. var data = {
  407. compName: '',
  408. title: '',
  409. mainBusinessType: '',
  410. companyProfile: '',
  411. }
  412. that.$store.commit('enterchange', data)
  413. that.show = true
  414. }
  415. uni.hideLoading()
  416. })
  417. .catch(res => {
  418. console.log("系统异常", res)
  419. uni.hideLoading()
  420. uni.showToast({
  421. title: "系统异常,请联系管理员",
  422. icon: 'none',
  423. duration: 2000
  424. })
  425. })
  426. }
  427. },
  428. })
  429. }
  430. }
  431. }
  432. </script>
  433. <style lang='scss' scoped>
  434. .center {
  435. padding: 10rpx 20rpx;
  436. width: 100vw;
  437. height: 100vh;
  438. overflow: scroll;
  439. position: relative;
  440. z-index: 2;
  441. }
  442. .bg {
  443. position: absolute;
  444. width: 100%;
  445. left: 0;
  446. top: 0;
  447. }
  448. .c-row {
  449. display: -webkit-box;
  450. display: -webkit-flex;
  451. display: flex;
  452. -webkit-box-align: center;
  453. -webkit-align-items: center;
  454. align-items: center;
  455. padding: 20rpx 30rpx;
  456. position: relative;
  457. }
  458. .con-list {
  459. -webkit-box-flex: 1;
  460. -webkit-flex: 1;
  461. flex: 1;
  462. display: -webkit-box;
  463. display: -webkit-flex;
  464. display: flex;
  465. -webkit-box-orient: vertical;
  466. -webkit-box-direction: normal;
  467. -webkit-flex-direction: column;
  468. flex-direction: column;
  469. line-height: 40rpx;
  470. text-align: right;
  471. padding-right: 20rpx;
  472. font-size: 14px;
  473. }
  474. .con-list input {
  475. font-size: 14px !important;
  476. }
  477. .back-btn {
  478. position: absolute;
  479. left: 40upx;
  480. z-index: 9999;
  481. padding-top: var(--status-bar-height);
  482. top: 40upx;
  483. font-size: 40upx;
  484. color: #fff;
  485. }
  486. .title1 {
  487. position: absolute;
  488. left: 50%;
  489. transform: translateX(-50%);
  490. top: 40upx;
  491. padding-top: var(--status-bar-height);
  492. z-index: 9999;
  493. color: #fff;
  494. font-size: 36rpx;
  495. }
  496. .choice {
  497. margin-top: 10px;
  498. display: inline-block;
  499. width: 25%;
  500. }
  501. .title {
  502. color: #71747C;
  503. }
  504. .types {
  505. background-color: #F4FAF8;
  506. text-align: center;
  507. border-radius: 20px;
  508. margin-left: 5px;
  509. padding: 16rpx 20rpx;
  510. }
  511. .types1 {
  512. background-color: #22C572;
  513. text-align: center;
  514. border-radius: 20px;
  515. color: #FFFFFF;
  516. }
  517. .write {
  518. margin-right: 20px;
  519. color: #71747C;
  520. }
  521. .commit {
  522. margin-top: 20px;
  523. border: 0px;
  524. border-radius: 20px;
  525. }
  526. .modular {
  527. background-color: #FFFFFF;
  528. border-radius: 10px;
  529. margin-top: 10px;
  530. position: relative;
  531. z-index: 2;
  532. padding: 0 12.5px;
  533. }
  534. .forList {
  535. margin-top: 20px;
  536. }
  537. .titleUp {
  538. color: #FFFFFF;
  539. font-size: 44rpx;
  540. margin-top: 80px;
  541. margin-left: 10px;
  542. position: relative;
  543. z-index: 2;
  544. }
  545. .upload {
  546. text-align: center;
  547. margin: 20px 0;
  548. margin-bottom: 20px;
  549. }
  550. .popups {
  551. width: 280px;
  552. height: 290px;
  553. border-radius: 20px;
  554. }
  555. .successImg {
  556. width: 90px;
  557. height: 90px;
  558. margin: 30px auto;
  559. }
  560. .successText {
  561. text-align: center;
  562. margin: 0 auto;
  563. font-size: 16px;
  564. }
  565. .companyProfilewrap {
  566. position: relative;
  567. width: 100%;
  568. }
  569. .companyProfile {
  570. width: 100%;
  571. height: 138px;
  572. background: #F9F9FA;
  573. font-size: 13px;
  574. padding: 13px;
  575. border-radius: 5px;
  576. border: 1px solid #eeeeee;
  577. }
  578. .companyProfilecontent {
  579. position: absolute;
  580. bottom: 0px;
  581. right: 20px;
  582. font-size: 13px;
  583. }
  584. .content1-card {
  585. background: linear-gradient(202deg, #D0FAE6 0%, #FFFFFF 100%);
  586. height: 391rpx;
  587. }
  588. </style>