Browse Source

feat: 核销金额

2912631854@qq.com 11 months ago
parent
commit
ec3c418d12

+ 1 - 1
pages/HotelMerchandise/record.vue

@@ -66,7 +66,7 @@
 						res.data.data.list.forEach((item, index) => {
 							number += item.orderAmount
 						});
-						this.totalAmount = parseFloat(number).toFixed(1)
+						this.totalAmount = parseFloat(number).toFixed(2)
 						this.totalNum = res.data.data.total;
 						this.data = res.data.data.list;
 					}

+ 35 - 17
pagesHouse/Verification/record.vue

@@ -22,7 +22,8 @@
 				<view class="item" v-for="(item,index) in data" :key="index" @tap="toDetails(item)">
 					<image :src="item.orderType==2?'../../static/bao.png':'../../static/pin.png'"></image>
 					<view class="mid">
-						<text>{{item.playDate}} {{item.playTime}}出发/{{item.orderType==2?'包船':'拼船'}}/{{item.boatNo}}</text>
+						<text>{{item.playDate}}
+							{{item.playTime}}出发/{{item.orderType==2?'包船':'拼船'}}/{{item.boatNo}}</text>
 						<text>{{item.num}}人 · 出游{{item.playLength}}小时</text>
 						<text>上船时间:{{item.updateDate}}</text>
 					</view>
@@ -30,7 +31,7 @@
 				</view>
 			</block>
 			<block v-else>
-				<NoData/>
+				<NoData />
 			</block>
 		</view>
 		<u-datetime-picker @confirm="confirmDate" @cancel="show=false" :show="show" v-model="value1"
@@ -65,17 +66,33 @@
 		methods: {
 			getdata() {
 				this.$api.get('/scenic/order/writeOffRecordPage', {
-					limit:50,
-					page:1,
+					limit: 50,
+					page: 1,
 					merchantId: this.merchantId,
 					// queryDate: this.date,
 					startDate: this.date,
 					endDate: this.date2
 				}).then(res => {
 					if (res.data.code == 0) {
-						this.totalAmount = res.data.data.totalAmount;
+						// this.totalAmount = res.data.data.totalAmount;
 						this.totalNum = res.data.data.totalNum;
-						this.data=res.data.data.pageData.list;
+						this.data = res.data.data.pageData.list;
+						var num = res.data.data.totalAmount.toString(); // 转成字符串类型  如能确定类型 这步可省去
+						if (num.indexOf(".") !== -1) {
+							let [integerPart, decimalPart] = num.split(".");
+
+							if (decimalPart.length > 2) {
+								decimalPart = decimalPart.substring(0, 2);
+							} else if (decimalPart.length === 1) {
+								decimalPart += "0";
+							}
+							num = `${integerPart}.${decimalPart}`;
+						} else {
+							num += ".00";
+						}
+						console.log(num);
+						this.totalAmount = num
+						return num;
 					}
 				})
 			},
@@ -89,11 +106,11 @@
 				// 格式化时间
 				let formattedTime = "";
 				formattedTime = `${year}-${month}-${day}`;
-				
-				if(Date.parse(formattedTime) - Date.parse(this.date2)>0){
+
+				if (Date.parse(formattedTime) - Date.parse(this.date2) > 0) {
 					return this.$showToast('开始日期不能大于结束日期');
 				}
-				
+
 				this.dateStr = `${year}-${month}-${day}`
 				this.date = formattedTime;
 				this.show = false;
@@ -109,19 +126,19 @@
 				// 格式化时间
 				let formattedTime = "";
 				formattedTime = `${year}-${month}-${day}`;
-				
-				if(Date.parse(formattedTime) - Date.parse(this.date)<0){
+
+				if (Date.parse(formattedTime) - Date.parse(this.date) < 0) {
 					return this.$showToast('结束日期不能小于开始日期');
 				}
-				
+
 				this.dateStr2 = `${year}-${month}-${day}`
 				this.date2 = formattedTime;
 				this.show2 = false;
 				this.getdata()
 			},
-			toDetails(item){
+			toDetails(item) {
 				uni.navigateTo({
-					url:'/pagesHouse/Verification/recordDetails?orderCode='+item.orderCode
+					url: '/pagesHouse/Verification/recordDetails?orderCode=' + item.orderCode
 				})
 			}
 		}
@@ -129,13 +146,14 @@
 </script>
 
 <style lang="less" scoped>
-	/deep/ .uicon-arrow-right{
+	/deep/ .uicon-arrow-right {
 		margin-top: 4rpx !important;
 	}
-	
-	.page{
+
+	.page {
 		box-sizing: border-box;
 	}
+
 	.top {
 		padding: 24rpx 30rpx;
 

+ 24 - 6
pagesHouse/Verification/recordCy.vue

@@ -21,7 +21,7 @@
 				</view>
 			</block>
 			<block v-else>
-				<NoData/>
+				<NoData />
 			</block>
 		</view>
 		<u-datetime-picker @confirm="confirmDate" @cancel="show=false" :show="show" v-model="value1"
@@ -49,7 +49,7 @@
 				if (val) {
 					return val.split(',')[0]
 				}
-		
+
 			}
 		},
 		onLoad() {
@@ -58,14 +58,31 @@
 		methods: {
 			getdata() {
 				this.$api.post('/api/merchant/food/getMerchantFoodWriteOffList', {
-					dateType:1,
+					dateType: 1,
 					merchantId: this.merchantId,
 					queryDate: this.date
 				}).then(res => {
 					if (res.data.code == 0) {
-						this.totalAmount = res.data.data.orderAmount;
+						// this.totalAmount = res.data.data.orderAmount;
 						this.totalNum = res.data.data.orders;
-						this.data=res.data.data.merchantOrderDTOS;
+						this.data = res.data.data.merchantOrderDTOS;
+						var num = res.data.data.orderAmount.toString(); // 转成字符串类型  如能确定类型 这步可省去
+						if (num.indexOf(".") !== -1) {
+							let [integerPart, decimalPart] = num.split(".");
+
+							if (decimalPart.length > 2) {
+								decimalPart = decimalPart.substring(0, 2);
+							} else if (decimalPart.length === 1) {
+								decimalPart += "0";
+							}
+
+							num = `${integerPart}.${decimalPart}`;
+						} else {
+							num += ".00";
+						}
+						console.log(num);
+						this.totalAmount = num;
+						return num;
 					}
 					console.log(res)
 				})
@@ -91,9 +108,10 @@
 </script>
 
 <style lang="less" scoped>
-	.page{
+	.page {
 		box-sizing: border-box;
 	}
+
 	.top {
 		padding: 24rpx 30rpx;
 		display: flex;