Bläddra i källkod

feat:仓库:字段+按钮权限

zhangxin 1 vecka sedan
förälder
incheckning
27cfdd8066

+ 26 - 25
pages/wareHouse/components/detail.vue

@@ -48,7 +48,7 @@
48 48
         <!-- 核心信息区域 -->
49 49
         <view class="core_info">
50 50
             <view class="section_title">核心信息</view>
51
-            <view class="info_row">
51
+            <view class="info_row" v-if="getWarehouseFieldPermissions('dictLabel','read')">
52 52
                 <view class="info_label">品牌</view>
53 53
                 <view class="info_value" @click.stop="showBrandlList()">
54 54
                     <!-- <u-input v-if="editMode.dictLabel" v-model="tempValues.dictLabel" :autoFocus="true" @blur="!globalEditMode && saveEditField('dictLabel', tempValues.dictLabel, 'dictLabel')" /> -->
@@ -56,7 +56,7 @@
56 56
                     <BrandList ref="brandListRef" @selectedBrand="handleSelectedBrand"></BrandList>
57 57
                 </view>
58 58
             </view>
59
-            <view class="info_row">
59
+            <view class="info_row" v-if="getWarehouseFieldPermissions('model','read')">
60 60
                 <view class="info_label">型号</view>
61 61
                 <view class="info_value" @click.stop="toggleEditField('model', coreInfo.model)">
62 62
                     <u-input v-if="editMode.model" v-model="tempValues.model" :autoFocus="true"
@@ -64,7 +64,7 @@
64 64
                     <span v-else>{{ coreInfo.model || '-' }}</span>
65 65
                 </view>
66 66
             </view>
67
-            <view class="info_row">
67
+            <view class="info_row" v-if="getWarehouseFieldPermissions('indentifyCode','read')">
68 68
                 <view class="info_label">独立编码</view>
69 69
                 <view class="info_value code" @click.stop="toggleEditField('indentifyCode', coreInfo.indentifyCode)">
70 70
                     <u-input v-if="editMode.indentifyCode" v-model="tempValues.indentifyCode" :autoFocus="true"
@@ -72,23 +72,23 @@
72 72
                     <span v-else>{{ coreInfo.indentifyCode || '-' }}</span>
73 73
                 </view>
74 74
             </view>
75
-            <view class="info_row">
75
+            <view class="info_row" v-if="getWarehouseFieldPermissions('stockStatus','read')">
76 76
                 <view class="info_label">是否入库</view>
77 77
                 <view class="info_value">{{ stockStatusFormatter(coreInfo.stockStatus) }}</view>
78 78
             </view>
79
-            <view class="info_row">
79
+            <view class="info_row" v-if="getWarehouseFieldPermissions('createTime','read')">
80 80
                 <view class="info_label">入库日期</view>
81 81
                 <view class="info_value">{{ coreInfo.createTime || '-' }}</view>
82 82
             </view>
83
-            <view class="info_row">
83
+            <view class="info_row" v-if="getWarehouseFieldPermissions('payType','read')">
84 84
                 <view class="info_label">付款方式</view>
85 85
                 <view class="info_value">{{ payTypeFormatter(coreInfo.payType) }}</view>
86 86
             </view>
87
-            <view class="info_row">
87
+            <view class="info_row" v-if="getWarehouseFieldPermissions('recycleSituation','read')">
88 88
                 <view class="info_label">回收情况</view>
89 89
                 <view class="info_value">{{ recycleSituationFormatter(coreInfo.recycleSituation) }}</view>
90 90
             </view>
91
-            <view class="info_row col">
91
+            <view class="info_row col" v-if="getWarehouseFieldPermissions('desc','read')">
92 92
                 <view class="info_label">备注信息</view>
93 93
                 <view class="info_value note" @click.stop="toggleEditField('desc', coreInfo.desc)">
94 94
                     <textarea v-if="editMode.desc" v-model="tempValues.desc" :autoFocus="true" rows="3"
@@ -101,8 +101,8 @@
101 101
         <!-- 财务与价格区域 -->
102 102
         <view class="finance_price">
103 103
             <view class="section_title">财务与价格</view>
104
-            <view class="price_group" v-if="isWareHouser">
105
-                <view class="price_item">
104
+            <view class="price_group">
105
+                <view class="price_item" v-if="getWarehouseFieldPermissions('costPrice','read')">
106 106
                     <view class="price_label">总成本价</view>
107 107
                     <view class="price_value original"
108 108
                         @click.stop="toggleEditField('costPrice', coreInfo.costPrice)">
@@ -111,7 +111,7 @@
111 111
                         <span v-else>¥{{ coreInfo.costPrice || '-' }}</span>
112 112
                     </view>
113 113
                 </view>
