瀏覽代碼

疗法滚动弹幕
中药打折券

XSLu08042 1 月之前
父節點
當前提交
9d21518c2e
共有 6 個文件被更改,包括 236 次插入19 次删除
  1. 3 1
      api/package.js
  2. 11 7
      pages/TUIKit/utils/date.ts
  3. 1 1
      pages/index/index.vue
  4. 107 3
      pages_company/packageDetails.vue
  5. 108 4
      pages_index/packageDetails.vue
  6. 6 3
      pages_order/storeOrderPay.vue

+ 3 - 1
api/package.js

@@ -15,7 +15,9 @@ let request = new Request().http
  export function getPackageDoctorList(data) {
  	 return request('/app/package/getPackageDoctorList',data,'GET');
  }
- 
+ export function getNewOrderByPackageId(data) {
+ 	 return request('/app/packageOrder/getNewOrderByPackageId',data,'GET');
+ }
  
  
  

+ 11 - 7
pages/TUIKit/utils/date.ts

@@ -21,7 +21,7 @@ export function formatTime(secondTime:number) {
   return newTime;
 }
 
-export function caculateTimeago(dateTimeStamp:number) {
+export function caculateTimeago(dateTimeStamp:number,type: any) {
   const minute = 1000 * 60;      // 把分,时,天,周,半个月,一个月用毫秒表示
   const hour = minute * 60;
   const day = hour * 24;
@@ -48,12 +48,16 @@ export function caculateTimeago(dateTimeStamp:number) {
   } else if (diffValue >= 0 && diffValue <= minute) {
     result = '刚刚';
   } else {
-    const datetime = new Date();
-    datetime.setTime(dateTimeStamp);
-    const Nyear = datetime.getFullYear();
-    const Nmonth = datetime.getMonth() + 1 < 10 ? `0${datetime.getMonth() + 1}` : datetime.getMonth() + 1;
-    const Ndate = datetime.getDate() < 10 ? `0${datetime.getDate()}` : datetime.getDate();
-    result = `${Nyear}-${Nmonth}-${Ndate}`;
+	if(type==1) {
+			result = '';  
+	} else {
+		const datetime = new Date();
+		datetime.setTime(dateTimeStamp);
+		const Nyear = datetime.getFullYear();
+		const Nmonth = datetime.getMonth() + 1 < 10 ? `0${datetime.getMonth() + 1}` : datetime.getMonth() + 1;
+		const Ndate = datetime.getDate() < 10 ? `0${datetime.getDate()}` : datetime.getDate();
+		result = `${Nyear}-${Nmonth}-${Ndate}`;
+	}
   }
   return result;
 }

+ 1 - 1
pages/index/index.vue

@@ -369,7 +369,7 @@
 		computed: {
 			bg: function() {
 				var top=this.top/120;
-				console.log(top)
+				// console.log(top)
 				if(top>0){
 					this.isTop=true;
 					this.titleColor="#fff"

+ 107 - 3
pages_company/packageDetails.vue

@@ -3,7 +3,14 @@
 		<!-- <view class="img-box"  @click="showImg()">
 			<image  :src="item.imgUrl"></image>
 		</view> -->
-		
+		<!-- 购买轮播列表 -->
+		 <view class="buy-lists" v-if="notics&&notics.length>0" :style="{height: boxHeight+'px'}">
+			<view :class="{'buy-top': animate == true }" :style="{marginTop: animate == true ? `-${marginTop}px`:'0'}">
+				<view class="buy-list buy-txtbox" v-for="(item,index) in notics" :key="index">
+					<view class="buy-item"><text class="textOne buy-name" >{{item.fsUserName|| ''}}</text><text>{{item.timeTxt}} 已下单</text></view>
+				</view>
+			</view>
+		 </view>
 		<view class="cont-box">
 			<view class="goods-banner" @click="showImg()">
 				<swiper
@@ -151,8 +158,9 @@
 </template>
 
 <script>
+	import { caculateTimeago } from '@/pages/TUIKit/utils/date.ts';
 	import {getConfigByKey} from '@/api/common'
-	import {getPackageById,getPackageDoctorList} from '@/api/package.js'
+	import {getPackageById,getPackageDoctorList,getNewOrderByPackageId} from '@/api/package.js'
 	export default {
 		data() {
 			return {
@@ -170,7 +178,12 @@
 				doctorPageNum:1,
 				doctorLastPage:false,
 				doctorTotal:0,
-				choose: 0
+				choose: 0,
+				boxHeight: 94,
+				marginTop: 30,
+				animate:false,
+				timer:null,
+				notics:[],
 			};
 		},
 		onLoad(option) {
@@ -178,6 +191,12 @@
 			this.companyId=uni.getStorageSync('companyId');
 			this.companyUserId=uni.getStorageSync('companyUserId');		
 		},
+		onReady() {
+			this.getNewOrderByPackageId()
+		},
+		onUnload() {
+			if(this.timer) clearInterval(this.timer)
+		},
 		onShow() {
 			this.getPackageById();
 			this.getPackageDoctorList();
@@ -193,6 +212,47 @@
 			}
 		},
 		methods:{
+			getNewOrderByPackageId() {
+				if(this.timer) clearInterval(this.timer)
+				getNewOrderByPackageId({packageId:this.packageId}).then(res=>{
+					if(res.code== 200) {
+						this.notics = res.data
+						if(res.data&&res.data.length > 0) {
+							this.notics = res.data.map(item=>({
+								...item,
+								timeTxt: caculateTimeago(new Date(item.payTime).getTime(),1)
+							}))
+							
+							this.getText()
+							this.timer = setInterval(this.scroll, 1400);
+						}
+					} else {
+						this.notics = []
+					}
+				})
+			},
+			scroll() {
+				this.animate = true;
+				setTimeout(() => {
+					this.notics.push(this.notics[0]);
+					this.notics.shift();
+					this.animate = false;
+				}, 1000);
+			},
+			getText() {
+				const query = uni.createSelectorQuery().in(this);
+				query
+				  .select(".buy-txtbox")
+				  .boundingClientRect((data) => {
+					this.marginTop = data.height + uni.upx2px(14)
+					if(this.notics.length>2) {
+						this.boxHeight = this.marginTop * 3 + uni.upx2px(8)
+					} else {
+						this.boxHeight = this.marginTop * this.notics.length + uni.upx2px(8)
+					}
+				  })
+				  .exec();
+			},
 			showMore(){
 				this.displayMore=this.displayMore==1?0:1;
 				this.displayText=this.displayMore==1?'收起':'查看更多'
@@ -317,6 +377,50 @@
 	page{
 		height: 100%;
 	}
+	.textOne {
+		overflow: hidden;
+		white-space: nowrap;
+		text-overflow: ellipsis;
+	}
+	.buy-lists{
+		height: 188rpx;
+		background-color:transparent;
+		overflow: hidden;
+		width: 60%;
+		position: absolute;
+		z-index: 99;
+		top: 20vh;
+		left: 20rpx;
+	}
+	.buy-list{
+		height: 46rpx;
+		font-size: 26rpx;
+		margin-top: 14rpx;
+		overflow: hidden;
+		color: #fff;
+		.buy-item {
+			display: inline-flex;
+			align-items: center;
+			height: 100%;
+			overflow: hidden;
+			background-color: rgba(0, 0, 0, 0.35);
+			border-radius: 10rpx;
+			padding: 0 20rpx;
+			box-sizing: border-box;
+		}
+		.buy-name {
+			width: 50%;
+			margin-right: 10rpx;
+		}
+		text {
+			word-break: break-all;
+			white-space: nowrap;
+		}
+	}
+	.buy-top {
+	    transition: all 1.5s ease-in;
+	    margin-top: -60rpx;
+	  }
 	.content{
 		height: 100%;
 		display: flex;

+ 108 - 4
pages_index/packageDetails.vue

@@ -3,7 +3,14 @@
 		<!-- <view class="img-box"  @click="showImg()">
 			<image  :src="item.imgUrl"></image>
 		</view> -->
-		
+		<!-- 购买轮播列表 -->
+		 <view class="buy-lists" v-if="notics&&notics.length>0" :style="{height: boxHeight+'px'}">
+			<view :class="{'buy-top': animate == true }" :style="{marginTop: animate == true ? `-${marginTop}px`:'0'}">
+				<view class="buy-list buy-txtbox" v-for="(item,index) in notics" :key="index">
+					<view class="buy-item"><text class="textOne buy-name" >{{item.fsUserName|| ''}}</text><text>{{item.timeTxt}} 已下单</text></view>
+				</view>
+			</view>
+		 </view>
 		<view class="cont-box">
 			<view class="goods-banner" @click="showImg()">
 				<swiper
@@ -175,7 +182,7 @@
 		</u-popup>
 		<view class="message-box" v-if="orderCount>0">
 			<view class="left">
-				<image src="/static/images/close24.png" mode="" @click="closeOrder()" ></image>
+				<image src="/static/images/close.png" mode="" @click="closeOrder()" ></image>
 				<view class="text ellipsis">您有{{count}}个待支付订单</view>
 			</view>
 			<view class="btn" @click="showOrder()">查看</view>
@@ -184,9 +191,10 @@
 </template>
 
 <script>
+	import { caculateTimeago } from '@/pages/TUIKit/utils/date.ts';
 	import {create,getOrderCount} from '@/api/packageOrder.js'
 	import {bindCompanyUser} from '@/api/companyUser.js'
-	import {getPackageById,getPackageDoctorList} from '@/api/package.js'
+	import {getPackageById,getPackageDoctorList,getNewOrderByPackageId} from '@/api/package.js'
 	export default {
 		data() {
 			return {
@@ -209,7 +217,12 @@
 				doctorTotal:0,
 				companyUserId:null,
 				companyId:null,
-				choose: 0
+				choose: 0,
+				boxHeight: 94,
+				marginTop: 30,
+				animate:false,
+				timer:null,
+				notics:[],
 			};
 		},
 		onLoad(option) {
@@ -222,6 +235,12 @@
 				this.companyUserId=option.companyUserId
 			}
 		},
+		onReady() {
+			this.getNewOrderByPackageId()
+		},
+		onUnload() {
+			if(this.timer) clearInterval(this.timer)
+		},
 		onShow() {
 			var that=this;
 			this.$isLogin().then(
@@ -265,6 +284,47 @@
 			
 		},
 		methods:{
+			getNewOrderByPackageId() {
+				if(this.timer) clearInterval(this.timer)
+				getNewOrderByPackageId({packageId:this.packageId}).then(res=>{
+					if(res.code== 200) {
+						this.notics = res.data
+						if(res.data&&res.data.length > 0) {
+							this.notics = res.data.map(item=>({
+								...item,
+								timeTxt: caculateTimeago(new Date(item.payTime).getTime(),1)
+							}))
+							
+							this.getText()
+							this.timer = setInterval(this.scroll, 1400);
+						}
+					} else {
+						this.notics = []
+					}
+				})
+			},
+			scroll() {
+				this.animate = true;
+				setTimeout(() => {
+					this.notics.push(this.notics[0]);
+					this.notics.shift();
+					this.animate = false;
+				}, 1000);
+			},
+			getText() {
+				const query = uni.createSelectorQuery().in(this);
+				query
+				  .select(".buy-txtbox")
+				  .boundingClientRect((data) => {
+					this.marginTop = data.height + uni.upx2px(14)
+					if(this.notics.length>2) {
+						this.boxHeight = this.marginTop * 3 + uni.upx2px(8)
+					} else {
+						this.boxHeight = this.marginTop * this.notics.length + uni.upx2px(8)
+					}
+				  })
+				  .exec();
+			},
 			closeOrder(){
 				this.messageShow=false;
 			},
@@ -443,6 +503,50 @@
 	page{
 		height: 100%;
 	}
+	.textOne {
+		overflow: hidden;
+		white-space: nowrap;
+		text-overflow: ellipsis;
+	}
+	.buy-lists{
+		height: 188rpx;
+		background-color:transparent;
+		overflow: hidden;
+		width: 60%;
+		position: absolute;
+		z-index: 99;
+		top: 20vh;
+		left: 20rpx;
+	}
+	.buy-list{
+		height: 46rpx;
+		font-size: 26rpx;
+		margin-top: 14rpx;
+		overflow: hidden;
+		color: #fff;
+		.buy-item {
+			display: inline-flex;
+			align-items: center;
+			height: 100%;
+			overflow: hidden;
+			background-color: rgba(0, 0, 0, 0.35);
+			border-radius: 10rpx;
+			padding: 0 20rpx;
+			box-sizing: border-box;
+		}
+		.buy-name {
+			width: 50%;
+			margin-right: 10rpx;
+		}
+		text {
+			word-break: break-all;
+			white-space: nowrap;
+		}
+	}
+	.buy-top {
+	    transition: all 1.5s ease-in;
+	    margin-top: -60rpx;
+	  }
 	.content{
 		height: 100%;
 		display: flex;

+ 6 - 3
pages_order/storeOrderPay.vue

@@ -44,7 +44,7 @@
 								<!-- <text class="unit">¥</text> -->
 								<!-- <text class="num">{{JSON.parse(item.jsonInfo).price.toFixed(2)}}</text> -->
 							</view>
-							<view class="num" v-if="order.ordetType==1">x{{item.num}}</view>
+							<view class="num" v-if="order.orderType==1">x{{item.num}}</view>
 						</view>
 					</view>
 				</view>
@@ -182,7 +182,6 @@
 		},
 		onShow() {
 			this.getStoreOrderById();
-			this.getMyEnableCouponList();
 		},
 		// onShareAppMessage(res) {
 		// 	var that=this;
@@ -244,7 +243,10 @@
 				);
 			},
 			getMyEnableCouponList(){
-				var data={couponType:2}
+				let data={couponType:2}
+				if(this.order.orderType == 2) {
+					data={couponType:'2,4'}
+				}
 				getMyEnableCouponList(data).then(
 					res => {
 						if(res.code==200){
@@ -271,6 +273,7 @@
 								}
 							}
 							this.compute();
+							this.getMyEnableCouponList();
 						}else{
 							 
 						}