<template> 
 | 
    <view> 
 | 
        <scroll-view scroll-y="true" > 
 | 
            <view class="header"> 
 | 
                <view class="cstmr-name"> 
 | 
                    <image src="../../../static/image/zuzhibumen.png" mode="aspectFit"></image> 
 | 
                    <view>{{saleManage.name}}</view> 
 | 
                </view> 
 | 
                <view class="cstmr-tel"> 
 | 
                    {{saleManage.company$}} |  
 | 
                    {{saleManage.money ? saleManage.pcd$ : '--'}} |  
 | 
                    {{saleManage.director$ ? saleManage.pcd$ : '--'}} 
 | 
                </view> 
 | 
            </view> 
 | 
            <view class="container"> 
 | 
                 
 | 
                <view><y-title title="基本信息"></y-title></view><view></view> 
 | 
                <view class="list-item1">项目代号</view><view class="list-item2">{{saleManage.uuid}}</view> 
 | 
                <view class="list-item1">甲方单位</view><view class="list-item2">{{saleManage.cstmrId$}}</view> 
 | 
                <view class="list-item1">项目总金额</view><view class="list-item2">{{saleManage.money}}</view> 
 | 
                <view class="list-item1">所属公司</view><view class="list-item2">{{saleManage.company$}}</view> 
 | 
                <view class="list-item1">省市区</view><view class="list-item2">{{saleManage.pcd$ ? saleManage.pcd$ : '--'}}</view> 
 | 
                <view class="list-item1">项目地址</view><view class="list-item2">{{saleManage.addr}}</view> 
 | 
                <view class="list-item1">负责人</view><view class="list-item2">{{saleManage.director$}}</view> 
 | 
                <view class="list-item1">备注</view><view class="list-item2">{{saleManage.remarks  ? saleManage.remarks : '--'}}</view> 
 | 
                <view class="list-item1">项目预算金额(万)</view><view class="list-item2">{{saleManage.money ? saleManage.money : '--'}}</view> 
 | 
                <view class="list-item1">项目预估成交率</view><view class="list-item2">{{saleManage.transactionRate ? saleManage.transactionRate : '--'}}</view> 
 | 
                 
 | 
                 
 | 
            </view> 
 | 
            <view class="container"> 
 | 
                <view><y-title title="其他信息"></y-title></view><view></view> 
 | 
                <view class="list-item1">添加人员</view><view class="list-item2 color-main">{{saleManage.createBy$}}</view> 
 | 
                <view class="list-item1">添加时间</view><view class="list-item2">{{saleManage.createTime$}}</view> 
 | 
                <view class="list-item1">修改人员</view><view class="list-item2">{{saleManage.updateBy$}}</view> 
 | 
                <view class="list-item1">修改时间</view><view class="list-item2 color-main">{{saleManage.updateTime$}}</view> 
 | 
            </view> 
 | 
            <view class="boxx"> 
 | 
                 
 | 
            </view> 
 | 
             
 | 
        </scroll-view> 
 | 
        <view class="foot"> 
 | 
            <button  size="mini" type="default" @click="modi(id)">修改</button> 
 | 
            <button  size="mini" type="warn" @click="del(id)">删除</button> 
 | 
            <button  size="mini" type="primary" @click="goBusiness(id)">出差</button> 
 | 
        </view> 
 | 
         
 | 
        <view> 
 | 
            <!-- 输入框示例 --> 
 | 
            <uni-popup ref="inputDialog" type="dialog"> 
 | 
                <uni-popup-dialog ref="inputClose" mode="input" title="添加跟进人" value="对话框预置提示内容!" 
 | 
                    placeholder="请输入内容" @confirm="confirm"> 
 | 
                        <uni-combox :candidates="addFollower.followers" placeholder="请选择" 
 | 
                        v-model="addFollower.follower" @input="autoLoad('follower',addFollower.follower)"></uni-combox> 
 | 
                </uni-popup-dialog> 
 | 
            </uni-popup> 
 | 
        </view> 
 | 
    </view> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
    export default { 
 | 
        data() { 
 | 
            return { 
 | 
                id: 0, 
 | 
                saleManage: {}, 
 | 
                cstmr: { 
 | 
                    id: '', 
 | 
                    name: '', 
 | 
                    tel: '', 
 | 
                    addr: '', 
 | 
                    cstman: '' 
 | 
                }, 
 | 
                addFollower: { 
 | 
                    follower: '', 
 | 
                    followers: '', 
 | 
                    followerList: [] 
 | 
                }, 
 | 
                followers: [], 
 | 
                followerIds: [],  
 | 
                cstmrId: '' 
 | 
            } 
 | 
        }, 
 | 
        onLoad(option) {  
 | 
            this.id = option.id 
 | 
            console.log(option); 
 | 
            this.init() 
 | 
            this.autoLoad('follower','') 
 | 
            setTimeout(()=>{ 
 | 
                this.getFollowers() 
 | 
            },500) 
 | 
        }, 
 | 
        methods: { 
 | 
            init() { 
 | 
                let that = this 
 | 
                uni.request({ 
 | 
                    url: that.baseUrl + '/order/' + that.id +'/auth', 
 | 
                    header: {'token' : uni.getStorageSync('token')}, 
 | 
                    method: 'GET', 
 | 
                    success(res) { 
 | 
                        res = res.data 
 | 
                        console.log(res); 
 | 
                        that.saleManage = res.data 
 | 
                        that.cstmr = res.data 
 | 
                        that.cstmrId = that.cstmr.id 
 | 
                    } 
 | 
                }) 
 | 
            }, 
 | 
            del(e) { 
 | 
                let that = this 
 | 
                e = Number(e) 
 | 
                uni.request({ 
 | 
                    url: that.baseUrl + '/cstmr/delete/one/' + e, 
 | 
                    header: {'token' : uni.getStorageSync('token'), 
 | 
                    }, 
 | 
                    method: 'GET', 
 | 
                     
 | 
                    success(res) { 
 | 
                        res = res.data 
 | 
                        if (res.code === 200) { 
 | 
                            uni.navigateBack() 
 | 
                        } else if (res.code === 403) { 
 | 
                            uni.showToast({title: res.msg, icon: "none", position: 'top'}) 
 | 
                            setTimeout(() => { 
 | 
                                uni.reLaunch({ 
 | 
                                    url: '../../login/login' 
 | 
                                }); 
 | 
                            }, 1000); 
 | 
                        } else { 
 | 
                            uni.showToast({title: res.msg, icon: "none",position: 'top'}) 
 | 
                        } 
 | 
                    } 
 | 
                }) 
 | 
            }, 
 | 
            addPerson() { 
 | 
                this.$refs.inputDialog.open() 
 | 
            }, 
 | 
            // 确认选择工作人 
 | 
            confirm() { 
 | 
                let that = this 
 | 
                var followerId 
 | 
                var followerList = that.addFollower.followerList 
 | 
                for (var i = 0;i < followerList.length; i++) { 
 | 
                    if (followerList[i].name == this.addFollower.follower) { 
 | 
                        followerId =followerList[i].value 
 | 
                    } 
 | 
                } 
 | 
                uni.request({ 
 | 
                    url: that.baseUrl + '/order/followers/add/json', 
 | 
                    header:{'token':uni.getStorageSync('token'),}, 
 | 
                    data: { 
 | 
                        orderId: that.cstmrId, 
 | 
                        followerIds:followerId}, 
 | 
                    method: 'POST', 
 | 
                    success(result) { 
 | 
                        var res = result.data 
 | 
                        that.getFollowers() 
 | 
                    } 
 | 
                }) 
 | 
                this.addFollower.follower = '' 
 | 
            }, 
 | 
            // 工作人列表 
 | 
            autoLoad(type,condition) { 
 | 
                let that = this 
 | 
                that.addFollower.followers = [] 
 | 
                that.addFollower.followerList = [] 
 | 
                uni.request({ 
 | 
                    url: that.baseUrl + '/user/all/get/kv', 
 | 
                    header:{'token':uni.getStorageSync('token')}, 
 | 
                    data: {condition:condition}, 
 | 
                    method: 'POST', 
 | 
                    success(result) { 
 | 
                        var res = result.data 
 | 
                        if (res.code === 200) { 
 | 
                            var element; 
 | 
                            if (type == 'follower') { 
 | 
                                for(element of res.data) { 
 | 
                                    that.addFollower.followers.push(element.name) 
 | 
                                    that.addFollower.followerList.push(element) 
 | 
                                } 
 | 
                                return 
 | 
                            } 
 | 
                        } 
 | 
                    } 
 | 
                }) 
 | 
            }, 
 | 
            getFollowers() { 
 | 
                let that = this 
 | 
                uni.request({ 
 | 
                    url: that.baseUrl + '/order/followers/table/auth', 
 | 
                    header:{'token':uni.getStorageSync('token')}, 
 | 
                    data: {orderId:that.cstmrId}, 
 | 
                    method:'GET', 
 | 
                    success(res) { 
 | 
                        res = res.data 
 | 
                        that.followers = res.data 
 | 
                    } 
 | 
                }) 
 | 
            }, 
 | 
            removeFollowers(userId) { 
 | 
                let that = this 
 | 
                uni.request({ 
 | 
                    url: that.baseUrl + '/order/followers/remove/auth', 
 | 
                    header:{ 
 | 
                        'token':uni.getStorageSync('token'), 
 | 
                        'content-type': 'application/x-www-form-urlencoded' 
 | 
                    }, 
 | 
                    data: { 
 | 
                        orderId:that.cstmrId, 
 | 
                        userId: userId 
 | 
                        }, 
 | 
                    method:'POST', 
 | 
                    success(res) { 
 | 
                        res = res.data 
 | 
                        that.getFollowers() 
 | 
                    } 
 | 
                }) 
 | 
            }, 
 | 
            modi(id) { 
 | 
                let _this = this 
 | 
                uni.navigateTo({ 
 | 
                    url: '/pages/business/saleManage/modiSaleManage', 
 | 
                    success: function(res) { 
 | 
                        // 通过eventChannel向被打开页面传送数据 
 | 
                        res.eventChannel.emit('saleManage', { data: _this.saleManage }) 
 | 
                    } 
 | 
                }) 
 | 
            }, 
 | 
            goBusiness() { 
 | 
                uni.navigateTo({ 
 | 
                    url: '/pages/business/goBusiness/addgoBusiness', 
 | 
                }) 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</script> 
 | 
  
 | 
<style> 
 | 
    .boxx { 
 | 
        display: flex; 
 | 
        flex-direction: column; 
 | 
    } 
 | 
    .header { 
 | 
        width: auto; 
 | 
        min-height: 110rpx; 
 | 
        background-color: #fff; 
 | 
        padding: 30px 20px 10px 20px; 
 | 
    } 
 | 
    .cstmr-name { 
 | 
        display: flex; 
 | 
        height: 35rpx; 
 | 
        line-height: 35rpx; 
 | 
        text-indent: 10rpx; 
 | 
        font-size: 36rpx; 
 | 
        color: #606266; 
 | 
    } 
 | 
    .cstmr-name image { 
 | 
        width: 35rpx; 
 | 
        height: 35rpx; 
 | 
    } 
 | 
    .cstmr-tel { 
 | 
        min-height: 60rpx; 
 | 
        line-height: 60rpx; 
 | 
        font-size: 24rpx; 
 | 
        color: #303133; 
 | 
    } 
 | 
    .container { 
 | 
        margin-top: 10px; 
 | 
        padding: 10rpx 20rpx 0 20rpx; 
 | 
        background-color: #fff; 
 | 
        display: grid; 
 | 
        grid-template-columns: 1fr 3fr; 
 | 
    } 
 | 
    .container:last-child { 
 | 
        grid-template-columns: 5fr 5fr 2fr; 
 | 
        margin-bottom: 120rpx; 
 | 
    } 
 | 
    .list-item1 { 
 | 
        min-height: 45rpx; 
 | 
        line-height: 45rpx; 
 | 
        color: #909399; 
 | 
        text-indent: 30rpx; 
 | 
    } 
 | 
    .list-item2 { 
 | 
        min-height: 45rpx; 
 | 
        line-height: 45rpx; 
 | 
        color: black; 
 | 
    } 
 | 
    .color-main { 
 | 
        color: #55aaff 
 | 
    } 
 | 
    .foot { 
 | 
        position: fixed; 
 | 
        width: 100%; 
 | 
        min-height: 100rpx; 
 | 
        bottom: 0; 
 | 
        margin-bottom: 0; 
 | 
        background-color: #fff; 
 | 
        border-top: 1px solid #efefef; 
 | 
        display: flex; 
 | 
        align-items: center; 
 | 
    } 
 | 
    .list { 
 | 
        min-height: 60rpx; 
 | 
        margin-top: 20rpx; 
 | 
        grid-column: 1 / 10; 
 | 
        display: grid; 
 | 
        grid-template-columns: 1fr 1fr; 
 | 
        position: relative; 
 | 
    } 
 | 
    .list-left { 
 | 
        min-height: 60rpx; 
 | 
        line-height: 60rpx; 
 | 
        padding-left: 20rpx; 
 | 
        color: #55aaff 
 | 
    } 
 | 
    .list-right { 
 | 
        min-height: 60rpx; 
 | 
        line-height: 60rpx; 
 | 
        /* background-color: #222; */ 
 | 
        padding-right: 30rpx; 
 | 
    } 
 | 
    .list-none { 
 | 
        min-height: 60rpx; 
 | 
        margin-top: 20rpx; 
 | 
        text-align: center; 
 | 
        /* background-color: #303133; */ 
 | 
        color: #b1b3b8; 
 | 
        grid-column: 1 / 10; 
 | 
        display: grid; 
 | 
        position: relative; 
 | 
    } 
 | 
</style> 
 |