credit_list.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div class="app-container">
  3. <div v-if="showRecord">
  4. <!-- 筛选条件 -->
  5. <div>
  6. <el-form
  7. ref="searchForm"
  8. :model="searchForm"
  9. label-width="100px"
  10. size="small"
  11. label-position="left"
  12. >
  13. <el-row :gutter="20">
  14. <el-col :xs="24" :sm="12" :lg="6">
  15. <el-form-item label="经销商编码" prop="customerNumber">
  16. <el-input
  17. v-model="searchForm.customerNumber"
  18. placeholder="请输入"
  19. ></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :xs="24" :sm="12" :lg="6">
  23. <el-form-item label="经销商名称" prop="customerName">
  24. <el-input
  25. v-model="searchForm.customerName"
  26. placeholder="请输入"
  27. ></el-input>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :xs="24" :sm="12" :lg="6">
  31. <el-form-item label="关联钱包" prop="walletName">
  32. <el-input
  33. v-model="searchForm.walletName"
  34. placeholder="请输入"
  35. ></el-input>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :xs="24" :sm="12" :lg="6">
  39. <el-form-item label="总信用额度" prop="amount">
  40. <el-input
  41. v-model="searchForm.amount"
  42. placeholder="请输入"
  43. ></el-input>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :xs="24" :sm="24" :lg="24">
  47. <el-form-item label="" class="fr">
  48. <el-button size="small" @click="clearFn">清空</el-button>
  49. <el-button size="small" type="primary" @click="searchFn"
  50. >搜索</el-button
  51. >
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. </el-form>
  56. </div>
  57. <!-- 按钮 -->
  58. <div class="btn-group clearfix">
  59. <div class="fr">
  60. <el-button type="primary" size="small" @click="exportList"
  61. >导出</el-button
  62. >
  63. <el-button type="primary" size="small">打印</el-button>
  64. </div>
  65. </div>
  66. <!-- 列表 -->
  67. <div class="mymain-container">
  68. <div class="table">
  69. <el-table
  70. v-loading="listLoading"
  71. :data="dataList"
  72. element-loading-text="Loading"
  73. border
  74. fit
  75. highlight-current-row
  76. stripe
  77. >
  78. <el-table-column
  79. label="序号"
  80. align="center"
  81. type="index"
  82. width="100"
  83. show-overflow-tooltip
  84. ></el-table-column>
  85. <el-table-column
  86. align="center"
  87. label="经销商编码"
  88. prop="customerNumber"
  89. min-width="160"
  90. show-overflow-tooltip
  91. ></el-table-column>
  92. <el-table-column
  93. align="center"
  94. label="经销商名称"
  95. prop="customerName"
  96. min-width="160"
  97. show-overflow-tooltip
  98. ></el-table-column>
  99. <el-table-column
  100. align="center"
  101. label="总信用额度"
  102. prop="amount"
  103. min-width="160"
  104. show-overflow-tooltip
  105. >
  106. <template slot-scope="scope">
  107. {{ scope.row.usedCreditAmount + scope.row.freeCreditAmount }}
  108. </template>
  109. </el-table-column>
  110. <el-table-column
  111. align="center"
  112. label="关联钱包"
  113. prop="name"
  114. min-width="160"
  115. show-overflow-tooltip
  116. ></el-table-column>
  117. <el-table-column
  118. align="center"
  119. label="操作"
  120. min-width="160"
  121. show-overflow-tooltip
  122. >
  123. <template slot-scope="scope">
  124. <el-button
  125. type="text"
  126. class="textColor"
  127. @click="editFn(scope.row)"
  128. >设置额度</el-button
  129. >
  130. <el-button
  131. type="text"
  132. class="textColor"
  133. @click="recordFn(scope.row.customerWalletId)"
  134. >记录</el-button
  135. >
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </div>
  140. <!-- 分页 -->
  141. <div class="fr">
  142. <el-pagination
  143. @size-change="handleSizeChange"
  144. @current-change="handleCurrentChange"
  145. :current-page="currentPage"
  146. :page-sizes="[10, 20, 30, 50]"
  147. :page-size="10"
  148. layout="total, sizes, prev, pager, next, jumper"
  149. :total="listTotal"
  150. >
  151. </el-pagination>
  152. </div>
  153. </div>
  154. </div>
  155. <CreditListDetail :recordsListId="recordsListId" v-else />
  156. <!-- 新增弹窗 -->
  157. <el-dialog
  158. title="经销商信用额度管理"
  159. :visible.sync="dialogForm"
  160. width="30%"
  161. :show-close="false"
  162. :close-on-click-modal="false"
  163. >
  164. <el-form
  165. ref="addForm"
  166. :rules="rules"
  167. :model="addForm"
  168. label-width="120px"
  169. >
  170. <el-form-item label="信用变更额度" prop="amount">
  171. <el-input v-model.number="addForm.amount"></el-input>
  172. </el-form-item>
  173. <el-form-item label="开始时间" prop="startTime">
  174. <el-date-picker
  175. class="selectStyle"
  176. v-model="addForm.startTime"
  177. type="datetime"
  178. placeholder="选择日期时间"
  179. default-time="00:00:00"
  180. value-format="yyyy-MM-dd HH:mm:ss"
  181. >
  182. </el-date-picker>
  183. </el-form-item>
  184. <el-form-item label="结束时间" prop="endTime">
  185. <el-date-picker
  186. class="selectStyle"
  187. v-model="addForm.endTime"
  188. type="datetime"
  189. placeholder="选择日期时间"
  190. default-time="00:00:00"
  191. value-format="yyyy-MM-dd HH:mm:ss"
  192. >
  193. </el-date-picker>
  194. </el-form-item>
  195. </el-form>
  196. <div slot="footer" class="dialog-footer">
  197. <el-button @click="cancelFn">取 消</el-button>
  198. <el-button type="primary" @click="addDataFn">确 定</el-button>
  199. </div>
  200. </el-dialog>
  201. </div>
  202. </template>
  203. <script>
  204. import {
  205. getCreditListEdit,
  206. getWalletCustomerList,
  207. } from "@/api/finance/credit_list";
  208. import CreditListDetail from "./components/credit_list-detail";
  209. import { downloadFiles } from "@/utils/util";
  210. export default {
  211. components: {
  212. CreditListDetail,
  213. },
  214. data() {
  215. return {
  216. currentPage: 1, // 当前页码
  217. pageSize: 10, // 每页数量
  218. listTotal: 0, // 列表总数
  219. dataList: [], // 列表数据
  220. searchForm: {
  221. customerNumber: "",
  222. customerName: "",
  223. amount: "",
  224. walletName: "",
  225. }, //搜索表单
  226. listLoading: false, // 列表加载loading
  227. showRecord: true,
  228. dialogForm: false, //弹窗表单
  229. addForm: {
  230. startTime: "",
  231. endTime: "",
  232. amount: null,
  233. },
  234. data: null,
  235. recordsListId: {}, //记录
  236. rules: {
  237. startTime: [
  238. { required: true, message: "请选择开始时间", trigger: "blur" },
  239. ],
  240. endTime: [
  241. { required: true, message: "请选择结束时间", trigger: "blur" },
  242. ],
  243. amount: [
  244. {
  245. required: true,
  246. message: "请输入数字",
  247. type: "number",
  248. trigger: "blur",
  249. },
  250. ],
  251. customerId: [
  252. { required: true, message: "请选择经销商", trigger: "blur" },
  253. ],
  254. customerWalletId: [
  255. { required: true, message: "请选择钱包", trigger: "blur" },
  256. ],
  257. },
  258. };
  259. },
  260. created() {
  261. this.getDataList({ type: "COMMONLY" });
  262. },
  263. methods: {
  264. //设置额度
  265. editFn(value) {
  266. this.data = {
  267. customerId: value.customerId,
  268. customerWalletId: value.customerWalletId,
  269. };
  270. this.dialogForm = true;
  271. },
  272. //导出
  273. exportList() {
  274. let screenData = {
  275. amount: this.searchForm.amount,
  276. customerNumber: this.searchForm.customerNumber,
  277. customerName: this.searchForm.customerName,
  278. walletName: this.searchForm.walletName,
  279. };
  280. downloadFiles("/credit/exportData", screenData);
  281. },
  282. //清空
  283. clearFn() {
  284. this.$refs.searchForm.resetFields();
  285. },
  286. //搜索
  287. searchFn() {},
  288. // 更改每页数量
  289. handleSizeChange(val) {
  290. this.pageSize = val;
  291. this.currentPage = 1;
  292. this.getDataList({ pageNum: 1, pageSize: this.pageSize });
  293. },
  294. // 更改当前页
  295. handleCurrentChange(val) {
  296. this.currentPage = val;
  297. this.getDataList({ pageNum: val, pageSize: 10 });
  298. },
  299. //列表数据
  300. async getDataList(data) {
  301. const res = await getWalletCustomerList(data);
  302. console.log(res);
  303. this.dataList = res.data;
  304. },
  305. //确定
  306. async addDataFn() {
  307. await this.$refs.addForm.validate();
  308. await getCreditListEdit({ ...this.addForm, ...this.data });
  309. this.getDataList({ type: "COMMONLY" });
  310. this.$message.success("设置成功");
  311. this.dialogForm = false;
  312. },
  313. //取消
  314. async cancelFn() {
  315. await this.$refs.addForm.resetFields();
  316. this.dialogForm = false;
  317. },
  318. //记录
  319. recordFn(id) {
  320. console.log(id);
  321. this.recordsListId = id;
  322. this.showRecord = false;
  323. },
  324. },
  325. };
  326. </script>
  327. <style lang="scss" scoped>
  328. .selectStyle {
  329. width: 100%;
  330. }
  331. </style>