Browse Source

销售订单

zhaoxiaohai 2 years ago
parent
commit
c7eeb48419

+ 25 - 5
packageA/orderForm/add/float/index.js

@@ -83,13 +83,34 @@ Component({
             })
         },
         /* 创建项目订单 */
-        addProjectOrder(e) {
+        addProjectOrder({
+            item
+        }) {
             wx.showModal({
                 title: '提示',
-                content: `是否确认创建“${e.item.billno}”相关“${e.item.projectname}”项目订单?`,
+                content: `是否确认创建“${item.billno}”相关“${item.projectname}”项目订单?`,
                 complete: (res) => {
-                    if (res.confirm) wx.redirectTo({
-                        url: `/packageA/orderForm/add/add?type=项目订单&sa_contractid=${e.item.sa_contractid}&sa_projectid=${ e.item.sa_projectid}`,
+                    if (res.confirm) _Http.basic({
+                        "id": 20230103141402,
+                        "content": {
+                            "sys_enterpriseid": item.sys_enterpriseid, //订货企业id,可不传,默认取当前账号的
+                            "sa_contractid": item.sa_contractid, //合同ID,
+                            "sa_projectid": item.sa_projectid, //工程项目表ID,
+                        },
+                    }).then(res => {
+                        console.log("新建项目订单", res)
+                        if (res.msg != '成功') return wx.showToast({
+                            title: res.msg,
+                            icon: "none",
+                            mask: true
+                        })
+                        if (res.msg == '成功') setTimeout(() => {
+                            wx.redirectTo({
+                                url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+                            });
+                            let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
+                            if (page) page.getList(true);
+                        }, 500)
                     })
                 }
             })
@@ -97,7 +118,6 @@ Component({
         addActivityOrder({
             item
         }) {
-            console.log(item)
             wx.showModal({
                 title: '提示',
                 content: `是否确定创建“${item.promname}”促销订单`,

+ 65 - 7
packageA/orderForm/detail.js

@@ -17,11 +17,12 @@ Page({
             label: "订单进度",
             icon: "icon-tabcaozuojilu1",
             model: "#Progress"
-        }],
-        /* , {
+        }, {
             label: "发票",
-            icon: "icon-tabkaipiaoxinxi"
-        } */
+            icon: "icon-tabkaipiaoxinxi",
+            model: "#Invoice"
+        }],
+        saletypeList: null,
     },
     onLoad(options) {
         this.setData({
@@ -29,6 +30,48 @@ Page({
             order_rebate_used: wx.getStorageSync('siteP').order_rebate_used
         });
         this.getDetail(true);
+
+        //获取企业免邮额度
+        _Http.basic({
+            "id": 20220920084001,
+            "content": {},
+        }).then(res => {
+            console.log("查询企业档案", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            })
+            this.setData({
+                figure: res.data.freefreightamount
+            })
+        })
+
+        //销售分类
+        _Http.basic({
+            "classname": "sysmanage.develop.optiontype.optiontype",
+            "method": "optiontypeselect",
+            "content": {
+                pageSize: "999",
+                "typename": "saletype",
+                "parameter": {
+                    "siteid": wx.getStorageSync('siteP').siteid
+                }
+            }
+        }, false).then(res => {
+            console.log("销售分类", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            })
+            this.setData({
+                saletypeList: res.data
+            })
+        })
+    },
+    /* 设置回签单 */
+    changeSignbackstatus(e) {
+        this.data.detail.signbackstatus = e.detail;
+        this.changeDetail();
     },
     /* 获取详情 */
     getDetail(init = false, show = true) {
@@ -51,9 +94,24 @@ Page({
             if (init) this.partialRenewal(true)
         })
     },
+    /* 选择销售分类 */
+    selectSaletype(e) {
+        if (this.isEdit()) return;
+        if (this.data.detail.type == '项目订单') return;
+    },
+    /* 设置销售分类 */
+    setSaletype(e) {
+        let value = this.data.saletypeList[e.detail.value].value;
+        if (value == this.data.detail.saletype) return;
+        this.setData({
+            "detail.saletype": value
+        })
+        this.changeDetail();
+    },
     /* 选择结算人 */
     selectAgent() {
         if (this.isEdit()) return;
+        if (this.data.detail.type == '项目订单') return;
         wx.navigateTo({
             url: `/select/agent/index?params=${JSON.stringify({ 
 				"id":20230104103702,
@@ -260,7 +318,7 @@ Page({
                 "sa_accountclassid": data.accountclass.sa_accountclassid || 0, //营销账户类型ID
                 "sa_brandid": data.sa_brandid, //品牌ID
                 "sys_enterprise_financeid": data.sys_enterprise_financeid || 0, //合作企业财务信息ID(开票信息)
-                "sa_logiscompid": data.logiscomp.sa_logiscompid, //物流公司档案ID
+                //"sa_logiscompid": data.logiscomp.sa_logiscompid || 0, 物流公司档案ID
                 "rec_contactsid": data.rec_contactsid || 0, //合作企业联系人表ID(收货信息)
                 "type": data.type, //订单类型
                 "typemx": data.typemx, // 明细分类,可选
@@ -269,8 +327,8 @@ Page({
                 "tradefield": data.tradefield, //必选
                 "pay_enterpriseid": data.pay_enterpriseid, //结算单位
                 "rebate_userate": data.accountclass.rebate_userate, //返利金使用比例
-                "rebate_used": data.rebate_used, //默认0,是否使用返利金
-                "billdate": data.billdate, //单据日期,默认创建日期
+                signbackstatus: data.signbackstatus,
+                saletype: data.saletype
             };
         if (content.type = '项目订单') {
             content.sa_contractid = data.sa_contractid,

+ 8 - 5
packageA/orderForm/detail.json

@@ -1,7 +1,10 @@
 {
-	"usingComponents": {
-		"Product": "./modules/product/index",
-		"Yl_Attachment": "/components/Yl_Attachment/index",
-		"Progress": "./modules/progress/index"
-	}
+    "usingComponents": {
+        "Product": "./modules/product/index",
+        "Yl_Attachment": "/components/Yl_Attachment/index",
+        "Progress": "./modules/progress/index",
+        "Invoice": "../invoice/modules/InvoiceList/index",
+        "van-radio": "@vant/weapp/radio/index",
+        "van-radio-group": "@vant/weapp/radio-group/index"
+    }
 }

+ 25 - 6
packageA/orderForm/detail.scss

@@ -133,6 +133,17 @@
     }
 }
 
+.radio-group {
+    display: flex !important;
+}
+
+.label-class {
+    display: flex;
+    align-items: center;
+    font-size: 28rpx;
+    color: #333;
+}
+
 /* 备注 */
 .remarks {
     flex: 1;
@@ -162,14 +173,22 @@
     z-index: 9999;
     padding-top: 10rpx;
 
-    .count {
-        height: 90rpx;
-        line-height: 90rpx;
-        font-size: 32rpx;
-        font-weight: bold;
-        color: var(--error);
+    .price {
+        view {
+            font-size: 24rpx;
+            color: rgb(163, 162, 162);
+        }
+
+        .count {
+            font-size: 32rpx;
+            font-weight: bold;
+            color: var(--error);
+            margin: 2rpx 0 10rpx 0;
+        }
     }
 
+
+
     .but-box {
         .but {
             min-width: 156rpx;

+ 25 - 8
packageA/orderForm/detail.wxml

@@ -77,28 +77,45 @@
 </view>
 
 <view class="box" style="padding: 10rpx 30rpx;">
+    <picker mode="selector" range='{{saletypeList}}' disabled="{{detail.status!='新建'}}" range-key='value' bindchange='setSaletype'>
+        <navigator url="#" class="row" bindtap="selectSaletype">
+            <view class="label">销售分类</view>
+            <view style="font-size: 28rpx;">
+                {{detail.saletype || '前往设置'}}
+                <van-icon name="arrow" />
+            </view>
+        </navigator>
+    </picker>
     <view class="row">
         <view class="label">订单备注</view>
         <textarea disabled="{{detail.status!='新建'}}" bindtap="isEdit" class="remarks" placeholder-class='placeholder' bindblur="changeRemarks" value="{{detail.remarks}}" auto-height placeholder="订单备注" />
     </view>
-    <navigator url="#" class="row" style="font-size: 0;">
-        <view class="label">是否需要回签单</view>
-        <checkbox disabled="{{detail.status!='新建'}}" bindtap="isEdit" checked="{{true}}" color='var(--assist)' />
-    </navigator>
+    <view class="row">
+        <view class="label">回签单</view>
+        <van-radio-group direction='horizontal' disabled="{{detail.status!='新建'}}" value="{{ detail.signbackstatus }}" bind:change="changeSignbackstatus">
+            <van-radio icon-size='14px' custom-class='label-class' name="不需要">不需要</van-radio>
+            <van-radio icon-size='14px' custom-class='label-class' name="纸质件">纸质件</van-radio>
+            <van-radio icon-size='14px' custom-class='label-class' name="扫描件">扫描件</van-radio>
+        </van-radio-group>
+    </view>
 </view>
-
 <view style="height: 20rpx;" />
-
 <Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
     <Product slot='产品明细' id='Product' disabled="{{detail.status!='新建'}}" />
     <Yl_Attachment slot='附件' id='Yl_Attachment' ownertable="sa_order" ownerid="{{detail.sa_orderid}}" disabled="{{detail.status!='新建'}}" />
     <Progress slot='订单进度' id='Progress' />
+    <Invoice slot='发票' id='Invoice' apiId='20221229154102' />
 </Yl_FunTabs>
 
 <view style="height: 130rpx;" />
 <view class="footer">
-    <view class="count">
-        ¥{{detail.amount}}元
+    <view class="price">
+        <view class="count">
+            ¥{{detail.amount}}元
+        </view>
+        <view>
+            {{detail.amount>=figure?'免运费':'差'+(figure-detail.amount)+'元免运费'}}
+        </view>
     </view>
     <view class="but-box">
         <van-button custom-class='but delete' wx:if="{{detail.status=='新建'}}" bind:click="deleteItem">删除订单</van-button>

+ 2 - 2
packageA/orderForm/modules/product/index.js

@@ -132,7 +132,7 @@ Component({
 						page.setData({
 							"detail.amount": amount - 0
 						})
-						page.setRebate_amount({
+						if (page.data.detail.rebate_used == 1) page.setRebate_amount({
 							detail: {
 								value: amount - 0
 							}
@@ -176,7 +176,7 @@ Component({
 							page.setData({
 								"detail.amount": amount - 0
 							})
-							page.setRebate_amount({
+							if (page.data.detail.rebate_used == 1) page.setRebate_amount({
 								detail: {
 									value: amount - 0
 								}