enter.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  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">{{deptList.buyer == null ? "未上传":deptList.buyer}}<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. <u-input v-model="deptList.name" input-align="right" class="write Regular" disabled
  53. placeholder="自动获取" />
  54. </u-form-item>
  55. <u-form-item label="详细地址" label-width="30%" class="title Regular">
  56. <u-input v-model="deptList.detailedAddress" input-align="right" class="write Regular"
  57. placeholder="如街道和门牌号,2-12个字" maxlength="12" />
  58. </u-form-item>
  59. <view>
  60. <view class="title Regular" style="margin-top: 15rpx;">上传图片</view>
  61. <view v-if="license1 != ''">
  62. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  63. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError"
  64. @on-remove="onRemove" @on-uploaded="isAdd = true" :before-upload="filterFileType"
  65. :options="uploadOptions" customBorder='2px dashed #D8DEF7' customBtnFontSize="14" customBtnColor="#6A7282" :customBtnHeight='custombtnheight'
  66. :customBtnWidth='custombtnwidth' customBack='#F9FAFE' :customBtnImage="custombtnimage" :customBtn='custombtn'
  67. :custom="uploadCustom" @on-progress="onProgress"></upload>
  68. </view>
  69. <view v-if="license2 != ''">
  70. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  71. :size-type="['compressed']" @on-success="getImgUrl1" @on-error="onError"
  72. @on-remove="onRemove" @on-uploaded="isAdd = true" :before-upload="filterFileType"
  73. :options="uploadOptions1" customBack='#FEF9FA' customBorder='2px dashed #F9D5DC' customBtnFontSize="14" customBtnColor="#6A7282" :customBtnHeight='custombtnheight'
  74. :customBtnWidth='custombtnwidth' :customBtnImage="custombtnimage" :customBtn='custombtn'
  75. :custom="uploadCustom" @on-progress="onProgress"></upload>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- :disabled="true" -->
  80. <u-button @click="submit" class="commit" type="success">提交</u-button>
  81. </u-form>
  82. <view v-if="show == true">
  83. <u-popup v-model="show" mode="center" border-radius="20" width="560rpx" height="560rpx">
  84. <view class="successImg">
  85. <image src="../../static/img/liangmai/tijiaochenggong@3x.png" mode=""
  86. style="width: 180rpx;height: 180rpx;"></image>
  87. </view>
  88. <view class="successText">提交成功,等待平台审核。</view>
  89. <u-button type="success" style="width: 400rpx; margin: 20rpx auto; " shape="circle" @click="perfect">
  90. 完善更多信息</u-button>
  91. <view style="color: #AFB3BF;text-align: center;" @click="navBack1">返回</view>
  92. </u-popup>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import {
  98. mapState
  99. } from 'vuex';
  100. import upload from '@/components/upload.vue';
  101. export default {
  102. components: {
  103. upload
  104. },
  105. name: "buy",
  106. data() {
  107. return {
  108. action: this.$uploadUrl,
  109. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  110. btnLoading: false,
  111. isAdd: true,
  112. uploadOptions: {
  113. "text": "上传封面图片",
  114. "bgc": ""
  115. },
  116. errorType: ['message'],
  117. uploadOptions1: {
  118. "text": "上传营业执照",
  119. "bgc": ""
  120. },
  121. mainBusinessType: [],
  122. uploadCustom: true,
  123. deptList: {
  124. companyProfile:''
  125. },
  126. management: [{
  127. name: "粮库",
  128. checked: false
  129. },
  130. {
  131. name: "加工厂",
  132. checked: false
  133. },
  134. {
  135. name: "烘干塔",
  136. checked: false
  137. },
  138. {
  139. name: "饲料厂",
  140. checked: false
  141. },
  142. {
  143. name: "养殖场",
  144. checked: false
  145. },
  146. {
  147. name: "粮贸",
  148. checked: false
  149. },
  150. {
  151. name: "期货",
  152. checked: false
  153. },
  154. ],
  155. types: [],
  156. show: false,
  157. // anNiuCss:"types",
  158. anNiuCss: [],
  159. position:{},
  160. custombtn:true,
  161. custombtnimage:'../../static/img/liangmai/ic_shanchuan@3x.png',
  162. custombtnwidth:50,
  163. custombtnheight:50,
  164. license1: "../../static/img/authentication/business@3x.png",
  165. license2: "../../static/img/authentication/business@3x.png",
  166. }
  167. },
  168. onLoad(options) {
  169. console.log(options)
  170. this.position=JSON.parse(options.position)
  171. console.log(this.position)
  172. },
  173. computed: {
  174. ...mapState(['hasLogin', 'userInfo'])
  175. },
  176. methods: {
  177. getImgUrl(res) {
  178. console.log(res)
  179. this.deptList.attachmentAddress = res
  180. },
  181. naviageToPage(item) {
  182. uni.navigateTo({
  183. url: item
  184. })
  185. },
  186. getImgUrl1(res) {
  187. console.log(res)
  188. this.deptList.licenseAddress = res
  189. },
  190. singleClick(item) {
  191. if (this.mainBusinessType.indexOf(item) == -1) {
  192. this.mainBusinessType.push(item.name)
  193. item.checked = true
  194. }
  195. },
  196. filterFileType(index, lists) {
  197. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  198. lists.splice(index, 1);
  199. // 当前文件不支持
  200. uni.showModal({
  201. title: '暂不支持当前图片类型',
  202. showCancel: false
  203. });
  204. } else {
  205. this.isAdd = false;
  206. }
  207. },
  208. navBack() {
  209. uni.navigateBack()
  210. },
  211. navBack1() {
  212. this.$api.doRequest('post', '/settledCompanyInfo/api/addSettledCompanyInfo', this.deptList).then(res => {
  213. if (res.data.code == 200) {
  214. uni.navigateBack(1)
  215. }
  216. })
  217. },
  218. upload() {
  219. uni.navigateTo({
  220. url: `/`
  221. })
  222. },
  223. perfect() {
  224. this.show=false
  225. uni.navigateTo({
  226. url: `/pages/grain_pulse/perfect?deptList=`+JSON.stringify(this.deptList)
  227. })
  228. },
  229. submit() {
  230. var that = this
  231. if (!this.deptList.compName) {
  232. this.$api.msg('公司名称不能为空')
  233. return
  234. }
  235. if (this.mainBusinessType.length==0) {
  236. this.$api.msg('至少选择一个主营类型')
  237. return
  238. }
  239. if (!this.deptList.title) {
  240. this.$api.msg('标题不能为空')
  241. return
  242. }
  243. if (!this.deptList.companyProfile) {
  244. this.$api.msg('企业简介不能为空')
  245. return
  246. }
  247. if (!this.deptList.longitude&&!this.deptList.longitude) {
  248. this.$api.msg('上传坐标不能为空')
  249. return
  250. }
  251. if (!this.deptList.detailedAddress) {
  252. this.$api.msg('详细地址不能为空')
  253. return
  254. }
  255. if (!this.deptList.attachmentAddress) {
  256. this.$api.msg('封面照片不能为空')
  257. return
  258. }
  259. if (!this.deptList.licenseAddress) {
  260. this.$api.msg('营业执照不能为空')
  261. return
  262. }
  263. if (this.deptList.compName.length<2||this.deptList.compName.length>25) {
  264. this.$api.msg('公司名称输入错误')
  265. return
  266. }
  267. if (this.deptList.title.length<2||this.deptList.title.length>16) {
  268. this.$api.msg('标题长度2-16个字')
  269. return
  270. }
  271. if (this.deptList.companyProfile.length<10||this.deptList.companyProfile.length>60) {
  272. this.$api.msg('简介长度10-60个字')
  273. return
  274. }
  275. if (this.deptList.detailedAddress.length<2||this.deptList.detailedAddress.length>12) {
  276. this.$api.msg('详细地址2-12个字')
  277. return
  278. }
  279. // this.show = true
  280. // return
  281. this.deptList.mainBusinessType=this.mainBusinessType.toString()
  282. this.deptList.longitude='40.22077'
  283. this.deptList.latitude='116.23128'
  284. this.deptList.createPhone=this.userInfo.phone
  285. uni.showModal({
  286. content: "确定提交企业信息??",
  287. showCancel: true,
  288. confirmText: '确定',
  289. success: function(res) {
  290. if (res.confirm) {
  291. that.show = true
  292. // that.$api.doRequest('post','/settledCompanyInfo/api/addSettledCompanyInfo',that.deptList).then(res => {
  293. // if(res.data.code==200){
  294. // }
  295. // })
  296. // //成功后
  297. // if (res.data.code == 200) {
  298. // uni.showToast({
  299. // title: '提交成功',
  300. // icon: 'none',
  301. // duration: 2000
  302. // })
  303. // }
  304. }
  305. },
  306. })
  307. }
  308. }
  309. }
  310. </script>
  311. <style lang='scss' scoped>
  312. .center {
  313. padding: 10rpx 20rpx;
  314. width: 100vw;
  315. height: 100vh;
  316. overflow: scroll;
  317. position:relative;z-index:2;
  318. }
  319. .bg{
  320. position:absolute;
  321. width:100%;
  322. left: 0;
  323. top:0;
  324. }
  325. .c-row {
  326. display: -webkit-box;
  327. display: -webkit-flex;
  328. display: flex;
  329. -webkit-box-align: center;
  330. -webkit-align-items: center;
  331. align-items: center;
  332. padding: 20rpx 30rpx;
  333. position: relative;
  334. }
  335. .con-list {
  336. -webkit-box-flex: 1;
  337. -webkit-flex: 1;
  338. flex: 1;
  339. display: -webkit-box;
  340. display: -webkit-flex;
  341. display: flex;
  342. -webkit-box-orient: vertical;
  343. -webkit-box-direction: normal;
  344. -webkit-flex-direction: column;
  345. flex-direction: column;
  346. line-height: 40rpx;
  347. text-align: right;
  348. padding-right: 20rpx;
  349. font-size: 14px;
  350. }
  351. .con-list input {
  352. font-size: 14px !important;
  353. }
  354. .back-btn {
  355. position: absolute;
  356. left: 40upx;
  357. z-index: 9999;
  358. padding-top: var(--status-bar-height);
  359. top: 40upx;
  360. font-size: 40upx;
  361. color: #fff;
  362. }
  363. .title1 {
  364. position: absolute;
  365. left: 50%;
  366. transform: translateX(-50%);
  367. top: 40upx;
  368. padding-top: var(--status-bar-height);
  369. z-index: 9999;
  370. color: #fff;
  371. font-size: 36rpx;
  372. }
  373. .choice {
  374. margin-top: 10px;
  375. display: inline-block;
  376. }
  377. .title {
  378. color: #71747C;
  379. }
  380. .types {
  381. background-color: #F4FAF8;
  382. text-align: center;
  383. border-radius: 20px;
  384. margin-left: 5px;
  385. padding:8px 19px;
  386. }
  387. .types1 {
  388. background-color: #22C572;
  389. text-align: center;
  390. border-radius: 20px;
  391. color: #FFFFFF;
  392. }
  393. .write {
  394. margin-right: 20px;
  395. color: #71747C;
  396. }
  397. .commit {
  398. margin-top: 20px;
  399. border: 0px;
  400. border-radius: 20px;
  401. }
  402. .modular {
  403. background-color: #FFFFFF;
  404. border-radius: 10px;
  405. margin-top: 10px;
  406. position:relative;z-index:2;
  407. padding:0 12.5px;
  408. }
  409. .forList {
  410. margin-top: 20px;
  411. }
  412. .titleUp {
  413. color: #FFFFFF;
  414. font-size: 44rpx;
  415. margin-top: 80px;
  416. margin-left: 10px;
  417. position: relative;
  418. z-index:2;
  419. }
  420. .upload {
  421. text-align: center;
  422. margin: 20px 0;
  423. margin-bottom: 20px;
  424. }
  425. .popups {
  426. width: 280px;
  427. height: 290px;
  428. border-radius: 20px;
  429. }
  430. .successImg {
  431. width: 90px;
  432. height: 90px;
  433. margin: 30px auto;
  434. }
  435. .successText {
  436. text-align: center;
  437. margin: 0 auto;
  438. font-size: 16px;
  439. }
  440. .companyProfilewrap{
  441. position:relative;
  442. width:100%;
  443. }
  444. .companyProfile{
  445. width:90%;height:138px;
  446. background:#F9F9FA;
  447. font-size:13px;
  448. padding:13px;
  449. border-radius:5px;
  450. }
  451. .companyProfilecontent{
  452. position:absolute;
  453. bottom:10px;
  454. right:15px;
  455. font-size:13px;
  456. }
  457. </style>