index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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="companyId">
  5. <el-select style="width: 220px" v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  6. <el-option
  7. v-for="item in companys"
  8. :key="item.companyId"
  9. :label="item.companyName"
  10. :value="item.companyId"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="订单号" prop="rechargeNo">
  15. <el-input
  16. style="width: 220px"
  17. v-model="queryParams.rechargeNo"
  18. placeholder="请输入充值订单号"
  19. clearable
  20. size="small"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item label="支付时间" prop="payTime">
  25. <el-date-picker v-model="dateRange" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  26. </el-form-item>
  27. <el-form-item label="状态" prop="status">
  28. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  29. <el-option
  30. v-for="dict in statusOptions"
  31. :key="dict.dictValue"
  32. :label="dict.dictLabel"
  33. :value="dict.dictValue"
  34. />
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="支付类型" prop="payType">
  38. <el-select style="width: 220px" v-model="queryParams.payType" placeholder="请选择支付类型" clearable size="small">
  39. <el-option
  40. v-for="dict in payTypeOptions"
  41. :key="dict.dictValue"
  42. :label="dict.dictLabel"
  43. :value="dict.dictValue"
  44. />
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item>
  48. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  49. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  50. </el-form-item>
  51. </el-form>
  52. <el-row :gutter="10" class="mb8">
  53. <el-col :span="1.5">
  54. <el-button
  55. type="warning"
  56. icon="el-icon-download"
  57. size="mini"
  58. @click="handleExport"
  59. v-hasPermi="['company:companyRecharge:export']"
  60. >导出</el-button>
  61. </el-col>
  62. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  63. </el-row>
  64. <el-tabs type="card" v-model="queryParams.isAudit" @tab-click="handleClick">
  65. <el-tab-pane label="待审核" name="0"></el-tab-pane>
  66. <el-tab-pane label="已审核" name="1"></el-tab-pane>
  67. <el-tab-pane label="已驳回" name="-1"></el-tab-pane>
  68. </el-tabs>
  69. <el-table height="500" border v-loading="loading" :data="companyRechargeList" @selection-change="handleSelectionChange">
  70. <el-table-column type="selection" width="55" align="center" />
  71. <el-table-column label="ID" align="center" prop="rechargeId" />
  72. <el-table-column label="充值订单号" align="center" prop="rechargeNo" />
  73. <el-table-column label="公司" align="center" prop="companyName" />
  74. <el-table-column label="充值金额" align="center" prop="money" />
  75. <el-table-column label="充值类型" align="center" prop="payType" >
  76. <template slot-scope="scope">
  77. <el-tag prop="status" v-for="(item, index) in payTypeOptions" v-if="scope.row.payType==item.dictValue">{{item.dictLabel}}</el-tag>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="提交人" align="center" prop="createUserNickName" width="180">
  81. </el-table-column>
  82. <el-table-column label="提交时间" align="center" prop="createTime" width="180">
  83. </el-table-column>
  84. <el-table-column label="审核人" align="center" prop="auditUserNickName" width="180">
  85. </el-table-column>
  86. <el-table-column label="审核时间" align="center" prop="auditTime" width="180">
  87. </el-table-column>
  88. <el-table-column label="支付时间" align="center" prop="payTime" width="180">
  89. </el-table-column>
  90. <el-table-column label="状态" align="center" prop="status" >
  91. <template slot-scope="scope">
  92. <el-tag prop="status" v-for="(item, index) in statusOptions" :type="scope.row.status==1?'success':'danger'" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="备注" align="center" prop="remark" />
  96. <el-table-column label="操作" fixed="right" align="center" width="120px" class-name="small-padding fixed-width">
  97. <template slot-scope="scope">
  98. <el-button
  99. v-if="scope.row.isAudit==0"
  100. size="mini"
  101. type="text"
  102. icon="el-icon-edit"
  103. @click="handleAudit(scope.row)"
  104. v-hasPermi="['company:companyRecharge:audit']"
  105. >审核</el-button>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <pagination
  110. v-show="total>0"
  111. :total="total"
  112. :page.sync="queryParams.pageNum"
  113. :limit.sync="queryParams.pageSize"
  114. @pagination="getList"
  115. />
  116. <!-- 添加或修改充值对话框 -->
  117. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
  118. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  119. <el-form-item label="公司" prop="companyName">
  120. <el-input v-model="form.companyName" disabled />
  121. </el-form-item>
  122. <el-form-item label="充值金额" prop="money">
  123. <el-input v-model="form.money" disabled />
  124. </el-form-item>
  125. <el-form-item label="状态">
  126. <el-radio-group v-model="form.isAudit">
  127. <el-radio label="1">通过</el-radio>
  128. <el-radio label="-1">驳回</el-radio>
  129. </el-radio-group>
  130. </el-form-item>
  131. <el-form-item label="备注" prop="remark">
  132. <el-input v-model="form.remark" type="textarea" :row="5" />
  133. </el-form-item>
  134. </el-form>
  135. <div slot="footer" class="dialog-footer">
  136. <el-button type="primary" @click="submitForm">确 定</el-button>
  137. <el-button @click="cancel">取 消</el-button>
  138. </div>
  139. </el-dialog>
  140. </div>
  141. </template>
  142. <script>
  143. import { listCompanyRecharge, getCompanyRecharge, audit, exportCompanyRecharge } from "@/api/company/companyRecharge";
  144. import { getCompanyList } from "@/api/company/company";
  145. export default {
  146. name: "CompanyRecharge",
  147. data() {
  148. return {
  149. payTypeOptions:[],
  150. companys:[],
  151. statusOptions:[],
  152. // 遮罩层
  153. loading: true,
  154. // 选中数组
  155. ids: [],
  156. // 非单个禁用
  157. single: true,
  158. // 非多个禁用
  159. multiple: true,
  160. // 显示搜索条件
  161. showSearch: true,
  162. // 总条数
  163. total: 0,
  164. dateRange: [],
  165. // 充值表格数据
  166. companyRechargeList: [],
  167. // 弹出层标题
  168. title: "",
  169. // 是否显示弹出层
  170. open: false,
  171. // 查询参数
  172. queryParams: {
  173. pageNum: 1,
  174. pageSize: 10,
  175. companyId: null,
  176. money: null,
  177. rechargeNo: null,
  178. payTime: null,
  179. status: null,
  180. isAudit:0,
  181. },
  182. // 表单参数
  183. form: {},
  184. // 表单校验
  185. rules: {
  186. isAudit: [
  187. { required: true, message: "状态不能为空", trigger: "blur" }
  188. ],
  189. }
  190. };
  191. },
  192. created() {
  193. getCompanyList().then(response => {
  194. this.companys = response.data;
  195. });
  196. this.getDicts("sys_comapny_recharge_pay_type").then((response) => {
  197. this.payTypeOptions = response.data;
  198. });
  199. this.getDicts("sys_company_pay_status").then((response) => {
  200. this.statusOptions = response.data;
  201. });
  202. this.getList();
  203. },
  204. methods: {
  205. handleClick(tab, event) {
  206. this.queryParams.isAudit=tab.name
  207. this.getList();
  208. },
  209. /** 查询充值列表 */
  210. getList() {
  211. this.loading = true;
  212. listCompanyRecharge(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  213. this.companyRechargeList = response.rows;
  214. this.total = response.total;
  215. this.loading = false;
  216. });
  217. },
  218. // 取消按钮
  219. cancel() {
  220. this.open = false;
  221. this.reset();
  222. },
  223. // 表单重置
  224. reset() {
  225. this.form = {
  226. rechargeId: null,
  227. companyId: null,
  228. money: null,
  229. rechargeNo: null,
  230. createTime: null,
  231. payTime: null,
  232. isAudit: "1"
  233. };
  234. this.resetForm("form");
  235. },
  236. /** 搜索按钮操作 */
  237. handleQuery() {
  238. this.queryParams.pageNum = 1;
  239. this.getList();
  240. },
  241. /** 重置按钮操作 */
  242. resetQuery() {
  243. this.dateRange=[];
  244. this.resetForm("queryForm");
  245. this.handleQuery();
  246. },
  247. // 多选框选中数据
  248. handleSelectionChange(selection) {
  249. this.ids = selection.map(item => item.rechargeId)
  250. this.single = selection.length!==1
  251. this.multiple = !selection.length
  252. },
  253. /** 修改按钮操作 */
  254. handleAudit(row) {
  255. this.reset();
  256. const rechargeId = row.rechargeId || this.ids
  257. getCompanyRecharge(rechargeId).then(response => {
  258. this.form = response.data;
  259. this.form.companyName = row.companyName;
  260. this.form.isAudit="1"
  261. this.open = true;
  262. this.title = "充值";
  263. });
  264. },
  265. /** 提交按钮 */
  266. submitForm() {
  267. this.$refs["form"].validate(valid => {
  268. if (valid) {
  269. audit(this.form).then(response => {
  270. if (response.code === 200) {
  271. this.msgSuccess("审核成功");
  272. this.open = false;
  273. this.getList();
  274. }
  275. });
  276. }
  277. });
  278. },
  279. /** 导出按钮操作 */
  280. handleExport() {
  281. const queryParams = this.queryParams;
  282. this.$confirm('是否确认导出所有充值数据项?', "警告", {
  283. confirmButtonText: "确定",
  284. cancelButtonText: "取消",
  285. type: "warning"
  286. }).then(function() {
  287. return exportCompanyRecharge(queryParams);
  288. }).then(response => {
  289. this.download(response.msg);
  290. }).catch(function() {});
  291. }
  292. }
  293. };
  294. </script>