|
@@ -15,13 +15,39 @@
|
|
|
]"
|
|
|
@get-list="getList">
|
|
|
<template #amount="{ item }">
|
|
|
- <div>
|
|
|
+ <div style="width: 100%">
|
|
|
<span style="padding-right: 4px">{{ item.currency }}</span>
|
|
|
<span>{{ moneyFormat(item.amount, 2) }}</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <template #buyCorporationName="{ item }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <a style="color: #409eff; cursor: pointer" @click="clickCorporationName(item.buyCorporationName)">{{ item.buyCorporationName }}</a>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #tags="{ item }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.tags" closable :key="index" @close="tagClose(tag, item)">
|
|
|
+ {{ dictValueLabel(tag, customerTag) }}
|
|
|
+ </el-tag>
|
|
|
+ <template v-if="item.tags.length !== customerTag.length">
|
|
|
+ <el-select
|
|
|
+ v-if="item.addTagShow"
|
|
|
+ v-model="addTag"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="
|
|
|
+ (val) => {
|
|
|
+ return changeTag(val, item);
|
|
|
+ }
|
|
|
+ ">
|
|
|
+ <el-option v-for="tag in customerTag" :key="tag.value" :label="tag.label" :value="tag.value" :disabled="judgeTagSelect(item.tags, tag.value)" />
|
|
|
+ </el-select>
|
|
|
+ <el-tag style="cursor: pointer" type="success" @click="showSelect(item)" v-else> + </el-tag>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template #advanceRatio="{ item }">
|
|
|
- <div>
|
|
|
+ <div style="width: 100%">
|
|
|
<span>{{ item.advanceRatio }}%</span>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -80,6 +106,7 @@ const corporationList = ref([]);
|
|
|
const customerList = ref([]);
|
|
|
const userList = ref([]);
|
|
|
const shippingMethod = ref([]);
|
|
|
+const customerTag = ref([]);
|
|
|
const status = ref([
|
|
|
{
|
|
|
label: "草稿",
|
|
@@ -167,11 +194,15 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "客户名称",
|
|
|
- prop: "buyCorporationId",
|
|
|
+ slot: "buyCorporationName",
|
|
|
"min-width": 220,
|
|
|
},
|
|
|
- render(type) {
|
|
|
- return proxy.dictValueLabel(type, customerList.value);
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "客户标签",
|
|
|
+ slot: "tags",
|
|
|
+ width: 180,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -252,7 +283,11 @@ const config = computed(() => {
|
|
|
];
|
|
|
});
|
|
|
const getDict = () => {
|
|
|
- proxy.getDictOne(["trade_methods", "account_currency", "shipping_method"]).then((res) => {
|
|
|
+ proxy.getDictOne(["customer_tag", "trade_methods", "account_currency", "shipping_method"]).then((res) => {
|
|
|
+ customerTag.value = res["customer_tag"].map((x) => ({
|
|
|
+ label: x.dictValue,
|
|
|
+ value: x.dictKey,
|
|
|
+ }));
|
|
|
tradeMethods.value = res["trade_methods"].map((x) => ({
|
|
|
label: x.dictValue,
|
|
|
value: x.dictKey,
|
|
@@ -303,6 +338,14 @@ const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
|
proxy.post("/sample/page", sourceList.value.pagination).then((res) => {
|
|
|
+ res.rows.forEach((x) => {
|
|
|
+ x.addTagShow = false;
|
|
|
+ if (x.tag) {
|
|
|
+ x.tags = x.tag.split(",");
|
|
|
+ } else {
|
|
|
+ x.tags = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
sourceList.value.data = res.rows;
|
|
|
sourceList.value.pagination.total = res.total;
|
|
|
setTimeout(() => {
|
|
@@ -466,6 +509,64 @@ const submitHandoverSlip = () => {
|
|
|
getList();
|
|
|
});
|
|
|
};
|
|
|
+const addTag = ref("");
|
|
|
+const judgeTagSelect = (data, val) => {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ if (data.includes(val)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+};
|
|
|
+const changeTag = (val, item) => {
|
|
|
+ let data = {
|
|
|
+ id: item.buyCorporationId,
|
|
|
+ tag: proxy.deepClone(item.tags),
|
|
|
+ };
|
|
|
+ data.tag.push(val);
|
|
|
+ data.tag = data.tag.join(",");
|
|
|
+ proxy.post("/customer/editTag", data).then(() => {
|
|
|
+ ElMessage({
|
|
|
+ message: "添加成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ item.addTagShow = false;
|
|
|
+ addTag.value = "";
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+};
|
|
|
+const tagClose = (val, item) => {
|
|
|
+ let data = {
|
|
|
+ id: item.buyCorporationId,
|
|
|
+ tag: proxy.deepClone(item.tags),
|
|
|
+ };
|
|
|
+ data.tag = data.tag.filter((row) => row !== val);
|
|
|
+ if (data.tag && data.tag.length > 0) {
|
|
|
+ data.tag = data.tag.join(",");
|
|
|
+ } else {
|
|
|
+ data.tag = "";
|
|
|
+ }
|
|
|
+ proxy.post("/customer/editTag", data).then(() => {
|
|
|
+ ElMessage({
|
|
|
+ message: "添加成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ item.addTagShow = false;
|
|
|
+ addTag.value = "";
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+};
|
|
|
+const showSelect = (item) => {
|
|
|
+ item.addTagShow = true;
|
|
|
+};
|
|
|
+const clickCorporationName = (name) => {
|
|
|
+ proxy.$router.replace({
|
|
|
+ path: "/ERP/customer/privatesea",
|
|
|
+ query: {
|
|
|
+ name: name,
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|