Commit 25be66d1 authored by 刘文虎's avatar 刘文虎

修复APP新增自定义报价错误

parent 7907c2f6
Pipeline #3516 canceled with stages
......@@ -156,7 +156,7 @@ export default {
}
},
created() {
console.log('-----', this.$slots);
// console.log('-----', this.$slots);
},
destroyed() {},
methods: {
......
......@@ -36,7 +36,7 @@
</view>
</u-form-item>
<u-form-item label="价格" label-position="left" prop="offerMinPrice" required>
<view class="price-view" :class="{ scope: form.offerType === 'scope' }">
<view class="price-view">
<u-input
type="digit"
v-model="form.offerMinPrice"
......@@ -44,7 +44,8 @@
:clearable="false"
input-align="right"
maxlength="11"
class="form-input price-view-input"
class="form-input"
:custom-style="inputCustomStyle"
/>
<view class="price-view-max" v-if="form.offerType === 'scope'">
<text class="price-view-max-line">-</text>
......@@ -55,7 +56,8 @@
:clearable="false"
input-align="right"
maxlength="11"
class="form-input price-view-input"
class="form-input"
:custom-style="inputCustomStyle"
/>
</view>
</view>
......@@ -87,7 +89,7 @@ import PopInput from '@/components/pop-input-view';
import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue';
import { baseUrl } from '@/utils/config.js';
import { priceTypeOptions } from '@/utils/options/bill/quoted-price.js';
import { getOfferPriceInfo, updateOfferPrice, getClassificationList,deleteOfferPrice } from '@/api/bill/quoted-price.js';
import { getOfferPriceInfo, updateOfferPrice, getClassificationList, deleteOfferPrice } from '@/api/bill/quoted-price.js';
export default {
components: { NavbarRight, PopInput, CheckboxGroups, BottomButtons },
......@@ -122,31 +124,33 @@ export default {
},
errorType: ['toast', 'border-bottom'],
rules: {
classificationId: [{ required: true, message: '请选择服务分类', trigger: ['change', 'blur'] }],
offerName: [{ required: true, message: '请输入价格名称', trigger: ['change', 'blur'] }],
offerType: [{ required: true, message: '请选择价格类型', trigger: ['change', 'blur'] }],
classificationId: [{ required: true, message: '请选择服务分类', trigger: ['blur'] }],
offerName: [{ required: true, message: '请输入价格名称', trigger: ['blur'] }],
offerType: [{ required: true, message: '请选择价格类型', trigger: ['blur'] }],
offerMinPrice: [
{ required: true, message: '请输入价格', trigger: ['blur'] },
{
required: true,
// 自定义验证函数,见上说明
asyncValidator: (rule, value, callback) => {
// 上面有说,返回true表示校验通过,返回false表示不通过
// this.$u.test.mobile()就是返回true或者false的
console.log("asyncValidator")
if(this.form.offerType==='scope'){
if(!value){
callback(new Error('请输入完整价格'))
}else if(this.form.offerMaxPrice<=value){
callback(new Error('最高价格不能低于最低价格'))
}else{
callback()
if (this.form.offerType === 'scope') {
if (!value) {
callback(new Error('请输入完整价格'));
} else if (!this.form.offerMaxPrice) {
callback(new Error('请输入完整价格'));
} else if (parseFloat(this.form.offerMaxPrice) < parseFloat(value)) {
callback(new Error('最高价格不能低于最低价格'));
} else {
callback();
}
}else{
callback()
} else {
callback();
}
},
// 触发器可以同时用blur和change
trigger: ['change', 'blur']
trigger: ['blur']
}
]
},
......@@ -154,6 +158,19 @@ export default {
};
},
computed: {
inputCustomStyle() {
let style = {
'font-size': '28rpx'
};
let style1 = {
'font-size': '28rpx',
width: '156rpx',
padding: '0 24rpx',
'background-color': '#f6f7fa',
'border-radius': '16rpx'
};
return this.form.offerType === 'scope' ? style1 : style;
},
disabled() {
let flag = !this.form.classificationId || !this.form.offerName || !this.form.offerType || !this.form.offerMinPrice;
if (this.form.offerType === 'scope') {
......@@ -219,8 +236,7 @@ export default {
this.loading = true;
this.$refs.uForm.validate(valid => {
if (valid) {
let { createdTime, time } = this.form;
this.form.startTime = createdTime + ' ' + time + ':00';
console.log('验证成功');
this.save();
} else {
this.loading = false;
......@@ -232,7 +248,10 @@ export default {
let title = this.form.id ? '修改' : '新增';
try {
let { data } = await updateOfferPrice({ ...this.form, templateId: this.templateId });
let { data } = await updateOfferPrice({
...this.form,
templateId: this.templateId
});
this.$refs.uToast.show({
title: title + '成功',
type: 'success',
......@@ -355,6 +374,13 @@ export default {
}
.form-input {
font-weight: bold;
font-size: 28rpx;
}
.price-view-input {
width: 156rpx;
background-color: #f6f7fa;
padding: 0 24rpx;
border-radius: 16rpx;
}
.price-view {
width: 100%;
......@@ -365,19 +391,13 @@ export default {
&-max {
display: flex;
align-items: center;
flex-shrink: 0;
width: 270rpx;
&-line {
margin: 0 24rpx;
}
}
}
.scope {
.price-view-input {
width: 156rpx;
background-color: #f6f7fa;
padding: 0 24rpx;
border-radius: 16rpx;
}
}
}
.submit {
width: 100%;
......
......@@ -45,11 +45,10 @@
<view class="collapse-body-bottom">
<text class="collapse-body-bottom-price">
<text>¥</text>
<text>{{ item2.offerMinPrice }}</text>
<text v-if="item2.offerType === 'scope'">
<text>-</text>
<text>{{ item2.offerMaxPrice }}</text>
{{item2.customPrice||0 }}
</text>
<text v-else>{{item2.offerMinPrice}}</text>
</text>
<view class="collapse-body-bottom-add">
<zb-tooltip placement="top-end" ref="tooltip1" color="#7f7f7f" :visible="!quotedPriceTooltip">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment