Storedetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="false" ><view class="div">
  3. <store-special-index v-show="special && special['store/index'+store.store_id]" :page-path="'store/index'" :item-id="''" v-if="store.store_name !=''" :store="store"></store-special-index>
  4. <view class="div container" v-show="!special || !special['store/index'+store.store_id]">
  5. <common-store-header v-if="!special || !special['store/index'+store.store_id] || special['store/index'+store.store_id]['editablePage']['editable_page_theme_config']['if_show_header']==1" :store="store"></common-store-header>
  6. <!--直播start-->
  7. <view class="div live-wrapper" v-if="store.live_apply_info" @click="goLive(store.live_apply_info.live_apply_id)">
  8. <view class="div box-wrapper v live-back-wrapper">
  9. <image mode="aspectFit" :src="store.live_apply_info.live_apply_cover_image_url" class="img live-back-image" />
  10. <view class="div box-wrapper v live-back-cover"></view>
  11. </view>
  12. <view class="div live-title">{{store.live_apply_info.live_apply_name}}</view>
  13. <view class="div box-wrapper h" style="align-items: flex-end">
  14. <view class="div box-wrapper v left">
  15. <view class="div box-wrapper v live-image">
  16. <video v-if="store.live_apply_info.live_apply_cover_video" :src="store.live_apply_info.live_apply_cover_video_url" muted="muted" autoplay="autoplay" loop="loop" />
  17. <image mode="aspectFit" class="img" v-else :src="store.live_apply_info.live_apply_cover_image_url">
  18. </view>
  19. </view>
  20. <view class="div box-wrapper v right">
  21. <view class="div box-wrapper v live-info">
  22. <view class="div box-wrapper v live-desc">
  23. <text class="span live-count">{{store.live_apply_info.live_apply_view_count}}次观看</text>
  24. <image mode="aspectFit" src="../../../static/image/live/live-state.png" class="img live-icon" />
  25. </view>
  26. </view>
  27. <view class="div goods-list">
  28. <view class="div box-wrapper h" v-if="store.live_apply_info.goods_list && store.live_apply_info.goods_list.length">
  29. <image mode="aspectFit" :src="store.live_apply_info.goods_list[0].goods_image_url" class="img goods-image" />
  30. <view class="div box-wrapper v goods-wrapper">
  31. <view class="div box-wrapper h goods-price">
  32. <text class="span">直播价:</text>
  33. <text class="span currency">¥</text>
  34. <text class="span price">{{store.live_apply_info.goods_list[0].goods_price}}</text>
  35. </view>
  36. <view class="div goods-btn">点击查看</view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="div live-btn-text">观看直播</view>
  43. </view>
  44. <!--直播end-->
  45. <swiper class="mt-5" v-if="store.mb_sliders && store.mb_sliders.length" :autoplay="true" v-bind:style="getBannerStyle" :indicator-dots="isShowIndicators">
  46. <swiper-item v-for="(item, index) in store.mb_sliders" :key="index">
  47. <image mode="aspectFit" class="img" :style="getBannerStyle" :src="item.imgUrl" @click="goAd(item)">
  48. </swiper-item>
  49. </swiper>
  50. <store-product-list
  51. :items="rec_goods_list"
  52. v-if="rec_goods_list && rec_goods_list.length > 0"
  53. ></store-product-list>
  54. <common-store-footer :store_id="store.store_id" v-if="!special || !special['store/index'+store.store_id] || special['store/index'+store.store_id]['editablePage']['editable_page_theme_config']['if_show_footer']==1"></common-store-footer>
  55. </view>
  56. </view></home-base>
  57. </template>
  58. <script>
  59. import {getFontSize} from '@/util/common'
  60. import { urlencode } from '@/util/common'
  61. import HomeBase from '../HomeBase'
  62. import { mapState, mapActions } from 'vuex'
  63. import StoreSpecialIndex from '../storespecial/Index'
  64. import CommonStoreHeader from '../common/CommonStoreHeader'
  65. import CommonStoreFooter from '../common/CommonStoreFooter'
  66. import { getStoreInfo } from '../../../api/homestoredetail'
  67. import { getChatCount } from '../../../api/memberInstantMessage'
  68. import StoreProductList from './StoreProductList'
  69. import HeaderMore from '../../HeaderMore'
  70. export default {
  71. name: 'Storedetail',
  72. data () {
  73. return {
  74. store: {
  75. store_id: '',
  76. store_name:''
  77. },
  78. rec_goods_list: false,
  79. popupVisible: false, // 弹出更多
  80. showDot: false
  81. }
  82. },
  83. components:{
  84. HomeBase,
  85. HeaderMore,
  86. StoreProductList,
  87. CommonStoreHeader,
  88. CommonStoreFooter,
  89. StoreSpecialIndex
  90. },
  91. computed:{
  92. fontSize(){
  93. return getFontSize()
  94. },
  95. ...mapState({
  96. special: state => state.home.special,
  97. config: state => state.config.config,
  98. token: state => state.member.token,
  99. isOnline: state => state.member.isOnline
  100. }),
  101. getBannerStyle: function () {
  102. const res = uni.getSystemInfoSync()
  103. var width = res.windowWidth
  104. var height = res.windowHeight
  105. let itemWidth = width
  106. let itemHeight = width * (1 / 4)
  107. return "width:"+itemWidth +"px;height:"+itemHeight +"px"
  108. },
  109. isShowIndicators () {
  110. if (this.store.mb_sliders && this.store.mb_sliders.length > 1) {
  111. return true
  112. }
  113. return false
  114. },
  115. },
  116. onShareAppMessage(res) {
  117. return {
  118. title: this.store.store_name,
  119. path: "/pages/home/storedetail/Storedetail?id="+this.store.store_id,
  120. imageUrl:this.store.store_avatar
  121. }
  122. },
  123. onShareTimeline(res) {
  124. return {
  125. title: this.store.store_name,
  126. path: "/pages/home/storedetail/Storedetail?id="+this.store.store_id,
  127. imageUrl:this.store.store_avatar
  128. }
  129. },
  130. onLoad: function (option) {
  131. this.store.store_id=option.id ? option.id : option.scene
  132. getStoreInfo(
  133. this.store.store_id, this.token
  134. ).then((res) => {
  135. this.store = res.result.store_info
  136. uni.setNavigationBarTitle({
  137. title: this.store.store_name
  138. })
  139. this.rec_goods_list = res.result.rec_goods_list
  140. if (this.store.is_platform_store) {
  141. this.fetchConfig({}).then(
  142. response => {
  143. },
  144. error => {
  145. uni.showToast({icon:'none',title: error.message})
  146. }
  147. )
  148. }
  149. }).catch(function (error) {
  150. })
  151. if (this.isOnline) {
  152. getChatCount().then(res => {
  153. if (res.result) {
  154. if (!this.showDot) {
  155. this.showDot = {}
  156. }
  157. this.showDot['chat'] = true
  158. }
  159. })
  160. }
  161. },
  162. methods:{
  163. goNavigate(path,query=false){
  164. uni.navigateTo({url:path+(query?('?'+urlencode(query)):'')})
  165. },
  166. showPopup(id){
  167. this.$refs[id].open()
  168. },
  169. hidePopup(id){
  170. this.$refs[id].close()
  171. },
  172. ...mapActions({
  173. fetchConfig: 'fetchConfig'
  174. }),
  175. goLive (live_apply_id) {
  176. uni.navigateTo({ url: '/pages/member/live/LiveDetail'+'?'+urlencode( { 'live_apply_id': live_apply_id } )})
  177. },
  178. goAd (item) {
  179. if (item.type === 2) {
  180. uni.navigateTo({ url: '/pages/home/goodsdetail/Goodsdetail'+'?'+urlencode( { goods_id: item.link } )})
  181. } else {
  182. uni.navigateTo({ url:item.link})
  183. }
  184. },
  185. // 弹出更多
  186. popupMore () {
  187. if (!this.popupVisible) {
  188. this.popupVisible = true
  189. } else {
  190. this.popupVisible = false
  191. }
  192. },
  193. }
  194. }
  195. </script>
  196. <style scoped lang="scss">
  197. .box-wrapper{box-sizing: border-box; display: flex;align-content: flex-start; flex-shrink: 0;}
  198. .box-wrapper.v{-webkit-box-orient: vertical; flex-direction: column; }
  199. .box-wrapper.h{-webkit-box-orient: horizontal; flex-direction: row;}
  200. .live-title{position: relative; display: block; font-size:$h2; width: 16rem; line-height: .75rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;margin-bottom:.5rem;}
  201. .box-wrapper .live-desc{position: relative; height: .75rem; }
  202. .box-wrapper .live-count{position: absolute; display: block; font-size:$fontSize;color:#55595F; left: 0px; top: 0px; height: .75rem; margin-left: 2.76rem; line-height: .75rem; }
  203. .box-wrapper .live-icon{display: flex; width: 2.46rem; height: .75rem;}
  204. .box-wrapper .live-btn-text{position: relative; display: block; font-size:$fontSize; color: rgb(255, 52, 103);}
  205. .box-wrapper .left{position: relative; width: 5.6rem; height: 5.6rem;}
  206. .box-wrapper .right{position: relative; flex: 1 1 0%; -webkit-box-flex: 1; margin-left: .5rem;}
  207. .box-wrapper .live-info{position: relative; margin-bottom: .5rem;}
  208. .box-wrapper .live-image{position: relative; height: 5.6rem; width: 5.6rem; border-radius: .3rem; overflow: hidden;background:#000}
  209. .box-wrapper .live-image .img{width:100%;height: 100%}
  210. .box-wrapper .live-image video{width:100%;height: 100%}
  211. .box-wrapper.live-back-wrapper{position: absolute; left: 0px; top: 0px; bottom:0;width: 100%; overflow: hidden;}
  212. .box-wrapper .live-back-image{display: flex; width: 100%; height: 100%; transform: scale(4); object-fit: cover;}
  213. .box-wrapper .live-back-cover{position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; background-color: rgba(255, 255, 255, 0.2);}
  214. .live-wrapper{position: relative; width: 100%; padding: .6rem; overflow: hidden;box-sizing: border-box;display: flex;flex-direction: column;align-items: center;}
  215. .live-btn-text{position: relative;z-index: 2;background: $primaryGradualColor;color:#fff;height: 1.5rem;line-height: 1.5rem;border-radius: 1rem;text-align: center;width:10rem;font-size:$subFontSize;margin:.5rem auto 0 auto;}
  216. .goods-list{background: #f1f1f1;border-radius:.4rem;overflow: hidden;width:10rem;
  217. .goods-image{width:4rem;height: 4rem;}
  218. .goods-wrapper{flex:1;justify-content: center;align-items: center;
  219. .goods-price{font-size:$fontSize;align-items: center;margin-bottom:.5rem;font-weight: 700;
  220. .currency{color:$primaryColor}
  221. .price{color:$primaryColor;
  222. white-space: nowrap;
  223. overflow: hidden;
  224. text-overflow: ellipsis;
  225. max-width: 3rem;}
  226. }
  227. }
  228. .goods-btn{border:1px solid $primaryColor;width:4rem;border-radius:1rem;height:1rem;line-height:1rem;color: $primaryColor;font-size:$fontSize;text-align: center;}
  229. }
  230. </style>