shop.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  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="'http://192.168.0.36:8080/jeecg-boot/'+shopData.headPhoto" mode=""></image>
  19. </view>
  20. <view class="name">
  21. {{shopData.storeName}}
  22. <view class="avg">
  23. <u-rate :count="count" v-model="shopData.commentGradeAvg" active-icon="heart-fill" inactive-icon="heart"
  24. :disabled="true"></u-rate>
  25. <span>{{shopData.commentGradeAvg}}分</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="c">
  85. <view class="title">
  86. <span v-if="shopStatus == 1">正常营业</span>
  87. <span v-if="shopStatus == 3">门店歇业</span>
  88. <span v-if="shopStatus == 2">关闭门店</span>
  89. </view>
  90. <view class="center">
  91. <image src="/static/index/start.png" mode="" v-if="shopStatus == 1"></image>
  92. <image src="/static/index/close.png" mode="" v-if="shopStatus == 2"></image>
  93. <image src="/static/index/rest.png" mode="" v-if="shopStatus == 3"></image>
  94. <span v-if="shopStatus == 1">恭喜发财,开业大吉!</span>
  95. <span v-if="shopStatus == 2">当前门店关闭成功</span>
  96. <span v-if="shopStatus == 3">当前门店已歇业</span>
  97. <view class="error" v-if="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.navigateBack({
  143. delta: 1
  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. }
  162. })
  163. } else if (this.currentIndex == 1) {
  164. let data = {
  165. id: this.id,
  166. merchantStatus: 3
  167. }
  168. this.$http.post("/merchant/localMerchantInfo/editStatus", data).then(res => {
  169. if (res.data.code == 200) {
  170. this.isPopup = false
  171. this.getShopData()
  172. this.isSuccess = true
  173. }
  174. })
  175. } else if (this.currentIndex == 2) {
  176. let data = {
  177. id: this.id,
  178. merchantStatus: 2
  179. }
  180. this.$http.post("/merchant/localMerchantInfo/editStatus", data).then(res => {
  181. if (res.data.code == 200) {
  182. this.isPopup = false
  183. this.getShopData()
  184. this.isSuccess = true
  185. }
  186. })
  187. }
  188. },
  189. getShopData() {
  190. this.$http.get("/merchant/localMerchantInfo/queryById?id=" + this.id).then(res => {
  191. if (res.data.code == 200) {
  192. this.shopData = res.data.result
  193. this.shopStatus = res.data.result.merchantStatus
  194. this.currentStatus()
  195. }
  196. })
  197. },
  198. currentStatus() {
  199. if (this.shopStatus == 1) {
  200. this.currentIndex = 0
  201. this.dynamicClass = 'start'
  202. } else if (this.shopStatus == 2) {
  203. this.currentIndex = 2
  204. this.dynamicClass = 'close'
  205. } else if (this.shopStatus == 3) {
  206. this.currentIndex = 1
  207. this.dynamicClass = 'rest'
  208. }
  209. },
  210. closePopup() {
  211. this.isPopup = false
  212. this.currentStatus()
  213. }
  214. },
  215. mounted() {
  216. this.getShopData()
  217. },
  218. onShow() {
  219. let that = this
  220. uni.getStorage({
  221. key: 'login_user_info',
  222. success: function(res) {
  223. that.id = res.data.merchantId
  224. }
  225. })
  226. }
  227. }
  228. </script>
  229. <style lang="scss" scoped>
  230. page {
  231. width: 100%;
  232. height: 100%;
  233. }
  234. .shop {
  235. width: 100%;
  236. height: 100%;
  237. background: #F7F8FC;
  238. display: flex;
  239. flex-direction: column;
  240. justify-content: space-between;
  241. /*#ifdef APP-PLUS*/
  242. .top {
  243. width: 100%;
  244. height: var(--status-bar-height);
  245. background: linear-gradient(180deg, #FFF9F1 0%, #FFFFFF 100%);
  246. }
  247. /*#endif*/
  248. .head {
  249. width: 100%;
  250. height: 112rpx;
  251. padding: 20rpx;
  252. display: flex;
  253. align-items: center;
  254. background: linear-gradient(180deg, #FFF9F1 0%, #FFFFFF 100%);
  255. position: relative;
  256. .cuIcon-back {
  257. font-size: 40rpx;
  258. margin-right: 40rpx;
  259. }
  260. .case {
  261. position: absolute;
  262. left: 50%;
  263. transform: translateX(-50%);
  264. font-size: 36rpx;
  265. font-weight: 600;
  266. }
  267. }
  268. .center {
  269. width: 100%;
  270. flex: 1;
  271. padding: 0px 24rpx;
  272. .data {
  273. width: 100%;
  274. background: #FFFFFF;
  275. box-shadow: 0px 2rpx 8rpx 0px rgba(214, 225, 237, 0.1);
  276. border-radius: 16rpx;
  277. margin: 20rpx auto;
  278. padding: 20rpx 16rpx;
  279. .title {
  280. font-size: 28rpx;
  281. position: relative;
  282. margin-bottom: 16rpx;
  283. span {
  284. display: block;
  285. width: 108rpx;
  286. height: 5rpx;
  287. background: linear-gradient(90deg, #88BFFF 0%, #449AFF 100%);
  288. border-radius: 8rpx;
  289. position: absolute;
  290. bottom: 5rpx;
  291. }
  292. }
  293. .content {
  294. display: flex;
  295. height: 140rpx;
  296. .img {
  297. margin-right: 20rpx;
  298. width: 140rpx;
  299. height: 140rpx;
  300. image {
  301. width: 140rpx;
  302. height: 140rpx;
  303. }
  304. }
  305. .name {
  306. height: 100%;
  307. font-size: 32rpx;
  308. font-weight: 600;
  309. display: flex;
  310. flex-direction: column;
  311. justify-content: space-between;
  312. .avg {
  313. height: 23rpx;
  314. display: flex;
  315. align-items: center;
  316. margin-top: 8rpx;
  317. span {
  318. font-size: 32rpx;
  319. color: #FD4912;
  320. margin-left: 10rpx;
  321. }
  322. }
  323. span {
  324. display: block;
  325. height: 49rpx;
  326. font-size: 34rpx;
  327. color: #53CC48;
  328. line-height: 40rpx;
  329. }
  330. }
  331. }
  332. .address {
  333. margin-top: 32rpx;
  334. border-bottom: 1px solid #eee;
  335. padding-bottom: 16rpx;
  336. .area {
  337. height: 39rpx;
  338. font-size: 26rpx;
  339. color: #333333;
  340. line-height: 30rpx;
  341. }
  342. .details {
  343. display: flex;
  344. justify-content: space-between;
  345. span {
  346. display: block;
  347. width: 534rpx;
  348. font-size: 24rpx;
  349. color: #666666;
  350. line-height: 28rpx;
  351. margin-top: 8rpx;
  352. }
  353. image {
  354. width: 48rpx;
  355. height: 48rpx;
  356. }
  357. }
  358. }
  359. .institution {
  360. height: 55rpx;
  361. font-size: 26rpx;
  362. color: #232832;
  363. border-bottom: 1px solid #eee;
  364. padding-bottom: 16rpx;
  365. margin-top: 16rpx;
  366. span {
  367. margin-left: 20rpx;
  368. }
  369. }
  370. }
  371. }
  372. .food {
  373. width: 100%;
  374. height: 112rpx;
  375. background: #FFFFFF;
  376. display: flex;
  377. justify-content: space-around;
  378. align-items: center;
  379. font-size: 28rpx;
  380. color: #FFFFFF;
  381. image {
  382. width: 40rpx;
  383. height: 40rpx;
  384. margin-right: 10rpx;
  385. }
  386. .business {
  387. width: 324rpx;
  388. height: 76rpx;
  389. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  390. border-radius: 12rpx;
  391. display: flex;
  392. justify-content: center;
  393. align-items: center;
  394. }
  395. .edit {
  396. width: 324rpx;
  397. height: 76rpx;
  398. background: linear-gradient(90deg, #FFA05B 0%, #FF7918 100%);
  399. border-radius: 12rpx;
  400. display: flex;
  401. justify-content: center;
  402. align-items: center;
  403. }
  404. }
  405. .popup {
  406. width: 100vw;
  407. height: 100vh;
  408. position: fixed;
  409. top: 0;
  410. left: 0;
  411. background: rgba(0, 0, 0, 0.4);
  412. display: flex;
  413. align-items: flex-end;
  414. .model {
  415. width: 100%;
  416. background-color: #fff;
  417. border-radius: 20rpx 20rpx 0rpx 0rpx;
  418. padding: 0rpx 24rpx;
  419. padding-bottom: 20rpx;
  420. .title {
  421. width: 100%;
  422. height: 86rpx;
  423. display: flex;
  424. align-items: center;
  425. justify-content: center;
  426. border-bottom: 1px solid #EEEEEE;
  427. position: relative;
  428. image {
  429. width: 40rpx;
  430. height: 40rpx;
  431. position: absolute;
  432. right: 0px;
  433. }
  434. }
  435. .btnList {
  436. width: 100%;
  437. height: 193rpx;
  438. border-bottom: 1px solid #EEEEEE;
  439. padding-top: 24rpx;
  440. .box {
  441. display: flex;
  442. justify-content: space-between;
  443. .btn {
  444. width: 196rpx;
  445. height: 66rpx;
  446. border-radius: 4rpx;
  447. border: 1px solid #C2C2C2;
  448. display: flex;
  449. align-items: center;
  450. justify-content: center;
  451. font-size: 26rpx;
  452. position: relative;
  453. image {
  454. width: 24rpx;
  455. height: 24rpx;
  456. position: absolute;
  457. top: 0;
  458. right: 0;
  459. }
  460. }
  461. .select {
  462. background: rgba(68, 154, 255, 0.1);
  463. border: 1px solid #449AFF;
  464. color: #2983EC;
  465. }
  466. }
  467. .affirm {
  468. width: 100%;
  469. font-size: 24rpx;
  470. color: #666666;
  471. line-height: 28rpx;
  472. text-align: center;
  473. margin-top: 24rpx;
  474. }
  475. }
  476. .sub {
  477. display: flex;
  478. justify-content: space-between;
  479. margin-top: 16rpx;
  480. .cancel {
  481. width: 205rpx;
  482. height: 76rpx;
  483. border-radius: 54rpx;
  484. border: 1px solid #CCCCCC;
  485. font-size: 28rpx;
  486. color: #999999;
  487. display: flex;
  488. align-items: center;
  489. justify-content: center;
  490. }
  491. .submit {
  492. width: 443rpx;
  493. height: 76rpx;
  494. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  495. border-radius: 53rpx;
  496. display: flex;
  497. align-items: center;
  498. justify-content: center;
  499. font-size: 28rpx;
  500. color: #FFFFFF;
  501. }
  502. }
  503. }
  504. }
  505. .res {
  506. display: flex;
  507. align-items: center;
  508. justify-content: center;
  509. .content {
  510. width: 570rpx;
  511. background: #FFFFFF;
  512. border-radius: 16rpx;
  513. padding: 0px 24rpx;
  514. padding-bottom: 16rpx;
  515. .title {
  516. width: 100%;
  517. height: 86rpx;
  518. font-size: 32rpx;
  519. color: #333333;
  520. font-weight: 600;
  521. border-bottom: 1px solid #EEEEEE;
  522. display: flex;
  523. align-items: center;
  524. justify-content: center;
  525. }
  526. .center {
  527. font-size: 30rpx;
  528. color: #333333;
  529. line-height: 35rpx;
  530. display: flex;
  531. flex-direction: column;
  532. align-items: center;
  533. justify-content: center;
  534. padding-top: 28rpx;
  535. border-bottom: 1px solid #EEEEEE;
  536. padding-bottom: 40rpx;
  537. margin-bottom: 16rpx;
  538. image {
  539. width: 100rpx;
  540. height: 100rpx;
  541. margin-bottom: 10rpx;
  542. }
  543. }
  544. .btn {
  545. width: 320rpx;
  546. height: 68rpx;
  547. border-radius: 66rpx;
  548. font-size: 28rpx;
  549. color: #FFFFFF;
  550. display: flex;
  551. align-items: center;
  552. justify-content: center;
  553. margin: 0rpx auto;
  554. }
  555. .start {
  556. background: #53CC48;
  557. }
  558. .close {
  559. background: #449AFF;
  560. }
  561. .rest {
  562. background: #FF8024;
  563. }
  564. }
  565. }
  566. }
  567. </style>