BrandInfo.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view class="brand-info-container">
  3. <view style="display: flex;justify-content: space-between;align-items: center;font-size: 36upx;font-weight: bold;">
  4. <view>{{ brandDetail.shopName || '--' }}</view>
  5. <view style="display: flex;align-items: center;">
  6. <BeeIcon
  7. :name="brandDetail.ifCollect ? 'star-fill' : 'star'" :size="22"
  8. :color="brandDetail.ifCollect ? '#ff8000' : '#222229'" @click="handleCollectToggle"
  9. ></BeeIcon>
  10. <BeeWxShare ref="beeWxShareRef" @click="handleShareServe()">
  11. <BeeIcon
  12. :src="require('../../../../static/images/new-brand/detail/share.png')" :size="22"
  13. style="margin-left: 24upx;"
  14. ></BeeIcon>
  15. </BeeWxShare>
  16. </view>
  17. </view>
  18. <view style="display: flex;justify-content: space-between;align-items: center;">
  19. <view style="flex: 1;width: 0;margin-right: 10upx;">
  20. <view style="padding-top: 6upx;font-size: 24upx;">
  21. <tui-rate active="#e02208" :size="14" disabled :current="brandDetail.score || 0"></tui-rate>
  22. <text style="margin-left: 8upx;color: #e02208;font-size: 26upx;">{{ brandDetail.score || 0 }}</text>
  23. <text style="color: #777777;margin-left: 18upx;">销量 {{ brandDetail.monthlySales }}</text>
  24. <text style="color: #000000;margin-left: 16upx;">人均{{ brandDetail.perCapita || ':--' }}</text>
  25. <text style="color: #777777;margin-left: 20upx;">粉丝数 {{ brandDetail.fansNumber }}</text>
  26. </view>
  27. <view v-if="brandDetail.voucherReturn || brandDetail.isVoucher" class="tags">
  28. <view v-if="brandDetail.voucherReturn" class="tag">补贴代金券{{ brandDetail.voucherReturn || 0 }}%</view>
  29. <view v-if="brandDetail.isVoucher" class="tag">支持代金券</view>
  30. </view>
  31. </view>
  32. <view style="display: flex;flex-direction: column;align-items: center;" @click="handleOpenCustomerService">
  33. <tui-icon name="people-fill" :size="48" unit="rpx" color="#9aedbe"></tui-icon>
  34. <text style="font-size: 26upx;color: #8e8e8e;">联系商家</text>
  35. </view>
  36. </view>
  37. <view style="display: flex;align-items: center;margin-top: 10upx;">
  38. <BeeIcon name="clock" :size="18" color="#888889" style="width: fit-content;"></BeeIcon>
  39. <view style="margin-left: 18upx;font-size: 28upx;color: #222229;">营业状态</view>
  40. <view style="margin-left: 20upx;font-size: 28upx;color: #E02208;">{{ brandDetail.trade || '未知' }}</view>
  41. <view style="margin-left: 18upx;padding: 2upx 18upx;font-size: 24upx;background-color: #f5f4f6;">
  42. {{ brandDetail.startTime }} 至 {{ brandDetail.endTime }}
  43. </view>
  44. </view>
  45. <view v-if="brandDetail.shopLogo" style="margin-top: 22upx;">
  46. <!-- 轮播图 -->
  47. <swiper
  48. autoplay :interval="3000" circular :previous-margin="previousMargin"
  49. :next-margin="nextMargin"
  50. :duration="1000" style="height: 328upx;" @change="handleSwiperChange"
  51. >
  52. <swiper-item>
  53. <tui-lazyload-img
  54. mode="scaleToFill" width="600rpx" height="100%" radius="20upx"
  55. :src="common.seamingImgUrl(brandDetail.shopLogo)"
  56. ></tui-lazyload-img>
  57. </swiper-item>
  58. <template v-if="brandDetail.advertisement">
  59. <swiper-item v-for="(item, index) in brandDetail.advertisement.split(',')" :key="index">
  60. <tui-lazyload-img
  61. mode="scaleToFill" width="600rpx" height="100%" radius="20upx"
  62. :src="common.seamingImgUrl(item)"
  63. ></tui-lazyload-img>
  64. </swiper-item>
  65. </template>
  66. </swiper>
  67. </view>
  68. <!-- <scroll-view v-if="brandDetail.bgUrl" scroll-x="true">
  69. <view>
  70. <tui-lazyload-img
  71. v-for="(img, index) in JSON.parse(brandDetail.bgUrl)" :key="index"
  72. mode="scaleToFill" width="250rpx" height="210rpx"
  73. :radius="!index ? '20rpx 0 0 20rpx' : index === JSON.parse(brandDetail.bgUrl).length - 1 ? '0 20rpx 20rpx 0' : ''"
  74. :src="common.seamingImgUrl(img)"
  75. ></tui-lazyload-img>
  76. </view>
  77. </scroll-view> -->
  78. <view class="address-info">
  79. <view class="address-detail-info">
  80. <view>
  81. <BeeIcon :size="18" color="#888889" name="gps"></BeeIcon>
  82. </view>
  83. <view class="address-text-wrapper">
  84. <view class="address-text">{{ brandDetail.shopAdress }}</view>
  85. <view style="font-weight: bold;color: #e02208;" class="address-text">
  86. 距您{{ brandDetail.distance || 0 }}Km
  87. </view>
  88. </view>
  89. </view>
  90. <view class="op-menus">
  91. <BeeMakePhone :phone="brandDetail.chargePersonPhone">
  92. <view class="item">
  93. <BeeIcon :size="20" color="#e02208" name="voipphone"></BeeIcon>
  94. <text>电话</text>
  95. </view>
  96. </BeeMakePhone>
  97. <view class="item" @click="$emit('navgation')">
  98. <BeeIcon :size="20" color="#e02208" name="revoke"></BeeIcon>
  99. <text>去这</text>
  100. </view>
  101. </view>
  102. </view>
  103. <tui-bottom-popup :show="isShowCustomerServicePopup" @close="isShowCustomerServicePopup = false">
  104. <ATFCustomerService :shop-id="shopId" :data="customerServiceList"></ATFCustomerService>
  105. </tui-bottom-popup>
  106. </view>
  107. </template>
  108. <script>
  109. import { A_TF_MAIN } from '../../../../config'
  110. import { updateCollectCancelApi, updateCollectToCollectApi } from '../../../../api/anotherTFInterface'
  111. export default {
  112. name: 'BrandInfo',
  113. props: {
  114. brandDetail: {
  115. type: Object,
  116. required: true
  117. }
  118. },
  119. data() {
  120. return {
  121. previousMargin: '0',
  122. nextMargin: '80rpx',
  123. shopId: '',
  124. // 客服
  125. isShowCustomerServicePopup: false,
  126. customerServiceList: []
  127. }
  128. },
  129. watch: {
  130. brandDetail: {
  131. handler(newV) {
  132. if (newV.shopId) {
  133. this.shopId = newV.shopId
  134. // #ifdef H5
  135. this.$nextTick(() => {
  136. this.handleShareServe(true)
  137. })
  138. // #endif
  139. }
  140. },
  141. immediate: true,
  142. deep: true
  143. }
  144. },
  145. methods: {
  146. // handleToConnectStore() {
  147. // if (!this.brandDetail.userId || !this.brandDetail.name) return this.$showToast('缺少商家信息')
  148. // this.go(`/user/otherServe/chat/chat-detail?chat=${this.brandDetail.userId}&name=${this.brandDetail.name}&avatar=${this.brandDetail.picUrl}`)
  149. // },
  150. // 收藏店辅
  151. handleCollectToggle() {
  152. uni.showLoading()
  153. if (this.brandDetail.ifCollect == 0) {
  154. updateCollectToCollectApi({
  155. shopId: parseInt(this.brandDetail.shopId)
  156. })
  157. .then(() => {
  158. uni.hideLoading()
  159. this.$showToast('收藏成功')
  160. this.$emit('refresh')
  161. })
  162. .catch(() => {
  163. uni.hideLoading()
  164. })
  165. } else {
  166. updateCollectCancelApi({
  167. ids: [ this.brandDetail.collectId ]
  168. })
  169. .then(() => {
  170. uni.hideLoading()
  171. this.$showToast('取消收藏成功')
  172. this.$emit('refresh')
  173. })
  174. .catch(() => {
  175. uni.hideLoading()
  176. })
  177. }
  178. },
  179. // 分享
  180. handleShareServe(isQuit) {
  181. if (!this.isLogin()) return
  182. const data = {
  183. data: {
  184. title: `团蜂社区商圈 - ${this.brandDetail.shopName}`,
  185. desc: this.brandDetail.shopBrief,
  186. link: `${A_TF_MAIN}/#/another-tf/another-user/shop/shop-detail?shopId=${this.brandDetail.shopId}`,
  187. imageUrl: this.common.seamingImgUrl(this.brandDetail.shopLogo)
  188. },
  189. successCb: () => { },
  190. failCb: () => { }
  191. }
  192. this.$refs.beeWxShareRef.share(data, isQuit)
  193. },
  194. handleSwiperChange(e) {
  195. if (this.brandDetail.advertisement && this.brandDetail.advertisement.split(',').length === 1) {
  196. console.log(e)
  197. if (e.detail.current === 1) {
  198. this.nextMargin = '0'
  199. this.previousMargin = '80rpx'
  200. } else {
  201. this.nextMargin = '80rpx'
  202. this.previousMargin = '0'
  203. }
  204. }
  205. },
  206. // 打开客服
  207. async handleOpenCustomerService() {
  208. const res = await this.$store.dispatch('app/getCustomerServiceAction', {
  209. shopId: this.brandDetail.shopId
  210. })
  211. this.customerServiceList = res.data
  212. if (!this.customerServiceList.length) this.$showToast('暂无客服')
  213. }
  214. }
  215. }
  216. </script>
  217. <style lang="less" scoped>
  218. .brand-info-container {
  219. // padding: 28upx 34upx;
  220. box-sizing: border-box;
  221. /deep/ .tui-popup-class.tui-bottom-popup {
  222. height: 85vh !important;
  223. }
  224. .tags {
  225. display: flex;
  226. align-items: center;
  227. flex-wrap: wrap;
  228. margin: 10upx 0 0 0;
  229. .tag {
  230. font-size: 26upx;
  231. margin-right: 12upx;
  232. margin-bottom: 10upx;
  233. padding: 4upx 12upx;
  234. background-color: #ff8000;
  235. color: #ffffff;
  236. border-radius: 10upx;
  237. }
  238. }
  239. .address-info {
  240. display: flex;
  241. align-items: center;
  242. width: 100%;
  243. margin-top: 24upx;
  244. .address-detail-info {
  245. flex: 1;
  246. display: flex;
  247. width: 0;
  248. font-size: 26upx;
  249. .address-text-wrapper {
  250. flex: 1;
  251. width: 0;
  252. margin-left: 10upx;
  253. .address-text {
  254. margin-bottom: 6upx;
  255. overflow: hidden;
  256. white-space: nowrap;
  257. text-overflow: ellipsis;
  258. color: #888889;
  259. font-weight: 500;
  260. }
  261. }
  262. }
  263. .op-menus {
  264. display: flex;
  265. align-items: center;
  266. .item {
  267. display: flex;
  268. align-items: center;
  269. flex-direction: column;
  270. margin-left: 30upx;
  271. text {
  272. font-size: 24upx;
  273. color: #888889;
  274. margin-top: 4upx;
  275. white-space: nowrap;
  276. }
  277. }
  278. }
  279. }
  280. }
  281. </style>