lilei 3 years ago
parent
commit
7a18c3f0bf

+ 7 - 1
src/components/Select/index.js

@@ -84,9 +84,15 @@ export default {
         this.$emit('change', obj, _.find(this.dataList, ['code', obj]))
         this.$emit('change', obj, _.find(this.dataList, ['code', obj]))
       }
       }
     }
     }
+    const radioOn = {
+      change: obj => {
+        this.$emit('input', obj.target.value)
+        this.$emit('change', obj.target.value, _.find(this.dataList, ['code', obj.target.value]))
+      }
+    }
     if(this.showType === 'radio'){
     if(this.showType === 'radio'){
       return (
       return (
-        <a-radio-group vModel={props.value} {...{ props, on: on }} >,
+        <a-radio-group vModel={props.value} {...{ props, on: radioOn }} >,
           {
           {
             this.dataList.map(item => {
             this.dataList.map(item => {
               return (<a-radio value={item.code} key={item.code}>{item['dispName']}</a-radio>)
               return (<a-radio value={item.code} key={item.code}>{item['dispName']}</a-radio>)

+ 63 - 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',
             path: '/purchasingManagement/purchaseReturnOutSync',
@@ -800,24 +800,26 @@ export const asyncRouterMap = [
                 }
                 }
               },
               },
               {
               {
-                path: 'edit/:id/:sn/:name',
+                path: 'edit/:sn',
                 name: 'purchaseReturnOutSyncEdit',
                 name: 'purchaseReturnOutSyncEdit',
                 component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturnOutSync/edit.vue'),
                 component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturnOutSync/edit.vue'),
                 meta: {
                 meta: {
                   title: '采购退货单(不抓单)',
                   title: '采购退货单(不抓单)',
                   icon: 'money-collect',
                   icon: 'money-collect',
                   hidden: true,
                   hidden: true,
+                  replaceTab: true,
                   permission: 'B_purchaseReturn_outSnycAdd'
                   permission: 'B_purchaseReturn_outSnycAdd'
                 }
                 }
               },
               },
               {
               {
-                path: 'edit/:id/:sn/:name',
+                path: 'edit/:sn',
                 name: 'purchaseReturnOutSyncGrapEdit',
                 name: 'purchaseReturnOutSyncGrapEdit',
                 component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturnOutSync/grapEdit.vue'),
                 component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturnOutSync/grapEdit.vue'),
                 meta: {
                 meta: {
                   title: '采购退货单(抓单)',
                   title: '采购退货单(抓单)',
                   icon: 'money-collect',
                   icon: 'money-collect',
                   hidden: true,
                   hidden: true,
+                  replaceTab: true,
                   permission: 'B_purchaseReturn_outSnycEdit'
                   permission: 'B_purchaseReturn_outSnycEdit'
                 }
                 }
               },
               },
@@ -829,6 +831,7 @@ export const asyncRouterMap = [
                   title: '采购退货详情',
                   title: '采购退货详情',
                   icon: 'money-collect',
                   icon: 'money-collect',
                   hidden: true,
                   hidden: true,
+                  replaceTab: true,
                   permission: 'B_purchaseReturn_outSnycDetail'
                   permission: 'B_purchaseReturn_outSnycDetail'
                 }
                 }
               }
               }

+ 1 - 1
src/views/numsGoodsShelves/replenishmentManagement/list.vue

@@ -30,7 +30,7 @@
             </template>
             </template>
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
               <span class="table-page-search-submitButtons">
               <span class="table-page-search-submitButtons">
-                <!-- <a-button type="info" style="margin-left: 5px" @click="taskIn" :disabled="disabled" >定时任务</a-button> -->
+                <a-button type="info" style="margin-left: 5px" v-if="process.env.NODE_ENV!='production'" @click="taskIn" :disabled="disabled" >定时任务</a-button>
                 <a-button type="primary" style="margin-left: 5px" @click="queryByTypeSum" :disabled="disabled" id="replenishmentManagementList-refresh">查询</a-button>
                 <a-button type="primary" style="margin-left: 5px" @click="queryByTypeSum" :disabled="disabled" id="replenishmentManagementList-refresh">查询</a-button>
                 <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="replenishmentManagementList-reset">重置</a-button>
                 <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="replenishmentManagementList-reset">重置</a-button>
                 <a @click="advanced = !advanced" style="margin-left: 5px">
                 <a @click="advanced = !advanced" style="margin-left: 5px">

+ 5 - 0
src/views/purchasingManagement/purchaseReturnOutSync/basicInfoModal.vue

@@ -33,6 +33,7 @@
             showType="radio"
             showType="radio"
             id="purchaseOrder-grabFlag"
             id="purchaseOrder-grabFlag"
             v-model="form.grabFlag"
             v-model="form.grabFlag"
+            @change="changeGrabFlag"
             allowClear
             allowClear
             placeholder="请选择"></v-select>
             placeholder="请选择"></v-select>
         </a-form-model-item>
         </a-form-model-item>
@@ -91,11 +92,15 @@ export default {
     this.getParentDealer()
     this.getParentDealer()
   },
   },
   methods: {
   methods: {
+    changeGrabFlag (e) {
+      console.log(e)
+    },
     resetForm () {
     resetForm () {
       this.$refs.ruleForm.resetFields()
       this.$refs.ruleForm.resetFields()
       this.form.returnTargetType = ''
       this.form.returnTargetType = ''
       this.form.returnTargetSn = undefined
       this.form.returnTargetSn = undefined
       this.form.returnTargetName = ''
       this.form.returnTargetName = ''
+      this.form.grabFlag = '1'
     },
     },
     // 供应商change
     // 供应商change
     tragetTypeChange (e) {
     tragetTypeChange (e) {

+ 18 - 16
src/views/purchasingManagement/purchaseReturnOutSync/detail.vue

@@ -23,13 +23,15 @@
         <a-collapse :activeKey="['1']">
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1" header="基础信息">
           <a-collapse-panel key="1" header="基础信息">
             <a-descriptions :column="3">
             <a-descriptions :column="3">
-              <a-descriptions-item label="客户名称">{{ basicInfoData&&basicInfoData.returnTargetName || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="供应商">{{ basicInfoData&&basicInfoData.returnTargetName || '--' }}</a-descriptions-item>
               <a-descriptions-item label="采退单号">{{ basicInfoData&&basicInfoData.purchaseReturnNo || '--' }}</a-descriptions-item>
               <a-descriptions-item label="采退单号">{{ basicInfoData&&basicInfoData.purchaseReturnNo || '--' }}</a-descriptions-item>
               <a-descriptions-item label="创建时间">{{ basicInfoData&&basicInfoData.createDate || '--' }}</a-descriptions-item>
               <a-descriptions-item label="创建时间">{{ basicInfoData&&basicInfoData.createDate || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="退货数量">{{ basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0) ? basicInfoData.totalQty : '--' }}</a-descriptions-item>
-              <a-descriptions-item label="坏件数量">{{ basicInfoData&&(basicInfoData.totalBadQty || basicInfoData.totalBadQty == 0) ? basicInfoData.totalBadQty : '--' }}</a-descriptions-item>
-              <a-descriptions-item label="返库数量">{{ basicInfoData&&(basicInfoData.totalBackStockQty || basicInfoData.totalBackStockQty == 0) ? basicInfoData.totalBackStockQty : '--' }}</a-descriptions-item>
-              <a-descriptions-item label="退货金额">{{ basicInfoData&&(basicInfoData.totalAmount || basicInfoData.totalAmount == 0) ? basicInfoData.totalAmount : '--' }}</a-descriptions-item>
+              <a-descriptions-item label="产品款数">{{ basicInfoData&&(basicInfoData.totalCategory || basicInfoData.totalCategory == 0) ? basicInfoData.totalCategory : '--' }}</a-descriptions-item>
+              <a-descriptions-item label="总数量">{{ basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0) ? basicInfoData.totalQty : '--' }}</a-descriptions-item>
+              <a-descriptions-item label="总金额">{{ basicInfoData&&(basicInfoData.totalAmount || basicInfoData.totalAmount == 0) ? basicInfoData.totalAmount : '--' }}</a-descriptions-item>
+              <a-descriptions-item label="是否抓单">{{ basicInfoData&&(basicInfoData.grabFlag) ? ['不抓单','抓单'][basicInfoData.grabFlag] : '--' }}</a-descriptions-item>
+              <a-descriptions-item label="出库时间">{{ basicInfoData&&(basicInfoData.outStockTime || basicInfoData.outStockTime == 0) ? basicInfoData.outStockTime : '--' }}</a-descriptions-item>
+              <a-descriptions-item label="业务状态">{{ basicInfoData&&(basicInfoData.stateDictValue) ? basicInfoData.stateDictValue : '--' }}</a-descriptions-item>
             </a-descriptions>
             </a-descriptions>
           </a-collapse-panel>
           </a-collapse-panel>
         </a-collapse>
         </a-collapse>
@@ -48,6 +50,10 @@
               :data="loadData"
               :data="loadData"
               :defaultLoadData="false"
               :defaultLoadData="false"
               bordered>
               bordered>
+              <!-- 退货金额合计 amount-->
+              <template slot="amount" slot-scope="text, record">
+                {{ (record.cost * record.qty).toFixed(2) }}
+              </template>
             </s-table>
             </s-table>
           </a-collapse-panel>
           </a-collapse-panel>
         </a-collapse>
         </a-collapse>
@@ -78,17 +84,13 @@ export default {
       spinning: false,
       spinning: false,
       // 表头
       // 表头
       columns: [
       columns: [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '采购单号', dataIndex: 'purchaseBillNo', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { 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.code', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '14%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '售价', dataIndex: 'cost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '坏件数量', dataIndex: 'badQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '返库数量', dataIndex: 'backStockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '退货金额小计', dataIndex: 'purchaseReturnAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货原因', dataIndex: 'remarks', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+        { 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' }
       ],
       ],
       dataSource: [],
       dataSource: [],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
@@ -135,7 +137,7 @@ export default {
     },
     },
     //  返回列表
     //  返回列表
     handleBack () {
     handleBack () {
-      this.$router.push({ path: '/purchasingManagement/purchaseReturn/list' })
+      this.$router.push({ name: 'purchaseReturnOutSyncList' })
     },
     },
     // 基本信息
     // 基本信息
     getDetail () {
     getDetail () {

+ 130 - 59
src/views/purchasingManagement/purchaseReturnOutSync/edit.vue

@@ -5,7 +5,7 @@
         <!-- 自定义的二级文字标题 -->
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
         <template slot="subTitle">
           <a id="purchaseReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
           <a id="purchaseReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin: 0 15px;color: #666;">供应商名称:{{ $route.params.name || '--' }}</span>
+          <span style="margin: 0 15px;color: #666;" v-if="detailData">供应商名称:{{ detailData.returnTargetName || '--' }}</span>
         </template>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_purchaseReturnPrint')">
         <template slot="extra" v-if="$hasPermissions('B_purchaseReturnPrint')">
@@ -20,24 +20,33 @@
             <div class="table-page-search-wrapper">
             <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.table.refresh(true)">
                 <a-row :gutter="15">
                 <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-col :md="6" :sm="24">
                     <a-form-item label="产品编码" prop="productCode">
                     <a-form-item label="产品编码" prop="productCode">
-                      <a-input id="purchaseReturnEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                      <a-input id="bulkReturnGoodsEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
                     </a-form-item>
                     </a-form-item>
                   </a-col>
                   </a-col>
                   <a-col :md="6" :sm="24">
                   <a-col :md="6" :sm="24">
                     <a-form-item label="产品名称" prop="productName">
                     <a-form-item label="产品名称" prop="productName">
-                      <a-input id="purchaseReturnEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
+                      <a-input id="bulkReturnGoodsEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
                     </a-form-item>
                     </a-form-item>
                   </a-col>
                   </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-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-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-col>
                 </a-row>
                 </a-row>
               </a-form>
               </a-form>
@@ -54,15 +63,6 @@
               :pageSize="10"
               :pageSize="10"
               :scroll="{ y: 149 }"
               :scroll="{ y: 149 }"
               bordered>
               bordered>
-              <!-- 自定义表头 -->
-              <template slot="refundableQtyTitle">
-                <a-tooltip placement="top">
-                  <template slot="title">
-                    <span>同一个采购单,可多次退货,所以可退数量=采购数量-已退货数量</span>
-                  </template>
-                  可退数量<a-icon type="question-circle" :style="{ marginLeft: '3px' }" />
-                </a-tooltip>
-              </template>
               <!-- 数量 -->
               <!-- 数量 -->
               <template slot="returnQty" slot-scope="text, record">
               <template slot="returnQty" slot-scope="text, record">
                 <a-input-number
                 <a-input-number
@@ -75,6 +75,18 @@
                   placeholder="请输入"
                   placeholder="请输入"
                   style="width: 100%;" />
                   style="width: 100%;" />
               </template>
               </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">
               <template slot="action" slot-scope="text, record">
                 <span v-if="record.refundableQty==0">--</span>
                 <span v-if="record.refundableQty==0">--</span>
@@ -104,6 +116,40 @@
                 @click.stop="handleDel('', 'all')"
                 @click.stop="handleDel('', 'all')"
                 style="margin-right: 10px;float: right;">整单删除</a-button>
                 style="margin-right: 10px;float: right;">整单删除</a-button>
             </template>
             </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
             <s-table
               class="sTable"
               class="sTable"
@@ -124,19 +170,22 @@
                   v-model="record.qty"
                   v-model="record.qty"
                   :precision="0"
                   :precision="0"
                   :min="1"
                   :min="1"
+                  :max="record.refundableQty"
                   placeholder="请输入"
                   placeholder="请输入"
                   @blur="e => qtyBlur(e.target.value, record)"
                   @blur="e => qtyBlur(e.target.value, record)"
                   style="width: 100%;" />
                   style="width: 100%;" />
               </template>
               </template>
-              <!-- 退货原因 -->
-              <template slot="remarks" slot-scope="text, record">
-                <a-input
+              <!-- 退货单价 -->
+              <template slot="price" slot-scope="text, record">
+                <a-input-number
                   size="small"
                   size="small"
-                  id="purchaseReturnEdit-remarks"
-                  v-model.trim="record.remarks"
-                  :maxLength="30"
-                  placeholder="退货原因(最多30个字符)"
-                  @blur="e => remarksBlur(e.target.value, record)"
+                  id="purchaseReturnEdit-cost"
+                  v-model="record.cost"
+                  :precision="2"
+                  :min="0"
+                  :max="999999"
+                  placeholder="请输入"
+                  @blur="e => costBlur(e.target.value, record)"
                   style="width: 100%;" />
                   style="width: 100%;" />
               </template>
               </template>
               <!-- 操作 -->
               <!-- 操作 -->
@@ -166,15 +215,16 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
 import Print from '@/views/common/print.vue'
 import Print from '@/views/common/print.vue'
 import { hdPrint } from '@/libs/JGPrint'
 import { hdPrint } from '@/libs/JGPrint'
+import { stockDetailProductList } from '@/api/sparePartsRet'
 import {
 import {
-  purchaseReturnPurchaseBillDetailList,
   purchaseReturnDetailList,
   purchaseReturnDetailList,
   purchaseReturnDetailSave,
   purchaseReturnDetailSave,
   purchaseReturnDetailDel,
   purchaseReturnDetailDel,
   purchaseReturnSubmit,
   purchaseReturnSubmit,
   purchaseReturnDelAll,
   purchaseReturnDelAll,
   purchaseReturnDetailPrint,
   purchaseReturnDetailPrint,
-  purchaseReturnDetailExport } from '@/api/purchaseReturn'
+  purchaseReturnDetailExport,
+  purchaseReturnDetailSn } from '@/api/purchaseReturn'
 export default {
 export default {
   name: 'PurchaseReturnEdit',
   name: 'PurchaseReturnEdit',
   components: { STable, VSelect, Print },
   components: { STable, VSelect, Print },
@@ -182,6 +232,7 @@ export default {
   data () {
   data () {
     return {
     return {
       spinning: false,
       spinning: false,
+      detailData: null,
       queryParam: {
       queryParam: {
         purchaseBillNo: '',
         purchaseBillNo: '',
         productCode: '',
         productCode: '',
@@ -193,27 +244,26 @@ export default {
       // 表头
       // 表头
       columns: [
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '采购单号', dataIndex: 'purchaseBillNo', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '采购总数', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { slots: { title: 'refundableQtyTitle' }, dataIndex: 'refundableQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '库存数量', dataIndex: 'stock.currentStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '缺货数量', dataIndex: 'cancelQty', width: '7%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '19%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '19%', align: 'left', 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: 'currentQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '8%', align: 'center' },
         { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '8%', align: 'center' },
         { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '8%', align: 'center' },
-        { title: '采购价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.disabled = true
         this.disabled = true
-        return purchaseReturnPurchaseBillDetailList(Object.assign(parameter, this.queryParam)).then(res => {
+        return stockDetailProductList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
             data.list[i].no = no + i + 1
           }
           }
+          this.dataSource = data.list
           this.disabled = false
           this.disabled = false
           return data
           return data
         })
         })
@@ -224,11 +274,10 @@ export default {
         { title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { 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.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.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '采购总数', dataIndex: 'purchaseBillQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货数量', scopedSlots: { customRender: 'qty' }, width: '10%', align: 'center' },
-        { title: '采购价', dataIndex: 'cost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '退货原因', scopedSlots: { customRender: 'remarks' }, width: '15%', align: 'center' },
+        { 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' }
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
@@ -239,8 +288,8 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
             data.list[i].no = no + i + 1
             data.list[i].qtyBackups = data.list[i].qty
             data.list[i].qtyBackups = data.list[i].qty
-            data.list[i].remarksBackups = data.list[i].remarks
-            data.list[i].refundableQty = data.list[i].purchaseBillRefundableQty + data.list[i].qty
+            data.list[i].costBackups = data.list[i].cost
+            data.list[i].refundableQty = data.list[i].purchaseBillRefundableQty
           }
           }
           this.dataSource = data.list
           this.dataSource = data.list
           return data
           return data
@@ -273,10 +322,15 @@ export default {
     //  添加/编辑
     //  添加/编辑
     handleAdd (row, isEdit) {
     handleAdd (row, isEdit) {
       // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
       // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
+      if (!isEdit && !row.returnPrice) {
+        this.$message.warning('请输入退货价格')
+        return
+      }
       if (!isEdit && !row.returnQty) {
       if (!isEdit && !row.returnQty) {
         this.$message.warning('请输入退货数量')
         this.$message.warning('请输入退货数量')
         return
         return
       }
       }
+
       const params = {
       const params = {
         id: isEdit ? row.id : undefined,
         id: isEdit ? row.id : undefined,
         purchaseReturnSn: this.$route.params.sn,
         purchaseReturnSn: this.$route.params.sn,
@@ -285,7 +339,16 @@ export default {
         purchaseBillDetailSn: row.purchaseBillDetailSn,
         purchaseBillDetailSn: row.purchaseBillDetailSn,
         qty: isEdit ? row.qty : row.returnQty, //  退货数量
         qty: isEdit ? row.qty : row.returnQty, //  退货数量
         productSn: row.productSn,
         productSn: row.productSn,
-        cost: row.price,
+        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,
+        cost: isEdit ? row.cost : row.returnPrice,
         remarks: row.remarks,
         remarks: row.remarks,
         promotionFlag: row.promotionFlag
         promotionFlag: row.promotionFlag
       }
       }
@@ -295,13 +358,17 @@ export default {
           row.qty = row.qtyBackups
           row.qty = row.qtyBackups
           return
           return
         }
         }
+        if (!row.cost) {
+          row.cost = row.costBackups
+          return
+        }
       }
       }
       this.spinning = true
       this.spinning = true
       purchaseReturnDetailSave(params).then(res => {
       purchaseReturnDetailSave(params).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           this.$message.success(res.message)
           this.$message.success(res.message)
-          // this.$refs.table.refresh()
           this.$refs.chooseTable.refresh()
           this.$refs.chooseTable.refresh()
+          this.getDetail(true)
           this.spinning = false
           this.spinning = false
         } else {
         } else {
           this.spinning = false
           this.spinning = false
@@ -361,7 +428,7 @@ export default {
     handleSubmit () {
     handleSubmit () {
       const _this = this
       const _this = this
       _this.spinning = true
       _this.spinning = true
-      purchaseReturnSubmit({ id: this.$route.params.id }).then(res => {
+      purchaseReturnSubmit({ id: this.detailData.id }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           this.$message.success(res.message)
           this.$message.success(res.message)
           setTimeout(() => {
           setTimeout(() => {
@@ -375,7 +442,7 @@ export default {
     },
     },
     //  返回列表
     //  返回列表
     handleBack () {
     handleBack () {
-      this.$router.push({ path: '/purchasingManagement/purchaseReturn/list' })
+      this.$router.push({ name: 'purchaseReturnOutSyncList' })
     },
     },
     // 已选产品 退货数量  blur
     // 已选产品 退货数量  blur
     qtyBlur (val, record) {
     qtyBlur (val, record) {
@@ -384,29 +451,33 @@ export default {
         this.handleAdd(record, 'edit')
         this.handleAdd(record, 'edit')
       }
       }
     },
     },
-    // 已选产品 退货原因  blur
-    remarksBlur (val, record) {
-      if (val && (val != record.remarksBackups)) {
+    // 已选产品 退货单价  blur
+    costBlur (val, record) {
+      if (val && (val != record.costBackups)) {
         this.handleAdd(record, 'edit')
         this.handleAdd(record, 'edit')
       }
       }
     },
     },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
+    // 获取详情
+    getDetail (type) {
+      purchaseReturnDetailSn({ sn: this.$route.params.sn }).then(res => {
+        this.detailData = res.data || null
+        if (!type) {
+          this.resetSearchForm()
+        }
+      })
     }
     }
   },
   },
   mounted () {
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.$refs.chooseTable.refresh(true)
       this.$refs.chooseTable.refresh(true)
-      this.resetSearchForm()
+      this.getDetail()
     }
     }
   },
   },
   activated () {
   activated () {
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
       this.$refs.chooseTable.refresh(true)
       this.$refs.chooseTable.refresh(true)
-      this.resetSearchForm()
+      this.getDetail()
     }
     }
   },
   },
   beforeRouteEnter (to, from, next) {
   beforeRouteEnter (to, from, next) {

+ 65 - 42
src/views/purchasingManagement/purchaseReturnOutSync/grapEdit.vue

@@ -5,7 +5,7 @@
         <!-- 自定义的二级文字标题 -->
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
         <template slot="subTitle">
           <a id="purchaseReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
           <a id="purchaseReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin: 0 15px;color: #666;">供应商名称:{{ $route.params.name || '--' }}</span>
+          <span style="margin: 0 15px;color: #666;" v-if="detailData">供应商名称:{{ detailData.returnTargetName || '--' }}</span>
         </template>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_purchaseReturnPrint')">
         <template slot="extra" v-if="$hasPermissions('B_purchaseReturnPrint')">
@@ -54,15 +54,6 @@
               :pageSize="10"
               :pageSize="10"
               :scroll="{ y: 149 }"
               :scroll="{ y: 149 }"
               bordered>
               bordered>
-              <!-- 自定义表头 -->
-              <template slot="refundableQtyTitle">
-                <a-tooltip placement="top">
-                  <template slot="title">
-                    <span>同一个采购单,可多次退货,所以可退数量=采购数量-已退货数量</span>
-                  </template>
-                  可退数量<a-icon type="question-circle" :style="{ marginLeft: '3px' }" />
-                </a-tooltip>
-              </template>
               <!-- 数量 -->
               <!-- 数量 -->
               <template slot="returnQty" slot-scope="text, record">
               <template slot="returnQty" slot-scope="text, record">
                 <a-input-number
                 <a-input-number
@@ -75,6 +66,18 @@
                   placeholder="请输入"
                   placeholder="请输入"
                   style="width: 100%;" />
                   style="width: 100%;" />
               </template>
               </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">
               <template slot="action" slot-scope="text, record">
                 <span v-if="record.refundableQty==0">--</span>
                 <span v-if="record.refundableQty==0">--</span>
@@ -124,21 +127,28 @@
                   v-model="record.qty"
                   v-model="record.qty"
                   :precision="0"
                   :precision="0"
                   :min="1"
                   :min="1"
+                  :max="record.refundableQty"
                   placeholder="请输入"
                   placeholder="请输入"
                   @blur="e => qtyBlur(e.target.value, record)"
                   @blur="e => qtyBlur(e.target.value, record)"
                   style="width: 100%;" />
                   style="width: 100%;" />
               </template>
               </template>
-              <!-- 退货原因 -->
-              <template slot="remarks" slot-scope="text, record">
-                <a-input
+              <!-- 退货单价 -->
+              <template slot="price" slot-scope="text, record">
+                <a-input-number
                   size="small"
                   size="small"
-                  id="purchaseReturnEdit-remarks"
-                  v-model.trim="record.remarks"
-                  :maxLength="30"
-                  placeholder="退货原因(最多30个字符)"
-                  @blur="e => remarksBlur(e.target.value, record)"
+                  id="purchaseReturnEdit-cost"
+                  v-model="record.cost"
+                  :precision="2"
+                  :min="0"
+                  :max="999999"
+                  placeholder="请输入"
+                  @blur="e => costBlur(e.target.value, record)"
                   style="width: 100%;" />
                   style="width: 100%;" />
               </template>
               </template>
+              <!-- 退货金额合计 amount-->
+              <template slot="amount" slot-scope="text, record">
+                {{ (record.cost * record.qty).toFixed(2) }}
+              </template>
               <!-- 操作 -->
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
               <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>
                 <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="purchaseReturnEdit-del-btn">删除</a-button>
@@ -174,7 +184,8 @@ import {
   purchaseReturnSubmit,
   purchaseReturnSubmit,
   purchaseReturnDelAll,
   purchaseReturnDelAll,
   purchaseReturnDetailPrint,
   purchaseReturnDetailPrint,
-  purchaseReturnDetailExport } from '@/api/purchaseReturn'
+  purchaseReturnDetailExport,
+  purchaseReturnDetailSn } from '@/api/purchaseReturn'
 export default {
 export default {
   name: 'PurchaseReturnEdit',
   name: 'PurchaseReturnEdit',
   components: { STable, VSelect, Print },
   components: { STable, VSelect, Print },
@@ -182,6 +193,7 @@ export default {
   data () {
   data () {
     return {
     return {
       spinning: false,
       spinning: false,
+      detailData: null,
       queryParam: {
       queryParam: {
         purchaseBillNo: '',
         purchaseBillNo: '',
         productCode: '',
         productCode: '',
@@ -196,18 +208,20 @@ export default {
         { title: '采购单号', dataIndex: 'purchaseBillNo', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '采购单号', dataIndex: 'purchaseBillNo', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '采购总数', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { slots: { title: 'refundableQtyTitle' }, dataIndex: 'refundableQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购价格', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购数量', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        // { title: '已退数量', dataIndex: 'refundableQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '可退数量', dataIndex: 'refundableQty', width: '7%', align: 'center' },
         { title: '库存数量', dataIndex: 'stock.currentStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '库存数量', dataIndex: 'stock.currentStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '缺货数量', dataIndex: 'cancelQty', width: '7%', align: 'center' },
-        { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '8%', align: 'center' },
-        { title: '采购价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '8%', align: 'center' },
+        { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '8%', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.disabled = true
         this.disabled = true
+        this.queryParam.returnTargetType = this.detailData.returnTargetType
         return purchaseReturnPurchaseBillNoSyncList(Object.assign(parameter, this.queryParam)).then(res => {
         return purchaseReturnPurchaseBillNoSyncList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           const no = (data.pageNo - 1) * data.pageSize
@@ -224,11 +238,10 @@ export default {
         { title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { 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.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.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '采购总数', dataIndex: 'purchaseBillQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货数量', scopedSlots: { customRender: 'qty' }, width: '10%', align: 'center' },
-        { title: '采购价', dataIndex: 'cost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '退货原因', scopedSlots: { customRender: 'remarks' }, width: '15%', align: 'center' },
+        { 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' }
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
@@ -239,8 +252,8 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
             data.list[i].no = no + i + 1
             data.list[i].qtyBackups = data.list[i].qty
             data.list[i].qtyBackups = data.list[i].qty
-            data.list[i].remarksBackups = data.list[i].remarks
-            data.list[i].refundableQty = data.list[i].purchaseBillRefundableQty + data.list[i].qty
+            data.list[i].costBackups = data.list[i].cost
+            data.list[i].refundableQty = data.list[i].purchaseBillRefundableQty
           }
           }
           this.dataSource = data.list
           this.dataSource = data.list
           return data
           return data
@@ -273,6 +286,10 @@ export default {
     //  添加/编辑
     //  添加/编辑
     handleAdd (row, isEdit) {
     handleAdd (row, isEdit) {
       // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
       // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
+      if (!isEdit && !row.returnPrice) {
+        this.$message.warning('请输入退货价格')
+        return
+      }
       if (!isEdit && !row.returnQty) {
       if (!isEdit && !row.returnQty) {
         this.$message.warning('请输入退货数量')
         this.$message.warning('请输入退货数量')
         return
         return
@@ -285,7 +302,7 @@ export default {
         purchaseBillDetailSn: row.purchaseBillDetailSn,
         purchaseBillDetailSn: row.purchaseBillDetailSn,
         qty: isEdit ? row.qty : row.returnQty, //  退货数量
         qty: isEdit ? row.qty : row.returnQty, //  退货数量
         productSn: row.productSn,
         productSn: row.productSn,
-        cost: row.price,
+        cost: isEdit ? row.cost : row.returnPrice,
         remarks: row.remarks,
         remarks: row.remarks,
         promotionFlag: row.promotionFlag
         promotionFlag: row.promotionFlag
       }
       }
@@ -295,6 +312,10 @@ export default {
           row.qty = row.qtyBackups
           row.qty = row.qtyBackups
           return
           return
         }
         }
+        if (!row.cost) {
+          row.cost = row.costBackups
+          return
+        }
       }
       }
       this.spinning = true
       this.spinning = true
       purchaseReturnDetailSave(params).then(res => {
       purchaseReturnDetailSave(params).then(res => {
@@ -361,7 +382,7 @@ export default {
     handleSubmit () {
     handleSubmit () {
       const _this = this
       const _this = this
       _this.spinning = true
       _this.spinning = true
-      purchaseReturnSubmit({ id: this.$route.params.id }).then(res => {
+      purchaseReturnSubmit({ id: _this.detailData.id }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           this.$message.success(res.message)
           this.$message.success(res.message)
           setTimeout(() => {
           setTimeout(() => {
@@ -375,7 +396,7 @@ export default {
     },
     },
     //  返回列表
     //  返回列表
     handleBack () {
     handleBack () {
-      this.$router.push({ path: '/purchasingManagement/purchaseReturn/list' })
+      this.$router.push({ name: 'purchaseReturnOutSyncList' })
     },
     },
     // 已选产品 退货数量  blur
     // 已选产品 退货数量  blur
     qtyBlur (val, record) {
     qtyBlur (val, record) {
@@ -384,29 +405,31 @@ export default {
         this.handleAdd(record, 'edit')
         this.handleAdd(record, 'edit')
       }
       }
     },
     },
-    // 已选产品 退货原因  blur
-    remarksBlur (val, record) {
-      if (val && (val != record.remarksBackups)) {
+    // 已选产品 退货单价  blur
+    costBlur (val, record) {
+      if (val && (val != record.costBackups)) {
         this.handleAdd(record, 'edit')
         this.handleAdd(record, 'edit')
       }
       }
     },
     },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
+    // 获取详情
+    getDetail () {
+      purchaseReturnDetailSn({ sn: this.$route.params.sn }).then(res => {
+        this.detailData = res.data || null
+        this.resetSearchForm()
+      })
     }
     }
   },
   },
   mounted () {
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.$refs.chooseTable.refresh(true)
       this.$refs.chooseTable.refresh(true)
-      this.resetSearchForm()
+      this.getDetail()
     }
     }
   },
   },
   activated () {
   activated () {
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
       this.$refs.chooseTable.refresh(true)
       this.$refs.chooseTable.refresh(true)
-      this.resetSearchForm()
+      this.getDetail()
     }
     }
   },
   },
   beforeRouteEnter (to, from, next) {
   beforeRouteEnter (to, from, next) {

+ 17 - 15
src/views/purchasingManagement/purchaseReturnOutSync/list.vue

@@ -17,7 +17,7 @@
             </a-col>
             </a-col>
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
               <a-form-item label="供应商">
               <a-form-item label="供应商">
-                <a-select v-model="queryParam.purchaseTargetSn" placeholder="请选择供应商">
+                <a-select v-model="queryParam.returnTargetSn" placeholder="请选择供应商">
                   <a-select-option v-for="item in purchaseTragetType" :key="item.purchaseTargetSn" :value="item.purchaseTargetSn">
                   <a-select-option v-for="item in purchaseTragetType" :key="item.purchaseTargetSn" :value="item.purchaseTargetSn">
                     {{ item.purchaseTargetName }}
                     {{ item.purchaseTargetName }}
                   </a-select-option>
                   </a-select-option>
@@ -94,12 +94,12 @@
         </template>
         </template>
         <!-- 审核 -->
         <!-- 审核 -->
         <template slot="audit" slot-scope="text, record">
         <template slot="audit" slot-scope="text, record">
-          <stateIcon :title="record.stateDictValue" v-if="record.state!='AUDIT_REJECT'" :state="record.state == 'WAIT_BACK'||record.state=='CHECKED'||record.state == 'FINISH'?'1':'2'"></stateIcon>
+          <stateIcon :title="record.stateDictValue" v-if="record.state!='AUDIT_REJECT'" :state="record.state=='WAIT_OUT_WAREHOUSE'||record.state == 'FINISH'?'1':'2'"></stateIcon>
           <stateIcon :title="record.stateDictValue" v-else :state="0"></stateIcon>
           <stateIcon :title="record.stateDictValue" v-else :state="0"></stateIcon>
         </template>
         </template>
         <!-- 出库 -->
         <!-- 出库 -->
         <template slot="waitOut" slot-scope="text, record">
         <template slot="waitOut" slot-scope="text, record">
-          <stateIcon :state="record.hasStockBill == '1'?'1':'2'"></stateIcon>
+          <stateIcon :state="record.state == 'FINISH'?'1':'2'"></stateIcon>
         </template>
         </template>
         <!-- 收款 -->
         <!-- 收款 -->
         <template slot="financial" slot-scope="text, record">
         <template slot="financial" slot-scope="text, record">
@@ -117,14 +117,14 @@
           <a-button
           <a-button
             size="small"
             size="small"
             type="link"
             type="link"
-            v-if="record.state == 'CHECKED' && $hasPermissions('B_purchaseReturn_outSnycAudit')"
+            v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_purchaseReturn_outSnycAudit')"
             @click="handleAudit(record)"
             @click="handleAudit(record)"
             class="button-primary"
             class="button-primary"
             id="bulkReturnGoodsList-audit-btn">审核</a-button>
             id="bulkReturnGoodsList-audit-btn">审核</a-button>
           <a-button
           <a-button
             size="small"
             size="small"
             type="link"
             type="link"
-            v-if="record.state == 'CHECKED' && $hasPermissions('B_purchaseReturn_outSnycOut')"
+            v-if="record.state == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_purchaseReturn_outSnycOut')"
             @click="handleWarehouse(record)"
             @click="handleWarehouse(record)"
             class="button-primary"
             class="button-primary"
             id="bulkReturnGoodsList-out-btn">出库</a-button>
             id="bulkReturnGoodsList-out-btn">出库</a-button>
@@ -135,7 +135,7 @@
             v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'AUDIT_REJECT') && $hasPermissions('B_purchaseReturn_outSnycDel')"
             v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'AUDIT_REJECT') && $hasPermissions('B_purchaseReturn_outSnycDel')"
             @click="handleDel(record)"
             @click="handleDel(record)"
             id="purchaseReturnList-del-btn">删除</a-button>
             id="purchaseReturnList-del-btn">删除</a-button>
-          <span v-if="!((record.state == 'WAIT_SUBMIT' || record.state == 'AUDIT_REJECT') && ($hasPermissions('B_purchaseReturn_outSnycEdit') || $hasPermissions('B_purchaseReturn_outSnycDel'))) && !(record.state == 'CHECKED' && ($hasPermissions('B_purchaseReturn_outSnycOut') || $hasPermissions('B_purchaseReturn_outSnycAudit')))">--</span>
+          <span v-if="record.state == 'FINISH'||!($hasPermissions('B_purchaseReturn_outSnycEdit') || $hasPermissions('B_purchaseReturn_outSnycDel')||$hasPermissions('B_purchaseReturn_outSnycOut')||$hasPermissions('B_purchaseReturn_outSnycAudit'))">--</span>
         </template>
         </template>
       </s-table>
       </s-table>
     </a-spin>
     </a-spin>
@@ -183,7 +183,7 @@ export default {
         purchaseReturnNo: '', //  退货单号
         purchaseReturnNo: '', //  退货单号
         state: undefined, //  业务状态
         state: undefined, //  业务状态
         settleState: undefined,
         settleState: undefined,
-        purchaseTargetSn: undefined,
+        returnTargetSn: undefined,
         grabFlag: undefined
         grabFlag: undefined
       },
       },
       disabled: false, //  查询、重置按钮是否可操作
       disabled: false, //  查询、重置按钮是否可操作
@@ -192,10 +192,12 @@ export default {
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '创建时间', dataIndex: 'createDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '采退单号', scopedSlots: { customRender: 'purchaseReturnNo' }, width: '17%', align: 'center' },
         { title: '采退单号', scopedSlots: { customRender: 'purchaseReturnNo' }, width: '17%', align: 'center' },
-        { title: '退货数量', dataIndex: 'totalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退款金额', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '客服审核时间', dataIndex: 'auditTime', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '扣减库存', dataIndex: 'hasStockBill', width: '6%', align: 'center', customRender: function (text) { return ['否', '是'][text] } },
+        { title: '供应商', dataIndex: 'returnTargetName', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品款数', dataIndex: 'totalCategory', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '总数量', dataIndex: 'totalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '总金额', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '是否抓单', dataIndex: 'grabFlag', width: '14%', align: 'center', customRender: function (text) { return text == '1' ? '抓单' : '不抓单' } },
+        { title: '出库时间', dataIndex: 'outStockTime', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
         { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
         { title: '出库', scopedSlots: { customRender: 'waitOut' }, width: '3%', align: 'center' },
         { title: '出库', scopedSlots: { customRender: 'waitOut' }, width: '3%', align: 'center' },
@@ -242,7 +244,7 @@ export default {
       this.queryParam.purchaseReturnNo = ''
       this.queryParam.purchaseReturnNo = ''
       this.queryParam.state = undefined
       this.queryParam.state = undefined
       this.queryParam.settleState = undefined
       this.queryParam.settleState = undefined
-      this.queryParam.purchaseTargetSn = undefined
+      this.queryParam.returnTargetSn = undefined
       this.queryParam.grabFlag = undefined
       this.queryParam.grabFlag = undefined
     },
     },
     // 获取供应商数据
     // 获取供应商数据
@@ -272,7 +274,7 @@ export default {
     },
     },
     // 编辑
     // 编辑
     handleEdit (row) {
     handleEdit (row) {
-      this.$router.push({ name: row.grabFlag == 1 ? 'purchaseReturnOutSyncGrapEdit' : 'purchaseReturnOutSyncEdit', params: { id: row.id, sn: row.purchaseReturnSn, name: row.returnTargetName } })
+      this.$router.push({ name: row.grabFlag == 1 ? 'purchaseReturnOutSyncGrapEdit' : 'purchaseReturnOutSyncEdit', params: { sn: row.purchaseReturnSn } })
     },
     },
     // 详情
     // 详情
     handleDetail (row) {
     handleDetail (row) {
@@ -287,7 +289,7 @@ export default {
         centered: true,
         centered: true,
         onOk () {
         onOk () {
           _this.spinning = true
           _this.spinning = true
-          purchaseReturnOutStock({ sn: row.purchaseReturnSn }).then(res => {
+          purchaseReturnOutStock({ purchaseReturnSn: row.purchaseReturnSn }).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
               _this.$refs.table.refresh()
@@ -303,7 +305,7 @@ export default {
       this.spinningAudit = true
       this.spinningAudit = true
       purchaseReturnAudit({
       purchaseReturnAudit({
         purchaseReturnSn: this.auditInfo.purchaseReturnSn,
         purchaseReturnSn: this.auditInfo.purchaseReturnSn,
-        auditFlag: billStatus
+        state: billStatus ? 'AUDIT_PASS' : 'AUDIT_REJECT'
       }).then(res => {
       }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           this.visibleAudit = false
           this.visibleAudit = false