소스 검색

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
修改

1004749546@qq.com 4 년 전
부모
커밋
cf53260aaf
8개의 변경된 파일153개의 추가작업 그리고 45개의 파일을 삭제
  1. 1 1
      App.vue
  2. 7 1
      api/order.js
  3. 9 0
      pages.json
  4. 75 0
      pages/checkOut/checkFinish.vue
  5. 22 31
      pages/order/order.vue
  6. 23 8
      pages/order/orderDetail.vue
  7. 1 1
      pages/toOrder/editAddress.vue
  8. 15 3
      pages/toOrder/index.vue

+ 1 - 1
App.vue

@@ -1,6 +1,6 @@
 <script>
 	// const uat_URL = 'https://carwash.test.zyucgj.com/gc-shop/' // 预发布
-	const uat_URL = 'http://192.168.16.155:8302/gc-shop/' // 本地
+	const uat_URL = 'http://192.168.16.105:8302/gc-shop/' // 本地
 	const pro_URL = 'https://carwash.zyucgj.com/gc-shop/'  // 生产
 	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url

+ 7 - 1
api/order.js

@@ -7,7 +7,13 @@ export const getStoreItems = params => {
     method: 'get',
   })
 };
-
+// 查看用户是否设置过支付密码
+export const existPayPwd = params => {
+  return axios.request({
+    url: `customer/existPayPwd`,
+    method: 'get',
+  })
+};
 // 下单 保存订单
 export const saveOrder = params => {
   return axios.request({

+ 9 - 0
pages.json

@@ -182,6 +182,15 @@
 		        "enablePullDownRefresh": false
 		    }
 		    
+		},
+		{
+		    "path" : "pages/checkOut/checkFinish",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "核销完成",
+		        "enablePullDownRefresh": false
+		    }
+		    
 		}
     ],
 	"globalStyle": {

+ 75 - 0
pages/checkOut/checkFinish.vue

@@ -0,0 +1,75 @@
+<template>
+	<view class="page-cont">
+		<view class="icon-cont">
+			<u-icon class="icon" name="checkmark" color="#62c500" size="80"></u-icon>
+			<view>支付成功</view>
+			<view>150 乐豆</view>
+		</view>
+		<view class="back-btn">
+			<u-button @click="toHome">返回首页</u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			orderId: '' //订单id
+		}
+	},
+	onLoad(option) {
+		console.log(option,'option')
+		this.orderId = option.id
+	},
+	methods: {
+		// 查看订单详情
+		toOrderDetail() {
+			uni.navigateTo({
+			    url: '/pages/order/orderDetail?id=' + this.orderId
+			})
+		},
+		// 返回首页
+		toHome() {
+			uni.reLaunch({
+			    url: '/pages/index/index'
+			})
+		}
+	}
+}
+</script>
+
+<style lang="less">
+	page{
+		height: 100%;
+	}
+	.page-cont{
+		width: 100%;
+		height: 100%;
+		background-color: #fff;
+		padding: 0 40upx;
+		.icon-cont{
+			width: 100%;
+			height: 400upx;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			justify-content: center;
+			>view{
+				font-size: 30upx;
+				margin-top: 40upx;
+			}
+		}
+		.icon{
+			width: 120upx;
+			height: 120upx;
+			background-color: #d1d1d1;
+			display: flex;
+			justify-content: center;
+			border-radius: 50%;
+		}
+		.back-btn{
+			margin-top: 40upx;
+		}
+	}
+</style>

+ 22 - 31
pages/order/order.vue

@@ -37,19 +37,22 @@
 								</view>
 							</view>
 							<view class="check-row">
-								<view v-if="item.orderState=='WAIT_PAY'"  class="text-right">
-									<text style="margin-right: 30upx;">支付剩余{{filterTime(item.orderTime)}}</text>
-									<u-button class="btn-cont" @click="toPay(item)"  shape="circle" type="error" size="medium">去支付</u-button>
+								<view v-if="item.orderState=='WAIT_PAY'"  class="text-right left-time">
+										<text style="margin-right: 20upx;">
+											支付剩余
+										</text>
+										<u-count-down @end="getRow" style="margin-right: 20upx;" separator ="zh" :timestamp="filterTime(item.orderTime)" :show-days="false" :show-hours="false"></u-count-down>
+									<u-button :custom-style="btnStyle" @click="toPay(item)"  shape="circle" type="error" size="medium">去支付</u-button>
 								</view>
 								<view v-if="item.orderState=='WAIT_SEND'" class="text-right">
