cmy 2 سال پیش
والد
کامیت
b540abb974

+ 9 - 0
api/water.js

@@ -49,4 +49,13 @@ export function use_certificate(data) {
 		data
 	});
 }
+// 获取门店可用时间段
+export function storeday(data) {
+	return request({
+		url: '/api/order/storeday',
+		method: 'get',
+		data
+	});
+}
+
 

+ 220 - 36
pages/order/createOrder.vue

@@ -14,8 +14,8 @@
 			</view>
 		</view>
 		<!-- 地址 -->
-		<navigator v-if="tabCurrentIndex == 1" url="/pages/set/address?source=1" class="address-section">
-			<view class="order-content" v-if="addressData.real_name">
+		<navigator v-if="tabCurrentIndex == 1" url="/pages/set/address?source=1" class="address-section margin-b-30">
+			<view class="order-content " v-if="addressData.real_name">
 				<view class="cen">
 					<view class="top">
 						<text class="name">{{ addressData.real_name }}</text>
@@ -33,7 +33,7 @@
 				</view>
 			</view>
 		</navigator>
-		<navigator v-if="tabCurrentIndex == 2" url="/pages/order/shopList?type=1" class="address-section">
+		<navigator url="/pages/order/shopList?type=1" class="address-section">
 			<view class="shop-box" v-if="shopAddress.name">
 				<view class="shop-top flex">
 					<view class="flex shop-title">
@@ -49,7 +49,7 @@
 						电话:{{ shopAddress.phone }}
 					</view>
 					<text class="shop-address">
-						地区:{{ shopAddress._detailed_address }}
+						地区:{{shopAddress.address+shopAddress.detailed_address}}
 					</text>
 				</view>
 			</view>
@@ -61,7 +61,6 @@
 			</view>
 		</navigator>
 		<view class="goodsList">
-
 			<view class="goods-section" v-for="(ls, ind) in shopList" :key="ind">
 				<!-- 商品列表 -->
 				<view class="g-item">
@@ -84,14 +83,31 @@
 		</view>
 		<!-- 金额明细 -->
 		<view class="yt-list">
-			<view class="yt-list-cell b-b"  v-if="tabCurrentIndex == 2">
-				<text class="cell-tit clamp">姓名</text>
-				<input class="desc" type="text" v-model="addressData.real_name" placeholder="请填写备注信息" placeholder-class="placeholder" />
-			</view>
-			<view class="yt-list-cell b-b"  v-if="tabCurrentIndex == 2">
-				<text class="cell-tit clamp">手机号</text>
-				<input class="desc" type="text" v-model="addressData.phone" placeholder="请填写备注信息" placeholder-class="placeholder" />
-			</view>
+			<template v-if="tabCurrentIndex == 1">
+				<view class="yt-list-cell b-b">
+					<text class="cell-tit clamp">送货日期</text>
+					<view @click="openTime" class="desc">
+					<text v-if="day.day">
+						{{timeList[checkedTime].name+day.time}}
+					</text>
+					<text v-else>
+						请选择送货日期
+					</text>
+					</view>
+				</view>
+			</template>
+			<template v-if="tabCurrentIndex == 2">
+				<view class="yt-list-cell b-b">
+					<text class="cell-tit clamp">姓名</text>
+					<input class="desc" type="text" v-model="addressData.real_name" placeholder="请填写备注信息"
+						placeholder-class="placeholder" />
+				</view>
+				<view class="yt-list-cell b-b">
+					<text class="cell-tit clamp">手机号</text>
+					<input class="desc" type="text" v-model="addressData.phone" placeholder="请填写备注信息"
+						placeholder-class="placeholder" />
+				</view>
+			</template>
 			<view class="yt-list-cell b-b">
 				<text class="cell-tit clamp">运费</text>
 				<text class="cell-tip disabled">{{ Postage }}</text>
@@ -104,7 +120,7 @@
 
 
 		<view class="yt-list">
