Files
dou_fire/pages/offline/create.vue
2023-11-14 18:05:15 +08:00

191 lines
4.1 KiB
Vue

<template>
<view class="create-page">
<view class="create-title">创建新的订单</view>
<view class="create-submit">完善创建订单用户与订单类型</view>
<view class="create-from">
<view class="create-type">
<view class="create-type-title">选择业务类型</view>
<block v-for="(item, index) in businessArr" :key="index">
<view class="create-type-item" :class="{'active': (item.business_id == businessId || item.synthesis_id == businessId) && item.self_type == selfType}" @click="onBusiness(item.business_id || item.synthesis_id, item.self_type)">
<image class="create-type-icon" :src="item.cover_url || item.cover" mode="aspectFill"></image>
<view class="create-type-text">
<view class="title nowrap">{{item.title || '-'}}</view>
<view class="submit nowrap">{{item.self_type == 'synthesis' ? '相关个人法律咨询服务' : item.subtitle || '-'}}</view>
</view>
</view>
</block>
</view>
<view class="create-btn">
<button size="default" @click="onNext()">下一步</button>
</view>
</view>
</view>
</template>
<script>
import { business } from '@/apis/interfaces/offline.js'
export default {
data() {
return {
businessArr: [],
businessId : '',
selfType : '',
};
},
created() {
uni.showLoading({
title: '加载中...',
mask : true
})
business().then(res => {
this.businessArr = res
this.businessId = res[0].business_id
this.selfType = res[0].self_type
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
}).finally(() => {
uni.hideLoading()
})
},
methods: {
// 选择业务类型
onBusiness(id, type){
this.selfType = type
this.businessId = id
},
// 创建业务单
onNext(){
let busines = this.businessArr.find(val => val.business_id === this.businessId)
this.$Router.replace({
name : 'OfflineGenerate',
params : {
businessTitle : busines.title,
businessId : busines.business_id
}
})
}
}
}
</script>
<style lang="scss">
.create-page{
padding: 50rpx;
box-sizing: border-box;
min-height: 100vh;
overflow: hidden;
.create-title{
text-align: center;
font-weight: bold;
font-size: 44rpx;
}
.create-submit{
text-align: center;
font-size: 30rpx;
color: gray;
padding-top: 10rpx;
}
.create-from{
padding-top: 50rpx;
}
// 目标用户
.create-user{
background: #f8f8f8;
border-radius: $radius;
padding: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
.cover{
width: 88rpx;
height: 88rpx;
background: white;
border-radius: $radius;
margin-right: 20rpx;
border: dashed 1rpx #ddd;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
.cover-src{
width: 100%;
height: 100%;
}
}
.nickname{
width: calc(100% - 188rpx);
line-height: 70rpx;
font-size: 32rpx;
&.hide{
color: gray;
}
}
.icon{
width: 80rpx;
text-align: right;
.icon-u{
display: inline-block;
}
}
}
// 选择业务类型
.create-type{
padding-top: 50rpx;
.create-type-title{
text-align: center;
line-height: 50rpx;
color: gray;
font-size: 30rpx;
}
.create-type-item{
background: #f8f8f8;
border-radius: $radius;
padding: 30rpx;
margin-top: 30rpx;
border:solid 1rpx #f8f8f8;
box-sizing: border-box;
display: flex;
align-items: center;
.create-type-icon{
width: 88rpx;
height: 88rpx;
margin-right: $margin;
background-color: white;
border-radius: $radius;
}
.create-type-text{
line-height: 40rpx;
.title{
font-size: 30rpx;
}
.submit{
color: gray;
font-size: 26rpx;
}
}
&.active{
border:solid 1rpx $main-color;
}
}
}
// 按钮
.create-btn{
margin-top: 90rpx;
button[size="default"]{
height: 100rpx;
line-height: 100rpx;
background: $main-color;
font-size: 32rpx;
color: white;
font-weight: bold;
&::after{
border: none;
}
}
}
}
</style>