123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <div class="productInfoList-wrap">
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :customRow="handleClickRow"
- :scroll="{ y: 149 }"
- :defaultLoadData="false"
- bordered>
- <template slot="footer">
- <a-row>
- <a-col span="2">合计:</a-col>
- <a-col span="22">
- <a-row>
- <a-col span="4">初期结存数量:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
- <a-col span="4">初期结存单价:{{ (totalData && (totalData.jpBsxLqqAmount || totalData.jpBsxLqqAmount==0)) ? toThousands(totalData.jpBsxLqqAmount) : '--' }}</a-col>
- <a-col span="4">初期结存金额:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
- <a-col span="4">本期收入数量:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
- <a-col span="4">本期收入单价:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
- <a-col span="4">本期收入金额:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
- <a-col span="4">本期发出数量:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
- <a-col span="4">本期发出单价:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
- <a-col span="4">本期发出金额:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
- <a-col span="4">本期结存数量:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
- <a-col span="4">本期结存单价:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
- <a-col span="4">本期结存金额:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
- </a-row>
- </a-col>
- </a-row>
- </template>
- </s-table>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { queryStockProductPage } from '@/api/stock'
- import ProductType from '@/views/common/productType.js'
- import ProductBrand from '@/views/common/productBrand.js'
- import { STable, VSelect } from '@/components'
- export default {
- name: 'QueryPart',
- mixins: [commonMixin],
- components: { STable, VSelect, ProductBrand, ProductType },
- props: {
- newLoading: Boolean
- },
- data () {
- return {
- advanced: false, // 高级搜索 展开/关闭
- showSetting: false, // 设置弹框
- productType: [],
- buyerSn: '',
- queryParam: { // 查询条件
- productCode: '', // 产品编码
- productName: '', // 产品名称
- productOrigCode: '', // 原厂编码
- productBrandSn: undefined, // 产品品牌
- productTypeSn1: '', // 产品一级分类
- productTypeSn2: '', // 产品二级分类
- productTypeSn3: '' // 产品三级分类
- },
- columns: [
- { title: '二级分类', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '三级分类', dataIndex: 'productName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '品牌', dataIndex: 'productBrandName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '期初结存数量', dataIndex: 'currentStockQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '期初结存单价', dataIndex: 'productPrice', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '期初结存金额', dataIndex: 'productPrice', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '本期收入数量', dataIndex: 'productUnit', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '本期收入单价', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '本期收入金额', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '本期发出数量', dataIndex: 'packQtyV', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '本期发出单价', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '本期发出金额', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '期末结存数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: '12%', align: 'center' },
- { title: '期末结存单价', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
- { title: '期末结存金额', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') }
- ],
- disabled: false, // 查询、重置按钮是否可操作
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.queryParam.dealerSn = this.buyerSn
- return queryStockProductPage(Object.assign(parameter, this.queryParam, { onlineFalg: '1', pricingState: 'PRICED' })).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- data.list = data.list.filter(item => item != null)
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- data.list[i].salesNums = 1
- data.list[i].currentStockQty = data.list[i].currentStockQty || 0
- const productPackQty = (data.list[i].productPackQty || data.list[i].productPackQty == 0) ? data.list[i].productPackQty : '--'
- const productUnit = data.list[i].productUnit || '--'
- const productPackQtyUnit = data.list[i].productPackQtyUnit || '--'
- data.list[i].packQtyV = productPackQty + productUnit + '/' + productPackQtyUnit
- }
- this.disabled = false
- }
- return data
- })
- }
- }
- },
- methods: {
- // 双击列表
- handleClickRow (record) {
- const _this = this
- return {
- on: {
- dblclick: (event) => {
- if (!record.productPrice || record.productPrice <= 0) {
- _this.$message.info('该产品暂时不能添加')
- } else {
- event.stopPropagation()
- _this.$emit('add', record, 0)
- }
- }
- }
- }
- },
- // 重置
- resetSearchForm () {
- this.queryParam.productCode = ''
- this.queryParam.productName = ''
- this.queryParam.productOrigCode = ''
- this.queryParam.productBrandSn = undefined
- this.queryParam.productTypeSn1 = ''
- this.queryParam.productTypeSn2 = ''
- this.queryParam.productTypeSn3 = ''
- this.productType = []
- this.$refs.table.refresh(true)
- },
- pageInit (buyerSn) {
- this.buyerSn = buyerSn
- this.resetSearchForm()
- },
- // 刷新当前页面
- resetCurForm () {
- this.$refs.table.refresh()
- },
- // 选择配件
- handleAdd (row) {
- this.$emit('add', row, 0)
- },
- // 产品分类 change
- changeProductType (val, opt) {
- this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
- this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
- this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .productInfoList-wrap{
- .ellipsisCon{
- display: flex;
- justify-content: space-between;
- align-items: center;
- .ellipsisText{
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- display: box;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- }
- }
- </style>
|