123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <template>
- <a-modal
- centered
- class="inventoryQueryDetail-modal"
- :footer="null"
- :maskClosable="false"
- :title="modalTit"
- v-model="isShow"
- @cancel="isShow=false"
- :width="960">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 基础信息 -->
- <a-card size="small" :bordered="false" class="purchaseReturnDetail-cont">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1" header="基础信息">
- <a-descriptions :column="3">
- <a-descriptions-item label="采购单号">{{ objItem&&objItem.purchaseBillNo || '--' }}</a-descriptions-item>
- </a-descriptions>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <!-- 合计 -->
- <a-alert type="info" style="margin-bottom:10px" v-if="objItem">
- <div class="ftext" slot="message">
- 缺货总款数:<strong>{{ objItem.totalCategory || objItem.totalCategory==0 ? objItem.totalCategory : '--' }}</strong>;
- 缺货总数量:<strong>{{ objItem.totalQty || objItem.totalQty==0 ? objItem.totalQty : '--' }}</strong>;
- <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
- 缺货总售价:<strong>{{ objItem.totalAmount || objItem.totalAmount==0 ? toThousands(objItem.totalAmount) : '--' }}</strong>。
- </div>
- </div>
- </a-alert>
- <!-- 详情 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: 500 }"
- bordered>
- <!-- 产品编码 -->
- <template slot="code" slot-scope="text, record">
- <span>{{ record.productCode }}</span>
- <a-badge v-if="record.promotionFlag && record.promotionFlag=='GIFT'" count="促" :number-style="{ backgroundColor: '#52c41a', zoom:'80%',marginLeft:'5px' }"></a-badge>
- <a-badge v-if="record.promotionFlag && record.promotionFlag=='DISCOUNT'" count="特" :number-style="{ backgroundColor: '#faad14', zoom:'80%',marginLeft:'5px' }"></a-badge>
- </template>
- <!-- 缺货单价 -->
- <template slot="unitPrice" slot-scope="text, record">
- <span v-if="record.promotionFlag && (record.promotionFlag=='GIFT' || record.promotionFlag=='DISCOUNT')">{{ record.price||record.price==0? toThousands(record.price): '--' }}{{ record.origPrice ? '(' + toThousands(record.origPrice) + ')' : '' }}</span>
- <span v-else>{{ toThousands(record.price||0) }}</span>
- </template>
- </s-table>
- <div class="btn-cont">
- <a-button id="inventoryQueryDetail-detail-modal-back" @click="isShow = false">返回列表</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable } from '@/components'
- import { outOfStockDetailList } from '@/api/oos'
- export default {
- name: 'DetailModal',
- components: { STable },
- mixins: [commonMixin],
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- objItem: {
- type: Object,
- default: () => {
- return {}
- }
- }
- },
- computed: {
- modalTit () {
- return '详情'
- },
- columns () {
- const _this = this
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '产品编码', dataIndex: 'productCode', scopedSlots: { customRender: 'code' }, width: '12%', align: 'center' },
- { title: '产品名称', dataIndex: 'productName', width: '17%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '原厂编码', dataIndex: 'origCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '缺货数量', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '单价', dataIndex: 'price', width: '11%', align: 'right', scopedSlots: { customRender: 'unitPrice' } },
- { title: '缺货金额', dataIndex: 'totalAmount', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ]
- return arr
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal, // 是否打开弹框
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return outOfStockDetailList(Object.assign(parameter, { purchaseBillSn: this.objItem && this.objItem.purchaseBillSn || '' })).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
- }
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- },
- disabled: false // 查询、重置按钮是否可操作
- }
- },
- methods: {
- // 获取表格数据
- pageInit () {
- this.$refs.table.refresh()
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.$refs.table.clearTable()
- }
- }
- }
- }
- </script>
- <style lang="less">
- .inventoryQueryDetail-modal{
- .btn-cont {
- text-align: center;
- margin: 5px 0 10px;
- }
- }
- </style>
|