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

Merge branch 'master' of http://git.huaml.com/zhh/front-end into module_s

fuwei 5 лет назад
Родитель
Сommit
8362f3b03b

+ 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 });
+};

+ 12 - 11
ghs/src/api/member/index.js

@@ -1,36 +1,37 @@
-import https from '@/plugins/luch-request_0.0.7/request'
+import https from "@/plugins/luch-request_0.0.7/request";
 
 /** *
  * 客户列表 b
  */
 export const getList = data => {
-	return https.get('/custom/list', data)
-}
+	return https.get("/custom/list", data);
+};
 
 /** *
  * 商家端客户详情,包括资产、订单和备注 b
  */
 export const getUserDet = data => {
-	return https.get('/custom/detail', data)
-}
+	return https.get("/custom/detail", data);
+};
 
 /** *
  * 获取客户详情,包括资产 b
  */
 export const getDet = data => {
-	return https.get('/user/detail', data)
-}
+	return https.get("/user/detail", data);
+};
 
 /** *
  * 添加客户 b
  */
 export const add = data => {
-	return https.post('/custom/add', data)
-}
+	return https.post("/custom/add", data);
+};
 // 延期付
 export const debt = data => {
-	return https.get('/custom/debt', data)
-}
+	return https.get("/custom/debt", data);
+};
+
 /** *
  * 给客户充值 b
  */

+ 127 - 103
ghs/src/components/module/app-search.vue

@@ -1,129 +1,153 @@
 <template>
-	<div class="app-search-module" :style="{height: height + 'rpx'}">
-		<div class="map-search" :style="{backgroundColor: backColor}">
+	<div class="app-search-module" :style="{ height: height + 'rpx' }">
+		<div class="map-search" :style="{ backgroundColor: backColor }">
 			<div class="icon-wrap" v-if="isIcon">
 				<i class="iconfont" :class="[icon]"></i>
 			</div>
 			<div class="input-wrap">
-				<input type="text" ref="searchInput" v-model="search" :focus="focus" @input="inputFn" :style="{fontSize: fontSize + 'rpx'}" :placeholder="placeholder" placeholder-class="placeholder" />
+				<input
+					type="text"
+					ref="searchInput"
+					v-model="search"
+					:focus="focus"
+					@input="inputFn"
+					:style="{ fontSize: fontSize + 'rpx' }"
+					:placeholder="placeholder"
+					placeholder-class="placeholder"
+					@confirm="searchFn"
+				/>
 			</div>
 		</div>
 		<block v-if="isBtn">
-			<button v-if="isTextBtn" class="search-btn" :style="{fontSize: fontSize + 'rpx'}" @click="searchFn">{{ btnText }}</button>
-			<button v-else class="search-btn admin-button-com middle blue" :style="{fontSize: fontSize + 'rpx'}" @click="searchFn">{{ btnText }}</button>
+			<button
+				v-if="isTextBtn"
+				class="search-btn"
+				:style="{ fontSize: fontSize + 'rpx' }"
+				@click="searchFn"
+			>
+				{{ btnText }}
+			</button>
+			<button
+				v-else
+				class="search-btn admin-button-com middle blue"
+				:style="{ fontSize: fontSize + 'rpx' }"
+				@click="searchFn"
+			>
+				{{ btnText }}
+			</button>
 		</block>
 	</div>
 </template>
 
 <script>
