Browse Source

添加确认提交以及撤回

xiaohaizhao 1 month ago
parent
commit
0580711d2c
2 changed files with 70 additions and 14 deletions
  1. 57 6
      packageA/orderForm/detail.js
  2. 13 8
      packageA/orderForm/detail.wxml

+ 57 - 6
packageA/orderForm/detail.js

@@ -28,13 +28,17 @@ Page({
         reminddays: 0,
     },
     onLoad(options) {
+        const authOptions = wx.getStorageSync('auth').worderform.options;
+        const checkPermission = (permission) => authOptions.includes(permission);
         this.setData({
             sa_orderid: options.id,
             order_rebate_used: wx.getStorageSync('siteP').order_rebate_used,
             userrole: wx.getStorageSync('userrole'),
-            isSubmit: wx.getStorageSync('auth').worderform.options.some(v => v == 'submit'),
-            isDelete: wx.getStorageSync('auth').worderform.options.some(v => v == 'delete'),
-            fixATime: wx.getStorageSync('auth').worderform.options.some(v => v == 'fixATime'),
+            isSubmit: checkPermission('submit'),
+            isDelete: checkPermission("delete"),
+            fixATime: checkPermission("fixATime"),
+            isRecall: checkPermission("recall"),
+            isSure: checkPermission("sure"),
         });
         this.getDetail(true);
         //销售分类
@@ -625,9 +629,56 @@ Page({
                 title: s.code != '1' ? s.msg : getApp().globalData.Language.getMapText('提交成功'),
                 icon: "none"
             });
-            if (s.code == '1') this.setData({
-                "detail.status": "提交"
-            })
+            if (s.code == '1') this.getDetail(true, false)
+        })
+    },
+    confirmSubmit() {
+        let that = this;
+        wx.showModal({
+            cancelText: getApp().globalData.Language.getMapText('取消'),
+            confirmText: getApp().globalData.Language.getMapText('确定'),
+            title: getApp().globalData.Language.getMapText('提示'),
+            content: getApp().globalData.Language.getMapText('是否确认提交订单') + '?',
+            complete: (res) => {
+                if (res.confirm) _Http.basic({
+                    "id": 2025011514120303,
+                    "content": {
+                        sa_orderid: that.data.sa_orderid,
+                        reminddays: that.data.reminddays
+                    },
+                }).then(s => {
+                    console.log("确定提交订单", s)
+                    wx.showToast({
+                        title: s.code != '1' ? s.msg : getApp().globalData.Language.getMapText('提交成功'),
+                        icon: "none"
+                    });
+                    if (s.code == '1') that.getDetail(true, false)
+                })
+            }
+        })
+    },
+    recall() {
+        let that = this;
+        wx.showModal({
+            cancelText: getApp().globalData.Language.getMapText('取消'),
+            confirmText: getApp().globalData.Language.getMapText('确定'),
+            title: getApp().globalData.Language.getMapText('提示'),
+            content: getApp().globalData.Language.getMapText('是否确认撤回订单') + '?',
+            complete: (res) => {
+                if (res.confirm) _Http.basic({
+                    "id": 20230301190202,
+                    "content": {
+                        sa_orderid: that.data.sa_orderid
+                    },
+                }).then(s => {
+                    console.log("确定提交订单", s)
+                    wx.showToast({
+                        title: s.code != '1' ? s.msg : getApp().globalData.Language.getMapText('撤回成功'),
+                        icon: "none"
+                    });
+                    if (s.code == '1') that.getDetail(true, false)
+                })
+            }
         })
     },
     stepperSubmit() {

+ 13 - 8
packageA/orderForm/detail.wxml

@@ -118,7 +118,6 @@
 	<Invoice slot='发票' id='Invoice' apiId='20221229154102' />
 </Yl_FunTabs>
 
-<!-- 提交订单 -->
 <van-dialog show="{{ showMYModel }}" bind:close="dialogOnClose" bind:confirm='stepperSubmit' use-slot title="{{language['提示']||'提示'}}" confirmButtonText="{{language['确定']||'确定'}}" cancelButtonText="{{language['取消']||'取消'}}" confirm-button-color='#3774F6' show-cancel-button confirm-button-open-type="getUserInfo" zIndex="99999999">
 	<view class="dialog-box">
 		<view style="margin-top: 20rpx;">
@@ -144,14 +143,20 @@
 		</view>
 	</view>
 	<view class="but-box">
-		<block wx:if="{{isDelete}}">
-			<van-button custom-class='but delete' wx:if="{{detail.status=='新建'&&detail.type!='特殊订单'}}" bind:click="deleteItem">{{language['删除订单']||'删除订单'}}</van-button>
+		<block wx:if="{{detail.status=='预提交'}}">
+			<van-button wx:if="{{isSure}}" custom-class='but' bind:click="confirmSubmit">{{language['确认提交']||'确认提交'}}</van-button>
+			<van-button  wx:if="{{isRecall}}" custom-class='but' color='#FF9933' bind:click="recall">{{language['撤回']||'撤回'}}</van-button>
 		</block>
-		<block wx:if="{{isSubmit}}">
-			<van-button custom-class='but' wx:if="{{detail.status=='新建'}}" bind:click="submit">{{language['提交订单']||'提交订单'}}</van-button>
-		</block>
-		<block wx:if="{{fixATime}}">
-			<van-button custom-class='but' wx:if="{{detail.status=='交期待确认'}}" bind:click="notarize">{{language['确认交期']||'确认交期'}}</van-button>
+		<block wx:else>
+			<block wx:if="{{isDelete}}">
+				<van-button custom-class='but delete' wx:if="{{detail.status=='新建'&&detail.type!='特殊订单'}}" bind:click="deleteItem">{{language['删除订单']||'删除订单'}}</van-button>
+			</block>
+			<block wx:if="{{isSubmit}}">
+				<van-button custom-class='but' wx:if="{{detail.status=='新建'}}" bind:click="submit">{{language['提交订单']||'提交订单'}}</van-button>
+			</block>
+			<block wx:if="{{fixATime}}">
+				<van-button custom-class='but' wx:if="{{detail.status=='交期待确认'}}" bind:click="notarize">{{language['确认交期']||'确认交期'}}</van-button>
+			</block>
 		</block>
 	</view>
 </view>