|
@@ -1,8 +1,11 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
- <addProject ref="addProject" :param="paramProject" class="inline-16" @add="addProject" @adds="addProjects"></addProject>
|
|
|
|
|
- <el-button :type="items.length > 0?'primary':''" size="small" @click="delProjects" :disabled="items.length === 0">删 除</el-button>
|
|
|
|
|
- <tableList style="margin-top: 10px" :checkbox="true" :loading="loading" :layout="projectCols" :data="list" :opwidth="200" :custom="true" fixedName="operation" @selectionChange="selectionChange">
|
|
|
|
|
|
|
+ <addProject v-if="!isDisabled" ref="addProject" :param="paramProject" class="inline-16" @add="addProject" @adds="addProjects"></addProject>
|
|
|
|
|
+ <el-button v-if="!isDisabled" :type="items.length > 0?'primary':''" size="small" @click="delProjects" class="inline-16" :disabled="items.length === 0">删 除</el-button>
|
|
|
|
|
+ <el-input style="width:200px;" placeholder="搜索" :suffix-icon="projectParam.content.where.condition?projectParam.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="projectParam.content.where.condition" @keyup.native.enter="listData(projectParam.content.pageNumber = 1)" @clear="listData(projectParam.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <tableList :height="'calc(90vh - 1050px)'" ref="projectRef" style="margin-top: 10px" :checkbox="true" :layout="projectCols" :data="list" :opwidth="200" :custom="true" fixedName="operation"
|
|
|
|
|
+ highlight-current-row @selectionChange="selectionChange" @rowClick="rowClick" >
|
|
|
<template v-slot:customcol="scope">
|
|
<template v-slot:customcol="scope">
|
|
|
<div v-if="scope.column.columnname === 'operation'">
|
|
<div v-if="scope.column.columnname === 'operation'">
|
|
|
<span>{{scope.column.data[scope.column.columnname]}}</span>
|
|
<span>{{scope.column.data[scope.column.columnname]}}</span>
|
|
@@ -10,21 +13,77 @@
|
|
|
<p v-else>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
|
|
<p v-else>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:opreation="scope">
|
|
<template v-slot:opreation="scope">
|
|
|
- <el-button type="text" size="mini" @click="onProduct(scope.data)">添加产品</el-button>
|
|
|
|
|
- <el-button size="mini" type="text" @click="delProject(scope.data)">删 除</el-button>
|
|
|
|
|
|
|
+ <el-button type="text" size="mini" @click="onProduct(scope.data)" :disabled="isDisabled">添加产品</el-button>
|
|
|
|
|
+ <el-button size="mini" type="text" @click="delProject(scope.data)" :disabled="isDisabled">删 除</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</tableList>
|
|
</tableList>
|
|
|
- <tableList style="margin-top: 10px" :checkbox="true" :loading="loading" :layout="productCols" :data="productList" :opwidth="200" :custom="true" fixedName="operation">
|
|
|
|
|
|
|
+ <div class=" container " style="text-align:left;float: left">
|
|
|
|
|
+ <span style="font-size: 14px">预测金额: ¥{{tool.formatAmount(projectPrice,2)}}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="container " style="text-align:right;float: right">
|
|
|
|
|
+ <el-pagination
|
|
|
|
|
+ background
|
|
|
|
|
+ @size-change="handleSizeChangeProject"
|
|
|
|
|
+ @current-change="handleCurrentChangeProject"
|
|
|
|
|
+ :current-page="projectParam.content.pageNumber"
|
|
|
|
|
+ :page-sizes="[20, 50, 100, 200]"
|
|
|
|
|
+ :page-size="20"
|
|
|
|
|
+ layout="total,sizes, prev, pager, next, jumper"
|
|
|
|
|
+ :total="totalProject">
|
|
|
|
|
+ </el-pagination>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="19">
|
|
|
|
|
+ <el-button v-if="!isDisabled" :type="itemsPro.length > 0?'primary':''" size="small" @click="delProducts" class="inline-16" :disabled="itemsPro.length === 0">删 除</el-button>
|
|
|
|
|
+ <el-input style="width:200px;" placeholder="搜索" :suffix-icon="productParam.content.where.condition?productParam.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="productParam.content.where.condition" @keyup.native.enter="listData(productParam.content.pageNumber = 1)" @clear="listData(productParam.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="5">
|
|
|
|
|
+ <el-input :disabled="isDisabled" style="width:100px;float: right" v-model="discountrate" placeholder="默认100" @change="discountrateChange(discountrate)">
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <span style="float: right;line-height: 40px;height:40px;font-size:13px;vertical-align: auto">折扣(%):</span>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <tableList :height="'calc(90vh - 1750px)'" style="margin-top: 10px" :checkbox="true" :layout="productCols" :data="productList" :opwidth="200" :custom="true" fixedName="operation"
|
|
|
|
|
+ @selectionChange="selectionChangePro">
|
|
|
<template v-slot:customcol="scope">
|
|
<template v-slot:customcol="scope">
|
|
|
<div v-if="scope.column.columnname === 'operation'">
|
|
<div v-if="scope.column.columnname === 'operation'">
|
|
|
<span>{{scope.column.data[scope.column.columnname]}}</span>
|
|
<span>{{scope.column.data[scope.column.columnname]}}</span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div v-else-if="scope.column.columnname === 'orderqty'">
|
|
|
|
|
+ <span v-if="isDisabled">{{scope.column.data[scope.column.columnname]}}</span>
|
|
|
|
|
+ <span v-else>
|
|
|
|
|
+ <el-input-number size="mini" v-model="scope.column.data.orderqty" @change="onChange(scope.column.data.orderqty,scope.$index,scope.column.data)" :min="scope.column.data.orderminqty" :step="scope.column.data.orderaddqty"></el-input-number>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else-if="scope.column.columnname === 'price'">
|
|
|
|
|
+ <span v-if="isDisabled">{{scope.column.data[scope.column.columnname]}}</span>
|
|
|
|
|
+ <span v-else>
|
|
|
|
|
+ <el-input size="mini" v-model="scope.column.data.price" @change="priceChange(scope.column.data.price,scope.$index,scope.column.data)"></el-input>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
<p v-else>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
|
|
<p v-else>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:opreation="scope">
|
|
<template v-slot:opreation="scope">
|
|
|
- <el-button size="mini" type="text" @click="delProduct(scope.data)">删 除</el-button>
|
|
|
|
|
|
|
+ <el-button size="mini" type="text" @click="delProduct(scope.data)" :disabled="isDisabled">删 除</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</tableList>
|
|
</tableList>
|
|
|
|
|
+ <div class=" container " style="text-align:left;float: left">
|
|
|
|
|
+ <span style="font-size: 14px">预测金额: ¥{{tool.formatAmount(productPrice,2)}}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="container " style="text-align:right;float: right">
|
|
|
|
|
+ <el-pagination
|
|
|
|
|
+ background
|
|
|
|
|
+ @size-change="handleSizeChangeProduct"
|
|
|
|
|
+ @current-change="handleCurrentChangeProduct"
|
|
|
|
|
+ :current-page="productParam.content.pageNumber"
|
|
|
|
|
+ :page-sizes="[20, 50, 100, 200]"
|
|
|
|
|
+ :page-size="20"
|
|
|
|
|
+ layout="total,sizes, prev, pager, next, jumper"
|
|
|
|
|
+ :total="totalProduct">
|
|
|
|
|
+ </el-pagination>
|
|
|
|
|
+ </div>
|
|
|
<el-drawer
|
|
<el-drawer
|
|
|
title="添加商品"
|
|
title="添加商品"
|
|
|
:visible.sync="dialogVisible"
|
|
:visible.sync="dialogVisible"
|
|
@@ -34,7 +93,7 @@
|
|
|
append-to-body
|
|
append-to-body
|
|
|
>
|
|
>
|
|
|
<addProduct ref="productRef" :params="paramProduct" :tablecolsAdd="tablecolsAdd" :querySa_brandid="brandid"
|
|
<addProduct ref="productRef" :params="paramProduct" :tablecolsAdd="tablecolsAdd" :querySa_brandid="brandid"
|
|
|
- :tradefield="tradefield" :discountrate="discountrate" @addProduct="addProduct" @addSuccess="addProducts"></addProduct>
|
|
|
|
|
|
|
+ :tradefield="tradefield" @addProduct="addProduct" @addSuccess="addProducts"></addProduct>
|
|
|
</el-drawer>
|
|
</el-drawer>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -45,6 +104,7 @@ import addProject from '@/template/prediction/addProjectTemp'
|
|
|
import addProduct from '@/template/prediction/addProductTemp'
|
|
import addProduct from '@/template/prediction/addProductTemp'
|
|
|
export default {
|
|
export default {
|
|
|
name: "projectList",
|
|
name: "projectList",
|
|
|
|
|
+ props:['id','isDisabled'],
|
|
|
components:{tableList,addProject,addProduct},
|
|
components:{tableList,addProject,addProduct},
|
|
|
data(){
|
|
data(){
|
|
|
return {
|
|
return {
|
|
@@ -52,7 +112,7 @@ export default {
|
|
|
brandid:'',
|
|
brandid:'',
|
|
|
tradefield:'',
|
|
tradefield:'',
|
|
|
sa_brandid:'',
|
|
sa_brandid:'',
|
|
|
- discountrate:'',
|
|
|
|
|
|
|
+ discountrate:1,
|
|
|
projectCols:[],
|
|
projectCols:[],
|
|
|
productCols:[],
|
|
productCols:[],
|
|
|
tablecolsAdd:[],
|
|
tablecolsAdd:[],
|
|
@@ -60,11 +120,19 @@ export default {
|
|
|
productList:[],
|
|
productList:[],
|
|
|
loading:false,
|
|
loading:false,
|
|
|
items:[],
|
|
items:[],
|
|
|
|
|
+ itemsPro:[],
|
|
|
selectProject:'',
|
|
selectProject:'',
|
|
|
|
|
+ selectProjectid:'',
|
|
|
|
|
+ totalProject:0,
|
|
|
|
|
+ totalProduct:0,
|
|
|
|
|
+ projectPrice:0,
|
|
|
|
|
+ productPrice:0,
|
|
|
projectParam:{
|
|
projectParam:{
|
|
|
"id": 20230705144904,
|
|
"id": 20230705144904,
|
|
|
"content": {
|
|
"content": {
|
|
|
- "sa_salesforecastbillid":this.$route.query.id,
|
|
|
|
|
|
|
+ "sa_salesforecastbillid":this.id,
|
|
|
|
|
+ "pageNumber": 1,
|
|
|
|
|
+ "pageSize": 20,
|
|
|
"where":{
|
|
"where":{
|
|
|
"condition":""
|
|
"condition":""
|
|
|
}
|
|
}
|
|
@@ -74,6 +142,8 @@ export default {
|
|
|
"id": 20230705145004,
|
|
"id": 20230705145004,
|
|
|
"content": {
|
|
"content": {
|
|
|
"sa_salesforecastprojectid": '',
|
|
"sa_salesforecastprojectid": '',
|
|
|
|
|
+ "pageNumber": 1,
|
|
|
|
|
+ "pageSize": 20,
|
|
|
"where":{
|
|
"where":{
|
|
|
"condition":""
|
|
"condition":""
|
|
|
}
|
|
}
|
|
@@ -84,7 +154,7 @@ export default {
|
|
|
"content": {
|
|
"content": {
|
|
|
"pageNumber": 1,
|
|
"pageNumber": 1,
|
|
|
"pageSize": 20,
|
|
"pageSize": 20,
|
|
|
- "sa_salesforecastbillid":this.$route.query.id,
|
|
|
|
|
|
|
+ "sa_salesforecastbillid":this.id,
|
|
|
"where": {
|
|
"where": {
|
|
|
"condition": ""
|
|
"condition": ""
|
|
|
}
|
|
}
|
|
@@ -95,32 +165,63 @@ export default {
|
|
|
"content": {
|
|
"content": {
|
|
|
"pageNumber": 1,
|
|
"pageNumber": 1,
|
|
|
"pageSize": 20,
|
|
"pageSize": 20,
|
|
|
- "sa_salesforecastbillid":this.$route.query.id,
|
|
|
|
|
|
|
+ "sa_salesforecastbillid":this.id,
|
|
|
"sa_salesforecastprojectid":'',
|
|
"sa_salesforecastprojectid":'',
|
|
|
"sa_projectid":"",
|
|
"sa_projectid":"",
|
|
|
"where": {
|
|
"where": {
|
|
|
"condition": ""
|
|
"condition": ""
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ currentRow: 0
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods:{
|
|
methods:{
|
|
|
- /*项目列表*/
|
|
|
|
|
|
|
+ /*初始化项目列表*/
|
|
|
async listData(){
|
|
async listData(){
|
|
|
const res = await this.$api.requested(this.projectParam)
|
|
const res = await this.$api.requested(this.projectParam)
|
|
|
this.list = res.data
|
|
this.list = res.data
|
|
|
|
|
+ this.totalProject = res.total
|
|
|
this.selectProject = res.data[0].sa_salesforecastprojectid
|
|
this.selectProject = res.data[0].sa_salesforecastprojectid
|
|
|
|
|
+ this.selectProjectid = res.data[0].sa_projectid
|
|
|
|
|
+ this.$refs.projectRef.$refs.table.setCurrentRow(this.list[0])
|
|
|
|
|
+ if (res.data.length > 0){
|
|
|
|
|
+ this.projectPrice = res.data[0].sumprojectamount
|
|
|
|
|
+ this.discountrate = res.data[0].discountrate * 100
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.projectPrice = 0
|
|
|
|
|
+ this.discountrate = ''
|
|
|
|
|
+ }
|
|
|
this.productData(res.data[0].sa_salesforecastprojectid)
|
|
this.productData(res.data[0].sa_salesforecastprojectid)
|
|
|
},
|
|
},
|
|
|
|
|
+ /*更改数据后项目列表*/
|
|
|
|
|
+ async projectData(){
|
|
|
|
|
+ const res = await this.$api.requested(this.projectParam)
|
|
|
|
|
+ this.list = res.data
|
|
|
|
|
+ if (res.data.length > 0){
|
|
|
|
|
+ this.projectPrice = res.data[0].sumprojectamount
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.projectPrice = 0
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$refs.projectRef.$refs.table.setCurrentRow(this.list[this.currentRow])
|
|
|
|
|
+ this.productData(this.selectProject)
|
|
|
|
|
+ },
|
|
|
/*产品列表*/
|
|
/*产品列表*/
|
|
|
async productData(id){
|
|
async productData(id){
|
|
|
this.productParam.content.sa_salesforecastprojectid = id
|
|
this.productParam.content.sa_salesforecastprojectid = id
|
|
|
const res = await this.$api.requested(this.productParam)
|
|
const res = await this.$api.requested(this.productParam)
|
|
|
this.productList = res.data
|
|
this.productList = res.data
|
|
|
|
|
+ this.totalProduct = res.total
|
|
|
|
|
+ if (res.data.length > 0){
|
|
|
|
|
+ this.productPrice = res.data[0].sumorderamount
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.productPrice = 0
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
/*添加项目*/
|
|
/*添加项目*/
|
|
|
async addProject(id){
|
|
async addProject(id){
|
|
|
|
|
+ console.log(id,'项目id')
|
|
|
const res = await this.$api.requested({
|
|
const res = await this.$api.requested({
|
|
|
"id": 20230705145104,
|
|
"id": 20230705145104,
|
|
|
"content": {
|
|
"content": {
|
|
@@ -130,7 +231,7 @@ export default {
|
|
|
{
|
|
{
|
|
|
"sa_salesforecastprojectid": 0,
|
|
"sa_salesforecastprojectid": 0,
|
|
|
"ownerid": id,
|
|
"ownerid": id,
|
|
|
- "discountrate": 0.1
|
|
|
|
|
|
|
+ "discountrate": 1
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
@@ -138,6 +239,7 @@ export default {
|
|
|
this.tool.showMessage(res,()=>{
|
|
this.tool.showMessage(res,()=>{
|
|
|
this.projectParam.content.pageNumber = 1
|
|
this.projectParam.content.pageNumber = 1
|
|
|
this.listData()
|
|
this.listData()
|
|
|
|
|
+ this.$emit('onSuccess')
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
/*批量添加项目*/
|
|
/*批量添加项目*/
|
|
@@ -153,6 +255,7 @@ export default {
|
|
|
this.tool.showMessage(res,()=>{
|
|
this.tool.showMessage(res,()=>{
|
|
|
this.projectParam.content.pageNumber = 1
|
|
this.projectParam.content.pageNumber = 1
|
|
|
this.listData()
|
|
this.listData()
|
|
|
|
|
+ this.$emit('onSuccess')
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
/*删除项目*/
|
|
/*删除项目*/
|
|
@@ -167,6 +270,7 @@ export default {
|
|
|
this.tool.showMessage(res,()=>{
|
|
this.tool.showMessage(res,()=>{
|
|
|
this.projectParam.content.pageNumber = 1
|
|
this.projectParam.content.pageNumber = 1
|
|
|
this.listData()
|
|
this.listData()
|
|
|
|
|
+ this.$emit('onSuccess')
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
},
|
|
},
|
|
@@ -193,14 +297,20 @@ export default {
|
|
|
selectionChange(val){
|
|
selectionChange(val){
|
|
|
this.items = val
|
|
this.items = val
|
|
|
},
|
|
},
|
|
|
|
|
+ /*勾选产品*/
|
|
|
|
|
+ selectionChangePro(val){
|
|
|
|
|
+ this.itemsPro = val
|
|
|
|
|
+ },
|
|
|
/*添加产品*/
|
|
/*添加产品*/
|
|
|
onProduct(val){
|
|
onProduct(val){
|
|
|
console.log(val,'项目信息')
|
|
console.log(val,'项目信息')
|
|
|
|
|
+ this.selectProject = val.sa_salesforecastprojectid
|
|
|
|
|
+ this.selectProjectid = val.sa_projectid
|
|
|
this.paramProduct.content.sa_salesforecastprojectid = val.sa_salesforecastprojectid
|
|
this.paramProduct.content.sa_salesforecastprojectid = val.sa_salesforecastprojectid
|
|
|
this.paramProduct.content.sa_projectid = val.sa_projectid
|
|
this.paramProduct.content.sa_projectid = val.sa_projectid
|
|
|
this.tradefield = val.tradefield
|
|
this.tradefield = val.tradefield
|
|
|
this.sa_brandid = val.sa_brandid
|
|
this.sa_brandid = val.sa_brandid
|
|
|
- this.discountrate = val.discountrate
|
|
|
|
|
|
|
+ this.discountrate = val.discountrate * 100
|
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
|
this.$nextTick(()=>{
|
|
this.$nextTick(()=>{
|
|
|
this.$refs.productRef.onShow()
|
|
this.$refs.productRef.onShow()
|
|
@@ -213,13 +323,13 @@ export default {
|
|
|
"id": 20230705145204,
|
|
"id": 20230705145204,
|
|
|
"content": {
|
|
"content": {
|
|
|
"sa_salesforecastbillid": this.$route.query.id,
|
|
"sa_salesforecastbillid": this.$route.query.id,
|
|
|
- "sa_salesforecastprojectid": this.paramProduct.content.sa_salesforecastprojectid,
|
|
|
|
|
|
|
+ "sa_salesforecastprojectid": this.selectProject,
|
|
|
"salesforecast": [
|
|
"salesforecast": [
|
|
|
{
|
|
{
|
|
|
"itemid": val.itemid,
|
|
"itemid": val.itemid,
|
|
|
"orderqty": val.qty,
|
|
"orderqty": val.qty,
|
|
|
- "orderamount": val.orderamount,
|
|
|
|
|
- "price": val.price,
|
|
|
|
|
|
|
+ "orderamount":(val.marketprice * (this.discountrate/100))*val.qty,
|
|
|
|
|
+ "price": val.marketprice * (this.discountrate / 100),
|
|
|
"sa_salesforecastid":0
|
|
"sa_salesforecastid":0
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
@@ -227,18 +337,17 @@ export default {
|
|
|
})
|
|
})
|
|
|
this.tool.showMessage(res,()=>{
|
|
this.tool.showMessage(res,()=>{
|
|
|
this.dialogVisible = false
|
|
this.dialogVisible = false
|
|
|
- this.productData(this.selectProject)
|
|
|
|
|
|
|
+ this.onSuccess()
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
async addProducts(val){
|
|
async addProducts(val){
|
|
|
- console.log(val,'需要添加的产品')
|
|
|
|
|
let items = []
|
|
let items = []
|
|
|
items = val.map(item=>{
|
|
items = val.map(item=>{
|
|
|
return {
|
|
return {
|
|
|
"itemid": item.itemid,
|
|
"itemid": item.itemid,
|
|
|
"orderqty": item.qty,
|
|
"orderqty": item.qty,
|
|
|
- "orderamount": (item.marketprice * this.discountrate)*item.qty,
|
|
|
|
|
- "price": item.marketprice * this.discountrate,
|
|
|
|
|
|
|
+ "orderamount": (item.marketprice * (this.discountrate /100))*item.qty,
|
|
|
|
|
+ "price": item.marketprice * (this.discountrate /100),
|
|
|
"sa_salesforecastid":0
|
|
"sa_salesforecastid":0
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -247,13 +356,13 @@ export default {
|
|
|
"id": 20230705145204,
|
|
"id": 20230705145204,
|
|
|
"content": {
|
|
"content": {
|
|
|
"sa_salesforecastbillid": this.$route.query.id,
|
|
"sa_salesforecastbillid": this.$route.query.id,
|
|
|
- "sa_salesforecastprojectid": this.paramProduct.content.sa_salesforecastprojectid,
|
|
|
|
|
|
|
+ "sa_salesforecastprojectid": this.selectProject,
|
|
|
"salesforecast": items
|
|
"salesforecast": items
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
this.tool.showMessage(res,()=>{
|
|
this.tool.showMessage(res,()=>{
|
|
|
this.dialogVisible = false
|
|
this.dialogVisible = false
|
|
|
- this.productData(this.selectProject)
|
|
|
|
|
|
|
+ this.onSuccess()
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
/*删除商品*/
|
|
/*删除商品*/
|
|
@@ -267,8 +376,136 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
this.tool.showMessage(res,()=>{
|
|
this.tool.showMessage(res,()=>{
|
|
|
- this.productData(this.selectProject)
|
|
|
|
|
|
|
+ this.onSuccess()
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ /*批量删除商品*/
|
|
|
|
|
+ async delProducts(){
|
|
|
|
|
+ console.log(this.itemsPro)
|
|
|
|
|
+ let ids = []
|
|
|
|
|
+ ids = this.itemsPro.map(item=>item.sa_salesforecastid)
|
|
|
|
|
+ console.log(ids)
|
|
|
|
|
+ const res = await this.$api.requested({
|
|
|
|
|
+ "id": 20230705145404,
|
|
|
|
|
+ "content": {
|
|
|
|
|
+ "sa_salesforecastbillid":this.$route.query.id,
|
|
|
|
|
+ "sa_salesforecastids":ids
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
|
|
+ this.itemsPro = []
|
|
|
|
|
+ this.productParam.content.pageNumber = 1
|
|
|
|
|
+ this.onSuccess()
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ onSuccess(){
|
|
|
|
|
+ this.projectData()
|
|
|
|
|
+ this.$emit('onSuccess')
|
|
|
|
|
+ },
|
|
|
|
|
+ rowClick(val){
|
|
|
|
|
+ console.log(val)
|
|
|
|
|
+ this.currentRow = val.rowindex -1
|
|
|
|
|
+ this.$refs.projectRef.$refs.table.setCurrentRow(this.list[this.currentRow])
|
|
|
|
|
+ this.selectProject = val.sa_salesforecastprojectid
|
|
|
|
|
+ this.selectProjectid = val.sa_projectid
|
|
|
|
|
+ this.discountrate = val.discountrate * 100
|
|
|
|
|
+ this.projectData()
|
|
|
|
|
+ },
|
|
|
|
|
+ handleSizeChangeProject(val) {
|
|
|
|
|
+ // console.log(`每页 ${val} 条`);
|
|
|
|
|
+ this.projectParam.content.pageSize = val
|
|
|
|
|
+ this.listData()
|
|
|
|
|
+ },
|
|
|
|
|
+ handleCurrentChangeProject(val) {
|
|
|
|
|
+ // console.log(`当前页: ${val}`);
|
|
|
|
|
+ this.projectParam.content.pageNumber = val
|
|
|
|
|
+ this.listData()
|
|
|
|
|
+ },
|
|
|
|
|
+ handleSizeChangeProduct(val) {
|
|
|
|
|
+ // console.log(`每页 ${val} 条`);
|
|
|
|
|
+ this.productParam.content.pageSize = val
|
|
|
|
|
+ this.productData(this.selectProject)
|
|
|
|
|
+ },
|
|
|
|
|
+ handleCurrentChangeProduct(val) {
|
|
|
|
|
+ // console.log(`当前页: ${val}`);
|
|
|
|
|
+ this.productParam.content.pageNumber = val
|
|
|
|
|
+ this.productData(this.selectProject)
|
|
|
|
|
+ },
|
|
|
|
|
+ onChange(val,index,data){
|
|
|
|
|
+ console.log(val,'9999')
|
|
|
|
|
+ if (val < data.orderminqty){
|
|
|
|
|
+ data.orderqty = data.orderminqty.toFixed(2)
|
|
|
|
|
+ }else {
|
|
|
|
|
+ if ((val - data.orderminqty)/data.orderaddqty > 0){
|
|
|
|
|
+ let k = ((val - data.orderminqty)/data.orderaddqty).toFixed(0)
|
|
|
|
|
+ data.orderqty = k * data.orderaddqty + data.orderminqty
|
|
|
|
|
+ }else {
|
|
|
|
|
+ data.orderqty = val.toFixed(2)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ data.orderamount = (data.price * data.orderqty).toFixed(2)
|
|
|
|
|
+ this.$set(this.productList,index,data)
|
|
|
|
|
+ /*this.onChangQty(data,data.orderqty)*/
|
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
|
+ this.onChangeQty(data)
|
|
|
|
|
+ },1000)
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ async onChangeQty(val){
|
|
|
|
|
+ const res = await this.$api.requested({
|
|
|
|
|
+ "id": 20230705145204,
|
|
|
|
|
+ "content": {
|
|
|
|
|
+ "sa_salesforecastbillid": this.$route.query.id,
|
|
|
|
|
+ "sa_salesforecastprojectid": this.selectProject,
|
|
|
|
|
+ "salesforecast": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "itemid": val.itemid,
|
|
|
|
|
+ "orderqty": val.orderqty,
|
|
|
|
|
+ "orderamount":val.price*val.orderqty,
|
|
|
|
|
+ "price": val.price ,
|
|
|
|
|
+ "sa_salesforecastid":val.sa_salesforecastid
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ this.dialogVisible = false
|
|
|
|
|
+ this.onSuccess()
|
|
|
|
|
+ },
|
|
|
|
|
+ priceChange(val,index,data){
|
|
|
|
|
+ console.log(data,'价格')
|
|
|
|
|
+ if(val < 0) {
|
|
|
|
|
+ data.price = 0
|
|
|
|
|
+ }else {
|
|
|
|
|
+ data.price = this.tool.formatAmount(val ,2)
|
|
|
|
|
+ }
|
|
|
|
|
+ data.orderamount = this.tool.formatAmount(data.price * data.orderqty,2)
|
|
|
|
|
+ console.log(data)
|
|
|
|
|
+ this.$set(this.productList,index,data)
|
|
|
|
|
+ /*setTimeout(()=>{*/
|
|
|
|
|
+ this.onChangeQty(data)
|
|
|
|
|
+ /* },1000)*/
|
|
|
|
|
+ },
|
|
|
|
|
+ async discountrateChange(val){
|
|
|
|
|
+ if(val < 0){
|
|
|
|
|
+ this.discountrate = 0
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.discountrate = Math.round(val * 100)/100
|
|
|
|
|
+ }
|
|
|
|
|
+ const res = await this.$api.requested({
|
|
|
|
|
+ "id": 20230705145104,
|
|
|
|
|
+ "content": {
|
|
|
|
|
+ "sa_salesforecastbillid": this.$route.query.id,
|
|
|
|
|
+ "ownertable": "sa_project",
|
|
|
|
|
+ "salesforecastproject": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "sa_salesforecastprojectid": this.selectProject,
|
|
|
|
|
+ "ownerid": this.selectProjectid,
|
|
|
|
|
+ "discountrate": this.discountrate/100
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
|
|
+ this.onSuccess()
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|