123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642 |
- <template>
- <div class="allocateBillEdit-wrap">
- <!-- <a-spin :spinning="spinning" tip="Loading..."> -->
- <div class="ant-spin-nested-loading">
- <a-page-header :ghost="false" :backIcon="false" class="allocateBillEdit-back" >
- <!-- 自定义的二级文字标题 -->
- <template slot="subTitle">
- <a id="allocateBillEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
- </template>
- <!-- 操作区,位于 title 行的行尾 -->
- <template slot="extra">
- <a-button
- key="3"
- type="primary"
- class="button-info"
- v-if="$hasPermissions('B_transferOut_detail_export')"
- id="allocateBillEdit-export-btn"
- :disabled="localDataSource.length==0"
- @click="handleExcel">导出Excel</a-button>
- <a-divider type="vertical" />
- <a-button
- key="2"
- type="primary"
- class="button-info"
- v-if="$hasPermissions('B_transferOut_print')"
- id="allocateBillEdit-db-print-btn"
- :disabled="localDataSource.length==0"
- @click="handlePrint('dbPrint')">调拨打印</a-button>
- <a-button
- key="1"
- type="default"
- class="button-info"
- v-if="$hasPermissions('B_transferOut_print')"
- id="allocateBillEdit-dbfl-print-btn"
- :disabled="localDataSource.length==0"
- @click="handlePrint('dbflPrint')">调拨分类打印</a-button>
- </template>
- </a-page-header>
- <a-card size="small" :bordered="false" v-if="basicInfoData" class="allocateBillEdit-cont">
- <a-collapse :activeKey="['0']">
- <a-collapse-panel key="0" header="基础信息">
- <a-descriptions :column="3">
- <a-descriptions-item label="调往对象">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
- <a-descriptions-item label="调拨单号">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
- <a-descriptions-item label="调拨类型">
- <AllocateType id="allocateEdit-allocateTypeSn" style="width: 200px;" @change="changeAllocateType" v-model="basicInfoData.allocateTypeSn"></AllocateType>
- </a-descriptions-item>
- <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
- <a-descriptions-item label="起止时间">
- <span v-if="basicInfoData&&(basicInfoData.promoStartDate || basicInfoData.promoEndDate)">{{ (basicInfoData&&basicInfoData.promoStartDate) || '--' }} ~ {{ (basicInfoData&&basicInfoData.promoEndDate) || '--' }}</span>
- <span v-else>--</span>
- </a-descriptions-item>
- <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remark) || '--' }}</a-descriptions-item>
- </a-descriptions>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <!-- 选择产品 -->
- <a-card size="small" :bordered="false" class="allocateBillEdit-cont">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1" :forceRender="true" header="选择产品">
- <!-- 筛选条件 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="产品编码" prop="productCode">
- <a-input id="allocateBillEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品名称" prop="productName">
- <a-input id="allocateBillEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="原厂编码" prop="productOrigCode">
- <a-input id="allocateBillEdit-productOrigCode" v-model.trim="queryParam.productOrigCode" placeholder="请输入原厂编码" allowClear />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="storeTransferOutList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- index="0"
- tableId="table1"
- :rowKey="(record) => record.stockSn"
- :columns="columns"
- :customRow="handleClickRow"
- :data="loadData"
- :scroll="{ y: 300 }"
- :defaultLoadData="false"
- bordered>
- <!-- 操作 -->
- <template slot="action1" slot-scope="text, record">
- <a-button size="small" type="link" class="button-primary" @click="handleAdd(record)" id="allocateBillEdit-add-btn">添加</a-button>
- </template>
- </s-table>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <!-- 已选产品 -->
- <a-card size="small" :bordered="false" class="allocateBillEdit-cont">
- <a-collapse :activeKey="['2']">
- <a-collapse-panel key="2" :forceRender="true" header="已选产品">
- <!-- 总计 -->
- <a-alert type="info" style="margin-bottom:10px">
- <div slot="message">
- 总数量:<strong>{{ (productTotal&&(productTotal.totalQty || productTotal.totalQty==0)) ? productTotal.totalQty : '--' }}</strong> ,
- <span v-if="$hasPermissions('B_isShowCost')">总成本(¥):<strong>{{ (productTotal&&(productTotal.totalCost || productTotal.totalCost==0)) ? productTotal.totalCost : '--' }}</strong> ,</span>
- <span v-if="$hasPermissions('B_isShowPrice')">总售价(¥):<strong>{{ (productTotal&&(productTotal.totalPrice || productTotal.totalPrice==0)) ? productTotal.totalPrice : '--' }}</strong></span>
- </div>
- </a-alert>
- <!-- 筛选条件 -->
- <a-row :gutter="15">
- <a-col :span="17">
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="9" :sm="24">
- <a-form-item label="产品编码" prop="productCode">
- <a-input id="allocateBillEdit-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
- </a-form-item>
- </a-col>
- <a-col :md="9" :sm="24">
- <a-form-item label="产品名称" prop="productName">
- <a-input id="allocateBillEdit-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="storeTransferOutList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="storeTransferOutList-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- </a-col>
- <a-col :span="7" style="text-align: right;">
- <a-button size="small" id="allocateBillEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
- <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
- </a-col>
- </a-row>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="chooseTable"
- size="small"
- index="1"
- tableId="table2"
- :rowKey="(record) => record.id"
- :columns="chooseColumns"
- :data="chooseLoadData"
- :scroll="{ y: 300 }"
- :defaultLoadData="false"
- bordered>
- <!-- 售价 -->
- <template slot="price" slot-scope="text, record, index">
- <!-- 调往对象为经销商时不可编辑售价,为员工或其他时可编辑售价 -->
- <div v-if="$route.params.dealerLevel == 'OTHER'">
- <a-select
- size="small"
- id="allocateBillEdit-price"
- option-label-prop="label"
- v-model="record.price"
- placeholder="请选择"
- @change="e => priceChange(e, record)"
- @focus="e => priceFocus(record, index)"
- style="width: 100%;">
- <a-select-option v-if="record.cost" :value="record.cost" :key="'cb-'+record.cost" :label="record.cost">成本 {{ record.cost }}</a-select-option>
- <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].provincePrice" :value="loadDataSource[index].provincePrice" :key="'A-'+loadDataSource[index].productSn" :label="loadDataSource[index].provincePrice">A价 {{ loadDataSource[index].provincePrice }}</a-select-option>
- <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].cityPrice" :value="loadDataSource[index].cityPrice" :key="'B-'+loadDataSource[index].productSn" :label="loadDataSource[index].cityPrice">B价 {{ loadDataSource[index].cityPrice }}</a-select-option>
- <a-select-option v-if="loadDataSource&&loadDataSource[index]&&loadDataSource[index].specialPrice" :value="loadDataSource[index].specialPrice" :key="'C-'+loadDataSource[index].productSn" :label="loadDataSource[index].specialPrice">C价 {{ loadDataSource[index].specialPrice }}</a-select-option>
- </a-select>
- </div>
- <span v-else>{{ record.price }}</span>
- </template>
- <!-- 调出数量 -->
- <template slot="qty" slot-scope="text, record">
- <a-input-number
- size="small"
- id="allocateBillEdit-qty"
- v-model="record.qty"
- :precision="0"
- :min="1"
- :max="999999"
- placeholder="请输入"
- @blur="e => qtyBlur(e.target.value, record)"
- style="width: 100%;" />
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="allocateBillEdit-del-btn">删除</a-button>
- </template>
- </s-table>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <!-- </a-spin> -->
- </div>
- <div class="affix-cont" v-if="basicInfoData">
- <a-button
- type="primary"
- id="allocateBillEdit-submit"
- size="large"
- :disabled="spinning"
- class="button-primary"
- @click="handleOpen"
- style="padding: 0 60px;">提交</a-button>
- </div>
- <!-- 导入产品 -->
- <importGuideModal :openModal="openGuideModal" :params="{allocateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
- <!-- 打印导出 -->
- <print-modal :openModal="openModal" :itemData="basicInfoData" :nowType="nowType" @ok="handleOk" @close="openModal=false" />
- <!-- 提交调拨单 -->
- <dsModal ref="dsModal" :openModal="showDsModal" @close="showDsModal=false" @ok="handleSubmit" />
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import ImportGuideModal from './importGuideModal.vue'
- import printModal from './printModal.vue'
- import dsModal from './dsModal.vue'
- import { printFun, exportExcel } from '@/libs/JGPrint.js'
- import { queryStockProductPage } from '@/api/stock'
- import { productPriceInfo } from '@/api/product'
- import AllocateType from '@/views/common/allocateType.js'
- import { allocateBillSave, allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel } from '@/api/allocateBill'
- export default {
- name: 'TransferOutEdit',
- mixins: [commonMixin],
- components: { STable, VSelect, ImportGuideModal, AllocateType, printModal, dsModal },
- data () {
- return {
- spinning: false,
- showDsModal: false,
- queryParam: {
- productCode: '',
- productName: '',
- productOrigCode: ''
- },
- chooseQueryParam: {
- productCode: '',
- productName: ''
- },
- disabled: false, // 查询、重置按钮是否可操作
- loading: false,
- chooseDisabled: false, // 查询、重置按钮是否可操作
- advanced: false, // 高级搜索 展开/关闭
- productBrandList: [], // 产品品牌 下拉数据
- productTypeList: [], // 产品分类 下拉数据
- productType: [],
- warehouseList: [], // 仓库 下拉数据
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- const dealerLevel = this.$route.params.dealerLevel == 'OTHER' ? undefined : this.$route.params.dealerLevel
- return queryStockProductPage(Object.assign(parameter, this.queryParam, { zeroQtyFlag: '0', dealerLevel: dealerLevel })).then(res => {
- const data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.loadDataSource = data.list || []
- this.disabled = false
- return data
- })
- },
- loadDataSource: [],
- localDataSource: [],
- // 加载数据方法 必须为 Promise 对象
- chooseLoadData: parameter => {
- this.chooseDisabled = true
- const params = Object.assign(parameter, this.chooseQueryParam, { allocateSn: this.$route.params.sn })
- return allocateBillDetailList(params).then(res => {
- this.getDetailCount()
- const data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- data.list[i].qtyBackups = data.list[i].qty
- data.list[i].priceBackups = data.list[i].price
- }
- this.localDataSource = data.list || []
- this.chooseDisabled = false
- return data
- })
- },
- productTotal: null, // 合计
- basicInfoData: null, // 基本信息
- openGuideModal: false, // 导入产品引导
- openModal: false,
- nowType: null
- }
- },
- computed: {
- columns () {
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productName', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '原厂编码', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- // { title: '成本价', dataIndex: 'lastStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- // { title: '售价', dataIndex: 'productPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '库存数量', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '单位', dataIndex: 'productUnit', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action1' }, width: '10%', align: 'center' }
- ]
- if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
- arr.splice(4, 0, { title: '成本价', dataIndex: 'lastStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
- const ind = this.$hasPermissions('B_isShowCost') ? 5 : 4
- arr.splice(ind, 0, { title: '售价', dataIndex: 'productPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- return arr
- },
- chooseColumns () {
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '产品编码', dataIndex: 'productEntity.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- // { title: '成本价', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- // { title: '售价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'center' },
- { title: '库存数量', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '调出数量', scopedSlots: { customRender: 'qty' }, width: '10%', align: 'center' },
- { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
- ]
- if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
- arr.splice(4, 0, { title: '成本价', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
- const ind = this.$hasPermissions('B_isShowCost') ? 5 : 4
- arr.splice(ind, 0, { title: '售价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'center' })
- }
- return arr
- }
- },
- methods: {
- // 修改调拨类型
- changeAllocateType (val) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确定要更改调拨类型吗?',
- centered: true,
- onOk () {
- const params = _this.basicInfoData
- allocateBillSave({
- allocateSn: params.allocateSn,
- targetType: params.targetType,
- targetSn: params.targetSn,
- targetName: params.targetName,
- allocateTypeSn: params.allocateTypeSn,
- remark: params.remark
- }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.getDetail()
- } else {
- _this.spinning = false
- }
- })
- },
- onCancel () {
- _this.getDetail()
- }
- })
- },
- // 重置
- resetSearchForm () {
- this.queryParam.productCode = ''
- this.queryParam.productName = ''
- this.queryParam.productOrigCode = ''
- this.$refs.table.refresh(true)
- },
- // 双击快速添加
- handleClickRow (record) {
- return {
- on: {
- dblclick: (event) => {
- this.handleAdd(record)
- }
- }
- }
- },
- // 导入产品
- handleGuideOk (obj) {
- allocateBillBatchInsert(obj).then(res => {
- if (res.status == 200) {
- this.$refs.chooseTable.refresh(true)
- }
- })
- },
- // 已选产品 重置
- chooseResetSearchForm () {
- this.chooseQueryParam.productCode = ''
- this.chooseQueryParam.productName = ''
- this.$refs.chooseTable.refresh(true)
- },
- // 添加/编辑
- handleAdd (row, isEdit, isRefresh) {
- const params = {
- id: isEdit ? row.id : undefined,
- allocateSn: this.$route.params.sn,
- cost: isEdit ? row.cost : row.lastStockCost,
- price: isEdit ? row.price : row.productPrice,
- qty: isEdit ? row.qty : 1, // 添加时调出数量默认为1
- productSn: row.productSn
- }
- if (isEdit) { // 编辑
- // 清空数量时,值应保持未清空前的值,因数量不可为空
- if (!row.qty) {
- row.qty = row.qtyBackups
- return
- }
- if (!row.price) {
- row.price = row.priceBackups
- return
- }
- }
- this.spinning = true
- allocateBillDetailSave(params).then(res => {
- if (res.status == 200) {
- this.$message.success(res.message)
- if (isRefresh != 'noRefresh') {
- this.$refs.table.refresh()
- }
- this.$refs.chooseTable.refresh()
- this.spinning = false
- } else {
- this.spinning = false
- }
- })
- },
- // 删除
- handleDel (row, isAll) {
- const _this = this
- const content = isAll ? '删除后不可恢复,确定要进行整单删除吗?' : '删除后不可恢复,确定要进行删除吗?'
- this.$confirm({
- title: '提示',
- content: content,
- centered: true,
- onOk () {
- if (isAll) { // 整单删除
- allocateBillDetailDelAll({ sn: _this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.refashPage()
- }
- })
- } else { // 单个删除
- allocateBillDetailDel({ id: row.id }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.refashPage()
- }
- })
- }
- }
- })
- },
- // 提交
- handleOpen () {
- if (this.localDataSource.length) {
- // 待提交
- if (this.basicInfoData.state == 'WAIT_SUBMIT') {
- this.showDsModal = true
- }
- // 待审核或审核不通过时
- if (this.basicInfoData.state == 'AUDIT_REJECT' || this.basicInfoData.state == 'WAIT_AUDIT') {
- this.handleSubmit()
- }
- } else {
- this.$message.info('请选择产品')
- }
- },
- handleSubmit (params) {
- const _this = this
- const data = Object.assign({ allocateSn: this.$route.params.sn }, params || {})
- _this.spinning = true
- allocateBillSubmit(data).then(res => {
- if (res.status == 200) {
- this.$message.success(res.message)
- setTimeout(() => {
- _this.handleBack()
- _this.spinning = false
- }, 1000)
- } else {
- _this.spinning = false
- }
- })
- },
- // 基本信息
- getDetail () {
- this.spinning = true
- allocateBillDetail({ sn: this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- this.basicInfoData = res.data
- } else {
- this.basicInfoData = null
- }
- this.spinning = false
- })
- },
- // 合计
- getDetailCount () {
- allocateBillDetailCount({ allocateSn: this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- this.productTotal = res.data
- } else {
- this.productTotal = null
- }
- })
- },
- // 返回列表
- handleBack () {
- this.$router.push({ path: '/allocationManagement/transferOut/list', query: { closeLastOldTab: true } })
- },
- // 已选产品 调出数量 blur
- qtyBlur (val, record) {
- // 光标移出,值发生改变再调用编辑接口
- if (val != record.qtyBackups) {
- this.handleAdd(record, 'edit', 'noRefresh')
- }
- },
- // 已选产品 售价 change
- priceChange (val, record) {
- // 光标移出,值发生改变再调用编辑接口
- if (val != record.priceBackups) {
- this.handleAdd(record, 'edit', 'noRefresh')
- }
- },
- // 获取价格
- priceFocus (row, index) {
- if (row.productSn) {
- productPriceInfo({ sn: row.productSn }).then(res => {
- if (res.status == 200 && res.data) {
- this.loadDataSource[index].provincePrice = res.data.provincePrice || undefined
- this.loadDataSource[index].cityPrice = res.data.cityPrice || undefined
- this.loadDataSource[index].specialPrice = res.data.specialPrice || undefined
- }
- })
- }
- },
- // 导出
- handleExcel () {
- const _this = this
- this.spinning = true
- exportExcel(allocateBillDetailExcel, { allocateSn: this.outBizSn || this.$route.params.sn }, '调拨明细', function () {
- _this.spinning = false
- })
- },
- // 打印预览/快捷打印
- handlePrint (type) {
- this.nowType = type
- this.openModal = true
- },
- handleOk (objs) {
- const _this = this
- const params = JSON.parse(JSON.stringify(objs))
- delete params.type
- _this.spinning = true
- const taskName = this.nowType == 'dbPrint' ? '调拨' : '调拨分类'
- printFun(allocateBillDetailPrint, params, objs.isPreview ? 'preview' : 'print', taskName, () => { _this.spinning = false })
- },
- // 刷新当前页面
- refashPage () {
- this.$refs.table.refresh()
- this.$refs.chooseTable.refresh()
- },
- pageInit () {
- this.getDetail()
- this.resetSearchForm()
- this.chooseResetSearchForm()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- }
- },
- activated () {
- // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
- if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
- this.pageInit()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .allocateBillEdit-wrap{
- position: relative;
- height: 100%;
- box-sizing: border-box;
- >.ant-spin-nested-loading{
- overflow-y: scroll;
- height: 100%;
- padding-bottom: 51px;
- }
- .allocateBillEdit-back{
- margin-bottom: 10px;
- }
- .allocateBillEdit-cont{
- margin-bottom: 10px;
- .sub-title{
- font-size: 12px;
- color: #808695;
- margin-left: 10px;
- }
- .tag-txt{
- font-size: 12px;
- color: #ed1c24;
- }
- .edit-circle-btn{
- margin-left: 15px;
- i{
- vertical-align: text-bottom;
- }
- }
- .import-btn{
- margin-left: 15px;
- }
- }
- }
- </style>
|