enter.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  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">
  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"
  37. maxlength="60"
  38. placeholder="请输入企业简介,如经营项目、产品类型、企业规模等,10-60个字"
  39. v-model="deptList.companyProfile" name="" id="" cols="10" rows="3">
  40. </textarea>
  41. <view class='companyProfilecontent'>{{deptList.companyProfile.length}}/60个字</view>
  42. </view>
  43. </u-form-item>
  44. </view>
  45. <view class="modular">
  46. <u-form-item label="上传坐标" label-width="30%" class="title Regular">
  47. <text @click='naviageToPage("/pages/grain_pulse/localtion/coordinate")'
  48. class="con-list Regular">{{position.longitude == undefined ? "未上传":'已上传'}}<text
  49. class='tip_text cuIcon-right'></text></text>
  50. </u-form-item>
  51. <u-form-item label="所在区域" label-width="30%" class="title Regular">
  52. <view style='text-align:right;width:100%;padding-right:10px;' v-if='position.province!=undefined'>
  53. {{position.province}}
  54. {{position.city}}
  55. {{position.district}}
  56. </view>
  57. <view style='text-align:right;width:100%;padding-right:10px;' v-if='position.pname!=undefined'>
  58. {{position.pname}}
  59. {{position.cityname}}
  60. {{position.adname}}
  61. </view>
  62. <view style='text-align:right;width:100%;padding-right:10px;' 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"
  75. @on-uploaded="isAdd = true" :before-upload="filterFileType"
  76. :options="uploadOptions" customBorder='2px dashed #D8DEF7' customBtnFontSize="14" customBtnColor="#6A7282" :customBtnHeight='custombtnheight'
  77. :customBtnWidth='custombtnwidth' customBack='#F9FAFE' :customBtnImage="custombtnimage" :customBtn='custombtn'
  78. :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"
  83. @on-uploaded="isAdd = true" :before-upload="filterFileType"
  84. :options="uploadOptions1" customBack='#FEF9FA' customBorder='2px dashed #F9D5DC' customBtnFontSize="14" customBtnColor="#6A7282" :customBtnHeight='custombtnheight'
  85. :customBtnWidth='custombtnwidth' :customBtnImage="custombtnimage" :customBtn='custombtn'
  86. :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. uni.getStorage({
  196. key: 'setPosition',
  197. success: (res) => {
  198. console.log(res.data)
  199. that.position = res.data
  200. that.position.longitude = res.data.location.split(',')[0];
  201. that.position.latitude = res.data.location.split(',')[1];
  202. console.log(that.position.longitude)
  203. console.log(that.position.latitude)
  204. // uni.removeStorage({
  205. // key: 'setLocaltion'
  206. // })
  207. },
  208. })
  209. if(this.$store.state.enter.companyProfile){
  210. this.deptList.companyProfile=this.$store.state.enter.companyProfile
  211. }
  212. if(this.$store.state.enter.compName){
  213. this.deptList.compName=this.$store.state.enter.compName
  214. }
  215. if(this.$store.state.enter.title){
  216. this.deptList.title=this.$store.state.enter.title
  217. }
  218. if(this.$store.state.enter.mainBusinessType){
  219. this.mainBusinessType=this.$store.state.enter.mainBusinessType.split(',')
  220. if(this.mainBusinessType.length>0){
  221. for(var i=0;i<this.management.length;i++){
  222. if(this.mainBusinessType.indexOf(this.management[i].name)!=-1){
  223. this.management[i].checked=true
  224. }
  225. }
  226. }
  227. }
  228. console.log(this.$store.state.enter)
  229. },
  230. computed: {
  231. ...mapState(['hasLogin', 'userInfo'])
  232. },
  233. methods: {
  234. getImgUrl(res) {
  235. console.log(res)
  236. this.deptList.attachmentAddress = res
  237. },
  238. naviageToPage(item) {
  239. // console.log(this.enter)
  240. var data={
  241. compName:this.deptList.compName,
  242. title:this.deptList.title,
  243. mainBusinessType:this.mainBusinessType.toString(),
  244. companyProfile:this.deptList.companyProfile,
  245. }
  246. console.log(this.$store)
  247. this.$store.commit('enterchange',data)
  248. // this.$store.dispatch('enterchange',data)
  249. // this.enterchange()
  250. var mainBusinessType=this.mainBusinessType.toString()
  251. uni.navigateTo({
  252. url: item
  253. })
  254. },
  255. getImgUrl1(res) {
  256. console.log(res)
  257. this.deptList.licenseAddress = res
  258. },
  259. singleClick(item) {
  260. if (this.mainBusinessType.indexOf(item) == -1) {
  261. this.mainBusinessType.push(item.name)
  262. item.checked = true
  263. }
  264. },
  265. filterFileType(index, lists) {
  266. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  267. lists.splice(index, 1);
  268. // 当前文件不支持
  269. uni.showModal({
  270. title: '暂不支持当前图片类型',
  271. showCancel: false
  272. });
  273. } else {
  274. this.isAdd = false;
  275. }
  276. },
  277. navBack() {
  278. uni.navigateBack()
  279. },
  280. // navBack1() {
  281. // this.$api.doRequest('post', '/settledCompanyInfo/api/addSettledCompanyInfo', this.deptList).then(res => {
  282. // if (res.data.code == 200) {
  283. // var data={
  284. // compName:'',
  285. // title:'',
  286. // mainBusinessType:'',
  287. // companyProfile:'',
  288. // }
  289. // that.$store.commit('enterchange',data)
  290. // uni.switchTab({
  291. // url:'/pages/grain_pulse/home'
  292. // })
  293. // }
  294. // })
  295. // },
  296. upload() {
  297. uni.navigateTo({
  298. url: `/`
  299. })
  300. },
  301. perfect() {
  302. this.show=false
  303. uni.navigateTo({
  304. url: `/pages/grain_pulse/perfect?deptList=`+JSON.stringify(this.deptList)
  305. })
  306. },
  307. submit() {
  308. var that = this
  309. if (!this.deptList.compName) {
  310. this.$api.msg('公司名称不能为空')
  311. return
  312. }
  313. if (this.mainBusinessType.length==0) {
  314. this.$api.msg('至少选择一个主营类型')
  315. return
  316. }
  317. if (!this.deptList.title) {
  318. this.$api.msg('标题不能为空')
  319. return
  320. }
  321. if (!this.deptList.companyProfile) {
  322. this.$api.msg('企业简介不能为空')
  323. return
  324. }
  325. if (!this.position.longitude&&!this.position.latitude) {
  326. this.$api.msg('上传坐标不能为空')
  327. return
  328. }
  329. if (!this.deptList.detailedAddress) {
  330. this.$api.msg('详细地址不能为空')
  331. return
  332. }
  333. if (!this.deptList.attachmentAddress) {
  334. this.$api.msg('封面照片不能为空')
  335. return
  336. }
  337. if (!this.deptList.licenseAddress) {
  338. this.$api.msg('营业执照不能为空')
  339. return
  340. }
  341. if (this.deptList.compName.length<2||this.deptList.compName.length>25) {
  342. this.$api.msg('公司名称输入错误')
  343. return
  344. }
  345. if (this.deptList.title.length<2||this.deptList.title.length>16) {
  346. this.$api.msg('标题长度2-16个字')
  347. return
  348. }
  349. if (this.deptList.companyProfile.length<10||this.deptList.companyProfile.length>60) {
  350. this.$api.msg('简介长度10-60个字')
  351. return
  352. }
  353. if (this.deptList.detailedAddress.length<2||this.deptList.detailedAddress.length>12) {
  354. this.$api.msg('详细地址2-12个字')
  355. return
  356. }
  357. // this.show = true
  358. // return
  359. this.deptList.mainBusinessType=this.mainBusinessType.toString()
  360. this.deptList.longitude=this.position.longitude
  361. this.deptList.latitude=this.position.latitude
  362. if(this.position.province!=undefined){
  363. this.deptList.province=this.position.province
  364. this.deptList.city=this.position.city
  365. this.deptList.area=this.position.district
  366. }else if(this.position.pname!=undefined){
  367. this.deptList.province=this.position.pname
  368. this.deptList.city=this.position.cityname
  369. this.deptList.area=this.position.adname
  370. }
  371. this.deptList.createPhone=this.userInfo.phone
  372. uni.showModal({
  373. content: "确定提交企业信息?",
  374. showCancel: true,
  375. confirmText: '确定',
  376. success: function(res) {
  377. if (res.confirm) {
  378. uni.showLoading({
  379. title:"正在提交",
  380. mask:true
  381. })
  382. that.$api.doRequest('post','/settledCompanyInfo/api/addSettledCompanyInfo',that.deptList).then(res => {
  383. //成功后
  384. console.log("提交企业信息",res)
  385. if (res.data.code == 200) {
  386. var data={
  387. compName:'',
  388. title:'',
  389. mainBusinessType:'',
  390. companyProfile:'',
  391. }
  392. that.$store.commit('enterchange',data)
  393. that.show = true
  394. }
  395. uni.hideLoading()
  396. })
  397. .catch(res => {
  398. console.log("系统异常",res)
  399. uni.hideLoading()
  400. uni.showToast({
  401. title: "系统异常,请联系管理员",
  402. icon: 'none',
  403. duration: 2000
  404. })
  405. })
  406. }
  407. },
  408. })
  409. }
  410. }
  411. }
  412. </script>
  413. <style lang='scss' scoped>
  414. .center {
  415. padding: 10rpx 20rpx;
  416. width: 100vw;
  417. height: 100vh;
  418. overflow: scroll;
  419. position:relative;z-index:2;
  420. }
  421. .bg{
  422. position:absolute;
  423. width:100%;
  424. left: 0;
  425. top:0;
  426. }
  427. .c-row {
  428. display: -webkit-box;
  429. display: -webkit-flex;
  430. display: flex;
  431. -webkit-box-align: center;
  432. -webkit-align-items: center;
  433. align-items: center;
  434. padding: 20rpx 30rpx;
  435. position: relative;
  436. }
  437. .con-list {
  438. -webkit-box-flex: 1;
  439. -webkit-flex: 1;
  440. flex: 1;
  441. display: -webkit-box;
  442. display: -webkit-flex;
  443. display: flex;
  444. -webkit-box-orient: vertical;
  445. -webkit-box-direction: normal;
  446. -webkit-flex-direction: column;
  447. flex-direction: column;
  448. line-height: 40rpx;
  449. text-align: right;
  450. padding-right: 20rpx;
  451. font-size: 14px;
  452. }
  453. .con-list input {
  454. font-size: 14px !important;
  455. }
  456. .back-btn {
  457. position: absolute;
  458. left: 40upx;
  459. z-index: 9999;
  460. padding-top: var(--status-bar-height);
  461. top: 40upx;
  462. font-size: 40upx;
  463. color: #fff;
  464. }
  465. .title1 {
  466. position: absolute;
  467. left: 50%;
  468. transform: translateX(-50%);
  469. top: 40upx;
  470. padding-top: var(--status-bar-height);
  471. z-index: 9999;
  472. color: #fff;
  473. font-size: 36rpx;
  474. }
  475. .choice {
  476. margin-top: 10px;
  477. display: inline-block;
  478. }
  479. .title {
  480. color: #71747C;
  481. }
  482. .types {
  483. background-color: #F4FAF8;
  484. text-align: center;
  485. border-radius: 20px;
  486. margin-left: 5px;
  487. padding:8px 19px;
  488. }
  489. .types1 {
  490. background-color: #22C572;
  491. text-align: center;
  492. border-radius: 20px;
  493. color: #FFFFFF;
  494. }
  495. .write {
  496. margin-right: 20px;
  497. color: #71747C;
  498. }
  499. .commit {
  500. margin-top: 20px;
  501. border: 0px;
  502. border-radius: 20px;
  503. }
  504. .modular {
  505. background-color: #FFFFFF;
  506. border-radius: 10px;
  507. margin-top: 10px;
  508. position:relative;z-index:2;
  509. padding:0 12.5px;
  510. }
  511. .forList {
  512. margin-top: 20px;
  513. }
  514. .titleUp {
  515. color: #FFFFFF;
  516. font-size: 44rpx;
  517. margin-top: 80px;
  518. margin-left: 10px;
  519. position: relative;
  520. z-index:2;
  521. }
  522. .upload {
  523. text-align: center;
  524. margin: 20px 0;
  525. margin-bottom: 20px;
  526. }
  527. .popups {
  528. width: 280px;
  529. height: 290px;
  530. border-radius: 20px;
  531. }
  532. .successImg {
  533. width: 90px;
  534. height: 90px;
  535. margin: 30px auto;
  536. }
  537. .successText {
  538. text-align: center;
  539. margin: 0 auto;
  540. font-size: 16px;
  541. }
  542. .companyProfilewrap{
  543. position:relative;
  544. width:100%;
  545. }
  546. .companyProfile{
  547. width:90%;height:138px;
  548. background:#F9F9FA;
  549. font-size:13px;
  550. padding:13px;
  551. border-radius:5px;
  552. }
  553. .companyProfilecontent{
  554. position:absolute;
  555. bottom:10px;
  556. right:15px;
  557. font-size:13px;
  558. }
  559. </style>