rebate_form.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <div class="app-container">
  3. <span>返利单</span>
  4. <el-divider></el-divider>
  5. <!-- 表头 -->
  6. <div>
  7. <el-form
  8. ref="searchForm"
  9. :model="searchForm"
  10. label-width="100px"
  11. size="small"
  12. label-position="left"
  13. >
  14. <el-row :gutter="20">
  15. <el-col :xs="24" :sm="12" :lg="6">
  16. <el-form-item label="返利单号" prop="">
  17. <el-input disabled placeholder=""></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :xs="24" :sm="12" :lg="6">
  21. <el-form-item label="返利日期" prop="">
  22. <el-date-picker
  23. class="selectStyle"
  24. v-model="searchForm.theTime"
  25. type="datetime"
  26. placeholder="选择日期时间"
  27. default-time="23:59:59"
  28. value-format="yyyy-MM-dd HH:mm:ss"
  29. >
  30. </el-date-picker>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :xs="24" :sm="12" :lg="6">
  34. <el-form-item label="备注" prop="">
  35. <el-input
  36. v-model="searchForm.remark"
  37. placeholder="请输入"
  38. ></el-input>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :xs="24" :sm="12" :lg="6">
  42. <el-form-item label="制单人" prop="">
  43. <el-input
  44. v-model="searchForm.createBy"
  45. placeholder="请输入"
  46. ></el-input>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :xs="24" :sm="12" :lg="6">
  50. <el-form-item label="制单日期" prop="">
  51. <el-date-picker
  52. class="selectStyle"
  53. v-model="searchForm.createTime"
  54. type="datetime"
  55. placeholder="选择日期时间"
  56. default-time="23:59:59"
  57. value-format="yyyy-MM-dd HH:mm:ss"
  58. >
  59. </el-date-picker>
  60. </el-form-item>
  61. </el-col>
  62. </el-row>
  63. </el-form>
  64. </div>
  65. <!-- 按钮 -->
  66. <div class="btn-group clearfix">
  67. <div class="fr">
  68. <el-button type="primary" size="small">批量导入</el-button>
  69. </div>
  70. </div>
  71. <!-- 列表 -->
  72. <div class="mymain-container">
  73. <div class="table">
  74. <el-table
  75. v-loading="listLoading"
  76. :data="dataList"
  77. element-loading-text="Loading"
  78. border
  79. fit
  80. highlight-current-row
  81. stripe
  82. :row-class-name="rouClassNameFn"
  83. @row-click="onRowClick"
  84. >
  85. <el-table-column
  86. align="center"
  87. label="序号"
  88. type="index"
  89. width="100"
  90. show-overflow-tooltip
  91. ></el-table-column>
  92. <el-table-column
  93. align="center"
  94. label="经销商编码"
  95. prop="customerNumber"
  96. min-width="160"
  97. show-overflow-tooltip
  98. >
  99. <template slot-scope="scope">
  100. <el-input disabled v-model="scope.row.customerNumber"></el-input>
  101. </template>
  102. </el-table-column>
  103. <el-table-column
  104. align="center"
  105. label="经销商名称"
  106. prop="customerName"
  107. min-width="200"
  108. show-overflow-tooltip
  109. >
  110. <template slot-scope="scope">
  111. <el-select
  112. @change="changeCustomerFn($event, scope.$index, scope.row)"
  113. v-model="scope.row.customerId"
  114. placeholder="请选择"
  115. >
  116. <el-option
  117. v-for="item in customerData"
  118. :key="item.id"
  119. :label="item.name"
  120. :value="item.id"
  121. >
  122. </el-option>
  123. </el-select>
  124. </template>
  125. </el-table-column>
  126. <el-table-column
  127. align="center"
  128. label="返利类型"
  129. prop="customerWalletId"
  130. min-width="160"
  131. show-overflow-tooltip
  132. >
  133. <template slot-scope="scope">
  134. <el-select
  135. v-model="scope.row.customerWalletId"
  136. placeholder="请选择"
  137. >
  138. <el-option
  139. v-for="item in scope.row.walletList"
  140. :key="item.customerWalletId"
  141. :label="item.name"
  142. :value="item.customerWalletId"
  143. >
  144. </el-option>
  145. </el-select>
  146. </template>
  147. </el-table-column>
  148. <el-table-column
  149. align="center"
  150. label="返利总金额"
  151. prop="amount"
  152. min-width="160"
  153. show-overflow-tooltip
  154. >
  155. <template slot-scope="scope">
  156. <el-input v-model.number="scope.row.amount"></el-input>
  157. </template>
  158. </el-table-column>
  159. <el-table-column
  160. align="center"
  161. label="暂扣返利"
  162. prop="withholdAmount"
  163. min-width="160"
  164. show-overflow-tooltip
  165. >
  166. <template slot-scope="scope">
  167. <el-input v-model.number="scope.row.withholdAmount"></el-input>
  168. </template>
  169. </el-table-column>
  170. <el-table-column
  171. align="center"
  172. label="政策文件流水号"
  173. prop="policyFileNo"
  174. min-width="160"
  175. show-overflow-tooltip
  176. >
  177. <template slot-scope="scope">
  178. <el-input v-model="scope.row.policyFileNo"></el-input>
  179. </template>
  180. </el-table-column>
  181. <el-table-column
  182. align="center"
  183. label="政策文号"
  184. prop="policyDocNo"
  185. min-width="160"
  186. show-overflow-tooltip
  187. >
  188. <template slot-scope="scope">
  189. <el-input v-model="scope.row.policyDocNo"></el-input>
  190. </template>
  191. </el-table-column>
  192. <el-table-column
  193. align="center"
  194. label="政策年份"
  195. prop="policyYear"
  196. min-width="160"
  197. show-overflow-tooltip
  198. >
  199. <template slot-scope="scope">
  200. <el-input v-model="scope.row.policyYear"></el-input>
  201. </template>
  202. </el-table-column>
  203. <el-table-column
  204. align="center"
  205. label="政策月份"
  206. prop="policyMonth"
  207. min-width="160"
  208. show-overflow-tooltip
  209. >
  210. <template slot-scope="scope">
  211. <el-input v-model="scope.row.policyMonth"></el-input>
  212. </template>
  213. </el-table-column>
  214. <el-table-column
  215. align="center"
  216. label="政策归属部门"
  217. prop="policyOrg"
  218. min-width="160"
  219. show-overflow-tooltip
  220. >
  221. <template slot-scope="scope">
  222. <el-input v-model="scope.row.policyOrg"></el-input>
  223. </template>
  224. </el-table-column>
  225. <el-table-column
  226. align="center"
  227. label="客户区域"
  228. prop="customerArea"
  229. min-width="160"
  230. show-overflow-tooltip
  231. >
  232. <template slot-scope="scope">
  233. <el-input v-model="scope.row.customerArea"></el-input>
  234. </template>
  235. </el-table-column>
  236. <el-table-column
  237. align="center"
  238. label="客户属性"
  239. prop="customerAttr"
  240. min-width="160"
  241. show-overflow-tooltip
  242. >
  243. <template slot-scope="scope">
  244. <el-input v-model="scope.row.customerAttr"></el-input>
  245. </template>
  246. </el-table-column>
  247. <el-table-column
  248. align="center"
  249. label="建立实际归属客户"
  250. prop="rewardActualCustomers"
  251. min-width="160"
  252. show-overflow-tooltip
  253. >
  254. <template slot-scope="scope">
  255. <el-input v-model="scope.row.rewardActualCustomers"></el-input>
  256. </template>
  257. </el-table-column>
  258. <el-table-column
  259. align="center"
  260. label="备注1"
  261. prop="remark1"
  262. min-width="160"
  263. show-overflow-tooltip
  264. >
  265. <template slot-scope="scope">
  266. <el-input v-model="scope.row.remark1"></el-input>
  267. </template>
  268. </el-table-column>
  269. <el-table-column
  270. align="center"
  271. label="备注2"
  272. prop="remark2"
  273. min-width="160"
  274. show-overflow-tooltip
  275. >
  276. <template slot-scope="scope">
  277. <el-input v-model="scope.row.remark2"></el-input>
  278. </template>
  279. </el-table-column>
  280. </el-table>
  281. </div>
  282. </div>
  283. <br />
  284. <!-- 按钮 -->
  285. <div class="btn-group clearfix">
  286. <div class="fl">
  287. <el-button type="primary" size="small" @click="addFn">保存</el-button>
  288. <el-button type="primary" size="small" @click="submitFn"
  289. >提交审批</el-button
  290. >
  291. <el-button type="primary" size="small" @click="cancelFn"
  292. >重置</el-button
  293. >
  294. </div>
  295. <div class="fr">
  296. <el-button type="primary" size="small" @click="addRowFn"
  297. >添加行</el-button
  298. >
  299. <el-button type="primary" size="small" @click="delRowFn"
  300. >删除行</el-button
  301. >
  302. </div>
  303. </div>
  304. </div>
  305. </template>
  306. <script>
  307. import {
  308. getCustomerList,
  309. getWalletCustomerList,
  310. getRebateOrderAdd,
  311. getRebateOrderApply,
  312. getRebateOrderList,
  313. } from "@/api/finance/rebate_form";
  314. export default {
  315. data() {
  316. return {
  317. dataList: [],
  318. listLoading: false, // 列表加载loading
  319. customerData: [],
  320. searchForm: {
  321. theTime: "",
  322. createTime: "",
  323. remark: "",
  324. createBy: "",
  325. },
  326. delIndex: null,
  327. };
  328. },
  329. created() {
  330. this.getCustomerData();
  331. },
  332. methods: {
  333. //重置
  334. cancelFn() {
  335. this.searchForm = {
  336. theTime: "",
  337. createTime: "",
  338. remark: "",
  339. createBy: "",
  340. };
  341. },
  342. rouClassNameFn({ row, rowIndex }) {
  343. //把每一行的索引放进row
  344. row.index = rowIndex;
  345. },
  346. onRowClick(row, event, column) {
  347. this.delIndex = row.index;
  348. },
  349. //删除行
  350. delRowFn() {
  351. this.dataList.splice(this.delIndex, 1);
  352. },
  353. //提交审批
  354. async submitFn() {
  355. let res = await getRebateOrderList({ pageSize: -1, pageNum: 1 });
  356. console.log(res);
  357. let index = res.data.records.length - 1;
  358. let arr = res.data.records;
  359. await getRebateOrderApply({ id: arr[index].rebateOrderId });
  360. this.$message.success("提交审批成功");
  361. },
  362. //新增
  363. async addFn() {
  364. console.log(this.searchForm);
  365. this.dataList.forEach((v) => {
  366. delete v.walletList;
  367. });
  368. console.log(this.dataList);
  369. await getRebateOrderAdd({ ...this.searchForm, items: this.dataList });
  370. this.$message.success("保存成功");
  371. },
  372. //选择经销商名称事件
  373. async changeCustomerFn(v, index, value) {
  374. value.customerWalletId = "";
  375. console.log(v, 322311);
  376. const res = await getWalletCustomerList({
  377. customerId: v,
  378. type: "REBATE",
  379. });
  380. const res2 = this.customerData.filter((i) => i.id == v);
  381. this.$set(this.dataList[index], "customerNumber", res2[0].number);
  382. this.$set(this.dataList[index], "customerName", res2[0].name);
  383. this.$set(this.dataList[index], "walletList", res.data);
  384. },
  385. //获取经销商数据
  386. async getCustomerData() {
  387. const res = await getCustomerList({ pageSize: -1, pageNum: 1 });
  388. this.customerData = res.data.records;
  389. },
  390. //添加行
  391. addRowFn() {
  392. this.dataList.push({
  393. customerNumber: "",
  394. customerName: "",
  395. customerWalletId: "",
  396. amount: null,
  397. withholdAmount: null,
  398. policyFileNo: "",
  399. policyDocNo: "",
  400. policyYear: "",
  401. policyMonth: "",
  402. policyOrg: "",
  403. customerArea: "",
  404. customerAttr: "",
  405. rewardActualCustomers: "",
  406. remark1: "",
  407. remark2: "",
  408. });
  409. },
  410. },
  411. };
  412. </script>
  413. <style lang="scss" scoped>
  414. .selectStyle {
  415. width: 100%;
  416. }
  417. </style>