Browse Source

客户跟进

zhaoxiaohai 2 years ago
parent
commit
4a4fa6d26c

+ 30 - 56
packageA/setclient/modules/trace/add/index.js

@@ -61,54 +61,40 @@ Page({
             this.initTemplate()
         }
     },
-    deleteFile(e) {
-        let item = e.detail.attachmentid ? e.detail : e.currentTarget.dataset.item,
-            that = this;
-        if (!e.detail.attachmentid) {
-            wx.showModal({
-                title: '提示',
-                content: '是否确认删除该附件',
-                complete: ({
-                    confirm
-                }) => {
-                    if (confirm) that.handleDelete([item.linksid]).then(res => {
-                        if (res.msg != '成功') return wx.showToast({
-                            title: res.data,
-                            icon: "none"
-                        })
-                        let files = that.data.files,
-                            name = item.fileType == "image" ? "images" : "videos",
-                            name2 = item.fileType == "image" ? "viewImages" : "viewVideos",
-                            data = that.data.files[name].find(v => v.url == item.url);
-                        files[name] = files[name].filter(v => v.url != data.url);
-                        files[name2] = files[name2].filter(v => v.url != data.url);
-                        that.setData({
-                            files
-                        })
-                    })
-                }
-            })
-        } else {
-            that.handleDelete([item.linksid]).then(res => {
-                if (res.msg != '成功') return wx.showToast({
-                    title: res.data,
-                    icon: "none"
-                })
-                let files = that.data.files;
-                files.files = files.files.filter(v => v.url != item.url);
-                that.setData({
-                    files
-                })
-            })
-        }
-    },
-    handleDelete(linksid) {
-        return _Http.basic({
+    /* 删除文件 */
+    deleteFile({
+        detail
+    }) {
+        let e = detail,
+            item = e.detail.attachmentid ? e.detail : e.currentTarget.dataset.item;
+        _Http.basic({
             "classname": "system.attachment.Attachment",
             "method": "deleteFileLink",
             "content": {
-                "linksids": linksid
+                "linksids": [item.linksid]
             }
+        }).then(res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                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
+            });
         })
     },
     /* 绑定媒体 */
