index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="storeInfo" :style="colorStyle">
  3. <view class="headerBg">
  4. <image :src="storeInfo.background_image" mode="aspectFill" class="image"></image>
  5. <view class="shade"></view>
  6. <!-- #ifdef MP -->
  7. <view :style="{height: getHeight.barTop+'px'}"></view>
  8. <view :style="{height: getHeight.barHeight+'px'}"></view>
  9. <!-- #endif -->
  10. <view style="height: 224rpx;"></view>
  11. </view>
  12. <view class="container">
  13. <!-- #ifdef MP -->
  14. <NavBar titleText="店铺信息" textColor="#FFFFFF" iconColor="#FFFFFF" showBack></NavBar>
  15. <!-- #endif -->
  16. <view class="content">
  17. <view class="title-box">
  18. <image :src="storeInfo.image" class="logo"></image>
  19. <view class="title">{{storeInfo.name || ''}}</view>
  20. <view class="address">{{(storeInfo.address+storeInfo.detailed_address) || ''}}</view>
  21. </view>
  22. <view v-if="latitude" class="map-box">
  23. <map name="" style="width: 100%; height: 100%;" :scale="18" :latitude="latitude" :longitude="longitude" :markers="markers" @markertap="showMaoLocation"></map>
  24. </view>
  25. <view class="qrcode-box acea-row row-between row-middle">
  26. <view class="name">店铺二维码</view>
  27. <view class="value">
  28. <text class="iconfont icon-ic_QRcode" @click="dialogShow = true"></text>
  29. </view>
  30. </view>
  31. <view class="time-box">
  32. <view class="item acea-row">
  33. <view class="name">店铺简介</view>
  34. <view class="value">{{storeInfo.introduction}}</view>
  35. </view>
  36. <view class="item acea-row">
  37. <view class="name">营业时间</view>
  38. <view class="value">{{storeInfo.day_start}}-{{storeInfo.day_end}}</view>
  39. </view>
  40. <view class="item acea-row">
  41. <view class="name">所在地区</view>
  42. <view class="value">{{storeInfo.address}}</view>
  43. </view>
  44. <view class="item acea-row">
  45. <view class="name">联系电话</view>
  46. <view class="value">{{storeInfo.phone}}</view>
  47. </view>
  48. </view>
  49. </view>
  50. <navigator url="" open-type="navigateBack" hover-class="none" class="btn">查看全部商品</navigator>
  51. </view>
  52. <view v-if="dialogShow">
  53. <view class="mask"></view>
  54. <view class="dialog">
  55. <view class="title">{{storeInfo.name}}</view>
  56. <!-- #ifdef MP -->
  57. <image :src="storeInfo.qrcode.routine" class="image"></image>
  58. <!-- #endif -->
  59. <!-- #ifndef MP -->
  60. <image v-if="$wechat.isWeixin()" :src="storeInfo.qrcode.wechat" class="image"></image>
  61. <view class="acea-row row-center-wrapper" style="margin: 36rpx 0 22rpx;" v-else>
  62. <w-qrcode :options="config.qrc"></w-qrcode>
  63. </view>
  64. <!-- #endif -->
  65. <view class="tips">长按识别二维码进入店铺</view>
  66. <text class="iconfont icon-ic_close1" @click="dialogShow = false"></text>
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import NavBar from '@/components/NavBar.vue';
  73. import colors from '@/mixins/color.js';
  74. import {
  75. getStoreData
  76. } from '@/api/store.js';
  77. export default {
  78. components: {
  79. NavBar
  80. },
  81. mixins: [colors],
  82. data() {
  83. return {
  84. getHeight: this.$util.getWXStatusHeight(),
  85. store_id: 0,
  86. storeInfo: {
  87. latitude: 0,
  88. longitude: 0,
  89. day_start: '',
  90. day_end: '',
  91. },
  92. latitude: 0,
  93. longitude: 0,
  94. markers: [],
  95. dialogShow: false,
  96. config: {
  97. qrc: {
  98. code: '',
  99. size: 380, // 二维码大小
  100. level: 3, //等级 0~4
  101. bgColor: '#FFFFFF', //二维码背景色 默认白色
  102. border: {
  103. color: ['#eee', '#eee'], //边框颜色支持渐变色
  104. lineWidth: 3, //边框宽度
  105. },
  106. color: ['#333', '#333'], //边框颜色支持渐变色
  107. }
  108. },
  109. }
  110. },
  111. onLoad(options) {
  112. this.store_id = options.store_id;
  113. // #ifndef MP
  114. this.config.qrc.code = '/pages/store/home/index?id=' + options.store_id;
  115. // #endif
  116. this.getStoreData();
  117. },
  118. methods: {
  119. showMaoLocation() {
  120. let data = {
  121. latitude: Number(this.storeInfo.latitude),
  122. longitude: Number(this.storeInfo.longitude),
  123. name: this.storeInfo.name,
  124. address: `${this.storeInfo.address+this.storeInfo.detailed_address}`,
  125. };
  126. // #ifdef H5
  127. if (this.$wechat.isWeixin()) {
  128. data.scale = 13;
  129. return this.$wechat.seeLocation(data);
  130. }
  131. // #endif
  132. uni.openLocation(data);
  133. },
  134. getStoreData() {
  135. getStoreData({
  136. store_id: this.store_id
  137. }).then(res => {
  138. this.storeInfo = res.data;
  139. this.$nextTick(() => {
  140. this.latitude = res.data.latitude
  141. this.longitude = res.data.longitude
  142. this.markers = [{
  143. id: res.data.id,
  144. latitude: res.data.latitude,
  145. longitude: res.data.longitude,
  146. iconPath: '../static/marker-icon.png',
  147. width: 42,
  148. height: 42,
  149. callout: {
  150. content: res.data.name,
  151. bgColor: '#FFFFFF',
  152. padding: 6,
  153. borderRadius: 8,
  154. textAlign: 'center',
  155. display: 'ALWAYS'
  156. }
  157. }];
  158. })
  159. });
  160. }
  161. },
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .headerBg {
  166. position: absolute;
  167. top: 0;
  168. left: 0;
  169. width: 100%;
  170. .image {
  171. position: absolute;
  172. top: 0;
  173. left: 0;
  174. width: 100%;
  175. height: 100%;
  176. }
  177. .shade {
  178. position: absolute;
  179. top: 0;
  180. left: 0;
  181. width: 100%;
  182. height: 100%;
  183. background: linear-gradient(180deg, rgba(0, 0, 0, 0.4047) 0%, #F5F5F5 100%);
  184. }
  185. }
  186. .storeInfo {
  187. .container {
  188. position: relative;
  189. padding: 108rpx 20rpx 0;
  190. }
  191. .content {
  192. padding: 0 32rpx;
  193. border-radius: 16rpx;
  194. background: #FFFFFF;
  195. }
  196. .title-box {
  197. position: relative;
  198. // min-height: 176rpx;
  199. padding-top: 104rpx;
  200. padding-bottom: 32rpx;
  201. text-align: center;
  202. .logo {
  203. position: absolute;
  204. top: -68rpx;
  205. left: 50%;
  206. width: 132rpx;
  207. height: 132rpx;
  208. border-radius: 12rpx;
  209. transform: translateX(-50%);
  210. }
  211. .title {
  212. font-weight: 500;
  213. font-size: 32rpx;
  214. line-height: 44rpx;
  215. color: #333333;
  216. }
  217. .address {
  218. margin-top: 20rpx;
  219. font-size: 26rpx;
  220. line-height: 40rpx;
  221. color: #666666;
  222. }
  223. }
  224. .time-box {
  225. padding: 32rpx 0;
  226. .item {
  227. margin-top: 40rpx;
  228. font-size: 28rpx;
  229. line-height: 40rpx;
  230. &:first-child {
  231. margin-top: 0;
  232. }
  233. }
  234. .name {
  235. font-weight: 500;
  236. color: #333333;
  237. }
  238. .value {
  239. flex: 1;
  240. min-width: 0;
  241. padding-left: 32rpx;
  242. color: #666666;
  243. }
  244. }
  245. .qrcode-box {
  246. padding: 40rpx 0 32rpx;
  247. border-bottom: 2rpx solid #F8F8F8;
  248. line-height: 46rpx;
  249. .name {
  250. font-weight: 500;
  251. font-size: 28rpx;
  252. color: #333333;
  253. }
  254. .iconfont {
  255. font-size: 38rpx;
  256. color: #333333;
  257. }
  258. }
  259. .map-box {
  260. height: 352rpx;
  261. border-radius: 16rpx;
  262. background: #DFDFDF;
  263. overflow: hidden;
  264. }
  265. .btn {
  266. height: 88rpx;
  267. border-radius: 16rpx;
  268. margin-top: 20rpx;
  269. background: #FFFFFF;
  270. text-align: center;
  271. font-size: 28rpx;
  272. line-height: 88rpx;
  273. color: var(--view-theme);
  274. }
  275. .dialog {
  276. position: fixed;
  277. top: 50%;
  278. right: 65rpx;
  279. left: 65rpx;
  280. z-index: 6;
  281. max-width: 620rpx;
  282. padding: 60rpx 0 42rpx;
  283. border-radius: 24rpx;
  284. background: #FFFFFF;
  285. transform: translateY(-50%);
  286. .title {
  287. text-align: center;
  288. font-weight: 500;
  289. font-size: 32rpx;
  290. line-height: 44rpx;
  291. color: #333333;
  292. }
  293. .image {
  294. display: block;
  295. width: 420rpx;
  296. height: 420rpx;
  297. margin: 36rpx auto 22rpx;
  298. }
  299. .tips {
  300. text-align: center;
  301. font-size: 26rpx;
  302. line-height: 36rpx;
  303. color: #999999;
  304. }
  305. .iconfont {
  306. position: absolute;
  307. bottom: -108rpx;
  308. left: 50%;
  309. transform: translateX(-50%);
  310. font-size: 60rpx;
  311. color: #CCCCCC;
  312. }
  313. }
  314. }
  315. w-qrcode {}
  316. </style>