xiaohaizhao hace 2 meses
padre
commit
ff447a6554

+ 235 - 159
CRM/customer/modules/orderCreate/create.js

@@ -8,75 +8,75 @@ Page({
     activeTab: 0,
     productList: [],
     form: [{
-      label: "客户",
-      error: false,
-      errMsg: "",
-      type: "text",
-      value: "",
-      placeholder: "客户名称",
-      valueName: "name",
-      required: false,
-      checking: "base",
-      disabled: true
-    },
-    {
-      label: "门店",
-      error: false,
-      errMsg: "",
-      type: "text",
-      value: "",
-      placeholder: "门店名称",
-      valueName: "storename",
-      required: false,
-      checking: "base",
-      disabled: true
-    },
-    {
-      label: "开单日期",
-      error: false,
-      errMsg: "",
-      type: "date",
-      value: "",
-      placeholder: "请选择开单日期",
-      valueName: "billdate",
-      required: false,
-      checking: "base"
-    },
-    {
-      label: "订单数量",
-      error: false,
-      errMsg: "",
-      type: "number",
-      value: "0",
-      placeholder: "订单数量",
-      valueName: "orderCount",
-      required: false,
-      checking: "base",
-      disabled: true
-    },
-    {
-      label: "订单金额",
-      error: false,
-      errMsg: "",
-      type: "number",
-      value: "0",
-      placeholder: "订单金额",
-      valueName: "amount",
-      required: false,
-      checking: "base",
-      disabled: true
-    },
-    {
-      label: "备注",
-      error: false,
-      errMsg: "",
-      type: "textarea",
-      value: "",
-      placeholder: "请输入备注",
-      valueName: "remarks",
-      required: false,
-      checking: "base"
-    }
+        label: "客户",
+        error: false,
+        errMsg: "",
+        type: "text",
+        value: "",
+        placeholder: "客户名称",
+        valueName: "name",
+        required: false,
+        checking: "base",
+        disabled: true
+      },
+      {
+        label: "门店",
+        error: false,
+        errMsg: "",
+        type: "text",
+        value: "",
+        placeholder: "门店名称",
+        valueName: "storename",
+        required: false,
+        checking: "base",
+        disabled: true
+      },
+      {
+        label: "开单日期",
+        error: false,
+        errMsg: "",
+        type: "date",
+        value: "",
+        placeholder: "请选择开单日期",
+        valueName: "billdate",
+        required: false,
+        checking: "base"
+      },
+      {
+        label: "订单数量",
+        error: false,
+        errMsg: "",
+        type: "number",
+        value: "0",
+        placeholder: "订单数量",
+        valueName: "orderCount",
+        required: false,
+        checking: "base",
+        disabled: true
+      },
+      {
+        label: "订单金额",
+        error: false,
+        errMsg: "",
+        type: "number",
+        value: "0",
+        placeholder: "订单金额",
+        valueName: "amount",
+        required: false,
+        checking: "base",
+        disabled: true
+      },
+      {
+        label: "备注",
+        error: false,
+        errMsg: "",
+        type: "textarea",
+        value: "",
+        placeholder: "请输入备注",
+        valueName: "remarks",
+        required: false,
+        checking: "base"
+      }
     ],
     "content": {
       "sa_custorderid": 0,
@@ -133,14 +133,16 @@ Page({
       });
       return;
     }
-    
+
     this.setData({
       loading: true
     });
     let formData = this.selectComponent("#Form").submit();
-    
+
     if (!formData) {
-      this.setData({ loading: false });
+      this.setData({
+        loading: false
+      });
       return;
     }
 
@@ -158,23 +160,39 @@ Page({
       if (res.code == 1) {
         const orderId = res.data;
         console.log("订单ID", orderId);
-        
+
         // 显示加载提示
         wx.showLoading({
-          title: '正在绑定商品...',
+          title: '正在处理...',
           mask: true
         });
-        
-        // 使用Promise.all处理商品绑定
-        this.bindProductsWithPromise(orderId).then(() => {
-          // 绑定完成,跳转到订单详情
+
+        // 准备绑定操作
+        const promises = [];
+
+        // 绑定商品
+        if (this.data.productList.length > 0) {
+          promises.push(this.bindProductsWithPromise(orderId));
+        }
+
+        // 绑定附件
+        const attachmentids = this.selectComponent("#Yl_files").getFiles().attachmentids;
+        if (attachmentids && attachmentids.length > 0) {
+          promises.push(this.bindAttachmentsWithPromise(orderId, attachmentids));
+        }
+
+        // 使用Promise.all处理所有绑定操作
+        Promise.all(promises).then(() => {
+          // 所有绑定完成,跳转到订单详情
           this.navigateToOrderDetail(orderId);
         }).catch(() => {
           // 绑定失败,跳转到订单详情
           this.navigateToOrderDetail(orderId);
         });
       } else {
-        this.setData({ loading: false });
+        this.setData({
+          loading: false
+        });
         wx.showToast({
           title: res.msg || '保存失败',
           icon: 'none'
@@ -203,7 +221,7 @@ Page({
           content: {
             sa_custorderid: orderId,
             sa_custorderitemsid: 0,
-            sys_enterprise_itemid:product.sys_enterprise_itemid|| product.itemid,
+            sys_enterprise_itemid: product.sys_enterprise_itemid || product.itemid,
             qty: product.qty,
             oldprice: product.originalPrice || product.price,
             discountrate: product.discount,
@@ -212,82 +230,107 @@ Page({
             remarks: product.remarks || ""
           }
         }).then(res => {
-            if (res.code != 1) {
-              console.error("绑定商品失败", res);
-            }
-            resolve(res);
-          }).catch(err => {
-            console.error("绑定商品失败", err);
-            resolve(null); // 即使失败也继续处理
-          });
+          if (res.code != 1) {
+            console.error("绑定商品失败", res);
+          }
+          resolve(res);
+        }).catch(err => {
+          console.error("绑定商品失败", err);
+          resolve(null); // 即使失败也继续处理
+        });
+      });
     });
-  });
 
-// 处理附件绑定(预留接口)
-const attachmentPromise = this.bindAttachmentsWithPromise(orderId);
+    // 处理附件绑定(预留接口)
+    const attachmentPromise = this.bindAttachmentsWithPromise(orderId);
 
-// 合并所有Promise
-const allPromises = [...bindPromises, attachmentPromise];
+    // 合并所有Promise
+    const allPromises = [...bindPromises, attachmentPromise];
 
-// 使用Promise.all处理所有请求
-return Promise.all(allPromises);
+    // 使用Promise.all处理所有请求
+    return Promise.all(allPromises);
   },
-// 绑定附件(预留接口)
-bindAttachmentsWithPromise(orderId) {
-  return new Promise((resolve) => {
-    // 这里预留附件绑定的逻辑
-    // 目前暂时直接resolve
-    resolve(null);
-  });
-},
-// 跳转到订单详情
-navigateToOrderDetail(orderId) {
-  // 隐藏加载提示
-  wx.hideLoading();
-  this.setData({ loading: false });
-  wx.redirectTo({
-    url: `/CRM/order/detail?id=${orderId}`,
-    success: () => {
-      // 跳转到订单详情页面
-      wx.showToast({
-        title: "开单成功",
-        icon: "none",
-        duration: 1500,
+  // 绑定附件
+  bindAttachmentsWithPromise(orderId, attachmentids) {
+    return new Promise((resolve) => {
+      if (!attachmentids || attachmentids.length === 0) {
+        resolve(null);
+        return;
+      }
+      _Http.basic({
+        "classname": "system.attachment.Attachment",
+        "method": "createFileLink",
+        id: 10020501,
+        "content": {
+          ownertable: "sa_custorder",
+          ownerid: orderId,
+          usetype: 'default',
+          attachmentids
+        }
+      }).then(res => {
+        console.log('绑定附件', res);
+        if (res.code == 1) {
+          resolve(res.data);
+        } else {
+          console.error('绑定附件失败', res);
+          resolve(); // 绑定失败也继续执行
+        }
+      }).catch(err => {
+        console.error('绑定附件错误', err);
+        resolve(); // 错误也继续执行
       });
-    }
-  });
-  getCurrentPages().find(v => v.__route__ == 'CRM/customer/detail').partialRenewal(true);
-},
-interrupt({
-  detail
-}) {
-  // 处理中断逻辑,如果需要的话
-},
-/* 表单必填项是否完成 */
-onConfirm({
-  detail
-}) {
-  this.setData({
-    disabled: detail
-  });
-},
-onChange(e) {
-  this.setData({
-    showAll: e.detail
-  });
-},
-closePage() {
-  wx.navigateBack({
-    delta: 1
-  });
-},
-// tab切换
-onTabChange(e) {
-  this.setData({
-    activeTab: e.detail
-  });
-},
-// 打开添加商品面板
+    });
+  },
+  // 跳转到订单详情
+  navigateToOrderDetail(orderId) {
+    // 隐藏加载提示
+    wx.hideLoading();
+    this.setData({
+      loading: false
+    });
+    wx.redirectTo({
+      url: `/CRM/order/detail?id=${orderId}`,
+      success: () => {
+        // 跳转到订单详情页面
+        wx.showToast({
+          title: "开单成功",
+          icon: "none",
+          duration: 1500,
+        });
+      }
+    });
+    getCurrentPages().find(v => v.__route__ == 'CRM/customer/detail').partialRenewal(true);
+  },
+  interrupt({
+    detail
+  }) {
+    // 处理中断逻辑,如果需要的话
+  },
+  /* 表单必填项是否完成 */
+  onConfirm({
+    detail
+  }) {
+    this.setData({
+      disabled: detail
+    });
+  },
+  onChange(e) {
+    this.setData({
+      showAll: e.detail
+    });
+  },
+  closePage() {
+    wx.navigateBack({
+      delta: 1
+    });
+  },
+  // tab切换
+  onTabChange(e) {
+    this.setData({
+      activeTab: e.detail
+    });
+  },
+  // 打开添加商品面板
   addProduct() {
     // 直接跳转到产品选择页面
     wx.navigateTo({
@@ -316,14 +359,14 @@ onTabChange(e) {
   handleSelect(detail) {
     if (detail && detail.list) {
       const existingItemIds = this.data.productList.map(item => item.sys_enterprise_itemid);
-      
+
       // 过滤掉已经存在的商品
       const newProducts = detail.list.filter(item => !existingItemIds.includes(item.sys_enterprise_itemid)).map(item => {
         // 处理价格字段,去除格式化符号
         const priceStr = item.guid_price_cus || item.price || "0";
         const price = parseFloat(priceStr.toString().replace(/[¥,]/g, '')) || 0;
         const qty = parseInt(item.qty) || 1;
-        
+
         return {
           itemid: item.itemid,
           sys_enterprise_itemid: item.sys_enterprise_itemid,
@@ -338,12 +381,12 @@ onTabChange(e) {
           remarks: item.remarks || ''
         };
       });
-      
+
       if (newProducts.length > 0) {
         this.setData({
           productList: [...this.data.productList, ...newProducts]
         });
-        
+
         // 更新订单金额
         this.updateOrderAmount();
       } else {
@@ -352,7 +395,7 @@ onTabChange(e) {
           icon: 'none'
         });
       }
-      
+
       // 返回页面
       wx.navigateBack();
     }
@@ -446,13 +489,46 @@ onTabChange(e) {
     form.forEach(item => {
       if (item.valueName === 'amount') {
         item.value = totalAmount.toString();
-        this.setData({ "content.amount": totalAmount });
+        this.setData({
+          "content.amount": totalAmount
+        });
       }
       if (item.valueName === 'orderCount') {
         item.value = totalQty.toString();
-        this.setData({ "content.orderCount": totalQty });
+        this.setData({
+          "content.orderCount": totalQty
+        });
       }
     });
-    this.setData({ form });
-  }
+    this.setData({
+      form
+    });
+  },
+  // 处理上传状态
+  changeState({
+    detail
+  }) {
+    this.setData({
+      loading: detail
+    });
+  },
+  // 处理文件上传回调
+  handleFileUpload({
+    detail
+  }) {
+    console.log("detail",detail)
+    Promise.all(detail.map(attachmentid => {
+      return _Http.basic({
+        "id": 2024061710590401,
+        "content": {
+          "pageSize": 1,
+          "pageNumber": 1,
+          "attachmentid": attachmentid
+        }
+      })
+    })).then(res => {
+      console.log('获取文件详情', res);
+      this.selectComponent("#Yl_files").handleFiles(res.map(v=>v.data[0]))
+    })
+  },
 });

+ 3 - 1
CRM/customer/modules/orderCreate/create.json

@@ -2,6 +2,8 @@
   "usingComponents": {
     "Yl_Field": "../../../../components/Yl_Field/index",
     "Yl_Headline": "../../../../components/Yl_Headline/index",
-    "van-button": "@vant/weapp/button/index"
+    "van-button": "@vant/weapp/button/index",
+    "Yl_Upload":"../../../../components/Yl_Upload/index",
+    "Yl_Files":"../../../../components/Yl_Files/index"
   }
 }

+ 59 - 10
CRM/customer/modules/orderCreate/create.scss

@@ -22,16 +22,6 @@
   color: #fff;
 }
 
-.empty {
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  height: 200rpx;
-  color: #999;
-  background-color: #f5f5f5;
-  border-radius: 8rpx;
-}
-
 .head {
   display: flex;
   justify-content: space-between;
@@ -177,4 +167,63 @@ page {
 
 .product-remarks .label {
   margin-top: 10rpx;
+}
+
+/* 附件上传样式 */
+.upload-container {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  background-color: #F4F5F7;
+  padding: 20rpx;
+  margin-bottom: 10rpx;
+
+  .upload-title {
+    font-size: 32rpx;
+    font-weight: bold;
+    color: #333;
+  }
+
+  .upload-buttons {
+    display: flex;
+    gap: 20rpx;
+  }
+
+  .upload-button {
+    display: flex;
+    align-items: center;
+    background-color: #fff;
+    border: 1rpx dashed #e8e8e8;
+    border-radius: 8rpx;
+    transition: all 0.3s ease;
+    font-size: 24rpx;
+    padding: 8rpx 14rpx;
+
+    .iconfont {
+      color: #999;
+      margin-bottom: 8rpx;
+    }
+
+    .upload-text {
+      color: #999;
+      margin-left: 12rpx;
+    }
+
+    &:hover {
+      border-color: #3874F6;
+      box-shadow: 0 2rpx 8rpx rgba(56, 116, 246, 0.1);
+
+      .iconfont,
+      .upload-text {
+        color: #3874F6;
+      }
+    }
+  }
+}
+
+/* 附件列表样式 */
+#Yl_files {
+  background-color: #F4F5F7;
+  padding: 0 20rpx 20rpx;
+  min-height: 200rpx;
 }

+ 18 - 7
CRM/customer/modules/orderCreate/create.wxml

@@ -12,10 +12,8 @@
         </navigator>
       </view>
     </view>
-    <view wx:if="{{productList.length == 0}}" class="empty">
-      <text>请添加商品</text>
-    </view>
-    <view wx:else class="product-list">
+    <view class="product-list">
+      <Yl_Empty wx:if="{{productList.length == 0}}" />
       <view wx:for="{{productList}}" wx:key="index" class="product-item">
         <view class="product-header">
           <view class="product-name">{{item.itemname}}</view>
@@ -59,11 +57,24 @@
 
   </van-tab>
   <van-tab title="附件">
-    <view style="padding: 20rpx;">
-      <view class="empty">
-        <text>请添加附件</text>
+    <view class="upload-container">
+      <view class="upload-title">订单附件</view>
+      <view class="upload-buttons">
+        <Yl_Upload accept='media' bind:uploadCallback="handleFileUpload" bind:changeState='changeState'>
+          <view class="upload-button">
+            <text class="iconfont icon-a-tonggaofujian" /> 
+            <view class="upload-text">图片/视频</view>
+          </view>
+        </Yl_Upload>
+        <Yl_Upload accept='file' bind:uploadCallback="handleFileUpload" bind:changeState='changeState'>
+          <view class="upload-button">
+            <text class="iconfont icon-a-biaoqianlanzhiku" /> 
+            <view class="upload-text">选取文件</view>
+          </view>
+        </Yl_Upload>
       </view>
     </view>
+    <Yl_Files delete id="Yl_files" />
   </van-tab>
 </van-tabs>
 

+ 1 - 1
components/Yl_Attachment/index.js

@@ -56,7 +56,7 @@ Component({
 		}) {
 			_Http.basic({
 				"classname": "system.attachment.Attachment",
-				"method": "createFileLink",
+				"method": "createFileLink",id: 10020501,
 				"content": {
 					"ownertable": this.data.ownertable,
 					"ownerid": this.data.ownerid,

+ 89 - 29
components/Yl_Files/index.js

@@ -21,6 +21,9 @@ Component({
             type: Function
         }
     },
+    data: {
+        attachmentids: []
+    },
     methods: {
         /* 预览媒体 */
         viewMedias(e) {
@@ -68,36 +71,56 @@ Component({
         /* 删除文件 */
         handleDeleteFile(e) {
             let item = e.currentTarget.dataset.item || e.currentTarget.dataset.item;
-            _Http.basic({
-                "classname": "system.attachment.Attachment",
-                "method": "deleteFileLink",
-                "content": {
-                    "linksids": [item.linksid]
-                }
-            }).then(res => {
-                if (res.msg != '成功') return wx.showToast({
-                    title: res.msg,
-                    icon: "none"
+            // 判断是否有 linksid
+            if (item.linksid) {
+                // 使用原接口删除文件链接
+                _Http.basic({
+                    "classname": "system.attachment.Attachment",
+                    "method": "deleteFileLink",
+                    "id": 10020601,
+                    "content": {
+                        "linksids": [item.linksid]
+                    }
+                }).then(res => {
+                    this.handleDeleteResponse(res, item);
                 });
-                let files = this.data.files;
-                switch (item.fileType) {
-                    case "image":
-                        files.images = files.images.filter(v => v.url != item.url);
-                        files.viewImages = files.viewImages.filter(v => v.url != item.url);
-                        break;
-                    case "video":
-                        files.videos = files.videos.filter(v => v.url != item.url);
-                        files.viewVideos = files.viewVideos.filter(v => v.url != item.url);
-                        break;
-                    default:
-                        files.files = files.files.filter(v => v.attachmentid != item.attachmentid);
-                        break;
-                };
-                this.setData({
-                    files
+            } else if (item.attachmentid) {
+                // 使用新接口删除文件
+                _Http.basic({
+                    "id": 10021201,
+                    "content": {
+                        "attachmentid": item.attachmentid
+                    }
+                }).then(res => {
+                    this.handleDeleteResponse(res, item);
                 });
-                this.triggerEvent("deleteCallBack")
-            })
+            }
+        },
+        /* 处理删除响应 */
+        handleDeleteResponse(res, item) {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            });
+            let files = this.data.files;
+            switch (item.fileType) {
+                case "image":
+                    files.images = files.images.filter(v => v.url != item.url);
+                    files.viewImages = files.viewImages.filter(v => v.url != item.url);
+                    break;
+                case "video":
+                    files.videos = files.videos.filter(v => v.url != item.url);
+                    files.viewVideos = files.viewVideos.filter(v => v.url != item.url);
+                    break;
+                default:
+                    files.files = files.files.filter(v => v.attachmentid != item.attachmentid);
+                    break;
+            };
+            this.setData({
+                files,
+                attachmentids: this.getFiles().attachmentids
+            });
+            this.triggerEvent("deleteCallBack")
         },
         /* 处理附件 */
         handleFiles(arr, init = false) {
@@ -109,7 +132,19 @@ Component({
                     files: []
                 } : this.data.files,
                 list = fileList(arr);
+
+            // 去重处理,确保每个文件只添加一次
+            const uniqueList = [];
+            const seenUrls = new Set();
+
             list.forEach(v => {
+                if (!seenUrls.has(v.url)) {
+                    seenUrls.add(v.url);
+                    uniqueList.push(v);
+                }
+            });
+
+            uniqueList.forEach(v => {
                 switch (v.fileType) {
                     case "video":
                         files.videos.push(v)
@@ -132,8 +167,30 @@ Component({
                 }
             });
             this.setData({
-                files
+                files,
+                attachmentids: this.getFiles().attachmentids
+            })
+        },
+        /* 返回数据ID数组 用来换绑数据 */
+        getFiles() {
+            let data = {
+                    attachmentids: [],
+                    list: [],
+                },
+                files = this.data.files;
+            files.files.forEach(v => {
+                data.attachmentids.push(v.attachmentid);
+                data.list.push(v);
+            })
+            files.images.forEach(v => {
+                data.attachmentids.push(v.attachmentid);
+                data.list.push(v);
             })
+            files.videos.forEach(v => {
+                data.attachmentids.push(v.attachmentid);
+                data.list.push(v);
+            });
+            return data
         },
         /* 初始化数据 */
         initData() {
@@ -146,6 +203,9 @@ Component({
                     files: []
                 }
             })
+            this.setData({
+                attachmentids: this.getFiles().attachmentids
+            })
         },
     }
 })

+ 2 - 1
components/Yl_Files/index.wxml

@@ -21,4 +21,5 @@
         <image wx:if="{{delete}}" class="delete" src="/static/image/delete.png" data-item="{{item}}" catchtap="handleDeleteFile" />
     </navigator>
 </view>
-<!--  list="{{files.files}}" -->
+<!--  list="{{files.files}}" -->
+<Yl_Empty wx:if="{{attachmentids.length == 0}}" />

+ 2 - 0
components/Yl_Upload/index.js

@@ -73,6 +73,7 @@ Component({
             return {
                 "classname": "system.attachment.huawei.OBS",
                 "method": "getFileName",
+                id: 10019701,
                 "content": {
                     "filename": file.name,
                     "filetype": ext,
@@ -94,6 +95,7 @@ Component({
                     _Http.basic({
                         "classname": "system.attachment.huawei.OBS",
                         "method": "uploadSuccess",
+                        id: 10019901,
                         "content": {
                             "serialfilename": res.serialfilename
                         }

+ 2 - 2
marketing/components/My_richText/index.js

@@ -87,7 +87,7 @@ Component({
             let prevPage = pages[pages.length - 1];
             _Http.basic({
                 "classname": "system.attachment.Attachment",
-                "method": "createFileLink",
+                "method": "createFileLink",id: 10020501,
                 "content": {
                     "ownertable": "SAT_SHAREMATERIAL",
                     "ownerid": prevPage.data.detailsData.sat_sharematerialid,
@@ -118,7 +118,7 @@ Component({
             let index = richTextFile.findIndex((value) => value.url == detail.src);
             _Http.basic({
                 "classname": "system.attachment.Attachment",
-                "method": "deleteFileLink",
+                "method": "deleteFileLink",id: 10020601,
                 "content": {
                     "linksids": [richTextFile[index].linksid]
                 }

+ 2 - 0
marketing/components/My_upload/index.js

@@ -73,6 +73,7 @@ Component({
             return {
                 "classname": "system.attachment.huawei.OBS",
                 "method": "getFileName",
+                id: 10019701,
                 "content": {
                     "filename": file.name,
                     "filetype": ext,
@@ -94,6 +95,7 @@ Component({
                     _Http.basic({
                         "classname": "system.attachment.huawei.OBS",
                         "method": "uploadSuccess",
+                        id: 10020501,
                         "content": {
                             "serialfilename": res.serialfilename
                         }

+ 2 - 2
marketing/promotional/upload.js

@@ -170,7 +170,7 @@ Page({
     }) {
         _Http.basic({
             "classname": "system.attachment.Attachment",
-            "method": "createFileLink",
+            "method": "createFileLink",id: 10020501,
             "content": {
                 "ownertable": "SAT_SHAREMATERIAL",
                 "ownerid": this.data.detailsData.sat_sharematerialid,
@@ -242,7 +242,7 @@ Page({
     handleDelete(linksids) {
         return _Http.basic({
             "classname": "system.attachment.Attachment",
-            "method": "deleteFileLink",
+            "method": "deleteFileLink",id: 10020601,
             "content": {
                 linksids: linksids
             }

+ 3 - 3
marketing/submission/details.js

@@ -60,7 +60,7 @@ Page({
     }) {
         _Http.basic({
             "classname": "system.attachment.Attachment",
-            "method": "createFileLink",
+            "method": "createFileLink",id: 10020501,
             "content": {
                 "ownertable": "sat_submitedit",
                 "ownerid": this.data.submiteditData.sat_submiteditid,
@@ -83,7 +83,7 @@ Page({
     }) {
         _Http.basic({
             "classname": "system.attachment.Attachment",
-            "method": "deleteFileLink",
+            "method": "deleteFileLink",id: 10020601,
             "content": {
                 linksids: [detail.linksid]
             }
@@ -253,7 +253,7 @@ Page({
                 };
                 _Http.basic({
                     "classname": "system.attachment.Attachment",
-                    "method": "deleteFileLink",
+                    "method": "deleteFileLink",id: 10020601,
                     "content": {
                         linksids
                     }

+ 2 - 2
pages/index/userCenter/userMsg/index.js

@@ -154,7 +154,7 @@ Page({
     }) {
         _Http.basic({
             "classname": "system.attachment.Attachment",
-            "method": "createFileLink",
+            "method": "createFileLink",id: 10020501,
             "content": {
                 "ownertable": "sys_users",
                 "ownerid": wx.getStorageSync('userMsg').userid,
@@ -169,7 +169,7 @@ Page({
             let linksids = this.data.attinfos.map(v => v.linksid);
             if (linksids.length) await _Http.basic({
                 "classname": "system.attachment.Attachment",
-                "method": "deleteFileLink",
+                "method": "deleteFileLink",id: 10020601,
                 "content": {
                     "linksids": linksids
                 }

+ 10 - 0
utils/FormatTheAttachment.js

@@ -13,6 +13,9 @@ function fileList(list) {
         typeList = [];
     for (let key in suffixList) typeList.push(key);
     for (let i = 0; i < list.length; i++) {
+        // 处理文件URL,确保是完整的URL
+        list[i].url = getImageUrl(list[i].url);
+        
         list[i].fileType = 'unknown';
         list[i].cover = `/static/image/file/unknown.png`
         const suffix = list[i].postfix.toLowerCase();
@@ -31,6 +34,13 @@ function fileList(list) {
             list[i].fileType = "folder";
             list[i].cover = `/static/image/file/folder.png`
         }
+        
+        // 处理子文件的URL
+        if (list[i].subfiles && list[i].subfiles.length > 0) {
+            list[i].subfiles.forEach(subfile => {
+                subfile.url = getImageUrl(subfile.url);
+            });
+        }
     }
     return list;
 };