|
@@ -71,6 +71,7 @@
|
|
|
<div style="width: 100%; padding: 0 20px">
|
|
|
<div style="margin-bottom: 10px" v-if="!(route.query && route.query.detailId)">
|
|
|
<el-button type="primary" size="small" @click="clickAddProduct()">选择产品</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="clickUploadProduct()">导入产品</el-button>
|
|
|
</div>
|
|
|
<el-collapse v-model="activeNames">
|
|
|
<div v-for="(item, index) in formData.data.orderSkuList" :key="index" style="margin-bottom: 20px">
|
|
@@ -551,6 +552,16 @@
|
|
|
<el-button @click="openViewPackaging = false">关 闭</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="导入产品" v-if="openUpload" v-model="openUpload" width="60%">
|
|
|
+ <el-upload class="upload-demo" :show-file-list="false" drag action="##" :http-request="giveawayServerLog" v-loading="loadingUpload">
|
|
|
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
+ <div class="el-upload__text">拖拽文件进行上传</div>
|
|
|
+ </el-upload>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openUpload = false">关 闭</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -963,6 +974,72 @@ const openProduct = ref(false);
|
|
|
const clickAddProduct = () => {
|
|
|
openProduct.value = true;
|
|
|
};
|
|
|
+const openUpload = ref(false);
|
|
|
+const loadingUpload = ref(false);
|
|
|
+const clickUploadProduct = () => {
|
|
|
+ loadingUpload.value = false;
|
|
|
+ openUpload.value = true;
|
|
|
+};
|
|
|
+const giveawayServerLog = (params) => {
|
|
|
+ let file = params.file;
|
|
|
+ let formFile = new FormData();
|
|
|
+ formFile.append("file", file);
|
|
|
+ loadingUpload.value = true;
|
|
|
+ proxy.postUploadFile("/skuSpec/getSkuSpecListFromImport", formFile).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({ message: "导入成功", type: "success" });
|
|
|
+ openUpload.value = false;
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
+ let list = formData.data.orderSkuList.filter((item) => item.skuSpecId === res.data[i].id && item.bomSpecId === res.data[i].bomSpecId);
|
|
|
+ if (!(list && list.length > 0)) {
|
|
|
+ let orderSkuBomList = [];
|
|
|
+ if (res.data[i].packagingMaterialList && res.data[i].packagingMaterialList.length > 0) {
|
|
|
+ orderSkuBomList = res.data[i].packagingMaterialList.map((item) => {
|
|
|
+ return {
|
|
|
+ bomSpecId: item.bomSpecId,
|
|
|
+ unitPrice: item.internalSellingPrice,
|
|
|
+ quantity: item.quantity,
|
|
|
+ bomSpecName: item.name,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ formData.data.orderSkuList.push({
|
|
|
+ wlnSkuName: res.data[i].wlnSkuName,
|
|
|
+ skuId: res.data[i].skuId,
|
|
|
+ code: res.data[i].code,
|
|
|
+ name: res.data[i].name,
|
|
|
+ skuSpecId: res.data[i].id,
|
|
|
+ bomSpecId: res.data[i].bomSpecId,
|
|
|
+ quantity: undefined,
|
|
|
+ erpCode: "",
|
|
|
+ featureCode: "",
|
|
|
+ customProcessingFee: "",
|
|
|
+ customProcessingType: "",
|
|
|
+ lssueFee: "",
|
|
|
+ deliveryMaterialsFee: "",
|
|
|
+ packingLabor: "",
|
|
|
+ managementFee: "",
|
|
|
+ unitPrice: "",
|
|
|
+ printType: 1,
|
|
|
+ packageRemark: "",
|
|
|
+ orderSkuBomList: orderSkuBomList,
|
|
|
+ blueprint: res.data[i].designImgUrl,
|
|
|
+ productionDocument: res.data[i].sharedFolder,
|
|
|
+ artworkLibraryId: "0",
|
|
|
+ inventoryQuantity: res.data[i].inventoryQuantity,
|
|
|
+ proofingFee: 0,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err);
|
|
|
+ loadingUpload.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+};
|
|
|
const printType = ref([
|
|
|
{
|
|
|
dictKey: 1,
|
|
@@ -984,6 +1061,7 @@ const typeList = ref([
|
|
|
},
|
|
|
]);
|
|
|
const selectProduct = (row, SKU) => {
|
|
|
+ console.log(row, SKU, "222");
|
|
|
if (row.id) {
|
|
|
let list = formData.data.orderSkuList.filter((item) => item.skuSpecId === row.id && item.bomSpecId === row.bomSpecId);
|
|
|
if (list && list.length > 0) {
|