Pārlūkot izejas kodu

报价单和合同作废添加作废原因

xiaohaizhao 1 gadu atpakaļ
vecāks
revīzija
d7e9c318af

+ 3 - 1
app.json

@@ -161,7 +161,9 @@
                 "contacts/detail",
                 "select/group/select",
                 "contacts/modules/client/index",
-                "contacts/modules/project/index"
+                "contacts/modules/project/index",
+                "offers/delete",
+                "contract/delete"
             ]
         }
     ],

+ 56 - 0
packageA/contract/delete.js

@@ -0,0 +1,56 @@
+const _Http = getApp().globalData.http;
+
+let sa_contractid = null;
+Page({
+    data: {
+        deletereason: "",
+        loading: false,
+    },
+    onLoad(options) {
+        sa_contractid = options.id;
+    },
+    onInput(e) {
+        this.setData({
+            deletereason: e.detail.value
+        })
+    },
+    handleDetele() {
+        let that = this;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认作废该合同?',
+            complete: ({
+                confirm
+            }) => {
+                if (confirm) {
+                    that.setData({
+                        loading: true
+                    })
+                    _Http.basic({
+                        "id": 20221121202502,
+                        "content": {
+                            "sa_contractids": [sa_contractid],
+                            "deletereason": that.data.deletereason
+                        },
+                    }).then(res => {
+                        console.log("作废合同", res);
+                        that.setData({
+                            loading: false
+                        })
+                        wx.showToast({
+                            title: res.msg != '成功' ? res.data : '作废成功',
+                            icon: "none",
+                            mask: true
+                        });
+                        if (res.msg == '成功') setTimeout(() => {
+                            wx.navigateBack({
+                                delta: 2
+                            });
+                        }, 300)
+                    })
+                }
+            }
+        })
+
+    }
+})

+ 4 - 0
packageA/contract/delete.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "作废原因"
+}

+ 58 - 0
packageA/contract/delete.scss

@@ -0,0 +1,58 @@
+.box {
+    width: 100vw;
+    padding: 20rpx 30rpx;
+    background-color: #fff;
+    box-sizing: border-box;
+
+    .title {
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+
+        text {
+            color: #FF3B30;
+            margin-right: 8rpx;
+        }
+    }
+
+    .content {
+        width: 690rpx;
+        height: 200rpx;
+        background: #FFFFFF;
+        border-radius: 8rpx;
+        opacity: 1;
+        border: 2rpx solid #CCCCCC;
+        margin-top: 20rpx;
+        box-sizing: border-box;
+        padding: 20rpx;
+
+        textarea {
+            width: 100%;
+            height: 100%;
+        }
+    }
+}
+
+.footer {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    position: fixed;
+    width: 100vw;
+    height: 130rpx;
+    background: #FFFFFF;
+    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    bottom: 0;
+
+    .custom {
+        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;
+    }
+}

+ 12 - 0
packageA/contract/delete.wxml

@@ -0,0 +1,12 @@
+<view class="box">
+    <view class="title">
+        <text>*</text>请说明作废原因
+    </view>
+    <view class="content">
+        <textarea placeholder="请说明作废原因" value="{{deletereason}}" bindinput="onInput" />
+    </view>
+</view>
+
+<view class="footer">
+    <van-button custom-class='custom' deletereason disabled='{{!deletereason ||loading}}' loading='{{loading}}' bindclick="handleDetele">提交</van-button>
+</view>

+ 2 - 32
packageA/contract/detail.js

@@ -697,38 +697,8 @@ Page({
                 })
                 break;
             case "作废":
