index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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="customerName">
  5. <el-input
  6. v-model="queryParams.customerName"
  7. placeholder="请输入客户名"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="油品" prop="cardOilsType">
  14. <el-select
  15. v-model="queryParams.cardOilsType"
  16. placeholder="请选择油品"
  17. clearable
  18. size="small"
  19. >
  20. <el-option
  21. v-for="item in oilOptions"
  22. :key="item.dictValue"
  23. :label="item.dictLabel"
  24. :value="item.dictValue"
  25. ></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="消费时间" prop="">
  29. <el-date-picker
  30. v-model="dateRangeCreatedDate"
  31. type="daterange"
  32. unlink-panels
  33. range-separator="至"
  34. start-placeholder="开始日期"
  35. end-placeholder="结束日期"
  36. >
  37. </el-date-picker>
  38. </el-form-item>
  39. <el-form-item>
  40. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  41. <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">汇总</el-button> -->
  42. <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['customer:record:export']" >导出</el-button>
  43. </el-form-item>
  44. </el-form>
  45. <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
  46. <el-table-column label="id" align="center" prop="id" v-if="false" />
  47. <el-table-column label="消费单号" align="center" prop="orderNo" />
  48. <el-table-column label="微信用户唯一标识" align="center" prop="unionId" v-if="false" />
  49. <el-table-column label="电子卡号" align="center" prop="customerNo" />
  50. <el-table-column label="会员名" align="center" prop="customerName" />
  51. <el-table-column label="油品" align="center" prop="cardOilsType" :formatter="cardOilsTypeFotmat"/>
  52. <el-table-column label="电子会员卡消费充值类型:+,充值;-,消费;" align="center" prop="usageType" v-if="false" />
  53. <el-table-column label="电子会员卡充值消费类型:1.微信;2.POS机" align="center" prop="payType" v-if="false"/>
  54. <el-table-column label="消费金额" align="center" prop="amt" />
  55. <el-table-column label="余额" align="center" prop="balance" />
  56. <el-table-column label="油站ID" align="center" prop="stationId" v-if="false"/>
  57. <el-table-column label="油站名称" align="center" prop="stationName" />
  58. <el-table-column label="支付时间" align="center" prop="payDate" width="150">
  59. <template slot-scope="scope">
  60. <span>{{ parseTime(scope.row.payDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="创建时间" align="center" prop="createTime" width="150">
  64. <template slot-scope="scope1">
  65. <span>{{ parseTime(scope1.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="是否消费成功:0,未成功;1,成功" align="center" prop="status" v-if="false"/>
  69. </el-table>
  70. <pagination
  71. v-show="total>0"
  72. :total="total"
  73. :page.sync="queryParams.pageNum"
  74. :limit.sync="queryParams.pageSize"
  75. @pagination="getList"
  76. />
  77. </div>
  78. </template>
  79. <script>
  80. import { listConsumption, exportConsumption } from "@/api/customer/consumption";
  81. export default {
  82. name: "Record",
  83. data() {
  84. return {
  85. //创建订单时间间隔
  86. dateRangeCreatedDate:[],
  87. // 遮罩层
  88. loading: true,
  89. // 选中数组
  90. ids: [],
  91. // 非单个禁用
  92. single: true,
  93. // 非多个禁用
  94. multiple: true,
  95. // 显示搜索条件
  96. showSearch: true,
  97. // 总条数
  98. total: 0,
  99. // 客户电子会员卡充值消费记录表格数据
  100. recordList: [],
  101. oilOptions:[],
  102. // 弹出层标题
  103. title: "",
  104. // 是否显示弹出层
  105. open: false,
  106. // 查询参数
  107. queryParams: {
  108. pageNum: 1,
  109. pageSize: 10,
  110. orderNo: null,
  111. unionId: null,
  112. customerNo: null,
  113. customerName: null,
  114. usageType: "-",
  115. payType: null,
  116. cardOilsType: null,
  117. amt: null,
  118. presentAmt: null,
  119. balance: null,
  120. stationId: null,
  121. stationName: null,
  122. status: 1
  123. },
  124. // 表单参数
  125. form: {},
  126. // 表单校验
  127. rules: {
  128. }
  129. };
  130. },
  131. created() {
  132. this.getList();
  133. this.getDicts("oil").then(response => {
  134. this.oilOptions = response.data;
  135. });
  136. },
  137. methods: {
  138. cardOilsTypeFotmat(row, column){
  139. if(row.cardOilsType === '2'){
  140. return '柴油'
  141. }else if(row.cardOilsType === '1'){
  142. return '汽油'
  143. }
  144. },
  145. /** 查询客户电子会员卡充值消费记录列表 */
  146. getList() {
  147. this.loading = true;
  148. this.queryParams.stationId= this.$store.selectDeptId;
  149. if(this.queryParams.stationId==null || this.queryParams.stationId==""){
  150. this.queryParams.stationId =this.$store.state.user.deptId;
  151. }
  152. listConsumption(this.addDateRange(this.queryParams, this.dateRangeCreatedDate)).then(response => {
  153. this.recordList = response.rows;
  154. this.total = response.total;
  155. this.loading = false;
  156. });
  157. },
  158. // 取消按钮
  159. cancel() {
  160. this.open = false;
  161. this.reset();
  162. },
  163. // 表单重置
  164. reset() {
  165. this.form = {
  166. id: null,
  167. orderNo: null,
  168. unionId: null,
  169. customerNo: null,
  170. customerName: null,
  171. usageType: null,
  172. payType: null,
  173. cardOilsType: null,
  174. amt: null,
  175. presentAmt: null,
  176. balance: null,
  177. createTime: null,
  178. stationId: null,
  179. stationName: null,
  180. status: "0"
  181. };
  182. this.resetForm("form");
  183. },
  184. /** 搜索按钮操作 */
  185. handleQuery() {
  186. this.queryParams.pageNum = 1;
  187. this.getList();
  188. },
  189. /** 重置按钮操作 */
  190. resetQuery() {
  191. this.resetForm("queryForm");
  192. this.handleQuery();
  193. },
  194. // 多选框选中数据
  195. handleSelectionChange(selection) {
  196. this.ids = selection.map(item => item.id)
  197. this.single = selection.length!==1
  198. this.multiple = !selection.length
  199. },
  200. /** 导出按钮操作 */
  201. handleExport() {
  202. this.queryParams.stationId= this.$store.selectDeptId;
  203. const queryParams = this.queryParams;
  204. this.$confirm('是否确认导出所有客户电子会员卡充值记录数据项?', "警告", {
  205. confirmButtonText: "确定",
  206. cancelButtonText: "取消",
  207. type: "warning"
  208. }).then(function() {
  209. return exportConsumption(queryParams);
  210. }).then(response => {
  211. this.download(response.msg);
  212. })
  213. }
  214. }
  215. };
  216. </script>