瀏覽代碼

增加客户类型

lilei 3 年之前
父節點
當前提交
0c6a2fa224

+ 69 - 0
src/views/common/custType.js

@@ -0,0 +1,69 @@
+import { custTypeFindAllList } from '@/api/custType'
+const custType = {
+  template: `
+      <a-select
+        :placeholder="placeholder"
+        :id="id"
+        allowClear
+        :value="defaultVal"
+        :showSearch="true"
+        @change="handleChange"
+        option-filter-prop="children"
+        :dropdownMatchSelectWidth="false"
+        :filter-option="filterOption">
+        <a-select-option v-for="item in list" :pinyin="item.pinyin" :key="item.customerTypeSn" :value="item.customerTypeSn">{{ item.name }}</a-select-option>
+      </a-select>
+    `,
+  props: {
+    value: {
+      type: String,
+      defatut: ''
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    placeholder: {
+      type: String,
+      default: '请选择客户类型'
+    }
+  },
+  data() {
+    return {
+      defaultVal: this.value,
+      list: []
+    };
+  },
+  mounted() {
+    this.getList()
+  },
+  watch: {
+    value(newValue, oldValue) {
+      this.defaultVal = newValue
+    }
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 || 
+        option.data.attrs.pinyin.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    handleChange(value) {
+      this.defaultVal = value;
+      this.$emit('change', value);
+      this.$emit('input', value);
+    },
+    getList () {
+      custTypeFindAllList().then(res => {
+        if (res.status == 200) {
+          this.list = res.data
+        } else {
+          this.list = []
+        }
+      })
+    },
+  },
+};
+
+export default custType

+ 3 - 17
src/views/customerManagement/customerInfo/edit.vue

@@ -117,9 +117,7 @@
             </a-col>
             <a-col :span="8">
               <a-form-model-item label="客户类型" prop="customerTypeSn">
-                <a-select id="customerManagementEdit-customerTypeSn" v-model="form.customerTypeSn" allowClear placeholder="请选择客户类型">
-                  <a-select-option v-for="item in custTypeList" :value="item.customerTypeSn" :key="item.customerTypeSn">{{ item.name }}</a-select-option>
-                </a-select>
+                <custType id="customerManagementEdit-customerTypeSn" v-model="form.customerTypeSn" allowClear placeholder="请选择客户类型"></custType>
               </a-form-model-item>
             </a-col>
           </a-row>
@@ -136,11 +134,11 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import { getArea } from '@/api/data'
+import custType from '@/views/common/custType.js'
 import { custSave, custFindById, settleStyleFindAllList } from '@/api/customer'
-import { custTypeFindAllList } from '@/api/custType'
 export default {
   name: 'CustomerManagementEdit',
-  components: { STable, VSelect },
+  components: { STable, VSelect, custType },
   mixins: [commonMixin],
   props: {
     model: {
@@ -187,7 +185,6 @@ export default {
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
       addrDistrictList: [], //  区下拉
-      custTypeList: [], //  客户类型  下拉数据
       settleStyleList: [] //  收款方式  下拉数据
     }
   },
@@ -211,16 +208,6 @@ export default {
         }
       })
     },