-			<view class="yt-list-cell b-b" v-if="fx" @click="payType='weixin'">
+			<view class="yt-list-cell b-b" @click="payType='weixin'">
 				<view class="cell-tit flex">
 					<image class="orderIcon" src="../../static/icon/orderWx.png" mode="widthFix"></image>
 					<text class="margin-l-10">微信支付</text>
@@ -145,6 +161,33 @@
 			</view>
 			<text class="submit" :class="{submitNo:payLoding}" @click="payLoding?'':submit()">提交订单</text>
 		</view>
+
+		<uni-popup class="alertTime" ref="popup" type="bottom">
+			<view class="alert-box position-relative">
+				<view class="alert-title ">
+					选择预计送达时间
+				</view>
+				<view class="tip iconfont iconclose" @click="$refs.popup.close()"></view>
+				<view class="flex">
+					<view class="left-title">
+						<view class="title" :class="{action:checkedTime==ind}" v-for="(item,ind) in  timeList"
+							@click="changeCheckedTime(item,ind)">
+							{{item.name+'('+item.day+')'}}
+						</view>
+					</view>
+					<view class="right-content">
+						<view class="list flex"  v-for="(item,ind) in  timeList[checkedTime].list" @click="checkedShopTime(item)">
+							<view class="time">
+								{{item.time}}
+							</view>
+							<view class="checked">
+								剩余:{{item.door_number-item.day_number}}
+							</view>
+						</view>
+					</view>
+				</view>
+			</view>
+		</uni-popup>
 	</view>
 </template>
 
@@ -161,6 +204,9 @@
 	import {
 		getUserInfo
 	} from '@/api/user.js';
+	import {
+		storeday
+	} from '@/api/water.js';
 	// #ifdef H5
 	import weixinObj from "@/plugin/jweixin-module/index.js";
 	// #endif
@@ -204,9 +250,57 @@
 				orderId: '', //订单id
 				now_money: 0, //余额
 				onShopId: -1, //默认-1为不存在商家id
-				system_store: [], //到店自提列表仓库
+				// 下单日期
+				day: {
+					day:'',
+					id:'',
+					time:''
+				},
+				// 当前选中的日期对象
+				checkedTime: 0,
+				// 保存每周日子
+				timeName: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
+				// 保存日期列表
+				timeList: [{
+					name: '今天',
+					day: '',
+					time: '',
+					list: []
+				}, {
+					name: '明天',
+					day: '',
+					time: '',
+					list: []
+				}, {
+					name: '',
+					day: '',
+					time: '',
+					list: []
+				}, {
+					name: '',
+					day: '',
+					time: '',
+					list: []
+				}]
 			};
 		},
+		watch: {
+			shopAddress(newValue, oldValue) {
+				console.log(newValue,'newValue');
+				for (let i = 0; i < this.timeList.length; i++) {
+					const item = this.timeList[i];
+					const day = `${item.time.getFullYear()}-${item.time.getMonth()+1}-${item.time.getDate()}`
+					storeday({
+						store_id:newValue.id,
+						day
+					}).then(({
+						data
+					}) => {
+						item.list= data;
+					});
+				}
+			}
+		},
 		onLoad(option) {
 			// 保存当前商品在购物车中的id
 			this.cartId = option.id;
@@ -216,8 +310,11 @@
 			}
 			this.loadData();
 			this.userinfo();
