From 4f5cbfb0878d0d35ce01b7c32ade1807c067fd27 Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期四, 19 九月 2024 16:12:43 +0800
Subject: [PATCH] add 签到和其他页面细节

---
 plugins/util.js                                                       |    6 
 static/images/customer/coupon/icon-sign-home.png                      |    0 
 sub_pages/partner/delivery/delivery.vue                               |    2 
 pages.json                                                            |    8 +
 pages/user/user-customer.scss                                         |   10 +
 mixin/mixin.js                                                        |    1 
 static/images/customer/coupon/sign-main-bg.png                        |    0 
 static/images/customer/coupon/sign-icon-1-0.png                       |    0 
 sub_pages/customer/self/sign.vue                                      |  325 ++++++++++++++++++++++++++++++++++++++++
 sub_pages/supplier/order-manage/order-manage-settlement-op-detail.vue |    9 
 pages/user/supplier-user.vue                                          |   38 ++++
 sub_pages/customer/trade/detail.vue                                   |   37 +++-
 12 files changed, 417 insertions(+), 19 deletions(-)

diff --git a/mixin/mixin.js b/mixin/mixin.js
index ad5ad6e..2564b5f 100644
--- a/mixin/mixin.js
+++ b/mixin/mixin.js
@@ -50,6 +50,7 @@
 			// regAvatarUrl: 'https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png',
 			regUserName: '',
 			regAvatarUrl: '',
+			previewImgSign:false,
 		}
 	},
 	methods: {
diff --git a/pages.json b/pages.json
index 5a79e6f..2c619ce 100644
--- a/pages.json
+++ b/pages.json
@@ -494,6 +494,14 @@
 						"navigationBarTitleText": "会员中心",
 						"enablePullDownRefresh": true
 					}
+				},
+				{
+					"path": "self/sign",
+					"style": {
+						"navigationBarTitleText": "签到",
+						"enablePullDownRefresh": false,
+						"navigationStyle": "custom"
+					}
 				}
 				// #endif
 			]
diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue
index 5befef5..f47291c 100644
--- a/pages/user/supplier-user.vue
+++ b/pages/user/supplier-user.vue
@@ -189,10 +189,11 @@
 					<view>我的服务</view>
 				</view>
 				<view class="flex service-icons-container">
-					<view class="service-icons" @click="goto('/sub_pages/customer/self/follow',true)">
-						<image src="../../static/images/customer/service/service-icon-1.png" class="service-icon ">
+					<view class="service-icons" @click="goto('/sub_pages/customer/self/sign',true)">
+						<image src="../../static/images/customer/coupon/icon-sign-home.png" class="service-icon ">
 						</image>
-						<view>关注店铺</view>
+						<view>签到</view>
+						<view v-if="!signToday" class="dot"></view>
 					</view>
 					<view class="service-icons" @click="goto('/sub_pages/customer/self/collect',true)">
 						<image src="../../static/images/customer/service/service-icon-2.png" class="service-icon ">
@@ -244,6 +245,25 @@
 					</view>
 					<!-- #endif -->
 				</view>
+
+				<!-- #ifdef PUB_CUSTOMER -->
+				<view class="flex service-icons-container">
+					<view class="service-icons" @click="goto('/sub_pages/customer/self/follow',true)">
+						<image src="../../static/images/customer/service/service-icon-1.png" class="service-icon ">
+						</image>
+						<view>关注店铺</view>
+					</view>
+					<view class="service-icons">
+
+					</view>
+					<view class="service-icons">
+
+					</view>
+					<view class="service-icons">
+
+					</view>
+				</view>
+				<!-- #endif -->
 			</view>
 		</view>
 		<!-- #endif -->
@@ -458,6 +478,7 @@
 				tj: {},
 				tj_order: {},
 				cacheUserId: '',
+				signToday: false
 				// order_pendding_num: 0,
 
 			};
