detailsPage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="goBack(0)">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
  11. @click="submit">保 存
  12. </el-button>
  13. </div>
  14. </div>
  15. <div style="margin-top: 50px">
  16. <trade-card title="基础信息">
  17. <avue-form :option="optionForm" v-model="form" ref="form">
  18. <tempalte slot="corpName" slot-scope="{ row }">
  19. <dic-select v-model="form.corpName" placeholder="客户" key="id" label="cnName" res="records"
  20. url="/blade-los/bcorps/listByType?corpTypeName=客户" :filterable="true" :remote="true"
  21. dataName="cnName" @selectChange="dicChange('corpName', $event)"
  22. :disabled="form.advanceChargeItemList.length > 0"></dic-select>
  23. </tempalte>
  24. <tempalte slot="advancePaymentBalance">
  25. <el-input-number v-model="form.advancePaymentBalance"
  26. @change="dicChange('advancePaymentBalance', form)" :controls="false" placeholder="请输入 预付款余额"
  27. size="small" style="width: 100%;"
  28. :disabled="form.advanceChargeItemList.length > 0"></el-input-number>
  29. </tempalte>
  30. <tempalte slot="inOverpayment">
  31. <el-input-number v-model="form.inOverpayment" @change="dicChange('inOverpayment', form)"
  32. :controls="false" placeholder="请输入 增加金额" size="small" style="width: 100%;"
  33. :disabled="form.advanceChargeItemList.length > 0"></el-input-number>
  34. </tempalte>
  35. <tempalte slot="outOverpaymen">
  36. <el-input-number v-model="form.outOverpaymen" @change="dicChange('outOverpaymen', form)"
  37. :controls="false" placeholder="请输入 消费金额" size="small" style="width: 100%;"
  38. :disabled="form.advanceChargeItemList.length > 0"></el-input-number>
  39. </tempalte>
  40. </avue-form>
  41. </trade-card>
  42. <trade-card title="预付款明细">
  43. <avue-crud :option="option" :data="form.advanceChargeItemList" id="out-table" ref="crud"
  44. @selection-change="selectionChange" @resetColumn="resetColumn('crud', 'option', 'optionBack', 400)"
  45. @saveColumn="saveColumn('crud', 'option', 'optionBack', 400)">
  46. <template slot="menuLeft">
  47. <el-button type="primary" size="small" icon="el-icon-plus" @click="addRow">新 增
  48. </el-button>
  49. </template>
  50. <template slot="orderNo" slot-scope="{ row }">
  51. <span style="color: #1e9fff" @click="rowEdit(row)">{{ row.orderNo }}</span>
  52. </template>
  53. <template slot="billNo" slot-scope="{ row }">
  54. <span style="color: #1e9fff" @click="rowEdit(row)">{{ row.billNo }}</span>
  55. </template>
  56. <template slot="menu" slot-scope="{ row, index }">
  57. <el-button v-if="row.identifier == 1" size="small" icon="el-icon-edit" type="text"
  58. @click="inEdit(row)">{{ row.$cellEdit ?
  59. "保存" :
  60. "编辑" }}</el-button>
  61. </template>
  62. </avue-crud>
  63. </trade-card>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import { submit, getDetail } from "@/api/iosBasicData/advanceCharge";
  69. import dicSelect from "@/components/dicSelect/main";
  70. import { bfeesList } from "@/api/iosBasicData/bfees";
  71. import _ from "lodash";
  72. export default {
  73. name: "detailsPage",
  74. data() {
  75. return {
  76. form: {
  77. status: '0',
  78. advanceChargeItemList: []
  79. },
  80. optionForm: {
  81. menuBtn: false,
  82. span: 8,
  83. column: [
  84. {
  85. label: '客户',
  86. prop: "corpName",
  87. rules: [{
  88. required: true,
  89. message: " ",
  90. trigger: "blur"
  91. }]
  92. },
  93. {
  94. label: "预付款余额",
  95. prop: "advancePaymentBalance",
  96. },
  97. {
  98. label: "增加金额",
  99. prop: "inOverpayment",
  100. },
  101. {
  102. label: "消费金额",
  103. prop: "outOverpaymen",
  104. },
  105. {
  106. label: '备注',
  107. prop: "remarks",
  108. type: 'textarea',
  109. disabled: false,
  110. span: 24,
  111. minRows: 2,
  112. },
  113. ]
  114. },
  115. option: {},
  116. optionBack: {
  117. height: 'auto',
  118. calcHeight: 30,
  119. menuWidth: 60,
  120. border: true,
  121. index: true,
  122. addBtn: false,
  123. viewBtn: false,
  124. editBtn: false,
  125. delBtn: false,
  126. menu: true,
  127. refreshBtn: false,
  128. align: 'center',
  129. column: [
  130. {
  131. label: "订单号",
  132. prop: "orderNo",
  133. cell: true,
  134. overHidden: true
  135. },
  136. {
  137. label: "提单号",
  138. prop: "billNo",
  139. cell: true,
  140. overHidden: true
  141. },
  142. {
  143. label: "金额",
  144. prop: "overpayment",
  145. type: 'number',
  146. controls: false,
  147. cell: true,
  148. rules: [{
  149. required: true,
  150. message: " ",
  151. trigger: "blur"
  152. }],
  153. overHidden: true
  154. },
  155. {
  156. label: "收款金额",
  157. prop: "amountD",
  158. overHidden: true
  159. },
  160. {
  161. label: "付款金额",
  162. prop: "amountC",
  163. overHidden: true
  164. },
  165. {
  166. label: "消费类型",
  167. prop: "overpaymentType",
  168. type: 'select',
  169. cell: true,
  170. dicData: [{
  171. label: '增加',
  172. value: 0
  173. }, {
  174. label: '消费',
  175. value: 1
  176. }],
  177. rules: [{
  178. required: true,
  179. message: " ",
  180. trigger: "blur"
  181. }],
  182. overHidden: true
  183. },
  184. {
  185. label: "来源单号",
  186. prop: "srcOrderNo",
  187. overHidden: true
  188. },
  189. {
  190. label: "生成标识",
  191. prop: "identifier",
  192. type: 'select',
  193. dicData: [{
  194. label: '系统生成',
  195. value: 0
  196. }, {
  197. label: '手动添加',
  198. value: 1
  199. }],
  200. overHidden: true
  201. },
  202. {
  203. label: "生成时间",
  204. prop: "createTime",
  205. type: "datetime",
  206. format: "yyyy-MM-dd HH:mm:ss",
  207. valueFormat: "yyyy-MM-dd HH:mm:ss",
  208. cell: true,
  209. overHidden: true
  210. },
  211. {
  212. label: "备注",
  213. prop: "remarks",
  214. overHidden: true
  215. }
  216. ]
  217. },
  218. }
  219. },
  220. components: {
  221. dicSelect,
  222. },
  223. props: {
  224. detailData: Object
  225. },
  226. async created() {
  227. this.option = await this.getColumnData(this.getColumnName(400), this.optionBack);
  228. if (this.detailData.id) {
  229. this.getDetails(this.detailData.id)
  230. }
  231. },
  232. methods: {
  233. addRow() {
  234. this.form.advanceChargeItemList.push({
  235. $cellEdit: true,
  236. identifier: 1
  237. })
  238. },
  239. // 编辑
  240. inEdit(row) {
  241. if (row.$cellEdit == true) {
  242. if (!row.overpayment || row.overpaymentType == null) return this.$message.error("请完善明细信息");
  243. this.$set(row, '$cellEdit', false)
  244. } else {
  245. this.$set(row, '$cellEdit', true)
  246. }
  247. },
  248. dicChange(name, row) {
  249. if (name == 'corpName') {
  250. if (row) {
  251. this.form.corpId = row.id
  252. } else {
  253. this.form.corpId = null
  254. }
  255. }
  256. if (name == 'advancePaymentBalance') {
  257. row.inOverpayment = _.add(Number(row.advancePaymentBalance ? row.advancePaymentBalance : 0), Number(row.outOverpaymen ? row.outOverpaymen : 0))
  258. }
  259. if (name == 'inOverpayment') {
  260. row.advancePaymentBalance = _.subtract(Number(row.inOverpayment ? row.inOverpayment : 0), Number(row.outOverpaymen ? row.outOverpaymen : 0))
  261. }
  262. if (name == 'outOverpaymen') {
  263. row.inOverpayment = _.add(Number(row.advancePaymentBalance ? row.advancePaymentBalance : 0), Number(row.outOverpaymen ? row.outOverpaymen : 0))
  264. }
  265. },
  266. rowEdit(row) {
  267. if (row.overpaymentType == 1) {
  268. if (this.$store.getters.firstSetStatus) {
  269. this.$alert("货款收费(T)页面已存在,请关闭货款收费(T)再进行操作", "温馨提示", {
  270. confirmButtonText: "确定",
  271. type: 'warning',
  272. callback: action => {
  273. }
  274. });
  275. } else {
  276. this.$router.push({
  277. path: '/tradeAgency/firstSettlement/index',
  278. query: {
  279. billNo: row.srcPid
  280. },
  281. })
  282. }
  283. }
  284. if (row.overpaymentType == 0) {
  285. if (this.$store.getters.exchangePurStatus) {
  286. this.$alert("货款付费(T)页面已存在,请关闭货款付费(T)再进行操作", "温馨提示", {
  287. confirmButtonText: "确定",
  288. type: 'warning',
  289. callback: action => {
  290. }
  291. });
  292. } else {
  293. this.$router.push({
  294. path: '/tradeAgency/exchangePurchasing/index',
  295. query: {
  296. billNo: row.srcPid
  297. },
  298. })
  299. }
  300. }
  301. },
  302. getDetails(id) {
  303. const loading = this.$loading({
  304. lock: true,
  305. text: '加载中',
  306. spinner: 'el-icon-loading',
  307. background: 'rgba(255,255,255,0.7)'
  308. });
  309. getDetail({ id: id }).then(res => {
  310. this.form = res.data.data
  311. this.$refs.crud.dicInit();
  312. }).finally(() => {
  313. loading.close()
  314. })
  315. },
  316. submit() {
  317. for (let row of this.form.advanceChargeItemList) {
  318. if (row.identifier == 1) {
  319. if (!row.overpayment || row.overpaymentType == null) {
  320. return this.$message.error("请完善明细信息");
  321. }
  322. }
  323. }
  324. this.$refs["form"].validate((valid, done) => {
  325. done();
  326. if (valid) {
  327. const loading = this.$loading({
  328. lock: true,
  329. text: '加载中',
  330. spinner: 'el-icon-loading',
  331. background: 'rgba(255,255,255,0.7)'
  332. });
  333. submit(this.form).then(res => {
  334. this.$message.success("保存成功");
  335. this.getDetails(res.data.data.id)
  336. }).finally(() => {
  337. loading.close();
  338. })
  339. } else {
  340. return false;
  341. }
  342. });
  343. },
  344. //自定义列保存
  345. async saveColumn(ref, option, optionBack, code) {
  346. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  347. if (inSave) {
  348. this.$message.success("保存成功");
  349. //关闭窗口
  350. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  351. }
  352. },
  353. //自定义列重置
  354. async resetColumn(ref, option, optionBack, code) {
  355. this[option] = this[optionBack];
  356. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  357. if (inSave) {
  358. this.$message.success("重置成功");
  359. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  360. }
  361. },
  362. goBack(type) {
  363. this.$emit("goBack", type);
  364. this.$emit('updateKey')
  365. },
  366. }
  367. }
  368. </script>
  369. <style lang="scss" scoped>
  370. ::v-deep .el-form-item {
  371. margin-bottom: 8px !important;
  372. }
  373. ::v-deep .el-table .cell {
  374. padding: 0 2px !important;
  375. .el-form-item {
  376. margin-bottom: 0px !important;
  377. }
  378. }
  379. ::v-deep .avue-crud .el-table .el-form-item__label {
  380. left: -1px;
  381. }
  382. ::v-deep#out-table .back-one {
  383. background: #ecf5ff !important;
  384. }
  385. ::v-deep#out-table .back-two {
  386. background: #ecf5ff !important;
  387. }
  388. </style>