Commit 2411dbf9 by zhangxw

Merge branch 'dev_v4.17.0' of http://192.168.3.233:8090/saas_plus/dj-car-boutiqu…

…e-work-wechat into dev_v4.17.0
2 parents b2702d9f f4fd91b6
......@@ -60,7 +60,7 @@ Page({
carLifeApi.getCarTypeList(i.id).then(res => {
let { data } = res
wx.hideLoading()
if (!data || !data.length) wx.$api.showToast('暂无该车型')
if (!data || !data.length) wx.$util.showToast('暂无该车型')
else carTypeList = data || []
this.setData({
brandInfo,
......
......@@ -7,7 +7,17 @@ Component({
/**
* 组件的属性列表
*/
properties: {},
properties: {
serviceInfo: {
type: Object,
value: () => { },
observer: function (n) {
this.setData({
formData: n
})
}
}
},
/**
* 组件的初始数据
......
// packageEquity/pages/carEquity/components/GLForm/GLForm.js
Component({
/**
* 组件的属性列表
*/
properties: {
formData: {
type: Object,
value: () => { },
observer: function (n) {
this.setData({
formData: n
})
}
},
formDataList: {
type: Array,
value: () => []
},
labelWidth: {
type: String,
value: '140rpx'
},
// 页面存放表单对象的对象名,用于直接变更page的值
dataAttrName: {
type: String,
value: null
}
},
/**
* 组件的初始数据
*/
data: {
targetIdx: -1
},
lifetimes: {
attached() {
let thisPage = wx.$router.getPageInstance()
wx.$eventbus.on("set_car_info", (n) => {
let { targetIdx, dataAttrName } = this.data
let formData = thisPage?.data[dataAttrName] || null
if (formData) {
if (targetIdx != -1) {
let targetItem = this.data.formDataList[targetIdx] || {}
if (targetItem.handleChange) {
targetItem.handleChange(thisPage, dataAttrName, n)
}
if (!targetItem.noDefault) {
thisPage.setData({
[dataAttrName + '.' + targetItem.labelName]: n.vehicleBrandName + '/' + n.vehicleSeriesName + '/' + n.vehicleShapeName + '/' + n.vehicleSubBrandName
})
}
}
formData = Object.assign(formData, n)
thisPage.setData({
[dataAttrName]: formData
// carInfo: n,
})
}
})
}
},
/**
* 组件的方法列表
*/
methods: {
handleInput(e) {
let value = e.detail
let { attr } = e.target.dataset
let { dataAttrName } = this.data
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
[dataAttrName + '.' + attr]: value
})
// console.log(thisPage.data)
},
handlePickerChange(e) {
let idx = e.detail.value || 0
let { target } = e.currentTarget.dataset
let { dataAttrName } = this.data
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
[dataAttrName + '.' + target.name]: target.optionList[idx][target.optionId],
[dataAttrName + '.' + target.labelName]: target.optionList[idx][target.optionLabel]
})
this.triggerEvent('pickerChange', { obj: target.optionList[idx] })
},
handleTimeChange(e) {
let { value } = e.detail
let { target } = e.currentTarget.dataset
let { dataAttrName } = this.data
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
[dataAttrName + '.' + target.name]: value
})
// console.log(this.data.formData)
},
// 品牌车型
handleJumpBrand(e) {
wx.$router.go("packageEquity.carBrands")
},
handleCellClick(e) {
let { target, idx } = e.currentTarget.dataset
switch (target.type) {
case 'brand':
this.setData({
targetIdx: idx
})
this.handleJumpBrand()
break
default:
break
}
}
}
})
{
"component": true,
"usingComponents": {
"van-field": "@vant/weapp/field/index"
}
}
\ No newline at end of file
<!--packageEquity/pages/carEquity/components/GLForm/GLForm.wxml-->
<view wx:for="{{formDataList}}" wx:key="index">
<gl-cell border="{{!item.noBorder}}" class="{{item.name}}" haveArrow="{{item.haveArrow || false}}" valueAlign="right" label="{{item.label}}" labelWidth="{{labelWidth}}" placeholder="{{item.placeholder || ''}}" bindclick="handleCellClick" data-target="{{item}}" data-idx="{{index}}" cellHeight="{{!item.noCellHeight}}">
<!-- input / textarea -->
<van-field wx:if="{{item.type == 'input'}}" class="textarea" value="{{formData[item.name]}}" input-align="{{itme.inputAlign || 'right'}}" rows="1" autosize type="{{item.fieldType || 'text'}}" placeholder="{{item.placeholder || '请输入'}}" maxlength="{{item.maxlength || 140}}" disabled="{{item.disabled}}" readonly="{{item.readonly}}" data-attr="{{item.name}}" bindinput="handleInput"/>
<!-- picker -->
<picker wx:if="{{item.type == 'select'}}" bindchange="handlePickerChange" data-target="{{item}}" value="{{index}}" range="{{item.optionList}}" range-key="{{item.optionLabel}}">
<view class="picker">
<image class="arrow" src="../../../../../components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.labelName]}}">{{formData[item.labelName]}}</view>
<text class="placeholder" wx:else>请选择</text>
</view>
</picker>
<!-- 时间选择器 -->
<picker wx:if="{{item.type == 'pickerTime'}}" mode="date" value="{{formData[name]}}" start="{{item.start || ''}}" end="{{item.end || ''}}" bindchange="handleTimeChange" data-target="{{item}}">
<view class="picker">
<image class="arrow" src="../../../../../components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.name]}}">{{formData[item.name]}}</view>
<text class="placeholder" wx:else>请选择</text>
</view>
</picker>
<!-- 品牌车型 -->
<view wx:if="{{item.type == 'brand'}}">{{formData[item.labelName]}}</view>
</gl-cell>
</view>
\ No newline at end of file
/* packageEquity/pages/carEquity/components/GLForm/GLForm.wxss */
.input {
text-align: right;
font-size: 28rpx;
}
.placeholder-class {
color: #C3C3C3;
}
.picker {
display: flex;
flex-direction: row-reverse;
height: 80rpx;
line-height: 80rpx;
text-align: right;
}
.placeholder {
font-weight: 400;
font-size: 28rpx;
color: #B6B6B8;
}
.arrow {
width: 28rpx;
height: 26rpx;
margin-top: 26rpx;
flex-shrink: 0;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
\ No newline at end of file
// packageEquity/pages/carEquity/components/SecondStep/SecondStep.js
import data from '../constant/secondStepData'
import fn from '../constant/ruleFn'
const defaultLabelWidth = '140rpx'
Component({
/**
* 组件的属性列表
*/
properties: {
serviceInfo: {
type: Object,
value: () => { }
},
// 页面存放表单对象的对象名
dataAttrName: {
type: String,
value: null
}
},
/**
* 组件的初始数据
*/
data: {
defaultLabelWidth,
secondObj: data.secondObj,
formRule: data.formRule
},
/**
* 组件的方法列表
*/
methods: {
getPageData() {
let thisPage = wx.$router.getPageInstance()
return thisPage?.data[this.data.dataAttrName]
},
handleConfirm() {
var { formRule } = this.data
let formData = this.getPageData()
let validObj = fn.checkRequired(formData, formRule)
if (validObj) {
wx.$util.showToast(validObj.message)
// wx.pageScrollTo({
// selector: `.${validObj.attr}`
// })
return
}
this.triggerEvent('confirm')
}
}
})
{
"component": true,
"usingComponents": {}
"usingComponents": {
"gl-form": "../GLForm/GLForm"
}
}
\ No newline at end of file
/* packageEquity/pages/carEquity/components/SecondStep/SecondStep.wxss */
\ No newline at end of file
<!--packageEquity/pages/carEquity/components/SecondStep/SecondStep.wxml-->
<text>packageEquity/pages/carEquity/components/SecondStep/SecondStep.wxml</text>
<view>
<view class="box">
<view class="title 11">车辆信息</view>
<gl-form formData="{{serviceInfo}}" dataAttrName="{{dataAttrName}}" formDataList="{{secondObj.carFormList}}"></gl-form>
</view>
<view class="box">
<view class="title">客户信息</view>
<gl-form formData="{{serviceInfo}}" dataAttrName="{{dataAttrName}}" formDataList="{{secondObj.customerFormList}}"></gl-form>
</view>
<view class="box">
<view class="title">产品信息</view>
<gl-form formData="{{serviceInfo}}" dataAttrName="{{dataAttrName}}" formDataList="{{secondObj.productFormList}}"></gl-form>
</view>
<view class="box m-b-40">
<view class="title">店面信息</view>
<gl-form formData="{{serviceInfo}}" dataAttrName="{{dataAttrName}}" formDataList="{{secondObj.storeFormList}}"></gl-form>
</view>
<button class="btn" bindtap="handleConfirm">确认提交(2/2)</button>
<button class="btn draft-btn" bindtap="handleDraft">存草稿</button>
</view>
\ No newline at end of file
/* packageEquity/pages/carEquity/components/SecondStep/SecondStep.wxss */
.box {
background: #FFFFFF;
box-shadow: 0 6rpx 16rpx 0 #cdcdd159;
border-radius: 16rpx;
margin: 20rpx;
color: #222222;
}
.m-b-40 {
margin-bottom: 40rpx;
}
.flex {
display: flex;
}
.title {
height: 96rpx;
line-height: 96rpx;
font-weight: 600;
font-size: 32rpx;
padding: 0 32rpx;
}
.picker {
display: flex;
flex-direction: row-reverse;
height: 80rpx;
line-height: 80rpx;
text-align: right;
}
.placeholder {
font-weight: 400;
font-size: 28rpx;
color: #B6B6B8;
}
.arrow {
width: 28rpx;
height: 26rpx;
margin-top: 26rpx;
flex-shrink: 0;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.input {
text-align: right;
font-size: 28rpx;
}
.placeholder-class {
color: #C3C3C3;
}
.tire-box {
padding: 0 40rpx 44rpx;
font-size: 28rpx;
color: #9B9B9E;
}
.tire-block {
width: 240rpx;
height: 240rpx;
box-sizing: border-box;
background-color: #F4F5F7;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.tire-block:first-child {
margin-right: 20rpx;
}
.tire-tip {
height: 40rpx;
line-height: 40rpx;
background-color: #ebf2fd;
border-radius: 8rpx;
font-size: 24rpx;
color: #3582EE;
margin-top: 28rpx;
padding: 4rpx 24rpx;
border-radius: 8rpx;
}
.icon-plus {
width: 35rpx;
height: 35rpx;
margin-bottom: 20rpx;
}
.btn {
box-sizing: border-box;
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 32rpx;
color: #FFFFFF;
background: #3582EE;
border-radius: 12rpx;
margin: 0 64rpx 20rpx;
}
.draft-btn {
background: #FFFFFF;
color: #3582EE;
}
\ No newline at end of file
// 固定optionList
const seatesList = [{
optionId: 1,
optionLabel: 1
}, {
optionId: 2,
optionLabel: 2
}, {
optionId: 3,
optionLabel: 3
}, {
optionId: 4,
optionLabel: 4
}, {
optionId: 5,
optionLabel: 5
}, {
optionId: 6,
optionLabel: 6
}, {
optionId: 7,
optionLabel: 7
}]
const customerTypeList = [{
optionId: 1,
optionLabel: '个人'
}, {
optionId: 2,
optionLabel: '企业'
}, {
optionId: 3,
optionLabel: '个人(港澳)'
}, {
optionId: 4,
optionLabel: '个人(台)'
}, {
optionId: 5,
optionLabel: '个人(军官)'
}]
const cardTypeList = [{
optionId: 1,
optionLabel: '身份证'
}, {
optionId: 4,
optionLabel: '军官证'
}, {
optionId: 22,
optionLabel: '统一社会信息代码'
}]
const buyCarTypeList = [{
optionId: 0,
optionLabel: '贷款车'
}, {
optionId: 1,
optionLabel: '全款车'
}]
export default {
seatesList,
customerTypeList,
cardTypeList,
buyCarTypeList
}
......@@ -16,6 +16,9 @@ const formRule = {
rearTireUrl: [{ required: true, message: '请上传后轮胎图片' }],
}
const phoneRex = /^[1]([3-9])[0-9]{9}$/
export default {
formRule
formRule,
phoneRex
}
\ No newline at end of file
import constantList from './constantList'
import data from './data'
const formRule = {
vin: [{ required: true, message: '车架号不能为空' }],
seatesNum: [{ required: true, message: '座位数不能为空' }],
engineNo: [{ required: true, message: '发动机号不能为空' }],
vehicleColor: [{ required: true, message: '车身颜色不能为空' }],
billingDate: [{ required: true, message: '购车日期不能为空' }],
vehicleBrandId: [{ required: true, message: '品牌车系不能为空' }],
customerType: [{ required: true, message: '客户类型不能为空' }],
customerName: [{ required: true, message: '姓名不能为空' }],
phone: [
{ required: true, message: '联系电话不能为空' },
{
validator: (rule, value) => {
return !data.phoneRex.test(value) ? { message: '请输入正确的手机号' } : null
}
}
],
cardNo: [{ required: true, message: '证件号码不能为空' }],
customerAddress: [{ required: true, message: '联系地址不能为空' }],
effectiveDate: [{ required: true, message: '生效日期不能为空' }],
tireBrand: [{ required: true, message: '轮胎品牌不能为空' }],
frontTireSpecification: [{ required: true, message: '规格型号(前轮)不能为空' }],
rearTireSpecification: [{ required: true, message: '规格型号(后轮)不能为空' }],
compensationName: [{ required: true, message: '第一受益人不能为空' }],
merchantPhone: [{ required: true, message: '联系电话不能为空' }],
merchantAddress: [{ required: true, message: '联系地址不能为空' }],
}
const secondObj = {
carFormList: [{
label: '车架号',
name: 'vin',
type: 'input',
maxlength: '17'
}, {
label: '车辆发票价',
name: 'invoicePrice',
type: 'input',
readonly: true
}, {
label: '座位数',
name: 'seatesNum',
labelName: 'seatesNum',
type: 'select',
optionList: constantList.seatesList,
optionId: 'optionId',
optionLabel: 'optionLabel'
}, {
label: '发动机号',
name: 'engineNo',
type: 'input',
maxlength: '30'
}, {
label: '车身颜色',
name: 'vehicleColor',
type: 'input',
maxlength: '5'
}, {
label: '购车日期',
name: 'billingDate',
type: 'pickerTime',
end: new Date()
}, {
label: '品牌车系',
name: 'vehicleBrandId',
labelName: 'brandTxt',
type: 'brand',
haveArrow: true,
placeholder: '请选择'
// handleChange: function (that, dataAttrName, brandObj) {
// console.log(brandObj,'brandObj--')
// that.setData({
// [dataAttrName + '.brandTxt']: brandObj.vehicleBrandName + '/' + brandObj.vehicleSeriesName + '/' + brandObj.vehicleShapeName + '/' + brandObj.vehicleSubBrandName
// })
// }
}],
customerFormList: [{
label: '客户类型',
name: 'customerType',
labelName: 'customerTypeName',
type: 'select',
optionList: constantList.customerTypeList,
optionId: 'optionId',
optionLabel: 'optionLabel'
}, {
label: '姓名',
name: 'customerName',
type: 'input',
maxlength: '100',
noCellHeight: true,
fieldType: 'textarea'
}, {
label: '联系电话',
name: 'phone',
type: 'input',
maxlength: '11',
}, {
label: '证件类型',
name: 'cardType',
labelName: 'cardTypeName',
type: 'select',
optionList: constantList.cardTypeList,
optionId: 'optionId',
optionLabel: 'optionLabel'
}, {
label: '证件号码',
name: 'cardNo',
type: 'input'
}, {
label: '联系地址',
name: 'customerAddress',
type: 'input',
maxlength: '100',
noCellHeight: true,
fieldType: 'textarea'
}],
productFormList: [{
label: '服务年限',
name: 'servicePeriod',
type: 'input',
disabled: true
}, {
label: '生效日期',
name: 'effectiveDate',
type: 'pickerTime',
start: new Date(new Date().setDate(new Date(new Date()).getDate() + 1)).toLocaleDateString()
}, {
label: '轮胎品牌',
name: 'tireBrand',
type: 'input',
maxlength: '20'
}, {
label: '规格型号(前轮)',
name: 'frontTireSpecification',
type: 'input',
maxlength: '20'
}, {
label: '规格型号(后轮)',
name: 'rearTireSpecification',
type: 'input',
maxlength: '20'
}, {
label: '购车类型',
name: 'buyCarType',
labelName: 'buyCarTypeName',
type: 'select',
optionList: constantList.buyCarTypeList,
optionId: 'optionId',
optionLabel: 'optionLabel'
}, {
label: '第一受益人',
name: 'compensationName',
type: 'input'
}],
storeFormList: [{
label: '店面名称',
name: 'merchantName',
type: 'input',
readonly: true
}, {
label: '联系电话',
name: 'merchantPhone',
type: 'input',
maxlength: '20'
}, {
label: '联系地址',
name: 'merchantAddress',
type: 'input',
fieldType: 'textarea',
maxlength: '100'
}]
}
export default {
formRule,
secondObj
}
\ No newline at end of file
......@@ -5,21 +5,32 @@ Page({
* 页面的初始数据
*/
data: {
formData: {}
serviceInfo: {
seatesNum: 5,
servicePeriod: '1年'
},
// 页面存放表单对象的对象名
dataAttrName: 'serviceInfo',
step: 'second'
},
handleFirstConfirm(e) {
let { formData } = e.detail
this.setData({
formData
serviceInfo: formData,
step: 'second'
})
},
handleSecondConfirm() {
let { serviceInfo } = this.data
console.log(serviceInfo, '调接口---')
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
......
{
"navigationBarTitleText": "服务信息",
"usingComponents": {
"first-step": "../components/FirstStep/FirstStep"
"first-step": "../components/FirstStep/FirstStep",
"second-step": "../components/SecondStep/SecondStep"
}
}
\ No newline at end of file
<!--packageEquity/pages/carEquity/serviceInfo/serviceInfo.wxml-->
<view>
<first-step id="FirstStep" bindconfirm="handleFirstConfirm"></first-step>
<view class="layout">
<first-step wx:if="{{step == 'first'}}" id="FirstStep" serviceInfo="{{serviceInfo}}" bindconfirm="handleFirstConfirm"></first-step>
<second-step wx:if="{{step == 'second'}}" id="SecondStep" serviceInfo="{{serviceInfo}}" dataAttrName="{{dataAttrName}}" bindconfirm="handleSecondConfirm"></second-step>
</view>
\ No newline at end of file
/* packageEquity/pages/carEquity/serviceInfo/serviceInfo.wxss */
page {
.layout {
background: #F4F5F7;
padding-bottom: 60rpx;
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!