+			// 初始化送货时间
+			this.timeInit();
 		},
 		computed: {
+			// 计算是否免运费
 			Postage() {
 				let money = +this.moneyAll.storePostage;
 				if (money == 0) {
@@ -229,10 +326,43 @@
 			payAllMoney() {
 				return +this.moneyAll.totalPrice + +this.moneyAll.vipPrice;
 			},
-			...mapState('shop', ['shopDetail']),
-			...mapState(['fx'])
+			...mapState('shop', ['shopDetail'])
 		},
 		methods: {
+			checkedShopTime(item){
+				this.day = item;
+				this.$refs.popup.close();
+			},
+			// 选中的时间对象
+			changeCheckedTime(item, ind) {
+				this.checkedTime = ind;
+			},
+			// 打开弹窗
+			openTime() {
+				// 打开弹出窗
+				this.$refs.popup.open();
+			},
+			// 初始化送货时间
+			timeInit() {
+				// 保存当前时间
+				const startTime = new Date();
+				for (let i = 0; i < this.timeList.length; i++) {
+					const item = this.timeList[i]
+					// 保存今天时间戳
+					item.time = new Date(startTime.getTime() + 86400000 * i);
+					// 获取今日周几
+					item.day = this.timeName[item.time.getDay()];
+					if (!item.name) {
+						// 获取今日日期
+						item.name = `${item.time.getMonth()+1}月${item.time.getDate()}日`
+					}
+				}
+				console.log(this.timeList, 'this.timeList');
+			},
+			// 送货时间修改
+			changeTime(res) {
+				console.log(res);
+			},
 			// 加载用户基础信息
 			userinfo() {
 				getUserInfo({}).then(({
@@ -267,7 +397,7 @@
 				confirm({
 					cartId: obj.cartId + '',
 					longitude: uni.getStorageSync('CACHE_LONGITUDE'),
-					latitude:uni.getStorageSync('CACHE_LATITUDE'),
+					latitude: uni.getStorageSync('CACHE_LATITUDE'),
 				}).then(({
 					data
 				}) => {
@@ -276,6 +406,7 @@
 					obj.moneyAll = data.priceGroup; //金额数据
 					obj.orderKey = data.orderKey; //订单key
 					obj.shopAddress = data.system_store; //到店自提列表
+					obj.shopAddress.address = data.system_store.address.join(','); //到店自提列表
 					// 计算金额
 					this.payMoneyNub();
 				});
@@ -404,15 +535,14 @@
 			// 初次订单创建
 			firstCreateOrder() {
 				let obj = this;
-				// 获取下单页面数据
-				let prepage = obj;
+				console.log(obj.day,'obj.day');
 				let data = {
-					real_name: prepage.addressData.real_name, //联系人名称
-					phone: prepage.addressData.phone, //联系人号码
-					addressId: prepage.addressData.id, //支付地址id
+					real_name: obj.addressData.real_name, //联系人名称
+					phone: obj.addressData.phone, //联系人号码
+					addressId: obj.addressData.id, //支付地址id
 					useIntegral: 0, //是否积分抵扣1为是0为否
 					payType: obj.payType, //支付类型  weixin-微信 yue-余额
-					mark: prepage.desc, //备注
+					mark: obj.desc, //备注
 					// #ifdef H5
 					from: 'weixin', //来源
 					// #endif
@@ -423,11 +553,10 @@
 					from: 'app', //来源
 					// #endif
 					shipping_type: obj.tabCurrentIndex, //提货方式 1 快递 2自提
-					store_id:obj.shopAddress.id||''
+					store_id: obj.shopAddress.id || '',
+					day:obj.day.day,
+					door_id:obj.day.door_id
 				};
-				if(obj.tabCurrentIndex == 2) {
-					data.store_id = obj.shopAddress.id
-				}
 				// 生成订单
 				createOrderkey(data, obj.orderKey)
 					.then(({
@@ -472,9 +601,10 @@
 </script>
 
 <style lang="scss">
-	.content{
+	.content {
 		padding-bottom: 100rpx;
 	}
+
 	.address-section {
 		border-radius: 20rpx;
 		padding: 30rpx;
@@ -820,13 +950,16 @@
 			}
 		}
 	}
-	.shop-box{
+
+	.shop-box {
 		.shop-top {
 			width: 100%;
-			.shop-title{
+
+			.shop-title {
 				width: 0px;
 				flex-grow: 1;
 				justify-content: flex-start;
+
 				.shopImg {
 					height: 65rpx;
 					width: 65rpx;
@@ -834,12 +967,14 @@
 					margin-right: 20rpx;
 					flex-shrink: 0;
 				}
-				.shop-name{
+
+				.shop-name {
 					font-weight: bold;
 					font-size: $font-lg;
 				}
 			}
-			.shop-tip{
+
+			.shop-tip {
 				color: #FFF;
 				padding: 5rpx 10rpx;
 				font-size: $font-sm;
@@ -847,10 +982,59 @@
 				border-radius: 5rpx;
 			}
 		}
-		.shop-content{
-			color:  $font-color-light;
+
+		.shop-content {
+			color: $font-color-light;
 			font-size: $font-sm;
 		}
 	}
-	
+
+	.alertTime {
+		z-index: 1000;
+
+		.alert-box {
+			background-color: #FFF;
+			border-top-right-radius: 20rpx;
+			border-top-left-radius: 20rpx;
+			min-height: 70vh;
+			.right-content{
+				width: 70%;
+				.list{
+					padding: 20rpx 30rpx;
+					font-size: $font-sm;
+					border-bottom: 1px solid $border-color-light;
+				}
+			}
+			.left-title {
+				width: 30%;
+				align-self: flex-start;
+				.title {
+					padding: 30rpx;
+					text-align: center;
+					font-weight: bold;
+					font-size: $font-sm;
+					background-color: rgba(246, 246, 246, 1);
+
+					&.action {
+						background-color: #FFF;
+					}
+				}
+			}
+
+			.alert-title {
+				text-align: center;
+				padding: 30rpx;
+				line-height: 1;
+				font-weight: bold;
+			}
+
+			.tip {
+				position: absolute;
+				top: 30rpx;
+				right: 30rpx;
+				color: $font-color-disabled;
+				font-weight: bold;
+			}
+		}
+	}
 </style>

+ 2 - 0
pages/set/address.vue

@@ -169,6 +169,8 @@
 						district: data.countyName
 					},
 					detail: data.detailInfo,
+					longitude: data.longitude, //经度
+					latitude:data.latitude, //纬度
 					type: 1
 				}).then(function(e) {
 					uni.showToast({

+ 43 - 22
pages/set/addressManage.vue

@@ -22,7 +22,7 @@
 				</view>
 				<view class="flex listItem" >
 					<view class="flex titleBox">
-						<text class="title">地址</text>
+						<text class="title">省市区</text>
 					</view>
 					<view class="right flex">
 						<pickerAddress class="input" @change="onCityClick">{{addressDetail||'请选择地址'}}</pickerAddress>
@@ -30,27 +30,35 @@
 				</view>
 				<view class="flex listItem" >
 					<view class="flex titleBox">
-						<text class="title">门牌号</text>
+						<text class="title">定位</text>
+					</view>
+					<view class="right flex">
+						<input :disabled='true' class="input" type="text" v-model="addressData.locate_address" placeholder="请选择定位"
+							placeholder-class="placeholder"  @click="openAddress"/>
+					</view>
+				</view>
+				<view class="flex listItem" >
+					<view class="flex titleBox">
+						<text class="title">详细地址</text>
 					</view>
 					<view class="right flex">
 						<input class="input" type="text" v-model="addressData.area" placeholder="楼号、门牌"
 							placeholder-class="placeholder" />
 					</view>
 				</view>
+				<view class="list">
+					<view class="flex listItem" >
+						<view class="flex titleBox">
+							<text class="title">默认</text>
+						</view>
+						<view class="flex" style="justify-content: flex-end; margin-right: -20rpx;">
+							<switch :checked='addressData.default==1' style="transform:scale(0.7)" @change="switchChange"/>
+						</view>
+					</view>
+				</view>
 			</view>
-
 		</view>
-		<uni-list class="margin-t-20 margin-l-30 margin-r-30" style="border-radius: 20rpx;">
-			<uni-list-item
-				title="设为默认"
-				:switch-checked="addressData.default"
-				:show-switch="true"
-				:show-arrow="false"
-				switch-color="#5dbc7c"
-				@switchChange="switchChange"
-			></uni-list-item>
-		</uni-list>
-
+		
 		<view class="base-buttom" @click="confirm">提交</view>
 	</view>
 </template>
@@ -77,7 +85,10 @@
 						district: ''
 					},
 					area: '',
-					default: false
+					default: false,
+					longitude: '', //经度
+					latitude:'', //纬度
+					locate_address:''
 				},
 			};
 		},
@@ -96,9 +107,12 @@
 						city: data.city,
 						district: data.district
 					},
+					longitude: data.longitude, //经度
+					latitude:data.latitude, //纬度
 					area: data.detail,
-					default: data.is_default == 1,
-					id: data.id
+					default: data.is_default,
+					id: data.id,
+					locate_address:data.locate_address
 				};
 				this.addressDetail = data.province + data.city + data.district;
 			}
@@ -119,18 +133,21 @@
 				this.addressDetail = data.join('');
 			},
 			//地图选择地址
-			chooseLocation() {
+			openAddress() {
 				uni.chooseLocation({
 					success: data => {
 						console.log(data);
-						this.addressData.addressName = data.name;
-						this.addressData.address = data.name;
+						this.addressData.area = data.name;
+						this.addressData.locate_address = data.address;
+						this.addressData.longitude = data.longitude;
+						this.addressData.latitude = data.latitude;
+						
 					}
 				});
 			},
 			// 设置是否为默认地址
 			switchChange(e) {
-				this.addressData.default = e.value;
+				this.addressData.default = e.detail.value?1:0;
 			},
 			//提交
 			confirm() {
@@ -165,7 +182,10 @@
 					detail: data.area,
 					is_default: data.default,
 					id: data.id || "",
-					type: 1
+					type: 1,
+					longitude: data.longitude, //经度
+					latitude:data.latitude, //纬度
+					locate_address:data.locate_address
 				}).then(function(e) {
 					obj.$api.prePage().refreshList();
 					uni.showToast({
@@ -226,6 +246,7 @@
 		}
 
 		.titleBox {
+			margin-right: 10rpx;
 			.title {
 				color: $font-color-base;
 				font-size: $font-base;

+ 12 - 0
uni_modules/uni-popup/changelog.md

@@ -1,3 +1,15 @@
+## 1.8.3(2023-04-17)
+- 修复 uni-popup 重复打开时的 bug
+## 1.8.2(2023-02-02)
+- uni-popup-dialog 组件新增 inputType 属性
+## 1.8.1(2022-12-01)
+- 修复 nvue 下 v-show 报错
+## 1.8.0(2022-11-29)
+- 优化 主题样式
+## 1.7.9(2022-04-02)
+- 修复 弹出层内部无法滚动的bug
+## 1.7.8(2022-03-28)
+- 修复 小程序中高度错误的bug
 ## 1.7.7(2022-03-17)
 - 修复 快速调用open出现问题的Bug
 ## 1.7.6(2022-02-14)

+ 5 - 1
uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue

@@ -10,7 +10,7 @@
 		</view>
 		<view v-else class="uni-dialog-content">
 			<slot>
-				<input class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholderText" :focus="focus" >
+				<input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText" :focus="focus" >
 			</slot>
 		</view>
 		<view class="uni-dialog-button-group">
@@ -57,6 +57,10 @@
 		mixins: [popup],
 		emits:['confirm','close'],
 		props: {
+			inputType:{
+				type: String,
+				default: 'text'
+			},
 			value: {
 				type: [String, Number],
 				default: ''

+ 4 - 6
uni_modules/uni-popup/components/uni-popup/uni-popup.vue

@@ -1,6 +1,5 @@
 <template>
-	<view v-if="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']"
-		@touchmove.stop.prevent="clear">
+	<view v-if="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']">
 		<view @touchstart="touchstart">
 			<uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass"
 				:duration="duration" :show="showTrans" @click="onTap" />
@@ -189,7 +188,7 @@
 					safeAreaInsets
 				} = uni.getSystemInfoSync()
 				this.popupWidth = windowWidth
-				this.popupHeight = windowHeight + windowTop
+				this.popupHeight = windowHeight + (windowTop || 0)
 				// TODO fix by mehaotian 是否适配底部安全区 ,目前微信ios 、和 app ios 计算有差异,需要框架修复
 				if (safeArea && this.safeArea) {
 					// #ifdef MP-WEIXIN
@@ -269,9 +268,8 @@
 
 			open(direction) {
 				// fix by mehaotian 处理快速打开关闭的情况
-				if(this.showPopup){
-					clearTimeout(this.timer)
-					this.showPopup = false
+				if (this.showPopup) {
+					return
 				}
 				let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share']
 				if (!(direction && innerType.indexOf(direction) !== -1)) {

+ 5 - 8
uni_modules/uni-popup/package.json

@@ -1,7 +1,7 @@
 {
 	"id": "uni-popup",
 	"displayName": "uni-popup 弹出层",
-	"version": "1.7.7",
+	"version": "1.8.3",
 	"description": " Popup 组件,提供常用的弹层",
 	"keywords": [
         "uni-ui",
@@ -17,12 +17,8 @@
 	"directories": {
 		"example": "../../temps/example_temps"
 	},
-	"dcloudext": {
-		"category": [
-			"前端组件",
-			"通用组件"
-		],
-		"sale": {
+    "dcloudext": {
+        "sale": {
 			"regular": {
 				"price": "0.00"
 			},
@@ -38,7 +34,8 @@
 			"data": "无",
 			"permissions": "无"
 		},
-		"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
+        "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
+        "type": "component-vue"
 	},
 	"uni_modules": {
 		"dependencies": [

+ 2 - 0
uni_modules/uni-transition/changelog.md

@@ -1,3 +1,5 @@
+## 1.3.2(2023-05-04)
+- 修复 NVUE 平台报错的问题
 ## 1.3.1(2021-11-23)
 - 修复 init 方法初始化问题
 ## 1.3.0(2021-11-19)

+ 4 - 1
uni_modules/uni-transition/components/uni-transition/createAnimation.js

@@ -10,7 +10,10 @@ const nvueAnimation = uni.requireNativePlugin('animation')
 class MPAnimation {
 	constructor(options, _this) {
 		this.options = options
-		this.animation = uni.createAnimation(options)
+		// 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误
+		this.animation = uni.createAnimation({
+			...options
+		})
 		this.currentStepAnimates = {}
 		this.next = 0
 		this.$ = _this

+ 11 - 2
uni_modules/uni-transition/components/uni-transition/uni-transition.vue

@@ -1,5 +1,10 @@
 <template>
-	<view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
+  <!-- #ifndef APP-NVUE -->
+  <view v-show="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
+  <!-- #endif -->
+  <!-- #ifdef APP-NVUE -->
+  <view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
+  <!-- #endif -->
 </template>
 
 <script>
@@ -48,7 +53,11 @@ export default {
 		customClass:{
 			type: String,
 			default: ''
-		}
+		},
+		onceRender:{
+			type:Boolean,
+			default:false
+		},
 	},
 	data() {
 		return {

+ 4 - 7
uni_modules/uni-transition/package.json

@@ -1,7 +1,7 @@
 {
   "id": "uni-transition",
   "displayName": "uni-transition 过渡动画",
-  "version": "1.3.1",
+  "version": "1.3.2",
   "description": "元素的简单过渡动画",
   "keywords": [
     "uni-ui",
@@ -17,11 +17,7 @@
   "directories": {
     "example": "../../temps/example_temps"
   },
-  "dcloudext": {
-    "category": [
-      "前端组件",
-      "通用组件"
-    ],
+"dcloudext": {
     "sale": {
       "regular": {
         "price": "0.00"
@@ -38,7 +34,8 @@
       "data": "无",
       "permissions": "无"
     },
-    "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
+    "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
+    "type": "component-vue"
   },
   "uni_modules": {
     "dependencies": ["uni-scss"],