Explorar el Código

1.历史消费

guo hace 2 años
padre
commit
6d19fe9ab4
Se han modificado 5 ficheros con 94 adiciones y 71 borrados
  1. 20 13
      pages/user/checkReport.vue
  2. 34 36
      pages/user/historyDetail.vue
  3. 29 15
      pages/user/historySpend.vue
  4. 1 1
      utils/common.js
  5. 10 6
      utils/request.js

+ 20 - 13
pages/user/checkReport.vue

@@ -1,18 +1,18 @@
 <template>
 	<view class="box">
-		<view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.ID)">
-			<view class="time">2021-09-03</view>
+		<view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.id)">
+			<view class="time">{{item.CreateTime}}</view>
 			<view class="carPlate">
-				<view class="plate">鲁A12345</view>
-				<view class="mileage">1000km</view>
+				<view class="plate">{{item.PlateNumber}}</view>
+				<view class="mileage">{{item.currentMileage}}km</view>
 			</view>
 
-			<view class="shopName">丰田 卡罗拉 2021款 1.2T 无极</view>
-			<view class="itemContent">这是门店名称这是门店名称这是门店名称这是门店名称这是...</view>
+			<view class="shopName"v-if="item.carmodel">{{item.carmodel}}</view>
+			<view class="itemContent">{{item.shopname}}</view>
 		</view>
 
 		<!-- 上拉 加载更多 -->
-		<view class="noMore" v-if="noMoreShow">没有更多数据</view>
+		<view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
 		<!-- 无数据空白页 -->
 		<nodata v-if="itemData.length==0"></nodata>
 
