rebate_form.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. >
  83. <el-table-column
  84. align="center"
  85. label="序号"
  86. type="index"
  87. width="100"
  88. show-overflow-tooltip
  89. ></el-table-column>
  90. <el-table-column
  91. align="center"
  92. label="经销商编码"
  93. prop="customerNumber"
  94. min-width="160"
  95. show-overflow-tooltip
  96. >
  97. <template slot-scope="scope">
  98. <el-input disabled v-model="scope.row.customerNumber"></el-input>
  99. </template>
  100. </el-table-column>
  101. <el-table-column
  102. align="center"
  103. label="经销商名称"
  104. prop="customerName"
  105. min-width="200"
  106. show-overflow-tooltip
  107. >
  108. <template slot-scope="scope">
  109. <el-select
  110. @change="changeCustomerFn($event, scope.$index, scope.row)"
  111. v-model="scope.row.customerId"
  112. placeholder="请选择"
  113. >
  114. <el-option
  115. v-for="item in customerData"
  116. :key="item.id"
  117. :label="item.name"
  118. :value="item.id"
  119. >
  120. </el-option>
  121. </el-select>
  122. </template>
  123. </el-table-column>
  124. <el-table-column
  125. align="center"
  126. label="返利类型"
  127. prop="customerWalletId"
  128. min-width="160"
  129. show-overflow-tooltip
  130. >
  131. <template slot-scope="scope">
  132. <el-select
  133. v-model="scope.row.customerWalletId"
  134. placeholder="请选择"
  135. >
  136. <el-option
  137. v-for="item in scope.row.walletList"
  138. :key="item.walletRebateId"
  139. :label="item.name"
  140. :value="item.walletRebateId"
  141. >
  142. </el-option>
  143. </el-select>
  144. </template>
  145. </el-table-column>
  146. <el-table-column
  147. align="center"
  148. label="返利总金额"
  149. prop="amount"
  150. min-width="160"
  151. show-overflow-tooltip
  152. >
  153. <template slot-scope="scope">
  154. <el-input v-model.number="scope.row.amount"></el-input>
  155. </template>
  156. </el-table-column>
  157. <el-table-column
  158. align="center"
  159. label="暂扣返利"
  160. prop="withholdAmount"
  161. min-width="160"
  162. show-overflow-tooltip
  163. >
  164. <template slot-scope="scope">
  165. <el-input v-model.number="scope.row.withholdAmount"></el-input>
  166. </template>
  167. </el-table-column>
  168. <el-table-column
  169. align="center"
  170. label="政策文件流水号"
  171. prop="policyFileNo"
  172. min-width="160"
  173. show-overflow-tooltip
  174. >
  175. <template slot-scope="scope">
  176. <el-input v-model="scope.row.policyFileNo"></el-input>
  177. </template>
  178. </el-table-column>
  179. <el-table-column
  180. align="center"
  181. label="政策文号"
  182. prop="policyDocNo"
  183. min-width="160"
  184. show-overflow-tooltip
  185. >
  186. <template slot-scope="scope">
  187. <el-input v-model="scope.row.policyDocNo"></el-input>
  188. </template>
  189. </el-table-column>
  190. <el-table-column
  191. align="center"
  192. label="政策年份"
  193. prop="policyYear"
  194. min-width="160"
  195. show-overflow-tooltip
  196. >
  197. <template slot-scope="scope">
  198. <el-input v-model="scope.row.policyYear"></el-input>
  199. </template>
  200. </el-table-column>
  201. <el-table-column
  202. align="center"
  203. label="政策月份"
  204. prop="policyMonth"
  205. min-width="160"
  206. show-overflow-tooltip
  207. >
  208. <template slot-scope="scope">
  209. <el-input v-model="scope.row.policyMonth"></el-input>
  210. </template>
  211. </el-table-column>
  212. <el-table-column
  213. align="center"
  214. label="政策归属部门"
  215. prop="policyOrg"
  216. min-width="160"
  217. show-overflow-tooltip
  218. >
  219. <template slot-scope="scope">
  220. <el-input v-model="scope.row.policyOrg"></el-input>
  221. </template>
  222. </el-table-column>
  223. <el-table-column
  224. align="center"
  225. label="客户区域"
  226. prop="customerArea"
  227. min-width="160"
  228. show-overflow-tooltip
  229. >
  230. <template slot-scope="scope">
  231. <el-input v-model="scope.row.customerArea"></el-input>
  232. </template>
  233. </el-table-column>
  234. <el-table-column
  235. align="center"
  236. label="客户属性"
  237. prop="customerAttr"
  238. min-width="160"
  239. show-overflow-tooltip
  240. >
  241. <template slot-scope="scope">
  242. <el-input v-model="scope.row.customerAttr"></el-input>
  243. </template>
  244. </el-table-column>
  245. <el-table-column
  246. align="center"
  247. label="建立实际归属客户"
  248. prop="rewardActualCustomers"
  249. min-width="160"
  250. show-overflow-tooltip
  251. >
  252. <template slot-scope="scope">
  253. <el-input v-model="scope.row.rewardActualCustomers"></el-input>
  254. </template>
  255. </el-table-column>
  256. <el-table-column
  257. align="center"
  258. label="备注1"
  259. prop="remark1"
  260. min-width="160"
  261. show-overflow-tooltip
  262. >
  263. <template slot-scope="scope">
  264. <el-input v-model="scope.row.remark1"></el-input>
  265. </template>
  266. </el-table-column>
  267. <el-table-column
  268. align="center"
  269. label="备注2"
  270. prop="remark2"
  271. min-width="160"
  272. show-overflow-tooltip
  273. >
  274. <template slot-scope="scope">
  275. <el-input v-model="scope.row.remark2"></el-input>
  276. </template>
  277. </el-table-column>
  278. </el-table>
  279. </div>
  280. </div>
  281. <br />
  282. <!-- 按钮 -->
  283. <div class="btn-group clearfix">
  284. <div class="fl">
  285. <el-button type="primary" size="small" @click="addFn">保存</el-button>
  286. <el-button type="primary" size="small">提交审批</el-button>
  287. <el-button type="primary" size="small">重置</el-button>
  288. </div>
  289. <div class="fr">
  290. <el-button type="primary" size="small" @click="addRowFn"
  291. >添加行</el-button
  292. >
  293. <el-button type="primary" size="small">删除行</el-button>
  294. </div>
  295. </div>
  296. </div>
  297. </template>
  298. <script>
  299. import {
  300. getCustomerList,
  301. getWalletCustomerList,
  302. getRebateOrderAdd,
  303. getRebateOrderApply,
  304. } from "@/api/finance/rebate_form";
  305. export default {
  306. data() {
  307. return {
  308. dataList: [],
  309. listLoading: false, // 列表加载loading
  310. customerData: [],
  311. searchForm: {
  312. theTime: "",
  313. createTime: "",
  314. remark: "",
  315. createBy: "",
  316. },
  317. };
  318. },
  319. created() {
  320. this.getCustomerData();
  321. },
  322. methods: {
  323. //新增
  324. async addFn() {
  325. console.log(this.searchForm);
  326. this.dataList.forEach((v) => {
  327. delete v.walletList;
  328. });
  329. console.log(this.dataList);
  330. await getRebateOrderAdd({ ...this.searchForm, items: this.dataList });
  331. this.$message.success("保存成功");
  332. },
  333. //选择经销商名称事件
  334. async changeCustomerFn(v, index, value) {
  335. value.customerWalletId = "";
  336. console.log(v, 322311);
  337. const res = await getWalletCustomerList({
  338. customerId: v,
  339. type: "REBATE",
  340. });
  341. const res2 = this.customerData.filter((i) => i.id == v);
  342. console.log(res2, 326556);
  343. this.$set(this.dataList[index], "customerNumber", res2[0].number);
  344. this.$set(this.dataList[index], "customerName", res2[0].name);
  345. this.$set(this.dataList[index], "walletList", res.data);
  346. },
  347. //获取经销商数据
  348. async getCustomerData() {
  349. const res = await getCustomerList({ pageSize: -1, pageNum: 1 });
  350. this.customerData = res.data.records;
  351. },
  352. //添加行
  353. addRowFn() {
  354. this.dataList.push({
  355. customerNumber: "",
  356. customerName: "",
  357. customerWalletId: "",
  358. amount: null,
  359. withholdAmount: null,
  360. policyFileNo: "",
  361. policyDocNo: "",
  362. policyYear: "",
  363. policyMonth: "",
  364. policyOrg: "",
  365. customerArea: "",
  366. customerAttr: "",
  367. rewardActualCustomers: "",
  368. remark1: "",
  369. remark2: "",
  370. });
  371. },
  372. },
  373. };
  374. </script>
  375. <style lang="scss" scoped>
  376. .selectStyle {
  377. width: 100%;
  378. }
  379. </style>