Przeglądaj źródła

配置接口调试

lilei 1 tydzień temu
rodzic
commit
64ad7ad970

+ 84 - 0
src/api/bizRemove.js

@@ -0,0 +1,84 @@
+import { axios } from '@/utils/request'
+
+// 根据销售退货单号查询客户
+export const salesReturnDetailByNo = (params) => {
+  return axios({
+    url: `/salesReturn/findByNo/${params.salesReturnBillNo}`,
+    data: params,
+    method: 'get',
+    headers: {
+      'module': encodeURIComponent('根据销售退货单号查询客户信息')
+    }
+  })
+}
+//  根据sn查询销售退货剔除配置
+export const bizRemoveConfigDetail = (params) => {
+  return axios({
+    url: `/bizRemoveConfig/findBySn`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('销售退货剔除配置详情')
+    }
+  })
+}
+//  销售退货剔除配置创建
+export const bizRemoveConfigCreate = (params) => {
+  return axios({
+    url: `/bizRemoveConfig/create`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('创建销售退货剔除配置')
+    }
+  })
+}
+//  销售退货剔除配置修改
+export const bizRemoveConfigModify = (params) => {
+  return axios({
+    url: `/bizRemoveConfig/modify`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('修改销售退货剔除配置')
+    }
+  })
+}
+//  销售退货剔除配删除
+export const bizRemoveConfigDelete = (params) => {
+  return axios({
+    url: `/bizRemoveConfig/delete`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('删除销售退货剔除配置')
+    }
+  })
+}
+// 销售退货剔除配置列表
+export const bizRemoveConfigPageList = (params) => {
+  const url = `/bizRemoveConfig/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('销售退货剔除配置列表查询')
+    }
+  })
+}
+
+// 导出
+export const bizRemoveConfigReportExport = (params) => {
+  return axios({
+    url: `/bizRemoveConfig/reportExport`,
+    data: params,
+    method: 'post',
+    responseType: 'blob',
+    headers: {
+      'module': encodeURIComponent('销售退货剔除配置导出')
+    }
+  })
+}

+ 84 - 96
src/views/setting/dailyReportSettings/baseModal.vue

@@ -20,54 +20,54 @@
       >
         <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 label="销售退货单号" prop="salesReturnBillNo">
+              <a-input id="base-salesReturnBillNo" v-model.trim="form.salesReturnBillNo" @change="fetchUser" allowClear placeholder="请输入销售退单号"/>
             </a-form-model-item>
           </a-col>
         </a-row>
         <a-row :gutter="15">
           <a-col :span="20">
-            <a-form-model-item label="客户名称" prop="syncFlag">
-              {{ form.dearlerName||'--' }}
+            <a-form-model-item label="客户名称" prop="buyerSn">
+              {{ dealerData&&dealerData.buyerName||'--' }}
             </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-form-model-item label="全国销售日报" prop="countrySalesDay">
+              <a-radio-group name="radioGroup" v-model="form.countrySalesDay">
                 <a-radio value="1">剔除</a-radio>
-                <a-radio value="2">不剔除</a-radio>
+                <a-radio value="0">不剔除</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="项目销售日报1" prop="goodFlag">
-              <a-radio-group name="radioGroup">
+            <a-form-model-item label="项目销售日报1" prop="dailyPl">
+              <a-radio-group name="radioGroup1" v-model="form.dailyPl">
                 <a-radio value="1">剔除</a-radio>
-                <a-radio value="2">不剔除</a-radio>
+                <a-radio value="0">不剔除</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="项目销售日报2" prop="goodFlag">
-              <a-radio-group name="radioGroup">
+            <a-form-model-item label="项目销售日报2" prop="dailyPljl">
+              <a-radio-group name="radioGroup2" v-model="form.dailyPljl">
                 <a-radio value="1">剔除</a-radio>
-                <a-radio value="2">不剔除</a-radio>
+                <a-radio value="0">不剔除</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-form-model-item label="分区销售日报" prop="areaSalesDay">
+              <a-radio-group name="radioGroup3" v-model="form.areaSalesDay">
                 <a-radio value="1">剔除</a-radio>
-                <a-radio value="2">不剔除</a-radio>
+                <a-radio value="0">不剔除</a-radio>
               </a-radio-group>
             </a-form-model-item>
           </a-col>
@@ -86,9 +86,7 @@ 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'
+import { bizRemoveConfigCreate, bizRemoveConfigModify, bizRemoveConfigDetail, salesReturnDetailByNo } from '@/api/bizRemove'
 export default {
   name: 'BaseModal',
   mixins: [commonMixin],
@@ -109,69 +107,51 @@ export default {
         wrapperCol: { span: 18 }
       },
       form: {
-        salesReturnBillSource: 'SALES',
-        buyerName: '', // 客户名称
-        buyerSn: undefined, // 客户sn
-        contactTel: '', //  联系电话
-        contactName: '', //  联系人
-        provinceSn: '', //  省
-        provinceName: '',
-        citySn: '', // 市
-        cityName: '',
-        countySn: '', // 区
-        countyName: '',
-        customerAddr: '', //  详细地址
-        warehouseSn: undefined, // 退货仓库
-        syncFlag: undefined, // 是否同步
-        goodFlag: undefined
+        salesReturnBillNo: '',
+        buyerSn: undefined,
+        configType: 'DAILY_REPORT',
+        bizSn: undefined, // bizsn
+        dailyPl: undefined,
+        countrySalesDay: undefined,
+        dailyPljl: undefined,
+        areaSalesDay: undefined
       },
       rules: {
+        salesReturnBillNo: [{ required: true, message: '请输入销售退货单号', trigger: ['change', 'blur'] }],
         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'] }]
+        dailyPl: [{ required: true, message: '请选择', trigger: ['change', 'blur'] }],
+        countrySalesDay: [{ required: true, message: '请选择', trigger: ['change', 'blur'] }],
+        dailyPljl: [{ required: true, message: '请选择', trigger: ['change', 'blur'] }],
+        areaSalesDay: [{ required: true, message: '请选择', trigger: ['change', 'blur'] }]
       },
       fetching: false,
-      dealerData: []
+      dealerData: null,
+      bizSn: undefined
     }
   },
   methods: {
-    fetchUser (dealerName) {
-      if (dealerName == '') return
+    fetchUser () {
+      if (!this.form.salesReturnBillNo) return
       this.lastFetchId += 1
       const fetchId = this.lastFetchId
-      this.dealerData = []
+      this.dealerData = null
       this.fetching = true
-      dealerSubareaScopeList({ nameLike: dealerName.replace(/\s+/g, ''), pageNo: 1, pageSize: 20 }).then(res => {
+      this.spinning = true
+      salesReturnDetailByNo({ salesReturnBillNo: this.form.salesReturnBillNo }).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)
+          this.dealerData = res.data
+          this.form.buyerSn = res.data.buyerSn
+          this.form.bizSn = res.data.salesReturnBillSn
         } else {
-          this.$message.error('获取客户信息失败')
+          this.dealerData = null
+          this.form.buyerSn = undefined
+          this.form.bizSn = undefined
         }
+        this.spinning = false
+        this.fetching = false
       })
     },
     //  保存
@@ -180,10 +160,9 @@ export default {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          // 保存销售单
+          // 保存
           _this.salesSaveFun()
         } else {
-          console.log('error submit!!')
           return false
         }
       })
@@ -192,54 +171,63 @@ export default {
     salesSaveFun () {
       const _this = this
       const form = this.form
-      console.log(form, 'save data')
+      const funs = !this.bizSn ? bizRemoveConfigCreate : bizRemoveConfigModify
       _this.spinning = true
-      salesReturnInsert(form).then(res => {
+      funs(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
+        _this.spinning = false
       })
     },
     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
+        configType: 'DAILY_REPORT',
+        salesReturnBillNo: '',
+        buyerSn: undefined,
+        bizSn: undefined, // bizsn
+        dailyPl: undefined,
+        countrySalesDay: undefined,
+        dailyPljl: undefined,
+        areaSalesDay: undefined
       }
+      this.bizSn = undefined
+      this.dealerData = null
       this.$refs.ruleForm.resetFields()
-      this.dealerData = []
       this.$emit('cancel')
+    },
+    getDetail () {
+      bizRemoveConfigDetail({ bizSn: this.bizSn, configType: 'DAILY_REPORT' }).then(res => {
+        const { bizSn, bizNo, dealerSn, dealerName, areaSalesDay, countrySalesDay, dailyPl, dailyPljl } = res.data
+        this.dealerData = { buyerName: dealerName }
+        this.form = Object.assign(this.form, {
+          salesReturnBillNo: bizNo,
+          buyerSn: dealerSn,
+          bizSn: bizSn,
+          dailyPl: dailyPl,
+          countrySalesDay: countrySalesDay,
+          dailyPljl: dailyPljl,
+          areaSalesDay: areaSalesDay
+        })
+      })
+    },
+    edit (row) {
+      if (row && row.bizSn) {
+        this.title = '编辑配置'
+        this.bizSn = row.bizSn
+        this.getDetail()
+      } else {
+        this.title = '新增配置'
+        this.bizSn = undefined
+      }
     }
   },
   watch: {
     show (newValue, oldValue) {
       this.opened = newValue
-      if (newValue) {
-        this.getDefaultWarehouse()
-      }
     }
   }
 }

+ 33 - 35
src/views/setting/dailyReportSettings/salesReturnRemove.vue

@@ -12,12 +12,12 @@
             </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" />
+                <dealerSubareaScopeList ref="dealerSubareaScopeList" id="salesReturnRemove-dealerSn" @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-input id="salesReturnRemove-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入总部销退单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -67,12 +67,14 @@
                 size="small"
                 type="link"
                 class="button-info"
+                v-if="record.show"
                 @click="handleEdit(record)"
                 :id="'salesReturnRemove-edit-btn'+index">编辑</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-error"
+                v-if="record.show"
                 @click="handleDel(record)"
                 :id="'salesReturnRemove-del-btn'+index">删除</a-button>
             </div>
@@ -80,7 +82,7 @@
         </s-table>
       </a-spin>
       <!-- 选择客户弹框 -->
-      <baseModal :show="openModal" ref="openModal" @ok="handleEdit" @cancel="openModal=false"></baseModal>
+      <baseModal :show="openModal" ref="openModal" @ok="handleOk" @cancel="openModal=false"></baseModal>
     </a-card>
   </div>
 </template>
@@ -89,13 +91,14 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import baseModal from './baseModal.vue'
+import { hdExportExcel } from '@/libs/exportExcel'
 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 { bizRemoveConfigPageList, bizRemoveConfigDelete, bizRemoveConfigReportExport } from '@/api/bizRemove'
 import moment from 'moment'
 import getDate from '@/libs/getDate.js'
 export default {
-  name: 'SalesReturnList',
+  name: 'SalesReturnRemove',
   mixins: [commonMixin],
   components: {
     STable,
@@ -120,23 +123,25 @@ export default {
       openDepartUserModal: false,
       // 查询参数
       queryParam: {
+        configType: 'DAILY_REPORT',
         beginDate: getDate.getThreeMonthDays().starttime,
         endDate: getDate.getCurrMonthDays().endtime,
-        buyerSn: undefined, //  客户名称
-        salesReturnBillNo: undefined //  总部销退单号
+        dealerSn: undefined, //  客户名称
+        bizNo: undefined //  总部销退单号
       },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
-        return salesReturnList(params).then(res => {
+        return bizRemoveConfigPageList(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
+              data.list[i].show = new Date(data.list[i].bizDate).getMonth() == new Date().getMonth()
             }
             this.disabled = false
           }
@@ -149,16 +154,17 @@ export default {
   },
   computed: {
     columns () {
+      const a = ['', '剔除']
       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: '总部销退单号', dataIndex: 'bizNo', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货日期', dataIndex: 'bizDate', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'dealerName', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '全国销售日报', dataIndex: 'countrySalesDay', width: '6%', align: 'center', customRender: function (text) { return a[text] } },
+        { title: '项目销售日报1', dataIndex: 'dailyPl', width: '6%', align: 'center', customRender: function (text) { return a[text] } },
+        { title: '项目销售日报2', dataIndex: 'dailyPljl', width: '5%', align: 'center', customRender: function (text) { return a[text] } },
+        { title: '分区销售日报', dataIndex: 'areaSalesDay', width: '5%', align: 'center', customRender: function (text) { return a[text] } },
+        { title: '创建时间', dataIndex: 'createDate', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
       ]
       return arr
@@ -172,27 +178,15 @@ export default {
     },
     // 选择客户
     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
-        }
-      })
+      this.queryParam.dealerSn = val.key
     },
     // 导出
-    exportList () {
+    handleExport () {
       const _this = this
       const params = JSON.parse(JSON.stringify(_this.queryParam))
       _this.exportLoading = true
       _this.spinning = true
-      hdExportExcel(manageAnalysisReportExport, params, '各品类经营分析表-' + this.monthVal + '-', function () {
+      hdExportExcel(bizRemoveConfigReportExport, params, '每日报表销售退货剔除配置-', function () {
         _this.exportLoading = false
         _this.spinning = false
       })
@@ -202,16 +196,19 @@ export default {
       this.openModal = true
       this.$refs.openModal.edit(row)
     },
+    handleOk (res) {
+      this.$refs.table.refresh()
+    },
     // 删除
     handleDel (row) {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确认要删除吗?',
+        content: <div>销退单号:{row.bizNo}<div>确认要删除吗?</div></div>,
         centered: true,
         onOk () {
           _this.spinning = true
-          salesReturnDel({ salesReturnBillSn: row.salesReturnBillSn }).then(res => {
+          bizRemoveConfigDelete({ bizSn: row.bizSn, configType: 'DAILY_REPORT' }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -221,13 +218,14 @@ export default {
         }
       })
     },
+    // 重置查询
     resetSearchForm () {
       this.$refs.rangeCreateDate.resetDate(this.createDate)
       this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
       this.queryParam.endDate = getDate.getCurrMonthDays().endtime
-      this.queryParam.buyerSn = undefined
+      this.queryParam.dealerSn = undefined
       this.$refs.dealerSubareaScopeList.resetForm()
-      this.queryParam.salesReturnBillNo = ''
+      this.queryParam.bizNo = ''
 
       this.$refs.table.refresh(true)
     },

+ 71 - 90
src/views/setting/salesReturnRemove/baseModal.vue

@@ -5,7 +5,7 @@
     centered
     :maskClosable="false"
     :confirmLoading="confirmLoading"
-    :width="500"
+    :width="560"
     :footer="null"
     @cancel="cancel"
   >
@@ -20,34 +20,34 @@
       >
         <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 label="销售退货单号" prop="salesReturnBillNo">
+              <a-input id="base-salesReturnBillNo" v-model.trim="form.salesReturnBillNo" @change="fetchUser" 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 label="客户名称" prop="buyerSn">
+              {{ dealerData&&dealerData.buyerName||'--' }}
             </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-form-model-item label="开单统计(客户)" prop="salesStatsDealer">
+              <a-radio-group name="radioGroup" v-model="form.salesStatsDealer">
                 <a-radio value="1">剔除</a-radio>
-                <a-radio value="2">不剔除</a-radio>
+                <a-radio value="0">不剔除</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-form-model-item label="开单统计(省份)" prop="salesStatsProvince">
+              <a-radio-group name="radioGroup1" v-model="form.salesStatsProvince">
                 <a-radio value="1">剔除</a-radio>
-                <a-radio value="2">不剔除</a-radio>
+                <a-radio value="0">不剔除</a-radio>
               </a-radio-group>
             </a-form-model-item>
           </a-col>
@@ -66,9 +66,7 @@ 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'
+import { bizRemoveConfigCreate, bizRemoveConfigModify, bizRemoveConfigDetail, salesReturnDetailByNo } from '@/api/bizRemove'
 export default {
   name: 'BaseModal',
   mixins: [commonMixin],
@@ -89,68 +87,47 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
-        buyerName: '', // 客户名称
-        buyerSn: undefined, // 客户sn
-        contactTel: '', //  联系电话
-        contactName: '', //  联系人
-        provinceSn: '', //  省
-        provinceName: '',
-        citySn: '', // 市
-        cityName: '',
-        countySn: '', // 区
-        countyName: '',
-        customerAddr: '', //  详细地址
-        warehouseSn: undefined, // 退货仓库
-        syncFlag: undefined, // 是否同步
-        goodFlag: undefined
+        salesReturnBillNo: '',
+        buyerSn: undefined,
+        configType: 'BILLING_REPORT',
+        bizSn: undefined, // bizsn
+        salesStatsProvince: undefined,
+        salesStatsDealer: undefined
       },
       rules: {
+        salesReturnBillNo: [{ required: true, message: '请输入销售退货单号', trigger: ['change', 'blur'] }],
         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'] }]
+        salesStatsProvince: [{ required: true, message: '请选择', trigger: ['change', 'blur'] }],
+        salesStatsDealer: [{ required: true, message: '请选择', trigger: ['change', 'blur'] }]
       },
       fetching: false,
-      dealerData: []
+      dealerData: null,
+      bizSn: undefined
     }
   },
   methods: {
-    fetchUser (dealerName) {
-      if (dealerName == '') return
+    fetchUser () {
+      if (!this.form.salesReturnBillNo) return
       this.lastFetchId += 1
       const fetchId = this.lastFetchId
-      this.dealerData = []
+      this.dealerData = null
+      this.spinning = true
       this.fetching = true
-      dealerSubareaScopeList({ nameLike: dealerName.replace(/\s+/g, ''), pageNo: 1, pageSize: 20 }).then(res => {
+      salesReturnDetailByNo({ salesReturnBillNo: this.form.salesReturnBillNo }).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)
+          this.dealerData = res.data
+          this.form.buyerSn = res.data.buyerSn
+          this.form.bizSn = res.data.salesReturnBillSn
         } else {
-          this.$message.error('获取客户信息失败')
+          this.dealerData = null
+          this.form.buyerSn = undefined
+          this.form.bizSn = undefined
         }
+        this.fetching = false
+        this.spinning = false
       })
     },
     //  保存
@@ -159,10 +136,9 @@ export default {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          // 保存销售单
+          // 保存
           _this.salesSaveFun()
         } else {
-          console.log('error submit!!')
           return false
         }
       })
@@ -171,54 +147,59 @@ export default {
     salesSaveFun () {
       const _this = this
       const form = this.form
-      console.log(form, 'save data')
+      const funs = !this.bizSn ? bizRemoveConfigCreate : bizRemoveConfigModify
       _this.spinning = true
-      salesReturnInsert(form).then(res => {
+      funs(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
+        _this.spinning = false
       })
     },
     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
+        configType: 'BILLING_REPORT',
+        salesReturnBillNo: '',
+        buyerSn: undefined,
+        bizSn: undefined, // bizsn
+        salesStatsProvince: undefined,
+        salesStatsDealer: undefined
       }
+      this.bizSn = undefined
+      this.dealerData = null
       this.$refs.ruleForm.resetFields()
-      this.dealerData = []
       this.$emit('cancel')
+    },
+    getDetail () {
+      bizRemoveConfigDetail({ bizSn: this.bizSn, configType: 'BILLING_REPORT' }).then(res => {
+        const { bizSn, bizNo, dealerSn, dealerName, salesStatsDealer, salesStatsProvince } = res.data
+        this.dealerData = { buyerName: dealerName }
+        this.form = Object.assign(this.form, {
+          salesReturnBillNo: bizNo,
+          buyerSn: dealerSn,
+          bizSn: bizSn,
+          salesStatsProvince: salesStatsProvince,
+          salesStatsDealer: salesStatsDealer
+        })
+      })
+    },
+    edit (row) {
+      if (row && row.bizSn) {
+        this.title = '编辑配置'
+        this.bizSn = row.bizSn
+        this.getDetail()
+      } else {
+        this.title = '新增配置'
+        this.bizSn = undefined
+      }
     }
   },
   watch: {
     show (newValue, oldValue) {
       this.opened = newValue
-      if (newValue) {
-        this.getDefaultWarehouse()
-      }
     }
   }
 }

+ 34 - 37
src/views/setting/salesReturnRemove/list.vue

@@ -12,12 +12,12 @@
             </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" />
+                <dealerSubareaScopeList ref="dealerSubareaScopeList" id="salesReturnRemove-dealerSn" @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-input id="salesReturnRemove-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入总部销退单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -38,6 +38,7 @@
         </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;">
@@ -68,12 +69,14 @@
                 size="small"
                 type="link"
                 class="button-info"
+                v-if="record.show"
                 @click="handleEdit(record)"
                 :id="'salesReturnRemove-edit-btn'+index">编辑</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-error"
+                v-if="record.show"
                 @click="handleDel(record)"
                 :id="'salesReturnRemove-del-btn'+index">删除</a-button>
             </div>
@@ -81,7 +84,7 @@
         </s-table>
       </a-spin>
       <!-- 选择客户弹框 -->
-      <baseModal :show="openModal" ref="openModal" @ok="handleEdit" @cancel="openModal=false"></baseModal>
+      <baseModal :show="openModal" ref="openModal" @ok="handleOk" @cancel="openModal=false"></baseModal>
     </a-card>
   </div>
 </template>
@@ -90,13 +93,14 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import baseModal from './baseModal.vue'
+import { hdExportExcel } from '@/libs/exportExcel'
 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 { bizRemoveConfigPageList, bizRemoveConfigDelete, bizRemoveConfigReportExport } from '@/api/bizRemove'
 import moment from 'moment'
 import getDate from '@/libs/getDate.js'
 export default {
-  name: 'SalesReturnList',
+  name: 'SalesReturnRemove',
   mixins: [commonMixin],
   components: {
     STable,
@@ -121,23 +125,25 @@ export default {
       openDepartUserModal: false,
       // 查询参数
       queryParam: {
+        configType: 'BILLING_REPORT',
         beginDate: getDate.getThreeMonthDays().starttime,
         endDate: getDate.getCurrMonthDays().endtime,
-        buyerSn: undefined, //  客户名称
-        salesReturnBillNo: undefined //  总部销退单号
+        dealerSn: undefined, //  客户名称
+        bizNo: undefined //  总部销退单号
       },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
-        return salesReturnList(params).then(res => {
+        return bizRemoveConfigPageList(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
+              data.list[i].show = new Date(data.list[i].bizDate).getMonth() == new Date().getMonth()
             }
             this.disabled = false
           }
@@ -150,17 +156,16 @@ export default {
   },
   computed: {
     columns () {
+      const a = ['', '剔除']
       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' }
+        { title: '总部销退单号', dataIndex: 'bizNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货日期', dataIndex: 'bizDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'dealerName', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '开单统计(客户)', dataIndex: 'salesStatsDealer', width: '10%', align: 'center', customRender: function (text) { return a[text] } },
+        { title: '开单统计(省份)', dataIndex: 'salesStatsProvince', width: '10%', align: 'center', customRender: function (text) { return a[text] } },
+        { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
       return arr
     }
@@ -173,27 +178,15 @@ export default {
     },
     // 选择客户
     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
-        }
-      })
+      this.queryParam.dealerSn = val.key
     },
     // 导出
-    exportList () {
+    handleExport () {
       const _this = this
       const params = JSON.parse(JSON.stringify(_this.queryParam))
       _this.exportLoading = true
       _this.spinning = true
-      hdExportExcel(manageAnalysisReportExport, params, '各品类经营分析表-' + this.monthVal + '-', function () {
+      hdExportExcel(bizRemoveConfigReportExport, params, '开单剔除配置-', function () {
         _this.exportLoading = false
         _this.spinning = false
       })
@@ -203,16 +196,19 @@ export default {
       this.openModal = true
       this.$refs.openModal.edit(row)
     },
+    handleOk (res) {
+      this.$refs.table.refresh()
+    },
     // 删除
     handleDel (row) {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确认要删除吗?',
+        content: <div>销退单号:{row.bizNo}<div>确认要删除吗?</div></div>,
         centered: true,
         onOk () {
           _this.spinning = true
-          salesReturnDel({ salesReturnBillSn: row.salesReturnBillSn }).then(res => {
+          bizRemoveConfigDelete({ bizSn: row.bizSn, configType: 'BILLING_REPORT' }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -222,13 +218,14 @@ export default {
         }
       })
     },
+    // 重置查询
     resetSearchForm () {
       this.$refs.rangeCreateDate.resetDate(this.createDate)
       this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
       this.queryParam.endDate = getDate.getCurrMonthDays().endtime
-      this.queryParam.buyerSn = undefined
+      this.queryParam.dealerSn = undefined
       this.$refs.dealerSubareaScopeList.resetForm()
-      this.queryParam.salesReturnBillNo = ''
+      this.queryParam.bizNo = ''
 
       this.$refs.table.refresh(true)
     },
@@ -240,7 +237,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 250
+      this.tableHeight = window.innerHeight - tableSearchH - 245
     }
   },
   watch: {