Просмотр исходного кода

欠款-新增公用成功返回页面(挂参:pages/xxx?title=title)

jf 5 лет назад
Родитель
Сommit
f0d06ec464

+ 1 - 1
ghsApp/src/api/arrears/index.js

@@ -21,5 +21,5 @@ export const getOrderDebtListApi = id => {
  * @param {*} id
  */
 export const clearOrderApi = id => {
-	return https.post("/order-clear/clear", { id });
+	return https.post("/order-clear/clear", id);
 };

+ 33 - 0
ghsApp/src/common/pageSuccess.vue

@@ -0,0 +1,33 @@
+<template>
+  <appResult :title="title">
+    <button class="admin-button-com big" @click="closeLayer">关闭</button>
+  </appResult>
+</template>
+<script>
+import appResult from "@/components/app-result";
+export default {
+  name: "pageSuccess",
+  components: {
+    appResult,
+  },
+	data() {
+		return {
+			title:'',
+		};
+	},
+	onLoad(e){
+  	this.title = e.title
+	},
+  methods: {
+    closeLayer() {
+					uni.navigateBack({delta: 2});
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.admin-button-com {
+  margin-bottom: 20px;
+  width: 100%;
+}
+</style>

+ 7 - 0
ghsApp/src/pages.json

@@ -54,6 +54,13 @@
 				"navigationBarBackgroundColor": "#ffffff",
 				"navigationBarTextStyle": "black"
 			}
+		},
+		{
+			"path": "common/pageSuccess",
+			"style": {
+				"navigationBarBackgroundColor": "#ffffff",
+				"navigationBarTextStyle": "black"
+			}
 		}
 	],
 	"subPackages": [

+ 57 - 28
ghsApp/src/pagesArrears/details.vue

@@ -7,17 +7,13 @@
 			</view>
 			<view class="top-row">
 				<view class="info-item">
-					<image
-						class="logo"
-						src="https://img.huaml.com/uploads/12358/202005/29/de74c55596d304b85e79154958e8bf57_small.jpeg"
-						alt="商品图"
-					/>
+					<image class="logo" :src="customInfo.smallAvatar"/>
 					<text class="name">
-						{{ option.name || "" }}
+						{{ customInfo.name || "" }}
 					</text>
 				</view>
 				<view class="price-item">
-					{{ option.debtAmount || "" }}
+					{{ totalAmount || "" }}
 				</view>
 			</view>
 		</view>
@@ -46,17 +42,12 @@
 				<view class="info-view">
 					已选 <text class="price">{{ selectList.length }}</text> 笔,
 					<text class="unit">¥</text>
-					<text class="price">{{ totalAmount }}</text>
+					<text class="price">{{ selectTotalAmount }}</text>
 				</view>
 			</template>
 			<view class="btn-view" v-if="isBatch">
-				<button
-					:class="['admin-button-com', selectList.length == 0 ? 'disable' : 'blue']"
-					:disabled="selectList.length == 0"
-					@click="batchEvent"
-				>
-					批量收款
-				</button>
+				<button :class="['admin-button-com', 'disable']" @click="isBatch = false"> 取消</button>
+				<button :class="['admin-button-com', 'blue']" @click="batchEvent" >收款</button>
 			</view>
 			<view class="btn-view" v-else>
 				<button class="admin-button-com blue" @click="isBatch = true">
@@ -69,7 +60,7 @@
 <script>
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import DetailsItem from "./detailsItem";
-import { getOrderDebtListApi } from "@/api/arrears/index";
+import { getOrderDebtListApi,clearOrderApi } from "@/api/arrears/index";
 import wexinPay from "@/utils/pay/wxPay";
 
 export default {
@@ -77,6 +68,7 @@ export default {
 	data() {
 		return {
 			isBatch: false,
+			customInfo: "",
 			totalAmount: "",
 			num: "",
 			detailsList: [],
@@ -88,6 +80,11 @@ export default {
 			uni.stopPullDownRefresh();
 		});
 	},
+	onLoad(){
+		this.initData().then(res => {
+			uni.stopPullDownRefresh();
+		});
+	},
 	computed: {
 		selectList() {
 			let list = [];
@@ -98,7 +95,19 @@ export default {
 					}
 				}
 			}
+			console.log(list)
 			return list;
+		},
+		selectTotalAmount() {
+			let amount = 0;
+			if (this.detailsList) {
+				for (const item of this.detailsList) {
+					if (item.checked) {
+						amount=amount+Number(item.actPrice);
+					}
+				}
+			}
+			return amount;
 		}
 	},
 	methods: {
@@ -106,8 +115,9 @@ export default {
 			try {
 				this.listLoading = true;
 				const {
-					data: { num, totalAmount, list }
+					data: { customInfo, num, totalAmount, list }
 				} = await getOrderDebtListApi(this.option.id);
+				this.customInfo = customInfo;
 				this.totalAmount = totalAmount;
 				this.num = num;
 				this.detailsList = list.map(ele => {
@@ -123,33 +133,50 @@ export default {
 		},
 		checkItemEvent(item) {
 			for (let index = 0; index < this.detailsList.length; index++) {
-				const element = this.detailsList[index];
-				if (element == item) {
+				const element = this.detailsList[index].id;
+				if (element == item.id) {
 					//id相等选中
+
 					this.$set(this.detailsList, index, {
-						...element,
-						checked: !element.checked
+						...this.detailsList[index],
+						checked: !this.detailsList[index].checked
 					});
 					break;
 				}
 			}
 		},
-		async batchEvent() {
+		batchEvent() {
 			try {
 				if (this.$util.isEmpty(this.selectList)) {
 					this.$msg("请还款选择订单");
 					return;
 				}
 				let ids = this.selectList.map(ele => {
-					return ele.id;
+					return {id:ele.id};
 				});
-				const { data } = await clearOrderApi(JSON.stringify(ids));
-				wexinPay(data, this.paySuccess, this.payFail);
+			let parameter = {
+					id:JSON.stringify(ids),
+				customId:this.customInfo.id,
+			}
+			let self = this;
+				uni.showModal({
+					title: '提示',
+					content: '确定已收款?',
+					success: function (res) {
+						if (res.confirm) {
+							self.paySuccess(parameter)
+						}
+					}
+				});
+				// const { data } = await clearOrderApi(parameter);
+				// wexinPay(data, this.paySuccess, this.payFail);
 			} catch (error) {}
 		},
 		// 支付成功
-		paySuccess() {
-			this.$util.pageTo(1);
+		async paySuccess(parameter) {
+			await clearOrderApi(parameter);
+			uni.navigateTo({url:'/common/pageSuccess?title=收款成功'});
+			// this.$util.pageTo(1);
 		},
 		payFail() {
 			this.$msg("支付没有成功");
@@ -206,13 +233,15 @@ export default {
 		padding-bottom: 50upx;
 	}
 	.bar-view {
+		position: fixed;
+		bottom: 0;
 		display: flex;
 		justify-content: space-between;
 		align-items: center;
 		padding: 0 30upx;
 		width: 100%;
 		height: 100upx;
-
+		background: #fff;
 		box-shadow: 0px -1px 6px 0px rgba(4, 0, 0, 0.06);
 		.info-view {
 			display: flex;

+ 4 - 4
ghsApp/src/pagesArrears/detailsItem.vue

@@ -6,14 +6,14 @@
 		</view>
 		<view class="details-main">
 			<view class="item-header">
-				<text class="name">销售出库 | XSCK-2019-0029 </text>
+				<text class="name">销售出库 | {{info.orderSn}} </text>
 			</view>
 			<view class="item-row">
-				<view class="mark">2020-10-20</view>
+				<view class="mark">{{ info.addTime }}</view>
 			</view>
 			<view class="item-row">
-				<view class="mark">成交金额:2,902.00</view>
-				<view class="price">欠款:2,902.00</view>
+				<view class="mark">成交金额:{{ info.actPrice }}</view>
+				<view class="price">{{ info.actPrice }}</view>
 			</view>
 		</view>
 	</view>