|
@@ -6,51 +6,37 @@
|
|
:maskClosable="false"
|
|
:maskClosable="false"
|
|
title="自定义报价"
|
|
title="自定义报价"
|
|
v-model="isShow"
|
|
v-model="isShow"
|
|
- @cancel="isShow=false"
|
|
|
|
|
|
+ @cancel="isShow = false"
|
|
:width="800">
|
|
:width="800">
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
- <!-- 表单 -->
|
|
|
|
- <div v-if="!isView">
|
|
|
|
- <a-form-model
|
|
|
|
- id="editPrice-form"
|
|
|
|
- ref="ruleForm"
|
|
|
|
- :model="form"
|
|
|
|
- :rules="rules"
|
|
|
|
- :label-col="formItemLayout.labelCol"
|
|
|
|
- :wrapper-col="formItemLayout.wrapperCol"
|
|
|
|
- >
|
|
|
|
- <a-form-model-item label="产品编码" prop="terminalPrice">
|
|
|
|
- <div>{{ form.terminalPrice }}</div>
|
|
|
|
- </a-form-model-item>
|
|
|
|
- <a-form-model-item label="产品名称" prop="terminalPrice">
|
|
|
|
- <div>{{ form.terminalPrice }}</div>
|
|
|
|
- </a-form-model-item>
|
|
|
|
- <a-form-model-item label="终端建议价" prop="terminalPrice">
|
|
|
|
- <div>{{ form.terminalPrice }}</div>
|
|
|
|
- </a-form-model-item>
|
|
|
|
- <a-form-model-item label="自定义终端价">
|
|
|
|
- <a-input
|
|
|
|
- id="editPrice-idCard"
|
|
|
|
- :maxLength="18"
|
|
|
|
- v-model.trim="form.terminalPriceZdy"
|
|
|
|
- placeholder="请输入自定义终端价"
|
|
|
|
- allowClear />
|
|
|
|
- </a-form-model-item>
|
|
|
|
- <a-form-model-item label="车主建议价" prop="terminalPrice">
|
|
|
|
- <div>{{ form.carOwnersPrice }}</div>
|
|
|
|
- </a-form-model-item>
|
|
|
|
- <a-form-model-item label="自定义车主价" prop="mobile">
|
|
|
|
- <a-input
|
|
|
|
- id="editPrice-mobile"
|
|
|
|
- v-model.trim="form.mobile"
|
|
|
|
- placeholder="请输入自定义车主价"
|
|
|
|
- allowClear />
|
|
|
|
- </a-form-model-item>
|
|
|
|
- </a-form-model>
|
|
|
|
- <div class="btn-cont">
|
|
|
|
- <a-button type="primary" size="large" id="editPrice-btn-submit" @click="handleSubmit">保存</a-button>
|
|
|
|
- <a-button id="editPrice-btn-back" size="large" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <a-form-model
|
|
|
|
+ id="editPrice-form"
|
|
|
|
+ ref="ruleForm"
|
|
|
|
+ :model="form"
|
|
|
|
+ :label-col="formItemLayout.labelCol"
|
|
|
|
+ :wrapper-col="formItemLayout.wrapperCol">
|
|
|
|
+ <a-form-model-item label="产品编码" prop="code">
|
|
|
|
+ <div>{{ form.code }}</div>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="产品名称" prop="name">
|
|
|
|
+ <div>{{ form.name }}</div>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="终端价" prop="terminalPrice">
|
|
|
|
+ <div>{{ form.terminalPrice?form.terminalPrice : '--' }}</div>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="自定义终端价" prop="dealerProductPrice.terminalPrice">
|
|
|
|
+ <a-input id="editPrice-terminalPriceZdy" :maxLength="18" v-model.trim="form.dealerProductPrice.terminalPrice" placeholder="请输入自定义终端价" allowClear />
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="车主价" prop="carOwnersPrice">
|
|
|
|
+ <div>{{ form.carOwnersPrice?form.carOwnersPrice:'--' }}</div>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="自定义车主价" prop="dealerProductPrice.carOwnersPrice">
|
|
|
|
+ <a-input id="editPrice-carOwnersPriceZdy" v-model.trim="form.dealerProductPrice.carOwnersPrice" placeholder="请输入自定义车主价" allowClear />
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-form-model>
|
|
|
|
+ <div class="btn-cont">
|
|
|
|
+ <a-button type="primary" size="large" id="editPrice-btn-submit" @click="handleSubmit">保存</a-button>
|
|
|
|
+ <a-button id="editPrice-btn-back" size="large" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
|
|
</div>
|
|
</div>
|
|
</a-spin>
|
|
</a-spin>
|
|
</a-modal>
|
|
</a-modal>
|
|
@@ -58,27 +44,19 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { commonMixin } from '@/utils/mixin'
|
|
import { commonMixin } from '@/utils/mixin'
|
|
-import { employeeSave, employeeDetail } from '@/api/salesman'
|
|
|
|
-import moment from 'moment'
|
|
|
|
|
|
+import { productDetail, settingPrice } from '@/api/product.js'
|
|
export default {
|
|
export default {
|
|
name: 'EditPriceModal',
|
|
name: 'EditPriceModal',
|
|
mixins: [commonMixin],
|
|
mixins: [commonMixin],
|
|
props: {
|
|
props: {
|
|
- openModal: { // 弹框显示状态
|
|
|
|
|
|
+ openModal: {
|
|
|
|
+ // 弹框显示状态
|
|
type: Boolean,
|
|
type: Boolean,
|
|
default: false
|
|
default: false
|
|
},
|
|
},
|
|
itemId: {
|
|
itemId: {
|
|
type: [Number, String],
|
|
type: [Number, String],
|
|
default: ''
|
|
default: ''
|
|
- },
|
|
|
|
- modalTitle: {
|
|
|
|
- type: String,
|
|
|
|
- default: ''
|
|
|
|
- },
|
|
|
|
- isState: { // 是否显示状态
|
|
|
|
- type: Boolean,
|
|
|
|
- default: true
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
@@ -89,98 +67,57 @@ export default {
|
|
labelCol: { span: 6 },
|
|
labelCol: { span: 6 },
|
|
wrapperCol: { span: 16 }
|
|
wrapperCol: { span: 16 }
|
|
},
|
|
},
|
|
- isView: false, // 是否查看详情
|
|
|
|
form: {
|
|
form: {
|
|
|
|
+ code: '',
|
|
|
|
+ name: '',
|
|
terminalPrice: '', // 终端建议价
|
|
terminalPrice: '', // 终端建议价
|
|
- terminalPriceZdy: '', // 自定义终端价
|
|
|
|
carOwnersPrice: '', // 车主建议价
|
|
carOwnersPrice: '', // 车主建议价
|
|
- carOwnersPriceZdy: '' // 自定义车主价
|
|
|
|
- },
|
|
|
|
- rules: {
|
|
|
|
- name: [
|
|
|
|
- { required: true, message: '请输入姓名', trigger: 'blur' }, { pattern: '^[^<|>]{1,30}$', message: '请输入不含<或>的字符,最多30个字符' }
|
|
|
|
- ],
|
|
|
|
- mobile: [
|
|
|
|
- { required: true, message: '请输入手机号码', trigger: 'blur' }, { pattern: /^\d{11}$/, message: '请输入正确的手机号码!' }
|
|
|
|
- ],
|
|
|
|
- entryDate: [
|
|
|
|
- { required: true, message: '请选择入职时间', trigger: 'change' }
|
|
|
|
-
|
|
|
|
- ],
|
|
|
|
- sex: [
|
|
|
|
- { required: true, message: '请选择性别', trigger: 'change' }
|
|
|
|
- ],
|
|
|
|
- enableFlag: [
|
|
|
|
- { required: true, message: '请选择状态', trigger: 'change' }
|
|
|
|
- ]
|
|
|
|
|
|
+ dealerProductPrice: {
|
|
|
|
+ terminalPrice: '',
|
|
|
|
+ carOwnersPrice: ''
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- // 时间 change
|
|
|
|
- dateChange (date) {
|
|
|
|
- this.queryParam.beginDate = date[0]
|
|
|
|
- this.queryParam.endDate = date[1]
|
|
|
|
- },
|
|
|
|
- // 不可选日期
|
|
|
|
- disabledDate (current) {
|
|
|
|
- return current && current > moment().endOf('day')
|
|
|
|
- },
|
|
|
|
- filterEmpty () {
|
|
|
|
- let str = this.form.supplierName
|
|
|
|
- str = str.replace(/\ +/g, '')
|
|
|
|
- str = str.replace(/[ ]/g, '')
|
|
|
|
- str = str.replace(/[\r\n]/g, '')
|
|
|
|
- this.form.supplierName = str
|
|
|
|
- },
|
|
|
|
// 详情
|
|
// 详情
|
|
getDetail () {
|
|
getDetail () {
|
|
- employeeDetail({ id: this.itemId }).then(res => {
|
|
|
|
|
|
+ const _this = this
|
|
|
|
+ productDetail({ sn: this.itemId }).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
- this.form = Object.assign(this.form, res.data)
|
|
|
|
- this.form.sex = Number(this.form.sex)
|
|
|
|
- this.form.enableFlag = Number(this.form.enableFlag)
|
|
|
|
|
|
+ const objInfo = {}
|
|
|
|
+ objInfo.code = res.data.code
|
|
|
|
+ objInfo.name = res.data.name
|
|
|
|
+ objInfo.terminalPrice = (res.data.terminalPrice || res.data.terminalPrice == 0) ? _this.toThousands(res.data.terminalPrice) : ''
|
|
|
|
+ objInfo.carOwnersPrice = (res.data.carOwnersPrice || res.data.carOwnersPrice == 0) ? _this.toThousands(res.data.carOwnersPrice) : ''
|
|
|
|
+ objInfo.dealerProductPrice = {}
|
|
|
|
+ Object.assign(objInfo.dealerProductPrice, { terminalPrice: res.data.dealerProductPrice && res.data.dealerProductPrice.terminalPrice || '', carOwnersPrice: res.data.dealerProductPrice && res.data.dealerProductPrice.carOwnersPrice || '' })
|
|
|
|
+ _this.form = objInfo
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ },
|
|
|
|
+ cancel () {
|
|
|
|
+
|
|
},
|
|
},
|
|
// 保存
|
|
// 保存
|
|
handleSubmit (e) {
|
|
handleSubmit (e) {
|
|
e.preventDefault()
|
|
e.preventDefault()
|
|
const _this = this
|
|
const _this = this
|
|
- this.$refs.ruleForm.validate(valid => {
|
|
|
|
- if (valid) {
|
|
|
|
- const form = _this.form
|
|
|
|
- form.entryDate = moment(form.entryDate).format('YYYY-MM-DD')
|
|
|
|
- form.id = this.itemId ? this.itemId : null
|
|
|
|
- _this.spinning = true
|
|
|
|
- employeeSave(form).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- _this.$message.success(res.message)
|
|
|
|
- _this.$emit('ok')
|
|
|
|
- _this.isShow = false
|
|
|
|
- _this.spinning = false
|
|
|
|
- } else {
|
|
|
|
- _this.spinning = false
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ _this.spinning = true
|
|
|
|
+ const ajaxData = {}
|
|
|
|
+ ajaxData.productSn = this.itemId
|
|
|
|
+ ajaxData.dealerProductPrice = {}
|
|
|
|
+ Object.assign(ajaxData.dealerProductPrice, this.form.dealerProductPrice)
|
|
|
|
+ settingPrice(ajaxData).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.$emit('ok')
|
|
|
|
+ _this.isShow = false
|
|
|
|
+ _this.spinning = false
|
|
} else {
|
|
} else {
|
|
- console.log('error submit!!')
|
|
|
|
- return false
|
|
|
|
|
|
+ _this.spinning = false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- },
|
|
|
|
- cancel () {
|
|
|
|
- this.form = {
|
|
|
|
- name: '', // 姓名
|
|
|
|
- mobile: '', // 联系电话
|
|
|
|
- enableFlag: 1, // 启禁用
|
|
|
|
- sex: 1, // 性别
|
|
|
|
- idCard: '', // 身份证号
|
|
|
|
- entryDate: undefined // 入职时间
|
|
|
|
- }
|
|
|
|
- // this.$nextTick(() => {
|
|
|
|
- // this.$refs.ruleForm.resetFields()
|
|
|
|
- // })
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -193,36 +130,22 @@ export default {
|
|
isShow (newValue, oldValue) {
|
|
isShow (newValue, oldValue) {
|
|
if (!newValue) {
|
|
if (!newValue) {
|
|
this.$emit('close')
|
|
this.$emit('close')
|
|
- }
|
|
|
|
- },
|
|
|
|
- itemId (newValue, oldValue) {
|
|
|
|
- if (this.isShow && newValue) {
|
|
|
|
|
|
+ } else {
|
|
this.getDetail()
|
|
this.getDetail()
|
|
}
|
|
}
|
|
- },
|
|
|
|
- modalTitle (newValue, oldValue) {
|
|
|
|
- console.log(newValue)
|
|
|
|
- if (newValue) {
|
|
|
|
- if (newValue == '编辑' || newValue == '新增') {
|
|
|
|
- this.isView = false
|
|
|
|
- } else {
|
|
|
|
- this.isView = true
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|
|
<style lang="less">
|
|
- .editPrice-modal{
|
|
|
|
- .ant-modal-body {
|
|
|
|
- padding: 40px 40px 24px;
|
|
|
|
- }
|
|
|
|
- .btn-cont {
|
|
|
|
- text-align: center;
|
|
|
|
- margin: 35px 0 10px;
|
|
|
|
- }
|
|
|
|
|
|
+.editPrice-modal {
|
|
|
|
+ .ant-modal-body {
|
|
|
|
+ padding: 40px 40px 24px;
|
|
|
|
+ }
|
|
|
|
+ .btn-cont {
|
|
|
|
+ text-align: center;
|
|
|
|
+ margin: 35px 0 10px;
|
|
}
|
|
}
|
|
|
|
+}
|
|
</style>
|
|
</style>
|