李天标 5 gadi atpakaļ
vecāks
revīzija
65e0cbe324

+ 24 - 0
pages.json

@@ -70,6 +70,30 @@
 			}
 		},
 		{
+		    "path" : "pages/Setting/pay",
+		    "style" : {
+				"navigationBarTitleText":"支付",
+				// "disableScroll": true,
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+		    "path" : "pages/Setting/dayPay",
+		    "style" : {
+				"navigationBarTitleText":"按日支付",
+				// "disableScroll": true,
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+		    "path" : "pages/Setting/timesPay",
+		    "style" : {
+				"navigationBarTitleText":"按次数支付",
+				// "disableScroll": true,
+				"enablePullDownRefresh": true
+			}
+		},
+		{
 		    "path" : "pages/User/user",
 		    "style" : {
 				"navigationBarTitleText":"我的"

+ 9 - 2
pages/Setting/Setting.vue

@@ -5,8 +5,8 @@
 				<uni-collapse-item :title="getEquipmentTitle(equipment)">
 					<uni-list>
 						<uni-list-item title="使用统计" note="单台机器的使用次数统计" @click="useStatistics(equipment.id,equipment.name)" thumb="../../static/img/统计.png"></uni-list-item>
-						<uni-list-item title="清洗规则" note="设定机器每天的清洗时间段" @click="rule(equipment.id,equipment.name,equipment.rule)" thumb="../../static/img/任务.png"></uni-list-item>
-						<uni-list-item title="支付" note="按天数/次数支付" show-extra-icon="true" thumb="../../static/img/支付.png"></uni-list-item>
+						<uni-list-item title="清洗规则" note="设定机器每天的清洗时间段(单台机器)" @click="rule(equipment.id,equipment.name,equipment.rule)" thumb="../../static/img/任务.png"></uni-list-item>
+						<uni-list-item title="支付" note="按天数/次数支付(单台机器)" show-extra-icon="true" @click="pay(equipment.id,equipment.name)" thumb="../../static/img/支付.png"></uni-list-item>
 						<uni-list-item title="参数调整" thumb="../../static/img/参数.png"></uni-list-item>
 					</uni-list>
 				</uni-collapse-item>
@@ -113,6 +113,13 @@
 					url: 'cleanRule',
 				});
 			},
+			pay(equipmentId,equipmentName){
+				uni.setStorageSync('nowEquipmentId', equipmentId);
+				uni.setStorageSync('nowEquipmentName', equipmentName);
+				uni.navigateTo({
+					url: 'pay',
+				});
+			},
 		}
 	}
 </script>

+ 171 - 0
pages/Setting/dayPay.vue