114
-                <view class="price_item">
114
+                <view class="price_item" v-if="getWarehouseFieldPermissions('peerPrice','read')">
115 115
                     <view class="price_label">同行价格</view>
116 116
                     <view class="price_value additional"
117 117
                         @click.stop="toggleEditField('peerPrice', coreInfo.peerPrice)">
@@ -122,7 +122,7 @@
122 122
                 </view>
123 123
             </view>
124 124
             <view class="price_group">
125
-                <view class="price_item">
125
+                <view class="price_item" v-if="getWarehouseFieldPermissions('agentPrice','read')">
126 126
                     <view class="price_label">代理价格</view>
127 127
                     <view class="price_value agent" @click.stop="toggleEditField('agentPrice', coreInfo.agentPrice)">
128 128
                         <u-input v-if="editMode.agentPrice" v-model="tempValues.agentPrice" :autoFocus="true"
@@ -130,7 +130,7 @@
130 130
                         <span v-else>¥{{ coreInfo.agentPrice || '-' }}</span>
131 131
                     </view>
132 132
                 </view>
133
-                <view class="price_item">
133
+                <view class="price_item" v-if="getWarehouseFieldPermissions('price','read')">
134 134
                     <view class="price_label">官方指导价</view>
135 135
                     <view class="price_value original" @click.stop="toggleEditField('price', coreInfo.price)">
136 136
                         <u-input v-if="editMode.price" v-model="tempValues.price" :autoFocus="true"
@@ -140,8 +140,8 @@
140 140
                 </view>
141 141
                 
142 142
             </view>
143
-            <view class="price_group" v-if="isWareHouser">
144
-                <view class="price_item">
143
+            <view class="price_group">
144
+                <view class="price_item" v-if="getWarehouseFieldPermissions('salePrice','read')">
145 145
                     <view class="price_label">销售价格</view>
146 146
                     <view class="price_value suggested"
147 147
                         @click.stop="toggleEditField('salePrice', coreInfo.salePrice)">
@@ -150,7 +150,7 @@
150 150
                         <span v-else>¥{{ coreInfo.salePrice || '-' }}</span>
151 151
                     </view>
152 152
                 </view>
153
-                <view class="price_item">
153
+                <view class="price_item" v-if="getWarehouseFieldPermissions('actualPrice','read')">
154 154
                     <view class="price_label">实价</view>
155 155
                     <view class="price_value suggested"
156 156
                         @click.stop="toggleEditField('actualPrice', coreInfo.actualPrice)">
@@ -165,7 +165,7 @@
165 165
         <!-- 溯源与位置区域 -->
166 166
         <view class="traceability_productPosition">
167 167
             <view class="section_title">溯源与位置</view>
168
-            <view class="info_row">
168
+            <view class="info_row" v-if="getWarehouseFieldPermissions('productPosition','read')">
169 169
                 <view class="info_label">商品位置</view>
170 170
                 <view class="info_value" @click.stop="toggleEditField('productPosition', coreInfo.productPosition)">
171 171
                     <u-input v-if="editMode.productPosition" v-model="tempValues.productPosition" :autoFocus="true"
@@ -173,7 +173,7 @@
173 173
                     <span v-else>{{ coreInfo.productPosition || '-' }}</span>
174 174
                 </view>
175 175
             </view>
176
-            <view class="info_row">
176
+            <view class="info_row" v-if="getWarehouseFieldPermissions('recyclePerson','read')">
177 177
                 <view class="info_label">回收人员</view>
178 178
                 <view class="info_value" @click.stop="showRecyclePersonPicker">
179 179
                     <span>{{ coreInfo.recyclePerson || '-' }}</span>
@@ -182,7 +182,7 @@
182 182
                     </personPicker>
183 183
                 </view>
184 184
             </view>
185
-            <view class="info_row">
185
+            <view class="info_row" v-if="getWarehouseFieldPermissions('identifyingPerson','read')">
186 186
                 <view class="info_label">鉴定人员</view>
187 187
                 <view class="info_value" @click.stop="showIdentifyingPersonPicker">
188 188
                     <span>{{ coreInfo.identifyingPerson || '-' }}</span>
@@ -239,7 +239,7 @@
239 239
 import BrandList from '@/components/brand-list/index.vue'
240 240
 import personPicker from '@/components/person-picker/index.vue'
241 241
 import imgsRowScroll from '@/components/imgs-row-scroll/index.vue'
242
-import { permissionCheck } from '@/utils/util.js'
242
+import { getWarehouseButtonPermissions,getWarehouseFieldPermissions } from '@/utils/util.js'
243 243
 import { recycleSituationList } from '../js/public.js'
