123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <a-modal
- centered
- class="orderStatisticsDetail-modal"
- :footer="null"
- :maskClosable="false"
- title="促销品明细"
- v-model="isShow"
- @cancle="isShow=false"
- width="80%">
- <div>
- <p>销售单号: {{ nowData.salesBillNo || '--' }}</p>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- :scroll="{ x: 1400, y: 400 }"
- bordered>
- </s-table>
- <div class="btn-cont"><a-button id="orderStatisticsDetail-back" @click="isShow = false">返回列表</a-button></div>
- </div>
- </a-modal>
- </template>
- <script>
- import { STable } from '@/components'
- import { salesDetailList } from '@/api/salesDetail'
- export default {
- name: 'OrderStatisticsDetailModal',
- components: { STable },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemSn: {
- type: [Number, String],
- default: ''
- },
- nowData: {
- type: Object,
- default: () => {
- return {}
- }
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- // 表头
- columns: [
- { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
- { title: '产品编码', dataIndex: 'productEntity.code', width: 220, align: 'center' },
- { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '原价', dataIndex: 'origPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '促销价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '单位', dataIndex: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '原价小计', dataIndex: 'totalAmounts', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '促销价小计', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '节省金额小计', dataIndex: 'totalEconomizeAmount', width: 130, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '促销类型', dataIndex: 'promotionRulesName', width: 150, align: 'center', customRender: function (text) { return text || '--' } }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- return salesDetailList(Object.assign(parameter, { salesBillSn: this.itemSn, promotionFlag: 1 })).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
- // priceSubtotal
- }
- return data
- })
- }
- }
- },
- methods: {
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- }
- },
- itemSn (newValue, oldValue) {
- if (this.isShow && newValue) {
- const _this = this
- setTimeout(() => {
- _this.$refs.table.refresh(true)
- }, 300)
- }
- }
- }
- }
- </script>
- <style lang="less">
- .orderStatisticsDetail-modal{
- .ant-modal-body {
- padding: 40px 40px 24px;
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|