|
|
@@ -154,53 +154,6 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
-
|
|
|
- <uni-popup
|
|
|
- ref="menuEditorPopup"
|
|
|
- type="bottom"
|
|
|
- mask-background-color="rgba(0,0,0,0.45)"
|
|
|
- :safe-area="false"
|
|
|
- >
|
|
|
- <view class="menu-editor">
|
|
|
- <view class="editor-header">
|
|
|
- <view class="editor-title">{{ editorTitle }}</view>
|
|
|
- <view class="editor-save" @click="saveMenuEditor">保存</view>
|
|
|
- </view>
|
|
|
- <scroll-view class="editor-scroll" scroll-y>
|
|
|
- <view class="editor-group" v-for="group in editorCatalog" :key="group.title">
|
|
|
- <view class="editor-group-title">
|
|
|
- <image
|
|
|
- v-if="group.titleIcon"
|
|
|
- class="editor-section-icon-img"
|
|
|
- :src="iconSrc(group.titleIcon)"
|
|
|
- mode="aspectFit"
|
|
|
- />
|
|
|
- <text class="editor-group-title-text">{{ group.title }}</text>
|
|
|
- </view>
|
|
|
- <view class="editor-list">
|
|
|
- <view
|
|
|
- class="editor-item"
|
|
|
- :class="{ selected: isEditorSelected(item), disabled: item.fixed }"
|
|
|
- v-for="item in group.list"
|
|
|
- :key="item.key"
|
|
|
- @click="toggleEditorItem(item)"
|
|
|
- >
|
|
|
- <image
|
|
|
- v-if="item.icon"
|
|
|
- class="editor-menu-icon-img"
|
|
|
- :src="iconSrc(item.icon)"
|
|
|
- mode="aspectFit"
|
|
|
- />
|
|
|
- <view v-else class="editor-icon empty-editor-icon"></view>
|
|
|
- <view class="editor-name">{{ item.name }}</view>
|
|
|
- <view class="editor-check">{{ isEditorSelected(item) ? '已添加' : '添加' }}</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </scroll-view>
|
|
|
- </view>
|
|
|
- </uni-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -211,18 +164,6 @@ import autoUpdateMixins from "@/mixins/autoUpdate";
|
|
|
import { currentShop } from "@/api/shop";
|
|
|
import { unReadMsgCount } from "@/api/chat";
|
|
|
import { getWorkbenchSummary } from '@/api/birthday';
|
|
|
-import {
|
|
|
- HOME_MENU_DEFAULT_KEYS,
|
|
|
- HOME_MENU_STORAGE_KEYS,
|
|
|
- HOME_OVERVIEW_FALLBACK,
|
|
|
- HOME_MENU_BILLING_METHODS,
|
|
|
- findStoredKeyIndex,
|
|
|
- getEditorCatalog,
|
|
|
- getMenuByKeys,
|
|
|
- getStoredMenuKeys as loadStoredMenuKeys,
|
|
|
- isSameMenuEntry,
|
|
|
- navigateMenuItem
|
|
|
-} from "../homeMenus";
|
|
|
import { iconSrc } from "@/utils/iconSrc";
|
|
|
export default {
|
|
|
name: "MallHomePanel",
|
|
|
@@ -252,17 +193,54 @@ export default {
|
|
|
lookMoney: 1,
|
|
|
shopInfo: {},
|
|
|
unReadMsgNum: 0,
|
|
|
- currentDate: '', // 当前日期信息 如:12月26号 周五
|
|
|
- quickMenuKeys: [],
|
|
|
- bizMenuKeys: [],
|
|
|
- editingMenuType: '',
|
|
|
- editingMenuKeys: [],
|
|
|
- quickIconSize: 34,
|
|
|
- menuIconSize: 32,
|
|
|
- moreIconSize: 22,
|
|
|
- editorIconSize: 20,
|
|
|
- editorSectionIconSize: 24,
|
|
|
- birthdaySummary: { today: 0, tomorrow: 0, week: 0 }
|
|
|
+ currentDate: '',
|
|
|
+ birthdaySummary: { today: 0, tomorrow: 0, week: 0 },
|
|
|
+ // 快捷操作(写死)
|
|
|
+ quickMenuList: [
|
|
|
+ { key: 'itemBill', name: '开单', icon: 'plant-billing', action: 'goItemKd', pf: 1 },
|
|
|
+ { key: 'itemQuickBill', name: '快捷开单', icon: 'plant-quick-billing', action: 'goItemKjKd', pf: 1 },
|
|
|
+ { key: 'buyItem', name: '买花', icon: 'buy-item', url: '/pagesPurchase/order', pf: 1 },
|
|
|
+ { key: 'purchaseRecord', name: '买花记录', icon: 'purchase-record', url: '/pagesPurchase/shopping', pf: 1 }
|
|
|
+ ],
|
|
|
+ // 花束花材合并栏(写死)
|
|
|
+ bizMenuList: [
|
|
|
+ { key: 'itemMall', name: '商城码', icon: 'mall-filled', url: '/admin/cg/item', pf: 1 },
|
|
|
+ { key: 'flowerCategory', name: '分类', icon: 'category-filled', url: '/admin/goods/categoryV2?tab=0', pf: 1 },
|
|
|
+ { key: 'flowerSort', name: '花束排序', icon: 'sort-filled', url: '/admin/goods/categorySort', pf: 1 },
|
|
|
+ { key: 'goodsManage', name: '商品管理', icon: 'bouquet', url: '/admin/goods/manage', pf: 1 },
|
|
|
+ { key: 'addFlower', name: '新增花束', icon: 'add-bouquet', url: '/admin/goods/add', pf: 1 },
|
|
|
+ { key: 'priceIncrease', name: '涨价设置', icon: 'price-increase', url: '/admin/goods/price-increase', pf: 1 },
|
|
|
+ { key: 'shopNotice', name: '公告', icon: 'notice', url: '/admin/shopNotice/list', pf: 1 },
|
|
|
+ { key: 'plant', name: '绿植花材', icon: 'plant-material', url: '/admin/item/list2', pf: 1 },
|
|
|
+ { key: 'freeRefund', name: '退款', icon: 'order-filled', url: '/admin/custom/selectCustom?style=1&refund=1', pf: 1 },
|
|
|
+ { key: 'freeRefundList', name: '退款记录', icon: 'order-filled', url: '/admin/billing/freeRefundList', pf: 1 },
|
|
|
+ { key: 'part', name: '拆散', icon: 'disassemble', url: '/admin/part/list', pf: 1 },
|
|
|
+ { key: 'changePrice', name: '改价', icon: 'change-price-filled', url: '/admin/changePrice/list2', pf: 1 },
|
|
|
+ { key: 'breakage', name: '报损', icon: 'breakage', url: '/admin/breakage/list', pf: 1 },
|
|
|
+ { key: 'plantCategory', name: '花材分类', icon: 'category-filled', url: '/admin/goods/categoryV2?tab=1', pf: 1 },
|
|
|
+ { key: 'task', name: '任务', icon: 'task-filled', url: '/admin/work/list', pf: 1 },
|
|
|
+ { key: 'homePageConfig', name: '首页配置', icon: 'settings-filled', url: '/admin/homePageConfig/index', pf: 1 }
|
|
|
+ ],
|
|
|
+ // 更多功能(写死)
|
|
|
+ moreMenuList: [
|
|
|
+ { key: 'calculator', name: '计算器', icon: 'calculator-filled', url: '/admin/tools/calculator', pf: 1 },
|
|
|
+ { key: 'staff', name: '员工', icon: 'staff', url: '/admin/staff/list', pf: 1 },
|
|
|
+ { key: 'profit', name: '利润表', icon: 'profit-filled', url: '/admin/stat/profit', pf: 1 },
|
|
|
+ { key: 'picText', name: '图文', icon: 'pic-text', url: '/admin/picText/picTextList', pf: 1 },
|
|
|
+ { key: 'scanPay', name: '收款码流水', icon: 'pay-code-flow', url: '/admin/order/scanPay', pf: 1 },
|
|
|
+ { key: 'payCode', name: '收款码', icon: 'pay-code', url: '/admin/cg/code', pf: 1 },
|
|
|
+ { key: 'redPacket', name: '红包管理', icon: 'red-packet', url: '/admin/hb/list', pf: 1 },
|
|
|
+ { key: 'rechargeSetting', name: '充值设置', icon: 'recharge', url: '/admin/recharge/rechargeSetting', pf: 1 }
|
|
|
+ ],
|
|
|
+ // 数据总览兜底
|
|
|
+ overviewFallback: [
|
|
|
+ { name: '花材数', value: 0, url: '/admin/item/list2' },
|
|
|
+ { name: '花材值(元)', value: 0, url: '/admin/stat/kind' },
|
|
|
+ { name: '花束', value: 0, url: '/admin/goods/manage' },
|
|
|
+ { name: '客户总数', value: 0, url: '/admin/home/member', type: 4 },
|
|
|
+ { name: '总订单', value: 0, url: '/admin/home/order', type: 4 },
|
|
|
+ { name: '总挂账(元)', value: 0, url: '/admin/custom/showTotalBalance' }
|
|
|
+ ]
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -279,36 +257,14 @@ export default {
|
|
|
yesterdayVisit: yesterdayData.visit || 0
|
|
|
}
|
|
|
},
|
|
|
- quickMenuList() {
|
|
|
- return getMenuByKeys(this.quickMenuKeys)
|
|
|
- },
|
|
|
- bizMenuList() {
|
|
|
- return getMenuByKeys(this.bizMenuKeys)
|
|
|
- },
|
|
|
- moreMenuList() {
|
|
|
- return getMenuByKeys(HOME_MENU_DEFAULT_KEYS.moreMenus)
|
|
|
- },
|
|
|
overviewDisplay() {
|
|
|
- return this.overview && this.overview.length ? this.overview : HOME_OVERVIEW_FALLBACK
|
|
|
- },
|
|
|
- editorTitle() {
|
|
|
- const titleMap = {
|
|
|
- quickMenus: '编辑快捷操作',
|
|
|
- bizMenus: '编辑花束花材'
|
|
|
- }
|
|
|
- return titleMap[this.editingMenuType] || '编辑菜单'
|
|
|
- },
|
|
|
- editorCatalog() {
|
|
|
- return getEditorCatalog(this.editingMenuType)
|
|
|
+ return this.overview && this.overview.length ? this.overview : this.overviewFallback
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
loginInfo: {
|
|
|
handler(newVal) {
|
|
|
if (!this.$util.isEmpty(newVal.admin) && newVal.admin.currentShopId > 0) {
|
|
|
- if (!this.quickMenuKeys.length) {
|
|
|
- this.handlePageLoad()
|
|
|
- }
|
|
|
this.handlePageShow()
|
|
|
}
|
|
|
},
|
|
|
@@ -322,10 +278,8 @@ export default {
|
|
|
this.handlePageUnload()
|
|
|
},
|
|
|
methods: {
|
|
|
- ...HOME_MENU_BILLING_METHODS,
|
|
|
handlePageLoad() {
|
|
|
this.updateCurrentDate()
|
|
|
- this.initHomeMenus()
|
|
|
},
|
|
|
goWarning(info){
|
|
|
if(!this.$util.isEmpty(info.warningUrl)){
|
|
|
@@ -335,8 +289,6 @@ export default {
|
|
|
handlePageUnload() {},
|
|
|
handlePageShow() {
|
|
|
this.unReadMsgNum = 0
|
|
|
- // 每次进入重新读菜单,吃到 bizMenusSchema 强制重排
|
|
|
- this.initHomeMenus()
|
|
|
this.init()
|
|
|
if (!this.$util.isEmpty(this.loginInfo.admin) && this.loginInfo.admin.currentShopId > 0) {
|
|
|
this.showShopName()
|
|
|
@@ -350,59 +302,35 @@ export default {
|
|
|
getShareMessage() {
|
|
|
return { title: "花掌柜,花店管家婆", desc: "", imageUrl: "", path: "admin/home/workbench" }
|
|
|
},
|
|
|
- initHomeMenus() {
|
|
|
- this.quickMenuKeys = loadStoredMenuKeys('quickMenus')
|
|
|
- this.bizMenuKeys = loadStoredMenuKeys('bizMenus')
|
|
|
- },
|
|
|
- openMenuEditor(type){
|
|
|
- this.editingMenuType = type
|
|
|
- const keysMap = {
|
|
|
- quickMenus: this.quickMenuKeys,
|
|
|
- bizMenus: this.bizMenuKeys
|
|
|
+ /** 快捷开单:跳默认客户开单页 */
|
|
|
+ goItemKjKd() {
|
|
|
+ if (this.myShopInfo && Number(this.myShopInfo.defaultCustomId) > 0) {
|
|
|
+ this.$util.pageTo({ url: '/admin/billing/index2?customId=' + this.myShopInfo.defaultCustomId })
|
|
|
+ } else {
|
|
|
+ this.$msg('请设置快捷开单的对应客户')
|
|
|
}
|
|
|
- this.editingMenuKeys = (keysMap[type] || []).slice()
|
|
|
- this.$refs.menuEditorPopup.open('bottom')
|
|
|
},
|
|
|
- isEditorSelected(item){
|
|
|
- return findStoredKeyIndex(this.editingMenuKeys, item) > -1
|
|
|
+ /** 开单:先选客户 */
|
|
|
+ goItemKd() {
|
|
|
+ this.$util.pageTo({ url: '/admin/custom/selectCustom' })
|
|
|
},
|
|
|
- toggleEditorItem(item){
|
|
|
- if(item.fixed){
|
|
|
+ /**
|
|
|
+ * 菜单点击:action 走本地方法,其余 pageTo;pf=0 且平台店时提示开发中
|
|
|
+ */
|
|
|
+ handleMenuTap(item) {
|
|
|
+ if (item.action === 'goItemKd') {
|
|
|
+ this.goItemKd()
|
|
|
return
|
|
|
}
|
|
|
- const index = findStoredKeyIndex(this.editingMenuKeys, item)
|
|
|
- if(index > -1){
|
|
|
- this.editingMenuKeys.splice(index, 1)
|
|
|
- }else{
|
|
|
- this.editingMenuKeys = this.editingMenuKeys.filter(key => !isSameMenuEntry(key, item))
|
|
|
- this.editingMenuKeys.push(item.key)
|
|
|
- }
|
|
|
- },
|
|
|
- saveMenuEditor(){
|
|
|
- const type = this.editingMenuType
|
|
|
- if(!type){
|
|
|
+ if (item.action === 'goItemKjKd') {
|
|
|
+ this.goItemKjKd()
|
|
|
return
|
|
|
}
|
|
|
- let keys = this.editingMenuKeys.slice()
|
|
|
- keys = keys.filter(key => key !== 'allApply')
|
|
|
- if(!keys.length){
|
|
|
- this.$msg('至少保留一个菜单')
|
|
|
+ if (this.loginInfo && this.loginInfo.pfShopId && Number(this.loginInfo.pfShopId) > 0 && item.pf === 0) {
|
|
|
+ this.$msg('开发中')
|
|
|
return
|
|
|
}
|
|
|
- if(type === 'quickMenus'){
|
|
|
- this.quickMenuKeys = keys
|
|
|
- }
|
|
|
- if(type === 'bizMenus'){
|
|
|
- this.bizMenuKeys = keys
|
|
|
- }
|
|
|
- if(HOME_MENU_STORAGE_KEYS[type]){
|
|
|
- uni.setStorageSync(HOME_MENU_STORAGE_KEYS[type], keys)
|
|
|
- }
|
|
|
- this.$refs.menuEditorPopup.close()
|
|
|
- this.$msg('已保存')
|
|
|
- },
|
|
|
- handleMenuTap(item) {
|
|
|
- navigateMenuItem(this, item)
|
|
|
+ this.$util.pageTo(item)
|
|
|
},
|
|
|
iconSrc,
|
|
|
scanCode(){
|
|
|
@@ -448,7 +376,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
goPage(item) {
|
|
|
- navigateMenuItem(this, item)
|
|
|
+ this.handleMenuTap(item)
|
|
|
},
|
|
|
noticeFn (item) {
|
|
|
this.$util.pageTo({ url: item.page })
|