Commit 679c377c by cen

Merge branch 'SAAS+V5.5.0' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V5.5.0

2 parents 13ab8045 4a23aed4
......@@ -73,7 +73,7 @@
:maxlength="item.maxlength ? item.maxlength : -1"
placeholder-class="input-placeholder"
@input="item.inputType === 'number' && item.maxlength ? (formData[item.value] = String($event.target.value).slice(0, item.maxlength)) : null"
:readonly="item.readonly || false"
:disabled="item.readonly || item.disabled || false"
/>
<view
v-if="item.valueIcon"
......
......@@ -379,15 +379,11 @@ export default {
}
},
openPop() {
// this.messageType = 'system'
// this.$refs.kfRef.open()
uni.navigateTo({
url: `/pages/common/messageList`
})
},
getMessageInfo() {
// this.getMessage()
// this.getMessageCount()
this.getMessagePop()
},
jumpPersonCenter() {
......@@ -441,13 +437,6 @@ export default {
this.tabs[2].hidden = true
this.tabs[3].hidden = true
return
} else {
// const { directSaleAuth, hmzxAuth, authorizedBusinessList } = res // 当驻店人员为非直营,且非鸿蒙智行延保业务驻店人员情况下。隐藏左侧【学习中心】图标
// const isYb = authorizedBusinessList && authorizedBusinessList.includes(1) // 1.延保 2.轻改 3.权益
// if (directSaleAuth || (hmzxAuth && isYb)) {
// this.tabs[2].hidden = false
// }
}
}
},
......@@ -456,6 +445,8 @@ export default {
// this.trackInterval = null
},
beforeDestroy() {
// uni.$off('pageBack')
// uni.$off('studyCenter')
uni.$off('ActivityCenter', this.handleActivityCenter);
// clearInterval(this.trackInterval)
// this.trackInterval = null
......
......@@ -21,9 +21,9 @@
<!-- 考试次数 -->
<view class="exam-times">
<text class="times-value">剩余考试次数</text>
<template v-if="!item.examTimes">不限次数</template>
<template v-if="!item.examTimes">不限制</template>
<template v-else>
<text>{{ filterValue(item.remainingTimes) }}/{{ filterValue(item.examTimes) }}次</text>
<text>{{ filterValue(item.remainingTimes) }}/{{ filterValue(item.examTimes) }}</text>
</template>
</view>
......@@ -164,7 +164,7 @@ export default {
// 跳转北森考试详情页
async viewExam(item) {
console.log('查看考试', item)
if (item.remainingTimes <= 0) return
if (item.examTimes && item.remainingTimes <= 0) return
// TODO: 跳转到考试详情页
this.showStudyPopup = false
this.currentExam = item
......@@ -193,7 +193,7 @@ export default {
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${tokenUrl}&return_url=${url}`;
uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评`
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评&type=1`
})
} else {
throw new Error('获取 token 失败')
......
......@@ -22,7 +22,7 @@
<text class="times-value">剩余考试次数</text>
<template v-if="!item.examTimes">不限制</template>
<template v-else>
<text>{{ filterValue(item.remainingTimes) }}/{{ filterValue(item.examTimes) }}次</text>
<text>{{ filterValue(item.remainingTimes) }}/{{ filterValue(item.examTimes) }}</text>
</template>
</view>
......@@ -166,7 +166,7 @@ export default {
// 跳转北森考试详情页
async viewExam(item) {
console.log('查看考试', item)
if (item.remainingTimes <= 0) return
if (item.examTimes && item.remainingTimes <= 0) return
// TODO: 跳转到考试详情页
this.showStudyPopup = false
this.currentExam = item
......@@ -195,7 +195,7 @@ export default {
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${tokenUrl}&return_url=${url}`;
uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评`
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评&type=1`
})
} else {
throw new Error('获取 token 失败')
......
......@@ -188,31 +188,18 @@ export default {
lockReason: 0
}
},
created() {
// 在组件创建时就开始监听,确保事件能被捕获
// uni.$on('showExamSubmitPopup', () => {
// console.log('接收到考试提交弹窗事件')
// this.showExamPopup = true
// })
uni.$on('showStudyPopup', obj => {
console.log('接收到学习弹窗事件', obj)
if (obj.type === 'examSubmit') {
this.showExamPopup = true
} else if (obj.type === 'getLevelExamInfo') {
// 查询是否有等级考试
this.getLevelExamInfo()
if (obj.name == 'myCourse') {
this.$refs.pointRef.getMyStudyTime()
}
}
})
},
beforeDestroy() {
// 组件销毁前移除监听
uni.$off('showStudyPopup')
uni.$logger.local.info('levelStudyPopup 移除监听')
uni.$off('levelStudyPopup')
// uni.$off('showStudyPopup')
},
mounted() {
uni.$logger.local.info('levelStudyPopup 开始监听mounted')
uni.$on('levelStudyPopup', obj => {
uni.$logger.local.info('接收到学习弹窗事件', obj)
this.showExamPopup = true
})
const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo
if (this.checkRecordAudio) permision.requestAndroidPermission('android.permission.RECORD_AUDIO') // 进入界面时检查权限
......@@ -267,7 +254,7 @@ export default {
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`)
this.jumpUrl = `${tokenUrl}&return_url=${url}`
uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评`
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评&type=0`
})
} else {
uni.showToast({
......
<template>
<view
class="car-model-box"
:key="viewKey"
>
<scroll-view
class="scroll-view"
scroll-y
:scroll-into-view="letter"
>
<template v-if="listData.length">
<template v-for="(i, index) in listData">
<view
class="item-box"
:key="index"
:id="i.letter"
>
<view class="letter-title flex">{{i.letter}}</view>
<template v-for="(c,cindex) in i.list">
<view
class="car-model"
:key="cindex"
>
<view class="brand-name">{{c.name}}</view>
<view class="brand-list">
<template v-for="(j, jindex) in c.childs_list">
<view
:key="jindex"
:class="['sub-brand-name']"
>
<view
class="subtitle subtitle-one flex"
@click.stop="chooseSubBrand(j, c , jindex, cindex, index)"
>
{{j.name}}
<uni-icons
:type="`${j.children && j.children.length?'down':'right'}`"
size="18"
></uni-icons>
</view>
</view>
<template v-for="(k,kindex) in j.children">
<view
class="sub-item flex"
:key="`${k.id}_${kindex}`"
>
<view
class="subtitle subtitle-two flex"
@click.stop="chooseSeries(k,jindex, cindex, index ,kindex)"
>
{{k.name}}
<uni-icons
:type="`${k.children && k.children.length?'down':'right'}`"
size="18"
></uni-icons>
</view>
<template v-for="(s,sindex) in k.children">
<view
:class="['item flex',{active: checkActive(s)}]"
:key="`${s.id}_${sindex}`"
@click.stop="chooseCarType(s,c)"
>
{{s.name}}
<view class="sprite-icon icon-tag-checked"></view>
</view>
</template>
</view>
</template>
</template>
</view>
</view>
</template>
</view>
</template>
<view class="block"></view>
</template>
</scroll-view>
<view class="letter-list">
<template v-for="(i, index) in listData">
<view
class="letter-item"
:key="index"
@click="letter = i.letter"
>
{{i.letter}}
</view>
</template>
</view>
<view class="right-box">
</view>
</view>
</template>
<script type='text/ecmascript-6'>
import popupmixin from './popupmixin'
export default {
mixins: [popupmixin],
name: 'CarBrand',
data () {
return {
letter: 'A',
viewKey: Date.now()
}
},
mounted () {
},
methods: {
async getList (searchValue) {
const { userInfo, params } = this,
{ cacheData } = params
this.currentId = ''
if (cacheData && cacheData.length) {
this.initData(cacheData)
if (searchValue) this.handleSearch(searchValue)
return
}
const data = await uni.$api.popupApi.getCarBrandList()
this.updateParams(params, data || [])
},
initData (carData) {
let { params: { idKey }, data: { customer, carInfo }, sceneType } = this,
letterList = Array.from(new Set([...carData.map((e) => e.letter)])),
carModelList = letterList.map(e => {
let list = []
carData.map(i => {
if (e === i.letter) {
i.childs_list = i.childs;
list.push(i)
}
})
return {
letter: e,
list,
}
})
this.list = carModelList
this.$emit('onComplete')
},
handleSearch (searchValue) {
if (!searchValue) {
this.searchStatus = false
this.letter = 'A'
} else {
searchValue = searchValue.toUpperCase()
let { list } = this,
carBrand = JSON.parse(JSON.stringify(list))
let arr = [];
carBrand.map(c => {
c.list.map(i => {
let childs_list = [],
i_name = i.name.toUpperCase()
i.childs_list.map((k) => {
let k_name = k.name.toUpperCase()
if (k_name.indexOf(searchValue) != -1) {
childs_list.push(k);
}
});
if (i_name.indexOf(searchValue) != -1 || childs_list.length > 0) {
i.childs_list = childs_list.length > 0 ? childs_list : i.childs_list;
arr.push(i);
}
})
})
let letterList = Array.from(new Set([...arr.map((e) => e.letter)]));
let searchList = letterList.map((l) => {
let _list = [];
arr.map((i) => {
if (l === i.letter) {
_list.push(i);
}
})
return {
letter: l,
list: _list,
}
})
this.searchList = searchList
this.searchStatus = true
}
},
async chooseSubBrand (that, item, jindex, cindex, index) {
if(that.children && that.children.length) return
uni.showLoading({
mask: true
})
const data = await uni.$api.popupApi.getCarSeriesList({
brandId: item.id,
childBrandId: that.id
})
uni.hideLoading()
this.listData[index].list[cindex].childs_list[jindex].children = data
this.viewKey = Date.now()
},
async chooseSeries (k, jindex, cindex, index, kindex) {
if (k.children && k.children.length) return
uni.showLoading({
mask: true
})
const data = await uni.$api.popupApi.getCarTypeList({
carSeriesId: k.id
})
uni.hideLoading()
this.listData[index].list[cindex].childs_list[jindex].children[kindex].children = data
this.viewKey = Date.now()
},
chooseCarType (s, c) {
let chooseItem = {
vehicleBrandId: c.id,
vehicleBrandName: c.name,
vehicleSubBrandId: s.brandId,
vehicleSubBrandName: s.brandName,
vehicleSeriesId: s.seriesId,
vehicleSeriesName: s.seriesName,
vehicleShapeId: s.id,
vehicleShapeName: s.name
}
this.currentId = s.id
this.$emit('choose', chooseItem)
},
checkActive (j) {
let { currentId, data, params } = this
return currentId ?
j.id == currentId : j.id == data[params.idKey]
},
}
}
</script>
<style scoped lang='scss'>
.car-model-box {
position: relative;
height: 100%;
width: 100%;
.scroll-view {
height: 100%;
}
.letter-list {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 0;
color: #888888;
font-size: toRpx(28);
line-height: toRpx(28);
padding: 0 toRpx(18);
text-align: center;
}
.item-box {
margin-bottom: toRpx(32);
.letter-title {
color: #888888;
font-size: toRpx(28);
height: toRpx(40);
background: #f5f7fa;
padding-left: toRpx(48);
}
.car-model {
margin: 0 toRpx(48);
.brand-name {
color: #333333;
font-size: toRpx(32);
line-height: toRpx(44);
margin: toRpx(16) 0;
}
.sub-brand-name {
color: #888888;
font-size: toRpx(28);
line-height: toRpx(40);
width: 100%;
flex-shrink: 0;
border-bottom: toRpx(2) solid #888;
}
}
}
.brand-list {
// display: grid;
// grid-template-columns: repeat(4, 1fr);
display: flex;
// gap: toRpx(32) 0;
flex-wrap: wrap;
.subtitle {
width: 100%;
flex-shrink: 0;
}
.subtitle-one {
margin: toRpx(10) 0;
}
.subtitle-two {
color: #000;
font-size: toRpx(36);
font-weight: 500;
}
.sub-item {
width: 100%;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
display: flex;
flex-wrap: wrap;
gap: toRpx(32);
margin-top: toRpx(20);
align-items: stretch;
}
.item {
width: calc((100% - #{toRpx(96)}) / 4);
justify-content: center;
min-height: toRpx(72);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
padding: toRpx(10);
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
}
.block {
width: 100%;
height: toRpx(24);
}
<template>
<view class="car-model-box">
<!-- :key="viewKey" -->
<scroll-view
class="scroll-view"
scroll-y
:scroll-into-view="letter"
>
<template v-if="listData.length">
<template v-for="(i, index) in listData">
<view
class="item-box"
:key="index"
:id="i.letter"
>
<view class="letter-title flex">{{i.letter}}</view>
<template v-for="(c,cindex) in i.list">
<view
class="car-model"
:key="cindex"
>
<view class="brand-name">{{c.name}}</view>
<view class="brand-list">
<template v-for="(j, jindex) in c.childs_list">
<view
:key="jindex"
:class="['sub-brand-name',{'hide-border':j.children && j.children.length && j.open}]"
>
<view
class="subtitle subtitle-one flex"
@click.stop="chooseSubBrand(j, c , jindex, cindex, index)"
>
{{j.name}}
<uni-icons
:type="`${j.children && j.children.length && j.open ?'down':'right'}`"
size="18"
></uni-icons>
</view>
</view>
<template v-for="(k,kindex) in j.children">
<view
:class="['sub-item flex',{'last':kindex == j.children.length-1}, {hide:!j.open}]"
:key="`${k.id}_${kindex}`"
>
<view
:class="['subtitle subtitle-two flex']"
@click.stop="chooseSeries(k,jindex, cindex, index ,kindex)"
>
{{k.name}}
<uni-icons
:type="`${k.children && k.children.length && k.open ?'down':'right'}`"
size="18"
></uni-icons>
</view>
<template v-for="(s,sindex) in k.children">
<view
:class="['item flex',{active: checkActive(s)}]"
:key="`${s.id}_${sindex}`"
@click.stop="chooseCarType(s,c)"
v-if="k.open"
>
{{s.name}}
<view class="sprite-icon icon-tag-checked"></view>
</view>
</template>
</view>
</template>
</template>
</view>
</view>
</template>
</view>
</template>
<view class="block"></view>
</template>
</scroll-view>
<view class="letter-list">
<template v-for="(i, index) in listData">
<view
class="letter-item"
:key="index"
@click="letter = i.letter"
>
{{i.letter}}
</view>
</template>
</view>
<view class="right-box">
</view>
</view>
</template>
<script type='text/ecmascript-6'>
import popupmixin from './popupmixin'
export default {
mixins: [popupmixin],
name: 'CarBrand',
data () {
return {
letter: 'A',
}
},
mounted () {
},
methods: {
async getList (searchValue) {
const { userInfo, params } = this,
{ cacheData } = params
this.currentId = ''
if (cacheData && cacheData.length) {
this.initData(cacheData)
if (searchValue) this.handleSearch(searchValue)
return
}
const data = await uni.$api.popupApi.getCarBrandList()
this.updateParams(params, data || [])
},
initData (carData) {
let { params: { idKey }, data: { customer, carInfo }, sceneType } = this,
letterList = Array.from(new Set([...carData.map((e) => e.letter)])),
carModelList = letterList.map(e => {
let list = []
carData.map(i => {
if (e === i.letter) {
i.childs_list = i.childs;
list.push(i)
}
})
return {
letter: e,
list,
}
})
this.list = carModelList
this.$emit('onComplete')
},
handleSearch (searchValue) {
if (!searchValue) {
this.searchStatus = false
this.letter = 'A'
} else {
searchValue = searchValue.toUpperCase()
let { list } = this,
carBrand = JSON.parse(JSON.stringify(list))
let arr = [];
carBrand.map(c => {
c.list.map(i => {
let childs_list = [],
i_name = i.name.toUpperCase()
i.childs_list.map((k) => {
let k_name = k.name.toUpperCase()
if (k_name.indexOf(searchValue) != -1) {
childs_list.push(k);
}
});
if (i_name.indexOf(searchValue) != -1 || childs_list.length > 0) {
i.childs_list = childs_list.length > 0 ? childs_list : i.childs_list;
arr.push(i);
}
})
})
let letterList = Array.from(new Set([...arr.map((e) => e.letter)]));
let searchList = letterList.map((l) => {
let _list = [];
arr.map((i) => {
if (l === i.letter) {
_list.push(i);
}
})
return {
letter: l,
list: _list,
}
})
this.searchList = searchList
this.searchStatus = true
}
},
async chooseSubBrand (that, item, jindex, cindex, index) {
if (that.children && that.children.length) {
this.$set(this.listData[index].list[cindex].childs_list[jindex], 'open', !that.open)
return
}
uni.showLoading({
mask: true
})
const data = await uni.$api.popupApi.getCarSeriesList({
brandId: item.id,
childBrandId: that.id
})
// this.listData[index].list[cindex].childs_list[jindex].children = data
this.$set(this.listData[index].list[cindex].childs_list[jindex], 'children', data)
this.$set(this.listData[index].list[cindex].childs_list[jindex], 'open', true)
setTimeout(() => {
uni.hideLoading()
}, 200)
// this.viewKey = Date.now()
},
async chooseSeries (k, jindex, cindex, index, kindex) {
if (k.children && k.children.length) {
this.$set(this.listData[index].list[cindex].childs_list[jindex].children[kindex], 'open', !k.open)
return
}
uni.showLoading({
mask: true
})
const data = await uni.$api.popupApi.getCarTypeList({
carSeriesId: k.id
})
// this.listData[index].list[cindex].childs_list[jindex].children[kindex].children = data
this.$set(this.listData[index].list[cindex].childs_list[jindex].children[kindex], 'children', data)
this.$set(this.listData[index].list[cindex].childs_list[jindex].children[kindex], 'open', true)
setTimeout(() => {
uni.hideLoading()
}, 200)
// this.viewKey = Date.now()
},
chooseCarType (s, c) {
let chooseItem = {
vehicleBrandId: c.id,
vehicleBrandName: c.name,
vehicleSubBrandId: s.brandId,
vehicleSubBrandName: s.brandName,
vehicleSeriesId: s.seriesId,
vehicleSeriesName: s.seriesName,
vehicleShapeId: s.id,
vehicleShapeName: s.name
}
this.currentId = s.id
this.$emit('choose', chooseItem)
},
checkActive (j) {
let { currentId, data, params } = this
return currentId ?
j.id == currentId : j.id == data[params.idKey]
},
}
}
</script>
<style scoped lang='scss'>
.car-model-box {
position: relative;
height: 100%;
width: 100%;
.scroll-view {
height: 100%;
}
.letter-list {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 0;
color: #888888;
font-size: toRpx(28);
line-height: toRpx(28);
padding: 0 toRpx(18);
text-align: center;
}
.item-box {
margin-bottom: toRpx(32);
.letter-title {
color: #888888;
font-size: toRpx(28);
height: toRpx(40);
background: #f5f7fa;
padding-left: toRpx(48);
}
.car-model {
margin: 0 toRpx(48);
.brand-name {
color: #333333;
font-size: toRpx(44);
line-height: toRpx(54);
margin: toRpx(24) 0;
}
.sub-brand-name {
color: #888888;
font-size: toRpx(34);
line-height: toRpx(44);
width: 100%;
flex-shrink: 0;
border-bottom: toRpx(2) solid #eee;
}
.hide-border {
border-bottom: none;
}
}
}
.brand-list {
// display: grid;
// grid-template-columns: repeat(4, 1fr);
display: flex;
// gap: toRpx(32) 0;
flex-wrap: wrap;
.subtitle {
width: 100%;
flex-shrink: 0;
}
.subtitle-one {
margin: toRpx(30) 0;
}
.subtitle-two {
color: #000;
font-size: toRpx(32);
font-weight: 500;
}
.last {
border-bottom: toRpx(2) solid #dce0e6;
padding-bottom: toRpx(40);
}
.hide {
visibility: hidden;
height: 0;
padding-bottom: 0;
}
.sub-item {
width: 100%;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(28);
display: flex;
flex-wrap: wrap;
gap: toRpx(32);
line-height: toRpx(60);
align-items: stretch;
box-sizing: border-box;
}
.item {
width: calc((100% - #{toRpx(96)}) / 4);
justify-content: center;
min-height: toRpx(72);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(28);
padding: toRpx(10);
line-height: toRpx(40);
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
}
.block {
width: 100%;
height: toRpx(24);
}
</style>
\ No newline at end of file
/**
* popupType
* 0:销售顾问/录单员
* 1:交付专员
* 2:二级流量方
* 3:转化人员
* 4:车品牌
* 5: 礼券
* 6:前档
* 7:前侧窗玻璃
* 8:后侧窗玻璃
* 9:后档
* 10:天窗
* 11:套餐
* 12:其他精品
* 13:时间选择
* 14: 代保管人员
* 15: 商品类目
* 16: 年龄区间
* 17:所在城市
* 18: 座位数
* 19: 客户档案
* 20: 战败客户档案
* 21: 客户类型
* 22: 证件类型
* 23: 购车类型
* 24: 车辆使用性质
* 25: 选择品牌车系
* 26: 变速箱类型
* 27: 权益战败推荐人员
*/
const componentConfig = {
0: {
name: 'EmployeeList',
title: '销售顾问/录单员',
placeholder: '请输入姓名',
idKey: ['referrerId', 'userId'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
1: {
name: 'EmployeeList',
title: '交付专员',
placeholder: '请输入姓名',
nullTips: '请选择交付专员',
idKey: ['deliveryId', 'deliveryUserId'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
2: {
name: 'DiversionMerchant',
title: '二级流量方',
hideSearch: true,
idKey: 'subShopMerchantId',
cacheData: [],
loadComplete: false
},
3: {
name: 'EmployeeList',
title: '转化人员',
placeholder: '请输入姓名',
idKey: 'sellerUserId',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
4: {
name: 'CarModelList',
title: '选择车型',
placeholder: '查找',
idKey: 'carSeriesId',
nullTips: '请选择车型',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
5: {
name: 'CouponList',
title: '选择礼券',
placeholder: '查找',
idKey: 'customerCouponCode',
nullTips: '优惠券不能为空',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
6: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [1], //前档
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
7: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [2], // 前侧窗玻璃
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
8: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [3], // 后侧窗玻璃
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
9: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [4], // 后档
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
10: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [5, 6, 7], // 天窗
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
11: {
name: 'PackageList',
title: '选择套餐',
placeholder: '查找',
nullTips: '请勾选套餐',
idKey: 'packageCode',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
12: {
name: 'SkuGoodsList',
title: '选择商品',
nullTips: '请勾选商品',
placeholder: '查找',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
13: {
name: 'DateTime',
title: '选择时间',
hideSearch: true,
loadComplete: false
},
14: {
name: 'AgreementList',
title: '代保管人员',
placeholder: '请输入姓名',
idKey: 'id',
cacheData: [],
loadComplete: false,
hideSearch: true,
noData: false
},
15: {
name: 'GoodsCategory',
title: '选择商品类目',
hideSearch: true,
loadComplete: false
},
16: {
name: 'AgeRange',
title: '年龄区间',
nullTips: '请选择年龄区间',
idKey: 'ageRange',
hideSearch: true,
loadComplete: false
},
17: {
name: 'City',
title: '所在城市',
hideSearch: true,
loadComplete: false,
nullTips: '请选择所在城市',
cacheData: [],
noData: false,
idKeys: ['provinceText', 'cityText']
},
18: {
name: 'Seat',
title: '座位数',
nullTips: '请选择座位数',
idKey: 'seat',
hideSearch: true,
loadComplete: false
},
19: {
name: 'Customer',
title: '客户档案',
loadComplete: false,
placeholder: '查找',
nullTips: '请选择客户',
idKey: 'customerId',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
20: {
name: 'Customer',
title: '客户档案',
loadComplete: false,
placeholder: '查找',
nullTips: '请选择客户',
idKey: 'id',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false,
defeat: true
},
21: {
name: 'Options',
title: '客户类型',
nullTips: '请选择客户类型',
idKey: 'customerType',
hideSearch: true,
loadComplete: false,
options: [
{
optionId: 1,
optionLabel: '个人'
},
{
optionId: 2,
optionLabel: '企业'
},
{
optionId: 3,
optionLabel: '个人(港澳)'
},
{
optionId: 4,
optionLabel: '个人(台)'
},
{
optionId: 5,
optionLabel: '个人(军官)'
}
]
},
22: {
name: 'Options',
title: '证件类型',
nullTips: '请选择证件类型',
idKey: 'cardType',
hideSearch: true,
loadComplete: false,
options: [
{
optionId: 1,
optionLabel: '身份证'
},
{
optionId: 2,
optionLabel: '统一社会信息代码'
},
{
optionId: 3,
optionLabel: '港澳返乡证'
},
{
optionId: 4,
optionLabel: '台胞证'
},
{
optionId: 5,
optionLabel: '军官证'
},
{
optionId: 7,
optionLabel: '护照'
}
]
},
23: {
name: 'Options',
title: '购车类型',
nullTips: '请选择购车类型',
idKey: 'buyCarType',
hideSearch: true,
loadComplete: false,
options: [
{
optionId: 0,
optionLabel: '贷款车'
},
{
optionId: 1,
optionLabel: '全款车'
}
]
},
24: {
name: 'Options',
title: '车辆使用性质',
nullTips: '请选择车辆使用性质',
idKey: 'vehicleNature',
hideSearch: true,
loadComplete: false,
options: [
{
optionId: 0,
optionLabel: '营运'
},
{
optionId: 1,
optionLabel: '非营运'
}
]
},
25: {
name: 'CarBrand',
title: '选择品牌车系',
placeholder: '查找',
idKey: 'vehicleShapeId',
nullTips: '请选择品牌车系',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false,
hideSearch: true,
popupStyle: 'height:90vh;'
},
26: {
name: 'Gearbox',
title: '变速箱类型',
nullTips: '请选择变速箱类型',
idKey: 'gearbox',
hideSearch: true,
loadComplete: false
},
27: {
name: 'EmployeeList',
title: '销售顾问/录单员',
placeholder: '请输入姓名',
idKey: ['referrerId', 'userId'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false,
defeat: true
}
}
export default { componentConfig }
/**
* popupType
* 0:销售顾问/录单员
* 1:交付专员
* 2:二级流量方
* 3:转化人员
* 4:车品牌
* 5: 礼券
* 6:前档
* 7:前侧窗玻璃
* 8:后侧窗玻璃
* 9:后档
* 10:天窗
* 11:套餐
* 12:其他精品
* 13:时间选择
* 14: 代保管人员
* 15: 商品类目
* 16: 年龄区间
* 17:所在城市
* 18: 座位数
* 19: 客户档案
* 20: 战败客户档案
* 21: 客户类型
* 22: 证件类型
* 23: 购车类型
* 24: 车辆使用性质
* 25: 选择品牌车系
* 26: 变速箱类型
* 27: 权益战败推荐人员
*/
const componentConfig = {
0: {
name: 'EmployeeList',
title: '销售顾问/录单员',
placeholder: '请输入姓名',
idKey: ['referrerId', 'userId'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
1: {
name: 'EmployeeList',
title: '交付专员',
placeholder: '请输入姓名',
nullTips: '请选择交付专员',
idKey: ['deliveryId', 'deliveryUserId'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
2: {
name: 'DiversionMerchant',
title: '二级流量方',
hideSearch: true,
idKey: 'subShopMerchantId',
cacheData: [],
loadComplete: false
},
3: {
name: 'EmployeeList',
title: '转化人员',
placeholder: '请输入姓名',
idKey: 'sellerUserId',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
4: {
name: 'CarModelList',
title: '选择车型',
placeholder: '查找',
idKey: 'carSeriesId',
nullTips: '请选择车型',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
5: {
name: 'CouponList',
title: '选择礼券',
placeholder: '查找',
idKey: 'customerCouponCode',
nullTips: '优惠券不能为空',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
6: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [1], //前档
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
7: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [2], // 前侧窗玻璃
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
8: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [3], // 后侧窗玻璃
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
9: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [4], // 后档
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
10: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
nullTips: '请勾选商品',
goodsType: [5, 6, 7], // 天窗
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
11: {
name: 'PackageList',
title: '选择套餐',
placeholder: '查找',
nullTips: '请勾选套餐',
idKey: 'packageCode',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
12: {
name: 'SkuGoodsList',
title: '选择商品',
nullTips: '请勾选商品',
placeholder: '查找',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
13: {
name: 'DateTime',
title: '选择时间',
hideSearch: true,
loadComplete: false
},
14: {
name: 'AgreementList',
title: '代保管人员',
placeholder: '请输入姓名',
idKey: 'id',
cacheData: [],
loadComplete: false,
hideSearch: true,
noData: false
},
15: {
name: 'GoodsCategory',
title: '选择商品类目',
hideSearch: true,
loadComplete: false
},
16: {
name: 'AgeRange',
title: '年龄区间',
nullTips: '请选择年龄区间',
idKey: 'ageRange',
hideSearch: true,
loadComplete: false
},
17: {
name: 'City',
title: '所在城市',
hideSearch: true,
loadComplete: false,
nullTips: '请选择所在城市',
cacheData: [],
noData: false,
idKeys: ['provinceText', 'cityText']
},
18: {
name: 'Seat',
title: '座位数',
nullTips: '请选择座位数',
idKey: 'seat',
hideSearch: true,
loadComplete: false
},
19: {
name: 'Customer',
title: '客户档案',
loadComplete: false,
placeholder: '查找',
nullTips: '请选择客户',
idKey: 'customerId',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
20: {
name: 'Customer',
title: '客户档案',
loadComplete: false,
placeholder: '查找',
nullTips: '请选择客户',
idKey: 'id',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false,
defeat: true
},
21: {
name: 'Options',
title: '客户类型',
nullTips: '请选择客户类型',
idKey: 'customerType',
hideSearch: true,
loadComplete: false,
options: [
{
optionId: 1,
optionLabel: '个人'
},
{
optionId: 2,
optionLabel: '企业'
},
{
optionId: 3,
optionLabel: '个人(港澳)'
},
{
optionId: 4,
optionLabel: '个人(台)'
},
{
optionId: 5,
optionLabel: '个人(军官)'
}
]
},
22: {
name: 'Options',
title: '证件类型',
nullTips: '请选择证件类型',
idKey: 'cardType',
hideSearch: true,
loadComplete: false,
options: [
{
optionId: 1,
optionLabel: '身份证'
},
{
optionId: 2,
optionLabel: '统一社会信息代码'
},
{
optionId: 3,
optionLabel: '港澳返乡证'
},
{
optionId: 4,
optionLabel: '台胞证'
},
{
optionId: 5,
optionLabel: '军官证'
},
{
optionId: 7,
optionLabel: '护照'
}
]
},
23: {
name: 'Options',
title: '购车类型',
nullTips: '请选择购车类型',
idKey: 'buyCarType',
hideSearch: true,
loadComplete: false,
options: [
{
optionId: 0,
optionLabel: '贷款车'
},
{
optionId: 1,
optionLabel: '全款车'
}
]
},
24: {
name: 'Options',
title: '车辆使用性质',
nullTips: '请选择车辆使用性质',
idKey: 'vehicleNature',
hideSearch: true,
loadComplete: false,
options: [
{
optionId: 0,
optionLabel: '营运'
},
{
optionId: 1,
optionLabel: '非营运'
}
]
},
25: {
name: 'CarBrand',
title: '选择品牌车系',
placeholder: '查找',
idKey: 'vehicleShapeId',
nullTips: '请选择品牌车系',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false,
hideSearch: true,
popupStyle: 'height:90vh;'
},
26: {
name: 'Gearbox',
title: '变速箱类型',
nullTips: '请选择变速箱类型',
idKey: 'gearbox',
hideSearch: true,
loadComplete: false
},
27: {
name: 'EmployeeList',
title: '销售顾问/录单员',
placeholder: '请输入姓名',
idKey: ['referrerId', 'userId'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false,
defeat: true
}
}
export default { componentConfig }
......@@ -79,43 +79,7 @@ export default {
moduleIconEnum,
moduleContentEnum,
topList: [],
msgList: [
{
moduleType: 3,
title: '请在06-dfasd',
createdTime: new Date().getTime(),
count: null,
strdate: '2025-06-11'
},
{
moduleType: 4,
title: '请在06-csaf ',
createdTime: new Date().getTime(),
count: 698,
strdate: '2025-06-11'
},
{
moduleType: 0,
title: '#这是通知标题##这是通知标题##这是通知标题##这是通知标题##这是通知标题#',
createdTime: new Date().getTime(),
count: 6,
strdate: '2025-06-11'
},
{
moduleType: 2,
title: 'dfs',
createdTime: new Date().getTime(),
count: 99,
strdate: '2025-06-12'
},
{
moduleType: 1,
title: 'df ',
createdTime: new Date().getTime(),
count: 99,
strdate: '2025-06-12'
}
]
msgList: []
}
},
watch: {
......@@ -138,10 +102,6 @@ export default {
// 过滤出topList中包含moduleType的对象
const result = this.msgList.filter(item => this.topList.includes(item.moduleType));
return result
// // 按topList中的倒序排列
// return this.topList.slice().reverse().map(type =>
// this.msgList.find(item => item.moduleType === type)
// ).filter(Boolean);
},
getList() {
// 过滤掉topList中包含moduleType的对象
......@@ -183,9 +143,6 @@ export default {
},
handleClick(item) {
this.$emit('handleClick', item)
// uni.navigateTo({
// url: `/pages/common/serviceDetail/index?moduleType=${moduleType}`
// })
}
}
}
......
......@@ -60,7 +60,7 @@ export default {
nothing: false,
total: 0,
pageNum: 1,
pageSize: 12,
pageSize: 16,
scrollTop: 0,
COURSE_TYPE
}
......@@ -137,11 +137,13 @@ export default {
</script>
<style lang="scss" scoped>
.completed-course {
height: calc(100% - #{toRpx(100)});
// height: calc(100% - #{toRpx(100)});
height: 100%;
.scroll-view {
margin-top: toRpx(40);
height: calc(100% - #{toRpx(70)});
// height: calc(100% - #{toRpx(50)});
height: 100%;
.completed-course-list {
display: grid;
......
......@@ -105,8 +105,6 @@ export default {
if(currentWebview){
currentWebview.close()
}
// 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'courseDetail', type: 'getLevelExamInfo'})
uni.navigateBack()
},
async openCourse(index, item) {
......
......@@ -95,8 +95,6 @@ export default {
},
methods: {
back() {
// 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'leaderboard', type: 'getLevelExamInfo'})
uni.navigateBack()
},
switchTab(index) {
......
......@@ -74,8 +74,6 @@ export default {
},
methods: {
back() {
// 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'myCourse', type: 'getLevelExamInfo'})
uni.navigateBack()
},
switchTab(index) {
......@@ -125,6 +123,7 @@ export default {
position: relative;
z-index: 10;
background: transparent;
height: toRpx(140);
.nav-bar {
display: flex;
......@@ -157,7 +156,7 @@ export default {
display: flex;
align-items: center;
padding: 0 toRpx(64);
margin-top: toRpx(52);
// margin-top: toRpx(52);
.tab-item {
width: toRpx(208);
height: toRpx(72);
......
......@@ -51,7 +51,7 @@ export default {
},
created() {
// 在组件创建时就开始监听,确保事件能被捕获
uni.$on('showStudyPopup', () => {
uni.$on('afterStudyPopup', () => {
console.log('接收到考试提交弹窗事件')
if (this.currentTab === 1) {
this.$refs.failedExam.showExamPopup = true
......@@ -62,15 +62,13 @@ export default {
},
beforeDestroy() {
// 组件销毁前移除监听
uni.$off('showStudyPopup')
uni.$off('afterStudyPopup')
},
mounted() {
this.getExamStatistics()
},
methods: {
back() {
// 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'myExam', type: 'getLevelExamInfo'})
uni.navigateBack()
},
switchTab(index) {
......@@ -97,7 +95,7 @@ export default {
background-image: url('@/assets/images/common/page-bg.webp');
background-size: 100%;
box-sizing: border-box;
padding-top: toRpx(112);
padding-top: toRpx(156);
}
.nav-bar {
......@@ -132,7 +130,7 @@ export default {
.tab-container {
display: flex;
align-items: center;
margin-top: toRpx(44);
// margin-top: toRpx(44);
margin-bottom: toRpx(28);
padding: 0 toRpx(64);
.tab-item {
......
......@@ -123,8 +123,6 @@
},
methods: {
back() {
// 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'myTask', type: 'getLevelExamInfo'})
uni.navigateBack()
},
goToMyTask() {
......
......@@ -37,6 +37,7 @@ export default {
return {
webviewUrl: '',
pageTitle: '学习测评',
type: null,
wv: null,
hotArea: null, // 存储热区对象
showLoading: true // 控制 loading 显示
......@@ -50,6 +51,9 @@ export default {
// 和 detail.vue 一样,直接使用 URL,不需要 decode
this.webviewUrl = options.url
}
if (options.type) {
this.type = options.type
}
console.log('📱 学习中心 webview 接收到的 URL (直接使用):', this.webviewUrl)
// 提取并解码 return_url 部分以便查看
......@@ -91,13 +95,6 @@ export default {
this.hotArea = null
}
},
onBackPress (options) {
if (options.from === 'backbutton') {
this.back()
return true
}
return false
},
onBackPress(options) {
if (options.from === 'backbutton') {
// 阻止默认返回
......@@ -160,16 +157,24 @@ export default {
},
back () {
console.log('触发返回,发送事件')
const {type } = this
console.log(type, 'type')
// 先返回上一页
uni.navigateBack({
success: () => {
console.log('返回成功,触发弹窗事件')
uni.$logger.local.info('返回成功,触发弹窗事件', type)
// 延迟触发事件,确保页面已经返回
setTimeout(() => {
if (type == 0) {
uni.$emit('levelStudyPopup')
} else if (type == 1) {
uni.$emit('afterStudyPopup')
}
// uni.$emit('showExamSubmitPopup')
uni.$emit('showStudyPopup', {
type: 'examSubmit'
})
// uni.$emit('showStudyPopup', {
// type: 'examSubmit'
// })
}, 100)
}
})
......
<template>
<view class="equity-box">
<view class="common-title">服务信息录入</view>
<template v-if="loadComplete">
<view class="box">
<scroll-view
scroll-y
class="scroll-view"
>
<view
class="box-content"
:key="viewKey"
>
<GlCell
:formList="formList"
:formData="orderObj"
@inputBlur="inputBlur"
@handleCell="handleCell"
:titleList="titleList"
@collapseAll="collapseAll"
collapseControl
@radioChange="radioChange"
>
<template #goodsHtml>
<EquityGoods
:externalData="orderObj"
ref="goodsRef"
/>
</template>
<template #tireHtml>
<template v-if="orderObj.tireFlag == 1">
<EquityTire
:externalData="orderObj"
ref="tireRef"
/>
</template>
</template>
<template #uploadHtml>
<EquityUpload
:externalData="orderObj"
ref="uplopdRef"
/>
</template>
<template #conversion>
<template v-if="orderObj.inclueType == 1">
<EquityConversion
:externalData="orderObj"
ref="conversionRef"
/>
</template>
</template>
</GlCell>
</view>
<view class="btns flex">
<view
class="btn save"
@click="submit(0)"
>存草稿</view>
<view
@click="submit(1)"
class="btn"
>确认提交</view>
</view>
</scroll-view>
</view>
</template>
<order-popup
ref="orderPopup"
:data="orderObj"
@onConfirm="onConfirm"
:popupType="popupType"
/>
<uni-calendar
ref="calendar"
:insert="false"
:clearDate="false"
:endDate="endDate"
@confirm="confirmCalendar($event,'billingDate')"
:date="orderObj.billingDate"
showBottomBtn
/>
<uni-calendar
ref="futureCalendar"
:insert="false"
:clearDate="false"
:startDate="endDate"
@confirm="confirmCalendar($event,'effectiveDate')"
:date="orderObj.effectiveDate"
showBottomBtn
/>
<NoticePopup
ref="reportNotice"
:title="noticeObj.title"
:text="noticeObj.text"
:type="noticeObj.type || 'success'"
:buttons="noticeObj.buttons"
></NoticePopup>
</view>
</template>
<script type='text/ecmascript-6'>
import utils from '@/utils/utils'
import {
EQUITY_FORM_LIST
, EQUITY_FORM_TITLE_LIST,
EQUITY_POPUP_ENUM,
tireObjList,
EQUITY_FORM_RULE,
energyFormRule,
oilFormRule,
extendServiceFormRule
} from '../contant'
import GlCell from '@/components/Form/GlCell.vue'
import OrderPopup from '@/components/OrderPopup/index.vue'
import dayjs from 'dayjs'
import EquityGoods from './EquityForm/EquityGoods.vue'
import EquityTire from './EquityForm/EquityTire.vue'
import EquityUpload from './EquityForm/EquityUpload.vue'
import EquityConversion from './EquityForm/EquityConversion.vue'
import NP from 'number-precision'
import NoticePopup from '@/components/NoticePopup.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const codeToAttr = {
YB0001: 'invoice',
YB0003: 'driveFront',
YB0004: 'driveBack',
YB0002: 'contract',
YB0005: 'other',
QS0001: 'retrofitInvoice',
QS0002: 'retrofit'
},
attrToCode = {
invoice: 'YB0001',
driveFront: 'YB0003',
driveBack: 'YB0004',
contract: 'YB0002',
other: 'YB0005',
retrofitInvoice: 'QS0001',
retrofit: 'QS0002'
},
ybAttachmentFlagTips = {
YB0001: '购车发票',
YB0003: '行驶证主页',
YB0004: '行驶证副页',
YB0002: '合同购买时里程数',
YB0005: '其他',
},
qsFlagTips = {
QS0001: '发票或收据',
QS0002: '加改装部位'
}
export default {
name: 'CreateEquity',
components: {
GlCell,
OrderPopup,
EquityGoods,
EquityTire,
EquityUpload,
EquityConversion,
NoticePopup
},
props: {
transmissionOfData: {
type: Object,
default: () => null
}
},
data () {
return {
formList: utils.deepClone(EQUITY_FORM_LIST),
titleList: utils.deepClone(EQUITY_FORM_TITLE_LIST),
endDate: dayjs().format('YYYY-MM-DD'),
equityFormRule: utils.deepClone(EQUITY_FORM_RULE),
orderObj: {},
loadComplete: false,
popupType: 0,
viewKey: Date.now(),
conSecondObj: {
vin: ''
},
noticeObj: {},
validateState: true
}
},
watch: {
transmissionOfData: {
handler (val) {
if (val && val.contractNo) this.getServiceInfoDetail({
contractNo: val.contractNo
}, 1)
if (val && val.orderId) this.getServiceInfoDetail({
orderId: val.orderId
}, 2)
},
deep: true,
immediate: true
}
},
computed: {
orderPopupRef () {
return this.$refs.orderPopup
}
},
mounted () {
},
methods: {
// 车架号动态校验
validateVin () {
let carVinVal = this.orderObj.vin;
if (carVinVal) {
this.orderObj.carVin = formatVinInput(carVinVal)
validateVin(this.orderObj.carVin).then(result => {
console.log("validateVin", result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr", result);
})
}
},
// 单选框change事件
radioChange (e, val) {
this.$set(this.orderObj, val.value, e.detail.value)
this.formList.map(k => {
k.map(i => {
if (i.value == val.value) i.current = e.detail.value
})
})
this.viewKey = Date.now()
},
handleCell (val) {
if (['calendar', 'futureCalendar'].includes(val.key)) return this.$refs[val.key]?.open()
this.popupType = Object.keys(EQUITY_POPUP_ENUM).find(key => EQUITY_POPUP_ENUM[key].key === val.key) * 1
this.orderPopupRef.open()
},
onConfirm (val) {
const { chooseContent, popupType } = val,
_typeValue = EQUITY_POPUP_ENUM[popupType]
if (_typeValue.key == 'carBrand') {
Object.assign(this.orderObj, chooseContent)
this.$set(this.orderObj, 'carBrandText',
`${chooseContent.vehicleBrandName}/${chooseContent.vehicleSubBrandName}/${chooseContent.vehicleSeriesName}/${chooseContent.vehicleShapeName}`)
this.viewKey = Date.now()
return
} else if (_typeValue.options) {
this.$set(this.orderObj, _typeValue.targetIdKey, chooseContent[_typeValue.sourceIdKey || 'optionId'])
this.$set(this.orderObj, _typeValue.targetNameKey, chooseContent[_typeValue.sourceNameKey || 'optionLabel'])
this.viewKey = Date.now()
return
}
this.$set(this.orderObj, _typeValue.value, chooseContent)
this.viewKey = Date.now()
},
inputBlur (e, val) {
this.orderObj[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
if (val.value === 'vin') this.validateVin()
},
async getServiceInfoDetail (paramSdata, type) {
try {
uni.showLoading({
title: '加载中...',
mask: true
})
let targetApi = type == 1 ? 'getServiceInfoDetail' : 'getEquityOrderByOrderId'
const data = await uni.$api.equityApi[targetApi](paramSdata)
if (!data) throw '获取数据失败'
if (data.ybAttachmentFlag != 0) this.formList[3] = []
if (data.qsFlag != 1) this.formList[4] = []
this.orderObj.goodInfoList = data.goodInfoList
this.orderObj.tireFlag = data.tireFlag
let carInfo = {},
params = {}
if (data.vehicleShapeId) {
carInfo = {
carBrandText: `${data.vehicleBrandName}/${data.vehicleSubBrandName}/${data.vehicleSeriesName}/${data.vehicleShapeName}`,
vehicleShapeId: data.vehicleShapeId,
vehicleShapeName: data.vehicleShapeName,
vehicleSeriesId: data.vehicleSeriesId,
vehicleSeriesName: data.vehicleSeriesName,
vehicleBrandId: data.vehicleBrandId,
vehicleBrandName: data.vehicleBrandName,
vehicleSubBrandId: data.vehicleSubBrandId,
vehicleSubBrandName: data.vehicleSubBrandName,
}
}
if (!data.customerType) data.customerType = 1
if (data.customerType) {
const customerTypeEnum = this.orderPopupRef.componentObject[21].options
params = {
customerType: data.customerType,
customerTypeName: customerTypeEnum.find(i => i.optionId == data.customerType).optionLabel
}
}
if (data.cardType) {
const cardTypeEnum = this.orderPopupRef.componentObject[22].options
params.cardType = data.cardType
params.cardTypeName = cardTypeEnum.find(i => i.optionId == data.cardType).optionLabel
}
if (data.buyCarType == null) data.buyCarType = 1
if (data.buyCarType != null) {
const buyCarTypeEnum = this.orderPopupRef.componentObject[23].options
params.buyCarType = data.buyCarType
params.buyCarTypeName = buyCarTypeEnum.find(i => i.optionId == data.buyCarType).optionLabel
}
let priceList = ['actualSalesPrice']
data.goodInfoList.map((item, idx) => {
if (item.actualSalesPrice) item.actualSalesPrice = NP.divide(Number(item.actualSalesPrice), 100).toFixed(2)
// priceList.forEach(k => {
// data.goodInfoList[idx][k] = item[k] === null ? null : (item[k] / 100).toFixed(2)
// })
if (item.vehicleRegistrationDate) {
item.vehicleRegistrationDate = dayjs(item.vehicleRegistrationDate).format('YYYY-MM-DD')
}
if (item.buyDate) {
item.buyDate = dayjs(item.buyDate).format('YYYY-MM-DD')
}
if (item.qualityBeginDate) {
item.qualityBeginDate = dayjs(item.qualityBeginDate).format('YYYY-MM-DD')
}
if (item.itemsCode == 'YB0003') {
item.gearbox = item.gearbox || ''
item.vehicleNature = typeof item.vehicleNature == 'number' ? item.vehicleNature : 1
let val = constantData.vehicleNatureList.find(k => k.optionId == item.vehicleNature)
if (val) {
item.vehicleNatureName = val.optionLabel
}
}
if (item.printType == 2 && !['YB0001', 'YB0002', 'YB0003'].includes(item.itemsCode)) item.displacementPowerFlag = item.displacementPowerFlag || 0
})
// 判断购买商品是否全部是延保allWarrantyFlag
const allWarrantyFlag = data?.goodInfoList?.some(v => v.printType != 2),
imgObj = {}
Object.keys(codeToAttr).map(key => {
if (codeToAttr[key] == 'other') imgObj[codeToAttr[key]] = []
else imgObj[codeToAttr[key]] = ''
})
this.formList.map(i => {
i.map(e => {
if (e.value == 'effectiveDate') e.hidden = !allWarrantyFlag //false 显示生效日期 true不显示
})
})
/**图片 */
if ((data.ybAttachmentFlag == 0 || data.qsFlag == 1) && data.attachmentList?.length) {
data.attachmentList.forEach(item => {
if (item.attachmentCode == 'YB0005') imgObj[codeToAttr[item.attachmentCode]].push(item.attachmentFile)
else imgObj[codeToAttr[item.attachmentCode]] = item.attachmentFile
})
}
if (data.tireFlag == 0) {
const list = ['tireBrand', 'tireScale', 'leftFrontDTO', 'leftFrontBatch', 'rightFrontDTO', 'rightFrontBatch', 'leftRearDTO', 'leftRearBatch', 'rightRearDTO', 'rightRearBatch']
list.map(key => {
this.equityFormRule[key][0].required = false
})
}
/**轮胎 */
if (data.attributeList?.length) {
data.attributeList.map((e, idx) => {
if (e.attributeValue) data[tireObjList[idx].attr] = e.attributeValue
})
}
let inclueType = data.addOnsFlag == 0 ? 2 : 1
Object.assign(this.orderObj, {
...data,
vin: data.vin,
invoicePrice: NP.divide(Number(data.invoicePrice || 0), 100).toFixed(2),
seatesNum: data.seatesNum,
seat: data.seatesNum,
engineNo: data.engineNo,
vehicleColor: data.vehicleColor,
billingDate: data.billingDate ? dayjs(data.billingDate).format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD'),
customerName: data.customerName,
customerPhone: data.customerPhone,
cardNo: data.cardNo,
customerAddress: data.customerAddress,
goodInfoList: data.goodInfoList,
effectiveDate: data.effectiveDate ? dayjs(data.effectiveDate).format('YYYY-MM-DD') : dayjs().add(1, 'day').format('YYYY-MM-DD'),
tireFlag: data.tireFlag,
compensationName: data.compensationName || data.customerName,
attachmentList: data.attachmentList || [],
merchantName: data.merchantName,
merchantPhone: data.merchantPhone,
merchantAddress: data.merchantAddress,
imgObj,
inclueType,
...carInfo,
...params
})
this.formList[4].map(e => {
if (e.value == 'inclueType') e.current = inclueType
})
this.viewKey = Date.now()
this.loadComplete = true
uni.hideLoading()
} catch (error) {
uni.hideLoading()
this.viewKey = Date.now()
this.loadComplete = true
if (error) uni.showToast({
title: error,
icon: 'none'
})
}
},
collapseAll (index) {
this.titleList[index].collapseAll = !this.titleList[index].collapseAll
},
confirmCalendar (e, key) {
this.orderObj[key] = e.fulldate
this.viewKey = Date.now()
},
async submit (operationType) {
// VIN车架号-动态校验
const carVin = this.orderObj.vin
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({ title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)', icon: 'none' })
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({ title: '车架号校验不匹配,请核对后重新输入', icon: 'none' })
return false
}
}
uni.showLoading({
title: '提交中...',
mask: true
})
const { orderObj, conSecondObj } = this,
{ goodsRef, tireRef, uplopdRef, conversionRef } = this.$refs
let params = utils.deepClone(orderObj),
attachmentList = [],
attributeList = []
if (tireRef) {
let { tireObj } = tireRef
tireObjList.map(item => {
if (tireObj[item.attr]) {
attributeList.push({
attributeValue: tireObj[item.attr],
sort: item.sort,
attributeGroup: item.attributeGroup,
attributeName: item.attributeName
})
params[item.attr] = tireObj[item.attr]
}
})
params.attributeList = attributeList
params.tireBrand = tireObj.tireBrand
params.tireScale = tireObj.tireScale
}
if (goodsRef) {
let goodInfoList = utils.deepClone(goodsRef.goodInfoList)
goodInfoList.map(item => {
item.actualSalesPrice = NP.times(Number(item.actualSalesPrice), 100)
})
params.goodInfoList = goodInfoList
}
if (uplopdRef || conversionRef) {
let imgObj = {}
if (uplopdRef) imgObj = uplopdRef.imgObj
if (conversionRef && params.inclueType == 1) imgObj = {
...imgObj,
...conversionRef.imgObj
}
Object.keys(imgObj).map(key => {
if (Array.isArray(imgObj[key])) {
imgObj[key].map(item => {
attachmentList.push({
attachmentCode: attrToCode[key],
attachmentType: 'IMG',
attachmentFile: item
})
})
} else {
attachmentList.push({
attachmentCode: attrToCode[key],
attachmentType: 'IMG',
attachmentFile: imgObj[key]
})
}
})
}
params.invoicePrice = NP.times(Number(params.invoicePrice), 100)
params.attachmentList = attachmentList
if (operationType == 0) {
this.confirm(params, operationType)
return
}
if (!this.checkOrder(params)) return uni.hideLoading()
const { code, message } = await uni.$api.equityApi.checkVinBuyEquityOrder({
vin: orderObj.vin
})
if (code == 0) {
this.confirm(params, operationType)
} else if (code == '-2') {
if (conSecondObj.vin == orderObj.vin) {
this.confirm(params, operationType)
this.conSecondObj.vin = ''
} else {
this.conSecondObj.vin = orderObj.vin
this.openNotice(message, params)
}
} else this.openNotice(message, params)
},
checkOrder (params) {
let { equityFormRule } = this
try {
Object.keys(equityFormRule).map(key => {
let [nullCheck, validatorCheck] = equityFormRule[key]
if (nullCheck.required) {
if (!params[key]) throw equityFormRule[key][0].message
} else {
if (validatorCheck && validatorCheck.validator) {
const res = validatorCheck.validator('', params[key])
if (res && res.message) throw res.message
}
}
})
params.goodInfoList?.map(item => {
if (item.printType == 2) {
if (item.itemsCode == 'YB0003') Object.keys(oilFormRule).map(key => {
let [nullCheck, validatorCheck] = oilFormRule[key]
if (nullCheck.required) {
if (!item[key]) throw oilFormRule[key][0].message
else {
if (validatorCheck && validatorCheck.validator) {
const res = validatorCheck.validator('', item[key])
if (res && res.message) throw res.message
}
}
}
})
if (item.itemsCode == 'YB0001' || item.itemsCode == 'YB0002') Object.keys(energyFormRule).map(key => {
let [nullCheck, validatorCheck] = energyFormRule[key]
if (nullCheck.required) {
if (!item[key]) throw energyFormRule[key][0].message
} else {
if (validatorCheck && validatorCheck.validator) {
const res = validatorCheck.validator('', item[key])
if (res && res.message) throw res.message
}
}
})
if (item.itemsCode != 'YB0001' && item.itemsCode != 'YB0002' && item.itemsCode != 'YB0003') Object.keys(extendServiceFormRule).map(key => {
let [nullCheck, validatorCheck] = extendServiceFormRule[key]
if (nullCheck.required) {
if (!item[key]) throw extendServiceFormRule[key][0].message
} else {
if (validatorCheck && validatorCheck.validator) {
const res = validatorCheck.validator('', item[key])
if (res && res.message) throw res.message
}
}
})
}
})
if (params.ybAttachmentFlag == 0 || params.qsFlag == 1) {
if (params.ybAttachmentFlag == 0) {
params.attachmentList.map(e => {
let item = ybAttachmentFlagTips[e.attachmentCode]
if (e.attachmentCode != 'YB0005') {
if (!e.attachmentFile) throw `请上传${item}`
}
})
}
if (params.qsFlag == 0 && params.inclueType == 1) {
params.attachmentList.map(e => {
let item = qsFlagTips[e.attachmentCode]
if (!e.attachmentFile) throw `请上传${item}`
})
}
}
} catch (error) {
uni.showToast({
title: error,
icon: 'none'
})
return false
}
return true
},
async confirm (paramsData, operationType) {
try {
let params = utils.deepClone(paramsData)
this.$refs.reportNotice.close()
// 0草稿,1提单
params.operationType = operationType
params.addOnsFlag = params.inclueType == 2 ? 0 : 1
params.seatesNum = params.seat
delete params.imgObj
delete params.inclueType
delete params.seat
uni.showLoading({
mask: true
})
const { code, message } = await uni.$api.equityApi.addEquityOrder(params)
if (code == 0) {
if (operationType == 0) {
uni.hideLoading()
uni.showToast({
title: '保存成功',
icon: 'none',
mask: true
})
setTimeout(() => {
this.$emit('jump', 'EquityManagement')
}, 1500)
} else {
uni.showLoading({
mask: true
})
setTimeout(async () => {
// 从URL获取文件名
const getFileNameFromUrl = (url) => {
return url.split('/').pop().split('?')[0] || '未知文件'
}
const { contractNo } = params,
url = await uni.$api.equityApi.printContract({ contractNo }),
fileName = getFileNameFromUrl(url),
type = 3
if (!url) throw '获取合同失败'
this.noticeObj = {
title: '提单成功',
text: '提单合同支持分享或保存',
type: 'success',
buttons: [
{
text: '查看合同',
type: 'primary',
callback: _ => {
this.$refs.reportNotice.close()
this.$emit('jump', 'EquityManagement')
// 跳转到预览页面
uni.navigateTo({
url: `/pages/common/filePreview?fileUrl=${encodeURIComponent(url)}&fileType=${type}&fileName=${encodeURIComponent(fileName)}`
})
}
}
]
}
setTimeout(() => {
uni.hideLoading()
this.$refs.reportNotice.open()
}, 100)
}, 1500)
}
} else throw message
} catch (error) {
uni.hideLoading()
if (error) uni.showToast({
title: error,
icon: 'none'
})
}
},
openNotice (message, params) {
uni.hideLoading()
let title = '出单失败',
btnText = '重新提单',
callbackFun = () => { }
if (message.includes('该车架已经购买过')) {
title = '信息确认'
btnText = '继续出单'
callbackFun = () => {
this.confirm(params, 1)
}
}
this.noticeObj = {
title,
text: message,
type: 'warning',
buttons: [
{
text: btnText,
type: 'primary',
callback: callbackFun
}
]
}
this.$nextTick(() => this.$refs.reportNotice.open())
},
}
}
</script>
<style scoped lang='scss'>
.equity-box {
height: 100%;
position: relative;
.box {
height: calc(100% - #{toRpx(120)});
.scroll-view {
height: 100%;
}
&-content {
padding: 0 toRpx(48);
}
}
.customer-title {
.customer-file {
margin-left: toRpx(20);
color: #347bff;
font-size: toRpx(24);
.sprite-icon {
margin-right: toRpx(4);
}
}
}
.btns {
padding: toRpx(24) toRpx(128);
gap: toRpx(32);
.btn {
display: flex;
align-items: center;
justify-content: center;
width: toRpx(1130);
height: toRpx(80);
color: #fff;
border-radius: toRpx(48);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
.save {
background: #3b73ff1a;
color: #4673ff;
font-size: toRpx(28);
font-weight: 500;
}
}
}
<template>
<view class="equity-box">
<view class="common-title">服务信息录入</view>
<template v-if="loadComplete">
<view class="box">
<scroll-view
scroll-y
class="scroll-view"
>
<view
class="box-content"
:key="viewKey"
>
<GlCell
:formList="formList"
:formData="orderObj"
@inputBlur="inputBlur"
@handleCell="handleCell"
:titleList="titleList"
@collapseAll="collapseAll"
collapseControl
@radioChange="radioChange"
>
<template #goodsHtml>
<EquityGoods
:externalData="orderObj"
ref="goodsRef"
/>
</template>
<template #tireHtml>
<template v-if="orderObj.tireFlag == 1">
<EquityTire
:externalData="orderObj"
ref="tireRef"
/>
</template>
</template>
<template #uploadHtml>
<EquityUpload
:externalData="orderObj"
ref="uplopdRef"
/>
</template>
<template #conversion>
<template v-if="orderObj.inclueType == 1">
<EquityConversion
:externalData="orderObj"
ref="conversionRef"
/>
</template>
</template>
</GlCell>
</view>
<view class="btns flex">
<view
class="btn save"
@click="submit(0)"
>存草稿</view>
<view
@click="submit(1)"
class="btn"
>确认提交</view>
</view>
</scroll-view>
</view>
</template>
<order-popup
ref="orderPopup"
:data="orderObj"
@onConfirm="onConfirm"
:popupType="popupType"
/>
<uni-calendar
ref="calendar"
:insert="false"
:clearDate="false"
:endDate="endDate"
@confirm="confirmCalendar($event,'billingDate')"
:date="orderObj.billingDate"
showBottomBtn
/>
<uni-calendar
ref="futureCalendar"
:insert="false"
:clearDate="false"
:startDate="endDate"
@confirm="confirmCalendar($event,'effectiveDate')"
:date="orderObj.effectiveDate"
showBottomBtn
/>
<NoticePopup
ref="reportNotice"
:title="noticeObj.title"
:text="noticeObj.text"
:type="noticeObj.type || 'success'"
:buttons="noticeObj.buttons"
></NoticePopup>
</view>
</template>
<script type='text/ecmascript-6'>
import utils from '@/utils/utils'
import {
EQUITY_FORM_LIST
, EQUITY_FORM_TITLE_LIST,
EQUITY_POPUP_ENUM,
tireObjList,
EQUITY_FORM_RULE,
energyFormRule,
oilFormRule,
extendServiceFormRule
} from '../contant'
import GlCell from '@/components/Form/GlCell.vue'
import OrderPopup from '@/components/OrderPopup/index.vue'
import dayjs from 'dayjs'
import EquityGoods from './EquityForm/EquityGoods.vue'
import EquityTire from './EquityForm/EquityTire.vue'
import EquityUpload from './EquityForm/EquityUpload.vue'
import EquityConversion from './EquityForm/EquityConversion.vue'
import NP from 'number-precision'
import NoticePopup from '@/components/NoticePopup.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const codeToAttr = {
YB0001: 'invoice',
YB0003: 'driveFront',
YB0004: 'driveBack',
YB0002: 'contract',
YB0005: 'other',
QS0001: 'retrofitInvoice',
QS0002: 'retrofit'
},
attrToCode = {
invoice: 'YB0001',
driveFront: 'YB0003',
driveBack: 'YB0004',
contract: 'YB0002',
other: 'YB0005',
retrofitInvoice: 'QS0001',
retrofit: 'QS0002'
},
ybAttachmentFlagTips = {
YB0001: '购车发票',
YB0003: '行驶证主页',
YB0004: '行驶证副页',
YB0002: '合同购买时里程数',
YB0005: '其他',
},
qsFlagTips = {
QS0001: '发票或收据',
QS0002: '加改装部位'
}
export default {
name: 'CreateEquity',
components: {
GlCell,
OrderPopup,
EquityGoods,
EquityTire,
EquityUpload,
EquityConversion,
NoticePopup
},
props: {
transmissionOfData: {
type: Object,
default: () => null
}
},
data () {
return {
formList: utils.deepClone(EQUITY_FORM_LIST),
titleList: utils.deepClone(EQUITY_FORM_TITLE_LIST),
endDate: dayjs().format('YYYY-MM-DD'),
equityFormRule: utils.deepClone(EQUITY_FORM_RULE),
orderObj: {},
loadComplete: false,
popupType: 0,
viewKey: Date.now(),
conSecondObj: {
vin: ''
},
noticeObj: {},
validateState: true
}
},
watch: {
transmissionOfData: {
handler (val) {
if (val && val.contractNo) this.getServiceInfoDetail({
contractNo: val.contractNo
}, 1)
if (val && val.orderId) this.getServiceInfoDetail({
orderId: val.orderId
}, 2)
},
deep: true,
immediate: true
}
},
computed: {
orderPopupRef () {
return this.$refs.orderPopup
}
},
mounted () {
},
methods: {
// 车架号动态校验
validateVin () {
let carVinVal = this.orderObj.vin;
if (carVinVal) {
this.orderObj.carVin = formatVinInput(carVinVal)
validateVin(this.orderObj.carVin).then(result => {
console.log("validateVin", result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr", result);
})
}
},
// 单选框change事件
radioChange (e, val) {
this.$set(this.orderObj, val.value, e.detail.value)
this.formList.map(k => {
k.map(i => {
if (i.value == val.value) i.current = e.detail.value
})
})
this.viewKey = Date.now()
},
handleCell (val) {
if (['calendar', 'futureCalendar'].includes(val.key)) return this.$refs[val.key]?.open()
this.popupType = Object.keys(EQUITY_POPUP_ENUM).find(key => EQUITY_POPUP_ENUM[key].key === val.key) * 1
this.orderPopupRef.open()
},
onConfirm (val) {
const { chooseContent, popupType } = val,
_typeValue = EQUITY_POPUP_ENUM[popupType]
if (_typeValue.key == 'carBrand') {
Object.assign(this.orderObj, chooseContent)
this.$set(this.orderObj, 'carBrandText',
`${chooseContent.vehicleBrandName}/${chooseContent.vehicleSubBrandName}/${chooseContent.vehicleSeriesName}/${chooseContent.vehicleShapeName}`)
this.viewKey = Date.now()
return
} else if (_typeValue.options) {
this.$set(this.orderObj, _typeValue.targetIdKey, chooseContent[_typeValue.sourceIdKey || 'optionId'])
this.$set(this.orderObj, _typeValue.targetNameKey, chooseContent[_typeValue.sourceNameKey || 'optionLabel'])
this.viewKey = Date.now()
return
}
this.$set(this.orderObj, _typeValue.value, chooseContent)
this.viewKey = Date.now()
},
inputBlur (e, val) {
this.orderObj[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
if (val.value === 'vin') this.validateVin()
},
async getServiceInfoDetail (paramSdata, type) {
try {
uni.showLoading({
title: '加载中...',
mask: true
})
let targetApi = type == 1 ? 'getServiceInfoDetail' : 'getEquityOrderByOrderId'
const data = await uni.$api.equityApi[targetApi](paramSdata)
if (!data) throw '获取数据失败'
if (data.ybAttachmentFlag != 0) this.formList[3] = []
if (data.qsFlag != 1) this.formList[4] = []
this.orderObj.goodInfoList = data.goodInfoList
this.orderObj.tireFlag = data.tireFlag
let carInfo = {},
params = {}
if (data.vehicleShapeId) {
carInfo = {
carBrandText: `${data.vehicleBrandName}/${data.vehicleSubBrandName}/${data.vehicleSeriesName}/${data.vehicleShapeName}`,
vehicleShapeId: data.vehicleShapeId,
vehicleShapeName: data.vehicleShapeName,
vehicleSeriesId: data.vehicleSeriesId,
vehicleSeriesName: data.vehicleSeriesName,
vehicleBrandId: data.vehicleBrandId,
vehicleBrandName: data.vehicleBrandName,
vehicleSubBrandId: data.vehicleSubBrandId,
vehicleSubBrandName: data.vehicleSubBrandName,
}
}
if (!data.customerType) data.customerType = 1
if (data.customerType) {
const customerTypeEnum = this.orderPopupRef.componentObject[21].options
params = {
customerType: data.customerType,
customerTypeName: customerTypeEnum.find(i => i.optionId == data.customerType).optionLabel
}
}
if (data.cardType) {
const cardTypeEnum = this.orderPopupRef.componentObject[22].options
params.cardType = data.cardType
params.cardTypeName = cardTypeEnum.find(i => i.optionId == data.cardType).optionLabel
}
if (data.buyCarType == null) data.buyCarType = 1
if (data.buyCarType != null) {
const buyCarTypeEnum = this.orderPopupRef.componentObject[23].options
params.buyCarType = data.buyCarType
params.buyCarTypeName = buyCarTypeEnum.find(i => i.optionId == data.buyCarType).optionLabel
}
let priceList = ['actualSalesPrice']
data.goodInfoList.map((item, idx) => {
if (item.actualSalesPrice) item.actualSalesPrice = NP.divide(Number(item.actualSalesPrice), 100).toFixed(2)
// priceList.forEach(k => {
// data.goodInfoList[idx][k] = item[k] === null ? null : (item[k] / 100).toFixed(2)
// })
if (item.vehicleRegistrationDate) {
item.vehicleRegistrationDate = dayjs(item.vehicleRegistrationDate).format('YYYY-MM-DD')
}
if (item.buyDate) {
item.buyDate = dayjs(item.buyDate).format('YYYY-MM-DD')
}
if (item.qualityBeginDate) {
item.qualityBeginDate = dayjs(item.qualityBeginDate).format('YYYY-MM-DD')
}
if (item.itemsCode == 'YB0003') {
item.gearbox = item.gearbox || ''
item.vehicleNature = typeof item.vehicleNature == 'number' ? item.vehicleNature : 1
let val = constantData.vehicleNatureList.find(k => k.optionId == item.vehicleNature)
if (val) {
item.vehicleNatureName = val.optionLabel
}
}
if (item.printType == 2 && !['YB0001', 'YB0002', 'YB0003'].includes(item.itemsCode)) item.displacementPowerFlag = item.displacementPowerFlag || 0
})
// 判断购买商品是否全部是延保allWarrantyFlag
const allWarrantyFlag = data?.goodInfoList?.some(v => v.printType != 2),
imgObj = {}
Object.keys(codeToAttr).map(key => {
if (codeToAttr[key] == 'other') imgObj[codeToAttr[key]] = []
else imgObj[codeToAttr[key]] = ''
})
this.formList.map(i => {
i.map(e => {
if (e.value == 'effectiveDate') e.hidden = !allWarrantyFlag //false 显示生效日期 true不显示
})
})
/**图片 */
if ((data.ybAttachmentFlag == 0 || data.qsFlag == 1) && data.attachmentList?.length) {
data.attachmentList.forEach(item => {
if (item.attachmentCode == 'YB0005') imgObj[codeToAttr[item.attachmentCode]].push(item.attachmentFile)
else imgObj[codeToAttr[item.attachmentCode]] = item.attachmentFile
})
}
if (data.tireFlag == 0) {
const list = ['tireBrand', 'tireScale', 'leftFrontDTO', 'leftFrontBatch', 'rightFrontDTO', 'rightFrontBatch', 'leftRearDTO', 'leftRearBatch', 'rightRearDTO', 'rightRearBatch']
list.map(key => {
this.equityFormRule[key][0].required = false
})
}
/**轮胎 */
if (data.attributeList?.length) {
data.attributeList.map((e, idx) => {
if (e.attributeValue) data[tireObjList[idx].attr] = e.attributeValue
})
}
let inclueType = data.addOnsFlag == 0 ? 2 : 1
Object.assign(this.orderObj, {
...data,
vin: data.vin,
invoicePrice: NP.divide(Number(data.invoicePrice || 0), 100).toFixed(2),
seatesNum: data.seatesNum,
seat: data.seatesNum,
engineNo: data.engineNo,
vehicleColor: data.vehicleColor,
billingDate: data.billingDate ? dayjs(data.billingDate).format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD'),
customerName: data.customerName,
customerPhone: data.customerPhone,
cardNo: data.cardNo,
customerAddress: data.customerAddress,
goodInfoList: data.goodInfoList,
effectiveDate: data.effectiveDate ? dayjs(data.effectiveDate).format('YYYY-MM-DD') : dayjs().add(1, 'day').format('YYYY-MM-DD'),
tireFlag: data.tireFlag,
compensationName: data.compensationName || data.customerName,
attachmentList: data.attachmentList || [],
merchantName: data.merchantName,
merchantPhone: data.merchantPhone,
merchantAddress: data.merchantAddress,
imgObj,
inclueType,
...carInfo,
...params
})
this.formList[4].map(e => {
if (e.value == 'inclueType') e.current = inclueType
})
this.viewKey = Date.now()
this.loadComplete = true
uni.hideLoading()
} catch (error) {
uni.hideLoading()
this.viewKey = Date.now()
this.loadComplete = true
if (error) uni.showToast({
title: error,
icon: 'none'
})
}
},
collapseAll (index) {
this.titleList[index].collapseAll = !this.titleList[index].collapseAll
},
confirmCalendar (e, key) {
this.orderObj[key] = e.fulldate
this.viewKey = Date.now()
},
async submit (operationType) {
// VIN车架号-动态校验
const carVin = this.orderObj.vin
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({ title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)', icon: 'none' })
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({ title: '车架号校验不匹配,请核对后重新输入', icon: 'none' })
return false
}
}
uni.showLoading({
title: '提交中...',
mask: true
})
const { orderObj, conSecondObj } = this,
{ goodsRef, tireRef, uplopdRef, conversionRef } = this.$refs
let params = utils.deepClone(orderObj),
attachmentList = [],
attributeList = []
if (tireRef) {
let { tireObj } = tireRef
tireObjList.map(item => {
if (tireObj[item.attr]) {
attributeList.push({
attributeValue: tireObj[item.attr],
sort: item.sort,
attributeGroup: item.attributeGroup,
attributeName: item.attributeName
})
params[item.attr] = tireObj[item.attr]
}
})
params.attributeList = attributeList
params.tireBrand = tireObj.tireBrand
params.tireScale = tireObj.tireScale
}
if (goodsRef) {
let goodInfoList = utils.deepClone(goodsRef.goodInfoList)
goodInfoList.map(item => {
item.actualSalesPrice = NP.times(Number(item.actualSalesPrice), 100)
})
params.goodInfoList = goodInfoList
}
if (uplopdRef || conversionRef) {
let imgObj = {}
if (uplopdRef) imgObj = uplopdRef.imgObj
if (conversionRef && params.inclueType == 1) imgObj = {
...imgObj,
...conversionRef.imgObj
}
Object.keys(imgObj).map(key => {
if (Array.isArray(imgObj[key])) {
imgObj[key].map(item => {
attachmentList.push({
attachmentCode: attrToCode[key],
attachmentType: 'IMG',
attachmentFile: item
})
})
} else {
attachmentList.push({
attachmentCode: attrToCode[key],
attachmentType: 'IMG',
attachmentFile: imgObj[key]
})
}
})
}
params.invoicePrice = NP.times(Number(params.invoicePrice), 100)
params.attachmentList = attachmentList
if (operationType == 0) {
this.confirm(params, operationType)
return
}
if (!this.checkOrder(params)) return uni.hideLoading()
const { code, message } = await uni.$api.equityApi.checkVinBuyEquityOrder({
vin: orderObj.vin
})
if (code == 0) {
this.confirm(params, operationType)
} else if (code == '-2') {
if (conSecondObj.vin == orderObj.vin) {
this.confirm(params, operationType)
this.conSecondObj.vin = ''
} else {
this.conSecondObj.vin = orderObj.vin
this.openNotice(message, params)
}
} else this.openNotice(message, params)
},
checkOrder (params) {
let { equityFormRule } = this
try {
Object.keys(equityFormRule).map(key => {
let [nullCheck, validatorCheck] = equityFormRule[key]
if (nullCheck.required) {
if (!params[key]) throw equityFormRule[key][0].message
else {
if (validatorCheck && validatorCheck.validator) {
const res = validatorCheck.validator('', params[key])
if (res && res.message) throw res.message
}
}
}
})
params.goodInfoList?.map(item => {
if (item.printType == 2) {
if (item.itemsCode == 'YB0003') Object.keys(oilFormRule).map(key => {
let [nullCheck, validatorCheck] = oilFormRule[key]
if (nullCheck.required) {
if (!item[key]) throw oilFormRule[key][0].message
else {
if (validatorCheck && validatorCheck.validator) {
const res = validatorCheck.validator('', item[key])
if (res && res.message) throw res.message
}
}
}
})
if (item.itemsCode == 'YB0001' || item.itemsCode == 'YB0002') Object.keys(energyFormRule).map(key => {
let [nullCheck, validatorCheck] = energyFormRule[key]
if (nullCheck.required) {
if (!item[key]) throw energyFormRule[key][0].message
} else {
if (validatorCheck && validatorCheck.validator) {
const res = validatorCheck.validator('', item[key])
if (res && res.message) throw res.message
}
}
})
if (item.itemsCode != 'YB0001' && item.itemsCode != 'YB0002' && item.itemsCode != 'YB0003') Object.keys(extendServiceFormRule).map(key => {
let [nullCheck, validatorCheck] = extendServiceFormRule[key]
if (nullCheck.required) {
if (!item[key]) throw extendServiceFormRule[key][0].message
} else {
if (validatorCheck && validatorCheck.validator) {
const res = validatorCheck.validator('', item[key])
if (res && res.message) throw res.message
}
}
})
}
})
if (params.ybAttachmentFlag == 0 || params.qsFlag == 1) {
if (params.ybAttachmentFlag == 0) {
params.attachmentList.map(e => {
let item = ybAttachmentFlagTips[e.attachmentCode]
if (e.attachmentCode != 'YB0005') {
if (!e.attachmentFile) throw `请上传${item}`
}
})
}
if (params.qsFlag == 0 && params.inclueType == 1) {
params.attachmentList.map(e => {
let item = qsFlagTips[e.attachmentCode]
if (!e.attachmentFile) throw `请上传${item}`
})
}
}
} catch (error) {
uni.showToast({
title: error,
icon: 'none'
})
return false
}
return true
},
async confirm (paramsData, operationType) {
try {
let params = utils.deepClone(paramsData)
this.$refs.reportNotice.close()
// 0草稿,1提单
params.operationType = operationType
params.addOnsFlag = params.inclueType == 2 ? 0 : 1
params.seatesNum = params.seat
delete params.imgObj
delete params.inclueType
delete params.seat
uni.showLoading({
mask: true
})
const { code, message } = await uni.$api.equityApi.addEquityOrder(params)
if (code == 0) {
if (operationType == 0) {
uni.hideLoading()
uni.showToast({
title: '保存成功',
icon: 'none',
mask: true
})
setTimeout(() => {
this.$emit('jump', 'EquityManagement')
}, 1500)
} else {
uni.showLoading({
mask: true
})
setTimeout(async () => {
// 从URL获取文件名
const getFileNameFromUrl = (url) => {
return url.split('/').pop().split('?')[0] || '未知文件'
}
const { contractNo } = params,
url = await uni.$api.equityApi.printContract({ contractNo }),
fileName = getFileNameFromUrl(url),
type = 3
if (!url) throw '获取合同失败'
this.noticeObj = {
title: '提单成功',
text: '提单合同支持分享或保存',
type: 'success',
buttons: [
{
text: '查看合同',
type: 'primary',
callback: _ => {
this.$refs.reportNotice.close()
this.$emit('jump', 'EquityManagement')
// 跳转到预览页面
uni.navigateTo({
url: `/pages/common/filePreview?fileUrl=${encodeURIComponent(url)}&fileType=${type}&fileName=${encodeURIComponent(fileName)}`
})
}
}
]
}
setTimeout(() => {
uni.hideLoading()
this.$refs.reportNotice.open()
}, 100)
}, 1500)
}
} else throw message
} catch (error) {
uni.hideLoading()
if (error) uni.showToast({
title: error,
icon: 'none'
})
}
},
openNotice (message, params) {
uni.hideLoading()
let title = '出单失败',
btnText = '重新提单',
callbackFun = () => { }
if (message.includes('该车架已经购买过')) {
title = '信息确认'
btnText = '继续出单'
callbackFun = () => {
this.confirm(params, 1)
}
}
this.noticeObj = {
title,
text: message,
type: 'warning',
buttons: [
{
text: btnText,
type: 'primary',
callback: callbackFun
}
]
}
this.$nextTick(() => this.$refs.reportNotice.open())
},
}
}
</script>
<style scoped lang='scss'>
.equity-box {
height: 100%;
position: relative;
.box {
height: calc(100% - #{toRpx(120)});
.scroll-view {
height: 100%;
}
&-content {
padding: 0 toRpx(48);
}
}
.customer-title {
.customer-file {
margin-left: toRpx(20);
color: #347bff;
font-size: toRpx(24);
.sprite-icon {
margin-right: toRpx(4);
}
}
}
.btns {
padding: toRpx(24) toRpx(128);
gap: toRpx(32);
.btn {
display: flex;
align-items: center;
justify-content: center;
width: toRpx(1130);
height: toRpx(80);
color: #fff;
border-radius: toRpx(48);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
.save {
background: #3b73ff1a;
color: #4673ff;
font-size: toRpx(28);
font-weight: 500;
}
}
}
</style>
\ No newline at end of file
......@@ -176,7 +176,7 @@ export default {
watch: {
externalData: {
handler (val) {
this.goodInfoList = val.goodInfoList || []
if (!this.goodInfoList.length) this.goodInfoList = val.goodInfoList || []
},
deep: true,
immediate: true
......@@ -191,7 +191,7 @@ export default {
extendServiceFormList,
oilProFormList,
cellBoxStyle: 'background: #f5f7fa;',
goodInfoList:[],
goodInfoList: [],
viewKey: Date.now(),
currentData: {},
popupType: 0,
......
......@@ -64,6 +64,7 @@ export default {
watch: {
externalData: {
handler (val) {
if (Object.keys(this.tireObj).length) return
const keyList = [
'tireBrand', 'tireScale',
'leftFrontDTO', 'leftFrontBatch',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!