|
|
@@ -7,15 +7,15 @@
|
|
|
|
|
|
<view v-if="activeType === 'goods'" class="panel">
|
|
|
<view class="search-row">
|
|
|
- <view class="search-type-wrap">
|
|
|
- <button class="admin-button-com middle small-btn" :class="[searchType === 0 ? 'blue' : 'default']" @click="changeSearchType(0)">名称</button>
|
|
|
- <button class="admin-button-com middle small-btn" :class="[searchType === 1 ? 'blue' : 'default']" @click="changeSearchType(1)">编号</button>
|
|
|
- </view>
|
|
|
- <view class="search-box">
|
|
|
+ <button class="admin-button-com middle small-btn blue" @click="changeSearchType">
|
|
|
+ <text>{{ searchTypeLabel }}</text>
|
|
|
+ <zui-svg-icon class="search-type-icon" icon="general-switch" :width="14" :height="14" color="#fff" />
|
|
|
+ </button>
|
|
|
+ <view class="search-box has-search-btn">
|
|
|
<text class="search-icon">⌕</text>
|
|
|
<input v-model="searchText" class="search-input" placeholder="请输入" confirm-type="search" @confirm="searchGoods" />
|
|
|
+ <button class="admin-button-com middle blue search-btn" @click="searchGoods">搜索</button>
|
|
|
</view>
|
|
|
- <button class="admin-button-com middle blue search-btn" @click="searchGoods">搜索</button>
|
|
|
</view>
|
|
|
|
|
|
<view class="filter-row">
|
|
|
@@ -503,7 +503,11 @@ export default {
|
|
|
// 汇总门店、登录人与字典信息;只读取 Vuex,不修改全局状态。
|
|
|
computed: {
|
|
|
...mapGetters(["getMyShopInfo", "getLoginInfo"]),
|
|
|
- ...mapGetters({ loginInfo: "getLoginInfo", dictInfo: "getDictionariesInfo" })
|
|
|
+ ...mapGetters({ loginInfo: "getLoginInfo", dictInfo: "getDictionariesInfo" }),
|
|
|
+ // 合并后的搜索类型按钮文案:0 按名称,1 按编号,避免模板里写三元判断。
|
|
|
+ searchTypeLabel() {
|
|
|
+ return this.searchType === 0 ? "名称" : "编号"
|
|
|
+ }
|
|
|
},
|
|
|
// 页面首次进入只加载花束与分享配置;花材按需懒加载,路由 type=item 时再进入花材流程。
|
|
|
onLoad(options) {
|
|
|
@@ -656,9 +660,9 @@ export default {
|
|
|
this.lastSearchText = ""
|
|
|
this.refreshGoods()
|
|
|
},
|
|
|
- // 切换按名称或编号搜索并立即刷新;i 为后端约定的搜索类型值。
|
|
|
- changeSearchType(i) {
|
|
|
- this.searchType = i
|
|
|
+ // 在名称/编号之间切换搜索类型并立即刷新;合并为一个按钮后点击即取反。
|
|
|
+ changeSearchType() {
|
|
|
+ this.searchType = this.searchType === 0 ? 1 : 0
|
|
|
this.searchGoods()
|
|
|
},
|
|
|
// 提交花束关键词搜索;有关键词时跨分类查询,清空后恢复首个分类。
|
|
|
@@ -1298,16 +1302,6 @@ page {
|
|
|
margin-left: 10upx;
|
|
|
}
|
|
|
|
|
|
-.search-type-wrap {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
-}
|
|
|
-
|
|
|
-/* 名称/编号切换按钮间距,避免小程序原生 button 相邻选择器不生效 */
|
|
|
-.search-type-wrap .small-btn:not(:last-child) {
|
|
|
- margin-right: 12upx;
|
|
|
-}
|
|
|
-
|
|
|
.small-btn,
|
|
|
.image-class-btn,
|
|
|
.search-btn,
|
|
|
@@ -1316,8 +1310,20 @@ page {
|
|
|
white-space: nowrap;
|
|
|
}
|
|
|
|
|
|
-.small-btn {
|
|
|
- width: 92upx;
|
|
|
+/* 名称/编号合并按钮:文字+切换图标同一行,宽度随内容伸缩 */
|
|
|
+.admin-button-com.middle.small-btn {
|
|
|
+ width: auto;
|
|
|
+ min-width: 120upx;
|
|
|
+ height: 68upx;
|
|
|
+ padding: 0 16upx;
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+
|
|
|
+.search-type-icon {
|
|
|
+ flex-shrink: 0;
|
|
|
+ margin-left: 6upx;
|
|
|
}
|
|
|
|
|
|
.image-class-btn {
|
|
|
@@ -1335,6 +1341,12 @@ page {
|
|
|
padding: 0 24upx;
|
|
|
box-sizing: border-box;
|
|
|
min-width: 0;
|
|
|
+ margin-left: 8upx;
|
|
|
+}
|
|
|
+
|
|
|
+/* 内嵌搜索按钮时收紧右侧内边距,让按钮贴在圆角框内 */
|
|
|
+.search-box.has-search-btn {
|
|
|
+ padding-right: 6upx;
|
|
|
}
|
|
|
|
|
|
.search-icon {
|
|
|
@@ -1354,6 +1366,19 @@ page {
|
|
|
width: 108upx;
|
|
|
}
|
|
|
|
|
|
+/* 花束搜索框内的搜索按钮:压低高度以免撑破圆角输入框 */
|
|
|
+.search-box .search-btn {
|
|
|
+ height: 54upx;
|
|
|
+ padding-top: 0;
|
|
|
+ padding-bottom: 0;
|
|
|
+ flex-shrink: 0;
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ font-size: 24upx;
|
|
|
+ border-radius: 26upx;
|
|
|
+}
|
|
|
+
|
|
|
.filter-row {
|
|
|
display: flex;
|
|
|
align-items: center;
|