|
|
@@ -19,19 +19,23 @@
|
|
|
<span>
|
|
|
<i>*</i>型号:
|
|
|
</span>
|
|
|
- <input type="text" class="form-control" v-model="applyObj.code" maxlength="30" @blur="checkCode" required />
|
|
|
+ <input type="text" class="form-control" :class="{'error': !validObj.code}" v-model="applyObj.code" maxlength="30" @blur="checkCode" />
|
|
|
</div>
|
|
|
<div class="form-item">
|
|
|
<span>
|
|
|
<i>*</i>品牌:
|
|
|
</span>
|
|
|
- <input type="text" class="form-control" maxlength="20" v-model="applyObj.brand" required />
|
|
|
+ <input type="text" class="form-control" :class="{'error': !validObj.brand}" maxlength="20" v-model="applyObj.brand" @blur="checkBrand" />
|
|
|
</div>
|
|
|
<div class="form-item">
|
|
|
<span>
|
|
|
单价预算:
|
|
|
</span>
|
|
|
- <input type="text" class="form-control" v-model="applyObj.unitPrice" />
|
|
|
+ <select v-model="applyObj.currency">
|
|
|
+ <option value="RMB">¥</option>
|
|
|
+ <option value="USD">$</option>
|
|
|
+ </select>
|
|
|
+ <input type="number" class="form-control" :class="{'error': !validObj.unitPrice}" v-model="applyObj.unitPrice" @blur="checkUnitPrice" @input="onUnitPriceInput" />
|
|
|
</div>
|
|
|
<div class="form-item">
|
|
|
<span>
|
|
|
@@ -49,13 +53,19 @@
|
|
|
<span>
|
|
|
采购数量:
|
|
|
</span>
|
|
|
- <input type="text" class="form-control" v-model="applyObj.amount" />
|
|
|
+ <input type="number" class="form-control" :class="{'error': !validObj.amount}" v-model="applyObj.amount" @blur="checkAmount" @input="onAmountInput" />
|
|
|
</div>
|
|
|
<div class="form-item">
|
|
|
<span>
|
|
|
<i>*</i>截止日期:
|
|
|
</span>
|
|
|
- <input type="text" class="form-control" v-model="applyObj.deadline" required />
|
|
|
+ <!--<input type="text" class="form-control" readonly :class="{'error': !validObj.deadline}" v-model="applyObj.deadline" @blur="checkDeadline" />-->
|
|
|
+ <el-date-picker
|
|
|
+ v-model="applyObj.deadline"
|
|
|
+ type="date"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ size="mini">
|
|
|
+ </el-date-picker>
|
|
|
</div>
|
|
|
</div>
|
|
|
<a @click="goPublish()">发布求购</a>
|
|
|
@@ -99,6 +109,7 @@
|
|
|
code: '',
|
|
|
brand: '',
|
|
|
unitPrice: '',
|
|
|
+ currency: 'RMB',
|
|
|
encapsulation: '',
|
|
|
produceDate: '',
|
|
|
amount: '',
|
|
|
@@ -108,10 +119,16 @@
|
|
|
code: true,
|
|
|
brand: true,
|
|
|
unitPrice: true,
|
|
|
- encapsulation: true,
|
|
|
- produceDate: true,
|
|
|
- amount: true,
|
|
|
- deadline: true
|
|
|
+// encapsulation: true,
|
|
|
+// produceDate: true,
|
|
|
+ amount: true
|
|
|
+// deadline: true
|
|
|
+ },
|
|
|
+ pickerOptions: {
|
|
|
+ disabledDate (time) {
|
|
|
+ // 大于等于今天 小于三个月后
|
|
|
+ return time.getTime() < Date.now() - 1000 * 60 * 60 * 24 || time.getTime() > Date.now() + 1000 * 60 * 60 * 24 * 30 * 3
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -124,15 +141,57 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ emptyForm: function () {
|
|
|
+ for (let attr in this.applyObj) {
|
|
|
+ this.applyObj[attr] = attr === 'currency' ? 'RMB' : ''
|
|
|
+ }
|
|
|
+ },
|
|
|
getRankBg: function (index) {
|
|
|
return index === 0 ? 1 : index < 3 ? 2 : 3
|
|
|
},
|
|
|
goPublish: function () {
|
|
|
-// console.log(this)
|
|
|
-// let obj = this.applyObj
|
|
|
this.$store.dispatch('applyPurchase/publishPurchaseApply', this.applyObj)
|
|
|
+// this.emptyForm()
|
|
|
},
|
|
|
checkCode: function () {
|
|
|
+ this.validObj.code = this.applyObj.code && this.applyObj.code !== ''
|
|
|
+ },
|
|
|
+ checkBrand: function () {
|
|
|
+ this.validObj.brand = this.applyObj.brand && this.applyObj.brand !== ''
|
|
|
+ },
|
|
|
+// code: true,
|
|
|
+// brand: true,
|
|
|
+// unitPrice: true,
|
|
|
+// encapsulation: true,
|
|
|
+// produceDate: true,
|
|
|
+// amount: true,
|
|
|
+// deadline: true
|
|
|
+ checkUnitPrice: function () {
|
|
|
+ this.validObj.unitPrice = this.applyObj.unitPrice === '' ? true : this.applyObj.unitPrice > 0 && this.applyObj.unitPrice < 100000000
|
|
|
+ },
|
|
|
+// checkEncapsulation: function () {
|
|
|
+// this.validObj.encapsulation = this.applyObj.encapsulation && this.applyObj.encapsulation !== ''
|
|
|
+// },
|
|
|
+// checkProduceDate: function () {
|
|
|
+// this.validObj.produceDate = this.applyObj.produceDate && this.applyObj.produceDate !== ''
|
|
|
+// },
|
|
|
+ checkAmount: function () {
|
|
|
+ this.validObj.amount = this.applyObj.amount === '' ? true : this.applyObj.amount > 0 && this.applyObj.amount < 100000000
|
|
|
+ },
|
|
|
+// checkDeadline: function () {
|
|
|
+// this.validObj.deadline = this.applyObj.deadline && this.applyObj.deadline !== ''
|
|
|
+// },
|
|
|
+ onUnitPriceInput: function () {
|
|
|
+ if (this.applyObj.unitPrice < 0) {
|
|
|
+ this.applyObj.unitPrice = 0
|
|
|
+ } else if (this.applyObj.unitPrice.toString().indexOf('.') !== -1 && this.applyObj.unitPrice.toString().split('.')[1].length > 6) {
|
|
|
+ this.applyObj.unitPrice = Number(this.applyObj.unitPrice).toFixed(6)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onAmountInput: function () {
|
|
|
+ if (this.applyObj.amount < 0) {
|
|
|
+ this.applyObj.amount = 0
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -210,12 +269,42 @@
|
|
|
color: #e41515;
|
|
|
}
|
|
|
}
|
|
|
+ select {
|
|
|
+ width: 32px;
|
|
|
+ position: absolute;
|
|
|
+ height: 20px;
|
|
|
+ background: url('/images/applyPurchase/select.png')no-repeat right;
|
|
|
+ appearance:none;
|
|
|
+ -moz-appearance:none;
|
|
|
+ -webkit-appearance:none;
|
|
|
+ -ms-appearance:none;
|
|
|
+ & + input {
|
|
|
+ padding-left: 34px;
|
|
|
+ }
|
|
|
+ }
|
|
|
input {
|
|
|
width: 111px;
|
|
|
height: 20px;
|
|
|
line-height: 20px;
|
|
|
border-radius: 2px;
|
|
|
padding: 0 3px;
|
|
|
+ box-shadow: none;
|
|
|
+ -webkit-box-shadow: none;
|
|
|
+ -moz-box-shadow: none;
|
|
|
+ &.error {
|
|
|
+ border-color: #f4645f!important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-date-editor--date{
|
|
|
+ width: 110px;
|
|
|
+ .el-icon-date {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ .el-input__inner {
|
|
|
+ height: 20px;
|
|
|
+ border-radius: 0;
|
|
|
+ border: 1px solid #c9c9c9 !important;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|