shop.vue 13 KB

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