@@ -513,6 +534,17 @@
 		onShow() {
 			this.cacheUserId = ''
 			this.getTj()
+			// #ifdef PUB_CUSTOMER
+			let that = this
+			this.$http.request('get', '/api/customer/point/sign/sign/today', {}).then(res => {
+				if (res.data) {
+					that.signToday = true
+				}
+			})
+
+			// #endif
+			//判断有没有签到
+
 		},
 		onLoad(options) {
 			// const url = options.q ? decodeURIComponent(options.q) : '';
diff --git a/pages/user/user-customer.scss b/pages/user/user-customer.scss
index cf7811b..4be1e24 100644
--- a/pages/user/user-customer.scss
+++ b/pages/user/user-customer.scss
@@ -141,6 +141,7 @@
 			font-size: 24rpx;
 			color: #000000;
 			line-height: 34rpx;
+			position: relative;
 			.service-icon{
 				height: 52rpx;
 				width: 52rpx;
@@ -149,6 +150,15 @@
 				height: 52rpx;
 				width: 56rpx;
 			}
+			.dot{
+				position: absolute;
+				left: calc(50% + 30rpx);
+				top: 0rpx;
+				width: 10rpx;
+				height: 10rpx;
+				background: #CF0000;
+				border-radius: 50%;
+			}
 		}
 		
 	}
diff --git a/plugins/util.js b/plugins/util.js
index d569ad2..2067642 100644
--- a/plugins/util.js
+++ b/plugins/util.js
@@ -137,6 +137,12 @@
 		}
 		return ''
 	},
