Explorar o código

Merge remote-tracking branch 'origin/master'

xyh8905170 %!s(int64=2) %!d(string=hai) anos
pai
achega
ab8f826cbf

+ 1 - 1
orderPages/orderDetail/index.vue

@@ -320,7 +320,7 @@ export default {
                 scanType: ['qrCode'],
                 success: function (res) {
                     uni.navigateTo({
-                        url:'/orderPages/serviceItems/index?serviceStationId='+ res.result + '&orderId='+order.orderId
+                        url:'/orderPages/serviceItems/index?serviceStationId='+ res.result + '&orderId='+order.orderId + '&serviceObjectId=' + order.serviceObjectId
                     })
                 }
             })

+ 22 - 0
orderPages/serviceItems/index.rpx.scss

@@ -366,3 +366,25 @@
 .outView{
   width: 600rpx;
 }
+
+.ticketView{
+  width: 400rpx;
+  height: 70rpx;
+  border-radius: 35rpx;
+  background: #F7F7F7;
+  margin-left: 32rpx;
+}
+.ticketBtn{
+  background: #F7F7F7;
+  width: 200rpx;
+  font-size: 28rpx;
+
+  color: #333333;
+  border-radius: 35rpx;
+  line-height: 70rpx;
+  text-align: center;
+}
+.ticketColor{
+  background: #FFE05C;
+  color: #FFFFFF;
+}

+ 56 - 10
orderPages/serviceItems/index.vue

@@ -39,15 +39,24 @@
 
             <view class="tabBarLineHeight"></view>
 
-            <view class="bottomView ">
+            <view class="bottomView">
 
-                <view class="flex-row justify-center" @click="goUseRights">
+                <view class="ticketView  flex-row">
+                    <view class="ticketBtn" :class="{'ticketColor': ticketBtnIndex === 1}" @click="clickTicketBtn(1)">
+                        <text>使用权益券</text>
+                    </view>
+                    <view class="ticketBtn" :class="{'ticketColor': ticketBtnIndex === 2}" @click="clickTicketBtn(2)">
+                        <text>使用优惠券</text>
+                    </view>
+                </view>
+
+                <view v-if="ticketBtnIndex === 1" class="flex-row justify-center" @click="goUseRights">
                     <view class="block_3 ">
                         <text lines="1" class="text_15">权益卡</text>
                         <view>
-                            <view class="flex-row justify-between" v-if="coupons.length>0">
+                            <view class="flex-row justify-between" v-if="equitys.length>0">
                                 <view class="flex-row">
-                                    <text class="text-group_5" v-for="(iter,i) in coupons" :key="i">{{iter.name}}:-¥{{iter.discountsPrice}}</text>
+                                    <text class="text-group_5" v-for="(iter,i) in equitys" :key="i">{{iter.description}}</text>
                                 </view>
                                 <u-icon name="arrow-right" color="#666" size="18"></u-icon>
                             </view>
@@ -60,8 +69,7 @@
                     </view>
                 </view>
 
-
-                <view class="flex-row justify-center" @click="goUseCoupons">
+                <view v-if="ticketBtnIndex === 2" class="flex-row justify-center" @click="goUseCoupons">
                     <view class="block_3 ">
                         <text lines="1" class="text_15">优惠券</text>
                         <view>
