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

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

@ -30,9 +30,11 @@
<div class="search"> <div class="search">
<Card> <Card>
<Row v-show="openSearch"> <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"> <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" /> style="width: 200px" />
</FormItem> </FormItem>
<FormItem label="商家类型" prop="merchantType"> <FormItem label="商家类型" prop="merchantType">
@ -42,7 +44,7 @@
</Select> </Select>
</FormItem> </FormItem>
<FormItem style="margin-left: -35px" class="br"> <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 @click="handleReset">重置</Button>
</FormItem> </FormItem>
</Form> </Form>
@ -139,6 +141,7 @@
getAllShopData, getAllShopData,
getShopData getShopData
} from "@/api/app"; } from "@/api/app";
import { SEARCH_HISTORY_KEYS, getSearchHistory, saveSearchHistory } from "@/libs/searchHistory";
export default { export default {
name: "user-manage", name: "user-manage",
components: { components: {
@ -156,6 +159,9 @@
courierVisiable:false, courierVisiable:false,
Visiable:false, Visiable:false,
tableSize: "default", tableSize: "default",
searchHistory: {
shopName: getSearchHistory(SEARCH_HISTORY_KEYS.shopName)
},
showUser: false, showUser: false,
showmernage:false, showmernage:false,
showType: "0", showType: "0",
@ -420,6 +426,16 @@
init() { init() {
this.getDataList(); 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) { changePage(v) {
this.searchForm.pageNumber = v; this.searchForm.pageNumber = v;
this.getDataList(); this.getDataList();
@ -459,6 +475,7 @@
}); });
}, },
handleSearch() { handleSearch() {
this.saveCurrentSearchHistory();
this.searchForm.pageNumber = 1; this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10; this.searchForm.pageSize = 10;
this.data = [] this.data = []
@ -675,5 +692,8 @@
mounted() { mounted() {
this.init(); this.init();
}, },
activated() {
this.loadSearchHistory();
},
}; };
</script> </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"> <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> <TabPane v-for="item in currentStatusTabs" :key="item.name" :label="item.label" :name="item.name"></TabPane>
</Tabs> </Tabs>
<Row v-show="openSearch" @keydown.enter.native="handleSearch"> <Row v-show="openSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="100"> <Form ref="searchForm" :model="searchForm" inline :label-width="100" autocomplete="off"
@submit.native.prevent="handleSearch">
<FormItem label="订单编号" prop="id"> <FormItem label="订单编号" prop="id">
<Input type="text" v-model="searchForm.id" clearable placeholder="请输入订单编号" <Input type="text" v-model="searchForm.id" clearable placeholder="请输入订单编号"
style="width: 200px" /> style="width: 200px" />
</FormItem> </FormItem>
<FormItem label="店铺名称" prop="shopName"> <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" /> style="width: 200px" />
</FormItem> </FormItem>
<FormItem label="收货人手机号" prop="receiverPhone"> <FormItem label="收货人手机号" prop="receiverPhone">
@ -131,7 +133,7 @@
</FormItem> </FormItem>
</div> </div>
<FormItem style="margin-left: -35px" class="br"> <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 @click="handleReset">重置</Button>
</FormItem> </FormItem>
</Form> </Form>
@ -276,6 +278,7 @@
} from "@/api/index"; } from "@/api/index";
import addEdit from "./addEdit.vue"; import addEdit from "./addEdit.vue";
import logisticsAddress from "@/views/sys/order-manage/logisticsAddress"; import logisticsAddress from "@/views/sys/order-manage/logisticsAddress";
import { SEARCH_HISTORY_KEYS, getSearchHistory, saveSearchHistory } from "@/libs/searchHistory";
export default { export default {
name: "order-manage", name: "order-manage",
components: { components: {
@ -285,6 +288,9 @@
data() { data() {
return { return {
tableSize: "default", tableSize: "default",
searchHistory: {
shopName: getSearchHistory(SEARCH_HISTORY_KEYS.shopName)
},
Visiable: false, Visiable: false,
showOrder: false, showOrder: false,
showType: "0", showType: "0",
@ -946,6 +952,7 @@
this.init(); this.init();
}, },
activated() { activated() {
this.loadSearchHistory();
if (this.hasActivatedOnce) { if (this.hasActivatedOnce) {
this.refreshOnMenuClick(); this.refreshOnMenuClick();
} }
@ -957,6 +964,16 @@
this.getFeedbackTodoCount(); this.getFeedbackTodoCount();
this.getLogisticsInfo() 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() { refreshOnMenuClick() {
this.refreshWholePage(); this.refreshWholePage();
}, },
@ -1172,6 +1189,7 @@
}, },
handleSearch() { handleSearch() {
this.saveCurrentSearchHistory();
if (this.isRefundTab) { if (this.isRefundTab) {
this.returnForm.pageNum = 1; this.returnForm.pageNum = 1;
this.returnForm.pageSize = 10; this.returnForm.pageSize = 10;

Loading…
Cancel
Save