售后 or 订单列表同步订单

This commit is contained in:
qiaopengfei 2024-08-20 17:15:17 +08:00
parent 3e55f0ecb6
commit 72a6cdb8a5
12 changed files with 489 additions and 149 deletions

View File

@ -47,3 +47,11 @@ export function after_log(data) {
data data
}) })
} }
// 同步订单
export function manual_after_order(data) {
return request({
url: `xy_openapi/afterSale/manual_after_order`,
method: 'post',
data
})
}

View File

@ -55,3 +55,11 @@ export function commodity_log(data) {
data data
}) })
} }
// 同步订单
// export function manual_after_order(data) {
// return request({
// url: `xy_openapi/afterSale/manual_after_order`,
// method: 'post',
// data
// })
// }

View File

@ -65,3 +65,11 @@ export function order_log(data) {
}) })
} }
// 同步订单
export function manual_sync_order(data) {
return request({
url: 'xy_openapi/api/order_info/manual_sync_order',
method: 'post',
data
})
}

View File

@ -39,4 +39,44 @@ export function senderDelete(data) {
data data
}) })
} }
// 修改寄件人
export function senderUpdate(data) {
return request({
url: `xy_openapi/sender/update`,
method: 'put',
data
})
}
// 获取快递公司
export function getExpressCompanyList(data) {
return request({
url: 'xy_openapi/api/order_info/getExpressCompanyList',
method: 'get',
data
})
}
// 获取快递产品
export function getLogisticsProductList(data) {
return request({
url: `xy_openapi/api/order_info/getLogisticsProductList`,
method: 'get',
data
})
}
// 编辑物流
export function update(data) {
return request({
url: `xy_openapi/address/update`,
method: 'put',
data
})
}
// 删除物流
export function addressDelete(data) {
return request({
url: `xy_openapi/address/delete/${data}`,
method: 'delete',
data
})
}

View File

