|
@@ -19,13 +19,13 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="padding-left: 20px">
|
|
|
<el-form-item label="客户名称" prop="customerId">
|
|
|
- <el-input v-if="display" v-model="dataForm.customerId" disabled></el-input>
|
|
|
+ <el-input v-if="display" v-model="dataForm.customerName" disabled></el-input>
|
|
|
<el-select v-else
|
|
|
v-model="dataForm.customerId"
|
|
|
:disabled="display"
|
|
|
- filterable
|
|
|
+ filterable
|
|
|
remote
|
|
|
- :remote-method="remoteCusList"
|
|
|
+ :remote-method="remoteCusList"
|
|
|
placeholder="请选择">
|
|
|
<el-option
|
|
|
v-for="item in optionsCus"
|
|
@@ -39,13 +39,13 @@
|
|
|
</el-row>
|
|
|
<el-row class="my-row">
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="业务员" prop="source">
|
|
|
- <el-input v-if="display" v-model="dataForm.salesmanId" disabled></el-input>
|
|
|
- <user-component v-else v-model="dataForm.salesmanId"></user-component>
|
|
|
+ <el-form-item label="业务员" prop="salesmanId">
|
|
|
+ <el-input v-if="display" v-model="dataForm.salesmanName" disabled></el-input>
|
|
|
+ <user-component v-else v-model="dataForm.salesmanId" :user-id="dataForm.salesmanId"></user-component>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="合同交期" prop="techId">
|
|
|
+ <el-form-item label="合同交期" prop="contactDate">
|
|
|
<el-input v-if="display" v-model="dataForm.contactDate" disabled></el-input>
|
|
|
<el-date-picker v-else
|
|
|
v-model="dataForm.contactDate"
|
|
@@ -104,30 +104,47 @@
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="数量">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number v-model="scope.row.cnt" :disabled="display" :min="1" style="width: 140px;"/>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="unitName"
|
|
|
+ prop="productNumber"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="订单编号">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.productNumber" :disabled="display" :min="1" style="width: 140px;"/>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="unitName"
|
|
|
+ prop="price"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="含税单价">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number v-model="scope.row.price" :disabled="display" :precision="2" :step="0.1" :min="0" style="width: 140px;"/>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="unitName"
|
|
|
+ prop="amount"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="含税总价">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ (scope.row.cnt*scope.row.price).toFixed(2) }}</span>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="unitName"
|
|
|
+ prop="rate"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="税率">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="number" v-model="scope.row.rateVal" :disabled="display">
|
|
|
+ <template slot="append">%</template>
|
|
|
+ </el-input>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="notes"
|
|
@@ -160,6 +177,7 @@
|
|
|
import { uploadUrl, downloadUrl, uploadFiles } from '@/api/file'
|
|
|
import { getCusList } from '@/api/cus'
|
|
|
import UserComponent from '../common/user-component'
|
|
|
+ import {toNumber, toPercent} from '@/utils/common'
|
|
|
|
|
|
export default {
|
|
|
name: 'order-add-or-update',
|
|
@@ -188,14 +206,16 @@
|
|
|
cusOrderCode: [{ required: true, message: '客户订单编码不能为空', trigger: 'blur' }],
|
|
|
customerId: [{ required: true, message: '客户名称不能为空', trigger: 'change' }],
|
|
|
salesmanId: [{ required: true, message: '业务员不能为空', trigger: 'change' }],
|
|
|
- attachList: [{ required: true, message: '合同扫描附件不能为空', trigger: 'blur' }]
|
|
|
+ contactDate: [{ required: true, message: '合同交期不能为空', trigger: 'change' }]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
async init (id, display) {
|
|
|
this.fileList = []
|
|
|
- this.dataForm = {}
|
|
|
+ this.dataForm = {
|
|
|
+ rateVal: 0
|
|
|
+ }
|
|
|
this.productDetails = []
|
|
|
this.visible = true
|
|
|
this.id = id || 0
|
|
@@ -205,48 +225,38 @@
|
|
|
if (data && data.code === '200') {
|
|
|
this.dataForm = data.data
|
|
|
console.log('data = ' + JSON.stringify(data.data))
|
|
|
- // // 组合小产品
|
|
|
- // data.data.composeProductMaterialList.forEach((item) => {
|
|
|
- // this.productDetails.push(item)
|
|
|
- // })
|
|
|
- // // 产品配料清单
|
|
|
- // data.data.productMaterialList.forEach((item) => {
|
|
|
- // this.materialList.push(item)
|
|
|
- // })
|
|
|
- // // 产品来源
|
|
|
- // if (data.data.source) {
|
|
|
- // this.optionsSource = [{
|
|
|
- // code: data.data.source,
|
|
|
- // value: data.data.sourceName
|
|
|
- // }]
|
|
|
- // }
|
|
|
- // // 产品工艺
|
|
|
- // if (data.data.techId) {
|
|
|
- // this.optionsTech = [{
|
|
|
- // code: data.data.techId,
|
|
|
- // value: data.data.techName
|
|
|
- // }]
|
|
|
- // }
|
|
|
- // // 产品图纸
|
|
|
- // if (data.data.proDrawings) {
|
|
|
- // this.dataForm.drawingIdList = []
|
|
|
- // data.data.proDrawings.forEach((item) => {
|
|
|
- // if (item.attachList) {
|
|
|
- // item.attachList.forEach((item1) => {
|
|
|
- // this.fileList.push({
|
|
|
- // name: item1.fileName,
|
|
|
- // url: item1.url,
|
|
|
- // id: item1.url
|
|
|
- // })
|
|
|
- // })
|
|
|
- // }
|
|
|
- // this.optionsDraw.push({
|
|
|
- // code: item.drawingId,
|
|
|
- // value: item.drawingName
|
|
|
- // })
|
|
|
- // this.dataForm.drawingIdList.push(item.drawingId)
|
|
|
- // })
|
|
|
- // }
|
|
|
+ // 附件
|
|
|
+ if (data.data.attachList) {
|
|
|
+ data.data.attachList.forEach((item) => {
|
|
|
+ this.fileList.push({
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.url,
|
|
|
+ id: item.url
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 订单产品明细
|
|
|
+ if (data.data.saleROrderProductList) {
|
|
|
+ data.data.saleROrderProductList.forEach((item) => {
|
|
|
+ this.productDetails.push({
|
|
|
+ id: item.id,
|
|
|
+ productId: item.productId,
|
|
|
+ productName: item.productName,
|
|
|
+ notes: item.notes,
|
|
|
+ cnt: item.cnt,
|
|
|
+ price: item.price,
|
|
|
+ productNumber: item.productNumber,
|
|
|
+ rateVal: toPercent(item.rate)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 编辑
|
|
|
+ if (!display) {
|
|
|
+ this.optionsCus.push({
|
|
|
+ code: data.data.customerId,
|
|
|
+ value: data.data.customerName
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -316,10 +326,10 @@
|
|
|
this.productDetails.push({
|
|
|
productId: item.productId,
|
|
|
productName: item.productName,
|
|
|
- productSpec: item.productSpec,
|
|
|
+ notes: item.notes,
|
|
|
cnt: 1,
|
|
|
- unitName: item.unitName,
|
|
|
- notes: item.notes
|
|
|
+ price: 0,
|
|
|
+ rate: 0
|
|
|
})
|
|
|
},
|
|
|
addMaterial () {
|
|
@@ -346,10 +356,27 @@
|
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
// 合同扫描件
|
|
|
+ let fList = this.fileList
|
|
|
+ if (fList.length > 0) {
|
|
|
+ this.dataForm.attachList = []
|
|
|
+ for (let i = 0; i < fList.length; i++) {
|
|
|
+ this.dataForm.attachList.push({
|
|
|
+ fileName: fList[i].name,
|
|
|
+ url: fList[i].url
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
// 订单产品明细
|
|
|
- // this.dataForm.composeProductMaterialList = []
|
|
|
+ let pList = this.productDetails
|
|
|
+ if (pList.length > 0) {
|
|
|
+ this.dataForm.saleROrderProductParamsList = pList
|
|
|
+ // rate百分比转换
|
|
|
+ this.dataForm.saleROrderProductParamsList.forEach((item) => {
|
|
|
+ item.rate = toNumber(item.rateVal)
|
|
|
+ })
|
|
|
+ }
|
|
|
this.$http({
|
|
|
- url: this.$http.adornUrl(`/biz-service/product/save`),
|
|
|
+ url: this.$http.adornUrl(`/biz-service/order/save`),
|
|
|
method: 'post',
|
|
|
data: this.$http.adornData({...this.dataForm, orgId: this.orgId})
|
|
|
}).then(({data}) => {
|