244 244
 export default {
245 245
     components: {
@@ -276,7 +276,6 @@ export default {
276 276
             downStatus: '',//下架状态 0:已下架 1:已上架
277 277
             showEditImgsModal: false,
278 278
             tempImgsUrl: [],
279
-            isWareHouser: permissionCheck('WAREHOUSER',false),
280 279
         }
281 280
     },
282 281
     onLoad(options) {
@@ -284,6 +283,8 @@ export default {
284 283
         this.getGoodsDetail();
285 284
     },
286 285
     methods: {
286
+        getWarehouseButtonPermissions:getWarehouseButtonPermissions,
287
+        getWarehouseFieldPermissions:getWarehouseFieldPermissions,
287 288
         // 分享
288 289
         handleShare() {
289 290
             uni.showToast({
@@ -379,7 +380,7 @@ export default {
379 380
         },
380 381
         // 显示品牌列表
381 382
         showBrandlList() {
382
-            if(!permissionCheck('WAREHOUSER')) return false
383
+            if(!this.getWarehouseFieldPermissions('dictValue','edit')) return false
383 384
             this.$refs.brandListRef.showBrandList();
384 385
         },
385 386
         // 处理选中品牌
@@ -487,7 +488,7 @@ export default {
487 488
         },
488 489
         // 切换单个字段的编辑状态
489 490
         toggleEditField(field, value) {
490
-            if(!permissionCheck('WAREHOUSER')) return false
491
+            if(!getWarehouseButtonPermissions('edit')) return false
491 492
             // 如果不是全局编辑模式
492 493
             if (!this.globalEditMode) {
493 494
                 // 重置所有编辑状态
@@ -508,7 +509,7 @@ export default {
508 509
         },
509 510
         // 进入全局编辑模式
510 511
         enterGlobalEdit() {
511
-            if(!permissionCheck('WAREHOUSER')) return false
512
+            if(!getWarehouseButtonPermissions('edit')) return false
512 513
             this.globalEditMode = true;
513 514
             // 设置所有可编辑字段为编辑状态
514 515
             this.editMode = {
@@ -656,7 +657,7 @@ export default {
656 657
             })
657 658
         },
658 659
         handleEditImgs() {
659
-            if(!permissionCheck('WAREHOUSER')) return false
660
+            if(!this.getWarehouseFieldPermissions('goodPicFileList','edit')) return false
660 661
             this.showEditImgsModal = true;
661 662
             this.tempImgsUrl = this.imgsUrl
662 663
         },

+ 4 - 4
pages/wareHouse/components/edit.vue

@@ -26,7 +26,7 @@
26 26
                                 @click="handlePasteRecognition(recognitionContent)"></u-button>
27 27
                         </view>
28 28
                     </u-form-item>
29
-                    <u-form-item v-if="getWarehouseFieldPermissions('goodPicFileList','read')" :label="'商品图片('+formData.goodPicFileList.length+'张)'" required prop="goodPicFileList" borderBottom>
29
+                    <u-form-item v-if="getWarehouseFieldPermissions('goodPicFileList','read')" :label="'商品图片('+formData.goodPicFileList.length+'张)'" required  borderBottom>
30 30
                         <view class="imgs_scroll">
31 31
                             <DragUpload ref="dragUpload" :images="formData.goodPicFileList" :isDelete="true" :isPreview="true" @imagesChanged="goodPicFileListImagesChanged" @uploadComplete="goodPicFileListUploadComplete"></DragUpload>
32 32
                             <!-- <ImgsRowScroll  v-if="formData.goodPicFileList.length > 0" :isShowDeleteIcon="true"
@@ -276,7 +276,7 @@ import BrandList from '@/components/brand-list/index.vue'
276 276
 import ImgsRowScroll from '@/components/imgs-row-scroll/index.vue'
277 277
 import DragUpload from '@/components/drag-upload/index.vue'
278 278
 import PersonPicker from '@/components/person-picker/index.vue'
279
-import { permissionCheck,getRoles,getWarehouseFieldPermissions } from '@/utils/util.js'
279
+import { getRoles,getWarehouseFieldPermissions,getWarehouseButtonPermissions } from '@/utils/util.js'
280 280
 import moreInfo from './moreInfo.vue'
281 281
 import { productConditionList,productAttributeList,stockStatusList,recycleTypeList,labelList,paymentTabList,recycleSituationList } from '../js/public.js'
282 282
 export default {
@@ -400,7 +400,6 @@ export default {
400 400
             echoInfoProductCondition:'',//入库回显的时候 商品成色回显
401 401
             echoInfoStockStatus:'',//入库回显的时候 是否入库回显
402 402
             echoInfoRecycleSituation:'0',//入库回显的时候 回收情况回显
403
-            isWareHouser: permissionCheck('WAREHOUSER',false),
404 403
             formType: '',//表单类型 add:新增 edit:编辑
405 404
             xhlSystemSetList: [],//系统设置-列表
406 405
             productConditionList:productConditionList,
@@ -457,6 +456,7 @@ export default {
457 456
     },
458 457
     methods: {
459 458
         getWarehouseFieldPermissions,
459
+        getWarehouseButtonPermissions,
460 460
         getXhlSystemSetList(){
461 461
             uni.$u.api.xhlSystemSetList({
462 462
                 pageNum: 1,
@@ -506,7 +506,7 @@ export default {
506 506
             })
507 507
         },
508 508
         handleMoreInfoConfirm() {
509
-            if(!permissionCheck('WAREHOUSER')) return false
509
+            if(!this.getWarehouseButtonPermissions('edit')) return false
510 510
             this.submitForm(this.submitType)
511 511
         },
512 512
         // 提交表单

+ 4 - 3
pages/wareHouse/components/fakeRegistration.vue

@@ -69,7 +69,7 @@
69 69
 </template>
70 70
 
71 71
 <script>
72
-import { permissionCheck } from '../../../utils/util.js'
72
+import { getWarehouseButtonPermissions } from '../../../utils/util.js'
73 73
 export default {
74 74
   name: 'FakeRegistration',
75 75
   data() {
@@ -118,6 +118,7 @@ export default {
118 118
     this.getWareHouseFakeList()
119 119
   },
120 120
   methods: {
121
+    getWarehouseButtonPermissions:getWarehouseButtonPermissions,
121 122
     handleLoadMore() {
122 123
       if (this.pageNum * this.pageSize >= this.total) {
123 124
         this.loadStatus = 'noMore'
@@ -141,7 +142,7 @@ export default {
141 142
       })
142 143
     },
143 144
     handleAdd() {
144
-      if(!permissionCheck('WAREHOUSER')) return false
145
+      if(!this.getWarehouseButtonPermissions('edit')) return false
145 146
       this.isAdd = true
146 147
       this.currentEditItem = null
147 148
       this.formData = {
@@ -172,7 +173,7 @@ export default {
172 173
       this.showEditDialog = true
173 174
     },
174 175
     handleSubmit() {
175
-      if(!permissionCheck('WAREHOUSER')) return false
176
+      if(!this.getWarehouseButtonPermissions('edit')) return false
176 177
       this.$refs.formRef.validate().then(() => {
177 178
         if (this.isAdd) {
178 179
           uni.$u.api.wareHouseFakeAdd(this.formData).then(res => {

+ 1 - 1
pages/wareHouse/components/fieldPermissions.vue

@@ -426,7 +426,7 @@ export default {
426 426
 }
427 427
 
428 428
 .list-wrap {
429
-	max-height: 60vh;
429
+	max-height: 30vh;
430 430
 }
431 431
 
432 432
 .loading-wrap {

+ 73 - 42
pages/wareHouse/index.vue

@@ -12,10 +12,12 @@
12 12
 					<text class="asset-value">{{ wareHouseCard.totalCost }}</text>
13 13
 				</view>
14 14
 				<view class="btn-group">
15
-					<u-button type="primary" shape="circle" plain size="mini" @click="navigateToFieldPermissions">字段权限</u-button>
15
+					<u-button v-if="isAdmin" type="primary" shape="circle" plain size="mini"
16
+						@click="navigateToFieldPermissions">字段权限</u-button>
16 17
 					<u-button type="success" shape="circle" plain size="mini" @click="openOrderList">开单记录</u-button>
17 18
 					<order-list ref="orderListRef"></order-list>
18
-					<u-button type="primary" shape="circle" plain size="mini" @click="navigateToFakeRegistration">假货登记</u-button>
19
+					<u-button type="primary" shape="circle" plain size="mini"
20
+						@click="navigateToFakeRegistration">假货登记</u-button>
19 21
 				</view>
20 22
 			</view>
21 23
 			<view class="data-cards">
@@ -39,8 +41,9 @@
39 41
 			</view>
40 42
 
41 43
 			<view class="category-tabs-wrap">
42
-				<u-tabs :list="tabList" :is-scroll="true" active-color="#007aff" inactive-color="#666666" font-size="28rpx"
43
-					keyName="dictLabel" border-bottom="none" @change="switchTab" class="u-tabs-custom"></u-tabs>
44
+				<u-tabs :list="tabList" :is-scroll="true" active-color="#007aff" inactive-color="#666666"
45
+					font-size="28rpx" keyName="dictLabel" border-bottom="none" @change="switchTab"
46
+					class="u-tabs-custom"></u-tabs>
44 47
 			</view>
45 48
 
46 49
 			<view class="filter-bar">
@@ -52,7 +55,8 @@
52 55
 				</view>
53 56
 				<view class="price-layout-btn">
54 57
 					<view class="price-btn" type="text" @click="priceVisibleChange">
55
-						<u-icon :name="priceVisible ? 'eye' : 'eye-off'" size="18" color="#1890ff" class="price-icon"></u-icon>
58
+						<u-icon :name="priceVisible ? 'eye' : 'eye-off'" size="18" color="#1890ff"
59
+							class="price-icon"></u-icon>
56 60
 						<text class="price-text">价格可见</text>
57 61
 					</view>
58 62
 					<view class="dept-btn" @click="recycleDeptClick">
@@ -61,9 +65,9 @@
61 65
 						</view>
62 66
 						<image src="/static/icons/dept.png" mode="aspectFill"></image>
63 67
 					</view>
64
-					<ba-tree-picker :selectParent="true" ref="recycleDeptRef" :multiple='false' @select-change="deptSeletchang"
65
-						border title="机构部门" :localdata="deptList" valueKey="deptId" textKey="deptName" childrenKey="children"
66
-						:selectedValues="deptId" :personNames="deptName" />
68
+					<ba-tree-picker :selectParent="true" ref="recycleDeptRef" :multiple='false'
69
+						@select-change="deptSeletchang" border title="机构部门" :localdata="deptList" valueKey="deptId"
70
+						textKey="deptName" childrenKey="children" :selectedValues="deptId" :personNames="deptName" />
67 71
 					<view class="layout-btn" type="text" size="mini" @click="openSearchFilter">
68 72
 						<image class="filter-icon" src="/static/icons/select.png" mode="aspectFill"></image>
69 73
 						筛选
@@ -73,24 +77,28 @@
73 77
 					<searchFilter ref="searchFilter" @confirm="handleSearch"></searchFilter>
74 78
 				</view>
75 79
 			</view>
76
-			<u-notice-bar class="custom-notice-bar" icon="" :text="selectText" mode="closable" speed="40"></u-notice-bar>
77
-			<scroll-view ref="scrollView" class="goods-list" scroll-y @scrolltolower="handleLoadMore" @scroll="handleScroll"
78
-				enable-back-to-top>
80
+			<u-notice-bar class="custom-notice-bar" icon="" :text="selectText" mode="closable"
81
+				speed="40"></u-notice-bar>
82
+			<scroll-view ref="scrollView" class="goods-list" scroll-y @scrolltolower="handleLoadMore"
83
+				@scroll="handleScroll" enable-back-to-top>
79 84
 				<view @click.stop="clickItem(goods)" class="goods-item" v-for="(goods, goodsIndex) in goodsList"
80 85
 					:key="`goods-${goodsIndex}`">
81 86
 					<u-swipe-action ref="swipeRef">
82
-						<u-swipe-action-item :options="swipeOptions" @click="(e) => handleSwipeClick(e, goods, goodsIndex)">
87
+						<u-swipe-action-item :options="swipeOptions"
88
+							@click="(e) => handleSwipeClick(e, goods, goodsIndex)">
83 89
 							<view class="goods-info">
84
-								<view class="goods-img-container" v-if="getWarehouseFieldPermissions('goodPicFileList','read')">
85
-									<image class="goods-img" :src="goods.imgUrl ? goods.imgUrl : '/static/no-img.png'" mode="aspectFill"
86
-										lazy-load></image>
90
+								<view class="goods-img-container"
91
+									v-if="getWarehouseFieldPermissions('goodPicFileList', 'read')">
92
+									<image class="goods-img" :src="goods.imgUrl ? goods.imgUrl : '/static/no-img.png'"
93
+										mode="aspectFill" lazy-load></image>
87 94
 									<!-- <image class="goods-img" src="/static/no-img.png" mode="aspectFill" lazy-load></image> -->
88
-									<view :class="['stock-indicator', goods.downStatus == '1' ? 'up-indicator' : 'down-indicator']">
95
+									<view
96
+										:class="['stock-indicator', goods.downStatus == '1' ? 'up-indicator' : 'down-indicator']">
89 97
 									</view>
90 98
 								</view>
91 99
 								<view class="info-content">
92 100
 									<view class="goods-brand">
93
-										<view v-if="getWarehouseFieldPermissions('dictLabel','read')">
101
+										<view v-if="getWarehouseFieldPermissions('dictLabel', 'read')">
94 102
 											{{ goods.dictLabel || '-' }}
95 103
 										</view>
96 104
 										<!-- <image v-if="goods.indentifyCode" src="../../static/icons/code.png"
@@ -99,35 +107,43 @@
99 107
 											{{ goods.indentifyCode || '' }}
100 108
 										</view> -->
101 109
 									</view>
102
-									<text class="goods-name" v-if="getWarehouseFieldPermissions('model','read')">型号:{{ goods.model || '-' }}</text>
103
-									<text class="goods-name" v-if="getWarehouseFieldPermissions('indentifyCode','read')">编码:{{ goods.indentifyCode || '-' }}</text>
110
+									<text class="goods-name" v-if="getWarehouseFieldPermissions('model', 'read')">型号:{{
111
+										goods.model || '-' }}</text>
112
+									<text class="goods-name"
113
+										v-if="getWarehouseFieldPermissions('indentifyCode', 'read')">编码:{{
114
+											goods.indentifyCode || '-' }}</text>
104 115
 									<view class="price-group">
105
-										<view class="price-item" v-if="getWarehouseFieldPermissions('costPrice','read')">
116
+										<view class="price-item"
117
+											v-if="getWarehouseFieldPermissions('costPrice', 'read')">
106 118
 											<text class="price-type">成本价</text>
107 119
 											<text class="price">¥{{ priceVisible ? goods.costPrice || '-' : '****'
108 120
 											}}</text>
109 121
 										</view>
110
-										<view class="price-item" v-if="getWarehouseFieldPermissions('salePrice','read')">
122
+										<view class="price-item"
123
+											v-if="getWarehouseFieldPermissions('salePrice', 'read')">
111 124
 											<text class="price-type">销售价</text>
112 125
 											<text class="price sales">¥{{ priceVisible ? goods.salePrice || '-' : '****'
113 126
 											}}</text>
114 127
 										</view>
115
-										<view class="price-item" v-if="getWarehouseFieldPermissions('peerPrice','read')">
128
+										<view class="price-item"
129
+											v-if="getWarehouseFieldPermissions('peerPrice', 'read')">
116 130
 											<text class="price-type">同行价</text>
117 131
 											<text class="price">¥{{ priceVisible ? goods.peerPrice || '-' : '****'
118 132
 											}}</text>
119 133
 										</view>
120
-										<view class="price-item" v-if="getWarehouseFieldPermissions('agentPrice','read')">
134
+										<view class="price-item"
135
+											v-if="getWarehouseFieldPermissions('agentPrice', 'read')">
121 136
 											<text class="price-type">代理价</text>
122 137
 											<text class="price">¥{{ priceVisible ? goods.agentPrice || '-' : '****'
123 138
 											}}</text>
124 139
 										</view>
125
-										<view class="price-item" v-if="getWarehouseFieldPermissions('actualPrice','read')">
140
+										<view class="price-item"
141
+											v-if="getWarehouseFieldPermissions('actualPrice', 'read')">
126 142
 											<text class="price-type">实价</text>
127 143
 											<text class="price">¥{{ priceVisible ? goods.actualPrice || '-' : '****'
128 144
 											}}</text>
129 145
 										</view>
130
-										<view class="price-item" v-if="getWarehouseFieldPermissions('price','read')">
146
+										<view class="price-item" v-if="getWarehouseFieldPermissions('price', 'read')">
131 147
 											<text class="price-type">指导价</text>
132 148
 											<text class="price">¥{{ priceVisible ? goods.price || '-' : '****' }}</text>
133 149
 										</view>
@@ -146,7 +162,8 @@
146 162
 									<view @click.stop="showMoreOptions(goods)">
147 163
 										<u-icon name="more-dot-fill" size="16" color="#666666"></u-icon>
148 164
 									</view>
149
-									<text class="goods-stock" v-if="getWarehouseFieldPermissions('stock','read')">数量:{{ goods.stock || 0 }}</text>
165
+									<text class="goods-stock" v-if="getWarehouseFieldPermissions('stock', 'read')">数量:{{
166
+										goods.stock || 0 }}</text>
150 167
 								</view>
151 168
 
152 169
 							</view>
@@ -154,35 +171,43 @@
154 171
 							<view class="more-info-container">
155 172
 								<view class="more-info-header" @click.stop="toggleMoreInfo(goods)">
156 173
 									<text class="more-info-title">更多信息</text>
157
-									<u-icon :name="goods.showMoreInfo ? 'arrow-up' : 'arrow-down'" size="14" color="#666666"></u-icon>
174
+									<u-icon :name="goods.showMoreInfo ? 'arrow-up' : 'arrow-down'" size="14"
175
+										color="#666666"></u-icon>
158 176
 								</view>
159 177
 								<transition name="more-info">
160 178
 									<view class="more-info-content" v-if="goods.showMoreInfo">
161
-										<view class="info-row" v-if="getWarehouseFieldPermissions('recycleTime','read')">
179
+										<view class="info-row"
180
+											v-if="getWarehouseFieldPermissions('recycleTime', 'read')">
162 181
 											<text class="info-label">回收时间:</text>
163 182
 											<text class="info-value">{{ formatterTime(goods.recycleTime) }}</text>
164 183
 										</view>
165
-										<view class="info-row" v-if="getWarehouseFieldPermissions('warehouseDate','read')">
184
+										<view class="info-row"
185
+											v-if="getWarehouseFieldPermissions('warehouseDate', 'read')">
166 186
 											<text class="info-label">入库时间:</text>
167 187
 											<text class="info-value">{{ formatterTime(goods.warehouseDate) }}</text>
168 188
 										</view>
169
-										<view class="info-row" v-if="getWarehouseFieldPermissions('productPosition','read')">
189
+										<view class="info-row"
190
+											v-if="getWarehouseFieldPermissions('productPosition', 'read')">
170 191
 											<text class="info-label">商品位置:</text>
171 192
 											<text class="info-value">{{ goods.productPosition || '-' }}</text>
172 193
 										</view>
173
-										<view class="info-row" v-if="getWarehouseFieldPermissions('identifyingPerson','read')">
194
+										<view class="info-row"
195
+											v-if="getWarehouseFieldPermissions('identifyingPerson', 'read')">
174 196
 											<text class="info-label">鉴定人员:</text>
175 197
 											<text class="info-value">{{ goods.identifyingPerson || '-' }}</text>
176 198
 										</view>
177
-										<view class="info-row" v-if="getWarehouseFieldPermissions('recyclePerson','read')">
199
+										<view class="info-row"
200
+											v-if="getWarehouseFieldPermissions('recyclePerson', 'read')">
178 201
 											<text class="info-label">回收人员:</text>
179 202
 											<text class="info-value">{{ goods.recyclePerson || '-' }}</text>
180 203
 										</view>
181
-										<view class="info-row" v-if="getWarehouseFieldPermissions('stockStatus','read')">
204
+										<view class="info-row"
205
+											v-if="getWarehouseFieldPermissions('stockStatus', 'read')">
182 206
 											<text class="info-label">是否入库:</text>
183
-											<text class="info-value">{{ goods.stockStatus == '1' ? '已入库' : '未入库' }}</text>
207
+											<text class="info-value">{{ goods.stockStatus == '1' ? '已入库' : '未入库'
208
+												}}</text>
184 209
 										</view>
185
-										<view class="info-row" v-if="getWarehouseFieldPermissions('payType','read')">
210
+										<view class="info-row" v-if="getWarehouseFieldPermissions('payType', 'read')">
186 211
 											<text class="info-label">付款方式:</text>
187 212
 											<text class="info-value">{{ payFormatter(goods.payType) }}</text>
188 213
 										</view>
@@ -204,7 +229,7 @@
204 229
 <script>
205 230
 import searchFilter from './components/searchFilter.vue'
206 231
 import moreInfo from './components/moreInfo.vue'
207
-import { permissionCheck,getWarehouseFieldPermissions } from '../../utils/util.js'
232
+import { getWarehouseButtonPermissions, getWarehouseFieldPermissions,getRoles } from '../../utils/util.js'
208 233
 import orderList from './components/orderList/index.vue'
209 234
 import { paymentTabList,productAttributeList } from './js/public.js'
210 235
 import jtimePickerPopup from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue';
@@ -215,6 +240,11 @@ export default {
215 240
 		orderList,
216 241
 		jtimePickerPopup
217 242
 	},
243
+	computed: {
244
+		isAdmin() {
245
+			return getRoles().some(v => v.includes('admin' || 'ADMIN'))
246
+		}
247
+	},
218 248
 	data() {
219 249
 		return {
220 250
 			searchString: '',//搜索编号、名称、品牌...
@@ -304,7 +334,7 @@ export default {
304 334
 			},
305 335
 			paymentTabList: paymentTabList,
306 336
 			productAttributeList: productAttributeList,
307
-			selectText:'暂无筛选条件'
337
+			selectText: '暂无筛选条件'
308 338
 		};
309 339
 	},
310 340
 	onLoad() {
@@ -349,6 +379,7 @@ export default {
349 379
 			this.$refs.moreInfoRef.showMoreInfo();
350 380
 		},
351 381
 		getWarehouseFieldPermissions,
382
+		getWarehouseButtonPermissions,
352 383
 		handleMoreInfoConfirm() {
353 384
 			this.$refs.moreInfoRef.closeModal();
354 385
 		},
@@ -400,7 +431,7 @@ export default {
400 431
 			if (!attr || attr.length == 0) {
401 432
 				return '暂无'
402 433
 			}
403
-			return attr.map(a=>this.productAttributeList.find(b=>b.value == a))?.map(item=>item.name).join(' ') || '暂无'
434
+			return attr.map(a => this.productAttributeList.find(b => b.value == a))?.map(item => item.name).join(' ') || '暂无'
404 435
 		},
405 436
 		formatterStockStatus(status) {
406 437
 			if (!status) {
@@ -427,7 +458,7 @@ export default {
427 458
 		handleSwipeClick(e, item, goodsIndex) {
428 459
 			if (e.index == 0) {//删除
429 460
 				this.isSwipeClick = true;
430
-				if (!permissionCheck('WAREHOUSER')) return false
461
+				if (!this.getWarehouseButtonPermissions('delete')) return false
431 462
 				uni.$u.api.wareHouseDelete({
432 463
 					id: item.id
433 464
 				}).then(() => {
@@ -520,7 +551,7 @@ export default {
520 551
 			return false;
521 552
 		},
522 553
 	},
523
-	
554
+
524 555
 	onShow() {
525 556
 		// 尝试恢复页面状态
526 557
 		if (!this.restorePageState()) {
@@ -528,7 +559,7 @@ export default {
528 559
 			this.pageNum = 1;
529 560
 			this.getList();
530 561
 		}
531
-		
562
+
532 563
 		this.getCard();
533 564
 		// 监听数据更新事件
534 565
 		this.updateListener = uni.$on('warehouse-data-updated', () => {
@@ -542,7 +573,7 @@ export default {
542 573
 	onHide() {
543 574
 		// 页面隐藏时保存状态
544 575
 		this.savePageState();
545
-		
576
+
546 577
 		// 移除事件监听器
547 578
 		if (this.updateListener) {
548 579
 			uni.$off('warehouse-data-updated', null);

+ 2 - 1
store/getters.js

@@ -16,6 +16,7 @@ const getters = {
16 16
   dialing : (state) => state.app.dialing,
17 17
   permissions: (state) => state.user.permissions,
18 18
   roles: (state) => state.user.userInfo.roles || [],
19
-  warehouseFieldPermissions: (state) => state.user.warehouseFieldPermissions || []
19
+  warehouseFieldPermissions: (state) => state.user.warehouseFieldPermissions || [],
20
+  warehouseButtonPermissions: (state) => state.user.warehouseButtonPermissions || []
20 21
 }
21 22
 export default getters

+ 11 - 0
store/modules/user.js

@@ -47,6 +47,7 @@ export default {
47 47
 		currentRoleIndex: 0, // 当前选中的角色索引
48 48
 		showRoleSwitch: false, // 是否显示切换权限按钮
49 49
 		warehouseFieldPermissions: [], // 仓库字段权限 [{ fieldName, read, edit }, ...],登录后按当前用户角色合并
50
+		warehouseButtonPermissions: [], // 仓库按钮权限 
50 51
 	},
51 52
 	mutations: {
52 53
 		SET_REDIRECTURL(state, data) {
@@ -177,6 +178,9 @@ export default {
177 178
 		SET_WAREHOUSE_FIELD_PERMISSIONS: (state, list) => {
178 179
 			state.warehouseFieldPermissions = Array.isArray(list) ? list : [];
179 180
 		},
181
+		SET_WAREHOUSE_BUTTON_PERMISSIONS: (state, list) => {
182
+			state.warehouseButtonPermissions = Array.isArray(list) ? list : [];
183
+		},
180 184
 		SWITCH_ROLE({}, role) {
181 185
 			setTimeout(() => {
182 186
 				const allIndices = [0, 1, 2, 3, 4, 5, 6];
@@ -233,6 +237,13 @@ export default {
233 237
 					}).catch(() => {
234 238
 						commit("SET_WAREHOUSE_FIELD_PERMISSIONS", []);
235 239
 					});
240
+					// 登录后拉取仓库按钮权限并存到 store(按当前用户角色合并)
241
+					uni.$u.api.wareHouseButtonPermissions({}).then((permRes) => {
242
+						const list = (permRes && permRes.data && Array.isArray(permRes.data)) ? permRes.data : [];
243
+						commit("SET_WAREHOUSE_BUTTON_PERMISSIONS", list);
244
+					}).catch(() => {
245
+						commit("SET_WAREHOUSE_BUTTON_PERMISSIONS", []);
246
+					});
236 247
 					commit("SET_BELONGSYSTEM", {
237 248
 						code: state.system.value,
238 249
 						callback: (flag) => {

+ 9 - 0
utils/util.js

@@ -414,3 +414,12 @@ export function getWarehouseFieldPermissions(field,permission) {
414 414
     const permissionItem = store.state.user.warehouseFieldPermissions?.find(item=>item.fieldName === field);
415 415
     return permissionItem ? permissionItem[permission] : false;
416 416
 }
417
+export function getWarehouseButtonPermissions(buttonKey) {
418
+    const permissionItem = store.state.user.warehouseButtonPermissions?.find(item=>item.buttonKey === buttonKey);
419
+	console.log(permissionItem)
420
+	if(!permissionItem.enabled){
421
+		uni.$u.toast('无权限');
422
+	}else{
423
+		return true
424
+	}
425
+}