Ver Fonte

供应商

shish há 5 anos atrás
pai
commit
9c56ac014d

+ 21 - 0
ghsApp/src/api/gys/index.js

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

+ 19 - 0
ghsApp/src/pages.json

@@ -682,6 +682,25 @@
 				}
 			]
 		},
+		{
+			"root": "pagesGys",
+			"pages": [
+				{
+					"path": "list",
+					"style": {
+						"navigationBarTitleText": "欠款",
+						"enablePullDownRefresh": true
+					}
+				},
+				{
+					"path": "details",
+					"style": {
+						"navigationBarTitleText": "欠款明细",
+						"enablePullDownRefresh": true
+					}
+				}
+			]
+		},
 		{
 			"root": "pagesInvite",
 			"pages": [

+ 0 - 1
ghsApp/src/pagesArrears/details.vue

@@ -57,7 +57,6 @@
 				<button :class="['admin-button-com', 'blue']" @click="batchEvent" >收款</button>
 			</view>
 		</view>
-    <kd-entrance></kd-entrance>
 	</view>
 </template>
 <script>

+ 312 - 0
ghsApp/src/pagesGys/details.vue

@@ -0,0 +1,312 @@
+<template>
+	<view class="order-page">
+		<view class="top-view">
+			<view class="top-row">
+				<text class="header-item">供应商</text>
+				<text class="header-item">总欠款 </text>
+			</view>
+			<view class="top-row">
+				<view class="info-item">
+					<image class="logo" :src="ghsInfo.smallAvatar"/>
+					<text class="name">
+						{{ ghsInfo.name || "" }}
+					</text>
+				</view>
+				<view class="price-item">
+					{{ ghsInfo.debtAmount || "0.00" }}
+				</view>
+			</view>
+		</view>
+		<view scroll-y class="shop-list">
+			<block v-if="!$util.isEmpty(detailsList)">
+				<DetailsItem
+					v-for="(item, index) in detailsList"
+					:key="index"
+					:info="item"
+					:isEdit="true"
+					:isCheck="item.checked"
+					@click="checkItemEvent"
+				></DetailsItem>
+			</block>
+			<block v-else>
+				<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(detailsList)" />
+			</block>
+		</view>
+		<view class="bar-view">
+			<template>
+				<view class="info-view">
+          <view
+            class="details-select"
+            @click="allCheck"
+          >
+            <text
+              class="iconfont iconxuanzhong"
+              v-if="isAllCheck"
+            > </text>
+            <text
+              class="iconfont iconweixuanzhong"
+              v-else
+            > </text>
+          </view>
+					已选 <text class="price">{{ selectList.length }}</text> 笔,
+					<text class="unit">¥</text>
+					<text class="price">{{ selectTotalAmount }}</text>
+				</view>
+			</template>
+			<view class="btn-view">
+				<button :class="['admin-button-com', 'blue']" @click="batchEvent" >结算</button>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import DetailsItem from "./detailsItem";
+import { getOrderDebtListApi,clearOrderApi } from "@/api/gys/index";
+
+export default {
+	components: { AppWrapperEmpty, DetailsItem },
+	data() {
+		return {
+			ghsInfo: "",
+			totalAmount: "",
+			num: "",
+			detailsList: [],
+			listLoading: false,
+      isAllCheck: false
+		};
+	},
+	onPullDownRefresh() {
+		this.initData().then(res => {
+			uni.stopPullDownRefresh();
+		});
+	},
+	onLoad(){
+		this.initData().then(res => {
+			uni.stopPullDownRefresh();
+		});
+	},
+	computed: {
+		selectList() {
+			let list = [];
+			if (this.detailsList) {
+				for (const item of this.detailsList) {
+					if (item.checked) {
+						list.push(item);
+					}
+				}
+			}
+			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.realPrice);
+					}
+				}
+			}
+			return amount.toFixed(2);
+		}
+	},
+  watch: {
+    selectList () {
+      if (this.selectList.length === this.detailsList.length) {
+        this.isAllCheck = true
+      } else {
+        this.isAllCheck = false
+      }
+    }
+  },
+	methods: {
+		async initData() {
+			try {
+				this.listLoading = true;
+				const {
+					data: { ghsInfo, num, totalAmount, list }
+				} = await getOrderDebtListApi(this.option.id);
+				this.ghsInfo = ghsInfo;
+				this.totalAmount = totalAmount;
+				this.num = num;
+				this.detailsList = list.map(ele => {
+					return {
+						...ele,
+						checked: false
+					};
+				});
+			} catch (error) {
+			} finally {
+				this.listLoading = false;
+			}
+		},
+    // 全选
+    allCheck () {
+      this.isAllCheck = !this.isAllCheck
+      if (this.isAllCheck) {
+        this.detailsList.map(ele => {
+          ele.checked = true
+        });
+      } else {
+        this.detailsList.map(ele => {
+          ele.checked = false
+        });
+      }
+    },
+		checkItemEvent(item) {
+			for (let index = 0; index < this.detailsList.length; index++) {
+				const element = this.detailsList[index].id;
+				if (element == item.id) {
+					//id相等选中
+
+					this.$set(this.detailsList, index, {
+						...this.detailsList[index],
+						checked: !this.detailsList[index].checked
+					});
+					break;
+				}
+			}
+		},
+		batchEvent() {
+			try {
+				if (this.$util.isEmpty(this.selectList)) {
+					this.$msg("请选择还款订单");
+					return;
+				}
+				let ids = this.selectList.map(ele => {
+					return {id:ele.id};
+				});
+			let parameter = {
+					id:JSON.stringify(ids),
+				ghsId:this.ghsInfo.id,
+			}
+			let self = this;
+				uni.showModal({
+					title: '提示',
+					content: '确定已结算?',
+					success: function (res) {
+						if (res.confirm) {
+							self.paySuccess(parameter)
+						}
+					}
+				});
+			} catch (error) {}
+		},
+		// 支付成功
+		async paySuccess(parameter) {
+			await clearOrderApi(parameter);
+			this.pageTo({url:'/common/pageSuccess?title=结算成功', type: 2});
+		},
+		payFail() {
+		}
+	}
+};
+</script>
+<style lang="scss" scoped>
+.order-page {
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	background-color: #f9fbfc;
+	overflow: scroll;
+	.top-view {
+		padding: 30upx;
+		background-color: #fff;
+		.top-row {
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			&:not(:last-child) {
+				margin-bottom: 10upx;
+			}
+			.header-item {
+				font-size: 24upx;
+				font-weight: 400;
+				color: #999999;
+			}
+			.info-item {
+				display: flex;
+				align-items: center;
+				.logo {
+					margin-right: 10upx;
+					width: 50upx;
+					height: 50upx;
+					border-radius: 50%;
+				}
+				.name {
+					font-size: 28upx;
+					font-weight: 600;
+					color: #333333;
+				}
+			}
+			.price-item {
+				font-size: 34upx;
+				font-weight: 600;
+				color: #333333;
+			}
+		}
+	}
+	.shop-list {
+		padding: 20upx 30upx;
+		flex: 1;
+		padding-bottom: 100upx;
+	}
+	.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;
+			align-items: center;
+			color: #333;
+			font-size: 24upx;
+			.iconfont {
+				font-size: 32upx;
+				color: #dddddd;
+			}
+			.price {
+				margin: 0 5upx;
+				color: $redColor;
+				font-size: 32upx;
+			}
+			.unit {
+				margin: 0 10upx;
+				color: $redColor;
+				font-size: 16upx;
+			}
+		}
+		.btn-view {
+			display: flex;
+			.admin-button-com {
+				display: flex;
+				align-items: center;
+				justify-content: center;
+				margin: 0 10upx;
+				width: 200upx;
+				height: 70upx;
+				// line-height: 70upx;
+				font-size: 32upx;
+			}
+		}
+	}
+  .details-select {
+    margin-right: 20upx;
+    display: inline-block;
+    .iconweixuanzhong,
+    .iconxuanzhong {
+      font-size: 40upx !important;
+    }
+    .iconxuanzhong {
+      color: $mainColor !important;
+    }
+  }
+}
+</style>

