|
@@ -1,48 +1,67 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <Toptitle :title="type==1?'新增客户产品价格':type==2?'编辑客户产品价格':'查看客户产品价格'">
|
|
|
+ <Toptitle
|
|
|
+ :title="
|
|
|
+ type == 1
|
|
|
+ ? '新增客户产品价格'
|
|
|
+ : type == 2
|
|
|
+ ? '编辑客户产品价格'
|
|
|
+ : '查看客户产品价格'
|
|
|
+ "
|
|
|
+ >
|
|
|
<slot name="titleButton">
|
|
|
- <Button @click="showModal=true"
|
|
|
- type="primary"
|
|
|
- v-show="!isChecked"
|
|
|
- ghost
|
|
|
- style="margin-right:10px;">选择产品</Button>
|
|
|
- <Button @click="goBack"
|
|
|
- type="primary"
|
|
|
- ghost
|
|
|
- style="margin-right:10px;">返回</Button>
|
|
|
- <Button @click="postData"
|
|
|
- v-show="!isChecked"
|
|
|
- type="primary"
|
|
|
- style="margin-right:10px;">保存</Button>
|
|
|
+ <Button
|
|
|
+ @click="showModal = true"
|
|
|
+ type="primary"
|
|
|
+ v-show="!isChecked"
|
|
|
+ ghost
|
|
|
+ style="margin-right:10px;"
|
|
|
+ >选择产品</Button
|
|
|
+ >
|
|
|
+ <Button @click="goBack" type="primary" ghost style="margin-right:10px;"
|
|
|
+ >返回</Button
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ @click="postData"
|
|
|
+ v-show="!isChecked"
|
|
|
+ type="primary"
|
|
|
+ style="margin-right:10px;"
|
|
|
+ >保存</Button
|
|
|
+ >
|
|
|
</slot>
|
|
|
</Toptitle>
|
|
|
<div class="top_search">
|
|
|
- <Form :model="formData"
|
|
|
- :label-width="100"
|
|
|
- class="top_search_form">
|
|
|
+ <Form :model="formData" :label-width="100" class="top_search_form">
|
|
|
<FormItem label="客户编码:">
|
|
|
- <Select v-model="formData.custom_id"
|
|
|
- filterable
|
|
|
- clearable
|
|
|
- @on-change="handleCustomerChange"
|
|
|
- :disabled="isChecked">
|
|
|
- <Option v-for="item of customList"
|
|
|
- :key="item.id"
|
|
|
- :value="item.id"
|
|
|
- :label="item.code"></Option>
|
|
|
+ <Select
|
|
|
+ v-model="formData.custom_id"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ @on-change="handleCustomerChange"
|
|
|
+ :disabled="isChecked"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="item of customList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.code"
|
|
|
+ ></Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
<FormItem label="客户名称:">
|
|
|
- <Select v-model="formData.custom_id"
|
|
|
- filterable
|
|
|
- clearable
|
|
|
- @on-change="handleCustomerChange"
|
|
|
- :disabled="isChecked">
|
|
|
- <Option v-for="item of customList"
|
|
|
- :key="item.id"
|
|
|
- :value="item.id"
|
|
|
- :label="item.title"></Option>
|
|
|
+ <Select
|
|
|
+ v-model="formData.custom_id"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ @on-change="handleCustomerChange"
|
|
|
+ :disabled="isChecked"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="item of customList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.title"
|
|
|
+ ></Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
</Form>
|
|
@@ -52,97 +71,120 @@
|
|
|
:disabled="isChecked"
|
|
|
type="primary">新增</Button> -->
|
|
|
</div>
|
|
|
- <Table :columns="tableColumns"
|
|
|
- max-height="600"
|
|
|
- :data="tableData"
|
|
|
- border>
|
|
|
- <template slot="priceSet"
|
|
|
- slot-scope="{index}">
|
|
|
- <Input :disabled='type == 3'
|
|
|
- @on-focus="openKey(index)"
|
|
|
- clearable
|
|
|
- placeholder="请输入公式"
|
|
|
- v-model="tableData[index].formula"></Input>
|
|
|
+ <Table :columns="tableColumns" max-height="600" :data="tableData" border>
|
|
|
+ <template slot="priceSet" slot-scope="{ index }">
|
|
|
+ <Input
|
|
|
+ :disabled="type == 3"
|
|
|
+ @on-focus="openKey(index)"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入公式"
|
|
|
+ v-model="tableData[index].formula"
|
|
|
+ ></Input>
|
|
|
</template>
|
|
|
- <template slot="set"
|
|
|
- slot-scope="{index}">
|
|
|
- <a style="margin:0 5px"
|
|
|
- :disabled="isChecked"
|
|
|
- @click="handleSet(tableData[index],index,4)">删除</a>
|
|
|
+ <template slot="set" slot-scope="{ index }">
|
|
|
+ <a
|
|
|
+ style="margin:0 5px"
|
|
|
+ :disabled="isChecked"
|
|
|
+ @click="handleSet(tableData[index], index, 4)"
|
|
|
+ >删除</a
|
|
|
+ >
|
|
|
</template>
|
|
|
</Table>
|
|
|
- <Modal v-model="showModal"
|
|
|
- title="选择产品"
|
|
|
- width='80'
|
|
|
- @on-ok="handleSelect"
|
|
|
- @on-cancel="showModal=false">
|
|
|
+ <Modal
|
|
|
+ v-model="showModal"
|
|
|
+ title="选择产品"
|
|
|
+ width="80"
|
|
|
+ @on-ok="handleSelect"
|
|
|
+ @on-cancel="showModal = false"
|
|
|
+ >
|
|
|
<div class="modal_content">
|
|
|
<div class="modal_content_left">
|
|
|
- <Tree :data="modalData.treeData"
|
|
|
- children-key='child'
|
|
|
- style="width:100%;"
|
|
|
- @on-select-change="handleTreeSlect"
|
|
|
- class="demo-tree-render"></Tree>
|
|
|
+ <Tree
|
|
|
+ :data="modalData.treeData"
|
|
|
+ children-key="child"
|
|
|
+ style="width:100%;"
|
|
|
+ @on-select-change="handleTreeSlect"
|
|
|
+ class="demo-tree-render"
|
|
|
+ ></Tree>
|
|
|
</div>
|
|
|
<div class="modal_content_center">
|
|
|
<div class="modal_content_center_top">
|
|
|
- <div><span>产品分类:</span>
|
|
|
- <Select v-model="modalData.type_title"
|
|
|
- filterable
|
|
|
- size="small"
|
|
|
- placeholder="请选择产品分类"
|
|
|
- clearable>
|
|
|
- <Option v-for="item of productTypeList"
|
|
|
- :key="item.id"
|
|
|
- :value="item.title"
|
|
|
- :label="item.title"></Option>
|
|
|
+ <div>
|
|
|
+ <span>产品分类:</span>
|
|
|
+ <Select
|
|
|
+ v-model="modalData.type_title"
|
|
|
+ filterable
|
|
|
+ size="small"
|
|
|
+ placeholder="请选择产品分类"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="item of productTypeList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.title"
|
|
|
+ :label="item.title"
|
|
|
+ ></Option>
|
|
|
</Select>
|
|
|
</div>
|
|
|
- <div><span>产品名称:</span>
|
|
|
- <Input type="text"
|
|
|
- size="small"
|
|
|
- v-model="modalData.title"
|
|
|
- placeholder="请输入产品名称" />
|
|
|
+ <div>
|
|
|
+ <span>产品名称:</span>
|
|
|
+ <Input
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ v-model="modalData.title"
|
|
|
+ placeholder="请输入产品名称"
|
|
|
+ />
|
|
|
</div>
|
|
|
- <Button @click="initModal()"
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- style="margin:0 10px;">搜索</Button>
|
|
|
+ <Button
|
|
|
+ @click="initModal()"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ style="margin:0 10px;"
|
|
|
+ >搜索</Button
|
|
|
+ >
|
|
|
</div>
|
|
|
<div class="modal_content_center_body">
|
|
|
- <Table :columns="modalTableColumns"
|
|
|
- height="520"
|
|
|
- border
|
|
|
- ref="modelTable"
|
|
|
- @on-select-all="handleSelectionAll"
|
|
|
- @on-select-all-cancel="handleSelectionAllCancel"
|
|
|
- @on-select="handleSelection"
|
|
|
- @on-select-cancel="handleSelectionCancel"
|
|
|
- :loading="modalTableLoading"
|
|
|
- :data="modalData.tableData">
|
|
|
+ <Table
|
|
|
+ :columns="modalTableColumns"
|
|
|
+ height="520"
|
|
|
+ border
|
|
|
+ ref="modelTable"
|
|
|
+ @on-select-all="handleSelectionAll"
|
|
|
+ @on-select-all-cancel="handleSelectionAllCancel"
|
|
|
+ @on-select="handleSelection"
|
|
|
+ @on-select-cancel="handleSelectionCancel"
|
|
|
+ :loading="modalTableLoading"
|
|
|
+ :data="modalData.tableData"
|
|
|
+ >
|
|
|
</Table>
|
|
|
<div class="modal_content_center_footer">
|
|
|
- <Page :page-size-opts="[10, 20, 30, 40,100]"
|
|
|
- @on-page-size-change='changeModalSize'
|
|
|
- @on-change='changeModalPage'
|
|
|
- :current='modal_page_index'
|
|
|
- show-total
|
|
|
- :total="modal_total"
|
|
|
- show-sizer
|
|
|
- :page-size='modal_page_size' />
|
|
|
+ <Page
|
|
|
+ :page-size-opts="[10, 20, 30, 40, 100]"
|
|
|
+ @on-page-size-change="changeModalSize"
|
|
|
+ @on-change="changeModalPage"
|
|
|
+ :current="modal_page_index"
|
|
|
+ show-total
|
|
|
+ :total="modal_total"
|
|
|
+ show-sizer
|
|
|
+ :page-size="modal_page_size"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="modal_content_right">
|
|
|
<span>已选</span>
|
|
|
- <Table :columns="selectedColumns"
|
|
|
- max-height="500"
|
|
|
- border
|
|
|
- :data="modalData.selectedData">
|
|
|
- <template slot="selectedSetSlot"
|
|
|
- slot-scope="{row,index}">
|
|
|
- <a style="margin:0 5px;color:red"
|
|
|
- @click="handleSelectedDele(row,index)">删除</a>
|
|
|
+ <Table
|
|
|
+ :columns="selectedColumns"
|
|
|
+ max-height="500"
|
|
|
+ border
|
|
|
+ :data="modalData.selectedData"
|
|
|
+ >
|
|
|
+ <template slot="selectedSetSlot" slot-scope="{ row, index }">
|
|
|
+ <a
|
|
|
+ style="margin:0 5px;color:red"
|
|
|
+ @click="handleSelectedDele(row, index)"
|
|
|
+ >删除</a
|
|
|
+ >
|
|
|
</template>
|
|
|
</Table>
|
|
|
</div>
|
|
@@ -154,14 +196,14 @@
|
|
|
<script>
|
|
|
// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
// 例如:import 《组件名称》 from '《组件路径》';
|
|
|
-import KeyBoard from '../../../components/keyboard/index'
|
|
|
+import KeyBoard from "../../../components/keyboard/index";
|
|
|
|
|
|
export default {
|
|
|
- name: '',
|
|
|
+ name: "",
|
|
|
components: { KeyBoard },
|
|
|
props: {},
|
|
|
// import引入的组件需要注入到对象中才能使用
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
// 这里存放数据
|
|
|
return {
|
|
|
type: this.$route.query.type || null,
|
|
@@ -175,29 +217,46 @@ export default {
|
|
|
formData: {},
|
|
|
keyModal: false,
|
|
|
tableColumns: [
|
|
|
- { title: '产品分类', key: 'type_title', align: 'center', minWidth: 120, },
|
|
|
- { title: '产品名称', key: 'title', align: 'center', minWidth: 120, },
|
|
|
- { title: '计量单位', key: 'unit', align: 'center', minWidth: 120, },
|
|
|
- { title: '型号', key: 'model', align: 'center', minWidth: 120, },
|
|
|
{
|
|
|
- title: '单价', key: 'price', align: 'center', minWidth: 120,
|
|
|
+ title: "产品分类",
|
|
|
+ key: "type_title",
|
|
|
+ align: "center",
|
|
|
+ minWidth: 120,
|
|
|
+ },
|
|
|
+ { title: "产品名称", key: "title", align: "center", minWidth: 120 },
|
|
|
+ { title: "计量单位", key: "unit", align: "center", minWidth: 120 },
|
|
|
+ { title: "型号", key: "model", align: "center", minWidth: 120 },
|
|
|
+ {
|
|
|
+ title: "单价",
|
|
|
+ key: "price",
|
|
|
+ align: "center",
|
|
|
+ minWidth: 120,
|
|
|
render: (h, params) => {
|
|
|
- const { row, index } = params
|
|
|
- const currencyRow = this.tableData[index]
|
|
|
- return this.type != 3 ? h('Input', {
|
|
|
- props: {
|
|
|
- value: currencyRow.price,
|
|
|
- placeholder: '请输入单价'
|
|
|
- },
|
|
|
- on: {
|
|
|
- 'on-change': (e) => {
|
|
|
- currencyRow.price = e.target.value
|
|
|
- currencyRow.discount_price = (currencyRow.price * currencyRow.fax / 100).toFixed(2)
|
|
|
- this.tableData.splice(index, 1, currencyRow)
|
|
|
- }
|
|
|
- }
|
|
|
- }, currencyRow.price) : h('span', {}, currencyRow.price)
|
|
|
- }
|
|
|
+ const { row, index } = params;
|
|
|
+ const currencyRow = this.tableData[index];
|
|
|
+ return this.type != 3
|
|
|
+ ? h(
|
|
|
+ "Input",
|
|
|
+ {
|
|
|
+ props: {
|
|
|
+ value: currencyRow.price,
|
|
|
+ placeholder: "请输入单价",
|
|
|
+ },
|
|
|
+ on: {
|
|
|
+ "on-change": (e) => {
|
|
|
+ currencyRow.price = e.target.value;
|
|
|
+ currencyRow.discount_price = (
|
|
|
+ (currencyRow.price * currencyRow.fax) /
|
|
|
+ 100
|
|
|
+ ).toFixed(2);
|
|
|
+ this.tableData.splice(index, 1, currencyRow);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ currencyRow.price
|
|
|
+ )
|
|
|
+ : h("span", {}, currencyRow.price);
|
|
|
+ },
|
|
|
},
|
|
|
// { title: '折扣率', key: 'fax', align: 'center', minWidth: 120, },
|
|
|
// {
|
|
@@ -220,45 +279,49 @@ export default {
|
|
|
// }, currencyRow.discount_price) : h('span', {}, currencyRow.discount_price)
|
|
|
// }
|
|
|
// },
|
|
|
- { title: '操作', key: '', align: 'center', slot: 'set', width: 200 },
|
|
|
+ { title: "操作", key: "", align: "center", slot: "set", width: 200 },
|
|
|
],
|
|
|
modalData: {
|
|
|
- title: '',
|
|
|
+ title: "",
|
|
|
tableData: [{}],
|
|
|
selectedData: [],
|
|
|
treeData: [
|
|
|
{
|
|
|
- title: '产品分类',
|
|
|
+ title: "产品分类",
|
|
|
expand: true,
|
|
|
child: [],
|
|
|
render: (h, { root, node, data }) => {
|
|
|
- return h('span', {
|
|
|
- style: {
|
|
|
- display: 'inline-block',
|
|
|
- width: '100%'
|
|
|
- }
|
|
|
- }, [
|
|
|
- h('span', [
|
|
|
- h('Icon', {
|
|
|
- props: {
|
|
|
- type: 'ios-folder-outline'
|
|
|
- },
|
|
|
+ return h(
|
|
|
+ "span",
|
|
|
+ {
|
|
|
+ style: {
|
|
|
+ display: "inline-block",
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ [
|
|
|
+ h("span", [
|
|
|
+ h("Icon", {
|
|
|
+ props: {
|
|
|
+ type: "ios-folder-outline",
|
|
|
+ },
|
|
|
+ style: {
|
|
|
+ marginRight: "8px",
|
|
|
+ },
|
|
|
+ }),
|
|
|
+ h("span", data.title),
|
|
|
+ ]),
|
|
|
+ h("span", {
|
|
|
style: {
|
|
|
- marginRight: '8px'
|
|
|
- }
|
|
|
+ display: "inline-block",
|
|
|
+ // float: 'right',
|
|
|
+ marginRight: "32px",
|
|
|
+ },
|
|
|
}),
|
|
|
- h('span', data.title)
|
|
|
- ]),
|
|
|
- h('span', {
|
|
|
- style: {
|
|
|
- display: 'inline-block',
|
|
|
- // float: 'right',
|
|
|
- marginRight: '32px'
|
|
|
- }
|
|
|
- })
|
|
|
- ]);
|
|
|
+ ]
|
|
|
+ );
|
|
|
},
|
|
|
- }
|
|
|
+ },
|
|
|
],
|
|
|
},
|
|
|
tableData: [],
|
|
@@ -271,166 +334,223 @@ export default {
|
|
|
selected: null,
|
|
|
currencyIndex: null,
|
|
|
modalTableColumns: [
|
|
|
- { title: '全选', type: 'selection', align: 'center', minWidth: 60 },
|
|
|
- { title: '产品分类', key: 'type_name', align: 'center', minWidth: 90 },
|
|
|
- { title: '产品名称', key: 'title', align: 'center', minWidth: 90 },
|
|
|
- { title: '产品规格', key: 'model', align: 'center', minWidth: 90 },
|
|
|
- { title: '计量单位', key: 'unit', align: 'center', minWidth: 90 },
|
|
|
+ { title: "全选", type: "selection", align: "center", minWidth: 60 },
|
|
|
+ { title: "产品分类", key: "type_name", align: "center", minWidth: 90 },
|
|
|
+ { title: "产品名称", key: "title", align: "center", minWidth: 90 },
|
|
|
+ { title: "产品规格", key: "model", align: "center", minWidth: 90 },
|
|
|
+ { title: "计量单位", key: "unit", align: "center", minWidth: 90 },
|
|
|
],
|
|
|
modalTableLoading: false,
|
|
|
modal_page_index: 1,
|
|
|
modal_page_size: 10,
|
|
|
modal_total: 0,
|
|
|
selectedColumns: [
|
|
|
- { title: '产品名称', key: 'title', align: 'center', minWidth: 110 },
|
|
|
- { title: '操作', key: 'title', align: 'center', minWidth: 90, slot: 'selectedSetSlot' },
|
|
|
+ { title: "产品名称", key: "title", align: "center", minWidth: 110 },
|
|
|
+ {
|
|
|
+ title: "操作",
|
|
|
+ key: "title",
|
|
|
+ align: "center",
|
|
|
+ minWidth: 90,
|
|
|
+ slot: "selectedSetSlot",
|
|
|
+ },
|
|
|
],
|
|
|
customList: [],
|
|
|
fax: null,
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
- created () {
|
|
|
+ created() {
|
|
|
// 获取基础产品类型
|
|
|
- this.axios.get('/api/basics_product_index').then(res => { this.productTypeList = res.data.data; this.modalData.treeData[0].child = res.data.data })
|
|
|
+ this.axios.get("/api/basics_product_index").then((res) => {
|
|
|
+ this.productTypeList = res.data.data;
|
|
|
+ this.modalData.treeData[0].child = res.data.data;
|
|
|
+ });
|
|
|
// 获取用户列表
|
|
|
- this.axios({ method: 'get', url: '/api/user', }).then((res) => { this.userList = res.data.data }).catch((err) => { });
|
|
|
+ this.axios({ method: "get", url: "/api/user" })
|
|
|
+ .then((res) => {
|
|
|
+ this.userList = res.data.data;
|
|
|
+ })
|
|
|
+ .catch((err) => {});
|
|
|
// 获取超标方案
|
|
|
- this.axios({ method: 'get', url: '/api/overdraft_list', }).then((res) => { this.overStandardList = res.data.data }).catch((err) => { });
|
|
|
- // 获取客户列表
|
|
|
- this.axios.get('/api/custom_list')
|
|
|
- .then(res => {
|
|
|
- this.customList = res.data.data
|
|
|
+ this.axios({ method: "get", url: "/api/overdraft_list" })
|
|
|
+ .then((res) => {
|
|
|
+ this.overStandardList = res.data.data;
|
|
|
})
|
|
|
- this.initModal()
|
|
|
+ .catch((err) => {});
|
|
|
+ // 获取客户列表
|
|
|
+ this.axios.get("/api/custom_list").then((res) => {
|
|
|
+ this.customList = res.data.data;
|
|
|
+ });
|
|
|
+ this.initModal();
|
|
|
},
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
- mounted () {
|
|
|
- this.init()
|
|
|
+ mounted() {
|
|
|
+ this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
- init () {
|
|
|
- (this.custom_id) &&
|
|
|
- this.axios.get('/api/custom_product_detail', { params: { custom_id: this.custom_id } }).then(res => {
|
|
|
- this.tableData = res.data.list.data
|
|
|
- this.formData = JSON.parse(JSON.stringify(res.data))
|
|
|
- delete this.formData.list
|
|
|
- this.formData.custom_id = this.formData.id
|
|
|
- this.fax = res.data.fax
|
|
|
- // this.formData.lockState = this.formData.lock == 1 ? true : false
|
|
|
- this.tableData.forEach(element => {
|
|
|
- element.discount_price = (element.price * element.fax / 100).toFixed(2)
|
|
|
+ init() {
|
|
|
+ this.custom_id &&
|
|
|
+ this.axios
|
|
|
+ .get("/api/custom_product_detail", {
|
|
|
+ params: { custom_id: this.custom_id },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ this.tableData = res.data.list.data;
|
|
|
+ this.formData = JSON.parse(JSON.stringify(res.data));
|
|
|
+ delete this.formData.list;
|
|
|
+ this.formData.custom_id = this.formData.id;
|
|
|
+ this.fax = res.data.fax;
|
|
|
+ // this.formData.lockState = this.formData.lock == 1 ? true : false
|
|
|
+ this.tableData.forEach((element) => {
|
|
|
+ element.discount_price = (
|
|
|
+ (element.price * element.fax) /
|
|
|
+ 100
|
|
|
+ ).toFixed(2);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err);
|
|
|
});
|
|
|
- }).catch(err => {
|
|
|
- console.error(err);
|
|
|
- })
|
|
|
},
|
|
|
- goBack () { this.$router.go(-1) },
|
|
|
- handleSet (row, index, type) {
|
|
|
- this.tableData.splice(index, 1)
|
|
|
+ goBack() {
|
|
|
+ this.$router.go(-1);
|
|
|
},
|
|
|
- postData () {
|
|
|
+ handleSet(row, index, type) {
|
|
|
+ let obj
|
|
|
+ // 4删除5复制
|
|
|
+ switch (type) {
|
|
|
+ case 4:
|
|
|
+ this.tableData.splice(index, 1);
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ obj= JSON.parse(JSON.stringify(row));
|
|
|
+ this.tableData.splice(index, 0, obj);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ postData() {
|
|
|
this.axios({
|
|
|
- method: 'post',
|
|
|
- url: '/api/custom_product_edit',
|
|
|
+ method: "post",
|
|
|
+ url: "/api/custom_product_edit",
|
|
|
data: {
|
|
|
...this.formData,
|
|
|
- detail: this.tableData
|
|
|
- }
|
|
|
- }).then((res) => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$Message.success(res.msg)
|
|
|
- this.goBack()
|
|
|
- }
|
|
|
- }).catch((err) => {
|
|
|
-
|
|
|
- });
|
|
|
+ detail: this.tableData,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$Message.success(res.msg);
|
|
|
+ this.goBack();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {});
|
|
|
},
|
|
|
- handleCustomerChange (val) {
|
|
|
- const row = this.customList.filter((item) => item.id == val)
|
|
|
- this.fax = row[0].fax
|
|
|
- this.tableData.forEach(element => {
|
|
|
+ handleCustomerChange(val) {
|
|
|
+ const row = this.customList.filter((item) => item.id == val);
|
|
|
+ this.fax = row[0].fax;
|
|
|
+ this.tableData.forEach((element) => {
|
|
|
element.fax = this.fax || 100;
|
|
|
- (element.price) && (element.discount_price = (element.price * element.fax / 100).toFixed(2))
|
|
|
+ element.price &&
|
|
|
+ (element.discount_price = (
|
|
|
+ (element.price * element.fax) /
|
|
|
+ 100
|
|
|
+ ).toFixed(2));
|
|
|
});
|
|
|
- this.tableData = JSON.parse(JSON.stringify(this.tableData))
|
|
|
+ this.tableData = JSON.parse(JSON.stringify(this.tableData));
|
|
|
},
|
|
|
- handleRuleAdd () {
|
|
|
- const obj = { min: null, max: null, formula: null }
|
|
|
- this.tableData.push({})
|
|
|
+ handleRuleAdd() {
|
|
|
+ const obj = { min: null, max: null, formula: null };
|
|
|
+ this.tableData.push({});
|
|
|
},
|
|
|
- handleSelectedDele (row, index) {
|
|
|
- this.modalData.selectedData.splice(index, 1)
|
|
|
+ handleSelectedDele(row, index) {
|
|
|
+ this.modalData.selectedData.splice(index, 1);
|
|
|
},
|
|
|
- changeProduct (row, index) {
|
|
|
- this.axios.get('/api/get_part_by_basic_product', { params: { basic_product_id: row.basic_product_id } })
|
|
|
- .then(res => {
|
|
|
- this.partsList = res.data
|
|
|
- }).catch(err => { console.error(err); })
|
|
|
+ changeProduct(row, index) {
|
|
|
+ this.axios
|
|
|
+ .get("/api/get_part_by_basic_product", {
|
|
|
+ params: { basic_product_id: row.basic_product_id },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ this.partsList = res.data;
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
},
|
|
|
- handleSelect () {
|
|
|
- this.modalData.selectedData.forEach(element => {
|
|
|
- element.product_id = element.id
|
|
|
- element.type_title = element.type_name
|
|
|
- element.fax = this.fax || 100
|
|
|
+ handleSelect() {
|
|
|
+ this.modalData.selectedData.forEach((element) => {
|
|
|
+ element.product_id = element.id;
|
|
|
+ element.type_title = element.type_name;
|
|
|
+ element.fax = this.fax || 100;
|
|
|
});
|
|
|
- this.tableData.splice((this.tableData.length - 1), 0, ...this.modalData.selectedData)
|
|
|
+ this.tableData.splice(
|
|
|
+ this.tableData.length - 1,
|
|
|
+ 0,
|
|
|
+ ...this.modalData.selectedData
|
|
|
+ );
|
|
|
},
|
|
|
- handleTreeSlect (array, row) {
|
|
|
- row.id && this.axios({
|
|
|
- method: 'get',
|
|
|
- url: '/api/product',
|
|
|
- params: {
|
|
|
- page_index: this.modal_page_index,
|
|
|
- page_size: this.modal_page_size,
|
|
|
- type_id: row.id
|
|
|
- }
|
|
|
- }).then((res) => {
|
|
|
- this.modal_total = res.data.total
|
|
|
- this.modalData.tableData = res.data.data
|
|
|
- }).catch((err) => { });
|
|
|
+ handleTreeSlect(array, row) {
|
|
|
+ row.id &&
|
|
|
+ this.axios({
|
|
|
+ method: "get",
|
|
|
+ url: "/api/product",
|
|
|
+ params: {
|
|
|
+ page_index: this.modal_page_index,
|
|
|
+ page_size: this.modal_page_size,
|
|
|
+ type_id: row.id,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ this.modal_total = res.data.total;
|
|
|
+ this.modalData.tableData = res.data.data;
|
|
|
+ });
|
|
|
},
|
|
|
- initModal () {
|
|
|
+ initModal() {
|
|
|
this.axios({
|
|
|
- method: 'get',
|
|
|
- url: '/api/product',
|
|
|
+ method: "get",
|
|
|
+ url: "/api/product",
|
|
|
params: {
|
|
|
page_index: this.modal_page_index,
|
|
|
page_size: this.modal_page_size,
|
|
|
title: this.modalData.title,
|
|
|
- type_title: this.modalData.type_title
|
|
|
- }
|
|
|
- }).then((res) => {
|
|
|
- this.modal_total = res.data.total
|
|
|
- this.modalData.tableData = res.data.data
|
|
|
- this.reselection()
|
|
|
- }).catch((err) => { });
|
|
|
+ type_title: this.modalData.type_title,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ this.modal_total = res.data.total;
|
|
|
+ this.modalData.tableData = res.data.data;
|
|
|
+ this.reselection();
|
|
|
+ })
|
|
|
+ .catch((err) => {});
|
|
|
},
|
|
|
- changeModalSize (e) {
|
|
|
+ changeModalSize(e) {
|
|
|
this.modal_page_size = e;
|
|
|
- this.initModal()
|
|
|
+ this.initModal();
|
|
|
},
|
|
|
- changeModalPage (e) {
|
|
|
+ changeModalPage(e) {
|
|
|
this.modal_page_index = e;
|
|
|
- this.initModal()
|
|
|
+ this.initModal();
|
|
|
},
|
|
|
- handleSelectionAll (selection) {
|
|
|
- this.modalData.selectedData = this.modalData.selectedData.concat(selection)
|
|
|
+ handleSelectionAll(selection) {
|
|
|
+ this.modalData.selectedData = this.modalData.selectedData.concat(
|
|
|
+ selection
|
|
|
+ );
|
|
|
},
|
|
|
- handleSelectionAllCancel () {
|
|
|
- this.modalData.tableData.forEach(element => {
|
|
|
- this.modalData.selectedData = this.modalData.selectedData.filter((x) => {
|
|
|
- return x.material_detail_id != element.material_detail_id
|
|
|
- })
|
|
|
+ handleSelectionAllCancel() {
|
|
|
+ this.modalData.tableData.forEach((element) => {
|
|
|
+ this.modalData.selectedData = this.modalData.selectedData.filter(
|
|
|
+ (x) => {
|
|
|
+ return x.material_detail_id != element.material_detail_id;
|
|
|
+ }
|
|
|
+ );
|
|
|
});
|
|
|
},
|
|
|
- handleSelection (selection, row) {
|
|
|
- this.modalData.selectedData.push(row)
|
|
|
+ handleSelection(selection, row) {
|
|
|
+ this.modalData.selectedData.push(row);
|
|
|
},
|
|
|
- handleSelectionCancel (selection, row) {
|
|
|
+ handleSelectionCancel(selection, row) {
|
|
|
this.modalData.selectedData.forEach((element, index) => {
|
|
|
if (element.material_detail_id == row.material_detail_id) {
|
|
|
- this.modalData.selectedData.splice(index, 1)
|
|
|
+ this.modalData.selectedData.splice(index, 1);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -439,17 +559,17 @@ export default {
|
|
|
computed: {},
|
|
|
// 监控data中的数据变化
|
|
|
watch: {},
|
|
|
- beforeCreate () { }, // 生命周期 - 创建之前
|
|
|
- beforeMount () { }, // 生命周期 - 挂载之前
|
|
|
- beforeUpdate () { }, // 生命周期 - 更新之前
|
|
|
- updated () { }, // 生命周期 - 更新之后
|
|
|
- beforeDestroy () { }, // 生命周期 - 销毁之前
|
|
|
- destroyed () { }, // 生命周期 - 销毁完成
|
|
|
- activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
-}
|
|
|
+ beforeCreate() {}, // 生命周期 - 创建之前
|
|
|
+ beforeMount() {}, // 生命周期 - 挂载之前
|
|
|
+ beforeUpdate() {}, // 生命周期 - 更新之前
|
|
|
+ updated() {}, // 生命周期 - 更新之后
|
|
|
+ beforeDestroy() {}, // 生命周期 - 销毁之前
|
|
|
+ destroyed() {}, // 生命周期 - 销毁完成
|
|
|
+ activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
-<style lang='scss' scoped>
|
|
|
+<style lang="scss" scoped>
|
|
|
.top_search {
|
|
|
padding: 20px 0;
|
|
|
width: 100%;
|