activityDetails.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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. uni.navigateTo({
  114. url: '../../pages/shopping/productDetails?productId='+item.id
  115. })
  116. },
  117. showDetail(item) {
  118. uni.navigateTo({
  119. url: '../../pages/shopping/productDetails?productId='+item.productId
  120. })
  121. },
  122. getStoreActivityDetails() {
  123. var that=this;
  124. let data = { activityId: this.activityId }
  125. getStoreActivityDetails(data).then(res => {
  126. this.activity=res.activity;
  127. this.products=res.products;
  128. this.products.forEach (function (value) {
  129. var item={
  130. picture: value.image,
  131. title: value.productName,
  132. description:value.keyword,
  133. id: value.productId,
  134. obj:value
  135. }
  136. that.productList.push(item)
  137. });
  138. this.images=res.activity.images.split(',')
  139. uni.setNavigationBarTitle({
  140. title: this.activity.title
  141. });
  142. })
  143. },
  144. share() {
  145. share(this.activityId).then(res => {
  146. })
  147. },
  148. },
  149. }
  150. </script>
  151. <style lang="less" scoped>
  152. .content{
  153. position: relative;
  154. .banner-box{
  155. .inner{
  156. width: 100%;
  157. height: 400upx;
  158. overflow: hidden;
  159. .swiper,
  160. .swiper-item,
  161. .swiper-item image{
  162. width: 100%;
  163. height: 100%;
  164. }
  165. }
  166. }
  167. .share{
  168. display: flex;
  169. align-items: center;
  170. justify-content: center;
  171. background-color: #c8f2ee;
  172. .item{
  173. width: 100%;
  174. display: flex;
  175. align-items: center;
  176. justify-content: flex-start;
  177. background-color: #fff;
  178. border-radius: 15rpx;
  179. padding: 15rpx;
  180. margin: 15rpx;
  181. }
  182. .name{
  183. margin-left: 10rpx;
  184. flex: 1;
  185. font-size: 28upx;
  186. font-family: PingFang SC;
  187. font-weight: 500;
  188. color: #b5b5b5;
  189. }
  190. .btn{
  191. margin-right: 15rpx;
  192. border-radius: 10rpx;
  193. padding: 10rpx 30rpx;
  194. background-color: #FF6633;
  195. font-size: 28upx;
  196. font-family: PingFang SC;
  197. font-weight: 500;
  198. color: #fff;
  199. position: relative;
  200. .share{
  201. display: inline-block;
  202. position: absolute;
  203. top: 0;
  204. left: 0;
  205. width: 100%;
  206. height: 100%rpx;
  207. opacity: 0;
  208. }
  209. }
  210. }
  211. .product{
  212. position: fixed;
  213. bottom: 120rpx;
  214. left:0rpx;
  215. .list{
  216. display: flex;
  217. background-color: #fff;
  218. border-radius: 15rpx;
  219. margin: 15rpx;
  220. padding: 15rpx;
  221. .medic-list{
  222. .item{
  223. box-sizing: border-box;
  224. background: #FFFFFF;
  225. border: 4upx solid #FFFFFF;
  226. border-radius: 16upx;
  227. padding: 20upx 30upx;
  228. display: flex;
  229. .img-box{
  230. width: 200upx;
  231. height: 200upx;
  232. margin-right: 30upx;
  233. image{
  234. width: 100%;
  235. height: 100%;
  236. }
  237. }
  238. .info-box{
  239. width: calc(100% - 210upx);
  240. .title{
  241. font-size: 32upx;
  242. font-family: PingFang SC;
  243. font-weight: 500;
  244. color: #111111;
  245. line-height: 40rpx;
  246. height: 80rpx;
  247. }
  248. .intro{
  249. font-size: 26upx;
  250. font-family: PingFang SC;
  251. font-weight: 500;
  252. color: #999999;
  253. line-height: 1;
  254. margin-top: 26upx;
  255. }
  256. .prce-num{
  257. display: flex;
  258. align-items: center;
  259. justify-content: space-between;
  260. margin-top: 30upx;
  261. .price{
  262. display: flex;
  263. align-items: flex-end;
  264. .unit{
  265. font-size: 24upx;
  266. font-family: PingFang SC;
  267. font-weight: 500;
  268. color: #FF6633;
  269. line-height: 1.2;
  270. margin-right: 4upx;
  271. }
  272. .num{
  273. font-size: 36upx;
  274. font-family: PingFang SC;
  275. font-weight: bold;
  276. color: #FF6633;
  277. line-height: 1;
  278. }
  279. }
  280. .cart-img{
  281. .sale{
  282. font-size: 20upx;
  283. font-family: PingFang SC;
  284. color: #999999;
  285. }
  286. }
  287. }
  288. }
  289. }
  290. }
  291. }
  292. }
  293. }
  294. </style>