Jelajahi Sumber

调拨退货

lilei 3 tahun lalu
induk
melakukan
e10300f597

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

@@ -1070,7 +1070,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'edit/:sn/:targetType',
+                path: 'edit/:sn/:targetType/:dealerLevel',
                 name: 'transferReturnEdit',
                 component: () => import(/* webpackChunkName: "allocationManagement" */ '@/views/allocationManagement/transferReturn/edit.vue'),
                 meta: {
@@ -1092,7 +1092,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'check/:sn/:grapFlag',
+                path: 'check/:sn/:grabFlag',
                 name: 'transferReturnCheck',
                 component: () => import(/* webpackChunkName: "allocationManagement" */ '@/views/allocationManagement/transferReturn/check.vue'),
                 meta: {

+ 10 - 0
src/views/allocationManagement/transferOut/basicInfoModal.vue

@@ -233,6 +233,16 @@ export default {
       if (!newValue) {
         this.$emit('close')
         this.$refs.ruleForm.resetFields()
+        this.form = {
+          targetType: 'DEALER',
+          targetSn: undefined,
+          targetName: '',
+          allocateTypeSn: undefined,
+          time: [],
+          promoStartDate: '',
+          promoEndDate: '',
+          remark: ''
+        }
       } else {
         this.getTargetTypeList()
         this.getAllocateTypeAllList()

+ 4 - 3
src/views/allocationManagement/transferOut/detail.vue

@@ -18,22 +18,23 @@
           <a-button
             key="3"
             type="primary"
-            class="button-warning"
+            class="button-info"
             v-if="$hasPermissions('B_transferOut_detail_export')"
             id="allocateBillDetail-export-btn"
             :disabled="localDataSource.length==0"
             @click="handleExcel">导出Excel</a-button>
+          <a-divider type="vertical" />
           <a-button
             key="2"
             type="primary"
-            class="button-error"
+            class="button-info"
             v-if="$hasPermissions('B_transferOut_print')"
             id="allocateBillDetail-db-print-btn"
             :disabled="localDataSource.length==0"
             @click="handlePrint('dbPrint')">调拨打印</a-button>
           <a-button
             key="1"
-            type="primary"
+            type="default"
             class="button-info"
             v-if="$hasPermissions('B_transferOut_print')"
             id="allocateBillDetail-dbfl-print-btn"

+ 6 - 5
src/views/allocationManagement/transferOut/edit.vue

@@ -12,22 +12,23 @@
           <a-button
             key="3"
             type="primary"
-            class="button-warning"
+            class="button-info"
             v-if="$hasPermissions('B_transferOut_detail_export')"
             id="allocateBillEdit-export-btn"
             :disabled="localDataSource.length==0"
             @click="handleExcel">导出Excel</a-button>
+          <a-divider type="vertical" />
           <a-button
             key="2"
             type="primary"
-            class="button-error"
+            class="button-info"
             v-if="$hasPermissions('B_transferOut_print')"
             id="allocateBillEdit-db-print-btn"
             :disabled="localDataSource.length==0"
             @click="handlePrint('dbPrint')">调拨打印</a-button>
           <a-button
             key="1"
-            type="primary"
+            type="default"
             class="button-info"
             v-if="$hasPermissions('B_transferOut_print')"
             id="allocateBillEdit-dbfl-print-btn"
@@ -100,7 +101,7 @@
               bordered>
               <!-- 操作 -->
               <template slot="action1" slot-scope="text, record">
-                <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="allocateBillEdit-add-btn">添加</a-button>
+                <a-button size="small" type="link" class="button-primary" @click="handleAdd(record)" id="allocateBillEdit-add-btn">添加</a-button>
               </template>
             </s-table>
           </a-collapse-panel>
@@ -196,7 +197,7 @@
               </template>
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
-                <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="allocateBillEdit-del-btn">删除</a-button>
+                <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="allocateBillEdit-del-btn">删除</a-button>
               </template>
             </s-table>
           </a-collapse-panel>

+ 2 - 1
src/views/allocationManagement/transferOut/list.vue

@@ -77,7 +77,8 @@
         bordered>
         <!-- 单号 -->
         <template slot="allocateNo" slot-scope="text, record">
-          <span :class="$hasPermissions('M_transferOut_detail')?'active':'common'" @click="handleDetail(record)">{{ record.allocateNo }}</span>
+          <a-button v-if="$hasPermissions('M_transferOut_detail')" size="small" type="link" class="button-info" @click="handleDetail(record)">{{ record.allocateNo }}</a-button>
+          <span v-else>{{ record.allocateNo }}</span>
         </template>
         <!-- 起止时间 -->
         <template slot="promoDate" slot-scope="text, record">

+ 2 - 2
src/views/allocationManagement/transferOut/printModal.vue

@@ -36,8 +36,8 @@
         </a-form-model-item>
       </a-form-model>
       <div class="btn-cont">
-        <a-button type="primary" id="allocateBill-print-save" @click="handleSave('preview')">打印预览</a-button>
-        <a-button id="allocateBill-print-back" @click="handleSave('print')" style="margin-left: 15px;">快捷打印</a-button>
+        <a-button id="allocateBill-print-save" @click="handleSave('preview')">打印预览</a-button>
+        <a-button type="primary" id="allocateBill-print-back" @click="handleSave('print')" style="margin-left: 15px;">快捷打印</a-button>
       </div>
     </a-spin>
   </a-modal>

+ 2 - 2
src/views/allocationManagement/transferReturn/basicInfoModal.vue

@@ -4,7 +4,7 @@
     class="allocateBill-basicInfo-modal"
     :footer="null"
     :maskClosable="false"
-    title="新增"
+    title="新增调拨退货"
     v-model="isShow"
     @cancle="isShow = false"
     :width="800">
@@ -102,7 +102,7 @@ export default {
         targetName: '',
         allocateReturnTypeSn: undefined,
         grabFlag: '1',
-        remark: ''
+        remarks: ''
       },
       rules: {
         targetType: [{ required: true, message: '请选择调往对象', trigger: 'change' }],

+ 60 - 31
src/views/allocationManagement/transferReturn/check.vue

@@ -5,12 +5,13 @@
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
           <a id="salesReturnCheck-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin: 0 15px;color: #666;">客户名称:{{ ordeDetail&&ordeDetail.buyerName || '--' }}</span>
+          <span style="margin: 0 15px;color: #666;">调拨退货对象名称:{{ ordeDetail&&ordeDetail.targetName || '--' }} ({{ ordeDetail&&ordeDetail.grabFlag==1 ? '抓单' : '不抓单' }})</span>
         </template>
       </a-page-header>
       <a-card size="small" :bordered="false" class="salesReturnCheck-cont">
         <div>
-          <a-button type="primary" :loading="loading" class="button-error" @click="backStock">批量返库</a-button>
+          <a-button type="primary" :loading="loading" class="button-info" @click="backStock">批量返库</a-button>
+          <a-button v-if="grabFlag==1" type="default" :loading="loading" class="button-info" @click="toPlBad">批量坏件</a-button>
         </div>
         <!-- 已选配件列表 -->
         <s-table
@@ -29,15 +30,16 @@
           <!-- 返库数量 -->
           <template slot="backStockQty" slot-scope="text, record">
             <a-input-number
-              id="salesReturn-backStockQty"
+              v-if="grabFlag==0"
               size="small"
               v-model="record.backStockQty"
               :precision="0"
               :min="0"
-              :max="record.qty"
+              :max="record.returnQty"
               placeholder="请输入"
               @blur="e => onCellBlur(e.target.value, record)"
               style="width: 100%;" />
+            <span v-else>{{ record.backStockQty }}</span>
           </template>
         </s-table>
       </a-card>
@@ -57,11 +59,12 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { salesReturnDetail, salesReturnCheck } from '@/api/salesReturn'
 import {
-  salesReturnDetailList,
-  updateBackStockQty
-} from '@/api/salesReturnDetail'
+  allocReturnDetailQueryPage,
+  allocateReturnQueryBySn,
+  allocReturnDetailUpdate,
+  allocateReturnCheck
+} from '@/api/allocateReturn'
 export default {
   name: 'SalesReturnEdit',
   components: {
@@ -72,9 +75,8 @@ export default {
     return {
       spinning: false,
       tableHeight: 0, // 表格高度
-      orderId: null,
       orderSn: null,
-      buyerSn: null,
+      grabFlag: null,
       disabled: false,
       isInster: false, // 是否正在添加产品
       ordeDetail: { discountAmount: 0 },
@@ -82,21 +84,23 @@ export default {
       // 已选产品
       dataSource: [],
       productForm: {
-        salesReturnBillSn: ''
+        allocateReturnSn: ''
       },
       chooseLoadData: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         // 查询总计
-        this.productForm.salesReturnBillSn = this.$route.params.sn
-        return salesReturnDetailList(Object.assign(parameter, this.productForm)).then(res => {
+        this.productForm.allocateReturnSn = this.$route.params.sn
+        return allocReturnDetailQueryPage(Object.assign(parameter, this.productForm)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              data.list[i].badQty = data.list[i].returnQty
+              data.list[i].backStockQty = data.list[i].backStockQty || 0
               data.list[i].backStockQtyBackups = data.list[i].backStockQty
             }
             this.disabled = false
@@ -112,16 +116,17 @@ export default {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '23%', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '退货数量', dataIndex: 'qty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '产品编码', dataIndex: 'product.code', align: 'center', width: '23%', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '退货数量', dataIndex: 'returnQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '坏件数量', dataIndex: 'badQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '返库数量', dataIndex: 'backStockQty', width: '10%', align: 'center', scopedSlots: { customRender: 'backStockQty' } },
-        { title: '单位', dataIndex: 'productEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
-        // { title: '售价', dataIndex: 'price', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '单位', dataIndex: 'product.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', dataIndex: 'price', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
-      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-        arr.splice(7, 0, { title: '售价', dataIndex: 'price', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      console.log(this.grabFlag)
+      if (this.grabFlag == 1) { //  抓单
+        arr.splice(1, 0, { title: '调拨单号', dataIndex: 'allocateNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } })
       }
       return arr
     }
@@ -131,9 +136,32 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
-    //  返回
+    //  返回列表
     handleBack () {
-      this.$router.push({ path: '/salesManagement/salesReturn/list', query: { closeLastOldTab: true } })
+      this.$router.push({ name: 'transferReturnList', query: { closeLastOldTab: true } })
+    },
+    // 批量坏件
+    toPlBad () {
+      const _this = this
+      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        _this.$message.warning('请先选择产品!')
+        return
+      }
+      this.$confirm({
+        title: '提示',
+        content: '确认要批量坏件吗?',
+        centered: true,
+        onOk () {
+          const obj = []
+          _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
+            obj.push({
+              allocateReturnDetailSn: item.allocateReturnDetailSn,
+              badQty: item.badQty
+            })
+          })
+          _this.submitCheck(obj)
+        }
+      })
     },
     // 批量返库
     backStock () {
@@ -150,8 +178,8 @@ export default {
           const obj = []
           _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
             obj.push({
-              salesReturnDetailSn: item.salesReturnDetailSn,
-              backStockQty: item.qty
+              allocateReturnDetailSn: item.allocateReturnDetailSn,
+              backStockQty: item.backStockQty
             })
           })
           _this.submitCheck(obj)
@@ -163,18 +191,18 @@ export default {
       //  光标移出,值发生改变再调用编辑接口
       if (val && val != record.backStockQtyBackups) {
         this.submitCheck([{
-          salesReturnDetailSn: record.salesReturnDetailSn,
+          allocateReturnDetailSn: record.allocateReturnDetailSn,
           backStockQty: record.backStockQty
         }])
       } else {
         record.backStockQty = record.backStockQtyBackups
       }
     },
-    // 品检
+    // 修改坏件或退货数量
     submitCheck (data) {
       this.loading = true
       this.spinning = true
-      updateBackStockQty(data).then(res => {
+      allocateReturnCheck(data).then(res => {
         if (res.status == 200) {
           this.resetSearchForm(true)
           this.$message.success(res.message)
@@ -189,7 +217,7 @@ export default {
     },
     // 获取单据详细
     getOrderDetail () {
-      salesReturnDetail({ sn: this.orderSn }).then(res => {
+      allocateReturnQueryBySn({ allocateReturnSn: this.orderSn }).then(res => {
         this.ordeDetail = res.data || null
       })
     },
@@ -198,10 +226,10 @@ export default {
       this.$refs.table.refresh(!!flag)
       this.getOrderDetail()
     },
-    // 提交销售单
+    // 品检
     handleSubmit () {
       this.spinning = true
-      salesReturnCheck({ salesReturnBillSn: this.orderSn }).then(res => {
+      allocateReturnCheck({ allocateReturnSn: this.orderSn }).then(res => {
         if (res.status == 200) {
           this.handleBack()
           this.$message.success(res.message)
@@ -217,7 +245,8 @@ export default {
         _this.setTableH()
       })
       this.orderSn = this.$route.params.sn
-      this.buyerSn = this.$route.params.buyerSn
+      this.grabFlag = this.$route.params.grabFlag
+      this.$refs.table.clearTable()
       this.getOrderDetail()
     },
     setTableH () {

+ 9 - 9
src/views/allocationManagement/transferReturn/detail.vue

@@ -102,18 +102,18 @@ export default {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productEntity.name', width: '27%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '单位', dataIndex: 'productEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '退货单价(¥)', dataIndex: 'cost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货数量', dataIndex: 'qty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '坏件数量', dataIndex: 'qty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '返库数量', dataIndex: 'qty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货金额(¥)', dataIndex: 'totalPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '27%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'product.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单价(¥)', dataIndex: 'price', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货数量', dataIndex: 'returnQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '坏件数量', dataIndex: 'badQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '返库数量', dataIndex: 'backStockQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货金额(¥)', dataIndex: 'totalReturnPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
 
       if (this.basicInfoData && this.basicInfoData.grabFlag == '1') {
-        arr.splice(1, 0, { title: '调拨单号', dataIndex: 'productEntity.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } })
+        arr.splice(1, 0, { title: '调拨单号', dataIndex: 'allocateReturnNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } })
       }
       return arr
     }

+ 72 - 71
src/views/allocationManagement/transferReturn/edit.vue

@@ -9,21 +9,21 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra">
-          <print :params="{allocateSn: $route.params.sn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
+          <print :params="{allocateReturnSn: $route.params.sn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
         </template>
       </a-page-header>
       <a-card size="small" :bordered="false" v-if="basicInfoData" class="allocateBillEdit-cont">
         <a-collapse :activeKey="['0']">
           <a-collapse-panel key="0" header="基础信息">
             <a-descriptions :column="3">
-              <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.allocateReturnTypeName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
               <a-descriptions-item label="调拨退货类型">
-                <AllocateType id="allocateEdit-allocateTypeSn" style="width: 200px;" @change="changeAllocateType" v-model="basicInfoData.allocateTypeSn"></AllocateType>
+                <AllocateType id="allocateEdit-allocateReturnTypeSn" style="width: 200px;" @change="changeAllocateType" v-model="basicInfoData.allocateReturnTypeSn"></AllocateType>
               </a-descriptions-item>
-              <a-descriptions-item label="是否抓单">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="是否抓单">{{ (basicInfoData&&basicInfoData.grabFlagDictValue) || '--' }}</a-descriptions-item>
               <a-descriptions-item label="备注">
-                {{ (basicInfoData&&basicInfoData.remark) || '--' }}
+                {{ (basicInfoData&&basicInfoData.remarks) }}
                 <a-icon type="form" title="编辑备注" @click="editRemark = true" style="color: dodgerblue;font-size: 14px;" />
               </a-descriptions-item>
             </a-descriptions>
@@ -110,8 +110,8 @@
             <!-- 总计 -->
             <a-alert type="info" style="margin-bottom:10px">
               <div slot="message">
-                退货总数量:<strong>{{ (productTotal&&(productTotal.totalQty || productTotal.totalQty==0)) ? productTotal.totalQty : '--' }}</strong> ,
-                <span>退货总金额(¥):<strong>{{ (productTotal&&(productTotal.totalPrice || productTotal.totalPrice==0)) ? productTotal.totalPrice : '--' }}</strong></span>
+                退货总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0)) ? basicInfoData.totalQty : '--' }}</strong> ,
+                <span v-if="$hasPermissions('B_isShowPrice')">退货总金额(¥):<strong>{{ (basicInfoData&&(basicInfoData.totalPrice || basicInfoData.totalPrice==0)) ? basicInfoData.totalPrice : '--' }}</strong></span>
               </div>
             </a-alert>
             <!-- 筛选条件 -->
@@ -122,12 +122,12 @@
                     <a-row :gutter="15">
                       <a-col :md="9" :sm="24">
                         <a-form-item label="产品编码" prop="productCode">
-                          <a-input id="allocateBillEdit-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
+                          <a-input id="editGrap-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="allocateBillEdit-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
+                          <a-input id="editGrap-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
                         </a-form-item>
                       </a-col>
                       <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
@@ -139,7 +139,7 @@
                 </div>
               </a-col>
               <a-col :span="7" style="text-align: right;">
-                <!-- <a-button size="small" id="allocateBillEdit-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
+                <!-- <a-button size="small" id="editGrap-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
                 <!-- <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button> -->
               </a-col>
             </a-row>
@@ -172,7 +172,7 @@
               <template slot="returnQty" slot-scope="text, record">
                 <a-input-number
                   size="small"
-                  v-model="record.qty"
+                  v-model="record.returnQty"
                   :precision="0"
                   :min="0"
                   :max="999999"
@@ -201,7 +201,7 @@
         style="padding: 0 60px;">提交</a-button>
     </div>
     <!-- 导入产品 -->
-    <!-- <importGuideModal :openModal="openGuideModal" :params="{allocateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" /> -->
+    <!-- <importGuideModal :openModal="openGuideModal" :params="{allocateReturnSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" /> -->
     <!-- 修改基础信息 -->
     <a-modal
       centered
@@ -214,7 +214,7 @@
       @cancle="editRemark = false"
       :width="600">
       <a-textarea
-        v-model="basicInfoData.remark"
+        v-model="basicInfoData.remarks"
         placeholder="请输入备注(最多120个字符)"
         :maxLength="120"
         :auto-size="{ minRows: 3, maxRows: 5 }"
@@ -233,7 +233,16 @@ import { STable, VSelect } from '@/components'
 import print from './print.vue'
 import { queryStockProductPage } from '@/api/stock'
 import AllocateType from '@/views/common/allocateType.js'
-import { allocateBillSave, allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillBatchInsert } from '@/api/allocateBill'
+import {
+  allocateReturnSave,
+  allocReturnDetailQueryPage,
+  allocateReturnQueryBySn,
+  allocReturnDetailInsert,
+  allocReturnDetailUpdate,
+  allocateReturnSubmit,
+  allocReturnDetailDelete
+  // allocateBillBatchInsert
+} from '@/api/allocateReturn'
 
 export default {
   components: { STable, VSelect, print, AllocateType },
@@ -283,33 +292,31 @@ export default {
       ],
       chooseColumns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '单位', dataIndex: 'productEntity.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'product.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'center' },
         { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '10%', align: 'center' },
-        { title: '退货金额', dataIndex: 'returnAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货金额', dataIndex: 'totalReturnPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: parameter => {
         this.chooseDisabled = true
-        const params = Object.assign(parameter, this.chooseQueryParam, { allocateSn: this.$route.params.sn })
-        return allocateBillDetailList(params).then(res => {
-          this.getDetailCount()
+        const params = Object.assign(parameter, { product: { name: this.chooseQueryParam.productName, code: this.chooseQueryParam.productCode }, allocateReturnSn: this.$route.params.sn })
+        return allocReturnDetailQueryPage(params).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
-            data.list[i].qtyBackups = data.list[i].qty
-            data.list[i].priceBackups = data.list[i].price
+            data.list[i].qtyBackups = data.list[i].returnQty
+            data.list[i].oldPrice = data.list[i].price
           }
           this.localDataSource = data.list || []
           this.chooseDisabled = false
           return data
         })
       },
-      productTotal: null, //  合计
       basicInfoData: null, // 基本信息
       openGuideModal: false, //  导入产品引导
       openModal: false,
@@ -321,17 +328,10 @@ export default {
     handleEditRemark () {
       const _this = this
       const params = _this.basicInfoData
-      allocateBillSave({
-        allocateSn: params.allocateSn,
-        targetType: params.targetType,
-        targetSn: params.targetSn,
-        targetName: params.targetName,
-        allocateTypeSn: params.allocateTypeSn,
-        remark: params.remark
-      }).then(res => {
+      allocateReturnSave(params).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
-          _this.getDetail()
+          _this.getDetail(true)
         } else {
           _this.spinning = false
         }
@@ -368,13 +368,13 @@ export default {
       }
     },
     // 导入产品
-    handleGuideOk (obj) {
-      allocateBillBatchInsert(obj).then(res => {
-        if (res.status == 200) {
-          this.$refs.chooseTable.refresh(true)
-        }
-      })
-    },
+    // handleGuideOk (obj) {
+    //   allocateBillBatchInsert(obj).then(res => {
+    //     if (res.status == 200) {
+    //       this.$refs.chooseTable.refresh(true)
+    //     }
+    //   })
+    // },
     // 已选产品  重置
     chooseResetSearchForm () {
       this.chooseQueryParam.productCode = ''
@@ -384,27 +384,29 @@ export default {
     //  添加/编辑
     handleAdd (row, isEdit, isRefresh) {
       const params = {
-        id: isEdit ? row.id : undefined,
-        allocateSn: this.$route.params.sn,
-        cost: isEdit ? row.cost : row.lastStockCost,
+        allocateReturnSn: this.$route.params.sn,
+        productSn: row.productSn,
         price: isEdit ? row.price : row.productPrice,
-        qty: isEdit ? row.qty : 1, //  添加时调出数量默认为1
-        productSn: row.productSn
+        returnQty: isEdit ? row.returnQty : row.qty
       }
+      const fun = isEdit ? allocReturnDetailUpdate : allocReturnDetailInsert
       if (isEdit) { // 编辑
         // 清空数量时,值应保持未清空前的值,因数量不可为空
-        if (!row.qty) {
-          row.qty = row.qtyBackups
+        if (!row.returnQty) {
+          row.returnQty = row.qtyBackups
           return
         }
         if (!row.price) {
-          row.price = row.priceBackups
+          row.price = row.oldPrice
           return
         }
+        params.oldPrice = row.oldPrice
+        params.allocateReturnDetailSn = row.allocateReturnDetailSn
       }
       this.spinning = true
-      allocateBillDetailSave(params).then(res => {
+      fun(params).then(res => {
         if (res.status == 200) {
+          this.getDetail(true)
           this.$message.success(res.message)
           if (isRefresh != 'noRefresh') {
             this.$refs.table.refresh()
@@ -426,14 +428,19 @@ export default {
         centered: true,
         onOk () {
           if (isAll) { //  整单删除
-            allocateBillDetailDelAll({ sn: _this.$route.params.sn }).then(res => {
-              if (res.status == 200) {
-                _this.$message.success(res.message)
-                _this.refashPage()
-              }
-            })
+            // allocateBillDetailDelAll({ sn: _this.$route.params.sn }).then(res => {
+            //   if (res.status == 200) {
+            //     _this.$message.success(res.message)
+            //     _this.refashPage()
+            //   }
+            // })
           } else { //  单个删除
-            allocateBillDetailDel({ id: row.id }).then(res => {
+            allocReturnDetailDelete({
+              allocateReturnSn: _this.$route.params.sn,
+              allocateDetailSn: row.allocateDetailSn,
+              price: row.price,
+              productSn: row.productSn
+            }).then(res => {
               if (res.status == 200) {
                 _this.$message.success(res.message)
                 _this.refashPage()
@@ -447,7 +454,7 @@ export default {
     handleSubmit () {
       const _this = this
       _this.spinning = true
-      allocateBillSubmit({ sn: this.$route.params.sn }).then(res => {
+      allocateReturnSubmit({ allocateReturnSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
           setTimeout(() => {
@@ -460,27 +467,20 @@ export default {
       })
     },
     // 基本信息
-    getDetail () {
+    getDetail (flag) {
       this.spinning = true
-      allocateBillDetail({ sn: this.$route.params.sn }).then(res => {
+      allocateReturnQueryBySn({ allocateReturnSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.basicInfoData = res.data
+          if (!flag) {
+            this.resetSearchForm()
+          }
         } else {
           this.basicInfoData = null
         }
         this.spinning = false
       })
     },
-    // 合计
-    getDetailCount () {
-      allocateBillDetailCount({ allocateSn: this.$route.params.sn }).then(res => {
-        if (res.status == 200) {
-          this.productTotal = res.data
-        } else {
-          this.productTotal = null
-        }
-      })
-    },
     //  返回列表
     handleBack () {
       this.$router.push({ name: 'transferReturnList', query: { closeLastOldTab: true } })
@@ -495,12 +495,13 @@ export default {
     // 已选产品 退货单价  change
     priceChange (val, record) {
       //  光标移出,值发生改变再调用编辑接口
-      if (val != record.priceBackups) {
+      if (val != record.oldPrice) {
         this.handleAdd(record, 'edit', 'noRefresh')
       }
     },
     // 刷新当前页面
     refashPage () {
+      this.getDetail(true)
       this.$refs.table.refresh()
       this.$refs.chooseTable.refresh()
     },

+ 18 - 9
src/views/allocationManagement/transferReturn/editGrp.vue

@@ -275,13 +275,13 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: parameter => {
         this.chooseDisabled = true
-        const params = Object.assign(parameter, this.chooseQueryParam, { allocateReturnSn: this.$route.params.sn })
+        const params = Object.assign(parameter, { product: { name: this.chooseQueryParam.productName, code: this.chooseQueryParam.productCode }, allocateReturnSn: this.$route.params.sn })
         return allocReturnDetailQueryPage(params).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
-            data.list[i].priceBackups = data.list[i].price
+            data.list[i].oldPrice = data.list[i].price
           }
           this.localDataSource = data.list || []
           this.chooseDisabled = false
@@ -332,7 +332,7 @@ export default {
       allocateReturnSave(params).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
-          _this.getDetail()
+          _this.getDetail(true)
         } else {
           _this.spinning = false
         }
@@ -394,14 +394,16 @@ export default {
       const fun = isEdit ? allocReturnDetailUpdate : allocReturnDetailInsert
       if (isEdit) { // 编辑
         if (!row.price) {
-          row.price = row.priceBackups
+          row.price = row.oldPrice
           return
         }
+        params.oldPrice = row.oldPrice
       }
       console.log(isEdit)
       this.spinning = true
       fun(params).then(res => {
         if (res.status == 200) {
+          this.getDetail(true)
           this.$message.success(res.message)
           if (isRefresh != 'noRefresh') {
             this.$refs.table.refresh()
@@ -410,7 +412,7 @@ export default {
           this.spinning = false
         } else {
           this.spinning = false
-          row.price = row.priceBackups
+          row.price = row.oldPrice
         }
       })
     },
@@ -431,7 +433,11 @@ export default {
             //   }
             // })
           } else { //  单个删除
-            allocReturnDetailDelete({ id: row.id }).then(res => {
+            allocReturnDetailDelete({
+              allocateReturnSn: _this.$route.params.sn,
+              allocateDetailSn: row.allocateDetailSn,
+              price: row.price,
+              productSn: row.productSn }).then(res => {
               if (res.status == 200) {
                 _this.$message.success(res.message)
                 _this.refashPage()
@@ -458,12 +464,14 @@ export default {
       })
     },
     // 基本信息
-    getDetail () {
+    getDetail (flag) {
       this.spinning = true
       allocateReturnQueryBySn({ allocateReturnSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.basicInfoData = res.data
-          this.resetSearchForm()
+          if (!flag) {
+            this.resetSearchForm()
+          }
         } else {
           this.basicInfoData = null
         }
@@ -477,12 +485,13 @@ export default {
     // 已选产品 退货单价  change
     priceChange (val, record) {
       //  光标移出,值发生改变再调用编辑接口
-      if (Number(val) != Number(record.priceBackups)) {
+      if (Number(val) != Number(record.oldPrice)) {
         this.handleAdd(record, true, 'noRefresh')
       }
     },
     // 刷新当前页面
     refashPage () {
+      this.getDetail(true)
       this.$refs.table.refresh()
       this.$refs.chooseTable.refresh()
     },

+ 6 - 6
src/views/allocationManagement/transferReturn/list.vue

@@ -77,7 +77,8 @@
         bordered>
         <!-- 单号 -->
         <template slot="allocateReturnNo" slot-scope="text, record">
-          <span :class="$hasPermissions('M_transferOut_detail')?'active':'common'" @click="handleDetail(record)">{{ record.allocateReturnNo }}</span>
+          <a-button v-if="$hasPermissions('M_transferOut_detail')" size="small" type="link" class="button-info" @click="handleDetail(record)">{{ record.allocateReturnNo }}</a-button>
+          <span v-else>{{ record.allocateReturnNo }}</span>
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
@@ -165,7 +166,6 @@ export default {
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
-              data.list[i].grapFlag = data.list[i].no % 2
             }
             this.disabled = false
           }
@@ -191,8 +191,8 @@ export default {
         { title: '是否抓单', dataIndex: 'grabFlagDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货总数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '坏件数量', dataIndex: 'totalBadQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '返库数量', dataIndex: 'printCount1', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货总金额', dataIndex: 'totalBackStockQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '返库数量', dataIndex: 'totalBackStockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货总金额', dataIndex: 'totalReturnPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '审核时间', dataIndex: 'auditTime', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
@@ -269,11 +269,11 @@ export default {
     },
     //  编辑
     handleEdit (row) {
-      this.$router.push({ name: row.grabFlag == 1 ? 'transferReturnGrpEdit' : 'transferReturnEdit', params: { sn: row.allocateReturnSn, targetType: row.targetType, targetTypeSn: row.targetTypeSn } })
+      this.$router.push({ name: row.grabFlag == 1 ? 'transferReturnGrpEdit' : 'transferReturnEdit', params: { sn: row.allocateReturnSn, targetType: row.targetType, dealerLevel: row.dealerLevel } })
     },
     // 品检
     handleCheck (row) {
-      this.$router.push({ name: 'transferReturnCheck', params: { sn: row.allocateReturnSn, grapFlag: row.grabFlag } })
+      this.$router.push({ name: 'transferReturnCheck', params: { sn: row.allocateReturnSn, grabFlag: row.grabFlag } })
     },
     //  导出
     handleExport () {