+	toMonth(date) {
+		if (date) {
+			return moment(date).format('MM-DD')
+		}
+		return ''
+	},
 	formatDate(date, format) {
 		if (date) {
 			return moment(date).format(format)
diff --git a/static/images/customer/coupon/icon-sign-home.png b/static/images/customer/coupon/icon-sign-home.png
new file mode 100644
index 0000000..001500e
--- /dev/null
+++ b/static/images/customer/coupon/icon-sign-home.png
Binary files differ
diff --git a/static/images/customer/coupon/sign-icon-1-0.png b/static/images/customer/coupon/sign-icon-1-0.png
new file mode 100644
index 0000000..8708cfa
--- /dev/null
+++ b/static/images/customer/coupon/sign-icon-1-0.png
Binary files differ
diff --git a/static/images/customer/coupon/sign-main-bg.png b/static/images/customer/coupon/sign-main-bg.png
new file mode 100644
index 0000000..e04984b
--- /dev/null
+++ b/static/images/customer/coupon/sign-main-bg.png
Binary files differ
diff --git a/sub_pages/customer/self/sign.vue b/sub_pages/customer/self/sign.vue
new file mode 100644
index 0000000..d40bd97
--- /dev/null
+++ b/sub_pages/customer/self/sign.vue
@@ -0,0 +1,325 @@
+<template>
+	<view class="sign-container ">
+		<image class="sign-bg" mode="aspectFit"
+			src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/e9/e95fc4312ac341cdb021f47803e3852fpu6Pi3C2PVVrf85eee3998d17ec30907cd7e2941388a.png">
+		</image>
+		<view class="sign-info p20">
+			<view class="title">
+				<uni-icons class="icon" type="left" size="24" @click="backpage()"></uni-icons>
+				签到
+			</view>
+			<view class="flex" style="margin-top: 40rpx;">
+				<image class="user-icon" v-if="
+					currentInfo.customerDTO&&currentInfo.customerDTO.cover
+					||currentInfo.supplierDTO&&currentInfo.supplierDTO.cover
+					|| currentInfo.picture
+					" :src="
+					currentInfo.customerDTO&&currentInfo.customerDTO.cover
+					||currentInfo.supplierDTO&&currentInfo.supplierDTO.cover
+					|| currentInfo.picture
+					" mode="scaleToFill"></image>
+				<image class="user-icon" v-else
+					src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png'
+					mode="scaleToFill"></image>
+				<view>
+					<view class="tj">
+						已经连续签到 <span class="b">{{signNum||0}}</span> 天
+					</view>
+					<view class="tip">
+						明日签到可获取1积分
+					</view>
+				</view>
+			</view>
+
+		</view>
+		<view class="sign-main-container">
+			<image mode="scaleToFill" src="../../../static/images/customer/coupon/sign-main-bg.png" class="bg"></image>
+			<view class="sign-icon-0"></view>
+			<image class="title-top" mode="scaleToFill"
+				src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/05/058b7bd0a5884c318e64329051739b0agwMJMk8Hhfccf336b87df7523e7e8799da761965becc.png">
+			</image>
+			<view class="calendar-list flex">
+				<view class="calendar-item"  :class="[item.sign?'sign':'',item.date==today?'today':'']" v-for="(item,index) of list" :key="index" @click="signToday(item)">
+					<view class="date">{{item.date==today?'今日':item.dateMonth}}</view>
+					<view class="sign-icon-1">
+
+					</view>
+					<view class="point">{{item.point || 1}}积分</view>
+
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				signNum: 0,
+				list: [],
+				today: ''
+			}
+		},
+		async onLoad() {
+			this.today = this.$util.toDate(new Date())
+			this.list = this.getAllDatesInCurrentMonth()
+			//请求
+			var start = this.list[0].date
+			var end = this.list[this.list.length - 1].date
+			this.$message.showLoading()
+			const {
+				code,
+				data
+			} = await this.$http.request('get', '/api/customer/point/sign/list', {
+				params: {
+					startDate: start,
+					endDate: end,
+				}
+			})
+			this.$message.hideLoading()
+			if (code == 0) {
+				for (var item of this.list) {
+					for (var j of data) {
+						if (j.recordDate && j.recordDate.startsWith(item.date)) {
+							item.sign = true
+							item.point = j.point || 1
+							this.signNum += 1
+							break
+						}
+					}
+				}
+			}
+
+		},
+		methods: {
+			async signToday(item) {
+				if (item.sign) {
+					return
+				}
+				if (item.date === this.today) {
+
+				} else {
+					return
+				}
+				this.$message.showLoading()
+				const {
+					code,
+					data
+				} = await this.$http.request('post', '/api/customer/point/sign/in', {
+
+				})
+				this.$message.hideLoading()
+				if (code == 0) {
+					this.$message.showToast('签到成功')
+					item.sign = true
+					this.signNum += 1
+					this.$forceUpdate()
+				}
+
+			},
+			getAllDatesInCurrentMonth() {
+				const dates = [];
+				const currentDate = new Date();
+				const currentYear = currentDate.getFullYear();
+				const currentMonth = currentDate.getMonth(); // 月份是从0开始的,0代表1月
+
+				// 获取当前月的第一天
+				const firstDay = new Date(currentYear, currentMonth, 1);
+				// 获取当前月的最后一天
+				const lastDay = new Date(currentYear, currentMonth + 1, 0);
+
+				for (let day = firstDay.getDate(); day <= lastDay.getDate(); day++) {
+					dates.push({
+						// date:new Date(currentYear, currentMonth, day),
+						date: this.$util.toDate(new Date(currentYear, currentMonth, day)),
+						dateMonth: this.$util.toMonth(new Date(currentYear, currentMonth, day)),
+						sign: false,
+						point: 1,
+					});
+				}
+
+				return dates;
+			}
+
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	.sign-container {
+		position: relative;
+
+		.sign-main-container {
+			.bg {
+				// background-image: url('@/static/images/customer/coupon/sign-main-bg.png');
+				height: 440rpx;
+				// left: 0rpx;
+				// right: 0rpx;
+				position: absolute;
+				top: -20rpx;
+				max-width: 690rpx;
+				min-width: 690rpx;
+				;
+				z-index: -1;
+			}
+
+			// background-color: #fff;
+			// background-size: 100% 50%;
+			min-height: 444rpx;
+			// padding: 20rpx;
+			position: absolute;
+			top: 400rpx;
+			left: 20rpx;
+			right: 20rpx;
+			// z-index: -
+
+			.calendar-list {
+				max-width: 650rpx;
+				padding: 20rpx;
+				background-color: #fff;
+				margin-top: 20rpx;
+
+				.calendar-item {
+					width: 120rpx;
+					height: 136rpx;
+					background: #E7F4E8;
+					border-radius: 8rpx;
+					border: 2rpx solid #E7F4E8;
+					text-align: center;
+					padding-top: 20rpx;
+					padding-bottom: 20rpx;
+					margin: 0 auto;
+					margin-bottom: 20rpx;
+
+					.date {
+						font-weight: 400;
+						font-size: 24rpx;
+						color: #000000;
+						line-height: 40rpx;
+					}
+
+					.sign-icon-1 {
+						width: 44rpx;
+						height: 44rpx;
+						margin: 0 auto;
+						background-image: url('@/static/images/customer/coupon/sign-icon-1-0.png');
+						background-size: 100% 100%;
+
+					}
+
+					.point {
+						font-weight: 400;
+						font-size: 24rpx;
+						color: #20613D;
+						line-height: 40rpx;
+					}
+				}
+
+				.calendar-item.sign {
+					border: 2rpx solid #87C48C;
+
+					.sign-icon-1 {
+						background-image: url("https://hmy-flower.oss-cn-shanghai.aliyuncs.com/02/02cf142651e84ddab6d2b334fedf3efa5FUKyuraE1U97cfcc36775df368c2f9b34abc8b527d6.png");
+						background-size: 100% 100%;
+
+					}
+				}
+
+				.calendar-item.today {
+					border: 2rpx solid #87C48C;
+					background: linear-gradient(180deg, #D5F2D8 0%, #8BDF92 100%);
+				}
+			}
+
+			.sign-icon-0 {
+				position: absolute;
+				right: 0rpx;
+				top: -70rpx;
+				width: 172rpx;
+				height: 148rpx;
+				background-size: 100% 100%;
+
+				background-image: url("https://hmy-flower.oss-cn-shanghai.aliyuncs.com/24/242efb615f4e4827bdda1b252906db9bIcLxoETs7MXVc85f821ae127c62dbe772349d1e6951e.png");
+			}
+
+			.title-top {
+				// background-image: url("https://hmy-flower.oss-cn-shanghai.aliyuncs.com/05/058b7bd0a5884c318e64329051739b0agwMJMk8Hhfccf336b87df7523e7e8799da761965becc.png");
+				width: 346rpx;
+				height: 42rpx;
+				// margin-top: 20rpx;
+				margin: 20rpx;
+				margin-left: 40rpx;
+			}
+		}
+
+		.sign-info {
+			position: absolute;
+			left: 0rpx;
+			top: 80rpx;
+			right: 0rpx;
+
+			.title {
+				text-align: center;
+				font-weight: 600;
+				font-size: 32rpx;
+				position: relative;
+
+				.icon {
+					position: absolute;
+					left: 0rpx;
+					z-index: 1;
+				}
+			}
+
+			.user-icon {
+				width: 110rpx;
+				height: 110rpx;
+				margin-right: 20rpx;
+				border-radius: 50%;
+			}
+
+			.tj {
+				margin-left: 48rpx;
+				font-weight: 400;
+				font-size: 28rpx;
+				color: #000000;
+				line-height: 40rpx;
+				margin-bottom: 10rpx;
+
+				.b {
+					font-size: 42rpx;
+					font-weight: 600;
+				}
+			}
+
+			.tip {
+				background: linear-gradient(to right, #D8ECDA, #E8F3E9);
+				padding: 10rpx 20rpx;
+				border-radius: 20rpx;
+				font-weight: 400;
+				font-size: 28rpx;
+				color: #619663;
+				line-height: 40rpx;
+				text-align: left;
+				margin-top: 10rpx;
+			}
+
+		}
+
+
+
+		.sign-bg {
+			// background-image: url("https://hmy-flower.oss-cn-shanghai.aliyuncs.com/e9/e95fc4312ac341cdb021f47803e3852fpu6Pi3C2PVVrf85eee3998d17ec30907cd7e2941388a.png");
+			width: 750rpx;
+
+			min-height: 482rpx;
+			position: relative;
+		}
+
+
+
+
+
+	}
+</style>
\ No newline at end of file
diff --git a/sub_pages/customer/trade/detail.vue b/sub_pages/customer/trade/detail.vue
index 47038ab..94e1c05 100644
--- a/sub_pages/customer/trade/detail.vue
+++ b/sub_pages/customer/trade/detail.vue
@@ -14,7 +14,10 @@
 						</view>
 					</swiper-item>
 					<swiper-item v-for="(url, index) in dto.bannerList" :key="index">
-						<image class="top-img" :lazy-load="true" mode="aspectFill" @click="previewImg(url)" :src="url">
+						<image class="top-img" :lazy-load="true" mode="aspectFill" @click="()=>{
+							previewImgSign = true;
+							previewImg(url);
+						}" :src="url">
 						</image>
 						<view class="index-tag">
 							{{index+1+(dto.video&&1)}}/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}}