-                wx.showModal({
-                    title: '提示',
-                    content: '是否确认作废该协议?',
-                    complete: ({
-                        confirm
-                    }) => {
-                        if (confirm) _Http.basic({
-                            "id": 20221121202502,
-                            "version": 1,
-                            "content": {
-                                "sa_contractids": [this.data.detail.sa_contractid]
-                            }
-                        }).then(res => {
-                            wx.showToast({
-                                title: res.msg == '成功' ? '已作废协议' : res.msg,
-                                icon: "none"
-                            });
-                            if (res.msg == '成功') {
-                                setTimeout(() => {
-                                    getCurrentPages().forEach(v => {
-                                        if (v.__route__ == 'packageA/contract/index') {
-                                            v.setData({
-                                                list: v.data.list.filter(value => value.sa_contractid != this.data.detail.sa_contractid),
-                                                'content.total': v.data.content.total - 1
-                                            })
-                                        }
-                                    })
-                                    wx.navigateBack();
-                                }, 300)
-                            }
-                        })
-                    }
+                wx.navigateTo({
+                  url: '/packageA/contract/delete?id='+this.data.detail.sa_contractid,
                 })
                 break;
             case "编辑":

+ 52 - 0
packageA/offers/delete.js

@@ -0,0 +1,52 @@
+const _Http = getApp().globalData.http;
+
+let sa_quotedpriceid = null;
+Page({
+    data: {
+        deletereason: "",
+        loading: false,
+    },
+    onLoad(options) {
+        sa_quotedpriceid = options.id;
+    },
+    onInput(e) {
+        this.setData({
+            deletereason: e.detail.value
+        })
+    },
+    handleDetele() {
+        let that = this;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认作废该报价单?',
+            complete: ({
+                confirm
+            }) => {
+                if (confirm) _Http.basic({
+                    "id": 20221020165503,
+                    "version": 1,
+                    "content": {
+                        "sa_quotedpriceids": [sa_quotedpriceid],
+                        deletereason: that.data.deletereason
+                    }
+                }).then(res => {
+                    console.log("作废报价单", res)
+                    that.setData({
+                        loading: false
+                    })
+                    wx.showToast({
+                        title: res.msg != '成功' ? res.msg : '作废成功',
+                        icon: "none",
+                        mask: true
+                    });
+                    if (res.msg == '成功') setTimeout(() => {
+                        wx.navigateBack({
+                            delta: 2
+                        });
+                    }, 300)
+                    getCurrentPages().find(v => v.__route__ == 'packageA/offers/index').getList(true)
+                })
+            }
+        })
+    }
+})

+ 4 - 0
packageA/offers/delete.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "作废原因"
+}

+ 58 - 0
packageA/offers/delete.scss

@@ -0,0 +1,58 @@
+.box {
+    width: 100vw;
+    padding: 20rpx 30rpx;
+    background-color: #fff;
+    box-sizing: border-box;
+
+    .title {
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+
+        text {
+            color: #FF3B30;
+            margin-right: 8rpx;
+        }
+    }
+
+    .content {
+        width: 690rpx;
+        height: 200rpx;
+        background: #FFFFFF;
+        border-radius: 8rpx;
+        opacity: 1;
+        border: 2rpx solid #CCCCCC;
+        margin-top: 20rpx;
+        box-sizing: border-box;
+        padding: 20rpx;
+
+        textarea {
+            width: 100%;
+            height: 100%;
+        }
+    }
+}
+
+.footer {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    position: fixed;
+    width: 100vw;
+    height: 130rpx;
+    background: #FFFFFF;
+    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    bottom: 0;
+
+    .custom {
+        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;
+    }
+}

+ 12 - 0
packageA/offers/delete.wxml

@@ -0,0 +1,12 @@
+<view class="box">
+    <view class="title">
+        <text>*</text>请说明作废原因
+    </view>
+    <view class="content">
+        <textarea placeholder="请说明作废原因" value="{{deletereason}}" bindinput="onInput" />
+    </view>
+</view>
+
+<view class="footer">
+    <van-button custom-class='custom' deletereason disabled='{{!deletereason ||loading}}' loading='{{loading}}' bindclick="handleDetele">提交</van-button>
+</view>

+ 2 - 34
packageA/offers/detail.js

@@ -502,41 +502,9 @@ Page({
                 })
                 break;
             case "作废":
-                wx.showModal({
-                    title: '提示',
-                    content: '是否确认作废该报价单?',
-                    complete: ({
-                        confirm
-                    }) => {
-                        if (confirm) _Http.basic({
-                            "id": 20221020165503,
-                            "version": 1,
-                            "content": {
-                                "sa_quotedpriceids": [this.data.detail.sa_quotedpriceid]
-                            }
-                        }).then(res => {
-                            wx.showToast({
-                                title: res.msg == '成功' ? '已作废报价单' : res.msg,
-                                icon: "none"
-                            });
-                            if (res.msg == '成功') {
-                                setTimeout(() => {
-                                    getCurrentPages().forEach(v => {
-                                        if (v.__route__ == 'packageA/offers/index') {
-                                            v.setData({
-                                                list: v.data.list.filter(value => value.sa_quotedpriceid != this.data.detail.sa_quotedpriceid),
-                                                'content.total': v.data.content.total - 1
-                                            })
-                                        }
-                                    })
-                                    wx.navigateBack();
-                                }, 300)
-                            }
-                        })
-                    }
+                wx.navigateTo({
+                    url: `/packageA/offers/delete?id=${this.data.detail.sa_quotedpriceid}`,
                 })
-
-
                 break;
             case "更换负责人":
                 wx.navigateTo({