|
@@ -29,12 +29,98 @@
|
|
|
<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" :expressStatus="true" @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: "胜德体育" }]);
|
|
@@ -159,7 +245,7 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "操作",
|
|
|
- width: 180,
|
|
|
+ width: 240,
|
|
|
align: "center",
|
|
|
fixed: "right",
|
|
|
},
|
|
@@ -217,6 +303,17 @@ const config = computed(() => {
|
|
|
},
|
|
|
}
|
|
|
: {},
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "修改包装配置",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ clickChangePackaging(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
];
|
|
|
},
|
|
|
},
|
|
@@ -327,6 +424,152 @@ const clickCancelHangUp = (row) => {
|
|
|
})
|
|
|
.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" });
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -334,4 +577,9 @@ const clickCancelHangUp = (row) => {
|
|
|
margin-top: 10px !important;
|
|
|
margin-bottom: 10px !important;
|
|
|
}
|
|
|
+.shippingPackage {
|
|
|
+ .el-form-item {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|