| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036 |
- <template>
- <div>
- <basic-container>
- <el-row>
- <el-col :span="4">
- <avue-tree
- ref="treeRef"
- :option="treeOption"
- :data="treeData"
- @node-click="nodeClick"
- style="height: 73vh"
- @save="corpTypeVisible = true"
- >
- </avue-tree>
- </el-col>
- <el-col :span="20">
- <avue-crud
- :option="option"
- :search.sync="search"
- v-model="form"
- :table-loading="loading"
- :data="dataList"
- ref="crud"
- :key="key"
- @on-load="onLoad"
- @selection-change="selectionChange"
- :before-open="beforeOpen"
- @row-update="rowUpdate"
- @search-change="searchChange"
- @search-reset="resetChange"
- @refresh-change="refreshChange"
- @row-del="rowDel"
- :page.sync="page"
- >
- <template slot="filesListForm">
- <span style="font-size: 12px">(图片文件像素推荐700X700,有且只允许有一张主图,其余均为副图)</span>
- <c-upload
- :data="form.filesList"
- display
- basic
- deleteUrl="/api/gubersail-admin/productLaunchFiles/remove"
- :enumerationValue="160"
- />
- </template>
- <template slot="detailsTextForm">
- <avue-ueditor v-model="form.detailsText" :options="optionsUeditor"> </avue-ueditor>
- </template>
- <template slot-scope="{ row, index }" slot="priceOne">
- <el-input-number
- v-if="row.upAndDownShelves == 0"
- v-model="row.priceOne"
- label="请输入售价"
- :controls="false"
- :precision="2"
- size="small"
- style="width: 100%"
- ></el-input-number>
- <span v-if="row.upAndDownShelves == 1">{{ row.priceOne }}</span>
- </template>
- <template slot-scope="{ row, index }" slot="priceTwo">
- <el-input-number
- v-if="row.upAndDownShelves == 0"
- v-model="row.priceTwo"
- label="请输入售价"
- :controls="false"
- :precision="2"
- size="small"
- style="width: 100%"
- ></el-input-number>
- <span v-if="row.upAndDownShelves == 1">{{ row.priceTwo }}</span>
- </template>
- <template slot-scope="{ row, index }" slot="priceThree">
- <el-input-number
- v-if="row.upAndDownShelves == 0"
- v-model="row.priceThree"
- label="请输入售价"
- :controls="false"
- :precision="2"
- size="small"
- style="width: 100%"
- ></el-input-number>
- <span v-if="row.upAndDownShelves == 1">{{ row.priceThree }}</span>
- </template>
- <template slot-scope="{ row, index }" slot="priceFour">
- <el-input-number
- v-if="row.upAndDownShelves == 0"
- v-model="row.priceFour"
- label="请输入售价"
- :controls="false"
- :precision="2"
- size="small"
- style="width: 100%"
- ></el-input-number>
- <span v-if="row.upAndDownShelves == 1">{{ row.priceFour }}</span>
- </template>
- <template slot-scope="{ type, size, row, index }" slot="menu">
- <el-button
- :size="size"
- :type="type"
- :disabled="row.upAndDownShelves"
- @click="$refs.crud.rowEdit(row, index)"
- >编辑
- </el-button>
- <el-button
- :size="size"
- :type="type"
- :disabled="row.upAndDownShelves"
- @click="$refs.crud.rowDel(row, index)"
- >删除
- </el-button>
- <el-button :size="size" :type="type" :disabled="row.upAndDownShelves" @click="annexOpen(row, index)"
- >商城图片
- </el-button>
- <el-tooltip :content="`${row.upAndDownShelves == 0 ? '上架' : '下架'}`" placement="top">
- <el-switch
- style="margin-left: 10px"
- v-model="row.upAndDownShelves"
- @change="check(row)"
- :active-value="1"
- :inactive-value="0"
- >
- </el-switch>
- </el-tooltip>
- </template>
- <template slot-scope="{ type, size, row, $index }" slot="menuLeft">
- <el-button type="primary" size="mini" icon="el-icon-top" @click="outExport">导出</el-button>
- <el-button class="el-icon-bottom" type="warning" size="small" @click="excelBoxfun('名称')">
- 导入
- </el-button>
- <!-- <el-button class="el-icon-bottom" type="warning" size="small" @click="excelBoxfun('code')">
- 按编码导入
- </el-button> -->
- <el-button
- class="el-icon-document-copy"
- :disabled="selectionList.length === 0"
- type="primary"
- size="small"
- @click="change(row, 'up')"
- >批量上架
- </el-button>
- <el-button
- class="el-icon-document-copy"
- :disabled="selectionList.length === 0"
- type="danger"
- size="small"
- @click="change(row, 'down')"
- >批量下架
- </el-button>
- </template>
- </avue-crud>
- </el-col>
- </el-row>
- </basic-container>
- <el-dialog
- title="添加产品"
- v-if="excelBox"
- append-to-body
- :visible.sync="excelBox"
- :close-on-click-modal="false"
- width="555px"
- >
- <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
- <template slot="excelTemplate">
- <el-button type="primary" @click="derivation">
- 点击下载<i class="el-icon-download el-icon--right"></i>
- </el-button>
- </template>
- </avue-form>
- <p style="text-align: center; color: #dc0505">温馨提示 第一次导入时请先下载模板</p>
- </el-dialog>
- <!--<el-dialog-->
- <!-- title="商城图片 (图片文件像素推荐700X700,有且只允许有一张主图,其余均为副图)"-->
- <!-- :visible.sync="enclosure"-->
- <!-- append-to-body-->
- <!-- width="70%">-->
- <!-- <c-upload :data="orderList" display basic deleteUrl="/api/gubersail-admin/productLaunchFiles/remove"-->
- <!-- :enumerationValue="160" />-->
- <!-- <span slot="footer" class="dialog-footer">-->
- <!-- <el-button @click="enclosure = false" size="small">取 消</el-button>-->
- <!-- <el-button type="primary" @click="saveAnnex" size="small">保 存</el-button>-->
- <!-- </span>-->
- <!--</el-dialog>-->
- <el-dialog
- title="附件上传"
- append-to-body
- :visible.sync="enclosure"
- width="555px"
- :close-on-click-modal="false"
- v-dialog-drag
- >
- <el-upload
- class="upload-demo"
- drag
- style="text-align: center"
- ref="upload"
- :action="action"
- :headers="headers"
- :on-success="onSuccess"
- :show-file-list="false"
- multiple
- >
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
- <div class="el-upload__tip" slot="tip">如上传文件过大,请耐心等待上传成功</div>
- </el-upload>
- </el-dialog>
- </div>
- </template>
- <script>
- // @ts-nocheck
- import {
- getList,
- groundingList,
- submit,
- batchOperationProductLaunch,
- getDetail,
- remove,
- productLaunch,
- listAllP,
- } from "@/api/basicData/listingManagement/index.js";
- import { getToken } from "@/util/auth";
- import { getCorpTypes } from "@/api/basicData/commodityInformation";
- import { isProcurement } from "@/api/basicData/configuration";
- export default {
- name: "index",
- data() {
- return {
- query: {
- whether: 0,
- },
- action: "/api/blade-resource/oss/endpoint/put-file",
- headers: { "Blade-Auth": "Bearer " + getToken() },
- orderList: [],
- enclosure: false,
- dataId: 0,
- rowImg: [],
- data: [],
- sharedCompanyoptions: [],
- activeName: "searchList",
- dialogVisibles: false,
- selectedNodes: [], // 存储选择节点的数组
- tableData: [],
- //上架列表
- goodsListShow: [],
- // 商品列表暂存
- goodsListSave: [],
- goodsListPolicy: [],
- optionsUeditor: {
- //普通上传地址
- // action:'https://avuejs.com/imgupload',
- action: "/api/blade-resource/oss/endpoint/put-file",
- headers: { "Blade-Auth": "Bearer " + getToken() },
- props: {
- res: "data",
- url: "link",
- },
- },
- excelForm: {},
- excelOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- {
- label: "模板下载",
- prop: "excelTemplate",
- formslot: true,
- span: 24,
- },
- {
- label: "模板上传",
- prop: "excelFile",
- type: "upload",
- drag: true,
- loadText: "模板上传中,请稍等",
- span: 24,
- propsHttp: {
- res: "data",
- },
- tip: "请上传 .xls,.xlsx 标准格式文件",
- action: "/api/gubersail-admin/productLaunch/import-productLaunch",
- },
- ],
- },
- templateUrl: "/api/gubersail-admin/productLaunch/export-productLaunch",
- treeOption: {
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- labelText: "标题",
- label: "cname",
- value: "id",
- },
- },
- excelBox: false,
- corpTypeVisible: false,
- // 左侧搜索
- treeData: [],
- loading: false,
- search: {},
- form: {},
- dataList: [],
- selectionList: [],
- page: {
- pageSize: 20,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500],
- },
- pageList: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- key: 0,
- option: {
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- addBtn: false,
- index: true,
- span: 8,
- border: true,
- selection: true,
- height: "auto",
- updateBtnText: "保存",
- searchMenuPosition: "right",
- align: "center",
- menuWidth: 220,
- searchSpan: 8,
- searchIcon: true,
- searchIndex: 2,
- highlightCurrentRow: true,
- dialogWidth: "90%",
- column: [
- {
- label: "商品名称",
- prop: "cname",
- search: true,
- disabled: true,
- overHidden: true,
- },
- {
- label: "规格型号",
- prop: "specificationAndModel",
- disabled: true,
- search: true,
- overHidden: true,
- },
- {
- label: "花纹",
- prop: "brandItem",
- disabled: true,
- search: true, // 是否搜索
- // type: 'select',
- // remote:true, // 是否为远程搜索
- // dicUrl:'/api/gubersail-admin/productLaunch/list?brandItem={{key}}', //key为当前输入值
- overHidden: true,
- },
- {
- label: "公司",
- prop: "salesCompanyName",
- disabled: true,
- overHidden: true,
- type: "select",
- props: {
- label: "fullName",
- value: "id",
- },
- dicUrl: "/api/blade-system/dept/top-list",
- },
- {
- label: "库存",
- prop: "inventory",
- disabled: true,
- overHidden: true,
- },
- {
- label: "产品状态",
- prop: "upAndDownShelves",
- filterable: true,
- display: false,
- search: true,
- hide: true,
- disabled: true,
- showColumn: false,
- type: "select",
- dicData: [
- {
- label: "上架",
- value: 1,
- },
- {
- label: "下架",
- value: 0,
- },
- ],
- },
- {
- label: "品牌",
- prop: "brandId",
- search: true,
- type: "select",
- props: {
- label: "cname",
- value: "id",
- },
- dicUrl: "/api/gubersail-admin/brandDesc/listAll?type=PP&enableOrNot=1",
- hide: true,
- filterable: true,
- disabled: true,
- overHidden: false,
- },
- {
- label: "品牌",
- prop: "brandName",
- disabled: true,
- overHidden: false,
- },
- {
- label: "售价1",
- prop: "priceOne",
- hide: false,
- overHidden: true,
- },
- {
- label: "售价2",
- prop: "priceTwo",
- hide: false,
- overHidden: true,
- },
- {
- label: "售价3",
- prop: "priceThree",
- hide: false,
- overHidden: true,
- },
- {
- label: "售价4",
- prop: "priceFour",
- hide: false,
- overHidden: true,
- },
- {
- label: "建议零售价",
- prop: "suggestedRetailPrice",
- hide: false,
- overHidden: true,
- },
- {
- label: "商品图片",
- prop: "filesList",
- hide: true,
- showColumn: false,
- overHidden: true,
- span: 24,
- },
- {
- label: "防爆",
- prop: "explosionProof",
- display: false,
- search: true,
- hide: false,
- showColumn: true,
- span: 8,
- type: "select",
- dicData: [
- {
- label: "否",
- value: 0,
- },
- {
- label: "是",
- value: 1,
- },
- ],
- },
- {
- label: "静音棉",
- prop: "originalFactory",
- display: false,
- search: true,
- hide: false,
- showColumn: true,
- span: 8,
- type: "select",
- dicData: [
- {
- label: "否",
- value: "0",
- },
- {
- label: "是",
- value: "1",
- },
- ],
- },
- {
- label: "自修补",
- prop: "selfRecovery",
- display: false,
- search: true,
- hide: false,
- showColumn: true,
- span: 8,
- type: "select",
- dicData: [
- {
- label: "否",
- value: "0",
- },
- {
- label: "是",
- value: "1",
- },
- ],
- },
- {
- label: "商品详情",
- prop: "detailsText",
- hide: true,
- span: 24,
- showColumn: false,
- overHidden: true,
- },
- ],
- },
- };
- },
- activated() {
- // getCorpTypes().then(res=>{
- // this.treeData = res.data.data
- // })
- listAllP({ whetherIntegral: "0" }).then((res) => {
- this.treeData = res.data.data;
- });
- this.onLoad(this.page, this.search);
- },
- async created() {
- this.key++;
- let i = 0;
- this.option.column.forEach((item) => {
- if (item.search) i++;
- });
- if (i % 3 !== 0) {
- const num = 3 - Number(i % 3);
- this.option.searchMenuSpan = num * 8;
- this.option.searchMenuPosition = "right";
- }
- },
- methods: {
- // 导入
- excelBoxfun(name) {
- if (name == "名称") {
- this.findObject(this.excelOption.column, "excelFile").action =
- "/api/gubersail-admin/tireStockDesc/importTireStockDesc";
- this.templateUrl = "/api/gubersail-admin/tireStockDesc/export-productLaunch";
- }
- this.excelBox = true;
- },
- // 导出
- outExport() {
- let config = { params: { ...this.search, whetherIntegral: 0 } };
- if (config.params) {
- for (const propName of Object.keys(config.params)) {
- const value = config.params[propName];
- if (value !== null && typeof value !== "undefined") {
- if (value instanceof Array) {
- for (const key of Object.keys(value)) {
- let params = propName + "[" + key + "]";
- config.params[params] = value[key];
- }
- delete config.params[propName];
- }
- }
- }
- }
- const routeData = this.$router.resolve({
- path: "/api/gubersail-admin/tireStockDesc/stockExport", //跳转目标窗口的地址
- query: {
- ...config.params, //括号内是要传递给新窗口的参数
- identification: this.url,
- },
- });
- window.open(routeData.href.slice(1, routeData.href.length) + "&" + `${this.website.tokenHeader}=${getToken()}`);
- },
- // 商城图片上传
- onSuccess(response, file, fileList) {
- let version = "2";
- if (this.form.filesList.length == 0) {
- version = "0";
- }
- this.form.filesList.push({
- fileName: response.data.originalName,
- url: response.data.link,
- sort: this.form.filesList.length,
- version: version,
- });
- submit({
- ...this.form,
- }).then((res) => {
- this.$message.success("修改成功");
- this.enclosure = false;
- this.onLoad(this.page, this.search);
- });
- },
- selectFocusfun(row) {
- console.log(row, 503);
- console.log(this.$refs.cruds, 504);
- },
- selectChangefun(value, row) {
- console.log(value, 506);
- if (value && Number(value) > 0) {
- this.$refs.cruds.toggleRowSelection(row, true);
- } else {
- this.$refs.cruds.toggleRowSelection(row, false);
- }
- },
- //打开附件
- annexOpen(row, index) {
- this.dataId = index;
- this.rowImg = row;
- this.orderList = row.filesList ? row.filesList : [];
- for (let order of this.orderList) {
- order.paymentType = order.typeFiles;
- }
- getDetail({ id: row.id }).then((res) => {
- this.form = res.data.data;
- });
- this.enclosure = true;
- },
- // 附件保存
- saveAnnex() {
- if (this.orderList.length > 0) {
- // 循环把编辑状态变成保存状态
- this.orderList.map((item) => {
- if (item.$cellEdit == true) {
- item.$cellEdit = false;
- } else {
- item.$cellEdit = true;
- }
- });
- let flag = this.orderList.some((item) => {
- return item.$version == "主图";
- });
- if (!flag) {
- this.$message.warning("请选择主图");
- return;
- }
- }
- this.rowImg.filesList = this.orderList;
- submit({
- ...this.rowImg,
- }).then((res) => {
- this.$message.success("添加成功");
- this.onLoad(this.page, this.search);
- });
- this.enclosure = false;
- },
- derivation() {
- window.open(`${this.templateUrl}?${this.website.tokenHeader}=${getToken()}`);
- },
- uploadAfter(res, done, loading, column) {
- this.excelBox = false;
- done();
- },
- nodeClick(data) {
- this.search.brandId = data.id;
- this.page.currentPage = 1;
- this.onLoad(this.page, this.search);
- },
- //刷新
- refreshChange() {
- this.onLoad(this.page, this.search);
- },
- //刷新触发
- refreshChangeCost() {
- // this.treeDeptId = ''
- this.page.currentPage = 1;
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- // sharedCompanyList
- // this.search.sharedCompanyList = params.sharedCompany;
- // Vue.delete(params, 'sharedCompany');
- // Vue.delete(this.search, 'sharedCompany');
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionChangeCost(list) {
- // this.goodsListSave = list
- this.tableData = list;
- },
- //新增
- commoditySelection() {
- delete this.page.brandId;
- this.goodsListShow = [];
- this.dialogVisibles = !this.dialogVisibles;
- this.tableData = [];
- this.goodsListSave = [];
- },
- //打开表单前
- beforeOpen(done, type) {
- // 查看和编辑逻辑
- if (["view", "edit"].includes(type)) {
- getDetail({ id: this.form.id }).then((res) => {
- this.form = res.data.data;
- done();
- });
- }
- },
- // 标签页切换
- tabHandle(data) {
- if (data.name == "searchList") {
- this.goodsListShow = this.data;
- this.page.total = this.pageList.total;
- } else if (data.name == "importStaging") {
- this.goodsListShow = this.goodsListSave;
- this.page.total = 0;
- }
- },
- removeStagList(row, index, type) {
- if (type === "policy") {
- this.goodsListPolicy.splice(row.$index, 1);
- if (this.goodsListPolicy.length == 0) {
- this.customerBuyFree.selection = true;
- this.optionPolicy.selection = true;
- this.$set(this.customerBuyFree, "menu", true);
- }
- } else if (type === "policy_buyAndGive") {
- this.buyAndGiveList.splice(row.$index, 1);
- if (this.buyAndGiveList.length == 0) {
- this.customerBuyFree.selection = true;
- this.optionPolicy.selection = true;
- this.$set(this.optionPolicy, "menu", true);
- }
- } else {
- console.log(row);
- this.goodsListSave.splice(row.$index, 1);
- }
- },
- rowDel(row, index) {
- this.$confirm("此操作将永久删除该行, 是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- remove(row.id).then((res) => {
- this.$message({
- type: "success",
- message: "删除成功!",
- });
- this.dataList.splice(index, 1);
- this.onLoad(this.page);
- });
- });
- },
- //编辑确定
- rowUpdate(form, index, done, loading) {
- if (this.form.filesList.length > 0) {
- let flag = this.form.filesList.some((item) => {
- return item.$version == "主图";
- });
- if (!flag) {
- this.$message.warning("请选择主图");
- // done()
- loading();
- return;
- }
- // 循环把编辑状态变成保存状态
- this.form.filesList.map((item) => {
- if (item.$cellEdit == true) {
- // this.$set(item, "$cellEdit", false);
- item.$cellEdit = false;
- } else {
- // this.$set(item, "$cellEdit", true);
- item.$cellEdit = true;
- }
- });
- }
- console.log({ ...this.form }.detailsText, 651);
- submit({
- ...this.form,
- })
- .then((res) => {
- this.$message.success("修改成功");
- this.onLoad(this.page, this.search);
- done();
- })
- .catch((err) => {
- loading();
- });
- },
- resetChange() {
- if (document.getElementsByClassName("is-current")[0]) {
- let selected = document.getElementsByClassName("is-current")[0];
- selected.classList.remove("is-current");
- }
- },
- goodsresetChange() {
- this.query = this.$options.data().query;
- },
- check(row) {
- console.log(row.upAndDownShelves);
- if (row.upAndDownShelves == 1) {
- if (row.priceOne == 0 || row.priceTwo == 0) {
- row.upAndDownShelves = 0;
- return this.$message.error("请维护所有售价");
- }
- this.loading = true;
- productLaunch([row])
- .then((res) => {
- batchOperationProductLaunch({
- flag: row.upAndDownShelves,
- ids: row.id,
- })
- .then((res) => {
- this.onLoad(this.page, this.search);
- })
- .catch(() => {
- this.loading = false;
- });
- })
- .catch(() => {
- this.loading = false;
- });
- } else {
- this.loading = true;
- batchOperationProductLaunch({
- flag: row.upAndDownShelves,
- ids: row.id,
- })
- .then((res) => {
- this.onLoad(this.page, this.search);
- })
- .catch(() => {
- this.loading = false;
- });
- }
- },
- // 确认导入
- importGoods() {
- if (!this.goodsListSave.length) {
- this.$message.error("请选择");
- }
- if (
- this.goodsListSave.some(
- (item) =>
- item.priceOne == undefined ||
- item.priceTwo == undefined ||
- item.priceThree == undefined ||
- item.priceFour == undefined
- )
- ) {
- this.$message.error("请填写所有售价");
- } else {
- if (this.goodsListSave.length > 0) {
- this.goodsListSaveHandle();
- }
- }
- },
- goodsListSaveHandle() {
- this.goodsListSave.forEach((item) => {
- // item.sharedCompany ? item.sharedCompany.join(',') : ''
- item.sharedCompany = item.sharedCompany ? item.sharedCompany.toString() : "";
- this.goodsListSave.specificationAndModel = item.typeno;
- delete this.goodsListSave.typeno;
- // item.sharedCompany = JSON.stringify(item.sharedCompany)
- });
- productLaunch(this.goodsListSave).then((res) => {
- this.dialogVisibles = !this.dialogVisibles;
- this.onLoad(this.page, this.search);
- });
- },
- //导入商品触发
- importChoice() {
- // this.contactsData = this.contactsData.concat(this.tableData)
- if (this.tableData.length === 1) {
- this.goodsShowData[this.choiceIndexT].cname = this.tableData[0].cname;
- this.goodsShowData[this.choiceIndexT].code = this.tableData[0].code;
- this.goodsShowData[this.choiceIndexT].typeno = this.tableData[0].typeno;
- this.goodsShowData[this.choiceIndexT].itemType = this.tableData[0].typeno;
- this.goodsShowData[this.choiceIndexT].itemId = this.tableData[0].id;
- this.goodsShowData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName;
- this.goodsShowData[this.choiceIndexT].integralMultiples = this.tableData[0].integralMultiples;
- this.goodsShowData[this.choiceIndexT].corpId = this.tableData[0].corpId;
- this.goodsShowData[this.choiceIndexT].corpName = this.tableData[0].corpName;
- this.quantityChange(this.goodsShowData[this.choiceIndexT]);
- selectGoodsNum({
- goodsId: this.tableData[0].id,
- itemType: this.tableData[0].typeno,
- tradeType: "GN",
- warehouseId: this.form.storageId,
- }).then((res) => {
- if (res.data.data.length > 0) {
- this.goodsShowData[this.choiceIndexT].storageQuantityList = res.data.data;
- this.goodsShowData[this.choiceIndexT].storageId = res.data.data[0].storageId;
- this.goodsShowData[this.choiceIndexT].storageName = res.data.data[0].storageName;
- this.goodsShowData[this.choiceIndexT].storageQuantity = res.data.data[0].surplusRouteQuantity;
- if (res.data.data[0].tenantId !== "681169") {
- this.goodsShowData[this.choiceIndexT].purchaseAmount = res.data.data[0].stockPrice;
- }
- }
- });
- }
- this.dialogVisible = !this.dialogVisible;
- this.commodityData = false;
- },
- importStagList(row, index, type) {
- if (type === "policy") {
- this.goodsListPolicy.push(row);
- if (this.goodsListPolicy.length > 0) {
- this.customerBuyFree.selection = false;
- this.optionPolicy.selection = true;
- this.$set(this.customerBuyFree, "menu", false);
- }
- } else if (type === "policy_buyAndGive") {
- this.buyAndGiveList.push(row);
- if (this.buyAndGiveList.length > 0) {
- this.customerBuyFree.selection = true;
- this.optionPolicy.selection = false;
- this.$set(this.optionPolicy, "menu", false);
- }
- } else {
- this.goodsListSave.push(row);
- }
- },
- change(row, type) {
- let data = [];
- for (let item of this.selectionList) {
- data.push(item.id);
- }
- if (type === "up") {
- for (let item of this.selectionList) {
- if (item.priceOne == 0 || item.priceTwo == 0) {
- return this.$message.error("请维护所有售价");
- }
- }
- this.$confirm("是否确认全部上架?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- batchOperationProductLaunch({
- flag: 1,
- ids: data.join(","),
- }).then((res) => {
- this.onLoad(this.page, this.search);
- });
- });
- } else if (type === "down") {
- this.$confirm("是否确认全部下架?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- batchOperationProductLaunch({
- flag: 0,
- ids: data.join(","),
- }).then((res) => {
- this.onLoad(this.page, this.search);
- });
- });
- }
- },
- //新增搜索
- goodsSearchCost(params, done) {
- this.treeDeptId = "";
- params = {
- ...params,
- // artsVision: this.form.belongToCorpId
- };
- this.onLoad(this.page, params);
- done();
- },
- onLoad(page, params = {}) {
- // 深拷贝一份防止弹出框的搜索参数和外面表格的搜索参数一样
- let search = JSON.parse(JSON.stringify(this.search));
- search.cname = params.cname;
- // this.search.cname = params.cname
- // params.sharedCompany = params.$sharedCompany
- params = {
- ...params,
- current: page.currentPage,
- size: page.pageSize,
- ...Object.assign(params, search),
- // ...Object.assign(params, this.search),
- // billType: 0,
- whetherIntegral: "0",
- };
- this.loading = true;
- getList(params)
- .then((res) => {
- this.dataList = res.data.data.records;
- this.page.total = res.data.data.total;
- this.pageList.total = res.data.data.total;
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.loading = false;
- })
- .finally(() => {
- this.loading = false;
- });
- },
- //点击可用库存打开
- storeInventoryOpen(row) {
- this.$router.push({
- path: "/tirePartsMall/basicData/listingManagement/detail",
- query: {
- goodsId: row.goodsId,
- dot: row.dot,
- },
- });
- },
- },
- };
- </script>
- <style scoped></style>
|