123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- <template>
- <div class="productInfoList-wrap">
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="searchForm">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="出库仓库" prop="warehouseSn" required>
- <chooseWarehouse ref="warehouse" :allowClear="false" v-model="queryParam.warehouseSn" :isDefault="true" @load="loadWarehouse"></chooseWarehouse>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品编码">
- <a-input id="productInfoList-code" 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="productInfoList-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="原厂编码">
- <a-input id="productInfoList-origCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品品牌">
- <ProductBrand id="productInfoList-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品分类">
- <ProductType id="productInfoList-productType" v-model="productType" @change="changeProductType"></ProductType>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="searchForm" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
- <a @click="advanced=!advanced" style="margin: 0 5px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <a-tabs type="card" @change="changeTab">
- <a-tab-pane v-for="item in tabList" :key="item.val" :tab="item.text"></a-tab-pane>
- </a-tabs>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :customRow="handleClickRow"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- :pageSize="50"
- bordered>
- <!-- 销售数量 -->
- <template slot="nums" slot-scope="text, record">
- <div @dblclick.stop>
- <a-input-number
- size="small"
- v-model="record.salesNums"
- :precision="0"
- :min="1"
- :max="999999"
- style="width: 100%;"
- placeholder="请输入" />
- </div>
- </template>
- <!-- 产品名称 -->
- <template slot="productName" slot-scope="text, record">
- <div class="ellipsisCon">
- <a-tooltip placement="rightBottom">
- <template slot="title">
- <span>{{ text }}</span>
- </template>
- <span class="ellipsisText">{{ text }}</span>
- </a-tooltip>
- <a-badge :number-style="{ backgroundColor: '#52c41a' }" count="活动" v-if="record.isJoinActivityProduct == 1"></a-badge>
- </div>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- class="button-info"
- :loading="newLoading"
- @click="handleAdd(record)"
- v-if="record.productPrice"
- id="productInfoList-edit-btn">添加</a-button>
- <span v-else>--</span>
- </template>
- </s-table>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { queryPromoProductPage } from '@/api/stock'
- import ProductType from '@/views/common/productType.js'
- import ProductBrand from '@/views/common/productBrand.js'
- import chooseWarehouse from '@/views/common/chooseWarehouse'
- import { STable, VSelect } from '@/components'
- export default {
- name: 'ActiveQueryPart',
- mixins: [commonMixin],
- components: { STable, VSelect, ProductBrand, ProductType, chooseWarehouse },
- props: {
- newLoading: Boolean
- },
- data () {
- return {
- advanced: false, // 高级搜索 展开/关闭
- showSetting: false, // 设置弹框
- productType: [],
- buyerSn: '',
- queryParam: { // 查询条件
- productCode: '', // 产品编码
- productName: '', // 产品名称
- productOrigCode: '', // 原厂编码
- productBrandSn: undefined, // 产品品牌
- productTypeSn1: '', // 产品一级分类
- productTypeSn2: '', // 产品二级分类
- productTypeSn3: '', // 产品三级分类
- warehouseSn: undefined
- },
- defaultWarehouseSn: undefined, // 默认仓库sn
- tableHeight: 300,
- disabled: false, // 查询、重置按钮是否可操作
- promoProductClz: 'GATE',
- promoRuleData: null,
- tabList:[],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.queryParam.dealerSn = this.buyerSn
- this.queryParam.promoProductClz = this.promoProductClz
- return queryPromoProductPage(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
- data.list[i].unitQtyV = data.list[i].unitQty + data.list[i].unitTypeDictValue
- }
- this.disabled = false
- }
- return data
- })
- }
- }
- },
- computed: {
- columns () {
- const arr = [
- { title: '产品编码', dataIndex: 'productCode', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productName', scopedSlots: { customRender: 'productName' }, width: '18%', align: 'left' },
- { title: '原厂编码', dataIndex: 'productOrigCode', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '品牌', dataIndex: 'productBrandName', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '出库仓库', dataIndex: 'warehouseName', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '库存数量', dataIndex: 'currentStockQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- // { title: '售价', dataIndex: 'productPrice', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '包装数', dataIndex: 'packQtyV', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '起订量', dataIndex: 'unitQtyV', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '下单数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: '8%', align: 'center' },
- { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
- ]
- if (this.$hasPermissions('B_salesEdit_salesPrice')) { // 售价权限
- arr.splice(6, 0, { title: '售价', dataIndex: 'productPrice', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
- }
- return arr
- }
- },
- watch:{
- advanced(a,b){
- this.tableHeight = window.innerHeight - (a ? 395 : 350)
- }
- },
- methods: {
- loadWarehouse (sn) {
- this.defaultWarehouseSn = sn
- this.queryParam.warehouseSn = sn
- if(this.buyerSn){
- this.resetSearchForm()
- }
- },
- // 切换tab
- changeTab(e){
- this.promoProductClz = e
- this.resetSearchForm()
- },
- // 双击列表
- 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, this.promoProductClz)
- }
- }
- }
- }
- },
- // 查询
- searchForm () {
- if (this.queryParam.warehouseSn) {
- this.$refs.table.refresh(true)
- } else {
- this.$message.info('请选择仓库')
- }
- },
- // 重置
- 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.queryParam.warehouseSn = this.defaultWarehouseSn
- this.$refs.table.refresh(true)
- },
- pageInit (data, promo) {
- this.buyerSn = data.buyerSn
- this.promoRuleData = promo.promotionRule
- this.queryParam.dealerLevel = data.buyerLevel
- this.queryParam.promoRuleSn = promo.promoRuleSn
- const tabList = []
- if(this.promoRuleData){
- if(this.promoRuleData.gateFlag==='1'){
- tabList.push({text:'门槛产品',val:'GATE'})
- }
- if(this.promoRuleData.promotionRuleType!='PROMO_PROD'){
- tabList.push({text:'正价产品',val:'REGULAR'})
- }
- if(this.promoRuleData.regularPromotionSameFlag==='0'){
- tabList.push({text:'促销产品',val:'GIFT'})
- }
- if(this.promoRuleData.promotionRuleType=='PROMO_PROD'){
- tabList.push({text:'特价产品',val:'DISCOUNT'})
- }
- }
- this.tabList = tabList
- this.promoProductClz = tabList[0].val
- this.tableHeight = window.innerHeight - 350
- },
- // 刷新当前页面
- resetCurForm () {
- const _this = this
- _this.$nextTick(() => {
- _this.$refs.table.refresh()
- })
- },
- // 选择配件
- handleAdd (row) {
- this.$emit('add', row, 0, this.promoProductClz)
- },
- // 产品分类 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{
- /deep/ .ant-tabs-bar{
- margin-bottom: 5px!important;
- }
- }
- </style>
|