Sfoglia il codice sorgente

Merge branch 'develop_yh12' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh12

lilei 2 anni fa
parent
commit
4b01f2a249

+ 36 - 0
src/config/router.config.js

@@ -753,6 +753,42 @@ export const asyncRouterMap = [
                 }
               }
             ]
+          },
+          {
+            path: '/purchasingManagement/purchaseReturn',
+            redirect: '/purchasingManagement/purchaseReturn/list',
+            name: 'purchaseReturn',
+            component: BlankLayout,
+            meta: {
+              title: '采购退货',
+              icon: 'gold'
+              // permission: 'M_purchaseReturnList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'purchaseReturnList',
+                component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/list.vue'),
+                meta: {
+                  title: '采购退货',
+                  icon: 'gold',
+                  hidden: true
+                  // permission: 'M_purchaseReturnList'
+                }
+              },
+              {
+                path: 'purchaseReturnDeatil',
+                name: 'purchaseReturnDeatil',
+                component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/purchaseReturn/purchaseReturnDeatil.vue'),
+                meta: {
+                  title: '采购退货',
+                  icon: 'gold',
+                  hidden: true
+                  // permission: 'M_purchaseReturnList'
+                }
+              }
+            ]
           }
         ]
       },

+ 184 - 0
src/views/purchasingManagement/purchaseReturn/addModal.vue