@@ -22,8 +25,10 @@
 					</swiper-item>
 
 					<swiper-item>
-						<image :src="dto.cover" :lazy-load="true" @click="previewImg(dto.cover)" class="top-img"
-							mode="aspectFill">
+						<image :src="dto.cover" :lazy-load="true" @click="()=>{
+							previewImgSign = true;
+							previewImg(dto.cover);
+						}" class="top-img" mode="aspectFill">
 						</image>
 						<view class="index-tag">
 							{{(dto.bannerList&&dto.bannerList.length||0)+1+(dto.video&&1||0)}}/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}}
@@ -76,7 +81,7 @@
 					<view class="price m-r-a component-price-new">
 						<span class="tip">会员价</span><span class="num p">{{ dto.priceMember || dto.price || '-' }}</span>
 						元/扎
-				
+
 					</view>
 					<view class="price m-r-a component-price-old">
 						<!-- <span class="num">{{ dto.price || '-' }}</span> -->
@@ -86,8 +91,8 @@
 				</view>
 
 
-				
-				
+
+
 				<view class="m-l-a m-r-15">
 					<button open-type="contact" class="component-button-contact">
 						<image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image>
@@ -223,13 +228,18 @@
 				dto: {},
 				shopnum: 0,
 				sharePartnerUserId: '',
