externalContactIntegral.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px">
  4. <!-- <el-form-item label="用户id" prop="userId">
  5. <el-input
  6. v-model="queryParams.userId"
  7. placeholder="请输入用户id"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>-->
  13. <!-- <el-form-item label="用户电话" prop="phone">
  14. <el-input
  15. v-model="queryParams.phone"
  16. placeholder="请输入用户电话"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>-->
  22. <el-form-item label="订单关联" prop="businessId">
  23. <el-input
  24. v-model="queryParams.businessId"
  25. placeholder="请输入订单关联"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="时间" prop="createTime">
  32. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  36. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  37. </el-form-item>
  38. </el-form>
  39. <el-row :gutter="10" class="mb8">
  40. <el-col :span="1.5">
  41. <el-button
  42. type="warning"
  43. plain
  44. icon="el-icon-download"
  45. size="mini"
  46. :loading="exportLoading"
  47. @click="handleExport"
  48. v-hasPermi="['company:integral:export']"
  49. >导出</el-button>
  50. </el-col>
  51. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  52. </el-row>
  53. <el-table v-loading="loading" border :data="userIntegralLogsList" @selection-change="handleSelectionChange">
  54. <el-table-column label="用户id" align="center" prop="userId" />
  55. <el-table-column label="用户昵称" align="center" prop="nickName" />
  56. <el-table-column label="用户电话" align="center" prop="phone" />
  57. <el-table-column label="类别" align="center" prop="logType" >
  58. <template slot-scope="scope">
  59. <dict-tag :options="intefralLogTypeOptions" :value="scope.row.logType"/>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="积分" align="center" prop="integral" />
  63. <el-table-column label="积分余额" align="center" prop="balance" />
  64. <el-table-column label="订单关联id" align="center" prop="businessId" />
  65. <el-table-column label="时间" align="center" prop="createTime" />
  66. </el-table>
  67. <pagination
  68. v-show="total>0"
  69. :total="total"
  70. :page.sync="queryParams.pageNum"
  71. :limit.sync="queryParams.pageSize"
  72. @pagination="getList"
  73. />
  74. </div>
  75. </template>
  76. <script>
  77. import { listUserIntegralLogs,exportUserIntegralLogs } from "@/api/company/companyIntegral";
  78. export default {
  79. name: "externalContactIntegral",
  80. data() {
  81. return {
  82. // 遮罩层
  83. loading: true,
  84. // 导出遮罩层
  85. exportLoading: false,
  86. // 选中数组
  87. ids: [],
  88. // 非单个禁用
  89. single: true,
  90. // 非多个禁用
  91. multiple: true,
  92. // 显示搜索条件
  93. showSearch: true,
  94. intefralLogTypeOptions: [],
  95. // 总条数
  96. total: 0,
  97. // 积分记录表格数据
  98. userIntegralLogsList: [],
  99. // 弹出层标题
  100. title: "",
  101. // 是否显示弹出层
  102. open: false,
  103. createTime:null,
  104. // 查询参数
  105. queryParams: {
  106. pageNum: 1,
  107. pageSize: 10,
  108. userId: null,
  109. logtype: null,
  110. integral: null,
  111. balance: null,
  112. businessId: null,
  113. createTime: null,
  114. phone:null,
  115. sTime:null,
  116. eTime:null,
  117. },
  118. // 表单参数
  119. form: {},
  120. // 表单校验
  121. rules: {
  122. }
  123. };
  124. },
  125. created() {
  126. this.getList();
  127. this.getDicts("sys_integral_log_type").then(response => {
  128. this.intefralLogTypeOptions = response.data;
  129. });
  130. },
  131. methods: {
  132. /** 查询积分记录列表 */
  133. getList() {
  134. this.loading = true;
  135. listUserIntegralLogs(this.queryParams).then(response => {
  136. this.userIntegralLogsList = response.rows;
  137. this.total = response.total;
  138. this.loading = false;
  139. });
  140. },
  141. // 取消按钮
  142. cancel() {
  143. this.open = false;
  144. this.reset();
  145. },
  146. // 表单重置
  147. reset() {
  148. this.form = {
  149. id: null,
  150. //userId: null,
  151. logType: null,
  152. integral: null,
  153. balance: null,
  154. businessId: null,
  155. createTime: null
  156. };
  157. this.resetForm("form");
  158. },
  159. /** 搜索按钮操作 */
  160. handleQuery() {
  161. this.queryParams.pageNum = 1;
  162. this.getList();
  163. },
  164. /** 重置按钮操作 */
  165. resetQuery() {
  166. this.resetForm("queryForm");
  167. this.createTime=null;
  168. this.queryParams.sTime=null;
  169. this.queryParams.eTime=null;
  170. this.handleQuery();
  171. },
  172. // 多选框选中数据
  173. handleSelectionChange(selection) {
  174. this.ids = selection.map(item => item.id)
  175. this.single = selection.length!==1
  176. this.multiple = !selection.length
  177. },
  178. change(){
  179. if(this.createTime!=null){
  180. this.queryParams.sTime=this.createTime[0];
  181. this.queryParams.eTime=this.createTime[1];
  182. }else{
  183. this.queryParams.sTime=null;
  184. this.queryParams.eTime=null;
  185. }
  186. },
  187. /** 导出按钮操作 */
  188. handleExport() {
  189. const queryParams = this.queryParams;
  190. this.$confirm('是否确认导出所有积分记录数据项?', "警告", {
  191. confirmButtonText: "确定",
  192. cancelButtonText: "取消",
  193. type: "warning"
  194. }).then(() => {
  195. this.exportLoading = true;
  196. return exportUserIntegralLogs(queryParams);
  197. }).then(response => {
  198. this.download(response.msg);
  199. this.exportLoading = false;
  200. }).catch(() => {});
  201. },
  202. getData(id){
  203. this.queryParams.userId = id;
  204. this.getList();
  205. }
  206. }
  207. };
  208. </script>