Commit 7420eca3 by 李伟康

commit 增加防抖

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