Pārlūkot izejas kodu

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

1004749546@qq.com 4 gadi atpakaļ
vecāks
revīzija
1a01879049

+ 11 - 5
api/order.js

@@ -40,19 +40,25 @@ export const getOrderList = params => {
 // 订单详情
 export const orderDetail = params => {
   return axios.request({
-    url: `order/find/${params.id}`,
+    url: `order/findById/${params.id}`,
     method: 'get',
   })
 };
 
-// 查询当前是否有未完成的订单
-export const getUnFinishedOrder = params => {
+// 查询物流
+export const queryOrderExpress = params => {
 	return axios.request({
-	  url: `order/unFinishedOrderRunStatus`,
+	  url: `orderExpress/findByOrderNo/${params.id}`,
+	  method: 'get',
+	})
+}
+// 查物流下商品信息
+export const queryOrderGoods = params => {
+	return axios.request({
+	  url: `orderGoods/findByExpressNo/${params.id}`,
 	  method: 'get',
 	})
 }
-
 // 取消订单
 export const cancleOrder = params => {
 	return axios.request({

+ 1 - 1
api/receiveAddress.js

@@ -3,7 +3,7 @@ import axios from '@/libs/axios.js';
 // 根据客户编号查找收货地址
 export const findAddressBycustomerNo = params => {
   return axios.request({
-    url: `receiveaddress/findBycustomerNo/${params.customerNo}`,
+    url: `receiveaddress/findBycustomerNo`,
     method: 'get'
   })
 };

+ 39 - 66
pages/order/LogList.vue

@@ -1,24 +1,21 @@
 <template>
 	<view class="pagesCons">
 		<view class="tab-body">
-			<view class="uTabs">
-				<u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
-				 swiperWidth="750"></u-tabs-swiper>
-			</view>
-			<swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
-				<swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
 					<scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
-						<view class="check-order-list" v-if="index==current" v-for="(item,sindex) in list" :key="item.id+'-'+sindex"
+						<view class="check-order-list" v-for="(item,sindex) in list" :key="item.id"
 						 @click="viewRow(item)">
 							<view class="order-log">
+								<view v-if="item.orderFlag=='待发货'">待发货</view>
 								<view>
-									快递公司:<text class="address-title">{{item.logName}}</text>
-									<text class="btn-cont" @click="copyLogNum" style="float: right;">确认收货</text>
-								</view>
-								<view>
-									<text>运单编号:</text>
-									<text>{{item.logNum}}</text>
-									<u-button @click="copyLogNum" style="margin-left: 20upx;" shape="square" size="mini">复制</u-button>
+									<view>
+										快递公司:<text class="address-title">{{item.logName}}</text>
+										<text class="btn-cont" @click="copyLogNum" style="float: right;">确认收货</text>
+									</view>
+									<view>
+										<text>运单编号:</text>
+										<text>{{item.logNum}}</text>
+										<u-button @click="copyLogNum" style="margin-left: 20upx;" shape="square" size="mini">复制</u-button>
+									</view>
 								</view>
 							</view>
 							<u-gap height="10" bg-color="#f8f8f8"></u-gap>
@@ -37,12 +34,10 @@
 						</view>
 						<u-empty style="padding-top: 10vh;height: auto;" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'"
 						 mode="list"></u-empty>
-						<view v-if="index==current" style="padding: 20upx;">
+						<view style="padding: 20upx;">
 							<u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
 						</view>
 					</scroll-view>
-				</swiper-item>
-			</swiper>
 		</view>
 		 <!-- 查看物流弹窗 -->
 		<view>
@@ -62,10 +57,7 @@
 </template>
 
 <script>
-	import {
-		getLookUpDatas,
-		listLookUp
-	} from '@/api/data'
+	import { queryOrderExpress } from '@/api/order.js'
 	export default {
 		components: {
 		},
@@ -74,23 +66,6 @@
 				isShow: false, // 是否显示物流弹框
 				status: 'loadmore',
 				noDataText: '暂无数据',
-				tabList: [
-					{
-						dispName: '包裹1',
-						typeId: 1,
-						queryLabel: 'DZF' // tab参数
-					},
-					{
-						dispName: '包裹2',
-						typeId: 3,
-						queryLabel: 'DFH' // tab参数
-					},
-					{
-						dispName: '待发货',
-						typeId: 3,
-						queryLabel: 'YFH' // tab参数
-					},
-				],
 				current: 0,
 				swiperCurrent: 0,
 				pageNo: 1,
@@ -120,34 +95,6 @@
 			handleRefresh() {
 				this.getRow()
 			},
-			// tabs通知swiper切换
-			tabsChange(index) {
-				this.swiperCurrent = index;
-			},
-			swiperChange(event) {
-				this.action = 'swiperChange'
-				this.status = 'loading'
-			},
-			// swiper-item左右移动,通知tabs的滑块跟随移动
-			transition(e) {
-				let dx = e.detail.dx;
-				this.$refs.uTabs.setDx(dx);
-			},
-			// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
-			// swiper滑动结束,分别设置tabs和swiper的状态
-			animationfinish(e) {
-				let current = e.detail.current;
-				let isCurtab = this.current == current
-				if (this.status != "nomore") {
-					let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
-					if (loadData) {
-						this.$refs.uTabs.setFinishCurrent(current);
-						this.swiperCurrent = current;
-						this.current = current;
-						this.resetPage();
-					}
-				}
-			},
 			// scroll-view到底部加载更多
 			onreachBottom() {
 				this.action = 'onreachBottom'
@@ -190,6 +137,32 @@
 							icon: ''
 						}
 					]
+				},
+				{
+					createDate: "2020-10-28 11:15:59",
+					orderFlag: "待支付",
+					payedAmount: 0,
+					id: 12,
+					amount: 450,
+					totalNum: 3,
+					logName: '韵达快递',
+					logNum: '12454545485',
+					itemList: [
+						{
+							name: "八九箭冠",
+							id: 76435,
+							number: 1,
+							price: 150,
+							icon: ''
+						},
+						{
+							name: "数据库的合法身份觉得很附近发生纠纷解决",
+							id: 76436,
+							number: 2,
+							price: 150,
+							icon: ''
+						}
+					]
 				}]
 				return 
 				if (pageNo) {

+ 128 - 33
pages/order/order.vue

@@ -8,7 +8,7 @@
 			<swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
 				<swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
 					<scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
-						<view class="check-order-list" v-if="index==current" v-for="(item,sindex) in list" :key="item.id+'-'+sindex"
+						<view class="check-order-list" v-if="index==current" v-for="item in list" :key="item.id"
 						 @click="viewRow(item)">
 							<view class="check-row">
 								<view class="createDate">{{item.createDate}}</view>
@@ -31,25 +31,24 @@
 									<text class="total-text">
 										共{{item.goodsNum}}件商品
 									</text>
-									<text v-if="item.orderFlag=='待支付'"><text class="money-total">应付</text><text class="price-num">{{item.originalGold}}</text>
+									<text v-if="item.orderState=='待支付'"><text class="money-total">应付</text><text class="price-num">{{item.originalGold}}</text>
 										<text class="price-text">乐豆</text></text>
-									<text v-else><text class="money-total">实付</text><text class="price-num">{{item.payGold}}</text> <text
-										 class="price-text">乐豆</text></text>
+									<text v-else><text class="money-total">实付</text><text class="price-num">{{item.payGold}}</text> <text class="price-text">乐豆</text></text>
 								</view>
 							</view>
 							<view class="check-row">
-								<view v-if="item.orderFlag=='待支付'" class="text-right">
-									<text style="margin-right: 30upx;">支付剩余1天45分</text>
-									<u-button class="btn-cont" shape="circle" type="error" size="medium">去支付</u-button>
+								<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>
-								<view v-if="item.orderFlag=='待发货'" class="text-right">
-									<u-button class="btn-cont" shape="circle" size="medium">提醒发货</u-button>
+								<view v-if="item.orderState=='WAIT_SEND'" class="text-right">
+									<u-button class="btn-cont" @click="showTip" shape="circle" size="medium">提醒发货</u-button>
 								</view>
-								<view v-if="item.orderFlag=='已发货'" class="text-right">
+								<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>
 								</view>
-								<view v-if="item.orderFlag=='已完成'" class="text-right">
+								<view v-if="item.orderState=='FINISH'" class="text-right">
 									<u-button @click="showLog(item)" class="btn-cont" shape="circle" size="medium">查看物流</u-button>
 								</view>
 							</view>
@@ -63,6 +62,37 @@
 				</swiper-item>
 			</swiper>
 		</view>
+		<!-- 提示用户设置支付密码 -->
+		<u-modal v-model="showSetPswModal" 
+		content="请先设置支付密码,才能使用乐豆" 
+		show-cancel-button 
+		confirm-text="去设置" 
+		cancel-text="暂时放弃"
+		@confirm="toSetPwd"
+		@cancel="showSetPswModal=false"
+		></u-modal>
+		<!-- 确认取消弹窗 -->
+		<u-modal v-model="showLeavePsw" 
+		title="确认放弃支付吗?"
+		content="您的订单在30分钟内未支付将被取消" 
+		show-cancel-button 
+		confirm-text="确认放弃" 
+		cancel-text="继续支付"
+		@confirm="canclePay"
+		@cancel="payAgain"
+		></u-modal>
+		<!-- 确认支付弹窗 -->
+		 <u-popup mode="center" closeable @close="showLeavePsw=true" v-model="showInputPsw" width="500rpx" >
+			<view class="slot-content">
+				<view>确认支付</view>
+				<view class="text-cont">
+					<text class="num-big">{{totalPrice}}</text>乐豆
+				</view>
+				<view class="footer">
+					<u-input v-model="password" maxlength="30" input-align="center" type="password" placeholder="请输入支付密码" />
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -72,7 +102,7 @@
 		listLookUp
 	} from '@/api/data'
 	import {
-		getOrderList
+		getOrderList, signPay
 	} from '@/api/order.js'
 	export default {
 		components: {},
@@ -93,7 +123,7 @@
 					{
 						dispName: '待发货',
 						typeId: 3,
-						queryLabel: ['WAIT_SEND','SEND_PART'] // tab参数
+						queryLabel: ['WAIT_SEND', 'SEND_PART'] // tab参数
 					},
 					{
 						dispName: '已发货',
@@ -117,12 +147,16 @@
 					logNum: 12356544544
 				},
 				total: 0,
+				totalPrice: 0, // 支付合计
 				action: 'swiperChange', // 操作类型,上划分页,或左右滑动
+				showSetPswModal: false,  // 设置支付密码弹窗
+				showInputPsw: false, // 打开输入密码弹窗
+				showLeavePsw: false, // 打开确定放弃弹窗
 			}
 		},
 		onLoad() {
-			// 监听待办处理后刷新
-			uni.$on('refreshBl-handle', this.handleRefresh)
+			// 监听设置密码是否成功
+			uni.$once('setPswSuccess', this.setPsw)
 			this.pageInit()
 		},
 		onUnload() {
@@ -227,37 +261,98 @@
 				this.searchParams = params
 				this.getRow(1)
 			},
-			// 查看物流
-			showLog(item) {
-				console.log(item, '111111')
+			// 支付剩余时间
+			filterTime (time) {
+				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 + "秒"
+			},
+			
+			// 跳转到设置支付密码页
+			toSetPwd () {
 				uni.navigateTo({
-					url: "/pages/order/LogList?id="
+					url:"/pages/userCenter/userInfo/paymentPwd"
 				})
 			},
-			// 复制运单编号 
-			copyLogNum() {
-				// H5 不支持
-				uni.setClipboardData({
-					data: this.logData.logNum,
-					success: function(res) {
-						uni.getClipboardData({
-							success: function(res) {
-								uni.showToast({
-									title: '已复制到剪贴板'
-								});
-							}
-						});
+			// 设置密码成功, 打开输入密码弹窗
+			setPsw (e) {
+				if (e.success) {
+					this.showInputPsw = true
+				}
+			},
+			//确认放弃
+			canclePay() {
+				this.showLeavePsw = false
+				this.showInputPsw = false
+			},
+			// 继续支付
+			payAgain () {
+				this.showLeavePsw = false
+				this.showInputPsw = true
+			},
+			// 支付
+			toPay(item) {
+				// this.totalPrice = item.payGold
+				// this.showSetPswModal = true
+				// return
+				signPay({id:item.id}).then(res=>{
+					this.btnLoading = false
+					if(res.status == 200) {
+						// 跳转到支付完成界面
+						uni.navigateTo({
+							url:"/pages/toOrder/payFinish?id=" + this.orderId
+						})
+					} else{
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
 					}
 				})
 			},
+			// 提醒发货
+			showTip() {
+				uni.showToast({
+					title: '已提醒商家发货',
+					icon: 'none'
+				})
+			},
+			// 查看物流
+			showLog(item) {
+				console.log(item, '111111')
+				uni.navigateTo({
+					url: "/pages/order/LogList?id=" + item.id
+				})
+			},
 			// 详细页
 			viewRow(item) {
 				// if (!this.$hasPermissions('M_backlog_detail_mobile')) {
 				// 	return
 				// }
+				console.log(item, '111111')
 				// 已完成的
 				uni.navigateTo({
-					url: "/pages/order/orderDetail?id="
+					url: "/pages/order/orderDetail?id=" + item.id
 				})
 			},
 		}

+ 17 - 17
pages/order/orderDetail.vue

@@ -3,11 +3,11 @@
 		<view class="order-info">
 			<!-- 订单状态 -->
 			<view class="order-status">
-				<view class="status-title">{{orderInfo.orderFlag}}</view>
-				<view v-if="orderInfo.orderFlag=='待支付'" class="status-care">
+				<view class="status-title">{{orderInfo.orderState}}</view>
+				<view v-if="orderInfo.orderState=='WAIT_PAY'" class="status-care">
 					请在 <text>2020-10-30</text>前付款,过期系统将自动取消订单
 				</view>
-				<view v-if="orderInfo.orderFlag=='已取消'" class="status-care">
+				<view v-if="orderInfo.orderState=='CANCEL'" class="status-care">
 					超时未支付,系统已自动取消订单
 				</view>
 			</view>
@@ -15,24 +15,24 @@
 			<!-- 地址 -->
 			<view class="order-address">
 				<view>
-					<text class="address-title">{{orderInfo.address}}</text>
+					<text class="address-title">{{orderInfo.receiveAddress}}</text>
 				</view>
 				<view>
-					<text style="margin-right: 30upx;">{{orderInfo.userName}}</text>
-					<text>{{orderInfo.phone}}</text>
+					<text style="margin-right: 30upx;">{{orderInfo.receiverName}}</text>
+					<text>{{orderInfo.receiverPhone}}</text>
 				</view>
 			</view>
 			<u-gap height="10" bg-color="#f8f8f8"></u-gap>
 			<!-- 商品列表 -->
-			<view class="bundle-list" v-for="item in orderInfo.itemList" :key="item.id">
+			<view class="bundle-list" v-for="item in orderInfo.orderGoodsList" :key="item.id">
 				<view class="img-cont">
-					<image :src="item.icon?item.icon:'../../static/goods.png'"></image>
+					<image :src="item.goodsImages"></image>
 				</view>
 				<view >
-					<view class="ellipsis-two">{{item.name}}</view>
+					<view class="ellipsis-two">{{item.goodsName}}</view>
 					<view class="bundle-num">
-						<view ><text class="price-num">{{item.price}}</text> <text class="price-text">乐豆</text></view>
-						<view >X {{item.number}}</view>
+						<view ><text class="price-num">{{item.payGold}}</text> <text class="price-text">乐豆</text></view>
+						<view >X {{item.buyQty}}</view>
 					</view>
 				</view>
 			</view>
@@ -40,7 +40,7 @@
 			<!-- 订单信息 -->
 			<u-cell-group>
 				<u-cell-item title="订单编号" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false" >
-					{{orderInfo.orderNo}}
+					{{orderInfo.orderSn}}
 				</u-cell-item>
 				<u-cell-item title="下单时间" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false" >
 					{{orderInfo.orderTime}}
@@ -50,17 +50,17 @@
 				</u-cell-item>
 				<u-gap height="10" bg-color="#f8f8f8"></u-gap>
 				<u-cell-item title="商品合计" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false">
-					<text class="price-num">{{orderInfo.amount}}</text> <text class="price-text">乐豆</text>
+					<text class="price-num">{{orderInfo.originalGold}}</text> <text class="price-text">乐豆</text>
 				</u-cell-item>
 				<u-cell-item title="运费" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false">
 					免运费
 				</u-cell-item>
-				<u-cell-item :title="(orderInfo.orderFlag=='待支付'||orderInfo.orderFlag=='已取消') ? '待支付':'实际支付'" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false">
-					<text class="price-num">{{orderInfo.amount}}</text> <text class="price-text">乐豆</text>
+				<u-cell-item :title="(orderInfo.orderState=='待支付'||orderInfo.orderState=='已取消') ? '待支付':'实际支付'" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false">
+					<text class="price-num">{{orderInfo.originalGold}}</text> <text class="price-text">乐豆</text>
 				</u-cell-item>
 			</u-cell-group>
 		</view>
-		<view v-if="orderInfo.orderFlag=='待支付'" class="footer">
+		<view v-if="orderInfo.orderState=='待支付'" class="footer">
 			<u-button @click="cancleOrder" type="error" >去支付</u-button>
 		</view>
 	</view>
@@ -77,7 +77,7 @@
 					userName: '王明',
 					phone: '18792701023',
 					orderTime: "2020-10-28 11:15:59",
-					orderFlag: "待支付",
+					orderState: "待支付",
 					orderNo: 121245465748,
 					payedAmount: 0,
 					id: 11,

+ 52 - 17
pages/toOrder/editAddress.vue

@@ -1,18 +1,18 @@
 <template>
 	<view class="content">
 		<u-form :model="form" ref="uForm" :label-width="140" :error-type="['toast']">
-			<u-form-item label="姓名" required prop="name">
-				<u-input placeholder="请输入姓名" :maxlength="30" v-model="form.name" />
+			<u-form-item label="姓名" required prop="receiverName">
+				<u-input placeholder="请输入姓名" :maxlength="30" v-model="form.receiverName" />
 			</u-form-item>
-			<u-form-item label="电话" required prop="mobile">
-				<u-input placeholder="请输入电话" :maxlength="11" type="number" v-model="form.mobile" />
+			<u-form-item label="电话" required prop="receiverPhone">
+				<u-input placeholder="请输入电话" :maxlength="11" type="number" v-model="form.receiverPhone" />
 			</u-form-item>
-			<u-form-item label="省市区" required prop="area">
-				<u-input v-model="form.area" placeholder="请选择省市区" @click="show = true" type="select" />
+			<u-form-item label="省市区" required prop="receiveAreasName">
+				<u-input v-model="form.receiveAreasName" placeholder="请选择省市区" @click="show = true" type="select" />
 				<u-picker v-model="show" @confirm="chooseArea" mode="region"></u-picker>
 			</u-form-item>
-			<u-form-item label="详细地址" required prop="address">
-				<u-input placeholder="请输入收货详细地址" :maxlength="100" v-model="form.address" />
+			<u-form-item label="详细地址" required prop="receiveAddress">
+				<u-input placeholder="请输入收货详细地址" :maxlength="100" v-model="form.receiveAddress" />
 			</u-form-item>
 		</u-form>
 		<view class="buttons">
@@ -22,18 +22,22 @@
 </template>
 
 <script>
+	import {
+		saveAddress
+	} from '@/api/receiveAddress.js'
 	export default {
 		data() {
 			return {
 				show: false,
 				form: {
-					name: '',
-					mobile: '',
-					area: '',
-					address: ''
+					receiverName: '',
+					receiverPhone: '',
+					receiveAreasreceiverName: '', // 地址名称
+					receiveAreas: '', // 地址编码
+					receiveAddress: '' // 详细地址
 				},
 				rules: {
-					name: [
+					receiverName: [
 						{ 
 							required: true, 
 							message: '请输入姓名', 
@@ -41,7 +45,7 @@
 							trigger: ['change','blur'],
 						}
 					],
-					mobile: [
+					receiverPhone: [
 						{ 
 							required: true, 
 							message: '请输入电话', 
@@ -49,14 +53,14 @@
 							trigger: ['change','blur'],
 						}
 					],
-					area: [
+					receiveAreasName: [
 						{
 							required: true, 
 							message: '请选择省市区', 
 							trigger: ['change','blur']
 						}
 					],
-					address: [
+					receiveAddress: [
 						{
 							required: true, 
 							max: 100, 
@@ -67,11 +71,41 @@
 				}
 			};
 		},
+		onLoad(option) {
+			this.form = this.$store.state.vuex_OrderAddress
+			if (this.form.receiveAreasName) {
+				uni.setNavigationBarTitle({
+					title: '修改地址'
+				})
+				this.form.receiveAreasName = this.form.receiveAreasName.replace(',','-')
+			} else {
+				uni.setNavigationBarTitle({
+					title: '新增地址'
+				})
+			}
+		},
 		methods: {
 			submit() {
 				this.$refs.uForm.validate(valid => {
 					if (valid) {
 						console.log('验证通过');
+						let params = this.form
+						saveAddress(params).then(res=>{
+							if(res.status == 200) {
+								uni.showToast({
+									title: res.message,
+									icon: 'none'
+								})
+								setTimeout(()=>{
+									uni.navigateBack()
+								},300)
+							} else {
+								uni.showToast({
+									title: res.message,
+									icon: 'none'
+								})
+							}
+						})
 					} else {
 						console.log('验证失败');
 					}
@@ -80,7 +114,8 @@
 			// 选择地址
 			chooseArea(e){
 				console.log(e)
-				this.form.area = e.province.label + '-' + e.city.label + '-' + e.area.label
+				this.form.receiveAreasName = e.province.label + '-' + e.city.label + '-' + e.area.label
+				this.form.receiveAreas = e.province.value + ',' + e.city.value + ',' + e.area.value
 			}
 		},
 		// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕

+ 121 - 16
pages/toOrder/index.vue

@@ -1,12 +1,16 @@
 <template>
 	<view class="cart-pages">
-		<view class="cart-bar">
+		<view v-if="!userInfo.receiveAddress" @click="editAddress" class="noAddress">
+			<view>请输入收货地址</view>
+			<u-icon name="arrow-right" size="36"></u-icon>
+		</view>
+		<view v-else class="cart-bar">
 			<view>
 				<u-image height="40rpx" width="40rpx" src="/static/position.png"></u-image>
 			</view>
 			<view class="position">
-				 <view class="address">陕西省西安市未央区华帝金座A座6楼</view>
-				 <view>王明 1456465455</view>
+				 <view class="address">{{userInfo.receiveAddress}}</view>
+				 <view>{{userInfo.receiverName +'&nbsp;&nbsp;&nbsp;' + userInfo.receiverPhone}}</view>
 			</view>
 			<view @click="editAddress">
 				<u-image height="50rpx" width="50rpx" src="/static/edit.png"></u-image>
@@ -53,6 +57,37 @@
 				<u-button size="mini" :loading="btnLoading" :custom-style="toOrderButton" type="error" @click="toSave">确认支付</u-button>
 			</view>
 		</view>
+		<!-- 提示用户设置支付密码 -->
+		<u-modal v-model="showSetPswModal" 
+		content="请先设置支付密码,才能使用乐豆" 
+		show-cancel-button 
+		confirm-text="去设置" 
+		cancel-text="暂时放弃"
+		@confirm="toSetPwd"
+		@cancel="showSetPswModal=false"
+		></u-modal>
+		<!-- 确认取消弹窗 -->
+		<u-modal v-model="showLeavePsw" 
+		title="确认放弃支付吗?"
+		content="您的订单在30分钟内未支付将被取消" 
+		show-cancel-button 
+		confirm-text="确认放弃" 
+		cancel-text="继续支付"
+		@confirm="canclePay"
+		@cancel="payAgain"
+		></u-modal>
+		<!-- 确认支付弹窗 -->
+		 <u-popup mode="center" closeable @close="showLeavePsw=true" v-model="showInputPsw" width="500rpx" >
+			<view class="slot-content">
+				<view>确认支付</view>
+				<view class="text-cont">
+					<text class="num-big">{{totalPrice}}</text>乐豆
+				</view>
+				<view class="footer">
+					<u-input v-model="password" maxlength="30" input-align="center" type="password" placeholder="请输入支付密码" />
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -70,18 +105,27 @@
 					width: '180rpx',
 					height: '60rpx'
 				},
-				goodsList: [],
+				goodsList: [], // 商品列表
+				// 用户信息
 				userInfo: {
 					receiveAddress: '陕西省西安市未央区华帝金座',
 					receiverName: '王明',
 					receiverPhone: '14564654551',
 				},
-				btnLoading: false  // 提交按钮加载圈
+				btnLoading: false,  // 提交按钮加载圈
+				orderId: '', // 订单id
+				showSetPswModal: false,  // 设置支付密码弹窗
+				showInputPsw: false, // 打开输入密码弹窗
+				showLeavePsw: false, // 打开确定放弃弹窗
 			};
 		},
+		onShow() {
+			this.getLocation()
+		},
 		onLoad() {
 			this.goodsList = this.$store.state.vuex_toOrderList
-			this.getLocation()
+			// 监听设置密码是否成功
+			uni.$once('setPswSuccess', this.setPsw)
 		},
 		computed: {
 			totalPrice() {
@@ -95,18 +139,52 @@
 		methods: {
 			// 获取用户位置
 			getLocation() {
-				 findAddressBycustomerNo({customerNo:'12313'}).then(res => {
+				 findAddressBycustomerNo({}).then(res => {
 					 console.log(res)
+					 if (res.status == 200) {
+						 this.userInfo = res.data[0] || {}
+					 } else {
+						 this.userInfo = {}
+						 uni.showToast({
+						 	title: res.message,
+							icon: 'none'
+						 })
+					 }
 				 })
 			},
-			//修改收货地址信息
+			//新增/修改收货地址信息
 			editAddress(){
+				this.$u.vuex("vuex_OrderAddress",this.userInfo)
 				uni.navigateTo({
-					url:"/pages/toOrder/editAddress"
+					url:"/pages/toOrder/editAddress?"
 				})
 			},
+			// 跳转到设置支付密码页
+			toSetPwd () {
+				uni.navigateTo({
+					url:"/pages/userCenter/userInfo/paymentPwd"
+				})
+			},
+			// 设置密码成功, 打开输入密码弹窗
+			setPsw (e) {
+				if (e.success) {
+					this.showInputPsw = true
+				}
+			},
+			//确认放弃
+			canclePay() {
+				this.showLeavePsw = false
+				this.showInputPsw = false
+			},
+			// 继续支付
+			payAgain () {
+				this.showLeavePsw = false
+				this.showInputPsw = true
+			},
 			// 支付  保存订单
 			toSave(){
+				this.showSetPswModal = true
+				return
 				let orderGoodsList = []
 				this.goodsList.map((item,index)=>{
 					orderGoodsList[index] = {
@@ -120,8 +198,8 @@
 				saveOrder(params).then(res=>{
 					console.log(res,'rrrrrrr')
 					if(res.status==200) {
-						let id = res.data.id
-						this.toPay(id)
+						this.orderId = res.data.id
+						this.toPay(this.orderId)
 					} else {
 						this.btnLoading = false
 						uni.showToast({
@@ -136,13 +214,9 @@
 				signPay({id:id}).then(res=>{
 					this.btnLoading = false
 					if(res.status == 200) {
-						uni.showToast({
-							title: res.message,
-							icon: 'none'
-						})
 						// 跳转到支付完成界面
 						uni.navigateTo({
-							url:""
+							url:"/pages/toOrder/payFinish?id=" + this.orderId
 						})
 					} else{
 						uni.showToast({
@@ -185,6 +259,16 @@ page{
 			}
 		}
 	}
+	.noAddress{
+		background: #FFFFFF;
+		border-bottom: 1px solid #F8F8F8;
+		border-top: 10upx solid #F8F8F8;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		padding:30upx 20upx;
+		font-size: 30upx;
+	}
 	.goods-list{
 		padding: 20upx 0;
 		flex-grow: 1;
@@ -278,5 +362,26 @@ page{
 			}
 		}
 	}
+	// 支付密码弹窗
+	.slot-content{
+		padding: 30upx 0;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: space-between;
+		.text-cont{
+			width: 100%;
+			padding: 60upx 0;
+			text-align: center;
+			.num-big{
+				font-size: 40upx;
+				color: red;
+			}
+		}
+		.footer{
+			width: 80%;
+			border-bottom: 1px solid #b1b1b1;
+		}
+	}
 }
 </style>

+ 39 - 2
pages/toOrder/payFinish.vue

@@ -1,13 +1,42 @@
 <template>
 	<view class="page-cont">
 		<view class="icon-cont">
-			<u-icon class="icon" name="checkmark" color="green" size="80"></u-icon>
+			<u-icon class="icon" name="checkmark" color="#62c500" size="80"></u-icon>
 			<view>支付成功</view>
 		</view>
+		<u-button @click="toOrderDetail" type="primary">查看订单详情</u-button>
+		<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">
@@ -18,13 +47,18 @@
 		width: 100%;
 		height: 100%;
 		background-color: #fff;
+		padding: 0 40upx;
 		.icon-cont{
 			width: 100%;
-			height: 300upx;
+			height: 400upx;
 			display: flex;
 			flex-direction: column;
 			align-items: center;
 			justify-content: center;
+			>view{
+				font-size: 30upx;
+				margin-top: 40upx;
+			}
 		}
 		.icon{
 			width: 120upx;
@@ -34,5 +68,8 @@
 			justify-content: center;
 			border-radius: 50%;
 		}
+		.back-btn{
+			margin-top: 40upx;
+		}
 	}
 </style>

+ 1 - 0
pages/userCenter/userInfo/paymentPwd.vue

@@ -66,6 +66,7 @@
 				if(this.oPwd == this.tPwd){
 					//  请求接口
 					uni.showToast({ title: '支付密码设置成功', icon: 'none' })
+					 uni.$emit('setPswSuccess', {success: true})
 					setTimeout(()=>{
 						uni.navigateBack({
 						    delta: 1

+ 1 - 0
store/index.js

@@ -109,6 +109,7 @@ const store = new Vuex.Store({
 		vuex_orderStatus: lifeData.vuex_orderStatus ? lifeData.vuex_orderStatus : '',// 订单状态
 		// 购物车及下单
 		vuex_cartList: [],
+		vuex_OrderAddress: {}, // 地址
 		vuex_toOrderList: [],
 		// 如果无需保存到本地永久存储,无需lifeData.xx方式
 		vuex_socket: null,