fix 基础数据 客户

This commit is contained in:
刘天扬 2021-11-21 16:39:18 +08:00
parent 04c8ad043a
commit 9476b458c8
3 changed files with 46 additions and 13 deletions

View file

@ -184,6 +184,15 @@ export function clientCategoriesDestroy(form) {
}) })
} }
export function clientCategoriesOptions(params) {
return axios({
url: '/api/client_categories/options',
headers: { 'X-CSRFToken': Cookies.get('csrftoken') },
method: 'get',
params,
})
}
// SalesPaymentRecord // SalesPaymentRecord
export function salesPaymentRecord(params) { export function salesPaymentRecord(params) {
return axios({ return axios({

View file

@ -1,7 +1,7 @@
<template> <template>
<a-select v-model.number="value" :disabled="disabled"> <a-select v-model.number="value" :disabled="disabled">
<a-select-option <a-select-option
v-for="(client) in clientList" v-for="(client) in clientCategoriesOptions"
:key="client.id" :key="client.id"
:value="client.id" :value="client.id"
> >
@ -11,7 +11,7 @@
</template> </template>
<script> <script>
import { clientList } from "@/api/sales"; import { clientCategoriesOptions } from "@/api/sales";
export default { export default {
props: ["value","disabled"], props: ["value","disabled"],
watch:{ watch:{
@ -21,11 +21,11 @@ export default {
}, },
data() { data() {
var that = this; var that = this;
clientList().then((resp) => { clientCategoriesOptions().then((resp) => {
that.clientList = resp.data.results; that.clientCategoriesOptions = resp.data.results;
}); });
return { return {
clientList: [], clientCategoriesOptions: [],
}; };
}, },
}; };

View file

@ -51,8 +51,19 @@
<a-form-model-item prop="number" label="客户编号"> <a-form-model-item prop="number" label="客户编号">
<a-input v-model="form.number" /> <a-input v-model="form.number" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="contacts" label="联系人"> <a-form-model-item prop="level" label="等级">
<a-input v-model="form.contacts" /> <a-select v-model="form.level">
<a-select-option :value="0">1</a-select-option>
<a-select-option :value="1">2</a-select-option>
<a-select-option :value="2">3</a-select-option>
<a-select-option :value="3">4</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item prop="category" label="客户分类">
<ClientCategoriesSelect v-model="form.category"></ClientCategoriesSelect>
</a-form-model-item>
<a-form-model-item prop="contact" label="联系人">
<a-input v-model="form.contact" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="phone" label="手机号"> <a-form-model-item prop="phone" label="手机号">
<a-input v-model="form.phone" /> <a-input v-model="form.phone" />
@ -63,11 +74,9 @@
<a-form-model-item prop="address" label="地址"> <a-form-model-item prop="address" label="地址">
<a-input v-model="form.address" /> <a-input v-model="form.address" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="status" label="状态"> <a-form-model-item prop="is_active" label="激活状态">
<a-select v-model="form.status"> <a-switch checked-children="" un-checked-children=""
<a-select-option :value="true">启用</a-select-option> v-model="form.is_active" />
<a-select-option :value="false">停用</a-select-option>
</a-select>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="order" label="排序"> <a-form-model-item prop="order" label="排序">
<a-input-number v-model="form.order" /> <a-input-number v-model="form.order" />
@ -107,7 +116,19 @@
{ {
title: '客户编号', title: '客户编号',
dataIndex: 'number', dataIndex: 'number',
key: 'name', key: 'number',
sorter: true,
},
{
title: '客户等级',
dataIndex: 'level_display',
key: 'level_display',
sorter: true,
},
{
title: '客户分类',
dataIndex: 'category_name',
key: 'category_name',
sorter: true, sorter: true,
}, },
{ {
@ -168,6 +189,9 @@
visible: false, visible: false,
}; };
}, },
components:{
ClientCategoriesSelect: () => import("@/components/Fields/ClientCategoriesSelect"),
},
methods: { methods: {
initailize() { initailize() {
this.resetForm(); this.resetForm();