Explorar o código

Merge branch '新功能开发/打款凭证' into 更新/LSA2.9.0

xiaohaizhao hai 1 ano
pai
achega
e60bf2ad3e

+ 1 - 1
components/Yl_Field/index.js

@@ -29,7 +29,7 @@ Component({
 			} = e.currentTarget.dataset;
 			getApp().globalData.handleSelect = this.handleRoute.bind(this);
 			wx.navigateTo({
-				url: item.url + '?params=' + JSON.stringify(item.params) + item.query
+				url: item.url + '?params=' + JSON.stringify(item.params) + (item.query || '')
 			})
 			this.setData({
 				temporary: {

+ 8 - 36
packageA/remitVoucher/detail.js

@@ -28,8 +28,7 @@ Page({
 			label: "附件",
 			icon: "icon-tabfujian1",
 			model: "#Yl_Attachment"
-		}],
-		tabbarsList: []
+		}]
 	},
 	onLoad(options) {
 		this.setData({
@@ -51,37 +50,13 @@ Page({
 				title: res.msg,
 				icon: "none"
 			});
-
-			let tabbarsList = []
-			if (res.data.status == '新建') tabbarsList = [{
-				label: "编辑",
-				icon: "icon-dibu-bianji"
-			}, {
-				label: "提交",
-				icon: "icon-tijiao",
-			}, {
-				label: "删除",
-				icon: "icon-guanlian-shanchu"
-			}]
-			/* {
-				label: "审核",
-				icon: "icon-shenhe"
-			}, */
-			if (res.data.status == '提交') tabbarsList = [{
-				label: "撤回",
-				icon: "icon-a-fanshenhetuihui"
-			}]
-			/* if (res.data.status == '审核') tabbarsList = [{
-				label: "撤回",
-				icon: "icon-a-fanshenhetuihui"
-			}] */
+			res.data.paydate = res.data.paydate.split(" ")[0]
 			this.setPreview(res.data);
 			this.setData({
 				detail: res.data,
-				tabbarsList,
 				loading: false
 			});
-			if (init) this.partialRenewal(true)
+			this.partialRenewal(true)
 		})
 	},
 	/* 设置详情信息 */
@@ -154,10 +129,11 @@ Page({
 			this.getDetail(true)
 		}
 	},
-	tabbarOnClick({
-		detail
-	}) {
-		switch (detail.label) {
+	tabbarOnClick(e) {
+		const {
+			name
+		} = e.currentTarget.dataset;
+		switch (name) {
 			case "编辑":
 				wx.navigateTo({
 					url: `/packageA/remitVoucher/update?rowData=${JSON.stringify(this.data.detail)}`,
@@ -251,9 +227,6 @@ Page({
 				})
 				break;
 		}
-	},
-	onInput(detail) {
-
 	},
 	//tabs 切换
 	tabsChange({
@@ -262,7 +235,6 @@ Page({
 		this.setData({
 			tabsActive: detail
 		});
-		console.log(this.data.tabsActive);
 		this.partialRenewal();
 	},
 	//局部数据更新 tabs

+ 12 - 5
packageA/remitVoucher/detail.scss

@@ -1,4 +1,5 @@
 @import "./detail.skeleton.wxss";
+
 .intr {
     position: relative;
     width: 100vw;
@@ -69,9 +70,10 @@
 }
 
 
+
 .footer {
     display: flex;
-    justify-content: center;
+    justify-content: space-between;
     padding: 0 30rpx;
     position: fixed;
     width: 100vw;
@@ -82,16 +84,21 @@
     box-sizing: border-box;
     z-index: 9999;
     padding-top: 10rpx;
+}
 
+.but-box {
     .but {
-        width: 690rpx;
+        min-width: 160rpx;
         height: 90rpx;
-        background: var(--warning);
-        border-radius: 16rpx;
+        border-radius: 8rpx;
         font-size: 28rpx;
         font-family: PingFang SC-Bold, PingFang SC;
         font-weight: bold;
-        color: #fff;
+        color: #FFFFFF;
+        margin-left: 10rpx;
     }
 
+    .delete {
+        background: var(--warning);
+    }
 }

+ 15 - 3
packageA/remitVoucher/detail.wxml

@@ -15,14 +15,26 @@
 </view>
 <Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
 	<Preview slot='详细信息' list1='{{list1}}' list2='{{list2}}' />
-	<remitVoucher disabled="{{detail.status != '新建'}}" detail="{{detail}}" slot="打款明细" id="remitVoucher" bind:onSuccess="getDetail"></remitVoucher>
+	<remitVoucher detail="{{detail}}" slot="打款明细" id="remitVoucher" bind:onSuccess="getDetail"></remitVoucher>
 	<Yl_Attachment slot='附件' id='Yl_Attachment' ownertable="sa_paybill" ownerid="{{detail.sa_paybillid}}" disabled="{{detail.status!='新建'}}" />
 	<view style="height: 160rpx;" />
 </Yl_FunTabs>
 
 <!-- 底部 -->
-<Yl_Tabbar wx:if="{{tabbarsList.length}}" list='{{tabbarsList}}' bind:callback="tabbarOnClick" />
-
+<block wx:if="{{detail.status=='新建' || detail.status=='提交' }}">
+	<view style="height: 130rpx;" />
+	<view class="footer">
+		<view></view>
+		<view wx:if="{{detail.status=='新建'}}" class="but-box">
+			<van-button custom-class='but' color="#3874F6" data-name="编辑" bind:click="tabbarOnClick">编辑</van-button>
+			<van-button custom-class='but' color="#E54D42" data-name="删除" bind:click="tabbarOnClick">删除</van-button>
+			<van-button custom-class='but' color='#F37B1D' data-name="提交" bind:click="tabbarOnClick">提交</van-button>
+		</view>
+		<view wx:elif="{{detail.status=='提交'}}" class="but-box">
+			<van-button custom-class='but bg-orange' color='#F37B1D' data-name="撤回" bind:click="tabbarOnClick">撤回</van-button>
+		</view>
+	</view>
+</block>
 
 <van-popup show="{{ show }}" position="bottom" custom-style="height: 50%;" bind:close="onClose" bind:click-overlay="onClose" z-index="9999">
 	<van-datetime-picker type="date" value="{{ currentDate }}" formatter="{{ formatter }}" bind:confirm="checkSubmit" bind:cancel="onClose" />

+ 7 - 110
packageA/remitVoucher/modules/remitDetail.js

@@ -7,13 +7,10 @@ Component({
   properties: {
     detail: {
       type: Object
-    },
-    disabled:{
-      type:Boolean
     }
   },
   options: {
-    addGlobalClass:true,
+    addGlobalClass: true,
   },
   /**
    * 组件的初始数据
@@ -31,12 +28,6 @@ Component({
    * 组件的方法列表
    */
   methods: {
-    isEdit () {
-      if (this.data.disabled) wx.showToast({
-				title: '当前状态不可编辑!',
-				icon: "none"
-			})
-    },
     getList(id, init) {
       let content = this.data.content;
       content.sa_paybillid = id;
@@ -50,6 +41,11 @@ Component({
           title: res.msg,
           icon: "none"
         })
+        getCurrentPages()[getCurrentPages().length - 1].setData({
+          "detail.accountname": res.data[0].accountname,
+          "detail.sa_accountclassid": res.data[0].sa_accountclassid,
+          "detail.sa_paybilldetailid": res.data[0].sa_paybilldetailid,
+        })
         this.setData({
           list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
           "content.pageNumber": res.pageNumber + 1,
@@ -59,105 +55,6 @@ Component({
           sa_paybillid: id
         })
       })
-    },
-    /* 添加明细 */
-    addProduct () {
-      wx.navigateTo({
-        url: `/packageA/remitVoucher/modules/selectAccount/index?params=${
-          JSON.stringify({
-            "id": 20221228085004,
-            "content": {
-              "pageNumber": 1,
-              "pageSize": 20,
-              "sa_paybillid":getCurrentPages()[getCurrentPages().length - 1].data.sa_paybillid,
-              "where": {
-                  "condition": ""
-              }
-            }
-          })
-        }`,
-      })
-      getApp().globalData.handleSelect = this.handleSelect.bind(this)
-    },
-    /* 操作选中的账户信息 */
-    async handleSelect (data) {
-      wx.navigateBack()
-      let paybilldetails = data.list.map(item => {
-        return {
-          "sa_paybilldetailid": 0,
-          "sa_accountclassid": item.sa_accountclassid,
-          "amount": item.amount
-        }
-      }),page = getCurrentPages()[getCurrentPages().length - 2]
-      let res = await _Http.basic({
-        "id":20221227092904,
-        "content": {
-          sa_paybillid:page.data.sa_paybillid,
-          paybilldetails
-        }
-      })
-      if( res.msg == '成功' ) {
-        this.getList(page.data.sa_paybillid,true)
-      }
-    },
-    /* 金额改变 */
-    async priceChange (e) {
-      console.log(e);
-      let data = e.currentTarget.dataset.data
-      if (e.detail.value == data.amount) return
-      let res = await _Http.basic({
-        "id":20221227092904,
-        "content": {
-          sa_paybillid:data.sa_paybillid,
-          paybilldetails: [
-            {
-              "sa_paybilldetailid": data.sa_paybilldetailid,
-                "sa_accountclassid":data.sa_accountclassid,
-                "amount":e.detail.value,
-            }
-          ]
-        }
-      })
-      if (res.msg == '成功') {
-        this.triggerEvent('onSuccess')
-      } else {
-        wx.showToast({
-          title: res.msg,
-          icon:'none'
-        })
-      }
-    },
-    /* 删除明细 */
-    deleteProduct (e) {
-      if (this.properties.detail.status != '新建') return wx.showToast({
-        title: '非新建状态无法删除',
-        icon:'none'
-      })
-      wx.showModal({
-        title:'提示',
-        content:'是否删除当前打款明细?',
-        complete: async (res) => {
-          console.log(res);
-          if (res.confirm) {
-            let res = await _Http.basic({
-              "id": 20221227093004,
-              "content": {
-                  "sa_paybillid":e.currentTarget.dataset.data.sa_paybillid,
-                  "sa_paybilldetailids":[e.currentTarget.dataset.data.sa_paybilldetailid]
-              }
-            })
-            if ( res.msg == '成功' ) {
-              this.getList(getCurrentPages()[getCurrentPages().length - 1].data.sa_paybillid,true)
-            } else {
-              console.log('出发');
-              wx.showToast({
-                title: res.msg,
-                icon:'none'
-              })
-            }
-          }
-        }
-      })
     }
   }
-})
+})

+ 5 - 5
packageA/remitVoucher/modules/remitDetail.scss

@@ -1,25 +1,25 @@
 @import "../../../static/common-head.scss";
+
 .item {
 	background: #ffffff;
 	width: 100vw;
 	padding: 20rpx 30rpx;
 	box-sizing: border-box;
 	font-size: 24rpx;
-	display: flex;
-	justify-content: space-between;
 	margin-bottom: 20rpx;
+
 	.input {
-		height: 54rpx;
 		background: #FFFFFF;
 		border-radius: 8rpx;
 		border: 1rpx solid #CCCCCC;
 		font-size: 28rpx;
 		font-family: PingFang SC-Regular, PingFang SC;
 		color: #333333;
-		line-height: 44px;
 		text-align: center;
 		margin-left: 20rpx;
+		padding: 8rpx 16rpx;
 	}
+
 	.delete {
 		width: 68rpx;
 		height: 68rpx;
@@ -27,4 +27,4 @@
 		font-size: 32rpx;
 		color: #999;
 	}
-}
+}

+ 7 - 19
packageA/remitVoucher/modules/remitDetail.wxml

@@ -1,24 +1,12 @@
 <view class="head">
-  <view class="count">打款明细</view>
-  <view class="expand">
-    <navigator wx:if="{{!disabled}}" url="#" class="but" bindtap="addProduct">
-      <van-icon name="plus" />
-    </navigator>
-  </view>
+	<view class="count">打款明细</view>
 </view>
 
 <view wx:for="{{ list }}" wx:key="{{ index }}" class="item">
-	<view>
-		<view style="margin-bottom:20rpx;font-size:28rpx;font-weight:bold">账户名称:{{item.accountname}}</view>
-		<view style="display:flex;align-items: center;">
-			金额
-			<input type="text" bindtap="isEdit" disabled="{{detail.status != '新建'}}" class="input" value="{{item.amount}}" data-data="{{item}}" bindblur="priceChange"/>
-		</view>
+	<view style="margin-bottom:20rpx;font-size:28rpx;font-weight:bold">账户名称:{{item.accountname}}</view>
+	<view style="display:flex;align-items: center;">
+		金额:
+		<view class="input">{{item.amount}}</view>
 	</view>
-	<view class="delete" wx:if="{{!disabled}}" data-data="{{item}}" catchtap="deleteProduct">
-		<text class="iconfont icon-guanlian-shanchu" />
-	</view>
-</view> 
-<block wx:if="{{list.length==0}}">
-	<Yl_Empty />
-</block>
+</view>
+<Yl_Empty wx:if="{{list.length==0}}" />

+ 1 - 0
packageA/remitVoucher/modules/selectAccount/index.js

@@ -11,6 +11,7 @@ Page({
         list:[]
     },
     onLoad(options) {
+        console.log(options)
         if (options.params) {
             let params = JSON.parse(options.params);
             if (!params.content.pageNumber || !params.content.pageTotal) {

+ 114 - 46
packageA/remitVoucher/update.js

@@ -1,6 +1,6 @@
 const _Http = getApp().globalData.http,
 	getTime = require("../../utils/getTime");
-
+let sa_paybilldetailid = 0;
 Page({
 	data: {
 		showAll: false,
@@ -11,56 +11,46 @@ Page({
 			period: ""
 		},
 		form: [{
-				label: "银行账号",
+				label: "转出账号",
 				error: false,
 				errMsg: "",
 				type: "route",
 				url: "/pages/bankAccount/index",
 				params: {},
 				value: "",
-				placeholder: "银行账号",
+				placeholder: "转出账号",
 				valueName: "bankcardno",
 				interrupt: true,
 				required: true
 			}, {
-				label: "款人",
+				label: "款人",
 				error: false,
 				errMsg: "",
 				type: "text",
 				value: "",
-				placeholder: "款人",
+				placeholder: "款人",
 				disabled: true,
 				valueName: "payer",
 				required: true
 			}, {
-				label: "银行",
+				label: "转出银行",
 				error: false,
 				errMsg: "",
 				type: "text",
 				value: "",
-				placeholder: "银行",
+				placeholder: "转出银行",
 				disabled: true,
 				valueName: "bank",
 				required: true
 			}, {
-				label: "款时间",
+				label: "款时间",
 				error: false,
 				errMsg: "",
 				type: "date",
 				value: getTime.formatTime(new Date(), '-').split(' ')[0],
-				placeholder: "请选择付款时间",
+				placeholder: "选择打款时间",
 				valueName: "paydate",
 				required: true,
-			}, {
-				label: "打款总金额",
-				error: false,
-				errMsg: "",
-				type: "digit",
-				value: "",
-				placeholder: "请输入打款总金额",
-				valueName: "amount",
-				required: true,
-
 			}, {
 				label: "转入银行",
 				error: false,
@@ -70,39 +60,70 @@ Page({
 				value: "",
 				rangeKey: "remarks",
 				rangeIndex: "",
-				placeholder: "选择转入银行",
+				placeholder: "选择转入银行",
 				valueName: "inbank",
-				required: false,
+				required: true,
 				interrupt: true
 			},
 			{
-				label: "转入账户",
+				label: "银行账号",
 				error: false,
 				errMsg: "",
 				type: "text",
 				value: "",
-				placeholder: "选择转入银行后自动带入",
+				placeholder: "选择转入银行后自动带入",
 				valueName: "inbankcardno",
-				required: false,
-			},
-			{
+				required: true,
+			}, {
+				label: "转入账户",
+				error: false,
+				errMsg: "",
+				type: "selector",
+				range: [],
+				value: "",
+				rangeKey: "accountname",
+				rangeIndex: "",
+				placeholder: "选择转入账户",
+				valueName: "sa_accountclassid",
+				required: true,
+				interrupt: true
+			}, {
+				label: "转入金额",
+				error: false,
+				errMsg: "",
+				type: "digit",
+				value: "",
+				placeholder: "转入金额",
+				valueName: "amount",
+				required: true,
+			}, {
 				label: "备注",
 				error: false,
 				errMsg: "",
 				type: "text",
 				value: "",
-				placeholder: "请输入备注",
+				placeholder: "输入备注",
 				valueName: "remarks",
 				required: false,
 			},
 		]
 	},
 	onLoad(options) {
+		let sa_paybillid = 0;
 		if (options.rowData) {
 			let data = JSON.parse(options.rowData);
+			sa_paybillid = data.sa_paybillid;
+			sa_paybilldetailid = data.sa_paybilldetailid;
 			this.setData({
 				form: this.data.form.map(v => {
-					v.value = data[v.valueName];
+					if (v.valueName == 'bankcardno') {
+						v.value = [data[v.valueName], data[v.valueName]];
+					} else if (v.valueName == "sa_accountclassid") {
+						v.id = data[v.valueName];
+						v.value = data.accountname;
+					} else {
+						v.value = data[v.valueName];
+					}
 					return v
 				}),
 				'content.sa_paybillid': data.sa_paybillid
@@ -128,26 +149,48 @@ Page({
 				})
 			}
 		});
+
+		_Http.basic({
+			"id": 20221228085004,
+			"content": {
+				"pageNumber": 1,
+				"pageSize": 9999,
+				sa_paybillid,
+				"where": {
+					"ispay": 1
+				}
+			},
+		}).then(res => {
+			console.log("获取可选择账户", res)
+			if (res.msg == '成功') {
+				let item = this.data.form.find(v => v.label == '转入账户')
+				item.range = res.data;
+				if (sa_paybillid) item.disabled = true;
+				this.setData({
+					form: this.data.form
+				})
+			}
+		})
 	},
 	/* 打断处理form */
 	interrupt({
 		detail
 	}) {
 		if (detail.data.label == '转入银行') {
-			detail.form[5] = detail.data;
-			detail.form[6].value = detail.result.value;
-			this.setData({
-				form: detail.form
-			})
-		} else if (detail.temporary.item.label == '银行账号') {
+			detail.form[4] = detail.data;
+			detail.form[5].value = detail.result.value;
+		} else if (detail.temporary.item.label == '转出账号') {
 			detail.form[0].value = [detail.data.bankcardno, detail.data.bankcardno];
 			detail.form[1].value = detail.data.name;
 			detail.form[2].value = detail.data.bank;
-			this.setData({
-				form: detail.form
-			})
 			wx.navigateBack()
+		} else if (detail.temporary.item.label == '转入账户') {
+			detail.form[6].value = detail.result.accountname;
+			detail.form[6].id = detail.result.sa_accountclassid;
 		}
+		this.setData({
+			form: detail.form
+		})
 		this.selectComponent('#Form').confirm()
 	},
 	async submit() {
@@ -155,7 +198,9 @@ Page({
 			...this.data.content,
 			...this.selectComponent("#Form").submit()
 		}
+		content.sa_accountclassid = this.data.form.find(v => v.label == '转入账户').id;
 		content.bankcardno = content.bankcardno[0]
+		console.log(content)
 		let res = await _Http.basic({
 			"id": "20221226153004",
 			content,
@@ -163,15 +208,37 @@ Page({
 		})
 		console.log("创建打款凭证", res);
 		if (res.msg == '成功') {
-			let page = getCurrentPages()[getCurrentPages().length - 2];
-			if (page.__route__ == 'packageA/remitVoucher/index') {
-				wx.redirectTo({
-					url: '/packageA/remitVoucher/detail?id=' + res.data.sa_paybillid,
-				})
-			} else if (page.__route__ == 'packageA/remitVoucher/detail') {
-				wx.navigateBack();
-				page.getDetail(true)
-			}
+			_Http.basic({
+				"id": 20221227092904,
+				"content": {
+					"paybilldetails": [{
+						"amount": content.amount,
+						"sa_accountclassid": content.sa_accountclassid,
+						sa_paybilldetailid
+					}],
+					"sa_paybillid": res.data.sa_paybillid
+				}
+			}).then(s => {
+				console.log("修改明细", s)
+				if (s.msg == '成功') {
+					let page = getCurrentPages()[getCurrentPages().length - 2];
+					if (page.__route__ == 'packageA/remitVoucher/index') {
+						wx.redirectTo({
+							url: '/packageA/remitVoucher/detail?id=' + res.data.sa_paybillid,
+						})
+					} else if (page.__route__ == 'packageA/remitVoucher/detail') {
+						wx.navigateBack();
+						page.getDetail(true)
+					}
+				} else {
+					wx.showToast({
+						title: res.msg,
+						icon: "none",
+						mask: true
+					})
+				}
+
+			})
 		} else {
 			wx.showToast({
 				title: res.msg,
@@ -179,6 +246,7 @@ Page({
 				mask: true
 			})
 		}
+
 	},
 	// 是否显示全部
 	onChange({

+ 1 - 1
packageA/remitVoucher/update.wxml

@@ -3,5 +3,5 @@
 	<view slot='discountrate' style="margin-right: 36rpx;">%</view>
 </Yl_Field>
 <view class="footer">
-	<van-button custom-class='but' disabled="{{disabled}}" bind:click="submit">提交</van-button>
+	<van-button custom-class='but' disabled="{{disabled}}" bind:click="submit">保存</van-button>
 </view>

+ 7 - 0
project.private.config.json

@@ -10,6 +10,13 @@
   "condition": {
     "miniprogram": {
       "list": [
+        {
+          "name": "打款凭证",
+          "pathName": "packageA/remitVoucher/index",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
+        },
         {
           "name": "商城详情",
           "pathName": "packageA/market/detail",