|
@@ -2,7 +2,7 @@
|
|
|
<div>
|
|
|
<!-- 筛选条件 -->
|
|
|
<div class="table-page-search-wrapper" style="margin:0" v-show="showSearchBox">
|
|
|
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="searchProduct">
|
|
|
<a-row :gutter="15" type="flex">
|
|
|
<a-col flex="1">
|
|
|
<a-form-item label="出库仓库" prop="warehouseSn">
|
|
@@ -52,7 +52,7 @@
|
|
|
</a-col>
|
|
|
<a-col flex="1">
|
|
|
<a-form-item label="满足起订量">
|
|
|
- <v-select code="FLAG" allowClear placeholder="请选择是否满足起订量"></v-select>
|
|
|
+ <v-select code="FLAG" v-model="queryParam.unitFlag" allowClear placeholder="请选择是否满足起订量"></v-select>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col flex="1">
|
|
@@ -61,7 +61,7 @@
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col flex="2" style="margin-bottom: 10px;">
|
|
|
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" :id="'salesEdit-refresh-'+id">查询</a-button>
|
|
|
+ <a-button type="primary" @click="searchProduct" :disabled="disabled" :id="'salesEdit-refresh-'+id">查询</a-button>
|
|
|
<a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" :id="'salesEdit-reset-'+id">重置</a-button>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -110,135 +110,34 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 已选配件列表 -->
|
|
|
- <s-table
|
|
|
- class="sTable"
|
|
|
- ref="table"
|
|
|
- size="small"
|
|
|
- :rowKey="(record) => record.id"
|
|
|
- :columns="columns"
|
|
|
- :data="loadData"
|
|
|
- :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.promotionFlag == 'GIFT'&&!!record.salesPromoDetailParentSn } }) }"
|
|
|
- @rowSelection="rowSelectionFun"
|
|
|
- :defaultLoadData="false"
|
|
|
- :showPagination="false"
|
|
|
- bordered>
|
|
|
- <!-- 产品编码 -->
|
|
|
- <template slot="productCode" slot-scope="text, record">
|
|
|
- <span style="padding-right: 10px;">{{ text }}</span>
|
|
|
- <a-badge count="促" v-if="record.promotionFlag.indexOf('GIFT')>=0" :number-style="{ backgroundColor: '#52c41a', zoom:'0.7' }"></a-badge>
|
|
|
- <a-badge count="特" v-if="record.promotionFlag.indexOf('DISCOUNT')>=0" :number-style="{ backgroundColor: '#faad14', zoom:'0.7' }"></a-badge>
|
|
|
- <a-badge count="槛" v-if="record.promotionFlag.indexOf('GATE')>=0" :number-style="{ backgroundColor: '#108ee9', zoom:'0.7' }"></a-badge>
|
|
|
- <a-badge count="正" v-if="record.promotionFlag.indexOf('REGULAR')>=0" :number-style="{ backgroundColor: '#ff5500', zoom:'0.7' }"></a-badge>
|
|
|
- <a-badge count="缺" v-if="Number(record.stockQty||0) < Number(record.unpushedQty||0)" :number-style="{ zoom:'0.7' }"></a-badge>
|
|
|
- </template>
|
|
|
- <!-- 产品名称 -->
|
|
|
- <template slot="productName" slot-scope="text, record">
|
|
|
- <div class="ellipsisCon">
|
|
|
- <span class="ellipsisText" :title="text">{{ text }}</span>
|
|
|
- <a-badge :number-style="{ backgroundColor: '#52c41a' }" count="活动" v-if="record.promotableFlag == 1"></a-badge>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <!-- 销售价 -->
|
|
|
- <template slot="price" slot-scope="text, record">
|
|
|
- {{ toThousands(text) }}
|
|
|
- <span v-if="record.promotionFlag=='GIFT'||record.promotionFlag=='DISCOUNT'" title="原价">({{ toThousands(record.origPrice) }})</span>
|
|
|
- </template>
|
|
|
- <!-- 折扣 -->
|
|
|
- <template slot="discountPrice" slot-scope="text, record">
|
|
|
- <div v-if="record.promotionFlag=='DISCOUNT'">
|
|
|
- <span v-if="record.specialType=='1'">{{ record.priceLevel=='PROVINCE'? (record.provinceDiscount*100).toFixed(2):record.priceLevel=='CITY'?(record.cityDiscount*100).toFixed(2):(record.specialDiscount*100).toFixed(2) }}%</span>
|
|
|
- <span v-else>{{ ((record.price/record.origPrice)*100).toFixed(2) }}%</span>
|
|
|
- </div>
|
|
|
- <div v-else>--</div>
|
|
|
- </template>
|
|
|
- <!-- 规则数量 -->
|
|
|
- <template slot="rulesNums" slot-scope="text, record">
|
|
|
- <a-popover placement="right">
|
|
|
- <template slot="content">
|
|
|
- <div
|
|
|
- title="点击查看详情"
|
|
|
- style="padding:5px 0;cursor: pointer;"
|
|
|
- v-for="item in record.promoRuleSnList"
|
|
|
- @click="showRuleDetail(item)"
|
|
|
- :id="'salesEdit-gzitem-'+id+'-'+record.id"
|
|
|
- :key="item">{{ activeRuleFilter(item) }}</div>
|
|
|
- </template>
|
|
|
- <a-button type="link" :id="'salesEdit-gzqty-'+id+'-'+record.id" size="small" class="button-info">{{ record.promoRuleNum }}<span style="zoom:0.6;color: #666;">个∨</span></a-button>
|
|
|
- </a-popover>
|
|
|
- </template>
|
|
|
- <!-- 销售数量 -->
|
|
|
- <template slot="salesNums" slot-scope="text, record">
|
|
|
- <a-input-number
|
|
|
- :id="'salesEdit-qty-'+id+'-'+record.id"
|
|
|
- v-if="!(record.promotionFlag == 'GIFT'&&record.salesPromoDetailParentSn)"
|
|
|
- size="small"
|
|
|
- v-model="record.qty"
|
|
|
- :precision="0"
|
|
|
- :min="1"
|
|
|
- :max="99999999"
|
|
|
- placeholder="请输入"
|
|
|
- @blur="e => onCellBlur(e.target.value, record)"
|
|
|
- :style="{width:'100%',color:record.qty>=record.unitQtyR?'':'red'}" />
|
|
|
- <span v-else>{{ record.qty }}</span>
|
|
|
- </template>
|
|
|
- <!-- 当前库存 -->
|
|
|
- <template slot="stockQty" slot-scope="text, record">
|
|
|
- <div v-if="record.stockQty || record.stockQty==0">
|
|
|
- <p style="margin: 0;" v-if="Number(record.stockQty) < Number(record.unpushedQty)">{{ record.stockQty }}(<span class="redStyle">缺{{ Number(record.unpushedQty||0) - Number(record.stockQty||0) }}</span>)</p>
|
|
|
- <p style="margin: 0;" v-else>{{ record.stockQty }}</p>
|
|
|
- </div>
|
|
|
- <span v-else>--</span>
|
|
|
- </template>
|
|
|
- <!-- 出库仓库 -->
|
|
|
- <template slot="warehouseBox" slot-scope="text, record">
|
|
|
- <a-select
|
|
|
- :id="'salesEdit-warehouse-'+id+'-'+record.id"
|
|
|
- size="small"
|
|
|
- style="width:100%;"
|
|
|
- placeholder="请选择仓库"
|
|
|
- v-model="record.warehouseSn"
|
|
|
- :showSearch="true"
|
|
|
- @change="handleWarehouseBox(record)"
|
|
|
- mode="default"
|
|
|
- :filter-option="filterOption">
|
|
|
- <a-select-option v-for="item in warehouseDataList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
- </template>
|
|
|
- <!-- 操作 -->
|
|
|
- <template slot="action" slot-scope="text, record">
|
|
|
- <div>
|
|
|
- <a-button
|
|
|
- :id="'salesEdit-upactive-'+id+'-'+record.id"
|
|
|
- size="small"
|
|
|
- type="link"
|
|
|
- :loading="delLoading"
|
|
|
- class="button-primary"
|
|
|
- v-if="record.promotionFlag != 'GIFT'"
|
|
|
- @click="handleUpdateActive(record)"
|
|
|
- >换促销</a-button>
|
|
|
- <a-button
|
|
|
- :id="'salesEdit-del-'+id+'-'+record.id"
|
|
|
- size="small"
|
|
|
- type="link"
|
|
|
- :loading="delLoading"
|
|
|
- class="button-error"
|
|
|
- v-if="!(record.promotionFlag == 'GIFT'&&record.salesPromoDetailParentSn)"
|
|
|
- @click="handleDel(record)"
|
|
|
- >删除</a-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </s-table>
|
|
|
-
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
+ <ve-table
|
|
|
+ style="width:100%"
|
|
|
+ border-y
|
|
|
+ border-x
|
|
|
+ border-around
|
|
|
+ :max-height="300"
|
|
|
+ :scroll-width="0"
|
|
|
+ :column-width-resize-option="columnWidthResizeOption"
|
|
|
+ :row-style-option="{clickHighlight: true}"
|
|
|
+ :cellSelectionOption="{enable: false}"
|
|
|
+ :virtual-scroll-option="{enable: true}"
|
|
|
+ :columns="columns"
|
|
|
+ :table-data="dataSource"
|
|
|
+ row-key-field-name="id"
|
|
|
+ :checkbox-option="checkboxOption"
|
|
|
+ />
|
|
|
+ </a-spin>
|
|
|
<!-- 仓库设置 -->
|
|
|
<setWarehouse :title="warehouseTit" :show="openWarehouseModal" @ok="chooseWarehouseOk" @cancel="openWarehouseModal=false"></setWarehouse>
|
|
|
<!-- 换促销 -->
|
|
|
- <updateActiveModal ref="updateActive" :show="openUpActiveModal" @ok="upActiveOk" @cancel="openUpActiveModal=false"></updateActiveModal>
|
|
|
+ <updateActiveModal ref="updateActive" :pageType="true" :show="openUpActiveModal" @ok="upActiveOk" @cancel="openUpActiveModal=false"></updateActiveModal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
-import { STable, VSelect } from '@/components'
|
|
|
+import { VSelect } from '@/components'
|
|
|
import setWarehouse from './setWarehouse.vue'
|
|
|
import updateActiveModal from './updateActiveModal.vue'
|
|
|
import chooseWarehouse from '@/views/common/chooseWarehouse'
|
|
@@ -259,7 +158,6 @@ export default {
|
|
|
name: 'ProductList',
|
|
|
mixins: [commonMixin],
|
|
|
components: {
|
|
|
- STable,
|
|
|
VSelect,
|
|
|
chooseWarehouse,
|
|
|
setWarehouse, // 设置仓库组件
|
|
@@ -301,31 +199,14 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
|
- dataSource: [],
|
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
- loadData: parameter => {
|
|
|
- this.disabled = true
|
|
|
- this.queryParam.salesBillSn = this.salesBillSn || ''
|
|
|
- this.queryParam.salesPromoSnSet = this.salesPromoSnSet || []
|
|
|
- return salesDetailExtPromoList(Object.assign(parameter, this.queryParam, {
|
|
|
- showStock: true,
|
|
|
- promoFlag: this.detailData.promoFlag
|
|
|
- })).then(res => {
|
|
|
- let data
|
|
|
- if (res.status == 200) {
|
|
|
- data = res.data
|
|
|
- const no = 0
|
|
|
- for (var i = 0; i < data.length; i++) {
|
|
|
- data[i].no = no + i + 1
|
|
|
- data[i].qtyBackups = data[i].qty
|
|
|
- data[i].productUnit = data[i].productEntity && data[i].productEntity.unit
|
|
|
- }
|
|
|
- this.dataSource = data
|
|
|
- }
|
|
|
- this.disabled = false
|
|
|
- return data
|
|
|
- })
|
|
|
+ // 表格列宽拖到
|
|
|
+ columnWidthResizeOption: {
|
|
|
+ // default false
|
|
|
+ enable: true,
|
|
|
+ // column resize min width
|
|
|
+ minWidth: 50
|
|
|
},
|
|
|
+ dataSource: [],
|
|
|
showSearchBox: true, // 是否显示筛选条件
|
|
|
openWarehouseModal: false, // 打开仓库设置
|
|
|
delLoading: false, // 删除logding
|
|
@@ -338,10 +219,12 @@ export default {
|
|
|
productTypeSn1: '', // 产品一级分类
|
|
|
productTypeSn2: '', // 产品二级分类
|
|
|
productTypeSn3: '', // 产品三级分类
|
|
|
- borrowFlag: undefined // 是否累计产品
|
|
|
+ borrowFlag: undefined, // 是否累计产品
|
|
|
+ unitFlag: undefined // 是否满足起订量
|
|
|
},
|
|
|
productType: [], // 已选产品分类
|
|
|
- rowSelectionInfo: null, // 已选产品数据
|
|
|
+ disableSelectedRowKeys: [], // 禁用的行
|
|
|
+ selectedRowKeys: [], // 已选行
|
|
|
warehouseDataList: [], // 仓库列表数据
|
|
|
openUpActiveModal: false, // 更换促销活动弹框
|
|
|
descDetail: null, // 规则详细数据
|
|
@@ -353,30 +236,214 @@ export default {
|
|
|
computed: {
|
|
|
// 已选产品数量
|
|
|
selectTotal () {
|
|
|
- return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
|
|
|
+ return this.selectedRowKeys.length || 0
|
|
|
+ },
|
|
|
+ // 表格复选框设置
|
|
|
+ checkboxOption () {
|
|
|
+ return {
|
|
|
+ disableSelectedRowKeys: this.disableSelectedRowKeys,
|
|
|
+ selectedRowKeys: this.selectedRowKeys,
|
|
|
+ // 行选择改变事件
|
|
|
+ selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
|
+ this.selectedRowChange({ row, isSelected, selectedRowKeys })
|
|
|
+ },
|
|
|
+ // 全选改变事件
|
|
|
+ selectedAllChange: ({ isSelected, selectedRowKeys }) => {
|
|
|
+ this.selectedAllChange({ isSelected, selectedRowKeys })
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// 表格列
|
|
|
columns () {
|
|
|
+ const _this = this
|
|
|
+ // 价格
|
|
|
+ const priceFormat = function (data) {
|
|
|
+ return _this.toThousands(data) || '--'
|
|
|
+ }
|
|
|
+ // 数字
|
|
|
+ const numsFormat = function (data) {
|
|
|
+ return data || data == 0 ? data : '--'
|
|
|
+ }
|
|
|
const arr = [
|
|
|
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '12%', align: 'center' },
|
|
|
- { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '25%', align: 'left' },
|
|
|
- { title: '规则数量', scopedSlots: { customRender: 'rulesNums' }, width: '4%', align: 'center' },
|
|
|
- { title: '起订量', dataIndex: 'promoUnit', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '6%', align: 'center' },
|
|
|
- { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '5%', align: 'center' },
|
|
|
- { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '8%', align: 'center' },
|
|
|
- { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
|
|
|
+ { title: '', field: '', key: '0', width: 40, type: 'checkbox', align: 'center' },
|
|
|
+ { title: '序号', field: 'no', key: '1', width: 50, align: 'center', operationColumn: false },
|
|
|
+ {
|
|
|
+ title: '产品编码',
|
|
|
+ field: 'productCode',
|
|
|
+ key: '2',
|
|
|
+ align: 'center',
|
|
|
+ width: 120,
|
|
|
+ operationColumn: false,
|
|
|
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <span style="padding-right: 10px;">{row.productEntity.code}</span>
|
|
|
+ {row.promotionFlag.indexOf('GIFT') >= 0 ? <a-badge count="促" numberStyle={{ backgroundColor: '#52c41a', zoom: '0.7' }}/> : ''}
|
|
|
+ {row.promotionFlag.indexOf('DISCOUNT') >= 0 ? <a-badge count="特" numberStyle={{ backgroundColor: '#faad14', zoom: '0.7' }}/> : ''}
|
|
|
+ {row.promotionFlag.indexOf('GATE') >= 0 ? <a-badge count="槛" numberStyle={{ backgroundColor: '#108ee9', zoom: '0.7' }}/> : ''}
|
|
|
+ {row.promotionFlag.indexOf('REGULAR') >= 0 ? <a-badge count="正" numberStyle={{ backgroundColor: '#ff5500', zoom: '0.7' }}/> : ''}
|
|
|
+ {Number(row.stockQty || 0) < Number(row.unpushedQty || 0) ? <a-badge count="缺" numberStyle={{ zoom: '0.7' }}/> : ''}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { title: '产品名称', field: 'productName', key: '3', width: 150, align: 'center', operationColumn: false, ellipsis: { showTitle: true }, renderBodyCell: ({ row, column, rowIndex }, h) => { return row.productEntity.name || '--' } },
|
|
|
+ {
|
|
|
+ title: '规则数量',
|
|
|
+ field: 'rulesNums',
|
|
|
+ key: '4',
|
|
|
+ width: 60,
|
|
|
+ align: 'center',
|
|
|
+ operationColumn: false,
|
|
|
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
+ return (
|
|
|
+ <a-popover placement="right">
|
|
|
+ <template slot="content">
|
|
|
+ {row.promoRuleSnList.map(item => {
|
|
|
+ return (
|
|
|
+ <div
|
|
|
+ id={'salesEdit-gzitem-' + row.id}
|
|
|
+ title="点击查看详情"
|
|
|
+ style="padding:5px 0;cursor: pointer;"
|
|
|
+ onClick={() => _this.showRuleDetail(item)}
|
|
|
+ >{ _this.activeRuleFilter(item) }</div>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </template>
|
|
|
+ <a-button type="link" id={'salesEdit-gzqty-' + row.id} size="small" class="button-info">{row.promoRuleNum}<span style="zoom:0.6;color: #666;">个∨</span></a-button>
|
|
|
+ </a-popover>
|
|
|
+ )
|
|
|
+ } },
|
|
|
+ { title: '起订量', field: 'promoUnit', key: '5', width: 100, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
|
|
|
+ {
|
|
|
+ title: '销售数量',
|
|
|
+ field: 'salesNums',
|
|
|
+ key: '6',
|
|
|
+ width: 80,
|
|
|
+ align: 'center',
|
|
|
+ operationColumn: false,
|
|
|
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
+ return (
|
|
|
+ !(row.promotionFlag == 'GIFT' && row.salesPromoDetailParentSn)
|
|
|
+ ? <a-input-number
|
|
|
+ id={'salesEdit-qty-' + row.id}
|
|
|
+ size="small"
|
|
|
+ vModel={row.qty}
|
|
|
+ precision={0}
|
|
|
+ min={1}
|
|
|
+ max={99999999}
|
|
|
+ placeholder="请输入"
|
|
|
+ onBlur={(e) => _this.onCellBlur(e.target.value, row)}
|
|
|
+ style={{ width: '100%', color: row.qty >= row.unitQtyR ? '' : 'red' }}/>
|
|
|
+ : <span>{ row.qty }</span>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '库存',
|
|
|
+ field: 'stockQty',
|
|
|
+ width: 80,
|
|
|
+ key: '7',
|
|
|
+ align: 'center',
|
|
|
+ operationColumn: false,
|
|
|
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
+ return (
|
|
|
+ (row.stockQty || row.stockQty == 0)
|
|
|
+ ? <div>
|
|
|
+ {
|
|
|
+ Number(row.stockQty) < Number(row.unpushedQty)
|
|
|
+ ? <p style="margin: 0;">{ row.stockQty }(<span class="redStyle">缺{ Number(row.unpushedQty || 0) - Number(row.stockQty || 0) }</span>)</p>
|
|
|
+ : <p style="margin: 0;">{ row.stockQty }</p>
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ : <span>--</span>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '出库仓库',
|
|
|
+ field: 'warehouseBox',
|
|
|
+ width: 100,
|
|
|
+ key: '8',
|
|
|
+ align: 'center',
|
|
|
+ operationColumn: false,
|
|
|
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
+ return (
|
|
|
+ <a-select
|
|
|
+ id={'salesEdit-warehouse-' + row.id}
|
|
|
+ size="small"
|
|
|
+ style="width:100%;"
|
|
|
+ placeholder="请选择仓库"
|
|
|
+ vModel={row.warehouseSn}
|
|
|
+ showSearch={true}
|
|
|
+ onChange={() => _this.handleWarehouseBox(row)}
|
|
|
+ mode="default"
|
|
|
+ filter-option={_this.filterOption}>
|
|
|
+ {
|
|
|
+ _this.warehouseDataList.map(item => {
|
|
|
+ return <a-select-option key={item.warehouseSn} value={item.warehouseSn}>{ item.name }</a-select-option>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </a-select>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { title: '单位', field: 'productOrigUnit', width: 50, key: 'unit', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row.productEntity.unit || '--' } },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ field: 'action',
|
|
|
+ width: 100,
|
|
|
+ key: 'action',
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'right',
|
|
|
+ operationColumn: false,
|
|
|
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ {
|
|
|
+ row.promotionFlag != 'GIFT'
|
|
|
+ ? <a-button
|
|
|
+ id={'salesEdit-upactive-' + row.id}
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ loading={_this.delLoading}
|
|
|
+ class="button-primary"
|
|
|
+ onClick={() => _this.handleUpdateActive(row)}
|
|
|
+ >换促销</a-button> : ''
|
|
|
+ }
|
|
|
+ {
|
|
|
+ !(row.promotionFlag == 'GIFT' && row.salesPromoDetailParentSn)
|
|
|
+ ? <a-button
|
|
|
+ id={'salesEdit-del-' + row.id}
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ loading={_this.delLoading}
|
|
|
+ class="button-error"
|
|
|
+ onClick={() => _this.handleDel(row)}
|
|
|
+ >删除</a-button> : ''
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
]
|
|
|
if (this.showStockCol) {
|
|
|
- arr.splice(7, 0, { title: '第三方库存', dataIndex: 'thirdStockQty', width: '6%', align: 'center', customRender: text => ((text || text == 0) ? text : '--') })
|
|
|
+ arr.splice(7, 0, { title: '第三方库存', field: 'thirdStockQty', key: 'thirdStockQty', width: 80, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } })
|
|
|
}
|
|
|
// 售价权限
|
|
|
if (this.$hasPermissions('B_salesEdit_salesPrice')) {
|
|
|
- arr.splice(4, 0, { title: '售价', dataIndex: 'price', width: '6%', align: 'right', scopedSlots: { customRender: 'price' } })
|
|
|
- arr.splice(5, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
|
|
|
- arr.splice((this.showStockCol ? 10 : 9), 0, { title: '售价小计', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
|
|
|
+ arr.splice(4, 0, { title: '售价(原价)',
|
|
|
+ field: 'price',
|
|
|
+ width: 120,
|
|
|
+ key: 'price',
|
|
|
+ align: 'center',
|
|
|
+ operationColumn: false,
|
|
|
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
+ return <div>{_this.toThousands(row[column.field])}<span style="color:#666;margin-left:3px;" title="原价">({_this.toThousands(row.origPrice)})</span></div>
|
|
|
+ }
|
|
|
+ })
|
|
|
+ arr.splice(5, 0, { title: '价格级别', field: 'priceLevelDictValue', width: 80, key: 'priceLevel', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } })
|
|
|
+ arr.splice((_this.showStockCol ? 10 : 9), 0, { title: '售价小计', field: 'totalAmount', key: 'totalAmount', width: 80, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field]) } })
|
|
|
}
|
|
|
return arr
|
|
|
}
|
|
@@ -395,6 +462,45 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 选择单元格
|
|
|
+ selectedRowChange ({ row, isSelected, selectedRowKeys }) {
|
|
|
+ this.selectedRowKeys = selectedRowKeys
|
|
|
+ },
|
|
|
+ // 全选行
|
|
|
+ selectedAllChange ({ isSelected, selectedRowKeys }) {
|
|
|
+ this.selectedRowKeys = selectedRowKeys
|
|
|
+ },
|
|
|
+ // 获取表格数据
|
|
|
+ getTableData () {
|
|
|
+ this.disabled = true
|
|
|
+ this.spinning = true
|
|
|
+ this.queryParam.salesBillSn = this.salesBillSn || ''
|
|
|
+ this.queryParam.salesPromoSnSet = this.salesPromoSnSet || []
|
|
|
+ salesDetailExtPromoList(Object.assign(this.queryParam, {
|
|
|
+ showStock: true,
|
|
|
+ promoFlag: this.detailData.promoFlag
|
|
|
+ })).then(res => {
|
|
|
+ let data = []
|
|
|
+ if (res.status == 200) {
|
|
|
+ data = res.data
|
|
|
+ const no = 0
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ data[i].no = no + i + 1
|
|
|
+ data[i].qtyBackups = data[i].qty
|
|
|
+ data[i].productUnit = data[i].productEntity && data[i].productEntity.unit
|
|
|
+ // 禁用选框
|
|
|
+ if (data[i].promotionFlag == 'GIFT' && !!data[i].salesPromoDetailParentSn) {
|
|
|
+ this.disableSelectedRowKeys.push(data[i].id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.dataSource = data
|
|
|
+ } else {
|
|
|
+ this.dataSource = []
|
|
|
+ }
|
|
|
+ this.disabled = false
|
|
|
+ this.spinning = false
|
|
|
+ })
|
|
|
+ },
|
|
|
// 参与规则名称
|
|
|
activeRuleFilter (val) {
|
|
|
const row = this.activeList.length && this.activeList.find(item => item.promoRuleSn == val)
|
|
@@ -443,10 +549,20 @@ export default {
|
|
|
this.queryParam.productTypeSn2 = ''
|
|
|
this.queryParam.productTypeSn3 = ''
|
|
|
this.queryParam.borrowFlag = undefined
|
|
|
+ this.queryParam.unitFlag = undefined
|
|
|
this.productType = []
|
|
|
this.rowSelectionInfo = null
|
|
|
- this.$refs.table.clearSelected()
|
|
|
- this.$refs.table.refresh(!!flag)
|
|
|
+ this.getTableData()
|
|
|
+ this.clearTableSelect()
|
|
|
+ this.showStockCol = false
|
|
|
+ },
|
|
|
+ // 查询产品,不重置
|
|
|
+ searchProduct () {
|
|
|
+ this.getTableData()
|
|
|
+ },
|
|
|
+ clearTableSelect () {
|
|
|
+ this.disableSelectedRowKeys = []
|
|
|
+ this.selectedRowKeys = []
|
|
|
},
|
|
|
// 保存添加的产品到销售列表
|
|
|
saveNewProduct (row, promo, promoProductClz) {
|
|
@@ -515,7 +631,7 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- this.$message.success('产品添加成功', 2.5)
|
|
|
+ this.$message.success('累计产品添加成功', 2.5)
|
|
|
this.resetSearchForm(true)
|
|
|
this.$emit('refash', 'promo')
|
|
|
}
|
|
@@ -529,21 +645,24 @@ export default {
|
|
|
// 批量取消出现产品
|
|
|
handleBatchCancelActive () {
|
|
|
const _this = this
|
|
|
- const len = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length
|
|
|
- if (!_this.rowSelectionInfo || (len < 1)) {
|
|
|
- _this.$message.warning('请先选择产品后再进行批量操作!')
|
|
|
+ if (this.selectTotal == 0) {
|
|
|
+ _this.$message.warning('请先选择要批量取消的产品!')
|
|
|
return
|
|
|
}
|
|
|
+ const rowSelect = this.dataSource.filter(item => this.selectedRowKeys.includes(item.id))
|
|
|
+ // 判断是否全部为赠品
|
|
|
const obj = []
|
|
|
const gift = []
|
|
|
- _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
|
|
|
+ rowSelect && rowSelect.map(item => {
|
|
|
// 赠品
|
|
|
if (item.promotionFlag == 'GIFT') {
|
|
|
gift.push(item.productCode)
|
|
|
} else {
|
|
|
+ // 非赠品
|
|
|
obj.push(item.salesBillDetailSn)
|
|
|
}
|
|
|
})
|
|
|
+ // 如果全部是赠品,不能转为正常产品
|
|
|
if (gift.length == len) {
|
|
|
this.$info({
|
|
|
title: '提示',
|
|
@@ -581,9 +700,9 @@ export default {
|
|
|
centered: true,
|
|
|
onOk () {
|
|
|
_this.spinning = true
|
|
|
- deleteAll({ salesBillSn: _this.salesBillSn, salesPromoSn: this.promo ? this.promo.salesPromoSn : '' }).then(res => {
|
|
|
+ deleteAll({ salesBillSn: _this.salesBillSn, salesPromoSn: '' }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- _this.$refs.table.refresh(true)
|
|
|
+ _this.searchProduct()
|
|
|
_this.$emit('refash', 'promo')
|
|
|
_this.$message.success(res.message)
|
|
|
}
|
|
@@ -595,14 +714,12 @@ export default {
|
|
|
// 批量删除已选产品
|
|
|
handleBatchDel () {
|
|
|
const _this = this
|
|
|
- if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
- _this.$message.warning('请先选择要删除的产品后再进行批量操作!')
|
|
|
+ if (this.selectTotal == 0) {
|
|
|
+ _this.$message.warning('请先选择要批量删除产品!')
|
|
|
return
|
|
|
}
|
|
|
- const obj = []
|
|
|
- _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
|
|
|
- obj.push(item.salesBillDetailSn)
|
|
|
- })
|
|
|
+ const selectedRows = this.dataSource.filter(item => this.selectedRowKeys.includes(item.id))
|
|
|
+ const obj = selectedRows ? selectedRows.map(item => item.salesBillDetailSn) : []
|
|
|
this.$confirm({
|
|
|
title: '提示',
|
|
|
content: '已选产品' + obj.length + '项,确认要批量删除吗?',
|
|
@@ -611,11 +728,11 @@ export default {
|
|
|
_this.spinning = true
|
|
|
salesDetailBatchDel({
|
|
|
salesBillSn: _this.salesBillSn,
|
|
|
- salesPromoSn: this.promo ? this.promo.salesPromoSn : '',
|
|
|
+ salesPromoSn: '',
|
|
|
salesBillDetailSnList: obj
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- _this.$refs.table.refresh(false)
|
|
|
+ _this.searchProduct()
|
|
|
_this.$emit('refash', 'promo')
|
|
|
_this.$message.success(res.message)
|
|
|
}
|
|
@@ -631,7 +748,7 @@ export default {
|
|
|
warehouseSn: row.warehouseSn,
|
|
|
salesBillDetailSnList: snArr,
|
|
|
salesBillSn: this.salesBillSn,
|
|
|
- salesPromoSn: this.promo ? this.promo.salesPromoSn : ''
|
|
|
+ salesPromoSn: ''
|
|
|
}
|
|
|
this.setWarehouseInfo(ajax_data)
|
|
|
},
|
|
@@ -646,7 +763,7 @@ export default {
|
|
|
warehouseSn: sn,
|
|
|
salesBillDetailSnList: snArr,
|
|
|
salesBillSn: _this.salesBillSn,
|
|
|
- salesPromoSn: _this.promo ? _this.promo.salesPromoSn : '',
|
|
|
+ salesPromoSn: '',
|
|
|
allFlag: _this.warehouseTit ? true : undefined
|
|
|
}
|
|
|
_this.setWarehouseInfo(ajax_data)
|
|
@@ -662,7 +779,7 @@ export default {
|
|
|
_this.$emit('refash', 'promo')
|
|
|
}
|
|
|
_this.openWarehouseModal = false
|
|
|
- _this.$refs.table.refresh(false)
|
|
|
+ _this.searchProduct()
|
|
|
_this.spinning = false
|
|
|
})
|
|
|
},
|
|
@@ -670,8 +787,8 @@ export default {
|
|
|
handleMenuClick (e) {
|
|
|
const _this = this
|
|
|
if (e.key == 0) { // 部分仓库设置
|
|
|
- if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
- _this.$message.warning('请先选择要设置的产品!')
|
|
|
+ if (_this.selectTotal == 0) {
|
|
|
+ _this.$message.warning('请先选择要批量设置的产品!')
|
|
|
} else {
|
|
|
_this.warehouseTit = '部分仓库设置'
|
|
|
_this.openWarehouseModal = true
|
|
@@ -679,7 +796,7 @@ export default {
|
|
|
} else if (e.key == 1) { // 删除已选项
|
|
|
this.handleBatchDel()
|
|
|
} else if (e.key == 3) { // 全部仓库设置
|
|
|
- _this.$refs.table.clearSelected()
|
|
|
+ _this.clearTableSelect()
|
|
|
_this.warehouseTit = '全部仓库设置'
|
|
|
_this.openWarehouseModal = true
|
|
|
} else if (e.key == 4) { // 批量取消促销
|
|
@@ -693,7 +810,7 @@ export default {
|
|
|
this.$refs.updateActive.getActiveList({
|
|
|
productSn: record.productSn,
|
|
|
salesBillSn: this.salesBillSn,
|
|
|
- promoRuleSn: this.promo ? this.promo.promoRuleSn : ''
|
|
|
+ salesBillDetailSn: record.salesBillDetailSn
|
|
|
}, record)
|
|
|
this.openUpActiveModal = true
|
|
|
},
|
|
@@ -707,13 +824,13 @@ export default {
|
|
|
salesBillDetailSn: record.salesBillDetailSn,
|
|
|
qty: record.qty,
|
|
|
salesBillSn: _this.salesBillSn,
|
|
|
- salesPromoSn: _this.promo ? _this.promo.salesPromoSn : ''
|
|
|
+ salesPromoSn: ''
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$emit('refash', 'promo')
|
|
|
_this.$message.success(res.message)
|
|
|
}
|
|
|
- _this.$refs.table.refresh(false)
|
|
|
+ _this.searchProduct()
|
|
|
_this.spinning = false
|
|
|
})
|
|
|
} else {
|
|
@@ -731,9 +848,9 @@ export default {
|
|
|
onOk () {
|
|
|
_this.delLoading = true
|
|
|
_this.spinning = true
|
|
|
- salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn, salesPromoSn: _this.promo ? _this.promo.salesPromoSn : '' }).then(res => {
|
|
|
+ salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn, salesPromoSn: '' }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- _this.$refs.table.refresh(false)
|
|
|
+ _this.searchProduct()
|
|
|
_this.$emit('refash', 'promo')
|
|
|
_this.$message.success(res.message)
|
|
|
}
|
|
@@ -749,7 +866,7 @@ export default {
|
|
|
const params = {
|
|
|
salesBillDetailSn: editRow.salesBillDetailSn,
|
|
|
salesBillSn: this.salesBillSn,
|
|
|
- oldSalesPromoSn: this.promo ? this.promo.salesPromoSn : '',
|
|
|
+ oldSalesPromoSn: '',
|
|
|
priceLevel: editRow.priceLevel
|
|
|
}
|
|
|
// 更换活动
|
|
@@ -760,8 +877,8 @@ export default {
|
|
|
this.spinning = false
|
|
|
this.$refs.updateActive.confirmLoading = false
|
|
|
this.openUpActiveModal = false
|
|
|
- this.$refs.table.clearSelected()
|
|
|
- this.$refs.table.refresh(false)
|
|
|
+ this.clearTableSelect()
|
|
|
+ this.searchProduct()
|
|
|
}
|
|
|
}
|
|
|
}
|