member-coupon.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div class="address-list">
  3. <div class="table">
  4. <el-table
  5. ref="orderTable"
  6. v-loading="listLoading"
  7. :data="dataList"
  8. element-loading-text="Loading"
  9. border
  10. fit
  11. highlight-current-row stripe
  12. >
  13. <el-table-column align="center" label="券名称" prop="couponName"></el-table-column>
  14. <el-table-column align="center" label="面额" prop="couponValue"></el-table-column>
  15. <el-table-column align="center" label="券状态" prop="state">
  16. <template slot-scope="{ row }">
  17. {{ row.state ? '可用' : '不可用' }}
  18. </template>
  19. </el-table-column>
  20. <el-table-column align="center" label="有效时间">
  21. <template slot-scope="{ row }">
  22. {{ formatDate(row) }}
  23. </template>
  24. </el-table-column>
  25. <el-table-column align="center" label="分享状态" prop="transferType">
  26. <template slot-scope="{ row }">
  27. {{ row.transferType ? '可分享' : '不可分享' }}
  28. </template>
  29. </el-table-column>
  30. <el-table-column align="center" label="剩余数量" prop="leftShareTimes"></el-table-column>
  31. <el-table-column align="center" label="领取明细">
  32. <template slot-scope="{ row }">
  33. <el-button type="text" @click="openShareDetail(row.id)">查看明细</el-button>
  34. </template>
  35. </el-table-column>
  36. <!-- <el-table-column align="center" label="使用时间" prop="useTime"></el-table-column> -->
  37. </el-table>
  38. </div>
  39. <div class="pagination clearfix">
  40. <div class="fr">
  41. <el-pagination
  42. @size-change="handleSizeChange"
  43. @current-change="handleCurrentChange"
  44. :current-page="currentPage"
  45. :page-sizes="[10, 20, 30, 50]"
  46. :page-size="10"
  47. layout="total, sizes, prev, pager, next, jumper"
  48. :total="listTotal">
  49. </el-pagination>
  50. </div>
  51. </div>
  52. <!-- 分享详情 -->
  53. <el-dialog title="分享详情" :visible.sync="shareDialog" :show-close="false" width="70%" :close-on-click-modal="false">
  54. <div class="table" style="margin: 10px 0 20px;">
  55. <el-table
  56. v-loading="shareTable_listLoading"
  57. :data="shareTable_dataList"
  58. element-loading-text="Loading"
  59. tooltip-effect="dark"
  60. style="width: 100%"
  61. max-height="270">
  62. <el-table-column align="center" prop="userName" label="用户名称" min-width="120" show-overflow-tooltip></el-table-column>
  63. <el-table-column align="center" prop="mobile" label="电话" min-width="120" show-overflow-tooltip></el-table-column>
  64. <el-table-column align="center" prop="couponName" label="券名称" min-width="120"></el-table-column>
  65. <el-table-column align="center" prop="userPhone" label="数量" min-width="120">
  66. <template>
  67. 1
  68. </template>
  69. </el-table-column>
  70. <el-table-column align="center" prop="receiveTime" label="领取时间" min-width="160"></el-table-column>
  71. </el-table>
  72. </div>
  73. <div class="pagination clearfix">
  74. <div class="fr">
  75. <el-pagination
  76. @current-change="shareTableCurrentChange"
  77. :current-page="shareTable_currentPage"
  78. :page-size="shareTable_pageSize"
  79. background
  80. layout="prev, pager, next"
  81. :total="shareTable_listTotal">
  82. </el-pagination>
  83. </div>
  84. </div>
  85. <div slot="footer" class="dialog-footer">
  86. <el-button @click="shareDialog = false">关 闭</el-button>
  87. </div>
  88. </el-dialog>
  89. </div>
  90. </template>
  91. <script>
  92. import {getMemberCouponList, getShareList} from "@/api/member";
  93. import {dateFormat} from "@/utils/util"
  94. export default {
  95. name: 'MemberCoupon',
  96. componentName: 'MemberCoupon',
  97. props: ['user'],
  98. data() {
  99. return {
  100. dataList: [], // 数据列表
  101. listLoading: true, // 列表加载loading
  102. currentPage: 1, // 当前页码
  103. pageSize: 10, // 每页数量
  104. listTotal: 0, // 列表总数
  105. detailId: '',
  106. shareDialog: false, // 分享详情 - 弹窗
  107. shareTable_dataList: null, // 分享详情 - 列表数据
  108. shareTable_listLoading: true, // 分享详情 - 列表加载loading
  109. shareTable_currentPage: 1, // 分享详情 - 当前页码
  110. shareTable_pageSize: 10, // 分享详情 - 每页数量
  111. shareTable_listTotal: 0, // 分享详情 - 列表总数
  112. }
  113. },
  114. created() {
  115. this.getCouponList()
  116. },
  117. methods: {
  118. getCouponList() {
  119. let params = {
  120. userId: this.user.userId,
  121. pageNum: this.currentPage,
  122. pageSize: this.pageSize
  123. }
  124. getMemberCouponList(params).then(res => {
  125. this.dataList = res.data.records
  126. this.listTotal = res.data.total
  127. this.listLoading = false
  128. })
  129. },
  130. // 更改每页数量
  131. handleSizeChange(val) {
  132. this.pageSize = val
  133. this.currentPage = 1
  134. this.getCouponList()
  135. },
  136. // 更改当前页
  137. handleCurrentChange(val) {
  138. this.currentPage = val
  139. this.getCouponList()
  140. },
  141. formatDate(row) {
  142. return dateFormat('YYYY.mm.dd', new Date(row.activeStartTime)) + ' - ' + dateFormat('YYYY.mm.dd', new Date(row.activeEndTime))
  143. },
  144. // 分享详情 - 获取列表
  145. getShareList() {
  146. getShareList({
  147. pageNo: this.shareTable_currentPage,
  148. pageSize: this.shareTable_pageSize,
  149. userCouponId: this.detailId,
  150. // userId: this.user.userId,
  151. }).then(res => {
  152. this.shareTable_dataList = res.data.records;
  153. this.shareTable_listTotal = res.data.total;
  154. this.shareTable_listLoading = false;
  155. })
  156. },
  157. // 分享详情 - 打开弹窗
  158. openShareDetail(id) {
  159. this.detailId = id;
  160. this.shareDialog = true;
  161. this.shareTable_currentPage = 1;
  162. this.getShareList();
  163. },
  164. // 分享详情 - 更改列表当前页
  165. shareTableCurrentChange(val) {
  166. this.shareTable_currentPage = val;
  167. this.getShareList();
  168. },
  169. }
  170. }
  171. </script>
  172. <style scoped>
  173. </style>