|
@@ -70,62 +70,71 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- alert -->
|
|
|
- <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="detailData">
|
|
|
- <div style="display: flex;align-items: center;">
|
|
|
- <a-button id="dispatch-plAdd" type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量添加</a-button>
|
|
|
- <a-button
|
|
|
- id="dispatch-plPurchase"
|
|
|
- type="primary"
|
|
|
- :disabled="newLoading"
|
|
|
- class="button-info"
|
|
|
- v-if="showConvertPromoGifts"
|
|
|
- @click="handlePlPurchase">批量转采购额</a-button>
|
|
|
- <a-button
|
|
|
- id="dispatch-plCancel"
|
|
|
- type="primary"
|
|
|
- v-if="hasNormalProduct"
|
|
|
- ghost
|
|
|
- style="margin-left:6px;"
|
|
|
- :disabled="newLoading"
|
|
|
- @click="handlePlCancel">批量取消</a-button>
|
|
|
- <a-button
|
|
|
- id="dispatch-cancelAll"
|
|
|
- type="primary"
|
|
|
- v-if="hasPrompActive&&hasNoPushedActive"
|
|
|
- ghost
|
|
|
- style="margin-left:6px;"
|
|
|
- :disabled="newLoading"
|
|
|
- @click="handleAllCancel">整单取消</a-button>
|
|
|
- <a-tooltip placement="top" v-if="hasPrompActive&&hasNoPushedActive" style="margin-left:6px;">
|
|
|
- <template slot="title">
|
|
|
- <span>参加促销活动的产品,不能单独取消,只能整单取消。</span>
|
|
|
- </template>
|
|
|
- <a-icon style="font-size: 14px;" type="question-circle" />
|
|
|
- </a-tooltip>
|
|
|
- <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
|
|
|
- <a-button
|
|
|
- @click="confirPurchaseModal"
|
|
|
- :loading="loading"
|
|
|
- type="primary"
|
|
|
- style="margin-left: 15px"
|
|
|
- class="button-info"
|
|
|
- id="dispatch-updateStock">整单转采购单</a-button>
|
|
|
- </div>
|
|
|
- <div style="padding-left: 20px;">
|
|
|
- 总销售数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
|
|
|
- 已取消数量:<strong>{{ detailData&&(detailData.totalCancelQty || detailData.totalCancelQty==0) ? detailData.totalCancelQty : '--' }}</strong>;
|
|
|
- 已下推数量:<strong>{{ detailData&&(detailData.totalPushedQty || detailData.totalPushedQty==0) ? detailData.totalPushedQty : '--' }}</strong>;
|
|
|
- 待下推数量:<strong>{{ detailData&&(detailData.totalUnpushedQty || detailData.totalUnpushedQty==0) ? detailData.totalUnpushedQty : '--' }}</strong>;
|
|
|
- <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;</span>
|
|
|
- <span v-if="$hasPermissions('B_salesDispatch_costPrice')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;</span>
|
|
|
- <span v-if="$hasPermissions('B_salesDispatch_costPrice')&&$hasPermissions('B_salesDispatch_salesPrice')">总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;</span>
|
|
|
- <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? toThousands(detailData.totalCancelAmount) : '--' }}</strong>;</span>
|
|
|
- <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? toThousands(detailData.totalPushedAmount) :'--' }}</strong>;</span>
|
|
|
- <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</span>
|
|
|
- <span v-if="$hasPermissions('B_salesDispatch_salesPrice')&&detailData&&detailData.totalConvertPromoGiftsAmount" style="color:red;">促销产品转采购额金额:<strong>{{ toThousands(detailData.totalConvertPromoGiftsAmount) }}</strong>;</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <span v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
|
|
|
+ <a-button id="dispatch-plAdd" type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量添加</a-button>
|
|
|
+ <a-button
|
|
|
+ id="dispatch-plPurchase"
|
|
|
+ type="primary"
|
|
|
+ :disabled="newLoading"
|
|
|
+ class="button-info"
|
|
|
+ v-if="showConvertPromoGifts"
|
|
|
+ @click="handlePlPurchase">批量转采购额</a-button>
|
|
|
+ <a-button
|
|
|
+ id="dispatch-plCancel"
|
|
|
+ type="primary"
|
|
|
+ v-if="hasNormalProduct"
|
|
|
+ ghost
|
|
|
+ style="margin-left:6px;"
|
|
|
+ :disabled="newLoading"
|
|
|
+ @click="handlePlCancel">批量取消</a-button>
|
|
|
|
|
|
+ <a-button
|
|
|
+ id="dispatch-cancelAll"
|
|
|
+ type="primary"
|
|
|
+ v-if="hasPrompActive&&hasNoPushedActive"
|
|
|
+ ghost
|
|
|
+ style="margin-left:6px;"
|
|
|
+ :disabled="newLoading"
|
|
|
+ @click="handleAllCancel">整单取消</a-button>
|
|
|
+ <a-tooltip placement="top" v-if="hasPrompActive&&hasNoPushedActive" style="margin-left:6px;">
|
|
|
+ <template slot="title">
|
|
|
+ <span>参加促销活动的产品,不能单独取消,只能整单取消。</span>
|
|
|
+ </template>
|
|
|
+ <a-icon style="font-size: 14px;" type="question-circle" />
|
|
|
+ </a-tooltip>
|
|
|
+ <v-select
|
|
|
+ v-if="hasJGtire"
|
|
|
+ :disabled="stockDisabled"
|
|
|
+ style="margin-left: 15px;width:150px;"
|
|
|
+ v-model="stockType"
|
|
|
+ id="dispatch-stockType"
|
|
|
+ code="TIRE_STOCK_TYPE"
|
|
|
+ placeholder="请选择库存类型"
|
|
|
+ @change="stockTypeChange"
|
|
|
+ ></v-select>
|
|
|
+ <a-button
|
|
|
+ v-if="hasJGtire && stockType=='LOCK_STOCK'"
|
|
|
+ @click="confirPurchaseModal"
|
|
|
+ :loading="loading"
|
|
|
+ type="primary"
|
|
|
+ style="margin-left: 6px"
|
|
|
+ class="button-info"
|
|
|
+ id="dispatch-updateStock">轮胎转采购单</a-button>
|
|
|
+ </div>
|
|
|
+ <div style="padding:10px 0;" v-if="detailData">
|
|
|
+ 总销售数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
|
|
|
+ 已取消数量:<strong>{{ detailData&&(detailData.totalCancelQty || detailData.totalCancelQty==0) ? detailData.totalCancelQty : '--' }}</strong>;
|
|
|
+ 已下推数量:<strong>{{ detailData&&(detailData.totalPushedQty || detailData.totalPushedQty==0) ? detailData.totalPushedQty : '--' }}</strong>;
|
|
|
+ 待下推数量:<strong>{{ detailData&&(detailData.totalUnpushedQty || detailData.totalUnpushedQty==0) ? detailData.totalUnpushedQty : '--' }}</strong>;
|
|
|
+ <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;</span>
|
|
|
+ <span v-if="$hasPermissions('B_salesDispatch_costPrice')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;</span>
|
|
|
+ <span v-if="$hasPermissions('B_salesDispatch_costPrice')&&$hasPermissions('B_salesDispatch_salesPrice')">总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;</span>
|
|
|
+ <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? toThousands(detailData.totalCancelAmount) : '--' }}</strong>;</span>
|
|
|
+ <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? toThousands(detailData.totalPushedAmount) :'--' }}</strong>;</span>
|
|
|
+ <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</span>
|
|
|
+ <span v-if="$hasPermissions('B_salesDispatch_salesPrice')&&detailData&&detailData.totalConvertPromoGiftsAmount" style="color:red;">促销产品转采购额金额:<strong>{{ toThousands(detailData.totalConvertPromoGiftsAmount) }}</strong>;</span>
|
|
|
+ </div>
|
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
|
<ve-table
|
|
|
border-y
|
|
@@ -234,7 +243,10 @@ export default {
|
|
|
selectedRowKeys: [], // 已选数据
|
|
|
colspanNums: 16, // 列合并数量
|
|
|
hasNormalProduct: false, // 是否有正常产品
|
|
|
- showLockStockQty: false // 是否显示锁定库存列
|
|
|
+ showLockStockQty: false, // 是否显示锁定库存列
|
|
|
+ stockType: undefined, // 默认锁定库存
|
|
|
+ hasJGtire: false, // 是否轮胎产品
|
|
|
+ stockDisabled: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -524,6 +536,10 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ // 修改库存类型
|
|
|
+ stockTypeChange (val) {
|
|
|
+ this.$emit('updateStockType', val)
|
|
|
+ },
|
|
|
// 查询列表
|
|
|
async searchTable () {
|
|
|
this.selectedRowKeys = []
|
|
@@ -602,6 +618,8 @@ export default {
|
|
|
const productName = (item.productEntity && item.productEntity.name) || (item.dealerProductEntity && item.dealerProductEntity.name)
|
|
|
const productOrigCode = (item.productEntity && item.productEntity.origCode) || (item.dealerProductEntity && item.dealerProductEntity.origCode)
|
|
|
const productOrigUnit = (item.productEntity && item.productEntity.unit) || (item.dealerProductEntity && item.dealerProductEntity.unit)
|
|
|
+ const productBrand = (item.productEntity && item.productEntity.productBrandName) || (item.dealerProductEntity && item.dealerProductEntity.productBrandName)
|
|
|
+ const productType3 = (item.productEntity && item.productEntity.productTypeName3) || (item.dealerProductEntity && item.dealerProductEntity.productTypeName3)
|
|
|
item.productCode = productCode || '--'
|
|
|
item.productName = productName || '--'
|
|
|
item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
|
|
@@ -613,6 +631,17 @@ export default {
|
|
|
} else {
|
|
|
item.maxConvertNums = 0
|
|
|
}
|
|
|
+
|
|
|
+ // 判断是否有箭冠轮胎产品
|
|
|
+ if (productBrand && productBrand.indexOf('箭冠') >= 0 && productBrand && productType3.indexOf('轮胎') >= 0) {
|
|
|
+ this.hasJGtire = true
|
|
|
+ // 默认锁定库存类型
|
|
|
+ if (!this.stockType) {
|
|
|
+ this.stockType = 'LOCK_STOCK'
|
|
|
+ this.stockTypeChange('LOCK_STOCK')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 转采购额数量
|
|
|
item.bakConvertPromoGiftsQty = item.convertPromoGiftsQty
|
|
|
|
|
@@ -661,13 +690,16 @@ export default {
|
|
|
},
|
|
|
// 添加
|
|
|
handleAdd (row) {
|
|
|
- if (row && row.productEntity && row.productEntity.productBrandName == '箭冠' && row.productEntity.productTypeName3 == '轮胎') {
|
|
|
+ const isLt = row && row.productEntity && row.productEntity.productBrandName == '箭冠' && row.productEntity.productTypeName3 == '轮胎'
|
|
|
+ // 如果库存类型是锁定库存 且 轮胎产品
|
|
|
+ if (this.stockType && this.stockType == 'LOCK_STOCK' && isLt) {
|
|
|
if (!row.lockStockQty) {
|
|
|
this.$message.warning('锁定库存为0,不可添加!')
|
|
|
} else {
|
|
|
this.$emit('addProduct', [row.salesBillDetailSn])
|
|
|
}
|
|
|
} else {
|
|
|
+ // 库存类型可用库存或非轮胎产品
|
|
|
if (row.stockQty > 0) { // 可用库存大于0才可添加
|
|
|
this.$emit('addProduct', [row.salesBillDetailSn])
|
|
|
} else {
|
|
@@ -721,11 +753,18 @@ export default {
|
|
|
_this.$message.warning('请先选择产品!')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- // 库存为0的产品,不包括箭冠轮胎产品
|
|
|
- const noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty && item.productEntity && item.productEntity.productBrandName != '箭冠' && item.productEntity.productTypeName3 != '轮胎')
|
|
|
- // 锁定库存为0的产品,只判断箭冠轮胎产品
|
|
|
- const noLockStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.productEntity && item.productEntity.productBrandName == '箭冠' && item.productEntity.productTypeName3 == '轮胎' && !item.lockStockQty)
|
|
|
+ let noStockRow = []
|
|
|
+ let noLockStockRow = []
|
|
|
+ // 库存类型是 锁定库存
|
|
|
+ if (this.stockType && this.stockType == 'LOCK_STOCK') {
|
|
|
+ // 库存为0的产品,不包括箭冠轮胎产品
|
|
|
+ noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty && item.productEntity && item.productEntity.productBrandName != '箭冠' && item.productEntity.productTypeName3 != '轮胎')
|
|
|
+ // 锁定库存为0的产品,只判断箭冠轮胎产品
|
|
|
+ noLockStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.productEntity && item.productEntity.productBrandName == '箭冠' && item.productEntity.productTypeName3 == '轮胎' && !item.lockStockQty)
|
|
|
+ } else {
|
|
|
+ // 库存类型是 可用库存
|
|
|
+ noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty)
|
|
|
+ }
|
|
|
|
|
|
// 库存为0产品编码列表
|
|
|
const noObj = []
|
|
@@ -743,14 +782,9 @@ export default {
|
|
|
})
|
|
|
|
|
|
// 可添加产品,不包括库存未0和箭冠轮胎锁定库存为0的产品
|
|
|
- const chooseRow = this.dataSource.filter(item => {
|
|
|
- return chooseList.includes(item.id) && !noObjSn.includes(item.salesBillDetailSn) && !noLockObjSn.includes(item.salesBillDetailSn)
|
|
|
- })
|
|
|
+ const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && !noObjSn.includes(item.salesBillDetailSn) && !noLockObjSn.includes(item.salesBillDetailSn))
|
|
|
// 可添加产品sn列表
|
|
|
- const obj = []
|
|
|
- chooseRow && chooseRow.map(item => {
|
|
|
- obj.push(item.salesBillDetailSn)
|
|
|
- })
|
|
|
+ const obj = chooseRow.map(item => item.salesBillDetailSn)
|
|
|
if (obj.length) {
|
|
|
this.$confirm({
|
|
|
title: '提示',
|