index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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="payTime">
  5. <el-date-picker v-model="dateRange" size="small" style="width: 205.4px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  6. </el-form-item>
  7. <el-form-item label="支付类型" prop="payType">
  8. <el-select v-model="queryParams.payType" placeholder="请选择支付类型" clearable size="small">
  9. <el-option
  10. v-for="dict in payTypeOptions"
  11. :key="dict.dictValue"
  12. :label="dict.dictLabel"
  13. :value="dict.dictValue"
  14. />
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item label="状态" prop="status">
  18. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  19. <el-option
  20. v-for="dict in statusOptions"
  21. :key="dict.dictValue"
  22. :label="dict.dictLabel"
  23. :value="dict.dictValue"
  24. />
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item>
  28. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  29. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  30. </el-form-item>
  31. </el-form>
  32. <el-row :gutter="10" class="mb8">
  33. <el-col :span="1.5">
  34. <el-button
  35. type="warning"
  36. icon="el-icon-download"
  37. size="mini"
  38. @click="handleExport"
  39. v-hasPermi="['company:companyRecharge:export']"
  40. >导出</el-button>
  41. <el-button
  42. size="mini"
  43. type="primary"
  44. icon="el-icon-edit"
  45. @click="handleRecharge"
  46. v-hasPermi="['company:companyRecharge:Recharge']"
  47. >充值</el-button>
  48. </el-col>
  49. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  50. </el-row>
  51. <el-table height="500" border v-loading="loading" :data="companyRechargeList" @selection-change="handleSelectionChange">
  52. <el-table-column type="selection" width="55" align="center" />
  53. <el-table-column label="充值订单号" align="center" prop="rechargeNo" />
  54. <el-table-column label="企业" align="center" prop="companyName" />
  55. <el-table-column label="充值金额" align="center" prop="money" />
  56. <el-table-column label="支付类型" align="center" prop="payType" >
  57. <template slot-scope="scope">
  58. <el-tag prop="status" v-for="(item, index) in payTypeOptions" v-if="scope.row.payType==item.dictValue">{{item.dictLabel}}</el-tag>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="凭证照片" align="center" prop="images" >
  62. <template slot-scope="scope">
  63. <div v-if="scope.row.imgs != null && scope.row.imgs != undefined && scope.row.imgs != ''">
  64. <el-image
  65. style="width: 80px; height: 80px"
  66. :src="scope.row.imgs.split(',')[0]"
  67. :preview-src-list="scope.row.imgs.split(',')">
  68. </el-image>
  69. <p style="margin: 0">({{scope.row.imgs.split(',').length}} 张)</p>
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="支付状态" align="center" prop="status" >
  74. <template slot-scope="scope">
  75. <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>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="支付时间" align="center" prop="payTime" width="180">
  79. <template slot-scope="scope">
  80. <span>{{ parseTime(scope.row.payTime) }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="审核状态" align="center" prop="isAudit" >
  84. <template slot-scope="scope">
  85. <el-tag prop="isAudit" type="danger" v-if="scope.row.isAudit === -1">已驳回</el-tag>
  86. <el-tag prop="isAudit" type="warning" v-if="scope.row.isAudit === 0">待审核</el-tag>
  87. <el-tag prop="isAudit" type="success" v-if="scope.row.isAudit === 1">已审核</el-tag>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="审核时间" align="center" prop="auditTime" width="180">
  91. <template slot-scope="scope">
  92. <span>{{ parseTime(scope.row.auditTime) }}</span>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <pagination
  97. v-show="total>0"
  98. :total="total"
  99. :page.sync="queryParams.pageNum"
  100. :limit.sync="queryParams.pageSize"
  101. @pagination="getList"
  102. />
  103. <!-- 添加或修改充值对话框 -->
  104. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  105. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  106. <el-form-item label="企业ID" prop="companyId">
  107. <el-input v-model="form.companyId" placeholder="请输入企业ID" />
  108. </el-form-item>
  109. <el-form-item label="金额" prop="money">
  110. <el-input v-model="form.money" placeholder="请输入金额" />
  111. </el-form-item>
  112. <el-form-item label="充值订单号" prop="rechargeNo">
  113. <el-input v-model="form.rechargeNo" placeholder="请输入充值订单号" />
  114. </el-form-item>
  115. <el-form-item label="支付时间" prop="payTime">
  116. <el-date-picker clearable size="small" style="width: 200px"
  117. v-model="form.payTime"
  118. type="date"
  119. value-format="yyyy-MM-dd"
  120. placeholder="选择支付时间">
  121. </el-date-picker>
  122. </el-form-item>
  123. <el-form-item label="状态 0未支付 1已支付">
  124. <el-radio-group v-model="form.status">
  125. <el-radio label="1">请选择字典生成</el-radio>
  126. </el-radio-group>
  127. </el-form-item>
  128. </el-form>
  129. <div slot="footer" class="dialog-footer">
  130. <el-button type="primary" @click="submitForm">确 定</el-button>
  131. <el-button @click="cancel">取 消</el-button>
  132. </div>
  133. </el-dialog>
  134. <!-- 充值对话框 -->
  135. <el-dialog :title="recharge.title" :visible.sync="recharge.open" width="500px" append-to-body>
  136. <el-form ref="rechargeForm" :rules="rechargeRules" :model="rechargeForm" label-width="80px">
  137. <!-- <el-form-item label="公司" >-->
  138. <!-- <el-input v-model="rechargeForm.companyName" disabled />-->
  139. <!-- </el-form-item>-->
  140. <!-- <el-form-item label="余额" >-->
  141. <!-- <el-input v-model="rechargeForm.balance" disabled />-->
  142. <!-- </el-form-item>-->
  143. <el-form-item label="充值金额" prop="money">
  144. <el-input-number v-model="rechargeForm.money" :min="0" placeholder="请输入充值金额" />
  145. </el-form-item>
  146. <el-form-item label="凭证" prop="imgs">
  147. <image-upload v-model="rechargeForm.imgs" :limit="9" />
  148. </el-form-item>
  149. <el-form-item label="备注" prop="remark">
  150. <el-input v-model="rechargeForm.remark" placeholder="请输入备注" />
  151. </el-form-item>
  152. </el-form>
  153. <div slot="footer" class="dialog-footer">
  154. <el-button type="primary" @click="submitRechargeForm">确 定</el-button>
  155. <el-button @click="recharge.open=false">取 消</el-button>
  156. </div>
  157. </el-dialog>
  158. </div>
  159. </template>
  160. <script>
  161. import { listCompanyRecharge, getCompanyRecharge, delCompanyRecharge, addCompanyRecharge, updateCompanyRecharge, exportCompanyRecharge, recharge } from "@/api/company/companyRecharge";
  162. import { getInfo } from '@/api/login';
  163. export default {
  164. name: "CompanyRecharge",
  165. data() {
  166. return {
  167. payTypeOptions:[],
  168. statusOptions:[],
  169. // 遮罩层
  170. loading: true,
  171. // 选中数组
  172. ids: [],
  173. // 非单个禁用
  174. single: true,
  175. // 非多个禁用
  176. multiple: true,
  177. // 显示搜索条件
  178. showSearch: true,
  179. // 总条数
  180. total: 0,
  181. dateRange: [],
  182. // 充值表格数据
  183. companyRechargeList: [],
  184. // 弹出层标题
  185. title: "",
  186. // 是否显示弹出层
  187. open: false,
  188. // 查询参数
  189. queryParams: {
  190. pageNum: 1,
  191. pageSize: 10,
  192. companyId: null,
  193. money: null,
  194. rechargeNo: null,
  195. payTime: null,
  196. status: null
  197. },
  198. // 表单参数
  199. form: {},
  200. // 表单校验
  201. rules: {
  202. },
  203. recharge:{
  204. open:false,
  205. title:"后台充值"
  206. },
  207. // 表单校验
  208. rechargeRules: {
  209. money: [
  210. { required: true, message: "充值金额不能为空", trigger: "blur" }
  211. ],
  212. imgs: [
  213. { required: true, message: "凭证不能为空", trigger: "change" }
  214. ],
  215. },
  216. // 表单参数
  217. rechargeForm: {
  218. money: 0,
  219. },
  220. };
  221. },
  222. created() {
  223. this.getDicts("company_pay_status").then((response) => {
  224. this.statusOptions = response.data;
  225. });
  226. this.getDicts("comapny_recharge_pay_type").then((response) => {
  227. this.payTypeOptions = response.data;
  228. });
  229. this.getList();
  230. },
  231. methods: {
  232. /** 查询充值列表 */
  233. getList() {
  234. this.loading = true;
  235. listCompanyRecharge(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  236. this.companyRechargeList = response.rows;
  237. this.total = response.total;
  238. this.loading = false;
  239. });
  240. },
  241. // 取消按钮
  242. cancel() {
  243. this.open = false;
  244. this.reset();
  245. },
  246. // 表单重置
  247. reset() {
  248. this.form = {
  249. rechargeId: null,
  250. companyId: null,
  251. money: null,
  252. rechargeNo: null,
  253. createTime: null,
  254. payTime: null,
  255. status: 0
  256. };
  257. this.resetForm("form");
  258. },
  259. /** 搜索按钮操作 */
  260. handleQuery() {
  261. this.queryParams.pageNum = 1;
  262. this.getList();
  263. },
  264. /** 重置按钮操作 */
  265. resetQuery() {
  266. this.resetForm("queryForm");
  267. this.handleQuery();
  268. },
  269. // 多选框选中数据
  270. handleSelectionChange(selection) {
  271. this.ids = selection.map(item => item.rechargeId)
  272. this.single = selection.length!==1
  273. this.multiple = !selection.length
  274. },
  275. /** 新增按钮操作 */
  276. handleAdd() {
  277. this.reset();
  278. this.open = true;
  279. this.title = "添加充值";
  280. },
  281. /** 修改按钮操作 */
  282. handleUpdate(row) {
  283. this.reset();
  284. const rechargeId = row.rechargeId || this.ids
  285. getCompanyRecharge(rechargeId).then(response => {
  286. this.form = response.data;
  287. this.open = true;
  288. this.title = "修改充值";
  289. });
  290. },
  291. /** 提交按钮 */
  292. submitForm() {
  293. this.$refs["form"].validate(valid => {
  294. if (valid) {
  295. if (this.form.rechargeId != null) {
  296. updateCompanyRecharge(this.form).then(response => {
  297. if (response.code === 200) {
  298. this.msgSuccess("修改成功");
  299. this.open = false;
  300. this.getList();
  301. }
  302. });
  303. } else {
  304. addCompanyRecharge(this.form).then(response => {
  305. if (response.code === 200) {
  306. this.msgSuccess("新增成功");
  307. this.open = false;
  308. this.getList();
  309. }
  310. });
  311. }
  312. }
  313. });
  314. },
  315. /** 删除按钮操作 */
  316. handleDelete(row) {
  317. const rechargeIds = row.rechargeId || this.ids;
  318. this.$confirm('是否确认删除充值编号为"' + rechargeIds + '"的数据项?', "警告", {
  319. confirmButtonText: "确定",
  320. cancelButtonText: "取消",
  321. type: "warning"
  322. }).then(function() {
  323. return delCompanyRecharge(rechargeIds);
  324. }).then(() => {
  325. this.getList();
  326. this.msgSuccess("删除成功");
  327. }).catch(function() {});
  328. },
  329. /** 导出按钮操作 */
  330. handleExport() {
  331. const queryParams = this.queryParams;
  332. this.$confirm('是否确认导出所有充值数据项?', "警告", {
  333. confirmButtonText: "确定",
  334. cancelButtonText: "取消",
  335. type: "warning"
  336. }).then(function() {
  337. return exportCompanyRecharge(queryParams);
  338. }).then(response => {
  339. this.download(response.msg);
  340. }).catch(function() {});
  341. },
  342. /** 充值按钮操作 */
  343. handleRecharge() {
  344. this.rechargeForm = {
  345. money: 0,
  346. balance: 0, //默认余额为0
  347. remark: '',
  348. imgs: []
  349. };
  350. this.recharge.open = true;
  351. },
  352. /** 提交按钮 */
  353. submitRechargeForm() {
  354. this.$refs["rechargeForm"].validate(valid => {
  355. if (valid) {
  356. recharge(this.rechargeForm).then(response => {
  357. if (response.code === 200) {
  358. this.msgSuccess(response.msg);
  359. this.recharge.open = false;
  360. this.getList();
  361. }
  362. });
  363. }
  364. });
  365. },
  366. }
  367. };
  368. </script>