Browse Source

散件退货

lilei 3 years ago
parent
commit
6f4a8cabff

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

@@ -717,64 +717,64 @@ export const asyncRouterMap = [
               }
             ]
           },
-          // {
-          //   path: '/purchasingManagement/purchaseReturn',
-          //   redirect: '/purchasingManagement/purchaseReturn/list',
-          //   name: 'purchaseReturn',
-          //   component: BlankLayout,
-          //   meta: {
-          //     title: '采购退货',
-          //     icon: 'money-collect',
-          //     permission: 'M_purchaseReturnList'
-          //   },
-          //   hideChildrenInMenu: true,
-          //   children: [
-          //     {
-          //       path: 'list',
-          //       name: 'purchaseReturnList',
-          //       component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/list.vue'),
-          //       meta: {
-          //         title: '采购退货列表',
-          //         icon: 'money-collect',
-          //         hidden: true,
-          //         permission: 'M_purchaseReturnList'
-          //       }
-          //     },
-          //     {
-          //       path: 'add/:id/:sn/:name',
-          //       name: 'purchaseReturnAdd',
-          //       component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/edit.vue'),
-          //       meta: {
-          //         title: '新增采购退货单',
-          //         icon: 'money-collect',
-          //         hidden: true,
-          //         permission: 'B_purchaseReturnNew'
-          //       }
-          //     },
-          //     {
-          //       path: 'edit/:id/:sn/:name',
-          //       name: 'purchaseReturnEdit',
-          //       component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/edit.vue'),
-          //       meta: {
-          //         title: '编辑采购退货单',
-          //         icon: 'money-collect',
-          //         hidden: true,
-          //         permission: 'B_purchaseReturnEdit'
-          //       }
-          //     },
-          //     {
-          //       path: 'detail/:sn',
-          //       name: 'purchaseReturnDetail',
-          //       component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/detail.vue'),
-          //       meta: {
-          //         title: '采购退货详情',
-          //         icon: 'money-collect',
-          //         hidden: true,
-          //         permission: 'B_purchaseReturnDetail'
-          //       }
-          //     }
-          //   ]
-          // },
+          {
+            path: '/purchasingManagement/purchaseReturn',
+            redirect: '/purchasingManagement/purchaseReturn/list',
+            name: 'purchaseReturn',
+            component: BlankLayout,
+            meta: {
+              title: '采购退货',
+              icon: 'money-collect',
+              permission: 'M_purchaseReturnList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'purchaseReturnList',
+                component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/list.vue'),
+                meta: {
+                  title: '采购退货列表',
+                  icon: 'money-collect',
+                  hidden: true,
+                  permission: 'M_purchaseReturnList'
+                }
+              },
+              {
+                path: 'add/:id/:sn/:name',
+                name: 'purchaseReturnAdd',
+                component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/edit.vue'),
+                meta: {
+                  title: '新增采购退货单',
+                  icon: 'money-collect',
+                  hidden: true,
+                  permission: 'B_purchaseReturnNew'
+                }
+              },
+              {
+                path: 'edit/:id/:sn/:name',
+                name: 'purchaseReturnEdit',
+                component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/edit.vue'),
+                meta: {
+                  title: '编辑采购退货单',
+                  icon: 'money-collect',
+                  hidden: true,
+                  permission: 'B_purchaseReturnEdit'
+                }
+              },
+              {
+                path: 'detail/:sn',
+                name: 'purchaseReturnDetail',
+                component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/detail.vue'),
+                meta: {
+                  title: '采购退货详情',
+                  icon: 'money-collect',
+                  hidden: true,
+                  permission: 'B_purchaseReturnDetail'
+                }
+              }
+            ]
+          },
           // 采购退货-不同步
           {
             path: '/purchasingManagement/purchaseReturnOutSync',
@@ -812,7 +812,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'edit/:sn',
+                path: 'grapEdit/:sn',
                 name: 'purchaseReturnOutSyncGrapEdit',
                 component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturnOutSync/grapEdit.vue'),
                 meta: {
@@ -824,7 +824,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'detail/:sn',
+                path: 'detail/:sn/:grabFlag',
                 name: 'purchaseReturnOutSyncDetail',
                 component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturnOutSync/detail.vue'),
                 meta: {

+ 5 - 0
src/store/modules/user.js

@@ -88,6 +88,11 @@ const user = {
     // 获取用户信息
     GetInfo ({ commit, state }) {
       const roles = Vue.ls.get('rolesAccess-qpls-md')
+      // 如果存在不同步采购退货,屏蔽同步的采购退货
+      const hasOutSyncReturn = roles.permissionList.find(item => item == 'M_purchaseReturn_outSnycList')
+      if(hasOutSyncReturn){
+        roles.permissionList = roles.permissionList.filter(item => item != 'M_purchaseReturnList')
+      }
       commit('SET_ROLES', roles)
       // commit('SET_TOKEN', sessionStorage.getItem(ACCESS_TOKEN) || state.token)
       commit('SET_NAME', { name: Vue.ls.get('userName'), welcome: '' })

+ 4 - 4
src/views/Home.vue

@@ -333,8 +333,8 @@ export default {
               icon: require('@/assets/home-icon/home_icon_purchase_return.png'),
               name: '采购退货',
               styleC: 'red-color',
-              url: '/purchasingManagement/purchaseReturn/list',
-              permission: 'M_purchaseReturnList',
+              url: this.$hasPermissions('M_purchaseReturn_outSnycList') ? '/purchasingManagement/purchaseReturnOutSync/list' : '/purchasingManagement/purchaseReturn/list',
+              permission: this.$hasPermissions('M_purchaseReturn_outSnycList') ? 'M_purchaseReturn_outSnycList' : 'M_purchaseReturnList',
               orderNum: ''
             }
           ],
@@ -352,9 +352,9 @@ export default {
               icon: require('@/assets/home-icon/home_icon_verify_return.png'),
               name: '退货审核',
               styleC: 'blue-color',
-              url: '/purchasingManagement/purchaseReturn/list',
+              url: this.$hasPermissions('M_purchaseReturn_outSnycList') ? '/purchasingManagement/purchaseReturnOutSync/list' : '/purchasingManagement/purchaseReturn/list',
               params: { state: 'WAIT_AUDIT' },
-              permission: 'M_purchaseReturnList',
+              permission: this.$hasPermissions('M_purchaseReturn_outSnycList') ? 'M_purchaseReturn_outSnycList' : 'M_purchaseReturnList',
               orderNum: 'purchaseReturnWaitAuditCount'
             }
           ],

+ 8 - 2
src/views/purchasingManagement/purchaseOrder/list.vue

@@ -110,7 +110,7 @@
         <template slot="purchaseBillNo" slot-scope="text, record">
           <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_purchaseDetail')" @click="handleDetail(record)">{{ record.purchaseBillNo }}</span>
           <span v-else>{{ record.purchaseBillNo }}</span>
-          <a-badge count="改" :offset="[10,0]" v-if="record.billStatus=='HQ_CHANGE'"></a-badge>
+          <a-badge count="改" :offset="[10,0]" v-if="record.billStatus=='HQ_CHANGE'||record.billStatus=='SUPERIOR_CHANGE'"></a-badge>
         </template>
         <!-- 审核 -->
         <template slot="audit" slot-scope="text, record">
@@ -373,7 +373,13 @@ export default {
     }
   },
   beforeRouteEnter (to, from, next) {
-    next(vm => {})
+    next(vm => {
+      // 从首页点击销售开单过来的,直接打开新建弹框
+      if (from.name == 'home' && vm.$store.state.app.isHomeNav && vm.$route.query.pageParams == null) {
+        vm.openModal = true
+        vm.$store.state.app.isHomeNav = false
+      }
+    })
   }
 }
 </script>

+ 1 - 1
src/views/purchasingManagement/purchaseReturnOutSync/basicInfoModal.vue

@@ -4,7 +4,7 @@
     class="purchaseOrder-basicInfo-modal"
     :footer="null"
     :maskClosable="false"
-    title="新增采购单"
+    title="新增采购退货单"
     v-model="isShow"
     @cancel="isShow=false"
     :width="800">

+ 24 - 11
src/views/purchasingManagement/purchaseReturnOutSync/detail.vue

@@ -83,15 +83,7 @@ export default {
     return {
       spinning: false,
       // 表头
-      columns: [
-        { title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '退货单价', dataIndex: 'cost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货数量', dataIndex: 'qty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货金额', scopedSlots: { customRender: 'amount' }, width: '6%', align: 'center' }
-      ],
+      columns: [],
       dataSource: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -141,6 +133,26 @@ export default {
     },
     // 基本信息
     getDetail () {
+      // 抓单
+      if (this.$route.params.grabFlag == '1') {
+        this.columns = [{ title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+          { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '退货单价', dataIndex: 'cost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+          { title: '退货数量', dataIndex: 'qty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+          { title: '退货金额', scopedSlots: { customRender: 'amount' }, width: '6%', align: 'center' }]
+      } else {
+        this.columns = [
+          { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+          { title: '仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '仓位', dataIndex: 'warehouseLocationName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '退货单价', dataIndex: 'cost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+          { title: '退货数量', dataIndex: 'qty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+          { title: '退货金额', scopedSlots: { customRender: 'amount' }, width: '6%', align: 'center' }]
+      }
       purchaseReturnDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.basicInfoData = res.data
@@ -149,9 +161,10 @@ export default {
         }
       })
     },
-    //  编辑
+    // 编辑
     handleEdit () {
-      this.$router.push({ path: `/purchasingManagement/purchaseReturn/edit/${this.basicInfoData.id}/${this.basicInfoData.purchaseReturnSn}/${this.basicInfoData.returnTargetName}` })
+      const row = this.basicInfoData
+      this.$router.push({ name: row.grabFlag == 1 ? 'purchaseReturnOutSyncGrapEdit' : 'purchaseReturnOutSyncEdit', params: { sn: row.purchaseReturnSn } })
     }
   },
   mounted () {

+ 113 - 101
src/views/purchasingManagement/purchaseReturnOutSync/edit.vue

@@ -13,108 +13,110 @@
         </template>
       </a-page-header>
       <!-- 选择产品 -->
-      <div class="purchaseReturnEdit-cont">
-        <a-collapse :activeKey="['1']">
-          <a-collapse-panel key="1" header="选择产品">
-            <!-- 筛选条件 -->
-            <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.trim="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.trim="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"
-              :data="loadData"
-              :defaultLoadData="false"
-              :pageSize="10"
-              :scroll="{ y: 149 }"
-              bordered>
-              <!-- 数量 -->
-              <template slot="returnQty" slot-scope="text, record">
-                <a-input-number
-                  size="small"
-                  id="purchaseReturnEdit-returnQty"
-                  v-model="record.returnQty"
-                  :precision="0"
-                  :min="1"
-                  :max="record.refundableQty"
-                  placeholder="请输入"
-                  style="width: 100%;" />
-              </template>
-              <!-- 单价 -->
-              <template slot="returnPrice" slot-scope="text, record">
-                <a-input-number
-                  size="small"
-                  id="purchaseReturnEdit-returnPrice"
-                  v-model="record.returnPrice"
-                  :precision="2"
-                  :min="0"
-                  :max="999999"
-                  placeholder="请输入"
-                  style="width: 100%;" />
-              </template>
-              <!-- 操作 -->
-              <template slot="action" slot-scope="text, record">
-                <span v-if="record.refundableQty==0">--</span>
-                <a-button
-                  v-else
-                  size="small"
-                  type="link"
-                  class="button-primary"
-                  @click="handleAdd(record)"
-                  id="purchaseReturnEdit-add-btn">添加</a-button>
-              </template>
-            </s-table>
-          </a-collapse-panel>
-        </a-collapse>
-      </div>
+      <a-card size="small" :bordered="false" class="purchaseReturnEdit-cont">
+        <div class="purchaseReturnEdit-cont">
+          <a-collapse :activeKey="['1']">
+            <a-collapse-panel key="1" header="选择产品">
+              <!-- 筛选条件 -->
+              <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.trim="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.trim="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"
+                :data="loadData"
+                :defaultLoadData="false"
+                :pageSize="10"
+                :scroll="{ y: 149 }"
+                bordered>
+                <!-- 数量 -->
+                <template slot="returnQty" slot-scope="text, record">
+                  <a-input-number
+                    size="small"
+                    id="purchaseReturnEdit-returnQty"
+                    v-model="record.returnQty"
+                    :precision="0"
+                    :min="1"
+                    :max="record.refundableQty"
+                    placeholder="请输入"
+                    style="width: 100%;" />
+                </template>
+                <!-- 单价 -->
+                <template slot="returnPrice" slot-scope="text, record">
+                  <a-input-number
+                    size="small"
+                    id="purchaseReturnEdit-returnPrice"
+                    v-model="record.returnPrice"
+                    :precision="2"
+                    :min="0"
+                    :max="999999"
+                    placeholder="请输入"
+                    style="width: 100%;" />
+                </template>
+                <!-- 操作 -->
+                <template slot="action" slot-scope="text, record">
+                  <span v-if="record.refundableQty==0">--</span>
+                  <a-button
+                    v-else
+                    size="small"
+                    type="link"
+                    class="button-primary"
+                    @click="handleAdd(record)"
+                    id="purchaseReturnEdit-add-btn">添加</a-button>
+                </template>
+              </s-table>
+            </a-collapse-panel>
+          </a-collapse>
+        </div>
+      </a-card>
       <!-- 已选产品 -->
       <a-card size="small" :bordered="false" class="purchaseReturnEdit-cont">
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1">
             <template slot="header">
               已选产品
-              <a-button
+              <!-- <a-button
                 size="small"
                 type="primary"
                 class="button-error"
                 id="purchaseReturnEdit-delAll-btn"
                 @click.stop="handleDel('', 'all')"
-                style="margin-right: 10px;float: right;">整单删除</a-button>
+                style="margin-right: 10px;float: right;">整单删除</a-button> -->
             </template>
             <!-- 总计 -->
             <a-alert type="info" style="margin-bottom:10px">
@@ -188,6 +190,10 @@
                   @blur="e => costBlur(e.target.value, record)"
                   style="width: 100%;" />
               </template>
+              <!-- 退货金额合计 amount-->
+              <template slot="amount" slot-scope="text, record">
+                {{ (record.cost * record.qty).toFixed(2) }}
+              </template>
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
                 <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="purchaseReturnEdit-del-btn">删除</a-button>
@@ -272,18 +278,24 @@ export default {
       // 表头
       chooseColumns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货单价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'center' },
         { title: '退货数量', scopedSlots: { customRender: 'qty' }, width: '10%', align: 'center' },
         { title: '退货金额', scopedSlots: { customRender: 'amount' }, width: '6%', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ],
+      chooseDisabled: false,
+      chooseQueryParam: {
+        productCode: '',
+        productName: ''
+      },
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: parameter => {
-        return purchaseReturnDetailList(Object.assign(parameter, { purchaseReturnSn: this.$route.params.sn, orderBy: 'qpls_purchase_return_bill_detail.CREATE_DATE desc' })).then(res => {
+        return purchaseReturnDetailList(Object.assign(parameter, this.chooseQueryParam, { purchaseReturnSn: this.$route.params.sn, orderBy: 'qpls_purchase_return_bill_detail.CREATE_DATE desc' })).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
@@ -314,13 +326,18 @@ export default {
         _this.spinning = false
       })
     },
-    //  重置
     resetSearchForm () {
-      this.queryParam.purchaseBillNo = ''
       this.queryParam.productCode = ''
       this.queryParam.productName = ''
+      this.queryParam.warehouseSn = undefined
       this.$refs.table.refresh(true)
     },
+    // 已选产品  重置
+    chooseResetSearchForm () {
+      this.chooseQueryParam.productCode = ''
+      this.chooseQueryParam.productName = ''
+      this.$refs.chooseTable.refresh(true)
+    },
     //  添加/编辑
     handleAdd (row, isEdit) {
       // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
@@ -332,13 +349,10 @@ export default {
         this.$message.warning('请输入退货数量')
         return
       }
-
       const params = {
         id: isEdit ? row.id : undefined,
         purchaseReturnSn: this.$route.params.sn,
-        purchaseBillSn: row.purchaseBillSn,
-        purchaseBillNo: row.purchaseBillNo,
-        purchaseBillDetailSn: row.purchaseBillDetailSn,
+        purchaseReturnDetailSn: row.purchaseReturnDetailSn,
         qty: isEdit ? row.qty : row.returnQty, //  退货数量
         productSn: row.productSn,
         productCode: row.productCode,
@@ -403,7 +417,6 @@ export default {
             purchaseReturnDelAll({ purchaseReturnSn: _this.$route.params.sn }).then(res => {
               if (res.status == 200) {
                 _this.$message.success(res.message)
-                // _this.$refs.table.refresh()
                 _this.$refs.chooseTable.refresh()
                 _this.spinning = false
               } else {
@@ -415,7 +428,6 @@ export default {
             purchaseReturnDetailDel({ 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 {

+ 130 - 83
src/views/purchasingManagement/purchaseReturnOutSync/grapEdit.vue

@@ -13,100 +13,136 @@
         </template>
       </a-page-header>
       <!-- 选择产品 -->
-      <div class="purchaseReturnEdit-cont">
-        <a-collapse :activeKey="['1']">
-          <a-collapse-panel key="1" header="选择产品">
-            <!-- 筛选条件 -->
-            <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="purchaseBillNo">
-                      <a-input id="purchaseReturnEdit-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" placeholder="请输入采购单号" allowClear />
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="产品编码" prop="productCode">
-                      <a-input id="purchaseReturnEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="产品名称" prop="productName">
-                      <a-input id="purchaseReturnEdit-productName" v-model.trim="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="purchaseReturnList-refresh">查询</a-button>
-                    <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="purchaseReturnList-reset">重置</a-button>
-                  </a-col>
-                </a-row>
-              </a-form>
-            </div>
-            <!-- 列表 -->
-            <s-table
-              class="sTable"
-              ref="table"
-              size="small"
-              :rowKey="(record) => record.id"
-              :columns="columns"
-              :data="loadData"
-              :defaultLoadData="false"
-              :pageSize="10"
-              :scroll="{ y: 149 }"
-              bordered>
-              <!-- 数量 -->
-              <template slot="returnQty" slot-scope="text, record">
-                <a-input-number
-                  size="small"
-                  id="purchaseReturnEdit-returnQty"
-                  v-model="record.returnQty"
-                  :precision="0"
-                  :min="1"
-                  :max="record.refundableQty"
-                  placeholder="请输入"
-                  style="width: 100%;" />
-              </template>
-              <!-- 单价 -->
-              <template slot="returnPrice" slot-scope="text, record">
-                <a-input-number
-                  size="small"
-                  id="purchaseReturnEdit-returnPrice"
-                  v-model="record.returnPrice"
-                  :precision="2"
-                  :min="0"
-                  :max="999999"
-                  placeholder="请输入"
-                  style="width: 100%;" />
-              </template>
-              <!-- 操作 -->
-              <template slot="action" slot-scope="text, record">
-                <span v-if="record.refundableQty==0">--</span>
-                <a-button
-                  v-else
-                  size="small"
-                  type="link"
-                  class="button-primary"
-                  @click="handleAdd(record)"
-                  id="purchaseReturnEdit-add-btn">添加</a-button>
-              </template>
-            </s-table>
-          </a-collapse-panel>
-        </a-collapse>
-      </div>
+      <a-card size="small" :bordered="false" class="purchaseReturnEdit-cont">
+        <div class="purchaseReturnEdit-cont">
+          <a-collapse :activeKey="['1']">
+            <a-collapse-panel key="1" header="选择产品">
+              <!-- 筛选条件 -->
+              <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="purchaseBillNo">
+                        <a-input id="purchaseReturnEdit-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" placeholder="请输入采购单号" allowClear />
+                      </a-form-item>
+                    </a-col>
+                    <a-col :md="6" :sm="24">
+                      <a-form-item label="产品编码" prop="productCode">
+                        <a-input id="purchaseReturnEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                      </a-form-item>
+                    </a-col>
+                    <a-col :md="6" :sm="24">
+                      <a-form-item label="产品名称" prop="productName">
+                        <a-input id="purchaseReturnEdit-productName" v-model.trim="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="purchaseReturnList-refresh">查询</a-button>
+                      <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="purchaseReturnList-reset">重置</a-button>
+                    </a-col>
+                  </a-row>
+                </a-form>
+              </div>
+              <!-- 列表 -->
+              <s-table
+                class="sTable"
+                ref="table"
+                size="small"
+                :rowKey="(record) => record.id"
+                :columns="columns"
+                :data="loadData"
+                :defaultLoadData="false"
+                :pageSize="10"
+                :scroll="{ y: 149 }"
+                bordered>
+                <!-- 数量 -->
+                <template slot="returnQty" slot-scope="text, record">
+                  <a-input-number
+                    size="small"
+                    id="purchaseReturnEdit-returnQty"
+                    v-model="record.returnQty"
+                    :precision="0"
+                    :min="1"
+                    :max="record.refundableQty"
+                    placeholder="请输入"
+                    style="width: 100%;" />
+                </template>
+                <!-- 单价 -->
+                <template slot="returnPrice" slot-scope="text, record">
+                  <a-input-number
+                    size="small"
+                    id="purchaseReturnEdit-returnPrice"
+                    v-model="record.returnPrice"
+                    :precision="2"
+                    :min="0"
+                    :max="999999"
+                    placeholder="请输入"
+                    style="width: 100%;" />
+                </template>
+                <!-- 操作 -->
+                <template slot="action" slot-scope="text, record">
+                  <span v-if="record.refundableQty==0">--</span>
+                  <a-button
+                    v-else
+                    size="small"
+                    type="link"
+                    class="button-primary"
+                    @click="handleAdd(record)"
+                    id="purchaseReturnEdit-add-btn">添加</a-button>
+                </template>
+              </s-table>
+            </a-collapse-panel>
+          </a-collapse>
+        </div>
+      </a-card>
       <!-- 已选产品 -->
       <a-card size="small" :bordered="false" class="purchaseReturnEdit-cont">
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1">
             <template slot="header">
               已选产品
-              <a-button
+              <!-- <a-button
                 size="small"
                 type="primary"
                 class="button-error"
                 id="purchaseReturnEdit-delAll-btn"
                 @click.stop="handleDel('', 'all')"
-                style="margin-right: 10px;float: right;">整单删除</a-button>
+                style="margin-right: 10px;float: right;">整单删除</a-button> -->
             </template>
+            <!-- 总计 -->
+            <a-alert type="info" style="margin-bottom:10px">
+              <div slot="message">
+                总款数<strong>{{ (detailData&&(detailData.totalCategory || detailData.totalCategory==0)) ? detailData.totalCategory : '--' }}</strong> ,
+                总数量<strong>{{ (detailData&&(detailData.totalQty || detailData.totalQty==0)) ? detailData.totalQty : '--' }}</strong> ,
+                总金额<strong>{{ (detailData&&(detailData.totalAmount || detailData.totalAmount==0)) ? '¥'+detailData.totalAmount : '--' }}</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.trim="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.trim="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"
@@ -232,6 +268,11 @@ export default {
           return data
         })
       },
+      chooseDisabled: false,
+      chooseQueryParam: {
+        productCode: '',
+        productName: ''
+      },
       // 表头
       chooseColumns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
@@ -246,7 +287,7 @@ export default {
       ],
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: parameter => {
-        return purchaseReturnDetailList(Object.assign(parameter, { purchaseReturnSn: this.$route.params.sn, orderBy: 'qpls_purchase_return_bill_detail.CREATE_DATE desc' })).then(res => {
+        return purchaseReturnDetailList(Object.assign(parameter, this.chooseQueryParam, { purchaseReturnSn: this.$route.params.sn, orderBy: 'qpls_purchase_return_bill_detail.CREATE_DATE desc' })).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
@@ -283,6 +324,12 @@ export default {
       this.queryParam.productName = ''
       this.$refs.table.refresh(true)
     },
+    // 已选产品  重置
+    chooseResetSearchForm () {
+      this.chooseQueryParam.productCode = ''
+      this.chooseQueryParam.productName = ''
+      this.$refs.chooseTable.refresh(true)
+    },
     //  添加/编辑
     handleAdd (row, isEdit) {
       // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty

+ 8 - 2
src/views/purchasingManagement/purchaseReturnOutSync/list.vue

@@ -278,7 +278,7 @@ export default {
     },
     // 详情
     handleDetail (row) {
-      this.$router.push({ name: 'purchaseReturnOutSyncDetail', params: { sn: row.purchaseReturnSn } })
+      this.$router.push({ name: 'purchaseReturnOutSyncDetail', params: { sn: row.purchaseReturnSn, grabFlag: row.grabFlag } })
     },
     //  生成出库单
     handleWarehouse (row) {
@@ -368,7 +368,13 @@ export default {
     }
   },
   beforeRouteEnter (to, from, next) {
-    next(vm => {})
+    next(vm => {
+      // 从首页点击销售开单过来的,直接打开新建弹框
+      if (from.name == 'home' && vm.$store.state.app.isHomeNav && vm.$route.query.pageParams == null) {
+        vm.openModal = true
+        vm.$store.state.app.isHomeNav = false
+      }
+    })
   }
 }
 </script>