leaf 5 месяцев назад
Родитель
Сommit
02269c3c01

+ 6 - 2
lib/link.ts

@@ -52,12 +52,16 @@ export const back = () => {
 export const login = () => {
 	let url : String
 	// #ifdef MP-WEIXIN
-	url = '/pages/user/login'
+	url = '/pages/login/index'
 	// #endif
 	// #ifdef APP
-	url = '/pages/user/login_other'
+	url = '/pages/login/index'
 	// #endif
 	uni.navigateTo({
 		url: url,
 	})
+}
+// 地址列表
+export const goAddressList = () => {
+	navto('/pages/address/index')
 }

+ 6 - 0
pages.json

@@ -1,6 +1,12 @@
 {
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
+			"path": "pages/address/index",
+			"style": {
+				"navigationBarTitleText": "我的地址"
+			}
+		},
+		{
 			"path": "pages/cfList/index",
 			"style": {
 				"navigationBarTitleText": "中医用药一件事"

+ 277 - 0
pages/address/index.vue

@@ -0,0 +1,277 @@
+<template>
+	<view class="address-page">
+		<view class="address-section">
+			<pub-list-scroll @next="onScrollTolower" :loaded="loaded" :text="loadText" :status="status">
+				<view class="no-data" v-if="!list || list.length == 0">
+					<image mode="heightFix" src="/static/image/no-data.png" />
+					暂无数据
+				</view>
+				<view class="address-list" v-else>
+					<view v-for="(item,index) in list" :key="'cf'+index" class="address-item" @click="onClickItem(item.id)"
+						:class="item.id==curAddressId?'is-active':''">
+						<view class="row address-item-top">
+							<view>{{item.name}}</view>
+							<view>{{item.phone}}</view>
+						</view>
+						<view class="">{{item.addr}}</view>
+						<view class="address-item-bottom">
+							<view class="row">
+								<text class="iconfont checkbox is-active" v-if="item.isDefault">&#xe63b;</text>
+								<text class="iconfont checkbox" v-else>&#xe8bb;</text>
+								默认收件地址
+							</view>
+							<view class="row">
+								<view class="row"><text class="iconfont">&#xe6ae;</text>编辑</view>
+								<view class="row next-btn"><text class="iconfont">&#xe626;</text>删除</view>
+							</view>
+						</view>
+					</view>
+				</view>
+			</pub-list-scroll>
+		</view>
+		<view class="pub-button is-bg large">新增地址</view>
+		<!-- 弹窗 -->
+		<uni-popup ref="confirmPopup" type="dialog">
+			<uni-popup-dialog type="info" cancelText="取消" confirmText="确定" content="确定使用快递配送" @confirm="onApply"
+				@close="onCancel"></uni-popup-dialog>
+		</uni-popup>
+	</view>
+</template>
+
+<script lang="ts" setup>
+	import { ref, onMounted } from 'vue'
+	import dlg from '@/lib/dlg'
+
+	const loaded = ref(false)
+	const loadText = ref('数据加载中...')
+	const status = ref('loading')
+	const list = ref() //处方列表
+	const queryParams = ref({
+		pageNo: 1,
+		pageSize: 10,
+		total: 0,
+		status: 2
+	})
+	const confirmPopup = ref() // 弹出层
+
+
+	const curAddressId = ref()
+	const _list = [{
+		id: 1,
+		name: '沈国军',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋',
+		isDefault: true
+	},
+	{
+		id: 2,
+		name: '沈国军1',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋'
+	}, {
+		id: 3,
+		name: '沈国军2',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋'
+	}, {
+		id: 4,
+		name: '沈国军3',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋'
+	}, {
+		id: 5,
+		name: '沈国军4',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋'
+	}, {
+		id: 6,
+		name: '沈国军5',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋'
+	}, {
+		id: 7,
+		name: '沈国军6',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋'
+	}, {
+		id: 8,
+		name: '沈国军7',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋'
+	}, {
+		id: 9,
+		name: '沈国军8',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋'
+	}, {
+		id: 10,
+		name: '沈国军9',
+		phone: '173****4682',
+		addr: '江苏省苏州市相城区元和街道尚景花苑11栋'
+	}]
+
+	const onSearch = (val) => {
+
+	}
+
+	const onSearchCancel = () => {
+
+	}
+	const onClickItem = (id : number) => {
+		curAddressId.value = id;
+		confirmPopup.value.open('center')
+	}
+
+	const onCancel = () => {
+		console.log("onCancel")
+	}
+	const onApply = () => {
+		console.log("onApply")
+	}
+
+	const getList = async () => {
+		try {
+			loaded.value = true;
+			let res = ''
+
+
+			if (!list.value) {
+				list.value = _list;
+			} else {
+				list.value = list.value.concat(_list);
+			}
+
+			// queryParams.value.total = res.total
+			// if (res.total && queryParams.value.pageNo >= queryParams.value.total / queryParams.value.pageSize) {
+			// 	status.value = "noMore"
+			// }
+		} catch (e) {
+			dlg.error(e)
+		} finally {
+			loaded.value = false;
+		}
+	}
+
+	//下一页
+	const onScrollTolower = async () => {
+		console.log("onScrollTolower")
+		if (!list.value || queryParams.value.pageNo > (queryParams.value.total / queryParams.value.pageSize)) {
+			return false;
+		}
+		if (queryParams.value.pageNo < queryParams.value.total / queryParams.value.pageSize) {
+			status.value = "loading";
+		} else {
+			status.value = "noMore"
+			return;
+		}
+		queryParams.value.pageNo++;
+		getList();
+	}
+
+	const onUpdate = (isMasked : boolean) => {
+
+	}
+
+	onMounted(() => {
+		getList()
+	})
+</script>
+
+<style lang="scss" scoped>
+	.address-page {
+		display: flex;
+		flex-direction: column;
+		height: 100%;
+
+		.address-section {
+			flex: 1;
+			overflow-y: auto;
+			margin-top: 16rpx;
+
+			.no-data {
+				margin-top: 160rpx;
+				@include flex-center;
+				flex-direction: column;
+
+				image {
+					width: 320rpx;
+					height: 320rpx;
+					margin-bottom: 48rpx;
+					color: $uni-text-color-light;
+				}
+			}
+
+			.address-list {
+
+				.address-item {
+					background: #fff;
+					margin-bottom: 24rpx;
+					padding: 24rpx 32rpx 16rpx;
+					color: $uni-text-color-grey;
+					border: 1px solid #fff;
+
+					.row {
+						@include flex;
+					}
+
+					.address-item-top {
+						font-size: $uni-font-size-lg;
+						line-height: $uni-line-height-lg;
+						color: $uni-text-color;
+						margin-bottom: 24rpx;
+
+						>view+view {
+							margin-left: 32rpx;
+						}
+					}
+
+					.address-item-bottom {
+						border-top: 1px solid $uni-border-color;
+						margin-top: 24rpx;
+						padding-top: 16rpx;
+						@include flex-between;
+						font-size: $uni-font-size-sm;
+						line-height: $uni-line-height-sm;
+
+						.iconfont {
+							font-size: 36rpx;
+							margin-right: 8rpx;
+
+							&.checkbox {
+								margin-right: 16rpx;
+								color: $uni-text-color-disable;
+							}
+
+							&.is-active {
+								color: $uni-color-primary;
+							}
+
+
+						}
+
+						.next-btn {
+							margin-left: 32rpx;
+						}
+					}
+
+					&.is-active {
+						border: 1px solid $uni-color-primary;
+						box-sizing: border-box;
+					}
+
+
+
+				}
+			}
+
+			::v-deep .scroll-view {
+				height: calc(100%);
+			}
+		}
+
+		.pub-button {
+			margin-left: 32rpx;
+			margin-right: 32rpx;
+		}
+	}
+</style>

+ 4 - 1
pages/cfList/index.vue

@@ -11,7 +11,7 @@
 					<view v-for="(item,index) in list" :key="'cf'+index" class="cf-item">
 						<view class="cf-item-title">
 							<view><text class="label">开方日期</text>{{item.date}}</view>
-							<view class="cf-item-title-addr">
+							<view class="cf-item-title-addr" @click="link.goAddressList()">
 								<text class="iconfont">&#xe692;</text>
 								填写收货地址
 							</view>
@@ -35,8 +35,11 @@
 	import { ref, onMounted } from 'vue'
 	import dlg from '@/lib/dlg'
 	import rest from '@/stores/rest'
+	import * as link from '@/lib/link'
+
 	import TopCard from '../index/TopCard.vue'
 
+
 	const loaded = ref(false)
 	const loadText = ref('数据加载中...')
 	const status = ref('loading')

+ 2 - 0
pages/login/index.vue

@@ -42,6 +42,7 @@
 			border-radius: $uni-border-radius-r1;
 			width: calc(100% - 194rpx);
 			padding: 40rpx $page-row-spacing 16rpx;
+			box-sizing: border-box;
 
 			.login-title {
 				font-size: $uni-font-size-xl;
@@ -54,6 +55,7 @@
 				:deep(.uni-easyinput__content) {
 					border-color: $uni-border-color !important;
 					border-radius: 4rpx;
+
 					.uni-easyinput__content-input {
 						height: 88rpx;
 						font-size: $uni-font-size-lg;

+ 4 - 3
uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue

@@ -323,10 +323,10 @@
 				const paddingRight =
 					this.type === 'password' || this.clearable || this.prefixIcon ?
 					'' :
-					'10px';
+					'32rpx';
 				return obj2strStyle({
 					'padding-right': paddingRight,
-					'padding-left': this.prefixIcon ? '' : '10px'
+					'padding-left': this.prefixIcon ? '' : '32rpx'
 				});
 			}
 		},
@@ -627,7 +627,8 @@
 	}
 
 	.content-clear-icon {
-		padding: 0 5px;
+		// padding: 0 5px;
+		padding: 0 32rpx;
 	}
 
 	.label-icon {

+ 41 - 20
uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue

@@ -1,14 +1,14 @@
 <template>
-	<view class="uni-popup-dialog">
-		<view class="uni-dialog-title">
+	<view class="uni-popup-dialog" :style="getDialogStyle()">
+		<view class="uni-dialog-title" v-if="title">
 			<text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{titleText}}</text>
 		</view>
-		<view v-if="mode === 'base'" class="uni-dialog-content">
+		<view v-if="mode === 'base'" class="uni-dialog-content" :class="title?'has-title':''">
 			<slot>
 				<text class="uni-dialog-content-text">{{content}}</text>
 			</slot>
 		</view>
-		<view v-else class="uni-dialog-content">
+		<view v-else class="uni-dialog-content" :class="title?'has-title':''">
 			<slot>
 				<input class="uni-dialog-input" :maxlength="maxlength" v-model="val" :type="inputType"
 					:placeholder="placeholderText" :focus="focus">
@@ -210,6 +210,14 @@
 			},
 			close() {
 				this.popup.close()
+			},
+			getDialogStyle() {
+				//离屏幕上方间距为128dp,左右边距为48dp
+				const systemInfo = uni.getSystemInfoSync();
+				console.log("systemInfo.screenWidth", systemInfo.screenWidth);
+				return {
+					width: `calc(${systemInfo.screenWidth}px - 194rpx)` //
+				}
 			}
 		}
 	}