-									<u-button class="btn-cont" @click="showTip" shape="circle" size="medium">提醒发货</u-button>
+									<u-button :custom-style="btnStyle" @click="showTip" shape="circle" size="medium">提醒发货</u-button>
 								</view>
 								<view v-if="item.orderState=='SEND_ALL'" class="text-right">
-									<u-button @click="showLog(item)" class="btn-cont" style="margin-right: 20upx;" shape="circle" size="medium">查看物流</u-button>
-									<u-button class="btn-cont" shape="circle" type="primary" size="medium">确认收货</u-button>
+									<u-button @click="showLog(item)" :custom-style="btnStyle" style="margin-right: 20upx;" shape="circle" size="medium">查看物流</u-button>
+									<u-button :custom-style="btnStyle" shape="circle" type="primary" size="medium">确认收货</u-button>
 								</view>
 								<view v-if="item.orderState=='FINISH'" class="text-right">
-									<u-button @click="showLog(item)" class="btn-cont" shape="circle" size="medium">查看物流</u-button>
+									<u-button @click="showLog(item)" :custom-style="btnStyle" shape="circle" size="medium">查看物流</u-button>
 								</view>
 							</view>
 						</view>
@@ -108,6 +111,10 @@
 		components: {},
 		data() {
 			return {
+				btnStyle:{
+					width: '180rpx',
+					fontSize: '30rpx',
+				},
 				status: 'loadmore',
 				noDataText: '暂无数据',
 				tabList: [{
@@ -148,6 +155,7 @@
 				},
 				total: 0,
 				totalPrice: 0, // 支付合计
+				password: '', // 支付密码
 				action: 'swiperChange', // 操作类型,上划分页,或左右滑动
 				showSetPswModal: false,  // 设置支付密码弹窗
 				showInputPsw: false, // 打开输入密码弹窗
@@ -155,15 +163,16 @@
 			}
 		},
 		onShow() {
-			this.pageInit()
 		},
 		onLoad() {
 			// 监听设置密码是否成功
 			uni.$once('setPswSuccess', this.setPsw)
+			// 监听详情支付成功事件
+			uni.$on('refresh', this.handleRefresh)
+			this.pageInit()
 		},
 		onUnload() {
-			uni.$off('refreshBL', this.refresh)
-			uni.$off('refreshBl-handle', this.handleRefresh)
+			uni.$off('refresh', this.handleRefresh)
 		},
 		methods: {
 			pageInit() {
@@ -265,29 +274,12 @@
 			},
 			// 支付剩余时间
 			filterTime (time) {
+				console.log(time,'tttttt')
 				let nowT = new Date().valueOf() // 现在时间戳
 				let orderT = new Date(time).valueOf() // 下单时间戳
 				let tt = (1800 * 1000) - (nowT - orderT)   // 距离30分钟支付 相差时间戳  
-				
-				setInterval(()=>{
-					if(tt>0) {
-						tt = tt -1000
-					} else {
-						clearInterval()
-						// this.getRow()
-					}
-				},1000)
-				//计算相差分钟数
-				var leave1 = tt % (3600 * 1000); //计算小时数后剩余的毫秒数
-				var minutes = Math.floor(tt / (60 * 1000));
-				//计算相差秒数
-				var leave3 = leave1 % (60 * 1000); //计算分钟数后剩余的毫秒数
-				var seconds = Math.round(leave3 / 1000);
-				
-				console.log(minutes + "天 " + seconds + "小时 ")
-				
-				// console.log(new Date(time).valueOf(),dt.valueOf(),'ttttttt')
-				return  minutes + "分 " + seconds + "秒"
+				console.log(tt,'tttttt')
+				return  tt
 			},
 			
 			// 跳转到设置支付密码页
@@ -480,7 +472,6 @@
 						justify-content: space-between;
 					}
 				}
