소스 검색

Merge branch 'master' of http://106.52.242.177:3000/askqvn/crm-app

zhangxin 1 개월 전
부모
커밋
16f0f4a8d0

+ 19 - 5
pages/clueDetail/tabs/clueInfo/index.vue

@@ -10,11 +10,17 @@
10 10
 					<template v-if="params.type === '1'">
11 11
 						<view class="Info_item" v-for="(item,index) in caseInfoColumn" :key="item.prop">
12 12
 							<text class="label">{{item.label}}</text>
13
-							<text v-if="item.color" class="value highlight" :style="handleStyle(item.color)">
14
-								{{clueDetail[item.prop]}}
15
-							</text>
16 13
 							<show-real-text :real="clueDetail.telephone" :type='params.type'
17 14
 								v-if="item.prop === 'telephone'"></show-real-text>
15
+							<view class="input_wrap" v-else-if="item.input">
16
+								<input v-model="clueDetail[item.prop]" 
17
+									:disabled="!hasEditPermission"
18
+									style="text-align: right; padding-right: 10px;"
19
+									@blur="updateClueMainInfo" />
20
+							</view>
21
+							<text v-else-if="item.color" class="value highlight" :style="handleStyle(item.color)">
22
+								{{clueDetail[item.prop]}}
23
+							</text>
18 24
 							<text v-else class="value">{{clueDetail[item.prop]}}</text>
19 25
 						</view>
20 26
 					</template>
@@ -22,7 +28,9 @@
22 28
 						<view class="Info_item" v-for="(item,index) in caseInfoColumn" :key="item.prop">
23 29
 							<text class="label">{{item.label}}</text>
24 30
 							<view class="input_wrap" v-if="item.input">
25
-								<input v-model="clueDetail[item.prop]" style="text-align: right; padding-right: 10px;"
31
+								<input v-model="clueDetail[item.prop]" 
32
+									:disabled="!hasEditPermission"
33
+									style="text-align: right; padding-right: 10px;"
26 34
 									@blur="updateClueMainInfo" />
27 35
 							</view>
28 36
 							<text v-else-if="item.color" class="value highlight" :style="handleStyle(item.color)">
@@ -48,6 +56,7 @@
48 56
 		cloneDeep,
49 57
 		isEqual
50 58
 	} from 'lodash';
59
+	import { checkPermi } from '@/utils/permission';
51 60
 
52 61
 	const caseInfoColumn = [{
53 62
 			prop: 'name',
@@ -151,7 +160,12 @@
151 160
 			        console.error('解析remarkDict失败:', error)
152 161
 			        return null
153 162
 			      }
154
-			    }
163
+			    },
164
+			hasEditPermission() {
165
+				if (this.params?.type === '2') return true;
166
+				if (this.params?.type === '1') return checkPermi(['crm:PublicClue:detail:edit']);
167
+				return false;
168
+			}
155 169
 		},