+ 106 - 0
ghsApp/src/pagesGys/detailsItem.vue

@@ -0,0 +1,106 @@
+<template>
+	<view class="details-item" @click.stop="checkEvent">
+		<view class="details-select" v-if="isEdit">
+			<text class="iconfont iconxuanzhong" v-if="isCheck"> </text>
+			<text class="iconfont iconweixuanzhong" v-else> </text>
+		</view>
+		<view class="details-main">
+			<view class="item-header">
+				<text class="name">采购单 | {{info.orderSn}} </text>
+			</view>
+			<view class="item-row">
+				<view class="mark">{{ info.addTime }}</view>
+			</view>
+			<view class="item-row">
+				<view class="mark">金额:{{ info.realPrice }}</view>
+				<view class="price">{{ info.realPrice }}</view>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+export default {
+	props: {
+		info: {
+			required: true
+		},
+		isEdit: {
+			type: Boolean,
+			default: false
+		},
+		isCheck: {
+			type: Boolean,
+			default: false
+		}
+	},
+	methods: {
+		checkEvent() {
+			if (this.isEdit) {
+				this.$emit("click", this.info);
+			}
+		}
+	}
+};
+</script>
+<style lang="scss" scoped>
+.details-item {
+	display: flex;
+	align-items: center;
+	padding: 30upx 20upx;
+	margin-bottom: 20upx;
+	background-color: #fff;
+	border-radius: 10upx;
+	.details-select {
+		margin-right: 30upx;
+		.iconfont {
+			font-size: 40upx;
+			color: #dddddd;
+		}
+		.iconxuanzhong {
+			color: $mainColor;
+		}
+	}
+	.details-main {
+		flex: 1;
+	}
+	.item-header {
+		display: flex;
+		align-items: center;
+		.logo {
+			margin-right: 20upx;
+			width: 50upx;
+			height: 50upx;
+			border-radius: 50%;
+		}
+		.name {
+			font-size: 28upx;
+			font-family: PingFang SC;
+			font-weight: 600;
+			color: #333333;
+		}
+	}
+	.item-row {
+		margin-top: 20upx;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+
+		.mark {
+			font-size: 28upx;
+			font-weight: 400;
+			color: #666666;
+		}
+		.price {
+			display: flex;
+			align-items: center;
+			font-size: 28upx;
+			font-weight: 600;
+			color: #333333;
+			.iconfont {
+				font-size: 28upx;
+				color: #999999;
+			}
+		}
+	}
+}
+</style>

