activity_detail.vue 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container" style="padding-top: 0; background-color: #f6f8f9;">
  7. <div class="base-info">
  8. <div class="poster-photo">
  9. <img :src="poster_photo" />
  10. </div>
  11. <div class="title-panel">
  12. <p class="title">
  13. <!-- <router-link v-if="activity != null && activity.status == 4" :to="activity_url" target="_blank">{{ title }}</router-link>
  14. <router-link v-else :to="activity_url">{{ title }}</router-link> -->
  15. <router-link :to="activity_url" target="_blank">{{ title }}</router-link>
  16. </p>
  17. <p class="date">活动日期:{{ activity_time }}</p>
  18. </div>
  19. <div class="action-panel">
  20. <el-button type="primary" v-if="show_share_btn" @click="$router.push({ path: '/activity/share', query: { id: activity_id } })">再次分享</el-button>
  21. <el-button type="primary" v-if="show_publish_btn" @click="publishActivity" :loading="publishing">发布</el-button>
  22. </div>
  23. </div>
  24. <div class="times-statistics">
  25. <el-row :gutter="20">
  26. <el-col :span="12">
  27. <div class="item">
  28. <span class="count">{{ read_times }}</span>
  29. <p class="desc">展示次数</p>
  30. </div>
  31. </el-col>
  32. <el-col :span="12">
  33. <div class="item">
  34. <span class="count">{{ join_count }}</span>
  35. <p class="desc">参与人数</p>
  36. </div>
  37. </el-col>
  38. </el-row>
  39. </div>
  40. <div class="signup-header">
  41. <div class="input">
  42. <el-input v-model="signup_keyword" placeholder="搜索报名人" style="width: 330px;"></el-input>
  43. <el-button type="primary" icon="el-icon-search" :loading="loading_search" @click="fetchSignupUsers">搜索</el-button>
  44. </div>
  45. <div class="all-btn">
  46. <el-button type="primary" @click="$router.push({ path: '/activity/signupusers', query: { id: activity_id } })">查看全部</el-button>
  47. </div>
  48. </div>
  49. <div class="signup-table-panel">
  50. <el-table :data="signup_users" empty-text="暂无人报名">
  51. <el-table-column label="报名号" align="center" prop="id"></el-table-column>
  52. <el-table-column label="手机号" align="center" prop="mobile"></el-table-column>
  53. <el-table-column label="客户姓名" align="center" prop="real_name"></el-table-column>
  54. <el-table-column label="报名时间" align="center">
  55. <template slot-scope="scope">
  56. <span>{{ parseTime(scope.row.ctime, "{y}-{m}-{d} {h}:{i}") }}</span>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import BreadCrumb from "@/scrm_pages/components/bread-crumb"
  66. import { fetchActivityDetailViewData, fetchActivitySignupUsers, publishActivity } from "@/api/activity/activity"
  67. import { parseTime } from "@/utils"
  68. export default {
  69. name: "ActivityDetail",
  70. components: {
  71. BreadCrumb,
  72. },
  73. data() {
  74. return {
  75. crumbs: [
  76. { path: false, name: "营销工具" },
  77. { path: false, name: "活动详情" },
  78. ],
  79. activity_id: 0,
  80. activity: null,
  81. signup_keyword: "",
  82. signup_users: [],
  83. loading_search: false,
  84. publishing: false,
  85. }
  86. },
  87. computed: {
  88. title: function() {
  89. return this.activity == null ? "" : this.activity.title
  90. },
  91. poster_photo: function() {
  92. return this.activity == null ? "/" : this.activity.poster_photo
  93. },
  94. activity_url: function() {
  95. if (this.activity != null) {
  96. return "/activity/preview?id=" + this.activity_id
  97. }
  98. return ""
  99. },
  100. activity_time: function() {
  101. return this.activity == null ? "" : parseTime(this.activity.start_time, "{y}-{m}-{d} {h}:{i}")
  102. },
  103. show_share_btn: function() {
  104. return this.activity == null ? false : (this.activity.status == 1)
  105. },
  106. show_publish_btn: function() {
  107. return this.activity == null ? false : (this.activity.status == 4)
  108. },
  109. read_times: function() {
  110. return this.activity == null ? 0 : this.activity.read_num
  111. },
  112. join_count: function() {
  113. return this.activity == null ? 0 : this.activity.join_num
  114. }
  115. },
  116. mounted() {
  117. this.activity_id = this.$route.query.id
  118. fetchActivityDetailViewData(this.activity_id).then(rs => {
  119. var resp = rs.data
  120. if (resp.state == 1) {
  121. this.activity = resp.data.activity
  122. this.signup_users = resp.data.users
  123. } else {
  124. this.$message.error(resp.msg)
  125. }
  126. }).catch(err => {
  127. this.$message.error(err)
  128. })
  129. },
  130. methods: {
  131. parseTime,
  132. fetchSignupUsers: function() {
  133. this.loading_search = true
  134. fetchActivitySignupUsers(this.activity_id, this.signup_keyword, 1).then(rs => {
  135. this.loading_search = false
  136. var resp = rs.data
  137. if (resp.state == 1) {
  138. this.signup_users = resp.data.users
  139. } else {
  140. this.$message.error(resp.msg)
  141. }
  142. }).catch(err => {
  143. this.loading_search = false
  144. this.$message.error(err)
  145. })
  146. },
  147. publishActivity: function() {
  148. this.publishing = true
  149. publishActivity(this.activity_id).then(rs => {
  150. this.publishing = false
  151. var resp = rs.data
  152. if (resp.state == 1) {
  153. this.activity.status = 1
  154. } else {
  155. this.$message.error(resp.msg)
  156. }
  157. }).catch(rs => {
  158. this.publishing = false
  159. this.$message.error(err)
  160. })
  161. }
  162. },
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. .base-info {
  167. padding: 20px 25px;
  168. display: flex;
  169. justify-content: flex-end;
  170. flex-wrap: nowrap;
  171. align-items: center;
  172. background-color: white;
  173. box-shadow: 0 0 1px #dee2e5;
  174. .poster-photo {
  175. width: 120px;
  176. height: 96px;
  177. display: flex;
  178. justify-content: center;
  179. margin-right: 22px;
  180. img {
  181. width: 100%;
  182. height: auto;
  183. border-radius: 4px;
  184. object-fit: cover;
  185. object-position: center;
  186. }
  187. }
  188. .title-panel {
  189. flex: 3;
  190. padding-right: 20px;
  191. .title {
  192. font-size: 18px;
  193. color: #485b6d;
  194. font-weight: 700;
  195. word-break: break-all;
  196. overflow: hidden;
  197. text-overflow: ellipsis;
  198. display: -webkit-box;
  199. -webkit-line-clamp: 2;
  200. -webkit-box-orient: vertical;
  201. height: 70px;
  202. line-height: 34px;
  203. }
  204. .date {
  205. color: #7b8a97;
  206. line-height: 20px;
  207. font-size: 14px;
  208. }
  209. }
  210. .action-panel {
  211. flex: 1;
  212. text-align: right;
  213. }
  214. }
  215. .times-statistics {
  216. margin-top: 20px;
  217. .item {
  218. padding: 40px 0 30px 0;
  219. box-shadow: 0 0 1px #dee2e5;
  220. background-color: white;
  221. text-align: center;
  222. .count {
  223. font-size: 36px;
  224. color: #58a2ec;
  225. }
  226. .desc {
  227. margin-top: 5px;
  228. font-size: 14px;
  229. color: #485b6d;
  230. }
  231. }
  232. }
  233. .signup-header {
  234. margin-top: 20px;
  235. display: flex;
  236. justify-content: space-between;
  237. .input {
  238. width: 500px;
  239. display: block;
  240. }
  241. .all-btn {
  242. display: block;
  243. }
  244. }
  245. .signup-table-panel {
  246. margin-top: 10px;
  247. }
  248. </style>