123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050 |
- <template>
- <div>
- <div v-if="isEdit == 1">
- <el-header height="50px" class="header">
- <el-page-header
- @back="($parent.isShow = 1), ($parent.id = '')"
- :content="comTitle"
- >
- </el-page-header>
- </el-header>
- <div class="app-container">
- <div class="diy-table-1">
- <el-row>
- <el-col :span="8" class="item">
- <div class="label">销售政策编号</div>
- <div class="value">{{ detail.code }}</div>
- </el-col>
- <el-col :span="8" class="item">
- <div class="label">销售政策说明</div>
- <div class="value">
- <el-input
- v-model="detail.title"
- placeholder="请输入政策说明"
- ></el-input>
- </div>
- </el-col>
- <el-col :span="8" class="item">
- <div class="label">状态</div>
- <div class="value">
- {{ detail.status == 1 ? "已生效" : "未生效" }}
- </div>
- </el-col>
- <el-col :span="24" class="item">
- <div class="label">销售政策类型</div>
- <div class="value">
- <el-select
- v-model="detail.type"
- size="small"
- placeholder="销售政策类型"
- class="select_height"
- >
- <el-option
- v-for="(item, index) in typeOptions"
- :key="index"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </div>
- </el-col>
- <el-col :span="24" class="item">
- <div class="label">备注</div>
- <div class="value">
- <el-input
- v-model="detail.remark"
- placeholder="请输入备注"
- ></el-input>
- </div>
- </el-col>
- <el-col :span="8" class="item">
- <div class="label">制单人</div>
- <div class="value">{{ detail.createBy }}</div>
- </el-col>
- <el-col :span="8" class="item">
- <div class="label">制单日期</div>
- <div class="value">
- <el-date-picker
- v-model="detail.createTime"
- type="datetime"
- placeholder="制单日期"
- default-time="00:00:00"
- value-format="yyyy-MM-dd HH:mm:ss"
- />
- </div>
- </el-col>
- <el-col :span="8" class="item">
- <div class="label">生效日期</div>
- <div class="value">
- <el-date-picker
- v-model="detail.startTime"
- type="datetime"
- placeholder="生效日期"
- default-time="00:00:00"
- value-format="yyyy-MM-dd HH:mm:ss"
- /> </el-form-item>
- </div>
- </el-col>
- <el-col :span="24" class="item">
- <div class="label">失败日期</div>
- <div class="value">
- <el-date-picker
- v-model="detail.endTime"
- type="datetime"
- placeholder="生效日期"
- default-time="00:00:00"
- value-format="yyyy-MM-dd HH:mm:ss"
- /> </el-form-item>
- </div>
- </el-col>
- </el-row>
- <el-row class="img-box" v-if="detail.imgSrc && $parent.isShow !== 5">
- <el-col :span="8" class="item">
- <div class="label" style="height: 150px">政策封面图</div>
- <div class="value" style="height: 150px">
- <el-image
- style="height: 120px; widht: 120px"
- :src="$imageUrl + detail.imgSrc"
- fit="fill"
- :preview-src-list="srcList"
- ></el-image>
- </div>
- </el-col>
- </el-row>
- <el-row v-if="$parent.isShow == 5">
- <el-col :span="24" class="item">
- <div class="label" style="height: 150px">政策封面图</div>
- <div class="value" style="height: 150px">
- <ImageUpload :fileList="fileList" :multiple="false" />
- </div>
- </el-col>
- </el-row>
- <el-row v-if="this.$parent.isShow == 4">
- <el-col :span="8" class="item">
- <div class="label">审核人</div>
- <div class="value">{{ detail.examineBy }}</div>
- </el-col>
- <el-col :span="8" class="item">
- <div class="label">审核日期</div>
- <div class="value">{{ detail.examineTime }}</div>
- </el-col>
- <el-col :span="8" class="item">
- <div class="label">关闭人</div>
- <div class="value"></div>
- </el-col>
- <el-col :span="8" class="item">
- <div class="label">关闭日期</div>
- <div class="value"></div>
- </el-col>
- </el-row>
- </div>
- <div class="mymain-container">
- <el-row>
- <el-divider></el-divider>
- <el-row type="flex">
- <el-col :span="12">
- <h4 style="display: inline-block; margin-right: 20px">
- 货品信息
- </h4>
- <el-upload
- v-if="$parent.isShow == 5"
- class="import-btn"
- :action="baseURL + 'student/import'"
- :http-request="handleImport"
- :file-list="importFileList"
- :show-file-list="false"
- >
- <el-button size="small">导入货品价格表</el-button>
- </el-upload>
- </el-col>
- <el-col :span="12" class="tr">
- <!-- <el-button size="small" @click="$parent.isShow = 10"
- >查看条件</el-button
- > -->
- </el-col>
- </el-row>
- <el-divider></el-divider>
- </el-row>
- <el-table
- v-loading="listLoading"
- :data="dataList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column
- fixed
- type="index"
- label="序号"
- width="50"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="materialNumber"
- label="货品编码"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="materialName"
- label="货品名称"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="specification"
- label="规格型号"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="saleTypeCode"
- label="销售类型编码"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="saleTypeName"
- label="销售类型"
- align="center"
- >
- </el-table-column>
- <el-table-column prop="price" label="单价" align="center">
- </el-table-column>
- <el-table-column label="支付钱包" align="center">
- <template slot-scope="scope">
- <el-tag
- style="margin: 5px"
- type="success"
- size="small"
- v-for="item in scope.row.walletRelaList"
- >{{ item.walletName }}</el-tag
- >
- </template>
- </el-table-column>
- <!-- <el-table-column
- label="操作"
- align="center"
- width="150"
- v-if="$parent.isShow == 5 && detail.examineStatus == 'SAVE'"
- >
- <template slot-scope="scope">
- <el-popconfirm
- confirm-button-text="好的"
- cancel-button-text="不用了"
- icon="el-icon-info"
- icon-color="red"
- title="内容确定删除吗?"
- @onConfirm="hanleDelete(scope.row.id)"
- >
- <el-button
- slot="reference"
- type="text"
- class="textColor el-popover-left"
- >删除</el-button
- >
- </el-popconfirm>
- </template>
- </el-table-column> -->
- </el-table>
- <!-- 分页 -->
- <div style="margin: 20px 0">
- <el-pagination
- @size-change="handleSizeChange2"
- @current-change="handleCurrentChange2"
- :current-page="dcurrentPage"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="dlistTotal"
- >
- </el-pagination>
- </div>
- <el-row>
- <el-divider></el-divider>
- <el-row type="flex">
- <el-col :span="12">
- <h4 style="display: inline-block; margin-right: 20px">
- 条件信息
- </h4>
- </el-col>
- </el-row>
- <el-divider></el-divider>
- </el-row>
- <el-table
- :data="conditionList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column
- fixed
- type="index"
- label="序号"
- width="50"
- align="center"
- >
- </el-table-column>
- <el-table-column prop="name" label="限定条件" align="center">
- <template slot-scope="scope">
- {{ scope.row.name }}
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="150">
- <template slot-scope="scope">
- <template v-if="$parent.isShow == 5">
- <el-button
- type="text"
- size="small"
- @click="getCommonApi(scope.row)"
- >编辑</el-button
- >
- <el-popconfirm
- confirm-button-text="好的"
- cancel-button-text="不用了"
- icon="el-icon-info"
- icon-color="red"
- title="内容确定删除吗?"
- @onConfirm="handleCondition(scope.row.id, scope.$index)"
- >
- <el-button
- slot="reference"
- type="text"
- class="textColor el-popover-left"
- >删除</el-button
- >
- </el-popconfirm>
- </template>
- <el-button
- v-else
- type="text"
- size="small"
- @click="
- ($parent.isShow = 10), ($parent.policyId = scope.row.id)
- "
- >查看条件</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <el-row>
- <el-divider></el-divider>
- <el-row type="flex">
- <el-col :span="12">
- <h4 style="display: inline-block; margin-right: 20px">
- 经销商使用范围
- </h4>
- </el-col>
- </el-row>
- <el-divider></el-divider>
- </el-row>
- <template v-if="$parent.isShow != 5">
- <el-table
- v-loading="listLoading"
- :data="custoList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column
- fixed
- type="index"
- label="序号"
- width="50"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="customerNumber"
- label="经销商编码"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="customerName"
- label="经销商名称"
- align="center"
- >
- </el-table-column>
- </el-table>
- <!-- 分页 -->
- <div style="margin: 20px 0">
- <el-pagination
- @size-change="handleSizeChanges"
- @current-change="handleCurrentChanges"
- :current-page="currentPages"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="clistTotals"
- >
- </el-pagination>
- </div>
- </template>
- <template v-else>
- <el-row :gutter="20">
- <el-col :span="10" :offset="0">
- <h5>未选经销商</h5>
- <el-divider
- direction="horizontal"
- content-position="left"
- ></el-divider>
- <el-table
- :data="dataL"
- element-loading-text="Loading"
- border
- ref="multipleTable"
- height="480px"
- fit
- highlight-current-row
- @select-all="handleSelectionAllChange"
- @selection-change="handleSelectionChange"
- >
- <el-table-column
- type="selection"
- width="55"
- :selectable="selectable"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="number"
- label="经销商编码"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="name"
- label="经销商名称"
- align="center"
- >
- </el-table-column>
- </el-table>
- <!-- 分页 -->
- <div style="margin: 20px 0">
- <el-pagination
- @size-change="handleSizeChanges"
- @current-change="handleCurrentChanges"
- :current-page="currentPages"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="clistTotal"
- >
- </el-pagination>
- </div>
- </el-col>
- <el-col :span="4" class="middle_box" :offset="0">
- <el-col>
- <el-button
- size="small"
- @click="handleAllAdd"
- :disabled="type == 2"
- >全部添加</el-button
- ></el-col
- >
- <el-col>
- <el-button
- size="small"
- @click="handleAdd"
- :disabled="type == 2"
- >增加</el-button
- ></el-col
- >
- <el-col>
- <el-button
- size="small"
- :disabled="type == 1"
- @click="handleDelete"
- >删除</el-button
- ></el-col
- >
- <el-col>
- <el-button
- size="small"
- :disabled="type == 1"
- @click="handleAllDelete"
- >全部删除</el-button
- ></el-col
- >
- </el-col>
- <el-col :span="10" :offset="0">
- <h5>已选经销商</h5>
- <el-divider
- direction="horizontal"
- content-position="left"
- ></el-divider>
- <el-table
- v-loading="listLoading"
- :data="custoList"
- element-loading-text="Loading"
- border
- height="480px"
- fit
- highlight-current-row
- stripe
- @select-all="handleSelectionAllChange2"
- @selection-change="handleSelectionChange2"
- >
- <el-table-column type="selection" width="55" align="center">
- </el-table-column>
- <el-table-column
- prop="customerNumber"
- label="经销商编码"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="customerName"
- label="经销商名称"
- align="center"
- >
- </el-table-column>
- </el-table>
- <!-- 分页 -->
- <!-- <div style="margin: 20px 0">
- <el-pagination
- @size-change="handleSizeChanges"
- @current-change="handleCurrentChanges"
- :current-page="currentPages"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="clistTotals"
- >
- </el-pagination>
- </div> -->
- </el-col>
- </el-row>
- </template>
- <div
- class="descriptions"
- v-if="$parent.isShow == 8 && detail.examineStatus == 'WAIT'"
- >
- <el-row>
- <el-col :span="6">审核人</el-col>
- <el-col :span="6">{{ $store.getters.name }}</el-col>
- <el-col :span="6">审核结果</el-col>
- <el-col :span="6">
- <template>
- <el-radio-group v-model="examineStatus">
- <el-radio :label="'OK'">通过</el-radio>
- <el-radio :label="'FAIL'">驳回</el-radio>
- </el-radio-group>
- </template>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="4">审批说明</el-col>
- <el-col :span="20" class="col value" style="padding: 0">
- <el-input
- size="small"
- placeholder="请输入内容"
- v-model="remark"
- >
- </el-input>
- </el-col>
- </el-row>
- <el-row>
- <el-button type="primary" size="small" @click="handleSubmit"
- >审核通过</el-button
- >
- </el-row>
- </div>
- </div>
- <div>
- <el-button
- type="primary"
- v-if="$parent.isShow == 5"
- size="default"
- @click="handleSave"
- >保存</el-button
- >
- </div>
- </div>
- </div>
- <EditCondition v-else :id="cid" :policyId="cpolicyId" />
- </div>
- </template>
- <script>
- import {
- deleteCondition,
- deleteMaterialPolicy,
- getConditionList,
- getCrList,
- getCustomerList,
- getMaterialList,
- getPolicyDetail,
- toExamine,
- updatePolicy
- } from '@/api/policy_list'
- import EditCondition from './EditCondition'
- import ImageUpload from '@/components/Common/image-upload.vue'
- import { handleImport } from '@/utils/util'
- import Minxin from '@/mixin'
- export default {
- mixins: [Minxin],
- name: "examine",
- components: {
- EditCondition,
- ImageUpload,
- },
- data() {
- return {
- baseURL: "",
- dcurrentPage: 1,
- dpageSize: 10,
- dlistTotal: 0,
- currentPages: 1, // 当前页码
- pageSizes: 10, // 每页数量
- clistTotal: 0,
- input: "",
- remark: "",
- fileList: [],
- listLoading: false,
- imageUrl: "",
- dataList: [],
- examineStatus: "OK",
- options: {},
- value: "",
- detail: {},
- srcList: [],
- screenForm: {
- code: "",
- createBy: "",
- endCreateTime: "",
- endTime1: "",
- endTime2: "",
- examineBy: "",
- remark: "",
- startCreateTime: "",
- startTime1: "",
- startTime2: "",
- status: "",
- title: "",
- type: "",
- },
- conditionList: [],
- custoList: [],
- isEdit: 1,
- cid: "",
- cpolicyId: "",
- dataL: [],
- clistTotal: 0,
- clistTotals: 0,
- type: 1,
- fileList: [],
- importFileList: [],
- leftData: [],
- rightData: [],
- typeOptions: [
- {
- value: 'PROVISION',
- label: '配提'
- },
- {
- value: 'LIMIT',
- label: '限量'
- }
- ],
- };
- },
- created() {},
- computed: {
- comTitle() {
- let title = "详情页";
- if (this.$parent.isShow == 5) {
- title = "编辑页";
- } else if (this.$parent.isShow == 8) {
- title = "审核页";
- } else {
- title = "详情页";
- }
- return title;
- },
- },
- methods: {
- getList() {
- this.listLoading = true;
- getPolicyDetail({ policyId: this.$parent.id }).then((res) => {
- this.detail = res.data;
- this.srcList = [this.$imageUrl + this.detail.imgSrc];
- if (this.$parent.isShow == 5 && this.detail.imgSrc) {
- this.fileList = [
- {
- hover: "",
- url: this.detail.imgSrc,
- },
- ];
- }
- this.handletwoList();
- // 获取条件政策
- this.getConditionList();
- this.getCond();
- });
- },
- getCrList() {
- const customerParams = {
- pageNum: this.currentPage,
- pageSize: this.pageSize,
- keyword: this.region == 1 || this.region == "" ? "" : this.keyword,
- region: this.region == 1 ? this.keyword : "",
- };
- // 获取经销商列表
- getCrList(customerParams).then((res) => {
- for (let j = 0; j < this.custoList.length; j++) {
- for (let i = 0; i < res.data.records.length; i++) {
- if (res.data.records[i].id == this.custoList[j].customerId) {
- res.data.records[i].disabled = true;
- }
- }
- }
- this.dataL = res.data.records;
- for (let k = 0; k < this.dataL.length; k++) {
- (this.dataL[k].customerId = this.dataL[k].id),
- (this.dataL[k].customerName = this.dataL[k].name),
- (this.dataL[k].customerNumber = this.dataL[k].number);
- }
- console.log(this.dataL, "获取经销商列表");
- this.clistTotal = res.data.total;
- });
- },
- // 更改每页数量
- handleSizeChanges(val) {
- this.pageSizes = val;
- this.currentPages = 1;
- this.getCond();
- },
- // 更改当前页
- handleCurrentChanges(val) {
- this.currentPages = val;
- this.getCond();
- },
- // 更改每页数量
- handleSizeChange2(val) {
- this.dpageSize = val;
- this.dcurrentPage = 1;
- this.handletwoList();
- },
- // 更改当前页
- handleCurrentChange2(val) {
- this.dcurrentPage = val;
- this.handletwoList();
- },
- getCommonApi(row) {
- (this.isEdit = 2), (this.cid = row.id), (this.cpolicyId = row.policyId);
- console.log(
- this.cpolicyId,
- this.detail.code,
- this.cpolicyId == this.detail.code
- );
- },
- getCond() {
- this.listLoading = true;
- const custoParams = {
- pageNum: this.currentPages,
- pageSize: this.pageSizes,
- policyId: this.detail.code,
- };
- getCustomerList(custoParams).then((res) => {
- this.custoList = res.data.records;
- this.clistTotals = res.data.total;
- this.listLoading = false;
- this.getCrList();
- });
- },
- handleSubmit() {
- toExamine({
- examineStatus: this.examineStatus,
- policyId: this.$parent.id,
- examineRemark: this.remark,
- }).then((res) => {
- this.$successMsg("已提交审核");
- this.$parent.isShow = 1;
- this.$parent.getList();
- });
- },
- // 获取货品信息
- handletwoList() {
- // this.searchForm.type
- const paramss = {
- pageNum: this.dcurrentPage,
- pageSize: this.dpageSize,
- policyId: this.detail.code,
- saleTypeCode: "",
- };
- getMaterialList(paramss)
- .then((result) => {
- this.dataList = result.data.records;
- this.dlistTotal = result.data.total;
- this.listLoading = false;
- })
- .catch((err) => {
- console.error(err);
- });
- },
- // 导入
- async handleImport(param) {
- this.importLoading = true;
- const file = param.file;
- console.log(file, 123);
- const formData = new FormData();
- formData.append("file", file);
- formData.append("policyId", this.detail.code);
- // formData.append("mainId", this.detail.mainId);
- let result = await handleImport("/policy/material/import", formData);
- this.importLoading = false;
- this.importFileList = [];
- if (result.code == 200) {
- this.$alert(result.message, "导入成功", {
- confirmButtonText: "确定",
- });
- this.handletwoList();
- } else {
- this.$alert(result.message, "导入失败", {
- confirmButtonText: "确定",
- });
- }
- },
- handleCondition(id, index) {
- deleteCondition({ id }).then((res) => {
- // this.conditionList.splice(index, 1);
- // Object.assign(
- // this.$children[9].$data,
- // this.$children[9].$options.data()
- // );
- this.getConditionList();
- this.$successMsg("删除成功");
- });
- },
- getConditionList() {
- const condParams = {
- policyId: this.detail.code,
- };
- getConditionList(condParams).then((res) => {
- this.conditionList = res.data;
- });
- },
- //删除
- hanleDelete(id) {
- const params = { policyMaterialId: id };
- deleteMaterialPolicy(params).then((res) => {
- this.$successMsg("删除成功");
- this.handletwoList();
- });
- },
- /**
- * 根据条件禁用行复选框
- * 函数返回值为false则禁用选择(反之亦然)
- * @param {Object} row - 行数据
- * @param {String} index - 索引值
- * @return Boolean
- */
- selectable: function (row, index) {
- // row.disabled == undefined 才能被选中
- if (row.disabled == undefined || row.disabled == false) {
- return true;
- } else {
- return false;
- }
- // 函数必须有返回值且是布尔值
- // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
- // 如果没有返回值则默认返回false(全部无法选中)
- },
- handleSelectionAllChange(e) {
- this.leftData = e;
- this.type = 1;
- },
- handleSelectionChange(e) {
- this.leftData = e;
- this.type = 1;
- },
- handleSelectionAllChange2(e) {
- this.rightData = e;
- this.type = 2;
- },
- handleSelectionChange2(e) {
- this.rightData = e;
- this.type = 2;
- },
- handleLeft(e) {
- this.type = 1;
- },
- handleRight(e) {
- this.type = 2;
- },
- handleAllAdd() {
- if (this.type == 1 && this.leftData.length) {
- for (let i = 0; i < this.dataL.length; i++) {
- for (let j = 0; j < this.leftData.length; j++) {
- if (this.dataL[i].id == this.leftData[j].id) {
- this.dataL[i].disabled = true;
- }
- }
- }
- this.custoList = [...this.custoList, ...this.leftData];
- this.$refs.multipleTable.clearSelection();
- } else {
- this.$errorMsg("请选择要添加的经销商");
- }
- },
- handleAllDelete() {
- if (this.type == 2 && this.rightData.length) {
- for (let i = 0; i < this.dataL.length; i++) {
- for (let j = 0; j < this.rightData.length; j++) {
- if (this.dataL[i].id == this.rightData[j].customerId) {
- this.$set(this.dataL[i], "disabled", false);
- }
- }
- }
- const arr = this.resArr(this.custoList, this.rightData);
- this.custoList = arr;
- } else {
- this.$errorMsg("请选择要删除的经销商");
- }
- },
- handleAdd() {
- if (this.type == 1 && this.leftData.length) {
- for (let i = 0; i < this.dataL.length; i++) {
- for (let j = 0; j < this.leftData.length; j++) {
- if (this.dataL[i].id == this.leftData[j].id) {
- this.dataL[i].disabled = true;
- }
- }
- }
- this.custoList = [...this.custoList, ...this.leftData];
- this.leftData = [];
- this.$refs.multipleTable.clearSelection();
- } else {
- this.$errorMsg("请选择要添加的经销商");
- }
- },
- handleDelete() {
- if (this.type == 2 && this.rightData.length) {
- for (let i = 0; i < this.dataL.length; i++) {
- for (let j = 0; j < this.rightData.length; j++) {
- if (this.dataL[i].id == this.rightData[j].customerId) {
- this.$set(this.dataL[i], "disabled", false);
- }
- }
- }
- const arr = this.resArr(this.custoList, this.rightData);
- this.custoList = arr;
- } else {
- this.$errorMsg("请选择要删除的经销商");
- }
- },
- //去掉相同数据
- resArr(arr1, arr2) {
- return arr1.filter((v) => arr2.every((val) => val.id != v.id));
- },
- async handleSave() {
- if (this.custoList.length) {
- var arr = [];
- this.custoList.forEach((el) => {
- arr.push({
- customerId: el.customerId,
- customerName: el.customerName,
- customerNumber: el.customerNumber,
- lastOrderTime: "",
- limitTakeNum: 0,
- policyId: this.detail.code,
- policyTitle: "",
- remark: "",
- });
- });
- const params = {
- ...this.detail,
- policyCustomers: arr,
- imgSrc: this.fileList.length ? this.fileList[0].url : "",
- };
- await updatePolicy(params);
- await this.getCond();
- this.$successMsg("编辑成功");
- this.fileList = [];
- this.$parent.isShow = 1;
- }
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .el-col {
- overflow: hidden;
- }
- .value{
- ::v-deep .el-input__prefix{
- display: none;
- }
- }
- .descriptions {
- // border: #EBEEF5;
- border: 1px solid #ebeef5;
- border-bottom: none;
- .el-row {
- height: 40px;
- line-height: 40px;
- }
- .el-col:nth-child(odd) {
- background-color: #ebeef5;
- }
- .el-col {
- padding: 0 15px;
- height: 100%;
- border-bottom: 1px solid #ebeef5;
- }
- }
- .el-divider--horizontal {
- margin: 20px 0;
- }
- .col {
- height: 100px;
- }
- .import-btn {
- margin-right: 10px;
- display: inline-block;
- }
- ::v-deep .el-input__icon .el-icon-time{
- display: none;
- }
- .middle_box {
- margin-top: 80px;
- text-align: center;
- height: 430px;
- display: flex;
- flex-direction: column;
- align-content: center;
- justify-content: space-between;
- align-items: center;
- }
- .img-box {
- height: 150px;
- display: flex;
- align-items: center;
- }
- </style>
|