|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<div>
|
|
|
- <el-page-header @back="goBack" content="存货调价单"> </el-page-header>
|
|
|
+ <el-page-header @back="goBack" :content="!cid?'存货调价单':'编辑'"> </el-page-header>
|
|
|
</div>
|
|
|
<br /><br />
|
|
|
<div>
|
|
@@ -113,7 +113,8 @@
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item>
|
|
|
- <el-select
|
|
|
+ <template v-if="!cid">
|
|
|
+ <el-select
|
|
|
placeholder="请选择销售类型"
|
|
|
@change="
|
|
|
handleSale($event, scope.$index, scope.row.saleTypes)
|
|
@@ -126,9 +127,15 @@
|
|
|
:value="item.id"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
- <!-- <el-select
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-else>
|
|
|
+ <el-select
|
|
|
+
|
|
|
+ @change="
|
|
|
+ handleSale($event, scope.$index, scope.row.id)
|
|
|
+ "
|
|
|
placeholder="请选择销售类型"
|
|
|
- filterable
|
|
|
v-model="scope.row.saleTypeId"
|
|
|
>
|
|
|
<el-option
|
|
@@ -136,7 +143,9 @@
|
|
|
:label="item.saleName"
|
|
|
:value="item.id"
|
|
|
></el-option>
|
|
|
- </el-select> -->
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ </template>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -236,7 +245,7 @@
|
|
|
<el-form-item>
|
|
|
<el-select
|
|
|
multiple
|
|
|
- :disabled="fang"
|
|
|
+ :disabled="scope.row.fang"
|
|
|
v-model="scope.row.walletRebateId"
|
|
|
placeholder="请选择返利类型"
|
|
|
@change="handelRebateList($event, scope.$index, scope.row)"
|
|
@@ -331,8 +340,10 @@
|
|
|
show-overflow-tooltip
|
|
|
><template slot-scope="scope">
|
|
|
<el-form-item>
|
|
|
- <el-select
|
|
|
+ <template v-if="!cid">
|
|
|
+ <el-select
|
|
|
multiple
|
|
|
+ clearable
|
|
|
v-model="scope.row.walletsId"
|
|
|
@change="handelWallets($event, scope.$index, scope.row)"
|
|
|
placeholder="请选择现金钱包"
|
|
@@ -344,7 +355,24 @@
|
|
|
:label="item.name"
|
|
|
>
|
|
|
</el-option>
|
|
|
- </el-select>
|
|
|
+ </el-select></template>
|
|
|
+ <template v-else>
|
|
|
+ <el-select
|
|
|
+ multiple
|
|
|
+ clearable
|
|
|
+ v-model="scope.row.walletsId"
|
|
|
+ @change="handelWallets($event, scope.$index, scope.row)"
|
|
|
+ placeholder="请选择现金钱包"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in scope.row.walleList"
|
|
|
+ :key="item.walletId"
|
|
|
+ :value="item.walletId"
|
|
|
+ :label="item.walletName"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select></template>
|
|
|
+
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -665,10 +693,17 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="btn-group clearfix">
|
|
|
- <el-button size="small" @click="handleReseat">重置</el-button>
|
|
|
+ <template v-if="!cid">
|
|
|
+ <el-button size="small" @click="handleReseat">重置</el-button>
|
|
|
<el-button size="small" type="primary" @click="hanleSbumit"
|
|
|
>提交</el-button
|
|
|
>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-button size="small" type="primary" @click="hanleSave"
|
|
|
+ >保存</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
<el-button
|
|
|
style="float: right"
|
|
|
type="primary"
|
|
@@ -829,12 +864,14 @@ import {
|
|
|
getUserList,
|
|
|
getMaterialDetail,
|
|
|
getWalletList,
|
|
|
+ handleEdit
|
|
|
} from "@/api/basic_data/material";
|
|
|
|
|
|
import MaterialListDetail from "./material_list-detail.vue";
|
|
|
import Mixin from "@/mixin/index";
|
|
|
export default {
|
|
|
mixins: [Mixin],
|
|
|
+ props:['cid'],
|
|
|
data() {
|
|
|
return {
|
|
|
listLoading: false,
|
|
@@ -876,6 +913,8 @@ export default {
|
|
|
selectData: [],
|
|
|
walleList: [],
|
|
|
fang: true,
|
|
|
+ wall1:[],
|
|
|
+ wall2:[]
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -888,6 +927,7 @@ export default {
|
|
|
};
|
|
|
getTypeList(params).then((res) => {
|
|
|
this.typeList = res.data.records;
|
|
|
+ console.log(this.typeList,'84545');
|
|
|
});
|
|
|
getUserList({
|
|
|
pageNum: 1,
|
|
@@ -917,58 +957,75 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
handleSale(e, index, saleTypes) {
|
|
|
-
|
|
|
let saleArr = [];
|
|
|
let rebateList =[]
|
|
|
rebateList = this.rebateList.filter((k) => {
|
|
|
|
|
|
return e === k.saleTypeId;
|
|
|
});
|
|
|
- saleArr = saleTypes.filter((i) => {
|
|
|
+ saleArr = this.typeList.filter((i) => {
|
|
|
return e == i.id;
|
|
|
});
|
|
|
-
|
|
|
+ console.log(rebateList);
|
|
|
// this.items[index].mainName = saleArr[0].mainName;
|
|
|
this.items[index].saleTypeId = saleArr[0].id;
|
|
|
+ this.items[index].fang= false
|
|
|
this.items[index].saleTypeName = saleArr[0].saleName;
|
|
|
this.$set(this.items[index], "rebateList", rebateList);
|
|
|
- this.fang = false;
|
|
|
+ // this.fang = false;
|
|
|
},
|
|
|
// xua
|
|
|
handelWallets(e, index, row) {
|
|
|
- for (let i = 0; i < e.length; i++) {
|
|
|
- if (this.items[index].wallets.length) {
|
|
|
- for (let j = 0; j < this.items[index].wallets.length; j++) {
|
|
|
- if (e[i] !== this.items[index].wallets[j].walletId) {
|
|
|
- this.$set(this.items[index], "wallets", [
|
|
|
- ...this.items[index].wallets,
|
|
|
- {
|
|
|
+ let id = row.cid
|
|
|
+
|
|
|
+ if (!this.wall1.includes(e[e.length-1])) {
|
|
|
+ this.items[index].wallets.push( {
|
|
|
type: "COMMONLY",
|
|
|
id: "",
|
|
|
- updPriceBillId: row.cid,
|
|
|
- updPriceBillItemId: row.cid,
|
|
|
- walletId: e[i],
|
|
|
- },
|
|
|
- ]);
|
|
|
+ updPriceBillId: id,
|
|
|
+ updPriceBillItemId: id,
|
|
|
+ walletId: e[e.length-1],
|
|
|
+ })
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log(987);
|
|
|
- this.$set(this.items[index], "wallets", [
|
|
|
- {
|
|
|
- type: "COMMONLY",
|
|
|
- id: "",
|
|
|
- updPriceBillId: row.id,
|
|
|
- updPriceBillItemId: row.id,
|
|
|
- walletId: e[0],
|
|
|
- },
|
|
|
- ]);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- console.log(this.items[index], 456);
|
|
|
+ // if ( this.items[index].wallets.length) {
|
|
|
+ // for (let j = 0; j < this.items[index].wallets.length; j++) {
|
|
|
+ // if (row.walleList[i].id !== this.items[index].wallets[j].walletId) {
|
|
|
+
|
|
|
+ // // this.$set(this.items[index], 'wallets',[
|
|
|
+ // // ...this.items[index].wallets,
|
|
|
+ // // {
|
|
|
+ // // type: "COMMONLY",
|
|
|
+ // // id: "",
|
|
|
+ // // updPriceBillId: id,
|
|
|
+ // // updPriceBillItemId: id,
|
|
|
+ // // walletId: e[i],
|
|
|
+ // // },
|
|
|
+ // // ]
|
|
|
+
|
|
|
+ // // );
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
},
|
|
|
handelRebateList(e, index, row) {
|
|
|
+
|
|
|
+ // let id = row.cid
|
|
|
+
|
|
|
+ // if (!this.wall1.includes(e[e.length-1])) {
|
|
|
+ // this.items[index].wallets.push( {
|
|
|
+ // type: "COMMONLY",
|
|
|
+ // id: "",
|
|
|
+ // updPriceBillId: id,
|
|
|
+ // updPriceBillItemId: id,
|
|
|
+ // walletId: e[e.length-1],
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+
|
|
|
for (let i = 0; i < e.length; i++) {
|
|
|
if (this.items[index].wallets.length) {
|
|
|
for (let j = 0; j < this.items[index].wallets.length; j++) {
|
|
@@ -1008,6 +1065,7 @@ export default {
|
|
|
this.serviceId = adminCompany.roleId;
|
|
|
},
|
|
|
goBack() {
|
|
|
+ this.$parent.cid=''
|
|
|
this.$parent.show = 1;
|
|
|
// 更新父组件数据
|
|
|
this.$parent.getList();
|
|
@@ -1087,6 +1145,7 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
cid: this.selectData[i].id,
|
|
|
+ fang:true
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1122,8 +1181,60 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getList() {
|
|
|
- this.listLoading = true;
|
|
|
- let params = {
|
|
|
+
|
|
|
+ if (this.$parent.show == 5) {
|
|
|
+ let rebateList= []
|
|
|
+ getProductRriceDetail({ id:this.cid }).then((res) => {
|
|
|
+ // this.editData = res.data;
|
|
|
+
|
|
|
+ for (let i = 0; i < res.data.items.length; i++) {
|
|
|
+ res.data.items[i].isPublishArr= [
|
|
|
+ {
|
|
|
+ value: "是",
|
|
|
+ bool: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "否",
|
|
|
+ bool: false,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ res.data.items[i].isPromoteArr=[
|
|
|
+ {
|
|
|
+ value: "是",
|
|
|
+ bool: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "否",
|
|
|
+ bool: false,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ let walletIds=[]
|
|
|
+ res.data.items[i].walletsId = ''
|
|
|
+ for (let p = 0; p < res.data.items[i].wallets2.length; p++) {
|
|
|
+ walletIds.push(res.data.items[i].wallets2[p].walletIds)
|
|
|
+ }
|
|
|
+ this.$set(res.data.items[i],'walletsId',walletIds)
|
|
|
+
|
|
|
+ rebateList = this.rebateList.filter((k) => {
|
|
|
+ return res.data.items[i].saleTypeId === k.saleTypeId;
|
|
|
+ });
|
|
|
+ this.items =res.data.items
|
|
|
+ this.base = res.data
|
|
|
+ res.data.items[i].wallets =[]
|
|
|
+ res.data.items[i].walleList = res.data.items[i].wallets2
|
|
|
+ res.data.items[i].rebateWallets=[]
|
|
|
+ res.data.items[i].rebateList=rebateList
|
|
|
+ res.data.items[i].fang = false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.listLoading = false;
|
|
|
+
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.listLoading = true;
|
|
|
+ let params = {
|
|
|
pageNum: this.currentPage,
|
|
|
pageSize: 10 || this.pageSize,
|
|
|
keyword: this.screenForm.keyword,
|
|
@@ -1134,6 +1245,8 @@ export default {
|
|
|
this.listTotal = res.data.total;
|
|
|
this.listLoading = false;
|
|
|
});
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
/**
|
|
|
* 根据条件禁用行复选框
|
|
@@ -1154,11 +1267,13 @@ export default {
|
|
|
// 如果没有返回值则默认返回false(全部无法选中)
|
|
|
},
|
|
|
hanleSbumit() {
|
|
|
+
|
|
|
for (let i = 0; i < this.items.length; i++) {
|
|
|
this.items[i].wallets = [
|
|
|
...this.items[i].rebateWallets,
|
|
|
...this.items[i].wallets,
|
|
|
];
|
|
|
+ console.log(this.items,45454);
|
|
|
if (!this.items[i].mainId) {
|
|
|
this.$errorMsg("请选择销售类型");
|
|
|
return;
|
|
@@ -1174,14 +1289,22 @@ export default {
|
|
|
serviceName: this.nickName,
|
|
|
};
|
|
|
getProductRriceAdd(params).then((res) => {
|
|
|
- this.$successMsg("成功");
|
|
|
- getProductRriceDetail({ id: res.data }).then((res) => {
|
|
|
- this.base.billId = res.data.billId;
|
|
|
+ this.$successMsg("成功");
|
|
|
this.$parent.show = 1;
|
|
|
this.$parent.getList();
|
|
|
- });
|
|
|
});
|
|
|
},
|
|
|
+ hanleSave(){
|
|
|
+ handleEdit({
|
|
|
+ ...this.base
|
|
|
+ }).then(res=>{
|
|
|
+ this.$successMsg("成功");
|
|
|
+ this.$parent.cid=''
|
|
|
+ this.$parent.show = 1;
|
|
|
+ this.$parent.getList();
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
handleReseat() {
|
|
|
this.base = {
|
|
|
adminCompanyId: "",
|