123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597 |
- <template>
- <el-card class="box-card">
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- :searchConfig="searchConfig"
- highlight-current-row
- @get-list="getList"
- @clickReset="clickReset">
- <template #code="{ item }">
- <div>
- <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
- </div>
- </template>
- <template #address="{ item }">
- <div>{{ item.province }}, {{ item.city }}, {{ item.county }}, {{ item.detailedAddress }}</div>
- </template>
- </byTable>
- <el-dialog title="售后类型" v-if="openAfterSale" v-model="openAfterSale" width="300px" style="margin-top: 20vh !important">
- <template #footer>
- <el-button type="primary" @click="applyForAfterSale(1)" size="large" v-preReClick>退 货</el-button>
- <el-button @click="applyForAfterSale(2)" size="large" v-preReClick>换 货</el-button>
- </template>
- </el-dialog>
- <el-dialog title="送货单" v-if="openDeliveryNote" v-model="openDeliveryNote" width="1000px">
- <DeliveryNote :rowData="rowData" @clickCancel="clickCancel"></DeliveryNote>
- </el-dialog>
- <el-dialog title="产品包装配置" v-if="openShippingPackage" v-model="openShippingPackage" width="80%" :close-on-press-escape="false" :show-close="false">
- <div style="height: calc(100vh - 184px); overflow-y: auto; overflow-x: hidden" v-loading="loadingPackage">
- <el-form :model="formData.data" :rules="rulesShippingPackage" ref="shippingPackage">
- <div style="font-weight: 700; margin: 20px 0 10px 0">发货包装</div>
- <div style="margin-bottom: 10px">
- <el-button type="primary" size="small" @click="clickExpressPacking()">选择包材</el-button>
- </div>
- <el-table :data="formData.data.orderPackageBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
- <el-table-column label="品号" prop="code" width="160" />
- <el-table-column label="品名" prop="name" min-width="220" />
- <el-table-column label="销售单价" prop="internalSellingPrice" width="100" />
- <el-table-column label="数量" width="120">
- <template #default="{ row, $index }">
- <div class="shippingPackage">
- <el-form-item
- :prop="'orderPackageBomList.' + $index + '.quantity'"
- :rules="rulesShippingPackage.quantity"
- :inline-message="true"
- style="width: 100%">
- <el-input-number
- onmousewheel="return false;"
- v-model="row.quantity"
- placeholder="修正数量"
- style="width: 100%"
- :controls="false"
- :min="0"
- :precision="0" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="销售小计" width="120">
- <template #default="{ row }">
- {{ moneyFormat(computePackagingMoney(row, "internalSellingPrice"), 2) }}
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" fixed="right" width="80">
- <template #default="{ $index }">
- <el-button type="danger" @click="clickPackagingDelete($index)" text>删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="font-weight: 700; margin: 20px 0 10px 0">外箱不干胶图稿</div>
- <div style="display: flex; width: 100%">
- <div style="width: 80px; line-height: 32px">不干胶图片:</div>
- <div style="width: calc(100% - 80px)">
- <el-image
- fit="scale-down"
- style="width: 148px; height: 148px; margin-right: 10px; cursor: pointer"
- v-if="formData.data.outerBoxSelfAdhesiveStickerFile && formData.data.outerBoxSelfAdhesiveStickerFile.fileUrl"
- :src="formData.data.outerBoxSelfAdhesiveStickerFile.fileUrl"
- @click="openFile(formData.data.outerBoxSelfAdhesiveStickerFile.fileUrl)" />
- <div style="display: flex">
- <el-upload
- :show-file-list="false"
- action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
- :data="uploadAdhesiveData"
- :before-upload="uploadAdhesiveFile"
- :on-success="
- (response, uploadFile) => {
- return handleAdhesivePackagingSuccess(uploadFile);
- }
- "
- style="width: 100%">
- <el-button type="primary" text>上传文件</el-button>
- </el-upload>
- </div>
- </div>
- </div>
- </el-form>
- </div>
- <template #footer>
- <el-button @click="openShippingPackage = false" v-preReClick>取 消</el-button>
- <el-button type="primary" @click="clickSaveShippingPackage" v-preReClick>提 交</el-button>
- </template>
- </el-dialog>
- <el-dialog title="选择快递包装" v-if="openExpressPacking" v-model="openExpressPacking" width="90%">
- <SelectBOM :selectStatus="true" :bomClassifyIdList="[2, 3]" @selectBOM="selectExpressPacking"></SelectBOM>
- <template #footer>
- <el-button @click="openExpressPacking = false">关 闭</el-button>
- </template>
- </el-dialog>
- </el-card>
- </template>
- <script setup>
- import byTable from "/src/components/byTable/index";
- import DeliveryNote from "/src/components/order/deliveryNote/index";
- import SelectBOM from "/src/views/group/BOM/management/index";
- import { ElMessage, ElMessageBox } from "element-plus";
- const { proxy } = getCurrentInstance();
- const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- departmentId: "",
- code: "",
- wlnCode: "",
- status: "",
- settlementStatus: "",
- exception: "0",
- },
- });
- const loading = ref(false);
- const searchConfig = computed(() => {
- return [
- {
- type: "input",
- prop: "code",
- label: "订单号",
- },
- {
- type: "input",
- prop: "wlnCode",
- label: "E10单号",
- },
- {
- type: "select",
- prop: "departmentId",
- data: departmentList.value,
- label: "事业部",
- },
- {
- type: "select",
- prop: "status",
- dictKey: "order_status",
- label: "订单状态",
- },
- ];
- });
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "事业部",
- prop: "departmentName",
- width: 120,
- },
- },
- {
- attrs: {
- label: "订单号",
- slot: "code",
- "min-width": 200,
- },
- },
- {
- attrs: {
- label: "E10单号",
- prop: "wlnCode",
- "min-width": 180,
- },
- },
- {
- attrs: {
- label: "快递单号",
- prop: "expressDeliveryCode",
- "min-width": 160,
- },
- },
- {
- attrs: {
- label: "订单状态",
- prop: "status",
- width: 120,
- },
- render(val) {
- return proxy.dictKeyValue(val, proxy.useUserStore().allDict["order_status"]);
- },
- },
- {
- attrs: {
- label: "交期",
- prop: "deliveryTime",
- width: 160,
- align: "center",
- },
- },
- {
- attrs: {
- label: "发货时间",
- prop: "shippingTime",
- width: 160,
- align: "center",
- },
- },
- {
- attrs: {
- label: "收货人",
- prop: "consignee",
- width: 140,
- },
- },
- {
- attrs: {
- label: "收货人电话",
- prop: "consigneeNumber",
- width: 140,
- },
- },
- {
- attrs: {
- label: "收货人地址",
- slot: "address",
- "min-width": 220,
- },
- },
- {
- attrs: {
- label: "操作",
- width: 220,
- align: "center",
- fixed: "right",
- },
- renderHTML(row) {
- return [
- judgeRoles()
- ? {
- attrs: {
- label: "修改包装配置",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickChangePackaging(row);
- },
- }
- : {},
- [40, 50].includes(row.status)
- ? {
- attrs: {
- label: "售后",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickAfterSale(row);
- },
- }
- : {},
- row.type === 1 && row.status == 40
- ? {
- attrs: {
- label: "送货单",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickDeliveryNote(row);
- },
- }
- : {},
- row.status == 20
- ? {
- attrs: {
- label: "挂起",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickHangUp(row);
- },
- }
- : {},
- row.status == 60
- ? {
- attrs: {
- label: "取消挂起",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickCancelHangUp(row);
- },
- }
- : {},
- ];
- },
- },
- ];
- });
- const getDemandData = () => {
- proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- if (res.rows && res.rows.length > 0) {
- departmentList.value = departmentList.value.concat(
- res.rows.map((item) => {
- return {
- dictKey: item.id,
- dictValue: item.name,
- };
- })
- );
- }
- });
- };
- getDemandData();
- const getList = async (req, status) => {
- if (status) {
- sourceList.value.pagination = {
- pageNum: sourceList.value.pagination.pageNum,
- pageSize: sourceList.value.pagination.pageSize,
- exception: "0",
- };
- } else {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- }
- loading.value = true;
- proxy.post("/orderInfo/page", sourceList.value.pagination).then((res) => {
- sourceList.value.data = res.rows;
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- getList();
- const clickReset = () => {
- getList("", true);
- };
- const clickCode = (row) => {
- proxy.$router.replace({
- path: "/addOrder",
- query: {
- detailId: row.id,
- text: "订单详情",
- random: proxy.random(),
- orderInquiry: true,
- },
- });
- };
- const openAfterSale = ref(false);
- const rowData = ref({});
- const clickAfterSale = (row) => {
- rowData.value = row;
- openAfterSale.value = true;
- };
- const applyForAfterSale = (type) => {
- openAfterSale.value = false;
- proxy.$router.replace({
- path: "/order/after-sale/initiate",
- query: {
- orderInfoId: rowData.value.id,
- type: type,
- random: proxy.random(),
- },
- });
- };
- const openDeliveryNote = ref(false);
- const clickDeliveryNote = (row) => {
- rowData.value = row;
- openDeliveryNote.value = true;
- };
- const clickCancel = (status) => {
- openDeliveryNote.value = false;
- if (status) {
- getList();
- }
- };
- const clickHangUp = (row) => {
- ElMessageBox.confirm("你是否确认此操作", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- proxy.post("/orderInfo/suspendOrder", { id: row.id }).then(() => {
- ElMessage({ message: "操作成功", type: "success" });
- getList();
- });
- })
- .catch(() => {});
- };
- const clickCancelHangUp = (row) => {
- ElMessageBox.confirm("你是否确认此操作", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- proxy.post("/orderInfo/cancelSuspendOrder", { id: row.id }).then(() => {
- ElMessage({ message: "操作成功", type: "success" });
- getList();
- });
- })
- .catch(() => {});
- };
- const formData = reactive({
- data: {
- orderPackageBomList: [],
- outerBoxSelfAdhesiveStickerFile: {},
- },
- });
- const rulesShippingPackage = ref({
- quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
- });
- const openShippingPackage = ref(false);
- const loadingPackage = ref(false);
- const clickChangePackaging = (row) => {
- loadingPackage.value = true;
- openShippingPackage.value = true;
- proxy.post("/orderInfo/detail", { id: row.id }).then(
- (res) => {
- formData.data = res;
- proxy.post("/fileInfo/getList", { businessIdList: [formData.data.id] }).then((fileObj) => {
- if (fileObj[formData.data.id] && fileObj[formData.data.id].length > 0) {
- let outerBoxSelfAdhesiveStickerFile = fileObj[formData.data.id].filter((item) => item.businessType == "1");
- if (outerBoxSelfAdhesiveStickerFile && outerBoxSelfAdhesiveStickerFile.length > 0) {
- formData.data.outerBoxSelfAdhesiveStickerFile = outerBoxSelfAdhesiveStickerFile[0];
- } else {
- formData.data.outerBoxSelfAdhesiveStickerFile = {};
- }
- }
- });
- loadingPackage.value = false;
- },
- (err) => {
- console.log(err);
- loadingPackage.value = false;
- }
- );
- };
- const computePackagingMoney = (item, label) => {
- let money = 0;
- if (item.quantity && item[label]) {
- money = Number(Math.round(item.quantity * item[label] * 100) / 100);
- }
- return money;
- };
- const clickPackagingDelete = (index) => {
- formData.data.orderPackageBomList.splice(index, 1);
- };
- const openFile = (path) => {
- window.open(path);
- };
- const uploadAdhesiveData = ref({});
- const uploadAdhesiveFile = async (file) => {
- const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
- uploadAdhesiveData.value = res.uploadBody;
- file.id = res.id;
- file.fileName = res.fileName;
- file.fileUrl = res.fileUrl;
- return true;
- };
- const handleAdhesivePackagingSuccess = (UploadFile) => {
- formData.data.outerBoxSelfAdhesiveStickerFile = {
- id: UploadFile.raw.id,
- fileName: UploadFile.raw.fileName,
- fileUrl: UploadFile.raw.fileUrl,
- };
- };
- const clickSaveShippingPackage = () => {
- proxy.$refs.shippingPackage.validate((valid) => {
- if (valid) {
- loadingPackage.value = true;
- if (formData.data.orderPackageBomList && formData.data.orderPackageBomList.length > 0) {
- proxy
- .post("/orderInfo/editOrderPackageBom", {
- id: formData.data.id,
- orderPackageBomList: formData.data.orderPackageBomList,
- outerBoxSelfAdhesiveStickerFile: formData.data.outerBoxSelfAdhesiveStickerFile,
- })
- .then(
- () => {
- ElMessage({ message: "提交成功", type: "success" });
- openShippingPackage.value = false;
- getList();
- },
- (err) => {
- console.log(err);
- loadingPackage.value = false;
- }
- );
- } else {
- ElMessageBox.confirm("是否确认无产品发货包装", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- proxy
- .post("/orderInfo/editOrderPackageBom", {
- id: formData.data.id,
- orderPackageBomList: formData.data.orderPackageBomList,
- outerBoxSelfAdhesiveStickerFile: formData.data.outerBoxSelfAdhesiveStickerFile,
- })
- .then(
- () => {
- ElMessage({ message: "提交成功", type: "success" });
- openShippingPackage.value = false;
- getList();
- },
- (err) => {
- console.log(err);
- loadingPackage.value = false;
- }
- );
- })
- .catch(() => {});
- }
- }
- });
- };
- const openExpressPacking = ref(false);
- const clickExpressPacking = () => {
- openExpressPacking.value = true;
- };
- const selectExpressPacking = (data) => {
- if (formData.data.orderPackageBomList && formData.data.orderPackageBomList.length > 0) {
- let list = formData.data.orderPackageBomList.filter((item) => item.bomSpecId === data.id);
- if (list && list.length > 0) {
- return ElMessage("快递物流包材已添加");
- }
- formData.data.orderPackageBomList.push({
- bomSpecId: data.id,
- code: data.code,
- name: data.name,
- internalSellingPrice: data.internalSellingPrice,
- quantity: undefined,
- });
- } else {
- formData.data.orderPackageBomList = [
- {
- bomSpecId: data.id,
- code: data.code,
- name: data.name,
- internalSellingPrice: data.internalSellingPrice,
- quantity: undefined,
- },
- ];
- }
- ElMessage({ message: "添加成功", type: "success" });
- };
- const judgeRoles = () => {
- let status = true;
- if (proxy.useUserStore().user.roles && proxy.useUserStore().user.roles.length > 0) {
- let list = proxy.useUserStore().user.roles.filter((item) => ["factoryAdmin", "factoryLaser", "factoryPacker", "factoryZxy"].includes(item.roleKey));
- if (list && list.length > 0) {
- status = false;
- }
- }
- return status;
- };
- </script>
- <style lang="scss" scoped>
- :deep(.el-dialog) {
- margin-top: 10px !important;
- margin-bottom: 10px !important;
- }
- .shippingPackage {
- .el-form-item {
- margin-bottom: 0;
- }
- }
- </style>
|