huangbin hace 4 años
padre
commit
e00cf9da91

+ 7 - 2
src/common/components/friends/index.vue

@@ -69,6 +69,10 @@ export default defineComponent({
             type: String,
             default: 'top',
         },
+        friends: {
+            type: Array as PropType<number[]>,
+            default: [],
+        },
     },
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
@@ -83,7 +87,8 @@ export default defineComponent({
                     if (res) {
                         myFriends.value = [];
                         res.forEach((el) => {
-                            myFriends.value.push({ ...el, checked: false });
+                            const checked = props.friends.includes(el.frienduserid) ? true : false;
+                            myFriends.value.push({ ...el, checked });
                         });
                     }
                 })
@@ -101,7 +106,7 @@ export default defineComponent({
             }
         }
         function submit() {
-            const result: string[] = [];
+            const result: number[] = [];
             myFriends.value.forEach((el) => {
                 if (el.checked) {
                     result.push(el.frienduserid);

+ 1 - 1
src/services/go/wrtrade/interface.ts

@@ -1121,7 +1121,7 @@ export interface QueryWrTradeBargainApplyQsp {
 
 export interface QueryWrFriendApplyRsp {
     friendname: string;//好友名字(已脱敏)
-    frienduserid: string;//好友用户ID
+    frienduserid: number;//好友用户ID
     isfriend: number; // 是否好友 0-不是 1-是
     userid: number;//用户ID
 }

+ 1 - 0
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_blocs/components/post-buying/index.vue

@@ -156,6 +156,7 @@
   </Drawer>
   <!-- 选择朋友 -->
   <Friend v-if="showFriend"
+          :friends=formState.friends
           @cancel="chooseFriend"
           @update="chooseFriend" />
   <!-- 选择履约模板 -->

+ 1 - 0
src/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_blocs/components/post-buying/index.vue

@@ -147,6 +147,7 @@
   </Drawer>
   <!-- 选择朋友 -->
   <Friend v-if="showFriend"
+          :friends=formState.friends
           @cancel="chooseFriend"
           @update="chooseFriend" />
   <!-- 选择履约模板 -->

+ 1 - 0
src/views/order/pre_sale_warehouse_receipt/components/pre_sale_warehouse_receipt_order_summary/components/listed/index.vue

@@ -265,6 +265,7 @@
   </Drawer>
   <!-- 选择朋友 -->
   <Friend v-if="showFriend"
+          :friends=formState.friends
           :position="'bottom'"
           @cancel="chooseFriend"
           @update="chooseFriend" />

+ 1 - 0
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/index.vue

@@ -252,6 +252,7 @@
   </Drawer>
   <!-- 选择朋友 -->
   <Friend v-if="showFriend"
+          :friends=formState.friends
           :position="'bottom'"
           @cancel="chooseFriend"
           @update="chooseFriend" />

+ 3 - 2
src/views/setting/friends/index.vue

@@ -87,10 +87,11 @@ export default defineComponent({
             });
         }
         function operate({ frienduserid, isfriend }: QueryWrFriendApplyRsp) {
+            const id = frienduserid.toString();
             if (isfriend) {
-                deleteFriend(frienduserid);
+                deleteFriend(id);
             } else {
-                addFriend(frienduserid);
+                addFriend(id);
             }
         }
         // 查询好友列表