| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075 |
- <template>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
- <el-button
- type="danger"
- style="border: none;background: none;color: red"
- icon="el-icon-arrow-left"
- @click="backToList"
- >返回列表
- </el-button>
- </div>
- <el-button
- style="margin-right: 110px"
- class="add-customer-btn"
- type="primary"
- :disabled="disabled"
- size="small"
- @click="editCustomer"
- >{{ form.id ? "确认修改" : "确认新增" }}
- </el-button>
- <el-dropdown class="add-customer-btn">
- <el-button type="primary" size="small">
- 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native="pleaseCheck" :disabled="form.auditStatus != 2">请核数据</el-dropdown-item>
- <el-dropdown-item @click.native="checkScheduleDialog = true,checkId=form.id" :disabled="form.auditStatus === 1 || form.auditStatus === 2">审核进度</el-dropdown-item>
- <!-- <el-dropdown-item>撤销请核</el-dropdown-item>-->
- <!-- <el-dropdown-item>审批数据</el-dropdown-item>-->
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- <div style="margin-top: 60px">
- <el-form
- :model="form"
- ref="form"
- label-width="130px"
- class="demo-ruleForm"
- >
- <containerTitle title="基础资料"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <el-row>
- <el-col
- v-for="(item, index) in basicData.column"
- :key="index"
- :span="item.span ? item.span : 8"
- >
- <el-form-item
- :label="item.label"
- :prop="item.prop"
- :rules="item.rules"
- >
- <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}"v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"/>-->
- <el-date-picker
- v-if="item.type === 'datetime'"
- style="width: 100%;"
- v-model="form[item.prop]"
- size="small"
- type="datetime"
- placeholder="选择日期"
- value-format="yyyy-MM-dd HH:mm:ss"
- />
- <span v-else-if="item.type === 'select'">
- <el-select
- v-model="form[item.prop]"
- slot="prepend"
- style="width: 100%;"
- size="small"
- placeholder="请选择"
- >
- <el-option
- v-for="(item, index) in item.dicData"
- :label="item.label"
- :value="item.value"
- :key="index"
- ></el-option>
- </el-select>
- </span>
- <crop-select
- v-else-if="item.prop === 'corps'"
- v-model="form[item.prop]"
- :collapseTags="true"
- :multiple="true"
- corpType="KH"
- style="width: 100%"
- @getCorpList="getCorpList"
- ></crop-select>
- <!-- <selectComponent v-else-if="item.prop === 'corps'" v-model="form[item.prop]"-->
- <!-- :configuration="configuration" style="width: 100%"/>-->
- <el-input
- type="textarea"
- v-else-if="item.type === 'textarea'"
- v-model="form[item.prop]"
- size="small"
- autocomplete="off"
- :disabled="item.disabled"
- ></el-input>
- <el-input
- type="age"
- v-else
- v-model="form[item.prop]"
- size="small"
- autocomplete="off"
- :disabled="item.disabled ? item.disabled : false"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </basic-container>
- <containerTitle title="特价促销"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <avue-crud
- :table-loading="contactLoading"
- :page.sync="contactPage"
- :option="customerContact"
- v-model="contactsForm"
- :data="contactsData"
- ref="crudContact"
- @current-change="currentChange"
- @size-change="sizeChange"
- @row-save="rowSave"
- @row-click="handleRowClick"
- @row-update="rowUpdate"
- @row-del="rowDel"
- >
- <template slot="code" slot-scope="{ row, index }">
- <el-button
- size="small"
- type="text"
- @click="rePick(row, index, 1)"
- :disabled="disabled"
- class="picker"
- style="padding:4px 10px;float:left"
- >选择</el-button
- >
- <span> {{ row.code }}</span>
- </template>
- <template slot="corpId" slot-scope="{ row, index }">
- <crop-select
- v-if="row.$cellEdit"
- v-model="row.corpId"
- :cropIndex="index"
- corpType="GYS"
- @getCorpData="getcorpId"
- :disabled="detailData.seeDisabled"
- ></crop-select>
- <span v-else>{{ row.corpName }}</span>
- </template>
- <template slot="menuLeft">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="small"
- @click.stop="newSpecial"
- >新增明细</el-button
- >
- <el-button
- type="primary"
- size="small"
- icon="el-icon-download"
- @click="downloadHandle"
- >下载模板</el-button
- >
- <el-upload
- :action="baseURL"
- :headers="headers"
- :disabled="detailData.seeDisabled"
- :on-progress="uploading"
- :show-file-list="false"
- accept=".xls,.xlsx"
- multiple
- :on-success="importTemplate"
- :on-error="uploadError"
- style="float: right"
- >
- <el-button type="primary" size="small" icon="el-icon-upload"
- >导 入</el-button
- >
- </el-upload>
- </template>
- <template slot-scope="{ row, index }" slot="menu">
- <el-button
- type="text"
- size="small"
- @click="rowCell(row, index)"
- icon="el-icon-edit"
- :disabled="form.status == 0"
- >{{ row.$cellEdit ? "保存" : "修改" }}
- </el-button>
- <el-button
- size="small"
- icon="el-icon-delete"
- type="text"
- @click="rowDel(row, index)"
- v-show="form.status == 1"
- >删 除</el-button>
- </template>
- </avue-crud>
- </basic-container>
- <containerTitle title="买赠促销"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <avue-crud
- :option="customerBuyFree"
- v-model="contactsFormBuyFree"
- :data="contactsDataBuyFree"
- ref="crudContactE"
- @row-save="rowSaveBuyFree"
- @row-click="handleRowClickBuyFree"
- @row-update="rowUpdateBuyFree"
- @row-del="rowDelBuyFree"
- >
- <template slot="code" slot-scope="{ row, index }">
- <el-button
- size="small"
- type="text"
- @click="rePick(row, index, 2)"
- :disabled="disabled"
- class="picker"
- style="padding:4px 10px;float:left"
- >选择</el-button
- >
- <span> {{ row.code }}</span>
- </template>
- <template slot="corpId" slot-scope="{ row, index }">
- <crop-select
- v-if="row.$cellEdit"
- v-model="row.corpId"
- :cropIndex="index"
- corpType="GYS"
- @getCorpData="getcorpFeesId"
- :disabled="detailData.seeDisabled"
- ></crop-select>
- <span v-else>{{ row.corpName }}</span>
- </template>
- <template slot="menuLeft">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="small"
- @click.stop="newBuyFree"
- >新增明细</el-button
- >
- </template>
- <template slot-scope="{ row, index }" slot="menu">
- <el-button
- type="text"
- size="small"
- @click="rowCellE(row, index)"
- icon="el-icon-edit"
- >{{ row.$cellEdit ? "保存" : "修改" }}
- </el-button>
- <el-button
- size="small"
- icon="el-icon-delete"
- type="text"
- @click="rowDelBuyFree(row, index)"
- v-show="form.status == 1"
- >删 除</el-button
- >
- </template>
- </avue-crud>
- </basic-container>
- </el-form>
- <el-dialog
- title="导入商品"
- append-to-body
- class="el-dialogDeep"
- :visible.sync="dialogVisible"
- width="80%"
- top="5vh"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- @close="closeGoods"
- v-dialogdrag
- >
- <span>
- <el-row>
- <el-col :span="5">
- <div>
- <el-scrollbar>
- <basic-container style="margin-top:45px">
- <avue-tree :option="treeOption" @node-click="nodeClick" />
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="19">
- <avue-crud
- :option="goodsOption"
- :table-loading="loading"
- :data="goodsList"
- ref="goodsCrud"
- @refresh-change="refreshChange"
- @selection-change="selectionChange"
- @row-click="rowClick"
- :page.sync="page"
- @on-load="onLoad"
- @saveColumn="saveGoodsColumn"
- @search-change="goodsSearch"
- ></avue-crud>
- </el-col>
- </el-row>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button
- type="primary"
- @click="importGoods"
- :disabled="selectionList.length == 0"
- >导入</el-button
- >
- </span>
- </el-dialog>
- </div>
- <el-dialog
- append-to-body
- title="审批进度"
- class="el-dialogDeep"
- :visible.sync="checkScheduleDialog"
- width="40%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- v-dialog-drag
- >
- <check-schedule
- :checkId="checkId"
- :batchNo="batchNo"
- @choceScheduleFun="choceScheduleFun"
- >
- </check-schedule>
- </el-dialog>
- </div>
- </template>
- <script>
- import customerContact from "./configuration/customerContact.json";
- import BuyFree from "./configuration/BuyFree.json";
- import {
- detail,
- corpsattn,
- typeSave,
- getItemdetail,
- itemSubmit,
- pleaseCheck
- } from "@/api/maintenance/salesPolicy";
- import {
- submit,
- delItem,
- getDeptLazyTree,
- getGoods,
- savePurchase,
- saveShipping,
- getPorts,
- getSpecification,
- saveSell
- } from "@/api/basicData/customerInquiry";
- import goodsOption from "./configuration/commodity.json";
- import { contrastObj, contrastList } from "@/util/contrastData";
- import { getToken } from "@/util/auth";
- import { getPurchasePrice } from "@/api/basicData/fees"
- import checkSchedule from "@/components/check/checkSchedule";
- export default {
- props: {
- detailData: Object
- },
- components:{
- checkSchedule,
- },
- data() {
- return {
- configuration: {
- multipleChoices: true,
- multiple: true,
- collapseTags: false,
- placeholder: "请点击右边按钮选择",
- dicData: []
- },
- checkId:'',
- batchNo:'',
- checkScheduleDialog:false,
- form: {},
- disabled: false,
- customerContact: customerContact,
- contactsForm: {},
- contactsData: [],
- customerBuyFree: BuyFree,
- contactsFormBuyFree: {},
- contactsDataBuyFree: [],
- basicData: {
- column: [
- {
- label: "政策名称",
- prop: "cname",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "状态",
- prop: "status",
- type: "select",
- dicData: [
- {
- label: "正常",
- value: 0
- },
- {
- label: "停用",
- value: 1
- }
- ],
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "品牌",
- prop: "brand",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "操作员",
- prop: "createUserName",
- disabled: true,
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "有效期开始时间",
- prop: "startTime",
- type: "datetime",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "有效期结束时间",
- prop: "endTime",
- type: "datetime",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- //多选
- label: "代理商",
- prop: "corps",
- span: 16,
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },{
- //多选
- label: "政策类型",
- prop: "type",
- span: 8,
- type: "select",
- dicData: [
- {
- label: "正常",
- value: '正常'
- },
- {
- label: "特价",
- value: '特价'
- }
- ],
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "备注",
- type: "textarea",
- span: 24,
- prop: "remarks",
- mock: {
- type: "county"
- }
- }
- ]
- },
- dialogVisible: false,
- selectionList: [],
- treeDeptId: null,
- treeOption: {
- nodeKey: "id",
- lazy: true,
- treeLoad: function(node, resolve) {
- const parentId = node.level === 0 ? 0 : node.data.id;
- getDeptLazyTree(parentId).then(res => {
- resolve(
- res.data.data.map(item => {
- return {
- ...item,
- leaf: !item.hasChildren
- };
- })
- );
- });
- },
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- label: "title",
- value: "value",
- children: "children"
- }
- },
- goodsOption: goodsOption,
- loading: false,
- goodsList: [],
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- contactPage: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- // 1特价 2买赠
- salesType: 1,
- reData: null,
- oldForm: {},
- oldSpecialOffer: [],
- oldBuyFree: [],
- baseURL: "/api/blade-mocha-item/salespolicy/import-sales-policy",
- headers: { "Blade-Auth": "Bearer " + getToken() },
- contactLoading: false
- };
- },
- //初始化查询
- created() {
- if (this.detailData.id) {
- this.queryData(this.detailData.id);
- } else {
- this.form = {
- type:'正常'
- };
- this.contactsData = [];
- }
- if (this.detailData.check) {
- this.batchNo = this.detailData.check.batchNo
- }
- },
- methods: {
- choceScheduleFun(){
- this.checkScheduleDialog = false
- },
- queryData(id) {
- this.openFullScreen(false, "正在努力的加载...");
- detail(id).then(res => {
- this.form = res.data.data;
- if (this.form.corpNameList) {
- this.configuration.dicData = this.form.corpNameList;
- }
- this.form.corps = this.form.corps.split(",");
- // if (res.data.data.specialItemList) this.contactsData = res.data.data.specialItemList
- if (res.data.data.presentItemList)
- this.contactsDataBuyFree = res.data.data.presentItemList;
- this.oldForm = Object.assign({}, this.form);
- // this.oldSpecialOffer = this.deepClone(this.contactsData)
- this.oldBuyFree = this.deepClone(this.contactsDataBuyFree);
- delete this.form.specialItemList;
- delete this.form.presentItemList;
- this.getItemdetail();
- this.openFullScreen(true);
- })
- },
- getItemdetail() {
- this.contactLoading = true;
- getItemdetail({
- current: this.contactPage.currentPage,
- size: this.contactPage.pageSize,
- pid: this.form.id
- })
- .then(res => {
- this.contactsData = res.data.data.records;
- this.contactPage.total = res.data.data.total;
- this.customerContact.height = window.innerHeight - 240;
- })
- .finally(() => {
- this.contactLoading = false;
- });
- },
- currentChange(val) {
- this.contactPage.currentPage = val;
- this.getItemdetail();
- },
- sizeChange(val) {
- this.contactPage.currentPage = 1;
- this.contactPage.pageSize = val;
- this.getItemdetail();
- },
- rePick(row, index, type) {
- this.reData = {
- ...row,
- index: index
- };
- if (type == 1) {
- this.newSpecial();
- } else {
- this.newBuyFree();
- }
- },
- // 新增特价弹窗
- newSpecial() {
- this.salesType = 1;
- this.dialogVisible = !this.dialogVisible;
- },
- // 买赠弹窗
- newBuyFree() {
- this.salesType = 2;
- this.dialogVisible = !this.dialogVisible;
- },
- closeGoods() {
- this.selectionList = [];
- this.treeDeptId = "";
- this.reData = null;
- },
- nodeClick(data) {
- this.treeDeptId = data.id;
- this.page.currentPage = 1;
- this.onLoad(this.page);
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- rowClick(row) {
- this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
- },
- goodsSearch(params, done) {
- this.onLoad(this.page, params);
- done();
- },
- //商品查询
- onLoad(page, params = {}) {
- this.loading = true;
- getGoods(page.currentPage, page.pageSize, this.treeDeptId, params)
- .then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.goodsList = data.records;
- if (this.page.total) {
- this.goodsOption.height = window.innerHeight - 400;
- } else {
- this.goodsOption.height = window.innerHeight - 400;
- }
- })
- .finally(() => {
- this.loading = false;
- });
- },
- // 确认导入商品
- importGoods() {
- if (this.reData) {
- if (this.selectionList.length != 1) {
- return this.$message.error("重新选择的时候只能选择一条数据");
- } else {
- this.selectionList.forEach(e => {
- if (this.reData.salesType == 1) {
- this.contactsData.forEach(async (item, index) => {
- if (index == this.reData.index) {
- item.purchasePrice = await this.getPurchasePrice(e);
- item.itemId = e.id;
- item.code = e.code;
- item.cname = e.cname;
- item.brand = e.brand;
- item.productCategory = e.goodsTypeName;
- item.typeno = e.typeno;
- item.brandItem = e.brandItem;
- item.cartonWeight = e.cartonWeight;
- item.cntrVolumn = e.cntrVolumn;
- // item.purchasePrice = this.brand.purchasePrice
- // item.salesPrice = this.brand.salesPrice
- // item.specialOffer = this.brand.specialOffer
- // item.updateUserName = this.brand.updateUserName
- // item.updateTime = this.brand.updateTime
- // item.salesType = this.brand.salesType
- }
- });
- } else {
- this.contactsDataBuyFree.forEach(async (item, index) => {
- item.itemId = e.id;
- item.code = e.code;
- item.cname = e.cname;
- item.brand = e.brand;
- item.productCategory = e.goodsTypeName;
- item.typeno = e.typeno;
- item.brandItem = e.brandItem;
- item.cartonWeight = e.cartonWeight;
- item.cntrVolumn = e.cntrVolumn;
- // item.purchasePrice = this.brand.purchasePrice
- // item.salesPrice = this.brand.salesPrice
- // item.salesPrice = this.brand.purchaseAmount
- // item.updateUserName = this.brand.salesVolume
- // item.updateUserName = this.brand.updateUserName
- // item.updateTime = this.brand.updateTime
- // item.salesType = this.brand.salesType
- });
- }
- });
- }
- } else {
- if (this.salesType == 1) {
- this.selectionList.forEach(async item => {
- this.contactsData.push({
- purchasePrice: await this.getPurchasePrice(item),
- itemId: item.id,
- code: item.code,
- brand: item.brand,
- productCategory: item.goodsTypeName,
- typeno: item.typeno,
- brandItem: item.brandItem,
- corpId: item.corpId,
- corpName: item.corpName,
- salesPrice: "",
- specialOffer: "",
- updateUserName: "",
- updateTime: "",
- salesType: "1",
- cntrVolumn: item.cntrVolumn,
- cartonWeight: item.cartonWeight,
- });
- });
- } else if (this.salesType == 2) {
- this.selectionList.forEach(item => {
- this.contactsDataBuyFree.push({
- itemId: item.id,
- code: item.code,
- brand: item.brand,
- productCategory: item.goodsTypeName,
- typeno: item.typeno,
- brandItem: item.brandItem,
- corpName: item.corpName,
- corpId: item.corpId,
- purchasePrice: "",
- salesPrice: "",
- purchaseAmount: "",
- salesVolume: "",
- updateUserName: "",
- updateTime: "",
- salesType: "2",
- cntrVolumn: item.cntrVolumn,
- cartonWeight: item.cartonWeight,
- });
- });
- }
- }
- this.dialogVisible = false;
- },
- //买赠列表信息保存触发
- rowSaveBuyFree(row, done, loading) {
- // this.contactsData.push(row)
- done();
- },
- //买赠列表点击行可编辑
- handleRowClickBuyFree(row, event, column) {
- },
- //买赠列表修改信息触发
- rowUpdateBuyFree(row, index, done, loading) {
- done(row);
- },
- //买赠列表删除信息触发
- rowDelBuyFree(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- //商品判断是否需要调用删除接口
- if (row.id) {
- corpsattn(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsDataBuyFree.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsDataBuyFree.splice(index, 1);
- }
- });
- },
- //新增商品信息保存触发
- rowSave(row, done, loading) {
- console.log(row);
- console.log(this.contactsData);
- // this.contactsData.push(row)
- done();
- },
- //点击行可编辑
- handleRowClick(row, event, column) {
- console.log(row.$index);
- },
- //商品编辑
- rowCell(row, index) {
- if (row.$cellEdit && this.form.id) {
- itemSubmit({...row,pid: this.form.id}).then(res => {
- this.$message.success('保存成功')
- this.$refs.crudContact.rowCell(row, index);
- })
- } else {
- this.$refs.crudContact.rowCell(row, index);
- }
- },
- //买赠编辑
- rowCellE(row, index) {
- console.log(row);
- this.$refs.crudContactE.rowCell(row, index);
- },
- //修改商品信息触发
- rowUpdate(row, index, done, loading) {
- done(row);
- },
- //删除商品信息触发
- rowDel(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- //商品判断是否需要调用删除接口
- if (row.id) {
- corpsattn(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsData.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsData.splice(index, 1);
- }
- });
- },
- //请核数据
- pleaseCheck(){
- this.$confirm("是否确认提交审批?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- for (let item in this.contactsData) {
- if (!this.contactsData[item].corpId) {
- return this.$message.error('特价明细第' + (Number(item) + 1) + '行供应商不能为空')
- }
- }
- for (let item in this.contactsDataBuyFree) {
- if (!this.contactsDataBuyFree[item].corpId) {
- return this.$message.error('买赠明细第' + (Number(item) + 1) + '行供应商不能为空')
- }
- }
- this.form.corps = this.form.corps.join(",");
- this.form.specialItemList = this.contactsData;
- this.form.presentItemList = this.contactsDataBuyFree;
- this.openFullScreen(false, "正在努力的加载...");
- typeSave(this.form).then(res => {
- const data = {
- id : this.form.id,
- checkType: 'xszc',
- url: '/maintenance/salesPolicy/index',
- pageStatus:"this.$store.getters.domSaleStatus",
- pageLabel:"销售政策",
- checkFlag: 2,
- }
- pleaseCheck(data).then(res=>{
- this.$message({
- type: "success",
- message: "请核成功!"
- });
- this.queryData(this.form.id);
- })
- });
- })
- },
- //修改提交触发
- editCustomer() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- for (let item in this.contactsData) {
- if (!this.contactsData[item].corpId) {
- return this.$message.error('特价明细第' + (Number(item) + 1) + '行供应商不能为空')
- }
- }
- for (let item in this.contactsDataBuyFree) {
- if (!this.contactsDataBuyFree[item].corpId) {
- return this.$message.error('买赠明细第' + (Number(item) + 1) + '行供应商不能为空')
- }
- }
- this.form.corps = this.form.corps.join(",");
- this.form.specialItemList = this.contactsData;
- this.form.presentItemList = this.contactsDataBuyFree;
- this.openFullScreen(false, "正在努力的加载...");
- typeSave(this.form).then(res => {
- this.$message({
- type: "success",
- message: this.form.id ? "修改成功!" : "新增成功!"
- });
- // this.backToList()
- this.queryData(res.data.data.id);
- });
- } else {
- return false;
- }
- });
- },
- //返回列表
- backToList() {
- this.$emit("goBack");
- },
- async saveGoodsColumn() {
- // const inSave = await this.saveColumnData(
- // this.getColumnName(26),
- // this.goodsOption
- // );
- // if (inSave) {
- // this.$message.success("保存成功");
- // //关闭窗口
- // this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
- // }
- },
- //遮罩层
- openFullScreen(res, text) {
- const loading = this.$loading({
- lock: true,
- text: text,
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)"
- });
- if (res === true) loading.close();
- },
- getcorpId(row) {
- this.contactsData[row.index].corpId = row.id;
- },
- getcorpFeesId(row) {
- this.contactsDataBuyFree[row.index].corpId = row.id;
- },
- // 下载模板
- downloadHandle() {
- this.$confirm("是否下载模板文件?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- window.open(
- `/api/blade-mocha-item/salespolicy/export-sales-policy?${
- this.website.tokenHeader
- }=${getToken()}`
- );
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "已取消"
- });
- });
- },
- //文件上传时
- uploading(event, file, fileList) {
- this.openFullScreen(false, "文件正在解析中");
- },
- importTemplate(res, file) {
- this.openFullScreen(true);
- let contactsData = [];
- contactsData = res.data;
- this.contactsData = this.contactsData.concat(contactsData);
- // console.log(res.data)
- },
- uploadError(err, file, fileList) {
- this.openFullScreen(true);
- this.$message.error(JSON.parse(err.message).msg);
- },
- getCorpList(data) {
- let arr = [];
- data.map(e => {
- arr.push(e.id);
- });
- this.form.corps = arr;
- },
- async getPurchasePrice(row) {
- let data;
- await getPurchasePrice({code: row.code}).then(res => {
- data = res.data.data.length > 0? res.data.data[0].purchasePrice: 0
- })
- return data;
- },
- }
- };
- </script>
- <style lang="scss" scoped>
- .back-icon {
- line-height: 64px;
- font-size: 20px;
- margin-right: 8px;
- }
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- .el-dialogDeep {
- ::v-deep .el-dialog {
- margin: 1vh auto 0 !important;
- padding-bottom: 10px !important;
- .el-dialog__body,
- .el-dialog__footer {
- padding-bottom: 0 !important;
- padding-top: 0 !important;
- }
- }
- }
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- ::v-deep .el-form-item__content {
- line-height: 32px;
- }
- </style>
|