123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <template>
- <a-card size="small" :bordered="false" class="giftRecordList-wrap">
- <!-- 搜索条件 -->
- <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="创建时间">
- <rangeDate ref="rangeDate" @change="dateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品编码">
- <a-input id="giftRecordList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="原厂编码">
- <a-input id="giftRecordList-productOrigCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="关联销售单号">
- <a-input id="giftRecordList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入关联销售单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="赠送客户">
- <custList ref="custList" @change="custChange" v-model="queryParam.customerSn"></custList>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="giftRecordList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="giftRecordList-reset">重置</a-button>
- <a @click="advanced=!advanced" style="margin-left: 8px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ x: 1620, y: tableHeight }"
- bordered>
- </s-table>
- </a-card>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import custList from '@/views/common/custList.vue'
- import rangeDate from '@/views/common/rangeDate.vue'
- import { giftsDetailList } from '@/api/dealerProduct'
- export default {
- components: { STable, VSelect, rangeDate, custList },
- data () {
- return {
- tableHeight: 0,
- advanced: false, // 高级搜索 展开/关闭
- queryParam: { // 查询条件
- beginDate: '',
- endDate: '',
- productCode: '', // 产品编码
- productOrigCode: '', // 原厂编码
- salesBillNo: '', // 关联销售单号
- customerSn: undefined // 赠送客户
- },
- disabled: false, // 查询、重置按钮是否可操作
- columns: [
- { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
- { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '赠品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '赠送数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '关联销售单号', dataIndex: 'salesBillNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '赠送客户', dataIndex: 'customerName', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '成本价(¥)', dataIndex: 'cost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '成本小计(¥)', dataIndex: 'totalCost', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- if (this.tableHeight == 0) {
- this.tableHeight = window.innerHeight - 260
- }
- return giftsDetailList(Object.assign(parameter, this.queryParam)).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.disabled = false
- return data
- })
- }
- }
- },
- methods: {
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- // 客户 change
- custChange (obj) {
- this.queryParam.customerSn = obj.key || undefined
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate()
- this.queryParam.beginDate = ''
- this.queryParam.endDate = ''
- this.queryParam.productCode = ''
- this.queryParam.productOrigCode = ''
- this.queryParam.salesBillNo = ''
- this.queryParam.customerSn = undefined
- if (this.advanced) {
- this.$refs.custList.resetForm()
- }
- this.$refs.table.refresh(true)
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
|