index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="手机号码" prop="mobilePhone">
  5. <el-input
  6. v-model="queryParams.mobilePhone"
  7. placeholder="请输入用户手机号码"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button type="info" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. <!-- <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button> -->
  17. </el-form-item>
  18. </el-form>
  19. <el-table v-loading="loading" :data="pointsList" >
  20. <el-table-column label="id" align="center" prop="id" v-if ="false" />
  21. <el-table-column label="微信用户unionID" align="center" prop="unionId" v-if="false"/>
  22. <el-table-column label="公众号的openID" align="center" prop="blogOpenid" v-if="false"/>
  23. <el-table-column label="小程序的openID" align="center" prop="minaOpenid" v-if="false" />
  24. <el-table-column label="会员名" align="center" prop="customerName" />
  25. <el-table-column label="手机号码" align="center" prop="mobilePhone" />
  26. <el-table-column label="账户积分余额" align="center" prop="points" />
  27. <el-table-column label="使用积分累计" align="center" prop="consumptionPoints" />
  28. <el-table-column label="获得积分累计" align="center" prop="accumulatePoints" />
  29. <el-table-column label="失效积分累计" align="center" prop="invalidPoints" />
  30. <el-table-column label="最近积分变化日期" align="center" prop="recentConsumptionDate" width="180">
  31. <template slot-scope="scope">
  32. <span>{{ parseTime(scope.row.recentConsumptionDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="油站ID" align="center" prop="stationId" v-if="false"/>
  36. <el-table-column label="油站名称" align="center" prop="stationName" v-if="false" />
  37. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  38. <template slot-scope="scope">
  39. <el-button
  40. size="mini"
  41. type="text"
  42. icon="el-icon-edit"
  43. @click="lookInfo(scope.row)"
  44. >明细</el-button>
  45. </template>
  46. </el-table-column>
  47. </el-table>
  48. <pagination
  49. v-show="total>0"
  50. :total="total"
  51. :page.sync="queryParams.pageNum"
  52. :limit.sync="queryParams.pageSize"
  53. @pagination="getList"
  54. />
  55. <!-- 添加或修改客户积分记录对话框 -->
  56. <el-dialog :title="title" :visible.sync="open" width="750px" append-to-body>
  57. <div class="app-container">
  58. <el-table v-loading="loadingInfo" :data="recordList" >
  59. <el-table-column label="主键自增" align="center" prop="id" v-if ="false"/>
  60. <el-table-column label="微信用户唯一标识" align="center" prop="unionId" v-if ="false"/>
  61. <el-table-column label="客户名称" align="center" prop="customerName" />
  62. <el-table-column label="积分记录类型" align="center" prop="recordType" :formatter="recordTypeFotmat" />
  63. <el-table-column label="消耗或增加积分" align="center" prop="integral" />
  64. <el-table-column label="时间" align="center" prop="createTime" />
  65. <el-table-column label="油站ID" align="center" prop="stationId" v-if ="false" />
  66. <el-table-column label="油站名称" align="center" prop="stationName" />
  67. </el-table>
  68. <pagination
  69. v-show="totalInfo>0"
  70. :total="totalInfo"
  71. :page.sync="query.pageNum"
  72. :limit.sync="query.pageSize"
  73. @pagination="getInfoList"
  74. />
  75. </div>
  76. </el-dialog>
  77. </div>
  78. </template>
  79. <script>
  80. import { listPoints, exportPoints } from "@/api/integral/points";
  81. import { listRecord } from "@/api/integral/record";
  82. export default {
  83. name: "Points",
  84. data() {
  85. return {
  86. // 遮罩层
  87. loading: true,
  88. loadingInfo: true,
  89. // 选中数组
  90. ids: [],
  91. // 非单个禁用
  92. single: true,
  93. // 非多个禁用
  94. multiple: true,
  95. // 显示搜索条件
  96. showSearch: true,
  97. // 总条数
  98. total: 0,
  99. totalInfo: 0,
  100. // 用户积分表格数据
  101. pointsList: [],
  102. //用户积分明细
  103. recordList: [],
  104. // 弹出层标题
  105. title: "",
  106. // 是否显示弹出层
  107. open: false,
  108. // 查询参数
  109. queryParams: {
  110. pageNum: 1,
  111. pageSize: 10,
  112. unionId: null,
  113. blogOpenid: null,
  114. minaOpenid: null,
  115. mobilePhone: null,
  116. points: null,
  117. consumptionPoints: null,
  118. accumulatePoints: null,
  119. invalidPoints: null,
  120. recentConsumptionDate: null,
  121. stationId: null,
  122. stationName: null
  123. },
  124. //积分明细 查询参数
  125. query: {
  126. pageNum: 1,
  127. pageSize: 10,
  128. unionId: null,
  129. customerName: null,
  130. recordType: null,
  131. integral: null,
  132. stationId: null,
  133. stationName: null
  134. },
  135. // 表单参数
  136. form: {},
  137. // 表单校验
  138. rules: {
  139. }
  140. };
  141. },
  142. created() {
  143. this.getList();
  144. },
  145. methods: {
  146. recordTypeFotmat(row, column){
  147. if(row.recordType === '-'){
  148. return '兑换积分'
  149. }else if(row.recordType === '+'){
  150. return '增加积分'
  151. }
  152. },
  153. /** 查询用户积分列表 */
  154. getList() {
  155. this.loading = true;
  156. this.queryParams.stationId= this.$store.selectDeptId;
  157. if(this.queryParams.stationId==null || this.queryParams.stationId==""){
  158. this.queryParams.stationId =this.$store.state.user.deptId;
  159. }
  160. listPoints(this.queryParams).then(response => {
  161. this.pointsList = response.rows;
  162. this.total = response.total;
  163. this.loading = false;
  164. });
  165. },
  166. /** 查询用户积分明细列表 */
  167. getInfoList() {
  168. this.loadingInfo = true;
  169. this.queryParams.stationId= this.$store.selectDeptId;
  170. listRecord(this.query).then(response => {
  171. this.recordList = response.rows;
  172. this.totalInfo = response.total;
  173. this.loadingInfo = false;
  174. });
  175. },
  176. // 取消按钮
  177. cancel() {
  178. this.open = false;
  179. this.reset();
  180. },
  181. // 表单重置
  182. reset() {
  183. this.form = {
  184. id: null,
  185. unionId: null,
  186. blogOpenid: null,
  187. minaOpenid: null,
  188. mobilePhone: null,
  189. points: null,
  190. consumptionPoints: null,
  191. accumulatePoints: null,
  192. invalidPoints: null,
  193. recentConsumptionDate: null,
  194. stationId: null,
  195. stationName: null
  196. };
  197. this.resetForm("form");
  198. },
  199. /** 搜索按钮操作 */
  200. handleQuery() {
  201. this.queryParams.pageNum = 1;
  202. this.getList();
  203. },
  204. /** 重置按钮操作 */
  205. resetQuery() {
  206. this.resetForm("queryForm");
  207. this.handleQuery();
  208. },
  209. //查看明细
  210. lookInfo(rows){
  211. this.query.unionId = rows.unionId;
  212. this.getInfoList();
  213. this.open = true;
  214. this.title = "查看客户积分记录";
  215. },
  216. /** 导出按钮操作 */
  217. handleExport() {
  218. const queryParams = this.queryParams;
  219. this.$confirm('是否确认导出所有用户积分数据项?', "警告", {
  220. confirmButtonText: "确定",
  221. cancelButtonText: "取消",
  222. type: "warning"
  223. }).then(function() {
  224. return exportPoints(queryParams);
  225. }).then(response => {
  226. this.download(response.msg);
  227. })
  228. }
  229. }
  230. };
  231. </script>