lilei преди 4 години
родител
ревизия
b40490be8a

+ 1 - 1
src/views/purchasingManagement/purchaseOrder/detail.vue

@@ -107,7 +107,7 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.disabled = true
         this.disabled = true
-        return purchaseDetailList(Object.assign(parameter, this.queryParam)).then(res => {
+        return purchaseDetailList(Object.assign(parameter, { purchaseBillSn: this.$route.params.sn })).then(res => {
           const data = res.data
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
           for (var i = 0; i < data.list.length; i++) {

+ 1 - 5
src/views/purchasingManagement/purchaseOrder/list.vue

@@ -227,11 +227,7 @@ export default {
     },
     },
     //  签收入库
     //  签收入库
     handleWarehouse (row) {
     handleWarehouse (row) {
-      purchaseWriteStockIn({ id: row.id }).then(res => {
-        if (res.status == 200) {
-          this.$router.push({ name: `purchaseOrderWarehousing`, params: { id: row.id } })
-        }
-      })
+      this.$router.push({ name: `purchaseOrderWarehousing`, params: { sn: row.purchaseBillSn } })
     },
     },
     //  删除
     //  删除
     handleDel (row) {
     handleDel (row) {

+ 131 - 70
src/views/purchasingManagement/purchaseOrder/warehousing.vue

@@ -1,13 +1,13 @@
 <template>
 <template>
   <div class="purchaseOrderWarehousing-wrap">
   <div class="purchaseOrderWarehousing-wrap">
-    <a-page-header :ghost="false" @back="handleBack" >
+    <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
       <!-- 自定义的二级文字标题 -->
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
       <template slot="subTitle">
-        <a id="purchaseOrderWarehousing-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+        <a id="purchaseOrderWarehousing-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        <span class="billno">单号:{{ detail&&detail.purchaseBillNo }}</span>
       </template>
       </template>
     </a-page-header>
     </a-page-header>
     <!-- 内容 -->
     <!-- 内容 -->
-    <a-page-header title="单号:CG2021010100001" ></a-page-header>
     <a-card size="small" :bordered="false" class="purchaseOrderWarehousing-cont">
     <a-card size="small" :bordered="false" class="purchaseOrderWarehousing-cont">
       <!-- 搜索条件 -->
       <!-- 搜索条件 -->
       <div class="table-page-search-wrapper">
       <div class="table-page-search-wrapper">
@@ -15,26 +15,17 @@
           <a-row :gutter="15">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
               <a-form-item label="关键词">
               <a-form-item label="关键词">
-                <a-input id="purchaseOrderWarehousing-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="产品名称/产品编码/原厂编码"/>
+                <a-input id="purchaseOrderWarehousing-bundleName" v-model.trim="queryParam.queryWord" allowClear placeholder="产品名称/产品编码/原厂编码"/>
               </a-form-item>
               </a-form-item>
             </a-col>
             </a-col>
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
               <a-form-item label="产品品牌">
               <a-form-item label="产品品牌">
-                <a-select
-                  placeholder="请选择"
-                  id="purchaseOrderWarehousing-state"
-                  allowClear
-                  v-model="queryParam.dataSourceNo"
-                  :showSearch="true"
-                  option-filter-prop="children"
-                  :filter-option="filterOption">
-                  <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
-                </a-select>
+                <ProductBrand id="purchaseOrderWarehousing-productBrand" v-model="queryParam.productBrandSn"></ProductBrand>
               </a-form-item>
               </a-form-item>
             </a-col>
             </a-col>
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
               <a-form-item label="产品类别">
               <a-form-item label="产品类别">
-                <a-cascader :options="typeData" expand-trigger="hover" id="purchaseOrderWarehousing-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
+                <ProductType id="purchaseOrderWarehousing-productType" @change="changeProductType" v-model="productType"></ProductType>
               </a-form-item>
               </a-form-item>
             </a-col>
             </a-col>
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
@@ -58,20 +49,17 @@
         :data="loadData"
         :data="loadData"
         :scroll="{ x: 1360 }"
         :scroll="{ x: 1360 }"
         bordered>
         bordered>
-        <!-- 入库数量 -->
-        <template slot="storageQuantity" slot-scope="text, record">
-          <span>{{ record.storageQuantity }}</span>
-          <a-input-number
-            id="purchaseOrderWarehousing-storageQuantity"
-            :value="record.storageQuantity"
-            :precision="0"
-            :min="0"
-            :max="999999"
-            placeholder="请输入" />
-        </template>
         <!-- 仓库仓位 -->
         <!-- 仓库仓位 -->
-        <template slot="warehousePosition" slot-scope="text, record">
-          <a-cascader :options="typeData" expand-trigger="hover" id="purchaseOrderWarehousing-state" placeholder="请选择" allowClear v-model="record.brand" />
+        <template slot="warehousePosition" slot-scope="text, record, index">
+          <a-cascader
+            @change="e => changeWarehouseCascade(e, record, index)"
+            v-model="record.warehouseCascade"
+            expand-trigger="hover"
+            :options="warehouseCascadeData"
+            :fieldNames="{ label: 'name', value: 'id', children: 'warehouseLocationList' }"
+            id="bulkWarehousingOrderEdit-warehouseCascade"
+            placeholder="请选择仓库仓位"
+            style="width: 100%;" />
         </template>
         </template>
       </s-table>
       </s-table>
     </a-card>
     </a-card>
@@ -85,71 +73,85 @@
 
 
 <script>
 <script>
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
+import { purchaseDetailBySn } from '@/api/purchase'
+import { purchaseDetailList, updateWarehouse } from '@/api/purchaseDetail'
+import ProductType from '../../common/productType.js'
+import ProductBrand from '../../common/productBrand.js'
+import { warehouseCascadeList } from '@/api/warehouse'
 export default {
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, ProductType, ProductBrand },
   data () {
   data () {
     return {
     return {
+      detail: null, //  详情数据
+      productType: [],
       queryParam: {
       queryParam: {
-
+        productBrandSn: undefined,
+        queryWord: '',
+        brand: '',
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '' //  产品三级分类
       },
       },
-      brandData: [], //  产品品牌  下拉数据
-      typeData: [], //  产品类别  下拉数据
       disabled: false, //  查询、重置按钮是否可操作
       disabled: false, //  查询、重置按钮是否可操作
+      warehouseCascadeData: [], //  仓库仓位
       // 表头
       // 表头
       columns: [
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'custName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'totalP', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购单价', dataIndex: 'totalNums', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '采购数量', scopedSlots: { customRender: 'purchaseNum' }, width: 100, align: 'center' },
-        { title: '缺货数量', scopedSlots: { customRender: 'outOfStockNum' }, width: 100, align: 'center' },
-        { title: '单位', dataIndex: 'mementPay', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购金额', dataIndex: 'shDate', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '入库数量', scopedSlots: { customRender: 'storageQuantity' }, width: 150, align: 'center' },
-        { title: '仓库仓位', scopedSlots: { customRender: 'warehousePosition' }, width: 150, align: 'center' }
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购单价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
+        { title: '缺货数量', dataIndex: 'oosQty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
+        { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
+        { title: '入库数量', dataIndex: 'putQty', width: 100, align: 'center' },
+        { title: '仓库仓位', scopedSlots: { customRender: 'warehousePosition' }, width: 300, align: 'center' }
       ],
       ],
+      chooseLoadData: [],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.disabled = true
         this.disabled = true
-        // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
-        //   const 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
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [
-              { id: '1', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
-            ],
-            count: 10
-          }
+        return purchaseDetailList(Object.assign(parameter, { purchaseBillSn: this.$route.params.sn })).then(res => {
+          const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
             data.list[i].no = no + i + 1
+            const warehouseSn = data.list[i].warehouseSn || undefined
+            const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
+            if (warehouseSn || warehouseLocationSn) {
+              data.list[i].warehouseSnBackups = warehouseSn
+              data.list[i].warehouseLocationSnBackups = warehouseLocationSn
+              data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
+            } else {
+              data.list[i].warehouseCascade = undefined
+            }
           }
           }
-          _this.disabled = false
-          resolve(data)
+          this.disabled = false
+          this.chooseLoadData = data.list
+          return data
         })
         })
       }
       }
     }
     }
   },
   },
   methods: {
   methods: {
-    //  重置
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    //  重置产品库
     resetSearchForm () {
     resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
+      this.queryParam = {
+        productBrandSn: undefined,
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        queryWord: '',
+        brand: ''
+      }
+      this.productType = []
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
     //  确认入库
     //  确认入库
@@ -164,7 +166,61 @@ export default {
       	return (
       	return (
       		option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       		option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       	)
       	)
+    },
+    //  详情
+    getDetail () {
+      purchaseDetailBySn({ sn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.detail = res.data
+        } else {
+          this.detail = null
+        }
+      })
+    },
+    //  仓库仓位  级联  列表
+    getWarehouseCascade () {
+      warehouseCascadeList({}).then(res => {
+        if (res.status == 200) {
+          this.warehouseCascadeData = res.data
+        } else {
+          this.warehouseCascadeData = []
+        }
+      })
+    },
+    // 修改仓库仓位
+    changeWarehouseCascade (val, opt, ind) {
+      console.log(val, opt, ind)
+      let loadData = this.chooseLoadData[ind]
+      if (val.length < 2) {
+        this.$message.warning('当前仓库无仓位,请选择其他仓库')
+        const warehouseSnBackups = loadData.warehouseSnBackups || undefined
+        const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
+        loadData.warehouseSn = warehouseSnBackups
+        loadData.warehouseLocationSn = warehouseLocationSnBackups
+        if (warehouseSnBackups || warehouseLocationSnBackups) {
+          loadData.warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
+        } else {
+          loadData.warehouseCascade = undefined
+        }
+      } else {
+        loadData.warehouseSn = val[0] ? val[0] : ''
+        loadData.warehouseLocationSn = val[1] ? val[1] : ''
+        loadData.warehouseSnBackups = val[0] ? val[0] : ''
+        loadData.warehouseLocationSnBackups = val[1] ? val[1] : ''
+        loadData = this.chooseLoadData[ind]
+        this.updateWarehouse(loadData)
+      }
+    },
+    // 修改库存
+    updateWarehouse (row) {
+      updateWarehouse({ warehouseSn: row.warehouseSn, warehouseLocationSn: row.warehouseLocationSn }).then(res => {
+
+      })
     }
     }
+  },
+  mounted () {
+    this.getDetail()
+    this.getWarehouseCascade()
   }
   }
 }
 }
 </script>
 </script>
@@ -175,5 +231,10 @@ export default {
     	text-align: center;
     	text-align: center;
     	margin: 35px 0 10px;
     	margin: 35px 0 10px;
     }
     }
+    .billno{
+      font-size: 14px;
+      font-weight: bold;
+      margin: 0 15px;
+    }
   }
   }
 </style>
 </style>