售后 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
})
}
// 同步订单
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
})
}
// 同步订单
// 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
})
}
// 修改寄件人
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>
<div class="button-group">
<span v-for="(item, index) in $attrs.buttonList" :key="index">
<el-button
v-bind="$attrs"
v-for="(item, index) in $attrs.buttonList"
:key="index"
v-if="item.show"
:loading="item.Loading"
@click="item.handler(item)"
>{{ item.name }}</el-button
>
</span>
<slot name="other"></slot>
</div>
</template>
@ -23,5 +25,4 @@
margin-left: 0px !important;
margin-right: 10px;
}
</style>

View File

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

View File

@ -147,7 +147,7 @@
</template>
<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";
const Table = ref(null);
const $emit = defineEmits(["selectAllEvent", "selectEvent"]);
@ -243,11 +243,12 @@ const scrollHeight = () => {
this.$refs.Table?.scrollTo(0, 0);
}, 500);
};
defineExpose({ clearCheckboxRow, scrollHeight });
</script>
<style lang="scss" scoped>
.table-box {
height: calc(100vh - 265px);
height: calc(100vh - 290px);
}
ul,

View File

@ -11,6 +11,7 @@
</el-tabs>
<SearchForm :inputs="Inputs" @onSearch="onSearch" @onRest="onRest" />
</div>
<buttonGroup :buttonList="buttonList"></buttonGroup>
<div class="table_box_center">
<Table
@ -19,6 +20,8 @@
:TabLoading="TabLoading"
:TableData="TableData"
:TableLabel="TableLabel"
@selectEvent="selectEvent"
@selectAllEvent="selectAllEvent"
>
<template #OperateButton="{ row }">
<OperateButton
@ -50,6 +53,7 @@ import { router } from "@/router.js";
import { Plus } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
import SearchForm from "@components/searchForm/index.vue";
import buttonGroup from "@/components/buttongroup.vue";
import Table from "@components/table.vue";
import OperateButton from "@/components/OperateButton.vue";
import PaginaTion from "@components/Pagination.vue";
@ -61,7 +65,8 @@ import {
refuse_refund,
confirm_receipt,
refuse_receipt,
after_log
after_log,
manual_after_order,
} from "@/api/AfterSalesManagement";
import { getshopInfo } from "@/api/newlybuiltgoods";
const activeName = ref("");
@ -154,7 +159,7 @@ const Inputs = ref([
width: "215px",
},
]);
const selectdateList = ref([]);
const TableRef = ref(null);
const TableKey = ref(new Date().getTime());
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({
pageNo: 1,
pageSize: 20,
@ -435,6 +463,12 @@ const TabChange = (val) => {
New_TableLabel.value = TableLabel.value;
TableKey.value = new Date().getTime();
};
const selectEvent = (data) => {
selectdateList.value = data;
};
const selectAllEvent = (data) => {
selectdateList.value = data;
};
</script>
<style lang="scss" scoped>
@ -449,7 +483,7 @@ const TabChange = (val) => {
background: #fff;
}
.table_box_center {
padding: 20px;
padding: 0 20px;
box-sizing: border-box;
}
</style>

View File

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

View File

@ -11,7 +11,7 @@
</el-tabs>
<SearchForm :inputs="Inputs" @onSearch="onSearch" @onRest="onRest" />
</div>
<buttonGroup :buttonList="buttonList"></buttonGroup>
<div class="table_box_center">
<Table
ref="TableRef"
@ -19,6 +19,8 @@
:TabLoading="TabLoading"
:TableData="TableData"
:TableLabel="TableLabel"
@selectEvent="selectEvent"
@selectAllEvent="selectAllEvent"
>
<template #OperateButton="{ row }">
<OperateButton
@ -76,6 +78,7 @@ import { router } from "@/router.js";
import { Plus } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
import SearchForm from "@components/searchForm/index.vue";
import buttonGroup from "@/components/buttongroup.vue";
import Table from "@components/table.vue";
import OperateButton from "@/components/OperateButton.vue";
import PaginaTion from "@components/Pagination.vue";
@ -89,8 +92,10 @@ import {
express_printing,
cancel_order,
order_log,
manual_sync_order,
} from "@/api/OrderManagement";
import { getshopInfo } from "@/api/newlybuiltgoods";
import { Loading } from "vant";
const activeName = ref("");
let printimg = ref(null);
const printshow = ref(false);
@ -194,7 +199,7 @@ const Inputs = ref([
width: "215px",
},
]);
const selectdateList = ref([]);
const TableRef = ref(null);
const TableKey = ref(new Date().getTime());
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({
pageNo: 1,
@ -557,6 +584,12 @@ const TabChange = (val) => {
New_TableLabel.value = TableLabel.value;
TableKey.value = new Date().getTime();
};
const selectEvent = (data) => {
selectdateList.value = data;
};
const selectAllEvent = (data) => {
selectdateList.value = data;
};
</script>
<style lang="scss" scoped>
@ -571,7 +604,7 @@ const TabChange = (val) => {
background: #fff;
}
.table_box_center {
padding: 20px;
padding: 0 20px 20px;
box-sizing: border-box;
}
</style>

View File

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

View File

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