|
@@ -17,7 +17,7 @@
|
|
|
class="button-info"
|
|
|
id="salesDetail-xs-print-btn"
|
|
|
v-if="$hasPermissions('B_salesPrint')"
|
|
|
- :disabled="localDataSource.length==0"
|
|
|
+ :disabled="hasData"
|
|
|
@click="handlePrint('SALES_BILL','B_salesPrint')">销售打印</a-button>
|
|
|
<a-button
|
|
|
key="2"
|
|
@@ -25,7 +25,7 @@
|
|
|
class="button-info"
|
|
|
id="salesDetail-xsfl-print-btn"
|
|
|
v-if="$hasPermissions('B_salesTypePrint')"
|
|
|
- :disabled="localDataSource.length==0"
|
|
|
+ :disabled="hasData"
|
|
|
@click="handlePrint('SALES_BILL_TYPE','B_salesTypePrint')">销售分类打印</a-button>
|
|
|
<a-divider type="vertical" />
|
|
|
<a-button
|
|
@@ -34,7 +34,7 @@
|
|
|
class="button-info"
|
|
|
id="salesDetail-export-btn"
|
|
|
v-if="$hasPermissions('B_salesDetailExport')"
|
|
|
- :disabled="localDataSource.length==0"
|
|
|
+ :disabled="hasData"
|
|
|
@click="handlePrint('export','B_salesDetailExport')">导出Excel</a-button>
|
|
|
<a-button
|
|
|
key="4"
|
|
@@ -42,7 +42,7 @@
|
|
|
class="button-info"
|
|
|
id="salesDetail-export-btn"
|
|
|
v-if="$hasPermissions('B_salesTypeExport')"
|
|
|
- :disabled="localDataSource.length==0"
|
|
|
+ :disabled="hasData"
|
|
|
@click="handlePrint('typeExport','B_salesTypeExport')">销售分类导出</a-button>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
@@ -93,51 +93,56 @@
|
|
|
</a-alert>
|
|
|
<!-- 查询 -->
|
|
|
<div class="table-page-search-wrapper">
|
|
|
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="searchTable">
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="出库仓库">
|
|
|
- <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
|
|
|
+ <chooseWarehouse ref="warehouse" v-model="warehouseSn"></chooseWarehouse>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
|
|
|
+ <a-button type="primary" @click="searchTable" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
|
|
|
<a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</a-form>
|
|
|
</div>
|
|
|
<!-- 列表 -->
|
|
|
- <s-table
|
|
|
- class="sTable"
|
|
|
- ref="table"
|
|
|
- size="small"
|
|
|
- :rowKey="(record) => record.id"
|
|
|
- :columns="columns"
|
|
|
- :data="loadData"
|
|
|
- :defaultLoadData="false"
|
|
|
- :showPagination="false"
|
|
|
- bordered>
|
|
|
- <!-- 产品编码 -->
|
|
|
- <template slot="productCode" slot-scope="text, record">
|
|
|
- <div v-if="(record.promotionFlag == 1) || (Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesAudit'))">
|
|
|
- <span>{{ text }}</span>
|
|
|
- <!-- <a-badge count="促" :number-style="{ backgroundColor: '#f90' }" v-if="record.promotionFlag == 1"></a-badge> -->
|
|
|
- <!-- 可审核时才可显示“缺”货产品 -->
|
|
|
- <a-badge count="缺" v-if="(Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesAudit'))">
|
|
|
- </a-badge>
|
|
|
- </div>
|
|
|
- <span v-if="!(record.promotionFlag == 1 || ((Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesAudit'))))">{{ text }}</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) - Number(record.stockQty) }}</span>)</p>
|
|
|
- <p style="margin: 0;" v-else>{{ record.stockQty }}</p>
|
|
|
- </div>
|
|
|
- <span v-else>--</span>
|
|
|
- </template>
|
|
|
- </s-table>
|
|
|
+ <detailProductList
|
|
|
+ ref="normalProduct"
|
|
|
+ :detailData="detailData"
|
|
|
+ :warehouseSn="warehouseSn"
|
|
|
+ :salesBillSn="$route.params.sn || bizSn"
|
|
|
+ :authCode="authCode"
|
|
|
+ :showCityPrice="isCityPrice"></detailProductList>
|
|
|
+
|
|
|
+ <!-- 活动列表 -->
|
|
|
+ <div
|
|
|
+ v-for="item in activeList"
|
|
|
+ :key="item.promoRuleSn"
|
|
|
+ >
|
|
|
+ <div class="active-title">
|
|
|
+ <div>
|
|
|
+ <strong style="margin-right:10px;font-size:14px;">{{item.promotion.title}}</strong> ({{item.promotionRule.description}})
|
|
|
+ <span style="margin-left:20px;color:#00aaff;cursor: pointer;" @click="(event) => {showDesc(event, item)}">
|
|
|
+ <a-icon title="查看活动详情" type="eye"/> 活动详情
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span v-if="$hasPermissions('B_salesEdit_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong>;</span>
|
|
|
+ 总款数:<strong>{{ detailData&&(detailData.totalCommonCategory || detailData.totalCommonCategory==0) ? detailData.totalCommonCategory : '--' }}</strong>;
|
|
|
+ 总数量:<strong>{{ detailData&&(detailData.totalCommonQty || detailData.totalCommonQty==0) ? detailData.totalCommonQty : '--' }}</strong>;
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <detailProductList
|
|
|
+ :ref="'active-'+item.promoRuleSn"
|
|
|
+ :promo="item"
|
|
|
+ :detailData="detailData"
|
|
|
+ :warehouseSn="warehouseSn"
|
|
|
+ :salesBillSn="$route.params.sn || bizSn"
|
|
|
+ :authCode="authCode"
|
|
|
+ :showCityPrice="isCityPrice"></detailProductList>
|
|
|
+ </div>
|
|
|
</a-card>
|
|
|
</a-spin>
|
|
|
<div class="affix-cont">
|
|
@@ -214,15 +219,17 @@ import moment from 'moment'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import printModal from './printModal.vue'
|
|
|
import auditModal from '@/views/common/auditModal.vue'
|
|
|
-import dsModal from '@/views/salesManagement/waitDispatch/dsModal.vue'
|
|
|
+import dsModal from '@/views/salesManagement/waitDispatchNew/dsModal.vue'
|
|
|
import stockOutDetail from './stockOutDetailModal.vue'
|
|
|
import chooseWarehouse from '@/views/common/chooseWarehouse'
|
|
|
-import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAudit, salesWriteAuditPush } from '@/api/salesNew'
|
|
|
-import { salesDetailAllList } from '@/api/salesDetailNew'
|
|
|
+import detailProductList from './comps/detailProductList.vue'
|
|
|
+// 接口
|
|
|
+import { salesDetailBySn, salesPromoQueryList, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAudit, salesWriteAuditPush } from '@/api/salesNew'
|
|
|
+
|
|
|
export default {
|
|
|
- name: 'SalesDetail',
|
|
|
+ name: 'SalesDetailNew',
|
|
|
mixins: [commonMixin],
|
|
|
- components: { STable, VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse },
|
|
|
+ components: { STable, VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse, detailProductList },
|
|
|
props: {
|
|
|
bizSn: { // 有值则为弹框,无值则为页面
|
|
|
type: [Number, String],
|
|
@@ -235,49 +242,8 @@ export default {
|
|
|
disabled: false,
|
|
|
showDsModal: false,
|
|
|
showStockOut: false,
|
|
|
- authCode: '',
|
|
|
- queryParam: {
|
|
|
- warehouseSn: undefined
|
|
|
- },
|
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
- loadData: parameter => {
|
|
|
- this.disabled = true
|
|
|
- const params = Object.assign(parameter, { salesBillSn: this.bizSn || this.$route.params.sn, warehouseSn: this.queryParam.warehouseSn })
|
|
|
- if (this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')) { // 审核,需用到库存
|
|
|
- params.showStock = true
|
|
|
- }
|
|
|
- return salesDetailAllList(params).then(res => {
|
|
|
- let data
|
|
|
- if (res.status == 200) {
|
|
|
- data = res.data
|
|
|
- const no = 0
|
|
|
- this.outStockStr = ''
|
|
|
- let str = ''
|
|
|
- for (var i = 0; i < data.length; i++) {
|
|
|
- data[i].no = no + i + 1
|
|
|
- const productCode = (data[i].productEntity && data[i].productEntity.code) || (data[i].dealerProductEntity && data[i].dealerProductEntity.code)
|
|
|
- const productName = (data[i].productEntity && data[i].productEntity.name) || (data[i].dealerProductEntity && data[i].dealerProductEntity.name)
|
|
|
- const productOrigCode = (data[i].productEntity && data[i].productEntity.origCode) || (data[i].dealerProductEntity && data[i].dealerProductEntity.origCode)
|
|
|
- const productOrigUnit = (data[i].productEntity && data[i].productEntity.unit) || (data[i].dealerProductEntity && data[i].dealerProductEntity.unit)
|
|
|
- data[i].productCode = productCode || '--'
|
|
|
- data[i].productName = productName || '--'
|
|
|
- data[i].productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
|
|
|
- data[i].productOrigUnit = productOrigUnit || '--'
|
|
|
- if (data[i].unpushedQty && (Number(data[i].stockQty) < Number(data[i].unpushedQty))) {
|
|
|
- str += data[i].productCode + '、'
|
|
|
- }
|
|
|
- }
|
|
|
- if (str.length > 0) {
|
|
|
- str = str.substr(0, str.length - 1)
|
|
|
- this.outStockStr = '产品编号为:' + str + '的产品库存不足;'
|
|
|
- }
|
|
|
- this.localDataSource = data
|
|
|
- this.disabled = false
|
|
|
- }
|
|
|
- return data
|
|
|
- })
|
|
|
- },
|
|
|
- localDataSource: [],
|
|
|
+ authCode: '', // 权限码
|
|
|
+ hasData: false, // 是否有数据
|
|
|
showDetail: false,
|
|
|
openModal: false,
|
|
|
detailData: null, // 详情数据
|
|
@@ -286,12 +252,14 @@ export default {
|
|
|
visibleAudit: false,
|
|
|
auditInfo: null,
|
|
|
spinningAudit: false,
|
|
|
- outStockStr: '', // 缺货产品信息说明
|
|
|
auditText: null,
|
|
|
- fromRouter: null
|
|
|
+ fromRouter: null,
|
|
|
+ activeList: [],
|
|
|
+ warehouseSn: undefined
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ // 地址
|
|
|
shippingAddress () {
|
|
|
const shippingAddrProvinceName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrProvinceName ? this.detailData.salesBillExtEntity.shippingAddrProvinceName : ''
|
|
|
const shippingAddrCityName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCityName ? this.detailData.salesBillExtEntity.shippingAddrCityName : ''
|
|
@@ -303,50 +271,6 @@ export default {
|
|
|
return shippingAddrProvinceName + shippingAddrCityName + shippingAddrCountyName + shippingAddr
|
|
|
}
|
|
|
},
|
|
|
- columns () {
|
|
|
- const _this = this
|
|
|
- const arr = [
|
|
|
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productCode', width: '13%', scopedSlots: { customRender: 'productCode' }, align: 'center' },
|
|
|
- { title: '产品名称', dataIndex: 'productName', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '原厂编码', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '出库仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- // { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- // { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- // { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- // { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '单位', dataIndex: 'productOrigUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- // { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' },
|
|
|
- { title: '待下推数', dataIndex: 'unpushedQty', 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: 'cancelQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
|
|
|
- ]
|
|
|
- if (this.$hasPermissions(this.authCode + '_costPrice')) { // 成本价权限
|
|
|
- arr.splice(5, 0, { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
- }
|
|
|
-
|
|
|
- const ind = this.$hasPermissions(this.authCode + '_costPrice') ? 6 : 5
|
|
|
- if (this.$hasPermissions(this.authCode + '_provincePrice')) {
|
|
|
- arr.splice(ind, 0, { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
- }
|
|
|
- // 是否勾选市级价格
|
|
|
- if (this.isCityPrice) {
|
|
|
- arr.splice(ind + 1, 0, { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
- if (this.$hasPermissions(this.authCode + '_salesPrice')) { // 售价权限
|
|
|
- arr.splice(ind + 2, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (this.$hasPermissions(this.authCode + '_salesPrice')) { // 售价权限
|
|
|
- arr.splice(ind + 1, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')) { // 审核,需用到库存
|
|
|
- arr.splice(arr.length - 3, 0, { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' })
|
|
|
- }
|
|
|
- return arr
|
|
|
- }
|
|
|
},
|
|
|
methods: {
|
|
|
// 返回
|
|
@@ -360,12 +284,54 @@ export default {
|
|
|
},
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
- this.queryParam.warehouseSn = undefined
|
|
|
- this.$refs.table.refresh()
|
|
|
+ this.warehouseSn = undefined
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.searchTable()
|
|
|
+ },100)
|
|
|
+ },
|
|
|
+ searchTable(){
|
|
|
+ this.$refs.normalProduct.getTableData()
|
|
|
+ this.activeList.map(item => {
|
|
|
+ this.$refs['active-'+item.promoRuleSn][0].getTableData()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 详情
|
|
|
+ getDetail () {
|
|
|
+ salesDetailBySn({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.detailData = res.data || null
|
|
|
+ }
|
|
|
+ this.getActiveList()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 查看活动详情
|
|
|
+ showDesc(e,item){
|
|
|
+
|
|
|
+ },
|
|
|
+ // 获取销售单参与的活动列表
|
|
|
+ getActiveList(){
|
|
|
+ salesPromoQueryList({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.activeList = res.data || []
|
|
|
+ this.activeList.map(item => {
|
|
|
+ item.isActive = true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.searchTable()
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
// 打开缺货明细
|
|
|
openStockOut () {
|
|
|
- if (this.outStockStr != '') {
|
|
|
+ const showMoad = false
|
|
|
+ this.activeList.map(item => {
|
|
|
+ if(!showMoad){
|
|
|
+ showMoad = this.$refs['active-'+item.promoRuleSn][0].outStockStr != ''
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ if (this.$refs.normalProduct.outStockStr != ''||showMoad) {
|
|
|
this.showStockOut = true
|
|
|
} else {
|
|
|
this.$info({
|
|
@@ -375,17 +341,6 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- // 详情
|
|
|
- getDetail () {
|
|
|
- salesDetailBySn({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.detailData = res.data || null
|
|
|
- this.$refs.table.refresh(true)
|
|
|
- } else {
|
|
|
- this.detailData = null
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 打开审核/一键审核弹框
|
|
|
handleAudit (isBatch) {
|
|
|
if (isBatch) { // 一键审核
|
|
@@ -520,6 +475,13 @@ export default {
|
|
|
.salesDetail-cont{
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
+ .active-title{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 10px;
|
|
|
+ background: #e3f9ff;
|
|
|
+ }
|
|
|
.flexBox{
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|