detail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <div class="adffc" style="height: calc(100vh - 80px);">
  3. <el-card shadow="never" class="aui-card--fill">
  4. <div class="mod-home">
  5. <div class="top adfac">
  6. <div class="back adfac" @click="handleBack">
  7. <img src="@/assets/img/back.png">
  8. <span>返回</span>
  9. </div>
  10. <div class="line"></div>
  11. <div class="text">会员详情</div>
  12. </div>
  13. <div class="title">基础资料</div>
  14. <div class="info adfacjb">
  15. <div class="info-left adffcac">
  16. <img src="@/assets/img/member_avatar.png">
  17. <el-button type="primary" @click="handleEdit" v-if="$hasPermission('core:appuser:update')">编辑资料</el-button>
  18. </div>
  19. <div class="info-right adf" v-if="userInfo">
  20. <div class="info-right-pre adf" style="margin-top: 0;">
  21. <div class="info-right-pre-title">会员姓名:</div>
  22. <div class="info-right-pre-content">{{ userInfo.realName||'' }}</div>
  23. </div>
  24. <div class="info-right-pre adf" style="margin-top: 0;">
  25. <div class="info-right-pre-title">会员手机:</div>
  26. <div class="info-right-pre-content">{{ userInfo.phoneCopy||'' }}</div>
  27. </div>
  28. <div class="info-right-pre adf" style="margin-top: 0;">
  29. <div class="info-right-pre-title">善行少年编号:</div>
  30. <div class="info-right-pre-content">{{ userInfo.uniqueNo||'' }}</div>
  31. </div>
  32. <div class="info-right-pre adf">
  33. <div class="info-right-pre-title">会员性别:</div>
  34. <div class="info-right-pre-content">{{ userInfo.genderText||'' }}</div>
  35. </div>
  36. <!-- <div class="info-right-pre adf">
  37. <div class="info-right-pre-title">会员年龄:</div>
  38. <div class="info-right-pre-content">{{ userInfo.age||'' }}</div>
  39. </div> -->
  40. <div class="info-right-pre adf">
  41. <div class="info-right-pre-title">微信昵称:</div>
  42. <div class="info-right-pre-content">{{ userInfo.nickName||'' }}</div>
  43. </div>
  44. <div class="info-right-pre adf">
  45. <div class="info-right-pre-title">渠道方:</div>
  46. <div class="info-right-pre-content">{{ userInfo.channelName||'' }}</div>
  47. </div>
  48. <div class="info-right-pre adf">
  49. <div class="info-right-pre-title">成为会员时间:</div>
  50. <div class="info-right-pre-content">{{ userInfo.createDate||'' }}</div>
  51. </div>
  52. <div class="info-right-pre adf">
  53. <div class="info-right-pre-title">家庭公益口号:</div>
  54. <div class="info-right-pre-content">{{ userInfo.welfareSlogan||'' }}</div>
  55. </div>
  56. <div class="info-right-pre adf">
  57. <div class="info-right-pre-title">家庭公益名称:</div>
  58. <div class="info-right-pre-content">{{ userInfo.welfareName||'' }}</div>
  59. </div>
  60. <div class="info-right-pre adf">
  61. <div class="info-right-pre-title">身份证号:</div>
  62. <div class="info-right-pre-content">{{ userInfo.idCardCopy||'' }}</div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </el-card>
  68. <el-card shadow="never" class="aui-card--fill">
  69. <div class="mod-home">
  70. <div class="title" style="margin-top: 0;">会员资产</div>
  71. <div class="nums adf" v-if="assetInfo">
  72. <div class="nums-pre adffcac">
  73. <p>累计捐献爱心值</p>
  74. <p class="num">{{ assetInfo.totalDonationValue||0 }}</p>
  75. </div>
  76. <div class="nums-pre adffcac">
  77. <p>家庭累计义工时长</p>
  78. <p class="num">{{ assetInfo.totalVolunteerHours||0 }}h</p>
  79. </div>
  80. <div class="nums-pre adffcac">
  81. <p>会员等级</p>
  82. <p class="num">Lv.{{ assetInfo.userLevel||1 }}</p>
  83. </div>
  84. <div class="nums-pre adffcac">
  85. <p>剩余爱心值</p>
  86. <p class="num">{{ assetInfo.loveValue||0 }}</p>
  87. </div>
  88. </div>
  89. </div>
  90. </el-card>
  91. <el-card shadow="never" class="aui-card--fill" style="flex: 1;">
  92. <div class="mod-home">
  93. <div class="tab adfac">
  94. <div class="tab-pre" v-for="(item,index) in tabList" :key="index" :class="{'active':tabIndex===index}" @click="changeTab(index)">{{ item }}</div>
  95. </div>
  96. <div class="table">
  97. <activity-record v-if="tabIndex===0"></activity-record>
  98. <heart-recorrd v-else-if="tabIndex===1"></heart-recorrd>
  99. <only-self-ticket v-else-if="tabIndex===2"></only-self-ticket>
  100. <family-member v-else></family-member>
  101. </div>
  102. </div>
  103. </el-card>
  104. <el-dialog width="800px" :visible.sync="show" title="编辑会员资料" @close="cancel">
  105. <el-form ref="memberRef" :model="form" :rules="rules" label-width="120px" style="width: 70%;margin: 0 auto;">
  106. <el-form-item label="会员昵称" prop="nickName">
  107. <el-input v-model="form.nickName" placeholder="请输入"></el-input>
  108. </el-form-item>
  109. <el-form-item label="善行少年编号" prop="uniqueNo">
  110. <el-input v-model="form.uniqueNo" placeholder="请输入"></el-input>
  111. </el-form-item>
  112. <el-form-item label="渠道方" prop="channelId">
  113. <el-select v-model="form.channelId" placeholder="请选择" style="width: 100%;">
  114. <el-option v-for="item in channelOptions" :key="item.id" :label="item.channelName" :value="item.id"></el-option>
  115. </el-select>
  116. </el-form-item>
  117. <el-form-item label="姓名" prop="realName">
  118. <el-input v-model="form.realName" placeholder="请输入"></el-input>
  119. </el-form-item>
  120. <el-form-item label="家庭公益名称" prop="welfareName">
  121. <el-input v-model="form.welfareName" placeholder="请输入"></el-input>
  122. </el-form-item>
  123. <el-form-item label="家庭公益口号" prop="welfareSlogan">
  124. <el-input v-model="form.welfareSlogan" placeholder="请输入"></el-input>
  125. </el-form-item>
  126. <el-form-item label="累计捐献爱心值" prop="totalInvoicedAmount">
  127. <el-input type="number" v-model="form.totalInvoicedAmount" disabled placeholder="请输入"></el-input>
  128. </el-form-item>
  129. <el-form-item label="剩余爱心值" prop="loveValue">
  130. <el-input type="number" v-model="form.loveValue" placeholder="请输入"></el-input>
  131. </el-form-item>
  132. <el-form-item label="参与公益次数" prop="welfareCount">
  133. <el-input type="number" v-model="form.welfareCount" disabled placeholder="请输入"></el-input>
  134. </el-form-item>
  135. <el-form-item label="会员等级" prop="userLevel">
  136. <el-input type="number" v-model="form.userLevel" placeholder="请输入"></el-input>
  137. </el-form-item>
  138. </el-form>
  139. <div class="demo-drawer__footer" style="display: flex;justify-content: end;margin-top: 30px;">
  140. <el-button :loading="buttonLoading" type="primary" @click="submitForm">保 存</el-button>
  141. <el-button @click="cancel" style="margin-right: 5%;">取 消</el-button>
  142. </div>
  143. </el-dialog>
  144. </div>
  145. </template>
  146. <script>
  147. import ActivityRecord from './components/activityRecord.vue'
  148. import HeartRecorrd from './components/heartRecorrd.vue'
  149. import OnlySelfTicket from './components/onlySelfTicket.vue'
  150. import FamilyMember from './components/familyMember.vue'
  151. export default {
  152. components: {
  153. ActivityRecord,
  154. HeartRecorrd,
  155. OnlySelfTicket,
  156. FamilyMember
  157. },
  158. data () {
  159. return {
  160. tabIndex: 0,
  161. tabList: ['活动记录', '爱心值记录', '专享券', '家庭成员'],
  162. show: false,
  163. buttonLoading: false,
  164. userInfo: null,
  165. assetInfo: null,
  166. form: {
  167. id: '',
  168. nickName: '',
  169. uniqueNo: '',
  170. channelId: '',
  171. realName: '',
  172. welfareName: '',
  173. welfareSlogan: '',
  174. totalInvoicedAmount: 0,
  175. loveValue: 0,
  176. welfareCount: 0,
  177. userLevel: 0
  178. },
  179. rules: {
  180. nickName: [
  181. { required: true, message: '请输入会员昵称', trigger: 'blur' }
  182. ],
  183. uniqueNo: [
  184. { required: true, message: '请输入善行少年编号', trigger: 'blur' }
  185. ],
  186. channelId: [
  187. { required: true, message: '请选择渠道方', trigger: 'change' }
  188. ],
  189. realName: [
  190. { required: true, message: '请输入姓名', trigger: 'blur' }
  191. ],
  192. welfareName: [
  193. { required: true, message: '请输入家庭公益名称', trigger: 'blur' }
  194. ],
  195. welfareSlogan: [
  196. { required: true, message: '请输入家庭公益口号', trigger: 'blur' }
  197. ],
  198. totalInvoicedAmount: [
  199. { required: true, message: '请输入累计捐献爱心值', trigger: 'blur' }
  200. ],
  201. loveValue: [
  202. { required: true, message: '请输入剩余爱心值', trigger: 'blur' }
  203. ],
  204. welfareCount: [
  205. { required: true, message: '请输入参与公益次数', trigger: 'blur' }
  206. ],
  207. userLevel: [
  208. { required: true, message: '请输入会员等级', trigger: 'blur' }
  209. ]
  210. },
  211. genderCfg: {
  212. '0': '男',
  213. '1': '女',
  214. '2': '保密'
  215. },
  216. channelOptions: []
  217. }
  218. },
  219. created () {
  220. this.getSupplierOptions()
  221. },
  222. mounted () {
  223. this.getDetail()
  224. this.getUserAsset()
  225. },
  226. methods: {
  227. getSupplierOptions () {
  228. this.$http.get('/core/channel/page', { params: { page: 1, limit: -1 } }).then(res => {
  229. this.channelOptions = res.data.data.list.filter(item => item.type === 1) || []
  230. })
  231. },
  232. getDetail () {
  233. this.$http.get('/core/app/user/' + this.$route.query.id).then(({ data: res }) => {
  234. if (res.code !== 0) return this.$message.error(res.msg)
  235. this.form = res.data
  236. this.form.totalInvoicedAmount = res.data.totalInvoicedAmount || 0
  237. this.form.welfareCount = res.data.welfareCount || 0
  238. this.form.userLevel = res.data.userLevel || 1
  239. this.userInfo = res.data
  240. this.userInfo.phoneCopy = this.userInfo.phone.replace(/(\d{3})\d*(\d{4})/, '$1****$2')
  241. this.userInfo.idCardCopy = this.userInfo.idCard.replace(/^(\d{6})\d{8}(\w{4})$/, '$1********$2')
  242. this.userInfo.genderText = this.genderCfg[this.userInfo.gender]
  243. })
  244. },
  245. getUserAsset () {
  246. this.$http.get('/core/app/user/getUserAsset/' + this.$route.query.id).then(({ data: res }) => {
  247. if (res.code !== 0) return this.$message.error(res.msg)
  248. this.assetInfo = res.data
  249. })
  250. },
  251. handleBack () {
  252. this.$router.push({ name: 'member-query' })
  253. },
  254. changeTab (index) {
  255. this.tabIndex = index
  256. },
  257. handleEdit () {
  258. this.show = true
  259. this.getDetail()
  260. },
  261. submitForm () {
  262. this.$refs['memberRef'].validate((valid) => {
  263. if (valid) {
  264. this.$http.put('/core/app/user', this.form).then(({ data: res }) => {
  265. if (res.code === 0) {
  266. this.$message.success('保存成功!')
  267. this.show = false
  268. this.getDetail()
  269. this.getUserAsset()
  270. } else {
  271. this.$message.error(res.msg || '保存失败!')
  272. }
  273. })
  274. } else {
  275. return false
  276. }
  277. })
  278. },
  279. cancel () {
  280. this.form = {
  281. id: '',
  282. nickName: '',
  283. uniqueNo: '',
  284. channelId: '',
  285. xxx: '',
  286. welfareName: '',
  287. welfareSlogan: '',
  288. totalInvoicedAmount: 0,
  289. loveValue: 0,
  290. welfareCount: 0,
  291. userLevel: 0
  292. }
  293. this.$refs['memberRef'].resetFields()
  294. this.show = false
  295. }
  296. }
  297. }
  298. </script>
  299. <style scoped lang="scss">
  300. .top {
  301. padding-bottom: 13px;
  302. box-shadow: inset 0px -1px 0px 0px #F0F1F7;
  303. .back {
  304. cursor: pointer;
  305. img {
  306. width: 22px;
  307. height: 22px;
  308. }
  309. span {
  310. font-family: PingFang-SC, PingFang-SC;
  311. font-weight: bold;
  312. font-size: 14px;
  313. color: #00AE57;
  314. line-height: 20px;
  315. margin-left: 6px;
  316. }
  317. }
  318. .line {
  319. width: 1px;
  320. height: 16px;
  321. background: #F0F1F7;
  322. margin-left: 14px;
  323. }
  324. .text {
  325. font-family: PingFangSC, PingFang SC;
  326. font-weight: 400;
  327. font-size: 14px;
  328. color: #657588;
  329. line-height: 20px;
  330. margin-left: 10px;
  331. }
  332. }
  333. .title{
  334. font-family: PingFang-SC, PingFang-SC;
  335. font-weight: bold;
  336. font-size: 16px;
  337. color: #252525;
  338. line-height: 22px;
  339. margin-top: 20px;
  340. }
  341. .info{
  342. margin-top: 20px;
  343. &-left{
  344. width: 135px;
  345. img{
  346. width: 64px;
  347. height: 64px;
  348. margin-bottom: 26px;
  349. }
  350. }
  351. &-right{
  352. width: calc(100% - 135px);
  353. flex-wrap: wrap;
  354. &-pre{
  355. width: calc(100% / 3);
  356. margin-top: 20px;
  357. &-title{
  358. width: 140px;
  359. padding-right: 12px;
  360. box-sizing: border-box;
  361. font-family: PingFangSC, PingFang SC;
  362. font-weight: 400;
  363. font-size: 14px;
  364. color: #646464;
  365. line-height: 16px;
  366. text-align: right;
  367. }
  368. &-content{
  369. width: calc(100% - 140px);
  370. font-family: PingFangSC, PingFang SC;
  371. font-weight: 400;
  372. font-size: 14px;
  373. color: #393939;
  374. line-height: 16px;
  375. }
  376. }
  377. }
  378. }
  379. .nums{
  380. margin-top: 16px;
  381. padding-bottom: 10px;
  382. .nums-pre{
  383. width: 25%;
  384. p{
  385. font-family: PingFangSC, PingFang SC;
  386. font-weight: 400;
  387. font-size: 14px;
  388. color: #646464;
  389. line-height: 16px;
  390. text-align: center;
  391. margin: 0;
  392. &.num{
  393. font-family: D-DINExp, D-DINExp;
  394. font-weight: bold;
  395. font-size: 24px;
  396. color: #252525;
  397. line-height: 24px;
  398. margin-top: 12px;
  399. }
  400. }
  401. }
  402. }
  403. .tab{
  404. padding-bottom: 18px;
  405. box-shadow: inset 0px -1px 0px 0px #F0F1F7;
  406. &-pre{
  407. position: relative;
  408. font-family: PingFangSC, PingFang SC;
  409. font-weight: 400;
  410. font-size: 14px;
  411. color: #252525;
  412. line-height: 16px;
  413. margin-left: 64px;
  414. cursor: pointer;
  415. &:first-child{
  416. margin-left: 0;
  417. }
  418. &.active{
  419. font-family: PingFang-SC, PingFang-SC;
  420. font-weight: bold;
  421. font-size: 16px;
  422. color: #252525;
  423. line-height: 16px;
  424. &::after{
  425. content: '';
  426. width: 48px;
  427. height: 4px;
  428. background: #00AE57;
  429. border-radius: 2px;
  430. position: absolute;
  431. left: 50%;
  432. transform: translateX(-50%);
  433. bottom: -18px;
  434. }
  435. }
  436. }
  437. }
  438. .table{
  439. margin-top: 18px;
  440. }
  441. </style>