1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174 |
- <template>
- <div class="mymain-container">
- <!-- 经销商信息 -->
- <slot name="header">
- <el-row class="radio">
- <el-radio-group v-model="region">
- <el-radio label="0">指定经销商</el-radio>
- <el-radio
- v-if="!adminWebsit || !adminWebsit.websitNumber || (adminWebsit && adminWebsit.websitNumber === 'GZ')"
- label="1"
- >广州经销商</el-radio>
- <el-radio
- v-if="!adminWebsit || !adminWebsit.websitNumber || (adminWebsit && adminWebsit.websitNumber === 'FS')"
- label="2"
- >佛山经销商</el-radio>
- </el-radio-group>
- <template v-if="region == 0">
- <el-upload
- class="import-btn"
- :action="baseURL + 'student/import'"
- :http-request="handleImport"
- :file-list="importFileList"
- :show-file-list="false"
- >
- <el-button type="primary" size="mini">导入经销商</el-button>
- </el-upload>
- <el-button type="primary" size="mini" @click="hanleDownloadFiles">下载模板</el-button>
- </template>
- </el-row>
- <el-row v-if="region == 0" type="flex">
- <el-col :xs="24" :sm="12" :lg="14">
- <el-input v-model="keyword" placeholder="查找经销商" size="mini" />
- </el-col>
- <el-col
- :xs="24"
- :sm="1"
- :lg="1"
- style="margin-left: 10px"
- ><el-button size="mini" @click="submitScreenForm">确定</el-button></el-col>
- <el-col
- :xs="24"
- :sm="1"
- :lg="1"
- style="margin-left: 20px"
- ><el-button size="mini" @click="resetScreenForm">重置</el-button></el-col>
- </el-row>
- </slot>
- <el-row v-if="region == 0" :gutter="20">
- <el-col :span="10" :offset="0">
- <h5>未选经销商</h5>
- <el-divider direction="horizontal" content-position="left" />
- <div class="table">
- <el-table
- ref="multipleTable"
- :data="dataL"
- element-loading-text="Loading"
- border
- height="480px"
- fit
- highlight-current-row
- @select-all="handleSelectionAllChange"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" width="55" :selectable="selectable" align="left" />
- <!-- <el-table-column-->
- <!-- prop="number"-->
- <!-- label="经销商编码"-->
- <!-- align="left"-->
- <!-- />-->
- <el-table-column
- prop="name"
- label="经销商名称"
- align="left"
- ><template slot-scope="scope">
- <CopyButton :copy-text="scope.row.name" />
- <span>{{ scope.row.name }}</span>
- <span class="red">{{ scope.row.number }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 分页 -->
- <div style="margin: 20px 0">
- <el-pagination
- :current-page="currentPages"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="clistTotal"
- @size-change="handleSizeChanges"
- @current-change="handleCurrentChanges"
- />
- </div>
- </el-col>
- <el-col :span="4" class="middle_box" :offset="0">
- <el-col> <el-button size="mini" :disabled="type == 2" @click="handleAllAdd">全部添加</el-button></el-col>
- <el-col> <el-button size="mini" :disabled="type == 2" @click="handleAdd">增加</el-button></el-col>
- <el-col> <el-button size="mini" :disabled="type == 1" @click="handleDelete">删除</el-button></el-col>
- <el-col> <el-button size="mini" :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" />
- <div class="table">
- <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="left" />
- <!-- <el-table-column-->
- <!-- prop="customerNumber"-->
- <!-- label="经销商编码"-->
- <!-- align="left"-->
- <!-- />-->
- <el-table-column prop="customerName" label="经销商名称" align="left">
- <template slot-scope="scope">
- <CopyButton :copy-text="scope.row.customerName" />
- <span>{{ scope.row.customerName }}</span>
- <span class="red">{{ scope.row.customerNumber }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </el-col>
- </el-row>
- <!-- 销售政策类型 ———— 限量-->
- <div>
- <div>
- <div>
- <h4 style="display: inline-block; margin-right: 20px">经销商上限</h4>
- <el-divider />
- </div>
- <div style="margin: 20px 0">
- <el-upload
- class="import-btn cus-btn"
- :action="baseURL + 'student/import'"
- :http-request="handleImports"
- :file-list="importFileList"
- :show-file-list="false"
- >
- <el-button type="primary" size="mini">导入经销商</el-button>
- </el-upload>
- <el-button type="primary" size="mini" @click="hanleDownloadFilesPolicy">下载模板</el-button>
- </div>
- <el-row style="margin: 20px 0">
- <el-col :span="12">
- <el-input v-model="keyword2" placeholder="查找经销商" size="mini" />
- </el-col>
- <el-col :span="10" style="margin-left: 20px">
- <el-button size="mini" @click="submitScreenForm2">确定</el-button>
- <el-button size="mini" @click="resetScreenForm2">重置</el-button>
- <template v-if="batch">
- <!-- <el-button
- v-if="list.length"
- type="primary"
- size="mini"
- @click="()=>{
- visible = true
- handelBatchData()
- }"
- >批量修改上限</el-button> -->
- <!-- <el-button
- v-if="list.length"
- type="primary"
- size="mini"
- @click="()=>{
- maxBuyNumVisible = true
- handelBatchData()
- }"
- >批量修改组数</el-button> -->
- </template>
- </el-col>
- </el-row>
- <div style="font-size: 14px">
- 注:经销商最大提货套数仅与经销商相关联,与机型没有限制关联;机型订货上线仅对机型做限制
- </div>
- </div>
- <div>
- <div class="table">
- <el-table
- v-loading="clistLoading"
- :data="list"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- @select-all="handleSelectionAllChange2"
- @selection-change="handleSelectionChange2"
- >
- <el-table-column type="index" width="50" />
- <el-table-column
- prop="customerNumber"
- label="经销商编号
- "
- align="left"
- min-width="300"
- >
- <template slot-scope="scope">
- <CopyButton :copy-text="scope.row.customerNumber" />
- <span>{{ scope.row.customerNumber }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="customerName" label="经销商名称" align="left" min-width="300">
- <template slot-scope="scope">
- <CopyButton :copy-text="scope.row.customerName" />
- <span>{{ scope.row.customerName }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="materialName" label="物料名称" align="left" min-width="200">
- <template slot-scope="scope">
- {{ scope.row.materialName }}
- </template>
- </el-table-column>
- <el-table-column prop="materialNumber" label="物料编号" align="left" min-width="200">
- <template slot-scope="scope">
- {{ scope.row.materialNumber }}
- </template>
- </el-table-column>
- <el-table-column prop="limitQty" label="订货上限" align="left" min-width="200">
- <template slot-scope="scope">
- {{ scope.row.limitQty }}
- </template>
- </el-table-column>
- <el-table-column prop="orderNums" label="已下订单数" align="left" min-width="200">
- <template slot-scope="scope">
- {{ scope.row.orderNums }}
- </template>
- </el-table-column>
- <el-table-column prop="examineOrderNums" label="已审订单数" align="left" min-width="200">
- <template slot-scope="scope">
- {{ scope.row.examineOrderNums }}
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 分页 -->
- <div style="margin: 20px 0">
- <el-pagination
- :current-page="policyList.currentPages"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="cTotal"
- @size-change="handleSizeChanges2"
- @current-change="handleCurrentChanges2"
- />
- </div>
- </div>
- <div>
- <div>
- <h4 style="display: inline-block; margin-right: 20px">经销商配提套数上限</h4>
- <el-divider />
- </div>
- <div style="margin: 20px 0">
- <el-upload
- class="import-btn cus-btn"
- :action="baseURL + 'policy/limit/group/import'"
- :http-request="handleImportPolicyLimitGroupPolicy"
- :file-list="importFileList"
- :show-file-list="false"
- >
- <el-button type="primary" size="mini">导入经销商配提套数</el-button>
- </el-upload>
- <ExportButton
- style="display: inline-block;margin-right: 10px;"
- :ex-url="'policy/limit/group/export'"
- ex-text="导出经销商配提套数"
- :ex-params="{ policyId: comCode || code }"
- />
- <el-button type="primary" size="mini" @click="hanleDownloadFilesPolicyLimitGroupPolicy">下载模板</el-button>
- <!-- <el-button
- v-if="policyLimitGroupList.length"
- type="primary"
- size="mini"
- @click="()=>{
- limitGroupvisible = true
- handelLimitGroupData()
- }"
- >批量修改配提套数上限</el-button> -->
- </div>
- <el-row style="margin: 20px 0">
- <el-col :span="12">
- <el-input v-model="policyKeyWord" placeholder="查找经销商" size="mini" />
- </el-col>
- <el-col :span="10" style="margin-left: 20px">
- <el-button size="mini" @click="getPolicyLimitGroupList">确定</el-button>
- <el-button size="mini" @click="onPolicyReset">重置</el-button>
- </el-col>
- </el-row>
- <div>
- <div class="table">
- <el-table
- v-loading="policyLoading"
- :data="policyLimitGroupList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column type="index" width="50" />
- <el-table-column
- prop="customerNumber"
- label="经销商编号
- "
- align="left"
- min-width="300"
- >
- <template slot-scope="scope">
- <CopyButton :copy-text="scope.row.customerNumber" />
- <span>{{ scope.row.customerNumber }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="customerName" label="经销商名称" align="left" min-width="300">
- <template slot-scope="scope">
- <CopyButton :copy-text="scope.row.customerName" />
- <span>{{ scope.row.customerName }}</span>
- </template>
- </el-table-column>
- <template v-if="policyType == 'LIMIT'">
- <el-table-column prop="minBuyNum" label="最小提货数量" align="left" min-width="200">
- <template slot-scope="scope">
- {{ scope.row.minBuyNum }}
- </template>
- </el-table-column>
- <el-table-column prop="maxBuyNum" label="最大提货组数" align="left" min-width="200">
- <template slot-scope="scope">
- {{ scope.row.maxBuyNum }}
- </template>
- </el-table-column>
- </template>
- <template v-else>
- <el-table-column prop="groupLimitNum" label="配提上限组数" align="left" min-width="200">
- <template slot-scope="scope">
- {{ scope.row.groupLimitNum }}
- </template>
- </el-table-column>
- </template>
- <!-- <el-table-column prop="orderNums" label="配提上限已下订单数" align="left">
- <template slot-scope="scope">
- {{ scope.row.orderNums }}
- </template>
- </el-table-column>
- <el-table-column prop="examineOrderNums" label="配提上限已审订单数" align="left">
- <template slot-scope="scope">
- {{ scope.row.examineOrderNums }}
- </template>
- </el-table-column> -->
- </el-table>
- </div>
- <!-- 分页 -->
- <div style="margin: 20px 0">
- <el-pagination
- :current-page="policyCurrentPages"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="policyListTotal"
- @size-change="handlePolicySizeChanges"
- @current-change="handlePolicyCurrentChanges"
- />
- </div>
- </div>
- </div>
- </div>
- <!-- 操作按钮 -->
- <slot name="footer">
- <el-row style="margin: 20px 0 0 0">
- <el-button type="primary" size="mini" @click="handleSave">
- {{ comCode ? '保存' : '提交审核' }}
- </el-button>
- <el-button type="primary" size="mini" @click="handleReset">重置</el-button>
- </el-row>
- </slot>
- </div>
- </template>
- <script>
- import {
- deleteCondition,
- deleteMaterialPolicy,
- getConditionList,
- getCrList,
- getCustomerList,
- getPolicyList,
- updateLimitGrouppdate,
- updateLimitBatchupdate,
- getPolicyLimitGroupList
- } from '@/api/policy_list'
- import { downloadFiles, handleImport } from '@/utils/util'
- import ImageUpload from '@/components/Common/image-upload.vue'
- import Minxin from '@/mixin'
- export default {
- name: 'Examine',
- components: {
- // eslint-disable-next-line vue/no-unused-components
- ImageUpload
- },
- mixins: [Minxin],
- // eslint-disable-next-line vue/require-prop-types
- props: ['code', 'yregion', 'policyType', 'batch'],
- data() {
- return {
- keyword: '',
- keyword2: '',
- region: '0',
- baseURL: '',
- dcurrentPage: 1,
- dpageSize: 10,
- dlistTotal: 0,
- currentPages: 1, // 当前页码
- pageSizes: 10, // 每页数量
- 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,
- importFileList: [],
- leftData: [],
- rightData: [],
- typeOptions: [
- {
- value: 'PROVISION',
- label: '配提'
- },
- {
- value: 'LIMIT',
- label: '限量'
- }
- ],
- comCode: '',
- policyList: {
- pageNum: 1,
- pageSize: 10,
- policyId: '',
- keyword: '',
- currentPages: 1
- },
- list: [],
- cTotal: 1,
- clistLoading: false,
- visible: false,
- maxBuyNumVisible: false,
- tableData: [],
- tableAttributes: {
- selectColumn: true
- },
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- limitQty: null,
- maxBuyNum: null,
- limitQtyKeyWord: '',
- maxBuyNumKeyWord: '',
- selectedData: [],
- batchCurrentPages: 1,
- batchPageSizes: 10,
- batchTotal: 0,
- policyLimitGroupList: [],
- policyLoading: false,
- policyCurrentPages: 1,
- policyPageSize: 10,
- policyListTotal: 0,
- policyKeyWord: '',
- limitGroupvisible: false,
- limitGroupNum: 0,
- limitGroupKeyWord: '',
- limitCurrentPages: 1,
- limitTotal: 0,
- limitPageSizes: 10,
- limitTableData: [],
- buyNumvisible: false,
- minBuyNum: null
- }
- },
- computed: {
- adminWebsit() {
- return JSON.parse(localStorage.getItem('supply_user')).adminWebsit
- },
- columns() {
- return [
- {
- columnAttributes: {
- label: '经销商编码',
- prop: 'customerNumber'
- }
- },
- {
- columnAttributes: {
- label: '经销商名称',
- prop: 'customerName'
- }
- },
- {
- columnAttributes: {
- label: '物料名称',
- prop: 'materialName'
- }
- },
- {
- columnAttributes: {
- label: '物料编号',
- prop: 'materialNumber'
- }
- }
- ]
- },
- limitColumns() {
- return [
- {
- columnAttributes: {
- label: '经销商编码',
- prop: 'customerNumber'
- }
- },
- {
- columnAttributes: {
- label: '经销商名称',
- prop: 'customerName'
- }
- }
- ]
- }
- },
- watch: {
- dataL: (val, oval) => {
- console.log(val, oval)
- }
- },
- created() {
- this.comCode = this.code
- if (this.comCode) {
- if (this.yregion || this.yregion == 0) {
- this.region = '' + this.yregion
- }
- this.getCond()
- this.getPolicyList()
- this.getPolicyLimitGroupList()
- }
- },
- methods: {
- getList() {
- this.getCrList()
- },
- onChange() {
- this.getCrList()
- },
- getCrList() {
- const customerParams = {
- pageNum: this.currentPages,
- pageSize: this.pageSizes,
- keyword: this.keyword,
- region: '',
- websitNumber: this.region == '0' && this.adminWebsit ? this.adminWebsit.websitNumber : ''
- }
- // 获取经销商列表
- 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)
- }
- this.clistTotal = res.data.total
- })
- },
- getPolicyList() {
- this.clistLoading = true
- getPolicyList({
- pageNum: this.policyList.currentPages,
- pageSize: this.policyList.pageSize,
- policyId: this.comCode || this.code,
- keyword: this.keyword2
- }).then(res => {
- this.list = res.data.records
- console.log(this.list, '785787')
- this.cTotal = res.data.total
- this.clistLoading = false
- })
- },
- // 更改每页数量
- handleSizeChanges2(val) {
- this.policyList.pageSizes = val
- this.policyList.currentPages = 1
- this.getPolicyList()
- },
- // 更改当前页
- handleCurrentChanges2(val) {
- this.policyList.currentPages = val
- this.getPolicyList()
- },
- // 更改每页数量
- handleSizeChanges(val) {
- this.pageSizes = val
- this.currentPages = 1
- this.getCrList()
- },
- // 更改当前页
- handleCurrentChanges(val) {
- this.currentPages = val
- this.getCrList()
- },
- // 提交筛选表单
- submitScreenForm() {
- this.currentPages = 1
- this.getCrList()
- },
- // 重置筛选表单
- resetScreenForm() {
- this.keyword = ''
- this.currentPages = 1
- this.getCrList()
- },
- // 提交筛选表单
- submitScreenForm2() {
- this.policyList.currentPages = 1
- this.getPolicyList()
- },
- // 重置筛选表单
- resetScreenForm2() {
- this.keyword2 = ''
- this.policyList.currentPages = 1
- this.getPolicyList()
- },
- // 去掉相同数据
- resArr(arr1, arr2) {
- return arr1.filter(v => arr2.every(val => val.id !== v.id))
- },
- // 导入经销商模板
- async handleImport(param) {
- this.importLoading = true
- const file = param.file
- const formData = new FormData()
- formData.append('file', file)
- // formData.append('policyId', this.searchForm.code)
- // formData.append("mainId", this.searchForm.mainId);
- const result = await handleImport('policy/importCustomer', formData)
- console.log(result)
- this.importLoading = false
- this.importFileList = []
- if (result.code === 200) {
- await this.$alert(result.message, '导入成功', {
- confirmButtonText: '确定'
- })
- for (let i = 0; i < result.data.length; i++) {
- result.data[i].customerNumber = result.data[i].number
- result.data[i].customerName = result.data[i].name
- result.data[i].customerId = result.data[i].id
- }
- if (this.custoList.length) {
- this.custoList = [...this.custoList, ...this.resArr(this.custoList, result.data)]
- } else {
- this.custoList = result.data
- }
- } else {
- await this.$alert(result.message, '导入失败', {
- confirmButtonText: '确定'
- })
- }
- },
- async handleImports(param) {
- this.importLoading = true
- const file = param.file
- const formData = new FormData()
- formData.append('file', file)
- formData.append('policyId', this.comCode || this.code)
- formData.append('type', this.policyType)
- // formData.append("mainId", this.searchForm.mainId);
- const result = await handleImport('policy/limit/import', formData)
- console.log(result)
- this.importLoading = false
- this.importFileList = []
- if (result.code === 200) {
- await this.$alert(result.message, '导入成功', {
- confirmButtonText: '确定'
- })
- this.list = result.data
- this.getPolicyList()
- } else {
- await this.$alert(result.message, '导入失败', {
- confirmButtonText: '确定'
- })
- }
- },
- // 下载经销商模板
- hanleDownloadFiles() {
- downloadFiles('policy/downloadCustomer')
- },
- hanleDownloadFilesPolicy() {
- downloadFiles('policy/limit/download')
- },
- getCommonApi(row) {
- (this.isEdit = 2), (this.cid = row.id), (this.cpolicyId = row.policyId)
- console.log(this.cpolicyId, this.comCode, this.cpolicyId === this.comCode)
- },
- getCond() {
- this.listLoading = true
- const custoParams = {
- pageNum: 1,
- pageSize: -1,
- policyId: this.comCode || this.code
- }
- getCustomerList(custoParams).then(res => {
- this.custoList = res.data.records
- console.log(this.custoList, '已选的')
- this.clistTotals = res.data.total
- this.listLoading = false
- // this.getCrList()
- })
- },
- handleCondition(id, index) {
- deleteCondition({ id }).then(res => {
- this.getConditionList()
- this.$successMsg('删除成功')
- })
- },
- getConditionList() {
- const condParams = {
- policyId: this.comCode
- }
- getConditionList(condParams).then(res => {
- this.conditionList = res.data
- })
- },
- // 删除
- hanleDelete(id) {
- const params = { policyMaterialId: id }
- deleteMaterialPolicy(params).then(res => {
- this.$successMsg('删除成功')
- })
- },
- /**
- * 根据条件禁用行复选框
- * 函数返回值为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)
- // this.dataL[i].disabled = false
- }
- }
- }
- this.custoList = this.resArr(this.custoList, this.rightData)
- this.$refs.multipleTable.clearSelection()
- } 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)
- // this.dataL[i].disabled = false
- }
- }
- }
- this.custoList = this.resArr(this.custoList, this.rightData)
- this.$refs.multipleTable.clearSelection()
- } else {
- this.$errorMsg('请选择要删除的经销商')
- }
- },
- // 提交数据
- async handleSave() {
- this.$emit('handlEditPolicy', this.custoList, this.region)
- },
- handleReset() {
- this.dataR = this.rightData = []
- this.keyword = ''
- this.$emit('handleReset')
- },
- selectionChange(data) {
- this.selectedData = data
- },
- handelBatchData(search) {
- if (search) {
- this.batchCurrentPages = 1
- }
- getPolicyList({
- pageNum: this.batchCurrentPages,
- pageSize: this.batchPageSizes,
- policyId: this.comCode || this.code,
- keyword: this.limitQtyKeyWord
- }).then(res => {
- this.tableData = res.data.records
- this.batchTotal = res.data.total
- })
- },
- handleDialogVisible() {
- this.visible = false
- this.buyNumvisible = false
- this.maxBuyNumVisible = false
- this.batchCurrentPages = 1
- this.batchPageSizes = 10
- this.limitQty = 0
- this.maxBuyNum = null
- this.minBuyNum = 0
- this.limitQtyKeyWord = ''
- this.maxBuyNumKeyWord = ''
- },
- onSubmit(e, type) {
- console.log(type)
- if (!this.selectedData.length) {
- this.$errorMsg('不能为空,请选择')
- return
- }
- let params = {}
- const customerIds = this.selectedData
- .map(k => {
- return k.customerId
- })
- .join(',')
- const ids = this.selectedData
- .map(k => {
- return k.id
- })
- .join(',')
- if (type) {
- if (this.limitQty <= 0) {
- this.$errorMsg('购买量上限不能小于0')
- return
- }
- params = {
- customerIds,
- ids,
- limitQty: this.limitQty
- }
- } else {
- if (this.minBuyNum <= 0 || !this.minBuyNum) {
- this.$errorMsg('最小提货数量不能小于0')
- return
- }
- params = {
- customerIds,
- ids,
- minBuyNum: this.minBuyNum,
- maxBuyNum: this.maxBuyNum
- }
- }
- updateLimitBatchupdate(params).then(res => {
- this.handleDialogVisible()
- this.getPolicyList()
- this.$successMsg('批量修改成功')
- })
- },
- handleBatchSizeChanges(val) {
- this.batchCurrentPages = 1
- this.batchPageSizes = val
- this.handelBatchData()
- },
- onReset() {
- this.limitQtyKeyWord = ''
- this.maxBuyNumKeyWord = ''
- this.handelBatchData()
- },
- handleBatchCurrentChanges(val) {
- this.batchCurrentPages = val
- this.handelBatchData()
- },
- getPolicyLimitGroupList() {
- this.policyLoading = true
- getPolicyLimitGroupList({
- pageNum: this.policyCurrentPages,
- pageSize: this.policyPageSize,
- policyId: this.comCode || this.code,
- keyword: this.policyKeyWord
- }).then(res => {
- this.policyLimitGroupList = res.data.records
- this.policyListTotal = res.data.total
- this.policyLoading = false
- })
- },
- handlePolicySizeChanges(val) {
- this.policyCurrentPages = 1
- this.policyPageSize = val
- this.getPolicyLimitGroupList()
- },
- onPolicyReset() {
- this.policyCurrentPages = 1
- this.policyPageSize = 10
- this.policyKeyWord = ''
- this.getPolicyLimitGroupList()
- },
- handlePolicyCurrentChanges(val) {
- this.policyCurrentPages = val
- this.getPolicyLimitGroupList()
- },
- hanleDownloadFilesPolicyLimitGroupPolicy() {
- downloadFiles('policy/limit/group/download')
- },
- async handleImportPolicyLimitGroupPolicy(param) {
- this.importLoading = true
- const file = param.file
- const formData = new FormData()
- formData.append('file', file)
- formData.append('policyId', this.comCode || this.code)
- // formData.append('type', this.policyType)
- // formData.append("mainId", this.searchForm.mainId);
- const result = await handleImport('policy/limit/group/import', formData)
- this.importLoading = false
- this.importFileList = []
- if (result.code === 200) {
- await this.$alert(result.message, '导入成功', {
- confirmButtonText: '确定'
- })
- // this.policyLimitGroupList = result.data
- this.getPolicyLimitGroupList()
- } else {
- await this.$alert(result.message, '导入失败', {
- confirmButtonText: '确定'
- })
- }
- },
- handelLimitGroupData(search) {
- if (search) {
- this.limitCurrentPages = 1
- }
- this.limitGroupvisible = true
- getPolicyLimitGroupList({
- pageNum: this.limitCurrentPages,
- pageSize: this.limitPageSizes,
- policyId: this.comCode || this.code,
- keyword: this.limitGroupKeyWord
- }).then(res => {
- this.limitTableData = res.data.records
- this.limitTotal = res.data.total
- })
- },
- onLimitSubmit(type) {
- if (!this.selectedData.length) {
- this.$errorMsg('不能为空,请选择')
- return
- }
- if (this.limitGroupNum <= 0) {
- this.$errorMsg('配提套数上限不能小于0')
- return
- }
- const ids = this.selectedData
- .map(k => {
- return k.id
- })
- .join(',')
- const params = {
- ids,
- limitGroupNum: this.limitGroupNum
- }
- updateLimitGrouppdate(params).then(res => {
- this.handleLimitDialogVisible()
- this.$successMsg('批量修改成功')
- this.getPolicyLimitGroupList()
- })
- },
- handleLimitSizeChanges(val) {
- this.limitCurrentPages = 1
- this.limitPageSizes = val
- this.handelLimitGroupData()
- },
- handleLimitCurrentChanges(val) {
- this.limitCurrentPages = val
- this.handelLimitGroupData()
- },
- onLimitReset() {
- this.limitGroupKeyWord = ''
- this.handelLimitGroupData()
- },
- handleLimitDialogVisible() {
- this.limitGroupvisible = false
- this.limitGroupNum = 0
- this.limitGroupKeyWord = ''
- this.limitCurrentPages = 1
- this.limitTotal = 0
- this.limitPageSizes = 10
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .radio {
- display: flex;
- align-items: center;
- margin: 0 0 20px 0;
- }
- .import-btn {
- margin: 0 20px;
- }
- .cus-btn {
- margin: 0;
- }
- .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;
- }
- .red {
- color: #f00;
- }
- </style>
|