warehouse_cost.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <template>
  2. <div class="app-container">
  3. <!-- <el-card class="box-card">
  4. <div slot="header" class="clearfix">
  5. <span>仓库费规则设施</span>
  6. </div>
  7. <el-row>
  8. <el-col :span="4">
  9. <strong>仓储费设置:</strong>
  10. </el-col>
  11. <el-col :span="16">
  12. <div class="set">
  13. <strong>货品仓库存放</strong
  14. ><input class="inputs" v-model="input" placeholder="10" /> ><strong
  15. >天内可免费受存储管理费用.</strong
  16. >
  17. </div>
  18. <div>
  19. <strong>当超过</strong
  20. ><input class="inputs" v-model="input" placeholder="10" />
  21. <strong>天后,按每立方米</strong
  22. ><input class="inputs" v-model="input" placeholder="10" /><strong
  23. >元/天计算</strong
  24. >
  25. </div>
  26. <h5>当商品不足1立方米时,按一立方米计算</h5>
  27. </el-col>
  28. </el-row>
  29. <h4 class="zhu">
  30. 注:改规则适用所有经销商,个性化液之后,则不再按该规则执行
  31. </h4>
  32. </el-card> -->
  33. <!-- 筛选条件 -->
  34. <div>
  35. <el-form
  36. ref="screenForm"
  37. :model="screenForm"
  38. label-width="70px"
  39. size="small"
  40. label-position="left"
  41. >
  42. <el-row :gutter="20">
  43. <el-col :xs="24" :sm="12" :lg="6">
  44. <el-form-item label="条件" prop="customerName">
  45. <el-input
  46. placeholder="请输入筛选条件"
  47. v-model="screenForm.customerName"
  48. ></el-input>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  52. <el-form-item label="">
  53. <el-button size="small" @click="resetScreenForm">清空</el-button>
  54. <el-button size="small" type="primary" @click="submitScreenForm"
  55. >搜索</el-button
  56. >
  57. </el-form-item>
  58. </el-col>
  59. </el-row>
  60. </el-form>
  61. </div>
  62. <!-- 按钮 -->
  63. <div class="btn-group clearfix">
  64. <div class="fl">
  65. <el-button
  66. type="primary"
  67. size="small"
  68. @click="(showDialog = true), (type = 1)"
  69. >新增</el-button
  70. >
  71. <el-popconfirm
  72. confirm-button-text="好的"
  73. cancel-button-text="不用了"
  74. icon="el-icon-info"
  75. icon-color="red"
  76. title="内容确定删除吗?"
  77. @onConfirm="hanleDelete"
  78. >
  79. <el-button
  80. type="primary"
  81. size="small"
  82. slot="reference"
  83. class="el-popover-left"
  84. >删除</el-button
  85. >
  86. </el-popconfirm>
  87. </div>
  88. <div class="fr">
  89. <el-upload
  90. class="import-btn"
  91. :action="baseURL + 'student/import'"
  92. :http-request="handleImport"
  93. :file-list="importFileList"
  94. >
  95. <el-button type="primary" size="small">导入</el-button>
  96. </el-upload>
  97. <el-button type="primary" size="small" @click="handleExport"
  98. >导出</el-button
  99. >
  100. <el-button type="primary" size="small" @click="hanlePrint"
  101. >打印</el-button
  102. >
  103. </div>
  104. </div>
  105. <div class="mymain-container">
  106. <!-- 列表 -->
  107. <div class="table">
  108. <!-- startprint -->
  109. <el-table
  110. v-loading="listLoading"
  111. :data="dataList"
  112. element-loading-text="Loading"
  113. border
  114. fit
  115. highlight-current-row
  116. stripe
  117. @select-all="hanleSelectAll"
  118. >
  119. <el-table-column type="selection" align="center" min-width="100" />
  120. <el-table-column
  121. align="center"
  122. label="经销商编码"
  123. prop="customerNumber"
  124. min-width="160"
  125. show-overflow-tooltip
  126. />
  127. <el-table-column
  128. align="center"
  129. label="经销商名称"
  130. prop="customerName"
  131. min-width="160"
  132. show-overflow-tooltip
  133. />
  134. <el-table-column
  135. align="center"
  136. label="存放免费天数"
  137. prop="freeDay"
  138. min-width="160"
  139. show-overflow-tooltip
  140. />
  141. <el-table-column
  142. align="center"
  143. label="收费规则(每立方米)"
  144. prop="toll"
  145. min-width="160"
  146. show-overflow-tooltip
  147. />
  148. <el-table-column
  149. align="center"
  150. label="创建人"
  151. prop="createBy"
  152. min-width="160"
  153. show-overflow-tooltip
  154. />
  155. <el-table-column
  156. align="center"
  157. label="创建时间"
  158. prop="createTime"
  159. min-width="160"
  160. show-overflow-tooltip
  161. />
  162. <el-table-column
  163. align="center"
  164. label="更新人"
  165. prop="updateBy"
  166. min-width="160"
  167. show-overflow-tooltip
  168. />
  169. <el-table-column
  170. align="center"
  171. label="更新时间"
  172. prop="updateTime"
  173. min-width="160"
  174. show-overflow-tooltip
  175. />
  176. <el-table-column
  177. align="center"
  178. label="操作"
  179. min-width="160"
  180. show-overflow-tooltip
  181. >
  182. <template slot-scope="scope">
  183. <el-button
  184. type="text"
  185. class="textColor"
  186. @click="editFn(scope.row.id, scope.row)"
  187. >编辑</el-button
  188. >
  189. <el-popconfirm
  190. confirm-button-text="好的"
  191. cancel-button-text="不用了"
  192. icon="el-icon-info"
  193. icon-color="red"
  194. title="内容确定删除吗?"
  195. @onConfirm="hanleDelete(scope.row.id)"
  196. >
  197. <el-button
  198. slot="reference"
  199. type="text"
  200. class="textColor el-popover-left"
  201. >删除</el-button
  202. >
  203. </el-popconfirm>
  204. </template>
  205. </el-table-column>
  206. </el-table>
  207. <!-- endprint -->
  208. </div>
  209. <!-- 分页 -->
  210. <div class="fr">
  211. <el-pagination
  212. @size-change="handleSizeChange"
  213. @current-change="handleCurrentChange"
  214. :current-page="currentPage"
  215. :page-sizes="[10, 20, 30, 50]"
  216. :page-size="10"
  217. layout="total, sizes, prev, pager, next, jumper"
  218. :total="listTotal"
  219. >
  220. </el-pagination>
  221. </div>
  222. </div>
  223. <!-- 弹窗 -->
  224. <el-dialog
  225. title="仓库费规则配置"
  226. :visible.sync="showDialog"
  227. width="30%"
  228. :show-close="false"
  229. :close-on-click-modal="false"
  230. >
  231. <el-form :model="dialogForm" label-width="100px" label-position="right">
  232. <el-form-item label="经销商编码" prop="customerNumber">
  233. <el-select
  234. v-model="dialogForm.customerNumber"
  235. placeholder="请选择活动区域"
  236. class="inputStyle"
  237. v-el-select-loadmore="loadmore"
  238. >
  239. <!-- v-el-select-loadmore="loadMore" -->
  240. <el-option
  241. v-for="(item, index) in customerList"
  242. :key="index"
  243. :label="item.number"
  244. :value="item.id"
  245. ></el-option>
  246. </el-select>
  247. </el-form-item>
  248. <el-form-item label="经销商名称" prop="customerName">
  249. <el-input
  250. v-model="dialogForm.customerName"
  251. class="inputStyle"
  252. ></el-input>
  253. </el-form-item>
  254. <el-form-item label="仓库存放" class="sty" prop="freeDay">
  255. <el-input
  256. type="number"
  257. v-model="dialogForm.freeDay"
  258. class="inputStyle"
  259. />天内可免费受存储管理费用. 当超过
  260. <el-input
  261. type="number"
  262. v-model="dialogForm.freeDay"
  263. class="inputStyle"
  264. />天后,按每立方米
  265. <el-input
  266. v-model="dialogForm.toll"
  267. type="number"
  268. class="inputStyle"
  269. />
  270. 元/天计算
  271. </el-form-item>
  272. </el-form>
  273. <div slot="footer" class="dialog-footer">
  274. <el-button @click="(showDialog = false), kong()">取 消</el-button>
  275. <el-button type="primary" @click="hanleInfo(dialogForm)"
  276. >确 定</el-button
  277. >
  278. </div>
  279. </el-dialog>
  280. </div>
  281. </template>
  282. <script>
  283. import Mixin from "@/mixin/index";
  284. import { downloadFiles, handleImport } from "@/utils/util";
  285. import {
  286. getListToll,
  287. getDetail,
  288. updateToll,
  289. addToll,
  290. deleteToll,
  291. getCustomerList,
  292. } from "@/api/basic_data/warehouse";
  293. export default {
  294. mixins: [Mixin],
  295. data() {
  296. return {
  297. dialogForm: {
  298. id: null,
  299. customerName: "",
  300. customerNumber: "",
  301. freeDay: 0,
  302. toll: 0,
  303. },
  304. sleectBox: {
  305. currentPage: 1, // 当前页码
  306. pageSize: 10, // 每页数量
  307. listTotal: 0, // 列表总数
  308. },
  309. baseURL: "",
  310. currentPage: 1, // 当前页码
  311. pageSize: 10, // 每页数量
  312. listTotal: 0, // 列表总数
  313. importLoading: false, // 导入加载loading
  314. importFileList: [], // 导入列表
  315. customerList: [],
  316. showDialog: false,
  317. dataList: [],
  318. screenForm: {
  319. customerName: "",
  320. freeDay: "",
  321. toll: "",
  322. },
  323. type: null, // 1 新增 2 修改 null 详情
  324. };
  325. },
  326. created() {
  327. this.getList();
  328. this.getCustomerList();
  329. },
  330. directives: {
  331. "el-select-loadmore": {
  332. bind(el, binding) {
  333. // 获取element-ui定义好的scroll盒⼦
  334. const SELECTWRAP_DOM = el.querySelector(
  335. ".el-select-dropdown .el-select-dropdown__wrap"
  336. );
  337. SELECTWRAP_DOM.addEventListener("scroll", function () {
  338. /**
  339. * scrollHeight 获取元素内容⾼度(只读)
  340. * scrollTop 获取或者设置元素的偏移值,常⽤于, 计算滚动条的位置, 当⼀个元素的容器没有产⽣垂直⽅向的滚动条, 那它的scrollTop的值默认为0.
  341. * clientHeight 读取元素的可见⾼度(只读)
  342. * 如果元素滚动到底, 下⾯等式返回true, 没有则返回false:
  343. * ele.scrollHeight - ele.scrollTop === ele.clientHeight;
  344. */
  345. const condition =
  346. this.scrollHeight - this.scrollTop <= this.clientHeight;
  347. if (condition) {
  348. binding.value();
  349. }
  350. });
  351. },
  352. },
  353. },
  354. methods: {
  355. editFn(id, row) {
  356. (this.dialogForm = {
  357. id: id,
  358. customerName: row.customerName,
  359. customerNumber: row.customerNumber,
  360. freeDay: row.freeDay,
  361. toll: row.toll,
  362. }),
  363. (this.type = 2);
  364. this.showDialog = true;
  365. },
  366. hanleInfo(dialogForm) {
  367. if (this.type === 1) {
  368. const params = {
  369. ...dialogForm,
  370. };
  371. console.log(params, 78798);
  372. addToll(params).then((res) => {
  373. this.$successMsg("保存成功");
  374. this.kong();
  375. this.getList();
  376. });
  377. } else if (this.type === 2) {
  378. const paramss = {
  379. ...this.dialogForm,
  380. };
  381. updateToll(paramss).then((res) => {
  382. this.$successMsg("编辑成功");
  383. this.kong();
  384. this.diaLogForm.id = null;
  385. this.getList();
  386. });
  387. }
  388. this.showDialog = false;
  389. },
  390. getList() {
  391. this.listLoading = true;
  392. let params = {
  393. pageNum: this.currentPage,
  394. pageSize: this.pageSize,
  395. customerName: this.screenForm.customerName,
  396. freeDay: this.screenForm.freeDay,
  397. toll: this.screenForm.toll,
  398. };
  399. getListToll(params).then((res) => {
  400. this.dataList = res.data.records;
  401. this.listTotal = res.data.total;
  402. this.listLoading = false;
  403. });
  404. },
  405. loadmore() {
  406. this.sleectBox.currentPage++;
  407. this.getCustomerList();
  408. },
  409. getCustomerList() {
  410. let params = {
  411. pageNum: this.sleectBox.currentPage,
  412. pageSize: this.sleectBox.pageSize,
  413. keyword: "",
  414. };
  415. getCustomerList(params).then((res) => {
  416. if (res.data.records.length) {
  417. this.customerList = [...this.customerList, ...res.data.records];
  418. }
  419. // this.listTotal = res.data.total;
  420. });
  421. },
  422. // hanleDetail(detail) {
  423. // this.type = null;
  424. // this.showDialog = true;
  425. // this.diaLogForm = detail;
  426. // },
  427. handleExport() {
  428. let screenData = {
  429. customerName: this.screenForm.customerName,
  430. freeDay: this.screenForm.freeDay,
  431. toll: this.screenForm.toll,
  432. };
  433. downloadFiles("/stock/exportToll", screenData);
  434. },
  435. // 删除数据
  436. hanleDelete(id) {
  437. deleteToll({ id }).then((res) => {
  438. this.$successMsg("删除成功");
  439. this.getList();
  440. });
  441. },
  442. // 导入
  443. async handleImport(param) {
  444. this.importLoading = true;
  445. const file = param.file;
  446. console.log(file, 123);
  447. const formData = new FormData();
  448. formData.append("file", file);
  449. let result = await handleImport("/stock/importToll", formData);
  450. this.importLoading = false;
  451. this.importFileList = [];
  452. if (result.code == 200) {
  453. this.$alert(result.message, "导入成功", {
  454. confirmButtonText: "确定",
  455. });
  456. this.getList();
  457. } else {
  458. this.$alert(result.message, "导入失败", {
  459. confirmButtonText: "确定",
  460. });
  461. }
  462. },
  463. kong() {
  464. this.dialogForm = {
  465. customerName: "",
  466. customerNumber: "",
  467. freeDay: 0,
  468. toll: 0,
  469. };
  470. },
  471. },
  472. };
  473. </script>
  474. <style lang="scss" scoped>
  475. ::v-deep .sty {
  476. width: 85%;
  477. .el-form-item__content .el-input {
  478. width: 22%;
  479. margin: 0px 10px 16px 0;
  480. }
  481. }
  482. .zhu {
  483. padding-top: 18px;
  484. }
  485. .import-btn {
  486. display: inline-block;
  487. margin-right: 10px;
  488. }
  489. .set {
  490. margin-bottom: 30px;
  491. }
  492. .inputs {
  493. margin: 0 18px;
  494. }
  495. ::v-deep .el-form {
  496. .inputStyle {
  497. width: 80%;
  498. }
  499. }
  500. ::v-deep .dialog-footer {
  501. display: flex;
  502. justify-content: center;
  503. }
  504. ::v-deep .el-dialog__header {
  505. background-color: #dddddd;
  506. }
  507. .inp {
  508. margin: 0 12px;
  509. }
  510. .right {
  511. margin-top: 12px;
  512. float: right;
  513. }
  514. .table {
  515. margin-top: 12px;
  516. }
  517. .search {
  518. display: flex;
  519. margin-top: 12px;
  520. ::v-deep .el-input {
  521. width: 50%;
  522. margin-right: 12px;
  523. }
  524. }
  525. .main {
  526. padding: 12px;
  527. }
  528. </style>
  529. >