zhengxin 5 年 前
コミット
46b9754cfa

+ 25 - 0
ghs/src/api/arrears/index.js

@@ -0,0 +1,25 @@
+import https from "@/plugins/luch-request_0.0.7/request";
+
+/**
+ * 客户欠款列表查询
+ * @param {*} name
+ */
+export const getDebtListApi = name => {
+	return https.get("/custom/debt-list", { name });
+};
+
+/**
+ * 客户欠款详情查询
+ * @param {*} name
+ */
+export const getOrderDebtListApi = id => {
+	return https.get("/order/debt-list", { id });
+};
+
+/**
+ * 批量收款
+ * @param {*} id
+ */
+export const clearOrderApi = id => {
+	return https.post("/order-clear/clear", { id });
+};

+ 0 - 8
ghs/src/api/member/index.js

@@ -32,14 +32,6 @@ export const debt = data => {
 	return https.get("/custom/debt", data);
 	return https.get("/custom/debt", data);
 };
 };
 
 
-/**
- * 客户欠款列表查询
- * @param {*} name
- */
-export const getDebtListApi = name => {
-	return https.get("/custom/debt-list", { name });
-};
-
 /** *
 /** *
  * 给客户充值 b
  * 给客户充值 b
  */
  */

+ 65 - 41
ghs/src/pagesArrears/details.vue

@@ -22,33 +22,38 @@
 			</view>
 			</view>
 		</view>
 		</view>
 		<scroll-view scroll-y class="shop-list">
 		<scroll-view scroll-y class="shop-list">
-			<DetailsItem
-				v-for="(item, index) in detailsList"
-				:key="index"
-				:info="item"
-				:isEdit="isBatch"
-				:isCheck="item.checked"
-				@click="checkItemEvent"
-			></DetailsItem>
+			<block v-if="!$util.isEmpty(detailsList)">
+				<DetailsItem
+					v-for="(item, index) in detailsList"
+					:key="index"
+					:info="item"
+					:isEdit="isBatch"
+					:isCheck="item.checked"
+					@click="checkItemEvent"
+				></DetailsItem>
+			</block>
+			<block v-else>
+				<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(detailsList)" />
+			</block>
 		</scroll-view>
 		</scroll-view>
 		<view class="bar-view">
 		<view class="bar-view">
 			<template v-if="!isBatch">
 			<template v-if="!isBatch">
 				<view class="info-view">
 				<view class="info-view">
-					共 <text class="price">{{ detailsList.length }}</text> 笔
+					共 <text class="price">{{ num }}</text> 笔
 				</view>
 				</view>
 			</template>
 			</template>
 			<template v-else>
 			<template v-else>
 				<view class="info-view">
 				<view class="info-view">
 					已选 <text class="price">{{ selectList.length }}</text> 笔,
 					已选 <text class="price">{{ selectList.length }}</text> 笔,
 					<text class="unit">¥</text>
 					<text class="unit">¥</text>
-					<text class="price">2,902.00</text>
+					<text class="price">{{ totalAmount }}</text>
 				</view>
 				</view>
 			</template>
 			</template>
 			<view class="btn-view" v-if="isBatch">
 			<view class="btn-view" v-if="isBatch">
 				<button
 				<button
 					:class="['admin-button-com', selectList.length == 0 ? 'disable' : 'blue']"
 					:class="['admin-button-com', selectList.length == 0 ? 'disable' : 'blue']"
 					:disabled="selectList.length == 0"
 					:disabled="selectList.length == 0"
-					@click=""
+					@click="batchEvent"
 				>
 				>
 					批量收款
 					批量收款
 				</button>
 				</button>
@@ -64,44 +69,24 @@
 <script>
 <script>
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import DetailsItem from "./detailsItem";
 import DetailsItem from "./detailsItem";
+import { getOrderDebtListApi } from "@/api/arrears/index";
+import wexinPay from "@/utils/pay/wxPay";
 
 
 export default {
 export default {
 	components: { AppWrapperEmpty, DetailsItem },
 	components: { AppWrapperEmpty, DetailsItem },
 	data() {
 	data() {
 		return {
 		return {
 			isBatch: false,
 			isBatch: false,
-
-			detailsList: [
-				{
-					orderNo: "PD20201217212800156",
-					name: "小许",
-					dateTime: "2020-7-10 21:50",
-					count: "101",
-					status: "01",
-					statusName: "已出库",
-					checked: true
-				},
-				{
-					orderNo: "PD20201217212800156",
-					name: "小许",
-					dateTime: "2020-7-10 21:50",
-					count: "101",
-					status: "01",
-					statusName: "已出库",
-					checked: false
-				},
-				{
-					orderNo: "PD20201217212800156",
-					name: "小许",
-					dateTime: "2020-7-10 21:50",
-					count: "101",
-					status: "01",
-					statusName: "已出库",
-					checked: false
-				}
-			]
+			totalAmount: "",
+			num: "",
+			detailsList: []
 		};
 		};
 	},
 	},
+	onPullDownRefresh() {
+		this.initData().then(res => {
+			uni.stopPullDownRefresh();
+		});
+	},
 	computed: {
 	computed: {
 		selectList() {
 		selectList() {
 			let list = [];
 			let list = [];
@@ -116,6 +101,25 @@ export default {
 		}
 		}
 	},
 	},
 	methods: {
 	methods: {
+		async initData() {
+			try {
+				this.listLoading = true;
+				const {
+					data: { num, totalAmount, list }
+				} = await getOrderDebtListApi(this.option.id);
+				this.totalAmount = totalAmount;
+				this.num = num;
+				this.detailsList = list.map(ele => {
+					return {
+						...ele,
+						checked: false
+					};
+				});
+			} catch (error) {
+			} finally {
+				this.listLoading = false;
+			}
+		},
 		checkItemEvent(item) {
 		checkItemEvent(item) {
 			for (let index = 0; index < this.detailsList.length; index++) {
 			for (let index = 0; index < this.detailsList.length; index++) {
 				const element = this.detailsList[index];
 				const element = this.detailsList[index];
@@ -128,6 +132,26 @@ export default {
 					break;
 					break;
 				}
 				}
 			}
 			}
+		},
+		async batchEvent() {
+			try {
+				if (this.$util.isEmpty(this.selectList)) {
+					this.$msg("请还款选择订单");
+					return;
+				}
+				let ids = this.selectList.map(ele => {
+					return ele.id;
+				});
+				const { data } = await clearOrderApi(JSON.stringify(ids));
+				wexinPay(data, this.paySuccess, this.payFail);
+			} catch (error) {}
+		},
+		// 支付成功
+		paySuccess() {
+			this.$util.pageTo(1);
+		},
+		payFail() {
+			this.$msg("支付没有成功");
 		}
 		}
 	}
 	}
 };
 };

+ 1 - 1
ghs/src/pagesArrears/list.vue

@@ -42,7 +42,7 @@
 <script>
 <script>
 import AppSearchModule from "@/components/module/app-search";
 import AppSearchModule from "@/components/module/app-search";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
-import { getDebtListApi } from "@/api/member/index";
+import { getDebtListApi } from "@/api/arrears/index";
 import { list } from "@/mixins";
 import { list } from "@/mixins";
 
 
 export default {
 export default {