-    //  客户类型
-    getCustTypeList () {
-      custTypeFindAllList().then(res => {
-        if (res.status == 200) {
-          this.custTypeList = res.data
-        } else {
-          this.custTypeList = []
-        }
-      })
-    },
     // 收款方式
     getSettleStyleList () {
       settleStyleFindAllList().then(res => {
@@ -328,7 +315,6 @@ export default {
     // 获取基础数据
     getBaseData () {
       this.getArea('province') //  省市区
-      this.getCustTypeList() //  客户类型
       this.getSettleStyleList() // 收款方式
       this.$refs.ruleForm.resetFields()
     },

+ 3 - 18
src/views/customerManagement/customerInfo/list.vue

@@ -56,9 +56,7 @@
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-item label="客户类型">
-                  <a-select v-model="queryParam.customerTypeSn" allowClear placeholder="请选择客户类型" style="max-width: 240px;">
-                    <a-select-option v-for="item in custTypeList" :value="item.customerTypeSn" :key="item.customerTypeSn">{{ item.name }}</a-select-option>
-                  </a-select>
+                  <custType v-model="queryParam.customerTypeSn" allowClear placeholder="请选择客户类型" style="max-width: 240px;"></custType>
                 </a-form-item>
               </a-col>
             </template>
@@ -123,13 +121,13 @@
 import { commonMixin } from '@/utils/mixin'
 import { getArea } from '@/api/data'
 import { custList, custDel, updateEnableStatus } from '@/api/customer'
-import { custTypeFindAllList } from '@/api/custType'
+import custType from '@/views/common/custType.js'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import customerManagementDetailModal from './detailModal.vue'
 export default {
   name: 'CustomerManagementList',
-  components: { STable, VSelect, customerManagementDetailModal, rangeDate },
+  components: { STable, VSelect, customerManagementDetailModal, rangeDate, custType },
   mixins: [commonMixin],
   data () {
     return {
@@ -182,7 +180,6 @@ export default {
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
       addrDistrictList: [], //  区下拉
-      custTypeList: [], //  客户类型 下拉数据
       openModal: false, //  查看客户详情  弹框
       itemId: '' //  当前客户id
     }
@@ -273,17 +270,6 @@ export default {
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       )
     },
-    //  获取客户类型列表
-    getCustTypeList () {
-      const _this = this
-      custTypeFindAllList().then(res => {
-        if (res.status == 200) {
-          _this.custTypeList = res.data || []
-        } else {
-          _this.custTypeList = []
-        }
-      })
-    },
     // 获取城市列表
     getCityList (val) {
       this.addrCityList = []
@@ -336,7 +322,6 @@ export default {
         _this.setTableH()
       })
       this.getArea('province')
-      this.getCustTypeList()
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight

+ 15 - 6
src/views/reportData/chainCustomerReport/list.vue

@@ -75,6 +75,11 @@
                   </a-form-model-item>
                 </a-row>
               </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="客户类型">
+                  <custType v-model="queryParam.customerTypeSn" allowClear placeholder="请选择客户类型" style="max-width: 240px;"></custType>
+                </a-form-item>
+              </a-col>
             </template>
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="handleSearch" :disabled="disabled" id="customerReportList-refresh">查询</a-button>
@@ -114,10 +119,11 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import { getArea } from '@/api/data'
+import custType from '@/views/common/custType.js'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { reportBigCustomerLinkageList, reportBigCustomerLinkageCount, linkageGroupList } from '@/api/reportData'
 export default {
-  components: { STable, VSelect, rangeDate },
+  components: { STable, VSelect, rangeDate, custType },
   mixins: [commonMixin],
   data () {
     return {
@@ -136,7 +142,8 @@ export default {
         productTypeSn3: '', //  产品三级分类
         provinceSn: undefined, //  省
         citySn: undefined, //  市
-        countySn: undefined //  区
+        countySn: undefined, //  区
+        customerTypeSn: undefined // 客户类型
       },
       productType: [],
       rules: {
@@ -147,10 +154,11 @@ export default {
       exportLoading: false,
       columns: [
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
-        { title: '连锁门店', dataIndex: 'dealerName', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户名称', dataIndex: 'salesTargetName', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true, sorter: true },
-        { title: '交易金额', dataIndex: 'totalAmount', width: '20%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, sorter: true },
-        { title: '毛利率', dataIndex: 'percentageUnit', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true }
+        { title: '连锁门店', dataIndex: 'dealerName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户名称', dataIndex: 'salesTargetName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true, sorter: true },
+        { title: '客户类型', dataIndex: 'customerTypeName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '交易金额', dataIndex: 'totalAmount', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, sorter: true },
+        { title: '毛利率', dataIndex: 'percentageUnit', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -240,6 +248,7 @@ export default {
       this.queryParam.provinceSn = undefined
       this.queryParam.citySn = undefined
       this.queryParam.countySn = undefined
+      this.queryParam.customerTypeSn = undefined
       this.productType = []
       this.$refs.ruleForm.resetFields()
       this.totalData = null

+ 13 - 4
src/views/reportData/customerReport/list.vue

@@ -61,6 +61,11 @@
                   </a-form-model-item>
                 </a-row>
               </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="客户类型">
+                  <custType v-model="queryParam.customerTypeSn" allowClear placeholder="请选择客户类型" style="max-width: 240px;"></custType>
+                </a-form-item>
+              </a-col>
             </template>
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="handleSearch" :disabled="disabled" id="customerReportList-refresh">查询</a-button>
@@ -99,12 +104,13 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
+import custType from '@/views/common/custType.js'
 import { getArea } from '@/api/data'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { reportBigCustomerList, reportBigCustomerCount } from '@/api/reportData'
 export default {
   mixins: [commonMixin],
-  components: { STable, VSelect, rangeDate },
+  components: { STable, VSelect, rangeDate, custType },
   data () {
     return {
       spinning: false,
@@ -121,7 +127,8 @@ export default {
         productTypeSn3: '', //  产品三级分类
         provinceSn: undefined, //  省
         citySn: undefined, //  市
-        countySn: undefined //  区
+        countySn: undefined, //  区
+        customerTypeSn: undefined // 客户类型
       },
       productType: [],
       rules: {
@@ -132,8 +139,9 @@ export default {
       columns: [
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
         { title: '客户名称', dataIndex: 'salesTargetName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true, sorter: true },
-        { title: '交易金额', dataIndex: 'totalAmount', width: '30%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') }, sorter: true },
-        { title: '毛利率', dataIndex: 'percentageUnit', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true }
+        { title: '客户类型', dataIndex: 'customerTypeName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '交易金额', dataIndex: 'totalAmount', width: '20%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') }, sorter: true },
+        { title: '毛利率', dataIndex: 'percentageUnit', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -221,6 +229,7 @@ export default {
       this.queryParam.provinceSn = undefined
       this.queryParam.citySn = undefined
       this.queryParam.countySn = undefined
+      this.queryParam.customerTypeSn = undefined
       this.productType = []
       this.$refs.ruleForm.resetFields()
       this.totalData = null