Browse Source

销售订单

zhaoxiaohai 2 years ago
parent
commit
130ffe5e8d

+ 76 - 4
packageA/orderForm/detail.js

@@ -3,7 +3,7 @@ const _Http = getApp().globalData.http;
 Page({
 Page({
     data: {
     data: {
         sa_orderid: null,
         sa_orderid: null,
-        tabsActive:0,
+        tabsActive: 0,
         tabsList: [{
         tabsList: [{
             label: "产品明细",
             label: "产品明细",
             icon: "icon-tabxiangxixinxi1"
             icon: "icon-tabxiangxixinxi1"
@@ -19,12 +19,12 @@ Page({
         }],
         }],
     },
     },
     onLoad(options) {
     onLoad(options) {
-        console.log(options)
         this.setData({
         this.setData({
             sa_orderid: options.id
             sa_orderid: options.id
         });
         });
         this.getDetail();
         this.getDetail();
-		},
+    },
+    /* 获取详情 */
     getDetail() {
     getDetail() {
         _Http.basic({
         _Http.basic({
             "id": 20221108151302,
             "id": 20221108151302,
@@ -41,5 +41,77 @@ Page({
                 detail: res.data
                 detail: res.data
             })
             })
         })
         })
-    }
+    },
+    /* 更新数据 */
+    changeDetail() {
+        let data = this.data.detail,
+            content = {
+                "sa_orderid": data.sa_orderid,
+                "sys_enterpriseid": data.sys_enterpriseid, //订货企业id
+                "sa_accountclassid": data.accountclass.sa_accountclassid, //营销账户类型ID
+                "sa_brandid": data.sa_brandid, //品牌ID
+                "sys_enterprise_financeid": data.finance.sys_enterprise_financeid, //合作企业财务信息ID(开票信息)
+                "sa_logiscompid": data.logiscomp.sa_logiscompid, //物流公司档案ID
+                "rec_contactsid": data.contacts.contactsid, //合作企业联系人表ID(收货信息)
+                "type": data.type, //订单类型
+                "typemx": data.typemx, // 明细分类,可选
+                "remarks": data.remarks,
+                "saler_hrid": data.saler_hrid, //销售人员hrid,业务员hrid
+                "tradefield": "消防", //必选
+                "pay_enterpriseid": data.pay_enterpriseid, //结算单位
+                "rebate_userate": data.accountclass.rebate_userate, //返利金使用比例
+                "rebate_used": data.accountclass.rebate_used, //默认0,是否使用返利金
+                "billdate": data.billdate, //单据日期,默认创建日期
+            };
+        if (content.type != '标准订单') {
+            //"sa_contractid": 1, 合同ID,标准订单不传
+            //"sa_projectid": 1, 工程项目表ID,标准订单不传
+        }
+        return new Promise((resolve, reject) => {
+            _Http.basic({
+                "id": 20221108111402,
+                content
+            }).then(res => {
+                console.log("修改订单数据", res);
+                if (res.msg != '成功') wx.showToast({
+                    title: res.msg,
+                    icon: "none"
+                });
+                resolve(res)
+            })
+        })
+    },
+
+    /* 修改订单备注 */
+    changeRemarks(e) {
+        let value = e.detail.value,
+            remarks = this.data.detail.remarks,
+            that = this;
+        if (value == this.data.detail.remarks) return;
+        wx.showModal({
+            title: '提示',
+            content: '是否确定修改订单备注?',
+            complete: async (res) => {
+                if (res.cancel) that.setData({
+                    "detail.remarks": remarks
+                })
+                if (res.confirm) {
+                    let res = await that.changeDetail();
+                    that.setData({
+                        "detail.remarks": res.msg == '成功' ? value : remarks
+                    })
+                }
+            }
+        })
+    },
+    /* 设置是否使用返利金 */
+    async changeRebateUsed() {
+        this.setData({
+            "detail.accountclass.rebate_used": this.data.detail.accountclass.rebate_used == 0 ? 1 : 0
+        })
+        let res = await this.changeDetail();
+        if (res.msg != '成功') this.setData({
+            "detail.accountclass.rebate_used": this.data.detail.accountclass.rebate_used == 0 ? 1 : 0
+        });
+    },
 })
 })

+ 10 - 10
packageA/orderForm/detail.wxml

@@ -34,7 +34,7 @@
             开票单位
             开票单位
         </view>
         </view>
         <view class="address">
         <view class="address">
-            {{detail.finance.pay_enterprisename}}
+            {{detail.finance.enterprisename}}
         </view>
         </view>
     </view>
     </view>
     <view class="iconfont icon-dibu-bianji" />
     <view class="iconfont icon-dibu-bianji" />
@@ -47,31 +47,31 @@
     <navigator url="#" class="row">
     <navigator url="#" class="row">
         <view class="label">结算人</view>
         <view class="label">结算人</view>
         <view style="font-size: 28rpx;">
         <view style="font-size: 28rpx;">
-            阿萨德阿萨德阿萨德阿萨德
+            {{detail.finance.pay_enterprisename}}
             <van-icon name="arrow" />
             <van-icon name="arrow" />
         </view>
         </view>
     </navigator>
     </navigator>
     <navigator url="#" class="row">
     <navigator url="#" class="row">
         <view class="label">支付账户</view>
         <view class="label">支付账户</view>
         <view style="font-size: 28rpx;">
         <view style="font-size: 28rpx;">
-            阿萨德阿萨德阿萨德阿萨德
+            {{detail.accountclass.accountname}}
             <van-icon name="arrow" />
             <van-icon name="arrow" />
         </view>
         </view>
     </navigator>
     </navigator>