@@ -35,7 +35,7 @@
 		},
 		onLoad() {
 			this.page = 1
-			// this.myOrderCoupon()
+			this.myOrderCoupon()
 		},
 		methods: {
 			goDetail(id) {
@@ -47,13 +47,14 @@
 				uni.showLoading({
 					title: '加载中'
 				})
-				this.$http('worldKeepCar/keepCarMy/listTCouponPage', {
+				this.$http('opencheckSheet/getTestList', {
 
-					page: this.page,
-					limit: 10,
+					// page: this.page,
+					// limit: 10,
 				}, 'GET').then(res => {
 					uni.hideLoading();
-					var list = res.data.Items
+					// var list = res.data.Items
+					var list = res.data
 
 					// 处理 undefined和null转为空白字符串
 					list.forEach((item, index) => {
@@ -99,7 +100,7 @@
 			}, 1000);
 		},
 		onReachBottom() {
-			this.page++;
+			// this.page++;
 			this.myOrderCoupon()
 		},
 	}
@@ -157,5 +158,11 @@
 		overflow: hidden;
 		text-overflow: ellipsis;
 		white-space: nowrap;
+	}
+	.noMore {
+		text-align: center;
+		line-height: 50rpx;
+		color: #999999;
+		font-size: 28rpx;
 	}
 </style>

+ 34 - 36
pages/user/historyDetail.vue

@@ -4,9 +4,9 @@
 		<view class="top">
 			<view class="orderState">
 				<image src="../../static/img/icon_order_def.png" mode="" style="width: 44rpx;height: 44rpx;"></image>
-				<view class="SheetState">已结算</view>
-				<view class="SheetState" v-if="orderData.SheetState==1">已结算</view>
-				<view class="SheetState" v-if="orderData.SheetState==2">未结算</view>
+				
+				<view class="SheetState" v-if="orderData.billsheet.PayState==2">已结算</view>
+				<view class="SheetState" v-if="orderData.billsheet.PayState==0">未结算</view>
 			</view>
 
 
@@ -16,10 +16,8 @@
 		<view class="shopBox">
 			<image src="../../static/img/icon_store.png" mode="" class="shopBoximg"></image>
 			<view class="shopCont">
-				<view class="shopName">{{orderData.ShopName}}这是门店名称</view>
-				<view class="Address">江苏省南京市鼓楼区铁路南街233
-					{{orderData.ProvinceName}}{{orderData.CityName}}{{orderData.AreaName}}{{orderData.Address}}
-				</view>
+				<view class="shopName">{{orderData.billsheet.ShopName}}</view>
+				<view class="Address">{{orderData.billsheet.Address}}</view>
 
 			</view>
 			<view class="shopRightBox" @click="map">
@@ -42,7 +40,7 @@
 		<view class="information">
 			<view class="carMes">
 				<view class="plate">{{orderData.billsheet.PlateNumber}}</view>
-				<view class="mileage">{{orderData.billsheet.CurrentMileage}}km</view>
+				<view class="mileage" v-if="orderData.billsheet.CurrentMileage>0">{{orderData.billsheet.CurrentMileage}}km</view>
 			</view>
 			<view class="informationLine">
 				<view class="informationTxt">姓名:</view>
@@ -54,7 +52,7 @@
 			</view>
 			<view class="informationLine">
 				<view class="informationTxt">单号:</view>
-				<view class="informationNum">{{orderData.billsheet}}no</view>
+				<view class="informationNum">{{orderData.billsheet.Code}}</view>
 			</view>
 			<view class="informationLine">
 				<view class="informationTxt">接车时间:</view>
@@ -62,7 +60,7 @@
 			</view>
 			<view class="informationLine">
 				<view class="informationTxt">服务顾问:</view>
-				<view class="informationNum">{{orderData.billsheet}}no</view>
+				<view class="informationNum">{{orderData.billsheet.PickName}}</view>
 			</view>
 
 		</view>
@@ -73,10 +71,10 @@
 			<view class="detailedLineBox">
 				<view class="detailedLine" v-for="(item,index) in orderData.listItems">
 
-					<view class="detailedCont">
+					
 						<view class="detailedName">{{item.ItemName}}项目名称</view>
 						<span>x1</span>
-					</view>
+					
 				</view>
 			</view>
 		</view>
@@ -88,11 +86,11 @@
 			<view class="detailedLineBox">
 				<view class="detailedLine" v-for="(item,index) in orderData.listParts">
 
-					<view class="detailedCont">
+					
 						<view class="detailedName">{{item.GoodsName}}商品名称</view>
 						<span>x{{item.SaleQty}}</span>
 
-					</view>
+					
 				</view>
 			</view>
 		</view>
@@ -114,7 +112,7 @@
 			}
 		},
 		onLoad(opt) {
-			this.location = uni.getStorageSync("locationCity");
+			
 			this.id = opt.id
 			
 			this.getData()
@@ -131,7 +129,7 @@
 			map() {
 				console.log("打开地图")
 				var that = this;
-				if (!that.orderData.Lat || !that.orderData.Lng) {
+				if (!that.orderData.billsheet.lat || !that.orderData.billsheet.lng) {
 					uni.showToast({
 						title: '该店铺未设置定位',
 						icon: 'none',
@@ -139,10 +137,10 @@
 					});
 				} else {
 					uni.openLocation({
-						latitude: Number(that.orderData.Lat),
-						longitude: Number(that.orderData.Lng),
-						name: that.orderData.ShopName,
-						address: that.orderData.Address,
+						latitude: Number(that.orderData.billsheet.lat),
+						longitude: Number(that.orderData.billsheet.lng),
+						name: that.orderData.billsheet.ShopName,
+						address: that.orderData.billsheet.Address,
 						success: function() {
 							console.log('success');
 						},
@@ -156,7 +154,7 @@
 
 			call() {
 				uni.makePhoneCall({
-					phoneNumber: this.orderData.MobilePhone
+					phoneNumber: this.orderData.billsheet.MobilePhone
 				});
 			},
 
@@ -166,11 +164,11 @@
 					title: '加载中'
 				});
 
-				this.$http('worldKeepCar/keepCarMy/queryMiNiAppTSheetDetail', {
-					lat: this.location.lat,
-					lng: this.location.lng,
+				this.$http('openweiXinCardInfoController/queryConsumptionDetail', {
+					// lat: this.location.lat,
+					// lng: this.location.lng,
 					id: this.id,
-				}, 'GET').then(res => {
+				}, 'POST').then(res => {
 					uni.hideLoading();
 					this.orderData = res.data;
 
@@ -274,13 +272,14 @@
 	.shopName {
 		font-size: 30rpx;
 		font-weight: bold;
-		color: #3C3C3C;
+		color: #3C3C3C;
+		line-height: 42rpx;
 	}
 
 	.Address {
 		color: #999999;
 		font-size: 24rpx;
-		padding-top: 10rpx;
+		margin-top: 10rpx;
 	}
 
 	.shopRihgtTxt {
@@ -290,7 +289,7 @@
 	}
 
 	.shopRightBox {
-		padding-top: 30rpx;
+		
 		padding-left: 28rpx;
 	}
 
@@ -397,8 +396,8 @@
 
 	.detailedLine {
 		display: flex;
-		padding-left: 20rpx;
-		padding-top: 40rpx;
+		padding: 20rpx 20rpx 0rpx;
+		justify-content: space-between;
 	}
 
 	.detailedImg {
@@ -407,18 +406,17 @@
 		border-radius: 10rpx;
 	}
 
-	.detailedCont {
-		padding-left: 20rpx;
-		display: flex;
-		justify-content: space-between;
-	}
+	
 
 	.detailedName {
 		font-size: 26rpx;
 		color: #3C3C3C;
 	}
 
-
+	span{
+		font-size: 26rpx;
+		color: #999999;
+	}
 
 	.goodscost {
 		width: 702rpx;

+ 29 - 15
pages/user/historySpend.vue

@@ -1,21 +1,25 @@
 <template>
 	<view class="box">
-		<view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.ID)">
+		<view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.id)">
 			<view class="time">{{item.time}}</view>
 			<view class="carPlate">
 				<view class="plate">{{item.PlateNumber}}</view>
-				<view class="mileage">{{item.CurrentMileage}}km</view>
+				<view class="mileage" v-if="item.CurrentMileage>0">{{item.CurrentMileage}}km</view>
 			</view>
 
 			<view class="shopName">{{item.ShopName}}</view>
 			
-			<view class="itemContent" v-show="item.listItems.length != 0" v-for="(v,i) in item.listItems">{{v.ItemName}},</view>
-			<view class="itemContent" v-show="item.listParts.length != 0" v-for="(v,i) in item.listParts">{{v.GoodsName}},</view>
+			<view class="itemN">
+				<view class="itemContent" v-if="item.listItems.length != 0" v-for="(v,i) in item.listItems">{{v.ItemName}},</view>
+			</view>
+			<view class="">
+				<view class="itemContent" v-if="item.listParts.length != 0" v-for="(v,i) in item.listParts">{{v.GoodsName}},</view>
+			</view>
 			
 		</view>
 
 		<!-- 上拉 加载更多 -->
-		<view class="noMore" v-if="noMoreShow">没有更多数据</view>
+		<view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
 		<!-- 无数据空白页 -->
 		<nodata v-if="itemData.length==0"></nodata>
 
@@ -38,7 +42,7 @@
 		},
 		onLoad() {
 			this.page = 1
-			// this.myOrderCoupon()
+			this.myOrderCoupon()
 		},
 		methods: {
 			goDetail(id) {
@@ -50,21 +54,21 @@
 				uni.showLoading({
 					title: '加载中'
 				})
-				this.$http('worldKeepCar/keepCarMy/listTCouponPage', {
+				this.$http('openweiXinCardInfoController/queryConsumptionList', {
 
 					// page: this.page,
 					// limit: 10,
-				}, 'GET').then(res => {
+				}, 'POST').then(res => {
 					uni.hideLoading();
 					// var list = res.data.Items
 					var list = res.data
-
+					
 					// 处理 undefined和null转为空白字符串
-					list.forEach((item, index) => {
-						for (const key in item) {
-							item[key] = this.$praseStrEmpty(item[key])
-						}
-					})
+					// list.forEach((item, index) => {
+					// 	for (const key in item) {
+					// 		item[key] = this.$praseStrEmpty(item[key])
+					// 	}
+					// })
 
 					if (this.page == 1) {
 						this.itemData = list
@@ -153,7 +157,11 @@
 		border-radius: 4rpx;
 		height: 36rpx;
 	}
-
+
+	.itemN {
+		display: flex;
+		
+	}
 	.shopName,
 	.itemContent {
 		color: #666666;
@@ -163,5 +171,11 @@
 		overflow: hidden;
 		text-overflow: ellipsis;
 		white-space: nowrap;
+	}
+	.noMore {
+		text-align: center;
+		line-height: 50rpx;
+		color: #999999;
+		font-size: 28rpx;
 	}
 </style>

+ 1 - 1
utils/common.js

@@ -1,6 +1,6 @@
 
 const isUserId = function() {
-	var userId=uni.getStorageSync("logodata").uid;
+	var userId=uni.getStorageSync("wxOpenData").loginInfo.uid;
 	//console.log("userId---"+userId)
 	if(!userId){
 		   uni.navigateTo({

+ 10 - 6
utils/request.js

@@ -9,9 +9,11 @@ const http = (url = '', date = {}, type = 'POST', header = {
 }) => {
     return new Promise((resolve, reject) => {
 		header={};
-		const logodata = uni.getStorageSync("logodata");
-		header['token']=logodata.token;
-		header['uid']=logodata.uid; 
+		const wxOpenData = uni.getStorageSync("wxOpenData");
+		if(wxOpenData){
+			header['token']=wxOpenData.loginInfo.token;
+			header['uid']=wxOpenData.loginInfo.uid; 
+		}
 		//header['token']='98A9FED8814B457288166BDF623F33D1';
 		//header['uid']='39415962-C9D3-466D-A73F-5B5429A8DB2A'; 
 		header['Content-Type']='application/x-www-form-urlencoded';
@@ -54,9 +56,11 @@ const httpBinary = (url = '', date = {}, type = 'POST', header = {
 }) => {
     return new Promise((resolve, reject) => {
 		header={};
-		const logodata = uni.getStorageSync("logodata");
-		header['token']=logodata.token;
-		header['uid']=logodata.uid; 
+		const wxOpenData = uni.getStorageSync("wxOpenData");
+		if(wxOpenData){	
+			header['token']=wxOpenData.loginInfo.token;
+			header['uid']=wxOpenData.loginInfo.uid; 
+		}
 		//header['token']='98A9FED8814B457288166BDF623F33D1';
 		//header['uid']='39415962-C9D3-466D-A73F-5B5429A8DB2A'; 
 		header['Content-Type']='application/x-www-form-urlencoded';