Browse Source

散件退货

chenrui 3 years ago
parent
commit
9d4047d975

+ 11 - 0
src/api/sparePartsPur.js

@@ -77,6 +77,17 @@ export const sparePartsPurDetailList = (params) => {
     method: 'post'
   })
 }
+//  散件采购(入库)详情列表  分页
+export const sparePartsPurDetailFinishList = (params) => {
+  const url = `/sparePartsPur/detail/queryFinishPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
 //  散件采购(入库) 详情列表 合计
 export const sparePartsPurDetailCount = (params) => {
   return axios({

+ 73 - 3
src/api/sparePartsRet.js

@@ -1,6 +1,6 @@
 import { axios } from '@/utils/request'
 
-//  散件退货列表  分页
+//  散件退货  列表  分页
 export const sparePartsRetList = (params) => {
   const url = `/sparePartsRet/queryPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
@@ -11,9 +11,17 @@ export const sparePartsRetList = (params) => {
     method: 'post'
   })
 }
-//  散件退货详情列表  分页
+//  散件退货  列表  保存
+export const sparePartsRetSave = (params) => {
+  return axios({
+    url: '/sparePartsRet/save',
+    data: params,
+    method: 'post'
+  })
+}
+//  散件退货  详情  列表  分页
 export const sparePartsRetDetailList = (params) => {
-  const url = `/sparePartsRet/queryDetailPage/${params.pageNo}/${params.pageSize}`
+  const url = `/sparePartsRet/detail/queryPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -22,3 +30,65 @@ export const sparePartsRetDetailList = (params) => {
     method: 'post'
   })
 }
+//  散件退货  详情  保存
+export const sparePartsRetDetailSave = (params) => {
+  return axios({
+    url: '/sparePartsRet/detail/save',
+    data: params,
+    method: 'post'
+  })
+}
+//  散件退货  详情  合计
+export const sparePartsRetDetailCount = (params) => {
+  return axios({
+    url: '/sparePartsRet/detail/queryPageCount',
+    data: params,
+    method: 'post'
+  })
+}
+//  散件退货  详情  产品(不抓单)  列表  分页
+export const stockDetailProductList = (params) => {
+  const url = `/stock/detail/findStockDetailPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  散件退货  详情  删除
+export const sparePartsRetDetailDel = (params) => {
+  const url = `/sparePartsRet/detail/delete/${params.id}`
+  delete params.id
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  散件退货  删除
+export const sparePartsRetDel = (params) => {
+  return axios({
+    url: `/sparePartsRet/delete/${params.id}`,
+    method: 'get'
+  })
+}
+//  散件退货  出库
+export const sparePartsRetOutStock = (params) => {
+  const url = `/sparePartsRet/outStock/${params.id}`
+  delete params.id
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  散件退货  详情  提交
+export const sparePartsRetSubmit = (params) => {
+  return axios({
+    url: '/sparePartsRet/submit',
+    data: params,
+    method: 'post'
+  })
+}

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

@@ -1275,65 +1275,65 @@ export const asyncRouterMap = [
                 }
               }
             ]
+          },
+          {
+            path: '/bulkManagement/bulkReturnGoods',
+            redirect: '/bulkManagement/bulkReturnGoods/list',
+            name: 'bulkReturnGoods',
+            component: RouteView,
+            meta: {
+              title: '散件退货',
+              icon: 'frown',
+              permission: 'M_bulkReturnGoodsList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'bulkReturnGoodsList',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkReturnGoods/list.vue'),
+                meta: {
+                  title: '散件退货列表',
+                  icon: 'frown',
+                  hidden: true,
+                  permission: 'M_bulkReturnGoodsList'
+                }
+              },
+              {
+                path: 'edit/:id/:sn',
+                name: 'bulkReturnGoodsEdit',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkReturnGoods/edit.vue'),
+                meta: {
+                  title: '编辑散件退货单(不抓单)',
+                  icon: 'frown',
+                  hidden: true,
+                  permission: 'B_bulkReturnGoodsEdit'
+                }
+              },
+              {
+                path: 'grabEdit/:id/:sn',
+                name: 'bulkReturnGoodsGrabEdit',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkReturnGoods/grabEdit.vue'),
+                meta: {
+                  title: '编辑散件退货单(抓单)',
+                  icon: 'frown',
+                  hidden: true,
+                  permission: 'B_bulkReturnGoodsEdit'
+                }
+              },
+              {
+                path: 'detail/:id/:sn',
+                name: 'bulkReturnGoodsDetail',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkReturnGoods/detail.vue'),
+                meta: {
+                  title: '散件退货单详情',
+                  icon: 'frown',
+                  hidden: true
+                  // permission: 'B_goodsManage_edit'
+                }
+              }
+            ]
           }
-          // {
-          //   path: '/bulkManagement/bulkReturnGoods',
-          //   redirect: '/bulkManagement/bulkReturnGoods/list',
-          //   name: 'bulkReturnGoods',
-          //   component: RouteView,
-          //   meta: {
-          //     title: '散件退货',
-          //     icon: 'frown'
-          //     // permission: 'M_goodsManage_list'
-          //   },
-          //   hideChildrenInMenu: true,
-          //   children: [
-          //     {
-          //       path: 'list',
-          //       name: 'bulkReturnGoodsList',
-          //       component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkReturnGoods/list.vue'),
-          //       meta: {
-          //         title: '散件退货列表',
-          //         icon: 'frown',
-          //         hidden: true
-          //         // permission: 'M_goodsManage_list'
-          //       }
-          //     },
-          //     {
-          //       path: 'add',
-          //       name: 'bulkReturnGoodsAdd',
-          //       component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkReturnGoods/edit.vue'),
-          //       meta: {
-          //         title: '新增散件退货单',
-          //         icon: 'frown',
-          //         hidden: true
-          //         // permission: 'B_goodsManage_edit'
-          //       }
-          //     },
-          //     {
-          //       path: 'edit/:id',
-          //       name: 'bulkReturnGoodsEdit',
-          //       component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkReturnGoods/edit.vue'),
-          //       meta: {
-          //         title: '编辑散件退货单',
-          //         icon: 'frown',
-          //         hidden: true
-          //         // permission: 'B_goodsManage_edit'
-          //       }
-          //     },
-          //     {
-          //       path: 'detail/:id',
-          //       name: 'bulkReturnGoodsDetail',
-          //       component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkReturnGoods/detail.vue'),
-          //       meta: {
-          //         title: '散件退货单详情',
-          //         icon: 'frown',
-          //         hidden: true
-          //         // permission: 'B_goodsManage_edit'
-          //       }
-          //     }
-          //   ]
-          // }
         ]
       },
       // 报表

+ 101 - 43
src/views/bulkManagement/bulkReturnGoods/basicInfoModal.vue

@@ -7,47 +7,56 @@
     title="新增散件退货单"
     v-model="isShow"
     @cancle="isShow = false"
