lilei hace 1 semana
padre
commit
1111e84ef4

+ 25 - 0
src/config/sysSetting.js

@@ -324,6 +324,31 @@ export default {
         }
       ]
     },
+    {
+      path: '/setting/salesReturnRemove',
+      redirect: '/setting/salesReturnRemove/list',
+      name: 'salesReturnRemove',
+      component: BlankLayout,
+      meta: {
+        title: '开单剔除配置',
+        icon: 'sketch',
+        permission: 'M_dailyReportSettings'
+      },
+      hideChildrenInMenu: true,
+      children: [
+        {
+          path: 'list',
+          name: 'salesReturnRemoveList',
+          component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/salesReturnRemove/list.vue'),
+          meta: {
+            title: '开单剔除配置',
+            icon: 'sketch',
+            hidden: true,
+            permission: 'M_dailyReportSettings'
+          }
+        }
+      ]
+    },
     {
       path: '/setting/tireSubsidySetting',
       redirect: '/setting/tireSubsidySetting/index',

+ 6 - 0
src/views/reportData/billingStatistics/index.vue

@@ -8,6 +8,12 @@
         <a-tab-pane key="2" tab="开单统计报表(省份)" force-render>
           <provinceCountList ref="provinceList"></provinceCountList>
         </a-tab-pane>
+        <a-tab-pane key="3" tab="未统计销售退货(客户)" force-render>
+          <provinceCountList ref="provinceList"></provinceCountList>
+        </a-tab-pane>
+        <a-tab-pane key="4" tab="未统计销售退货(省份)" force-render>
+          <provinceCountList ref="provinceList"></provinceCountList>
+        </a-tab-pane>
       </a-tabs>
     </a-card>
   </div>

+ 2 - 14
src/views/setting/dailyReportSettings/baseModal.vue

@@ -21,19 +21,7 @@
         <a-row :gutter="15">
           <a-col :span="20">
             <a-form-model-item label="销售退单号" prop="buyerSn">
-              <a-select
-                show-search
-                id="chooseCustom-buyerSn"
-                v-model="form.buyerSn"
-                placeholder="请输入名称搜索"
-                :filter-option="false"
-                :not-found-content="fetching ? undefined : null"
-                @search="fetchUser"
-                @change="handleChange"
-              >
-                <a-spin v-if="fetching" slot="notFoundContent" size="small" />
-                <a-select-option v-for="item in dealerData" :key="item.dealerSn" :value="item.dealerSn">{{ item.dealerName }}</a-select-option>
-              </a-select>
+              <a-input id="base-salesReturnBillNo" v-model.trim="form.salesReturnBillNo" allowClear placeholder="请输入销售退单号"/>
             </a-form-model-item>
           </a-col>
         </a-row>
@@ -114,7 +102,7 @@ export default {
     return {
       opened: this.show,
       spinning: false,
-      title: '新增销售退货单——选择客户',
+      title: '新增配置',
       confirmLoading: false,
       formItemLayout: {
         labelCol: { span: 6 },

+ 2 - 1
src/views/setting/dailyReportSettings/salesReturnRemove.vue

@@ -37,6 +37,7 @@
           </a-row>
         </a-form>
       </div>
+
       <a-spin :spinning="spinning" tip="Loading...">
         <div class="table-operator" style="flex-grow: 1;display: flex;justify-content: space-between;align-items: center;">
           <div style="flex-grow: 1;display: flex;align-items: center;">
@@ -238,7 +239,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 305
+      this.tableHeight = window.innerHeight - tableSearchH - 300
     }
   },
   watch: {

+ 225 - 0
src/views/setting/salesReturnRemove/baseModal.vue

@@ -0,0 +1,225 @@
+<template>
+  <a-modal
+    v-model="opened"
+    :title="title"
+    centered
+    :maskClosable="false"
+    :confirmLoading="confirmLoading"
+    :width="500"
+    :footer="null"
+    @cancel="cancel"
+  >
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-form-model
+        id="chooseCustom-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <a-row :gutter="15">
+          <a-col :span="20">
+            <a-form-model-item label="销售退单号" prop="buyerSn">
+              <a-input id="base-salesReturnBillNo" v-model.trim="form.salesReturnBillNo" allowClear placeholder="请输入销售退单号"/>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="15">
+          <a-col :span="20">
+            <a-form-model-item label="客户名称" prop="buyerName">
+              {{ form.dearlerName||'--' }}
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="15">
+          <a-col :span="20">
+            <a-form-model-item label="开单统计(客户)" prop="goodFlag">
+              <a-radio-group name="radioGroup">
+                <a-radio value="1">剔除</a-radio>
+                <a-radio value="2">不剔除</a-radio>
+              </a-radio-group>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="15">
+          <a-col :span="20">
+            <a-form-model-item label="开单统计(省份)" prop="goodFlag">
+              <a-radio-group name="radioGroup">
+                <a-radio value="1">剔除</a-radio>
+                <a-radio value="2">不剔除</a-radio>
+              </a-radio-group>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+        <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
+          <a-button @click="cancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
+          <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">保存</a-button>
+        </a-form-model-item>
+      </a-form-model>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { VSelect } from '@/components'
+import debounce from 'lodash/debounce'
+import warehouse from '@/views/common/chooseWarehouse.js'
+import { dealerSubareaScopeList, dealerDetailBySn } from '@/api/dealer'
+import { getDefaultWarehouse } from '@/api/warehouse'
+import { salesReturnInsert } from '@/api/salesReturn'
+export default {
+  name: 'BaseModal',
+  mixins: [commonMixin],
+  components: { VSelect, warehouse },
+  props: {
+    show: [Boolean]
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      opened: this.show,
+      spinning: false,
+      title: '新增配置',
+      confirmLoading: false,
+      formItemLayout: {
+        labelCol: { span: 8 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        buyerName: '', // 客户名称
+        buyerSn: undefined, // 客户sn
+        contactTel: '', //  联系电话
+        contactName: '', //  联系人
+        provinceSn: '', //  省
+        provinceName: '',
+        citySn: '', // 市
+        cityName: '',
+        countySn: '', // 区
+        countyName: '',
+        customerAddr: '', //  详细地址
+        warehouseSn: undefined, // 退货仓库
+        syncFlag: undefined, // 是否同步
+        goodFlag: undefined
+      },
+      rules: {
+        buyerSn: [{ required: true, message: '请选择客户', trigger: ['change', 'blur'] }],
+        warehouseSn: [{ required: true, message: '请选择退货仓库', trigger: 'change' }],
+        syncFlag: [{ required: true, message: '请选择是否同步', trigger: ['change', 'blur'] }],
+        goodFlag: [{ required: true, message: '请选择退货类别', trigger: ['change', 'blur'] }]
+      },
+      fetching: false,
+      dealerData: []
+    }
+  },
+  methods: {
+    fetchUser (dealerName) {
+      if (dealerName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.dealerData = []
+      this.fetching = true
+      dealerSubareaScopeList({ nameLike: dealerName.replace(/\s+/g, ''), pageNo: 1, pageSize: 20 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.dealerData = res.data && res.data.list ? res.data.list : []
+        this.fetching = false
+      })
+    },
+    // 客户  change
+    handleChange (value) {
+      dealerDetailBySn({ sn: this.form.buyerSn }).then(res => {
+        if (res.data) {
+          const data = res.data
+          this.form = Object.assign(this.form, {
+            buyerName: data.dealerName, // 客户名称
+            buyerSn: data.dealerSn, // 客户sn
+            contactTel: data.contactMobile, //  联系电话
+            contactName: data.contact, //  联系人
+            provinceSn: data.provinceSn, //  省
+            provinceName: data.provinceName,
+            citySn: data.citySn, // 市
+            cityName: data.cityName,
+            countySn: data.districtSn, // 区
+            countyName: data.districtName,
+            customerAddr: data.address //  详细地址
+          })
+          console.log(this.form)
+        } else {
+          this.$message.error('获取客户信息失败')
+        }
+      })
+    },
+    //  保存
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          // 保存销售单
+          _this.salesSaveFun()
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    // 新建销售退货单
+    salesSaveFun () {
+      const _this = this
+      const form = this.form
+      console.log(form, 'save data')
+      _this.spinning = true
+      salesReturnInsert(form).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$emit('ok', res.data)
+          _this.cancel()
+          _this.spinning = false
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    getDefaultWarehouse () {
+      getDefaultWarehouse().then(res => {
+        this.form.warehouseSn = res.data ? res.data.warehouseSn : undefined
+      })
+    },
+    cancel () {
+      this.opened = false
+      this.form = {
+        salesReturnBillSource: 'SALES',
+        buyerName: '', // 客户名称
+        buyerSn: undefined, // 客户sn
+        contactTel: '', //  联系电话
+        contactName: '', //  联系人
+        provinceSn: '', //  省
+        provinceName: '',
+        citySn: '', // 市
+        cityName: '',
+        countySn: '', // 区
+        countyName: '',
+        customerAddr: '', //  详细地址
+        warehouseSn: undefined,
+        syncFlag: undefined, // 是否同步
+        goodFlag: undefined
+      }
+      this.$refs.ruleForm.resetFields()
+      this.dealerData = []
+      this.$emit('cancel')
+    }
+  },
+  watch: {
+    show (newValue, oldValue) {
+      this.opened = newValue
+      if (newValue) {
+        this.getDefaultWarehouse()
+      }
+    }
+  }
+}
+</script>

+ 279 - 0
src/views/setting/salesReturnRemove/list.vue

@@ -0,0 +1,279 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="searchBoxNormal">
+      <!-- 搜索条件 -->
+      <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="rangeCreateDate" id="salesReturnRemove-createDate" :value="createDate" @change="dateCreateChange" />
+              </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="salesReturnRemove-buyerSn" @change="custChange" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="总部销退单号">
+                <a-input id="salesReturnRemove-salesReturnBillNo" v-model.trim="queryParam.salesReturnBillNo" allowClear placeholder="请输入总部销退单号"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <span class="table-page-search-submitButtons">
+                <a-button id="salesReturnRemove-search" type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
+                <a-button id="salesReturnRemove-reset" style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
+                <a-button
+                  style="margin-left: 10px"
+                  type="primary"
+                  class="button-warning"
+                  @click="handleExport"
+                  :disabled="disabled"
+                  :loading="exportLoading"
+                  id="salesReturnRemove-export">导出</a-button>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </a-card>
+    <a-card size="small" :bordered="false" class="searchBoxNormal">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <div class="table-operator" style="flex-grow: 1;display: flex;justify-content: space-between;align-items: center;">
+          <div style="flex-grow: 1;display: flex;align-items: center;">
+            <!-- 操作按钮 -->
+            <div>
+              <a-button type="primary" v-if="$hasPermissions('B_salesReturnNew')" @click="handleEdit">新增</a-button>
+            </div>
+          </div>
+          <div></div>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          :style="{ height: tableHeight+75+'px' }"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record, index">
+            <div>
+              <a-button
+                size="small"
+                type="link"
+                class="button-info"
+                @click="handleEdit(record)"
+                :id="'salesReturnRemove-edit-btn'+index">编辑</a-button>
+              <a-button
+                size="small"
+                type="link"
+                class="button-error"
+                @click="handleDel(record)"
+                :id="'salesReturnRemove-del-btn'+index">删除</a-button>
+            </div>
+          </template>
+        </s-table>
+      </a-spin>
+      <!-- 选择客户弹框 -->
+      <baseModal :show="openModal" ref="openModal" @ok="handleEdit" @cancel="openModal=false"></baseModal>
+    </a-card>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import baseModal from './baseModal.vue'
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+import rangeDate from '@/views/common/rangeDate.vue'
+import { salesReturnList, salesReturnQueryCount, salesReturnDel, salesReturnCancelBill, salesReturnSubmit, submitVerify } from '@/api/salesReturn'
+import moment from 'moment'
+import getDate from '@/libs/getDate.js'
+export default {
+  name: 'SalesReturnList',
+  mixins: [commonMixin],
+  components: {
+    STable,
+    VSelect,
+    baseModal,
+    dealerSubareaScopeList,
+    rangeDate
+  },
+  data () {
+    return {
+      spinning: false,
+      // 高级搜索 展开/关闭
+      advanced: true,
+      tableHeight: 0,
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      createDate: [
+        moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
+        moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
+      ], //  创建时间
+      openModal: false, // 选择客户弹框是否显示
+      openDepartUserModal: false,
+      // 查询参数
+      queryParam: {
+        beginDate: getDate.getThreeMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime,
+        buyerSn: undefined, //  客户名称
+        salesReturnBillNo: undefined //  总部销退单号
+      },
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        return salesReturnList(params).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
+        })
+      },
+      visibleAudit: false
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '编号', dataIndex: 'no', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '总部销退单号', dataIndex: 'salesReturnBillNo', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货日期', dataIndex: 'createDate', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '全国销售日报', dataIndex: 'goodFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '项目销售日报1', dataIndex: 'salesReturnTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '项目销售日报2', dataIndex: 'billStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区销售日报', dataIndex: 'billStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '创建时间', dataIndex: 'billStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
+      ]
+      return arr
+    }
+  },
+  methods: {
+    //  创建时间  change
+    dateCreateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
+    // 选择客户
+    custChange (val) {
+      this.queryParam.buyerSn = val.key
+    },
+    //  导出  必填判断
+    handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.exportList()
+        } else {
+          _this.$message.error('请选择时间')
+          return false
+        }
+      })
+    },
+    // 导出
+    exportList () {
+      const _this = this
+      const params = JSON.parse(JSON.stringify(_this.queryParam))
+      _this.exportLoading = true
+      _this.spinning = true
+      hdExportExcel(manageAnalysisReportExport, params, '各品类经营分析表-' + this.monthVal + '-', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+      })
+    },
+    // 编辑
+    handleEdit (row) {
+      this.openModal = true
+      this.$refs.openModal.edit(row)
+    },
+    // 删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要删除吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          salesReturnDel({ salesReturnBillSn: row.salesReturnBillSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+            _this.spinning = false
+          })
+        }
+      })
+    },
+    resetSearchForm () {
+      this.$refs.rangeCreateDate.resetDate(this.createDate)
+      this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.queryParam.buyerSn = undefined
+      this.$refs.dealerSubareaScopeList.resetForm()
+      this.queryParam.salesReturnBillNo = ''
+
+      this.$refs.table.refresh(true)
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 250
+    }
+  },
+  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>