Commit f5eb9af1 by cen

feat: 新增埋点

1 parent 79cfc84e
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"type" : "uniCloud" "type" : "uniCloud"
}, },
{ {
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
} }
] ]
......
...@@ -15,6 +15,9 @@ export default { ...@@ -15,6 +15,9 @@ export default {
computed: { computed: {
...mapState('audio', ['isEnd', 'isStart']) ...mapState('audio', ['isEnd', 'isStart'])
}, },
globalData: {
userInfo: uni.getStorageSync('release_userInfo')
},
onLaunch: async function () { onLaunch: async function () {
this.onKeep() this.onKeep()
this.setAPPVersion() this.setAPPVersion()
......
...@@ -15,11 +15,13 @@ import MessageBox from './components/MessageBox/index' ...@@ -15,11 +15,13 @@ import MessageBox from './components/MessageBox/index'
import wnCanvas from './components/Canvas/wn-canvas' import wnCanvas from './components/Canvas/wn-canvas'
import UpdateBox from './components/UpdateBox' import UpdateBox from './components/UpdateBox'
import webView from './components/WebView' import webView from './components/WebView'
import debounce from './utils/debounce.js'
Vue.use(webView) Vue.use(webView)
Vue.component('GlsxImage', GlsxImage) Vue.component('GlsxImage', GlsxImage)
Vue.component('MessageBox', MessageBox) Vue.component('MessageBox', MessageBox)
Vue.component('wnCanvas', wnCanvas) Vue.component('wnCanvas', wnCanvas)
Vue.component('UpdateBox', UpdateBox) Vue.component('UpdateBox', UpdateBox)
Vue.directive('debounce', debounce)
Vue.config.productionTip = false Vue.config.productionTip = false
App.mpType = 'app' App.mpType = 'app'
// Vue.prototype.$ossDomain = config.OSS_DOMAIN // Vue.prototype.$ossDomain = config.OSS_DOMAIN
......
<!--工单信息卡片--> <!--工单信息卡片-->
<template> <template>
<view class="order-card" @click="() => jumpClick(orderCardDetail.status == 3 ? 'ConfirmOrder' : orderCardDetail.status == 1 ? 'CreateOrder' : 'OrderDetail', orderCardDetail)"> <view class="order-card" v-debounce.stop="cardClick">
<view class="order-card-top-box flex justify-between"> <view class="order-card-top-box flex justify-between">
<text>{{ orderCardDetail.customer.customerName }}</text> <text>{{ orderCardDetail.customer.customerName }}</text>
<view class="status text-center" :style="{ color: orderCardDetail.statuscolor, 'background-color': orderCardDetail.statusbackground }"> <view class="status text-center" :style="{ color: orderCardDetail.statuscolor, 'background-color': orderCardDetail.statusbackground }">
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</view> </view>
<view v-if="orderCardDetail.subOrderList.length > 2" class="goods-more"> <view v-if="orderCardDetail.subOrderList.length > 2" class="goods-more">
<text @click.stop="showAllGoodsList"> <text v-debounce="showAllGoodsList">
{{ orderCardDetail.showAllGoodsListFlag ? '收起' : '查看全部' }} {{ orderCardDetail.showAllGoodsListFlag ? '收起' : '查看全部' }}
</text> </text>
(共{{ orderCardDetail.subOrderList.length }}件) (共{{ orderCardDetail.subOrderList.length }}件)
...@@ -91,19 +91,19 @@ ...@@ -91,19 +91,19 @@
<PublishPopup ref="recordOrderPopup" popupClass="recordOrderPopup" type="center" :showClose="true" title="请选择录单入口"> <PublishPopup ref="recordOrderPopup" popupClass="recordOrderPopup" type="center" :showClose="true" title="请选择录单入口">
<template #content> <template #content>
<view class="modatcontent"> <view class="modatcontent">
<view class="modalbox com" :class="selectType == 1 ? 'act' : ''" @click.stop="changeType(1)"> <view class="modalbox com" :class="selectType == 1 ? 'act' : ''" v-debounce="[changeType, 1]">
<view class="sprite-icon icon-create-order"></view> <view class="sprite-icon icon-create-order"></view>
新增工单 新增工单
</view> </view>
<view class="modalbox cancle" :class="selectType == 2 ? 'act' : ''" @click.stop="changeType(2)"> <view class="modalbox cancle" :class="selectType == 2 ? 'act' : ''" v-debounce="[changeType, 2]">
<view class="sprite-icon icon-defeat-order"></view> <view class="sprite-icon icon-defeat-order"></view>
战败下单 战败下单
</view> </view>
<view v-if="isSettingExpiredTraffic && !isScan" class="modalbox cancle" :class="selectType == 3 ? 'act' : ''" @click.stop="changeType(3)"> <view v-if="isSettingExpiredTraffic && !isScan" class="modalbox cancle" :class="selectType == 3 ? 'act' : ''" v-debounce="[changeType, 3]">
<view class="sprite-icon icon-expiration"></view> <view class="sprite-icon icon-expiration"></view>
失效客户 失效客户
</view> </view>
<view class="modalbox cancle" v-if="orderCardDetail.constructionFlag !== 'Y' && orderCardDetail.selectPayType !== 1 && orderCardDetail.selectPayType !== 3 && orderCardDetail.selectPayType !== 4 && orderCardDetail.status !== 9" :class="selectType == 4 ? 'act' : ''" @click.stop="changeType(4)"> <view class="modalbox cancle" v-if="orderCardDetail.constructionFlag !== 'Y' && orderCardDetail.selectPayType !== 1 && orderCardDetail.selectPayType !== 3 && orderCardDetail.selectPayType !== 4 && orderCardDetail.status !== 9" :class="selectType == 4 ? 'act' : ''" v-debounce.stop="[changeType, 4]">
<view class="sprite-icon icon-revoke"></view> <view class="sprite-icon icon-revoke"></view>
撤销工单 撤销工单
</view> </view>
...@@ -111,8 +111,8 @@ ...@@ -111,8 +111,8 @@
</template> </template>
<template #footer> <template #footer>
<view class="footer-box flex justify-center"> <view class="footer-box flex justify-center">
<view class="cancle-btn btn" @click.stop="cancelSelection">取消</view> <view class="cancle-btn btn" v-debounce.stop="cancelSelection">取消</view>
<view class="sure-btn btn" @click.stop="confirmSelection">确认</view> <view class="sure-btn btn" v-debounce.stop="confirmSelection">确认</view>
</view> </view>
</template> </template>
</PublishPopup> </PublishPopup>
...@@ -304,6 +304,9 @@ export default { ...@@ -304,6 +304,9 @@ export default {
}, },
cancelSelection() { cancelSelection() {
this.$refs.recordOrderPopup.closePopup() this.$refs.recordOrderPopup.closePopup()
},
cardClick() {
this.jumpClick(this.orderCardDetail.status == 3 ? 'ConfirmOrder' : this.orderCardDetail.status == 1 ? 'CreateOrder' : 'OrderDetail', this.orderCardDetail)
} }
} }
} }
...@@ -362,6 +365,7 @@ export default { ...@@ -362,6 +365,7 @@ export default {
background-color: #fff; background-color: #fff;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
border-radius: 0 0 toRpx(32) toRpx(32);
.btn { .btn {
width: 40%; width: 40%;
height: toRpx(80); height: toRpx(80);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</view> </view>
<view class="flex justify-between align-center"> <view class="flex justify-between align-center">
<view class="date-box-value">{{ successDate }}</view> <view class="date-box-value">{{ successDate }}</view>
<view class="handlerBtn" @click="openDate">编辑</view> <view class="handlerBtn" v-debounce.stop="openDate">编辑</view>
</view> </view>
</view> </view>
<!-- 商品信息 --> <!-- 商品信息 -->
...@@ -95,17 +95,17 @@ ...@@ -95,17 +95,17 @@
<view v-else>{{ orderInfo[item.key] || '' }}</view> <view v-else>{{ orderInfo[item.key] || '' }}</view>
</view> </view>
</view> </view>
<view v-if="item.copy" class="copy-btn" @click="setCopyData(orderInfo[item.key])"> <view v-if="item.copy" class="copy-btn" v-debounce="[setCopyData, orderInfo[item.key]]">
<view class="sprite-icon icon-icon-copy copy"></view> <view class="sprite-icon icon-icon-copy copy"></view>
</view> </view>
<view class="customize-btn" v-if="item.dateChange" @click.stop="customizeDate">自定义</view> <view class="customize-btn" v-if="item.dateChange" v-debounce.stop="customizeDate">自定义</view>
</view> </view>
<view v-if="(orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7) && orderInfo.payVoucherList.length"> <view v-if="(orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7) && orderInfo.payVoucherList.length">
<view class="flex align-center pt-8"> <view class="flex align-center pt-8">
<view class="label">付款凭证</view> <view class="label">付款凭证</view>
<view class="image-box"> <view class="image-box">
<view class="value" @click="previewImage" v-for="(item, index) in orderInfo.payVoucherList" :key="index"> <view class="value" v-debounce.stop="previewImage" v-for="(item, index) in orderInfo.payVoucherList" :key="index">
<view class="image"> <view class="image">
<!-- <image src="{{item.payVoucher}}" /> --> <!-- <image src="{{item.payVoucher}}" /> -->
</view> </view>
...@@ -130,6 +130,7 @@ ...@@ -130,6 +130,7 @@
<view class="order-info pt-16"> <view class="order-info pt-16">
<view class="flex align-center pt-16" v-for="(item, index) in customerObj" :key="index"> <view class="flex align-center pt-16" v-for="(item, index) in customerObj" :key="index">
<view class="label">{{ item.label }}</view> <view class="label">{{ item.label }}</view>
<view class="flex flex-1">
<view class="value" :style="{ color: item.color || '#333' }"> <view class="value" :style="{ color: item.color || '#333' }">
<view v-if="item.arr"> <view v-if="item.arr">
<view v-if="orderInfo[item.arr[1]]" class="flex"> <view v-if="orderInfo[item.arr[1]]" class="flex">
...@@ -145,11 +146,12 @@ ...@@ -145,11 +146,12 @@
{{ item.enum ? item.enum[orderInfo[item.key]] : orderInfo[item.key] || '' }} {{ item.enum ? item.enum[orderInfo[item.key]] : orderInfo[item.key] || '' }}
</view> </view>
</view> </view>
<view v-if="item.copy" class="copy-btn" @click="setCopyData(orderInfo[item.key])"> <view v-if="item.copy" class="copy-btn" v-debounce="[setCopyData, orderInfo[item.key]]">
<view class="sprite-icon icon-icon-copy copy"></view> <view class="sprite-icon icon-icon-copy copy"></view>
</view> </view>
</view> </view>
</view> </view>
</view>
<view v-if="orderInfo.selectPayType == 0"> <view v-if="orderInfo.selectPayType == 0">
<view class="flex align-center pt-8"> <view class="flex align-center pt-8">
<view class="label">拒升理由</view> <view class="label">拒升理由</view>
...@@ -161,8 +163,8 @@ ...@@ -161,8 +163,8 @@
</view> </view>
<view class="flex align-center footer-box justify-center"> <view class="flex align-center footer-box justify-center">
<view class="edit btn" @click="edit">修改</view> <view class="edit btn" v-debounce.stop="edit">修改</view>
<view class="confirm btn" @click="confirm">确认</view> <view class="confirm btn" v-debounce.stop="confirm">确认</view>
</view> </view>
</view> </view>
<PublishPopup ref="tipsPopup" popupClass="tipsPopup" type="center" :showClose="true" :showTitle="false" @confirm="confirmTips"> <PublishPopup ref="tipsPopup" popupClass="tipsPopup" type="center" :showClose="true" :showTitle="false" @confirm="confirmTips">
...@@ -189,7 +191,7 @@ ...@@ -189,7 +191,7 @@
<view class="popup-top"> <view class="popup-top">
<view class="popup-top-box flex align-center"> <view class="popup-top-box flex align-center">
<text class="popup-top-box-title">工单确认码</text> <text class="popup-top-box-title">工单确认码</text>
<uni-icons @click="closePopup" class="icon-close" type="closeempty"></uni-icons> <uni-icons v-debounce.stop="closePopup" class="icon-close" type="closeempty"></uni-icons>
</view> </view>
</view> </view>
</template> </template>
...@@ -507,7 +509,10 @@ export default { ...@@ -507,7 +509,10 @@ export default {
obj.outTradeNo = outTradeNo obj.outTradeNo = outTradeNo
} }
console.log(obj) console.log(obj)
uni.showLoading() uni.showLoading({
title: '提交中...',
mask: true
})
// 状态更新 需刷新工单列表和预约管理列表 // 状态更新 需刷新工单列表和预约管理列表
utils.refreshPageData() utils.refreshPageData()
uni.$api.boutiqueApi.createPayOrder(obj).then(data => { uni.$api.boutiqueApi.createPayOrder(obj).then(data => {
...@@ -704,6 +709,9 @@ export default { ...@@ -704,6 +709,9 @@ export default {
.py-16 { .py-16 {
padding: toRpx(16) 0; padding: toRpx(16) 0;
} }
.flex-1 {
flex: 1;
}
.date-box { .date-box {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -885,7 +893,6 @@ export default { ...@@ -885,7 +893,6 @@ export default {
font-size: toRpx(26); font-size: toRpx(26);
font-weight: 400; font-weight: 400;
white-space: wrap; white-space: wrap;
flex: 1;
} }
} }
} }
......
...@@ -7,24 +7,19 @@ ...@@ -7,24 +7,19 @@
<GlCell :formList="formList" :formData="orderObj" @radioChange="radioChange" @inputBlur="inputBlur" @handleCell="handleCell"> <GlCell :formList="formList" :formData="orderObj" @radioChange="radioChange" @inputBlur="inputBlur" @handleCell="handleCell">
<!-- 使用v-for循环渲染产品组件,减少重复代码 --> <!-- 使用v-for循环渲染产品组件,减少重复代码 -->
<template slot="frontGear"> <template slot="frontGear">
<Product v-if="orderObj.frontGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontGear" :positionTypeList="positionTypeList" <Product v-if="orderObj.frontGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontGear" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData"></Product>
:baseConfigData="baseConfigData"></Product>
</template> </template>
<template slot="frontWindow"> <template slot="frontWindow">
<Product v-if="orderObj.frontWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontWindow" :positionTypeList="positionTypeList" <Product v-if="orderObj.frontWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontWindow" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData"></Product>
:baseConfigData="baseConfigData"></Product>
</template> </template>
<template slot="rearWindow"> <template slot="rearWindow">
<Product v-if="orderObj.rearWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearWindow" :positionTypeList="positionTypeList" <Product v-if="orderObj.rearWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearWindow" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData"></Product>
:baseConfigData="baseConfigData"></Product>
</template> </template>
<template slot="rearGear"> <template slot="rearGear">
<Product v-if="orderObj.rearGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearGear" :positionTypeList="positionTypeList" <Product v-if="orderObj.rearGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearGear" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData"></Product>
:baseConfigData="baseConfigData"></Product>
</template> </template>
<template slot="sunRoof"> <template slot="sunRoof">
<Product v-if="orderObj.sunRoof" @changeTotalPrice="changeTotalPrice" :list="orderObj.sunRoof" :positionTypeList="positionTypeList" <Product v-if="orderObj.sunRoof" @changeTotalPrice="changeTotalPrice" :list="orderObj.sunRoof" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData"></Product>
:baseConfigData="baseConfigData"></Product>
</template> </template>
<template slot="package"> <template slot="package">
<Package v-if="orderObj.package" @changeTotalPrice="changeTotalPrice" :list="orderObj.package" :positionTypeList="positionTypeList"></Package> <Package v-if="orderObj.package" @changeTotalPrice="changeTotalPrice" :list="orderObj.package" :positionTypeList="positionTypeList"></Package>
...@@ -48,7 +43,7 @@ ...@@ -48,7 +43,7 @@
</template> </template>
</GlCell> </GlCell>
</view> </view>
<view @click="submit" class="btn">战败下单</view> <view v-debounce.stop="submit" class="btn">战败下单</view>
</scroll-view> </scroll-view>
</view> </view>
<!-- 弹窗 --> <!-- 弹窗 -->
...@@ -206,6 +201,7 @@ export default { ...@@ -206,6 +201,7 @@ export default {
console.log(options, 'options') console.log(options, 'options')
}, },
mounted() { mounted() {
uni.$track.add({ eventCode: 'app_defeat_order' })
console.log('mounted', this.orderCreateType) console.log('mounted', this.orderCreateType)
this.userInfo = uni.$storage.get('userInfo') || {} this.userInfo = uni.$storage.get('userInfo') || {}
this.baseConfigData = uni.$storage.get('mock_data') || {} this.baseConfigData = uni.$storage.get('mock_data') || {}
...@@ -382,6 +378,18 @@ export default { ...@@ -382,6 +378,18 @@ export default {
} }
} }
if (this.orderObj.standNo) {
const vinRex = /[A-Z0-9]{17}$/
console.log(this.orderObj.standNo, vinRex.test(this.orderObj.standNo))
if (!vinRex.test(this.orderObj.standNo)) {
uni.showToast({
title: `请输入正确的VIN码`,
icon: 'none'
})
return false
}
}
// 处理onlyLabel为true的特殊校验 // 处理onlyLabel为true的特殊校验
if (onlyLabelItem.length > 0) { if (onlyLabelItem.length > 0) {
// 检查frontGear、frontWindow、rearGear、rearWindow、sunRoof和couponInfo字段中是否至少有一个不为空 // 检查frontGear、frontWindow、rearGear、rearWindow、sunRoof和couponInfo字段中是否至少有一个不为空
...@@ -456,10 +464,14 @@ export default { ...@@ -456,10 +464,14 @@ export default {
delete obj.customerName delete obj.customerName
delete obj.customerPhone delete obj.customerPhone
console.log(obj, 'rucan') console.log(obj, 'rucan')
uni.showLoading({
title: '提交中...',
mask: true
})
const res = await uni.$api.boutiqueApi.notUpgradeOrder({ json: JSON.stringify(obj) }) const res = await uni.$api.boutiqueApi.notUpgradeOrder({ json: JSON.stringify(obj) })
console.log(res, '===submit') console.log(res, '===submit')
if (res) { if (res) {
uni.hideLoading()
uni.showToast({ uni.showToast({
title: '保存成功', title: '保存成功',
icon: 'success' icon: 'success'
......
<template> <template>
<view class="order-management"> <view class="order-management">
<view class="search-box"> <view class="search-box">
<input class="search-input" v-model="keyword" placeholder="输入客户姓名/商品名称/订单编号/手机号搜索" /> <input class="search-input" placeholder-class="placeholder" v-model="keyword" confirm-type="search" @confirm="handleSearch" placeholder="输入客户姓名/商品名称/订单编号/手机号搜索" />
<view class="clear flex" @click="clear">
<uni-icons type="closeempty" size="16" v-if="keyword"></uni-icons>
</view>
</view> </view>
<view class="tab-container flex justify-between"> <view class="tab-container flex justify-between">
...@@ -223,6 +226,7 @@ export default { ...@@ -223,6 +226,7 @@ export default {
} }
}, },
mounted() { mounted() {
uni.$track.add({ eventCode: 'app_order_management' })
this.localUserInfo = uni.$storage.get('userInfo') || {} this.localUserInfo = uni.$storage.get('userInfo') || {}
this.search() this.search()
this.startWaitOrderPolling() this.startWaitOrderPolling()
...@@ -231,6 +235,10 @@ export default { ...@@ -231,6 +235,10 @@ export default {
this.clearWaitOrderPolling() this.clearWaitOrderPolling()
}, },
methods: { methods: {
clear() {
this.keyword = ''
this.search()
},
search() { search() {
// 判断是不是超管 && !this.localUserInfo.isSuper // 判断是不是超管 && !this.localUserInfo.isSuper
// ,不是只能筛选当前4s店的 // ,不是只能筛选当前4s店的
...@@ -530,6 +538,13 @@ export default { ...@@ -530,6 +538,13 @@ export default {
background: linear-gradient(-44.4deg, #94c2ff00 0%, #5294ff 100%); background: linear-gradient(-44.4deg, #94c2ff00 0%, #5294ff 100%);
filter: blur(24px); filter: blur(24px);
} }
.clear {
position: absolute;
right: toRpx(18);
top: toRpx(10);
height: 100%;
padding: 0 48rpx;
}
.search-input { .search-input {
text-align: center; text-align: center;
...@@ -537,10 +552,28 @@ export default { ...@@ -537,10 +552,28 @@ export default {
border-radius: toRpx(40); border-radius: toRpx(40);
opacity: 1; opacity: 1;
background: #f5f7fa; background: #f5f7fa;
.uni-input-placeholder { .uni-input-placeholder {
color: #999ea8; color: #999ea8;
font-size: toRpx(28); font-size: toRpx(28);
} }
.placeholder {
height: 100%;
color: #999ea8;
font-family: uniicons;
display: flex;
align-items: center;
justify-content: center;
&::after {
display: block;
content: '\e654';
margin-left: 8rpx;
height: 100%;
display: flex;
align-items: center;
font-size: 36rpx;
}
}
} }
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
交易流水号 交易流水号
<text class="required">*</text> <text class="required">*</text>
</view> </view>
<input v-model="outTradeNo" class="uni-input" maxlength="100" placeholder="请输入" /> <input v-model="outTradeNo" type="number" class="uni-input" maxlength="32" placeholder="请输入" />
</view> </view>
<view class="payment"> <view class="payment">
<view class="payment-label"> <view class="payment-label">
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<text class="required">*</text> <text class="required">*</text>
</view> </view>
<view class="upload-box flex flex-wrap"> <view class="upload-box flex flex-wrap">
<view class="upload-item" @click="selectImg"></view> <view class="upload-item" v-debounce.stop="selectImg"></view>
<view v-for="(item, index) in payVoucherList" :key="index" class="previewImageList"> <view v-for="(item, index) in payVoucherList" :key="index" class="previewImageList">
<image :src="item"></image> <image :src="item"></image>
<view class="close-box" @click="deleteImg(index)"> <view class="close-box" v-debounce="[deleteImg, index]">
<uni-icons class="icon-close" type="closeempty" color="#ffffff"></uni-icons> <uni-icons class="icon-close" type="closeempty" color="#ffffff"></uni-icons>
</view> </view>
</view> </view>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="uploadBtn" @click="confirm">确定提交</view> <view class="uploadBtn" v-debounce.stop="confirm">确定提交</view>
</view> </view>
</template> </template>
<script> <script>
...@@ -95,8 +95,12 @@ export default { ...@@ -95,8 +95,12 @@ export default {
}) })
obj.outTradeNo = this.outTradeNo obj.outTradeNo = this.outTradeNo
} }
console.log(obj) uni.showLoading({
title: '提交中...',
mask: true
})
uni.$api.boutiqueApi.createPayOrder(obj).then(data => { uni.$api.boutiqueApi.createPayOrder(obj).then(data => {
uni.hideLoading()
uni.showToast({ title: '提交成功', icon: 'success' }) uni.showToast({ title: '提交成功', icon: 'success' })
this.$emit('jump', 'OrderDetail', data) this.$emit('jump', 'OrderDetail', data)
}) })
......
<template> <template>
<view class="detail-box"> <view class="detail-box">
<view class="nav-bar"> <view class="nav-bar">
<view <view class="back" @click="backPage">
class="back" <uni-icons type="left" :size="20" color="#000"></uni-icons>
@click="backPage"
>
<uni-icons
type="left"
:size="20"
color="#000"
></uni-icons>
</view> </view>
<view class="title">展业工具</view> <view class="title">展业工具</view>
</view> </view>
...@@ -17,46 +10,20 @@ ...@@ -17,46 +10,20 @@
<view class="detail-left"> <view class="detail-left">
<view class="common-title">展业</view> <view class="common-title">展业</view>
<view class="content"> <view class="content">
<image <image class="banner" src="../../../assets/images/common/tool_banner.png" mode="scaleToFill" />
class="banner"
src="../../../assets/images/common/tool_banner.png"
mode="scaleToFill"
/>
<template v-if="toolComponentName !== 'DailyReport'"> <template v-if="toolComponentName !== 'DailyReport'">
<Entrance @entranceClick="entranceClick"></Entrance> <Entrance @entranceClick="entranceClick"></Entrance>
</template> </template>
<template v-else> <template v-else>
<uni-calendar <uni-calendar ref="calendar" :clearDate="false" :endDate="endDate" :showMonth="false" @monthSwitch="currentMonth = `${$event.year}-${$event.month}`" @change="currentDate = $event.fulldate" backgroundColor="transparent" :selected="selectedDays" :date="currentDate" />
ref="calendar"
:clearDate="false"
:endDate="endDate"
:showMonth="false"
@monthSwitch="currentMonth = `${$event.year}-${$event.month}`"
@change="currentDate = $event.fulldate"
backgroundColor="transparent"
:selected="selectedDays"
:date="currentDate"
/>
</template> </template>
</view> </view>
</view> </view>
<view class="detail-right"> <view class="detail-right">
<component <component :is="toolComponentName" @jump="jump" :transmission-of-data="transmissionOfData" :currentDate="currentDate" :currentMonth="currentMonth" @setCalendarSelected="selectedDays = $event" />
:is="toolComponentName"
@jump="jump"
:transmission-of-data="transmissionOfData"
:currentDate="currentDate"
:currentMonth="currentMonth"
@setCalendarSelected="selectedDays = $event"
/>
</view> </view>
</view> </view>
<NoticePopup <NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup>
ref="notice"
title="重要提示"
text="当前页面暂未保存,是否确认退出"
type="warning"
></NoticePopup>
</view> </view>
</template> </template>
...@@ -86,7 +53,7 @@ export default { ...@@ -86,7 +53,7 @@ export default {
UploadProofOfPayment, UploadProofOfPayment,
OrderDetail OrderDetail
}, },
data () { data() {
return { return {
toolComponentName: '', toolComponentName: '',
transmissionOfData: null, transmissionOfData: null,
...@@ -96,7 +63,7 @@ export default { ...@@ -96,7 +63,7 @@ export default {
selectedDays: [] selectedDays: []
} }
}, },
onLoad (options) { onLoad(options) {
if (options.componentName) this.toolComponentName = options.componentName if (options.componentName) this.toolComponentName = options.componentName
if (options.currentDate) this.currentDate = options.currentDate if (options.currentDate) this.currentDate = options.currentDate
uni.$on('jumpToDailyReport', currentDate => { uni.$on('jumpToDailyReport', currentDate => {
...@@ -105,7 +72,7 @@ export default { ...@@ -105,7 +72,7 @@ export default {
}) })
}, },
methods: { methods: {
async entranceClick (item) { async entranceClick(item) {
console.log(item) console.log(item)
if (item.name != 'DailyReport' && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return if (item.name != 'DailyReport' && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return
// 保存当前选择的组件信息,但不立即切换 // 保存当前选择的组件信息,但不立即切换
...@@ -145,11 +112,11 @@ export default { ...@@ -145,11 +112,11 @@ export default {
// 打开弹窗 // 打开弹窗
this.$refs.notice.open() this.$refs.notice.open()
}, },
backPage () { backPage() {
uni.navigateBack() uni.navigateBack()
}, },
// name:跳转组件名,val:跳转参数 // name:跳转组件名,val:跳转参数
jump (name, val) { jump(name, val) {
this.toolComponentName = name this.toolComponentName = name
console.log(this.toolComponentName, val) console.log(this.toolComponentName, val)
if (val) { if (val) {
......
// utils/debounce.js
const debounce = {
bind(el, binding) {
// 支持函数、数组[函数, 参数...]或对象{fn: 函数, params: 参数数组, delay: 延迟时间}格式
if (typeof binding.value !== 'function' && !Array.isArray(binding.value) && (!binding.value || typeof binding.value !== 'object')) {
console.warn('v-debounce binding value must be a function, array or object')
return
}
// 解析参数
let fn,
params = [],
delay = 300
const stopPropagation = binding.modifiers && binding.modifiers.stop
if (typeof binding.value === 'function') {
fn = binding.value
} else if (Array.isArray(binding.value)) {
;[fn, ...params] = binding.value
} else if (typeof binding.value === 'object') {
fn = binding.value.fn
params = binding.value.params || []
delay = binding.value.delay || delay
}
// 如果没有提供函数,直接返回
if (typeof fn !== 'function') {
console.warn('v-debounce: function is required')
return
}
// 获取延迟时间
if (binding.arg) {
delay = parseInt(binding.arg) || delay
}
let timer = null
const debounceFn = function (event) {
// 处理.stop修饰符
if (stopPropagation && event && typeof event.stopPropagation === 'function') {
event.stopPropagation()
}
if (timer) {
clearTimeout(timer)
}
// 收集事件参数
const eventArgs = arguments.length ? Array.from(arguments) : []
timer = setTimeout(() => {
// 合并预设参数和事件参数
const allParams = [...params, ...eventArgs]
fn.apply(this, allParams)
timer = null
}, delay)
}
el._debounceFn = debounceFn
el.addEventListener('click', debounceFn)
},
update(el, binding) {
// 当绑定值发生变化时重新绑定
if (binding.value !== binding.oldValue) {
// 移除旧的事件监听
if (el._debounceFn) {
el.removeEventListener('click', el._debounceFn)
el._debounceFn = null
}
// 重新绑定,逻辑与bind相同
if (typeof binding.value !== 'function' && !Array.isArray(binding.value) && (!binding.value || typeof binding.value !== 'object')) {
console.warn('v-debounce binding value must be a function, array or object')
return
}
let fn,
params = [],
delay = 300
const stopPropagation = binding.modifiers && binding.modifiers.stop
if (typeof binding.value === 'function') {
fn = binding.value
} else if (Array.isArray(binding.value)) {
;[fn, ...params] = binding.value
} else if (typeof binding.value === 'object') {
fn = binding.value.fn
params = binding.value.params || []
delay = binding.value.delay || delay
}
if (typeof fn !== 'function') {
console.warn('v-debounce: function is required')
return
}
if (binding.arg) {
delay = parseInt(binding.arg) || delay
}
let timer = null
const debounceFn = function (event) {
if (stopPropagation && event && typeof event.stopPropagation === 'function') {
event.stopPropagation()
}
if (timer) {
clearTimeout(timer)
}
const eventArgs = arguments.length ? Array.from(arguments) : []
timer = setTimeout(() => {
const allParams = [...params, ...eventArgs]
fn.apply(this, allParams)
timer = null
}, delay)
}
el._debounceFn = debounceFn
el.addEventListener('click', debounceFn)
}
},
unbind(el) {
if (el._debounceFn) {
el.removeEventListener('click', el._debounceFn)
el._debounceFn = null
}
}
}
export default debounce
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!