156 170
 		methods: {
157 171
 			async updateClueMainInfo() {

+ 1 - 0
pages/orderDetailRefactored/components/OrderDetailView.vue

@@ -24,6 +24,7 @@
24 24
         :follow-up-list="followUpList"
25 25
         @next="handleNext"
26 26
         @update-file-ids="handleUpdateFileIds"
27
+        @price-updated="$emit('price-updated')"
27 28
       />
28 29
     </view>
29 30
     

+ 1 - 0
pages/orderDetailRefactored/components/PageFour.vue

@@ -894,6 +894,7 @@ export default {
894 894
                   stockStatus:0,//库存状态,0待入库,1已入库,因为是我们是预入库,所以是0
895 895
                   origin:this.orderDetail.website,//来源
896 896
                   actualPrice:this.currentReceipt.sellingPrice|| '',//实价,也就是顶部的第三个价格sellingPrice
897
+                  price:this.currentReceipt.sellingPrice|| '',//官方指导价,也就是顶部的第三个价格sellingPrice
897 898
                 }
898 899
                 if (!this.currentReceipt.warehouseId) {
899 900
                   //当没有仓库id的时候调用新增仓库接口

+ 15 - 1
pages/orderDetailRefactored/components/PageTwo.vue

@@ -124,6 +124,7 @@
124 124
                   placeholder="0" 
125 125
                   min="0"
126 126
                   @input="onPriceInput" 
127
+                  @blur="saveApprovedPrice"
127 128
                 />
128 129
               </view>
129 130
             </view>
@@ -324,10 +325,23 @@ export default {
324 325
     /**
325 326
      * 快速调整价格
326 327
      */
327
-    quickChangePrice(amount) {
328
+    async quickChangePrice(amount) {
328 329
       let newPrice = this.approvedPrice + amount
329 330
       newPrice = Math.max(0, newPrice)
330 331
       this.approvedPrice = newPrice
332
+
333
+      await uni.$u.api.updateReceiptForm({
334
+        id: this.currentReceipt.id,
335
+        sellingPrice: newPrice
336
+      })
337
+      this.$emit('price-updated')
338
+    },
339
+    async saveApprovedPrice() {
340
+      await uni.$u.api.updateReceiptForm({
341
+        id: this.currentReceipt.id,
342
+        sellingPrice: this.approvedPrice
343
+      })
344
+      this.$emit('price-updated')
331 345
     },
332 346
 
333 347
     /**

+ 19 - 1
pages/orderDetailRefactored/index.vue

@@ -24,7 +24,7 @@
24 24
 
25 25
     <!-- 订单详情视图 -->
26 26
     <OrderDetailView :order-detail="orderDetail" :top-info="topInfo" :order-id="orderId"
27
-      :current-receipt="currentReceipt" />
27
+      :current-receipt="currentReceipt" @price-updated="refreshCurrentReceipt" />
28 28
 
29 29
     <!-- 加一单模态窗 -->
30 30
     <u-modal :show="addOneModalVisible" title="加一单" showCancelButton @cancel="handleAddOneCancel"
@@ -173,6 +173,24 @@ export default {
173 173
     },
174 174
 
175 175
     /**
176
+     * 刷新当前收单(用于价格等修改后同步顶部信息)
177
+     */
178
+    async refreshCurrentReceipt() {
179
+      if (!this.currentReceipt || !this.currentReceipt.id) return
180
+      try {
181
+        const res = await uni.$u.api.getReceiptForm(this.currentReceipt.id)
182
+        if (res.code === 200 && res.data) {
183
+          this.currentReceipt = res.data
184
+          this.topInfo.brand = res.data.brand || '暂无'
185
+          this.topInfo.model = res.data.model || '暂无'
186
+          this.topInfo.price = res.data.sellingPrice ?? '暂无'
187
+        }
188
+      } catch (error) {
189
+        console.error('刷新当前收单失败:', error)
190
+      }
191
+    },
192
+
193
+    /**
176 194
      * 点击收单项
177 195
      */
178 196
     async handleReceiptClick(item) {

+ 3 - 1
store/getters.js

@@ -13,6 +13,8 @@ const getters = {
13 13
   isDS: (state) => state.user.isDS,
14 14
   isOut: (state) => state.user.isOut,
15 15
   recordId : (state) => state.app.recordId,
16
-  dialing : (state) => state.app.dialing
16
+  dialing : (state) => state.app.dialing,
17
+  permissions: (state) => state.user.permissions,
18
+  roles: (state) => state.user.userInfo.roles || []
17 19
 }
18 20
 export default getters

+ 13 - 2
store/modules/user.js

@@ -25,11 +25,12 @@ export default {
25 25
 		homeOff: false, // 居家
26 26
 		isOut: false, // 外访
27 27
 		uuid: null, // 设备id
28
+		permissions: [], // 权限列表
28 29
 		netConfig: {
29 30
 			// http://59.42.9.166:9520/proxy
30 31
 			// http://10.0.7.100:9500
31
-			// ip: "https://crm.nanjingshiyu.com/prod-api", // ip
32
-			ip: "https://crmtest.nanjingshiyu.com/prod-api", // 测试环境ip
32
+			ip: "https://crm.nanjingshiyu.com/prod-api", // ip
33
+			// ip: "https://crmtest.nanjingshiyu.com/prod-api", // 测试环境ip
33 34
 			// ip : "/api", // 测试环境ip
34 35
 			// ip : "http://47.113.184.101", // 测试环境ip
35 36
 			// ip: "http://172.16.7.200", // ip
@@ -162,6 +163,9 @@ export default {
162 163
 		SET_SHOW_ROLE_SWITCH(state, show) {
163 164
 			state.showRoleSwitch = show;
164 165
 		},
166
+		SET_PERMISSIONS: (state, permissions) => {
167
+			state.permissions = permissions || [];
168
+		},
165 169
 		SWITCH_ROLE({}, role) {
166 170
 			setTimeout(() => {
167 171
 				const allIndices = [0, 1, 2, 3, 4, 5, 6];
@@ -207,6 +211,12 @@ export default {
207 211
 			return new Promise((resolve, reject) => {
208 212
 				uni.$u.api.getInfo().then(res => {
209 213
 					commit("SET_USERINFO", res.user);
214
+					// 保存权限列表
215
+					if (res.permissions && res.permissions.length > 0) {
216
+						commit("SET_PERMISSIONS", res.permissions);
217
+					} else {
218
+						commit("SET_PERMISSIONS", []);
219
+					}
210 220
 					commit("SET_BELONGSYSTEM", {
211 221
 						code: state.system.value,
212 222
 						callback: (flag) => {
@@ -248,6 +258,7 @@ export default {
248 258
 
249 259
 				commit("SET_TOKEN", "");
250 260
 				commit("SET_USERINFO", {});
261
+				commit("SET_PERMISSIONS", []); // 清空权限列表
251 262
 				dispatch("app/logoutCloseData", null, {
252 263
 					root: true
253 264
 				});

+ 60 - 0
utils/permission.js

@@ -0,0 +1,60 @@
1
+import store from '@/store'
2
+
3
+/**
4
+ * 字符权限校验
5
+ * @param {Array} value 校验值
6
+ * @returns {Boolean}
7
+ */
8
+export function checkPermi(value) {
9
+  if (value && value instanceof Array && value.length > 0) {
10
+    const permissions = store.getters && store.getters.permissions
11
+    console.log('permissionsxxxxxxxx', permissions);
12
+    const permissionDatas = value
13
+    const all_permission = "*:*:*";
14
+
15
+    if (!permissions || !Array.isArray(permissions) || permissions.length === 0) {
16
+      return false
17
+    }
18
+
19
+    const hasPermission = permissions.some(permission => {
20
+      return all_permission === permission || permissionDatas.includes(permission)
21
+    })
22
+
23
+    if (!hasPermission) {
24
+      return false
25
+    }
26
+    return true
27
+  } else {
28
+    console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`)
29
+    return false
30
+  }
31
+}
32
+
33
+/**
34
+ * 角色权限校验
35
+ * @param {Array} value 校验值
36
+ * @returns {Boolean}
37
+ */
38
+export function checkRole(value) {
39
+  if (value && value instanceof Array && value.length > 0) {
40
+    const roles = store.getters && store.getters.roles
41
+    const permissionRoles = value
42
+    const super_admin = "admin";
43
+
44
+    if (!roles || !Array.isArray(roles) || roles.length === 0) {
45
+      return false
46
+    }
47
+
48
+    const hasRole = roles.some(role => {
49
+      return super_admin === role || permissionRoles.includes(role)
50
+    })
51
+
52
+    if (!hasRole) {
53
+      return false
54
+    }
55
+    return true
56
+  } else {
57
+    console.error(`need roles! Like checkRole="['admin','editor']"`)
58
+    return false
59
+  }
60
+}