@@ -217,8 +225,9 @@
 
 <style lang="scss">
 	.uni-popup-dialog {
-		width: 300px;
-		border-radius: 11px;
+		// width: calc(100vh/2 - 168rpx); // 300px;
+		// width: calc(100vh/2);
+		border-radius: 24rpx;
 		background-color: #fff;
 	}
 
@@ -228,12 +237,18 @@
 		/* #endif */
 		flex-direction: row;
 		justify-content: center;
-		padding-top: 25px;
+		padding-top: 40rpx;
+		// font-size: $uni-font-size-xl;
+		// line-height: $uni-line-height-xl;
+		// font-weight: 600;
+		// color: $uni-text-color;
 	}
 
 	.uni-dialog-title-text {
-		font-size: 16px;
-		font-weight: 500;
+		font-size: $uni-font-size-xl;
+		line-height: $uni-line-height-xl;
+		font-weight: 600;
+		color: $uni-text-color;
 	}
 
 	.uni-dialog-content {
@@ -243,12 +258,17 @@
 		flex-direction: row;
 		justify-content: center;
 		align-items: center;
-		padding: 20px;
+		padding: 40rpx 20px 32rpx;
+		color: $uni-text-color-grey;
+
+		&.has-title {
+			padding-top: 24rpx;
+		}
 	}
 
 	.uni-dialog-content-text {
-		font-size: 14px;
-		color: #6C6C6C;
+		font-size: 28rpx;
+		color: $uni-text-color-grey; //#6C6C6C;
 	}
 
 	.uni-dialog-button-group {
@@ -256,7 +276,7 @@
 		display: flex;
 		/* #endif */
 		flex-direction: row;
-		border-top-color: #f5f5f5;
+		border-top-color: $uni-border-color; //#f5f5f5;
 		border-top-style: solid;
 		border-top-width: 1px;
 	}
@@ -270,22 +290,23 @@
 		flex-direction: row;
 		justify-content: center;
 		align-items: center;
-		height: 45px;
+		height: 96rpx;
 	}
 
 	.uni-border-left {
-		border-left-color: #f0f0f0;
+		border-left-color: $uni-border-color; // #f0f0f0;
 		border-left-style: solid;
 		border-left-width: 1px;
 	}
 
 	.uni-dialog-button-text {
-		font-size: 16px;
-		color: #333;
+		font-size: $uni-font-size-xl;
+		line-height: $uni-line-height-xl;
+		color: $uni-text-color-grey; //#333;
 	}
 
 	.uni-button-color {
-		color: #007aff;
+		color: $uni-color-primary; //#007aff;
 	}
 
 	.uni-dialog-input {
@@ -311,6 +332,6 @@
 	}
 
 	.uni-popup__info {
-		color: #909399;
+		color: $uni-text-color; //#909399;
 	}
-</style>
+</style>