|
@@ -153,6 +153,11 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="客户" align="center" prop="customerName" />
|
|
|
+ <el-table-column
|
|
|
+ label="结算单位"
|
|
|
+ align="center"
|
|
|
+ prop="settlementUnitName"
|
|
|
+ />
|
|
|
<el-table-column label="收款金额" align="center" prop="amount" />
|
|
|
<el-table-column label="经办人" align="center" prop="personInCharge" />
|
|
|
<!-- <el-table-column label="付款方式" align="center" prop="paymentMethod">
|
|
@@ -280,6 +285,7 @@
|
|
|
placeholder="请选择客户"
|
|
|
clearable
|
|
|
filterable
|
|
|
+ @change="getSettlementUnitList"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in customSelectData"
|
|
@@ -388,6 +394,31 @@
|
|
|
<el-input v-model="form.amount" placeholder="请输入金额" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="结算单位" prop="settlementUnitId">
|
|
|
+ <!-- <el-input
|
|
|
+ v-model="form.settlementUnitId"
|
|
|
+ placeholder="请输入结算单位"
|
|
|
+ >
|
|
|
+
|
|
|
+ </el-input> -->
|
|
|
+ <el-select v-model="form.settlementUnitId" clearable filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="item in settlementUnitList"
|
|
|
+ :key="item.ids"
|
|
|
+ :label="item.customerName"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ class="ml10"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="editSettleUnit"
|
|
|
+ ></el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="备注" prop="collectionDetails">
|
|
|
<el-input
|
|
@@ -398,6 +429,96 @@
|
|
|
</el-col>
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
+ <el-dialog
|
|
|
+ width="600px"
|
|
|
+ :title="customName + '的结算单位'"
|
|
|
+ :visible.sync="innerVisible"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="addSettleUnit"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ :disabled="adding"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <el-table :data="settleTableData" border stripe>
|
|
|
+ <el-table-column type="index" width="50" />
|
|
|
+ <el-table-column prop="customerName" label="单位名称">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="!scope.row.isEdit">{{ scope.row.customerName }}</span>
|
|
|
+ <el-input
|
|
|
+ v-else
|
|
|
+ v-model="scope.row.customerName"
|
|
|
+ size="mini"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="customerRegion" label="单位地区">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="!scope.row.isEdit">{{
|
|
|
+ scope.row.customerRegion
|
|
|
+ }}</span>
|
|
|
+ <el-input
|
|
|
+ v-else
|
|
|
+ v-model="scope.row.customerRegion"
|
|
|
+ size="mini"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <!-- 编辑 -->
|
|
|
+ <div class="btn-wrap" v-show="scope.row.isEdit && scope.row.id">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ size="small"
|
|
|
+ @click="addSettleUnitConfirm(scope.row)"
|
|
|
+ >保存</el-button
|
|
|
+ >
|
|
|
+ <el-button type="info" size="small" @click="initSettleTableData"
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <!-- 待编辑 -->
|
|
|
+ <div class="btn-wrap" v-show="!scope.row.isEdit && scope.row.id">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="scope.row.isEdit = true"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="deleteUnit(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <!-- 待新增 -->
|
|
|
+ <div class="btn-wrap" v-show="!scope.row.id">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="addSettleUnitConfirm(scope.row)"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="cancelAdd(scope.$index)"
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="innerCancel">关 闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
<!-- 应收表格 -->
|
|
|
<!-- <el-table
|
|
|
:data="receiveTableData"
|
|
@@ -431,7 +552,13 @@ import {
|
|
|
getDeptList,
|
|
|
getFinanceList,
|
|
|
} from "@/api/system/SaleOtherCollection";
|
|
|
-import { getCustomList } from "@/api/system/SaleRegistrationCollection";
|
|
|
+import {
|
|
|
+ getCustomList,
|
|
|
+ customerSettlementUnit,
|
|
|
+ addSettlementUnit,
|
|
|
+ updateSettlementUnit,
|
|
|
+ deleteSettlementUnit,
|
|
|
+} from "@/api/system/SaleRegistrationCollection";
|
|
|
import moment from "moment";
|
|
|
|
|
|
export default {
|
|
@@ -443,6 +570,10 @@ export default {
|
|
|
],
|
|
|
data() {
|
|
|
return {
|
|
|
+ innerVisible: false,
|
|
|
+ settleTableData: [],
|
|
|
+ customName: "",
|
|
|
+ settlementUnitList: [], //结算单位列表
|
|
|
timeRange: [],
|
|
|
financeSelectData: [], //经办人选择数据
|
|
|
deptSelectData: [], //部门选择数据
|
|
@@ -488,7 +619,21 @@ export default {
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
- rules: {},
|
|
|
+ rules: {
|
|
|
+ otherCollectionDate: [
|
|
|
+ { required: true, message: "日期不能为空", trigger: "change" },
|
|
|
+ ],
|
|
|
+ customerId: [
|
|
|
+ { required: true, message: "客户不能为空", trigger: "change" },
|
|
|
+ ],
|
|
|
+ paymentMethod: [
|
|
|
+ { required: true, message: "付款方式不能为空", trigger: "change" },
|
|
|
+ ],
|
|
|
+ itemReceivable: [
|
|
|
+ { required: true, message: "应收项目不能为空", trigger: "change" },
|
|
|
+ ],
|
|
|
+ amount: [{ required: true, message: "金额不能为空", trigger: "blur" }],
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
@@ -496,7 +641,131 @@ export default {
|
|
|
await this.initSelectData();
|
|
|
this.getList();
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ adding() {
|
|
|
+ if (!this.settleTableData.length) return false;
|
|
|
+ return this.settleTableData.some((item) => !item.id);
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ /* 内层弹窗关闭回调 */
|
|
|
+ innerCancel() {
|
|
|
+ this.innerVisible = false;
|
|
|
+ this.getSettlementUnitList();
|
|
|
+ },
|
|
|
+ /* 新增一条结算单位 */
|
|
|
+ addSettleUnit() {
|
|
|
+ this.settleTableData.unshift({
|
|
|
+ customerName: "",
|
|
|
+ customerRegion: "",
|
|
|
+ isEdit: true,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 删除单位 */
|
|
|
+ async deleteUnit(row) {
|
|
|
+ this.$confirm("是否确认删除该单位?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ try {
|
|
|
+ let res = await deleteSettlementUnit(row.id);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.initSettleTableData();
|
|
|
+ } else {
|
|
|
+ throw new Error(res.msg);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消删除",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 取消新增结算单位 */
|
|
|
+ cancelAdd(index) {
|
|
|
+ this.settleTableData.splice(index, 1);
|
|
|
+ },
|
|
|
+ /* 确认新增/修改一条结算单位 */
|
|
|
+ async addSettleUnitConfirm(row) {
|
|
|
+ let { customerName, customerRegion, id } = row;
|
|
|
+ if (!customerName || !customerRegion) {
|
|
|
+ this.$message.warning("请完善数据!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let customerId = this.form.customerId;
|
|
|
+ let fun = id ? updateSettlementUnit : addSettlementUnit;
|
|
|
+ let payload = {
|
|
|
+ customerId,
|
|
|
+ customerRegion,
|
|
|
+ customerName,
|
|
|
+ };
|
|
|
+ if (id) {
|
|
|
+ payload.id = id;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ let res = await fun(payload);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("操作成功!");
|
|
|
+ this.initSettleTableData();
|
|
|
+ } else {
|
|
|
+ throw new Error(res.msg);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 初始化结算单位表格数据 */
|
|
|
+ async initSettleTableData() {
|
|
|
+ await this.getSettlementUnitList();
|
|
|
+ this.settleTableData = this.settlementUnitList.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isEdit: false,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 开始编辑结算单位
|
|
|
+ async editSettleUnit() {
|
|
|
+ let customerId = this.form.customerId;
|
|
|
+ if (!customerId) {
|
|
|
+ this.$message.warning("请先选择客户名称");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.customName = this.customSelectData.find(
|
|
|
+ (item) => item.id == this.form.customerId
|
|
|
+ )?.customName;
|
|
|
+ await this.initSettleTableData();
|
|
|
+ this.innerVisible = true;
|
|
|
+ },
|
|
|
+ // 获取结算单位下拉框数据
|
|
|
+ async getSettlementUnitList() {
|
|
|
+ let customerId = this.form.customerId;
|
|
|
+ if (!customerId) {
|
|
|
+ this.$message.warning("请先选择客户名称");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ let payload = {
|
|
|
+ customerId,
|
|
|
+ isEnablePaging: false,
|
|
|
+ };
|
|
|
+ let res = await customerSettlementUnit(payload);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.settlementUnitList = res.rows;
|
|
|
+ } else {
|
|
|
+ throw new Error(res.msg);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 提交回调
|
|
|
async handleSubmit(row) {
|
|
|
this.$confirm("是否确认提交?", "提示", {
|
|
@@ -612,6 +881,7 @@ export default {
|
|
|
personInChargeId: null,
|
|
|
paymentMethod: null,
|
|
|
travelCertificateNumber: null,
|
|
|
+ settlementUnitId: null,
|
|
|
deptId: null,
|
|
|
collectionDetails: null,
|
|
|
itemReceivable: null,
|