+				previewImgSign: false,
 			}
 		},
 		onShow() {
-			if (this.id) {
-				this.getDetail()
+			if (!this.previewImgSign) {
+				if (this.id) {
+					this.getDetail()
+				}
+				this.refreshShopNum()
 			}
-			this.refreshShopNum()
+			this.previewImgSign = false
+
 		},
 		async onLoad(options) {
 			console.log('trade detail options', options)
@@ -244,8 +254,8 @@
 				// setTimeout(() => {
 				//并且当前用户没有绑定
 				if (tmp.currentInfo.id && tmp.currentInfo.customerDTO.partnerId) {
-					
-				}else{
+
+				} else {
 					if (tmp.currentInfo.id) {
 						await tmp.bindPartnerUser(options.partnerUserId, '')
 					} else {
@@ -256,7 +266,7 @@
 						}
 					}
 				}
-					
+
 
 				// }, 1000)
 			}
@@ -562,6 +572,7 @@
 		.swiper-box {
 			position: relative;
 			border-bottom: 1px solid #d3d4d7;
+
 			swiper-item {
 				background-color: #fff;
 				border-radius: 8rpx;
@@ -616,7 +627,7 @@
 					margin-right: 6rpx;
 					text-align: center;
 				}
-				
+
 				.tag.green {
 					color: rgba(110, 159, 102, 1);
 					background: rgba(202, 229, 214, 1);
diff --git a/sub_pages/partner/delivery/delivery.vue b/sub_pages/partner/delivery/delivery.vue
index e33a520..861eb13 100644
--- a/sub_pages/partner/delivery/delivery.vue
+++ b/sub_pages/partner/delivery/delivery.vue
@@ -1,7 +1,7 @@
 <script>
 	export default {
 		data() {
-			var defaultDatePre = new Date(new Date().getTime() - 24 * 3600 * 1000)
+			var defaultDatePre = new Date(new Date().getTime())
 			return {
 				query: {
 					supplierName: '',
diff --git a/sub_pages/supplier/order-manage/order-manage-settlement-op-detail.vue b/sub_pages/supplier/order-manage/order-manage-settlement-op-detail.vue
index 55feea7..e084707 100644
--- a/sub_pages/supplier/order-manage/order-manage-settlement-op-detail.vue
+++ b/sub_pages/supplier/order-manage/order-manage-settlement-op-detail.vue
@@ -7,7 +7,7 @@
 				},
 				orderItemId: '',
 				op: '',
-				opStr:''
+				opStr: ''
 			};
 		},
 		async onLoad(options) {
@@ -26,10 +26,15 @@
 
 		methods: {
 			async init() {
+				var apitype = 'supplier'
+				// #ifdef PUB_CUSTOMER
+				apitype = 'customer'
+				// #endif
+
 				this.$message.showLoading()
 				const {
 					data
-				} = await this.$http.request('get', `/api/supplier/delivery/mine/list/check/info/` + this.op, {
+				} = await this.$http.request('get', `/api/${apitype}/delivery/mine/list/check/info/` + this.op, {
 					params: {
 						orderItemId: this.orderItemId
 					}

--
Gitblit v1.9.3