storeDetail.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="content">
  3. <template v-if="store">
  4. <view class="top">
  5. <image :src="store.image" mode="" class="store-img"></image>
  6. <view class="right">
  7. <view class="store-name clamp">{{ store.name }}</view>
  8. <view class="store-content clamp2">{{ store.introduction }}</view>
  9. </view>
  10. </view>
  11. <view class="jg"></view>
  12. <view class="store-info">
  13. <view class="title">门店地址/营业时间</view>
  14. <view class="info-box">
  15. <view class="item">
  16. <image src="../../static/icon/adress.png" mode="" class="item-img"></image>
  17. <view class="item-msg">{{ store.detailed_address }}</view>
  18. </view>
  19. <view class="item">
  20. <image src="../../static/icon/daytime.png" mode="" class="item-img"></image>
  21. <view class="item-msg">营业时间{{ store.day_time }}</view>
  22. </view>
  23. <view class="item">
  24. <image src="../../static/icon/phone.png" mode="" class="item-img"></image>
  25. <view class="item-msg">{{ store.phone }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <empty v-if="!store && loaded"></empty>
  31. <view class="edit-btn" @click="eidt()" v-if="store && loaded && store.is_show">编辑信息</view>
  32. <view class="edit-btn" v-if="store.is_show == 0" style="background-color: #999999;">门店审核中</view>
  33. <view class="edit-btn" @click="add()" v-if="!store && loaded">添加门店</view>
  34. </view>
  35. </template>
  36. <script>
  37. import empty from '@/components/empty';
  38. import { getStoreInfo } from '@/api/index.js';
  39. import { orderData, getUserInfo, getMyStore } from '@/api/user.js';
  40. export default {
  41. components: {
  42. empty
  43. },
  44. data() {
  45. return {
  46. canEdit: false,
  47. store: '',
  48. loaded: false
  49. };
  50. },
  51. onLoad(opt) {
  52. if (opt.id) {
  53. this.store_id = opt.id;
  54. this.getStoreInfo();
  55. } else {
  56. this.getMyStore();
  57. }
  58. },
  59. methods: {
  60. navTo(url) {
  61. uni.navigateTo({
  62. url: url
  63. });
  64. },
  65. getStoreInfo() {
  66. uni.showLoading({
  67. title: '加载中...',
  68. mask: true
  69. });
  70. getStoreInfo({
  71. id: this.store_id
  72. })
  73. .then(({ data }) => {
  74. uni.hideLoading();
  75. this.store = data;
  76. })
  77. .catch(err => {
  78. console.log(err);
  79. });
  80. },
  81. getMyStore() {
  82. getMyStore().then(({ data }) => {
  83. if (data.length == 0) {
  84. this.loaded = true;
  85. } else {
  86. this.store = data[0];
  87. this.loaded = true;
  88. }
  89. });
  90. },
  91. eidt() {
  92. let str = JSON.stringify(this.store);
  93. console.log(str);
  94. uni.navigateTo({
  95. url: '/pages/store/storeMessage?type=edit&item=' + str
  96. });
  97. },
  98. add() {
  99. uni.navigateTo({
  100. url: '/pages/store/storeMessage?type=add'
  101. });
  102. },
  103. //添加或修改成功之后回调
  104. refreshList() {
  105. // 重新加载地址
  106. this.getMyStore();
  107. }
  108. }
  109. };
  110. </script>
  111. <style lang="scss" scoped>
  112. page {
  113. height: 100%;
  114. background-color: #fff;
  115. }
  116. .top {
  117. height: 198rpx;
  118. display: flex;
  119. padding: 30rpx 25rpx 36rpx;
  120. .store-img {
  121. width: 132rpx;
  122. height: 132rpx;
  123. flex-shrink: 0;
  124. }
  125. .right {
  126. padding-left: 20rpx;
  127. .store-name {
  128. padding: 5rpx 0;
  129. font-size: 36rpx;
  130. font-family: PingFang SC;
  131. font-weight: bold;
  132. color: #333333;
  133. }
  134. .store-title {
  135. font-size: 20rpx;
  136. font-family: PingFang SC;
  137. font-weight: 400;
  138. color: #999999;
  139. line-height: 25rpx;
  140. }
  141. }
  142. }
  143. .jg {
  144. height: 20rpx;
  145. background-color: #f8f6f6;
  146. }
  147. .store-info {
  148. padding: 28rpx 30rpx 0;
  149. height: 100%;
  150. .title {
  151. font-size: 32rpx;
  152. font-family: PingFang SC;
  153. font-weight: 500;
  154. color: #333333;
  155. line-height: 55rpx;
  156. }
  157. .info-box {
  158. margin-top: 30rpx;
  159. width: 690rpx;
  160. min-height: 301rpx;
  161. border: 2px solid #dddddd;
  162. border-radius: 10rpx;
  163. padding: 40rpx 40rpx 0rpx;
  164. .item {
  165. display: flex;
  166. padding-bottom: 40rpx;
  167. image {
  168. margin-top: 6rpx;
  169. margin-right: 20rpx;
  170. height: 28rpx;
  171. width: 28rpx;
  172. flex-shrink: 0;
  173. }
  174. .item-msg {
  175. font-size: 29rpx;
  176. font-family: PingFang SC;
  177. font-weight: 500;
  178. color: #333333;
  179. line-height: 40rpx;
  180. }
  181. }
  182. }
  183. }
  184. .edit-btn {
  185. position: fixed;
  186. bottom: 34rpx;
  187. left: 0;
  188. right: 0;
  189. margin: 0 auto;
  190. width: 674rpx;
  191. // height: 88rpx;
  192. background: #ff4c4c;
  193. border-radius: 44rpx;
  194. text-align: center;
  195. line-height: 88rpx;
  196. font-size: 36rpx;
  197. font-family: PingFang SC;
  198. font-weight: 500;
  199. color: #ffffff;
  200. }
  201. </style>