123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <template>
- <view>
- <view class="form-card" v-if="viewStatus">
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">规格说明</view>
- <up-input v-model="formData.name" clearable border="none" placeholder="填写本服务内容说明" class="form-input"
- placeholder-class="form-placeholder"></up-input>
- </view>
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">服务价格</view>
- <up-input v-model="formData.name" clearable border="none" placeholder="单次服务的价格" class="form-input"
- placeholder-class="form-placeholder"></up-input>
- </view>
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">购买单位</view>
- <up-input v-model="formData.name" clearable border="none" placeholder="购买单位如次、平方" class="form-input"
- placeholder-class="form-placeholder"></up-input>
- </view>
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">最少购买</view>
- <up-input v-model="formData.name" clearable border="none" placeholder="用户下单最少购买数量" class="form-input"
- placeholder-class="form-placeholder"></up-input>
- </view>
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">服务时长</view>
- <up-input v-model="formData.name" clearable border="none" placeholder="预计单次服务时常" class="form-input"
- placeholder-class="form-placeholder"></up-input>
- </view>
- </view>
- <view class="form-card" v-else>
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">规格说明</view>
- <view class="form-input">{{ formData.name }}</view>
- </view>
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">服务价格</view>
- <view class="form-input">{{ formData.name }}</view>
- </view>
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">购买单位</view>
- <view class="form-input">{{ formData.name }}</view>
- </view>
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">最少购买</view>
- <view class="form-input">{{ formData.name }}</view>
- </view>
- <view class="flex_c_l form-item hr-solid">
- <view class="form-lable">服务时长</view>
- <view class="form-input">{{ formData.name }}</view>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { computed, ref, reactive } from 'vue';
- const status = ref(false);
- import { provide, inject } from 'vue'
- import { sendCode } from '@/api/sm.js';
- const formData = inject('formData');
- const props = defineProps({
- viewStatus: {
- type: Boolean,
- default: true
- },
- form:{
- type: Object,
- default: () => {
- return {
- name: '',
- }
- }
- }
- })
- //年龄校验
- const ageVer = () => {
- return new Promise((resolve, reject) => {
- const isNum = uni.$u.test.digits(formData.age)
- if (!isNum) {
- formData.age = formData.age.replace(/[^0-9.]/g, '');// 移除非数字字符
- reject('请输入数字');
- }
- const value = Number(formData.age);
- if (value < 12) {
- reject('年龄过小');
- }
- resolve();
- })
- }
- // 校验
- const blurInput = async (key) => {
- try {
- const verFun = {
- age: ageVer,
- }
- const res = await verFun[key]();
- console.log("TCL: numberInput -> res", res)
- } catch (error) {
- uni.showToast({
- title: error,
- icon: 'none',
- duration: 1000
- });
- console.log("TCL: numberInput -> error", error)
- }
- }
- </script>
- <style lang="scss" scoped>
- .form-card {
- background: #fff;
- border-radius: 20rpx;
- margin-bottom: 20rpx;
- .form-item {
- padding: 32rpx 0;
- margin-left: 32rpx;
- padding-right: 32rpx;
- .form-lable {
- font-size: 32rpx;
- line-height: 44rpx;
- color: #1D2129;
- margin-right: 48rpx;
- }
- }
- .form-input {
- flex: 1;
- font-family: PingFang SC;
- font-size: 32rpx;
- line-height: 44rpx;
- color: #130F26;
- }
- }
- .code-btn {
- border-radius: 14rpx;
- background: linear-gradient(180deg, #FD8F7C -75%, #FE534B 140%);
- // margin-right: 32rpx;
- font-family: PingFang SC;
- font-size: 26rpx;
- font-weight: normal;
- line-height: 42rpx;
- letter-spacing: normal;
- color: #FFFFFF;
- padding: 13rpx 20rpx;
- }
- </style>
- <style>
- .form-placeholder {
- color: #C9CDD4;
- }
- </style>
|