activityDetails.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view class="content">
  3. <view class="banner-box" >
  4. <view class="inner">
  5. <swiper
  6. class="swiper"
  7. :autoplay="true"
  8. :interval="3000"
  9. :duration="1000"
  10. >
  11. <swiper-item class="swiper-item" v-for="(item,index) in images" :key="index" >
  12. <image :src="item" mode=""></image>
  13. </swiper-item>
  14. </swiper>
  15. </view>
  16. </view>
  17. <view class="share">
  18. <view class="item">
  19. <view class="name">
  20. 已有{{activity.shareNumber}}人分享
  21. </view>
  22. <view class="btn">
  23. 分享
  24. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="inner">
  29. <view v-html="activity.content" style="font-size:0"></view>
  30. </view>
  31. <view class="product">
  32. <view>
  33. <special-banner :banner-list="productList" v-on:selectBanner="selectProduct" :swiper-config="swiperConfig"></special-banner>
  34. </view>
  35. <!-- <view class="list">
  36. <scroll-view scroll-y="true" style="height: 500rpx;" >
  37. <view class="medic-list">
  38. <view v-for="(item,index) in products" :key="index" class="item" @click="showDetail(item)">
  39. <view class="img-box">
  40. <image :src="item.image" mode="aspectFit"></image>
  41. </view>
  42. <view class="info-box">
  43. <view class="title ellipsis2">{{item.productName}}</view>
  44. <view class="intro ellipsis">{{item.productInfo}}</view>
  45. <view class="prce-num">
  46. <view class="price">
  47. <text class="unit">¥</text>
  48. <text class="num">{{item.price.toFixed(2)}} </text>
  49. </view>
  50. <view class="cart-img" @click="navgetTo('../shopping/cart')">
  51. <view class="sale">已售 {{item.sales}} {{item.unitName}}</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </scroll-view>
  58. </view> -->
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import { getStoreActivityDetails,share } from '@/api/activity'
  64. import specialBanner from '../components/specialBanner.vue'
  65. export default {
  66. components: {
  67. specialBanner
  68. },
  69. data: function() {
  70. return {
  71. activityId:null,
  72. products:[],
  73. activity:null,
  74. images:[],
  75. productList:[],
  76. swiperConfig: {
  77. indicatorDots: true,
  78. indicatorColor: 'rgba(255, 255, 255, .4)',
  79. indicatorActiveColor: 'rgba(255, 255, 255, 1)',
  80. autoplay: false,
  81. interval: 3000,
  82. duration: 300,
  83. circular: true,
  84. previousMargin: '58rpx',
  85. nextMargin: '58rpx'
  86. }
  87. }
  88. },
  89. onLoad: function(options) {
  90. this.activityId=options.activityId;
  91. this.getStoreActivityDetails();
  92. // uni.setStorageSync(this.activityId,null);
  93. },
  94. onShareAppMessage(res) {
  95. this.share();
  96. return {
  97. title: this.activity.title,
  98. path: '/pages_shopping/shopping/activityDetails?activityId='+this.activity.activityId,
  99. imageUrl: this.activity.logoUrl //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  100. }
  101. },
  102. //分享到朋友圈
  103. onShareTimeline(res) {
  104. this.share();
  105. return {
  106. title: this.activity.title,
  107. query:'',//页面参数
  108. imageUrl: this.activity.logoUrl //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  109. }
  110. },
  111. methods: {
  112. selectProduct(item){
  113. console.log(item);
  114. uni.navigateTo({
  115. url: '../../pages/shopping/productDetails?productId='+item.id
  116. })
  117. },
  118. showDetail(item) {
  119. uni.navigateTo({
  120. url: '../../pages/shopping/productDetails?productId='+item.productId
  121. })
  122. },
  123. getStoreActivityDetails() {
  124. var that=this;
  125. let data = { activityId: this.activityId }
  126. getStoreActivityDetails(data).then(res => {
  127. this.activity=res.activity;
  128. this.products=res.products;
  129. this.products.forEach (function (value) {
  130. var item={
  131. picture: value.image,
  132. title: value.productName,
  133. description:value.keyword,
  134. id: value.productId,
  135. obj:value
  136. }
  137. that.productList.push(item)
  138. });
  139. this.images=res.activity.images.split(',')
  140. uni.setNavigationBarTitle({
  141. title: this.activity.title
  142. });
  143. })
  144. },
  145. share() {
  146. share(this.activityId).then(res => {
  147. })
  148. },
  149. },
  150. }
  151. </script>
  152. <style lang="less" scoped>
  153. .content{
  154. position: relative;
  155. .banner-box{
  156. .inner{
  157. width: 100%;
  158. height: 400upx;
  159. overflow: hidden;
  160. .swiper,
  161. .swiper-item,
  162. .swiper-item image{
  163. width: 100%;
  164. height: 100%;
  165. }
  166. }
  167. }
  168. .share{
  169. display: flex;
  170. align-items: center;
  171. justify-content: center;
  172. background-color: #c8f2ee;
  173. .item{
  174. width: 100%;
  175. display: flex;
  176. align-items: center;
  177. justify-content: flex-start;
  178. background-color: #fff;
  179. border-radius: 15rpx;
  180. padding: 15rpx;
  181. margin: 15rpx;
  182. }
  183. .name{
  184. margin-left: 10rpx;
  185. flex: 1;
  186. font-size: 28upx;
  187. font-family: PingFang SC;
  188. font-weight: 500;
  189. color: #b5b5b5;
  190. }
  191. .btn{
  192. margin-right: 15rpx;
  193. border-radius: 10rpx;
  194. padding: 10rpx 30rpx;
  195. background-color: #FF6633;
  196. font-size: 28upx;
  197. font-family: PingFang SC;
  198. font-weight: 500;
  199. color: #fff;
  200. position: relative;
  201. .share{
  202. display: inline-block;
  203. position: absolute;
  204. top: 0;
  205. left: 0;
  206. width: 100%;
  207. height: 100%rpx;
  208. opacity: 0;
  209. }
  210. }
  211. }
  212. .product{
  213. position: fixed;
  214. bottom: 120rpx;
  215. left:0rpx;
  216. .list{
  217. display: flex;
  218. background-color: #fff;
  219. border-radius: 15rpx;
  220. margin: 15rpx;
  221. padding: 15rpx;
  222. .medic-list{
  223. .item{
  224. box-sizing: border-box;
  225. background: #FFFFFF;
  226. border: 4upx solid #FFFFFF;
  227. border-radius: 16upx;
  228. padding: 20upx 30upx;
  229. display: flex;
  230. .img-box{
  231. width: 200upx;
  232. height: 200upx;
  233. margin-right: 30upx;
  234. image{
  235. width: 100%;
  236. height: 100%;
  237. }
  238. }
  239. .info-box{
  240. width: calc(100% - 210upx);
  241. .title{
  242. font-size: 32upx;
  243. font-family: PingFang SC;
  244. font-weight: 500;
  245. color: #111111;
  246. line-height: 40rpx;
  247. height: 80rpx;
  248. }
  249. .intro{
  250. font-size: 26upx;
  251. font-family: PingFang SC;
  252. font-weight: 500;
  253. color: #999999;
  254. line-height: 1;
  255. margin-top: 26upx;
  256. }
  257. .prce-num{
  258. display: flex;
  259. align-items: center;
  260. justify-content: space-between;
  261. margin-top: 30upx;
  262. .price{
  263. display: flex;
  264. align-items: flex-end;
  265. .unit{
  266. font-size: 24upx;
  267. font-family: PingFang SC;
  268. font-weight: 500;
  269. color: #FF6633;
  270. line-height: 1.2;
  271. margin-right: 4upx;
  272. }
  273. .num{
  274. font-size: 36upx;
  275. font-family: PingFang SC;
  276. font-weight: bold;
  277. color: #FF6633;
  278. line-height: 1;
  279. }
  280. }
  281. .cart-img{
  282. .sale{
  283. font-size: 20upx;
  284. font-family: PingFang SC;
  285. color: #999999;
  286. }
  287. }
  288. }
  289. }
  290. }
  291. }
  292. }
  293. }
  294. }
  295. </style>