Browse Source

销售单仓库查询

chenrui 2 years ago
parent
commit
cc1e031068

+ 51 - 0
src/api/sales.js

@@ -239,3 +239,54 @@ export const updateWarehouse = (params) => {
     data: params
   })
 }
+
+//  按仓库查询销售单 列表  有分页
+export const queryPageForWarehouse = (params) => {
+  const url = `/sales/queryPageForWarehouse/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 获取按仓库查询销售单数量
+export const queryCountForWarehouse = (params) => {
+  return axios({
+    url: '/sales/queryCountForWarehouse',
+    method: 'post',
+    data: params
+  })
+}
+// 按仓库查询销售明细 列表
+export const queryPageForWarehouseDetail = (params) => {
+  const url = `/sales/detail/queryPageForWarehouse/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 获取按仓库查询销售单明细数量
+export const queryCountForWarehouseDetail = (params) => {
+  return axios({
+    url: '/sales/detail/queryCountForWarehouse',
+    method: 'post',
+    data: params
+  })
+}
+// 按仓库导出销售单
+
+export const exportForWarehouse = params => {
+  const url = `/sales/exportForWarehouse`
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 1 - 1
src/config/router.config.js

@@ -234,7 +234,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'detail/:sn/',
+                path: 'detail/:sn/:wsn',
                 name: 'saleOrderDetail',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesOrderWarehouse/detail.vue'),
                 meta: {

+ 25 - 21
src/views/salesManagement/salesOrderWarehouse/detail.vue

@@ -12,7 +12,7 @@
           <a-collapse-panel key="1" header="基础信息" v-if="detailData">
             <a-descriptions size="small" :column="3">
               <a-descriptions-item label="销售单号">{{ detailData.salesBillNo || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="创建时间">{{ detailData.dispatchBillNo || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="创建时间">{{ detailData.createDate || '--' }}</a-descriptions-item>
               <a-descriptions-item label="客户名称">{{ detailData.buyerName || '--' }}</a-descriptions-item>
               <a-descriptions-item label="收货地址" :span="2" v-if="detailData&&detailData.salesBillExtEntity">
                 {{ detailData.salesBillExtEntity&&detailData.salesBillExtEntity.shippingAddrProvinceName || '' }}
@@ -32,9 +32,9 @@
         <a-alert type="info" style="margin-bottom: 10px;" v-if="detailData!=null">
           <div slot="message">
             <span>
-              总数量:<strong>{{ detailData.totalSalesQty || detailData.totalSalesQty==0? detailData.totalSalesQty : '--' }}</strong>;
+              总数量:<strong>{{ countData.totalQty || countData.totalQty==0? countData.totalQty : '--' }}</strong>;
             </span>
-            总款数:<strong>{{ detailData.totalQty || detailData.totalQty==0? detailData.totalQty : '--' }}</strong>;
+            总款数:<strong>{{ countData.totalCategory || countData.totalCategory==0? countData.totalCategory : '--' }}</strong>;
           </div>
         </a-alert>
         <!-- 列表 -->
@@ -64,7 +64,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
-import { dispatchDetaillList, dispatchFindBySn } from '@/api/dispatch'
+import { queryPageForWarehouseDetail, queryCountForWarehouseDetail, salesDetailBySn } from '@/api/sales'
 export default {
   name: 'SalesOrderWarehouseDetail',
   mixins: [commonMixin],
@@ -76,21 +76,13 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        return dispatchDetaillList(Object.assign(parameter, { dispatchBillSn: this.outBizSubSn || this.bizSn || this.$route.params.sn })).then(res => {
+        return queryPageForWarehouseDetail(Object.assign(parameter, { salesBillSn: this.$route.params.sn, warehouseSn: this.$route.params.wsn })).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
-              const productCode = (data.list[i].productEntity && data.list[i].productEntity.code) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.code)
-              const productName = (data.list[i].productEntity && data.list[i].productEntity.name) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.name)
-              const productOrigCode = (data.list[i].productEntity && data.list[i].productEntity.origCode) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.origCode)
-              const productOrigUnit = (data.list[i].productEntity && data.list[i].productEntity.unit) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.unit)
-              data.list[i].productCode = productCode || '--'
-              data.list[i].productName = productName || '--'
-              data.list[i].productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
-              data.list[i].productOrigUnit = productOrigUnit || '--'
             }
             this.disabled = false
           }
@@ -98,6 +90,7 @@ export default {
         })
       },
       detailData: null, //  详情数据
+      countData: null, // 数量数据
       fromRouter: null
     }
   },