@@ -0,0 +1,171 @@
+<template>
+	<view class=" ">
+		<view class="font header">
+			价格:{{price}}元/天
+		</view>
+		<view class="font header">
+			<view class="font">
+				你要购买的数量:
+			</view>
+			<view class="input-two">
+				<input type="text" class="input" v-model="num" />
+			</view>
+			<view class="font3">
+				天
+			</view>
+		</view>
+		<view class="font2 header">
+			合计:{{num*price}}元
+		</view>
+		<view class="button">
+			<button type="primary" @click="buy()" class="button2">
+				<p class="p">购买</p>
+			</button>
+		</view>
+		<font class="font1">{{title}}</font>
+		<view class="" style="margin: auto;">
+			<!-- <font class="font1">{{title}}</font> -->
+			<image class="" :src=img mode=""></image>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapActions,
+		mapMutations
+	} from 'vuex'
+	export default {
+		data() {
+			return {
+				price: '',
+				num: '10',
+				title: '',
+				img: null
+			}
+		},
+		onLoad() {},
+		onShow() {
+			this.findPrice();
+		},
+		methods: {
+			...mapActions('chart', ['getPrice', 'pay']),
+			findPrice() {
+				var name = "dayPay";
+				this.getPrice(name)
+					.then(data => {
+						this.price = data;
+					}, _ => void uni.stopPullDownRefresh());
+			},
+			buy() {
+				var p = this.price;
+				var n = this.num;
+				var pri = p * n;
+				if (pri == 0) {
+					uni.showModal({
+						content: '请选择数量',
+						showCancel: false
+					});
+					return null;
+				}
+				const param = {};
+				param['price'] = pri;
+				param['type'] = "0";
+				param['equipmentId'] = uni.getStorageSync("nowEquipmentId");
+				param['adminId'] = uni.getStorageSync("globalUser").id;
+				this.pay(param).then(data => {
+					this.title = "请用微信扫码支付";
+					this.img = data;
+				}, _ => void uni.stopPullDownRefresh());
+			},
+		},
+
+	}
+</script>
+
+<style>
+	.header {
+		display: flex;
+		flex-direction: row;
+		justify-content: flex-start;
+		padding-left: 20upx;
+	}
+
+	.font {
+		padding-top: 20upx;
+		height: 70upx;
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+
+	.font2 {
+		padding-top: 40upx;
+		padding-bottom: 30upx;
+		height: 70upx;
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+
+	.font3 {
+		padding-left: 30upx;
+		padding-top: 23upx;
+		height: 70upx;
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+
+	.input-two {
+		width: 80upx;
+		height: 30upx;
+		padding-top: 23upx;
+		padding-left: 30upx;
+	}
+
+	.input {
+		padding-left: 20upx;
+
+		background-color: #FFFFFF;
+		width: 80upx;
+		height: 30upx;
+		box-shadow: 0upx 0upx 20upx #D3D3D3;
+		border-radius: 5upx;
+	}
+
+	.button {
+		padding-top: 70upx;
+		margin: auto;
+		width: 80%;
+		height: 100upx;
+	}
+
+	.button2 {
+		margin: auto;
+		width: 80%;
+		height: 100upx;
+	}
+
+	.p {
+		padding-top: 2upx;
+		margin: 0 auto;
+		font-size: 45upx;
+		font-family: "PingFang-SC-Bold";
+	}
+
+	.font1 {
+		color: #F4AE1B;
+		padding-left: 300upx;
+		padding-top: 100upx;
+		font-size: 25upx;
+		font-family: "PingFang-SC-Bold";
+	}
+
+	.img {
+		height: 600upx;
+		weight: 600upx;
+		margin: auto;
+	}
+</style>

+ 29 - 0
pages/Setting/pay.vue

@@ -0,0 +1,29 @@
+<template>
+	<view class="">
+		<uni-list>
+			<uni-list-item title="按天数购买"  @click="day()"></uni-list-item>
+			<uni-list-item title="按使用次数购买"  @click="times()"></uni-list-item>
+		</uni-list>
+	</view>
+</template>
+
+<script>
+	export default {
+		methods: {
+			day(){
+				uni.navigateTo({
+					url: 'dayPay',
+				});
+			},
+			times(){
+				uni.navigateTo({
+					url: 'timesPay',
+				});
+			},
+			
+		}
+	}
+</script>
+
+<style>
+</style>

+ 162 - 0
pages/Setting/timesPay.vue

@@ -0,0 +1,162 @@
+<template>
+	<view class=" ">
+		<view class="font header">
+			价格:{{price}}元/次
+		</view>
+		<view class="font header">
+			<view class="font">
+				你要购买的数量:
+			</view>
+			<view class="input-two">
+				<input  type="text" class="input" v-model="num" />
+			</view>
+			<view class="font3">
+				次
+			</view>
+		</view>
+		<view class="font2 header">
+			合计:{{num*price}}元
+		</view>
+		<view class="button">
+			<button type="primary" @click="buy()" class="button2">
+				<p class="p">购买</p>
+			</button>
+		</view>
+		<font class="font1">{{title}}</font>
+		<view class="" style="margin: auto;">
+			<image class=""  :src=img mode=""></image>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapActions,
+		mapMutations
+	} from 'vuex'
+	export default {
+		data() {
+			return {
+				price:'',
+				num:'10',
+				title:'',
+				img:null
+			}
+		},
+		onLoad() {
+		},
+		onShow() {
+			this.findPrice();
+		},
+		methods: {
+			...mapActions('chart', ['getPrice','pay']),
+			findPrice(){
+				var name = "timesPay";
+				this.getPrice(name)
+					.then(data => {
+						this.price = data;
+					}, _ => void uni.stopPullDownRefresh());
+			},
+			buy(){
+				var p = this.price;
+				var n = this.num;
+				var pri = p*n;
+				if(pri==0){
+					uni.showModal({
+						content: '请选择数量',
+						showCancel: false
+					});
+					return null;
+				}
+				const param = {};
+				param['price'] = pri;
+				param['type'] = "1";
+				param['equipmentId'] = uni.getStorageSync("nowEquipmentId");
+				param['adminId'] = uni.getStorageSync("globalUser").id;
+				this.pay(param).then(data => {
+					this.title = "请用微信扫码支付";
+					this.img = data;
+				}, _ => void uni.stopPullDownRefresh());
+				
+			}
+		},
+
+	}
+</script>
+
+<style>
+	.header {
+		display: flex;
+		flex-direction: row;
+		justify-content: flex-start;
+		padding-left: 20upx;
+	}
+	.font{
+		padding-top: 20upx;
+		height: 70upx;
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.font2{
+		padding-top: 40upx;
+		padding-bottom: 30upx;
+		height: 70upx;
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.font3{
+		padding-left: 30upx;
+		padding-top: 23upx;
+		height: 70upx;
+		color: #363D44;
+		font-size: 36upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.input-two {
+		width: 80upx;
+		height: 30upx;
+		padding-top: 23upx;
+		padding-left: 30upx;
+	}
+	.input {
+		padding-left: 20upx;
+		
+		background-color: #FFFFFF;
+		width: 80upx;
+		height: 30upx;
+		box-shadow: 0upx 0upx 20upx #D3D3D3;
+		border-radius: 5upx;
+	}
+	.button{
+		padding-top: 70upx;
+		margin: auto;
+		width: 80%;
+		height: 100upx;
+	}
+	.button2{
+		margin: auto;
+		width: 80%;
+		height: 100upx;
+	}
+	.p{
+		padding-top: 2upx;
+		margin: 0 auto;
+		font-size: 45upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.font1{
+		color: #F4AE1B;
+		padding-left: 300upx;
+		padding-top: 100upx;
+		font-size: 25upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.img{
+		height: 600upx;
+		weight:600upx;
+		margin: auto;
+	}
+</style>

+ 17 - 0
store/modules/chart.js

@@ -76,6 +76,7 @@ export default {
 					return data;
 				});
 		},
+		//修改定时清洗规则
 		updateRule({ commit },param) {
 			return apis.sz.post('/TEquipment/updateRule',param)
 				.then(res => {
@@ -83,6 +84,22 @@ export default {
 					return data;
 				});
 		},
+		//获取价格
+		getPrice({ commit },name) {
+			return apis.sz.post('/TPromoCode/getPrice',name)
+				.then(res => {
+					const { data } = res;
+					return data;
+				});
+		},
+		//支付
+		pay({ commit },param) {
+			return apis.sz.post('/TOrder/pay',param)
+				.then(res => {
+					const { data } = res;
+					return data;
+				});
+		},
 	}
 }