index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <view :data-theme="theme" :style="{ 'background-image': `linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 40%),url(${store.mer_banner})` }"
  3. class="store-detail">
  4. <tui-skeleton v-if="skeletonShow"></tui-skeleton>
  5. <view class="sectionBox">
  6. <view class="section head">
  7. <image :src="merchantAPPInfo.avatar"></image>
  8. <view class="text-wrap">
  9. <view class="name line1 acea-row row-middle">
  10. <text class="name_store">{{ merchantAPPInfo.name }}</text>
  11. <text v-if="store.typeId" class="merType ml8 bg-color">{{ store.typeId | merchantTypeFilter }}</text>
  12. <text v-else-if="store.isSelf" class="merType bg-color ml8">自营</text>
  13. </view>
  14. <view class="fans">
  15. {{ store.followerNum < 10000 ? store.followerNum + '人关注' : (store.followerNum / 10000).toFixed(2) + '万' + '人关注' }}
  16. </view>
  17. </view>
  18. <button hover-class="none" class="merCollect" :class="!store.isCollect ? 'care' : ''" @click="followToggle">
  19. <text v-show="store.isCollect" class="iconfont icon-guanzhu"></text>
  20. {{ store.isCollect ? '已关注' : '关注' }}
  21. </button>
  22. </view>
  23. <view class="section wrap">
  24. <view class="name">店铺评级</view>
  25. <view class="score-wrap">
  26. <view class="score">
  27. <view class='starsList'>
  28. <block v-for="(itemn, indexn) in merchantAPPInfo.starLevel" :key="indexn">
  29. <text class='iconfont icon-pingfen font-color'></text>
  30. </block>
  31. <block v-show="Number(merchantAPPInfo.starLevel)<5">
  32. <text v-for="(itemn, indexn) in (5-Number(merchantAPPInfo.starLevel))" :key="indexn" class='iconfont icon-pingfen'
  33. style="color: #BBBBBB;"></text>
  34. </block>
  35. <text class="font-color">{{merchantAPPInfo.starLevel}}</text>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="section wrap" @click="popupShow = true">
  41. <view class="name">店铺资质</view>
  42. <view><text class="iconfont icon-zizhizhengjian"></text></view>
  43. </view>
  44. <view class="section wrap" @click="call">
  45. <view class="name">联系客服</view>
  46. <view><text class="iconfont icon-kefu-mendian"></text></view>
  47. </view>
  48. <view class="section info">
  49. <view class="item very">
  50. <view class="name">店铺简介</view>
  51. <view class="value">{{ store.intro }}</view>
  52. </view>
  53. <view class="item very">
  54. <view class="acea-row" style="flex: 1;">
  55. <view class="name">店铺地址</view>
  56. <view class="value">{{ store.addressDetail }}</view>
  57. </view>
  58. <view v-if="store.latitude && store.longitude " class="iconfont icon-dingwei font-color" @click="showMaoLocation(store.latitude, store.longitude)"></view>
  59. </view>
  60. <view class="item">
  61. <view class="name">开店时间</view>
  62. <view class="value">{{ store.createTime | dateFormat }}</view>
  63. </view>
  64. </view>
  65. <view :class="{ mask: popupShow }" @click="popupShow = false"></view>
  66. <view :class="{ 'popup-active': popupShow }" class="popup-qrcode">
  67. <view class="name">资质图片</view>
  68. <template v-for="(item,index) in qualificationPicture">
  69. <image :src="item" @click='getpreviewImage(index)'></image>
  70. </template>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. // +----------------------------------------------------------------------
  77. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  78. // +----------------------------------------------------------------------
  79. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  80. // +----------------------------------------------------------------------
  81. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  82. // +----------------------------------------------------------------------
  83. // | Author: CRMEB Team <admin@crmeb.com>
  84. // +----------------------------------------------------------------------
  85. import {
  86. mapGetters
  87. } from 'vuex';
  88. import {
  89. getMerDetailApi
  90. } from '@/api/merchant.js';
  91. import {
  92. chatConfig
  93. } from '@/utils/consumerType.js'
  94. import {
  95. followMer
  96. } from '@/libs/follow.js';
  97. import tuiSkeleton from '@/components/base/tui-skeleton.vue';
  98. let app = getApp();
  99. export default {
  100. computed: mapGetters(['isLogin', 'uid', 'merchantAPPInfo', 'merchantType']),
  101. components: {
  102. tuiSkeleton
  103. },
  104. data() {
  105. return {
  106. skeletonShow: true,
  107. merid: 0,
  108. store: {},
  109. score: 0,
  110. star: 0,
  111. popupShow: false,
  112. storeCode: '',
  113. openSettingBtnHidden: true, //是否授权
  114. qualificationPicture: [],
  115. theme: app.globalData.theme
  116. };
  117. },
  118. onLoad: function(options) {
  119. this.merid = options.merId;
  120. this.getStore();
  121. },
  122. onReady: function() {
  123. },
  124. mounted: function() {
  125. if (!this.merchantAPPInfo) this.getMerIndexInfo()
  126. },
  127. methods: {
  128. //商户信息
  129. async getMerIndexInfo() {
  130. let {
  131. data
  132. } = await getMerIndexInfoApi(this.merid)
  133. this.$store.commit('MERCHANTJINFO', data);
  134. },
  135. //查看地图
  136. showMaoLocation(lat, long) {
  137. if (!lat || !long)
  138. return this.$util.Tips({
  139. title: '请设置允许商城访问您的位置!'
  140. });
  141. //#ifdef H5
  142. if (this.$wechat.isWeixin() === true) {
  143. this.$wechat
  144. .seeLocation({
  145. latitude: Number(lat),
  146. longitude: Number(long),
  147. name: this.store.name,
  148. address: this.store.addressDetail ? this.store.addressDetail : ''
  149. })
  150. .then(res => {
  151. console.log('success');
  152. });
  153. } else {
  154. //#endif
  155. uni.openLocation({
  156. latitude: parseFloat(lat),
  157. longitude: parseFloat(long),
  158. scale: 8,
  159. geocode: true,
  160. name: this.store.name,
  161. address: this.store.addressDetail ? this.store.addressDetail : '',
  162. success: function(res) {
  163. console.log(res);
  164. }
  165. });
  166. // #ifdef H5
  167. }
  168. //#endif
  169. },
  170. // 设置是否关注
  171. followToggle: function() {
  172. if (this.isLogin === false) {
  173. toLogin();
  174. } else {
  175. followMer(this.store.isCollect, this.merid).then(() => {
  176. this.$set(this.store, 'isCollect', !this.store.isCollect);
  177. let merchantInfo = {
  178. ...this.merchantAPPInfo
  179. }
  180. merchantInfo.isCollect = !merchantInfo.isCollect
  181. this.$store.commit('MERCHANTJINFO', {
  182. ...merchantInfo
  183. });
  184. });
  185. }
  186. },
  187. returns() {
  188. uni.navigateBack()
  189. },
  190. call: function() {
  191. chatConfig(this.$Cache.getItem('merchantAPPInfo'));
  192. },
  193. getpreviewImage: function(indexw) {
  194. uni.previewImage({
  195. urls: this.qualificationPicture,
  196. current: this.qualificationPicture[indexw]
  197. });
  198. },
  199. getStore: function() {
  200. getMerDetailApi(this.merid).then(res => {
  201. let store = res.data;
  202. this.store = store;
  203. this.qualificationPicture = JSON.parse(store.qualificationPicture)
  204. this.score = (parseFloat(store.postage_score) + parseFloat(store.product_score) +
  205. parseFloat(store.service_score)) / 3;
  206. this.star = (this.score / 5) * 100;
  207. this.skeletonShow = false
  208. });
  209. }
  210. }
  211. };
  212. </script>
  213. <style lang="scss" scoped>
  214. .care {
  215. color: #666666 !important;
  216. border: 1px solid #CCCCCC;
  217. background: inherit !important;
  218. }
  219. .score {
  220. display: flex;
  221. align-items: center;
  222. margin-top: 8rpx;
  223. font-weight: 500;
  224. font-size: 24rpx;
  225. line-height: 1;
  226. .iconfont {
  227. font-size: 20rpx;
  228. }
  229. }
  230. .ml8 {
  231. margin-left: 8rpx;
  232. margin-right: 0;
  233. }
  234. .store-detail {
  235. background: left top/750rpx 360rpx no-repeat fixed;
  236. .sectionBox {
  237. padding: 30rpx 24rpx;
  238. }
  239. .section {
  240. border-radius: 20rpx;
  241. margin-bottom: 20rpx;
  242. background-color: #ffffff;
  243. }
  244. .head {
  245. display: flex;
  246. align-items: center;
  247. padding: 20rpx;
  248. image {
  249. width: 90rpx;
  250. height: 90rpx;
  251. border-radius: 6rpx;
  252. }
  253. .text-wrap {
  254. flex: 1;
  255. min-width: 0;
  256. margin-right: 20rpx;
  257. margin-left: 20rpx;
  258. line-height: 1;
  259. .name {
  260. font-weight: bold;
  261. font-size: 28rpx;
  262. color: #333;
  263. .name_store {
  264. display: inline-block;
  265. overflow: hidden;
  266. white-space: nowrap;
  267. text-overflow: ellipsis;
  268. max-width: 140px;
  269. }
  270. .isSelf {
  271. padding: 3rpx;
  272. border-radius: 6rpx;
  273. }
  274. }
  275. .fans {
  276. margin-top: 15rpx;
  277. font-weight: 500;
  278. font-size: 22rpx;
  279. color: #666666;
  280. }
  281. }
  282. .followed {
  283. border: 1rpx solid #bfbfbf;
  284. background: none;
  285. color: #999999;
  286. }
  287. }
  288. .wrap {
  289. display: flex;
  290. align-items: center;
  291. padding: 32rpx 20rpx;
  292. .name {
  293. flex: 1;
  294. min-width: 0;
  295. font-weight: 400;
  296. font-size: 28rpx;
  297. color: #282828;
  298. }
  299. .score-wrap {
  300. display: flex;
  301. align-items: center;
  302. font-weight: 500;
  303. font-size: 28rpx;
  304. }
  305. .iconfont {
  306. font-size: 36rpx;
  307. }
  308. .icon-pingfen {
  309. margin-right: 6rpx;
  310. font-size: 23rpx;
  311. color: #666666;
  312. }
  313. .active {
  314. @include main_bg_color(theme);
  315. }
  316. }
  317. .info {
  318. .item {
  319. display: flex;
  320. align-items: center;
  321. padding: 30rpx 20rpx;
  322. border: 1rpx solid #f5f5f5;
  323. font-weight: normal;
  324. font-size: 28rpx;
  325. color: #282828;
  326. justify-content: flex-start;
  327. .name {
  328. margin-right: 16rpx;
  329. // width: 176rpx;
  330. }
  331. .value {
  332. font-size: 30rpx;
  333. font-family: PingFangSC-Regular, PingFang SC;
  334. font-weight: 400;
  335. color: #999999;
  336. line-height: 40rpx;
  337. width: 486rpx;
  338. word-break: break-all;
  339. }
  340. }
  341. .very {
  342. .name {
  343. align-self: flex-start;
  344. }
  345. }
  346. }
  347. .popup-qrcode {
  348. position: fixed;
  349. top: 50%;
  350. left: 50%;
  351. z-index: 99;
  352. width: 544rpx;
  353. padding-top: 48rpx;
  354. padding-bottom: 36rpx;
  355. border-radius: 24rpx;
  356. background-color: #ffffff;
  357. transform: translate(-50%, -50%) scale(0);
  358. opacity: 0;
  359. transition: 0.3s;
  360. line-height: 1;
  361. text-align: center;
  362. color: #282828;
  363. .name {
  364. max-width: 90%;
  365. margin-right: auto;
  366. margin-left: auto;
  367. font-weight: bold;
  368. font-size: 32rpx;
  369. }
  370. .info {
  371. margin-top: 24rpx;
  372. font-weight: 500;
  373. font-size: 24rpx;
  374. }
  375. image {
  376. width: 110rpx;
  377. height: 110rpx;
  378. margin-top: 18rpx;
  379. }
  380. }
  381. .popup-active {
  382. transform: translate(-50%, -50%) scale(1);
  383. opacity: 1;
  384. }
  385. }
  386. </style>