123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <template>
- <div class="storeTransferOutDetail-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-page-header :ghost="false" :backIcon="false" class="storeTransferOutDetail-back" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }">
- <!-- 自定义的二级文字标题 -->
- <template slot="subTitle" v-if="!outBizSn">
- <a id="storeTransferOutDetail-back-btn" href="javascript:;" @click="handleBack">
- <a-icon type="left" />
- 返回列表
- </a>
- <a-button
- v-if="isEdit && $hasPermissions('B_storeCallOutEdit')"
- type="primary"
- size="small"
- style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
- id="storeTransferOutDetail-edit-btn"
- @click.stop="handleEdit"
- >
- 编辑
- </a-button>
- </template>
- <!-- 操作区,位于 title 行的行尾 -->
- <template slot="extra" v-if="outBizSn ? $hasPermissions('B_outboundOrderDetail') : $hasPermissions('B_storeCallOutPrint')">
- <a-checkbox key="4" v-if="$hasPermissions('M_ShowAllCost')" v-model="printCostChecked">打印成本</a-checkbox>
- <Print :disabled="localDataSource.length == 0" :showExport="false" @handlePrint="handlePrint"></Print>
- </template>
- </a-page-header>
- <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont" v-if="basicInfoData">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1" header="基础信息">
- <a-descriptions :column="3">
- <a-descriptions-item label="调往对象名称">
- {{
- (basicInfoData.putPersonType == 'EMPLOYEE'
- ? basicInfoData.putPersonName
- : basicInfoData.customerNameCurrent == basicInfoData.putPersonName
- ? basicInfoData.customerNameCurrent
- : basicInfoData.customerNameCurrent + '(' + basicInfoData.putPersonName + ')') || '--'
- }}
- </a-descriptions-item>
- <a-descriptions-item label="店内调出单号">{{ basicInfoData.storeCallOutNo || '--' }}</a-descriptions-item>
- <a-descriptions-item label="业务状态">{{ basicInfoData.stateDictValue || '--' }}</a-descriptions-item>
- <a-descriptions-item label="财务状态">{{ basicInfoData.settleStateDictValue || '--' }}</a-descriptions-item>
- <a-descriptions-item label="调拨类型">{{ basicInfoData.callOutTypeName || '--' }}</a-descriptions-item>
- <a-descriptions-item label="备注">{{ basicInfoData.remark || '--' }}</a-descriptions-item>
- </a-descriptions>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
- <!-- 总计 -->
- <a-alert type="info" style="margin-bottom:10px">
- <div slot="message">
- 总款数
- <strong>{{ productTotal && (productTotal.productTotalCategory || productTotal.productTotalCategory == 0) ? productTotal.productTotalCategory : '--' }}</strong>
- , 总数量
- <strong>{{ productTotal && (productTotal.productTotalQty || productTotal.productTotalQty == 0) ? productTotal.productTotalQty : '--' }}</strong>
- <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
- ,总成本
- <strong>{{ productTotal && (productTotal.productTotalCost || productTotal.productTotalCost == 0) ? toThousands(productTotal.productTotalCost, 2) : '--' }}</strong>
- </div>
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="record => record.id"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- bordered>
- <div slot="costTitle">
- <a-tooltip placement="top">
- <template slot="title">
- 系统中不同批次的产品,成本价可能不同,此值是按照实际出库批次的成本计算得到。
- </template>
- <span style="margin-right: 5px;">实际总成本</span>
- <a-icon type="question-circle" />
- </a-tooltip>
- </div>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button size="small" type="link" class="button-primary" @click="handleViewDetail(record)">出库明细</a-button>
- </template>
- </s-table>
- <!-- 出入库明细 -->
- <outInDetialModal ref="outInDetialModal" outBizType="SHOP_CALL_OUT" :openModal="showOutInModal" @close="showOutInModal = false"></outInDetialModal>
- </a-card>
- </a-spin>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import { getOperationalPrecision } from '@/libs/tools.js'
- import { storeCallOutDetailList, storeCallOutDetailCount, storeCallOutDetailSn, storeCallOutDetailPrint } from '@/api/storeCallOut'
- import Print from '@/views/common/print.vue'
- import outInDetialModal from '@/views/common/outInDetialModal.vue'
- import { hdPrint } from '@/libs/JGPrint'
- export default {
- name: 'StoreCallOutDetail',
- components: { STable, VSelect, Print, outInDetialModal },
- mixins: [commonMixin],
- props: {
- outBizSn: {
- // 有值则为弹框,无值则为页面
- type: [Number, String],
- default: ''
- }
- },
- data () {
- return {
- spinning: false,
- showOutInModal: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.spinning = true
- return storeCallOutDetailList(Object.assign(parameter, { storeCallOutSn: this.outBizSn || this.$route.params.sn })).then(res => {
- let data
- if (res.status == 200) {
- 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
- // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
- data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
- }
- this.localDataSource = data.list
- }
- this.spinning = false
- return data
- })
- },
- localDataSource: [],
- basicInfoData: null, // 基本信息
- productTotal: null, // 合计
- printCostChecked: true // 打印成本
- }
- },
- computed: {
- isEdit () {
- return (
- ((this.basicInfoData && this.basicInfoData.state == 'WAIT_SUBMIT') || (this.basicInfoData && this.basicInfoData.state == 'WAIT_AUDIT')) &&
- this.$hasPermissions('B_storeCallOutEdit')
- )
- },
- columns () {
- const _this = this
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- {
- title: '产品编码',
- dataIndex: 'productCode',
- width: '22%',
- align: 'center',
- customRender: function (text) {
- return text || '--'
- }
- },
- {
- title: '产品名称',
- dataIndex: 'productName',
- width: '22%',
- align: 'left',
- customRender: function (text) {
- return text || '--'
- },
- ellipsis: true
- },
- {
- title: '单位',
- dataIndex: 'productUnit',
- width: '6%',
- align: 'center',
- customRender: function (text) {
- return text || '--'
- }
- },
- // { title: '成本价(¥)', dataIndex: 'outCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- {
- title: '调出仓库',
- dataIndex: 'warehouseName',
- width: '12%',
- align: 'center',
- customRender: function (text) {
- return text || '--'
- }
- },
- {
- title: '调出仓位',
- dataIndex: 'warehouseLocationName',
- width: '12%',
- align: 'center',
- customRender: function (text) {
- return text || '--'
- }
- },
- {
- title: '调出数量',
- dataIndex: 'outQty',
- width: '10%',
- align: 'center',
- customRender: function (text) {
- return text || text == 0 ? text : '--'
- }
- },
- // { slots: { title: 'costTitle' }, dataIndex: 'totalOutCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
- ]
- if (this.$hasPermissions('M_ShowAllCost')) {
- arr.splice(6, 0, {
- slots: { title: 'costTitle' },
- dataIndex: 'totalOutCost',
- width: '8%',
- align: 'right',
- customRender: function (text) {
- return text || text == 0 ? _this.toThousands(text, 2) : '--'
- }
- })
- }
- return arr
- }
- },
- methods: {
- // 返回列表
- handleBack () {
- this.$router.push({ path: '/allocationManagement/storeTransferOut/list' })
- },
- // 打印预览/快捷打印
- handlePrint (type, printerType) {
- const _this = this
- _this.spinning = true
- const url = storeCallOutDetailPrint
- const params = {
- sn: this.outBizSn || this.$route.params.sn,
- type: printerType,
- costFlag: this.printCostChecked && this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
- }
- // 打印或导出
- hdPrint(printerType, type, url, params, '店内调出单', function () {
- _this.spinning = false
- })
- },
- // 出入库明细
- handleViewDetail (row) {
- this.showOutInModal = true
- this.$refs.outInDetialModal.getData(row)
- },
- // 基本信息
- getDetail () {
- storeCallOutDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- this.basicInfoData = res.data
- this.getDetailCount()
- } else {
- this.basicInfoData = null
- }
- })
- },
- // 合计
- getDetailCount () {
- storeCallOutDetailCount({ storeCallOutSn: this.outBizSn || this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- this.productTotal = res.data
- this.$nextTick(() => {
- this.$refs.table.refresh(true)
- })
- } else {
- this.productTotal = null
- }
- })
- },
- // 编辑
- handleEdit () {
- this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${this.basicInfoData.id}/${this.basicInfoData.storeCallOutSn}` })
- }
- },
- mounted () {
- this.printCostChecked = true
- this.getDetail()
- },
- activated () {
- this.printCostChecked = true
- this.getDetail()
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .storeTransferOutDetail-wrap {
- .storeTransferOutDetail-back {
- margin-bottom: 10px;
- }
- .storeTransferOutDetail-cont {
- margin-bottom: 10px;
- }
- }
- </style>
|