Catering.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <view class="page" :style="{'min-height':(h)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="商户信息"></c-nav-bar>
  4. <view class="tenant-title">
  5. <text>基本信息</text>
  6. </view>
  7. <view class="from-content">
  8. <view class="one-realName">
  9. <view class="realName">
  10. 商户名称
  11. </view>
  12. <!-- <u--input v-model="realName" border="none" pl ></u--input> -->
  13. <view class="right">
  14. <input type="text" v-model="list.name" border="none" placeholder="请输入昵称" />
  15. </view>
  16. </view>
  17. <view class="one" @click="nav">
  18. <view class="">
  19. 商户类型
  20. </view>
  21. <view class="">
  22. <!-- 渔家乐 -->
  23. 餐饮美食
  24. </view>
  25. <!-- <view class="right">
  26. <input type="text" v-model="list.phone" border="none" placeholder="请输入" style="height: 48rpx;" />
  27. </view> -->
  28. </view>
  29. <view class="one-mobile">
  30. <view class="mobile">
  31. 企业名称
  32. </view>
  33. <view class="right">
  34. <input type="text" v-model="list.companyName" border="none" placeholder="请输入"
  35. style="height: 48rpx;" />
  36. </view>
  37. </view>
  38. <view class="one">
  39. <view class="">
  40. 企业类型
  41. </view>
  42. <view class="right">
  43. <input type="text" v-model="companyType" border="none" placeholder="请输入"
  44. style="height: 48rpx; text-align: right;" />
  45. </view>
  46. </view>
  47. <view class="one-mobile">
  48. <view class="mobile">
  49. 企业法人
  50. </view>
  51. <view class="right">
  52. <input type="text" v-model="list.legalPerson" border="none" placeholder="请输入"
  53. style="height: 48rpx;" />
  54. </view>
  55. </view>
  56. <view class="one-mobile">
  57. <view class="mobile">
  58. 法人身份证号码
  59. </view>
  60. <view class="right">
  61. <input type="text" v-model="list.idCard" border="none" placeholder="请输入" style="height: 48rpx;" />
  62. </view>
  63. </view>
  64. <view class="one-mobile">
  65. <view class="mobile" style="width: 350rpx;">
  66. 统一社会信用代码
  67. </view>
  68. <view class="right">
  69. <input type="text" v-model="list.creditCode" border="none" placeholder="请输入"
  70. style="height: 48rpx;" />
  71. </view>
  72. </view>
  73. <view class="one-mobile">
  74. <view class="mobile">
  75. 企业地址
  76. </view>
  77. <view class="right">
  78. <input type="text" v-model="list.areaDetail" border="none" placeholder="请输入"
  79. style="height: 48rpx;" />
  80. </view>
  81. </view>
  82. </view>
  83. <view class="tenant-title">
  84. <text>联系人信息</text>
  85. </view>
  86. <view class="from-content">
  87. <view class="one-mobile">
  88. <view class="mobile">
  89. 联系人姓名
  90. </view>
  91. <view class="right">
  92. <input type="text" v-model="list.linkName" border="none" placeholder="请输入" style="height: 48rpx;" />
  93. </view>
  94. </view>
  95. <view class="one-mobile">
  96. <view class="mobile">
  97. 联系人号码
  98. </view>
  99. <view class="right">
  100. <input type="text" v-model="list.phone" border="none" placeholder="请输入" style="height: 48rpx;" />
  101. </view>
  102. </view>
  103. </view>
  104. <view class="tenant-title">
  105. <text>商家相册</text>
  106. </view>
  107. <view class="from-content" style="padding: 30rpx;">
  108. <view class="tenant-image">
  109. <view @click="idCardFront">
  110. <image :src="list.idCardFront" mode=""></image>
  111. <view>法人身份证国徽面</view>
  112. </view>
  113. <view @click="idCardReverse">
  114. <image :src="list.idCardReverse" mode=""></image>
  115. <view>法人身份证人像面</view>
  116. </view>
  117. <view @click="licensePic">
  118. <image :src="list.licensePic" mode=""></image>
  119. <view>营业执照</view>
  120. </view>
  121. <!-- <view @click="usccl">
  122. <image :src="list.usccl" mode=""></image>
  123. <view>统一社会信息代码证</view>
  124. </view> -->
  125. <view @click="shopSign">
  126. <image :src="list.storeFrontPic" mode=""></image>
  127. <view>门头照/店铺照片</view>
  128. </view>
  129. <!-- <view @click="shopImgs">
  130. <image :src="list.shopImgs" mode=""></image>
  131. <view>店铺照片</view>
  132. </view> -->
  133. </view>
  134. </view>
  135. <!-- 选择弹框学历要求 -->
  136. <u-popup :show="showTwo" @close="close" :round="24" @open="open">
  137. <view class="pop">
  138. <view class="hander">
  139. <view class="left" @click="showTwo=false">
  140. 取消
  141. </view>
  142. <view class="center">
  143. <!-- 学历要求 -->
  144. </view>
  145. <view class="right" @click="showTwo=false">
  146. 确定
  147. </view>
  148. </view>
  149. <view class="At-last" v-for="item,index in JobList">
  150. <view class="item" @click="choose(item,index)" :class="indexDb==index?'activeItem':''">
  151. {{item.name}}
  152. </view>
  153. </view>
  154. </view>
  155. </u-popup>
  156. <view class="from-content">
  157. <button class="tenant-button" @click="merchant">
  158. 立即保存
  159. </button>
  160. </view>
  161. </view>
  162. </template>
  163. <script>
  164. import {
  165. encrypt
  166. } from '../../../utils/aes.js'
  167. export default {
  168. data() {
  169. return {
  170. h: uni.getSystemInfoSync().windowHeight - 87,
  171. mt: uni.getSystemInfoSync().statusBarHeight + 44,
  172. titleHeader: '个人信息',
  173. fileList: [],
  174. JobList: [{
  175. name: '不限'
  176. }, {
  177. name: '高中',
  178. },
  179. {
  180. name: '中专/技校',
  181. },
  182. {
  183. name: '大专',
  184. },
  185. {
  186. name: '本科',
  187. },
  188. {
  189. name: '硕士',
  190. }
  191. ],
  192. fishermanId: uni.getStorageSync('merchantId'),
  193. list: {},
  194. dto: {
  195. name: '', //商户名称
  196. companyName: '', //企业名称
  197. merchantType: 4, //商户类型
  198. companyType: '', //企业类型
  199. legalPerson: '', //企业法人
  200. idCard: '', //法人身份证号码
  201. creditCode: '', //统一社区信用代码
  202. areaDetail: '', //企业地址
  203. linkName: '', //联系人姓名
  204. phone: '', //联系人号码
  205. idCardFront: '', //法人身份证国徽面
  206. idCardReverse: '', //法人身份证人像面
  207. licensePic: '', //营业执照
  208. // usccl: '', //统一社会信息代码证
  209. storeFrontPic: '', //门头照
  210. shopImgs: '', //店铺照片
  211. id: '',
  212. areaDetail: '', //企业地址
  213. },
  214. typeList: {},
  215. companyType: '',
  216. tempLegalPerson:null,
  217. tempIdCard:null,
  218. tempLinkName:null
  219. }
  220. },
  221. onLoad() {
  222. this.getList()
  223. },
  224. methods: {
  225. // 获取数据
  226. getList() {
  227. let id = this.fishermanId
  228. this.$api.get(`/api/merchant/food/merchant/${id}`).then(res => {
  229. this.list = res.data.data
  230. this.tempIdCard = this.list.idCard;
  231. this.tempLegalPerson = this.list.legalPerson;
  232. this.tempLinkName = this.list.linkName;
  233. this.getDict()
  234. })
  235. },
  236. // 获取企业类型字典
  237. getDict() {
  238. this.$api.get('/sys/dict/type/all').then(res => {
  239. console.log(res.data)
  240. //this.$store.state.Dict = Object.assign(res.data);
  241. // this.dictValue
  242. this.typeList = res.data.data.find((p) => p.dictType == 'CompanyType').dataList;
  243. console.log(this.typeList);
  244. this.companyType = this.typeList.find((p) => p.dictValue == this.list.companyType).dictLabel
  245. console.log(this.companyType);
  246. })
  247. },
  248. // 立即保存
  249. merchant() {
  250. this.dto.idCardFront = this.list.idCardFront
  251. this.dto.name = this.list.name
  252. this.dto.companyName = this.list.companyName
  253. this.dto.merchantType = this.list.merchantType
  254. this.dto.companyType = this.list.companyType
  255. this.dto.legalPerson = this.list.legalPerson
  256. this.dto.idCard = this.list.idCard
  257. this.dto.creditCode = this.list.creditCode
  258. this.dto.idCardReverse = this.list.idCardReverse
  259. this.dto.licensePic = this.list.licensePic
  260. this.dto.storeFrontPic = this.list.storeFrontPic
  261. this.dto.shopImgs = this.list.shopImgs
  262. this.dto.linkName = this.list.linkName
  263. this.dto.phone = this.list.phone
  264. this.dto.areaDetail = this.list.areaDetail
  265. this.dto.id = uni.getStorageSync('merchantId')
  266. //加密
  267. let newDataForm = JSON.parse(JSON.stringify(this.dto));
  268. if (
  269. newDataForm.legalPerson &&
  270. this.tempLegalPerson != newDataForm.legalPerson
  271. ) {
  272. //编辑了
  273. newDataForm.legalPerson = encrypt(
  274. newDataForm.legalPerson
  275. );
  276. } else {
  277. newDataForm.legalPerson = null;
  278. }
  279. if (
  280. newDataForm.idCard &&
  281. this.tempIdCard != newDataForm.idCard
  282. ) {
  283. newDataForm.idCard = encrypt(
  284. newDataForm.idCard
  285. );
  286. } else {
  287. newDataForm.idCard = null;
  288. }
  289. if (
  290. newDataForm.linkName &&
  291. this.tempLinkName != newDataForm.linkName
  292. ) {
  293. newDataForm.linkName = encrypt(
  294. newDataForm.linkName
  295. );
  296. } else {
  297. newDataForm.linkName = null;
  298. }
  299. this.$api.put('/api/merchant/food/updateMerchantInfo', newDataForm).then(res => {
  300. console.log('0000', res.data);
  301. if (res.data.code == 0) {
  302. this.$showToast('保存成功');
  303. setTimeout(() => {
  304. this.getList()
  305. }, 1000)
  306. }
  307. })
  308. },
  309. // 上传头像法人身份证国徽面
  310. idCardFront() {
  311. uni.chooseImage({
  312. sourceType: ['album'], //从相册选择
  313. success: chooseImageRes => {
  314. const tempFilePaths = chooseImageRes.tempFilePaths;
  315. uni.uploadFile({
  316. url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
  317. filePath: tempFilePaths[0],
  318. name: 'file',
  319. header: {
  320. token: wx.getStorageSync('access_token')
  321. },
  322. success: res => {
  323. // uploadFile上传成功后,根据和后台的约定msgCode判断接口调用状态
  324. let data = JSON.parse(res.data);
  325. this.dto.idCardFront = data.data.url
  326. this.list.idCardFront = data.data.url
  327. }
  328. });
  329. },
  330. fail: err => {
  331. this.myToast('图片上传失败', 'none');
  332. }
  333. });
  334. },
  335. // 上传法人身份证人像面
  336. idCardReverse() {
  337. uni.chooseImage({
  338. sourceType: ['album'], //从相册选择
  339. success: chooseImageRes => {
  340. const tempFilePaths = chooseImageRes.tempFilePaths;
  341. uni.uploadFile({
  342. url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
  343. filePath: tempFilePaths[0],
  344. name: 'file',
  345. header: {
  346. token: wx.getStorageSync('access_token')
  347. },
  348. success: res => {
  349. // uploadFile上传成功后,根据和后台的约定msgCode判断接口调用状态
  350. let data = JSON.parse(res.data);
  351. this.dto.idCardReverse = data.data.url
  352. this.list.idCardReverse = data.data.url
  353. }
  354. });
  355. },
  356. fail: err => {
  357. this.myToast('图片上传失败', 'none');
  358. }
  359. });
  360. }, // 上传营业执照
  361. licensePic() {
  362. uni.chooseImage({
  363. sourceType: ['album'], //从相册选择
  364. success: chooseImageRes => {
  365. const tempFilePaths = chooseImageRes.tempFilePaths;
  366. uni.uploadFile({
  367. url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
  368. filePath: tempFilePaths[0],
  369. name: 'file',
  370. header: {
  371. token: wx.getStorageSync('access_token')
  372. },
  373. success: res => {
  374. // uploadFile上传成功后,根据和后台的约定msgCode判断接口调用状态
  375. let data = JSON.parse(res.data);
  376. this.dto.licensePic = data.data.url
  377. this.list.licensePic = data.data.url
  378. }
  379. });
  380. },
  381. fail: err => {
  382. this.myToast('图片上传失败', 'none');
  383. }
  384. });
  385. }, // 上传统一社会信息代码证
  386. // usccl() {
  387. // uni.chooseImage({
  388. // sourceType: ['album'], //从相册选择
  389. // success: chooseImageRes => {
  390. // const tempFilePaths = chooseImageRes.tempFilePaths;
  391. // uni.uploadFile({
  392. // url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
  393. // filePath: tempFilePaths[0],
  394. // name: 'file',
  395. // header: {
  396. // token: wx.getStorageSync('access_token')
  397. // },
  398. // success: res => {
  399. // // uploadFile上传成功后,根据和后台的约定msgCode判断接口调用状态
  400. // let data = JSON.parse(res.data);
  401. // this.dto.usccl = data.data.url
  402. // this.list.usccl = data.data.url
  403. // }
  404. // });
  405. // },
  406. // fail: err => {
  407. // this.myToast('图片上传失败', 'none');
  408. // }
  409. // });
  410. // }, // 上传门头照
  411. shopSign() {
  412. uni.chooseImage({
  413. sourceType: ['album'], //从相册选择
  414. success: chooseImageRes => {
  415. const tempFilePaths = chooseImageRes.tempFilePaths;
  416. uni.uploadFile({
  417. url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
  418. filePath: tempFilePaths[0],
  419. name: 'file',
  420. header: {
  421. token: wx.getStorageSync('access_token')
  422. },
  423. success: res => {
  424. // uploadFile上传成功后,根据和后台的约定msgCode判断接口调用状态
  425. let data = JSON.parse(res.data);
  426. this.dto.storeFrontPic = data.data.url
  427. this.list.storeFrontPic = data.data.url
  428. }
  429. });
  430. },
  431. fail: err => {
  432. this.myToast('图片上传失败', 'none');
  433. }
  434. });
  435. }, // 上传店铺照片
  436. shopImgs() {
  437. uni.chooseImage({
  438. sourceType: ['album'], //从相册选择
  439. success: chooseImageRes => {
  440. const tempFilePaths = chooseImageRes.tempFilePaths;
  441. uni.uploadFile({
  442. url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
  443. filePath: tempFilePaths[0],
  444. name: 'file',
  445. header: {
  446. token: wx.getStorageSync('access_token')
  447. },
  448. success: res => {
  449. // uploadFile上传成功后,根据和后台的约定msgCode判断接口调用状态
  450. let data = JSON.parse(res.data);
  451. this.dto.shopImgs = data.data.url
  452. this.list.shopImgs = data.data.url
  453. }
  454. });
  455. },
  456. fail: err => {
  457. this.myToast('图片上传失败', 'none');
  458. }
  459. });
  460. },
  461. }
  462. }
  463. </script>
  464. <style lang="scss" scoped>
  465. .page {
  466. box-sizing: border-box;
  467. // padding: 30rpx;
  468. // padding-top: 150rpx;
  469. }
  470. //标题样式
  471. .tenant-title {
  472. height: 88rpx;
  473. background: #F5F8FA;
  474. padding-left: 30rpx;
  475. text {
  476. line-height: 88rpx;
  477. font-size: 28rpx;
  478. color: #007A69;
  479. }
  480. }
  481. //商家相册样式
  482. .tenant-image {
  483. width: 100%;
  484. display: flex;
  485. flex-wrap: wrap;
  486. justify-content: space-around;
  487. >view {
  488. width: 47%;
  489. text-align: center;
  490. image {
  491. width: 100%;
  492. height: 212rpx;
  493. background: #F6F8F9;
  494. }
  495. view {
  496. margin: 15rpx 0 45rpx 0;
  497. }
  498. }
  499. }
  500. //保存样式
  501. .tenant-button {
  502. background: #007A69;
  503. border-radius: 40rpx;
  504. font-weight: bold;
  505. font-size: 28rpx;
  506. color: #FFFFFF;
  507. height: 88rpx;
  508. line-height: 88rpx;
  509. }
  510. .from-content {
  511. padding: 30rpx;
  512. .title {
  513. margin: 40rpx 0 36rpx;
  514. font-size: 30rpx;
  515. font-weight: Regular;
  516. color: #111111;
  517. }
  518. .one-image {
  519. width: 100%;
  520. display: flex;
  521. justify-content: space-between;
  522. .image {
  523. width: 124rpx;
  524. height: 124rpx;
  525. border-radius: 100rpx;
  526. image {
  527. width: 100%;
  528. height: 100%;
  529. border-radius: 100rpx;
  530. }
  531. }
  532. .user {
  533. margin-top: 24rpx;
  534. font-size: 30rpx;
  535. color: #111;
  536. font-weight: Regular;
  537. }
  538. }
  539. .one-realName {
  540. width: 100%;
  541. display: flex;
  542. align-items: center;
  543. height: 120rpx;
  544. line-height: 120rpx;
  545. border-bottom: 1rpx solid #EFEFEF;
  546. .realName {
  547. width: 188rpx;
  548. height: 120rpx;
  549. font-size: 30rpx;
  550. color: #333333;
  551. font-weight: Regular;
  552. }
  553. .right {
  554. text-align: right;
  555. width: 100%;
  556. font-size: 30rpx;
  557. color: #666666;
  558. font-weight: Regular;
  559. // display: flex;
  560. // justify-content: space-between;
  561. }
  562. }
  563. .one-mobile {
  564. display: flex;
  565. width: 100%;
  566. align-items: center;
  567. height: 120rpx;
  568. line-height: 120rpx;
  569. border-bottom: 1rpx solid #EFEFEF;
  570. .right {
  571. width: 100%;
  572. text-align: right;
  573. font-size: 30rpx;
  574. color: #666666;
  575. font-weight: Regular;
  576. }
  577. .mobile {
  578. width: 380rpx !important;
  579. height: 120rpx;
  580. font-size: 30rpx;
  581. color: #333333;
  582. font-weight: Regular;
  583. }
  584. .replacement {
  585. border-radius: 50rpx;
  586. width: 80rpx;
  587. height: 48rpx;
  588. line-height: 48rpx;
  589. border: 1rpx solid #025EA7;
  590. color: #025EA7;
  591. font-weight: Regular;
  592. font-size: 24rpx;
  593. text-align: center;
  594. }
  595. }
  596. .one {
  597. height: 120rpx;
  598. line-height: 120rpx;
  599. display: flex;
  600. border-bottom: 1rpx solid #EFEFEF;
  601. justify-content: space-between;
  602. align-items: center;
  603. font-size: 30rpx;
  604. color: #333333;
  605. font-weight: Regular;
  606. }
  607. }
  608. .btn {
  609. margin: 120rpx auto;
  610. width: 650rpx;
  611. height: 88rpx;
  612. display: flex;
  613. background-color: #01B9F9;
  614. line-height: 88rpx;
  615. border-radius: 50rpx;
  616. .btn-btn {
  617. margin: 0 auto;
  618. font-size: 32rpx;
  619. color: #FFFFFF;
  620. font-weight: Regular;
  621. }
  622. }
  623. </style>