Commit cd014bf1 by 胡悦

feat: 实现Pad素材列表功能并优化信息录入组件

refactor(MediaComponent): 将madiaId类型从Number改为String
feat(common): 新增Pad文件夹和素材列表查询接口
refactor(HomeFrame): 为Material组件添加moduleList属性
feat(detail): 启用FinishStep和信息录入组件
refactor(MaterialIndex): 移除硬编码数据改为props传入
refactor(FinishStep): 简化表单字段并移除冗余组件
feat(index): 实现Pad素材动态加载功能
feat: 新增信息录入组件支持凭证上传
1 parent 4a85c67b
......@@ -455,4 +455,12 @@ module.exports = {
getProductList(data) {
return http.shukeRequest('linkwe-gateway/open/product/page/list', data, 'GET', true)
},
// Pad文件夹列表查询
getPadFolderList(data) {
return http.shukeRequest('linkwe-gateway/reception/pad/materials/folders/list', data, 'POST', true)
},
// Pad素材列表查询
getPadMaterialList(data) {
return http.shukeRequest('linkwe-gateway/reception/pad/materials/materials/list', data, 'POST', true)
},
}
......@@ -82,14 +82,6 @@
</template>
</view>
</MessageBox>
<car-brands
ref="carBrandListVisible"
@select="handleSelect($event, 'carBrandListVisible')"
/>
<employee
ref="employeeBoxVisible"
@select="handleSelect($event, 'employeeBoxVisible')"
/>
<uni-popup
ref="successRef"
type="message"
......@@ -104,46 +96,34 @@
</template>
<script type="text/ecmascript-6">
import Employee from '@/components/Employee.vue'
import CarBrands from '@/components/CarBrands.vue'
import { mapMutations } from "vuex";
const phoneRex = /^[1]([3-9])[0-9]{9}$/;
const formObject_boutique = [{
label: "车主姓名",
label: "客户姓名",
key: "customerName",
type: "input",
inputType: "text",
maxlength: 20,
placeholder: '请输入车主姓名',
placeholder: '请输入客户姓名',
required: true
},
{
label: "品牌车型",
key: "carModel",
type: "select",
type: "input",
popKey: "carBrandListVisible",
placeholder: '请选择品牌车型',
disabled: true
},
{
label: "车主电话",
key: "phoneNumber",
label: "品牌车型",
key: "carModel",
type: "input",
inputType: "tel",
maxlength: 11,
placeholder: '请输入车主电话',
maxlength: 50,
placeholder: '请输入品牌车型',
required: true
},
{
label: "交付专员",
key: "staffName",
type: "select",
popKey: "employeeBoxVisible",
placeholder: '请选择交付专员',
required: true
},]
}]
export default {
components: { Employee, CarBrands },
name: 'FinishStep',
props: {
sceneType: {
......@@ -161,16 +141,16 @@ export default {
step: 1,
formObject: [
{
label: "车主姓名",
label: "客户姓名",
key: "customerName",
type: "input",
inputType: "text",
maxlength: 50,
placeholder: '请输入车主姓名',
placeholder: '请输入客户姓名',
required: true
},
{
label: "车主电话",
label: "客户电话",
key: "phoneNumber",
type: "input",
inputType: "tel",
......@@ -181,17 +161,9 @@ export default {
{
label: "品牌车型",
key: "carModel",
type: "select",
popKey: "carBrandListVisible",
placeholder: '请选择品牌车型',
required: true
},
{
label: "销售姓名",
key: "staffName",
type: "select",
popKey: "employeeBoxVisible",
placeholder: '请选择销售',
type: "input",
maxlength: 50,
placeholder: '请输入品牌车型',
required: true
},
],
......@@ -200,7 +172,6 @@ export default {
carModel: "",
phoneNumber: "",
salesUuid: "",
staffName: "",
},
resultList: [
{
......@@ -227,8 +198,7 @@ export default {
},
tips () {
let { sceneType, titleTips } = this,
text = titleTips || '检测到“交车告知书”中未填写客户档案,请填写后再完成接待。'
if (sceneType == 1) text = '请确认“车型加装选购页”中的客户信息,并点击「完成接待」结束客户接待。'
text = titleTips || '检测到客户信息未完善,请填写后再完成接待。'
return text
}
},
......@@ -317,15 +287,10 @@ export default {
this.$store.dispatch('setCustomerInfo', this.formData)
},
handleSelect (item, popkey) {
this.$refs[popkey].close();
if (popkey == "employeeBoxVisible") {
this.formData.salesUuid = item.uuid;
this.formData.staffName = item.staffName;
} else {
this.$refs.carBrandListVisible.close();
this.formData.carModel = item.name;
this.formData.carModelId = item.id
}
this.$refs[popkey].close()
this.$refs.carBrandListVisible.close();
this.formData.carModel = item.name;
this.formData.carModelId = item.id
this.$store.dispatch("setCustomerInfo", this.formData);
this.selectKey = Date.now()
},
......
......@@ -15,7 +15,7 @@
<view class="common-title">产品介绍</view>
<view class="content-box">
<template>
<Material ref="materialRef"></Material>
<Material ref="materialRef" :moduleList="moduleList"></Material>
<!-- <swiper-component
:moduleList="moduleList"
@click="swiperClick"
......@@ -152,12 +152,16 @@ export default {
}
},
computed: {
finishRef() {
return this.$refs.finish
},
componentName () {
let tabs = this.$refs.leftBox?.tabs
return tabs ? tabs[this.tabIndex].name : ''
},
},
methods: {
async changeTab({ item, index }) {
this.previewOff = index != 0
this.$emit('changeTab', index)
......
......@@ -15,10 +15,8 @@
</view>
<!-- 指示点:与 currentIndex 同步高亮 -->
<view class="module-dots flex">
<template v-for="(i, index) in moduleList">
<div :class="['dot', { 'active': index == currentIndex }]" :key="index">
</div>
</template>
<view v-for="(i, index) in moduleList" :key="index" :class="['dot', { 'active': index == currentIndex }]">
</view>
</view>
</view>
</template>
......@@ -27,36 +25,42 @@
export default {
// 自定义三卡片轮播组件:实现自动播放与手势滑动
name: 'MaterialIndex',
props: {
moduleList: {
type: Array,
default: () => []
}
},
data() {
return {
// 素材数据源(示例数据,可替换为真实接口)
moduleList: [
{
id: 1,
materialName: '素材1',
materialUrl: 'https://img.pconline.com.cn/images/upload/upc/tx/wallpaper/1305/16/c4/20990657_1368686545122.jpg'
},
{
id: 2,
materialName: '素材2',
materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
},
{
id: 3,
materialName: '素材3',
materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
},
{
id: 4,
materialName: '素材4',
materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
},
{
id: 5,
materialName: '素材5',
materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
}
],
// moduleList: [
// {
// id: 1,
// materialName: '素材1',
// materialUrl: 'https://img.pconline.com.cn/images/upload/upc/tx/wallpaper/1305/16/c4/20990657_1368686545122.jpg'
// },
// {
// id: 2,
// materialName: '素材2',
// materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
// },
// {
// id: 3,
// materialName: '素材3',
// materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
// },
// {
// id: 4,
// materialName: '素材4',
// materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
// },
// {
// id: 5,
// materialName: '素材5',
// materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
// }
// ],
// 轮播数据快照(与 moduleList 同步)
datalist: [],
// 渲染用的三卡片列表(左/中/右)
......@@ -86,6 +90,16 @@ export default {
return this.moduleList[this.currentIndex]?.materialName || ''
}
},
watch: {
moduleList: {
handler(val) {
if (val && val.length) {
this.getDatalist()
}
},
deep: true
}
},
mounted() {
// 初始化轮播并开启自动播放
this.getDatalist()
......@@ -95,6 +109,7 @@ export default {
// 初始化 imagelist(最多三项)并更新 currentIndex
getDatalist() {
this.datalist = this.moduleList
console.log(this.datalist, '===')
const list = JSON.parse(JSON.stringify(this.style_object))
const len = this.datalist.length
if (!len) {
......
......@@ -50,7 +50,7 @@ export default {
views: [Array, Object],
penSwitch: Boolean,
title: String,
madiaId: Number,
madiaId: String,
isByd: Boolean,
show: Boolean,
hasCarBrand: Boolean
......
<!--
* @Description:
* @Author: huyue
* @Date: 2024-04-07 14:54:28
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-04-18 11:24:22
-->
<template>
<view
class="information-entry"
v-if="showPayPage"
>
<view class="nav-bar">
<view
class="back"
@click="$emit('update:showPayPage', false)"
>
<uni-icons
type="left"
:size="20"
color="#000"
></uni-icons>
</view>
<view class="title">信息录入</view>
</view>
<view class="information-tips">建议同步采集凭证,若接待工作繁忙可在提单环节再进行补充。</view>
<view class="information-box">
<view
class="information-item"
v-for="(item, index) in infoList"
:key="item.title"
>
<view
class="upload-img"
v-if="item.imgUrl"
>
<image
class="img"
:src="item.imgUrl"
mode="aspectFill"
@click="preview(index)"
/>
<view
class="upload-close"
@click="close(index)"
><glsx-image
src="detail/icon-close.png"
mode="scaleToFill"
/></view>
<!-- <uni-icons
class="upload-close"
type="clear"
:size="20"
@click="close(index)"
></uni-icons> -->
</view>
<view
v-else
class="icon"
@tap="choose(index)"
>
<view class="icon-upload sprite-icon icon-icon-upload"></view>
</view>
<view class="information-title">{{ item.title }} </view>
</view>
</view>
<view
class="information-done"
@click="$emit('finish')"
>完成接待</view>
<!-- <uni-popup ref="preview" type="center" border-radius="10px 10px 0 0">
<image class="preview-img" :src="previewImg" mode="aspectFit" />
</uni-popup> -->
</view>
</template>
<script>
import { uploadFile } from "@/utils/ossUploadFile/uploadFile.js";
import utils from "@/utils/utils";
import permision from '@/js_sdk/wa-permission/permission.js'
const INFO_LIST = [
{
id: 1,
title: "客户付款凭证",
},
{
id: 2,
title: "客户购车发票",
},
{
id: 3,
title: "客户延保合同",
},
];
import { mapMutations } from "vuex";
export default {
props: {
showPayPage: Boolean
},
data () {
return {
infoList: JSON.parse(JSON.stringify(INFO_LIST)),
previewImg: "",
isPreview: false,
};
},
watch: {
watchBooksList: {
immediate: true,
handler (newValue) {
if (newValue.length) this.infoList = newValue
else this.infoList = JSON.parse(JSON.stringify(INFO_LIST))
},
}
},
computed: {
watchBooksList () {
return this.$store.state.audio.booksList
}
},
methods: {
...mapMutations("audio", ["setBooks"]),
// 上传图
async choose (index) {
const result = await permision.requestAndroidPermission(
"android.permission.CAMERA"
);
if (result !== 1) {
uni.showToast({
title: "为了访问您的相机和图库,请打开相机权限",
icon: "none",
});
return;
}
uni.chooseImage({
count: 1,
success: async (res) => {
// await upload(res.tempFilePath)
let url = await uploadFile(res.tempFilePaths[0])
uni.$logger.local.info(`上传付款凭证:${res.tempFilePaths[0]}`)
// this.$set(
// this.infoList[index],
// "imgUrl",
// url
// );
this.infoList[index].imgUrl = url
this.setBooks(utils.deepClone(this.infoList))
},
fail: (err) => {
uni.$logger.local.error(`上传付款凭证失败:${typeof err == 'string' ? err : err.toString()}`)
console.log(err);
},
});
},
// 删除图
close (index) {
// this.$set(this.infoList[index], "imgUrl");
this.infoList[index].imgUrl = ''
this.setBooks(utils.deepClone(this.infoList))
},
// 预览图片
preview (index) {
this.isPreview = true;
this.previewImg = this.infoList[index].imgUrl;
uni.previewImage({
urls: [this.infoList[index].imgUrl],
longPressActions: {
// itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) {
console.log(
"选中了第" +
(data.tapIndex + 1) +
"个按钮,第" +
(data.index + 1) +
"张图片"
);
},
fail: function (err) {
console.log(err.errMsg);
},
},
});
// this.$refs.preview.open("center");
},
},
};
</script>
<style lang="scss" scoped>
.information-entry {
position: fixed;
// position: relative;
background-color: #fff;
width: 100vw;
height: 100vh;
z-index: 998;
box-sizing: border-box;
padding-top: toRpx(144);
left: 0;
top: 0;
.nav-bar {
position: fixed;
width: 100%;
height: toRpx(96);
left: 0;
top: toRpx(48);
z-index: 9;
.back {
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
}
.title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-weight: 700;
font-size: toRpx(32);
color: #1a1a1a;
}
}
.information-tips {
background: rgba(44, 102, 247, 0.1);
color: #2c66f7;
padding: toRpx(32) 0 toRpx(24) toRpx(80);
font-size: toRpx(28);
}
.information-box {
display: flex;
padding: toRpx(40) toRpx(80);
.information-item {
display: flex;
flex-direction: column;
width: toRpx(264);
margin-right: toRpx(48);
.icon {
background-color: #f4f5f7;
border: toRpx(2) solid #eff0f2;
border-radius: toRpx(16);
.icon-upload {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: toRpx(128);
height: toRpx(128);
}
}
.icon,
.upload-img {
position: relative;
width: toRpx(264);
height: toRpx(264);
}
.upload-img {
.img {
border-radius: toRpx(16);
width: 100%;
height: 100%;
}
.upload-close {
position: absolute;
right: 0;
top: 0;
width: toRpx(40);
height: toRpx(40);
// transform: translate(50%, -50%);
// text-align: center;
// font-size: 36rpx;
// line-height: toRpx(40);
// display: flex;
// align-items: center;
// justify-content: center;
// background-color: #fff;
// border-radius: 50%;
// padding: 0;
}
}
.information-title {
margin-top: toRpx(24);
font-weight: 500;
font-size: toRpx(28);
color: #222222;
letter-spacing: 0;
line-height: toRpx(48);
text-align: center;
}
}
}
}
.information-done {
position: absolute;
bottom: toRpx(30);
left: 50%;
transform: translateX(-50%);
width: calc(100% - #{toRpx(240)});
height: toRpx(80);
font-weight: 500;
font-size: toRpx(32);
color: #ffffff;
text-align: center;
line-height: toRpx(80);
background-color: #2c66f7;
border-radius: toRpx(40);
}
.preview-img {
height: toRpx(1300);
}
</style>
......@@ -73,7 +73,7 @@
</view>
</template>
</template>
<!-- <finish-step
<finish-step
ref="stepRef"
@submit="done"
:titleTips="finishTips"
......@@ -81,7 +81,7 @@
<informationEntry
:showPayPage.sync="showPayPage"
@finish="open"
/> -->
/>
</view>
</template>
<script>
......@@ -92,9 +92,9 @@ import MediaComponent from './components/MediaComponent.vue'
// import History from './components/History.vue'
// import ThreeGuarantees from './components/ThreeGuarantees.vue'
// import payPop from './components/payPop.vue'
// import FinishStep from '@/components/FinishStep.vue'
import FinishStep from '@/components/FinishStep.vue'
import { mapMutations } from 'vuex'
// import informationEntry from './components/informationEntry.vue'
import informationEntry from './components/informationEntry.vue'
// import insurance from '@/components/Insurance/Insurance.vue'
import { receptionTrackMixin } from '@/mixin/index.js'
export default {
......@@ -104,10 +104,10 @@ export default {
MediaComponent,
// payPop,
// CaseCenter,
// FinishStep,
FinishStep,
// History,
// ThreeGuarantees,
// informationEntry,
informationEntry,
// insurance
},
props: {
......
......@@ -40,48 +40,49 @@ export default {
components: { HomeFrame, detail },
data () {
return {
moduleList:[
{
id: 6,
thumbnail: 'https://img02.glsx.com.cn/weapp/resource/app-tape/media/benz/6.webp',
title: '保修升级产品保障范围',
class: 'landscape',
style: 'width: calc(100vw * (1282 / 2346));height: calc(100vmin * (1173 / 768) * (304 / 2346));',
showAlt: false,
componentName: 'media-component',
detailTitle: '保修升级产品保障范围',
receptionSourceDetailList: [{
detailUrl: 'https://img02.glsx.com.cn/weapp/resource/app-tape/media/benz/page/6-1.webp',
}]
},
{
id: 2,
materialName: '素材2',
materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
},
{
id: 3,
materialName: '素材3',
materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
},
{
id: 4,
materialName: '素材4',
materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
},
{
id: 5,
materialName: '素材5',
materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
}
],
moduleList: [],
// moduleList:[
// {
// id: 6,
// thumbnail: 'https://img02.glsx.com.cn/weapp/resource/app-tape/media/benz/6.webp',
// title: '保修升级产品保障范围',
// class: 'landscape',
// style: 'width: calc(100vw * (1282 / 2346));height: calc(100vmin * (1173 / 768) * (304 / 2346));',
// showAlt: false,
// componentName: 'media-component',
// detailTitle: '保修升级产品保障范围',
// receptionSourceDetailList: {
// detailUrl: 'https://img02.glsx.com.cn/weapp/resource/app-tape/media/benz/page/6-1.webp'
// }
// },
// {
// id: 2,
// materialName: '素材2',
// materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
// },
// {
// id: 3,
// materialName: '素材3',
// materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
// },
// {
// id: 4,
// materialName: '素材4',
// materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
// },
// {
// id: 5,
// materialName: '素材5',
// materialUrl: 'https://seopic.699pic.com/photo/50073/0161.jpg_wh1200.jpg'
// }
// ],
toolList: [
{
id: 6,
shortTitle: '保障范围',
title: '保修升级产品保障范围',
shortTitleUrl: 'https://img02.glsx.com.cn/weapp/resource/app-tape/tool/6.png'
}
// {
// id: 6,
// shortTitle: '保障范围',
// title: '保修升级产品保障范围',
// shortTitleUrl: 'https://img02.glsx.com.cn/weapp/resource/app-tape/tool/6.png'
// }
],
id: '',
type: '',
......@@ -115,6 +116,7 @@ export default {
// this.get_Vehicle_Sales_Data()
// this.requested = true
// this.$refs.home.updateApp(true)
this.getSoure()
},
async onShow () {
// this.init()
......@@ -125,60 +127,42 @@ export default {
// // this.findPayInfo()
// if (this.requested && !this.id) this.$refs.home.updateApp()
// },
/**获取车型&销售数据 */
get_Vehicle_Sales_Data () {
const userInfo = uni.$storage.get('userInfo'),
storageCarBrandList = uni.$storage.get('carBrandList'),
storageEmployeeList = uni.$storage.get('employeeList'),
{ shopMerchantId } = userInfo
if (storageCarBrandList) this.$store.dispatch('setCarBrandsList', storageCarBrandList)
if (storageEmployeeList) this.$store.dispatch('setEmployeeList', storageEmployeeList)
/**获取品牌车型 */
uni.$api.commonApi.getMerchantCarBrandList([shopMerchantId]).then(({ data }) => {
let list = data[0].carBrandList,
carBrandList = [],
brandIdList = [],
subBrandIdList = []
list?.map(e => {
e.childs.map(i => {
i.brandName = e.name
i.brandId = e.id
carBrandList.push(i)
subBrandIdList.push(i.id)
})
brandIdList.push(e.id)
})
this.getSoure(brandIdList, subBrandIdList)
this.$store.dispatch('setCarBrandsList', carBrandList)
uni.$storage.set('carBrandList', carBrandList)
if (carBrandList.length) {
let index = 0
this.getCarBrandsList(carBrandList, index)
}
})
/**获取销售人员 */
uni.$api.commonApi.getEmployeeList({
merchantId: shopMerchantId
}).then(res => {
this.$store.dispatch('setEmployeeList', res || [])
uni.$storage.set('employeeList', res || [])
})
},
// 查询素材
async getSoure (brandIdList, subBrandIdList) {
const { shopMerchantId, sceneType } = this
let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`)
if (data) this.setViewInfo(data)
let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, {
brandIdList,
subBrandIdList
async getSoure () {
const first_res = await uni.$api.commonApi.getPadFolderList({
typeCode: '17324738e3e28597d671f23002e796eb',
status: 0
})
if (requestData) this.setViewInfo(requestData)
else this.loadComplete = true
},
errorImg (index) {
this.moduleList[index].showAlt = true
console.log(first_res)
if (first_res?.data?.length) {
const second_res = await uni.$api.commonApi.getPadMaterialList({
folderCode: first_res?.data[0]?.folderCode,
typeCode: first_res?.data[0]?.typeCode,
status: 0
})
console.log(second_res, 'second_res')
if (second_res?.data?.length) {
this.moduleList = second_res?.data?.map(item => ({
...item,
thumbnail: item.materialUrl,
title: item.materialName,
class: 'landscape',
style: 'width: calc(100vw * (1282 / 2346));height: calc(100vmin * (1173 / 768) * (304 / 2346));',
showAlt: false,
componentName: 'media-component',
detailTitle: item.materialName,
receptionSourceDetailList: {
detailUrl: item.materialUrl
}
}))
this.toolList = second_res?.data?.map(item => ({
...item,
shortTitle: item.materialName,
title: item.materialName,
shortTitleUrl: item.materialUrl
}))
}
}
},
async start () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!