receivable_list-add.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <div>
  3. <div class="sty">
  4. <el-page-header @back="goBack"> </el-page-header>
  5. </div>
  6. <br />
  7. <span>基本信息</span>
  8. <el-divider></el-divider>
  9. <!-- 表头 -->
  10. <div>
  11. <el-form
  12. ref="searchForm"
  13. :model="searchForm"
  14. label-width="100px"
  15. size="small"
  16. label-position="left"
  17. >
  18. <el-row :gutter="20">
  19. <el-col :xs="24" :sm="12" :lg="6">
  20. <el-form-item label="单据类型" prop="">
  21. <el-input v-model="searchForm.billType" disabled></el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :xs="24" :sm="12" :lg="6">
  25. <el-form-item label="单据来源" prop="">
  26. <el-select
  27. class="selectStyle"
  28. v-model="searchForm.source"
  29. placeholder="请选择"
  30. >
  31. <el-option value="工程押金"> </el-option>
  32. <el-option value="保证金"> </el-option>
  33. <el-option value="工程价差"> </el-option>
  34. </el-select>
  35. </el-form-item>
  36. </el-col>
  37. <el-col :xs="24" :sm="12" :lg="6">
  38. <el-form-item label="业务日期" prop="">
  39. <el-date-picker
  40. class="selectStyle"
  41. v-model="searchForm.theTime"
  42. type="datetime"
  43. placeholder="选择日期时间"
  44. default-time="23:59:59"
  45. value-format="yyyy-MM-dd HH:mm:ss"
  46. >
  47. </el-date-picker>
  48. </el-form-item>
  49. </el-col>
  50. <el-col :xs="24" :sm="12" :lg="6">
  51. <el-form-item label="到期日" prop="">
  52. <el-date-picker
  53. class="selectStyle"
  54. v-model="searchForm.endTime"
  55. type="datetime"
  56. placeholder="选择日期时间"
  57. default-time="23:59:59"
  58. value-format="yyyy-MM-dd HH:mm:ss"
  59. >
  60. </el-date-picker>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :xs="24" :sm="12" :lg="6">
  64. <el-form-item label="总金额" prop="">
  65. <el-input
  66. disabled
  67. v-model="searchForm.totalAmount"
  68. placeholder=""
  69. ></el-input>
  70. </el-form-item>
  71. </el-col>
  72. <el-col :xs="24" :sm="12" :lg="6">
  73. <el-form-item label="单据状态" prop="">
  74. <el-select
  75. class="selectStyle"
  76. v-model="searchForm.examineStatus"
  77. placeholder="请选择"
  78. >
  79. <el-option value="SAVE" label="暂存"> </el-option>
  80. </el-select>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :xs="24" :sm="12" :lg="6">
  84. <el-form-item label="备注" prop="">
  85. <el-input
  86. v-model="searchForm.remark"
  87. placeholder="请输入"
  88. ></el-input>
  89. </el-form-item>
  90. </el-col>
  91. </el-row>
  92. </el-form>
  93. </div>
  94. <span>明细</span>
  95. <el-divider></el-divider>
  96. <!-- 列表 -->
  97. <div class="mymain-container">
  98. <div class="table">
  99. <el-table
  100. v-loading="listLoading"
  101. :data="dataList"
  102. element-loading-text="Loading"
  103. border
  104. fit
  105. highlight-current-row
  106. stripe
  107. :row-class-name="rouClassNameFn"
  108. @row-click="onRowClick"
  109. >
  110. <el-table-column align="center" label="序号">
  111. <template slot-scope="scope">
  112. {{ scope.$index + 1 }}
  113. </template>
  114. </el-table-column>
  115. <el-table-column
  116. align="center"
  117. label="*经销商名称"
  118. prop="customerName"
  119. min-width="160"
  120. show-overflow-tooltip
  121. >
  122. <template slot-scope="scope">
  123. <el-select
  124. @change="changeCustomerFn($event, scope.$index)"
  125. v-model="scope.row.customerId"
  126. placeholder="请选择"
  127. >
  128. <el-option
  129. v-for="(item, i) in customerList"
  130. :key="i"
  131. :label="item.name"
  132. :value="item.id"
  133. >
  134. </el-option>
  135. </el-select>
  136. </template>
  137. </el-table-column>
  138. <el-table-column
  139. align="center"
  140. label="费用项目编码"
  141. prop="projectCode"
  142. min-width="160"
  143. show-overflow-tooltip
  144. >
  145. <template slot-scope="scope">
  146. <el-input v-model="scope.row.projectCode"></el-input>
  147. </template>
  148. </el-table-column>
  149. <el-table-column
  150. align="center"
  151. label="*项目费用名称"
  152. prop="projectName"
  153. min-width="160"
  154. show-overflow-tooltip
  155. >
  156. <template slot-scope="scope">
  157. <el-input v-model="scope.row.projectName"></el-input>
  158. </template>
  159. </el-table-column>
  160. <el-table-column
  161. align="center"
  162. label="*费用承担部门"
  163. prop="departmentId"
  164. min-width="160"
  165. show-overflow-tooltip
  166. >
  167. <template slot-scope="scope">
  168. <el-input v-model="scope.row.departmentId"></el-input>
  169. </template>
  170. </el-table-column>
  171. <el-table-column
  172. align="center"
  173. label="现金钱包"
  174. prop="walletId"
  175. min-width="160"
  176. show-overflow-tooltip
  177. >
  178. <template slot-scope="scope">
  179. <el-select v-model="scope.row.walletId" placeholder="请选择">
  180. <el-option
  181. v-for="item in scope.row.walletList"
  182. :key="item.mainId"
  183. :label="item.name"
  184. :value="item.mainId"
  185. >
  186. </el-option>
  187. </el-select>
  188. </template>
  189. </el-table-column>
  190. <el-table-column
  191. align="center"
  192. label="*发票类型"
  193. prop="invoiceType"
  194. min-width="160"
  195. show-overflow-tooltip
  196. >
  197. <template slot-scope="scope">
  198. <el-input v-model="scope.row.invoiceType"></el-input>
  199. </template>
  200. </el-table-column>
  201. <el-table-column
  202. align="center"
  203. label="不含税金额"
  204. prop="afterTaxAmount"
  205. min-width="160"
  206. show-overflow-tooltip
  207. >
  208. <template slot-scope="scope">
  209. <el-input
  210. :min="0"
  211. oninput="if(value<0)value=0"
  212. v-model="scope.row.afterTaxAmount"
  213. ></el-input>
  214. </template>
  215. </el-table-column>
  216. <el-table-column
  217. align="center"
  218. label="税额"
  219. prop="tax"
  220. min-width="160"
  221. show-overflow-tooltip
  222. >
  223. <template slot-scope="scope">
  224. <el-input
  225. :min="0"
  226. oninput="if(value<0)value=0"
  227. v-model="scope.row.tax"
  228. ></el-input>
  229. </template>
  230. </el-table-column>
  231. <el-table-column
  232. align="center"
  233. label="总金额"
  234. prop="tax"
  235. min-width="160"
  236. show-overflow-tooltip
  237. >
  238. <template slot-scope="scope">
  239. <el-input
  240. :min="0"
  241. oninput="if(value<0)value=0"
  242. v-model="scope.row.totalAmount"
  243. ></el-input>
  244. </template>
  245. </el-table-column>
  246. <el-table-column
  247. align="center"
  248. label="备注"
  249. prop="remark"
  250. min-width="160"
  251. show-overflow-tooltip
  252. >
  253. <template slot-scope="scope">
  254. <el-input v-model="scope.row.remark"></el-input>
  255. </template>
  256. </el-table-column>
  257. </el-table>
  258. </div>
  259. </div>
  260. <!-- 按钮 -->
  261. <div class="btn-group clearfix">
  262. <div class="fl">
  263. <el-button type="primary" size="small" @click="addFn"
  264. >提交审核</el-button
  265. >
  266. <el-button type="primary" size="small" @click="resetFn">重置</el-button>
  267. </div>
  268. <div class="fr">
  269. <el-button type="primary" size="small" @click="addRowFn"
  270. >添加行</el-button
  271. >
  272. <el-button type="primary" size="small" @click="delRowFn"
  273. >删除行</el-button
  274. >
  275. </div>
  276. </div>
  277. </div>
  278. </template>
  279. <script>
  280. import {
  281. getCustomerList,
  282. getFinanceCustomerList,
  283. getFinanceOtherReceAdd,
  284. getFinanceOtherReceApply,
  285. getFinanceOtherReceList,
  286. } from "@/api/finance/receivable_list";
  287. export default {
  288. data() {
  289. return {
  290. searchForm: {
  291. source: "",
  292. theTime: "",
  293. billType: "其他应收单",
  294. examineStatus: "",
  295. },
  296. dataList: [],
  297. customerList: [], //经销商数据
  298. listLoading: false, // 列表加载loading
  299. walletList: [], //现金钱包数据
  300. delIndex: null,
  301. };
  302. },
  303. created() {
  304. this.getCustomerList();
  305. },
  306. methods: {
  307. //重置
  308. resetFn() {
  309. this.searchForm = {};
  310. },
  311. rouClassNameFn({ row, rowIndex }) {
  312. //把每一行的索引放进row
  313. row.index = rowIndex;
  314. },
  315. onRowClick(row, event, column) {
  316. this.delIndex = row.index;
  317. },
  318. //删除行
  319. delRowFn() {
  320. this.dataList.splice(this.delIndex, 1);
  321. },
  322. //新增
  323. async addFn() {
  324. this.dataList.forEach((v) => {
  325. let res = this.customerList.filter((i) => i.id == v.customerId);
  326. console.log(res);
  327. v.customerName = res[0].name;
  328. v.customerNumber = res[0].number;
  329. let res2 = v.walletList.filter((j) => j.mainId == v.walletId);
  330. v.customerWalletId = res2[0].customerWalletId;
  331. v.walletId = res2[0].walletRebateId;
  332. });
  333. console.log(this.dataList);
  334. await getFinanceOtherReceAdd({
  335. items: this.dataList,
  336. ...this.searchForm,
  337. });
  338. const res = await getFinanceOtherReceList({ pageSize: 1, pageNum: 1 });
  339. await getFinanceOtherReceApply({ id: res.data.records[0].id });
  340. this.$message.success("提审成功");
  341. this.$emit("updateList");
  342. this.$parent.showPage = 1;
  343. this.resetFn();
  344. },
  345. //选择经销商名称事件
  346. async changeCustomerFn(v, index) {
  347. console.log(v, 322311);
  348. const res = await getFinanceCustomerList({
  349. customerId: v,
  350. type: "COMMONLY",
  351. });
  352. this.$set(this.dataList[index], "walletList", res.data);
  353. console.log(this.dataList, "kkk");
  354. // this.walletList = res.data;
  355. },
  356. //获取经销商数据
  357. async getCustomerList() {
  358. const res = await getCustomerList({ pageNum: 1, pageSize: -1 });
  359. this.customerList = res.data.records;
  360. },
  361. //添加行数据
  362. addRowFn() {
  363. this.dataList.push({
  364. customerId: "",
  365. projectCode: "",
  366. projectName: "",
  367. departmentId: "",
  368. walletId: "",
  369. invoiceType: "",
  370. afterTaxAmount: "",
  371. tax: "",
  372. totalAmount: "",
  373. });
  374. },
  375. goBack() {
  376. this.$parent.showPage = 1;
  377. },
  378. },
  379. };
  380. </script>
  381. <style lang="scss" scoped>
  382. .selectStyle {
  383. width: 100%;
  384. }
  385. </style>