storeDetail.vue 4.5 KB

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