receivable_list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <div class="app-container">
  3. <div v-if="showPage == 1">
  4. <el-radio-group @change="changeRadioGroupFn" v-model="examine" size="mini">
  5. <el-radio-button label="">全部</el-radio-button>
  6. <el-radio-button label="WAIT">待审核</el-radio-button>
  7. <el-radio-button label="OK">审核通过</el-radio-button>
  8. <el-radio-button label="FAIL">审核驳回</el-radio-button>
  9. </el-radio-group>
  10. <br /><br />
  11. <!-- 筛选条件 -->
  12. <div>
  13. <el-form ref="searchForm" :model="searchForm" label-width="100px" size="mini" label-position="left">
  14. <el-row :gutter="20">
  15. <el-col :xs="24" :sm="12" :lg="6">
  16. <el-form-item label="单据来源" prop="source">
  17. <el-select v-model="searchForm.source" class="selectStyle" placeholder="请选择" filterable>
  18. <el-option value="工程押金"> </el-option>
  19. <el-option value="保证金"> </el-option>
  20. <el-option value="工程价差"> </el-option>
  21. <el-option value="仓储费"> </el-option>
  22. </el-select>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :xs="24" :sm="12" :lg="6">
  26. <el-form-item label="单据编号" prop="code">
  27. <el-input v-model="searchForm.code" placeholder="请输入"></el-input>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :xs="24" :sm="12" :lg="6">
  31. <el-form-item label="往来单位" prop="userName">
  32. <!-- <el-input v-model="searchForm.userName" placeholder="请输入"></el-input> -->
  33. <el-select class="selectStyle" v-model="searchForm.userName" placeholder="请选择" filterable>
  34. <el-option v-for="(v, i) in customerList" :key="i" :label="v.name" :value="v.name">
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :xs="24" :sm="12" :lg="6">
  40. <el-form-item label="业务开始时间" prop="startTime">
  41. <el-date-picker class="dateStyle" v-model="searchForm.startTime" placeholder="选择日期" type="datetime" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss">
  42. </el-date-picker>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :xs="24" :sm="12" :lg="6">
  46. <el-form-item label="业务结束时间" prop="endTime">
  47. <el-date-picker class="dateStyle" v-model="searchForm.endTime" placeholder="选择日期" type="datetime" default-time="23:59:59" value-format="yyyy-MM-dd HH:mm:ss">
  48. </el-date-picker>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :xs="24" :sm="12" :lg="18">
  52. <el-form-item label="" class="fr">
  53. <el-button size="mini" @click="clearFn">清空</el-button>
  54. <el-button size="mini" type="primary" @click="searchFn">搜索</el-button>
  55. </el-form-item>
  56. </el-col>
  57. </el-row>
  58. </el-form>
  59. </div>
  60. <!-- 按钮 -->
  61. <div class="btn-group clearfix">
  62. <div class="fl">
  63. <el-button v-if="$checkBtnRole('add', $route.meta.roles)" type="primary" icon="el-icon-plus" size="mini" @click="addFn">新建</el-button>
  64. <el-popconfirm v-if="$checkBtnRole('del', $route.meta.roles)" class="delClass" @onConfirm="deleFn" title="这是一段内容确定删除吗?">
  65. <el-button :disabled="deleList.length < 1" slot="reference" type="danger" icon="el-icon-minus" size="mini">批量删除</el-button>
  66. </el-popconfirm>
  67. </div>
  68. <div class="fr">
  69. <ExportButton :exUrl="'/finance/other/rece/listExport'" :exParams="exParams" />
  70. </div>
  71. </div>
  72. <!-- 列表 -->
  73. <div class="mymain-container">
  74. <div class="table">
  75. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe @selection-change="selectionChangeFn" show-summary :summary-method="$getSummaries">
  76. <el-table-column align="center" type="selection" width="51">
  77. </el-table-column>
  78. <el-table-column align="left" label="单据类型" prop="billType" min-width="100" show-overflow-tooltip></el-table-column>
  79. <el-table-column align="left" label="单据来源" prop="source" min-width="100" show-overflow-tooltip></el-table-column>
  80. <el-table-column align="left" label="单据编码" prop="code" min-width="190" show-overflow-tooltip>
  81. <template slot-scope="scope">
  82. <CopyButton :copyText="scope.row.code" />
  83. <span>{{scope.row.code}}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column align="left" label="业务日期" prop="theTime" min-width="160" show-overflow-tooltip></el-table-column>
  87. <el-table-column align="left" label="往来单位类型" prop="userType" min-width="140" show-overflow-tooltip>
  88. <template slot-scope="scope">
  89. {{ scope.row.userType == "BD_Customer" ? "客户" : "" }}
  90. </template>
  91. </el-table-column>
  92. <el-table-column align="left" label="往来单位" prop="userName" min-width="260" show-overflow-tooltip>
  93. <template slot-scope="scope">
  94. <CopyButton :copyText="scope.row.userName" />
  95. <span>{{scope.row.userName}}</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column align="left" label="币别" prop="amountType" min-width="100" show-overflow-tooltip></el-table-column>
  99. <el-table-column align="left" label="单据状态" prop="examineStatus" min-width="160" show-overflow-tooltip>
  100. <template slot-scope="scope">
  101. <el-tag size="mini" v-show="scope.row.examineStatus == 'SAVE'">保存</el-tag>
  102. <el-tag size="mini" v-show="scope.row.examineStatus == 'WAIT'" type="warning">待审核</el-tag>
  103. <el-tag size="mini" v-show="scope.row.examineStatus == 'OK'" type="success">通过</el-tag>
  104. <el-tag size="mini" v-show="scope.row.examineStatus == 'FAIL'" type="danger">不通过</el-tag>
  105. <el-tag size="mini" v-show="scope.row.examineStatus == 'CLOSE'" type="info">已关闭</el-tag>
  106. </template>
  107. </el-table-column>
  108. <el-table-column align="right" label="总金额" prop="totalAmount" min-width="120" show-overflow-tooltip>
  109. <template slot-scope="scope">
  110. {{ scope.row.totalAmount | numToFixed }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column align="center" label="操作" min-width="160" show-overflow-tooltip fixed="right">
  114. <template slot-scope="scope">
  115. <el-button v-show="
  116. (scope.row.examineStatus == 'WAIT' ||
  117. scope.row.examineStatus == 'FAIL') &&
  118. $checkBtnRole('examine', $route.meta.roles)
  119. " type="text" class="textColor" @click="approvalFn(scope.row.id)">审批</el-button>
  120. <el-button type="text" class="textColor" v-show="scope.row.examineStatus == 'SAVE'" @click="bringFn(scope.row.id)">提审</el-button>
  121. <el-button type="text" class="textColor" v-show="scope.row.examineStatus == 'OK' || scope.row.examineStatus == 'FAIL'" @click="unApprovalFn(scope.row.id)">弃审</el-button>
  122. <el-button type="text" class="textColor" @click="detailFn(scope.row.id)">详情</el-button>
  123. </template>
  124. </el-table-column>
  125. </el-table>
  126. </div>
  127. <!-- 分页 -->
  128. <div class="fr">
  129. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="listTotal">
  130. </el-pagination>
  131. </div>
  132. </div>
  133. </div>
  134. <ReceivableListAdd @updateList="updateList" v-else-if="showPage == 2" />
  135. <ReceivableListApproval :approvalId="approvalId" @updateList="updateList" v-else-if="showPage == 3" />
  136. <ReceivableListDetail :approvalId="approvalId" v-else-if="showPage == 4" />
  137. </div>
  138. </template>
  139. <script>
  140. import { getCustomerList } from "@/api/finance/wallet";
  141. import {
  142. getFinanceOtherReceList,
  143. getFinanceOtherReceDelete,
  144. getFinanceOtherReceApply,
  145. getFinanceOtherReceAbandon,
  146. } from "@/api/finance/receivable_list";
  147. import ReceivableListAdd from "./components/receivable_list-add";
  148. import ReceivableListApproval from "./components/receivable_list-approval";
  149. import ReceivableListDetail from "./components/receivable_list-detail";
  150. export default {
  151. components: {
  152. ReceivableListAdd,
  153. ReceivableListApproval,
  154. ReceivableListDetail,
  155. },
  156. data() {
  157. return {
  158. customerList: [],
  159. currentPage: 1, // 当前页码
  160. pageSize: 10, // 每页数量
  161. listTotal: 0, // 列表总数
  162. dataList: [], // 列表数据
  163. searchForm: {
  164. source: "",
  165. code: "",
  166. userName: "",
  167. startTime: "",
  168. endTime: "",
  169. }, //搜索表单
  170. listLoading: false, // 列表加载loading
  171. examine: "",
  172. showPage: 1,
  173. approvalId: null,
  174. deleList: [],
  175. };
  176. },
  177. computed: {
  178. exParams() {
  179. return {
  180. source: this.searchForm.source,
  181. code: this.searchForm.code,
  182. userName: this.searchForm.userName,
  183. startTime: this.searchForm.startTime,
  184. endTime: this.searchForm.endTime,
  185. examineStatus: this.examine,
  186. };
  187. },
  188. },
  189. created() {
  190. this.getDataList({ pageSize: this.pageSize, pageNum: this.currentPage });
  191. this.getCustomerDataList();
  192. },
  193. methods: {
  194. //获取经销商列表
  195. async getCustomerDataList() {
  196. let res = await getCustomerList({
  197. pageNum: 1,
  198. pageSize: -1,
  199. });
  200. this.customerList = res.data.records;
  201. },
  202. //提审
  203. async bringFn(id) {
  204. await getFinanceOtherReceApply({ id });
  205. this.$message.success("提审成功");
  206. this.getDataList({
  207. pageNum: this.currentPage,
  208. pageSize: this.pageSize,
  209. examineStatus: this.examine,
  210. });
  211. },
  212. //弃审
  213. async unApprovalFn(id) {
  214. await getFinanceOtherReceAbandon({ id });
  215. this.$message.success("弃审成功");
  216. this.getDataList({
  217. pageNum: this.currentPage,
  218. pageSize: this.pageSize,
  219. examineStatus: this.examine,
  220. });
  221. },
  222. //radio切换'
  223. changeRadioGroupFn(v) {
  224. this.getDataList({
  225. pageSize: this.pageSize,
  226. pageNum: this.currentPage,
  227. examineStatus: v,
  228. });
  229. },
  230. // 更改每页数量
  231. handleSizeChange(val) {
  232. this.pageSize = val;
  233. this.currentPage = 1;
  234. this.getDataList({
  235. pageNum: 1,
  236. pageSize: this.pageSize,
  237. examineStatus: this.examine,
  238. });
  239. },
  240. // 更改当前页
  241. handleCurrentChange(val) {
  242. this.currentPage = val;
  243. this.getDataList({
  244. pageNum: val,
  245. pageSize: 10,
  246. examineStatus: this.examine,
  247. });
  248. },
  249. //清除
  250. async clearFn() {
  251. await this.$refs.searchForm.resetFields();
  252. this.examine = "";
  253. },
  254. //搜索
  255. searchFn() {
  256. this.getDataList({
  257. ...this.searchForm,
  258. // examineStatus: this.examine,
  259. pageSize: this.pageSize,
  260. pageNum: this.currentPage,
  261. });
  262. },
  263. //删除
  264. async deleFn() {
  265. let res = this.deleList.toString();
  266. console.log(res);
  267. await getFinanceOtherReceDelete({ ids: res });
  268. this.getDataList({ pageSize: this.pageSize, pageNum: this.currentPage });
  269. this.$message.success("删除成功");
  270. this.deleList = [];
  271. },
  272. selectionChangeFn(value) {
  273. // console.log(value);
  274. const res = value.map((v) => v.id);
  275. // console.log(res);
  276. this.deleList = res;
  277. },
  278. //新建后更新列表
  279. updateList() {
  280. this.getDataList({ pageSize: this.pageSize, pageNum: this.currentPage });
  281. },
  282. //获取来列表数据
  283. async getDataList(data) {
  284. let res = await getFinanceOtherReceList(data);
  285. // console.log(res);
  286. res.data.records.forEach((item) => {
  287. item.sums2 = ["totalAmount"];
  288. item.sums1 = ["totalAmount"];
  289. });
  290. this.dataList = res.data.records;
  291. this.listTotal = res.data.total;
  292. },
  293. //详情
  294. detailFn(id) {
  295. this.approvalId = id;
  296. this.showPage = 4;
  297. },
  298. //审批
  299. approvalFn(id) {
  300. this.approvalId = id;
  301. this.showPage = 3;
  302. },
  303. //新建
  304. addFn() {
  305. this.showPage = 2;
  306. },
  307. },
  308. };
  309. </script>
  310. <style lang="scss" scoped>
  311. .selectStyle {
  312. width: 100%;
  313. }
  314. .dateStyle {
  315. width: 100%;
  316. }
  317. .delClass {
  318. margin-left: 10px;
  319. }
  320. </style>