123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726 |
- <template>
- <div>
- <a-card size="small" :bordered="false" class="salesManagementList-wrap">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper" style="margin: 0;">
- <a-form layout="inline">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="创建时间">
- <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="客户名称">
- <dealerSubareaScopeList ref="dealerSubareaScopeList" id="salesManagementList-buyerName" @change="custChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="销售单号">
- <a-input id="salesManagementList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="采购单号">
- <a-input id="salesManagementList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="备货打印状态">
- <v-select
- v-model="queryParam.printStatus"
- ref="printStatus"
- id="salesManagementList-printStatus"
- code="PRINT_STATUS"
- placeholder="请选择打印状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="业务状态">
- <v-select
- v-model="queryParam.billStatus"
- ref="billStatus"
- id="salesManagementList-billStatus"
- code="SALES_BILL_STATUS"
- placeholder="请选择业务状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="财务状态">
- <v-select
- v-model="queryParam.financialStatus"
- ref="financialStatus"
- id="salesManagementList-financialStatus"
- code="FINANCIAL_RECEIVE_STATUS"
- placeholder="请选择财务状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="单据来源">
- <v-select
- v-model="queryParam.salesBillSource"
- ref="salesBillSource"
- id="salesManagementList-salesBillSource"
- code="SALES_SOURCE"
- placeholder="请选择单据来源"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="所在区域">
- <subarea ref="subarea" id="salesManagementList-subarea" @change="subareaChange"></subarea>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
- <Area id="salesManagementList-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="出库仓库">
- <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="促销单">
- <v-select
- v-model="queryParam.promoFlag"
- ref="cxFlag"
- code="FLAG"
- placeholder="请选择是否促销单"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="24" :sm="24" style="text-align: center;">
- <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
- <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
- <a-button
- style="margin-left: 10px"
- type="primary"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- v-if="$hasPermissions('B_sales_export')"
- >导出</a-button>
- <a @click="advanced=!advanced" style="margin-left: 8px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- </a-card>
- <a-card size="small" :bordered="false" class="salesManagementList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 操作按钮 -->
- <div class="table-operator" style="display: flex;justify-content: space-between;align-items: center;">
- <div style="padding-right: 15px;"><a-button type="primary" class="button-error" v-if="$hasPermissions('B_salesAdd')" @click="handleAdd">新增</a-button></div>
- <div style="flex-grow: 1;display: flex;justify-content: space-between;align-items: center;">
- <div>
- <div>
- 总单数:<strong>{{ totalData&&(totalData.totalRecord || totalData.totalRecord==0) ? totalData.totalRecord : '--' }}</strong>;
- 总款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
- 总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
- 已下推数量:<strong>{{ totalData&&(totalData.totalPushedQty || totalData.totalPushedQty==0) ? totalData.totalPushedQty : '--' }}</strong>;
- 已发货数量:<strong>{{ totalData&&(totalData.totalDispatchQty || totalData.totalDispatchQty==0) ? totalData.totalDispatchQty : '--' }}</strong>;
- 已取消数量:<strong>{{ totalData&&(totalData.totalCancelQty || totalData.totalCancelQty==0) ? totalData.totalCancelQty : '--' }}</strong>;
- 待下推数量:<strong>{{ totalData&&(totalData.totalUnpushedQty || totalData.totalUnpushedQty==0) ? totalData.totalUnpushedQty : '--' }}</strong>;
- </div>
- <div v-if="$hasPermissions('M_salesQueryList_salesPrice')">
- 总售价:<strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? toThousands(totalData.totalAmount) : '--' }}</strong>;
- 已下推金额:<strong>{{ totalData&&(totalData.totalPushedAmount || totalData.totalPushedAmount==0) ? toThousands(totalData.totalPushedAmount) : '--' }}</strong>;
- 已取消金额:<strong>{{ totalData&&(totalData.totalCancelAmount || totalData.totalCancelAmount==0) ? toThousands(totalData.totalCancelAmount) : '--' }}</strong>;
- 待下推金额:<strong>{{ totalData&&(totalData.totalUnpushedAmount || totalData.totalUnpushedAmount==0) ? toThousands(totalData.totalUnpushedAmount) : '--' }}</strong>;
- 已发货金额:<strong>{{ totalData&&(totalData.totalDispatchAmount || totalData.totalDispatchAmount==0) ? toThousands(totalData.totalDispatchAmount) : '--' }}</strong>;
- </div>
- </div>
- <div>
- <a-checkbox v-model="showCancelNum"><span style="display: inline-block;margin-top: 1px;">显示取消数量</span></a-checkbox>
- </div>
- </div>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+75+'px' }"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- bordered>
- <!-- 销售单号 -->
- <template slot="salesBillNo" slot-scope="text, record">
- <span v-if="$hasPermissions('B_salesDetail')" class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
- <span v-else>{{ record.salesBillNo }}</span>
- <a-badge :count="'改'+record.changeTimes" :number-style="{ zoom:'80%' }" v-if="record.changeTimes>0"></a-badge>
- <a-badge count="促" v-if="record.promoFlag==1" :number-style="{ backgroundColor: '#52c41a', zoom:'80%' }"></a-badge>
- </template>
- <!-- 提交时间 -->
- <!-- submitDateTit -->
- <template slot="submitDateTit">
- <span>提交时间</span>
- </template>
- <!-- 出库仓库 -->
- <template slot="warehouseBox" slot-scope="text, record">
- <a-tooltip placement="right" v-if="record.newWarehouseNameSet && record.newWarehouseNameSet.length>0">
- <template slot="title">
- <span>{{ record.newWarehouseNameSet.toString() }}</span>
- </template>
- <div class="warehouse_box">
- <span>{{ record.newWarehouseNameSet.toString() }}</span>
- </div>
- </a-tooltip>
- <div v-else>--</div>
- </template>
- <!-- 总数量 -->
- <template slot="totalQty" slot-scope="text, record">
- {{ record.totalQty }}
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <div>
- <a-button
- size="small"
- type="link"
- class="button-warning"
- v-if="record.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
- @click="handleDetailAudit(record)"
- >审核</a-button>
- <a-button
- size="small"
- type="link"
- class="button-warning"
- v-if="record.billStatus == 'WAIT_PUSH'&&$hasPermissions('B_salesDispatch')"
- @click="handleDispatch(record)"
- >下推</a-button>
- <a-button
- size="small"
- type="link"
- class="button-info"
- v-if="(record.salesBillSource == 'SALES' && (record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'AUDIT_REJECT' || record.billStatus == 'HQ_CHANGE'))&&$hasPermissions('B_salesEdit')"
- @click="handleEdit(record)"
- >
- 编辑
- </a-button>
- <a-button
- size="small"
- type="link"
- class="button-info"
- v-if="record.salesBillSource == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'HQ_CHANGE') && $hasPermissions('B_salesEdit')"
- @click="handleEdit(record)"
- >
- 改单
- </a-button>
- <a-button
- size="small"
- type="link"
- class="button-error"
- v-if="(record.salesBillSource == 'SALES' && (record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'AUDIT_REJECT' || record.billStatus == 'HQ_CHANGE'))&&$hasPermissions('B_salesDel')"
- @click="handleDel(record)"
- >
- 删除
- </a-button>
- <a-button
- size="small"
- type="link"
- class="button-error"
- v-if="record.salesBillSource == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'HQ_CHANGE') && $hasPermissions('B_salesDel')"
- @click="handleDel(record)"
- >
- 取消
- </a-button>
- <a-button
- size="small"
- type="link"
- class="button-warning"
- v-if="record.printStatus=='UNABLE_PRINT'&&$hasPermissions('B_Sales_UNABLE_PRINT')"
- @click="handlePrint(record)"
- >允许备货打印</a-button>
- <a-button
- size="small"
- type="link"
- class="button-warning"
- v-if="record.billStatus=='FINISH' && record.expenseClainFlag == 'N'"
- @click="handleExpense(record)"
- >转费用报销单</a-button>
- </div>
- </template>
- </s-table>
- </a-spin>
- <!-- 选择客户弹框 -->
- <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
- <!-- 操作提示 -->
- <commonModal modalTit="操作提示" :width="this.tipData&&this.tipData.length == 1?'500px':'800px'" :openModal="showTipModal" @cancel="canselModal" @ok="updatePrintStatus">
- <div style="text-align: center;" v-if="this.tipData&&this.tipData.length">
- <div style="margin-bottom: 15px;font-size: 14px;"><strong>确认允许此单进行备货打印吗?</strong></div>
- <div style="line-height: 24px;" v-if="this.tipData.length == 1">
- <div>备货单号:{{ tipData[0]&&tipData[0].dispatchBillNo }}</div>
- <div>客户名称:{{ tipData[0]&&tipData[0].buyerName }}</div>
- </div>
- <div v-else>
- <a-table
- :row-selection="{ selectedRowKeys: selectedRowKeys,onChange: onSelectChange, getCheckboxProps: record => ({ props: { disabled: record.printStatus!=='UNABLE_PRINT' }})}"
- :columns="bhColumns"
- :data-source="tipData"
- :pagination="false"
- />
- </div>
- </div>
- </commonModal>
- <!-- 新增费用单 -->
- <baseDataModal ref="expenseModal" @expenseSaveOk="expenseSaveOk" :show="openBaseModal" @close="openBaseModal=false"></baseDataModal>
- <!-- 导出提示框 -->
- <reportModal :visible="showExport" @close="showExport=false"></reportModal>
- </a-card>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import moment from 'moment'
- import getDate from '@/libs/getDate.js'
- import subarea from '@/views/common/subarea.js'
- import Area from '@/views/common/area.js'
- import rangeDate from '@/views/common/rangeDate.vue'
- import { STable, VSelect } from '@/components'
- import commonModal from '@/views/common/commonModal.vue'
- import chooseCustomModal from './chooseCustomModal.vue'
- import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
- import baseDataModal from '@/views/expenseManagement/expenseReimbursement/baseDataModal.vue'
- import reportModal from '@/views/common/reportModal.vue'
- import { salesList, salesDel, salesCancle, salesCount, queryCreateBySalesBillSn, expenseAccountSave } from '@/api/salesNew'
- import { hdExportExcel } from '@/libs/exportExcel'
- import chooseWarehouse from '@/views/common/chooseWarehouse'
- import { dispatchBatchPrintStatus, queryBySalesBillSn } from '@/api/dispatch'
- import { salesDetailExport } from '@/api/salesBillReport'
- export default {
- name: 'SalesQueryList',
- mixins: [commonMixin],
- components: { STable, VSelect, chooseCustomModal, dealerSubareaScopeList, Area, rangeDate, subarea, commonModal, reportModal, chooseWarehouse, baseDataModal },
- data () {
- return {
- spinning: false,
- advanced: true, // 高级搜索 展开/关闭
- disabled: false, // 查询、重置按钮是否可操作
- openModal: false, // 选择客户弹框是否显示
- openBaseModal: false, // 费用弹框
- showTipModal: false, // 备货打印弹框
- showExport: false,
- exportLoading: false,
- expenseOption: false,
- tableHeight: 0,
- time: [
- moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
- moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
- ],
- // 查询参数
- queryParam: {
- beginDate: getDate.getThreeMonthDays().starttime,
- endDate: getDate.getCurrMonthDays().endtime,
- buyerSn: undefined, // 客户名称
- salesBillNo: '', // 销售单号
- purchaseBillNo: '',
- printStatus: undefined,
- billStatus: undefined, // 业务状态
- financialStatus: undefined, // 财务状态
- salesBillSource: undefined,
- subareaArea: {
- subareaSn: undefined,
- subareaAreaSn: undefined
- },
- shippingAddrProvinceSn: undefined,
- warehouseSn: undefined,
- promoFlag: undefined
- },
- totalData: {
- totalAmount: 0,
- totalCategory: 0,
- totalQty: 0,
- totalRecord: 0,
- totalPushedQty: 0,
- totalDispatchQty: 0,
- totalCancelQty: 0,
- totalUnpushedQty: 0,
- totalPushedAmount: 0,
- totalCancelAmount: 0,
- totalUnpushedAmount: 0,
- totalDispatchAmount: 0
- },
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- delete parameter.tableId
- delete parameter.index
- // 查询总计
- salesCount(Object.assign(parameter, this.queryParam)).then(res => {
- this.totalData = Object.assign(this.totalData, res.data || {})
- })
- return salesList(Object.assign(parameter, this.queryParam)).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- data.list.forEach((con, i) => {
- con.no = no + i + 1
- const newWarehouseName = []
- if (con.warehouseNameSet) {
- con.warehouseNameSet.forEach(item => {
- if (item) {
- newWarehouseName.push(item)
- }
- })
- con.newWarehouseNameSet = newWarehouseName
- }
- })
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- },
- showCancelNum: false, // 是否显示取消数量和待下推数量
- tipData: null, // 备货单信息
- tempSalesBillSn: null,
- // 允许备货打印
- selectedRowKeys: [],
- bhColumns: [
- {
- title: '备货单号',
- dataIndex: 'dispatchBillNo'
- },
- {
- title: '客户名称',
- dataIndex: 'buyerName'
- },
- {
- title: '备货打印状态',
- dataIndex: 'printStatusDictValue'
- }
- ]
- }
- },
- computed: {
- columns () {
- const _this = this
- const arr = [
- { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
- { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '7%', align: 'center' },
- { title: <a-tooltip placement='top' title='第一次提交时间'>提交时间 <a-icon type="question-circle" /></a-tooltip>, dataIndex: 'firstSubmitDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
- { title: '客户名称', dataIndex: 'buyerName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '8%', align: 'center', ellipsis: true },
- { title: '总数量', dataIndex: 'totalQty', scopedSlots: { customRender: 'totalQty' }, width: '4%', align: 'center' },
- { title: '已下推数量', dataIndex: 'totalPushedQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '已发货数量', dataIndex: 'totalDispatchQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '审核时间', dataIndex: 'auditDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
- { title: '最近备货时间', dataIndex: 'lastStockUpDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
- { title: '业务状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '财务状态', dataIndex: 'financialStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '备货打印状态', dataIndex: 'printStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
- ]
- if (this.$hasPermissions('M_salesQueryList_salesPrice')) { // 售价权限
- arr.splice(6, 0, { title: '总售价', dataIndex: 'totalAmount', width: '4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
- arr.splice(8, 0, { title: '下推总金额', dataIndex: 'totalPushedAmount', width: '4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
- }
- if (this.showCancelNum) {
- const ind = this.$hasPermissions('M_salesQueryList_salesPrice') ? 10 : 8
- arr.splice(ind, 0, { title: '已取消数量', dataIndex: 'totalCancelQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- arr.splice(ind + 1, 0, { title: '待下推数量', dataIndex: 'totalUnpushedQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- return arr
- }
- },
- methods: {
- // 导出
- handleExport () {
- const _this = this
- _this.$store.state.app.curActionPermission = 'B_sales_export'
- _this.exportLoading = true
- _this.spinning = true
- hdExportExcel(salesDetailExport, _this.queryParam, '销售明细', function () {
- _this.exportLoading = false
- _this.spinning = false
- _this.showExport = true
- _this.$store.state.app.curActionPermission = ''
- })
- },
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- custChange (val) {
- this.queryParam.buyerSn = val.key
- },
- subareaChange (val) {
- this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
- this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
- },
- // 新增
- handleAdd () {
- this.openModal = true
- },
- // 选择客户成功
- chooseCustomOk (data) {
- this.$router.push({ name: 'salesNewAdd', params: { sn: data.salesBillSn } })
- },
- // 下推
- handleDispatch (row) {
- this.$router.push({ name: 'waitDispatchNew', params: { salesBillSn: row.salesBillSn } })
- },
- // 详情
- handleDetail (row) {
- this.$router.push({ name: 'salesNewDetail', params: { sn: row.salesBillSn } })
- },
- // 审核
- handleDetailAudit (row) {
- this.$router.push({ name: 'salesNewDetailAudit', params: { sn: row.salesBillSn } })
- },
- // 编辑
- handleEdit (row) {
- this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn } })
- },
- // 删除
- handleDel (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: row.salesBillSource == 'PURCHASE' ? '确认要取消吗?' : '确认要删除吗?',
- centered: true,
- closable: true,
- onOk () {
- _this.spinning = true
- const fun = row.salesBillSource == 'PURCHASE' ? salesCancle : salesDel
- fun({ salesBillSn: row.salesBillSn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 转费用单
- async handleExpense (row) {
- const _this = this
- const hasExpense = await queryCreateBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => res.data || [])
- console.log(hasExpense)
- // 有2个以上采购额时
- if (hasExpense && hasExpense.exceed && hasExpense.balance) {
- _this.$confirm({
- title: '转费用报销单?',
- centered: true,
- class: 'confirm-center',
- content: <div>
- <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
- <div style="padding:0 0 10px 0;text-align:center;">
- <aRadioGroup onChange={_this.changeDaOpt}>
- <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="balance">
- 采购额结余
- </aRadio>
- <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="exceed">
- 采购额超出
- </aRadio>
- </aRadioGroup>
- </div>
- </div>,
- onOk () {
- if (_this.expenseOption) {
- _this.expenseSave(hasExpense, _this.expenseOption)
- } else {
- _this.$message.info('请选择费用报销单类型!')
- return true
- }
- },
- onCancel () {
- _this.expenseOption = null
- }
- })
- } else {
- // 直接转费用单
- _this.expenseSave(hasExpense, null)
- }
- },
- // 转费用单
- expenseSave (data, type) {
- console.log(data, type)
- const params = type ? data[type] : (data.balance || data.exceed)
- if (params) {
- this.openBaseModal = true
- this.$refs.expenseModal.setDetail(params, 'sales')
- }
- },
- expenseSaveOk (params) {
- expenseAccountSave(params).then(res => {
- if (res.status == 200) {
- this.$message.info(res.message)
- this.$refs.table.refresh()
- this.openBaseModal = false
- this.expenseOption = null
- this.$router.push({ name: 'expenseReimbursementEdit', params: { sn: res.data.expenseAccountSn } })
- }
- })
- },
- changeDaOpt (e) {
- this.expenseOption = e.target.value
- },
- // 允许备货打印
- handlePrint (row) {
- // 获取关联的下推单
- this.tempSalesBillSn = row.salesBillSn
- queryBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => {
- this.tipData = res.data || []
- this.tipData.map(item => {
- item.key = item.dispatchBillSn
- if (item.printStatus == 'UNABLE_PRINT') {
- this.selectedRowKeys.push(item.dispatchBillSn)
- }
- })
- this.showTipModal = true
- })
- },
- canselModal () {
- this.tipData = null
- this.showTipModal = false
- this.tempSalesBillSn = null
- this.selectedRowKeys = []
- },
- onSelectChange (selectedRowKeys) {
- this.selectedRowKeys = selectedRowKeys
- },
- // 允许备货打印状态
- updatePrintStatus () {
- const isOne = this.tipData.length
- if (isOne > 1 && this.selectedRowKeys.length == 0) {
- this.$message.info('请选择备货单!')
- return
- }
- const dispatchBillSnList = []
- this.tipData.map(item => {
- dispatchBillSnList.push(item.dispatchBillSn)
- })
- const params = {
- 'salesBillSn': this.tempSalesBillSn,
- 'dispatchBillSnList': isOne > 1 ? this.selectedRowKeys : dispatchBillSnList,
- 'printStatus': 'NO_PRINT'
- }
- dispatchBatchPrintStatus(params).then(res => {
- if (res.status == 200) {
- this.canselModal()
- this.$message.info(res.message)
- this.$refs.table.refresh()
- }
- })
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate(this.time)
- this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
- this.queryParam.endDate = getDate.getCurrMonthDays().endtime
- this.$refs.dealerSubareaScopeList.resetForm()
- this.queryParam.buyerSn = undefined
- this.queryParam.salesBillNo = ''
- this.queryParam.purchaseBillNo = ''
- this.queryParam.printStatus = undefined
- this.queryParam.billStatus = undefined
- this.queryParam.financialStatus = undefined
- this.queryParam.salesBillSource = undefined
- this.queryParam.subareaArea.subareaSn = undefined
- this.queryParam.subareaArea.subareaAreaSn = undefined
- this.queryParam.shippingAddrProvinceSn = undefined
- this.queryParam.warehouseSn = undefined
- this.queryParam.promoFlag = undefined
- if (this.advanced) {
- this.$refs.subarea.clearData()
- }
- this.$refs.table.refresh(true)
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 265
- }
- },
- watch: {
- advanced (newValue, oldValue) {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- console.log(newValue)
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- // 仅刷新列表,不重置页面
- if (this.$store.state.app.updateList) {
- this.pageInit()
- this.$refs.table.refresh()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less" scoped>
- .salesManagementList-wrap{
- margin-bottom: 6px;
- .sTable{
- .badge-con-t{
- .ant-badge-count{
- transform: scale(0.8);
- font-size: 13px;
- }
- }
- .warehouse_box{
- width: 100%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- // .warehouse_box>span::after{
- // content:',';
- // }
- // .warehouse_box>span:last-child::after{
- // content:'';
- // }
- }
- }
- </style>
|