ソースを参照

Merge branch 'deploy' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into deploy

1004749546@qq.com 4 年 前
コミット
a5bc4dcdc7

+ 9 - 0
src/api/customer.js

@@ -28,6 +28,15 @@ export const custSave = params => {
   })
 }
 
+// 根据sn修改客户信息
+export const updateByCustomerSn = params => {
+  return axios({
+    url: '/cust/updateByCustomerSn',
+    data: params,
+    method: 'post'
+  })
+}
+
 // 客户详情
 export const custFindById = params => {
   return axios({

+ 10 - 0
src/api/power-user.js

@@ -21,6 +21,16 @@ export const getPowerUserList = params => {
   })
 }
 
+// 获取所有用户
+export const getUserAllList = params => {
+  const url = `/mduser/findAll`
+  return axios({
+    url: url,
+    data: params,
+    method: 'POST'
+  })
+}
+
 // 改变权限状态接口
 export const updateEnableStatus = params => {
   return axios({

+ 2 - 1
src/api/sales.js

@@ -91,7 +91,7 @@ export const salesWriteSubmit = (params) => {
     method: 'post'
   })
 }
-//  销售 保存
+//  销售 新增或编辑
 export const salesSave = (params) => {
   return axios({
     url: '/sales/save',
@@ -99,6 +99,7 @@ export const salesSave = (params) => {
     method: 'post'
   })
 }
+
 //  销售 删除
 export const salesDel = (params) => {
   return axios({

+ 21 - 6
src/api/salesDetail.js

@@ -11,10 +11,26 @@ export const salesDetailList = (params) => {
     method: 'post'
   })
 }
-//  销售详情 保存
-export const salesDetailSave = (params) => {
+//  销售详情 新增配件
+export const salesDetailInsert = (params) => {
   return axios({
-    url: '/salesDetail/save',
+    url: '/salesDetail/insert',
+    data: params,
+    method: 'post'
+  })
+}
+//  销售详情 修改价格
+export const salesDetailUpdatePrice = (params) => {
+  return axios({
+    url: '/salesDetail/updatePrice',
+    data: params,
+    method: 'post'
+  })
+}
+//  销售详情 修改数量
+export const salesDetailUpdateQty = (params) => {
+  return axios({
+    url: '/salesDetail/updateQty',
     data: params,
     method: 'post'
   })
@@ -23,14 +39,13 @@ export const salesDetailSave = (params) => {
 export const salesDetailDel = (params) => {
   return axios({
     url: `/salesDetail/delete/${params.id}`,
-    data: params,
-    method: 'post'
+    method: 'get'
   })
 }
 //  销售详情 整单删除
 export const salesDetailDelAll = (params) => {
   return axios({
-    url: `/salesDetail/deleteAll/${params.id}`,
+    url: `/salesDetail/deleteBySalesBillSn/${params.salesBillSn}`,
     data: params,
     method: 'post'
   })

+ 39 - 0
src/api/sparePartsPur.js

@@ -27,6 +27,30 @@ export const sparePartsPurSave = (params) => {
     method: 'post'
   })
 }
+//  散件采购(入库) 提交
+export const sparePartsPurSubmit = (params) => {
+  return axios({
+    url: '/sparePartsPur/submit',
+    data: params,
+    method: 'post'
+  })
+}
+//  散件采购(入库) 入库
+export const sparePartsPurPut = (params) => {
+  return axios({
+    url: '/sparePartsPur/put',
+    data: params,
+    method: 'post'
+  })
+}
+//  散件采购(入库) 删除
+export const sparePartsPurDel = (params) => {
+  return axios({
+    url: `/sparePartsPur/delete/${params.id}`,
+    method: 'get'
+  })
+}
+
 //  散件采购(入库) 详情
 export const sparePartsPurDetail = (params) => {
   return axios({
@@ -53,3 +77,18 @@ export const sparePartsPurDetailCount = (params) => {
     method: 'post'
   })
 }
+//  散件采购(入库) 详情列表 保存
+export const sparePartsPurDetailSave = (params) => {
+  return axios({
+    url: '/sparePartsPur/detail/save',
+    data: params,
+    method: 'post'
+  })
+}
+//  散件采购(入库) 详情列表 删除
+export const sparePartsPurDetailDel = (params) => {
+  return axios({
+    url: `/sparePartsPur/detail/delete/${params.id}`,
+    method: 'get'
+  })
+}

+ 12 - 0
src/api/stock.js

@@ -38,3 +38,15 @@ export const stockDetailCount = (params) => {
     method: 'post'
   })
 }
+
+//  库存 详情列表  分页
+export const querySumByProductLocation = (params) => {
+  const url = `/stock/detail/querySumByProductLocation/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

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

@@ -94,7 +94,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add',
+                path: 'add/:id',
                 name: 'salesAdd',
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/edit.vue'),
                 meta: {
@@ -1145,7 +1145,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'detail/:id',
+                path: 'detail/:id/:sn',
                 name: 'bulkWarehousingOrderDetail',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkWarehousingOrder/detail.vue'),
                 meta: {

+ 41 - 42
src/views/bulkManagement/bulkWarehousingOrder/detail.vue

@@ -1,9 +1,14 @@
 <template>
   <div class="bulkWarehousingOrderDetail-wrap">
-    <a-page-header :ghost="false" @back="handleBack" >
+    <a-page-header :ghost="false" :backIcon="false" class="bulkWarehousingOrderDetail-cont" >
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
-        <a id="bulkWarehousingOrderDetail-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+        <a id="bulkWarehousingOrderDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.sparePartsPurchaseSn) || '' }}</p>
+      </template>
+      <template slot="tags">
+        <a-tag color="purple" v-if="basicInfoData&&basicInfoData.stateDictValue">{{ basicInfoData.stateDictValue }}</a-tag>
+        <a-tag color="orange" v-if="basicInfoData&&basicInfoData.settleStateDictValue">{{ basicInfoData.settleStateDictValue }}</a-tag>
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
@@ -11,23 +16,16 @@
         <a-button key="1" type="primary" id="bulkWarehousingOrderDetail-print-btn">快速打印</a-button>
       </template>
     </a-page-header>
-    <!-- 内容 -->
-    <a-page-header title="单号:CG2021010100001" >
-      <template slot="tags">
-        <a-tag color="blue">审核通过</a-tag>
-        <a-tag color="orange">未结算</a-tag>
-      </template>
-    </a-page-header>
     <!-- 基础信息 -->
     <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
       <a-collapse :activeKey="['1']">
         <a-collapse-panel key="1" header="基础信息">
           <a-descriptions :column="3">
-            <a-descriptions-item label="供应商">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="支付方式">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="采购员工">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="收货人">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="收货地址">箭冠营销中心</a-descriptions-item>
+            <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '' }}</a-descriptions-item>
+            <a-descriptions-item label="散件入库类型">{{ (basicInfoData&&basicInfoData.sparePartsTypeName) || '' }}</a-descriptions-item>
+            <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '' }}</a-descriptions-item>
+            <a-descriptions-item label="联系人">{{ (basicInfoData&&basicInfoData.supplierName) || '' }}</a-descriptions-item>
+            <a-descriptions-item label="联系地址">{{ (basicInfoData&&basicInfoData.supplierName) || '' }}</a-descriptions-item>
           </a-descriptions>
         </a-collapse-panel>
       </a-collapse>
@@ -48,7 +46,7 @@
             :rowKey="(record) => record.id"
             :columns="columns"
             :data="loadData"
-            :scroll="{ x: 1060 }"
+            :scroll="{ x: 1080, y: 300 }"
             bordered>
             <!-- 采购数量 -->
             <template slot="purchaseNum" slot-scope="text, record">
@@ -84,6 +82,7 @@
 
 <script>
 import { STable, VSelect } from '@/components'
+import { sparePartsPurDetail, sparePartsPurDetailList } from '@/api/sparePartsPur'
 export default {
   components: { STable, VSelect },
   data () {
@@ -91,52 +90,52 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'creatDate', width: 200, 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: 'totaslNums', 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: '采购金额', dataIndex: 'shDate', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓库', dataIndex: 'shD3ate', width: 100, align: 'center' },
+        { title: '仓位', dataIndex: 'shDaste', width: 100, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         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 sparePartsPurDetailList(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
-          resolve(data)
+          this.disabled = false
+          return data
         })
-      }
+      },
+      basicInfoData: null //  基本信息
     }
   },
   methods: {
     //  返回列表
     handleBack () {
       this.$router.push({ path: '/bulkManagement/bulkWarehousingOrder/list' })
+    },
+    // 基本信息
+    getDetail () {
+      sparePartsPurDetail({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.basicInfoData = res.data
+        } else {
+          this.basicInfoData = null
+        }
+      })
     }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.openModal = false
+      vm.getDetail()
+    })
   }
 }
 </script>

+ 415 - 126
src/views/bulkManagement/bulkWarehousingOrder/edit.vue

@@ -1,34 +1,25 @@
 <template>
   <div class="bulkWarehousingOrderEdit-wrap">
     <!-- 内容 -->
-    <a-page-header :ghost="false" @back="handleBack" >
+    <a-page-header :ghost="false" :backIcon="false" class="bulkWarehousingOrderEdit-cont" >
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
-        <a id="bulkWarehousingOrderDetail-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+        <a id="bulkWarehousingOrderEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.sparePartsPurchaseSn) || '' }}</p>
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
-        <a-button key="2" id="bulkWarehousingOrderDetail-preview-btn">打印预览</a-button>
-        <a-button key="1" type="primary" id="bulkWarehousingOrderDetail-print-btn">快速打印</a-button>
+        <a-button key="2" id="bulkWarehousingOrderEdit-preview-btn">打印预览</a-button>
+        <a-button key="1" type="primary" id="bulkWarehousingOrderEdit-print-btn">快速打印</a-button>
       </template>
     </a-page-header>
-    <!-- 内容 -->
-    <a-page-header title="单号:CG2021010100001" ></a-page-header>
-
     <!-- 基础信息 -->
     <a-card size="small" :bordered="false" class="bulkWarehousingOrderEdit-cont">
       <a-collapse :activeKey="['1']">
         <a-collapse-panel key="1">
           <template slot="header">
             基础信息
-            <!-- <a-button
-              type="primary"
-              shape="circle"
-              size="small"
-              icon="edit"
-              class="edit-circle-btn"
-              id="bulkWarehousingOrderEdit-edit-circle-btn"
-              @click.stop="handleEditInfo" /> -->
+            <!-- <a-button type="primary" shape="circle" size="small" icon="edit" class="edit-circle-btn" id="bulkWarehousingOrderEdit-edit-circle-btn" @click.stop="handleEditInfo" /> -->
           </template>
           <a-descriptions :column="3">
             <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
@@ -53,51 +44,60 @@
                 <a-row :gutter="15">
                   <a-col :md="6" :sm="24">
                     <a-form-item label="关键词">
-                      <a-input id="bulkWarehousingOrderEdit-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="产品名称/产品编码/原厂编码"/>
+                      <a-input id="bulkWarehousingOrderEdit-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="产品名称/产品编码/原厂编码"/>
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
                     <a-form-item label="产品品牌">
                       <a-select
-                        placeholder="请选择"
-                        id="bulkWarehousingOrderEdit-state"
+                        placeholder="请选择产品品牌"
+                        id="bulkWarehousingOrderEdit-productBrandSn"
                         allowClear
-                        v-model="queryParam.dataSourceNo"
+                        v-model="queryParam.productBrandSn"
                         :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-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
                       </a-select>
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
-                    <a-form-item label="产品类别">
-                      <a-cascader :options="typeData" id="bulkWarehousingOrderEdit-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
+                    <a-form-item label="产品分类">
+                      <a-cascader
+                        @change="changeProductType"
+                        change-on-select
+                        v-model="productType"
+                        :options="productTypeList"
+                        :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
+                        id="productInfoList-productType"
+                        placeholder="请选择产品分类"
+                        allowClear />
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
-                    <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkWarehousingOrderEdit-refresh">查询</a-button>
+                    <a-button style="margin-bottom: 18px;" type="primary" @click="getDealerProductList(1)" :disabled="disabled" id="bulkWarehousingOrderEdit-refresh">查询</a-button>
                     <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="bulkWarehousingOrderEdit-reset">重置</a-button>
                   </a-col>
                 </a-row>
               </a-form>
             </div>
             <!-- 列表 -->
-            <s-table
+            <a-table
               class="sTable"
               ref="table"
               size="small"
               :rowKey="(record) => record.id"
               :columns="columns"
               :customRow="handleClickRow"
-              :data="loadData"
-              :scroll="{ x: 1700, y: 300 }"
+              :dataSource="loadData"
+              :scroll="{ x: 1780, y: 300 }"
+              :pagination="paginationProps"
               bordered>
               <!-- 成本价 -->
-              <template slot="costPrice" slot-scope="text, record">
+              <template slot="putCost" slot-scope="text, record">
                 <a-input-number
-                  id="bulkWarehousingOrderEdit-costPrice"
-                  v-model="record.costPrice"
+                  id="bulkWarehousingOrderEdit-putCost"
+                  v-model="record.putCost"
                   :precision="2"
                   :min="0"
                   :max="999999"
@@ -105,10 +105,10 @@
                   style="width: 100%;" />
               </template>
               <!-- 数量 -->
-              <template slot="quantity" slot-scope="text, record">
+              <template slot="putQty" slot-scope="text, record">
                 <a-input-number
-                  id="bulkWarehousingOrderEdit-quantity"
-                  v-model="record.quantity"
+                  id="bulkWarehousingOrderEdit-putQty"
+                  v-model="record.putQty"
                   :precision="0"
                   :min="0"
                   :max="999999"
@@ -116,22 +116,27 @@
                   style="width: 100%;" />
               </template>
               <!-- 仓库 -->
-              <template slot="warehouse" slot-scope="text, record">
-                <a-select id="bulkWarehousingOrderEdit-warehouse" placeholder="请选择" allowClear v-model="record.warehouse" style="width: 100%;">
+              <template slot="warehouseSn" slot-scope="text, record, index">
+                <a-select
+                  id="bulkWarehousingOrderEdit-warehouseSn"
+                  placeholder="请选择"
+                  @change="warehouseChange(record, index)"
+                  v-model="record.warehouseSn"
+                  style="width: 100%;">
                   <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
                 </a-select>
               </template>
               <!-- 仓位 -->
-              <template slot="position" slot-scope="text, record">
-                <a-select id="bulkWarehousingOrderEdit-position" placeholder="请选择" allowClear v-model="record.position" style="width: 100%;">
-                  <a-select-option v-for="item in warehouseList" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.name }}</a-select-option>
+              <template slot="warehouseLocationSn" slot-scope="text, record, index">
+                <a-select id="bulkWarehousingOrderEdit-warehouseLocationSn" placeholder="请选择" v-model="record.warehouseLocationSn" style="width: 100%;">
+                  <a-select-option v-for="item in warehouseLocList[index]" :key="item.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
                 </a-select>
               </template>
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
                 <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="bulkWarehousingOrderEdit-add-btn">添加</a-button>
               </template>
-            </s-table>
+            </a-table>
           </div>
         </a-collapse-panel>
       </a-collapse>
@@ -151,55 +156,71 @@
               <div slot="message">总款数 <strong>{{ (productTotal&&productTotal.productTotalCategory) || 0 }}</strong> ,总数量 <strong>{{ (productTotal&&productTotal.productTotalQty) || 0 }}</strong> ,总成本¥<strong>{{ (productTotal&&productTotal.productTotalCost) || 0 }}</strong></div>
             </a-alert>
             <!-- 列表 -->
-            <s-table
+            <a-table
               class="sTable"
-              ref="table"
+              ref="chooseTable"
               size="small"
               :rowKey="(record) => record.id"
               :columns="chooseColumns"
-              :data="chooseLoadData"
+              :dataSource="chooseLoadData"
+              :scroll="{ x: 1880, y: 300 }"
+              :pagination="choosePaginationProps"
               bordered>
               <!-- 成本价 -->
-              <template slot="costPrice" slot-scope="text, record">
+              <template slot="putCost" slot-scope="text, record">
                 <a-input-number
-                  id="bulkWarehousingOrderEdit-costPrice"
-                  v-model="record.costPrice"
+                  id="bulkWarehousingOrderEdit-choose-putCost"
+                  v-model="record.putCost"
                   :precision="2"
                   :min="0"
                   :max="999999"
-                  placeholder="请输入" />
+                  placeholder="请输入"
+                  @blur="e => putCostChange(e.target.value, record)"
+                  style="width: 100%;" />
               </template>
               <!-- 数量 -->
-              <template slot="quantity" slot-scope="text, record">
+              <template slot="putQty" slot-scope="text, record">
                 <a-input-number
-                  id="bulkWarehousingOrderEdit-quantity"
-                  v-model="record.quantity"
+                  id="bulkWarehousingOrderEdit-choose-putQty"
+                  v-model="record.putQty"
                   :precision="0"
                   :min="0"
                   :max="999999"
-                  placeholder="请输入" />
+                  placeholder="请输入"
+                  @blur="e => putQtyChange(e.target.value, record)"
+                  style="width: 100%;" />
               </template>
               <!-- 仓库 -->
-              <template slot="warehouse" slot-scope="text, record">
-                <a-select id="bulkWarehousingOrderEdit-warehouse" placeholder="请选择" allowClear v-model="record.warehouse">
-                  <a-select-option v-for="item in warehouseList" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
+              <template slot="warehouseSn" slot-scope="text, record, index">
+                <a-select
+                  id="bulkWarehousingOrderEdit-choose-warehouseSn"
+                  placeholder="请选择"
+                  @change="chooseWarehouseChange(record, index)"
+                  v-model="record.warehouseSn"
+                  style="width: 100%;">
+                  <a-select-option v-for="item in chooseWarehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
                 </a-select>
               </template>
               <!-- 仓位 -->
-              <template slot="position" slot-scope="text, record">
-                <a-select id="bulkWarehousingOrderEdit-position" placeholder="请选择" allowClear v-model="record.position">
-                  <a-select-option v-for="item in customeList" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
+              <template slot="warehouseLocationSn" slot-scope="text, record, index">
+                <a-select id="bulkWarehousingOrderEdit-choose-warehouseLocationSn" placeholder="请选择" @change="chooseWarehouseLocChange(record)" v-model="record.warehouseLocationSn" style="width: 100%;">
+                  <a-select-option v-for="item in chooseWarehouseLocList[index]" :key="item.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
                 </a-select>
               </template>
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
-                <a-button size="small" type="primary" @click="handleDel(record)" id="bulkWarehousingOrderEdit-del-btn">删除</a-button>
+                <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="bulkWarehousingOrderEdit-del-btn">删除</a-button>
               </template>
-            </s-table>
+            </a-table>
           </div>
         </a-collapse-panel>
       </a-collapse>
     </a-card>
+    <a-affix :offset-bottom="0">
+      <div style="text-align: center;width: 100%;background-color: #fff;padding: 30px 0;box-shadow: 0 0 20px #dcdee2;">
+        <a-button type="primary" id="bulkWarehousingOrderEdit-submit" size="large" @click="handleSubmit" style="padding: 0 60px;">提交</a-button>
+      </div>
+    </a-affix>
     <!-- 选择基本信息弹框 -->
     <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
   </div>
@@ -208,77 +229,81 @@
 <script>
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
-import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount } from '@/api/sparePartsPur'
+import { getOperationalPrecision } from '@/libs/tools.js'
+import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
+import { dealerProductTypeList } from '@/api/dealerProductType'
+import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount, sparePartsPurDetailSave, sparePartsPurDetailDel, sparePartsPurSubmit } from '@/api/sparePartsPur'
 import { dealerProductList } from '@/api/dealerProduct'
-import { warehouseAllList } from '@/api/warehouse'
+import { warehouseAllList, warehouseLocAllList } from '@/api/warehouse'
 export default {
   components: { STable, VSelect, basicInfoModal },
   data () {
     return {
       queryParam: {
-        productBrandSn: undefined
-        // productBrandSn: undefined,
+        queryWord: '',
+        productBrandSn: undefined,
+        productTypeSn1: undefined,
+        productTypeSn2: undefined,
+        productTypeSn3: undefined
       },
-      brandData: [], //  产品品牌  下拉数据
-      typeData: [], //  产品类别  下拉数据
+      productBrandList: [], //  产品品牌  下拉数据
+      productTypeList: [], //  产品分类  下拉数据
+      productType: [],
       disabled: false, //  查询、重置按钮是否可操作
       // 表头
       columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '产品编码', dataIndex: 'code', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '原厂编码', dataIndex: 'origCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品品牌', dataIndex: 'productBrandName', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '成本价', scopedSlots: { customRender: 'costPrice' }, width: 150, align: 'center' },
-        { title: '数量', scopedSlots: { customRender: 'quantity' }, width: 150, align: 'center' },
-        { title: '仓库', scopedSlots: { customRender: 'warehouse' }, width: 200, align: 'center' },
-        { title: '仓位', scopedSlots: { customRender: 'position' }, width: 200, align: 'center' },
+        { title: '成本价', scopedSlots: { customRender: 'putCost' }, width: 150, align: 'center' },
+        { title: '数量', scopedSlots: { customRender: 'putQty' }, width: 150, align: 'center' },
+        { title: '仓库', scopedSlots: { customRender: 'warehouseSn' }, width: 200, align: 'center' },
+        { title: '仓位', scopedSlots: { customRender: 'warehouseLocationSn' }, width: 200, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        return dealerProductList(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
-          this.getWarehouseList()
-          console.log('--------数据', data)
-          return data
-        })
+      loadData: [],
+      pageNo: 1, //  分页页码
+      pageSize: 10, //  分页 每页多少条
+      paginationProps: {
+        showSizeChanger: true, //  是否可以改变 pageSize
+        total: 0, //  分页总条数
+        current: 1,
+        onShowSizeChange: (current, pageSize) => this.changePageSize(current, pageSize),
+        onChange: (current) => this.changePage(current)
       },
       // 表头
       chooseColumns: [
-        { title: '产品编码', dataIndex: 'creatDate', align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'custName', align: 'center' },
-        { title: '原厂编码', dataIndex: 'totalP', align: 'center' },
-        { title: '产品品牌', dataIndex: 'custsName', align: 'center', sorter: true },
-        { title: '单位', dataIndex: 'custsNdame', align: 'center' },
-        { title: '成本价', scopedSlots: { customRender: 'costPrice' }, align: 'center' },
-        { title: '数量', scopedSlots: { customRender: 'quantity' }, align: 'center' },
-        { title: '成本小计', dataIndex: 'custsNdsame', align: 'center' },
-        { title: '仓库', scopedSlots: { customRender: 'warehouse' }, align: 'center' },
-        { title: '仓位', scopedSlots: { customRender: 'position' }, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center', sorter: true },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品品牌', dataIndex: 'brandName', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '成本价', scopedSlots: { customRender: 'putCost' }, width: 150, align: 'center' },
+        { title: '数量', scopedSlots: { customRender: 'putQty' }, width: 150, align: 'center' },
+        { title: '成本小计', dataIndex: 'costSubtotal', width: 100, align: 'center' },
+        { title: '仓库', scopedSlots: { customRender: 'warehouseSn' }, width: 200, align: 'center' },
+        { title: '仓位', scopedSlots: { customRender: 'warehouseLocationSn' }, width: 200, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
-      // 加载数据方法 必须为 Promise 对象
-      chooseLoadData: parameter => {
-        this.disabled = true
-        return sparePartsPurDetailList(Object.assign(parameter, { sparePartsPurchaseSn: this.$route.params.sn })).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
-        })
+      chooseLoadData: [],
+      choosePageNo: 1, //  分页页码
+      choosePageSize: 10, //  分页 每页多少条
+      choosePaginationProps: {
+        showSizeChanger: true, //  是否可以改变 pageSize
+        total: 0, //  分页总条数
+        current: 1,
+        onShowSizeChange: (current, pageSize) => this.changeChoosePageSize(current, pageSize),
+        onChange: (current) => this.changeChoosePage(current)
       },
       openModal: false, // 选择基本信息弹框是否显示
       warehouseList: [], //  仓库  下拉数据
+      warehouseLocList: {}, //  仓位  下拉数据
+      chooseWarehouseList: [], //  已选产品 仓库  下拉数据
+      chooseWarehouseLocList: {}, //  已选产品 仓位  下拉数据
       basicInfoData: null, //  基本信息
       productTotal: null //  合计
     }
@@ -286,25 +311,47 @@ export default {
   methods: {
     //  重置
     resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
-      this.$refs.table.refresh(true)
+      this.queryParam.queryWord = ''
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.productType = []
+      this.getDealerProductList(1)
     },
     // 双击快速添加
     handleClickRow (record) {
       return {
         on: {
           dblclick: (event) => {
-            console.log(record)
+            this.handleAdd(record)
           }
         }
       }
     },
-    // 获取详情
+    //  分页  一页多少条change
+    changePageSize (current, pageSize) {
+      this.pageNo = current
+      this.pageSize = pageSize
+      this.getDealerProductList()
+    },
+    //  分页 页码change
+    changePage (current) {
+      this.pageNo = current
+      this.getDealerProductList()
+    },
+    //  已选产品 分页  一页多少条change
+    changeChoosePageSize (current, pageSize) {
+      this.choosePageNo = current
+      this.choosePageSize = pageSize
+      this.getChooseDealerProductList()
+    },
+    //  已选产品 分页 页码change
+    changeChoosePage (current) {
+      this.choosePageNo = current
+      this.getChooseDealerProductList()
+    },
+    // 基本信息
     getDetail () {
       sparePartsPurDetail({ id: this.$route.params.id }).then(res => {
         if (res.status == 200) {
@@ -314,18 +361,80 @@ export default {
         }
       })
     },
-    //  添加
-    handleAdd (row) {},
+    //  添加/编辑
+    handleAdd (row, isEdit) {
+      if (!row.putCost) {
+        this.$message.warning('请输入成本价')
+        return
+      }
+      if (!row.putQty) {
+        this.$message.warning('请输入数量')
+        return
+      }
+      if (!row.warehouseSn) {
+        this.$message.warning('请选择仓库')
+        return
+      }
+      if (!row.warehouseLocationSn) {
+        this.$message.warning('请选择仓位')
+        return
+      }
+      const params = {
+        id: isEdit ? row.id : undefined,
+        sparePartsPurchaseSn: this.$route.params.sn,
+        putCost: row.putCost,
+        putQty: row.putQty,
+        productCode: isEdit ? row.productCode : row.code,
+        productOrigCode: (isEdit ? row.productOrigCode : row.origCode) || undefined,
+        productSn: row.productSn,
+        productTypeSn1: row.productTypeSn1,
+        productTypeSn2: row.productTypeSn2,
+        productTypeSn3: row.productTypeSn3,
+        brandSn: isEdit ? row.brandSn : row.productBrandSn,
+        warehouseLocationSn: row.warehouseLocationSn,
+        warehouseSn: row.warehouseSn
+      }
+      sparePartsPurDetailSave(params).then(res => {
+        if (res.status == 200) {
+          this.getChooseDealerProductList()
+        }
+      })
+    },
+    //  提交
+    handleSubmit () {
+      const _this = this
+      sparePartsPurSubmit({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          setTimeout(() => {
+            _this.handleBack()
+          }, 1000)
+        }
+      })
+    },
     //  删除
-    handleDel (row) {},
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后不可恢复,确定要进行删除吗?',
+        centered: true,
+        onOk () {
+          sparePartsPurDetailDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.getChooseDealerProductList()
+            }
+          })
+        }
+      })
+    },
     //  编辑基本信息
     handleEditInfo () {
       this.openModal = true
     },
     //  基本信息  保存
-    handleOk () {
-
-    },
+    handleOk () {},
     //  导入明细
     handleImport () {
       console.log(333)
@@ -335,25 +444,201 @@ export default {
       this.$router.push({ path: '/bulkManagement/bulkWarehousingOrder/list' })
     },
     // 仓库下拉数据
-    getWarehouseList () {
+    getWarehouseList (type) {
       warehouseAllList({}).then(res => {
         if (res.status == 200) {
-          this.warehouseList = res.data
-          const defaultFlagInd = this.warehouseList.findIndex(item => item.defaultFlag == 1)
-          console.log(defaultFlagInd, this.loadData)
-          // this.loadData.map(item => {
-          //   item.warehouse = this.warehouseList[defaultFlagInd].warehouseSn
-          // })
+          if (type == 'dealerProduct') { //  全部产品
+            this.warehouseList = res.data
+            const defaultFlagInd = this.warehouseList.findIndex(item => item.defaultFlag == 1)
+            this.loadData.map((item, index) => {
+              // 全部产品中,仓库默认值为默认仓库,则仓位必然也为默认仓位,因此可批量设置默认仓位的值 all
+              // 解决更改后不实时渲染问题
+              this.$set(item, 'warehouseSn', this.warehouseList[defaultFlagInd].warehouseSn)
+              this.$set(item, 'nowWarehouseSn', this.warehouseList[defaultFlagInd].warehouseSn) // 所选仓库sn(为记录上一所选仓库sn)
+              // 每个仓库对应仓位应是独立的
+              this.getWarehouseLocList(this.warehouseList[defaultFlagInd].warehouseSn, index, type, 'all')
+            })
+          } else if (type == 'sparePartsPurDetail') { //  已选产品
+            this.chooseWarehouseList = res.data
+            this.chooseLoadData.map((item, index) => {
+              // 每个仓库对应仓位应是独立的
+              this.getWarehouseLocList(item.warehouseSn, index, type)
+            })
+          }
         } else {
           this.warehouseList = []
+          this.chooseWarehouseList = []
+          this.loadData.map(item => {
+            this.$set(item, 'warehouseSn', undefined)
+            this.$set(item, 'nowWarehouseSn', undefined)
+            this.$set(item, 'warehouseLocationSn', undefined)
+          })
+        }
+      })
+    },
+    // 仓位下拉数据
+    getWarehouseLocList (warehouseSn, ind, type, isAll, isChange) {
+      // warehouseSn仓库sn、ind当前数据下标、type为全部产品或已选产品、isAll为是否设置全部产品内全部仓位的值为默认仓位、isChange为仓库是否change
+      warehouseLocAllList({ warehouseSn: warehouseSn }).then(res => {
+        if (res.status == 200) {
+          //  处理 全部产品和已选产品以及是否有默认仓位下的不同情况
+          this.defaultLocationSet(ind, type, res.data, isAll, isChange)
+        } else {
+          this.$set(this.warehouseLocList, ind, [])
+          this.$set(this.chooseWarehouseLocList, ind, [])
+          this.loadData.map(item => {
+            this.$set(item, 'warehouseLocationSn', undefined)
+          })
+          this.chooseLoadData.map(item => {
+            this.$set(item, 'warehouseLocationSn', undefined)
+          })
         }
       })
     },
+    defaultLocationSet (ind, type, data, isAll, isChange) {
+      let warehouseLocList
+      let loadData
+      if (type == 'dealerProduct') { //  全部产品
+        warehouseLocList = this.warehouseLocList
+        loadData = this.loadData
+      } else if (type == 'sparePartsPurDetail') { //  已选产品
+        warehouseLocList = this.chooseWarehouseLocList
+        loadData = this.chooseLoadData
+      }
+      this.$set(warehouseLocList, ind, data)
+      const defaultFlagInd = warehouseLocList[ind].findIndex(item => item.defaultFlag == 1)
+      //  有默认仓位则默认选择默认仓位,无默认仓位则默认选择第一个仓位
+      if (defaultFlagInd > -1) { //  有默认仓位
+        if (isAll == 'all') { //  批量设置默认仓位的值为默认仓位
+          loadData.map(item => {
+            this.$set(item, 'warehouseLocationSn', warehouseLocList[ind][defaultFlagInd].warehouseLocationSn)
+          })
+        } else {
+          this.$set(loadData[ind], 'warehouseLocationSn', warehouseLocList[ind][defaultFlagInd].warehouseLocationSn)
+        }
+        loadData[ind].nowWarehouseSn = loadData[ind].warehouseSn
+      } else { //  无默认仓位
+        if (warehouseLocList[ind].length > 0) {
+          loadData[ind].warehouseLocationSn = warehouseLocList[ind][0].warehouseLocationSn
+          loadData[ind].nowWarehouseSn = loadData[ind].warehouseSn
+        } else {
+          this.$message.warning('当前仓库无仓位,请选择其他仓库')
+          loadData[ind].warehouseSn = loadData[ind].nowWarehouseSn
+          this.getWarehouseLocList(loadData[ind].warehouseSn, ind, type)
+        }
+      }
+      //  仓库更改时,应与仓位一齐变更
+      if (isChange == 'change' && type == 'sparePartsPurDetail' && warehouseLocList[ind].length > 0) { // 设置已选产品仓库变更时更新数据
+        this.handleAdd(loadData[ind], 'edit')
+      }
+    },
     // 合计
     getDetailCount () {
       sparePartsPurDetailCount({ sparePartsPurchaseSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.productTotal = res.data
+        } else {
+          this.productTotal = null
+        }
+      })
+    },
+    // 仓库change
+    warehouseChange (record, index) {
+      this.loadData[index].warehouseLocationSn = undefined
+      this.getWarehouseLocList(this.loadData[index].warehouseSn, index, 'dealerProduct')
+    },
+    // 已选产品 成本价  change
+    putCostChange (val, record) {
+      this.handleAdd(record, 'edit')
+    },
+    // 已选产品 数量  change
+    putQtyChange (val, record) {
+      this.handleAdd(record, 'edit')
+    },
+    // 已选产品 仓库  change
+    chooseWarehouseChange (record, index) {
+      this.chooseLoadData[index].warehouseLocationSn = undefined
+      //  仓库仓位为联动更改,因此应在设置仓位后再进行更改
+      this.getWarehouseLocList(this.chooseLoadData[index].warehouseSn, index, 'sparePartsPurDetail', undefined, 'change')
+    },
+    // 已选产品 仓位  change
+    chooseWarehouseLocChange (record) {
+      this.handleAdd(record, 'edit')
+    },
+    //  产品分类  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] : ''
+    },
+    // 产品列表数据
+    getDealerProductList (pageNo) {
+      this.disabled = true
+      this.pageNo = pageNo || this.pageNo
+      const params = Object.assign({ pageNo: this.pageNo, pageSize: this.pageSize }, this.queryParam)
+      dealerProductList(params).then(res => {
+        if (res.status == 200) {
+          const data = res.data
+          this.paginationProps.total = Number(res.data.count) || 0
+          this.paginationProps.current = this.pageNo
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.loadData = data.list
+          this.getWarehouseList('dealerProduct')
+          this.disabled = false
+        } else {
+          this.paginationProps.total = 0
+          this.paginationProps.current = 1
+          this.loadData = []
+        }
+      })
+    },
+    // 已选产品列表数据
+    getChooseDealerProductList () {
+      const params = {
+        pageNo: this.choosePageNo,
+        pageSize: this.choosePageSize,
+        sparePartsPurchaseSn: this.$route.params.sn
+      }
+      sparePartsPurDetailList(params).then(res => {
+        if (res.status == 200) {
+          const data = res.data
+          this.choosePaginationProps.total = Number(res.data.count) || 0
+          this.choosePaginationProps.current = this.pageNo
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+            // 成本小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
+            data.list[i].costSubtotal = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
+          }
+          this.chooseLoadData = data.list
+          this.getWarehouseList('sparePartsPurDetail')
+        } else {
+          this.choosePaginationProps.total = 0
+          this.choosePaginationProps.current = 1
+          this.chooseLoadData = []
+        }
+      })
+    },
+    //  产品品牌  列表
+    getProductBrand () {
+      dealerProductBrandQuery({ 'sysFlag': '0' }).then(res => {
+        if (res.status == 200) {
+          this.productBrandList = res.data
+        } else {
+          this.productBrandList = []
+        }
+      })
+    },
+    //  产品分类  列表
+    getProductType () {
+      dealerProductTypeList({ 'sysFlag': '0' }).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
         }
       })
     },
@@ -367,7 +652,11 @@ export default {
     next(vm => {
       vm.openModal = false
       vm.getDetail()
+      vm.getDealerProductList()
       vm.getDetailCount()
+      vm.getChooseDealerProductList()
+      vm.getProductBrand()
+      vm.getProductType()
     })
   }
 }

+ 35 - 23
src/views/bulkManagement/bulkWarehousingOrder/list.vue

@@ -98,9 +98,27 @@
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="primary" @click="handleEdit(record)" class="button-info" id="bulkWarehousingOrderList-edit-btn">编辑</a-button>
-        <a-button size="small" type="primary" @click="handleWarehouse(record)" class="button-warning" id="bulkWarehousingOrderList-warehouse-btn">入库</a-button>
-        <a-button size="small" type="primary" @click="handleDel(record)" class="button-error" id="bulkWarehousingOrderList-del-btn">删除</a-button>
+        <a-button
+          size="small"
+          type="primary"
+          v-if="record.state != 'FINISH'"
+          @click="handleEdit(record)"
+          class="button-info"
+          id="bulkWarehousingOrderList-edit-btn">编辑</a-button>
+        <a-button
+          size="small"
+          type="primary"
+          v-if="record.state == 'WAIT_PUT_WAREHOUSE'"
+          @click="handleWarehouse(record)"
+          class="button-warning"
+          id="bulkWarehousingOrderList-warehouse-btn">入库</a-button>
+        <a-button
+          size="small"
+          type="primary"
+          v-if="record.state != 'FINISH'"
+          @click="handleDel(record)"
+          class="button-error"
+          id="bulkWarehousingOrderList-del-btn">删除</a-button>
       </template>
     </s-table>
     <!-- 选择基本信息弹框 -->
@@ -112,7 +130,7 @@
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
-import { sparePartsPurList, sparePartsPurCount } from '@/api/sparePartsPur'
+import { sparePartsPurList, sparePartsPurCount, sparePartsPurDel, sparePartsPurPut } from '@/api/sparePartsPur'
 import { supplierAllList } from '@/api/supplier'
 export default {
   components: { STable, VSelect, basicInfoModal },
@@ -196,7 +214,7 @@ export default {
     },
     //  详情
     handleDetail (row) {
-      this.$router.push({ path: `/bulkManagement/bulkWarehousingOrder/detail/${row.id}` })
+      this.$router.push({ path: `/bulkManagement/bulkWarehousingOrder/detail/${row.id}/${row.sparePartsPurchaseSn}` })
     },
     //  入库
     handleWarehouse (row) {
@@ -206,15 +224,12 @@ export default {
         content: '确定是否入库?',
         centered: true,
         onOk () {
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   console.log(res, 'res1111')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          sparePartsPurPut({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },
@@ -226,15 +241,12 @@ export default {
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
         onOk () {
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   console.log(res, 'res1111')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          sparePartsPurDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },

+ 10 - 2
src/views/common/editInput.js

@@ -4,8 +4,8 @@ const EditableCell = {
         <div class="editable-cell-input-wrapper">
           <a-input-number 
           size="small" 
-          :min="0.1" 
-          :max="100000" 
+          :min="min" 
+          :max="max" 
           :value="value" 
           :precision="precision"
           :step="step"
@@ -29,6 +29,14 @@ const EditableCell = {
     step: {
       type: [Number],
       default: 1
+    },
+    min: {
+      type: [Number],
+      default: 0
+    },
+    max: {
+      type: [Number],
+      default: 999999
     }
   },
   data() {

+ 180 - 83
src/views/salesManagement/salesQuery/chooseCustomModal.vue

@@ -19,23 +19,25 @@
     >
       <a-row :gutter="15">
         <a-col :span="8">
-          <a-form-model-item label="客户名称" prop="customerName">
+          <a-form-model-item label="客户名称" prop="buyerSn">
             <a-auto-complete
-              id="chooseCustom-customerName"
+              id="chooseCustom-buyerSn"
               placeholder="请选择客户"
               allowClear
-              v-model="form.customerName"
+              v-model="form.buyerSn"
               :filter-option="filterOption"
               @select="custSelect"
               @change="custChange">
               <template slot="dataSource">
-                <a-select-option v-for="item in custAllList" :key="item.id" :title="item.id">{{ item.customerName }}</a-select-option>
+                <a-select-option v-for="item in custAllList" :key="item.customerSn" :title="item.id">{{ item.customerName }}</a-select-option>
               </template>
             </a-auto-complete>
           </a-form-model-item>
         </a-col>
-        <a-col :span="8">
-          <a-form-model-item>(未搜索到客户时为新增客户)</a-form-model-item>
+        <a-col :span="16">
+          <a-form-model-item><a-button type="dashed" icon="plus">
+            新增
+          </a-button>(未搜索到客户时点击新增按钮)</a-form-model-item>
         </a-col>
       </a-row>
       <a-row :gutter="15">
@@ -44,22 +46,22 @@
             <a-row :gutter="15">
               <!-- 客户地址 -->
               <a-col span="8">
-                <a-form-model-item prop="provinceSn">
-                  <a-select id="chooseCustom-provinceSn" @change="getCityList" v-model="form.provinceSn" placeholder="请选择省">
+                <a-form-model-item prop="shippingAddressProvinceSn">
+                  <a-select id="chooseCustom-provinceSn" @change="getCityList" v-model="form.shippingAddressProvinceSn" placeholder="请选择省">
                     <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </a-col>
               <a-col span="8">
-                <a-form-model-item prop="citySn">
-                  <a-select id="chooseCustom-citySn" @change="getAreaList" v-model="form.citySn" placeholder="请选择市">
+                <a-form-model-item prop="shippingAddressCitySn">
+                  <a-select id="chooseCustom-citySn" @change="getAreaList" v-model="form.shippingAddressCitySn" placeholder="请选择市">
                     <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </a-col>
               <a-col span="8">
-                <a-form-model-item prop="countySn">
-                  <a-select id="chooseCustom-countySn" @change="areaCharged" v-model="form.countySn" placeholder="请选择区/县">
+                <a-form-model-item prop="shippingAddressCountySn">
+                  <a-select id="chooseCustom-countySn" @change="areaCharged" v-model="form.shippingAddressCountySn" placeholder="请选择区/县">
                     <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
                   </a-select>
                 </a-form-model-item>
@@ -68,11 +70,11 @@
           </a-form-model-item>
         </a-col>
         <a-col :span="8">
-          <a-form-model-item label="详细地址" prop="customerAddr">
+          <a-form-model-item label="" prop="shippingAddress">
             <a-input
-              id="chooseCustom-customerAddr"
+              id="chooseCustom-shippingAddress"
               :maxLength="60"
-              v-model="form.customerAddr"
+              v-model="form.shippingAddress"
               placeholder="请输入详细地址(最多60个字符)"
               allowClear />
           </a-form-model-item>
@@ -80,21 +82,21 @@
       </a-row>
       <a-row :gutter="15">
         <a-col :span="8">
-          <a-form-model-item label="联系人" prop="contactName">
+          <a-form-model-item label="联系人" prop="consigneeName">
             <a-input
-              id="chooseCustom-contactName"
+              id="chooseCustom-consigneeName"
               :maxLength="30"
-              v-model="form.contactName"
+              v-model="form.consigneeName"
               placeholder="请输入联系人(最多30个字符)"
               allowClear />
           </a-form-model-item>
         </a-col>
         <a-col :span="8">
-          <a-form-model-item label="联系电话" prop="contactTel">
+          <a-form-model-item label="联系电话" prop="consigneeTel">
             <a-input
-              id="chooseCustom-contactTel"
+              id="chooseCustom-consigneeTel"
               :maxLength="30"
-              v-model="form.contactTel"
+              v-model="form.consigneeTel"
               placeholder="请输入联系电话(最多30个字符)"
               allowClear />
           </a-form-model-item>
@@ -122,33 +124,33 @@
             </a-row>
           </a-form-model-item>
         </a-col>
-        <a-col :span="8">
+        <!-- <a-col :span="8">
           <a-form-model-item label="支付方式" prop="payType">
             <v-select code="PAY_TYPE" id="chooseCustom-payType" v-model="form.payType" allowClear placeholder="请选择支付方式" />
           </a-form-model-item>
-        </a-col>
+        </a-col> -->
         <a-col :span="8">
-          <a-form-model-item label="收款方式" prop="payment">
-            <v-select code="SETTLE_STYLE_NAME" id="chooseCustom-payment" v-model="form.settleStyleSn" allowClear placeholder="请选择收款方式"></v-select>
+          <a-form-model-item label="收款方式" prop="settleStyle">
+            <v-select code="SETTLE_STYLE_NAME" id="chooseCustom-settleStyle" v-model="form.settleStyle" allowClear placeholder="请选择收款方式"></v-select>
           </a-form-model-item>
         </a-col>
-      </a-row>
-      <a-row :gutter="15">
         <a-col :span="8">
           <a-form-model-item label="配送方式" prop="dispatchType">
             <v-select code="DISPATCH_TYPE" id="chooseCustom-dispatchType" v-model="form.dispatchType" allowClear placeholder="请选择配送方式"></v-select>
           </a-form-model-item>
         </a-col>
+      </a-row>
+      <a-row :gutter="15">
         <a-col :span="8">
-          <a-form-model-item label="业务员" prop="tenantId">
-            <a-select id="chooseCustom-tenantId" v-model="form.tenantId" placeholder="请选择业务员">
-              <a-select-option v-for="item in tenantList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+          <a-form-model-item label="业务员" prop="salesManSn">
+            <a-select id="chooseCustom-salesManSn" @change="salesManChange" v-model="form.salesManSn" placeholder="请选择业务员">
+              <a-select-option v-for="item in userList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
             </a-select>
           </a-form-model-item>
         </a-col>
         <a-col :span="8">
-          <a-form-model-item label="铺货出库" prop="salesman">
-            <v-select code="FLAG" id="chooseCustom-salesman" v-model="form.salesman" allowClear placeholder="请选择"></v-select>
+          <a-form-model-item label="铺货出库" prop="distributionFlag">
+            <v-select code="FLAG" id="chooseCustom-distributionFlag" v-model="form.distributionFlag" allowClear placeholder="请选择"></v-select>
           </a-form-model-item>
         </a-col>
       </a-row>
@@ -178,7 +180,9 @@
 
 <script>
 import { getArea } from '@/api/data'
-import { custAllList, custFindById } from '@/api/customer'
+import { custAllList, custFindById, custSave, updateByCustomerSn } from '@/api/customer'
+import { salesSave } from '@/api/sales'
+import { getUserAllList } from '@/api/power-user'
 import { VSelect } from '@/components'
 export default {
   name: 'ChooseCustomModal',
@@ -195,106 +199,181 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
-        customerName: '', // 客户名称
-        contactTel: '', //  联系电话
-        contactName: '', //  联系人
-        provinceSn: undefined, //  省
-        provinceName: '',
-        citySn: undefined, // 市
-        cityName: '',
-        countySn: undefined, // 区
-        countyName: '',
-        customerAddr: '', //  详细地址
+        buyerName: '', // 客户名称
+        buyerSn: '', // 客户sn
+        consigneeTel: '', //  联系电话
+        consigneeName: '', //  联系人
+        shippingAddressProvinceSn: undefined, //  省
+        shippingAddressProvinceName: '',
+        shippingAddressCitySn: undefined, // 市
+        shippingAddressCityName: '',
+        shippingAddressCountySn: undefined, // 区
+        shippingAddressCountyName: '',
+        shippingAddress: '', //  详细地址
         fax: '', //  客户传真
         dispatchType: '', //  配送方式
         satelliteFlag: 0, //  是否卫星仓客户
         customerTypeSn: undefined, //  客户类型
         priceType: '', //  价格类型
-        payType: '', //  支付方式
-        settleStyleSn: '', //  收款方式
-        tenantId: undefined, //  业务员
+        // payType: '', //  支付方式
+        settleStyle: '', //  收款方式
+        salesManSn: undefined, //  业务员
+        salesManName: '',
+        distributionFlag: '0', // 铺货出库
+        salesTragetType: 'C',
         remarks: '' //  备注
       },
       rules: {
-        customerName: [
+        buyerSn: [
           { required: true, message: '请输入客户名称', trigger: ['change', 'blur'] }
         ],
-        contactTel: [
+        consigneeTel: [
           { required: true, message: '请输入联系电话', trigger: 'blur' }
         ],
-        provinceSn: [
+        shippingAddressProvinceSn: [
           { required: true, message: '请选择省', trigger: 'change' }
         ],
-        citySn: [
+        shippingAddressCitySn: [
           { required: true, message: '请选择市', trigger: 'change' }
         ],
-        countySn: [
+        shippingAddressCountySn: [
           { required: true, message: '请选择区/县', trigger: 'change' }
         ],
-        contactPhone: [
-          { required: true, message: '请输入联系电话', trigger: 'blur' }
+        shippingAddress: [
+          { required: true, message: '请输入详细地址', trigger: 'blur' }
         ],
         priceType: [
           { required: true, message: '请选择价格类型', trigger: 'change' }
         ],
-        payType: [
-          { required: true, message: '请选择支付方式', trigger: 'change' }
-        ],
-        settleStyleSn: [
+        // payType: [
+        //   { required: true, message: '请选择支付方式', trigger: 'change' }
+        // ],
+        settleStyle: [
           { required: true, message: '请选择收款方式', trigger: 'change' }
+        ],
+        distributionFlag: [
+          { required: true, message: '请选择是否铺货出库', trigger: 'change' }
         ]
+        // salesManSn: [
+        //   { required: true, message: '请选择业务员', trigger: 'change' }
+        // ]
       },
       custAllList: [], //  客户 下拉数据
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
       addrDistrictList: [], //  区下拉
-      tenantList: [], // 业务员 下拉
+      userList: [], // 业务员 下拉
       custId: undefined, // 客户id
-      isEdit: true //  是否可编辑
+      isEdit: true, //  是否可编辑
+      interId: null
     }
   },
   methods: {
+    // 业务员
+    salesManChange (id) {
+      this.form.salesManName = this.userList.find(item => item.id == id).name
+    },
     // 客户 select
-    custSelect (id) {
-      this.custId = id
+    custSelect (v) {
+      console.log(v, 'custSelect')
+      const cust = this.custAllList.find(item => item.customerSn == v)
+      this.custId = cust.id
+      this.form.buyerName = cust.customerName
       this.isEdit = false
       this.getDetail()
     },
     // 客户 change
     custChange (val) {
+      console.log(val, 'custChange')
+      this.$refs.ruleForm.resetFields()
       this.custId = undefined
       this.isEdit = true
     },
+    // 编辑客户信息
+    editCust (data) {
+      console.log(data)
+      if (data.shippingAddressProvinceSn) { this.getArea('city', data.shippingAddressProvinceSn) }
+      if (data.shippingAddressCitySn) { this.getArea('district', data.shippingAddressCitySn) }
+      this.form = Object.assign(this.form, data)
+      // this.interId = setInterval(() => {
+
+      // }, 100)
+    },
     //  获取详情
     getDetail () {
       custFindById({ id: this.custId }).then(res => {
-        if (res.status == 200) {
-          if (res.data.provinceSn) { this.getArea('city', res.data.provinceSn) }
-          if (res.data.citySn) { this.getArea('district', res.data.citySn) }
-          this.form = Object.assign(this.form, res.data)
+        const data = res.data
+        if (res.status == 200 && data) {
+          if (data.provinceSn) { this.getArea('city', data.provinceSn) }
+          if (data.citySn) { this.getArea('district', data.citySn) }
+          this.form = Object.assign(this.form, {
+            buyerName: data.customerName, // 客户名称
+            buyerSn: data.customerSn, // 客户sn
+            consigneeTel: data.contactTel, //  联系电话
+            consigneeName: data.contactName, //  联系人
+            shippingAddressProvinceSn: data.provinceSn, //  省
+            shippingAddressProvinceName: data.provinceName,
+            shippingAddressCitySn: data.citySn, // 市
+            shippingAddressCityName: data.cityName,
+            shippingAddressCountySn: data.countySn, // 区
+            shippingAddressCountyName: data.countyName,
+            shippingAddress: data.customerAddr, //  详细地址
+            fax: data.fax, //  客户传真
+            dispatchType: data.dispatchType, //  配送方式
+            satelliteFlag: data.satelliteFlag, //  是否卫星仓客户
+            customerTypeSn: data.customerTypeSn, //  客户类型
+            priceType: data.priceType, //  价格类型
+            settleStyle: data.settleStyleSn //  收款方式
+          })
         } else {
+          this.$message.error('获取客户信息失败')
           this.$refs.ruleForm.resetFields()
         }
+        this.$refs.ruleForm.clearValidate()
+      })
+    },
+    // 保存客户信息
+    handleSaveCust () {
+      updateByCustomerSn({
+        customerSn: this.form.buyerSn,
+        customerName: this.form.buyerName,
+        contactTel: this.form.consigneeTel, //  联系电话
+        contactName: this.form.consigneeName, //  联系人
+        provinceSn: this.form.shippingAddressProvinceSn, //  省
+        provinceName: this.form.shippingAddressProvinceName,
+        citySn: this.form.shippingAddressCitySn, // 市
+        cityName: this.form.shippingAddressCityName,
+        countySn: this.form.shippingAddressCountySn, // 区
+        countyName: this.form.shippingAddressCountyName,
+        customerAddr: this.form.shippingAddress, //  详细地址
+        dispatchType: this.form.dispatchType, //  配送方式
+        customerTypeSn: this.form.customerTypeSn, //  客户类型
+        priceType: this.form.priceType, //  价格类型
+        settleStyleSn: this.form.settleStyle //  收款方式
+      }).then(res => {
+        if (res.status != 200) {
+          this.$message.error(res.message)
+        }
       })
     },
     //  保存
     handleSubmit (e) {
       e.preventDefault()
       const _this = this
-      this.$emit('ok', { id: 1000, customName: '车领主常青二路店' })
-      this.cancel()
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          console.log('-------------提交信息', _this.form)
-          //     const form = values.form
-          //     form.desc = _this.form.desc
-          //     form.id = this.isEdit ? this.$route.params.id : null
-          //     console.log(form,'-----提交信息')
-          //     // goodsSave(form).then(res => {
-          //     //   if (res.status == 200) {
-          //     //     _this.$message.success(res.message)
-          //     //   }
-          //     // })
+          // 保存客户信息
+          _this.handleSaveCust()
+          // 新建或编辑销售单
+          const form = this.form
+          console.log(form, 'save data')
+          salesSave(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('ok', res.data)
+              _this.cancel()
+            }
+          })
         } else {
           console.log('error submit!!')
           return false
@@ -317,25 +396,42 @@ export default {
         }
       })
     },
+    // 获取业务员列表数据
+    getUserAllList () {
+      getUserAllList({}).then(res => {
+        if (res.status == 200) {
+          this.userList = res.data || []
+        } else {
+          this.userList = []
+        }
+      })
+    },
     // 获取城市列表
     getCityList (val) {
+      console.log(val, '-------------')
       this.addrCityList = []
       this.addrDistrictList = []
-      this.form.citySn = undefined
-      this.form.countySn = undefined
-      this.form.customerAddr = ''
+      this.form.shippingAddressCitySn = undefined
+      this.form.shippingAddressCityName = ''
+      this.form.shippingAddressCountySn = undefined
+      this.form.shippingAddressCountyName = ''
+      this.form.shippingAddress = ''
+      this.form.shippingAddressCountyName = this.addrProvinceList.find(item => item.id == val).name
       this.getArea('city', val)
     },
     // 获取区县列表
     getAreaList (val) {
       this.addrDistrictList = []
-      this.form.countySn = undefined
-      this.form.customerAddr = ''
+      this.form.shippingAddressCountySn = undefined
+      this.form.shippingAddressCountyName = ''
+      this.form.shippingAddress = ''
+      this.form.shippingAddressCityName = this.addrCityList.find(item => item.id == val).name
       this.getArea('district', val)
     },
     // 区县变更
     areaCharged (val) {
-      this.form.customerAddr = ''
+      this.form.shippingAddress = ''
+      this.form.shippingAddressCountyName = this.addrDistrictList.find(item => item.id == val).name
     },
     //  省/市/区
     getArea (type, sn) {
@@ -377,6 +473,7 @@ export default {
       if (newValue) {
         this.getArea('province')
         this.getCustAllList()
+        this.getUserAllList()
       }
     }
   }

+ 3 - 3
src/views/salesManagement/salesQuery/detail.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="salesDetail-wrap">
-    <a-page-header :ghost="false" @back="handleBack" class="salesDetail-cont">
+    <a-page-header :ghost="false" :backIcon="false" class="salesDetail-cont">
       <template slot="subTitle">
-        <a href="javascript:;" @click="handleBack">返回列表</a>
+        <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon>返回列表</a>
       </template>
       <template slot="extra">
         <span>打印字段:</span>
@@ -131,7 +131,7 @@ export default {
   methods: {
     //  返回
     handleBack () {
-      this.$router.push({ path: '/salesManagement/salesQuery/list' })
+      this.$router.push({ name: 'salesQueryList' })
     },
     //  详情
     getDetail () {

+ 136 - 70
src/views/salesManagement/salesQuery/edit.vue

@@ -1,10 +1,11 @@
 <template>
   <div class="salesEdit-wrap">
-    <a-page-header :ghost="false" @back="handleBack" >
+    <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
-        <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack">客户名称:车领主常青二路店</a>
-        <a-button id="salesEdit-edit-btn" size="small" @click="handleEdit" style="margin-left:50px" key="0">编辑</a-button>
+        <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        <span style="margin: 0 15px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
+        <a-button id="salesEdit-edit-btn" size="small" @click="handleEdit" style="margin-left:10px" key="0">编辑</a-button>
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
@@ -14,7 +15,7 @@
     </a-page-header>
     <a-card size="small" :bordered="false" class="salesEdit-cont">
       <!-- 查询配件列表 -->
-      <queryPart></queryPart>
+      <queryPart @add="insterProduct"></queryPart>
     </a-card>
     <a-card size="small" :bordered="false" class="salesEdit-cont">
       <!-- 总计 -->
@@ -26,10 +27,10 @@
         <a-col :span="18">
           <a-form-model layout="inline" :model="productForm" @submit="handleSearch">
             <a-form-model-item label="产品编码">
-              <a-input v-model="productForm.productNo" placeholder="输入产品编码" />
+              <a-input v-model="productForm.code" placeholder="输入产品编码" />
             </a-form-model-item>
             <a-form-model-item label="产品名称">
-              <a-input v-model="productForm.productName" placeholder="输入产品名称" />
+              <a-input v-model="productForm.name" placeholder="输入产品名称" />
             </a-form-model-item>
             <a-form-model-item>
               <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
@@ -40,7 +41,7 @@
         <a-col :span="6">
           <div style="float:right;overflow: hidden;">
             <a-button size="small" id="salesEdit-dru">导入明细</a-button>
-            <a-button size="small" type="primary" style="margin-left: 10px" id="salesEdit-del-all">整单删除</a-button>
+            <a-button size="small" type="primary" @click="delSalerDetailAll" style="margin-left: 10px" id="salesEdit-del-all">整单删除</a-button>
           </div>
         </a-col>
       </a-row>
@@ -52,32 +53,36 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
-        :scroll="{ x: 1560 }"
+        :scroll="{ x: 1560, y: 150 }"
         bordered>
         <!-- 售价 -->
         <template slot="price" slot-scope="text, record">
-          <a-input-number
+          <editable-cell
+            :text="record.price"
             id="salesEdit-price"
-            :value="record.price"
-            :precision="0"
-            :min="0"
             :max="999999"
-            placeholder="请输入" />
+            :min="0"
+            :precision="2"
+            @change="onCellChange(record.id, 'price', $event)" />
         </template>
         <!-- 销售数量 -->
         <template slot="salesNums" slot-scope="text, record">
-          <a-input-number
+          <editable-cell
+            :text="record.qty"
             id="salesEdit-salesNums"
-            :value="record.salesNums"
-            :precision="0"
-            :min="0"
             :max="999999"
-            placeholder="请输入" />
+            :min="1"
+            :precision="0"
+            @change="onCellChange(record.id, 'qty', $event)" />
+        </template>
+        <!-- 操作 -->
+        <template slot="action" slot-scope="text, record">
+          <a-button size="small" type="link" @click="handleDel(record)" id="productInfoList-Del">删除</a-button>
         </template>
       </s-table>
     </a-card>
     <!-- 选择客户弹框 -->
-    <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false" />
+    <choose-custom-modal ref="custModal" :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false" />
   </div>
 </template>
 
@@ -85,86 +90,89 @@
 import { STable, VSelect } from '@/components'
 import queryPart from './queryPart.vue'
 import chooseCustomModal from './chooseCustomModal.vue'
+import { salesDetail } from '@/api/sales'
+import EditableCell from '@/views/common/editInput.js'
+import { salesDetailList, salesDetailInsert, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll } from '@/api/salesDetail'
 export default {
   name: 'SalesDetail',
-  components: { STable, VSelect, queryPart, chooseCustomModal },
+  components: { STable, VSelect, queryPart, chooseCustomModal, EditableCell },
   data () {
     return {
+      orderId: null, // 销售单id
+      salesBillSn: null, // 销售单sn
       disabled: false, //  查询、重置按钮是否可操作
-      openModal: false,
+      openModal: false, // 客户弹框
+      detailData: null, // 订单基础数据
       dataSource: [],
       productForm: {
-        productNo: '',
-        productName: ''
+        code: '',
+        name: ''
       },
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'productNo', width: 140, align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'productName', align: 'center' },
-        { title: '原厂编码', dataIndex: 'ycNo', width: 140, align: 'center' },
-        { title: '品牌', dataIndex: 'productBrand', width: 100, align: 'center', sorter: true },
-        { title: '仓库', dataIndex: 'cangku', width: 100, align: 'center', sorter: true },
-        { title: '仓位', dataIndex: 'cangwei', width: 100, align: 'center' },
-        { title: '辅助单位', dataIndex: 'pzdw', width: 100, align: 'center' },
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 140, align: 'center', sorter: true },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center' },
+        { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 140, align: 'center' },
+        { title: '品牌', dataIndex: 'dealerProductEntity.productBrandName', width: 100, align: 'center', sorter: true },
+        { title: '仓库', dataIndex: 'warehouseEntity.name', width: 100, align: 'center', sorter: true },
+        { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: 100, align: 'center' },
         { title: '售价', scopedSlots: { customRender: 'price' }, width: 150, align: 'center' },
         { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: 150, align: 'center' },
-        { title: '单位', dataIndex: 'dw', width: 100, align: 'center' },
+        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center' },
         { title: '售价小计', dataIndex: 'xj', width: 100, align: 'center' },
-        { title: '折后小计', dataIndex: 'zhxj', width: 100, align: 'center' }
+        { title: '折后小计', dataIndex: 'zhxj', width: 100, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         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',
-                productNo: 'jgqp11111111111',
-                productName: '产品1',
-                ycNo: 'jgqp111123545',
-                productBrand: '箭冠品牌',
-                productType: '产品分类1',
-                price: 5.6,
-                salesNums: 12
-              }
-            ],
-            count: 10
-          }
+        return salesDetailList(Object.assign(parameter, this.productForm)).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
-          _this.dataSource = data.list
-          resolve(data)
+          this.disabled = false
+          this.dataSource = data.list
+          return data
         })
       }
     }
   },
   methods: {
-    onCellChange (key, dataIndex, value) {
-      console.log(key, dataIndex, value)
-      console.log(this.dataSource)
+    onCellChange (id, key, value) {
+      console.log(id, key, value)
       const dataSource = [...this.dataSource]
-      const target = dataSource.find(item => item.id === key)
-      if (target) {
-        target[dataIndex] = Number(value)
+      const row = dataSource.find(item => item.id === id)
+      if (row) {
+        row[key] = Number(value)
         this.dataSource = dataSource
       }
+      // 修改价格
+      if (key == 'price') {
+        salesDetailUpdatePrice({
+          salesBillSn: row.salesBillSn,
+          productSn: row.productSn,
+          price: row.price
+        }).then(res => {
+          if (res.status == 200) {
+            this.$refs.table.refresh(true)
+          }
+          this.$message.info(res.message)
+        })
+      }
+      if (key == 'qty') {
+        salesDetailUpdateQty({
+          id: row.id,
+          qty: row.qty
+        }).then(res => {
+          if (res.status == 200) {
+            this.$refs.table.refresh(true)
+          }
+          this.$message.info(res.message)
+        })
+      }
     },
     handleSearch () {
 
@@ -173,15 +181,73 @@ export default {
     chooseCustomOk (data) {
 
     },
+    // 编辑客户信息
     handleEdit () {
       this.openModal = true
+      this.$refs.custModal.editCust(this.detailData)
     },
     //  重置
-    resetSearchForm () {},
+    resetSearchForm () {
+      this.$refs.table.refresh()
+    },
     //  返回
     handleBack () {
       this.$router.push({ path: '/salesManagement/salesQuery/list' })
+    },
+    // 整单删除
+    delSalerDetailAll () {
+      salesDetailDelAll({ salesBillSn: this.detailData.salesBillSn }).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm()
+        }
+        this.$message.info(res.message)
+      })
+    },
+    // 删除产品
+    handleDel (row) {
+      salesDetailDel({ id: row.id }).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm()
+        }
+        this.$message.info(res.message)
+      })
+    },
+    // 添加产品
+    insterProduct (row) {
+      console.log(row)
+      salesDetailInsert({
+        productSn: row.productSn,
+        price: row.dealerProduct.cityPrice,
+        qty: row.salesNums,
+        salesBillSn: this.detailData.salesBillSn,
+        salesBillNo: this.detailData.salesBillNo,
+        warehouseSn: row.warehouseSn,
+        warehouseLocationSn: row.warehouseLocationSn,
+        stockSn: row.stockSn
+      }).then(res => {
+        console.log(res)
+        if (res.status == 200) {
+          this.resetSearchForm()
+        }
+      })
+    },
+    //  详情
+    getOrderDetail () {
+      salesDetail({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.detailData = res.data
+        } else {
+          this.detailData = null
+        }
+      })
     }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      // 获取销售单详情
+      vm.getOrderDetail()
+      vm.orderId = vm.$route.params.id
+    })
   }
 }
 </script>

+ 40 - 43
src/views/salesManagement/salesQuery/list.vue

@@ -46,7 +46,7 @@
                   v-model="queryParam.payType"
                   ref="payType"
                   id="salesManagementList-payType"
-                  code="PAYMENT_TYPE"
+                  code="PAY_TYPE"
                   placeholder="请选择支付方式"
                   allowClear></v-select>
               </a-form-item>
@@ -57,7 +57,7 @@
                   v-model="queryParam.settleStyle"
                   ref="settleStyle"
                   id="salesManagementList-settleStyle"
-                  code="PAYMENT_TYPE"
+                  code="SETTLE_STYLE_NAME"
                   placeholder="请选择收款方式"
                   allowClear></v-select>
               </a-form-item>
@@ -65,10 +65,10 @@
             <a-col :md="6" :sm="24">
               <a-form-item label="业务状态">
                 <v-select
-                  v-model="queryParam.auditStatus"
-                  ref="auditStatus"
-                  id="salesManagementList-auditStatus"
-                  code="PAYMENT_TYPE"
+                  v-model="queryParam.billStatus"
+                  ref="billStatus"
+                  id="salesManagementList-billStatus"
+                  code="BILL_STATUS"
                   placeholder="请选择业务状态"
                   allowClear></v-select>
               </a-form-item>
@@ -79,7 +79,7 @@
                   v-model="queryParam.financialStatus"
                   ref="financialStatus"
                   id="salesManagementList-financialStatus"
-                  code="PAYMENT_TYPE"
+                  code="FINANCIAL_STATUS"
                   placeholder="请选择财务状态"
                   allowClear></v-select>
               </a-form-item>
@@ -114,10 +114,10 @@
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
-      :scroll="{ x: 2040 }"
+      :scroll="{ x: 2040, y:300 }"
       bordered>
       <!-- 业务/审核状态 -->
-      <template slot="auditStatus" slot-scope="text, record">
+      <template slot="billStatus" slot-scope="text, record">
         <a-tag :color="record.state=='FINISH'?'green':'red'" >{{ record.state=='FINISH'? '待备货审核': '待单据审核' }}</a-tag>
       </template>
       <!-- 财务状态 -->
@@ -126,15 +126,11 @@
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="link" @click="handleEexamine(record)" id="salesManagementList-eexamine-btn">审核</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleSend(record)" id="salesManagementList-send-btn">出库</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleDetail(record)" id="salesManagementList-detail-btn">详情</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleEdit(record)" id="salesManagementList-edit-btn">编辑</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleDel(record)" id="salesManagementList-del-btn">删除</a-button>
+        <a-button size="small" type="primary" class="button-warning" @click="handleEexamine(record)" id="salesManagementList-eexamine-btn">审核</a-button>
+        <a-button size="small" type="primary" class="button-primary" @click="handleSend(record)" id="salesManagementList-send-btn">出库</a-button>
+        <a-button size="small" type="primary" class="button-success" @click="handleDetail(record)" id="salesManagementList-detail-btn">详情</a-button>
+        <a-button size="small" type="primary" class="button-info" @click="handleEdit(record)" id="salesManagementList-edit-btn">编辑</a-button>
+        <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="salesManagementList-del-btn">删除</a-button>
       </template>
     </s-table>
     <!-- 选择客户弹框 -->
@@ -147,7 +143,7 @@ import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import chooseCustomModal from './chooseCustomModal.vue'
 import { custAllList } from '@/api/customer'
-import { salesList, salesDel } from '@/api/sales'
+import { salesList, salesDel, salesWriteAudit, salesWriteStockOut } from '@/api/sales'
 export default {
   name: 'TableList',
   components: { STable, VSelect, chooseCustomModal },
@@ -166,7 +162,7 @@ export default {
         purchaseBillNo: '', //  采购单号
         payType: undefined, //  支付方式
         settleStyle: undefined, //  收款方式
-        auditStatus: undefined, //  业务状态
+        billStatus: undefined, //  业务状态
         financialStatus: undefined //  财务状态
       },
       // 表头
@@ -185,7 +181,7 @@ export default {
         { title: '急件', dataIndex: 'urgentFlag', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务状态', scopedSlots: { customRender: 'auditStatus' }, width: 110, align: 'center' },
         { title: '财务状态', scopedSlots: { customRender: 'financialStatus' }, width: 110, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 260, align: 'center', fixed: 'right' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 300, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -221,25 +217,26 @@ export default {
     },
     // 选择客户成功
     chooseCustomOk (data) {
-      this.$router.push({ path: '/salesManagement/salesQuery/add' })
+      this.$router.push({ name: 'salesAdd', params: { id: data.id } })
     },
     //  审核
     handleEexamine (row) {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确认要审核通过吗?',
+        content: '请点击下方按钮确认操作?',
         centered: true,
+        okText: '审核通过',
+        canselText: '审核不通过',
         onOk () {
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   console.log(res, 'res1111')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          salesWriteAudit({
+            id: row.id
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },
@@ -251,25 +248,25 @@ export default {
         content: '确认要出库吗?',
         centered: true,
         onOk () {
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   console.log(res, 'res1111')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          salesWriteStockOut({
+            id: row.id,
+            salesBillSn: row.salesBillSn
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },
     // 详情
     handleDetail (row) {
-      this.$router.push({ path: `/salesManagement/salesQuery/detail/${row.id}/${row.salesBillSn}` })
+      this.$router.push({ name: 'salesDetail', params: { id: row.id, sn: row.salesBillSn } })
     },
     // 编辑
     handleEdit (row) {
-      this.$router.push({ path: `/salesManagement/salesQuery/edit/${row.id}` })
+      this.$router.push({ name: 'salesEdit', params: { id: row.id } })
     },
     // 删除
     handleDel (row) {

+ 88 - 63
src/views/salesManagement/salesQuery/queryPart.vue

@@ -6,42 +6,50 @@
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
             <a-form-item label="产品编码">
-              <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品编码"/>
+              <a-input id="productInfoList-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="产品名称">
-              <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品名称"/>
+              <a-input id="productInfoList-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="原厂编码">
-              <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入原厂编码"/>
+              <a-input id="productInfoList-origCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
             </a-form-item>
           </a-col>
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
               <a-form-item label="车架号(VIN)">
-                <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入车架号(VIN)"/>
+                <a-input id="productInfoList-vinNo" v-model.trim="queryParam.vinNo" allowClear placeholder="请输入车架号(VIN)"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品品牌">
                 <a-select
                   placeholder="请选择产品品牌"
-                  id="productInfoList-state"
+                  id="productInfoList-productBrandSn"
                   allowClear
-                  v-model="queryParam.dataSourceNo"
+                  v-model="queryParam.brandSn"
                   :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-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
                 </a-select>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品类别">
-                <a-cascader :options="typeData" id="productInfoList-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
+                <a-cascader
+                  @change="changeProductType"
+                  change-on-select
+                  v-model="productType"
+                  :options="productTypeList"
+                  :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
+                  id="productInfoList-productType"
+                  placeholder="请选择产品分类"
+                  allowClear />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -51,7 +59,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="仓库">
-                <v-select code="CHECK_ENABLE_STATE" id="productInfoList-state" v-model="queryParam.state" allowClear placeholder="请选择仓库"></v-select>
+                <v-select code="CHECK_ENABLE_STATE" id="productInfoList-state" v-model="queryParam.warehouseSn" allowClear placeholder="请选择仓库"></v-select>
               </a-form-item>
             </a-col>
           </template>
@@ -80,22 +88,22 @@
       :columns="columns"
       :data="loadData"
       :customRow="handleClickRow"
-      :scroll="{ x: 1530 }"
+      :scroll="{ x: 1530, y: 150 }"
       bordered>
       <!-- 售价 -->
       <template slot="price" slot-scope="text, record">
         <a-input-number
           id="productInfoList-price"
-          :value="record.price"
+          :value="record.dealerProduct.cityPrice||0"
           :precision="0"
           :min="0"
           :max="999999"
           placeholder="请输入" />
       </template>
       <!-- 销售数量 -->
-      <template slot="salesNums" slot-scope="text, record">
+      <template slot="nums" slot-scope="text, record">
         <a-input-number
-          id="productInfoList-salesNums"
+          id="productInfoList-nums"
           :value="record.salesNums"
           :precision="0"
           :min="0"
@@ -115,7 +123,9 @@
 </template>
 
 <script>
-// import { customerBundleDelayList, customerBundleExportDelay } from '@/api/FinancialManagement'
+import { productBrandQuery } from '@/api/productBrand'
+import { productTypeQuery } from '@/api/productType'
+import { querySumByProductLocation } from '@/api/stock'
 import productSalesRecordModal from './productSalesRecordModal.vue'
 import { STable, VSelect } from '@/components'
 export default {
@@ -124,66 +134,53 @@ export default {
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
+      productType: [],
       queryParam: { //  查询条件
-        bundleName: '', //  供应商名称
-        state: undefined //  状态
+        productCode: '', //  产品编码
+        productName: '', //  产品名称
+        productOrigCode: '', //  原厂编码
+        sysFlag: '1',
+        brandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        warehouseSn: undefined //  仓库
       },
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false, // 导出loading
-      brandData: [], //  下拉数据
-      typeData: [], //  产品类别  下拉数据
+      productBrandList: [], //  下拉数据
+      productTypeList: [], //  产品类别  下拉数据
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'productNo', width: 140, align: 'center', sorter: true },
+        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', sorter: true },
         { title: '产品名称', dataIndex: 'productName', align: 'center' },
-        { title: '原厂编码', dataIndex: 'ycNo', width: 140, align: 'center' },
-        { title: '品牌', dataIndex: 'productBrand', width: 100, align: 'center', sorter: true },
-        { title: '仓库', dataIndex: 'cangku', width: 100, align: 'center', sorter: true },
-        { title: '仓位', dataIndex: 'cangwei', width: 100, align: 'center' },
-        { title: '辅助单位', dataIndex: 'pzdw', width: 100, align: 'center' },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center' },
+        { title: '品牌', dataIndex: 'brandName', width: 100, align: 'center', sorter: true },
+        { title: '仓库', dataIndex: 'warehouseSn', width: 100, align: 'center', sorter: true },
+        { title: '仓位', dataIndex: 'warehouseLocationSn', width: 100, align: 'center' },
         { title: '售价', scopedSlots: { customRender: 'price' }, width: 150, align: 'center' },
-        { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: 150, align: 'center' },
-        { title: '单位', dataIndex: 'dw', width: 100, align: 'center' },
+        { title: '销售数量', scopedSlots: { customRender: 'nums' }, width: 150, align: 'center' },
+        { title: '单位', dataIndex: 'unit', width: 100, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         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',
-                productNo: 'jgqp1111111111',
-                productName: '产品1',
-                ycNo: 'jgqp111123545',
-                productBrand: '箭冠品牌',
-                productType: '产品分类1',
-                price: 5.6,
-                salesNums: 12,
-                dw: '个'
-              }
-            ],
-            count: 10
-          }
+        return querySumByProductLocation(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
+            data.list[i].salesNums = 1
+          }
+          this.disabled = false
+          if (this.productBrandList.length == 0) {
+            this.getProductBrand()
           }
-          _this.disabled = false
-          resolve(data)
+          if (this.productTypeList.length == 0) {
+            this.getProductType()
+          }
+          return data
         })
       },
       openModal: false, //  查看客户详情  弹框
@@ -203,12 +200,14 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
+      this.queryParam.productName = ''
+      this.queryParam.productOrigCode = ''
+      this.queryParam.brandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.warehouseSn = undefined
+      this.productType = []
       this.$refs.table.refresh(true)
     },
     filterOption (input, option) {
@@ -229,6 +228,32 @@ export default {
     closeModal () {
       this.itemId = ''
       this.openModal = false
+    },
+    //  产品品牌  列表
+    getProductBrand () {
+      productBrandQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productBrandList = res.data
+        } else {
+          this.productBrandList = []
+        }
+      })
+    },
+    //  产品分类  列表
+    getProductType () {
+      productTypeQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
+        }
+      })
+    },
+    //  产品分类  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] : ''
     }
   }
 }

+ 1 - 1
src/views/salesManagement/urgentItemsOffset/list.vue

@@ -72,7 +72,7 @@
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
-      :scroll="{ x: 1280 }"
+      :scroll="{ x: 1280, y: 300 }"
       bordered>
       <!-- 状态 -->
       <template slot="status" slot-scope="text, record">