-
 				.btn-cont {
 					width: 180upx;
 					font-size: 30upx;

+ 23 - 8
pages/order/orderDetail.vue

@@ -62,7 +62,7 @@
 			</u-cell-group>
 		</view>
 		<view v-if="orderInfo.orderState=='WAIT_PAY'" class="footer">
-			<u-button @click="cancleOrder" type="error">去支付</u-button>
+			<u-button @click="toPay" type="error">去支付</u-button>
 		</view>
 		<!-- 提示用户设置支付密码 -->
 		<u-modal v-model="showSetPswModal" 
@@ -101,7 +101,8 @@
 <script>
 	import {
 		orderDetail,
-		cancleOrder
+		cancleOrder,
+		existPayPwd
 	} from '@/api/order.js'
 	import {
 		getLookUpDatas
@@ -111,6 +112,7 @@
 			return {
 				orderInfo: {},
 				totalPrice: 0, // 支付合计
+				password: '', // 支付密码
 				showSetPswModal: false,  // 设置支付密码弹窗
 				showInputPsw: false, // 打开输入密码弹窗
 				showLeavePsw: false, // 打开确定放弃弹窗
@@ -175,16 +177,29 @@
 				this.showInputPsw = true
 			},
 			// 支付
-			toPay(item) {
-				// this.totalPrice = item.payGold
-				// this.showSetPswModal = true
-				// return
-				signPay({id:item.id}).then(res=>{
+			toPay() {
+				existPayPwd().then(res=>{
+					console.log(res,'rrrrrr')
+					if(res.status == 200) {
+						if(res.data) {
+							// this.totalPrice = item.payGold
+							// this.showSetPswModal = true
+						}
+					} else {
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+				})
+				
+				signPay({id:this.orderInfo.id}).then(res=>{
 					this.btnLoading = false
 					if(res.status == 200) {
+						uni.$emit('refresh')
 						// 跳转到支付完成界面
 						uni.navigateTo({
-							url:"/pages/toOrder/payFinish?id=" + this.orderId
+							url:"/pages/toOrder/payFinish?id=" + this.orderInfo.id
 						})
 					} else{
 						uni.showToast({

+ 1 - 1
pages/toOrder/editAddress.vue

@@ -12,7 +12,7 @@
 				<u-picker v-model="show" @confirm="chooseArea" mode="region"></u-picker>
 			</u-form-item>
 			<u-form-item label="详细地址" required prop="receiveAddress">
-				<u-input placeholder="请输入收货详细地址" :maxlength="100" v-model="form.receiveAddress" />
+				<u-input placeholder="请输入收货详细地址(最多500个字符)" :maxlength="500" v-model="form.receiveAddress" />
 			</u-form-item>
 		</u-form>
 		<view class="buttons">

+ 15 - 3
pages/toOrder/index.vue

@@ -92,7 +92,7 @@
 </template>
 
 <script>
-	import { saveOrder, signPay} from '@/api/order.js'
+	import { saveOrder, signPay, existPayPwd} from '@/api/order.js'
 	import {
 		findAddressBycustomerNo
 	} from '@/api/receiveAddress.js'
@@ -114,6 +114,7 @@
 				},
 				btnLoading: false,  // 提交按钮加载圈
 				orderId: '', // 订单id
+				password: '', // 支付密码
 				showSetPswModal: false,  // 设置支付密码弹窗
 				showInputPsw: false, // 打开输入密码弹窗
 				showLeavePsw: false, // 打开确定放弃弹窗
@@ -183,6 +184,13 @@
 			},
 			// 支付  保存订单
 			toSave(){
+				existPayPwd().then(res=>{
+					console.log(res,'rrrrrr')
+					if(res.status == 200) {
+						
+					}
+				})
+				return
 				// this.showSetPswModal = true
 				// return
 				let orderGoodsList = []
@@ -193,8 +201,12 @@
 					}
 				})
 				this.btnLoading = true
-				let params = Object.assign(this.userInfo,{orderGoodsList:orderGoodsList})
-				console.log(orderGoodsList,params,'orderGoodsList')
+				let params = {
+					receiveAddress: this.userInfo.receiveAddress,
+					receiverName: this.userInfo.receiverName,
+					receiverPhone: this.userInfo.receiverPhone,
+					orderGoodsList: orderGoodsList
+				}
 				saveOrder(params).then(res=>{
 					console.log(res,'rrrrrrr')
 					if(res.status==200) {