flying-monkey/pages/appreciationServe/appreciationServe.vue

407 lines
13 KiB
Vue
Raw Normal View History

2022-03-22 03:38:06 +00:00
<template>
<view class="content">
2022-03-28 07:33:10 +00:00
<statusNav returnColor="#c2c2c2" navBarTitle="增值服务"></statusNav>
2022-03-25 09:18:08 +00:00
<container-subgroup-two>
2022-04-01 10:16:43 +00:00
<view slot="content" style="margin: -20rpx -30rpx 0;">
2022-03-25 09:18:08 +00:00
<view class="select-type">
<view class="text">选择类型</view>
<view class="type">
<view class="li" @click="typeIndexFun(index)" :class="index==typeIndex?'on':''"
v-for="(item,index) in typeData">
2022-04-06 08:07:18 +00:00
{{item.name}}
2022-03-25 09:18:08 +00:00
</view>
</view>
2022-03-22 03:38:06 +00:00
</view>
2022-03-25 09:18:08 +00:00
<view class="appreciationServe-from">
<view class="li">
<view class="title">
<text class="cor">*</text>产品名称
</view>
2022-04-06 08:07:18 +00:00
<input class="input" v-model="data.title" type="text" placeholder="请填写产品名称" />
2022-03-25 09:18:08 +00:00
</view>
<view class="li">
<view class="title">
<text class="cor">*</text>规格型号
</view>
2022-04-06 08:07:18 +00:00
<input class="input" type="text" v-model="data.model" placeholder="请填写产品规格型号" />
2022-03-25 09:18:08 +00:00
</view>
<view class="li">
<view class="title">产品品牌</view>
2022-04-06 08:07:18 +00:00
<input class="input" type="text" v-model="data.brand" value="" placeholder="请输入品牌" />
2022-03-25 09:18:08 +00:00
</view>
<view class="li">
2022-04-13 12:36:32 +00:00
<view class="title flexs">
2022-03-25 09:18:08 +00:00
<text class="cor">*</text>产品尺寸
</view>
2022-04-13 12:36:32 +00:00
<view class="disac fon26">
<view class="disac">
<input class="input" style="width: 100rpx;" type="digit" v-model="data.width" placeholder="38.5" />
</view>
<view class="mar-y40 mar-z10">x</view>
<view class="disac">
<input class="input" style="width: 100%;" type="digit" v-model="data.height" placeholder="14.5" />
</view>
</view>
2022-03-25 09:18:08 +00:00
</view>
2022-03-22 03:38:06 +00:00
</view>
2022-03-25 09:18:08 +00:00
<view class="supplementTitle">补充信息</view>
<view class="supplement-from">
<view class="li">
<view class="title">
<text class="cor">*</text>联系人
</view>
2022-04-06 08:07:18 +00:00
<input type="text" class="input" v-model="data.contact_name" placeholder="请填写联系人名称" />
2022-03-25 09:18:08 +00:00
</view>
<view class="li">
<view class="">
<text class="cor">*</text>联系电话
</view>
2022-04-06 08:07:18 +00:00
<input type="text" v-model="data.contact_phone" class="input" placeholder="请填写联系电话" />
2022-03-25 09:18:08 +00:00
</view>
<view class="li">
<view class="">
<text class="cor">*</text>预约时间
</view>
2022-04-06 08:07:18 +00:00
<input type="text" v-model="data.appointment_time" class="input" @tap="openDatetimePicker"
placeholder="请选择预约时间" />
2022-03-25 09:18:08 +00:00
</view>
2022-04-06 08:07:18 +00:00
<yy-mm-dd-hh-ss ref="myPicker" @submit="handleSubmit" :start-year="2022" :end-year="2122">
</yy-mm-dd-hh-ss>
2022-03-25 09:18:08 +00:00
<view class="li-textarea">
<view class="title">*详细地址</view>
2022-04-06 08:07:18 +00:00
<textarea class="textarea" v-model="data.addres" placeholder="请输入详细地址" />
2022-03-25 09:18:08 +00:00
</view>
2022-04-13 12:36:32 +00:00
<view class="scene-img dis">
<view class="title flexs">现场图片</view>
<view class="disac fw">
<view class="img-content" v-for="(item,index) in imgsrcArr" :key="index">
<image class="img mar-x10" :src="item" mode="aspectFill" lazy-load></image>
</view>
<view class="iocn-content flexs mar-x10" @click="chooseImg()">
<image class="icon" src="../../static/iocn/jia.png" mode=""></image>
</view>
</view>
2022-03-25 09:18:08 +00:00
</view>
2022-03-22 03:38:06 +00:00
</view>
2022-04-06 08:07:18 +00:00
<button class="submit-button" @click="submitData()" type="default">确认提交</button>
2022-03-25 09:18:08 +00:00
2022-03-22 03:38:06 +00:00
</view>
2022-04-06 08:07:18 +00:00
</container-subgroup-two>
2022-03-22 03:38:06 +00:00
</view>
</view>
2022-04-06 08:07:18 +00:00
2022-03-22 03:38:06 +00:00
</template>
<script>
2022-03-25 09:18:08 +00:00
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
2022-03-22 03:38:06 +00:00
import statusNav from '../../components/status-nav.vue';
2022-04-06 08:07:18 +00:00
import yyMmDdHhSs from '@/components/dates/yy-mm-dd-hh-ss.vue';
import {
uploadImg
} from '@/jsFile/public-api.js';
2022-03-22 03:38:06 +00:00
export default {
components: {
statusNav,
2022-03-25 09:12:59 +00:00
containerSubgroupTwo,
2022-04-06 08:07:18 +00:00
yyMmDdHhSs
2022-03-22 03:38:06 +00:00
},
data() {
return {
2022-04-06 08:07:18 +00:00
data: {
type_id: 1,
2022-04-13 12:36:32 +00:00
title: "",
brand: "",
model: "",
width: '',
height: '',
contact_name: "",
contact_phone: "",
2022-04-06 08:07:18 +00:00
appointment_time: '',
2022-04-13 12:36:32 +00:00
addres: "",
pictures:''
2022-03-31 09:58:34 +00:00
},
2022-04-13 12:36:32 +00:00
pictures: [],
2022-04-06 08:07:18 +00:00
imgsrcArr: [],
2022-03-22 03:38:06 +00:00
typeIndex: 0,
2022-04-13 12:36:32 +00:00
typeData: []
2022-03-22 03:38:06 +00:00
}
},
2022-03-25 09:18:08 +00:00
onLoad(op) {
2022-04-06 08:07:18 +00:00
this.getType()
2022-03-25 09:18:08 +00:00
if (op.index != undefined) this.typeIndex = op.index;
},
2022-03-22 03:38:06 +00:00
methods: {
2022-04-06 08:07:18 +00:00
// 切换类型
2022-03-22 03:38:06 +00:00
typeIndexFun(index) {
this.typeIndex = index
2022-04-13 12:36:32 +00:00
this.data.type_id = this.typeData[index].id;
2022-04-06 08:07:18 +00:00
},
getType() {
this.$requst.post('/universal/api.vas/vas_type', this.data).then(res => {
if (res.code == 1) {
this.typeData = [...res.data]
} else {
}
})
},
openDatetimePicker() {
this.$refs.myPicker.show();
},
// 获取预约时间
handleSubmit(e) {
// {year: "2019", month: "07", day: "17", hour: "15", minute: "21"}
this.data.appointment_time = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`;
},
// 选择图片
chooseImg() {
uni.chooseImage({
count: 2,
sourceType: ['album', 'camera'],
success: (res) => {
let imgsrc = res.tempFilePaths;
imgsrc.forEach(item => {
this.imgsrcArr.push(item);
})
for (var i = 0; i < res.tempFilePaths.length; i++) {
uploadImg({
path: res.tempFilePaths[i]
}).then(res => {
if (res.code) {
this.$toolAll.tools.showToast('上传成功');
2022-04-13 12:36:32 +00:00
this.pictures.push(res.data.id);
2022-04-06 08:07:18 +00:00
}
})
}
}
})
},
// 提交
submitData() {
2022-04-13 12:36:32 +00:00
this.data.pictures = this.pictures.join(',');
console.log(this.data.pictures);
2022-04-06 08:07:18 +00:00
if (!this.data.title) {
this.$toolAll.tools.showToast("请填写产品名称");
return
}
if (!this.data.contact_name) {
this.$toolAll.tools.showToast("请填写联系人名称");
return
}
var reg_tel =
/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/; //11位手机号码正则
if (!reg_tel.test(this.data.contact_phone)) {
this.$toolAll.tools.showToast("请正确填写联系人电话");
return
}
if (!this.data.appointment_time) {
this.$toolAll.tools.showToast("请选择预约时间");
return
}
if (!this.data.addres) {
this.$toolAll.tools.showToast("请正确填写详细地址");
return
}
2022-04-13 12:36:32 +00:00
if (!this.pictures.length) {
2022-04-06 08:07:18 +00:00
this.$toolAll.tools.showToast("请选择现场图片");
return
}
2022-04-13 12:36:32 +00:00
this.data.appointment_time = new Date(this.data.appointment_time).getTime()/1000;
this.data.pictures = this.pictures.join(',');
2022-04-06 08:07:18 +00:00
this.$requst.post('/universal/api.vas/vas', this.data).then(res => {
2022-04-13 12:36:32 +00:00
if (res.code) {
this.$toolAll.tools.showToast('提交成功');
setTimeout(()=>{
uni.navigateBack({delta:1})
},1000)
2022-04-06 08:07:18 +00:00
} else {
}
})
2022-03-22 03:38:06 +00:00
}
}
}
</script>
<style>
2022-03-25 09:18:08 +00:00
.content {}
.cor {
color: #FF0000;
2022-03-22 03:38:06 +00:00
}
2022-03-25 09:18:08 +00:00
2022-03-22 03:38:06 +00:00
.select-type {
display: flex;
margin-top: 10rpx;
height: 80rpx;
background-color: #FFFFFF;
align-items: center;
padding: 0rpx 28rpx;
}
2022-03-25 09:18:08 +00:00
2022-03-22 03:38:06 +00:00
.submit-button {
width: 686rpx;
border-radius: 50rpx;
height: 90rpx;
background-color: #02A2ea;
line-height: 90rpx;
color: #FFFFFF;
margin-top: 60rpx;
text-align: center;
font-size: 30rpx;
}
2022-03-25 09:18:08 +00:00
2022-03-22 03:38:06 +00:00
.select-type .text {
font-size: 28rpx;
color: #333333;
margin-right: 34rpx;
}
.select-type .type {
display: flex;
}
.select-type .type .li {
width: 106rpx;
line-height: 44rpx;
text-align: center;
height: 44rpx;
2022-03-25 03:41:31 +00:00
color: #bbbbbb;
2022-03-22 03:38:06 +00:00
border-radius: 50rpx;
font-size: 24rpx;
border: solid 2rpx #99999b;
margin-right: 20rpx;
}
.select-type .type .on {
2022-04-01 10:16:43 +00:00
background-color: #0081ff;
2022-03-22 03:38:06 +00:00
border: none;
color: #FFFFFF;
box-shadow: 2rpx 2px 10rpx rgba(0, 81, 255, 0.5);
}
.appreciationServe-from {
padding: 0rpx 25rpx;
background-color: #FFFFFF;
margin-top: 10rpx;
}
.appreciationServe-from .li {
display: flex;
height: 80rpx;
2022-04-06 08:07:18 +00:00
border-bottom: 1rpx solid #f5f5f7;
2022-03-22 03:38:06 +00:00
align-items: center;
}
2022-04-06 08:07:18 +00:00
.appreciationServe-from .li:last-child {
border-bottom: none;
}
2022-03-22 03:38:06 +00:00
.appreciationServe-from .li .title {
font-size: 26rpx;
color: #333333;
margin-right: 28rpx;
width: 118rpx;
text-align: right;
}
.appreciationServe-from .li .input {
font-size: 26rpx;
color: #333333;
flex: 1;
}
.supplementTitle {
padding: 20rpx 25rpx;
font-size: 26rpx;
color: #333333;
}
.supplement-from {
background-color: #FFFFFF;
2022-03-25 09:18:08 +00:00
padding: 0rpx 25rpx;
2022-03-22 03:38:06 +00:00
}
.supplement-from .li {
display: flex;
align-items: center;
2022-03-25 09:18:08 +00:00
2022-03-22 03:38:06 +00:00
height: 80rpx;
font-size: 27rpx;
border-bottom: 2rpx solid #f5f5f7;
line-height: 27rpx;
justify-content: space-between;
color: #333333;
}
2022-03-25 09:18:08 +00:00
.supplement-from .li .input {
2022-03-22 03:38:06 +00:00
text-align: right;
2022-03-25 03:41:31 +00:00
font-size: 24rpx
2022-03-22 03:38:06 +00:00
}
2022-03-25 09:18:08 +00:00
2022-03-22 03:38:06 +00:00
.supplement-from .li-textarea {
font-size: 27rpx;
line-height: 27rpx;
justify-content: space-between;
color: #333333;
padding-bottom: 13rpx;
}
2022-03-25 09:18:08 +00:00
.supplement-from .li-textarea .title {
padding-top: 26rpx;
padding-bottom: 17rpx;
2022-03-22 03:38:06 +00:00
}
2022-03-25 09:18:08 +00:00
.supplement-from .li-textarea .textarea {
width: 100%;
height: 127rpx;
background-color: #F5F5F5;
box-sizing: border-box;
padding: 20rpx;
font-size: 24rpx
2022-03-22 03:38:06 +00:00
}
2022-03-25 09:18:08 +00:00
.scene-img {
margin-top: 27rpx;
padding-bottom: 30rpx;
}
.scene-img .title {
margin-right: 28rpx;
font-size: 26rpx;
color: #333333;
}
.scene-img .img-content .img {
width: 170rpx;
2022-04-13 12:36:32 +00:00
height: 135rpx;
2022-03-25 09:18:08 +00:00
margin-right: 10rpx;
2022-04-13 12:36:32 +00:00
vertical-align: middle;
2022-03-25 09:18:08 +00:00
}
.scene-img .iocn-content {
2022-04-13 12:36:32 +00:00
width: 170rpx;
2022-03-25 09:18:08 +00:00
height: 135rpx;
background-color: #DCDCDC;
display: flex;
align-items: center;
justify-content: center;
}
.scene-img .iocn-content .icon {
width: 62rpx;
height: 62rpx;
}
</style>