diff --git a/package-lock.json b/package-lock.json index 334ce0c..d478e08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.0", "eslint-plugin-vue": "^6.2.2", + "lodash": "^4.17.21", "mapbox-gl": "^2.15.0", "mqtt": "^2.18.9", "normalize.css": "^8.0.1", diff --git a/package.json b/package.json index 5a897df..7c90f1c 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.0", "eslint-plugin-vue": "^6.2.2", + "lodash": "^4.17.21", "mapbox-gl": "^2.15.0", "mqtt": "^2.18.9", "normalize.css": "^8.0.1", diff --git a/src/views/layout/components/main/order/index.vue b/src/views/layout/components/main/order/index.vue index a5e267a..85f8459 100644 --- a/src/views/layout/components/main/order/index.vue +++ b/src/views/layout/components/main/order/index.vue @@ -24,7 +24,7 @@ - + + - + @@ -67,6 +67,7 @@ import SelectionShipmentStatus from '@/components/SelectionShipmentStatus' import SelectionRefundStatus from '@/components/SelectionRefundStatus' import DatePickerOrder from '@/components/DatePickerOrder' import SearchOrder from '@/components/SearchOrder' +import { debounce } from 'lodash'// 防抖 export default { name: 'Order', @@ -74,7 +75,8 @@ export default { return { pageSize: 50, // 每页显示记录条数 currentPage: 1, // 当前页 - shop_id: this.$store.state.user.shop_id // 搜索条件 商铺id + shop_id: this.$store.state.user.shop_id, // 搜索条件 商铺id + orderList: []// 订单列表 } }, components: { @@ -86,12 +88,6 @@ export default { SearchOrder }, computed: { - /** - * @description: 订单列表 - */ - orderList () { - return [] - }, /** * @description: 搜索条件 集合 */ @@ -106,15 +102,25 @@ export default { */ async getOrderList (orderSerch) { const res = await getOrderList(orderSerch) - console.log(res) - } + this.orderList = res.data.orderList + console.log(res.data.orderList) + }, + /** + * @description: 表单提交 加入防抖 + */ + debouncedGetOrderList: debounce(function (val) { + this.getOrderList(val) + }, 500) }, watch: { shop_id (val) { this.$store.commit('app/setOrderSerch', { shop_id: val }) }, - orderSerch (val) { - this.getOrderList(val) + orderSerch: { + handler (val) { + this.debouncedGetOrderList(val)// 表单提交 加入防抖 + }, + deep: true } }, created () {