Storeabout.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="false" ><view class="div container">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar title="店铺资料" class="common-header" left-icon="back" @clickLeft="goBack()">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <view class="div header">
  13. <view class="div header-wrapper">
  14. <view class="div content-wrapper">
  15. <view class="div avatar">
  16. <image mode="aspectFit" class="img" :src="store.store_avatar">
  17. </view>
  18. <view class="div content">
  19. <view class="div store_name">{{store.store_name}}</view>
  20. <view class="div follow_number">已经有{{store.store_collect}}人收藏</view>
  21. </view>
  22. <view class="div follow_panel" :class="{'active':store.is_favorate}">
  23. <view class="div follow_button" @click="toggleFavorite" >
  24. <text class="i iconfont" v-if="!store.is_favorate">&#xe64e;</text>
  25. {{favoriteName}}
  26. </view>
  27. </view>
  28. </view>
  29. <view class="div store_credit">
  30. <view class="ul">
  31. <view class="li">
  32. <text class="span text">{{deliverycredit_text}}</text>
  33. <text class="span credit store_deliverycredit">{{deliverycredit_credit}}分</text>
  34. </view>
  35. <view class="li">
  36. <text class="span text">{{desccredit_text}}</text>
  37. <text class="span credit store_desccredit">{{desccredit_credit}}分</text>
  38. </view>
  39. <view class="li">
  40. <text class="span text">{{servicecredit_text}}</text>
  41. <text class="span credit store_servicecredit">{{servicecredit_credit}}分</text>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="div info-wrapper">
  46. <view class="div info-item">
  47. <view class="div item price">{{ store.goods_count }}</view>
  48. <view class="div item">全部商品</view>
  49. </view>
  50. <view class="div info-item">
  51. <view class="div item price">{{ store.seller_name }}</view>
  52. <view class="div item">店铺掌柜</view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="div shopping-about">
  57. <flex-line :show-border="true" @click.native="showPopup('imageVisible')">
  58. <text class="span">店铺二维码</text>
  59. <text slot="right" class="span right-icon iconfont">&#xe6e0;</text>
  60. </flex-line>
  61. <text class="a" @click="makePhoneCall(store.store_phone)" :href="'tel:'+ store.store_phone">
  62. <flex-line :show-border="true">
  63. <text class="span">商家电话</text>
  64. <text slot="right" class="span right-icon iconfont">&#xe6d1;</text>
  65. </flex-line>
  66. </text>
  67. </view>
  68. <view class="div store_info mt-5">
  69. <flex-line :show-border="true"><text class="span line-name">公司名称</text><text class="span" slot="right">{{store.store_company_name}}</text></flex-line>
  70. <flex-line :show-border="true"><text class="span line-name">公司地区</text><text class="span" slot="right">{{store.area_info}}</text></flex-line>
  71. <flex-line :show-border="true"><text class="span line-name">主营商品</text><text class="span" slot="right">{{store.store_mainbusiness}}</text></flex-line>
  72. <flex-line :show-border="true"><text class="span line-name">店铺QQ</text><text class="span" slot="right">{{store.store_qq}}</text></flex-line>
  73. <flex-line :show-border="true"><text class="span line-name">店铺旺旺</text><text class="span" slot="right">{{store.store_ww}}</text></flex-line>
  74. </view>
  75. </view>
  76. <uni-popup background-color="#fff" ref="imageVisible" class="middle-popup">
  77. <text class="h4">{{store.store_name}}</text>
  78. <view class="div img-new-box"><image mode="aspectFit" class="img" :src="qrcodeurl"></view>
  79. <view class="p">邀请好友扫一扫分享店铺给TA</view>
  80. </uni-popup>
  81. </view></home-base>
  82. </template>
  83. <script>
  84. import {getFontSize} from '@/util/common'
  85. import TitleHeader from '../../TitleHeader'
  86. import HomeBase from '../HomeBase'
  87. import { mapState, mapActions } from 'vuex'
  88. import CommonStoreFooter from '../common/CommonStoreFooter'
  89. import { getStoreInfo } from '../../../api/homestoredetail'
  90. import { addFavoriteStore, delFavoriteStore } from '../../../api/memberFavorite'
  91. import flexLine from '../../flexLine'
  92. import { env } from '../../../static/config'
  93. export default {
  94. name: 'Storeabout',
  95. mounted(){
  96. // #ifdef MP-WEIXIN
  97. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  98. // #endif
  99. },
  100. data(){
  101. return {
  102. navHeight: 0,
  103. store: {
  104. store_id: ''
  105. },
  106. rec_goods_list: false,
  107. popupVisible: false, // 弹出更多
  108. showDot: false,
  109. deliverycredit_text: '',
  110. deliverycredit_credit: 0,
  111. desccredit_text: '',
  112. desccredit_credit: 0,
  113. servicecredit_text: '',
  114. servicecredit_credit: 0,
  115. qrcodeurl: ''
  116. }
  117. },
  118. components:{
  119. TitleHeader,
  120. HomeBase,
  121. flexLine,
  122. CommonStoreFooter
  123. },
  124. computed:{
  125. fontSize(){
  126. return getFontSize()
  127. },
  128. ...mapState({
  129. config: state => state.config.config,
  130. token: state => state.member.token,
  131. isOnline: state => state.member.isOnline
  132. }),
  133. favoriteName () {
  134. return this.store.is_favorate ? '已收藏' : '收藏'
  135. }
  136. },
  137. onLoad: function (option) {
  138. this.store.store_id=option.id ? option.id : ''
  139. getStoreInfo(
  140. this.store.store_id, this.token
  141. ).then((res) => {
  142. this.store = res.result.store_info
  143. this.qrcodeurl = env.API_HOST + '/index/getQrcode?url=' + encodeURIComponent(env.H5_HOST + 'pages/home/storedetail/Storedetail?id=' + this.store.store_id)
  144. this.rec_goods_list = res.result.rec_goods_list
  145. this.deliverycredit_text = res.result.store_info.store_credit.store_deliverycredit.text
  146. this.deliverycredit_credit = res.result.store_info.store_credit.store_deliverycredit.credit
  147. this.desccredit_text = res.result.store_info.store_credit.store_desccredit.text
  148. this.desccredit_credit = res.result.store_info.store_credit.store_desccredit.credit
  149. this.servicecredit_text = res.result.store_info.store_credit.store_servicecredit.text
  150. this.servicecredit_credit = res.result.store_info.store_credit.store_servicecredit.credit
  151. if (this.store.is_platform_store) {
  152. this.fetchConfig({}).then(
  153. response => {
  154. },
  155. error => {
  156. uni.showToast({icon:'none',title: error.message})
  157. }
  158. )
  159. }
  160. }).catch(function (error) {
  161. })
  162. },
  163. methods:{
  164. showPopup(id){
  165. this.$refs[id].open()
  166. },
  167. hidePopup(id){
  168. this.$refs[id].close()
  169. },
  170. goBack(){uni.navigateBack({delta:1})},
  171. ...mapActions({
  172. fetchConfig: 'fetchConfig'
  173. }),
  174. // 弹出更多
  175. popupMore () {
  176. if (!this.popupVisible) {
  177. this.popupVisible = true
  178. } else {
  179. this.popupVisible = false
  180. }
  181. },
  182. makePhoneCall(store_phone){
  183. uni.makePhoneCall({
  184. phoneNumber:store_phone
  185. })
  186. },
  187. toggleFavorite () {
  188. if (!this.store.is_favorate) {
  189. addFavoriteStore(this.store.store_id).then(
  190. response => {
  191. uni.showToast({icon:'none',title: response.message})
  192. this.store.is_favorate = !this.store.is_favorate
  193. },
  194. error => {
  195. uni.showToast({icon:'none',title: error.message})
  196. }
  197. )
  198. } else {
  199. delFavoriteStore(this.store.store_id).then(
  200. response => {
  201. uni.showToast({icon:'none',title: response.message})
  202. this.store.is_favorate = !this.store.is_favorate
  203. },
  204. error => {
  205. uni.showToast({icon:'none',title: error.message})
  206. }
  207. )
  208. }
  209. }
  210. }
  211. }
  212. </script>
  213. <style scoped lang="scss">
  214. .header {overflow: hidden;position: relative;background-position: center;background-size: auto 100%;}
  215. .header .content-wrapper {-ms-flex-align: center;-webkit-box-align: center;align-items: center;display: -webkit-box;display: -ms-flexbox;display: flex;padding:0.8rem 0.5rem;position: relative;background: #fff}
  216. .header .content-wrapper .avatar {-ms-flex: 0 0 3rem;-webkit-box-flex: 0;flex: 0 0 3rem;margin-right:0.4rem;width:3rem; border: 1px solid #efefef;}
  217. .header .content-wrapper .avatar .img {border-radius:0.1rem;width:3rem;height:3rem;}
  218. .header .content-wrapper .content {position:relative;width:8rem;height:3rem;margin-left: .5rem}
  219. .header .content-wrapper .content .store_name {font-size:$h2;;margin-bottom:.4rem;font-weight: 700}
  220. .header .content-wrapper .content .follow_number{line-height:0.7rem;font-size:$fontSize;margin-top:0.1rem;color: #999}
  221. .follow_panel{position:absolute;top:1rem;right:$pageSpace;}
  222. .follow_panel .follow_button{display:block;background:$primaryColor;border:1px solid #fff;border-radius:2.5rem;padding:0 0.4rem;line-height:1.2rem;font-size:$fontSize;color:#fff;width:2.4rem;text-align: center}
  223. .follow_panel .follow_button .i{line-height:1.2rem;}
  224. .store_credit{background: #fff;padding: 0px .5rem 2rem;}
  225. .store_credit .ul .li{display: inline-block;width: 33%;text-align: center}
  226. .store_credit .ul .li .text{font-size:$fontSize}
  227. .store_credit .ul .li .credit{font-size:$fontSize;margin-left: .2rem;color:$primaryColor}
  228. .header-wrapper{position: relative;box-shadow: 0px 4px 4px #f7f7f7;}
  229. .info-wrapper {
  230. position: absolute;
  231. bottom:-2rem;
  232. left:1.5rem;
  233. right:1.5rem;
  234. display: inline-flex;
  235. flex-direction: row;
  236. justify-content: flex-start;
  237. align-content: stretch;
  238. background-color: $primaryColor;
  239. border-radius: .4rem;
  240. z-index: 2;
  241. }
  242. .info-item {
  243. flex: 1;
  244. text-align: center;
  245. font-size: $fontSize;
  246. color:#fff;
  247. position: relative;
  248. &:first-child::after{content:'';position: absolute;top:.5rem;bottom:.5rem;right:0;border-right: 1px dashed rgba(255,255,255,.5);}
  249. .item{padding-top:.5rem;padding-bottom:.5rem;}
  250. .price{font-size:$h2;padding-bottom:0}
  251. }
  252. .shopping-about{background: #fff;padding:0 $pageSpace;padding-top:2.5rem;
  253. .right-icon{font-size:$mainFontSize;color:$formInputColor;}
  254. }
  255. .store_info {background: #fff;padding:0 $pageSpace;}
  256. .header .background {-webkit-filter: blur(0.5rem);filter: blur(0.5rem);height: 100%;left: 0;position: absolute;top: 0;width: 100%;z-index: -1;}
  257. .middle-popup .h4{ font-size:$h3; text-align: center; padding: .6rem; border: 1px solid #eee; color: #444;display: block;}
  258. .middle-popup .img-new-box{background: #fff; padding: .75rem; margin: .5rem .65rem;height: auto}
  259. .middle-popup .img-new-box .img{width: 100%;height: 6rem;}
  260. .middle-popup .p{font-size:$fontSize;color: #777; text-align: center; padding: .4rem; border-top: 1px solid #eee;}
  261. </style>