+ 206 - 0
ghsApp/src/pagesGys/list.vue

@@ -0,0 +1,206 @@
+<template>
+	<view class="order-page">
+		<view class="input-wrap">
+			<AppSearchModule v-model="name" placeholder="请输入客户,支持拼音首字母搜索" @input="searchFn" />
+		</view>
+		<scroll-view scroll-y class="shop-list">
+			<block v-if="!$util.isEmpty(list.data)">
+				<view class="shop-item" v-for="(item, index) in list.data" :key="index">
+
+					<view class="item-header" @click="gotoDetailsEvent(item)">
+						<image
+							class="logo"
+							:src="item.smallAvatar"
+							alt="商品图"
+						/>
+						<text class="name">{{ item.name }} </text>
+					</view>
+					<view class="item-main" @click="gotoDetailsEvent(item)">
+						<view class="phone" @click.stop="callUp(item.mobile)" ><i class="iconfont icondianhua1"></i> {{ item.mobile }}</view>
+						<view class="price">{{ item.debtAmount }} <text class="iconfont iconxiangyou"></text>
+						</view>
+					</view>
+				</view>
+
+			</block>
+			<block v-else>
+				<AppWrapperEmpty title="暂无记录" :is-empty="$util.isEmpty(list.data)" />
+			</block>
+		</scroll-view>
+		<view class="bar-view">
+			<view class="price-view">
+				共 {{ customNum }} 个客户,合计
+				<text class="price">
+					{{ debtAmount }}
+				</text>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+import AppSearchModule from "@/components/module/app-search";
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import { getDebtListApi } from "@/api/arrears/index";
+import { list } from "@/mixins";
+
+export default {
+	components: { AppSearchModule, AppWrapperEmpty },
+	mixins: [list],
+
+	data() {
+		return {
+			name: "",
+			customNum: "0",
+			debtAmount: "0.00"
+		};
+	},
+	onShow() {
+		if (!this.listLoading) {
+			this.searchFn();
+		}
+	},
+	onPullDownRefresh() {
+		this.resetList();
+		this._list().then(res => {
+			uni.stopPullDownRefresh();
+		});
+	},
+	methods: {
+		async init() {
+			this._list();
+		},
+		_list() {
+			this.listLoading = true;
+			return getDebtListApi(this.name)
+				.then(res => {
+					const {
+						data: { customNum, debtAmount }
+					} = res;
+					this.customNum = customNum;
+					this.debtAmount = Number(debtAmount).toFixed(2);
+
+					this.completes(res);
+					this.listLoading = false;
+				})
+				.catch(err => {
+					this.listLoading = false;
+				});
+		},
+		gotoDetailsEvent(item) {
+			uni.navigateTo({
+				url: `/pagesArrears/details?id=${item.id}`,
+				success: result => {},
+				fail: () => {},
+				complete: () => {}
+			});
+		},
+		searchFn() {
+			this.resetList();
+			this.init();
+		},
+		callUp(mobile) {
+			uni.makePhoneCall({
+				phoneNumber: mobile
+			});
+		},
+	}
+};
+</script>
+<style lang="scss" scoped>
+.order-page {
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	background-color: #f9fbfc;
+	.input-wrap {
+		padding: 22px 20px 22px 30px;
+		background-color: #fff;
+	}
+	.shop-list {
+		padding: 20upx 30upx;
+		flex: 1;
+		padding-bottom: 50upx;
+		.shop-item {
+			margin-bottom: 20upx;
+			background-color: #fff;
+			border-radius: 10upx;
+			.item-header {
+				display: flex;
+				align-items: center;
+				padding: 20upx;
+				.logo {
+					margin-right: 20upx;
+					width: 50upx;
+					height: 50upx;
+					border-radius: 50%;
+				}
+				.name {
+					font-size: 28upx;
+					font-family: PingFang SC;
+					font-weight: 600;
+					color: #333333;
+				}
+			}
+			.item-main {
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+				padding: 30upx 20upx;
+				border-top: 1px solid #f0f2f6;
+				.phone {
+					font-size: 28upx;
+					font-weight: 400;
+					color: #666666;
+					line-height: 18upx;
+					height:18upx;
+					z-index:100;
+				}
+				.price {
+					display: flex;
+					align-items: center;
+					font-size: 28upx;
+					font-weight: 600;
+					color: #333333;
+					.iconfont {
+						font-size: 28upx;
+						color: #999999;
+					}
+				}
+				& .icondianhua1 {
+					font-size: 30px;
+					color: #3385ff;
+					margin-right:15upx;
+					z-index:100;
+				}
+			}
+		}
+	}
+	.bar-view {
+		display: flex;
+		justify-content: flex-end;
+		align-items: center;
+		padding: 0 30upx;
+		width: 100%;
+		height: 100upx;
+
+		box-shadow: 0px -1px 6px 0px rgba(4, 0, 0, 0.06);
+
+		.price-view {
+			display: flex;
+			align-items: center;
+			color: #333;
+			font-size: 24upx;
+			.price {
+				color: $redColor;
+				font-size: 32upx;
+				margin-left:10upx;
+			}
+			.unit {
+				margin: 0 0 0 10upx;
+				color: $redColor;
+				font-size: 24upx;
+			}
+		}
+	}
+}
+</style>

+ 1 - 1
ghsApp/src/pagesPurchase/supplier.vue

@@ -83,7 +83,7 @@ export default {
     },
     gotoDetailsEvent(item) {
 			uni.navigateTo({
-				url: `/pagesArrears/details?id=${item.id}`,
+				url: `/pagesGys/details?id=${item.id}`,
 				success: result => {},
 				fail: () => {},
 				complete: () => {}