Pārlūkot izejas kodu

财务调拨退货确认

lilei 3 gadi atpakaļ
vecāks
revīzija
b616e5f70f

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

@@ -509,7 +509,7 @@ export const asyncRouterMap = [
             name: 'returnConfirmation',
             component: BlankLayout,
             meta: {
-              title: '退货确认',
+              title: '销售退货确认',
               icon: 'vertical-align-top',
               permission: 'M_returnConfirmationList'
             },
@@ -520,7 +520,7 @@ export const asyncRouterMap = [
                 name: 'returnConfirmationList',
                 component: () => import(/* webpackChunkName: "financialManagement" */ '@/views/financialManagement/returnConfirmation/list.vue'),
                 meta: {
-                  title: '退货确认列表',
+                  title: '销售退货确认列表',
                   icon: 'vertical-align-top',
                   hidden: true,
                   permission: 'M_returnConfirmationList'
@@ -528,6 +528,31 @@ export const asyncRouterMap = [
               }
             ]
           },
+          {
+            path: '/financialManagement/allocateReturnConfirmation',
+            redirect: '/financialManagement/allocateReturnConfirmation/list',
+            name: 'allocateReturnConfirmation',
+            component: BlankLayout,
+            meta: {
+              title: '调拨退货确认',
+              icon: 'vertical-align-top',
+              // permission: 'M_allocateReturnConfirmationList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'allocateReturnConfirmationList',
+                component: () => import(/* webpackChunkName: "financialManagement" */ '@/views/financialManagement/allocateReturnConfirmation/list.vue'),
+                meta: {
+                  title: '调拨退货确认列表',
+                  icon: 'vertical-align-top',
+                  hidden: true,
+                  // permission: 'M_allocateReturnConfirmationList'
+                }
+              }
+            ]
+          },
           {
             path: '/financialManagement/inventoryConfirmation',
             redirect: '/financialManagement/inventoryConfirmation/list',

+ 6 - 80
src/views/allocationManagement/transferReturn/detail.vue

@@ -14,31 +14,8 @@
             @click.stop="handleEdit">编辑</a-button>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
-        <template slot="extra">
-          <a-button
-            key="3"
-            type="primary"
-            class="button-warning"
-            v-if="$hasPermissions('B_transferOut_detail_export')"
-            id="allocateBillDetail-export-btn"
-            :disabled="localDataSource.length==0"
-            @click="handleExcel">导出Excel</a-button>
-          <a-button
-            key="2"
-            type="primary"
-            class="button-error"
-            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"
-            class="button-info"
-            v-if="$hasPermissions('B_transferOut_print')"
-            id="allocateBillDetail-dbfl-print-btn"
-            :disabled="localDataSource.length==0"
-            @click="handlePrint('dbflPrint')">调拨分类打印</a-button>
+        <template slot="extra" v-if="!outBizSn">
+          <print :params="{allocateSn: $route.params.sn || outBizSn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
         </template>
       </a-page-header>
       <a-card size="small" :bordered="false" class="allocateBillDetail-cont">
@@ -77,17 +54,15 @@
         </s-table>
       </a-card>
     </a-spin>
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
-import { hdExportExcel } from '@/libs/exportExcel'
+import print from './print.vue'
 import { allocateBillDetailList, allocateBillDetail, allocateBillDetailCount, allocateBillDetailPrint, allocateBillDetailExcel } from '@/api/allocateBill'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, print },
   props: {
     outBizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],
@@ -170,57 +145,8 @@ export default {
       })
     },
     //  编辑