-    width="80%">
-    <a-form-model
-      id="bulkReturnGoods-basicInfo-form"
-      ref="ruleForm"
-      :model="form"
-      :rules="rules"
-      :label-col="formItemLayout.labelCol"
-      :wrapper-col="formItemLayout.wrapperCol">
-      <a-form-model-item label="供应商" prop="name">
-        <a-select
-          v-model="form.name"
-          placeholder="请选择"
-          allowClear
-          :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>
-      </a-form-model-item>
-      <a-form-model-item label="是否抓单" prop="type">
-        <a-radio-group v-model="form.type">
-          <a-radio value="a">是</a-radio>
-          <a-radio value="b">否</a-radio>
-        </a-radio-group>
-      </a-form-model-item>
-      <a-form-model-item label="备注" prop="remarks">
-        <a-textarea id="bulkReturnGoods-basicInfo-remarks" :maxLength="120" v-model="form.remarks" placeholder="请输入备注(最多120个字符)" allowClear />
-      </a-form-model-item>
-    </a-form-model>
-    <div class="btn-cont">
-      <a-button type="primary" id="bulkReturnGoods-basicInfo-modal-save" @click="handleSave">保存</a-button>
-      <a-button id="bulkReturnGoods-basicInfo-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
-    </div>
+    :width="800">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-form-model
+        id="bulkReturnGoods-basicInfo-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol">
+        <a-form-model-item label="供应商" prop="supplierSn">
+          <a-select
+            placeholder="请输入名称查询,如果没有请点击 '+' 新增"
+            allowClear
+            v-model="form.supplierSn"
+            :showSearch="true"
+            option-filter-prop="children"
+            :filter-option="filterOption"
+            style="width: 80%;">
+            <a-select-option v-for="item in supplierList" :key="item.supplierSn" :value="item.supplierSn" :disabled="item.enabledFlag==0">{{ item.supplierName }}</a-select-option>
+          </a-select>
+          <a-button icon="plus" size="small" @click="openSupplierModal=true" id="bulkWarehousingOrder-basicInfo-add-btn" style="margin-left: 10px;"></a-button>
+        </a-form-model-item>
+        <a-form-model-item label="是否抓单" prop="isGrab">
+          <a-radio-group v-model="form.isGrab">
+            <a-radio value="1">是</a-radio>
+            <a-radio value="0">否</a-radio>
+          </a-radio-group>
+        </a-form-model-item>
+        <a-form-model-item label="备注" prop="remarks">
+          <a-textarea id="bulkReturnGoods-basicInfo-remarks" :maxLength="120" v-model="form.remarks" placeholder="请输入备注(最多120个字符)" allowClear />
+        </a-form-model-item>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button type="primary" id="bulkReturnGoods-basicInfo-modal-save" @click="handleSave">保存</a-button>
+        <a-button id="bulkReturnGoods-basicInfo-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
+      </div>
+    </a-spin>
+    <!-- 供应商 -->
+    <supplier-info-edit-modal :openModal="openSupplierModal" @close="closeSupplierModal" @ok="handleOk" :isState="false" />
   </a-modal>
 </template>
 
 <script>
 import { VSelect } from '@/components'
