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

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

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