lilei 4 år sedan
förälder
incheckning
a2168632ea

+ 0 - 70
src/views/common/custList.js

@@ -1,70 +0,0 @@
-import { custAllList } from '@/api/customer'
-const CustList = {
-  template: `
-        <a-select
-          :id="id"
-          placeholder="请选择客户"
-          allowClear
-          :value="defaultVal"
-          :showSearch="true"
-          @change="handleChange"
-          :filter-option="filterOption">
-          <a-select-option v-for="item in custAllList" :key="item[defValKey]" :value="item[defValKey]">{{ item.customerName }}</a-select-option>
-        </a-select>
-    `,
-  props: {
-    value: {
-      type: String,
-      defatut: ''
-    },
-    id: {
-      type: String,
-      default: ''
-    },
-    defValKey: {
-      type: String,
-      default: 'customerName'
-    }
-  },
-  data() {
-    return {
-      defaultVal: this.value,
-      custAllList: []
-    };
-  },
-  watch: {
-    value(newValue, oldValue) {
-      console.log(newValue)
-      this.defaultVal = newValue
-    }
-  },
-  mounted() {
-    this.getCustAllList()
-  },
-  methods: {
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
-    },
-    handleChange(value) {
-      console.log(value)
-      this.defaultVal = value;
-      this.$emit('change', this.value);
-      this.$emit('input', value);
-    },
-    // 客户无分页列表数据
-    getCustAllList () {
-      const _this = this
-      custAllList().then(res => {
-        if (res.status == 200) {
-          _this.custAllList = res.data || []
-        } else {
-          _this.custAllList = []
-        }
-      })
-    },
-  },
-};
-
-export default CustList

+ 63 - 0
src/views/common/custList.vue

@@ -0,0 +1,63 @@
+<template>
+  <a-select
+    show-search
+    label-in-value
+    :value="dealerName"
+    placeholder="请输入客户名称搜索"
+    style="width: 100%"
+    :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 data" :key="item.dealerSn" :value="item.dealerSn">
+      {{ item.dealerName }}
+    </a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import { dealerQueryList } from '@/api/dealer'
+export default {
+  props: {
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      dealerName: [],
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (dealerName) {
+      console.log('fetching user', dealerName)
+      if (dealerName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      dealerQueryList({ 'nameLike': dealerName, pageNo: 1, pageSize: 1000 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data.list || []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      Object.assign(this, {
+        dealerName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value)
+    },
+    resetForm () {
+      this.dealerName = []
+    }
+  }
+}
+</script>

+ 1 - 1
src/views/salesManagement/backorder/list.vue

@@ -48,7 +48,7 @@
 
 <script>
 // import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data'
-import custList from '@/views/common/custList.js'
+import custList from '@/views/common/custList.vue'
 import { STable, VSelect } from '@/components'
 export default {
   components: { STable, VSelect, custList },

+ 2 - 2
src/views/salesManagement/examineVerify/list.vue

@@ -102,7 +102,7 @@
 
 <script>
 import { dispatchlList, dispatchQueryCount, dispatchStockUpAduit } from '@/api/dispatch'
-import custList from '@/views/common/custList.js'
+import custList from '@/views/common/custList.vue'
 import { STable, VSelect } from '@/components'
 import moment from 'moment'
 export default {
@@ -123,7 +123,7 @@ export default {
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
-        { title: '单据来源', dataIndex: 'salesBillSourceDictValue', width: 100, align: 'center' },
+        { title: '单据来源', dataIndex: 'salesBillEntity.salesBillSourceDictValue', width: 100, align: 'center' },
         { title: '销售单号', dataIndex: 'salesBillNo', width: 230, align: 'center' },
         { title: '下推单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: 230, align: 'center' },
         { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },

+ 1 - 1
src/views/salesManagement/pushOrderManagement/list.vue

@@ -89,7 +89,7 @@
 <script>
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
-import custList from '@/views/common/custList.js'
+import custList from '@/views/common/custList.vue'
 import { dispatchlList, dispatchQueryCount } from '@/api/dispatch'
 export default {
   name: 'TableList',

+ 1 - 1
src/views/salesManagement/salesQuery/chooseCustomModal.vue

@@ -70,7 +70,7 @@
 <script>
 import { salesSave } from '@/api/sales'
 import { VSelect } from '@/components'
-import custList from '@/views/common/custList.js'
+import custList from '@/views/common/custList.vue'
 import settleStyle from '@/views/common/settleStyle.js'
 export default {
   name: 'ChooseCustomModal',

+ 1 - 1
src/views/salesManagement/salesQuery/list.vue

@@ -189,7 +189,7 @@
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import chooseCustomModal from './chooseCustomModal.vue'
-import custList from '@/views/common/custList.js'
+import custList from '@/views/common/custList.vue'
 import { salesList, salesDel, salesWriteAudit, salesCount } from '@/api/sales'
 export default {
   name: 'TableList',

+ 4 - 88
src/views/salesManagement/salesReturn/chooseCustomModal.vue

@@ -20,23 +20,9 @@
       <a-row :gutter="15">
         <a-col :span="8">
           <a-form-model-item label="客户名称" prop="buyerSn">
-            <a-select
-              id="chooseCustom-buyerSn"
-              show-search
-              placeholder="请选择客户"
-              v-model="form.buyerSn"
-              :filter-option="filterOption"
-              @change="custChange">
-              <a-select-option v-for="item in custAllList" :key="item.id" :value="item.customerSn">{{ item.customerName }}</a-select-option>
-            </a-select>
+            <custList id="chooseCustom-buyerSn" ref="custList" @change="custChange"></custList>
           </a-form-model-item>
         </a-col>
-        <!-- <a-col :span="16">
-          <a-form-model-item>
-            <a-button type="primary" class="button-primary" @click="openNewCust" icon="plus">新增</a-button>
-            (点击新增按钮新增客户)
-          </a-form-model-item>
-        </a-col> -->
       </a-row>
       <a-row :gutter="15">
         <a-col :span="16">
@@ -125,7 +111,6 @@
       @cancel="cancelNewCust"
       :footer="null"
     >
-      <CustomerManagementEdit ref="newCust" model="modal" @ok="newCustFun"></CustomerManagementEdit>
     </a-modal>
   </a-modal>
 </template>
@@ -135,10 +120,9 @@ import { getArea } from '@/api/data'
 import { custAllList, custFindById, updateByCustomerSn } from '@/api/customer'
 import { salesReturnSave } from '@/api/salesReturn'
 import { VSelect } from '@/components'
-import CustomerManagementEdit from '@/views/customerManagement/customerInfo/edit.vue'
 export default {
   name: 'ChooseCustomModal',
-  components: { VSelect, CustomerManagementEdit },
+  components: { VSelect },
   props: {
     show: [Boolean]
   },
@@ -190,73 +174,16 @@ export default {
           { required: true, message: '请选择是否铺货出库', trigger: 'change' }
         ]
       },
-      custAllList: [], //  客户 下拉数据
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
       addrDistrictList: [], //  区下拉
       custId: undefined, // 客户id
-      isEdit: false, //  是否编辑状态
-      isChangeCust: false, // 是否更换客户
-      interId: null,
-      isNewCust: false // 是否新增客户
+      interId: null
     }
   },
   methods: {
-    openNewCust () {
-      this.isNewCust = true
-      setTimeout(() => {
-        this.$refs.newCust.getBaseData()
-      }, 500)
-    },
-    // 新建客户
-    newCustFun (data) {
-      console.log(data, this.isEdit)
-      this.isNewCust = false
-      // 更新客户信息
-      this.custAllList.unshift(data)
-      setTimeout(() => {
-        this.custChange(data.customerSn)
-      }, 300)
-    },
-    cancelNewCust () {
-      this.isNewCust = false
-      this.$refs.newCust.getBaseData()
-    },
-    // 客户 change
     custChange (val) {
-      console.log(val, 'custChange')
-      const _this = this
-      const cust = this.custAllList.find(item => item.customerSn == val)
-      // 编辑
-      if (this.isEdit) {
-        this.$confirm({
-          title: '提示',
-          content: '更换客户后信息需要重新完善,确认要更换吗?',
-          centered: true,
-          onOk () {
-            _this.custId = cust.id
-            _this.form.buyerName = cust.customerName
-            _this.getDetail()
-          },
-          onCancel () {
-            _this.form.buyerSn = _this.buyerSnBak
-          }
-        })
-      } else {
-        _this.custId = cust.id
-        _this.form.buyerName = cust.customerName
-        _this.getDetail()
-      }
-    },
-    // 编辑客户信息
-    editCust (data) {
-      console.log(data)
-      this.title = '编辑客户信息'
-      this.isEdit = true
-      if (data.provinceSn) { this.getArea('city', data.provinceSn) }
-      if (data.citySn) { this.getArea('district', data.citySn) }
-      this.form = Object.assign(this.form, data)
-      this.buyerSnBak = this.form.buyerSn
+      this.form.buyerSn = val.key
     },
     //  获取详情
     getDetail () {
@@ -345,17 +272,6 @@ export default {
       this.$refs.ruleForm.resetFields()
       this.$emit('cancel')
     },
-    // 客户无分页列表数据
-    getCustAllList () {
-      const _this = this
-      custAllList().then(res => {
-        if (res.status == 200) {
-          _this.custAllList = res.data || []
-        } else {
-          _this.custAllList = []
-        }
-      })
-    },
     // 获取城市列表
     getCityList (val) {
       console.log(val, '-------------')

+ 38 - 18
src/views/salesManagement/salesReturn/list.vue

@@ -28,13 +28,13 @@
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <custList id="salesReturn-buyerSn" defValKey="customerSn" v-model="queryParam.buyerSn"></custList>
+              <custList id="salesReturn-buyerSn" ref="custList" @change="custChange"></custList>
             </a-form-item>
           </a-col>
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
-              <a-form-item label="退单号">
-                <a-input id="salesReturn-salesReturnNo" v-model.trim="queryParam.salesReturnNo" allowClear placeholder="请输入退单号"/>
+              <a-form-item label="退单号">
+                <a-input id="salesReturn-salesReturnBillNo" v-model.trim="queryParam.salesReturnBillNo" allowClear placeholder="请输入退单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -48,6 +48,17 @@
                   allowClear></v-select>
               </a-form-item>
             </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="财务状态">
+                <v-select
+                  v-model="queryParam.settleState"
+                  ref="settleState"
+                  id="salesManagementList-settleState"
+                  code="FINANCIAL_STATUS"
+                  placeholder="请选择财务状态"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
           </template>
           <a-col :md="6" :sm="24">
             <span class="table-page-search-submitButtons">
@@ -83,14 +94,14 @@
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
-      :scroll="{ x: 1810, y: tableHeight }"
+      :scroll="{ x: 2300, y: tableHeight }"
       bordered>
       <!-- 单号 -->
-      <template slot="salesReturnNo" slot-scope="text, record">
-        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.salesReturnNo }}</span>
+      <template slot="salesReturnBillNo" slot-scope="text, record">
+        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.salesReturnBillNo }}</span>
       </template>
       <!-- 财务状态 -->
-      <template slot="financialStatus" slot-scope="text, record">
+      <template slot="settleState" slot-scope="text, record">
         <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.settleStateDictValue" />
       </template>
       <!-- 操作 -->
@@ -127,7 +138,7 @@
 <script>
 import { STable, VSelect } from '@/components'
 import chooseCustomModal from './chooseCustomModal.vue'
-import custList from '@/views/common/custList.js'
+import custList from '@/views/common/custList.vue'
 import { salesReturnList, salesReturnQueryCount, salesReturnAudit, salesReturnDel } from '@/api/salesReturn'
 import moment from 'moment'
 export default {
@@ -151,8 +162,9 @@ export default {
       // 查询参数
       queryParam: {
         buyerSn: undefined, //  客户名称
-        salesReturnNo: undefined, //  销退单号
+        salesReturnBillNo: undefined, //  总部销退单号
         billStatus: undefined, // 业务状态
+        settleState: undefined, // 财务状态
         beginDate: undefined,
         endDate: undefined,
         auditBeginDate: undefined,
@@ -163,15 +175,18 @@ export default {
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
-        { title: '销售退货单号', scopedSlots: { customRender: 'salesReturnNo' }, width: 260, align: 'center' },
-        { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '退款总金额', dataIndex: 'totalAmount', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '总款数', dataIndex: 'totalCategory', width: 110, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '总数量', dataIndex: 'totalQty', width: 110, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单据来源', dataIndex: 'salesBillSourceDictValue', width: 120, align: 'center' },
+        { title: '客户采退单号', dataIndex: 'purchaseReturnBillNo', width: 260, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '总部销退单号', scopedSlots: { customRender: 'salesReturnBillNo' }, width: 260, align: 'center' },
+        { title: '退货客户', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '退货数量', dataIndex: 'totalQty', width: 110, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '坏件数量', dataIndex: 'totalBadQty', width: 110, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '返库数量', dataIndex: 'totalCategory', width: 110, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退款金额', dataIndex: 'totalAmount', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '是否抓单', dataIndex: 'grabFlag', width: 100, align: 'center', customRender: function (text) { return ['否', '是'][text] } },
         { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '业务状态', dataIndex: 'stateDictValue', width: 110, align: 'center' },
-        { title: '财务状态', dataIndex: 'settleStateDictValue', scopedSlots: { customRender: 'financialStatus' }, width: 110, align: 'center' },
+        { title: '业务状态', dataIndex: 'billStatusDictValue', width: 110, align: 'center' },
+        { title: '财务状态', dataIndex: 'settleStateDictValue', scopedSlots: { customRender: 'settleState' }, width: 110, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 220, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -211,6 +226,9 @@ export default {
     }
   },
   methods: {
+    custChange (val) {
+      this.queryParam.buyerSn = val.key
+    },
     // 不可选日期
     disabledDate (date, dateStrings) {
       return date && date.valueOf() > Date.now()
@@ -268,8 +286,10 @@ export default {
     },
     resetSearchForm () {
       this.queryParam.buyerSn = undefined
-      this.queryParam.salesReturnNo = ''
-      this.queryParam.billStatus = ''
+      this.$refs.custList.resetForm()
+      this.queryParam.salesReturnBillNo = ''
+      this.queryParam.billStatus = undefined
+      this.queryParam.settleState = undefined
       this.queryParam.beginDate = undefined
       this.endDate = undefined
       this.auditBeginDate = undefined