shop.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <template>
  2. <view class="shop">
  3. <view class="top"></view>
  4. <view class="head">
  5. <span class="cuIcon-back" @click="back"></span>
  6. <view class="case">
  7. 门店详情
  8. </view>
  9. </view>
  10. <view class="center">
  11. <view class="data">
  12. <view class="title">
  13. 门店信息
  14. <span></span>
  15. </view>
  16. <view class="content">
  17. <view class="img">
  18. <image :src="shopData.logo" mode=""></image>
  19. </view>
  20. <view class="name">
  21. {{shopData.storeName}}
  22. <view class="avg">
  23. <u-rate :count="count" v-model="shopData.grade" active-icon="heart-fill" inactive-icon="heart"
  24. :disabled="true"></u-rate>
  25. <span>{{shopData.grade}}分</span>
  26. </view>
  27. <span v-if="typeIndex !== null" :style="{color:btnList[typeIndex].color}">{{btnList[typeIndex].name}}</span>
  28. </view>
  29. </view>
  30. <view class="address">
  31. <view class="area">{{shopData.locality}}</view>
  32. <view class="details">
  33. <span>{{shopData.address}}</span>
  34. <image src="/static/index/addressblue.png" mode=""></image>
  35. </view>
  36. </view>
  37. <view class="institution">
  38. 经营机构 <span>{{shopData.corporateName}}</span>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="food">
  43. <view class="business" @click="isPopup = true">
  44. <image src="/static/index/business.png" mode=""></image>营业管理
  45. </view>
  46. <!-- <view class="edit" @click="edit">
  47. <image src="/static/index/edit.png" mode=""></image>编辑门店
  48. </view> -->
  49. </view>
  50. <view class="popup" v-if="isPopup">
  51. <view class="model">
  52. <view class="title">
  53. 营业管理
  54. <image src="/static/index/cut.png" mode="" @click="closePopup"></image>
  55. </view>
  56. <view class="btnList">
  57. <view class="box">
  58. <view class="btn" :class="currentIndex==index?'select':''" v-for="(item,index) in btnList" :key="index"
  59. @click="toggle(item,index)">
  60. {{item.name}}
  61. <image src="/static/index/select.png" mode="" v-if="currentIndex==index"></image>
  62. </view>
  63. </view>
  64. <view class="affirm">
  65. {{btnList[currentIndex].content}}
  66. </view>
  67. </view>
  68. <view class="sub">
  69. <view class="cancel" @click="closePopup">
  70. 取消
  71. </view>
  72. <view class="submit" @click="changeStatus">
  73. 确定
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="popup res" v-if="isSuccess">
  79. <view class="content">
  80. <view class="title">
  81. <span>{{btnList[currentIndex].name}}</span>
  82. </view>
  83. <view class="center">
  84. <image :src="btnList[currentIndex].image" mode="" v-show="shopStatus == 1"></image>
  85. <span>{{ resultTip || (btnList[currentIndex] && btnList[currentIndex].tip) }}</span>
  86. <view class="error" v-show="shopStatus == 4">
  87. 当前门店还存在有效服务券<br />
  88. 暂时无法关闭门店
  89. </view>
  90. </view>
  91. <view class="btn" :class="btnList[currentIndex].class" @click="isSuccess = false">
  92. 确定
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. export default {
  100. data() {
  101. return {
  102. btnList: [{
  103. name: '正常营业',
  104. type:1,
  105. class:"start",
  106. tip:"恭喜发财,开业大吉!",
  107. image:"/static/index/start.png",
  108. content:" ",
  109. color:""
  110. },
  111. {
  112. name: '关闭门店',
  113. type:2,
  114. class:"close",
  115. tip:"当前门店关闭成功",
  116. image:"/static/index/close.png",
  117. content:"关闭门店前需保证没有还未使用的有效服务券哦! ",
  118. color:"#999999"
  119. },
  120. {
  121. name: '暂停营业',
  122. type:3,
  123. class:"close",
  124. tip:"该店铺已暂停营业",
  125. image:"/static/index/rest.png",
  126. content:" ",
  127. color:"#FF8024"
  128. },
  129. // {
  130. // name: '解约下线',
  131. // type: 4,
  132. // class:"close",
  133. // tip:"谢谢光临,该店铺已下架",
  134. // image:"/static/index/rest.png",
  135. // content:" ",
  136. // color:"#FF8024"
  137. // },
  138. // {
  139. // name: '门店歇业',
  140. // type: 5,
  141. // class:"rest",
  142. // tip:"当前门店已歇业",
  143. // image:"/static/index/rest.png",
  144. // content:"当前门店确定歇业?",
  145. // color:"#FF8024"
  146. // },
  147. ],
  148. currentIndex: 0,
  149. isPopup: false,
  150. status: 3,
  151. isSuccess: false,
  152. count: 5,
  153. shopData: {},
  154. shopStatus: null,
  155. typeIndex: null,
  156. id: '',
  157. resultTip:''
  158. }
  159. },
  160. methods: {
  161. edit() {
  162. uni.navigateTo({
  163. url: '/pages/store/editStore'
  164. })
  165. },
  166. //返回
  167. back() {
  168. uni.switchTab({
  169. url:'/pages/index/index'
  170. })
  171. },
  172. //切换状态
  173. toggle(item, index) {
  174. this.shopStatus=item.type
  175. this.currentIndex = index
  176. },
  177. changeStatus() {
  178. let data = {
  179. id: this.id,
  180. merchantStatus: this.shopStatus
  181. }
  182. this.$http.post("/merchant/localMerchantInfo/editStatus", data).then(res => {
  183. if (res.data.code == 200) {
  184. this.isPopup = false
  185. // 解决页面闪烁状态问题
  186. this.getShopData().then(() => {
  187. this.isSuccess = true
  188. })
  189. }else {
  190. uni.showToast({
  191. icon: 'none',
  192. title: res.data.message
  193. })
  194. }
  195. })
  196. },
  197. getShopData() {
  198. return this.$http.get("/merchant/localMerchantInfo/queryById?id=" + this.id).then(res => {
  199. if (res.data.code == 200) {
  200. this.shopData = res.data.result
  201. this.resultTip = ''
  202. this.shopStatus = res.data.result.merchantStatus
  203. let tempStatus = this.shopStatus
  204. if (tempStatus === 5) {
  205. this.resultTip = '当前时间不在营业时间范围内,已自动歇业。'
  206. tempStatus = 3
  207. }
  208. const index=this.btnList.findIndex(item => item.type == tempStatus);
  209. if (index > -1) {
  210. this.typeIndex = index
  211. this.currentIndex=index
  212. }
  213. }
  214. })
  215. },
  216. closePopup() {
  217. this.isPopup = false
  218. }
  219. },
  220. mounted() {
  221. this.getShopData()
  222. },
  223. onShow() {
  224. let that = this
  225. uni.getStorage({
  226. key: 'login_user_info',
  227. success: function(res) {
  228. that.id = res.data.merchantId
  229. }
  230. })
  231. }
  232. }
  233. </script>
  234. <style lang="scss" scoped>
  235. page {
  236. width: 100%;
  237. height: 100%;
  238. }
  239. .shop {
  240. width: 100%;
  241. height: 100%;
  242. background: #F7F8FC;
  243. display: flex;
  244. flex-direction: column;
  245. justify-content: space-between;
  246. /*#ifdef APP-PLUS*/
  247. .top {
  248. width: 100%;
  249. height: var(--status-bar-height);
  250. background: linear-gradient(180deg, #FFF9F1 0%, #FFFFFF 100%);
  251. }
  252. /*#endif*/
  253. .head {
  254. width: 100%;
  255. height: 112rpx;
  256. padding: 20rpx;
  257. display: flex;
  258. align-items: center;
  259. background: linear-gradient(180deg, #FFF9F1 0%, #FFFFFF 100%);
  260. position: relative;
  261. .cuIcon-back {
  262. font-size: 40rpx;
  263. margin-right: 40rpx;
  264. }
  265. .case {
  266. position: absolute;
  267. left: 50%;
  268. transform: translateX(-50%);
  269. font-size: 36rpx;
  270. font-weight: 600;
  271. }
  272. }
  273. .center {
  274. width: 100%;
  275. flex: 1;
  276. padding: 0px 24rpx;
  277. .data {
  278. width: 100%;
  279. background: #FFFFFF;
  280. box-shadow: 0px 2rpx 8rpx 0px rgba(214, 225, 237, 0.1);
  281. border-radius: 16rpx;
  282. margin: 20rpx auto;
  283. padding: 20rpx 16rpx;
  284. .title {
  285. font-size: 28rpx;
  286. position: relative;
  287. margin-bottom: 16rpx;
  288. span {
  289. display: block;
  290. width: 108rpx;
  291. height: 5rpx;
  292. background: linear-gradient(90deg, #88BFFF 0%, #449AFF 100%);
  293. border-radius: 8rpx;
  294. position: absolute;
  295. bottom: 5rpx;
  296. }
  297. }
  298. .content {
  299. display: flex;
  300. height: 140rpx;
  301. .img {
  302. margin-right: 20rpx;
  303. width: 140rpx;
  304. height: 140rpx;
  305. image {
  306. width: 140rpx;
  307. height: 140rpx;
  308. }
  309. }
  310. .name {
  311. height: 100%;
  312. font-size: 32rpx;
  313. font-weight: 600;
  314. display: flex;
  315. flex-direction: column;
  316. justify-content: space-between;
  317. .avg {
  318. height: 23rpx;
  319. display: flex;
  320. align-items: center;
  321. margin-top: 8rpx;
  322. span {
  323. font-size: 32rpx;
  324. color: #FD4912;
  325. margin-left: 10rpx;
  326. }
  327. }
  328. span {
  329. display: block;
  330. height: 49rpx;
  331. font-size: 34rpx;
  332. color: #53CC48;
  333. line-height: 40rpx;
  334. }
  335. }
  336. }
  337. .address {
  338. margin-top: 32rpx;
  339. border-bottom: 1px solid #eee;
  340. padding-bottom: 16rpx;
  341. .area {
  342. height: 39rpx;
  343. font-size: 26rpx;
  344. color: #333333;
  345. line-height: 30rpx;
  346. }
  347. .details {
  348. display: flex;
  349. justify-content: space-between;
  350. span {
  351. display: block;
  352. width: 534rpx;
  353. font-size: 24rpx;
  354. color: #666666;
  355. line-height: 28rpx;
  356. margin-top: 8rpx;
  357. }
  358. image {
  359. width: 48rpx;
  360. height: 48rpx;
  361. }
  362. }
  363. }
  364. .institution {
  365. height: 55rpx;
  366. font-size: 26rpx;
  367. color: #232832;
  368. border-bottom: 1px solid #eee;
  369. padding-bottom: 16rpx;
  370. margin-top: 16rpx;
  371. span {
  372. margin-left: 20rpx;
  373. }
  374. }
  375. }
  376. }
  377. .food {
  378. width: 100%;
  379. height: 112rpx;
  380. background: #FFFFFF;
  381. display: flex;
  382. justify-content: space-around;
  383. align-items: center;
  384. font-size: 28rpx;
  385. color: #FFFFFF;
  386. image {
  387. width: 40rpx;
  388. height: 40rpx;
  389. margin-right: 10rpx;
  390. }
  391. .business {
  392. width: 80%;
  393. height: 76rpx;
  394. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  395. border-radius: 12rpx;
  396. display: flex;
  397. justify-content: center;
  398. align-items: center;
  399. }
  400. .edit {
  401. width: 324rpx;
  402. height: 76rpx;
  403. background: linear-gradient(90deg, #FFA05B 0%, #FF7918 100%);
  404. border-radius: 12rpx;
  405. display: flex;
  406. justify-content: center;
  407. align-items: center;
  408. }
  409. }
  410. .popup {
  411. width: 100vw;
  412. height: 100vh;
  413. position: fixed;
  414. top: 0;
  415. left: 0;
  416. background: rgba(0, 0, 0, 0.4);
  417. display: flex;
  418. align-items: flex-end;
  419. .model {
  420. width: 100%;
  421. background-color: #fff;
  422. border-radius: 20rpx 20rpx 0rpx 0rpx;
  423. padding: 0rpx 24rpx;
  424. padding-bottom: 20rpx;
  425. .title {
  426. width: 100%;
  427. height: 86rpx;
  428. display: flex;
  429. align-items: center;
  430. justify-content: center;
  431. border-bottom: 1px solid #EEEEEE;
  432. position: relative;
  433. image {
  434. width: 40rpx;
  435. height: 40rpx;
  436. position: absolute;
  437. right: 0px;
  438. }
  439. }
  440. .btnList {
  441. width: 100%;
  442. min-height: 250rpx;
  443. border-bottom: 1px solid #EEEEEE;
  444. padding-top: 24rpx;
  445. .box {
  446. display:grid;
  447. grid-template-columns: repeat(3, 1fr);
  448. gap: 20rpx;
  449. .btn {
  450. width: 196rpx;
  451. height: 66rpx;
  452. border-radius: 4rpx;
  453. border: 1px solid #C2C2C2;
  454. display: flex;
  455. align-items: center;
  456. justify-content: center;
  457. font-size: 26rpx;
  458. position: relative;
  459. image {
  460. width: 24rpx;
  461. height: 24rpx;
  462. position: absolute;
  463. top: 0;
  464. right: 0;
  465. }
  466. }
  467. .select {
  468. background: rgba(68, 154, 255, 0.1);
  469. border: 1px solid #449AFF;
  470. color: #2983EC;
  471. }
  472. }
  473. .affirm {
  474. width: 100%;
  475. font-size: 24rpx;
  476. color: #666666;
  477. line-height: 28rpx;
  478. text-align: center;
  479. margin-top: 24rpx;
  480. }
  481. }
  482. .sub {
  483. display: flex;
  484. justify-content: space-between;
  485. margin-top: 16rpx;
  486. .cancel {
  487. width: 205rpx;
  488. height: 76rpx;
  489. border-radius: 54rpx;
  490. border: 1px solid #CCCCCC;
  491. font-size: 28rpx;
  492. color: #999999;
  493. display: flex;
  494. align-items: center;
  495. justify-content: center;
  496. }
  497. .submit {
  498. width: 443rpx;
  499. height: 76rpx;
  500. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  501. border-radius: 53rpx;
  502. display: flex;
  503. align-items: center;
  504. justify-content: center;
  505. font-size: 28rpx;
  506. color: #FFFFFF;
  507. }
  508. }
  509. }
  510. }
  511. .res {
  512. display: flex;
  513. align-items: center;
  514. justify-content: center;
  515. .content {
  516. width: 570rpx;
  517. background: #FFFFFF;
  518. border-radius: 16rpx;
  519. padding: 0px 24rpx;
  520. padding-bottom: 16rpx;
  521. .title {
  522. width: 100%;
  523. height: 86rpx;
  524. font-size: 32rpx;
  525. color: #333333;
  526. font-weight: 600;
  527. border-bottom: 1px solid #EEEEEE;
  528. display: flex;
  529. align-items: center;
  530. justify-content: center;
  531. }
  532. .center {
  533. font-size: 30rpx;
  534. color: #333333;
  535. line-height: 35rpx;
  536. display: flex;
  537. flex-direction: column;
  538. align-items: center;
  539. justify-content: center;
  540. padding-top: 28rpx;
  541. border-bottom: 1px solid #EEEEEE;
  542. padding-bottom: 40rpx;
  543. margin-bottom: 16rpx;
  544. image {
  545. width: 100rpx;
  546. height: 100rpx;
  547. margin-bottom: 10rpx;
  548. }
  549. }
  550. .btn {
  551. width: 320rpx;
  552. height: 68rpx;
  553. border-radius: 66rpx;
  554. font-size: 28rpx;
  555. color: #FFFFFF;
  556. display: flex;
  557. align-items: center;
  558. justify-content: center;
  559. margin: 0rpx auto;
  560. }
  561. .start {
  562. background: #53CC48;
  563. }
  564. .close {
  565. background: #449AFF;
  566. }
  567. .rest {
  568. background: #FF8024;
  569. }
  570. }
  571. }
  572. }
  573. </style>