+import supplierInfoEditModal from '@/views/supplierManagement/supplierInfo/editModal.vue'
+import { supplierAllList } from '@/api/supplier'
+import { sparePartsRetSave } from '@/api/sparePartsRet'
 export default {
   name: 'BulkReturnGoodsBasicInfoModal',
-  components: { VSelect },
+  components: { VSelect, supplierInfoEditModal },
   props: {
     openModal: {
       //  弹框显示状态
@@ -57,30 +66,76 @@ export default {
   },
   data () {
     return {
+      spinning: false,
       isShow: this.openModal, //  是否打开弹框
       formItemLayout: {
-        labelCol: { span: 6 },
-        wrapperCol: { span: 16 }
+        labelCol: { span: 4 },
+        wrapperCol: { span: 18 }
       },
       form: {
-        type: 'a',
-        name: undefined, // 仓库名称
-        sort: '' //  排序
+        supplierSn: undefined,
+        isGrab: '1',
+        remarks: ''
       },
       rules: {
-        name: [{ required: true, message: '请选择调出产品类型', trigger: 'change' }]
+        supplierSn: [ { required: true, message: '请选择供应商', trigger: 'change' } ],
+        isGrab: [ { required: true, message: '请选择是否抓单', trigger: 'change' } ]
       },
-      brandData: [] //  供应商  下拉数据
+      supplierList: [], //  供应商  下拉数据
+      openSupplierModal: false //  供应商 弹框
     }
   },
   methods: {
     //  保存
     handleSave () {
-      this.isShow = false
-      this.$emit('ok')
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const form = JSON.parse(JSON.stringify(_this.form))
+          _this.spinning = true
+          sparePartsRetSave(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              setTimeout(() => {
+                _this.isShow = false
+                _this.$emit('ok', res.data)
+                _this.spinning = false
+              }, 1000)
+            } else {
+              _this.spinning = false
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
     },
     filterOption (input, option) {
       return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+    },
+    // 新增供应商 成功
+    handleOk () {
+      //  获取供应商数据列表,并赋值
+      this.getSupplierList('val')
+    },
+    // 关闭供应商弹框
+    closeSupplierModal () {
+      this.openSupplierModal = false
+    },
+    // 供应商下拉数据
+    getSupplierList (val) {
+      supplierAllList().then(res => {
+        if (res.status == 200) {
+          this.supplierList = res.data
+          if (val) { //  需将新增加的供应商回填,即不需要用户再选一下
+            this.form.supplierSn = this.supplierList[0].supplierSn
+            this.$refs.ruleForm.clearValidate('supplierSn')
+          }
+        } else {
+          this.supplierList = []
+        }
+      })
     }
   },
   watch: {
@@ -92,6 +147,9 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
+        this.$refs.ruleForm.resetFields()
+      } else {
+        this.getSupplierList()
       }
     }
   }

+ 349 - 247
src/views/bulkManagement/bulkReturnGoods/edit.vue

@@ -1,301 +1,413 @@
 <template>
   <div class="bulkReturnGoodsEdit-wrap">
-    <a-page-header :ghost="false" @back="handleBack" >
-      <!-- 自定义的二级文字标题 -->
-      <template slot="subTitle">
-        <a id="bulkReturnGoodsEdit-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
-      </template>
-      <!-- 操作区,位于 title 行的行尾 -->
-      <!-- <template slot="extra">
-        <a-button key="2" id="bulkReturnGoodsEdit-preview-btn">打印预览</a-button>
-        <a-button key="1" type="primary" id="bulkReturnGoodsEdit-print-btn">快速打印</a-button>
-      </template> -->
-    </a-page-header>
-    <!-- 内容 -->
-    <a-page-header title="单号:CG2021010100001" ></a-page-header>
-    <!-- 基础信息 -->
-    <a-card size="small" :bordered="false" class="bulkReturnGoodsEdit-cont">
-      <a-collapse :activeKey="['1']">
-        <a-collapse-panel key="1">
-          <template slot="header">
-            基础信息
-            <a-button
-              type="primary"
-              shape="circle"
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-page-header :ghost="false" :backIcon="false" class="bulkReturnGoodsEdit-cont">
+        <!-- 自定义的二级文字标题 -->
+        <template slot="subTitle">
+          <a id="bulkReturnGoodsEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        </template>
+      </a-page-header>
+      <!-- 选择产品 -->
+      <a-card size="small" :bordered="false" class="bulkReturnGoodsEdit-cont">
+        <!-- 搜索条件 -->
+        <div class="table-page-search-wrapper">
+          <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品编码" prop="productCode">
+                  <a-input id="bulkReturnGoodsEdit-productCode" v-model="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品名称" prop="productName">
+                  <a-input id="bulkReturnGoodsEdit-productName" v-model="queryParam.productName" placeholder="请输入产品名称" allowClear />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="仓库">
+                  <a-select
+                    placeholder="请选择仓库"
+                    id="bulkReturnGoodsEdit-warehouseSn"
+                    allowClear
+                    v-model="queryParam.warehouseSn"
+                    :showSearch="true"
+                    option-filter-prop="children"
+                    :filter-option="filterOption">
+                    <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkReturnGoodsEdit-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="bulkReturnGoodsEdit-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :customRow="handleClickRow"
+          :data="loadData"
+          :scroll="{ x: 980, y:300 }"
+          bordered>
+          <!-- 退货单价 -->
+          <template slot="purchaseCost" slot-scope="text, record">
+            <a-input-number
               size="small"
-              icon="edit"
-              class="edit-circle-btn"
-              id="bulkReturnGoodsEdit-edit-circle-btn"
-              @click.stop="handleEditInfo" />
+              id="bulkReturnGoodsEdit-purchaseCost"
+              v-model="record.purchaseCost"
+              :precision="2"
+              :min="0"
+              :max="999999"
+              placeholder="请输入"
+              style="width: 100%;" />
           </template>
-          <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>
-        </a-collapse-panel>
-      </a-collapse>
-    </a-card>
-    <!-- 选择产品 -->
-    <a-card size="small" :bordered="false" class="bulkReturnGoodsEdit-cont">
-      <a-collapse :activeKey="['1']">
-        <a-collapse-panel key="1">
-          <template slot="header">
-            选择产品<span class="sub-title">以下是该供应商的所有散件入库产品,请选择本次需要退货的产品</span>
+          <!-- 退货数量 -->
+          <template slot="purchaseQty" slot-scope="text, record">
+            <a-input-number
+              size="small"
+              id="bulkReturnGoodsEdit-purchaseQty"
+              v-model="record.purchaseQty"
+              :precision="0"
+              :min="1"
+              :max="record.currentQty"
+              placeholder="请输入"
+              style="width: 100%;" />
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="bulkReturnGoodsEdit-add-btn">添加</a-button>
           </template>
-          <!-- 选择产品 -->
-          <div>
-            <!-- 搜索条件 -->
+        </s-table>
+      </a-card>
+      <!-- 已选产品 -->
+      <a-card size="small" :bordered="false" class="bulkReturnGoodsEdit-cont">
+        <!-- 总计 -->
+        <a-alert type="info" style="margin-bottom:10px">
+          <div slot="message">
+            总款数<strong>{{ (productTotal&&(productTotal.purchaseSize || productTotal.purchaseSize==0)) ? productTotal.purchaseSize : '--' }}</strong> ,
+            总数量<strong>{{ (productTotal&&(productTotal.purchaseQty || productTotal.purchaseQty==0)) ? productTotal.purchaseQty : '--' }}</strong> ,
+            总金额<strong>{{ (productTotal&&(productTotal.purchaseCost || productTotal.purchaseCost==0)) ? '¥'+productTotal.purchaseCost : '--' }}</strong>
+          </div>
+        </a-alert>
+        <!-- 筛选条件 -->
+        <a-row :gutter="15" justify="space-between">
+          <a-col :span="17">
             <div class="table-page-search-wrapper">
-              <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+              <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
                 <a-row :gutter="15">
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="关键词">
-                      <a-input id="bulkReturnGoodsEdit-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="产品名称/产品编码/原厂编码"/>
+                  <a-col :md="9" :sm="24">
+                    <a-form-item label="产品编码" prop="productCode">
+                      <a-input id="bulkReturnGoodsEdit-productCode" v-model="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
                     </a-form-item>
                   </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="散件单号">
-                      <a-input id="bulkReturnGoodsEdit-sparePartsReturnNo" v-model.trim="queryParam.sparePartsReturnNo" allowClear placeholder="请输入散件退货单号"/>
+                  <a-col :md="9" :sm="24">
+                    <a-form-item label="产品名称" prop="productName">
+                      <a-input id="bulkReturnGoodsEdit-productName" v-model="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
                     </a-form-item>
                   </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="散件单审核时间">
-                      <a-range-picker
-                        style="width:100%"
-                        id="bulkReturnGoodsEdit-creatTime"
-                        :disabledDate="disabledDate"
-                        v-model="time"
-                        :format="dateFormat"
-                        :placeholder="['开始时间', '结束时间']" />
-                    </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="bulkReturnGoodsEdit-refresh">查询</a-button>
-                    <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="bulkReturnGoodsEdit-reset">重置</a-button>
+                  <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                    <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="bulkReturnGoodsEdit-refresh">查询</a-button>
+                    <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="bulkReturnGoodsEdit-reset">重置</a-button>
                   </a-col>
                 </a-row>
               </a-form>
             </div>
-            <!-- 列表 -->
-            <s-table
-              class="sTable"
-              ref="table"
+          </a-col>
+          <a-col :span="7" style="text-align: right;"></a-col>
+        </a-row>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="chooseTable"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="chooseColumns"
+          :data="chooseLoadData"
+          :scroll="{ x: 980, y:300 }"
+          bordered>
+          <!-- 退货单价 -->
+          <template slot="purchaseCost" slot-scope="text, record">
+            <a-input-number
               size="small"
-              :rowKey="(record) => record.id"
-              :columns="columns"
-              :data="loadData"
-              bordered>
-              <!-- 采购数量 -->
-              <template slot="storageQuantity" slot-scope="text, record">
-                <a-input-number
-                  id="bulkReturnGoodsEdit-storageQuantity"
-                  :value="record.storageQuantity"
-                  :precision="0"
-                  :min="0"
-                  :max="999999"
-                  placeholder="请输入" />
-              </template>
-              <!-- 操作 -->
-              <template slot="action" slot-scope="text, record">
-                <a-button size="small" type="primary" @click="handleAdd(record)" id="bulkReturnGoodsEdit-add-btn">添加</a-button>
-              </template>
-            </s-table>
-          </div>
-        </a-collapse-panel>
-      </a-collapse>
-    </a-card>
-    <!-- 已选产品 -->
-    <a-card size="small" :bordered="false" class="bulkReturnGoodsEdit-cont">
-      <a-collapse :activeKey="['1']">
-        <a-collapse-panel key="1">
-          <template slot="header">
-            已选产品
-            <!-- <a-button size="small" class="import-btn" id="bulkReturnGoodsEdit-import-btn" @click.stop="handleImport">导入明细</a-button> -->
+              id="bulkReturnGoodsEdit-purchaseCost"
+              v-model="record.purchaseCost"
+              :precision="2"
+              :min="0"
+              :max="999999"
+              placeholder="请输入"
+              @blur="e => purchaseCostBlur(e.target.value, record)"
+              style="width: 100%;" />
           </template>
-          <!-- 已选产品 -->
-          <div>
-            <!-- 总计 -->
-            <a-alert type="info" style="margin-bottom:10px">
-              <div slot="message">产品款数 <strong>6</strong> ,退货数量合计 <strong>6</strong> ,退货金额合计¥<strong>6.33</strong></div>
-            </a-alert>
-            <!-- 列表 -->
-            <s-table
-              class="sTable"
-              ref="table"
+          <!-- 退货数量 -->
+          <template slot="purchaseQty" slot-scope="text, record">
+            <a-input-number
               size="small"
-              :rowKey="(record) => record.id"
-              :columns="chooseColumns"
-              :data="chooseLoadData"
-              bordered>
-              <!-- 采购数量 -->
-              <template slot="storageQuantity" slot-scope="text, record">
-                <a-input-number
-                  id="bulkReturnGoodsEdit-storageQuantity"
-                  :value="record.storageQuantity"
-                  :precision="0"
-                  :min="0"
-                  :max="999999"
-                  placeholder="请输入" />
-              </template>
-              <!-- 操作 -->
-              <template slot="action" slot-scope="text, record">
-                <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="bulkReturnGoodsEdit-del-btn">删除</a-button>
-              </template>
-            </s-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: 12px 0;box-shadow: 0 0 20px #dcdee2;">
-        <a-button type="primary" id="bulkReturnGoodsEdit-submit-btn" size="large" class="button-primary" @click="handleSubmit" style="padding: 0 60px;">提交</a-button>
-      </div>
-    </a-affix>
-    <!-- 选择基本信息弹框 -->
-    <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+              id="bulkReturnGoodsEdit-purchaseQty"
+              v-model="record.purchaseQty"
+              :precision="0"
+              :min="1"
+              :max="999999"
+              placeholder="请输入"
+              @blur="e => purchaseQtyBlur(e.target.value, record)"
+              style="width: 100%;" />
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="bulkReturnGoodsEdit-del-btn">删除</a-button>
+          </template>
+        </s-table>
+      </a-card>
+    </a-spin>
+    <div class="affix-cont">
+      <a-button
+        type="primary"
+        id="bulkReturnGoodsEdit-submit-btn"
+        size="large"
+        :disabled="spinning"
+        class="button-primary"
+        @click="handleSubmit"
+        style="padding: 0 60px;">提交</a-button>
+    </div>
   </div>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
-import basicInfoModal from './basicInfoModal.vue'
+import { warehouseAllList } from '@/api/warehouse'
+import { sparePartsRetDetailList, stockDetailProductList, sparePartsRetDetailSave, sparePartsRetDetailCount, sparePartsRetDetailDel, sparePartsRetSubmit } from '@/api/sparePartsRet'
 export default {
-  components: { STable, VSelect, basicInfoModal },
+  components: { STable, VSelect },
   data () {
     return {
+      spinning: false,
       queryParam: {
-
+        productCode: '',
+        productName: '',
+        warehouseSn: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
-      dateFormat: 'YYYY-MM-DD',
-      time: [], //  散件单审核时间
       // 表头
       columns: [
-        { title: '散件单号', dataIndex: 'creatDate', align: 'center' },
-        { title: '散件单审核时间', dataIndex: 'custName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'custsName', align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'totalP', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '单位', scopedSlots: { customRender: 'outOfStockNum' }, align: 'center' },
-        { title: '成本价', dataIndex: 'totalNums', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '入库数量', dataIndex: 'totsalP', align: 'center' },
-        { title: '已退数量', dataIndex: 'totaslP', align: 'center' },
-        { title: '可退数量', dataIndex: 'tostalP', align: 'center' },
-        { title: '库存数量', dataIndex: 'todtalP', align: 'center' },
-        { title: '退货数量', scopedSlots: { customRender: 'storageQuantity' }, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
+        { title: '产品编码', dataIndex: 'productCode', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '库存数量', dataIndex: 'currentQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', scopedSlots: { customRender: 'purchaseCost' }, width: 100, align: 'center' },
+        { title: '退货数量', scopedSlots: { customRender: 'purchaseQty' }, width: 100, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, 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', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
-            ],
-            count: 10
-          }
+        return stockDetailProductList(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
         })
       },
+      chooseDisabled: false,
+      chooseQueryParam: {
+        productCode: '',
+        productName: ''
+      },
       // 表头
       chooseColumns: [
-        { title: '产品编码', dataIndex: 'creatDaite', align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'custNayme', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '单位', dataIndex: 'custsNakme', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '成本价', dataIndex: 'mementPay', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货数量', scopedSlots: { customRender: 'storageQuantity' }, align: 'center' },
-        { title: '退货金额', dataIndex: 'custssNakme', align: 'center', customRender: function (text) { return ((text || text == 0) ? '¥' + text : '--') } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
+        { title: '产品编码', dataIndex: 'productCode', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', scopedSlots: { customRender: 'purchaseCost' }, width: 100, align: 'center' },
+        { title: '退货数量', scopedSlots: { customRender: 'purchaseQty' }, width: 100, align: 'center' },
+        { title: '退货金额', dataIndex: 'purchaseAmount', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: 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', custssName: 0, creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
-            ],
-            count: 10
-          }
+        this.chooseDisabled = true
+        const params = Object.assign(parameter, this.chooseQueryParam, { sparePartsReturnSn: this.$route.params.sn })
+        return sparePartsRetDetailList(params).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].purchaseCostBackups = data.list[i].purchaseCost
+            data.list[i].purchaseQtyBackups = data.list[i].purchaseQty
           }
-          _this.disabled = false
-          resolve(data)
+          this.localDataSource = data.list || []
+          this.chooseDisabled = false
+          this.getDetailCount(params)
+          return data
         })
       },
-      openModal: false // 选择基本信息弹框是否显示
+      localDataSource: [],
+      productTotal: null, //  合计
+      warehouseList: [] // 仓库列表
     }
   },
   methods: {
-    // 不可选日期
-    disabledDate (date, dateStrings) {
-      return date && date.valueOf() > Date.now()
+    // 合计
+    getDetailCount (params) {
+      sparePartsRetDetailCount(params).then(res => {
+        if (res.status == 200) {
+          this.productTotal = res.data
+        } else {
+          this.productTotal = null
+        }
+      })
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
+      this.queryParam.productCode = ''
+      this.queryParam.productName = ''
+      this.queryParam.warehouseSn = undefined
       this.$refs.table.refresh(true)
     },
-    //  添加
-    handleAdd (row) {},
+    // 已选产品  重置
+    chooseResetSearchForm () {
+      this.chooseQueryParam.productCode = ''
+      this.chooseQueryParam.productName = ''
+      this.$refs.chooseTable.refresh(true)
+    },
+    //  添加/编辑
+    handleAdd (row, isEdit) {
+      if (!isEdit && !row.purchaseCost) {
+        this.$message.warning('请输入退货单价后再添加!')
+        return
+      }
+      if (!isEdit && !row.purchaseQty) {
+        this.$message.warning('请输入退货数量后再添加!')
+        return
+      }
+      const params = {
+        id: isEdit ? row.id : undefined,
+        sparePartsReturnSn: this.$route.params.sn,
+        purchaseCost: row.purchaseCost,
+        purchaseQty: row.purchaseQty,
+        productSn: row.productSn,
+        productCode: row.productCode,
+        productOrigCode: row.productOrigCode,
+        productTypeSn1: row.productTypeSn1,
+        productTypeSn2: row.productTypeSn2,
+        productTypeSn3: row.productTypeSn3,
+        brandSn: row.brandSn,
+        warehouseLocationSn: row.warehouseLocationSn,
+        warehouseSn: row.warehouseSn,
+        productExpiryDate: row.productExpiryDate
+      }
+      if (isEdit) { // 编辑
+        // 清空成本价或数量时,值应保持未清空前的值,因成本价和数量都不可为空
+        if (!row.purchaseCost) {
+          row.purchaseCost = row.purchaseCostBackups
+          return
+        }
+        if (!row.purchaseQty) {
+          row.purchaseQty = row.purchaseQtyBackups
+          return
+        }
+      }
+      this.spinning = true
+      sparePartsRetDetailSave(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$refs.table.refresh()
+          this.$refs.chooseTable.refresh()
+          this.spinning = false
+        } else {
+          this.spinning = false
+        }
+      })
+    },
     //  删除
-    handleDel (row) {},
-    //  编辑基本信息
-    handleEditInfo () {
-      this.openModal = true
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后不可恢复,确定要进行删除吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          sparePartsRetDetailDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.$refs.chooseTable.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
     },
     //  提交
     handleSubmit () {
-
+      const _this = this
+      if (this.localDataSource.length < 1) {
+        this.$message.info('退货单中不存在任何产品,无法提交')
+        return
+      }
+      _this.spinning = true
+      sparePartsRetSubmit({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          setTimeout(() => {
+            _this.handleBack()
+            _this.spinning = false
+          }, 1000)
+        } else {
+          _this.spinning = false
+        }
+      })
     },
-    //  基本信息  保存
-    handleOk () {
-
+    // 已选产品 单价  blur
+    purchaseCostBlur (val, record) {
+      //  光标移出,值发生改变再调用编辑接口
+      if (val != record.purchaseCostBackups) {
+        this.handleAdd(record, 'edit')
+      }
+    },
+    // 已选产品 数量  blur
+    purchaseQtyBlur (val, record) {
+      if (val != record.purchaseQtyBackups) {
+        this.handleAdd(record, 'edit')
+      }
     },
     //  返回列表
     handleBack () {
       this.$router.push({ path: '/bulkManagement/bulkReturnGoods/list', query: { closeLastOldTab: true } })
     },
-    //  导入明细
-    handleImport () {
-      console.log(333)
+    // 双击快速添加
+    handleClickRow (record) {
+      return {
+        on: {
+          dblclick: (event) => {
+            this.handleAdd(record)
+          }
+        }
+      }
+    },
+    // 仓库
+    getWarehouse () {
+      warehouseAllList({}).then(res => {
+        if (res.status == 200) {
+          this.warehouseList = res.data
+        } else {
+          this.warehouseList = []
+        }
+      })
     },
     filterOption (input, option) {
       return (
@@ -305,7 +417,7 @@ export default {
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
-      vm.openModal = false
+      vm.getWarehouse()
     })
   }
 }
@@ -313,26 +425,16 @@ export default {
 
 <style lang="less">
   .bulkReturnGoodsEdit-wrap{
+    position: relative;
+    height: 100%;
+    padding-bottom: 51px;
+    box-sizing: border-box;
+    >.ant-spin-nested-loading{
+      overflow-y: scroll;
+      height: 100%;
+    }
     .bulkReturnGoodsEdit-cont{
       margin-bottom: 10px;
-      .sub-title{
-        font-size: 12px;
-        color: #808695;
-        margin-left: 10px;
-      }
-      .tag-txt{
-        font-size: 12px;
-        color: #ed1c24;
-      }
-      .edit-circle-btn{
-        margin-left: 15px;
-        i{
-          vertical-align: text-bottom;
-        }
-      }
-      .import-btn{
-        margin-left: 15px;
-      }
     }
   }
 </style>

+ 439 - 0
src/views/bulkManagement/bulkReturnGoods/grabEdit.vue

@@ -0,0 +1,439 @@
+<template>
+  <div class="bulkReturnGoodsEdit-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-page-header :ghost="false" :backIcon="false" class="bulkReturnGoodsEdit-cont">
+        <!-- 自定义的二级文字标题 -->
+        <template slot="subTitle">
+          <a id="bulkReturnGoodsEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        </template>
+      </a-page-header>
+      <!-- 选择产品 -->
+      <a-card size="small" :bordered="false" class="bulkReturnGoodsEdit-cont">
+        <!-- 搜索条件 -->
+        <div class="table-page-search-wrapper">
+          <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="散件入库单号" prop="sparePartsPurchaseNo">
+                  <a-input id="bulkReturnGoodsEdit-sparePartsPurchaseNo" v-model="queryParam.sparePartsPurchaseNo" placeholder="请输入散件入库单号" allowClear />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品编码" prop="productCode">
+                  <a-input id="bulkReturnGoodsEdit-productCode" v-model="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品名称" prop="productName">
+                  <a-input id="bulkReturnGoodsEdit-productName" v-model="queryParam.productName" placeholder="请输入产品名称" allowClear />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkReturnGoodsEdit-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="bulkReturnGoodsEdit-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :customRow="handleClickRow"
+          :data="loadData"
+          :scroll="{ x: 1280, y:300 }"
+          bordered>
+          <!-- 退货单价 -->
+          <template slot="purchaseCost" slot-scope="text, record">
+            <a-input-number
+              size="small"
+              id="bulkReturnGoodsEdit-purchaseCost"
+              v-model="record.purchaseCost"
+              :precision="2"
+              :min="0"
+              :max="999999"
+              placeholder="请输入"
+              style="width: 100%;" />
+          </template>
+          <!-- 退货数量 -->
+          <template slot="purchaseQty" slot-scope="text, record">
+            <a-input-number
+              size="small"
+              id="bulkReturnGoodsEdit-purchaseQty"
+              v-model="record.purchaseQty"
+              :precision="0"
+              :min="1"
+              :max="record.currentStockQty"
+              placeholder="请输入"
+              style="width: 100%;" />
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="bulkReturnGoodsEdit-add-btn">添加</a-button>
+          </template>
+        </s-table>
+      </a-card>
+      <!-- 已选产品 -->
+      <a-card size="small" :bordered="false" class="bulkReturnGoodsEdit-cont">
+        <!-- 总计 -->
+        <a-alert type="info" style="margin-bottom:10px">
+          <div slot="message">
+            总款数<strong>{{ (productTotal&&(productTotal.purchaseSize || productTotal.purchaseSize==0)) ? productTotal.purchaseSize : '--' }}</strong> ,
+            总数量<strong>{{ (productTotal&&(productTotal.purchaseQty || productTotal.purchaseQty==0)) ? productTotal.purchaseQty : '--' }}</strong> ,
+            总金额<strong>{{ (productTotal&&(productTotal.purchaseCost || productTotal.purchaseCost==0)) ? '¥'+productTotal.purchaseCost : '--' }}</strong>
+          </div>
+        </a-alert>
+        <!-- 筛选条件 -->
+        <a-row :gutter="15" justify="space-between">
+          <a-col :span="17">
+            <div class="table-page-search-wrapper">
+              <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
+                <a-row :gutter="15">
+                  <a-col :md="9" :sm="24">
+                    <a-form-item label="产品编码" prop="productCode">
+                      <a-input id="bulkReturnGoodsEdit-productCode" v-model="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
+                    </a-form-item>
+                  </a-col>
+                  <a-col :md="9" :sm="24">
+                    <a-form-item label="产品名称" prop="productName">
+                      <a-input id="bulkReturnGoodsEdit-productName" v-model="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
+                    </a-form-item>
+                  </a-col>
+                  <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                    <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="bulkReturnGoodsEdit-refresh">查询</a-button>
+                    <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="bulkReturnGoodsEdit-reset">重置</a-button>
+                  </a-col>
+                </a-row>
+              </a-form>
+            </div>
+          </a-col>
+          <a-col :span="7" style="text-align: right;"></a-col>
+        </a-row>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="chooseTable"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="chooseColumns"
+          :data="chooseLoadData"
+          :scroll="{ x: 960, y:300 }"
+          bordered>
+          <!-- 退货单价 -->
+          <template slot="purchaseCost" slot-scope="text, record">
+            <a-input-number
+              size="small"
+              id="bulkReturnGoodsEdit-purchaseCost"
+              v-model="record.purchaseCost"
+              :precision="2"
+              :min="0"
+              :max="999999"
+              placeholder="请输入"
+              @blur="e => purchaseCostBlur(e.target.value, record)"
+              style="width: 100%;" />
+          </template>
+          <!-- 退货数量 -->
+          <template slot="purchaseQty" slot-scope="text, record">
+            <a-input-number
+              size="small"
+              id="bulkReturnGoodsEdit-purchaseQty"
+              v-model="record.purchaseQty"
+              :precision="0"
+              :min="1"
+              :max="999999"
+              placeholder="请输入"
+              @blur="e => purchaseQtyBlur(e.target.value, record)"
+              style="width: 100%;" />
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="bulkReturnGoodsEdit-del-btn">删除</a-button>
+          </template>
+        </s-table>
+      </a-card>
+    </a-spin>
+    <div class="affix-cont">
+      <a-button
+        type="primary"
+        id="bulkReturnGoodsEdit-submit-btn"
+        size="large"
+        :disabled="spinning"
+        class="button-primary"
+        @click="handleSubmit"
+        style="padding: 0 60px;">提交</a-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import { warehouseAllList } from '@/api/warehouse'
+import { sparePartsPurDetailFinishList } from '@/api/sparePartsPur'
+import { sparePartsRetDetailList, sparePartsRetDetailSave, sparePartsRetDetailCount, sparePartsRetDetailDel, sparePartsRetSubmit } from '@/api/sparePartsRet'
+export default {
+  components: { STable, VSelect },
+  data () {
+    return {
+      spinning: false,
+      queryParam: {
+        productCode: '',
+        productName: '',
+        sparePartsPurchaseNo: ''
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      // 表头
+      columns: [
+        { title: '散件入库单号', dataIndex: 'sparePartsPurchaseNo', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入库价格', dataIndex: 'putCost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '入库数量', dataIndex: 'putQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '已退数量', dataIndex: 'returnQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '可退数量', dataIndex: 'refundableQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '库存数量', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', scopedSlots: { customRender: 'purchaseCost' }, width: 100, align: 'center' },
+        { title: '退货数量', scopedSlots: { customRender: 'purchaseQty' }, width: 100, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        return sparePartsPurDetailFinishList(Object.assign(parameter, this.queryParam, { state: 'FINISH' })).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
+        })
+      },
+      chooseDisabled: false,
+      chooseQueryParam: {
+        productCode: '',
+        productName: ''
+      },
+      // 表头
+      chooseColumns: [
+        { title: '散件入库单号', dataIndex: 'sparePartsPurchaseNo', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', scopedSlots: { customRender: 'purchaseCost' }, width: 100, align: 'center' },
+        { title: '退货数量', scopedSlots: { customRender: 'purchaseQty' }, width: 100, align: 'center' },
+        { title: '退货金额', dataIndex: 'purchaseAmount', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      chooseLoadData: parameter => {
+        this.chooseDisabled = true
+        const params = Object.assign(parameter, this.chooseQueryParam, { sparePartsReturnSn: this.$route.params.sn })
+        return sparePartsRetDetailList(params).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].purchaseCostBackups = data.list[i].purchaseCost
+            data.list[i].purchaseQtyBackups = data.list[i].purchaseQty
+          }
+          this.localDataSource = data.list || []
+          this.chooseDisabled = false
+          this.getDetailCount(params)
+          return data
+        })
+      },
+      localDataSource: [],
+      productTotal: null, //  合计
+      warehouseList: [] // 仓库列表
+    }
+  },
+  methods: {
+    // 合计
+    getDetailCount (params) {
+      sparePartsRetDetailCount(params).then(res => {
+        if (res.status == 200) {
+          this.productTotal = res.data
+        } else {
+          this.productTotal = null
+        }
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.productCode = ''
+      this.queryParam.productName = ''
+      this.queryParam.sparePartsPurchaseNo = ''
+      this.$refs.table.refresh(true)
+    },
+    // 已选产品  重置
+    chooseResetSearchForm () {
+      this.chooseQueryParam.productCode = ''
+      this.chooseQueryParam.productName = ''
+      this.$refs.chooseTable.refresh(true)
+    },
+    //  添加/编辑
+    handleAdd (row, isEdit) {
+      if (!isEdit && !row.purchaseCost) {
+        this.$message.warning('请输入退货单价后再添加!')
+        return
+      }
+      if (!isEdit && !row.purchaseQty) {
+        this.$message.warning('请输入退货数量后再添加!')
+        return
+      }
+      const params = {
+        id: isEdit ? row.id : undefined,
+        sparePartsDetailSn: isEdit ? row.sparePartsDetailSn : row.id,
+        sparePartsReturnSn: this.$route.params.sn,
+        purchaseCost: row.purchaseCost,
+        purchaseQty: row.purchaseQty,
+        productSn: row.productSn,
+        productCode: row.productCode,
+        productOrigCode: row.productOrigCode,
+        productTypeSn1: row.productTypeSn1,
+        productTypeSn2: row.productTypeSn2,
+        productTypeSn3: row.productTypeSn3,
+        brandSn: row.brandSn,
+        warehouseLocationSn: row.warehouseLocationSn,
+        warehouseSn: row.warehouseSn,
+        productExpiryDate: row.productExpiryDate
+      }
+      if (isEdit) { // 编辑
+        // 清空成本价或数量时,值应保持未清空前的值,因成本价和数量都不可为空
+        if (!row.purchaseCost) {
+          row.purchaseCost = row.purchaseCostBackups
+          return
+        }
+        if (!row.purchaseQty) {
+          row.purchaseQty = row.purchaseQtyBackups
+          return
+        }
+      }
+      this.spinning = true
+      sparePartsRetDetailSave(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$refs.table.refresh()
+          this.$refs.chooseTable.refresh()
+          this.spinning = false
+        } else {
+          this.spinning = false
+        }
+      })
+    },
+    //  删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后不可恢复,确定要进行删除吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          sparePartsRetDetailDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.$refs.chooseTable.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    //  提交
+    handleSubmit () {
+      const _this = this
+      if (this.localDataSource.length < 1) {
+        this.$message.info('退货单中不存在任何产品,无法提交')
+        return
+      }
+      _this.spinning = true
+      sparePartsRetSubmit({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          setTimeout(() => {
+            _this.handleBack()
+            _this.spinning = false
+          }, 1000)
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    // 已选产品 单价  blur
+    purchaseCostBlur (val, record) {
+      //  光标移出,值发生改变再调用编辑接口
+      if (val != record.purchaseCostBackups) {
+        this.handleAdd(record, 'edit')
+      }
+    },
+    // 已选产品 数量  blur
+    purchaseQtyBlur (val, record) {
+      if (val != record.purchaseQtyBackups) {
+        this.handleAdd(record, 'edit')
+      }
+    },
+    //  返回列表
+    handleBack () {
+      this.$router.push({ path: '/bulkManagement/bulkReturnGoods/list', query: { closeLastOldTab: true } })
+    },
+    //  导入明细
+    handleImport () {
+      console.log(333)
+    },
+    // 双击快速添加
+    handleClickRow (record) {
+      return {
+        on: {
+          dblclick: (event) => {
+            this.handleAdd(record)
+          }
+        }
+      }
+    },
+    // 仓库
+    getWarehouse () {
+      warehouseAllList({}).then(res => {
+        if (res.status == 200) {
+          this.warehouseList = res.data
+        } else {
+          this.warehouseList = []
+        }
+      })
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.getWarehouse()
+    })
+  }
+}
+</script>
+
+<style lang="less">
+  .bulkReturnGoodsEdit-wrap{
+    position: relative;
+    height: 100%;
+    padding-bottom: 51px;
+    box-sizing: border-box;
+    >.ant-spin-nested-loading{
+      overflow-y: scroll;
+      height: 100%;
+    }
+    .bulkReturnGoodsEdit-cont{
+      margin-bottom: 10px;
+    }
+  }
+</style>

+ 171 - 108
src/views/bulkManagement/bulkReturnGoods/list.vue

@@ -1,96 +1,120 @@
 <template>
   <a-card size="small" :bordered="false" class="bulkReturnGoodsList-wrap">
-    <!-- 搜索条件 -->
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="散件退货单号">
-              <a-input id="bulkReturnGoodsList-sparePartsReturnNo" v-model.trim="queryParam.sparePartsReturnNo" allowClear placeholder="请输入散件退货单号"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="创建时间">
-              <rangeDate ref="rangeDate" @change="dateChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="供应商">
-              <a-select id="bulkReturnGoodsList-customerTypeSn" v-model="queryParam.customerTypeSn" placeholder="请选择供应商">
-                <a-select-option v-for="item in custTypeList" :value="item.id" :key="item.id">{{ item.name }}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <template v-if="advanced">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+          <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-item label="单据状态">
-                <v-select code="CHECK_ENABLE_STATE" id="bulkReturnGoodsList-satelliteFlag" v-model="queryParam.satelliteFlag" allowClear placeholder="请选择"></v-select>
+              <a-form-item label="创建时间">
+                <rangeDate ref="rangeDate" @change="dateChange" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="结算状态">
-                <v-select code="CHECK_ENABLE_STATE" id="bulkReturnGoodsList-satelliteFlag" v-model="queryParam.satelliteFlag" allowClear placeholder="请选择"></v-select>
+              <a-form-item label="散件退货单号">
+                <a-input id="bulkReturnGoodsList-sparePartsReturnNo" v-model.trim="queryParam.sparePartsReturnNo" allowClear placeholder="请输入散件退货单号"/>
               </a-form-item>
             </a-col>
-          </template>
-          <a-col :md="6" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkReturnGoodsList-refresh">查询</a-button>
-            <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="bulkReturnGoodsList-reset">重置</a-button>
-            <a @click="advanced=!advanced" style="margin-left: 8px">
-              {{ advanced ? '收起' : '展开' }}
-              <a-icon :type="advanced ? 'up' : 'down'"/>
-            </a>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 操作按钮 -->
-    <div class="table-operator">
-      <a-button id="bulkReturnGoodsList-add" type="primary" class="button-error" @click="handleAdd()">新增</a-button>
-    </div>
-    <!-- 合计 -->
-    <a-alert type="info" style="margin-bottom:10px">
-      <div slot="message">共 <strong>6</strong> 条记录,总数量合计 <strong>14</strong> ,总金额合计 <strong>¥14</strong> </div>
-    </a-alert>
-    <!-- 列表 -->
-    <s-table
-      class="sTable"
-      ref="table"
-      size="small"
-      :rowKey="(record) => record.id"
-      :columns="columns"
-      :data="loadData"
-      :scroll="{ x: 1310, y: tableHeight }"
-      bordered>
-      <!-- 是否转销售单 -->
-      <template slot="invenstoryNum" slot-scope="text, record">
-        <span>{{ record.invenstoryNum == 1 ? '是' : '否' }}</span>
-      </template>
-      <!-- 操作 -->
-      <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="link" class="button-info" @click="handleEdit(record)" id="bulkReturnGoodsList-edit-btn">编辑</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleDetail(record)" id="bulkReturnGoodsList-detail-btn">详情</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleAdopt(record)" id="bulkReturnGoodsList-isAdopt-btn">{{ record.adopt == 0 ? '通过' : '不通过' }}</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="bulkReturnGoodsList-del-btn">删除</a-button>
-      </template>
-    </s-table>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="供应商" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                <a-select
+                  id="bulkReturnGoodsList-supplierSn"
+                  placeholder="请选择供应商"
+                  allowClear
+                  v-model="queryParam.supplierSn"
+                  :showSearch="true"
+                  option-filter-prop="children"
+                  :filter-option="filterOption">
+                  <a-select-option v-for="item in supplierList" :key="item.supplierSn" :value="item.supplierSn">{{ item.supplierName }}</a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="是否抓单">
+                  <v-select code="FLAG" id="bulkReturnGoodsList-isGrab" v-model="queryParam.isGrab" allowClear placeholder="请选择"></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="业务状态">
+                  <v-select code="SPARE_PARTS_RETURN" id="bulkReturnGoodsList-state" v-model="queryParam.state" allowClear placeholder="请选择"></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="财务状态">
+                  <v-select code="FINANCIAL_RECEIVE_STATUS" id="bulkReturnGoodsList-settleState" v-model="queryParam.settleState" allowClear placeholder="请选择"></v-select>
+                </a-form-item>
+              </a-col>
+            </template>
+            <a-col :md="6" :sm="24">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkReturnGoodsList-refresh">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="bulkReturnGoodsList-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 8px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <!-- 操作按钮 -->
+      <div class="table-operator">
+        <a-button id="bulkReturnGoodsList-add" v-if="$hasPermissions('B_bulkReturnGoodsAdd')" type="primary" class="button-error" @click="handleAdd()">新增</a-button>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        :style="{ height: tableHeight+84.5+'px' }"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ x: 1370, y: tableHeight }"
+        bordered>
+        <!-- 操作 -->
+        <template slot="action" slot-scope="text, record">
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.state != 'FINISH' && $hasPermissions('B_bulkReturnGoodsEdit')"
+            @click="handleEdit(record)"
+            class="button-info"
+            id="bulkReturnGoodsList-edit-btn">编辑</a-button>
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.state == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_bulkReturnGoodsOutStock')"
+            @click="handleWarehouse(record)"
+            class="button-primary"
+            id="bulkReturnGoodsList-warehouse-btn">出库</a-button>
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.state != 'FINISH' && $hasPermissions('B_bulkReturnGoodsDel')"
+            @click="handleDel(record)"
+            class="button-error"
+            id="bulkReturnGoodsList-del-btn">删除</a-button>
+          <span v-if="!(record.state != 'FINISH' && $hasPermissions('B_bulkReturnGoodsEdit')) && !(record.state == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_bulkReturnGoodsOutStock')) && !(record.state != 'FINISH' && $hasPermissions('B_bulkReturnGoodsDel'))">--</span>
+        </template>
+      </s-table>
+    </a-spin>
     <!-- 选择基本信息弹框 -->
     <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
   </a-card>
 </template>
 
 <script>
-import { sparePartsRetList } from '@/api/sparePartsRet'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 import rangeDate from '@/views/common/rangeDate.vue'
+import { supplierAllList } from '@/api/supplier'
+import { sparePartsRetList, sparePartsRetDel, sparePartsRetOutStock } from '@/api/sparePartsRet'
 export default {
   components: { STable, VSelect, basicInfoModal, rangeDate },
   data () {
     return {
+      spinning: false,
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0,
       queryParam: { //  查询条件
@@ -98,21 +122,24 @@ export default {
         endDate: '',
         sparePartsReturnNo: '', //  散件退货单号
         supplierSn: undefined, //  供应商
-        settleState: undefined, //  结算状态
-        state: undefined //  单据状态
+        isGrab: undefined,
+        settleState: undefined,
+        state: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '散件退货单号', dataIndex: 'sparePartsReturnNo', width: 140, align: 'center' },
-        { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
+        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
+        { title: '散件退货单号', dataIndex: 'sparePartsReturnNo', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '供应商', dataIndex: 'supplierName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '总金额', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单据状态', dataIndex: 'state', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '结算状态', dataIndex: 'settleState', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 230, align: 'center', fixed: 'right' }
+        { title: '产品款数', dataIndex: 'productTotalCategory', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '总数量', dataIndex: 'productTotalQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '总金额', dataIndex: 'productTotalCost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '是否抓单', dataIndex: 'isGrabDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '业务状态', dataIndex: 'stateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '财务状态', dataIndex: 'settleStateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '创建时间', dataIndex: 'createDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '出库时间', dataIndex: 'outStockTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 140, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -130,7 +157,7 @@ export default {
           return data
         })
       },
-      custTypeList: [], //  供应商下拉
+      supplierList: [], //  供应商列表数据
       openModal: false // 基本信息弹框是否显示
     }
   },
@@ -152,13 +179,14 @@ export default {
       this.queryParam.endDate = ''
       this.queryParam.sparePartsReturnNo = ''
       this.queryParam.supplierSn = undefined
+      this.queryParam.isGrab = undefined
       this.queryParam.settleState = undefined
       this.queryParam.state = undefined
       this.$refs.table.refresh(true)
     },
     //  基本信息  保存
-    handleOk () {
-      this.$router.push({ path: `/bulkManagement/bulkReturnGoods/add` })
+    handleOk (data) {
+      this.$router.push({ name: data.isGrab == 1 ? 'bulkReturnGoodsGrabEdit' : 'bulkReturnGoodsEdit', params: { id: data.id, sn: data.sparePartsReturnSn } })
     },
     //  新增
     handleAdd () {
@@ -166,11 +194,11 @@ export default {
     },
     //  编辑
     handleEdit (row) {
-      this.$router.push({ path: `/bulkManagement/bulkReturnGoods/edit/${row.id}` })
+      this.$router.push({ name: row.isGrab == 1 ? 'bulkReturnGoodsGrabEdit' : 'bulkReturnGoodsEdit', params: { id: row.id, sn: row.sparePartsReturnSn } })
     },
     //  详情
     handleDetail (row) {
-      this.$router.push({ path: `/bulkManagement/bulkReturnGoods/detail/${row.id}` })
+      this.$router.push({ path: `/bulkManagement/bulkReturnGoods/detail/${row.id}/${row.sparePartsReturnSn}` })
     },
     //  删除
     handleDel (row) {
@@ -180,37 +208,72 @@ export default {
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
         onOk () {
-          // warehouseDel({
-          //   id: row.id
-          // }).then(res => {
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          sparePartsRetDel({
+            id: row.id
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },
-    //  是否通过
-    handleAdopt (row) {
+    //  入库
+    handleWarehouse (row) {
       const _this = this
-      const content = '确认要审核' + row.adopt ? '不' : '' + '通过吗?'
       this.$confirm({
         title: '提示',
-        content: content,
+        content: '确定要出库吗?',
         centered: true,
         onOk () {
-          // warehouseDel({
-          //   id: row.id
-          // }).then(res => {
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          _this.spinning = true
+          sparePartsRetOutStock({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 供应商下拉数据
+    getSupplierList () {
+      supplierAllList().then(res => {
+        if (res.status == 200) {
+          this.supplierList = res.data
+        } else {
+          this.supplierList = []
         }
       })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 245
     }
+  },
+  mounted () {
+    const _this = this
+    this.$nextTick(() => { // 页面渲染完成后的回调
+      _this.setTableH()
+    })
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      setTimeout(() => {
+        _this.setTableH()
+      }, 400)
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.openModal = false
+      vm.getSupplierList()
+    })
   }
 }
 </script>

+ 1 - 9
src/views/bulkManagement/bulkWarehousingOrder/list.vue

@@ -128,7 +128,6 @@
             @click="handleDel(record)"
             class="button-error"
             id="bulkWarehousingOrderList-del-btn">删除</a-button>
-          <!-- <span v-if="record.state == 'FINISH' && record.state != 'WAIT_PUT_WAREHOUSE'">--</span> -->
           <span v-if="(record.state == 'FINISH' || !$hasPermissions('B_bulkWarehousingOrder_edit')) &&(record.state == 'FINISH' || !$hasPermissions('B_bulkWarehousingOrder_del')) &&(record.state != 'WAIT_PUT_WAREHOUSE' || !$hasPermissions('B_bulkWarehousingOrder_put'))">--</span>
         </template>
       </s-table>
@@ -337,7 +336,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 285
+      this.tableHeight = window.innerHeight - tableSearchH - 280
     }
   },
   mounted () {
@@ -362,10 +361,3 @@ export default {
   }
 }
 </script>
-<style lang="less">
-  .bulkWarehousingOrderList-wrap{
-    .sTable{
-      margin-top: 15px;
-    }
-  }
-</style>