-    <navigator url="#" class="row" style="font-size: 0;">
-        <view class="label">是否使用返利金(余额:10000)</view>
-        <checkbox checked="{{true}}" color='var(--assist)' />
+    <navigator url="#" class="row" style="font-size: 0;" bindtap="changeRebateUsed">
+        <view class="label">是否使用返利金(余额:{{detail.accountclass.rebate_amount}})</view>
+        <checkbox checked="{{detail.accountclass.rebate_used==1}}" color='var(--assist)' />
     </navigator>
     </navigator>
-    <view class="row">
-        <view class="label">返利金支付(最大比例:20%)</view>
-        <input type="digit" class="remarks" placeholder-class='placeholder' value="{{detail.remarks}}" placeholder="使用金额" />
+    <view class="row" wx:if="{{detail.accountclass.rebate_used==1}}">
+        <view class="label">返利金支付(最多订单金额20%)</view>
+        <input type="digit" class="remarks" placeholder-class='placeholder' value="{{detail.accountclass.rebate_amount}}" placeholder="使用金额" />
     </view>
     </view>
 </view>
 </view>
 
 
 <view class="box" style="padding: 10rpx 30rpx;">
 <view class="box" style="padding: 10rpx 30rpx;">
     <view class="row">
     <view class="row">
         <view class="label">订单备注</view>
         <view class="label">订单备注</view>
-        <textarea class="remarks" placeholder-class='placeholder' value="{{detail.remarks}}" auto-height placeholder="订单备注" />
+        <textarea class="remarks" placeholder-class='placeholder' bindblur="changeRemarks" value="{{detail.remarks}}" auto-height placeholder="订单备注" />
     </view>
     </view>
     <navigator url="#" class="row" style="font-size: 0;">
     <navigator url="#" class="row" style="font-size: 0;">
         <view class="label">是否需要回签单</view>
         <view class="label">是否需要回签单</view>

+ 10 - 0
packageA/orderForm/index.js

@@ -2,6 +2,7 @@ const _Http = getApp().globalData.http;
 
 
 Page({
 Page({
   data: {
   data: {
+    active: 0,
     loading: true,
     loading: true,
     amount: 0,
     amount: 0,
     "content": {
     "content": {
@@ -54,6 +55,15 @@ Page({
     });
     });
     this.getList(true)
     this.getList(true)
   },
   },
+  /* 切换tabs */
+  tabsChange(e) {
+    let status = e.detail.title == '全部' ? "" : e.detail.title;
+    this.setData({
+      active: e.detail.index,
+      "content.where.status": status
+    });
+    this.getList(true);
+  },
   onReady() {
   onReady() {
     this.setListHeight()
     this.setListHeight()
   },
   },

+ 2 - 2
packageA/orderForm/index.wxml

@@ -2,12 +2,12 @@
 <template is="skeleton" wx:if="{{loading}}" />
 <template is="skeleton" wx:if="{{loading}}" />
 
 
 <Yl_HeadNav styleType="1" sort='{{content.sort}}' placeholder='搜索' bindonSearch="onSearch" />
 <Yl_HeadNav styleType="1" sort='{{content.sort}}' placeholder='搜索' bindonSearch="onSearch" />
-<van-tabs active="{{ active }}" color='var(--assist)' title-active-color='var(--assist)'>
+<van-tabs active="{{ active }}" color='var(--assist)' title-active-color='var(--assist)' bind:change="tabsChange">
     <van-tab title="全部" />
     <van-tab title="全部" />
     <van-tab title="新建" />
     <van-tab title="新建" />
     <van-tab title="提交" />
     <van-tab title="提交" />
     <van-tab title="审核" />
     <van-tab title="审核" />
-    <van-tab title="完成" />
+    <van-tab title="关闭" />
 </van-tabs>
 </van-tabs>
 <view class="tips">
 <view class="tips">
     共计{{content.total}}单,合计¥{{amount}}
     共计{{content.total}}单,合计¥{{amount}}

+ 0 - 20
packageA/shopping/float/index.js

@@ -1,20 +0,0 @@
-const _Http = getApp().globalData.http;
-Component({
-  data: {
-    num: 0,
-  },
-  methods: {
-    /* 去购物车 */
-    toShopping() {
-      wx.navigateTo({
-        url: '/packageA/shopping/index',
-      })
-    },
-    /* 设置数量 */
-    setNum(num) {
-      this.setData({
-        num
-      })
-    }
-  }
-})

+ 0 - 4
packageA/shopping/float/index.json

@@ -1,4 +0,0 @@
-{
-  "component": true,
-  "usingComponents": {}
-}

+ 0 - 13
packageA/shopping/float/index.scss

@@ -1,13 +0,0 @@
-.corner-mark {
-	position: absolute;
-	display: inline-block;
-	height: 28rpx;
-	font-size: 20rpx;
-	color: #FFFFFF;
-	background-color: red;
-	padding: 0 10rpx;
-	border-radius: 14rpx;
-	top: -45rpx;
-	left: 0rpx;
-	z-index: 9999;
-}

+ 0 - 6
packageA/shopping/float/index.wxml

@@ -1,6 +0,0 @@
-<Yl_FloatingButton useSlot bindtap="toShopping">
-	<view>
-		<text class="corner-mark" wx:if="{{num>0}}">{{num}}</text>
-		<image style="width: 160rpx; height: 160rpx; transform: translate(-50%,-50%);" src='/static/image/shopping.png' data-title="新建线索" />
-	</view>
-</Yl_FloatingButton>