|
@@ -76,62 +76,33 @@
|
|
|
<span v-if="$hasPermissions('B_salesDispatch_salesPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- <!-- 列表 -->
|
|
|
- <s-table
|
|
|
- class="sTable"
|
|
|
- ref="table"
|
|
|
- size="small"
|
|
|
- :rowKey="(record) => record.id"
|
|
|
- :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: record.surplusQty<=0 }})}"
|
|
|
- @rowSelection="rowSelectionFun"
|
|
|
- :columns="columns"
|
|
|
- :showPagination="false"
|
|
|
- :data="loadData"
|
|
|
- :scroll="{ y: 300 }"
|
|
|
- :defaultLoadData="false"
|
|
|
- bordered>
|
|
|
- <!-- 取消数量 -->
|
|
|
- <template slot="nums" slot-scope="text, record">
|
|
|
- <div v-if="record.surplusQty>0" @dblclick.stop>
|
|
|
- <a-input-number
|
|
|
- size="small"
|
|
|
- v-model="record.cancelNums"
|
|
|
- :precision="0"
|
|
|
- :min="0"
|
|
|
- :max="record.surplusQty"
|
|
|
- style="width: 100%;"
|
|
|
- placeholder="请输入" />
|
|
|
- </div>
|
|
|
- <div v-else>--</div>
|
|
|
- </template>
|
|
|
- <!-- 产品编码 -->
|
|
|
- <template slot="productCode" slot-scope="text, record">
|
|
|
- <a-badge count="促" v-if="record.promotionFlag == 1">
|
|
|
- <div style="padding-right: 15px;">{{ text }}</div>
|
|
|
- </a-badge>
|
|
|
- <span v-else>{{ text }}</span>
|
|
|
- </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.surplusQty>0"
|
|
|
- id="productInfoList-edit-btn">添加</a-button>
|
|
|
- <span v-else>--</span>
|
|
|
- </template>
|
|
|
- </s-table>
|
|
|
+
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
+ <ve-table
|
|
|
+ border-y
|
|
|
+ v-show="!showEmpty"
|
|
|
+ :scroll-width="0"
|
|
|
+ :max-height="tableHeight"
|
|
|
+ :show-header="showTableHead"
|
|
|
+ :row-style-option="{clickHighlight: true}"
|
|
|
+ :cellSelectionOption="{enable: false}"
|
|
|
+ :virtual-scroll-option="{enable: true}"
|
|
|
+ :columns="columns"
|
|
|
+ :table-data="dataSource"
|
|
|
+ row-key-field-name="id"
|
|
|
+ :cell-style-option="cellStyleOption"
|
|
|
+ :column-width-resize-option="columnWidthResizeOption"
|
|
|
+ />
|
|
|
+ <div v-show="showEmpty" class="empty-data">暂无数据</div>
|
|
|
+ </a-spin>
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
-import { salesDetailAllStockList } from '@/api/salesDetail'
|
|
|
+import { salesPromoQueryList } from '@/api/salesNew'
|
|
|
+import { salesDetailAllList } from '@/api/salesDetailNew'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import chooseWarehouse from '@/views/common/chooseWarehouse'
|
|
|
export default {
|
|
@@ -139,17 +110,19 @@ export default {
|
|
|
mixins: [commonMixin],
|
|
|
components: { STable, VSelect, chooseWarehouse },
|
|
|
props: {
|
|
|
- newLoading: Boolean
|
|
|
- },
|
|
|
- watch: {
|
|
|
- data (newValue, oldValue) {
|
|
|
- this.resetSearchForm()
|
|
|
+ newLoading: Boolean,
|
|
|
+ maxHeight:{
|
|
|
+ type: [String,Number],
|
|
|
+ default: '300'
|
|
|
+ },
|
|
|
+ showHeader: {
|
|
|
+ type: Boolean,
|
|
|
+ default: true
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
advanced: true, // 高级搜索 展开/关闭
|
|
|
- showSetting: false, // 设置弹框
|
|
|
productType: [],
|
|
|
salesBillSn: '',
|
|
|
detailData: null,
|
|
@@ -166,71 +139,124 @@ export default {
|
|
|
warehouseSn: undefined
|
|
|
},
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
- loadData: parameter => {
|
|
|
- this.disabled = true
|
|
|
- this.queryParam.salesBillSn = this.salesBillSn
|
|
|
- return salesDetailAllStockList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
- let data
|
|
|
- if (res.status == 200) {
|
|
|
- data = res.data
|
|
|
- if (data) {
|
|
|
- // 根据类型过滤数据
|
|
|
- data = data.filter(item => {
|
|
|
- if (this.queryParam.ptype == '1') {
|
|
|
- return item != null && item.surplusQty > 0
|
|
|
- }
|
|
|
- if (this.queryParam.ptype == '2') {
|
|
|
- return item != null && item.surplusQty > 0 && item.surplusQty <= item.stockQty
|
|
|
- }
|
|
|
- if (this.queryParam.ptype == '3') {
|
|
|
- return item != null && item.surplusQty > item.stockQty
|
|
|
- }
|
|
|
- if (this.queryParam.ptype == '0') {
|
|
|
- return item != null
|
|
|
- }
|
|
|
- })
|
|
|
- // 增加编号
|
|
|
- const no = 0
|
|
|
- for (var i = 0; i < data.length; i++) {
|
|
|
- data[i].no = no + i + 1
|
|
|
- data[i].cancelNums = data[i].surplusQty
|
|
|
- }
|
|
|
- this.disabled = false
|
|
|
- }
|
|
|
- }
|
|
|
- return data
|
|
|
- })
|
|
|
+ activeList: [], // 活动列表
|
|
|
+ spinning: false,
|
|
|
+ dataSource: [],
|
|
|
+ tableHeight: this.maxHeight,
|
|
|
+ cellStyleOption: {},
|
|
|
+ columnWidthResizeOption: {
|
|
|
+ // default false
|
|
|
+ enable: true,
|
|
|
+ // column resize min width
|
|
|
+ minWidth: 50
|
|
|
},
|
|
|
- rowSelectionInfo: null
|
|
|
+ showEmpty: false,
|
|
|
+ showTableHead: true
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
columns () {
|
|
|
- const arr = [
|
|
|
- // { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '14%', align: 'center' },
|
|
|
- { title: '产品名称', dataIndex: 'productEntity.name', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- // { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- // { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '出库仓库', dataIndex: 'warehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '可用库存', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '已取消', dataIndex: 'cancelQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '已下推', dataIndex: 'pushedQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '待下推数量', dataIndex: 'surplusQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '取消数量', dataIndex: 'cancelNums', scopedSlots: { customRender: 'nums' }, width: '7%', align: 'center' },
|
|
|
- { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
|
|
|
- ]
|
|
|
+ const _this = this
|
|
|
+ const priceFormat = function(data){
|
|
|
+ return _this.toThousands(data) || '--'
|
|
|
+ }
|
|
|
+ const numsFormat = function(data){
|
|
|
+ return data || data == 0 ? data : '--'
|
|
|
+ }
|
|
|
+ const codeFormat = function(record,data,h){
|
|
|
+ if(record.promotionFlag=='GIFT'){
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <span style="padding-right: 15px;">{data}</span>
|
|
|
+ <a-badge count="促" number-style={{ backgroundColor: '#52c41a', zoom:'80%' }}></a-badge>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ if(record.promotionFlag=='REGULAR'){
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <span style="padding-right: 15px;">{data}</span>
|
|
|
+ <a-badge count="正" number-style={{ backgroundColor: '#108ee9', zoom:'80%' }}></a-badge>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ if(record.promotionFlag=='DISCOUNT'){
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <span style="padding-right: 15px;">{data}</span>
|
|
|
+ <a-badge count="特" number-style={{ backgroundColor: '#faad14', zoom:'80%' }}></a-badge>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ if(Number(record.stockQty||0) < Number(record.unpushedQty||0)){
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <span style="padding-right: 15px;">{data}</span>
|
|
|
+ <a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 输入框
|
|
|
+ const inputFormat = function(record,data,h) {
|
|
|
+ if(record.surplusQty>0){
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <a-input-number
|
|
|
+ size="small"
|
|
|
+ vModel={record.cancelNums}
|
|
|
+ precision="0"
|
|
|
+ min="0"
|
|
|
+ max={record.surplusQty}
|
|
|
+ style="width: 100%;"
|
|
|
+ placeholder="请输入" />
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ return '--'
|
|
|
+ }
|
|
|
+ // 操作按钮
|
|
|
+ const actionFormat = function(record,data,h) {
|
|
|
+ if(record.surplusQty>0){
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-info"
|
|
|
+ loading={newLoading}
|
|
|
+ onClick="handleAdd(record)"
|
|
|
+ >添加</a-button>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ return '--'
|
|
|
+ }
|
|
|
+ let arr= [
|
|
|
+ { title: '序号', field: 'no',key: "a", width: 50, align: 'center', fixed: 'left',operationColumn: false },
|
|
|
+ { title: '产品编码', field: 'productCode',key: "b", width: 150, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row,row[column.field],h)} },
|
|
|
+ { title: '产品名称', field: 'productName',key: "c", width: 250, align: 'center',operationColumn: false , ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
|
|
|
+ { title: '原厂编码', field: 'productOrigCode',key: "d", width: 150, align: 'center',operationColumn: false,ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
|
|
|
+ { title: '出库仓库', field: 'warehouseName',key: "e", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}}
|
|
|
+ ]
|
|
|
if (this.$hasPermissions('B_salesDispatch_salesPrice')) { // 售价权限
|
|
|
- arr.splice(3, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
|
|
|
+ arr.push({ title: '销售价', field: 'price', width: 80,key: "f", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
|
|
|
}
|
|
|
if (this.$hasPermissions('B_salesDispatch_costPrice')) {
|
|
|
- const ind = this.$hasPermissions('B_salesDispatch_salesPrice') ? 4 : 3
|
|
|
- arr.splice(ind, 0, { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
|
|
|
- }
|
|
|
+ arr.push({ title: '成本价', field: 'showCost', width: 80,key: "g", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
|
|
|
+ }
|
|
|
+ arr = arr.concat([
|
|
|
+ { title: '出库仓库', field: 'warehouseName',key: "h", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
|
|
|
+ { title: '单位', field: 'productOrigUnit',key: "i", width: 80, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
|
|
|
+ { title: '可用库存', field: 'stockQty', width: 80,key: "j", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
|
|
|
+ { title: '销售数量', field: 'qty', width: 80,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
|
|
|
+ { title: '已取消', field: 'cancelQty', width: 80,key: "o", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
|
|
|
+ { title: '已下推', field: 'pushedQty', width: 80,key: "p", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
|
|
|
+ { title: '待下推', field: 'surplusQty', width: 80,key: "q", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
|
|
|
+ { title: '取消数量', field: 'surplusQty', width: 80,key: "r", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return inputFormat(row,row[column.field],h)} },
|
|
|
+ { title: '操作', field: 'action', width: 80,key: "s", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row,row[column.field],h)} },
|
|
|
+ ])
|
|
|
+
|
|
|
return arr
|
|
|
}
|
|
|
},
|
|
@@ -239,8 +265,38 @@ export default {
|
|
|
rowSelectionFun (obj) {
|
|
|
this.rowSelectionInfo = obj || null
|
|
|
},
|
|
|
- // 类型变化,过滤列表
|
|
|
- handlePtypeChange () {},
|
|
|
+ // 获取销售单参与的活动列表
|
|
|
+ getActiveList(){
|
|
|
+ salesPromoQueryList({ salesBillSn: this.salesBillSn }).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.activeList = res.data || []
|
|
|
+ }
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.searchTable()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async searchTable(){
|
|
|
+ this.disabled = true
|
|
|
+ this.queryParam.salesBillSn = this.salesBillSn
|
|
|
+ this.queryParam.showStock = true
|
|
|
+ const params = this.queryParam
|
|
|
+ // 正常产品
|
|
|
+ const list0 = await salesDetailAllList(params).then(res => res.data)
|
|
|
+ const list1 = [], active = this.activeList;
|
|
|
+ // 活动产品
|
|
|
+ for(let i=0;i<active.length;i++){
|
|
|
+ const promo = active[i]
|
|
|
+ params.promoRuleSn = promo.promoRuleSn
|
|
|
+ params.promoSn = promo.promoSn
|
|
|
+ params.salesPromoSn = promo.salesPromoSn
|
|
|
+ list1[i] = await salesDetailAllList(params).then(res => res.data)
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(list0)
|
|
|
+ console.log(list1)
|
|
|
+ this.dataSource = list0
|
|
|
+ },
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
this.queryParam.ptype = '0'
|
|
@@ -258,8 +314,8 @@ export default {
|
|
|
pageInit (salesBillSn, detailData) {
|
|
|
this.salesBillSn = salesBillSn
|
|
|
this.detailData = detailData
|
|
|
- this.$refs.table.clearSelected()
|
|
|
- this.resetSearchForm()
|
|
|
+ // 获取活动列表
|
|
|
+ this.getActiveList()
|
|
|
},
|
|
|
clearTable () {
|
|
|
this.rowSelectionInfo = null
|