123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- <template>
- <div>
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="goBack(0)">返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button v-if="editButton" class="el-button--small-yh" style="margin-left: 6px;" type="primary"
- size="small" @click="inEdit">编 辑
- </el-button>
- <el-button v-if="!editButton" class="el-button--small-yh" style="margin-left: 6px;" type="primary"
- size="small" @click="submit" :disabled="form.status == '已生成'">保 存
- </el-button>
- <el-button v-if="form.id && form.status == '录入'" class="el-button--small-yh" style="margin-left: 6px;"
- type="success" size="small" @click="confirm" :disabled="editButton">确认生成仓储费
- </el-button>
- <el-button v-if="form.id && form.status == '已生成'" class="el-button--small-yh" style="margin-left: 6px;"
- type="danger" size="small" @click="revokeConfirm" :disabled="editButton">撤销生成仓储费
- </el-button>
- </div>
- </div>
- <div style="margin-top: 50px">
- <trade-card title="基础信息">
- <avue-form :option="optionForm" v-model="form" ref="form">
- <template slot="warehouseName" slot-scope="{ row }">
- <dic-select v-model="form.warehouseName" placeholder="仓库" key="id" label="cname"
- url="/blade-los/storage/list" res="records" :filterable="true" :remote="true"
- dataName="cname" @selectChange="dicChange('warehouseName', $event)"
- :disabled="optionForm.disabled"></dic-select>
- </template>
- </avue-form>
- </trade-card>
- <trade-card title="仓储费明细">
- <avue-crud :option="option" :data="form.storageFeesItemsList" id="out-table" ref="crud"
- @resetColumn="resetColumn('crud', 'option', 'optionBack', 443)"
- @saveColumn="saveColumn('crud', 'option', 'optionBack', 443)">
- <template slot="menuLeft">
- <el-button type="primary" size="small" @click="addRow"
- :disabled="editButton || form.status == '已生成'||form.storageFeesItemsList.length>0">计算仓储费
- </el-button>
- </template>
- <template slot="menu" slot-scope="{ row, index }">
- <!-- <el-button size="small" icon="el-icon-edit" type="text"
- @click="inEdit(row)">{{ row.$cellEdit ?
- "保存" :
- "编辑" }}</el-button> -->
- <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
- :disabled="editButton || form.status == '已生成'">删除</el-button>
- </template>
- </avue-crud>
- </trade-card>
- </div>
- </div>
- </template>
- <script>
- import { submit, getDetail, itemRemove, calculateStorageFees, confirmSettlement, revokeSettlement } from "@/api/iosBasicData/storageFeeF";
- import dicSelect from "@/components/dicSelect/main";
- import { bfeesList } from "@/api/iosBasicData/bfees";
- import _ from "lodash";
- export default {
- name: "detailsPage",
- data() {
- return {
- editButton: false,
- form: {
- storageFeesItemsList: []
- },
- optionForm: {
- menuBtn: false,
- disabled: false,
- span: 8,
- column: [
- {
- label: "仓库",
- prop: "warehouseName",
- disabled: false,
- },
- // {
- // label: "计费规则",
- // prop: "billingRules",
- // type: "select",
- // dicData: [{
- // label: '净重',
- // value: '0'
- // }, {
- // label: '毛重',
- // value: '1'
- // }],
- // disabled: true,
- // },
- // {
- // label: "计费起始时间",
- // prop: "chargingStartDate",
- // type: "date",
- // format: "yyyy-MM-dd",
- // valueFormat: "yyyy-MM-dd 00:00:00",
- // disabled: false,
- // },
- {
- label: "计费结束时间",
- prop: "chargingEndDate",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 00:00:00",
- disabled: false,
- },
- {
- label: "合计金额",
- prop: "amount",
- disabled: true,
- },
- {
- label: '备注',
- prop: "remarks",
- type: 'textarea',
- disabled: false,
- span: 24,
- minRows: 2,
- },
- ]
- },
- option: {},
- optionBack: {
- height: 'auto',
- calcHeight: 30,
- menuWidth: 120,
- border: true,
- index: true,
- addBtn: false,
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- menu: true,
- refreshBtn: false,
- align: 'center',
- column: [
- {
- label: "合同号",
- prop: "contractNumber",
- // cell: true,
- overHidden: true
- },
- {
- label: "提单号",
- prop: "billNo",
- // cell: true,
- overHidden: true
- },
- {
- label: "入库日期",
- prop: "storageDate",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 00:00:00",
- // cell: true,
- overHidden: true
- },
- {
- label: "剩余件数",
- prop: "surplusQuantity",
- // cell: true,
- overHidden: true
- },
- {
- label: "剩余净重",
- prop: "surplusNetWeight",
- // cell: true,
- overHidden: true
- },
- {
- label: "剩余毛重",
- prop: "surplusWeight",
- // cell: true,
- overHidden: true
- },
- {
- label: "金额",
- prop: "amount",
- type: 'number',
- controls: false,
- // cell: true,
- overHidden: true
- },
- {
- label: "计费起始时间",
- prop: "chargingStartDate",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 00:00:00",
- // cell: true,
- overHidden: true
- },
- {
- label: "计费结束时间",
- prop: "chargingEndDate",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 23:59:59",
- // cell: true,
- overHidden: true
- },
- {
- label: "备注",
- prop: "remarks",
- // cell: true,
- overHidden: true
- }
- ]
- },
- }
- },
- components: {
- dicSelect,
- },
- props: {
- detailData: Object
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(443), this.optionBack);
- if (this.detailData.id) {
- this.editButton = true
- this.optionForm.disabled = true
- this.getDetails(this.detailData.id)
- }
- },
- methods: {
- addRow() {
- if (!this.form.warehouseId) return this.$message.error("请选择仓库!");
- if (!this.form.chargingEndDate) return this.$message.error("请选择计费时间!");
- let obj = {}
- obj = {
- warehouseId: this.form.warehouseId,
- warehouseName: this.form.warehouseName,
- chargingStartDate: this.form.chargingStartDate,
- chargingEndDate: this.form.chargingEndDate,
- }
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- calculateStorageFees(obj).then(res => {
- this.form.storageFeesItemsList = res.data.data
- this.$refs.crud.dicInit();
- }).finally(() => {
- loading.close()
- })
- },
- // 编辑
- inEdit() {
- this.editButton = false
- if (this.form.status != '已生成') {
- this.optionForm.disabled = false
- }
- },
- dicChange(name, row) {
- if (name == 'warehouseName') {
- if (row) {
- this.form.warehouseId = row.id
- // this.form.billingRules=row.billingRules
- } else {
- this.form.billingRules=null
- // this.form.warehouseId = null
- }
- }
- },
- getDetails(id) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- getDetail({ id: id }).then(res => {
- this.form = res.data.data
- this.$refs.crud.dicInit();
- }).finally(() => {
- loading.close()
- })
- },
- submit() {
- // for (let row of this.form.storageFeesItemsList) {
- // if (row.identifier == 1) {
- // if (!row.overpayment || row.overpaymentType == null) {
- // return this.$message.error("请完善明细信息");
- // }
- // }
- // }
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- submit(this.form).then(res => {
- this.$message.success("保存成功");
- this.getDetails(res.data.data.id)
- }).finally(() => {
- loading.close();
- })
- } else {
- return false;
- }
- });
- },
- confirm() {
- if (this.form.storageFeesItemsList.length == 0) return this.$message.success("明细没有数据");
- this.$confirm('是否确认生成仓储费?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- confirmSettlement(this.form).then(res => {
- this.$message.success("操作成功");
- this.getDetails(res.data.data.id)
- this.optionForm.disabled = true
- }).finally(() => {
- loading.close();
- })
- })
- },
- revokeConfirm() {
- this.$confirm('是否撤销生成仓储费?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- revokeSettlement(this.form).then(res => {
- this.$message.success("操作成功");
- this.getDetails(res.data.data.id)
- this.optionForm.disabled = false
- }).finally(() => {
- loading.close();
- })
- })
- },
- rowDel(row, index) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- itemRemove({ ids: row.id }).then(res => {
- this.form.storageFeesItemsList.splice(index, 1);
- this.$message.success("操作成功!");
- });
- } else {
- this.form.storageFeesItemsList.splice(index, 1);
- this.$message.success("操作成功!");
- }
- }
- );
- },
- //自定义列保存
- async saveColumn(ref, option, optionBack, code) {
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumn(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- goBack(type) {
- this.$emit("goBack", type);
- this.$emit('updateKey')
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- ::v-deep .el-table .cell {
- padding: 0 2px !important;
- .el-form-item {
- margin-bottom: 0px !important;
- }
- }
- ::v-deep .avue-crud .el-table .el-form-item__label {
- left: -1px;
- }
- ::v-deep#out-table .back-one {
- background: #ecf5ff !important;
- }
- ::v-deep#out-table .back-two {
- background: #ecf5ff !important;
- }
- </style>
|