detail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view class="safe-area-inset-bottom">
  3. <my-bar title="发布活动" :transparent="transparent">
  4. <view slot="content" class="publish">
  5. <image :src="detail.pic" style="height: 380rpx;width: 100%;"></image>
  6. </view>
  7. </my-bar>
  8. <view class="clock">
  9. <!-- <view class="cu-btn round sm" style="background-color: #dcdcdc;">
  10. <u-icon name="clock"></u-icon>
  11. <text class="margin-left-10">设置响应倒计时</text>
  12. </view>
  13. <view class="tips">
  14. <text>*</text>
  15. <text>如未在限定时间内响应,系统默认自动推送给旗下商户。</text>
  16. </view> -->
  17. </view>
  18. <view class="content">
  19. <text class="title">{{detail.title}}</text>
  20. <view class="data" style="margin-top: 30rpx;">
  21. <u-icon name="clock"></u-icon>
  22. <text class="margin-left-10">{{detail.beginTime | date('mm/dd hh:MM:ss')}} 至 {{detail.endTime | date('mm/dd hh:MM:ss')}}</text>
  23. </view>
  24. <view class="data">
  25. <u-icon name="map"></u-icon>
  26. <text class="margin-left-10">仅限全天河区内报名</text>
  27. </view>
  28. <view class="data flex">
  29. <view class="flex">
  30. <u-icon name="grid"></u-icon>
  31. <text class="margin-left-10">{{detail.labelNames}}</text>
  32. </view>
  33. <view class="flex margin-left-50">
  34. <u-icon name="bag"></u-icon>
  35. <text class="margin-left-10">活动供应价{{detail.supplyPrice}}%</text>
  36. </view>
  37. </view>
  38. <view class="data">
  39. <u-icon name="home-fill"></u-icon>
  40. <text class="margin-left-10">联营积分全场通用</text>
  41. </view>
  42. </view>
  43. <view class="intro" v-if="current==1">
  44. <view class="flex">
  45. <u-icon name="coupon"></u-icon>
  46. <text class="margin-left-10">商场活动补贴</text>
  47. </view>
  48. <view class="desc" style="display: flex;border-bottom: 1rpx solid #DDDDDD;align-items: center;">
  49. <u-input v-model="appendSupplyPrice" placeholder="请输入折扣" style="width: 90%;" />
  50. <text class="padding-left-20">%</text>
  51. </view>
  52. </view>
  53. <view class="intro">
  54. <view class="flex">
  55. <u-icon name="bookmark"></u-icon>
  56. <text class="margin-left-10">活动介绍</text>
  57. </view>
  58. <view class="desc">
  59. {{detail.detail}}
  60. </view>
  61. </view>
  62. <view class="attend" v-if="!$isEmpty(detail.activityJoinRecords)">
  63. <view class="margin-bottom-20">
  64. <u-icon name="calendar-fill"></u-icon>
  65. <text class="margin-left-10">已参加</text>
  66. </view>
  67. <view class="flex">
  68. <view class="flex " style="width: 90%;">
  69. <view class="data" v-for="(item,index) in detail.activityJoinRecords" :key="index">
  70. <view class="item">
  71. <image :src="item.joinPic" mode=""></image>
  72. <view>
  73. <text>{{name | ellipsis}}</text>
  74. <text>{{item.finalSupplyPrice}}折</text>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <view v-if="detail.activityJoinRecords.length>3" class="center" style="width: 10%;margin-right: 15rpx;">
  80. <u-icon name="more-circle" size="80" color="#ababab"></u-icon>
  81. </view>
  82. </view>
  83. </view>
  84. <view @click="operate" class="center" style="margin:50rpx 0rpx 20rpx;">
  85. <view class="cu-btn btn-bg-color" style="width: 90%;height: 86rpx;border-radius: 12rpx;">
  86. <block v-if="current==0">
  87. <text v-if="detail.auditStatus==0">待审核</text>
  88. <text v-if="detail.auditStatus==1">审核通过</text>
  89. <text v-if="detail.auditStatus==2">审核不通过</text>
  90. <text v-if="detail.auditStatus==3">已停用</text>
  91. </block>
  92. <block v-if="current==1">
  93. <text>参加活动</text>
  94. </block>
  95. <block v-if="current==2">
  96. <text>退出活动</text>
  97. </block>
  98. </view>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import myBar from "@/components/my-bar.vue"
  104. export default {
  105. components: {
  106. myBar
  107. },
  108. onPageScroll(obj) {
  109. this.transparent = obj.scrollTop * 0.006;
  110. },
  111. filters: {
  112. // 名称超出显示省略号
  113. ellipsis(value) {
  114. if (!value) return '';
  115. if (value.length > 4) {
  116. return value.slice(0, 3) + '...'
  117. }
  118. return value
  119. }
  120. },
  121. data() {
  122. return {
  123. id: '',
  124. current: 0, //0 发起活动详情,1可参加活动详情,2已参加活动详情
  125. transparent: '',
  126. name: '星巴克',
  127. detail: {},
  128. appendSupplyPrice: 100
  129. }
  130. },
  131. onLoad(options) {
  132. this.id = options.id
  133. this.current = options.current || 0
  134. if (!this.id) {
  135. this.$u.toast('系统错误')
  136. return
  137. }
  138. this.fetchDetail()
  139. },
  140. methods: {
  141. fetchDetail() {
  142. this.$api.activity.detail({
  143. id: this.id
  144. }).then(res => {
  145. this.detail = res.data
  146. })
  147. },
  148. operate() {
  149. if (this.current == 0) {
  150. return
  151. }
  152. if (this.current == 1) {
  153. //参加活动
  154. this.join()
  155. } else if (this.current == 2) {
  156. //退出活动
  157. this.exit()
  158. }
  159. },
  160. join() {
  161. this.$dialog.showModal("确定参加?").then(res => {
  162. let operateList = {
  163. activityId: this.id,
  164. joinType: 1,
  165. joinId: this.vuex_mallId,
  166. appendSupplyPrice: this.appendSupplyPrice
  167. }
  168. this.$api.activity.join(operateList).then(res => {
  169. if (res.success) {
  170. this.$dialog.showModal("参加成功", false).then(() => {
  171. this.$util.isReloadAndBack()
  172. })
  173. }
  174. })
  175. })
  176. },
  177. exit() {
  178. this.$dialog.showModal("确定退出?").then(res => {
  179. let operateList = [{
  180. activityId: this.id,
  181. joinType: 1,
  182. joinId: this.vuex_mallId
  183. }]
  184. this.$api.activity.exit(operateList).then(res => {
  185. if (res.success) {
  186. this.$dialog.showModal("退出成功", false).then(() => {
  187. this.$util.isReloadAndBack()
  188. })
  189. }
  190. })
  191. })
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .publish {
  198. overflow: hidden;
  199. border-radius: 10rpx;
  200. height: 380rpx;
  201. position: absolute;
  202. bottom: 20rpx;
  203. left: 0;
  204. right: 0;
  205. width: 92%;
  206. margin: 0 auto -120rpx;
  207. border-radius: 10rpx;
  208. box-shadow: 0rpx 16rpx 8rpx -8rpx #a8a8a8;
  209. display: flex;
  210. justify-content: center;
  211. align-items: center;
  212. flex-direction: column;
  213. text {
  214. font-size: 26rpx;
  215. color: #797979;
  216. }
  217. }
  218. .clock {
  219. background-color: #FFFFFF;
  220. height: 120rpx;
  221. padding-bottom: 20rpx;
  222. display: flex;
  223. flex-direction: column;
  224. justify-content: flex-end;
  225. align-items: center;
  226. .tips {
  227. margin-top: 10rpx;
  228. font-size: 24rpx;
  229. color: #FF9447;
  230. }
  231. }
  232. .content {
  233. padding: 15rpx 30rpx;
  234. background-color: #FFFFFF;
  235. .title {
  236. line-height: 50rpx;
  237. font-weight: 800;
  238. font-size: 32rpx;
  239. }
  240. .data {
  241. margin: 20rpx 0;
  242. color: #787878;
  243. }
  244. }
  245. .intro {
  246. margin-top: 15rpx;
  247. padding: 15rpx 30rpx;
  248. background-color: #FFFFFF;
  249. .desc {
  250. color: #9a9a9a;
  251. margin-top: 20rpx;
  252. line-height: 46rpx;
  253. font-size: 28rpx;
  254. }
  255. }
  256. .attend {
  257. margin-top: 15rpx;
  258. padding: 15rpx 0 15rpx 30rpx;
  259. background-color: #FFFFFF;
  260. .data {
  261. margin: 10rpx 20rpx 10rpx 0;
  262. $width: 80rpx;
  263. .item {
  264. width: 190rpx;
  265. height: $width;
  266. background-color: #eeeeee;
  267. border-radius: 50rpx;
  268. display: flex;
  269. image {
  270. width: $width;
  271. height: $width;
  272. }
  273. view {
  274. padding-left: 10rpx;
  275. display: flex;
  276. flex-direction: column;
  277. justify-content: center;
  278. font-size: 22rpx;
  279. text:first-child {
  280. font-weight: 800;
  281. margin-bottom: 4rpx;
  282. }
  283. }
  284. }
  285. }
  286. }
  287. </style>