@@ -0,0 +1,184 @@
+<template>
+  <a-modal
+    centered
+    class="bulkWarehousingOrder-basicInfo-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="新增"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="800">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-form-model
+        id="bulkWarehousingOrder-basicInfo-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="入库单号" prop="relationNo">
+          <a-input
+            id="bulkWarehousingOrder-relationNo"
+            :maxLength="30"
+            v-model.trim="form.relationNo"
+            placeholder="入库单号"
+            allowClear />
+        </a-form-model-item>
+        <a-form-model-item label="供应商名称" prop="supplierSn">
+          <a-select
+            placeholder="请选择供应商"
+            allowClear
+            v-model="form.supplierSn"
+            :showSearch="true"
+            option-filter-prop="children"
+            :filter-option="filterOption">
+            <a-select-option v-for="item in supplierList" :key="item.supplierSn" :value="item.supplierSn" :disabled="item.enableFlag==0">{{ item.supplierName }}</a-select-option>
+          </a-select>
+        </a-form-model-item>
+        <a-form-model-item label="退货原因" prop="sparePartsType">
+          <v-select
+            v-model="form.sparePartsType"
+            ref="sparePartsType"
+            id="bulkWarehousingOrder-basicInfo-sparePartsType"
+            code="SPARE_PARTS_TYPE"
+            placeholder="请选择退货原因"
+            allowClear></v-select>
+        </a-form-model-item>
+
+        <a-form-model-item label="补充说明" prop="remark">
+          <a-textarea
+            id="bulkWarehousingOrder-remark"
+            :maxLength="30"
+            v-model="form.remark"
+            placeholder="具体描述下退货原因"
+            allowClear />
+        </a-form-model-item>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button type="primary" id="bulkWarehousingOrder-basicInfo-modal-save" @click="handleSave">保存</a-button>
+        <a-button id="bulkWarehousingOrder-basicInfo-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { VSelect } from '@/components'
+import { supplierAllList } from '@/api/supplier'
+import { sparePartsSave } from '@/api/spareParts'
+export default {
+  name: 'BulkWarehousingOrderBasicInfoModal',
+  mixins: [commonMixin],
+  components: { VSelect },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      spinning: false,
+      formItemLayout: {
+        labelCol: { span: 5 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        supplierSn: undefined, // 供应商
+        sparePartsType: undefined, //  散件类型
+        relationNo: '', //  关联单号
+        remark: '' // 备注
+      },
+      rules: {
+        supplierSn: [
+          { required: true, message: '请选择供应商', trigger: 'change' }
+        ],
+        sparePartsType: [
+          { required: true, message: '请选择入库类型', trigger: 'change' }
+        ],
+        relationNo: [
+          { required: true, message: '请输入入库单号', trigger: 'change' }
+        ]
+      },
+      supplierList: [] //  供应商  下拉数据
+    }
+  },
+  methods: {
+    //  保存
+    handleSave () {
+      const _this = this
+      _this.$emit('close')
+      _this.$router.push({ name: 'purchaseReturnDeatil' })
+      // this.$refs.ruleForm.validate(valid => {
+      //   if (valid) {
+      //     const form = JSON.parse(JSON.stringify(_this.form))
+      //     _this.spinning = true
+      //     sparePartsSave(form).then(res => {
+      //       if (res.status == 200) {
+      //         _this.$message.success(res.message)
+      //         setTimeout(() => {
+      //           _this.isShow = false
+      //           _this.$emit('ok', res.data)
+      //           _this.spinning = false
+      //         }, 1000)
+      //       } else {
+      //         _this.spinning = false
+      //       }
+      //     })
+      //   } else {
+      //     console.log('error submit!!')
+      //     return false
+      //   }
+      // })
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    // 供应商下拉数据
+    getSupplierList (val) {
+      supplierAllList().then(res => {
+        if (res.status == 200) {
+          this.supplierList = res.data
+          if (val) { //  需将新增加的供应商回填,即不需要用户再选一下
+            this.form.supplierSn = this.supplierList[0].supplierSn
+            this.$refs.ruleForm.clearValidate('supplierSn')
+          }
+        } else {
+          this.supplierList = []
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.$refs.ruleForm.resetFields()
+      } else {
+        this.getSupplierList()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .bulkWarehousingOrder-basicInfo-modal{
+    .ant-modal-body {
+      padding: 40px 40px 24px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+  }
+</style>

+ 214 - 0
src/views/purchasingManagement/purchaseReturn/chooseDepartUserModal.vue

@@ -0,0 +1,214 @@
+<template>
+  <a-modal
+    centered
+    class="departUser-modal"
+    :footer="null"
+    :maskClosable="false"
+    :title="title+'选择审批人员'"
+    v-model="isShow"
+    @cancel="cancel"
+    width="60%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div>
+        <div class="departUser-con">
+          <a-form-model
+            id="departUser-form"
+            ref="ruleForm"
+            :model="form"
+            :rules="rules"
+            :label-col="formItemLayout.labelCol"
+            :wrapper-col="formItemLayout.wrapperCol">
+            <a-form-model-item label="申请人员" prop="applyPersonSn">
+              <employee style="width: 100%;" @change="employeeChange" id="departUser-Employee" v-model="form.applyPersonSn"></employee>
+            </a-form-model-item>
+            <a-form-model-item label="审批人员" prop="approvers">
+              <dingDepartUser
+                ref="departUserApp"
+                @loaded="uploading=false"
+                id="departUser-approvers"
+                :disabled="uploading"
+                v-model="form.approvers"
+                @change="changeApprovers"
+                allowClear
+                placeholder="请选择审批人员"
+              ></dingDepartUser>
+            </a-form-model-item>
+            <a-form-model-item label="抄送人" prop="ccList">
+              <dingDepartUser
+                ref="departUserCc"
+                @loaded="uploading=false"
+                :disabled="uploading"
+                id="departUser-ccList"
+                v-model="form.ccList"
+                allowClear
+                placeholder="请选择抄送人"
+              ></dingDepartUser>
+            </a-form-model-item>
+          </a-form-model>
+        </div>
+        <div class="btn-cont">
+          <a-button type="primary" id="departUser-save" @click="handleSave">确定</a-button>
+          <a-button :loading="uploading" style="margin-left: 15px;" @click="updateUser">刷新人员</a-button>
+          <a-button id="departUser-back" @click="cancel" style="margin-left: 15px;">取消</a-button>
+        </div>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { VSelect, Upload } from '@/components'
+import dingDepartUser from '@/views/common/dingDepartUser.js'
+import employee from '@/views/expenseManagement/expenseReimbursement/employee.js'
+import { sign } from 'core-js/fn/number'
+export default {
+  name: 'ChooseDepartUserModal',
+  components: { dingDepartUser, employee, VSelect, Upload },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      uploading: false,
+      spinning: false,
+      isShow: this.openModal, //  是否打开弹框
+      title: '',
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        salesReturnType: undefined,
+        applyPersonSn: undefined,
+        approvers: [], // 审批人
+        ccList: [] // 抄送人
+      },
+      attachList: [],
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo',
+      rules: {
+        salesReturnType: [
+          { required: true, message: '请选择退货类型', trigger: 'change' }
+        ],
+        applyPersonSn: [
+          { required: true, message: '请选择申请人员', trigger: 'change' }
+        ],
+        approvers: [
+          { required: true, type: 'array', message: '请选择审批人', trigger: 'change' }
+        ]
+      }
+    }
+  },
+  methods: {
+    // 申请人员
+    employeeChange (v, r) {
+      this.$nextTick(() => {
+        this.$refs.ruleForm.validateField(['applyPersonSn'])
+      })
+    },
+    //  附件上传
+    changeAttach (file) {
+      this.attachList = JSON.parse(file)
+      this.attachList.map(item => {
+        item.fileType = item.extName
+      })
+    },
+    updateUser () {
+      this.uploading = true
+      this.$refs.departUserApp.updateDeptUser()
+      // this.$refs.departUserCc.updateDeptUser()
+    },
+    changeApprovers (value) {
+      this.form.approvers = value
+      this.$refs.ruleForm.clearValidate()
+    },
+    getTreeVal (data) {
+      const ret = []
+      data.map(item => {
+        ret.push(item.value)
+      })
+      return ret.join(',')
+    },
+    // 确定
+    handleSave (e) {
+      e.preventDefault()
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const form = JSON.parse(JSON.stringify(_this.form))
+          form.attachmentList = this.attachList
+          if (form.approvers) {
+            form.approvers = this.getTreeVal(form.approvers)
+          }
+          if (form.ccList) {
+            form.ccList = this.getTreeVal(form.ccList)
+          }
+          console.log(form)
+          this.$emit('submit', form)
+          this.$emit('close')
+        } else {
+          return false
+        }
+      })
+    },
+    getDetail (data) {
+      this.form = Object.assign(this.form, {
+        salesReturnType: data.salesReturnType,
+        applyPersonSn: data.applyPersonSn
+      })
+      // 获取附件列表
+      this.form.attachmentList = ''
+      this.attachList = data.attachmentList
+      this.$nextTick(() => {
+        if (this.attachList.length) {
+          this.$refs.attachList.setFileList(this.attachList)
+        }
+      })
+    },
+    resetForm () {
+      this.$nextTick(() => {
+        this.$refs.ruleForm.resetFields()
+        this.$refs.attachList.setFileList('')
+      })
+      this.attachList = []
+      this.form = {
+        salesReturnType: undefined,
+        applyPersonSn: undefined,
+        ccList: undefined,
+        approvers: undefined,
+        attachmentList: ''
+      }
+    },
+    cancel () {
+      this.isShow = false
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.resetForm()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .departUser-modal{
+    .ant-modal-body {
+      padding: 30px 40px 24px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+  }
+</style>

+ 148 - 0
src/views/purchasingManagement/purchaseReturn/detailModal.vue

@@ -0,0 +1,148 @@
+<template>
+  <a-modal
+    centered
+    class="confirmationDetail-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="详情"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="960">
+    <div>
+      <a-descriptions size="small" :column="4" style="margin-bottom: 10px;">
+        <a-descriptions-item label="入库单号">{{ nowData&&nowData.stockPutNo || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="供应商名称">{{ nowData&&nowData.putTime || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="退货原因">{{ nowData&&nowData.putBizTypeDictValue || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="退货金额">{{ nowData&&nowData.putBizTypeDictValue || '--' }}</a-descriptions-item>
+      </a-descriptions>
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.stockPutSn"
+        :columns="columns"
+        :data="loadData"
+        :defaultLoadData="false"
+        bordered>
+      </s-table>
+      <div class="auditProgress">审核进度</div>
+      <a-divider />
+      <a-table :columns="auditColumns" :data-source="data" bordered>
+      </a-table>
+      <div class="btn-cont"><a-button id="confirmationDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { STable } from '@/components'
+import { stockPutDetailList } from '@/api/stockPut'
+export default {
+  name: 'ConfirmationDetailModal',
+  components: { STable },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
+    },
+    nowData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      detailsData: null, //  详情数据
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        return stockPutDetailList(Object.assign(parameter, { sn: this.itemSn })).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
+            }
+            this.disabled = false
+          }
+          return data
+        })
+      }
+    }
+  },
+  computed: {
+    // 列表表头
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '7%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '45%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'putQty', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '入库数量', dataIndex: 'putQty', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货单价', dataIndex: 'putCost', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '申请退货数量', dataIndex: 'putQty', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货金额', dataIndex: 'putCost', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      ]
+      return arr
+    },
+    auditColumns () {
+      const auditArr = [
+        { title: '序号', dataIndex: 'no', width: '7%', align: 'center' },
+        { title: '人员名称', dataIndex: 'peopleName', width: '45%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '状态', dataIndex: 'status', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '审批意见', dataIndex: 'suggest', width: '45%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '附件', dataIndex: 'fujian', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '操作时间', dataIndex: 'time', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      ]
+      return auditArr
+    }
+  },
+  methods: {},
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.$refs.table.clearTable()
+      }
+    },
+    itemSn (newValue, oldValue) {
+      if (this.isShow && newValue) {
+        const _this = this
+        setTimeout(() => {
+          _this.$refs.table.refresh(true)
+        }, 200)
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .confirmationDetail-modal{
+    .ant-modal-body {
+      padding: 40px 40px 24px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin-top:24px;
+    }
+  }
+  .auditProgress{
+    margin-top:24px;
+  }
+  .ant-divider-horizontal{
+    margin:10px 0 24px;
+  }
+</style>

+ 379 - 0
src/views/purchasingManagement/purchaseReturn/list.vue

@@ -0,0 +1,379 @@
+<template>
+  <a-card size="small" :bordered="false" class="bulkWarehousingOrderList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="供应商名称">
+                <a-input id="bulkWarehousingOrderList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入供应商名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="审核状态">
+                <v-select
+                  v-model="queryParam.state"
+                  ref="state"
+                  id="bulkWarehousingOrderList-state"
+                  code="SPARE_PARTS_STATE"
+                  placeholder="请选择审核状态"
+                  allowClear
+                ></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="提交时间">
+                <rangeDate ref="rangeDate" @change="dateChange" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <span class="table-page-search-submitButtons">
+                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkWarehousingOrderList-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="bulkWarehousingOrderList-reset">重置</a-button>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <!-- 操作按钮 -->
+      <div class="table-operator">
+        <a-button v-if="$hasPermissions('B_sparePartsNew')" id="bulkWarehousingOrderList-add" type="primary" class="button-error" @click="handleAdd">新增</a-button>
+        <a-button
+          style="margin-left: 10px"
+          v-if="$hasPermissions('B_sparePartsExport')"
+          type="primary"
+          class="button-warning"
+          @click="handleExport"
+          :disabled="disabled"
+          :loading="exportLoading"
+        >导出明细</a-button>
+        <span style="margin-left: 8px">
+          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
+        </span>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        :style="{ height: tableHeight+84.5+'px' }"
+        size="small"
+        :rowKey="(record) => record.sparePartsSn"
+        rowKeyName="sparePartsSn"
+        :row-selection="$hasPermissions('B_sparePartsBatchAudit')?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state != 'WAIT_AUDIT' } }) }:null"
+        @rowSelection="rowSelectionFun"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+        <!-- 入库单号 -->
+        <template slot="sparePartsNo" slot-scope="text, record">
+          <span v-if="$hasPermissions('B_sparePartsDetail')" class="link-bule" @click="handleDetail(record)">{{ record.sparePartsNo }}</span>
+          <span v-else>{{ record.sparePartsNo }}</span>
+        </template>
+        <!-- 操作 -->
+        <template slot="action" slot-scope="text, record">
+          <a-button
+            size="small"
+            type="link"
+            class="button-warning"
+            @click="handleAuditModalShow(record)"
+            id="allocateBillList-examine-btn">审核</a-button>
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsEdit')"
+            @click="handleEdit(record)"
+            class="button-info"
+            id="bulkWarehousingOrderList-edit-btn">编辑</a-button>
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsEdit')"
+            @click="handleEdit(record)"
+            class="button-info"
+            id="bulkWarehousingOrderList-edit-btn">详情</a-button>
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsEdit')"
+            @click="handleEdit(record)"
+            class="button-info"
+            id="bulkWarehousingOrderList-edit-btn">再次提交</a-button>
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsDel')"
+            @click="handleDel(record)"
+            class="button-error"
+            id="bulkWarehousingOrderList-del-btn">删除</a-button>
+          <span v-if="!(record.state == 'WAIT_AUDIT'&&($hasPermissions('B_sparePartsEdit') || $hasPermissions('B_sparePartsDel') || $hasPermissions('B_sparePartsAudit')))">--</span>
+        </template>
+      </s-table>
+    </a-spin>
+    <!-- 选择基本信息弹框 -->
+    <add-modal v-drag :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+    <detailModal v-drag :openModal="openDetailModal" :itemSn="itemSn" @close="closeDetailModal" />
+    <!-- 导出提示框 -->
+    <reportModal :visible="showExport" @close="showExport=false"></reportModal>
+    <!-- 选择审核人员 -->
+    <chooseDepartUserModal v-drag :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
+  </a-card>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import addModal from './addModal.vue'
+import detailModal from './detailModal.vue'
+import chooseDepartUserModal from './chooseDepartUserModal.vue'
+import reportModal from '@/views/common/reportModal.vue'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { sparePartsList, sparePartsDelete, sparePartsAudit, sparePartsDetailExport } from '@/api/spareParts'
+export default {
+  name: 'BulkWarehousingOrderList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, reportModal, detailModal, addModal, chooseDepartUserModal },
+  data () {
+    return {
+      spinning: false,
+      disabled: false, //  查询、重置按钮是否可操作
+      openModal: false, // 基本信息弹框是否显示
+      showExport: false,
+      exportLoading: false,
+      tableHeight: 0,
+      auditInfo: null,
+      // 查询参数
+      queryParam: {
+        productCode: '',
+        relationNo: '',
+        state: undefined,
+        sparePartsType: undefined,
+        sparePartsNo: '',
+        supplierName: '',
+        kingdeeNo: ''
+
+      },
+      openDepartUserModal: false,
+      loading: false,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return sparePartsList(Object.assign(parameter, this.queryParam)).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
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      openDetailModal: false,
+      itemSn: null,
+      rowSelectionInfo: null
+    }
+  },
+  computed: {
+	  columns () {
+	    const arr = [
+        { title: '序号', dataIndex: 'no', width: '3.5%', align: 'center' },
+	      { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+	      { title: '入库单号', scopedSlots: { customRender: 'sparePartsNo' }, width: '15%', align: 'center' },
+	      { title: '供应商名称', dataIndex: 'supplierName', align: 'center', width: '15%', customRender: function (text) { return text || '--' }, ellipsis: true },
+	      { title: '退回原因', dataIndex: 'remark', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '申请退货数量', dataIndex: 'productTotalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+	      { title: '退货金额', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+	      { title: '审核时间', dataIndex: 'sparePartsTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+	      { title: '审核状态', dataIndex: 'stateDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+	      { title: '操作', scopedSlots: { customRender: 'action' }, width: '9%', align: 'center' }
+	    ]
+
+	    return arr
+	  }
+  },
+  methods: {
+    // 提交时间
+    dateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      _this.exportLoading = true
+      _this.spinning = true
+      hdExportExcel(sparePartsDetailExport, _this.queryParam, '散件入库明细', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+        _this.showExport = true
+      })
+    },
+    //  新增
+    handleAdd () {
+      this.openModal = true
+    },
+    //  基本信息  保存
+    handleOk (row) {
+      this.$router.push({ path: `/purchasingManagement/bulkWarehousingOrder/add/${row.id}/${row.sparePartsSn}` })
+    },
+    //  编辑
+    handleEdit (row) {
+      this.$router.push({ path: `/purchasingManagement/bulkWarehousingOrder/edit/${row.id}/${row.sparePartsSn}` })
+    },
+    //  详情
+    handleDetail (row) {
+      this.itemSn = row.sparePartsSn
+      this.openDetailModal = true
+    },
+    // 关闭弹框
+    closeDetailModal () {
+      this.itemSn = null
+      this.openDetailModal = false
+    },
+    //  删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后不可恢复,确定要进行删除吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          sparePartsDelete({ sn: row.sparePartsSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam = {
+        productCode: '',
+        relationNo: '',
+        state: undefined,
+        sparePartsType: undefined,
+        sparePartsNo: '',
+        supplierName: '',
+        kingdeeNo: ''
+      }
+      this.$refs.table.refresh(true)
+    },
+    //  单条审核
+    handleAudit (row, isBatch) {
+      const _this = this
+      let content = ''
+      let params = []
+      if (isBatch) { //  批量
+        content = '确认要批量审核吗?'
+        params = row
+      } else { //  单条
+        content = '确认要审核通过吗?'
+        params = [row.sparePartsSn]
+      }
+      this.$confirm({
+        title: '提示',
+        content: content,
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          sparePartsAudit(params).then(res => {
+            if (res.status == 200) {
+              _this.$refs.table.clearSelected() // 清空表格选中项
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 批量审核
+    handleBatchAudit () {
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        this.$message.warning('请在列表勾选后再进行批量操作!')
+        return
+      }
+      this.handleAudit(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, 'batch')
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.openModal = false
+      this.openDetailModal = false
+      this.itemSn = null
+      this.rowSelectionInfo = null
+      this.$refs.table.clearTable()
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 235
+    },
+    handleAuditModalShow (row) {
+      this.auditInfo = row
+      this.openDepartUserModal = true
+    },
+    // 提交
+    handleSubmit (data) {
+
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+    // 仅刷新列表,不重置页面
+    if (this.$store.state.app.updateList) {
+      this.pageInit()
+      this.$refs.table.refresh()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+<style lang="less">
+  .bulkWarehousingOrderList-wrap{
+    .active{
+      color: #ed1c24;
+      cursor: pointer;
+    }
+    .common{
+      color: rgba(0, 0, 0);
+    }
+  }
+</style>

+ 509 - 0
src/views/purchasingManagement/purchaseReturn/purchaseReturnDeatil.vue

@@ -0,0 +1,509 @@
+<template>
+  <div class="salesReturnEdit-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-page-header :ghost="false" :backIcon="false" class="salesReturnEdit-back" >
+        <!-- 自定义的二级文字标题 -->
+        <template slot="subTitle">
+          <a id="salesReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        </template>
+      </a-page-header>
+      <a-card size="small" :bordered="false" class="outboundOrderDetail-cont">
+        <a-collapse :activeKey="['1']">
+          <a-collapse-panel key="1" header="基础信息">
+            <a-descriptions size="small" :column="3" style="margin-bottom: 10px;">
+              <a-descriptions-item label="入库单号">SJ221222000001</a-descriptions-item>
+              <a-descriptions-item label="供应商名称">东莞市绿冠滤清器有限公司</a-descriptions-item>
+              <a-descriptions-item label="创建时间">2022-12-30 14:22</a-descriptions-item>
+            </a-descriptions>
+          </a-collapse-panel>
+        </a-collapse>
+      </a-card>
+      <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
+        <!-- 查询配件列表 -->
+        <div>已入库产品信息</div>
+        <a-divider />
+        <queryPart ref="partQuery" :newLoading="isInster" @add="saveProduct"></queryPart>
+      </a-card>
+      <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
+        <a-alert style="margin-bottom: 10px;" type="info">
+          <div slot="message" class="total-bar">
+            <div>
+              <span>申请退货数量:{{ ordeDetail&&(ordeDetail.totalInitialQty || ordeDetail.totalInitialQty==0) ? ordeDetail.totalInitialQty : '--' }};</span>
+              <span v-if="$hasPermissions('B_isShowPrice')">退货金额:{{ ordeDetail&&(ordeDetail.totalAmount || ordeDetail.totalAmount==0) ? ordeDetail.totalAmount : '--' }}元;</span>
+            </div>
+          </div>
+        </a-alert>
+        <div class="table-page-search-wrapper" style="display:flex;align-items: center;justify-content: space-between;">
+          <div style="flex-grow:1;">
+            <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+              <a-row :gutter="15">
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="产品编码">
+                    <a-input v-model.trim="productForm.productCode" allowClear placeholder="请输入产品编码"/>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="产品名称">
+                    <a-input v-model.trim="productForm.productName" allowClear placeholder="请输入产品名称"/>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                  <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled">查询</a-button>
+                  <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled">重置</a-button>
+                </a-col>
+              </a-row>
+            </a-form>
+          </div>
+          <div>
+            <span style="margin-right: 10px;" v-if="selNums">已选{{ selNums }}项</span>
+            <a-button type="default" class="button-info" @click="openPlSetReason">批量设置退货原因</a-button>
+            <a-button type="primary" class="button-info" id="salesReturnEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
+          </div>
+        </div>
+        <!-- 已选配件列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :row-selection="{ columnWidth: 40 }"
+          @rowSelection="rowSelectionFun"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          :scroll="{ y: 300 }"
+          bordered>
+          <!-- 本次退货数量 -->
+          <template slot="qty" slot-scope="text, record">
+            <a-input-number
+              id="salesReturn-qty"
+              size="small"
+              v-model="record.initialQty"
+              :precision="0"
+              :min="0"
+              :max="999999"
+              placeholder="请输入"
+              @blur="e => onCellBlur(e.target.value, record, 'qty')"
+              style="width: 100%;" />
+          </template>
+          <!-- 退货原因 -->
+          <template slot="returnReason" slot-scope="text, record">
+            <returnReason v-model="record.returnReason" @blur="updateReason(record)"></returnReason>
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button
+              size="small"
+              type="link"
+              :loading="delLoading"
+              class="button-error"
+              @click="handleDel(record)"
+              id="salesReturn-Del">删除</a-button>
+          </template>
+        </s-table>
+      </a-card>
+    </a-spin>
+    <div class="affix-cont">
+      <a-button
+        size="large"
+        style="padding: 0 60px;"
+        :disabled="spinning"
+        type="primary"
+        class="button-primary"
+        @click="beforeSubmit()"
+        id="salesReturn-handleSubmit">提交</a-button>
+    </div>
+    <!-- 选择审核人员 -->
+    <!-- <chooseDepartUserModal ref="chooseDepart" :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal> -->
+    <!-- 导入产品 -->
+    <!-- <importGuideModal :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" /> -->
+    <!-- 批量设置退货原因 -->
+    <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @cancel="showPlModal=false" @ok="setPlReturnReason">
+      <div style="text-align: center;">
+        <div style="margin-bottom: 15px;font-size: 14px;"><strong>请输入退货原因</strong></div>
+        <div style="line-height: 24px;">
+          <div><returnReason size="large" v-model="plReturnReason"></returnReason></div>
+        </div>
+      </div>
+    </commonModal>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import { printFun, exportExcel } from '@/libs/JGPrint.js'
+// import ImportGuideModal from './importGuideModal.vue'
+import queryPart from './queryPart.vue'
+import commonModal from '@/views/common/commonModal.vue'
+import EditableCell from '@/views/common/editInput.js'
+// import chooseDepartUserModal from './chooseDepartUserModal.vue'
+import returnReason from '@/views/common/returnReason'
+import {
+  salesReturnDetail,
+  salesReturnSubmit,
+  salesReturnBatchInsert,
+  salesReturnPrint,
+  salesReturnExport
+} from '@/api/salesReturn'
+import {
+  salesReturnDetailList,
+  salesReturnDetailDel,
+  salesReturnDetailInsert,
+  salesReturnDetailUpdateQty,
+  salesReturnDetailUpdateReason,
+  salesReturnDetailSetReason
+} from '@/api/salesReturnDetail'
+export default {
+  name: 'PurchaseReturnDeatil',
+  mixins: [commonMixin],
+  components: {
+    STable,
+    VSelect,
+    EditableCell,
+    returnReason,
+    commonModal,
+    queryPart
+  },
+  data () {
+    return {
+      spinning: false,
+      orderId: null,
+      orderSn: null,
+      buyerSn: null,
+      disabled: false,
+      isInster: false, // 是否正在添加产品
+      openDepartUserModal: false,
+      ordeDetail: { discountAmount: 0 },
+      delLoading: false,
+      // 已选产品
+      dataSource: [],
+      productForm: {
+        salesReturnBillSn: '',
+        productName: '',
+        productCode: ''
+      },
+      chooseLoadData: [],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        // 查询总计
+        this.productForm.salesReturnBillSn = '481487002858102784'
+        return salesReturnDetailList(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].qtyBackups = data.list[i].initialQty
+              data.list[i].returnReasonBackups = data.list[i].returnReason
+            }
+            this.disabled = false
+            this.chooseLoadData = data.list
+            this.total = res.data.count
+          }
+          return data
+        })
+      },
+      openGuideModal: false, //  导入产品引导
+      total: 0,
+      rowSelectionInfo: null,
+      plReturnReason: '',
+      showPlModal: false
+    }
+  },
+  watch: {
+    showPlModal (newValue, oldValue) {
+      if (!newValue) {
+        this.plReturnReason = ''
+      }
+    }
+  },
+  computed: {
+    selNums () {
+      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
+    },
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
+        { title: '产品编码', dataIndex: 'productEntity.code', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'productEntity.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
+        { title: '退货单价', dataIndex: 'initialQty', align: 'center', width: '8%', scopedSlots: { customRender: 'qty' } },
+        { title: '申请退款数量', dataIndex: 'returnReason', align: 'center', width: '13%', scopedSlots: { customRender: 'returnReason' } },
+        { title: '退款金额', dataIndex: 'returnReason', align: 'center', width: '13%', scopedSlots: { customRender: 'returnReason' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+      ]
+      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
+        arr.splice(4, 0, { title: '参考退货单价', dataIndex: 'price', align: 'center', width: '8%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+        arr.splice(7, 0, { title: '参考退货金额', align: 'center', dataIndex: 'totalAmount', width: '8%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      }
+      return arr
+    }
+  },
+  methods: {
+    //  返回
+    handleBack () {
+      this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
+    },
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    // 已选产品  blur
+    onCellBlur (val, record, type) {
+      const valBackups = record.qtyBackups
+      //  光标移出,值发生改变再调用编辑接口
+      if (val && val != valBackups) {
+        this.spinning = true
+        salesReturnDetailUpdateQty({
+          salesReturnDetailSn: record.salesReturnDetailSn,
+          initialQty: record.initialQty,
+          price: record.price
+        }).then(res => {
+          if (res.status == 200) {
+            this.resetTable(false)
+            this.$message.success(res.message)
+            this.spinning = false
+            record.qtyBackups = record.initialQty
+          } else {
+            this.spinning = false
+            record.initialQty = valBackups
+          }
+        })
+      } else {
+        record.initialQty = valBackups
+      }
+    },
+    // 修改退货原因
+    updateReason (row) {
+      console.log(row.returnReason)
+      // 空或没有改变时不保存数据
+      if (!row.returnReason || row.returnReason == row.returnReasonBackups) {
+        row.returnReason = row.returnReasonBackups
+        return
+      }
+      this.spinning = true
+      salesReturnDetailUpdateReason({
+        salesReturnDetailSn: row.salesReturnDetailSn,
+        returnReason: row.returnReason
+      }).then(res => {
+        if (res.status == 200) {
+          this.resetTable(false)
+          this.$message.success(res.message)
+        } else {
+          row.returnReason = row.returnReasonBackups
+        }
+        this.spinning = false
+      })
+    },
+    // 批量设置退货原因
+    openPlSetReason () {
+      if (this.selNums) {
+        this.showPlModal = true
+      } else {
+        this.$message.warning('请先选择产品!')
+      }
+    },
+    setPlReturnReason () {
+      if (this.plReturnReason == '') {
+        this.$message.warning('请输入退货原因!')
+      } else {
+        this.spinning = true
+        const snList = []
+        const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
+        arr.map(item => {
+          snList.push(item.salesReturnDetailSn)
+        })
+        salesReturnDetailSetReason({
+          salesReturnBillDetailSnList: snList,
+          returnReason: this.plReturnReason
+        }).then(res => {
+          if (res.status == 200) {
+            this.showPlModal = false
+            this.$refs.table.clearSelected()
+            this.resetTable(false)
+          }
+          this.spinning = false
+        })
+      }
+    },
+    // 获取单据详细
+    getOrderDetail () {
+      salesReturnDetail({ sn: this.orderSn }).then(res => {
+        this.ordeDetail = res.data || null
+      })
+    },
+    // 删除产品
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要删除吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.delLoading = true
+          _this.spinning = true
+          salesReturnDetailDel({ salesReturnDetailSn: row.salesReturnDetailSn }).then(res => {
+            if (res.status == 200) {
+              _this.resetTable(false)
+            }
+            _this.$message.info(res.message)
+            _this.delLoading = false
+            _this.spinning = false
+          })
+        }
+      })
+    },
+    resetTable (flag) {
+      this.$refs.table.refresh(flag)
+      this.getOrderDetail()
+    },
+    //  重置
+    resetSearchForm (flag) {
+      this.productForm.productName = ''
+      this.productForm.productCode = ''
+      this.$refs.table.refresh(!!flag)
+      this.getOrderDetail()
+    },
+    // 添加或修改产品
+    saveProduct (row) {
+      // 防止多次添加产品
+      if (this.isInster) {
+        return
+      }
+      this.isInster = true
+      const params = {
+        'salesReturnBillSn': this.orderSn,
+        'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
+        'price': row.productPrice,
+        'cost': row.lastStockCost,
+        'returnReason': row.returnReason,
+        'productSn': row.productSn,
+        'initialQty': row.qty
+      }
+      this.spinning = true
+      salesReturnDetailInsert(params).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm(true)
+          this.$message.success(res.message)
+        }
+        this.isInster = false
+        this.spinning = false
+      })
+    },
+    beforeSubmit () {
+      if (this.total) {
+        const hasKong = this.chooseLoadData.find(item => !item.returnReason)
+        if (hasKong) {
+          this.$message.warning('请输入退货原因!')
+        } else {
+          this.openDepartUserModal = true
+          if (this.ordeDetail.billStatus == 'AUDIT_REJECT') {
+            this.$refs.chooseDepart.getDetail(this.ordeDetail)
+          }
+        }
+      } else {
+        this.$message.warning('请添加产品!')
+      }
+    },
+    // 提交销售退货
+    handleSubmit (data) {
+      this.spinning = true
+      salesReturnSubmit({ salesReturnBillSn: this.orderSn, ...data }).then(res => {
+        if (res.status == 200) {
+          this.handleBack()
+          this.$message.success(res.message)
+        }
+        this.spinning = false
+      })
+    },
+    closeGuideModel () {
+      this.openGuideModal = false
+    },
+    // 导入产品
+    hanldeOk (obj) {
+      salesReturnBatchInsert(obj).then(res => {
+        if (res.status == 200) {
+          this.resetTable(true)
+        }
+      })
+    },
+    // 打印预览/快捷打印
+    handlePrint (type) {
+      const _this = this
+      const a = ['WAIT_CUSTOMER_SERVICE_CONFIRM', 'WAIT_FINANCIAL_AUDIT', 'FINANCIAL_REJECT', 'FINISH'].find(item => item == this.ordeDetail.billStatus)
+      const status = a ? 'SALES_RETURN_AMOUNT' : 'SALES_RETURN_REASON'
+      const params = { salesReturnBillSn: this.$route.params.sn, priceType: status }
+      _this.spinning = true
+      // 导出
+      if (type == 'export') {
+        exportExcel(salesReturnExport, params, '销售退货', function () {
+          _this.spinning = false
+        })
+      } else {
+        // 打印或预览
+        printFun(salesReturnPrint, params, type, '销售退货', () => {
+          _this.spinning = false
+        })
+      }
+    },
+    pageInit () {
+      this.orderSn = this.$route.params.sn
+      this.buyerSn = this.$route.params.buyerSn
+      this.resetSearchForm(true)
+      this.$refs.partQuery.pageInit(this.buyerSn, 0)
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
+    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+      this.pageInit()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less">
+  .salesReturnEdit-wrap{
+    position: relative;
+    height: 100%;
+    padding-bottom: 51px;
+    box-sizing: border-box;
+    >.ant-spin-nested-loading{
+      overflow-y: scroll;
+      height: 100%;
+    }
+    .salesReturnEdit-cont{
+      margin-top: 10px;
+      .ant-divider-horizontal{
+        margin:10px 0 24px;
+      }
+      .total-bar{
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        > div{
+          &:last-child{
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            > div{
+              padding: 0 10px;
+            }
+          }
+        }
+      }
+    }
+  }
+</style>

+ 210 - 0
src/views/purchasingManagement/purchaseReturn/queryPart.vue

@@ -0,0 +1,210 @@
+<template>
+  <div class="salesReturnList-wrap">
+    <!-- 搜索条件 -->
+    <div class="table-page-search-wrapper">
+      <div style="width:80%">
+        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品编码">
+                <a-input id="salesReturnList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品名称">
+                <a-input id="salesReturnList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesReturnList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">重置</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">批量添加</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">整单添加</a-button>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </div>
+    <!-- 列表 -->
+    <s-table
+      class="sTable"
+      ref="table"
+      size="small"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      :customRow="handleClickRow"
+      :defaultLoadData="false"
+      :scroll="{ y: 300 }"
+      bordered>
+      <!-- 申请退货数量 -->
+      <template slot="qty" slot-scope="text, record">
+        <div @dblclick.stop>
+          <a-input-number
+            size="small"
+            v-model="record.qty"
+            :precision="0"
+            :min="showReceiveQty?0:1"
+            :max="999999"
+            style="width: 100%;"
+            placeholder="请输入" />
+        </div>
+      </template>
+      <!-- 仓库实收数量 -->
+      <template slot="receiveQty" slot-scope="text, record">
+        <div @dblclick.stop>
+          <a-input-number
+            size="small"
+            v-model="record.receiveQty"
+            :precision="0"
+            :min="1"
+            :max="999999"
+            style="width: 100%;"
+            placeholder="请输入" />
+        </div>
+      </template>
+      <!-- 退货原因 -->
+      <template slot="returnReason" slot-scope="text, record">
+        <div @dblclick.stop>
+          <returnReason v-model="record.returnReason"></returnReason>
+        </div>
+      </template>
+      <span slot="customTitle">
+        操作
+        <a-popover>
+          <template slot="content">
+            双击列表配件可快速选中添加
+          </template>
+          <a-icon type="question-circle" theme="twoTone" />
+        </a-popover>
+      </span>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-button
+          size="small"
+          type="link"
+          class="button-info"
+          :disabled="newLoading"
+          v-if="record.productPrice"
+          @click="handleAdd(record)"
+        >添加</a-button>
+        <span v-else>--</span>
+      </template>
+    </s-table>
+  </div>
+</template>
+
+<script>
+import { queryStockProductPage } from '@/api/stock'
+import returnReason from '@/views/common/returnReason'
+import { STable, VSelect } from '@/components'
+export default {
+  name: 'QueryPart',
+  components: { STable, VSelect, returnReason },
+  props: {
+    newLoading: Boolean,
+    isShowPrice: {
+      type: Boolean,
+      default: true
+    },
+    // 是否显示仓库实收数量
+    showReceiveQty: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      buyerSn: '',
+      priceType: '',
+      queryParam: { //  查询条件
+        productName: '', // 产品名称
+        productCode: '' //  产品编码
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.queryParam.dealerSn = this.buyerSn
+        return queryStockProductPage(Object.assign(parameter, this.queryParam)).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].qty = this.showReceiveQty ? 0 : 1
+              data.list[i].receiveQty = 1
+            }
+            this.disabled = false
+          }
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    // 双击列表选择配件
+    handleClickRow (record) {
+      const _this = this
+      return {
+        on: {
+          dblclick: (event) => {
+            event.stopPropagation()
+            if (record.productPrice) {
+              _this.$emit('add', record)
+            }
+          }
+        }
+      }
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.productName = ''
+      this.queryParam.productCode = ''
+      this.$refs.table.refresh(true)
+    },
+    pageInit (buyerSn) {
+      this.buyerSn = buyerSn
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '27%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入库单价', dataIndex: 'productPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '入库数量', dataIndex: 'qty', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
+        { title: '已退数量', dataIndex: 'qty', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
+        { title: '最大可退数量', dataIndex: 'qty', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
+        { title: '申请退货数量', dataIndex: 'qty', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
+        { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+      ]
+      let i = 5
+      if (this.$hasPermissions('B_isShowPrice') && this.isShowPrice) { //  售价权限
+        arr.splice(4, 0, { title: '当前售价', dataIndex: 'productPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+        i = 6
+      }
+      // 实收数量是否显示
+      if (this.showReceiveQty) {
+        arr.splice(i, 0, { title: '仓库实收数量', dataIndex: 'receiveQty', width: '9%', align: 'center', scopedSlots: { customRender: 'receiveQty' } })
+      }
+      this.columns = arr
+      this.resetSearchForm()
+    },
+    // 选择配件
+    handleAdd (row) {
+      this.$emit('add', row)
+    },
+    refreshData () {
+      this.$refs.table.refresh()
+    }
+  }
+}
+</script>
+<style lang="less">
+  .salesReturnList-wrap{
+    .redBg-row{
+      background-color: #f5cdc8;
+    }
+  }
+</style>