lhl 2 years ago
parent
commit
11e0f63cc0
2 changed files with 63 additions and 14 deletions
  1. 31 11
      pages/shop/rent.vue
  2. 32 3
      pages/user/user.vue

+ 31 - 11
pages/shop/rent.vue

@@ -86,7 +86,7 @@
 					选择套餐
 				</view>
 			</view>
-			<view class="contet-list flex" style="position: relative;" :style="{'height': isShowAll? 'auto': '275rpx'}">
+			<view class="contet-list flex" style="position: relative;" :style="{'height': isShowAll? 'auto': '550rpx'}">
 				<view class="flex" v-if="isShowAll == false"
 					style="width: 100%; position: absolute;bottom: 0;background-color: #fff;height: 50rpx;left: 0;text-align: center;border-radius: 0 0 20rpx 20rpx;padding: 0 30px;"
 					@click="isShowAll = true">
@@ -102,7 +102,9 @@
 				</view>
 				<view class="tc flex" v-for="(item,index) in tcList" :class="{'action': selectTcIndex == index}"
 					@click="choosTc(index,item)" v-if="item.day == 30 || !userInfo.payRules">
-
+					<view class="tc-tit">
+						{{item.title}}
+					</view>
 					<view class="tc-price">
 						{{item.price}}
 						<text class="tc-time-t">
@@ -264,7 +266,7 @@
 		<view class="ts" v-if="!isdk">
 
 		</view>
-		<view class="btm-btn flex" v-if="!isdk">
+		<view class="btm-btn flex" v-if="!isdk || !ismy">
 
 			<!-- <view class="pay-price" v-if="!ismy && userInfo.battery_deposit  != 1">
 				总计费用:<text>{{(selectTc.price*1 + selectTc.deposit*1).toFixed(2) || ''}}</text>
@@ -366,10 +368,10 @@
 		watch: {
 			selctStore(n, o) {
 				if (n) {
-					if(this.userInfo.battery_deposit  != 1) {
+					if(this.userInfo.battery_deposit  != 1 && n.is_pledge == 1) {
 						this.ljmy()
 					}
-					if (this.selectTc.day*1 == 30 && !this.userInfo.payRules) {
+					if (this.selectTc.day*1 == 30 && !this.userInfo.payRules ) {
 						this.ktdk()
 					}else {
 						
@@ -399,13 +401,21 @@
 				return this.isdk && this.dkQrcodeUrl
 			},
 			showPrice() {
-				let price = this.selectTc.price * 1 + this.selectTc.deposit * 1
+				console.log(this.ismy,'this.ismy');
+				let price
+				if(this.ismy) {
+					price = this.selectTc.price * 1 + this.selectTc.deposit * 1
+				}else {
+					price = this.selectTc.deposit * 1
+					console.log(price,'pricepriceprice');
+				}
+				
 				if (!this.ismy && this.userInfo.battery_deposit != 1) {
 					if (this.isqxdk) {
 						let all = (price - this.userInfo.certificate * 1).toFixed(2)
 						return all > 0 ? all : 0
 					} else {
-						return price
+						return price*1
 					}
 				} else {
 					if (this.isqxdk) {
@@ -448,6 +458,7 @@
 			qxmy() {
 				this.ismy = false
 			},
+			// 开通代扣
 			ktdk() {
 				let that = this
 				that.dkQrcodeUrl = ''
@@ -459,7 +470,7 @@
 				}
 				this.isdk = true
 				// this.contractCreate()
-
+				
 				this.toBuy()
 			},
 			contractCreate() {
@@ -481,6 +492,9 @@
 				if (!that.is_tj && that.selctStore.id == '') {
 					return that.$api.msg('请选择门店')
 				}
+				if(that.selectTc.is_pledge == 0) {
+					return
+				}
 				this.ismy = true
 				this.rentFree()
 			},
@@ -980,7 +994,7 @@
 		padding: 0 25rpx 45rpx;
 		height: 275rpx;
 		overflow: hidden;
-
+		
 		.tc {
 			width: 315rpx;
 			height: 212rpx;
@@ -990,7 +1004,11 @@
 			margin-bottom: 20rpx;
 			flex-direction: column;
 			justify-content: center;
-
+			.tc-tit {
+				font-size: 36rpx;
+				text-align: center;
+				
+			}
 			// align-items: center;
 			.tc-time {
 				font-size: 28rpx;
@@ -1042,7 +1060,9 @@
 				}
 			}
 		}
-
+		.tc-t {
+			// width: 630rpx;
+		}
 		.dy {
 			height: 187rpx;
 		}

+ 32 - 3
pages/user/user.vue

@@ -182,8 +182,10 @@
 						核销码
 					</view> -->
 					<input type="text" v-model="code" placeholder="请输入核销码" placeholder-class="hx-placeholder" />
-					<!-- <image src="../../static/icon/scend.png" mode=""></image> -->
-					<input type="text" v-model="dcode" placeholder="请输入电池编号" placeholder-class="hx-placeholder" v-if="hxtype == 1"/>
+					<view class="flex dcm" v-if="hxtype == 1">
+						<input type="text" v-model="dcode" placeholder="请输入电池编号" placeholder-class="hx-placeholder" />
+						<image src="../../static/icon/scend.png" mode="widthFix" style="width: 50rpx;" @click="smdc"></image>
+					</view>
 					<view class="hx-btn" @click="qhx">
 						立即核销
 					</view>
@@ -358,6 +360,18 @@
 				// #endif
 
 			},
+			smdc() {
+				// #ifndef H5
+				uni.scanCode({
+					autoDecodeCharset:true,
+					success: (res) => {
+						console.log(res);
+						let str = res.result.split('编号:')
+						this.dcode = str[1]
+					}
+				})
+				// #endif
+			},
 			// 跳转卡片页面
 			navcard() {
 				// 判断是否已经认证
@@ -656,7 +670,7 @@
 				text-align: center;
 				padding-bottom: 10rpx;
 			}
-
+			
 			input {
 				width: 439rpx;
 				height: 68rpx;
@@ -671,6 +685,21 @@
 					color: $base-color;
 				}
 			}
+			.dcm {
+				width: 439rpx;
+				margin: 0 auto;
+				input {
+					flex-grow: 1;
+					height: 68rpx;
+					background: #f1faf6;
+					border-radius: 10rpx;
+					margin: 0 10rpx 0 0;
+					padding-left: 26rpx;
+				}
+				image {
+					flex-shrink: 0;
+				}
+			}
 
 			.hx-btn {
 				margin: 44rpx auto 0;