info.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <el-card shadow="never" class="aui-card--fill">
  3. <div class="mod-home">
  4. <div class="top adfac">
  5. <div class="back adfac" @click="handleBack">
  6. <img src="@/assets/img/back.png">
  7. <span>返回</span>
  8. </div>
  9. <div class="line"></div>
  10. <div class="text">报名信息</div>
  11. </div>
  12. <div class="title">活动信息</div>
  13. <div class="info">
  14. <div class="info-pre adf">
  15. <div class="info-pre-title adf"><span>*</span>活动名称:</div>
  16. <div class="info-pre-content">{{ activityInfo.activityName || '' }}</div>
  17. </div>
  18. <div class="info-pre adf">
  19. <div class="info-pre-title adf"><span>*</span>活动时间:</div>
  20. <div class="info-pre-content">{{ activityInfo.activityStartTime || '' }} - {{ activityInfo.activityEndTime || '' }}</div>
  21. </div>
  22. <div class="info-pre adf">
  23. <div class="info-pre-title adf"><span>*</span>渠道方:</div>
  24. <div class="info-pre-content">{{ activityInfo.channelName || '' }}</div>
  25. </div>
  26. <div class="info-pre adf">
  27. <div class="info-pre-title adf"><span>*</span>活动地址:</div>
  28. <div class="info-pre-content">{{ provinceName || '' }}{{ cityName || '' }}{{ districtName || '' }}{{ activityInfo.address || '' }}</div>
  29. </div>
  30. <div class="info-pre adf">
  31. <div class="info-pre-title adf"><span>*</span>会员等级:</div>
  32. <div class="info-pre-content">{{ activityInfo.userLevel?`Lv.${activityInfo.userLevel} 级以上`:'无限制' }}</div>
  33. </div>
  34. <div class="info-pre adf">
  35. <div class="info-pre-title adf"><span>*</span>举办方:</div>
  36. <div class="info-pre-content">{{ activityInfo.organizerName || '' }}</div>
  37. </div>
  38. <div class="info-pre adf">
  39. <div class="info-pre-title adf"><span>*</span>报名人数:</div>
  40. <div class="info-pre-content">{{ activityInfo.recruitmentNow || 0 }}/{{ activityInfo.recruitmentMax || '无限制' }}</div>
  41. </div>
  42. <div class="info-pre adf">
  43. <div class="info-pre-title adf"><span>*</span>公益支持:</div>
  44. <div class="info-pre-content" v-if="activityInfo.activityLimit!=3">{{ (activityInfo.valueLimit||'-') }} {{ activityLimitCfg[activityInfo.activityLimit]||'-' }}</div>
  45. <div class="info-pre-content" v-else>免费</div>
  46. </div>
  47. <div class="info-pre adf">
  48. <div class="info-pre-title adf"><span>*</span>公益支持内容:</div>
  49. <div class="info-pre-content">{{ activityInfo.loveValueContent || '' }}</div>
  50. </div>
  51. </div>
  52. <div class="title adfacjb">
  53. 活动报名信息
  54. <el-button type="primary" @click="handleExcel">导出Excel</el-button>
  55. </div>
  56. <el-table :data="dataList" border cell-class-name="vertical-top-cell" v-loading="loading" empty-text="暂无活动报名信息" style="margin-top: 16px;">
  57. <el-table-column prop="id" label="善行少年编号" width="200"></el-table-column>
  58. <el-table-column prop="welfareName" label="家庭名称" width="150"></el-table-column>
  59. <el-table-column prop="contactPhoneJM" label="手机号码" width="150"></el-table-column>
  60. <el-table-column prop="channelName" label="渠道方" width="200"></el-table-column>
  61. <el-table-column prop="name" label="姓名" width="150"></el-table-column>
  62. <el-table-column prop="idCardJM" label="身份证号" width="300"></el-table-column>
  63. <el-table-column prop="volunteerNo" label="义工号" width="100"></el-table-column>
  64. <el-table-column prop="gender" label="性别" width="100">
  65. <template slot-scope="scope">{{ genderDict[scope.row.gender] || '' }}</template>
  66. </el-table-column>
  67. <el-table-column prop="age" label="年龄" width="100">
  68. <template slot-scope="scope">{{ scope.row.age||0 }}岁</template>
  69. </el-table-column>
  70. <!-- <el-table-column prop="xxx" label="参会情况" width="120"></el-table-column> -->
  71. <el-table-column prop="currentSchool" label="就读学校" width="200">
  72. <template slot-scope="scope">{{ scope.row.currentSchool || '/' }}</template>
  73. </el-table-column>
  74. <el-table-column prop="createDate" label="报名时间" width="240"></el-table-column>
  75. <el-table-column prop="signupState" label="状态" width="150" fixed="right">
  76. <template slot-scope="scope"><div :class="{'statered':scope.row.signupState==-1}">{{ statusCfg[scope.row.signupState] || '--' }}</div></template>
  77. </el-table-column>
  78. </el-table>
  79. <el-pagination
  80. :current-page="queryParams.page"
  81. :page-sizes="[10, 20, 50, 100]"
  82. :page-size="queryParams.limit"
  83. :total="total"
  84. layout="total, sizes, prev, pager, next, jumper"
  85. @size-change="pageSizeChangeHandle"
  86. @current-change="pageCurrentChangeHandle">
  87. </el-pagination>
  88. </div>
  89. </el-card>
  90. </template>
  91. <script>
  92. import Cookies from 'js-cookie'
  93. import qs from 'qs'
  94. export default {
  95. data () {
  96. return {
  97. provinceName: '',
  98. cityName: '',
  99. districtName: '',
  100. activityInfo: null,
  101. activityLimitCfg: {
  102. 1: '爱心值',
  103. 2: '专享券',
  104. 3: '免费'
  105. },
  106. genderDict: {
  107. 0: '男',
  108. 1: '女',
  109. 2: '保密'
  110. },
  111. loading: false,
  112. queryParams: {
  113. activityId: this.$route.query.id,
  114. page: 1,
  115. limit: 10
  116. },
  117. statusCfg: {
  118. '-1': '已取消',
  119. 1: '已报名',
  120. 2: '已签到',
  121. 3: '已填档案'
  122. }
  123. }
  124. },
  125. mounted () {
  126. this.getDetail(this.$route.query.id)
  127. this.getList()
  128. },
  129. methods: {
  130. handleBack () {
  131. this.$router.push({ name: 'activity-list' })
  132. },
  133. getSSQ (code, key) {
  134. this.$http.get('/sys/region/' + code).then(({ data: res }) => {
  135. if (res.code !== 0) return this.$message.error(res.msg)
  136. this[key] = res.data.name
  137. })
  138. },
  139. getDetail (id) {
  140. this.$http.get('/core/activity/' + id).then(({ data: res }) => {
  141. if (res.code !== 0) return this.$message.error(res.msg)
  142. this.activityInfo = res.data
  143. this.getSSQ(res.data.provinceId, 'provinceName')
  144. this.getSSQ(res.data.cityId, 'cityName')
  145. this.getSSQ(res.data.districtId, 'districtName')
  146. })
  147. },
  148. getList () {
  149. this.loading = true
  150. this.$http.get('/core/activity/signup/getSignupList', { params: this.queryParams }).then(({ data: res }) => {
  151. if (res.code !== 0) return this.$message.error(res.msg)
  152. this.dataList = res.data.list
  153. this.dataList.forEach(d => {
  154. d.contactPhoneJM = d.contactPhone.replace(/^(.{3})(?:\d+)(.{4})$/, '$1****$2')
  155. d.idCardJM = d.idCard.replace(/^(\d{6})(\d{8})(\d{3}[\dX])$/i, '$1********$3')
  156. d.age = this.getAge(d.idCard)
  157. })
  158. this.total = res.data.total
  159. this.loading = false
  160. })
  161. },
  162. isValid (idCard) {
  163. const regex = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
  164. return typeof idCard === 'string' && regex.test(idCard)
  165. },
  166. getAge (idCard) {
  167. if (!this.isValid(idCard)) return 0
  168. const birthDateStr = idCard.substring(6, 14)
  169. const birthYear = parseInt(birthDateStr.substring(0, 4), 10)
  170. const birthMonth = parseInt(birthDateStr.substring(4, 6), 10)
  171. const birthDay = parseInt(birthDateStr.substring(6, 8), 10)
  172. const today = new Date()
  173. const currentYear = today.getFullYear()
  174. const currentMonth = today.getMonth() + 1
  175. const currentDay = today.getDate()
  176. // 计算周岁
  177. let age = currentYear - birthYear
  178. // 如果当前月份小于出生月份,或者月份相同但日期小于出生日期,说明今年的生日还没过
  179. if (currentMonth < birthMonth || (currentMonth === birthMonth && currentDay < birthDay)) {
  180. age--
  181. }
  182. return age < 0 ? 0 : age
  183. },
  184. pageSizeChangeHandle (val) {
  185. this.queryParams.limit = val
  186. this.getList()
  187. },
  188. pageCurrentChangeHandle (val) {
  189. this.queryParams.page = val
  190. this.getList()
  191. },
  192. handleExcel () {
  193. let newDataForm = Object.assign({}, this.queryParams)
  194. var params = qs.stringify({
  195. 'token': Cookies.get('token'),
  196. ...newDataForm
  197. })
  198. window.location.href = `${window.SITE_CONFIG['apiURL']}/core/activity/signup/export?${params}`
  199. }
  200. }
  201. }
  202. </script>
  203. <style scoped lang="scss">
  204. .statered{
  205. color: #F4657A;
  206. }
  207. .top {
  208. padding-bottom: 13px;
  209. box-shadow: inset 0px -1px 0px 0px #F0F1F7;
  210. .back {
  211. cursor: pointer;
  212. img {
  213. width: 22px;
  214. height: 22px;
  215. }
  216. span {
  217. font-family: PingFang-SC, PingFang-SC;
  218. font-weight: bold;
  219. font-size: 14px;
  220. color: #00AE57;
  221. line-height: 20px;
  222. margin-left: 6px;
  223. }
  224. }
  225. .line {
  226. width: 1px;
  227. height: 16px;
  228. background: #F0F1F7;
  229. margin-left: 14px;
  230. }
  231. .text {
  232. font-family: PingFangSC, PingFang SC;
  233. font-weight: 400;
  234. font-size: 14px;
  235. color: #657588;
  236. line-height: 20px;
  237. margin-left: 10px;
  238. }
  239. }
  240. .title{
  241. font-family: PingFang-SC, PingFang-SC;
  242. font-weight: bold;
  243. font-size: 16px;
  244. color: #393939;
  245. line-height: 22px;
  246. margin-top: 20px;
  247. }
  248. .info{
  249. background: #F5F8FC;
  250. border-radius: 8px;
  251. margin-top: 10px;
  252. padding: 0 16px 20px;
  253. display: flex;
  254. flex-wrap: wrap;
  255. &-pre{
  256. width: calc(100% / 3);
  257. margin-top: 20px;
  258. &-title{
  259. width: 130px;
  260. font-family: PingFangSC, PingFang SC;
  261. font-weight: 400;
  262. font-size: 14px;
  263. color: #646464;
  264. line-height: 20px;
  265. text-align: right;
  266. letter-spacing: 1px;
  267. justify-content: flex-end;
  268. padding-right: 4px;
  269. box-sizing: border-box;
  270. span{
  271. font-family: PingFangSC, PingFang SC;
  272. font-weight: 400;
  273. font-size: 14px;
  274. color: #FB5454;
  275. line-height: 20px;
  276. margin-right: 6px;
  277. }
  278. }
  279. &-content{
  280. width: calc(100% - 130px);
  281. font-family: PingFang-SC, PingFang-SC;
  282. font-weight: bold;
  283. font-size: 14px;
  284. color: #252525;
  285. line-height: 20px;
  286. }
  287. }
  288. }
  289. </style>