123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994 |
- <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
- class="el-button--small-yh add-customer-btn"
- type="primary"
- :disabled="disabled"
- size="small"
- @click="editCustomer"
- >{{ form.id ? "确认修改" : "确认新增" }}
- </el-button>
- </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>
- </div>
- </template>
- <script>
- import customerContact from "./configuration/customerContact.json";
- import BuyFree from "./configuration/BuyFree.json";
- import {
- detail,
- corpsattn,
- typeSave,
- getItemdetail,
- itemSubmit
- } 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"
- export default {
- props: {
- detailData: Object
- },
- data() {
- return {
- configuration: {
- multipleChoices: true,
- multiple: true,
- collapseTags: false,
- placeholder: "请点击右边按钮选择",
- dicData: []
- },
- 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 = [];
- }
- },
- methods: {
- 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();
- })
- .finally(() => {
- 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);
- }
- });
- },
- //修改提交触发
- 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>
|