zhaoxiaohai 2 år sedan
förälder
incheckning
af93971755

+ 49 - 1
packageA/invoice/detail.js

@@ -141,10 +141,58 @@ Page({
             }
         }
     },
+    submit() {
+        if (this.selectComponent("#DetailLine").data.list.length == 0) {
+            wx.showToast({
+                title: '还未添加开票订单行不可提交!',
+                icon: "none"
+            });
+            this.setData({
+                tabsActive: 2
+            })
+        } else {
+            let that = this;
+            wx.showModal({
+                title: '提示',
+                content: '是否确认提交该申请单?',
+                complete: ({
+                    confirm
+                }) => {
+                    if (confirm) _Http.basic({
+                        "id": "20221219133803",
+                        "version": 1,
+                        "content": {
+                            "sa_invoiceapplyid": that.data.sa_invoiceapplyid
+                        }
+                    }).then(res => {
+                        console.log("提交申请单", res);
+                        if (res.msg != '成功') return wx.showToast({
+                            title: res.msg,
+                            icon: "none"
+                        });
+                        that.getDetail();
+                    })
+                }
+            })
+        }
+    },
     onReachBottom() {
         this.partialRenewal();
     },
     onUnload() {
-
+        let page = getCurrentPages().find(v => v.__route__ == 'packageA/invoice/index');
+        let content = page.data.content;
+        content.pageNumber = 1;
+        content.pageSize = page.data.list.length;
+        _Http.basic({
+            "id": 20221219133703,
+            "version": 1,
+            content
+        }).then(res => {
+            console.log("开票列表", res)
+            page.setData({
+                list: res.data
+            })
+        })
     },
 })

+ 2 - 2
packageA/invoice/detail.wxml

@@ -14,6 +14,6 @@
 	<view style="height: 140rpx;" />
 </Yl_FunTabs>
 
-<view class="footer" wx:if="{{detail.status=='审核'}}">
-	<van-button custom-class='but' bind:click="receiving">确认收货</van-button>
+<view class="footer">
+	<van-button custom-class='but' bind:click="submit">提交申请单</van-button>
 </view>

+ 1 - 1
packageA/invoice/index.js

@@ -83,7 +83,7 @@ Page({
   /* 切换tabs */
   tabsChange(e) {
     this.setData({
-      "content.status": e.detail.name
+      active: e.detail.name
     });
     this.getList(true);
   },

+ 9 - 10
packageA/invoice/modules/detailLine/list/index.js

@@ -35,20 +35,19 @@ Component({
 					title: `开票金额不可为0`,
 					icon: "none"
 				});
-				if (i != -1) this.setData({
+				if (i != -1) return this.setData({
 					[`list[${i}].invoiceamount`]: this.data.list[i].invoiceamount,
 					[`list[${i}].invoiceaqty`]: this.data.list[i].invoiceaqty,
 				})
-			} else {
-				if (e.detail.value != data.invoiceamount) this.triggerEvent("changeProduct", {
-					"sa_invoiceapply_orderid": data.sa_invoiceapply_orderid,
-					"saorderid": data.sa_orderid,
-					"sa_orderitemsid": data.sa_orderitemsid,
-					"price": data.price,
-					"invoiceamount": e.detail.value - 0,
-					"invoiceaqty": (e.detail.value - 0) / data.price
-				})
 			}
+			if (e.detail.value != data.invoiceamount) this.triggerEvent("changeProduct", {
+				"sa_invoiceapply_orderid": data.sa_invoiceapply_orderid,
+				"saorderid": data.sa_orderid,
+				"sa_orderitemsid": data.sa_orderitemsid,
+				"price": data.price,
+				"invoiceamount": e.detail.value - 0,
+				"invoiceaqty": (e.detail.value - 0) / data.price
+			})
 		},
 		deleteProduct(e) {
 			let {

+ 38 - 7
packageA/invoice/update.js

@@ -34,16 +34,16 @@ Page({
                 error: false,
                 errMsg: "",
                 type: "route",
-                url: "/select/finance/index",
+                url: "/select/agent/index",
                 params: {
-                    "id": 20221013160602,
+                    "id": "20221216145803",
+                    "version": 1,
                     "content": {
                         nocache: true,
-                        "pageSize": 20,
                         "where": {
-                            "condition": "",
-                        },
-                    },
+                            "condition": ""
+                        }
+                    }
                 },
                 interrupt: true,
                 query: '&radio=true',
@@ -69,6 +69,7 @@ Page({
                         },
                     },
                 },
+                interrupt: true,
                 query: '&radio=true',
                 value: "",
                 placeholder: "选择开票抬头信息",
@@ -91,7 +92,6 @@ Page({
             detail.data.value[0] = `抬头:${item.enterprisename}\n税号:${item.taxno}\n地址:${item.address}`;
             detail.form[detail.temporary.index].value = detail.data.value;
             this.setData({
-                form: detail.form,
                 "content.enterprisename": item.enterprisename,
                 "content.taxno": item.taxno,
                 "content.bank": item.bank,
@@ -99,13 +99,44 @@ Page({
                 "content.bankcardno": item.bankcardno,
                 "content.address": item.address,
             })
+        } else if (detail.temporary.item.label == "开票经销商") {
+            detail.form[0].value = detail.data.value;
+            detail.form.splice(1, detail.form.length == 2 ? 0 : 1, {
+                label: "开票抬头",
+                error: false,
+                errMsg: "",
+                type: "route",
+                url: "/select/finance/index",
+                params: {
+                    "id": 20221013160602,
+                    "content": {
+                        nocache: true,
+                        sys_enterpriseid: detail.data.id[0],
+                        "pageSize": 20,
+                        "where": {
+                            "condition": "",
+                        },
+                    },
+                },
+                interrupt: true,
+                query: '&radio=true',
+                value: "",
+                placeholder: "选择开票抬头信息",
+                valueName: "principal",
+                checking: "base",
+                required: true
+            })
         }
+        this.setData({
+            form: detail.form,
+        })
         this.selectComponent("#Form").confirm();
         wx.navigateBack()
     },
     submit() {
         let data = this.selectComponent("#Form").submit();
         let content = this.data.content;
+        data.sys_enterpriseid && (content.sys_enterpriseid = data.sys_enterpriseid[1][0]);
         content.remarks = data.remarks;
         wx.showModal({
             title: '提示',