-	export default {
-		name: 'app-search-module',
-		props: {
-			// 搜索组件的高度
-			height: {
-				type: Number,
-				default: 66
-			},
-			placeholder: {
-				type: String,
-				default: '请输入'
-			},
-			// size字体大小
-			fontSize: {
-				type: Number,
-				default: 26
-			},
-			// 是否有icon
-			isIcon: {
-				type: Boolean,
-				default: true
-			},
-			// 显示的icon
-			icon: {
-				type: String,
-				default: 'iconsearch'
-			},
-			// 背景色
-			backColor: {
-				type: String,
-				default: '#F0F2F6'
-			},
-			// 是否需要按钮
-			isBtn: {
-				type: Boolean,
-				default: false
-			},
-			// 是否是文字按钮
-			isTextBtn: {
-				type: Boolean,
-				default: true
-			},
-			// 按钮文字
-			btnText: {
-				type: String,
-				default: '搜索'
-			},
-			// 是否自动聚焦
-			focus: {
-				type: Boolean,
-				default: false
-			}
+export default {
+	name: "app-search-module",
+	props: {
+		// 搜索组件的高度
+		height: {
+			type: Number,
+			default: 66
 		},
-		data() {
-			return {
-				search: ''
-			}
+		placeholder: {
+			type: String,
+			default: "请输入"
 		},
-		methods: {
-			searchFn() {
-				this.$emit('search', this.search)
-			},
-			inputFn(e) {
-				// console.log('sdfa', e)
-				setTimeout(() => {
-					this.$emit('input', this.search)
-				})
-			}
+		// size字体大小
+		fontSize: {
+			type: Number,
+			default: 26
+		},
+		// 是否有icon
+		isIcon: {
+			type: Boolean,
+			default: true
+		},
+		// 显示的icon
+		icon: {
+			type: String,
+			default: "iconsearch"
+		},
+		// 背景色
+		backColor: {
+			type: String,
+			default: "#F0F2F6"
+		},
+		// 是否需要按钮
+		isBtn: {
+			type: Boolean,
+			default: false
+		},
+		// 是否是文字按钮
+		isTextBtn: {
+			type: Boolean,
+			default: true
+		},
+		// 按钮文字
+		btnText: {
+			type: String,
+			default: "搜索"
+		},
+		// 是否自动聚焦
+		focus: {
+			type: Boolean,
+			default: false
+		}
+	},
+	data() {
+		return {
+			search: ""
+		};
+	},
+	methods: {
+		searchFn() {
+			this.$emit("search", this.search);
+		},
+		inputFn(e) {
+			// console.log('sdfa', e)
+			setTimeout(() => {
+				this.$emit("input", this.search);
+			});
 		}
 	}
+};
 </script>
 
 <style lang="scss" scoped>
-	.app-search-module {
+.app-search-module {
+	width: 100%;
+	@include disFlex(center, space-between);
+	.map-search {
+		@include disFlex(center, flex-start);
 		width: 100%;
-		@include disFlex(center, space-between);
-		.map-search {
-			@include disFlex(center, flex-start);
-			width: 100%;
-			height: 100%;
-			border-radius: 10px;
-			.icon-wrap {
-				margin-left: 20px;
-				width: 40px;
-				.iconfont {
-					color: #ccc;
-					font-size: 32px;
-				}
-			}
-			.input-wrap {
-				width: calc(100% - 90px);
-				margin-left: 14px;
-				input {
-					font-size: 26px;
-					text-align: left;
-				}
-				.placeholder {
-					color: #ccc;
-				}
+		height: 100%;
+		border-radius: 10px;
+		.icon-wrap {
+			margin-left: 20px;
+			width: 40px;
+			.iconfont {
+				color: #ccc;
+				font-size: 32px;
 			}
 		}
-		// 按钮
-		.search-btn {
-			height: 100%;
-			padding: 0 20px;
-			flex-shrink: 0;
-			margin-left: 20px;
-			background-color: inherit;
+		.input-wrap {
+			width: calc(100% - 90px);
+			margin-left: 14px;
+			input {
+				font-size: 26px;
+				text-align: left;
+			}
+			.placeholder {
+				color: #ccc;
+			}
 		}
 	}
+	// 按钮
+	.search-btn {
+		height: 100%;
+		padding: 0 20px;
+		flex-shrink: 0;
+		margin-left: 20px;
+		background-color: inherit;
+	}
+}
 </style>

+ 67 - 43
ghs/src/pagesArrears/details.vue

@@ -13,42 +13,47 @@
 						alt="商品图"
 					/>
 					<text class="name">
-						花禾家
+						{{ option.name || "" }}
 					</text>
 				</view>
 				<view class="price-item">
-					24,915.00
+					{{ option.debtAmount || "" }}
 				</view>
 			</view>
 		</view>
 		<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>
 		<view class="bar-view">
 			<template v-if="!isBatch">
 				<view class="info-view">
-					共 <text class="price">{{ detailsList.length }}</text> 笔
+					共 <text class="price">{{ num }}</text> 笔
 				</view>
 			</template>
 			<template v-else>
 				<view class="info-view">
 					已选 <text class="price">{{ selectList.length }}</text> 笔,
 					<text class="unit">¥</text>
-					<text class="price">2,902.00</text>
+					<text class="price">{{ totalAmount }}</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=""
+					@click="batchEvent"
 				>
 					批量收款
 				</button>
@@ -64,44 +69,24 @@
 <script>
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import DetailsItem from "./detailsItem";
+import { getOrderDebtListApi } from "@/api/arrears/index";
+import wexinPay from "@/utils/pay/wxPay";
 
 export default {
 	components: { AppWrapperEmpty, DetailsItem },
 	data() {
 		return {
 			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: {
 		selectList() {
 			let list = [];
@@ -116,6 +101,25 @@ export default {
 		}
 	},
 	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) {
 			for (let index = 0; index < this.detailsList.length; index++) {
 				const element = this.detailsList[index];
@@ -128,6 +132,26 @@ export default {
 					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("支付没有成功");
 		}
 	}
 };

+ 81 - 92
ghs/src/pagesArrears/list.vue

@@ -1,41 +1,39 @@
 <template>
 	<view class="order-page">
 		<view class="input-wrap">
-			<AppSearchModule placeholder="输入客户" @search="searchFn" />
+			<AppSearchModule v-model="name" placeholder="输入客户" @search="searchFn" />
 		</view>
 		<scroll-view scroll-y class="shop-list">
-			<view class="shop-item" v-for="(item, index) in orderList" :key="index">
-				<view class="item-header">
-					<image
-						class="logo"
-						src="https://img.huaml.com/uploads/12358/202005/29/de74c55596d304b85e79154958e8bf57_small.jpeg"
-						alt="商品图"
-					/>
-					<text class="name">国兰花尚-文灶店 </text>
-				</view>
-				<view class="item-main">
-					<view class="phone">15280215347 </view>
-					<view 
-						@click="pageTo({
-							url: '/pagesOrder/detail',
-							query: {
-								id: 0
-							}
-						})"
-						class="price"
-						>¥580.50 <text class="iconfont iconxiangyou"></text>
+			<block v-if="!$util.isEmpty(list.data)">
+				<view class="shop-item" v-for="(item, index) in list.data" :key="index">
+					<view class="item-header">
+						<image
+							class="logo"
+							src="https://img.huaml.com/uploads/12358/202005/29/de74c55596d304b85e79154958e8bf57_small.jpeg"
+							alt="商品图"
+						/>
+						<text class="name">{{ item.name }} </text>
+					</view>
+					<view class="item-main">
+						<view class="phone">{{ item.mobile }} </view>
+						<view @click="gotoDetailsEvent(item)" class="price"
+							>¥{{ item.debtAmount }} <text class="iconfont iconxiangyou"></text>
+						</view>
 					</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">
-				共44笔,合计
+				共{{ customNum }}笔,合计
 				<text class="unit">
 				</text>
 				<text class="price">
-					7867531.95
+					{{ debtAmount }}
 				</text>
 			</view>
 		</view>
@@ -44,80 +42,71 @@
 <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 {
-			tabs: [
-				{
-					name: "全部",
-					key: "25",
-					value: "25"
-				},
-				{
-					name: "待确认",
-					key: "01",
-					value: "25"
-				},
-				{
-					name: "待配送",
-					key: "02",
-					value: "25"
-				},
-				{
-					name: "配送中",
-					key: "03",
-					value: "25"
-				},
-				{
-					name: "已完成",
-					key: "03",
-					value: "25"
-				},
-				{
-					name: "未完成",
-					key: "03",
-					value: "25"
-				},
-				{
-					name: "未完成",
-					key: "03",
-					value: "25"
-				},
-				{
-					name: "未完成",
-					key: "03",
-					value: "25"
-				}
-			],
-			orderList: [
-				{
-					orderNo: "PD20201217212800156",
-					name: "小许",
-					dateTime: "2020-7-10 21:50",
-					count: "101",
-					status: "01",
-					statusName: "已出库"
-				},
-				{
-					orderNo: "PD20201217212800156",
-					name: "小许",
-					dateTime: "2020-7-10 21:50",
-					count: "101",
-					status: "02",
-					statusName: "待出库"
-				},
-				{
-					orderNo: "PD20201217212800156",
-					name: "小许",
-					dateTime: "2020-7-10 21:50",
-					count: "101",
-					status: "03",
-					statusName: "已取消"
-				}
-			]
+			name: "",
+			customNum: "",
+			debtAmount: ""
 		};
+	},
+	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 = debtAmount;
+
+					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: () => {}
+			// });
+
+			this.pageTo({
+				url: "/pagesArrears/details",
+				query: {
+					id: item.id
+				}
+			});
+		},
+		searchFn() {
+			this.resetList();
+			this.init();
+		}
 	}
 };
 </script>