|
@@ -17,7 +17,7 @@
|
|
|
{
|
|
|
text: '合并付款',
|
|
|
disabled: selectData.length === 0,
|
|
|
- action: () => start(20),
|
|
|
+ action: () => handlePayment(20),
|
|
|
},
|
|
|
]"
|
|
|
@get-list="getList"
|
|
@@ -31,23 +31,28 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <template #paymentStatus="{ item }">
|
|
|
+ <template #payStatus="{ item }">
|
|
|
<div
|
|
|
style="cursor: pointer; color: #409eff"
|
|
|
- @click="handleClickArrivalStatus(item)"
|
|
|
+ @click="handleClickPayStatus(item)"
|
|
|
>
|
|
|
- {{ dictValueLabel(item.arrivalStatus, arrivalStatus) }}
|
|
|
+ {{ dictValueLabel(item.payStatus, paymentStatus) }}
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<template #btn="{ item }">
|
|
|
<div>
|
|
|
- <el-button type="primary" link @click="start(10)">付款</el-button>
|
|
|
-
|
|
|
- <el-button type="primary" link @click="handleEdit(item, 88)"
|
|
|
+ <el-button type="primary" link @click="handlePayment(10)"
|
|
|
+ >付款</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ v-if="item.payStatus != 30"
|
|
|
+ @click="handleEnd(item)"
|
|
|
>结束</el-button
|
|
|
>
|
|
|
- <el-button type="primary" link @click="handleEdit(item, 99)"
|
|
|
+ <el-button type="primary" link @click="handleClear(item)"
|
|
|
>清空</el-button
|
|
|
>
|
|
|
</div>
|
|
@@ -70,22 +75,23 @@
|
|
|
>
|
|
|
<template #details>
|
|
|
<div style="width: 100%">
|
|
|
- <el-table :data="formData.data.afterSaleDetailList">
|
|
|
- <el-table-column prop="productCode" label="采购单号" />
|
|
|
- <el-table-column prop="productName" label="采购金额" />
|
|
|
- <el-table-column prop="productSpec" label="已付款金额" />
|
|
|
- <el-table-column prop="quantity" label="付款金额" min-width="150">
|
|
|
+ <el-table :data="formData.data.purchasePayRecordDetailList">
|
|
|
+ <el-table-column prop="code" label="采购单号" />
|
|
|
+ <el-table-column prop="waitAmount" label="采购金额" />
|
|
|
+ <el-table-column prop="alreadyAmount" label="已付款金额" />
|
|
|
+ <el-table-column prop="amount" label="付款金额" min-width="150">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item
|
|
|
- :prop="'afterSaleDetailList.' + $index + '.quantity'"
|
|
|
- :rules="rules.quantity"
|
|
|
+ :prop="'purchasePayRecordDetailList.' + $index + '.amount'"
|
|
|
+ :rules="rules.amount"
|
|
|
:inline-message="true"
|
|
|
>
|
|
|
<el-input-number
|
|
|
- v-model="row.quantity"
|
|
|
- :precision="2"
|
|
|
+ v-model="row.amount"
|
|
|
+ :precision="4"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
+ onmousewheel="return false;"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
@@ -120,17 +126,15 @@
|
|
|
placement="top"
|
|
|
v-for="(activity, index) in activities"
|
|
|
:key="index"
|
|
|
- :timestamp="activity.handleTime"
|
|
|
+ :timestamp="activity.payUserName"
|
|
|
>
|
|
|
- <div>
|
|
|
- 跟进人:{{ activity.handleUserName }}
|
|
|
- <span
|
|
|
- >({{
|
|
|
- dictValueLabel(activity.status, afterSalesStatus)
|
|
|
- }})</span
|
|
|
- >
|
|
|
+ <!-- <template default>
|
|
|
+ <div>aa</div>
|
|
|
+ </template> -->
|
|
|
+ <div>付款金额:{{ moneyFormat(activity.amount, 2) }}</div>
|
|
|
+ <div style="margin-top: 5px">
|
|
|
+ 付款时间: {{ activity.createTime }}
|
|
|
</div>
|
|
|
- <div style="margin-top: 5px">跟进记录: {{ activity.remark }}</div>
|
|
|
</el-timeline-item>
|
|
|
</el-timeline>
|
|
|
</div>
|
|
@@ -142,19 +146,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-/* eslint-disable vue/no-unused-components */
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import byTable from "@/components/byTable/index";
|
|
|
import byForm from "@/components/byForm/index";
|
|
|
-import FileUpload from "@/components/FileUpload/index";
|
|
|
-import { computed, defineComponent, ref } from "vue";
|
|
|
-import { getToken } from "@/utils/auth";
|
|
|
-import SelectProduct from "@/components/WDLY/product/SelectProduct";
|
|
|
-import useUserStore from "@/store/modules/user";
|
|
|
|
|
|
-const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
|
|
|
-const headers = ref({ Authorization: "Bearer " + getToken() });
|
|
|
-const uploadData = ref({});
|
|
|
const loading = ref(false);
|
|
|
const submitLoading = ref(false);
|
|
|
const sourceList = ref({
|
|
@@ -171,14 +166,8 @@ let dialogVisible = ref(false);
|
|
|
let dialogVisibleOne = ref(false);
|
|
|
let activities = ref([]);
|
|
|
let modalType = ref("add");
|
|
|
-
|
|
|
let rules = ref({
|
|
|
- detailedAddress: [
|
|
|
- { required: true, message: "请输入详细地址", trigger: "blur" },
|
|
|
- ],
|
|
|
- handleUserId: [
|
|
|
- { required: true, message: "请选择跟进人", trigger: "change" },
|
|
|
- ],
|
|
|
+ amount: [{ required: true, message: "请输入付款金额", trigger: "blur" }],
|
|
|
});
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const arrivalStatus = ref([
|
|
@@ -212,12 +201,12 @@ const paymentStatus = ref([
|
|
|
const selectConfig = computed(() => [
|
|
|
{
|
|
|
label: "到货状态",
|
|
|
- prop: "type",
|
|
|
+ prop: "arrivalStatus",
|
|
|
data: arrivalStatus.value,
|
|
|
},
|
|
|
{
|
|
|
label: "付款状态",
|
|
|
- prop: "status",
|
|
|
+ prop: "payStatus",
|
|
|
data: paymentStatus.value,
|
|
|
},
|
|
|
]);
|
|
@@ -234,45 +223,44 @@ const config = computed(() => {
|
|
|
label: "采购单号",
|
|
|
slot: "contractCode",
|
|
|
},
|
|
|
- // render(type) {
|
|
|
- // return proxy.dictValueLabel(type, afterSalesType.value);
|
|
|
- // },
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "供应商",
|
|
|
- prop: "customerName",
|
|
|
+ prop: "supplyName",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "收获仓库",
|
|
|
- prop: "createTime",
|
|
|
+ prop: "receiptWarehouseName",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "采购金额",
|
|
|
- prop: "address",
|
|
|
+ prop: "amount",
|
|
|
+ width: 100,
|
|
|
},
|
|
|
- render() {
|
|
|
- return proxy.moneyFormat(20, 2);
|
|
|
+ render(amount) {
|
|
|
+ return proxy.moneyFormat(amount, 2);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "已付款金额",
|
|
|
- prop: "cause",
|
|
|
+ prop: "paidAmount",
|
|
|
+ width: 100,
|
|
|
},
|
|
|
- render() {
|
|
|
- return proxy.moneyFormat(20, 2);
|
|
|
+ render(paidAmount) {
|
|
|
+ return proxy.moneyFormat(paidAmount, 2);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "采购人",
|
|
|
- prop: "createTime",
|
|
|
- width: 100,
|
|
|
+ prop: "purchaseName",
|
|
|
+ width: 150,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -285,14 +273,17 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "到货状态",
|
|
|
- prop: "createTime",
|
|
|
+ prop: "arrivalStatus",
|
|
|
width: 100,
|
|
|
},
|
|
|
+ render(status) {
|
|
|
+ return proxy.dictValueLabel(status, arrivalStatus.value);
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "付款状态",
|
|
|
- slot: "paymentStatus",
|
|
|
+ slot: "payStatus",
|
|
|
width: 100,
|
|
|
},
|
|
|
},
|
|
@@ -324,22 +315,22 @@ const byform = ref(null);
|
|
|
let formConfig = computed(() => [
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "type",
|
|
|
+ prop: "supplyName",
|
|
|
label: "供应商",
|
|
|
disabled: true,
|
|
|
},
|
|
|
{
|
|
|
type: "date",
|
|
|
itemType: "datetime",
|
|
|
- prop: "type",
|
|
|
+ prop: "payDate",
|
|
|
label: "付款时间",
|
|
|
format: "YYYY-MM-DD HH:mm:ss",
|
|
|
},
|
|
|
{
|
|
|
type: "number",
|
|
|
- prop: "aa",
|
|
|
+ prop: "amount",
|
|
|
label: "付款金额",
|
|
|
- precision: 2,
|
|
|
+ precision: 4,
|
|
|
min: 0,
|
|
|
controls: false,
|
|
|
},
|
|
@@ -357,37 +348,39 @@ const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
|
proxy
|
|
|
- .post("/afterSaleRecord/page", sourceList.value.pagination)
|
|
|
- .then((message) => {
|
|
|
- console.log(message);
|
|
|
- sourceList.value.data = message.rows;
|
|
|
- sourceList.value.pagination.total = message.total;
|
|
|
+ .post("/purchase/pageByWdly", sourceList.value.pagination)
|
|
|
+ .then((res) => {
|
|
|
+ sourceList.value.data = res.rows.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ ...JSON.parse(x.victoriatouristJson),
|
|
|
+ isCheck: true,
|
|
|
+ }));
|
|
|
+ sourceList.value.pagination.total = res.total;
|
|
|
setTimeout(() => {
|
|
|
loading.value = false;
|
|
|
}, 200);
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
-const rowData = ref({});
|
|
|
-
|
|
|
const submitForm = () => {
|
|
|
byform.value.handleSubmit((valid) => {
|
|
|
- const list = formData.data.afterSaleDetailList;
|
|
|
- if (!list.length > 0)
|
|
|
- return ElMessage({
|
|
|
- message: `请关联商品!`,
|
|
|
- type: "info",
|
|
|
- });
|
|
|
+ const list = formData.data.purchasePayRecordDetailList;
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
|
const e = list[i];
|
|
|
- if (e.quantity == 0) {
|
|
|
+ if (Number(e.amount) + Number(e.alreadyAmount) > Number(e.waitAmount)) {
|
|
|
return ElMessage({
|
|
|
- message: `数量不能为0!`,
|
|
|
+ message: `本次付款加已付款金额不可大于采购金额`,
|
|
|
type: "info",
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- proxy.post("ada", formData.data).then(
|
|
|
+ const total = list.reduce((total, x) => (total += Number(x.amount)), 0);
|
|
|
+ if (Number(formData.data.amount) != total) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "本次付款合计必须等于上方的付款金额",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ proxy.post("/purchasePayRecord/add", formData.data).then(
|
|
|
(res) => {
|
|
|
ElMessage({
|
|
|
message: "操作成功",
|
|
@@ -406,158 +399,107 @@ const submitForm = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const getDtl = (row) => {
|
|
|
- modalType.value = "edit";
|
|
|
- proxy.post("/supplierInfo/detail", { id: row.id }).then((res) => {
|
|
|
- proxy
|
|
|
- .post("/fileInfo/getList", { businessIdList: [row.id] })
|
|
|
- .then((fileObj) => {
|
|
|
- fileList.value = fileObj[row.id] || [];
|
|
|
- fileListCopy.value = [...fileList.value];
|
|
|
- getCityData(res.countryId, "20");
|
|
|
- getCityData(res.provinceId, "30");
|
|
|
- res.type = res.type + "";
|
|
|
- res.victoriatouristJson = JSON.parse(res.victoriatouristJson);
|
|
|
- formData.data = res;
|
|
|
- dialogVisible.value = true;
|
|
|
- });
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const handleClickFile = (row) => {
|
|
|
- ElMessage({
|
|
|
- message: "数据请求中,请稍后!",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- let id = row.id;
|
|
|
- proxy.post("/fileInfo/getList", { businessIdList: [id] }).then((res) => {
|
|
|
- const file = res[id][0];
|
|
|
- window.open(file.fileUrl, "_blank");
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const handleClose = (index) => {
|
|
|
- if (fileListCopy.value.length === 1) {
|
|
|
- return ElMessage({
|
|
|
- message: "最后一个附件啦!",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
- }
|
|
|
- fileList.value.splice(index, 1);
|
|
|
- fileListCopy.value.splice(index, 1);
|
|
|
-};
|
|
|
-
|
|
|
-const countryData = ref([]);
|
|
|
-const provinceData = ref([]);
|
|
|
-const cityData = ref([]);
|
|
|
-
|
|
|
-const getCityData = (id, type, flag) => {
|
|
|
- proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
|
|
|
- if (type === "20") {
|
|
|
- provinceData.value = res;
|
|
|
- if (flag) {
|
|
|
- formData.data.provinceId = "";
|
|
|
- formData.data.provinceName = "";
|
|
|
- formData.data.cityId = "";
|
|
|
- formData.data.cityName = "";
|
|
|
- }
|
|
|
- } else if (type === "30") {
|
|
|
- cityData.value = res;
|
|
|
- if (flag) {
|
|
|
- formData.data.cityId = "";
|
|
|
- formData.data.cityName = "";
|
|
|
- }
|
|
|
- } else {
|
|
|
- countryData.value = res;
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
-const handleSelect = (row) => {
|
|
|
- const flag = formData.data.afterSaleDetailList.some(
|
|
|
- (x) => x.productId === row.id
|
|
|
- );
|
|
|
- if (flag)
|
|
|
- return ElMessage({
|
|
|
- message: "该商品已选择",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
- formData.data.afterSaleDetailList.push({
|
|
|
- productName: row.name,
|
|
|
- productCode: row.code,
|
|
|
- productSpec: row.spec,
|
|
|
- productId: row.id,
|
|
|
- quantity: null,
|
|
|
- remark: "",
|
|
|
- });
|
|
|
- return ElMessage({
|
|
|
- message: "选择成功",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const handleRemove = (index) => {
|
|
|
- formData.data.afterSaleDetailList.splice(index, 1);
|
|
|
- return ElMessage({
|
|
|
- message: "删除成功",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const getDict = () => {
|
|
|
- proxy.getDict(["after_sale_type", "after_sale_status"]).then((res) => {
|
|
|
- afterSalesType.value = res["after_sale_type"].map((x) => ({
|
|
|
- label: x.dictValue,
|
|
|
- value: x.dictKey,
|
|
|
- }));
|
|
|
- afterSalesStatus.value = res["after_sale_status"].map((x) => ({
|
|
|
- label: x.dictValue,
|
|
|
- value: x.dictKey,
|
|
|
- }));
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
const selectData = ref([]);
|
|
|
-const selectDataOne = ref([]);
|
|
|
const selectRow = (data) => {
|
|
|
selectData.value = data;
|
|
|
};
|
|
|
watch(selectData, (newVal, oldVal) => {
|
|
|
if (newVal.length == 0) {
|
|
|
sourceList.value.data.forEach((x) => {
|
|
|
- if (x.status <= 30) {
|
|
|
- x.isCheck = true;
|
|
|
- } else {
|
|
|
- x.isCheck = false;
|
|
|
- }
|
|
|
+ x.isCheck = true;
|
|
|
});
|
|
|
} else if (newVal.length == 1) {
|
|
|
const current = newVal[0];
|
|
|
sourceList.value.data.forEach((x) => {
|
|
|
- if (x.receiptWarehouseId !== current.receiptWarehouseId) {
|
|
|
+ if (x.supplyId !== current.supplyId) {
|
|
|
x.isCheck = false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
-const start = (type, data) => {
|
|
|
+const handlePayment = (type, data) => {
|
|
|
modalType.value = "add";
|
|
|
- let ids = [];
|
|
|
- let row = {};
|
|
|
if (type === 10) {
|
|
|
- selectDataOne.value = [data];
|
|
|
- // row = selectDataOne.value[0];
|
|
|
- // ids = selectDataOne.value.map((x) => x.id).join();
|
|
|
+ selectData.value = [data];
|
|
|
} else if (type === 20) {
|
|
|
- // ids = selectData.value.map((x) => x.id).join();
|
|
|
- // row = selectData.value[0];
|
|
|
}
|
|
|
+ formData.data = {
|
|
|
+ supplyName: selectData.value[0].supplyName,
|
|
|
+ amount: "",
|
|
|
+ payDate: "",
|
|
|
+ purchasePayRecordDetailList: selectData.value.map((x) => ({
|
|
|
+ purchaseId: x.id,
|
|
|
+ code: x.contractCode,
|
|
|
+ waitAmount: x.amount,
|
|
|
+ alreadyAmount: x.paidAmount,
|
|
|
+ amount: null,
|
|
|
+ })),
|
|
|
+ };
|
|
|
dialogVisible.value = true;
|
|
|
};
|
|
|
|
|
|
-getCityData("0");
|
|
|
+const handleClickPayStatus = (row) => {
|
|
|
+ proxy
|
|
|
+ .post("/purchasePayRecordDetail/page", { purchaseId: row.id })
|
|
|
+ .then((res) => {
|
|
|
+ if (res && res.rows && res.rows.length > 0) {
|
|
|
+ activities.value = res.rows;
|
|
|
+ dialogVisibleOne.value = true;
|
|
|
+ } else {
|
|
|
+ return ElMessage({
|
|
|
+ message: `暂无付款记录`,
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleEnd = (row) => {
|
|
|
+ // 弹窗提示是否删除
|
|
|
+ ElMessageBox.confirm("是否确认结束?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ // 删除
|
|
|
+ proxy
|
|
|
+ .post("/purchase/edit", {
|
|
|
+ ...row,
|
|
|
+ payStatus: 30,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "操作成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleClear = (row) => {
|
|
|
+ // 弹窗提示是否删除
|
|
|
+ ElMessageBox.confirm("是否确认清空付款记录?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ // 删除
|
|
|
+ proxy
|
|
|
+ .post("/purchasePayRecordDetail/empty", {
|
|
|
+ purchaseId: row.id,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "操作成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
getList();
|
|
|
-getDict();
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|