-    handleEdit () {
-      const row = this.basicInfoData
-      this.$router.push({ name: row.grabFlag == 1 ? 'transferReturnGrpEdit' : 'transferReturnEdit', params: { sn: row.allocateSn, dealerLevel: row.dealerLevel } })
-    },
-    // 导出
-    handleExcel () {
-      const _this = this
-      this.spinning = true
-      hdExportExcel(allocateBillDetailExcel, { allocateSn: this.outBizSn || this.$route.params.sn }, '调拨退货明细', function () {
-        _this.spinning = false
-      })
-    },
-    // 打印预览/快捷打印
-    handlePrint (type) {
-      this.nowType = type
-      this.openModal = true
-    },
-    handleOk (objs) {
-      const _this = this
-      const params = JSON.parse(JSON.stringify(objs))
-      delete params.type
-      _this.spinning = true
-      allocateBillDetailPrint(params).then(res => {
-        _this.spinning = false
-        if (res.type == 'application/json') {
-          var reader = new FileReader()
-          reader.addEventListener('loadend', function () {
-            const obj = JSON.parse(reader.result)
-            _this.$notification.error({
-              message: '提示',
-              description: obj.message
-            })
-          })
-          reader.readAsText(res)
-        } else {
-          this.print(res, objs.isPreview)
-        }
-      })
-    },
-    print (data, type) {
-      if (!data) {
-        return
-      }
-      const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
-      document.getElementById('print').innerHTML = '<iframe id="printftod" name="printftod" src="' + url + '" hidden></iframe>'
-      if (type == '1') { //  预览
-        window.open(url)
-      } else if (type == '0') { //  打印
-        window.frames['printftod'].focus()
-        window.frames['printftod'].print()
-      }
+    handleEdit (row) {
+      this.$router.push({ name: row.grapFlag == 1 ? 'transferReturnGrpEdit' : 'transferReturnEdit', params: { sn: row.allocateSn, dealerLevel: row.dealerLevel } })
     },
     pageInit () {
       this.$refs.table.refresh(true)

+ 65 - 0
src/views/financialManagement/allocateReturnConfirmation/detailModal.vue

@@ -0,0 +1,65 @@
+<template>
+  <a-modal
+    centered
+    class="confirmationDetail-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="详情"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="960">
+    <div>
+      <detail :outBizSn="itemSn" ref="detail"></detail>
+      <div class="btn-cont"><a-button id="confirmationDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import detail from '@/views/allocationManagement/transferReturn/detail'
+export default {
+  name: 'AllocateReturnDetailModal',
+  components: { detail },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal //  是否打开弹框
+    }
+  },
+  methods: {
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .confirmationDetail-modal{
+    .ant-modal-body {
+      padding: 10px 10px 20px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 5px 0 10px;
+    }
+  }
+</style>

+ 280 - 0
src/views/financialManagement/allocateReturnConfirmation/list.vue

@@ -0,0 +1,280 @@
+<template>
+  <a-card size="small" :bordered="false" class="returnConfirmationList-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="创建时间">
+                <rangeDate ref="rangeDate" @change="dateChange" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                <dealerSubareaScopeList ref="dealerSubareaScopeList" id="returnConfirmationList-buyerSn" @change="custChange" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="调拨退货单号">
+                <a-input id="returnConfirmationList-salesReturnBillNo" v-model.trim="queryParam.salesReturnBillNo" allowClear placeholder="请输入销退单号"/>
+              </a-form-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="是否抓单">
+                  <v-select
+                    v-model="queryParam.grabFlag"
+                    ref="grabFlag"
+                    id="returnConfirmationList-grabFlag"
+                    code="FLAG"
+                    placeholder="请选择"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="状态">
+                  <v-select
+                    v-model="queryParam.billStatus"
+                    ref="billStatus"
+                    id="returnConfirmationList-billStatus"
+                    code="SALES_RETURN_CONFIRM_STATUS"
+                    placeholder="请选择状态"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+            </template>
+            <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="returnConfirmationList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="returnConfirmationList-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 5px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        :style="{ height: tableHeight+84.5+'px' }"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+        <!-- 销退单号 -->
+        <template slot="salesReturnBillNo" slot-scope="text, record">
+          <span :class="$hasPermissions('B_returnConfirmation_detail')?'active':'common'" @click="handleDetail(record)">{{ record.salesReturnBillNo }}</span>
+        </template>
+        <!-- 操作 -->
+        <template slot="action" slot-scope="text, record">
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.billStatus=='WAIT_FINANCIAL_AUDIT' && $hasPermissions('B_returnConfirmation_return')"
+            class="button-warning"
+            @click="handleAudit(record)"
+            id="returnConfirmationList-audit-btn">退货确认</a-button>
+          <span v-else>--</span>
+        </template>
+      </s-table>
+    </a-spin>
+    <!-- 查看 -->
+    <AllocateReturnDetailModal :openModal="openModal" :itemSn="itemSn" @close="closeModal" />
+  </a-card>
+</template>
+
+<script>
+import rangeDate from '@/views/common/rangeDate.vue'
+import { STable, VSelect } from '@/components'
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+import AllocateReturnDetailModal from './detailModal.vue'
+import { salesReturnFinancialList, salesReturnFinancial } from '@/api/salesReturn'
+export default {
+  components: { STable, VSelect, AllocateReturnDetailModal, dealerSubareaScopeList, rangeDate },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      queryParam: { //  查询条件
+        beginDate: '',
+        endDate: '',
+        salesReturnBillNo: '', //  单号
+        buyerSn: undefined,
+        grabFlag: undefined,
+        billStatus: undefined //  状态
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      advanced: true,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return salesReturnFinancialList(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
+        })
+      },
+      openModal: false,
+      itemSn: ''
+    }
+  },
+  // 根据权限显示列表字段
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '创建时间1', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货单号', scopedSlots: { customRender: 'salesReturnBillNo' }, width: '16%', align: 'center' },
+        { title: '调拨退货客户', dataIndex: 'buyerName', align: 'center', width: '15%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '是否抓单', dataIndex: 'grabFlagDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货总数量', dataIndex: 'totalQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '坏件数量', dataIndex: 'totalQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '返库数量', dataIndex: 'totalQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        // { title: '退货总金额', dataIndex: 'totalAmount', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '确认时间', dataIndex: 'confirmTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
+      ]
+      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
+        arr.splice(8, 0, { title: '退货总金额', dataIndex: 'totalAmount', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      }
+      return arr
+    }
+  },
+  methods: {
+    //  创建时间  change
+    dateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
+    custChange (val) {
+      this.queryParam.buyerSn = val.key
+    },
+    //  重置
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate()
+      this.queryParam.beginDate = ''
+      this.queryParam.endDate = ''
+      this.queryParam.salesReturnBillNo = ''
+      this.queryParam.buyerSn = undefined
+      this.queryParam.grabFlag = undefined
+      this.queryParam.billStatus = undefined
+      this.$refs.dealerSubareaScopeList.resetForm()
+      this.$refs.table.refresh(true)
+    },
+    // 详情
+    handleDetail (row) {
+      if (!this.$hasPermissions('B_returnConfirmation_detail')) { return }
+      this.itemSn = row.salesReturnBillSn
+      this.openModal = true
+    },
+    closeModal () {
+      this.itemSn = ''
+      this.openModal = false
+    },
+    // 单个审核
+    handleAudit (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '请点击下方按钮确认操作',
+        centered: true,
+        closable: true,
+        okText: '通过',
+        cancelText: '不通过',
+        onOk () {
+          _this.auditOrder(row.salesReturnBillSn, 'FINISH')
+        },
+        onCancel (e) {
+          if (!e.triggerCancel) {
+            _this.auditOrder(row.salesReturnBillSn, 'FINANCIAL_REJECT')
+          }
+          _this.$destroyAll()
+        }
+      })
+    },
+    auditOrder (sn, flag) {
+      const _this = this
+      _this.spinning = true
+      salesReturnFinancial({ salesReturnBillSn: sn, billStatus: flag }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
+          _this.spinning = false
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 195
+    }
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    '$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">
+  .returnConfirmationList-wrap{
+    .active{
+      color: #ed1c24;
+      cursor: pointer;
+    }
+    .common{
+      color: rgba(0, 0, 0);
+    }
+  }
+</style>