123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449 |
- <template>
- <div class="shelfSet-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
- <!-- 自定义的二级文字标题 -->
- <template slot="subTitle">
- <a id="shelfSet-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
- </template>
- </a-page-header>
- <!-- 内容 -->
- <a-card size="small" :bordered="false" class="shelfSet-cont">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1">
- <template slot="header">
- <span>基础信息</span>
- <a-button icon="edit" v-if="basicInfoData&&basicInfoData.state!='WRITE_OFF'&&basicInfoData.state!='SUSPEND'" size="small" type="link" style="margin-left: 20px;color: #39f;" @click.stop="openInfoModal = true">编辑</a-button>
- </template>
- <a-descriptions :column="2">
- <a-descriptions-item label="货架名称">
- {{ basicInfoData&&basicInfoData.shelfName || '--' }}
- <a-badge count="已注销" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="basicInfoData&&basicInfoData.state=='WRITE_OFF'"></a-badge>
- <a-badge count="已停用" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="basicInfoData&&basicInfoData.state=='DISABLED'"></a-badge>
- <a-badge count="已暂停" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="basicInfoData&&basicInfoData.state=='SUSPEND'"></a-badge>
- </a-descriptions-item>
- <a-descriptions-item>
- <template slot="label">
- 货架产品
- </template>
- <span>{{showPriceStr.length ? showPriceStr.join("/") : '--'}}</span>
- </a-descriptions-item>
- <a-descriptions-item>
- <template slot="label">
- <a-tooltip placement="top">
- <template slot="title">
- <span>此数字货架,归属于您的哪一位客户。如果没有搜索到客户,请在客户管理功能中新建客户。</span>
- </template>
- 关联客户<a-icon type="question-circle" style="color: rgba(0,0,0,.65);font-size: 16px;margin-left: 2px;vertical-align: sub;cursor: pointer;" />
- </a-tooltip>
- </template>
- {{ (basicInfoData&&basicInfoData.customerEntity&&basicInfoData.customerEntity.customerName) || '--' }}
- </a-descriptions-item>
- <a-descriptions-item>
- <template slot="label">
- 非货架产品
- </template>
- <span>{{showNoShelfPriceStr.length ? showNoShelfPriceStr.join("/") : '--'}}</span>
- </a-descriptions-item>
- </a-descriptions>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <a-card size="small" :bordered="false" class="shelfSet-cont">
- <!-- 搜索条件 -->
- <div ref="tableSearch" 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="产品编码">
- <a-input id="shelfSet-productCode" v-model.trim="queryParam.shelfProductApiEntity.productCode" allowClear placeholder="请输入产品编码"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品名称">
- <a-input id="shelfSet-productName" v-model.trim="queryParam.shelfProductApiEntity.productName" allowClear placeholder="请输入产品名称"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <span class="table-page-search-submitButtons">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shelfSet-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="shelfSet-reset">重置</a-button>
- <a-button
- type="primary"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- >导出</a-button>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮 -->
- <div class="table-operator" v-if="basicInfoData&&basicInfoData.state!='WRITE_OFF'&&basicInfoData.state!='SUSPEND'">
- <a-button id="shelfSet-addHW" type="primary" class="button-error" @click="addHW(1)">新增货位</a-button>
- <a-button id="shelfSet-impoort" type="primary" class="button-info" @click="addHW(0)">批量导入货位</a-button>
- <a-button id="shelfSet-import" type="primary" class="button-error" @click="openGuideModal=true">导入绑定产品</a-button>
- <a-tooltip placement="top">
- <template slot="title">
- <span>如果货位还没有绑定产品,可使用此功能通过Excel批量导入</span>
- </template>
- <a-icon type="question-circle" style="color: rgba(0,0,0,.45);font-size: 16px;margin-left: 5px;vertical-align: middle;cursor: pointer;" />
- </a-tooltip>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :scroll="{ y: tableHeight }"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :showPagination="false"
- :defaultLoadData="false"
- bordered>
- <span slot="customTitle">
- 结算价
- <a-popover>
- <template slot="content">
- 即易码通进货价
- </template>
- <a-icon type="question-circle"/>
- </a-popover>
- </span>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- :class="record.enableFlag==1?'button-error':'button-primary'"
- v-if="record.shelfProductApiEntity&&(!record.shelfProductApiEntity.qty||(record.enableFlag==0&&record.shelfProductApiEntity.qty))&&record.shelfProductApiEntity.productSn"
- @click="handleEnable(record)"
- >{{ record.enableFlag==1?'禁用':'启用' }}</a-button>
- <a-button
- size="small"
- type="link"
- class="button-primary"
- v-if="!(record.shelfProductApiEntity&&record.shelfProductApiEntity.productSn)"
- @click="handleProduct(record, 'bind')"
- >绑定产品</a-button>
- <a-button
- size="small"
- type="link"
- :class="record.enableFlag==1?'button-primary':''"
- :disabled="record.enableFlag==0"
- v-else
- @click="handleReplace(record)"
- >更换产品</a-button>
- <a-button
- size="small"
- type="link"
- :class="record.enableFlag==1?'button-primary':''"
- :disabled="record.enableFlag==0"
- @click="editHW(record)"
- >编辑</a-button>
- <a-button
- size="small"
- type="link"
- class="button-error"
- v-if="!(record.shelfProductApiEntity&&record.shelfProductApiEntity.productSn)"
- @click="handleDel(record)"
- >删除</a-button>
- </template>
- </s-table>
- </a-card>
- </a-spin>
- <!-- 基础设置 -->
- <basic-info-modal :openModal="openInfoModal" :nowData="basicInfoData" @ok="handleInfoOk" @close="openInfoModal=false" />
- <!-- 修改信息/绑定产品/更换产品 -->
- <bind-product-modal :openModal="openModal" :type="modalType" :nowData="nowData" @ok="$refs.table.refresh()" @close="handleCancel" />
- <!-- 编辑、新增货位 -->
- <addHwModal :openModal="openHwModal" :type="modalType" :nowData="nowData" @ok="$refs.table.refresh()" @close="handleCancel" />
- <!-- 更换产品 -->
- <common-modal
- :openModal="openTipsModal"
- modalHtml="只有当前库存为0时,才能更换产品<br/>您可以在“货架监控”功能中将产品调回"
- okText="好的"
- :isCancel="false"
- @ok="openTipsModal=false"
- @close="openTipsModal=false" />
- <!-- 导入产品 -->
- <importGuideModal :openModal="openGuideModal" :params="{shelfSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
- <!-- 导入货位模板 -->
- <importHuoweiModal :openModal="openImportModal" @close="openImportModal=false" @ok="$refs.table.refresh(true)" :shelfSn="$route.params.sn"></importHuoweiModal>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { downloadExcel } from '@/libs/JGPrint.js'
- import { STable, VSelect } from '@/components'
- import commonModal from '@/views/common/commonModal.vue'
- import addHwModal from './addHwModal.vue'
- import bindProductModal from './bindProductModal.vue'
- import ImportGuideModal from './importGuideModal.vue'
- import basicInfoModal from './basicInfoModal.vue'
- import importHuoweiModal from './importHuoweiModal.vue'
- import { shelfDetail, shelfProductList, shelfProductBatchInsert, delShelfPlaceSn, shelfProductEnable, getShelfPriceShow, shelfProductExport } from '@/api/shelf'
- export default {
- name: 'ShelfMonitoringWarehousing',
- components: { STable, VSelect, commonModal, bindProductModal, addHwModal, ImportGuideModal, basicInfoModal, importHuoweiModal },
- mixins: [commonMixin],
- data () {
- return {
- spinning: false,
- disabled: false, // 查询、重置按钮是否可操作
- tableHeight: 400,
- exportLoading: false,
- queryParam: {
- shelfProductApiEntity: {
- productCode: '',
- productName: ''
- }
- },
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return shelfProductList(Object.assign(parameter, this.queryParam, { shelfSn: this.$route.params.sn })).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- for (var i = 0; i < data.length; i++) {
- data[i].no = i + 1
- data[i].enableFlag = data[i].shelfProductApiEntity && data[i].shelfProductApiEntity.enableFlag
- }
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- },
- basicInfoData: null,
- openTipsModal: false,
- openModal: false,
- nowData: null,
- openGuideModal: false,
- modalType: null,
- openInfoModal: false,
- openHwModal: false,
- openImportModal: false,
- showPriceStr: [],
- showNoShelfPriceStr: []
- }
- },
- computed:{
- columns(){
- const _this = this
- const ret = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '货位号', dataIndex: 'shelfPlaceCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '绑定产品编码', dataIndex: 'shelfProductApiEntity.productCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '绑定产品名称', dataIndex: 'shelfProductApiEntity.productName', width: '23%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '车主价', dataIndex: 'shelfProductApiEntity.price', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
- { slots: { title: 'customTitle' }, dataIndex: 'shelfProductApiEntity.cost', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
- { title: '最大库容', dataIndex: 'shelfProductApiEntity.maxQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '当前库存', dataIndex: 'shelfProductApiEntity.qty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- ]
- if(this.basicInfoData&&this.basicInfoData.state!='WRITE_OFF'&&this.basicInfoData.state!='SUSPEND'){
- ret.push({ title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' })
- }
- return ret
- }
- },
- methods: {
- // 获取价格显示设置
- getShelfPriceShow () {
- this.showPriceStr = []
- this.showNoShelfPriceStr = []
- getShelfPriceShow({ shelfSn: this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- const ret = res.data&&res.data
- this.basicInfoData.showPrice = ret
- ret.map(item => {
- if(item.paramCode == 'shelf_price_show'&&item.paramValue == 1){
- this.showPriceStr.push("车主价")
- }
- if(item.paramCode == 'shelf_cost_show'&&item.paramValue == 1){
- this.showPriceStr.push("结算价")
- }
- if(item.paramCode == 'non_shelf_price_show'&&item.paramValue == 1){
- this.showNoShelfPriceStr.push("车主价")
- }
- if(item.paramCode == 'non_shelf_cost_show'&&item.paramValue == 1){
- this.showNoShelfPriceStr.push("结算价")
- }
- })
- }
- })
- },
- // 导出产品
- handleExport () {
- this.exportLoading = true
- shelfProductExport({shelfSn: this.$route.params.sn}).then(res => {
- downloadExcel(res, (this.basicInfoData?this.basicInfoData.shelfName:'')+"的产品")
- this.exportLoading = false
- })
- },
- // 导入或新增货位
- addHW (type) {
- // 导入货位
- if (type == 0) {
- this.openImportModal = true
- } else {
- // 新增货位
- this.nowData = this.basicInfoData
- this.modalType = 'add'
- this.openHwModal = true
- }
- },
- // 禁用启用
- handleEnable (row) {
- const _this = this
- if (row.enableFlag == 1) {
- this.$confirm({
- title: '提示',
- content: '禁用后不参于盘点和补货,但是可以退货、调回,确认禁用吗?',
- centered: true,
- onOk () {
- _this.enableFun(row)
- }
- })
- } else {
- _this.enableFun(row)
- }
- },
- enableFun (row) {
- const _this = this
- _this.spinning = true
- shelfProductEnable({ shelfSn: this.$route.params.sn, shelfProductSn: row.shelfProductApiEntity.shelfProductSn, enableFlag: row.enableFlag == 1 ? 0 : 1 }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- }
- _this.spinning = false
- })
- },
- // 编辑货位
- editHW (row) {
- // 已绑定产品,不能编辑货位号,只能编辑已绑定产品的销售价、结算价、最大库容
- if (row.shelfProductApiEntity && row.shelfProductApiEntity.productSn) {
- this.handleProduct(row, 'edit')
- } else {
- // 货位没有绑定产品,仅编辑货位号
- this.nowData = Object.assign(this.basicInfoData, row)
- this.modalType = 'edit'
- this.openHwModal = true
- }
- },
- // 基本信息
- getDetail () {
- shelfDetail({ sn: this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- this.basicInfoData = res.data
- this.getShelfPriceShow()
- } else {
- this.basicInfoData = null
- }
- })
- },
- // 删除货位
- handleDel (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '删除后无法恢复,确认删除?',
- centered: true,
- onOk () {
- _this.spinning = true
- delShelfPlaceSn({ shelfPlaceSn: row.shelfPlaceSn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- }
- _this.spinning = false
- })
- }
- })
- },
- // 更换产品
- handleReplace (row) {
- if (row.shelfProductApiEntity.qty) {
- this.openTipsModal = true
- } else {
- this.handleProduct(row, 'replace')
- }
- },
- // 更换产品/绑定产品/修改信息
- handleProduct (row, type) {
- if (row) {
- this.nowData = Object.assign(row, { customerSn: this.basicInfoData && this.basicInfoData.customerEntity && this.basicInfoData.customerEntity.customerSn })
- } else {
- this.nowData = null
- }
- this.modalType = type
- this.openModal = true
- },
- handleCancel () {
- this.modalType = null
- this.nowData = null
- this.openModal = false
- this.openHwModal = false
- },
- // 导入成功
- handleGuideOk (obj) {
- shelfProductBatchInsert(obj).then(res => {
- if (res.status == 200) {
- this.$refs.table.refresh(true)
- }
- })
- },
- handleInfoOk () {
- this.getDetail()
- },
- // 重置
- resetSearchForm () {
- this.queryParam.shelfProductApiEntity.productCode = ''
- this.queryParam.shelfProductApiEntity.productName = ''
- this.$refs.table.refresh(true)
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 350
- },
- // 返回列表
- handleBack () {
- this.$router.push({ path: '/numsGoodsShelves/shelfSet/list' })
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.setTableH()
- this.getDetail()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
- if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
- this.setTableH()
- this.getDetail()
- this.resetSearchForm()
- }
- }
- }
- </script>
- <style lang="less">
- .shelfSet-wrap{
- .store-info{
- margin: 0 15px;
- color: rgb(102, 102, 102);
- }
- .shelfSet-cont{
- margin-top: 10px;
- }
- }
- </style>
|