|
|
@@ -43,7 +43,13 @@
|
|
|
:class="{ active: currentTab === index }"
|
|
|
@tap.stop="swichTab(index, item)"
|
|
|
>
|
|
|
- <view class="category-icon"></view>
|
|
|
+ <!-- 花束分类图标:与 categoryV2 一致取 img,无图时不占位以免侧栏文字错位 -->
|
|
|
+ <image
|
|
|
+ v-if="getCategoryIconSrc(item)"
|
|
|
+ class="category-icon"
|
|
|
+ :src="getCategoryIconSrc(item)"
|
|
|
+ mode="aspectFill"
|
|
|
+ />
|
|
|
<text>{{ item.categoryName || '' }}</text>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
@@ -115,8 +121,8 @@
|
|
|
<view class="filter-tab" :class="{ active: globalLookStock === 2 }" @click="changeHasStock(2)">没库存</view>
|
|
|
</view>
|
|
|
<view class="action-btns">
|
|
|
- <button class="admin-button-com middle blue tool-btn tool-btn--wide" @click="selectFlowerNumFn">⌯ 筛选</button>
|
|
|
- <button class="admin-button-com middle blue tool-btn" @click="refreshItem">⟳ 刷新</button>
|
|
|
+ <button class="admin-button-com middle blue tool-btn tool-btn--wide" @click="selectFlowerNumFn"><zui-svg-icon class="tool-btn-icon" icon="general-filter" :width="14" :height="14" color="#fff" />筛选</button>
|
|
|
+ <button class="admin-button-com middle blue tool-btn" @click="refreshItem"><zui-svg-icon class="tool-btn-icon" icon="general-refresh" :width="14" :height="14" color="#fff" />刷新</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -129,7 +135,13 @@
|
|
|
:class="{ active: globalClassIndex === index }"
|
|
|
@tap.stop="globalSwitchClass(index, item)"
|
|
|
>
|
|
|
- <view class="category-icon"></view>
|
|
|
+ <!-- 花材分类图标:优先 smallCover,其次 cover,与分类管理页展示字段对齐 -->
|
|
|
+ <image
|
|
|
+ v-if="getCategoryIconSrc(item)"
|
|
|
+ class="category-icon"
|
|
|
+ :src="getCategoryIconSrc(item)"
|
|
|
+ mode="aspectFill"
|
|
|
+ />
|
|
|
<text>{{ item.name || '' }}</text>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
@@ -280,6 +292,18 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
+ <!-- 已开通花材批发店时,引导去批发端小程序修改花材,避免在零售端误改 -->
|
|
|
+ <modal-module
|
|
|
+ :show="showPfItemTip"
|
|
|
+ content="请到销花宝批发端修改花材"
|
|
|
+ color="#333"
|
|
|
+ :size="32"
|
|
|
+ padding="30rpx 30rpx"
|
|
|
+ :button="pfItemTipButtons"
|
|
|
+ :maskClosable="true"
|
|
|
+ @click="onPfItemTipClick"
|
|
|
+ />
|
|
|
+
|
|
|
<modal-module :show="printLabelShow" @click="dialogInputConfirm" :maskClosable="true" title="数量" padding="30rpx 30rpx">
|
|
|
<template v-slot:content>
|
|
|
<view class="app-modal-input-wrap">
|
|
|
@@ -464,7 +488,16 @@ export default {
|
|
|
partFocus: false,
|
|
|
remarkShow: false,
|
|
|
remarkText: "",
|
|
|
- remarkFocus: false
|
|
|
+ remarkFocus: false,
|
|
|
+ // 花材是否已懒加载过,避免重复 initItem 请求
|
|
|
+ itemInited: false,
|
|
|
+ // 已开通批发店时切换花材的引导弹窗
|
|
|
+ showPfItemTip: false,
|
|
|
+ // 引导弹窗按钮:沿用 modal-module 默认描边/实心样式
|
|
|
+ pfItemTipButtons: [
|
|
|
+ { text: "返回花束", plain: true },
|
|
|
+ { text: "去批发端", plain: false }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
// 汇总门店、登录人与字典信息;只读取 Vuex,不修改全局状态。
|
|
|
@@ -472,16 +505,16 @@ export default {
|
|
|
...mapGetters(["getMyShopInfo", "getLoginInfo"]),
|
|
|
...mapGetters({ loginInfo: "getLoginInfo", dictInfo: "getDictionariesInfo" })
|
|
|
},
|
|
|
- // 页面首次进入时按路由参数选择商品类型,并并行初始化分享配置、花束分类与花材数据。
|
|
|
+ // 页面首次进入只加载花束与分享配置;花材按需懒加载,路由 type=item 时再进入花材流程。
|
|
|
onLoad(options) {
|
|
|
- if (options && options.type === "item") {
|
|
|
- this.activeType = "item"
|
|
|
- }
|
|
|
getWeixinId().then(res => {
|
|
|
this.getAppIdList = res.data
|
|
|
})
|
|
|
this.getCategoryData()
|
|
|
- this.initItem()
|
|
|
+ // 深链直接进花材时走同一套切换逻辑,以便已开通批发店时弹出引导而非误加载花材
|
|
|
+ if (options && options.type === "item") {
|
|
|
+ this.switchType("item")
|
|
|
+ }
|
|
|
},
|
|
|
// 页面重新可见时消费花束刷新标记,避免从编辑页返回后展示旧数据。
|
|
|
onShow() {
|
|
|
@@ -494,9 +527,87 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 切换花束或花材面板;type 仅接受 goods、item,不重新发起已完成的初始化请求。
|
|
|
+ /**
|
|
|
+ * 解析侧栏分类图标地址。
|
|
|
+ * 花束分类用 img;花材分类优先 smallCover,其次 cover。
|
|
|
+ * @param {Object} item 分类项
|
|
|
+ * @returns {string} 图标完整地址,无图返回空字符串(模板不渲染 image)
|
|
|
+ */
|
|
|
+ getCategoryIconSrc(item) {
|
|
|
+ if (!item) return ""
|
|
|
+ return item.img || item.smallCover || item.cover || ""
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 切换花束 / 花材面板。
|
|
|
+ * 已开通花材批发店(pfShopId>0)时切到花材只弹引导,不切换面板、不加载花材;
|
|
|
+ * 未开通时才切换并按需懒加载花材数据。
|
|
|
+ * @param {string} type goods | item
|
|
|
+ */
|
|
|
switchType(type) {
|
|
|
- this.activeType = type
|
|
|
+ if (type === this.activeType) return
|
|
|
+ if (type === "item") {
|
|
|
+ // 零售店已绑定批发店:花材应在批发端维护,此处拦截并引导跳转销花宝
|
|
|
+ if (Number(this.getMyShopInfo && this.getMyShopInfo.pfShopId) > 0) {
|
|
|
+ this.showPfItemTip = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.activeType = "item"
|
|
|
+ this.ensureItemLoaded()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.activeType = "goods"
|
|
|
+ },
|
|
|
+ // 关闭「去批发端」引导弹窗,保持当前仍在花束面板。
|
|
|
+ closePfItemTip() {
|
|
|
+ this.showPfItemTip = false
|
|
|
+ },
|
|
|
+ // 处理引导弹窗按钮:0 返回花束,1 跳转批发端小程序。
|
|
|
+ onPfItemTipClick(val) {
|
|
|
+ if (!val || val.index == 0) {
|
|
|
+ this.closePfItemTip()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.goToPfMiniProgram()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 打开批发端小程序(现网「销花宝」,测试环境「花惠宝」)。
|
|
|
+ * appId 取自 getWeixinId 的 ghs.miniAppId;未缓存时再请求一次。
|
|
|
+ */
|
|
|
+ goToPfMiniProgram() {
|
|
|
+ this.closePfItemTip()
|
|
|
+ const openGhs = appIdList => {
|
|
|
+ const appId = appIdList && appIdList.ghs && appIdList.ghs.miniAppId
|
|
|
+ if (!appId) {
|
|
|
+ this.$msg("暂无法打开批发端")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ uni.navigateToMiniProgram({
|
|
|
+ appId: appId,
|
|
|
+ path: "admin/home/workbench",
|
|
|
+ envVersion: process.env.NODE_ENV === "development" ? "develop" : "release",
|
|
|
+ extraData: {},
|
|
|
+ success() {}
|
|
|
+ })
|
|
|
+ // #endif
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ this.$msg("请用微信打开")
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
+ if (this.getAppIdList && this.getAppIdList.ghs && this.getAppIdList.ghs.miniAppId) {
|
|
|
+ openGhs(this.getAppIdList)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ getWeixinId().then(res => {
|
|
|
+ this.getAppIdList = res.data || {}
|
|
|
+ openGhs(this.getAppIdList)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 首次进入花材时初始化分类与列表;已初始化则跳过,避免重复请求。
|
|
|
+ ensureItemLoaded() {
|
|
|
+ if (this.itemInited) return
|
|
|
+ this.itemInited = true
|
|
|
+ this.initItem()
|
|
|
},
|
|
|
// 加载花束分类并默认选中首个有效分类;分类为空时保留空态,不请求无效分类。
|
|
|
getCategoryData() {
|
|
|
@@ -1385,7 +1496,9 @@ page {
|
|
|
border-radius: 10upx;
|
|
|
flex-shrink: 0;
|
|
|
margin-right: 12upx;
|
|
|
- background: transparent;
|
|
|
+ background: #f5f5f5;
|
|
|
+ display: block;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.list-box {
|