hmp 5 жил өмнө
parent
commit
4d260732c7

+ 104 - 0
pages/enterprise/comps/card.vue

@@ -0,0 +1,104 @@
+<template>
+	<view class="safe-area-inset-bottom">
+		<view class="card" v-for="(item,index) in list" :key="index">
+			<view class="item">
+				<view class="left">
+					<view class="tag" :class="item.tagColor">
+						<text>{{item.enterpriseName.substr(0,1)}}</text>
+					</view>
+					<view class="content">
+						<text class="text-cut-1">{{item.enterpriseName}}</text>
+						<text class="text-cut-1">{{item.residentialName}}</text>
+					</view>
+				</view>
+				<view class="right">
+					<image @click="callPhone(item.officeNum)" src="../../../static/index/call.png" mode=""></image>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			list: Array
+		},
+		data() {
+			return {
+				callPhone(phone) {
+					uni.showModal({
+						title: '提示',
+						content: `确定要拨打电话:${phone}吗?`,
+						success: function(res) {
+							if (res.confirm) {
+								uni.makePhoneCall({
+									phoneNumber: phone //仅为示例
+								});
+							}
+						}
+					});
+				}
+			}
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style lang="scss">
+	.card {
+		position: relative;
+		background-color: #FFFFFF;
+		padding: 35rpx;
+		margin: 20rpx;
+
+		.item {
+			display: flex;
+			justify-content: space-between;
+		}
+
+		.left {
+			display: flex;
+			width: 88%;
+
+			.tag {
+				border-radius: 50%;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				height: 80rpx;
+				width: 80rpx;
+				font-size: 32rpx;
+			}
+
+			.content {
+				padding-left: 30rpx;
+				display: flex;
+				flex-direction: column;
+
+				text:first-child {
+					font-size: 32rpx;
+				}
+
+				text:last-child {
+					font-size: 28rpx;
+					color: #9f9f9f;
+					padding-top: 15rpx;
+				}
+			}
+		}
+
+		.right {
+			display: flex;
+			justify-content: center;
+			align-items: center;
+
+			image {
+				width: 50rpx;
+				height: 50rpx;
+			}
+		}
+	}
+</style>

+ 50 - 0
pages/enterprise/enterprise.vue

@@ -0,0 +1,50 @@
+<template>
+	<view>
+		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
+			:up="upOption">
+			<card :list="list"></card>
+		</mescroll-body>
+	</view>
+</template>
+
+<script>
+	import card from "./comps/card.vue"
+	import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
+	export default {
+		mixins: [MescrollMixin], // 使用mixin
+		components: {
+			card
+		},
+		data() {
+			return {
+
+			}
+		},
+		methods: {
+			upCallback(mescroll) {
+				let params = {
+
+				}
+				try {
+					this.$api.enterprise.page(params).then(res => {
+						let data = res.data.records
+						data.forEach(item => {
+							item.tagColor = 'bg-' + this.ColorList[Math.floor(Math.random() * this
+								.ColorList.length)]
+						})
+						let total = res.data.total
+						mescroll.endBySize(data.length, total);
+						if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
+						this.list = this.list.concat(data); //追加新数据
+					})
+				} catch (e) {
+					this.mescroll.endErr()
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+
+</style>