@@ -106,13 +99,13 @@ export default {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '25%', scopedSlots: { customRender: 'productCode' }, align: 'center' },
-        { title: '产品名称', dataIndex: 'productName', width: '33%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '单位', dataIndex: 'productOrigUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productEntity.name', width: '33%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '销售数量', dataIndex: 'qty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
       if (this.$hasPermissions('B_dispatchDetail_salesPrice')) { //  售价权限
-        arr.splice(4, 0, { title: '出库仓库', dataIndex: 'productOrigUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
+        arr.splice(4, 0, { title: '出库仓库', dataIndex: 'warehouseName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
       }
       return arr
     }
@@ -124,26 +117,37 @@ export default {
     },
     //  详情
     getDetail () {
-      dispatchFindBySn({ dispatchBillSn: this.outBizSubSn || this.bizSn || this.$route.params.sn }).then(res => {
+      salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
-          this.detailData = res.data
+          this.$refs.table.refresh(true)
+          this.detailData = res.data || null
         } else {
           this.detailData = null
         }
       })
+    },
+    // 数量
+    getCount () {
+      queryCountForWarehouseDetail({ salesBillSn: this.$route.params.sn, warehouseSn: this.$route.params.wsn }).then(res => {
+        if (res.status == 200) {
+          this.countData = res.data
+        } else {
+          this.countData = null
+        }
+      })
     }
   },
   mounted () {
     if (!this.$store.state.app.isNewTab || this.outBizSubSn || this.bizSn) { // 页签刷新 或 为弹框时调用
-      this.$refs.table.refresh(true)
       this.getDetail()
+      this.getCount()
     }
   },
   activated () {
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
-      this.$refs.table.refresh(true)
       this.getDetail()
+      this.getCount()
     }
   },
   beforeRouteEnter (to, from, next) {

+ 33 - 24
src/views/salesManagement/salesOrderWarehouse/list.vue

@@ -12,21 +12,21 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="客户名称">
-                <a-input id="salesOrderWarehouseList-demanderName" v-model.trim="queryParam.demanderName" allowClear placeholder="请输入客户名称"/>
+                <a-input id="salesOrderWarehouseList-buyerSn" v-model.trim="queryParam.buyerSn" allowClear placeholder="请输入客户名称"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="销售单号">
-                <a-input id="salesOrderWarehouseList-outBizNo" v-model.trim="queryParam.outBizNo" allowClear placeholder="请输入销售单号"/>
+                <a-input id="salesOrderWarehouseList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="业务状态">
                 <v-select
-                  v-model="queryParam.state"
-                  ref="state"
-                  id="salesOrderWarehouseList-state"
-                  code="OUT_STATE"
+                  v-model="queryParam.billStatus"
+                  ref="billStatus"
+                  id="salesManagementList-billStatus"
+                  code="SALES_BILL_STATUS"
                   placeholder="请选择业务状态"
                   allowClear></v-select>
               </a-form-item>
@@ -59,7 +59,6 @@
       <!-- alert -->
       <a-alert type="info" style="margin-bottom:10px">
         <div slot="message">
-          总单数:<strong>{{ totalData&&(totalData.totalRecord || totalData.totalRecord==0) ? totalData.totalRecord : '--' }}</strong>;
           总款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
           总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
         </div>
@@ -70,8 +69,8 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :rowKey="(record) => record.stockOutSn"
-        rowKeyName="stockOutSn"
+        :rowKey="(record) => record.salesBillNo"
+        rowKeyName="salesBillNo"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -79,7 +78,7 @@
         bordered>
         <!-- 单号 -->
         <template slot="stockOutNo" slot-scope="text, record">
-          <span class="link-bule" @click="handleDetail(record)">{{ record.stockOutNo }}</span>
+          <span class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
         </template>
       </s-table>
     </a-spin>
@@ -94,7 +93,7 @@ import getDate from '@/libs/getDate.js'
 import Area from '@/views/common/area.js'
 import { STable, VSelect } from '@/components'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
-import { stockOutList } from '@/api/stockOut'
+import { queryPageForWarehouse, queryCountForWarehouse, exportForWarehouse } from '@/api/sales'
 import { hdExportExcel } from '@/libs/exportExcel'
 export default {
   name: 'SalesOrderWarehouseList',
@@ -111,20 +110,22 @@ export default {
       queryParam: { //  查询条件
         beginDate: getDate.getThreeMonthDays().starttime,
         endDate: getDate.getCurrMonthDays().endtime,
-        demanderName: '', //  客户名称
-        state: undefined, //  状态
+        buyerSn: '', //  客户名称
+        billStatus: undefined, //  业务状态
+        salesBillNo: '', // 销售单号
         shippingAddrProvinceSn: undefined,
-        sendFlag: undefined,
         warehouseSn: undefined
       },
       exportLoading: false,
       disabled: false, //  查询、重置按钮是否可操作
       loading: false,
+      totalData: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return stockOutList(Object.assign(parameter, this.queryParam)).then(res => {
+        const params = Object.assign(parameter, this.queryParam)
+        return queryPageForWarehouse(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -132,6 +133,7 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
             }
+            this.getCount(params)
             this.disabled = false
           }
           this.spinning = false
@@ -149,10 +151,10 @@ export default {
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '销售单号', scopedSlots: { customRender: 'stockOutNo' }, width: '10%', align: 'center' },
-        { title: '提交时间', dataIndex: 'auditTime', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'demanderName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '总数量', dataIndex: 'productTotalQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '业务状态', dataIndex: 'sendFlagDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '提交时间', dataIndex: 'submitDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '总数量', dataIndex: 'totalQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '业务状态', dataIndex: 'billStatusDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
 	  if (this.isShowWarehouse) {
 	    arr.splice(5, 0, { title: '出库仓库', dataIndex: 'warehouseName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
@@ -161,17 +163,24 @@ export default {
     }
   },
   methods: {
+    // 获取总数量
+    getCount (params) {
+      queryCountForWarehouse(params).then(res => {
+        if (res.status == 200) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
     //  导出
     handleExport () {
       const _this = this
-      _this.$store.state.app.curActionPermission = 'B_sales_export'
       _this.exportLoading = true
       _this.spinning = true
-      hdExportExcel(salesDetailExport, _this.queryParam, '销售明细', function () {
+      hdExportExcel(exportForWarehouse, _this.queryParam, '销售单仓库明细', function () {
         _this.exportLoading = false
         _this.spinning = false
-        _this.showExport = true
-        _this.$store.state.app.curActionPermission = ''
       })
     },
     //  时间  change
@@ -193,7 +202,7 @@ export default {
     },
     //  详情
     handleDetail (row) {
-      this.$router.push({ path: `/salesManagement/salesOrderWarehouse/detail/${row.allocateSn}` })
+      this.$router.push({ path: `/salesManagement/salesOrderWarehouse/detail/${row.salesBillSn}/${row.warehouseSn}` })
     },
     pageInit () {
       const _this = this