ソースを参照

项目商机失败和结束逻辑修改

xiaohaizhao 2 年 前
コミット
73ea42c5cb

+ 20 - 37
packageA/project/detail.js

@@ -217,8 +217,11 @@ Page({
                 label: "报备审核时间",
                 value: data.reportcheckdate
             }, {
-                label: "作废原因",
-                value: data.deletereason
+                label: "结束原因",
+                value: data.endreason
+            }, {
+                label: "失败原因",
+                value: data.defeatreason
             }, {
                 label: "转手次数",
                 value: data.changecount
@@ -245,13 +248,14 @@ Page({
         }].concat(tabbarList);
 
         if (isLeader || isAdmin) {
-            if (status != '已失败') tabbarList = tabbarList.concat([{
+            if (status != '已失败' && status != '已结束') tabbarList = tabbarList.concat([{
                 icon: "icon-bianji",
                 label: "编辑"
             }, {
                 icon: "icon-genjin",
                 label: "提交报备"
             }])
+
             if (editdataleader) tabbarList.push({
                 icon: "icon-zhuanyi",
                 label: "更换负责人"
@@ -260,7 +264,13 @@ Page({
                 icon: "icon-shanchu",
                 label: "作废"
             })
-            tabbarList.push(status == '已失败' ? {
+        }
+        if (isLeader && status != '已失败') {
+            tabbarList.push({
+                icon: "icon-dibu-wuxiao",
+                label: "失败"
+            })
+            tabbarList.push(status == '已结束' ? {
                 icon: "icon-dibu-chehui",
                 label: "恢复"
             } : {
@@ -285,39 +295,15 @@ Page({
         let data = this.data.detail,
             that = this;
         switch (detail.label) {
-            case "结束":
-                if (data.status != '跟进中') return wx.showToast({
-                    title: '当前状态不可结束',
-                    icon: "none"
-                });
-
-                wx.showModal({
-                    title: '提示',
-                    content: '是否确认结束项目',
-                    complete: ({
-                        confirm
-                    }) => {
-                        if (confirm) _Http.basic({
-                            "id": 20221215163702,
-                            "content": {
-                                "sa_projectid": data.sa_projectid
-                            }
-                        }).then(res => {
-                            console.log('结束', res)
-                            wx.showToast({
-                                title: res.msg == '成功' ? '已结束' : res.msg,
-                                icon: "none"
-                            });
-                            if (res.msg == '成功') setTimeout(this.getDetail, 300);
-                        })
-                    }
+            case "失败":
+                wx.navigateTo({
+                    url: '/packageA/project/modules/fail/index?id=' + this.data.sa_projectid
                 })
                 break;
+            case "结束":
+                this.selectComponent("#Dialog").onClick(this.data.sa_projectid)
+                break;
             case "恢复":
-                if (data.status != '已失败') return wx.showToast({
-                    title: '失败项目才可恢复!',
-                    icon: "none"
-                });
                 _Http.basic({
                     "id": 20221208184202,
                     "content": {
@@ -607,9 +593,6 @@ Page({
             }
         }
     },
-    onShow() {
-        console.log()
-    },
     onReachBottom() {
         this.partialRenewal();
     },

+ 3 - 2
packageA/project/detail.json

@@ -13,8 +13,9 @@
         "Opponent": "./modules/opponent/index",
         "Work": "/packageA/public/work/index",
         "Contract": "./modules/contract/index",
-        "Clue":"./modules/clue/index",
-        "ReportingProgress":"./modules/reportingProgress/index"
+        "Clue": "./modules/clue/index",
+        "ReportingProgress": "./modules/reportingProgress/index",
+        "Dialog": "./modules/dialog/index"
     },
     "navigationBarTitleText": "项目详情"
 }

+ 3 - 2
packageA/project/detail.wxml

@@ -34,7 +34,6 @@
 <!-- 底部 -->
 <Yl_Tabbar list='{{tabbarList}}' bind:callback="tabbarOnClick" />
 <wxs src='../../utils/wxmlQueryPer.wxs' module="per" />
-
 <!-- 查重 -->
 <van-popup show="{{ repetitionShow }}" custom-class='popup' round position="bottom" custom-style="height: 100%;" bind:close="repClose">
     <view class="title">
@@ -56,4 +55,6 @@
         <view class="exp">负责人:{{item.leader[0].name||' --'}}</view>
         <view class="exp">手机号:{{item.phonenumber||" --"}}</view>
     </navigator>
-</van-popup>
+</van-popup>
+<!-- 结束 -->
+<Dialog id='Dialog' />

+ 43 - 0
packageA/project/modules/dialog/index.js

@@ -0,0 +1,43 @@
+const _Http = getApp().globalData.http;
+Component({
+  properties: {},
+  data: {
+    show: false,
+    endreason: ""
+  },
+  methods: {
+    onClick(sa_projectid) {
+      this.setData({
+        show: true
+      })
+      this.selectComponent("#Dialog").data.beforeClose = (action) => new Promise((resolve) => {
+        if (action === 'confirm') {
+          _Http.basic({
+            "id": 20221215163702,
+            "content": {
+              sa_projectid,
+              endreason: this.data.endreason
+            }
+          }).then(res => {
+            console.log('结束', res)
+            wx.showToast({
+              title: res.msg == '成功' ? '已结束' : res.msg,
+              icon: "none"
+            });
+            resolve(true);
+            let page = getCurrentPages()[getCurrentPages().length - 1];
+            page.getDetail();
+          })
+        } else {
+          resolve(false);
+          this.setData({
+            show: false
+          })
+        }
+      });
+    },
+    onChange(e) {
+      this.data.endreason = e.detail.value;
+    }
+  }
+})

+ 7 - 0
packageA/project/modules/dialog/index.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+      "van-dialog": "@vant/weapp/dialog/index",
+      "van-stepper": "@vant/weapp/stepper/index"
+    }
+  }

+ 8 - 0
packageA/project/modules/dialog/index.scss

@@ -0,0 +1,8 @@
+.box {
+    box-sizing: border-box;
+    border: 1px solid #ddd;
+    width: 94%;
+    margin: 20rpx auto 0;
+    padding: 20rpx;
+    box-sizing: border-box;
+}

+ 5 - 0
packageA/project/modules/dialog/index.wxml

@@ -0,0 +1,5 @@
+<van-dialog id="Dialog" use-slot title="结束原因" show="{{ show }}" asyncClose confirm-button-color='#085CDF' show-cancel-button>
+    <view class="box">
+        <textarea bind:input='onChange' maxlength='-1' placeholder="请说明..." auto-height />
+    </view>
+</van-dialog>

+ 74 - 0
packageA/project/modules/fail/index.js

@@ -0,0 +1,74 @@
+const _Http = getApp().globalData.http;
+let sa_projectid = "";
+Page({
+    data: {
+        defeatreason: "",
+        type: "其他",
+        actions: [{
+            name: "价格"
+        }, {
+            name: "品牌"
+        }, {
+            name: "商务"
+        }, {
+            name: "地域"
+        }, {
+            name: "其他"
+        }],
+        show: false
+    },
+    onLoad(options) {
+        sa_projectid = options.id;
+    },
+    //开始选择跟进方式
+    openSelect() {
+        this.setData({
+            show: true
+        })
+    },
+    //取消选择
+    onCancel() {
+        this.setData({
+            show: false
+        })
+    },
+    //确定选择
+    onSelect({
+        detail
+    }) {
+        this.setData({
+            type: detail.name
+        })
+        this.onCancel();
+    },
+    //文本域输入
+    onInput(e) {
+        this.setData({
+            defeatreason: e.detail.value
+        })
+    },
+    submit() {
+        _Http.basic({
+            "id": 20230706152904,
+            "content": {
+                sa_projectid,
+                "defeatreason": this.data.defeatreason,
+                defeattype: this.data.type
+            }
+        }).then(res => {
+            console.log("失败", res)
+            wx.showToast({
+                title: res.msg == '成功' ? '已失败' : res.msg,
+                icon: "none",
+                mask: true
+            });
+            if (res.msg == '成功') {
+                let page = getCurrentPages()[getCurrentPages().length - 2];
+                page.getDetail()
+                setTimeout(() => {
+                    wx.navigateBack()
+                }, 500)
+            }
+        })
+    }
+})

+ 4 - 0
packageA/project/modules/fail/index.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "项目失败原因"
+}

+ 99 - 0
packageA/project/modules/fail/index.scss

@@ -0,0 +1,99 @@
+.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;
+    box-sizing: border-box;
+    background-color: #fff;
+    padding-top: 20rpx;
+    margin-top: 20rpx;
+    padding-bottom: 10rpx;
+
+    .title {
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+        padding-left: 30rpx;
+    }
+
+    .content {
+        width: 690rpx;
+        border-radius: 8rpx;
+        border: 2rpx solid #CCCCCC;
+        margin-top: 20rpx;
+        box-sizing: border-box;
+        padding-bottom: 20rpx;
+        margin-left: 30rpx;
+        margin-bottom: 20rpx;
+
+        .textarea {
+            width: 625rpx;
+            height: 400rpx;
+            margin: 20rpx 0 20rpx 30rpx;
+        }
+
+        .title {
+            margin: 20rpx 0 0 0;
+        }
+    }
+}
+
+.footer {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    position: fixed;
+    width: 750rpx;
+    height: 130rpx;
+    background: #FFFFFF;
+    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    bottom: 0;
+
+    .but {
+        width: 156rpx;
+        height: 90rpx;
+        background: #3874F6;
+        border-radius: 8rpx;
+        font-size: 28rpx;
+        font-family: PingFang SC-Bold, PingFang SC;
+        font-weight: bold;
+        color: #FFFFFF;
+        margin-right: 30rpx;
+    }
+}

+ 19 - 0
packageA/project/modules/fail/index.wxml

@@ -0,0 +1,19 @@
+<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">失败原因</view>
+    <view class="content">
+        <textarea class="textarea" maxlength='-1' placeholder='请填写' value="{{content}}" bindinput='onInput' />
+    </view>
+</view>
+<van-action-sheet show="{{ show }}" actions="{{ actions }}" bind:cancel='onCancel' bind:select='onSelect' cancel-text="取消" />
+<view style="height: 130rpx;" />
+<view class="footer">
+    <van-button custom-class='but' disabled='{{!defeatreason}}' bindtap="submit">确定</van-button>
+</view>