@ -1,12 +1,14 @@
<template> <template>
<div class="button-group"> <div class="button-group">
<span v-for="(item, index) in $attrs.buttonList" :key="index">
<el-button <el-button
v-bind="$attrs" v-bind="$attrs"
v-for="(item, index) in $attrs.buttonList" v-if="item.show"
:key="index" :loading="item.Loading"
@click="item.handler(item)" @click="item.handler(item)"
>{{ item.name }}</el-button >{{ item.name }}</el-button
> >
</span>
<slot name="other"></slot> <slot name="other"></slot>
</div> </div>
</template> </template>
@ -23,5 +25,4 @@
margin-left: 0px !important; margin-left: 0px !important;
margin-right: 10px; margin-right: 10px;
} }
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog <el-dialog
:before-close="false" :before-close="DeliveryCancel"
title="发货" title="发货"
:width="750" :width="750"
top="8vh" top="8vh"
@ -66,9 +66,16 @@
/></span> /></span>
</div> </div>
<div> <div>
<el-popover placement="bottom" :width="500" trigger="click"> <el-popover
placement="bottom"
:width="500"
trigger="click"
:visible="receiptVisible"
>
<template #reference> <template #reference>
<el-button size="small">更改收件人信息</el-button> <el-button size="small" @click="receiptVisible = true"
>更改收件人信息</el-button
>
</template> </template>
<el-row> <el-row>
<el-col <el-col
@ -77,14 +84,24 @@
:key="index" :key="index"
> >
<el-form-item :label="item.label"> <el-form-item :label="item.label">
<el-input <el-input v-model="recipientList[item.params]" />
v-model="
orderDeliveryDto.contactInfoList[0][item.params]
"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<div class="btnbox">
<el-button
type="text"
class="btn"
@click="changeInfo('recipient')"
>确定</el-button
>
<el-button
type="text"
class="btn"
@click="editCancel('recipient')"
>取消修改</el-button
>
</div>
</el-popover> </el-popover>
</div> </div>
</div> </div>
@ -112,9 +129,16 @@
<div class="title">寄件信息</div> <div class="title">寄件信息</div>
</div> </div>
<div> <div>
<el-popover placement="bottom" :width="260" trigger="click"> <el-popover
placement="bottom"
:width="260"
trigger="click"
:visible="senderVisible"
>
<template #reference> <template #reference>
<el-button size="small">更改寄件人信息</el-button> <el-button size="small" @click="senderVisible = true"
>更改寄件人信息</el-button
>
</template> </template>
<el-row> <el-row>
<el-col <el-col
@ -130,7 +154,6 @@
:placeholder="`请选择寄件人`" :placeholder="`请选择寄件人`"
clearable clearable
v-model="sender" v-model="sender"
@change="changeInfo(item)"
> >
<el-option <el-option
v-for="el in item.options" v-for="el in item.options"
@ -142,6 +165,20 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<div class="btnbox">
<el-button
type="text"
class="btn"
@click="changeInfo('sender')"
>确定</el-button
>
<el-button
type="text"
class="btn"
@click="editCancel('sender')"
>取消修改</el-button
>
</div>
</el-popover> </el-popover>
</div> </div>
</div> </div>
@ -227,11 +264,7 @@ const props = defineProps({
default: false, default: false,
}, },
}); });
const emit = defineEmits([ const emit = defineEmits(["deliveryConfirm", "deliveryCancel", "Print"]);
"deliveryConfirm",
"deliveryCancel",
"Print",
]);
const ruleFormRef = ref(null); const ruleFormRef = ref(null);
const orderDeliveryDto = reactive({ const orderDeliveryDto = reactive({
@ -255,7 +288,7 @@ const orderDeliveryDto = reactive({
contactType: "1", // contactType: "1", //
cityId: "", //id,idid cityId: "", //id,idid
districtId: "", //id districtId: "", //id
deliveryCompany: "", // deliveryid: "", //
remark: "", // remark: "", //
trackingNumber: "", // trackingNumber: "", //
deliverType: "", deliverType: "",
@ -263,6 +296,13 @@ const orderDeliveryDto = reactive({
], ],
}); });
const sender = ref(null); const sender = ref(null);
let recipientList = ref({
contact: "", //
tel: "", //
address: "", //
});
const receiptVisible = ref(false);
const senderVisible = ref(false);
const ruleForm = reactive({ const ruleForm = reactive({
receiptInfor: [ receiptInfor: [
{ {
@ -326,8 +366,8 @@ const ruleForm = reactive({
{ {
type: "select", type: "select",
label: "物流公司", label: "物流公司",
props: "deliveryCompany", props: "deliveryid",
params: "deliveryCompany", params: "deliveryid",
span: 11, span: 11,
options: [], options: [],
}, },
@ -384,8 +424,8 @@ const shippingAddresss = (rule, value, callback) => {
} }
callback(); callback();
}; };
const deliveryCompany = (rule, value, callback) => { const deliveryid = (rule, value, callback) => {
if (!orderDeliveryDto.contactInfoList[1].deliveryCompany) { if (!orderDeliveryDto.contactInfoList[1].deliveryid) {
callback(new Error("请选择物流公司")); callback(new Error("请选择物流公司"));
} }
callback(); callback();
@ -403,7 +443,7 @@ const rules = reactive({
shippingName: [{ validator: shippingName, trigger: "blur" }], shippingName: [{ validator: shippingName, trigger: "blur" }],
shippingTel: [{ validator: shippingTel, trigger: "blur" }], shippingTel: [{ validator: shippingTel, trigger: "blur" }],
shippingAddresss: [{ validator: shippingAddresss, trigger: "blur" }], shippingAddresss: [{ validator: shippingAddresss, trigger: "blur" }],
deliveryCompany: [{ validator: deliveryCompany, trigger: "blur" }], deliveryid: [{ validator: deliveryid, trigger: "blur" }],
trackingNumber: [{ validator: trackingNumber, trigger: "blur" }], trackingNumber: [{ validator: trackingNumber, trigger: "blur" }],
}); });
@ -450,8 +490,8 @@ const changeRadio = (e) => {
{ {
type: "select", type: "select",
label: "物流公司", label: "物流公司",
props: "deliveryCompany", props: "deliveryid",
params: "deliveryCompany", params: "deliveryid",
span: 11, span: 11,
options: [], options: [],
}, },
@ -487,8 +527,8 @@ const changeRadio = (e) => {
{ {
type: "select", type: "select",
label: "物流公司", label: "物流公司",
props: "deliveryCompany", props: "deliveryid",
params: "deliveryCompany", params: "deliveryid",
span: 11, span: 11,
options: [], options: [],
}, },
@ -507,12 +547,28 @@ const changeRadio = (e) => {
ruleForm.shippingInfor.find((e) => e.label == "物流公司").options = ruleForm.shippingInfor.find((e) => e.label == "物流公司").options =
props.DeliveryInfoList.logisticsRespList.map((item) => ({ props.DeliveryInfoList.logisticsRespList.map((item) => ({
label: item.logisticsName, label: item.logisticsName,
value: item.logisticsCode, value: item.id,
})); }));
} }
}; };
const editCancel = (item) => {
if (item == "recipient") {
receiptVisible.value = false;
} else {
senderVisible.value = false;
}
};
const changeInfo = (item) => { const changeInfo = (item) => {
if (item.label === "寄件人:") { if (item === "recipient") {
orderDeliveryDto.contactInfoList[1].trackingNumber = "";
orderDeliveryDto.contactInfoList[0] = {
...orderDeliveryDto.contactInfoList[0],
...recipientList.value,
};
editCancel(item);
quickorder("downlist");
} else if (item === "sender") {
orderDeliveryDto.contactInfoList[1].trackingNumber = "";
const senderinfo = props.DeliveryInfoList.senderList.find( const senderinfo = props.DeliveryInfoList.senderList.find(
(item) => item.id === sender.value (item) => item.id === sender.value
); );
@ -528,10 +584,11 @@ const changeInfo = (item) => {
cityId: senderinfo.city_id, cityId: senderinfo.city_id,
districtId: senderinfo.district_id, districtId: senderinfo.district_id,
}; };
editCancel(item);
quickorder("downlist");
} else if (item.label === "物流公司") { } else if (item.label === "物流公司") {
const logisticList = props.DeliveryInfoList.logisticsRespList.find( const logisticList = props.DeliveryInfoList.logisticsRespList.find(
(e) => (e) => e.id == orderDeliveryDto.contactInfoList[1].deliveryid
e.logisticsCode == orderDeliveryDto.contactInfoList[1].deliveryCompany
); );
orderDeliveryDto.id = logisticList.id; orderDeliveryDto.id = logisticList.id;
orderDeliveryDto.contactInfoList[1] = { orderDeliveryDto.contactInfoList[1] = {
@ -540,17 +597,21 @@ const changeInfo = (item) => {
address: `${logisticList.province}${logisticList.city}${logisticList.district}${logisticList.detailed}`, address: `${logisticList.province}${logisticList.city}${logisticList.district}${logisticList.detailed}`,
cityId: logisticList.city_id, cityId: logisticList.city_id,
districtId: logisticList.district_id, districtId: logisticList.district_id,
deliveryCompany: logisticList.logisticsCode, deliveryid: logisticList.id,
deliverType: "0", deliverType: "0",
contactType: "1", contactType: "1",
}; };
if (!logisticList.monthFlag) return; if (!logisticList.monthFlag) return;
orderDeliveryDto.contactInfoList[1].trackingNumber = ""; orderDeliveryDto.contactInfoList[1].trackingNumber = "";
orderDeliveryDto.deliveryCompany = orderDeliveryDto.deliveryCompany =
orderDeliveryDto.contactInfoList[1].deliveryCompany; props.DeliveryInfoList.logisticsRespList.find(
(e) => e.id == orderDeliveryDto.contactInfoList[1].deliveryid
).logisticsCode
quickorder("downlist"); quickorder("downlist");
} }
}; };
const copyinfo = (e) => { const copyinfo = (e) => {
const text = const text =
"收件人:" + "收件人:" +
@ -571,7 +632,7 @@ const quickorder = (str) => {
} }
}); });
} else { } else {
const info = orderDeliveryDto.contactInfoList[1]; const info = orderDeliveryDto.deliveryCompany;
let status = let status =
info.deliveryCompany == "sf" ? 1 : info.deliveryCompany == "jd" ? 2 : ""; info.deliveryCompany == "sf" ? 1 : info.deliveryCompany == "jd" ? 2 : "";
emit("Print", { emit("Print", {
@ -591,7 +652,10 @@ watch(
if (val && val.senderList && val.senderList.length > 0) { if (val && val.senderList && val.senderList.length > 0) {
once = true; once = true;
const sender = val.senderList[0]; const sender = val.senderList[0];
const logisticList = val.logisticsRespList.find((e) => e.defaultFlag); const defaultFlag = val.logisticsRespList.some((e) => e.defaultFlag);
const logisticList = defaultFlag
? val.logisticsRespList.find((e) => e.defaultFlag)
: val.logisticsRespList[0];
if (sender && logisticList) { if (sender && logisticList) {
sender.value = sender.id; sender.value = sender.id;
orderDeliveryDto.orderId = val.orderId; orderDeliveryDto.orderId = val.orderId;
@ -609,18 +673,22 @@ watch(
address: `${logisticList.province}${logisticList.city}${logisticList.district}${logisticList.detailed}`, address: `${logisticList.province}${logisticList.city}${logisticList.district}${logisticList.detailed}`,
cityId: logisticList.city_id, cityId: logisticList.city_id,
districtId: logisticList.district_id, districtId: logisticList.district_id,
deliveryCompany: logisticList.logisticsCode, deliveryid: logisticList.id,
deliverType: "0", deliverType: "0",
contactType: "1", contactType: "1",
}; };
recipientList.value = {
contact: val.receiverName,
tel: val.receiverPhone,
address: `${val.receiverProvince}${val.receiverCity}${val.receiverDistrict}${val.receiverAddress}`,
};
ruleForm.shippingInfor.find((e) => e.label == "寄件人:").options = ruleForm.shippingInfor.find((e) => e.label == "寄件人:").options =
val.senderList.map((item) => ({ label: item.name, value: item.id })); val.senderList.map((item) => ({ label: item.name, value: item.id }));
ruleForm.shippingInfor.find((e) => e.label == "物流公司").options = ruleForm.shippingInfor.find((e) => e.label == "物流公司").options =
val.logisticsRespList.map((item) => ({ val.logisticsRespList.map((item) => ({
label: item.logisticsName, label: item.logisticsName,
value: item.logisticsCode, value: item.id,
})); }));
} }
if ( if (
@ -718,6 +786,11 @@ onMounted(() => {});
height: 80px; height: 80px;
} }
} }
.btnbox {
display: flex;
justify-content: flex-end;
}
.dialog-footer { .dialog-footer {
display: flex; display: flex;
justify-content: end; justify-content: end;

View File

@ -147,7 +147,7 @@
</template> </template>
<script setup> <script setup>
import { ref, defineEmits, defineProps, computed } from "vue"; import { ref, defineEmits, defineProps, computed, defineExpose } from "vue";
import { Picture as IconPicture } from "@element-plus/icons-vue"; import { Picture as IconPicture } from "@element-plus/icons-vue";
const Table = ref(null); const Table = ref(null);
const $emit = defineEmits(["selectAllEvent", "selectEvent"]); const $emit = defineEmits(["selectAllEvent", "selectEvent"]);
@ -243,11 +243,12 @@ const scrollHeight = () => {
this.$refs.Table?.scrollTo(0, 0); this.$refs.Table?.scrollTo(0, 0);
}, 500); }, 500);
}; };
defineExpose({ clearCheckboxRow, scrollHeight });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.table-box { .table-box {
height: calc(100vh - 265px); height: calc(100vh - 290px);
} }
ul, ul,

View File

@ -11,6 +11,7 @@
</el-tabs> </el-tabs>
<SearchForm :inputs="Inputs" @onSearch="onSearch" @onRest="onRest" /> <SearchForm :inputs="Inputs" @onSearch="onSearch" @onRest="onRest" />
</div> </div>
<buttonGroup :buttonList="buttonList"></buttonGroup>
<div class="table_box_center"> <div class="table_box_center">
<Table <Table
@ -19,6 +20,8 @@
:TabLoading="TabLoading" :TabLoading="TabLoading"
:TableData="TableData" :TableData="TableData"
:TableLabel="TableLabel" :TableLabel="TableLabel"
@selectEvent="selectEvent"
@selectAllEvent="selectAllEvent"
> >
<template #OperateButton="{ row }"> <template #OperateButton="{ row }">
<OperateButton <OperateButton
@ -50,6 +53,7 @@ import { router } from "@/router.js";
import { Plus } from "@element-plus/icons-vue"; import { Plus } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import SearchForm from "@components/searchForm/index.vue"; import SearchForm from "@components/searchForm/index.vue";
import buttonGroup from "@/components/buttongroup.vue";
import Table from "@components/table.vue"; import Table from "@components/table.vue";
import OperateButton from "@/components/OperateButton.vue"; import OperateButton from "@/components/OperateButton.vue";
import PaginaTion from "@components/Pagination.vue"; import PaginaTion from "@components/Pagination.vue";
@ -61,7 +65,8 @@ import {
refuse_refund, refuse_refund,
confirm_receipt, confirm_receipt,
refuse_receipt, refuse_receipt,
after_log after_log,
manual_after_order,
} from "@/api/AfterSalesManagement"; } from "@/api/AfterSalesManagement";
import { getshopInfo } from "@/api/newlybuiltgoods"; import { getshopInfo } from "@/api/newlybuiltgoods";
const activeName = ref(""); const activeName = ref("");
@ -154,7 +159,7 @@ const Inputs = ref([
width: "215px", width: "215px",
}, },
]); ]);
const selectdateList = ref([]);
const TableRef = ref(null); const TableRef = ref(null);
const TableKey = ref(new Date().getTime()); const TableKey = ref(new Date().getTime());
const TabLoading = ref(false); const TabLoading = ref(false);
@ -344,6 +349,29 @@ const ButtonListGroup = ref([
}, },
}, },
]); ]);
const buttonList = ref([
{
name: "同步订单",
show: true,
Loading: false,
handler: (item) => {
console.log(item, "item");
if (!selectdateList.value.length)
return ElMessage.warning("至少选择一条数据!");
item.Loading = true;
const saleIds = [];
selectdateList.value.map((e) => saleIds.push(e.saleId));
manual_after_order({ idList: saleIds }).then((res) => {
item.Loading = false;
if (res.code === "200") {
TableRef.value.clearCheckboxRow();
getDatas();
}
});
},
},
]);
let commodityInfoDto = reactive({ let commodityInfoDto = reactive({
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 20,
@ -435,6 +463,12 @@ const TabChange = (val) => {
New_TableLabel.value = TableLabel.value; New_TableLabel.value = TableLabel.value;
TableKey.value = new Date().getTime(); TableKey.value = new Date().getTime();
}; };
const selectEvent = (data) => {
selectdateList.value = data;
};
const selectAllEvent = (data) => {
selectdateList.value = data;
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -449,7 +483,7 @@ const TabChange = (val) => {
background: #fff; background: #fff;
} }
.table_box_center { .table_box_center {
padding: 20px; padding: 0 20px;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>

View File

@ -575,6 +575,10 @@ const createGoods = reactive({
label: "普通商品", label: "普通商品",
value: 2, value: 2,
}, },
// {
// label: "",
// value: 16,
// },
], ],
}, },
radio_group_sell: { radio_group_sell: {

View File

@ -11,7 +11,7 @@
</el-tabs> </el-tabs>
<SearchForm :inputs="Inputs" @onSearch="onSearch" @onRest="onRest" /> <SearchForm :inputs="Inputs" @onSearch="onSearch" @onRest="onRest" />
</div> </div>
<buttonGroup :buttonList="buttonList"></buttonGroup>
<div class="table_box_center"> <div class="table_box_center">
<Table <Table
ref="TableRef" ref="TableRef"
@ -19,6 +19,8 @@
:TabLoading="TabLoading" :TabLoading="TabLoading"
:TableData="TableData" :TableData="TableData"
:TableLabel="TableLabel" :TableLabel="TableLabel"
@selectEvent="selectEvent"
@selectAllEvent="selectAllEvent"
> >
<template #OperateButton="{ row }"> <template #OperateButton="{ row }">
<OperateButton <OperateButton
@ -76,6 +78,7 @@ import { router } from "@/router.js";
import { Plus } from "@element-plus/icons-vue"; import { Plus } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import SearchForm from "@components/searchForm/index.vue"; import SearchForm from "@components/searchForm/index.vue";
import buttonGroup from "@/components/buttongroup.vue";
import Table from "@components/table.vue"; import Table from "@components/table.vue";
import OperateButton from "@/components/OperateButton.vue"; import OperateButton from "@/components/OperateButton.vue";
import PaginaTion from "@components/Pagination.vue"; import PaginaTion from "@components/Pagination.vue";
@ -89,8 +92,10 @@ import {
express_printing, express_printing,
cancel_order, cancel_order,
order_log, order_log,
manual_sync_order,
} from "@/api/OrderManagement"; } from "@/api/OrderManagement";
import { getshopInfo } from "@/api/newlybuiltgoods"; import { getshopInfo } from "@/api/newlybuiltgoods";
import { Loading } from "vant";
const activeName = ref(""); const activeName = ref("");
let printimg = ref(null); let printimg = ref(null);
const printshow = ref(false); const printshow = ref(false);
@ -194,7 +199,7 @@ const Inputs = ref([
width: "215px", width: "215px",
}, },
]); ]);
const selectdateList = ref([]);
const TableRef = ref(null); const TableRef = ref(null);
const TableKey = ref(new Date().getTime()); const TableKey = ref(new Date().getTime());
const TabLoading = ref(false); const TabLoading = ref(false);
@ -390,6 +395,28 @@ const ButtonListGroup = ref([
}, },
}, },
]); ]);
const buttonList = ref([
{
name: "同步订单",
show: true,
Loading: false,
handler: (item) => {
console.log(item, "item");
if (!selectdateList.value.length)
return ElMessage.warning("至少选择一条数据!");
item.Loading = true;
const orderIds = [];
selectdateList.value.map((e) => orderIds.push(e.orderId));
manual_sync_order({ idList: orderIds }).then((res) => {
item.Loading = false;
if (res.code === "200") {
TableRef.value.clearCheckboxRow();
getDatas();
}
});
},
},
]);
let orderInfoDto = reactive({ let orderInfoDto = reactive({
pageNo: 1, pageNo: 1,
@ -557,6 +584,12 @@ const TabChange = (val) => {
New_TableLabel.value = TableLabel.value; New_TableLabel.value = TableLabel.value;
TableKey.value = new Date().getTime(); TableKey.value = new Date().getTime();
}; };
const selectEvent = (data) => {
selectdateList.value = data;
};
const selectAllEvent = (data) => {
selectdateList.value = data;
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -571,7 +604,7 @@ const TabChange = (val) => {
background: #fff; background: #fff;
} }
.table_box_center { .table_box_center {
padding: 20px; padding: 0 20px 20px;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>

View File

@ -3,7 +3,7 @@
<el-dialog <el-dialog
:title="props.AddTitle" :title="props.AddTitle"
v-model="props.AddDialogVisible" v-model="props.AddDialogVisible"
width="30%" width="20%"
:close-on-click-modal="false" :close-on-click-modal="false"
:before-close="AddClose" :before-close="AddClose"
> >
@ -35,6 +35,7 @@
:autocomplete="item.autocomplete" :autocomplete="item.autocomplete"
:clearable="item.clearable" :clearable="item.clearable"
:placeholder="item.placeholder" :placeholder="item.placeholder"
@change="item.inputChange($event,item)"
><el-option ><el-option
v-for="item in item.options" v-for="item in item.options"
:key="item.value" :key="item.value"

View File

@ -51,24 +51,24 @@
</vxe-colgroup> </vxe-colgroup>
<vxe-column field="ship_by_default" title="是否打单发货默认物流"> <vxe-column field="ship_by_default" title="是否打单发货默认物流">
<template #default="{ row }"> <template #default="{ row }">
<span>{{ row.default_flag ? "是" : "否" }}</span> <span>{{ row.defaultFlag ? "是" : "否" }}</span>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="remark" title="备注"></vxe-column> <vxe-column field="remark" title="备注"></vxe-column>
<vxe-column title="操作"> <vxe-column title="操作">
<!-- <template #default="{ row }"> <template #default="{ row }">
<el-button type="text" @click="edit(row)" style="margin-right: 10px" <el-button
type="text"
@click="edit(row)"
style="margin-right: 10px"
>编辑</el-button >编辑</el-button
> >
<el-popconfirm title="您确定删除吗?" @confirm="delConfirm(row)">
<el-button <template #reference>
slot="reference" <el-button type="text" style="color: #f56c6c">删除</el-button>
type="text" </template>
style="color: #f56c6c" </el-popconfirm>
@click="delConfirm(row)" </template>
>删除</el-button
>
</template> -->
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
</div> </div>
@ -167,12 +167,6 @@
clearable clearable
></el-input> ></el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item label="是否设为默认">
<el-radio-group v-model="jjrformLableAlign.default">
<el-radio :label='1'></el-radio>
<el-radio :label='0'></el-radio>
</el-radio-group>
</el-form-item> -->
</el-form> </el-form>
</div> </div>
<template #footer> <template #footer>
@ -201,6 +195,11 @@ import {
senderList, senderList,
senderAdd, senderAdd,
senderDelete, senderDelete,
getExpressCompanyList,
getLogisticsProductList,
update,
addressDelete,
senderUpdate,
} from "@/api/translateSet"; } from "@/api/translateSet";
import { region } from "@/api/newlybuiltgoods"; import { region } from "@/api/newlybuiltgoods";
const route = useRoute(); const route = useRoute();
@ -224,29 +223,27 @@ const jjrformLableAlign = ref({
const title1 = ref(""); const title1 = ref("");
const area = ref([]); const area = ref([]);
const areaRef = ref(null); const areaRef = ref(null);
const AddTitle = ref("添加快递公司"); const AddTitle = ref("");
const editText = ref("确定"); const editText = ref("确定");
const ruleForm = ref({ const ruleForm = ref({
logisticsId: "",
monthFlag: "0",
senderId: "",
monthCode: "",
logisticsName: "",
logisticsCode: "",
expressCompany: "", expressCompany: "",
id: "", jdAccessToken: "",
businesses_code: "", productCode: "",
user_id: "", defaultFlag: "0",
logistics_id: "",
month_flag: "",
sender_id: "",
month_code: "",
default_flag: "",
remark: "", remark: "",
logistics_name: "",
jd_access_token: "",
logistics_code: "",
}); });
const ruleFormList = ref([ const ruleFormList = ref([
{ {
type: "input", type: "input",
label: "物流名称", label: "物流名称",
params: "logistics_name", params: "logisticsName",
prop: "logistics_name", prop: "logisticsName",
clearable: true, clearable: true,
show: true, show: true,
placeholder: "请输入物流名称", placeholder: "请输入物流名称",
@ -255,19 +252,36 @@ const ruleFormList = ref([
{ {
type: "select", type: "select",
label: "快递公司", label: "快递公司",
params: "expressCompany", params: "logisticsCode",
prop: "expressCompany", prop: "logisticsCode",
clearable: true, clearable: true,
show: true, show: true,
placeholder: "请选择快递公司", placeholder: "请选择快递公司",
inputChange: () => {}, inputChange: (e, item) => {
ruleForm.value.expressCompany = item.options.find(
(el) => el.value === e
).label;
get_LogisticsProductList(e);
const targets = ["access_token", "快递产品"];
const show = (e === "jd" || e === "sf") && ruleForm.value.monthFlag;
targets.forEach((label) => {
const item = ruleFormList.value.find((e) => e.label === label);
if (item) {
if (e === "sf") {
item.label == "快递产品" ? (item.show = show) : (item.show = false);
} else {
item.show = show;
}
}
});
},
options: [], options: [],
}, },
{ {
type: "input", type: "input",
label: "物流编码", label: "物流编码",
params: "logistics_code", params: "logisticsCode",
prop: "logistics_code", prop: "logisticsCode",
clearable: true, clearable: true,
disabled: true, disabled: true,
show: true, show: true,
@ -276,12 +290,27 @@ const ruleFormList = ref([
{ {
type: "radio", type: "radio",
label: "是否使用月结", label: "是否使用月结",
params: "month_flag", params: "monthFlag",
prop: "month_flag", prop: "monthFlag",
show: true, show: true,
clearable: true, clearable: true,
radioChange: (e) => { radioChange: (e) => {
ruleFormList.value.find((e) => e.label === "月结号").show = e; ruleFormList.value.find((e) => e.label === "月结号").show = e;
const targets = ["access_token", "快递产品"];
const show =
e == 1 &&
(ruleForm.value.logisticsCode === "jd" ||
ruleForm.value.logisticsCode === "sf");
targets.forEach((label) => {
const item = ruleFormList.value.find((e) => e.label === label);
if (item) {
if (ruleForm.value.logisticsCode === "sf") {
item.label == "快递产品" ? (item.show = show) : (item.show = false);
} else {
item.show = show;
}
}
});
}, },
options: [ options: [
{ {
@ -297,8 +326,8 @@ const ruleFormList = ref([
{ {
type: "select", type: "select",
label: "快递产品", label: "快递产品",
params: "", params: "productCode",
prop: "", prop: "productCode",
clearable: true, clearable: true,
show: false, show: false,
placeholder: "请选择快递产品", placeholder: "请选择快递产品",
@ -308,8 +337,8 @@ const ruleFormList = ref([
{ {
type: "input", type: "input",
label: "月结号", label: "月结号",
params: "", params: "monthCode",
prop: "", prop: "monthCode",
clearable: true, clearable: true,
show: false, show: false,
placeholder: "请输入月结号", placeholder: "请输入月结号",
@ -317,35 +346,27 @@ const ruleFormList = ref([
{ {
type: "input", type: "input",
label: "access_token", label: "access_token",
params: "", params: "jdAccessToken",
prop: "", prop: "jdAccessToken",
clearable: true, clearable: true,
show: false, show: false,
placeholder: "请输入access_token", placeholder: "请输入access_token",
}, },
{
type: "input",
label: "refresh_token",
params: "",
prop: "",
clearable: true,
show: false,
placeholder: "请输入refresh_token",
},
{ {
type: "select", type: "select",
label: "默认寄件人", label: "默认寄件人",
params: "sender_id", params: "senderId",
prop: "sender_id", prop: "senderId",
show: true, show: true,
clearable: true, clearable: true,
inputChange: () => {},
options: [], options: [],
}, },
{ {
type: "radio", type: "radio",
label: "是否默认物流", label: "是否默认物流",
params: "", params: "defaultFlag",
prop: "", prop: "defaultFlag",
show: true, show: true,
clearable: true, clearable: true,
options: [ options: [
@ -378,12 +399,34 @@ let xyUserAddressDto = reactive({
const buttonList = ref([ const buttonList = ref([
{ {
name: "新增物流", name: "新增物流",
show: true,
handler: (item) => { handler: (item) => {
ruleForm.value = {
logisticsId: "",
monthFlag: "0",
senderId: "",
monthCode: "",
logisticsName: "",
logisticsCode: "",
expressCompany: "",
jdAccessToken: "",
productCode: "",
defaultFlag: "0",
remark: "",
};
const targets = ["access_token", "快递产品", "月结号"];
targets.forEach((label) => {
const item = ruleFormList.value.find((e) => e.label === label);
item.show = false;
});
AddTitle.value = "添加快递公司";
editText.value = "确定";
AddDialogVisible.value = true; AddDialogVisible.value = true;
}, },
}, },
{ {
name: "寄件人管理", name: "寄件人管理",
show: true,
handler: (item) => { handler: (item) => {
jjrdialogVisible.value = true; jjrdialogVisible.value = true;
}, },
@ -427,8 +470,57 @@ const tableColumn = ref([
]); ]);
const submitForm = () => { const submitForm = () => {
if (editText.value == "确定") {
add(ruleForm.value).then((res) => { add(ruleForm.value).then((res) => {
if (res.code === "200") { if (res.code === "200") {
ElMessage.success(res.msg);
get_userAddress();
AddClose();
}
});
} else {
update(ruleForm.value).then((res) => {
if (res.code === "200") {
ElMessage.success(res.msg);
get_userAddress();
AddClose();
}
});
}
};
const edit = (row) => {
get_LogisticsProductList(row.logisticsCode);
ruleFormList.value.find((e) => e.label === "月结号").show = row.monthFlag;
const targets = ["access_token", "快递产品"];
const show =
row.monthFlag == 1 &&
(row.logisticsCode === "jd" || row.logisticsCode === "sf");
targets.forEach((label) => {
const item = ruleFormList.value.find((e) => e.label === label);
if (item) {
if (ruleForm.value.logisticsCode === "sf") {
item.label == "快递产品" ? (item.show = show) : (item.show = false);
} else {
item.show = show;
}
}
});
ruleForm.value = {
...row,
monthFlag: row.monthFlag ? String(row.monthFlag) : "0",
defaultFlag: row.defaultFlag ? String(row.defaultFlag) : "0",
};
AddDialogVisible.value = true;
AddTitle.value = "编辑快递公司";
editText.value = "编辑";
AddDialogVisible.value = true;
};
//
const delConfirm = (row) => {
addressDelete(row.id).then((res) => {
if (res.code === "200") {
ElMessage.success(res.msg);
get_userAddress();
} }
}); });
}; };
@ -471,19 +563,22 @@ const changejjr = () => {
xzjjrdialogVisible.value = true; xzjjrdialogVisible.value = true;
jjbtnshow.value = false; jjbtnshow.value = false;
title1.value = "修改寄件人"; title1.value = "修改寄件人";
console.log(params, "fasdflsdjfkds"); jjrformLableAlign.value = {
...params,
jjrformLableAlign.value.name = params.name; area: [params.province_id, params.city_id, params.district_id],
jjrformLableAlign.value.detailed = params.detailed; };
jjrformLableAlign.value.phone = params.phone; console.log(jjrformLableAlign.value, "fasdflsdjfkds");
jjrformLableAlign.value.postal_code = params.postal_code;
jjrformLableAlign.value.area = [
params.province_id,
params.city_id,
params.district_id,
];
} }
}; };
const changeset = () => {
senderUpdate(jjrformLableAlign.value).then((res) => {
if (res.code === "200") {
ElMessage.success(res.msg);
xzjjrdialogVisible.value = false;
get_senderList();
}
});
};
// //
const get_region = () => { const get_region = () => {
region().then((res) => { region().then((res) => {
@ -505,32 +600,49 @@ const get_region = () => {
}); });
}; };
const areaChange = (value) => { const areaChange = (value) => {
// const selectedData = areaRef.value.cascaderPanelRef.options; const selectedData = areaRef.value.cascaderPanelRef.options;
// if (selectedData.length > 0) { const areaList = findLabelsByPath(selectedData, value);
// const province = selectedData[0]; jjrformLableAlign.value = {
// const city = selectedData.length > 1 ? selectedData[0].children[0] : null; ...jjrformLableAlign.value,
// const district = selectedData.length > 2 ?selectedData[0].children[0]: null; province: areaList[0],
// console.log( city: areaList[1],
// `Province: ${province.label}, City: ${ district: areaList[2],
// city ? city.label : "None" province_id: value[0],
// }, District: ${district ? district.label : "None"}` city_id: value[1],
// ); district_id: value[2],
// } };
};
const findLabelsByPath = (options, path) => {
if (path.length === 0) {
return [];
}
const currentOption = options.find((option) => option.value === path[0]);
if (!currentOption) {
return [];
}
const currentLabel = [currentOption.label]; // label
const remainingPathLabels =
path.length > 1
? findLabelsByPath(currentOption.children, path.slice(1))
: [];
return [...currentLabel, ...remainingPathLabels];
}; };
const surejjrset = () => { const surejjrset = () => {
const area = jjrformLableAlign.value.area; const area = jjrformLableAlign.value.area;
let params = { let params = {
...jjrformLableAlign.value, ...jjrformLableAlign.value,
province_id: area[0], province_id: area[0],
province: "",
city_id: area[1], city_id: area[1],
city: "",
district_id: area[2], district_id: area[2],
district: "",
}; };
senderAdd(params).then((res) => {
return; if (res.code === "200") {
senderAdd(params).then((res) => {}); ElMessage.success(res.msg);
xzjjrdialogVisible.value = false;
get_senderList();
}
});
}; };
const delthechoose = () => { const delthechoose = () => {
if (!xTable2.value.getRadioRecord()) { if (!xTable2.value.getRadioRecord()) {
@ -547,10 +659,27 @@ const delthechoose = () => {
}); });
} }
}; };
const get_ExpressCompanyList = () => {
getExpressCompanyList().then((res) => {
if (res.code === "200") {
ruleFormList.value.find((e) => e.label === "快递公司").options =
res.data.map((e) => ({ label: e.name, value: e.code }));
}
});
};
const get_LogisticsProductList = (e) => {
getLogisticsProductList(e).then((res) => {
if (res.code === "200") {
ruleFormList.value.find((e) => e.label === "快递产品").options =
res.data.map((e) => ({ label: e.productName, value: e.productCode }));
}
});
};
onMounted(() => { onMounted(() => {
get_userAddress(); get_userAddress();
get_senderList(); get_senderList();
get_region(); get_region();
get_ExpressCompanyList();
}); });
</script> </script>