@@ -96,6 +104,7 @@ export default {
     data() {
         return {
             coupons:[],
+            equitys:[],
             couponIds:'',
             tabIndex: 3,
             projects:{},
@@ -103,23 +112,40 @@ export default {
             orderId:'',
             serviceProject:{},
             serviceProjectId:'',
+            serviceObjectId:'',
+            ticketBtnIndex:1
         }
     },
     onLoad(e) {
         this.orderId=e.orderId
         this.serviceStationId=e.serviceStationId
+        this.serviceObjectId=e.serviceObjectId
         this.getStationById(e.serviceStationId)
 
         uni.$off('getUseCoupons')
         uni.$on('getUseCoupons',this.getUseCoupons)
+        uni.$on('getEquity',this.getEquity)
 
     },
 
     methods: {
 
+        clickTicketBtn(ticketBtnIndex){
+            this.ticketBtnIndex =ticketBtnIndex
+        },
+
+        getEquity(e){
+            this.equitys =e
+        },
+
         goUseRights(){
+
+            if (this.serviceProjectId.length === 0){
+                uni.$u.toast('请先选择服务项目')
+                return
+            }
             uni.navigateTo({
-                url:'/storePages/useRights/index'
+                url:'/storePages/useRights/index?serviceProjectId=' + this.serviceProjectId + '&serviceObjectId=' + this.serviceObjectId
             })
         },
 
@@ -140,7 +166,6 @@ export default {
                 uni.$u.toast('请先选择服务项目')
                 return
             }
-
             uni.navigateTo({
                 url: '/orderPages/useCoupons/index?standardPrice='+this.serviceProject.standardPrice
             })
@@ -148,20 +173,41 @@ export default {
         },
 
         clickItem(item){
+            if (this.equitys.length>0){
+                if (item.id != this.equitys[0].serviceObjectId){
+                    this.equitys=[]
+                }
+            }
+
             this.serviceProjectId = item.id
             this.serviceProject = item
         },
 
         addChildProject(){
-            if (this.id === ''){
+
+            if (this.ticketBtnIndex === 1){
+                this.couponIds=''
+            }
+
+            if (this.ticketBtnIndex === 2){
+                this.equitys=[]
+            }
+
+            if (!this.serviceProjectId){
                 uni.$u.toast("请选择服务项目")
+                return
+            }
+            let userEquityCardId
+            if (this.equitys.length>0){
+                 userEquityCardId = this.equitys[0].id
             }
             this.$api.addChildProject({
                 orderId:this.orderId,
                 serviceProjectId:this.serviceProjectId,
                 servicePersonId:this.projects.personId,
                 serviceStationId:this.serviceStationId,
-                couponIds:this.couponIds
+                couponIds:this.couponIds,
+                userEquityCardId:userEquityCardId
             }).then(res=>{
                 uni.navigateTo({
                     url:'/orderPages/orderDetail/index?id='+ this.orderId

+ 3 - 3
orderPages/useCoupons/index.vue

@@ -12,7 +12,7 @@
         </view>
         <view  :style="{'height':scrollViewHeight}">
             <scroll-view class="scroll " :style="{'height':scrollViewHeight}" scroll-y>
-                <view  class="row-list flex-row justify-start" :class="{'grayscale' : item.discountsPrice*1 >standardPrice*1 }" v-for="(item,index) in countsList" @click="clickCoupons(item,index)" :key="index">
+                <view  class="row-list flex-row justify-start" :class="{'grayscale' : item.reachPrice*1 >standardPrice*1 }" v-for="(item,index) in countsList" @click="clickCoupons(item,index)" :key="index">
                     <view class="h-text flex-col justify-center ">
                         <view class="money">
                             <text>¥{{item.discountsPrice}}</text>
@@ -40,7 +40,7 @@
 
                     <view class="h-right-content flex-col justify-center">
 
-                        <view class="flex-row justify-center" v-if="item.discountsPrice*1 >standardPrice*1 ">
+                        <view class="flex-row justify-center" v-if="item.reachPrice*1 >standardPrice*1 ">
                             <view class="h-btn-img">
                                 <image class="h-btn-img" src="/static/coupon/u2110.png" mode=""></image>
                             </view>
@@ -115,7 +115,7 @@ export default {
       },
       clickCoupons(item,index){
 
-          if (item.discountsPrice*1 > this.standardPrice*1){
+          if (item.reachPrice*1 > this.standardPrice*1){
               return
           }
 

+ 1 - 1
pages/order/module/mescrollUni-item.vue

@@ -255,7 +255,7 @@
 			scanType: ['qrCode'],
           success: function (res) {
 			uni.navigateTo({
-				 url:'/orderPages/serviceItems/index?serviceStationId='+ res.result + '&orderId='+item.orderId
+				 url:'/orderPages/serviceItems/index?serviceStationId='+ res.result + '&orderId='+item.orderId + '&serviceObjectId=' + item.serviceObjectId
 			})
           }
         })

+ 2 - 74
storePages/useRights/index.rpx.scss

@@ -1,4 +1,3 @@
-
 .page{
   background: #F7F7F7;
   padding: 0 32rpx;
@@ -104,77 +103,6 @@
 .row-list:first-child{
   margin-top: 0;
 }
-.btn{
-  width: 156rpx;
-  height: 64rpx;
-  background: #93D21A;
-  border-radius: 32rpx;
-
-  font-size: 24rpx;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #FFFFFF;
-  line-height: 64rpx;
-  text-align: center;
-}
-
-
-
-.payView{
-  height: 638rpx;
-  background: #FFFFFF;
-  box-shadow: 0rpx -4rpx 8rpx 0rpx rgba(0,0,0,0.03);
-  border-radius: 24rpx 24rpx 0rpx 0rpx;
-  padding: 24rpx 32rpx;
-  z-index: 100;
-}
-.payType{
-  font-size: 32rpx;
-  font-family: PingFangSC-Medium, PingFang SC;
-  font-weight: bord;
-  color: #111111;
-  line-height: 48rpx;
-}
-.x{
-  width: 35rpx;
-  height: 35rpx;
-  border-radius: 18rpx;
-}
-.payTitle{
-  font-size: 24rpx;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #666666;
-  line-height: 40rpx;
-  margin-top: 8rpx;
-}
-.payItem{
-  background: #FAFAFA;
-  border-radius: 20rpx;
-  padding: 34rpx 32rpx;
-  margin-top: 32rpx;
-}
-.payName{
-  margin-left: 24rpx;
-}
-.balance{
-  font-size: 24rpx;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #999999;
-  line-height: 40rpx;
-}
-.commitBtn{
-  width: 686rpx;
-  height: 108rpx;
-  background: #FFE05C;
-  border-radius: 60rpx;
-  margin-top: 32rpx;
-
-  font-size: 32rpx;
-  font-family: PingFangSC-Medium, PingFang SC;
-  font-weight: bold;
-  color: #111111;
-  line-height: 108rpx;
-  text-align: center;
+.grayscale{
+  filter: grayscale(100%);
 }

+ 113 - 36
storePages/useRights/index.vue

@@ -1,41 +1,66 @@
 <template>
 	<view class="page" :style="{'height':windowHeight}">
 
-		<scroll-view scroll-y :style="{'height':windowHeight}">
-			<view  class="row-list flex-row justify-start" v-for="(item,index) in equityList" :key="index">
-				<view class="h-text flex-col justify-center ">
-					<view class="money">
-						<text>¥{{item.faceValue}}</text>
+		<view class="flex-row">
+			<view class="flex-col justify-center" @click="noUseChange">
+				<u-icon v-if="noUse" name="checkmark-circle-fill" color="#38db38" size="25" ></u-icon>
+				<u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
+			</view>
+			<view class="noUse">
+				<text>不使用权益券</text>
+			</view>
+		</view>
+		<view  :style="{'height':scrollViewHeight}">
+			<scroll-view class="scroll " :style="{'height':scrollViewHeight}" scroll-y>
+				<view  class="row-list flex-row justify-start" :class="{'grayscale' :serviceProjectId != item.serviceProjectId || serviceObjectId != item.serviceObjectId }" v-for="(item,index) in equityList" @click="clickCoupons(item,index)" :key="index">
+					<view class="h-text flex-col justify-center ">
+						<view class="money">
+							<text>¥{{item.faceValue}}</text>
+						</view>
+<!--						<view class="desc">-->
+<!--							<text>{{item.name}}</text>-->
+<!--						</view>-->
 					</view>
-					<!--				<view class="desc">-->
-					<!--					<text>{{item.title}}</text>-->
-					<!--				</view>-->
-				</view>
 
-				<view class="h-center-content flex-col justify-around">
-					<view class="h-value">
-						<text>{{item.description}}</text>
-					</view>
-					<view class="title">
-						使用项目:{{item.serviceProjectName || ''}}
-					</view>
-					<view class="title">
-						绑定对象:{{item.serviceObjectName}}
-					</view>
-					<view class="title">
-						结束期限:{{item.effectiveEndTime.substring(0,10)}}
+					<view class="h-center-content flex-col ">
+						<view class="h-value">
+							<text>{{item.description}}</text>
+						</view>
+						<view class="title">
+							使用项目:{{item.serviceProjectName || ''}}
+						</view>
+						<view class="title">
+							绑定对象:{{item.serviceObjectName}}
+						</view>
+						<view class="title">
+							结束期限:{{item.effectiveEndTime.substring(0,10)}}
+						</view>
 					</view>
 
-				</view>
+					<view class="h-right-content flex-col justify-center">
+
+						<view class="flex-row justify-center" v-if="serviceProjectId != item.serviceProjectId || serviceObjectId != item.serviceObjectId ">
 
-<!--				<view class="h-right-content flex-col justify-center ">-->
-<!--					<view class="btn" @click="payRights(item)">-->
-<!--						<text>购买</text>-->
-<!--					</view>-->
-<!--				</view>-->
+							<view class="h-btn-img">
+								<image class="h-btn-img" src="/static/coupon/u2110.png" mode=""></image>
+							</view>
+						</view>
 
+						<view class="flex-row justify-center" v-else>
+							<u-icon v-if="item.isUse " name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
+							<u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
+						</view>
+
+
+					</view>
+				</view>
+			</scroll-view>
+		</view>
+		<view>
+			<view class="btn" @click="useCoupons">
+				<text>确定</text>
 			</view>
-		</scroll-view>
+		</view>
 
 
 	</view>
@@ -44,21 +69,75 @@
 	export default {
 		data() {
 			return {
-				windowHeight:'',
-				userInfo:{},
 				equityList:[],
+				noUse:true,
+				windowHeight:'',
+				scrollViewHeight:'',
+				serviceObjectId:'',
+				serviceProjectId:'',
 			};
 		},
-		onLoad(option) {
+		onLoad(e) {
+			this.serviceProjectId = e.serviceProjectId
+			this.serviceObjectId = e.serviceObjectId
 			let sysInfo = uni.getSystemInfoSync()
-			this.windowHeight =sysInfo.windowHeight - 44 +'px'//除标题栏栏外的屏幕可用高度
-			this.userInfo = uni.getStorageSync('userInfo')
-
+			this.windowHeight =sysInfo.windowHeight +'px'
+			this.scrollViewHeight =sysInfo.windowHeight -(sysInfo.windowWidth/750)*252 +'px'
 			this.myEquityCardList()
 		},
+		computed: {
 
+		},
 		methods: {
 
+			useCoupons(){
+				let  equitys = []
+				for (const equity of this.equityList) {
+					if (equity.isUse){
+						equitys.push(equity)
+					}
+				}
+				uni.$emit('getEquity',equitys)
+				uni.navigateBack({
+					data:1
+				})
+			},
+
+			noUseChange(){
+				this.noUse = !this.noUse
+				if (this.noUse){
+					this.equityList.forEach(item=>{
+						item.isUse = false
+					})
+				}
+			},
+			clickCoupons(item,index){
+
+				if (this.serviceProjectId != item.serviceProjectId || this.serviceObjectId != item.serviceObjectId){
+					return
+				}
+
+				//关闭多选开始
+				this.equityList.forEach(item=>{
+					item.isUse = false
+				})
+				//关闭多选结束
+
+				console.log(item)
+				this.noUse = false
+				item.isUse = !item.isUse
+				this.$set(this.equityList,index,item)
+
+				let flag = true
+				this.equityList.forEach(item=>{
+					if (item.isUse){
+						flag = false
+					}
+				})
+				this.noUse = flag
+
+			},
+
 			myEquityCardList(){
 				this.$api.myEquityCardList().then(res=>{
 					console.log(res)
@@ -70,8 +149,6 @@
 	};
 </script>
 <style lang="scss" scoped>
-
 	@import '/common/css/common.css';
 	@import './index.rpx.scss';
-
 </style>