settledShipyard.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <template>
  2. <view class="content">
  3. <view v-if="state == 0 || state == 2">
  4. <view class="box">
  5. <view class="title">船厂信息</view>
  6. <view class="cell vflex">
  7. <view class="img_title">船厂头像</view>
  8. <view style="width: 220rpx;height: 220rpx;padding-top: 28rpx;">
  9. <u-upload :fileList="info.fileList1" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="1" multiple :previewFullImage="true" width="220rpx" height="220rpx">
  10. <view class="vflex acenter jcenter upload_bg">
  11. <u-icon name="plus" color="#929292" size="20"></u-icon>
  12. <view class="upload_text">上传图片</view>
  13. </view>
  14. </u-upload>
  15. </view>
  16. </view>
  17. <view class="hflex acenter jbetween cell">
  18. <view class="left">船厂名称</view>
  19. <u-input v-model="info.name" border="none" placeholder="请输入船厂名称" inputAlign="right"></u-input>
  20. </view>
  21. <view class="hflex acenter jbetween cell" @click="selectmap">
  22. <view class="left">船厂地址</view>
  23. <u-input v-model="addressObj.address" border="none" disabled disabledColor="#fff" placeholder="请选择" inputAlign="right" suffixIcon="map-fill" suffixIconStyle="color: #B7B7B7"></u-input>
  24. </view>
  25. <view class="hflex acenter jbetween cell">
  26. <view class="left">联系人</view>
  27. <u-input v-model="info.contacts" border="none" placeholder="请输入联系人姓名" inputAlign="right"></u-input>
  28. </view>
  29. <view class="hflex acenter jbetween cell">
  30. <view class="left">联系电话</view>
  31. <u-input v-model="info.phone" border="none" placeholder="请输入联系电话" inputAlign="right"></u-input>
  32. </view>
  33. <view class="hflex acenter jbetween cell">
  34. <view class="left">船厂人数</view>
  35. <u-input v-model="info.num_staff" border="none" placeholder="请输入范围值,例如10-50" inputAlign="right"></u-input>
  36. </view>
  37. <view class="vflex cell" style="border: none;">
  38. <view class="left">船厂简介</view>
  39. <u--textarea v-model="info.introduction" placeholder="在此输入船厂简介内容" ></u--textarea>
  40. </view>
  41. <view class="vflex">
  42. <view class="img_title">船厂环境</view>
  43. <view class="hflex fwrap" style="padding-top: 28rpx;">
  44. <u-upload :fileList="info.fileList2" @afterRead="afterRead" @delete="deletePic" :maxCount="9" name="2" multiple :previewFullImage="true" width="200rpx" height="200rpx">
  45. <view class="vflex acenter jcenter upload_bg">
  46. <u-icon name="plus" color="#929292" size="20"></u-icon>
  47. <view class="upload_text">上传图片</view>
  48. </view>
  49. </u-upload>
  50. </view>
  51. </view>
  52. <view class="vflex cell" style="border: none;">
  53. <view class="left">产品简介</view>
  54. <u--textarea v-model="info.product_intro" placeholder="在此输入产品简介内容" ></u--textarea>
  55. </view>
  56. </view>
  57. <view class="box">
  58. <view class="cell" style="border: none;padding: none;">
  59. <view class="img_title">上传营业执照</view>
  60. <view class="upload_img vflex acenter jcenter">
  61. <u-upload :fileList="info.fileList3" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="3" multiple :previewFullImage="true" width="550rpx" height="324rpx">
  62. <image src="https://ship-expert.zhousi.hdlkeji.com/common/upload-business.png" style="width: 550rpx;height: 324rpx;"></image>
  63. </u-upload>
  64. <view class="hflex acenter ">
  65. <u-icon name="camera" color="#999999" size="16"></u-icon>
  66. <view class="">点击上传营业执照</view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="hflex acenter">
  72. <u-checkbox-group @change="checkboxChange">
  73. <u-checkbox v-model="agree" shape="circle"></u-checkbox>
  74. </u-checkbox-group>
  75. <view class="text">阅读并同意<span class="read" @click="open">《船厂入驻规则》</span></view>
  76. </view>
  77. <view class="button hflex acenter jcenter" @click="settled">
  78. <view>立即入驻</view>
  79. </view>
  80. </view>
  81. <view v-if="state == 1">
  82. <view class="box1 vflex acenter jcenter">
  83. <image src="https://ship-expert.zhousi.hdlkeji.com/common/wait.png" class="box1_img"></image>
  84. <view class="box1_title">审核中</view>
  85. <view class="box1_subTitle">预计审核时间3个工作日</view>
  86. <view class="box1_subTitle">请留意当前页面变动</view>
  87. <view class="btn" @click="result">返回</view>
  88. </view>
  89. </view>
  90. <view v-if="state == 3">
  91. <view class="box1 vflex acenter jcenter">
  92. <image src="https://ship-expert.zhousi.hdlkeji.com/common/error.png" class="box1_img"></image>
  93. <view class="box1_title">审核失败</view>
  94. <view class="box1_subTitle">驳回原因</view>
  95. <view class="box1_subTitle">{{reason}}<span style="color: #506dff;margin-left: 8rpx;" @click="edit">立即修改></span></view>
  96. <view class="btn" @click="result">返回</view>
  97. </view>
  98. </view>
  99. <u-modal :show="showProtocol" :title="protocolTitle" confirmColor="#2988FE" @confirm="isRead" confirmText="我已阅读">
  100. <view class="slot-content">
  101. <rich-text :nodes="protocolContent"></rich-text>
  102. </view>
  103. </u-modal>
  104. </view>
  105. </template>
  106. <script>
  107. import $api from '@/static/js/api.js'
  108. var that = ''
  109. export default {
  110. data() {
  111. return {
  112. info: {
  113. id: '',
  114. name: '',
  115. address: '',
  116. contacts: '',
  117. phone: '',
  118. introduction: '',
  119. fileList1: [],
  120. fileList2: [],
  121. fileList3: [],
  122. product_intro:''
  123. },
  124. addressObj: {},
  125. agree: false,
  126. showProtocol: false,
  127. protocolTitle: '',
  128. protocolContent: '',
  129. state: 0,
  130. reason:'',
  131. fileList1: '',
  132. fileList2: '',
  133. fileList3: '',
  134. }
  135. },
  136. onLoad() {
  137. that = this
  138. that.getPreData()
  139. },
  140. methods: {
  141. getPreData() {
  142. var pages = getCurrentPages()
  143. var prePage = pages[pages.length - 2]
  144. var shipyard = prePage.$vm.user.shipyard
  145. if (shipyard) {
  146. that.info = {
  147. name: shipyard.name,
  148. contacts: shipyard.contact_name,
  149. phone: shipyard.contact_phone,
  150. introduction: shipyard.intro,
  151. num_staff: shipyard.num_staff,
  152. fileList1: [],
  153. fileList2: [],
  154. fileList3: [],
  155. product_intro: shipyard.product_intro,
  156. // fileList1: shipyard.business_img.split(','),
  157. id: shipyard.id
  158. }
  159. if(shipyard.head_img !== null) {
  160. that.info.fileList1.push({
  161. url: shipyard.head_img
  162. })
  163. that.fileList1 = shipyard.head_img
  164. }
  165. var imgs = shipyard.environment_imgs
  166. for(var i=0;i<imgs.length;i++) {
  167. that.info.fileList2.push({
  168. url: imgs[i]
  169. })
  170. }
  171. that.fileList2 = shipyard.environment_imgs
  172. that.info.fileList3.push({
  173. url: shipyard.business_img
  174. })
  175. that.fileList3 = shipyard.business_img
  176. console.log(that.info);
  177. that.addressObj = {
  178. address: shipyard.address,
  179. province: shipyard.province,
  180. city:shipyard.city,
  181. area:shipyard.area,
  182. longitude: shipyard.longitude,
  183. latitude: shipyard.latitude,
  184. }
  185. that.state = shipyard.audit
  186. that.reason = shipyard.why
  187. }
  188. },
  189. selectmap() {
  190. console.log('选择地址');
  191. uni.getLocation({
  192. type: 'wgs84',
  193. success: (res)=>{
  194. console.log(res);
  195. if(res.longitude && res.latitude){
  196. $api.jump('/pages/user/map?lng='+res.longitude+'&lat='+res.latitude)
  197. }
  198. },
  199. fail:()=>{
  200. uni.getSetting({
  201. success: (res) => {
  202. console.log(res);
  203. var status = res.authSetting;
  204. if(!status['scope.userLocation']){
  205. uni.showModal({
  206. title:"是否授权当前位置",
  207. content:"需要获取您的地理位置,请确认授权,否则地图功能将无法使用",
  208. success:(tip)=>{
  209. if(tip.confirm){
  210. uni.openSetting({
  211. success:(data)=>{
  212. if(data.authSetting['scope.userLocation']===true){
  213. uni.showToast({
  214. title:"授权成功",
  215. icon:"success",
  216. duration:1000
  217. })
  218. uni.getLocation({
  219. type: 'wgs84',
  220. success: (res)=>{
  221. console.log('当前位置的经度:' + res.longitude);
  222. console.log('当前位置的纬度:' + res.latitude);
  223. $api.jump('/pages/user/map?lng='+res.longitude+'&lat='+res.latitude)
  224. }
  225. })
  226. }else{
  227. uni.showToast({
  228. title:"授权失败",
  229. icon:"none",
  230. duration:1000
  231. })
  232. }
  233. }
  234. })
  235. }
  236. }
  237. })
  238. }else{
  239. uni.getLocation({
  240. type: 'wgs84',
  241. success: (res)=>{
  242. console.log('当前位置的经度:' + res.longitude);
  243. console.log('当前位置的纬度:' + res.latitude);
  244. $api.jump('/pages/user/map?lng='+res.longitude+'&lat='+res.latitude)
  245. }
  246. })
  247. }
  248. },
  249. fail: (res) => {
  250. uni.showToast({
  251. title:"调用授权窗口失败",
  252. icon:"none",
  253. duration:1000
  254. })
  255. }
  256. })
  257. }
  258. })
  259. },
  260. // 删除图片
  261. deletePic(event) {
  262. // that.userInfo.imgList.splice(event.index, 1)
  263. console.log(event)
  264. if(event.name !== '2') {
  265. that.info[`fileList${event.name}`] = []
  266. that[`fileList${event.name}`] = ''
  267. } else {
  268. that[`fileList${event.name}`] = ''
  269. that.info[`fileList${event.name}`].splice(event.index, 1)
  270. if(that.info[`fileList${event.name}`].length > 0) {
  271. for(var i=0;i<that.info[`fileList${event.name}`].length;i++) {
  272. if(i == that.info[`fileList${event.name}`].length -1) {
  273. that[`fileList${event.name}`] += that.info[`fileList${event.name}`][i].url
  274. } else {
  275. that[`fileList${event.name}`] += that.info[`fileList${event.name}`][i].url + ','
  276. }
  277. }
  278. }
  279. }
  280. },
  281. // 新增图片
  282. async afterRead(event) {
  283. uni.showLoading({
  284. title: '上传中',
  285. mask: true
  286. })
  287. console.log(`fileList${event.name}`);
  288. console.log(this.info[`fileList${event.name}`]);
  289. let lists = [].concat(event.file)
  290. let fileListLen = this.info[`fileList${event.name}`].length
  291. lists.map((item) => {
  292. this.info[`fileList${event.name}`].push({
  293. ...item,
  294. status: 'uploading',
  295. message: '上传中'
  296. })
  297. })
  298. for (let i = 0; i < lists.length; i++) {
  299. const result = await this.uploadFilePromise(lists[i].url)
  300. let item = this.info[`fileList${event.name}`][fileListLen]
  301. this.info[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  302. status: 'success',
  303. message: '',
  304. url: result.url
  305. }))
  306. fileListLen++
  307. if(lists.length - 1 == i) {
  308. uni.hideLoading()
  309. }
  310. }
  311. that[`fileList${event.name}`] = ""
  312. if(that.info[`fileList${event.name}`].length > 0) {
  313. for(var i=0;i<that.info[`fileList${event.name}`].length;i++) {
  314. if(i == that.info[`fileList${event.name}`].length -1) {
  315. that[`fileList${event.name}`] += that.info[`fileList${event.name}`][i].url
  316. } else {
  317. that[`fileList${event.name}`] += that.info[`fileList${event.name}`][i].url + ','
  318. }
  319. }
  320. }
  321. },
  322. // 上传图片
  323. uploadFilePromise(url) {
  324. return new Promise((resolve, reject) => {
  325. let a = uni.uploadFile({
  326. url: $api.config.baseUrl + '/data/api.auth.Center/upload',
  327. filePath: url,
  328. name: 'file',
  329. header: {
  330. 'content-type': 'application/x-www-form-urlencoded',
  331. 'api-token': uni.getStorageSync('token').token?uni.getStorageSync('token').token:'',
  332. 'api-name': 'wxapp'
  333. },
  334. formData: {
  335. user: 'test'
  336. },
  337. success: (res) => {
  338. setTimeout(() => {
  339. var data = JSON.parse(res.data)
  340. resolve(data.data)
  341. }, 1000)
  342. }
  343. });
  344. })
  345. },
  346. // 阅读并同意
  347. checkboxChange(n) {
  348. that.agree = !that.agree
  349. },
  350. settled() {
  351. uni.showLoading({
  352. title: '提交中',
  353. mask: true
  354. })
  355. var business_img = ""
  356. console.log(that.fileList2);
  357. if ($api.formCheck(that.info.name,'required')&&$api.formCheck(that.addressObj.address,'required')&&$api.formCheck(that.info.fileList1,'required')&&$api.formCheck(that.info.contacts,'required')&&$api.formCheck(that.info.phone,'phone')&&$api.formCheck(that.info.introduction,'required')) {
  358. if(that.agree) {
  359. $api.req({
  360. url: '/data/api.auth.Center/addupshipyard',
  361. method: 'POST',
  362. data: {
  363. name: that.info.name,
  364. province: that.addressObj.province,
  365. city: that.addressObj.city,
  366. area: that.addressObj.area,
  367. address: that.addressObj.address,
  368. contact_name: that.info.contacts,
  369. contact_phone: that.info.phone,
  370. intro: that.info.introduction,
  371. longitude: that.addressObj.longitude,
  372. latitude: that.addressObj.latitude,
  373. head_img: that.fileList1,
  374. environment_imgs: that.fileList2,
  375. business_img: that.fileList3,
  376. product_intro: that.info.product_intro,
  377. num_staff: that.info.num_staff,
  378. id: that.info.id?that.info.id: ''
  379. }
  380. }, function(res) {
  381. uni.hideLoading()
  382. if(res.code == 1) {
  383. $api.info(res.info)
  384. that.state = 1
  385. }
  386. })
  387. }else {
  388. $api.info('请先阅读并同意《船厂入驻规则》')
  389. uni.hideLoading()
  390. }
  391. } else {
  392. uni.hideLoading()
  393. }
  394. },
  395. edit() {
  396. that.state = 0
  397. },
  398. result() {
  399. $api.jump('/pages/tabbar/mine/mine',3)
  400. },
  401. open() {
  402. $api.req({
  403. url: '/data/api.auth.Center/getrule'
  404. }, function(res) {
  405. if (res.code == 1) {
  406. console.log(res);
  407. uni.setStorageSync('xieyi',res.data.shipyard_join_rule)
  408. $api.jump('/pages/user/agreement?title=船厂入驻规则')
  409. }
  410. })
  411. },
  412. isRead() {
  413. that.showProtocol = false
  414. that.agree = true
  415. },
  416. },
  417. }
  418. </script>
  419. <style lang="scss" scoped>
  420. .content::v-deep {
  421. background: #F4F4F4;
  422. padding: 20rpx 30rpx;
  423. .box {
  424. width: 100%;
  425. background: #FFFFFF;
  426. border-radius: 28rpx;
  427. padding: 28rpx 20rpx;
  428. box-sizing: border-box;
  429. margin-bottom: 16rpx;
  430. .title {
  431. font-size: 32rpx;
  432. color: #222222;
  433. font-weight: 600;
  434. line-height: 44px;
  435. }
  436. .upload_bg {
  437. width: 200rpx;
  438. height: 200rpx;
  439. background: #F4F4F4;
  440. border-radius: 20rpx;
  441. }
  442. .upload_text {
  443. font-size: 26rpx;
  444. font-weight: 400;
  445. color: #777777;
  446. line-height: 36rpx;
  447. padding-top: 20rpx;
  448. }
  449. .cell {
  450. width: 100%;
  451. padding: 20rpx 0 28rpx;
  452. border-bottom: 1rpx solid #f4f4f4;
  453. .left {
  454. width: 20%;
  455. font-size: 28rpx;
  456. color: #222;
  457. position: relative;
  458. padding-left: 10rpx;
  459. }
  460. .left::before {
  461. content: "*";
  462. position: absolute;
  463. top: 0rpx;
  464. left: -5rpx;
  465. color: #FF0D0D;
  466. font-size: 20rpx;
  467. }
  468. .u-input {
  469. font-size: 28rpx;
  470. color: #222;
  471. }
  472. .img_title {
  473. font-size: 28rpx;
  474. color: #444;
  475. }
  476. .upload_img {
  477. width: 670rpx;
  478. height: 404rpx;
  479. background-color: #fff;
  480. border-radius: 20rpx;
  481. margin: 28rpx 0 0;
  482. padding: 20rpx 0;
  483. border: 1rpx dashed #e0e0e0;
  484. }
  485. .u-upload__wrap {
  486. display: flex;
  487. align-items: center !important;
  488. justify-content: center !important;
  489. }
  490. .u-textarea {
  491. margin: 28rpx auto 0;
  492. background-color: #f4f4f4;
  493. border-radius: 28rpx;
  494. box-sizing: border-box;
  495. padding: 24rpx;
  496. width: 610rpx;
  497. }
  498. }
  499. }
  500. .text {
  501. font-size: 24rpx;
  502. color: #9c9c9c;
  503. }
  504. .read {
  505. color: #2a63f3;
  506. }
  507. .button {
  508. width: 100%;
  509. height: 88rpx;
  510. background-color: #506dff;
  511. border-radius: 50rpx;
  512. box-shadow: 0 4rpx 28rpx 0 rgba(132,123,255,0.4);
  513. font-size: 40rpx;
  514. color: #fff;
  515. margin: 40rpx 0 36rpx;
  516. }
  517. .box1 {
  518. width: 100%;
  519. // height: 100vh;
  520. background-color: #fff;
  521. padding-bottom: 80rpx;
  522. .box1_img {
  523. width: 124rpx;
  524. height: 124rpx;
  525. margin: 108rpx 0 40rpx;
  526. }
  527. .box1_title {
  528. font-size: 32rpx;
  529. color: #222;
  530. margin-bottom: 24rpx;
  531. }
  532. .box1_subTitle {
  533. margin: 12rpx 0;
  534. font-size: 26rpx;
  535. color: #999999;
  536. }
  537. .btn {
  538. width: 530rpx;
  539. height: 88rpx;
  540. background-color: #506dff;
  541. color: #fff;
  542. text-align: center;
  543. line-height: 88rpx;
  544. border-radius: 44rpx;
  545. font-size: 36rpx;
  546. margin-top: 122rpx;
  547. }
  548. }
  549. }
  550. </style>