@@ -132,7 +118,6 @@ Page({
     /* 处理附件 */
     handleFiles(list) {
         let files = this.data.files;
-
         list.forEach(v => {
             switch (v.fileType) {
                 case "video":
@@ -159,17 +144,6 @@ Page({
             files
         })
     },
-    /* 预览媒体 */
-    viewMedias(e) {
-        const {
-            index,
-            type
-        } = e.currentTarget.dataset;
-        wx.previewMedia({
-            current: index,
-            sources: type == 'image' ? this.data.files.viewImages : this.data.files.viewVideos,
-        })
-    },
     /* 初始化模板 */
     initTemplate() {
         _Http.basic({

+ 2 - 2
packageA/setclient/modules/trace/add/index.json

@@ -1,7 +1,7 @@
 {
     "usingComponents": {
-        "My_upload":"/components/My_upload/index",
-        "My_accessory":"/components/My_accessory/index"
+        "My_upload": "/components/My_upload/index",
+        "Files": "../files/index"
     },
     "navigationBarTitleText": "跟进"
 }

+ 41 - 81
packageA/setclient/modules/trace/add/index.scss

@@ -1,16 +1,53 @@
+.navigator {
+    width: 750rpx;
+    background: #FFFFFF;
+    box-sizing: border-box;
+    padding-left: 30rpx;
+    margin-bottom: 20rpx;
+
+    >view {
+        display: flex;
+        align-items: center;
+        border-bottom: 2rpx solid #ccc;
+        height: 90rpx;
+        width: 100%;
+        box-sizing: border-box;
+
+        .label {
+            flex-shrink: 0;
+            font-size: 28rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #666666;
+            padding-left: 20rpx;
+            width: 290rpx;
+            box-sizing: border-box;
+        }
+
+        .text {
+            flex: 1;
+            font-size: 28rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #333333;
+        }
+
+        .iconfont {
+            flex-shrink: 0;
+            margin-right: 36rpx;
+        }
+    }
+}
 .box {
     width: 100vw;
-    background-color: #ffffff;
-    padding-top: 20rpx;
     box-sizing: border-box;
-
+    background-color: #fff;
+    padding-top: 20rpx;
+    margin-top: 20rpx;
     .title {
         font-size: 28rpx;
         font-family: PingFang SC-Regular, PingFang SC;
         color: #333333;
         padding-left: 30rpx;
     }
-
     .content {
         width: 690rpx;
         border-radius: 8rpx;
@@ -51,84 +88,7 @@
             margin: 20rpx 0 0 0;
         }
     }
-
-    .navigator {
-        width: 750rpx;
-        background: #FFFFFF;
-        box-sizing: border-box;
-        padding-left: 30rpx;
-
-        >view {
-            display: flex;
-            align-items: center;
-            border-top: 2rpx solid #ccc;
-            height: 90rpx;
-            width: 100%;
-            box-sizing: border-box;
-
-            .label {
-                flex-shrink: 0;
-                font-size: 28rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #666666;
-                padding-left: 20rpx;
-                width: 290rpx;
-                box-sizing: border-box;
-            }
-
-            .text {
-                flex: 1;
-                font-size: 28rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #333333;
-            }
-
-            .iconfont {
-                flex-shrink: 0;
-                margin-right: 36rpx;
-            }
-        }
-    }
-
-    .media {
-        width: 100%;
-        display: flex;
-        flex-wrap: wrap;
-        margin-top: 20rpx;
-        padding: 0 30rpx;
-        box-sizing: border-box;
-
-        .image {
-            position: relative;
-            width: 116rpx;
-            height: 116rpx;
-            margin-right: 8rpx;
-            margin-bottom: 8rpx;
-
-            image {
-                width: 100%;
-                height: 100%;
-            }
-
-            .icon {
-                position: absolute;
-                top: 6rpx;
-                right: 6rpx;
-                color: #DF1C34;
-            }
-
-            .suspend {
-                position: absolute;
-                top: 50%;
-                left: 50%;
-                width: 36rpx;
-                height: 36rpx;
-                transform: translate(-50%, -50%);
-            }
-        }
-    }
 }
-
 .footer {
     display: flex;
     align-items: center;

+ 11 - 26
packageA/setclient/modules/trace/add/index.wxml

@@ -1,7 +1,14 @@
+<navigator class="navigator" url="#" bindtap="openSelect">
+    <view>
+        <view class="label">跟进方式</view>
+        <view class="text">{{type||"请选择"}}</view>
+        <text class="iconfont icon-a-wodetiaozhuan" />
+    </view>
+</navigator>
+
 <view class="box">
-    <view class="title"><text style="color: red; margin-right: 8rpx;">*</text>记录跟进内容</view>
+    <view class="title">跟进内容</view>
     <view class="content">
-        <textarea class="textarea" placeholder='请填写' value="{{content}}" bindinput='onInput' />
         <view class="upload">
             <My_upload accept='media' binduploadCallback="insertImgEdit">
                 <navigator url="#">
@@ -14,31 +21,9 @@
                 </navigator>
             </My_upload>
         </view>
-        <view class="title">
-            附件列表:
-        </view>
-        <view class="media">
-            <navigator url="#" class="image" wx:for="{{files.images}}" wx:key="item.attachmentid">
-                <image src="{{item.url}}" data-index="{{index}}" data-type='image' mode="aspectFill" bindtap="viewMedias" />
-                <van-icon custom-class='icon' name="clear" data-item="{{item}}" bindtap="deleteFile" />
-            </navigator>
-        </view>
-        <view class="media">
-            <navigator url="#" class="image" wx:for="{{files.videos}}" wx:key="item.attachmentid">
-                <image src="{{item.subfiles[0].url}}" data-index="{{index}}" data-type='video' mode="aspectFill" bindtap="viewMedias" />
-                <van-icon custom-class='icon' name="clear" data-item="{{item}}" bindtap="deleteFile" />
-                <image class="suspend" src="/static/image/suspend.png" />
-            </navigator>
-        </view>
-        <My_accessory butType='删除' list="{{files.files}}" binddeleteFile='deleteFile' />
+        <textarea class="textarea" placeholder='请填写' value="{{content}}" bindinput='onInput' />
     </view>
-    <navigator class="navigator" url="#" bindtap="openSelect">
-        <view>
-            <view class="label">跟进方式</view>
-            <view class="text">{{type||"请选择"}}</view>
-            <text class="iconfont icon-a-wodetiaozhuan" />
-        </view>
-    </navigator>
+    <Files files='{{files}}' binddeleteFile='deleteFile' />
 </view>
 <van-action-sheet show="{{ show }}" actions="{{ actions }}" bind:cancel='onCancel' bind:select='onSelect' cancel-text="取消" />
 <view style="height: 130rpx;" />

+ 54 - 6
packageA/setclient/modules/trace/detail/index.js

@@ -1,10 +1,19 @@
-const _Http = getApp().globalData.http;
+const _Http = getApp().globalData.http,
+    MFT = require("../../../../../utils/matchingFeilType");
+
 Page({
     data: {
         ownertable: null,
         ownerid: null,
         sys_datafollowupid: null,
         detail: {},
+        files: {
+            images: [],
+            viewImages: [],
+            videos: [],
+            viewVideos: [],
+            files: []
+        },
         tabbarList: [{
             icon: "icon-bianji",
             label: "编辑"
@@ -28,15 +37,54 @@ Page({
                 "sys_datafollowupid": this.data.sys_datafollowupid
             }
         }).then(res => {
+            console.log("跟进详情", res)
             if (res.msg != '成功') return wx.showToast({
                 title: res.data,
                 icon: "none"
             })
+            this.handleFiles(MFT.fileList(res.data.attinfos));
             this.setData({
-                detail: res.data
+                detail: res.data,
+                briefs: [{
+                    label: "跟进类型",
+                    value: res.data.type
+                }, {
+                    label: "跟进内容",
+                    value: res.data.content
+                }]
             })
         })
     },
+
+    /* 处理附件 */
+    handleFiles(list) {
+        let files = this.data.files;
+        list.forEach(v => {
+            switch (v.fileType) {
+                case "video":
+                    files.videos.push(v)
+                    files.viewVideos.push({
+                        url: v.url,
+                        type: "video",
+                        poster: v.subfiles[0].url
+                    })
+                    break;
+                case "image":
+                    files.images.push(v)
+                    files.viewImages.push({
+                        url: v.url,
+                        type: "image"
+                    })
+                    break;
+                default:
+                    files.files.push(v)
+                    break;
+            }
+        });
+        this.setData({
+            files
+        })
+    },
     /* tab 切换回调 */
     tabbarOnClick({
         detail
@@ -51,10 +99,10 @@ Page({
             case "作废":
                 wx.navigateTo({
                     url: `/packageA/setclient/modules/trace/list/delete?item=${JSON.stringify({
-                        "sys_datafollowupid": item.sys_datafollowupid,
-                        "ownertable": this.data.ownertable,
-                        "ownerid": this.data.ownerid
-                    })}`,
+                    "sys_datafollowupid": item.sys_datafollowupid,
+                    "ownertable": this.data.ownertable,
+                    "ownerid": this.data.ownerid
+                })}`,
                 })
                 break;
         }

+ 3 - 1
packageA/setclient/modules/trace/detail/index.json

@@ -1,4 +1,6 @@
 {
-    "usingComponents": {},
+    "usingComponents": {
+        "Files": "../files/index"
+    },
     "navigationBarTitleText": "跟进动态详情"
 }

+ 1 - 51
packageA/setclient/modules/trace/detail/index.scss

@@ -2,11 +2,10 @@
     width: 100vw;
     background-color: #ffffff;
     box-sizing: border-box;
-    padding: 20rpx 0 20rpx 30rpx;
+    padding: 20rpx 0 0 30rpx;
 
     .head {
         display: flex;
-
         .portrait {
             display: flex;
             align-items: center;
@@ -45,53 +44,4 @@
         }
 
     }
-
-    .main {
-        margin-top: 34rpx;
-        padding-bottom: 20rpx;
-        border-bottom: 1px solid #ddd;
-        padding-right: 30rpx;
-        box-sizing: border-box;
-
-        .title {
-            font-size: 24rpx;
-            font-family: PingFang SC-Regular, PingFang SC;
-            color: #999999;
-        }
-
-        .content {
-            font-size: 28rpx;
-            font-family: PingFang SC-Regular, PingFang SC;
-            color: #666666;
-            margin-top: 20rpx;
-            word-break: break-all;
-        }
-    }
-
-    .bottom {
-        display: flex;
-
-        >view {
-            flex: 1;
-
-            .label {
-                font-size: 24rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #999999;
-                margin-top: 20rpx;
-            }
-
-            .con {
-                font-size: 28rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #333333;
-                margin-top: 10rpx;
-
-                .iconfont {
-                    margin-left: 20rpx;
-                    color: #FA8C16;
-                }
-            }
-        }
-    }
 }

+ 4 - 15
packageA/setclient/modules/trace/detail/index.wxml

@@ -10,20 +10,9 @@
             <view class="time">{{detail.createdate}}</view>
         </view>
     </view>
-    <view class="main">
-        <view class="title">跟进内容</view>
-        <view class="content">{{detail.content}}</view>
-    </view>
-    <view class="bottom">
-        <view>
-            <view class="label">跟进方式</view>
-            <view class="con">{{detail.type}}</view>
-        </view>
-        <view wx:if="{{false}}">
-            <view class="label">跟进联系人</view>
-            <view class="con">17757394388<text class="iconfont icon-shujubodadianhua1" /></view>
-        </view>
-    </view>
 </view>
-
+<view style="background-color: #fff;">
+    <Yl_Detail list="{{briefs}}" />
+    <Files files='{{files}}' delete='{{false}}' />
+</view>
 <Yl_Tabbar list='{{tabbarList}}' bind:callback="tabbarOnClick" />