Commit 7420eca3 by 李伟康

commit 增加防抖

1 parent 427061e8
...@@ -232,6 +232,7 @@ export default { ...@@ -232,6 +232,7 @@ export default {
}, },
methods: { methods: {
changeIndex (index) { changeIndex (index) {
if (this.tabIndex == index) return
this.tabIndex = index; this.tabIndex = index;
this.$emit("changeTab", index) this.$emit("changeTab", index)
}, },
......
...@@ -16,12 +16,14 @@ import GlsxImage from "./components/GlsxImage"; ...@@ -16,12 +16,14 @@ import GlsxImage from "./components/GlsxImage";
import MessageBox from "./components/MessageBox/index"; 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 utils from "./utils/utils";
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);
uni.$api = api; uni.$api = api;
uni.$storage = new Storage(); uni.$storage = new Storage();
uni.$throttle = utils.throttle
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;
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
export default { export default {
name: '', name: 'CustomerType',
data () { data () {
return { return {
typeList: [ typeList: [
...@@ -67,10 +67,11 @@ export default { ...@@ -67,10 +67,11 @@ export default {
this.$refs.customer.close(); this.$refs.customer.close();
this.$emit('cancel') this.$emit('cancel')
}, },
choose (index) { choose: uni.$throttle(function (index) {
this.$emit('choose', index) this.$emit('choose', index)
this.$refs.customer.close(); this.$refs.customer.close();
} }, 200)
} }
} }
</script> </script>
......
...@@ -66,7 +66,6 @@ import { mapMutations } from "vuex"; ...@@ -66,7 +66,6 @@ import { mapMutations } from "vuex";
import invitation from "./invitation.vue"; import invitation from "./invitation.vue";
import Case from "./case.vue"; import Case from "./case.vue";
import history from "./history.vue"; import history from "./history.vue";
import utils from "@/utils/utils";
export default { export default {
components: { components: {
ToolBox, ToolBox,
......
...@@ -11,14 +11,15 @@ ...@@ -11,14 +11,15 @@
@blur="input($event)" @blur="input($event)"
@focus="focus" @focus="focus"
/> />
<view class="input-tips" v-if="!isSearch" <view
class="input-tips"
v-if="!isSearch"
>搜索客户姓名/电话<uni-icons >搜索客户姓名/电话<uni-icons
type="search" type="search"
class="icon" class="icon"
color="#999" color="#999"
size="20" size="20"
></uni-icons ></uni-icons></view>
></view>
<uni-icons <uni-icons
v-if="isSearch" v-if="isSearch"
type="closeempty" type="closeempty"
...@@ -38,16 +39,20 @@ ...@@ -38,16 +39,20 @@
<template v-if="flag"> <template v-if="flag">
<template v-if="list.length"> <template v-if="list.length">
<template v-for="item in list"> <template v-for="item in list">
<view class="item" :key="item.id" @click="reception(item)">
<view <view
:class="['status flex', 'status_' + formatInvite(item)]" class="item"
>{{ inviteStatus[formatInvite(item)] }}</view :key="item.id"
@click="reception(item)"
> >
<view :class="['status flex', 'status_' + formatInvite(item)]">{{ inviteStatus[formatInvite(item)] }}</view>
<view class="name"> <view class="name">
{{ item.customerName }} {{ item.customerName }}
</view> </view>
<template v-for="(k, ind) in itemObject"> <template v-for="(k, ind) in itemObject">
<view class="info flex" :key="ind"> <view
class="info flex"
:key="ind"
>
<view class="label">{{ k.label }}</view> <view class="label">{{ k.label }}</view>
<view class="value">{{ <view class="value">{{
k.format k.format
...@@ -114,20 +119,20 @@ export default { ...@@ -114,20 +119,20 @@ export default {
return this.$store.state.user.historyStatus return this.$store.state.user.historyStatus
}, },
}, },
watch:{ watch: {
watchStatus:{ watchStatus: {
handler() { handler () {
this.init() this.init()
}, },
immediate:true immediate: true
}, },
show(){ show () {
this.$refs.receptionTips?.close() this.$refs.receptionTips?.close()
} }
}, },
methods: { methods: {
init() { init () {
this.customerNameOrPhone = ''; this.customerNameOrPhone = '';
this.isSearch = false this.isSearch = false
this.pageNum = 1 this.pageNum = 1
...@@ -135,14 +140,14 @@ export default { ...@@ -135,14 +140,14 @@ export default {
this.getRecordList() this.getRecordList()
}, },
//已预约的并且预约时间小于当前时间的,显示超时未到店,否则显示已预约 //已预约的并且预约时间小于当前时间的,显示超时未到店,否则显示已预约
formatInvite(val) { formatInvite (val) {
if(val.inviteStatus == 2 && new Date().getTime() > new Date(val.inviteDate).getTime()) { if (val.inviteStatus == 2 && new Date().getTime() > new Date(val.inviteDate).getTime()) {
return 5 return 5
} }
return val.inviteStatus return val.inviteStatus
}, },
formatTime(val,key) { formatTime (val, key) {
if(key == 'customerPhone') { if (key == 'customerPhone') {
return val.slice(0, 3) + " " + val.slice(3, 7) + " " + val.slice(7) return val.slice(0, 3) + " " + val.slice(3, 7) + " " + val.slice(7)
} }
return dayjs(val).format("YYYY-MM-DD HH:mm:ss") return dayjs(val).format("YYYY-MM-DD HH:mm:ss")
...@@ -167,7 +172,7 @@ export default { ...@@ -167,7 +172,7 @@ export default {
focus () { focus () {
this.isSearch = true this.isSearch = true
}, },
handleClear() { handleClear () {
this.init() this.init()
}, },
getRecordList () { getRecordList () {
...@@ -185,11 +190,11 @@ export default { ...@@ -185,11 +190,11 @@ export default {
this.chooseItem = item this.chooseItem = item
this.$refs.receptionTips.open() this.$refs.receptionTips.open()
}, },
jumpPage () { jumpPage: uni.$throttle(function () {
this.$emit('reception', { this.$emit('reception', {
item: this.chooseItem item: this.chooseItem
}) })
} }, 200)
}, },
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!