hdInfo.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view>
  3. <!-- swiper -->
  4. <view class="sw">
  5. <swiper :indicator-dots="false" style="width: 100%;height: 100%;" :autoplay="true" :interval="3000"
  6. :duration="300">
  7. <swiper-item v-for="(item,index) in imgs">
  8. <image :src="item" style="width: 100%;height: 100%;" mode="aspectFill"></image>
  9. </swiper-item>
  10. </swiper>
  11. </view>
  12. <!-- 活动标题 -->
  13. <view class="title flex justify-center align-center">
  14. <view class="title-box flex align-center">
  15. {{info.title}}
  16. </view>
  17. </view>
  18. <!-- 活动内容 -->
  19. <view class="info flex justify-center">
  20. <view class="info-box" v-html="content">
  21. </view>
  22. </view>
  23. <!-- 活动类型 -->
  24. <view class="title flex justify-center align-center">
  25. <view class="title-box flex align-center">
  26. <span v-if="info.type=='1'">普通活动</span>
  27. <span v-if="info.type=='2'">时段优惠</span>
  28. <span v-if="info.type=='3'">满额优惠</span>
  29. <span v-if="info.type=='4'">全场优惠</span>
  30. </view>
  31. </view>
  32. <!-- 活动内容 时段优惠-->
  33. <view class="title flex justify-center align-center" v-if="info.type=='2'">
  34. <view class="title-box align-center">
  35. <view v-for="(item,index) in info.timeIntervalInfos" :key="index">
  36. {{item.startTime}}至{{item.endTime}}打{{item.discountContent}}折
  37. </view><br/>
  38. </view>
  39. </view>
  40. <!-- 活动内容 满额优惠-->
  41. <view class="title flex justify-center align-center" v-if="info.type=='3'">
  42. <view class="title-box flex align-center" v-if="info.fullReductionInfo.type=='1'">
  43. 订单满{{info.fullReductionInfo.minAmount}}减{{info.fullReductionInfo.discountContent}}元
  44. </view>
  45. <view class="title-box flex align-center" v-if="info.fullReductionInfo.type=='2'">
  46. 订单满{{info.fullReductionInfo.minAmount}}打{{info.fullReductionInfo.discountContent}}折
  47. </view>
  48. </view>
  49. <!-- 活动内容 全场优惠-->
  50. <view class="title flex justify-center align-center" v-if="info.type=='4'">
  51. <view class="title-box flex align-center">
  52. 全场打{{info.globalDiscountsInfo.discountRate}}折
  53. </view>
  54. </view>
  55. <!-- 活动时间 -->
  56. <view class="title flex justify-center align-center">
  57. <view class="title-box flex align-center">
  58. {{info.startTime}}至{{info.endTime}}
  59. </view>
  60. </view>
  61. <!-- 加入按钮 -->
  62. <view class="submit flex justify-center align-center">
  63. <view class="submit-box flex justify-center align-center" @click="joinHd()">
  64. 加入活动
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. activityId: '',
  74. info: {},
  75. content: '',
  76. imgs: [],
  77. };
  78. },
  79. onLoad(option) {
  80. console.log()
  81. this.activityId = option.activityId
  82. this.getInfo()
  83. },
  84. methods: {
  85. //加入活动
  86. joinHd() {
  87. uni.navigateTo({
  88. url:'./join_huodong?activityId='+this.activityId
  89. })
  90. // let data = {
  91. // activityId: this.activityId,
  92. // shopId: uni.getStorageSync('shopId')
  93. // }
  94. // this.$Request.get("/app/activityManage/shopJoinActivity", data).then(res => {
  95. // if (res.code == 0) {
  96. // uni.showModal({
  97. // title: '提示',
  98. // content: '确定加入该活动?',
  99. // complete(ret) {
  100. // if (ret.confirm) {
  101. // uni.showToast({
  102. // title: '加入成功'
  103. // })
  104. // setTimeout(() => {
  105. // uni.navigateBack()
  106. // }, 1000)
  107. // }
  108. // }
  109. // })
  110. // } else {
  111. // uni.showToast({
  112. // title: res.msg,
  113. // icon: 'none'
  114. // })
  115. // }
  116. // });
  117. },
  118. //活动详情
  119. getInfo() {
  120. var activityId=this.activityId
  121. this.$Request.get(`/admin/activity/${activityId}`).then(res => {
  122. if(res.msg=='success'){
  123. this.content = res.data.content.replace(new RegExp("img", "g"),
  124. 'img style="width:100%;height:auto;"')
  125. this.info = res.data
  126. this.imgs = res.data.image.split(',')
  127. }else{
  128. uni.showModal({
  129. title: '提示',
  130. content: res.msg,
  131. success: function (res) {
  132. if (res.confirm) {
  133. } else if (res.cancel) {
  134. }
  135. }
  136. });
  137. }
  138. });
  139. },
  140. }
  141. }
  142. </script>
  143. <style lang="scss">
  144. page {
  145. background-color: #ffffff;
  146. }
  147. .sw {
  148. width: 100%;
  149. height: 300rpx;
  150. }
  151. .title {
  152. width: 100%;
  153. height: 100rpx;
  154. background-color: #ffffff;
  155. .title-box {
  156. width: 686rpx;
  157. height: 100%;
  158. font-size: 32rpx;
  159. font-weight: bold;
  160. }
  161. }
  162. .info {
  163. width: 100%;
  164. height: auto;
  165. .info-box {
  166. width: 686rpx;
  167. height: 100%;
  168. }
  169. }
  170. .submit {
  171. width: 100%;
  172. height: 160rpx;
  173. position: fixed;
  174. bottom: 0;
  175. background-color: #ffffff;
  176. .submit-box {
  177. width: 686rpx;
  178. height: 88rpx;
  179. background-color: #FCD202;
  180. border-radius: 40rpx;
  181. }
  182. }
  183. </style>