wangfukang 2 weeks ago
parent
commit
0832f91e19
  1. 28
      src/libs/searchHistory.js
  2. 34
      src/views/app/business/logistics/logistics.vue
  3. 26
      src/views/app/shop/shop.vue
  4. 26
      src/views/sys/order-manage/orderManage.vue

28
src/libs/searchHistory.js

@ -0,0 +1,28 @@
import { getStore, setStore } from "@/libs/storage";
const DEFAULT_LIMIT = 5;
export const SEARCH_HISTORY_KEYS = {
shopName: "search-history:shop-name",
workerName: "search-history:worker-name"
};
export const getSearchHistory = (key) => {
try {
const value = getStore(key);
const list = JSON.parse(value);
return Array.isArray(list) ? list.filter((item) => typeof item === "string" && item.trim() !== "") : [];
} catch (e) {
return [];
}
};
export const saveSearchHistory = (key, value, limit = DEFAULT_LIMIT) => {
const text = String(value || "").trim();
if (!text) return getSearchHistory(key);
const list = getSearchHistory(key).filter((item) => item !== text);
const nextList = [text, ...list].slice(0, limit);
setStore(key, nextList);
return nextList;
};

34
src/views/app/business/logistics/logistics.vue

@ -154,8 +154,9 @@
</FormItem>
</Form>
</div>
<Row v-if="isOrderTab" v-show="openSearch" @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="activeSearchForm" inline :label-width="90">
<Row v-if="isOrderTab" v-show="openSearch">
<Form ref="searchForm" :model="activeSearchForm" inline :label-width="90" autocomplete="off"
@submit.native.prevent="handleSearch">
<FormItem label="配送类型" v-if="tabName === 'delivery'">
<Select v-model="deliverySearchForm.deliveryType" clearable placeholder="全部类型" style="width: 160px"
@on-change="handleSearch">
@ -165,11 +166,13 @@
</Select>
</FormItem>
<FormItem label="配送员名称" prop="workerName" v-if="tabName === 'delivery'">
<Input type="text" v-model="deliverySearchForm.workerName" clearable placeholder="请输入配送员名称"
<AutoComplete v-model="deliverySearchForm.workerName" :data="searchHistory.workerName"
:filter-method="filterSearchHistory" clearable placeholder="请输入配送员名称"
style="width: 180px" />
</FormItem>
<FormItem label="店铺名称" prop="shopName">
<Input type="text" v-model="activeSearchForm.shopName" clearable placeholder="请输入店铺名称"
<AutoComplete v-model="activeSearchForm.shopName" :data="searchHistory.shopName"
:filter-method="filterSearchHistory" clearable placeholder="请输入店铺名称"
style="width: 180px" />
</FormItem>
<FormItem label="取货区域">
@ -181,7 +184,7 @@
:root-id="currentRegionId" @on-change="handlePutAreaChange" @on-clear="handlePutAreaChange('')" />
</FormItem>
<FormItem style="margin-left: -35px" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
<Button html-type="submit" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
<Button v-if="tabName === 'hall'" :type="hallSearchForm.order === 'deliveryFee' ? 'warning' : 'default'"
@click="toggleCommissionSort">佣金优先</Button>
@ -285,6 +288,7 @@
import addEdit from "./addEdit.vue";
import logisticsAddress from "@/views/app/business/logistics/logisticsAddress";
import shopAreaTreeChoose from "@/views/my-components/hiver/shopArea-tree-choose";
import { SEARCH_HISTORY_KEYS, getSearchHistory, saveSearchHistory } from "@/libs/searchHistory";
const HALL_TYPE_MAP = {
waimai: 1,
@ -314,6 +318,10 @@
Visiable: false,
transferList: [],
tableSize: "default",
searchHistory: {
shopName: getSearchHistory(SEARCH_HISTORY_KEYS.shopName),
workerName: getSearchHistory(SEARCH_HISTORY_KEYS.workerName)
},
showOrder: false,
showType: "0",
openSearch: true,
@ -463,6 +471,20 @@
this.getBaseDeliveryFeeSetting();
this.getDeliverySwitch();
},
loadSearchHistory() {
this.searchHistory.shopName = getSearchHistory(SEARCH_HISTORY_KEYS.shopName);
this.searchHistory.workerName = getSearchHistory(SEARCH_HISTORY_KEYS.workerName);
},
filterSearchHistory(value, option) {
if (!value) return true;
return String(option || "").toLowerCase().indexOf(String(value).toLowerCase()) > -1;
},
saveCurrentSearchHistory() {
this.searchHistory.shopName = saveSearchHistory(SEARCH_HISTORY_KEYS.shopName, this.activeSearchForm.shopName);
if (this.tabName === "delivery") {
this.searchHistory.workerName = saveSearchHistory(SEARCH_HISTORY_KEYS.workerName, this.deliverySearchForm.workerName);
}
},
refreshOnMenuClick() {
if (this.isOrderTab) {
this.getLogisticsInfo();
@ -731,6 +753,7 @@
this.handleSearch();
},
handleSearch() {
this.saveCurrentSearchHistory();
this.activeSearchForm.pageNum = 1;
this.getLogisticsInfo();
this.refreshOrderCounts();
@ -1601,6 +1624,7 @@
this.init();
},
activated() {
this.loadSearchHistory();
this.startCountRefreshTimer();
if (this.hasActivatedOnce) {
this.refreshOnMenuClick();

26
src/views/app/shop/shop.vue

@ -30,9 +30,11 @@
<div class="search">
<Card>
<Row v-show="openSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="70">
<Form ref="searchForm" :model="searchForm" inline :label-width="70" autocomplete="off"
@submit.native.prevent="handleSearch">
<FormItem label="店铺名称" prop="shopName">
<Input type="text" v-model="searchForm.shopName" clearable placeholder="请输入店铺名称"
<AutoComplete v-model="searchForm.shopName" :data="searchHistory.shopName"
:filter-method="filterSearchHistory" clearable placeholder="请输入店铺名称"
style="width: 200px" />
</FormItem>
<FormItem label="商家类型" prop="merchantType">
@ -42,7 +44,7 @@
</Select>
</FormItem>
<FormItem style="margin-left: -35px" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
<Button html-type="submit" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
</FormItem>
</Form>
@ -139,6 +141,7 @@
getAllShopData,
getShopData
} from "@/api/app";
import { SEARCH_HISTORY_KEYS, getSearchHistory, saveSearchHistory } from "@/libs/searchHistory";
export default {
name: "user-manage",
components: {
@ -156,6 +159,9 @@
courierVisiable:false,
Visiable:false,
tableSize: "default",
searchHistory: {
shopName: getSearchHistory(SEARCH_HISTORY_KEYS.shopName)
},
showUser: false,
showmernage:false,
showType: "0",
@ -420,6 +426,16 @@
init() {
this.getDataList();
},
loadSearchHistory() {
this.searchHistory.shopName = getSearchHistory(SEARCH_HISTORY_KEYS.shopName);
},
filterSearchHistory(value, option) {
if (!value) return true;
return String(option || "").toLowerCase().indexOf(String(value).toLowerCase()) > -1;
},
saveCurrentSearchHistory() {
this.searchHistory.shopName = saveSearchHistory(SEARCH_HISTORY_KEYS.shopName, this.searchForm.shopName);
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
@ -459,6 +475,7 @@
});
},
handleSearch() {
this.saveCurrentSearchHistory();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.data = []
@ -675,5 +692,8 @@
mounted() {
this.init();
},
activated() {
this.loadSearchHistory();
},
};
</script>

26
src/views/sys/order-manage/orderManage.vue

@ -106,14 +106,16 @@
<Tabs v-if="!isRefundTab && !isFeedbackTab" v-model="tabName1" :animated="false" @on-click="changeTab">
<TabPane v-for="item in currentStatusTabs" :key="item.name" :label="item.label" :name="item.name"></TabPane>
</Tabs>
<Row v-show="openSearch" @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="100">
<Row v-show="openSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="100" autocomplete="off"
@submit.native.prevent="handleSearch">
<FormItem label="订单编号" prop="id">
<Input type="text" v-model="searchForm.id" clearable placeholder="请输入订单编号"
style="width: 200px" />
</FormItem>
<FormItem label="店铺名称" prop="shopName">
<Input type="text" v-model="searchForm.shopName" clearable placeholder="请输入店铺名称"
<AutoComplete v-model="searchForm.shopName" :data="searchHistory.shopName"
:filter-method="filterSearchHistory" clearable placeholder="请输入店铺名称"
style="width: 200px" />
</FormItem>
<FormItem label="收货人手机号" prop="receiverPhone">
@ -131,7 +133,7 @@
</FormItem>
</div>
<FormItem style="margin-left: -35px" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
<Button html-type="submit" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
</FormItem>
</Form>
@ -276,6 +278,7 @@
} from "@/api/index";
import addEdit from "./addEdit.vue";
import logisticsAddress from "@/views/sys/order-manage/logisticsAddress";
import { SEARCH_HISTORY_KEYS, getSearchHistory, saveSearchHistory } from "@/libs/searchHistory";
export default {
name: "order-manage",
components: {
@ -285,6 +288,9 @@
data() {
return {
tableSize: "default",
searchHistory: {
shopName: getSearchHistory(SEARCH_HISTORY_KEYS.shopName)
},
Visiable: false,
showOrder: false,
showType: "0",
@ -946,6 +952,7 @@
this.init();
},
activated() {
this.loadSearchHistory();
if (this.hasActivatedOnce) {
this.refreshOnMenuClick();
}
@ -957,6 +964,16 @@
this.getFeedbackTodoCount();
this.getLogisticsInfo()
},
loadSearchHistory() {
this.searchHistory.shopName = getSearchHistory(SEARCH_HISTORY_KEYS.shopName);
},
filterSearchHistory(value, option) {
if (!value) return true;
return String(option || "").toLowerCase().indexOf(String(value).toLowerCase()) > -1;
},
saveCurrentSearchHistory() {
this.searchHistory.shopName = saveSearchHistory(SEARCH_HISTORY_KEYS.shopName, this.searchForm.shopName);
},
refreshOnMenuClick() {
this.refreshWholePage();
},
@ -1172,6 +1189,7 @@
},
handleSearch() {
this.saveCurrentSearchHistory();
if (this.isRefundTab) {
this.returnForm.pageNum = 1;
this.returnForm.pageSize = 10;

Loading…
Cancel
Save