Commit 34f82249 by 前端

活动申请开发

1 parent 19e9ab72
......@@ -11,4 +11,11 @@ module.exports = {
true
);
},
// 智能名片活动申请
activityApply(data) {
return api.post({
method: `entmicro.api.business.card.activity.apply`,
...data,
},true)
}
}
\ No newline at end of file
// pages/activityApplication/activityApplication.js
import {
trackData
} from "../../utils/data";
import WxValidate from "../../utils/WxValidate"
import {
entmicroApi
} from "../../api/api";
Page({
/**
* 页面的初始数据
*/
data: {
productTabList: [{
id: '0',
name: 'scene1',
title: '新车洽谈场景',
type: '1.0 新车权益销售',
url: 'car4'
},
{
id: '1',
name: 'scene2',
title: '新车交付场景',
type: '1.1 新车精品升级',
url: 'car1'
},
{
id: '2',
name: 'scene3',
title: '0-12个月',
type: '1.2 新车线上转化',
url: 'car2'
},
{
id: '3',
name: 'scene4',
title: '12个月以上',
type: '1.3 存量用户众筹',
url: 'car3'
}
],
productList: {
scene1: [{
name: 'equity',
url: 'digital_icon',
nameZh: '数字无忧权益卡',
isSelect: false
}],
scene2: [{
name: 'solarFilm',
url: 'solar_icon',
nameZh: '汽车太阳膜',
isSelect: false
}],
scene3: [{
name: 'paintProtect',
url: 'protect_icon',
nameZh: '漆面保护膜',
isSelect: false
},
{
name: 'changingFilm',
url: 'change_icon',
nameZh: '改色膜',
isSelect: false
}
],
scene4: [{
name: 'carBeauty',
url: 'beauty_icon',
nameZh: '数字化美容',
isSelect: false
},
{
name: 'seatVentilate',
url: 'seat_icon',
nameZh: '座椅通风',
isSelect: false
},
{
name: 'arNavigation',
url: 'ar_icon',
nameZh: 'AR实景导航',
isSelect: false
},
{
name: 'ambientLighting',
url: 'light_icon',
nameZh: '氛围灯',
isSelect: false
},
{
name: 'navigationArround',
url: 'arround_icon',
nameZh: '360全景导航',
isSelect: false
}
]
},
selectItemIndex: 0,
selectItemName: 'scene1',
applyForm: {
merchantName: '',
carModel: '',
contactName: '',
contactPhone: ''
},
foldFlag: false,
sceneNum: '',
sceneName: ''
},
// 表单验证规则
initValidate() {
const rules = {
merchantName: {
required: true
},
contactName: {
required: true
},
contactPhone: {
required: true,
tel: true
}
}
const messages = {
merchantName: {
required: '请填写门店名称',
},
contactName: {
required: '请填写联系人'
},
contactPhone: {
required: '请填写手机号'
}
}
this.WxValidate = new WxValidate(rules, messages)
},
//报错
showModal(error) {
wx.showModal({
content: error.msg,
showCancel: false,
})
},
// 表单输入
handleInput(e) {
let name = e.currentTarget.dataset.name
let val = e.detail.value
const form = `applyForm.${name}`
this.setData({
[form]: val
})
},
// 提交表单
submitApply() {
// wx.$util.showLoading('提交中...')
const cardId = wx.$util.getStorageSync("scene").cardId
let params = this.data.applyForm
// 校验表单
if (!this.WxValidate.checkForm(params)) {
const error = this.WxValidate.errorList[0]
this.showModal(error)
wx.hideLoading()
return false
}
// 如果选择了业务场景
if (this.data.sceneName) {
let selectFlag = 0
let productItems = []
this.data.productList[this.data.sceneName].forEach(item => {
if (item.isSelect) {
selectFlag = selectFlag + 1
productItems.push(item.nameZh)
}
})
if (!selectFlag) {
wx.showModal({
content: '请至少选择一个产品',
showCancel: false,
})
return
}
let businessItem = this.data.productTabList.find(item => {
return item.id == this.data.sceneNum
})
params.businessScenario = businessItem.title
params.productItems = productItems.join(',')
}
params.cardId = cardId
params.openId = wx.$util.getStorageSync('aicard_info').openId
params.unionId = wx.$util.getStorageSync('aicard_info').unionId
entmicroApi.activityApply(params).then(({
data,
code,
message
}) => {
if (code == -1) {
wx.hideLoading()
wx.showToast({
msg: '提交成功'
})
wx.$router.go("applySuccess");
}
})
},
// 选择活动tab
selectProduct(e) {
this.setData({
selectItemIndex: e.currentTarget.dataset.item.id,
selectItemName: e.currentTarget.dataset.item.name
})
},
// 跳转产品详情页
goPage(e) {
wx.$router.go(e.currentTarget.dataset.item);
},
// 展开收起
handleFold() {
this.setData({
foldFlag: !this.data.foldFlag
})
},
// 选择业务场景
selectScene(e) {
// 遍历之前业务场景下产品是否已选择,选择了的话取消选中
if (this.data.sceneName) {
let newProductList
newProductList = this.data.productList[this.data.sceneName].map(item => {
if (item.isSelect) item.isSelect = false
return item
})
let selectList = `productList.${this.data.sceneName}`
this.setData({
[selectList]: newProductList
})
}
this.setData({
sceneNum: e.currentTarget.dataset.item.id,
sceneName: e.currentTarget.dataset.item.name
})
},
// 选择业务场景产品
selectScenePro(e) {
var index = e.currentTarget.dataset.index;
var item = this.data.productList[this.data.sceneName][index];
item.isSelect = !item.isSelect
this.setData({
productList: this.data.productList,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 初始化验证规则函数
this.initValidate()
// 禁用分享转发
wx.hideShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
......@@ -26,7 +285,19 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
const options = wx.getEnterOptionsSync()
if (options.query.cardId) {
wx.$trackData = options.query
}
getApp()
.login()
.then(({
data
}) => {
if (!wx.$trackData.detailShare) {
wx.$Track.sendTrack(trackData.ACTIVITYAPPLICATION);
}
});
},
/**
......
{
"usingComponents": {}
"usingComponents": {},
"navigationBarTitleText": "活动申请"
}
\ No newline at end of file
<!--pages/activityApplication/activityApplication.wxml-->
<text>pages/activityApplication/activityApplication.wxml</text>
<view class="apply-content">
<image class="apply-background" mode="widthFix" webp src="{{IMGURL}}application/application_top.png?v={{img_version}}"></image>
<view class="box-background">
<!-- 产品选择tab -->
<view class="product-tab-box">
<!-- tab栏 -->
<block wx:for="{{productTabList}}">
<view class="product-item {{item.id == selectItemIndex ? 'product-item-active' : ''}}" bindtap="selectProduct" data-item="{{item}}">
<view class="product-item-title {{item.id == selectItemIndex ? 'product-item-title-active' : ''}}">{{item.title}}</view>
<view class="product-item-type {{item.id == selectItemIndex ? 'product-item-type-active' : ''}}">{{item.type}}</view>
<view wx:if="{{item.id == selectItemIndex}}" class="selected-item">
<view class="selected-item-top"></view>
<view class="selected-item-bottom"></view>
</view>
</view>
</block>
</view>
<!-- 产品展示 -->
<view class="product-box">
<block wx:for="{{productList[selectItemName]}}">
<image class="product-img" mode="widthFix" webp src="{{IMGURL}}application/{{item.url}}.png?v={{img_version}}" bindtap="goPage" data-item="{{item.name}}"></image>
</block>
</view>
</view>
<!-- 申请表单 -->
<view class="apply-box">
<view class="apply-top">
<view class="apply-top-icon"></view>
<view class="apply-top-title">申请信息</view>
</view>
<form>
<view class="apply-info">
<view class='info-list'>
<text class="info-lable">门店名称<text class="require"> *</text></text>
<input name="applyName" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入门店名称' value="{{applyForm.merchantName}}" bindinput="handleInput" data-name="merchantName"></input>
</view>
<view class='info-list'>
<text class="info-lable">主营车型</text>
<input name="telphone" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入主营车型' value="{{applyForm.carModel}}" bindinput="handleInput" data-name="carModel"></input>
</view>
<view class='info-list'>
<text class="info-lable">联系人<text class="require"> *</text></text>
<input name="bussinessName" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入姓名' value="{{applyForm.contactName}}" bindinput="handleInput" data-name="contactName"></input>
</view>
<view class='info-list'>
<text class="info-lable">手机号<text class="require"> *</text></text>
<input name="bussinessName" type='text' placeholder-style='font-size:28rpx;color: #9E9EA8;' placeholder='请输入手机号' value="{{applyForm.contactPhone}}" bindinput="handleInput" data-name="contactPhone"></input>
</view>
</view>
</form>
<!-- 展开收起 -->
<view class="apply-fold" bindtap="handleFold">
<text wx:if="{{!foldFlag}}">选择业务场景</text>
<text wx:else>收起</text>
<image wx:if="{{!foldFlag}}" class="fold-icon" mode="widthFix" webp src="{{IMGURL}}application/down_icon.png?v={{img_version}}"></image>
<image wx:else class="fold-icon" mode="widthFix" webp src="{{IMGURL}}application/up_icon.png?v={{img_version}}"></image>
</view>
<block wx:if="{{foldFlag}}">
<!-- 业务场景 -->
<view class="fold-title">业务场景</view>
<view class="product-tab-box fold-box">
<view wx:for="{{productTabList}}" class="item-wrap {{item.id == sceneNum ? 'act':''}}" bindtap="selectScene" data-item="{{item}}">
<view class="fold-scene-item {{item.id == sceneNum ? 'fold-scene-item-active':''}}">
<image class="fold-img" mode="widthFix" webp src="{{IMGURL}}application/{{item.url}}.png?v={{img_version}}"></image>
<view class="product-item-title {{item.id == sceneNum ? 'product-item-title-active':''}}">{{item.title}}</view>
<view class="product-item-type {{item.id == sceneNum ? 'product-item-type-active':''}}">{{item.type}}</view>
</view>
</view>
</view>
<!-- 选择产品 -->
<block wx:if="{{sceneNum}}">
<view><text class="fold-title">选择产品</text><text class="fold-tip">(可多选)</text></view>
<view class="fold-product">
<block wx:for="{{productList[sceneName]}}">
<view class="item {{item.isSelect ? 'item-selected': ''}}" bindtap="selectScenePro" data-index="{{index}}">
<view>{{item.nameZh}}</view>
<image wx:if="{{item.isSelect}}" class="selected-img" mode="widthFix" webp src="{{IMGURL}}application/selected_icon.png?v={{img_version}}"></image>
</view>
</block>
</view>
</block>
</block>
</view>
<view class="btn-box">
<button class="submit-btn" bindtap="submitApply">
提交申请
</button></view>
</view>
\ No newline at end of file
/* pages/activityApplication/activityApplication.wxss */
\ No newline at end of file
/* pages/activityApplication/activityApplication.wxss */
.apply-content {
/* overflow: auto; */
}
.apply-background {
width: 100%;
}
.box-background {
padding-top: 8rpx;
background-image: linear-gradient(179deg, #E3E8FF 0%, #FEFEFE 100%);
}
.product-tab-box {
display: flex;
/* justify-content: space-around; */
padding: 0 26rpx;
}
.product-item {
/* width: 166rpx; */
width: calc(100%/4);
height: 120rpx;
margin-right: 12rpx;
background: #F5F5FC;
border-radius: 8rpx;
}
.product-item:last-child {
margin-right: 0;
}
.product-item-active {
background: #FFFFFF;
}
.product-item-title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 24rpx;
color: #323436;
letter-spacing: 0;
text-align: center;
line-height: 44rpx;
margin-top: 24rpx;
}
.product-item-title-active {
color: #5850FF;
}
.product-item-type {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 18rpx;
color: #8A8C90;
letter-spacing: 0;
text-align: center;
line-height: 24rpx;
}
.product-item-type-active {
color: #807AFF;
}
.selected-item {
margin-top: 27rpx;
/* width: 166rpx; */
position: relative;
}
.selected-item-top {
/* width: 166rpx; */
height: 4rpx;
border-bottom-left-radius: 4rpx;
border-bottom-right-radius: 4rpx;
background: #5850FF;
}
.selected-item-bottom {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 0px;
height: 0px;
border: 12rpx solid #5850FF;
border-bottom-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
}
.product-img {
width: 224rpx;
height: 216rpx;
margin-right: 16rpx;
margin-bottom: 20rpx;
}
.product-img:nth-child(3n) {
margin-right: 0;
}
.product-box {
margin: 36rpx 0 63rpx 0;
padding: 0 26rpx;
}
.apply-box {
width: 702rpx;
/* height: 680rpx; */
background: #FFFFFF;
box-shadow: 0 6rpx 24rpx 0 rgba(175, 181, 219, 0.40);
border-radius: 12rpx;
margin: 0 24rpx;
margin-bottom: 30rpx;
/* position: absolute;
top: 420rpx;
left: 24rpx; */
}
.apply-top {
display: flex;
padding: 32rpx;
}
.apply-top-icon {
width: 10rpx;
height: 38rpx;
background: #5850FF;
border-radius: 0 8rpx 8rpx 0;
margin-right: 18rpx;
margin-top: 2rpx;
}
.apply-top-title {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 32rpx;
color: #323436;
}
.apply-info {
padding: 0 32rpx;
}
.info-list {
background: #fff;
display: flex;
align-content: center;
padding: 36rpx 0;
border-bottom: 1rpx solid #eee;
}
.info-lable {
width: 176rpx;
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 28rpx;
color: #2D2D33;
}
.require {
color: #EB4E4E;
}
.submit-btn {
width: 622rpx;
height: 80rpx;
background: #5850FF;
border-radius: 8rpx;
margin-top: 60rpx;
text-align: center;
font-size: 28rpx;
color: #FFFFFF;
font-weight: 500;
font-family: PingFangSC-Medium;
line-height: 80rpx;
}
.btn-box {
padding-bottom: 60rpx;
}
.apply-fold {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #5850FF;
text-align: center;
padding: 76rpx 0 40rpx 0;
}
.fold-icon {
width: 24rpx;
height: 24rpx;
vertical-align: middle;
margin-left: 8rpx;
}
.fold-title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 28rpx;
color: #323436;
padding-left: 32rpx;
}
.fold-tip {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 22rpx;
color: #6E6E7A;
}
.fold-box {
padding: 44rpx 16rpx;
}
.fold-scene-item {
/* width: 160rpx; */
width: 100%;
height: 180rpx;
background: #F7F7FC;
border-radius: 12rpx;
text-align: center;
}
.fold-scene-item-active {
background-image: linear-gradient(145deg, #E6E6FF 0%, #FFFFFF 73%);
}
.fold-img {
width: 56rpx;
height: 56rpx;
margin-top: 20rpx;
}
.item-wrap {
position: relative;
/* width: 160rpx; */
width: calc(100%/4);
height: 180rpx;
border-radius: 12rpx;
margin-right: 12rpx;
}
.item-wrap:last-child {
margin-right: 0
}
.act {
border: 2rpx solid #5850FF;
}
.act::after {
position: absolute;
left: 50%;
bottom: -14rpx;
display: block;
content: "";
width: 14rpx;
height: 14rpx;
border-bottom: 2rpx solid #5850FF;
border-right: 2rpx solid #5850FF;
transform: rotate(45deg) translateX(-50%);
background-color: #fff;
}
.item {
width: 216rpx;
height: 64rpx;
background: #F5F5FA;
border-radius: 8rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #323436;
letter-spacing: 0;
text-align: center;
line-height: 64rpx;
margin-right: 14rpx;
margin-bottom: 20rpx;
position: relative;
box-sizing: border-box;
}
.item:nth-child(3n) {
margin-right: 0;
}
.fold-product {
display: flex;
flex-wrap: wrap;
padding: 36rpx 16rpx 64rpx 16rpx;
}
.item-selected {
color: #5850FF;
font-weight: 600;
border: 2rpx solid #9B96FF;
}
.selected-img {
width: 30rpx;
height: 22rpx;
position: absolute;
top: 0;
right: 0;
}
\ No newline at end of file
......@@ -130,6 +130,13 @@
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "活动申请",
"pathName": "pages/activityApplication/activityApplication",
"query": "",
"launchMode": "default",
"scene": null
}
]
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!