Browse Source

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
增加

1004749546@qq.com 4 năm trước cách đây
mục cha
commit
a58f4b1b61
5 tập tin đã thay đổi với 155 bổ sung115 xóa
  1. 5 4
      api/order.js
  2. 9 0
      pages.json
  3. 49 107
      pages/order/order.vue
  4. 54 4
      pages/toOrder/index.vue
  5. 38 0
      pages/toOrder/payFinish.vue

+ 5 - 4
api/order.js

@@ -11,7 +11,7 @@ export const getStoreItems = params => {
 // 下单 保存订单
 export const saveOrder = params => {
   return axios.request({
-    url: `order/save`,
+    url: `order/addOrder`,
     method: 'post',
 	data: params
   })
@@ -20,14 +20,15 @@ export const saveOrder = params => {
 // 下单 预支付
 export const signPay  = params => {
   return axios.request({
-    url: `order/pay?orderId=${params.orderId}`,
-    method: 'get',
+    url: `order/payOrder`,
+    method: 'post',
+    data: params
   })
 };
 
 // 我的订单
 export const getOrderList = params => {
-	let url = `order/query/${params.pageNo}/${params.pageSize}`
+	let url = `order/queryPage/${params.pageNo}/${params.pageSize}`
 	delete params.pageNo
 	delete params.pageSize
 	return axios.request({

+ 9 - 0
pages.json

@@ -173,6 +173,15 @@
 		        "enablePullDownRefresh": false
 		    }
 		    
+		},
+		{
+		    "path" : "pages/toOrder/payFinish",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "支付完成",
+		        "enablePullDownRefresh": false
+		    }
+		    
 		}
     ],
 	"globalStyle": {

+ 49 - 107
pages/order/order.vue

@@ -8,34 +8,33 @@
 			<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,sindex) in list" :key="item.id+'-'+sindex"
 						 @click="viewRow(item)">
 							<view class="check-row">
 								<view class="createDate">{{item.createDate}}</view>
-								<view >{{item.orderFlag}}</view>
+								<view>{{item.orderState}}</view>
 							</view>
-							<view class="bundle-list" v-for="row in item.itemList" :key="row.id">
+							<view class="bundle-list" v-for="row in item.orderGoodsList" :key="row.id">
 								<view class="img-cont">
-									<image :src="row.icon?row.icon:'../../static/goods.png'"></image>
+									<image :src="row.goodsImages"></image>
 								</view>
-								<view >
-									<view class="ellipsis-two">{{row.name}}</view>
+								<view>
+									<view class="ellipsis-two">{{row.goodsName}}</view>
 									<view class="bundle-num">
-										<view ><text class="price-num">{{row.price}}</text> <text class="price-text">乐豆</text></view>
-										<view >X {{row.number}}</view>
+										<view><text class="price-num">{{row.payGold}}</text> <text class="price-text">乐豆</text></view>
+										<view>X {{row.buyQty}}</view>
 									</view>
 								</view>
 							</view>
 							<view class="check-row">
 								<view class="text-right">
 									<text class="total-text">
-										共{{item.totalNum}}件商品
+										共{{item.goodsNum}}件商品
 									</text>
-									<text v-if="item.orderFlag=='待支付'"><text class="money-total">应付</text><text class="price-num">{{item.amount}}</text> <text class="price-text">乐豆</text></text>
-									<text v-else><text class="money-total">实付</text><text class="price-num">{{item.payedAmount}}</text> <text class="price-text">乐豆</text></text>
+									<text v-if="item.orderFlag=='待支付'"><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>
 								</view>
 							</view>
 							<view class="check-row">
@@ -72,40 +71,41 @@
 		getLookUpDatas,
 		listLookUp
 	} from '@/api/data'
+	import {
+		getOrderList
+	} from '@/api/order.js'
 	export default {
-		components: {
-		},
+		components: {},
 		data() {
 			return {
 				status: 'loadmore',
 				noDataText: '暂无数据',
-				tabList: [
-					{
+				tabList: [{
 						dispName: '全部',
 						typeId: 2,
-						queryLabel: 'ALL' // tab参数
+						queryLabel: [] // tab参数
 					},
 					{
 						dispName: '待支付',
 						typeId: 1,
-						queryLabel: 'DZF' // tab参数
+						queryLabel: ['WAIT_PAY'] // tab参数
 					},
 					{
 						dispName: '待发货',
 						typeId: 3,
-						queryLabel: 'DFH' // tab参数
+						queryLabel: ['WAIT_SEND','SEND_PART'] // tab参数
 					},
 					{
 						dispName: '已发货',
 						typeId: 3,
-						queryLabel: 'YFH' // tab参数
+						queryLabel: ['SEND_ALL'] // tab参数
 					},
 					{
 						dispName: '已完成',
 						typeId: 3,
-						queryLabel: 'YWC' // tab参数
+						queryLabel: ['FINISH'] // tab参数
 					},
-					
+
 				],
 				current: 0,
 				swiperCurrent: 0,
@@ -183,89 +183,17 @@
 			// 查询列表
 			getRow(pageNo) {
 				this.status = "loadmore"
-				this.list = [{
-					createDate: "2020-10-28 11:15:59",
-					orderFlag: "待支付",
-					payedAmount: 0,
-					id: 11,
-					amount: 450,
-					totalNum: 3,
-					itemList: [
-						{
-							name: "八九箭冠",
-							id: 76435,
-							number: 1,
-							price: 150,
-							icon: ''
-						},
-						{
-							name: "数据库的合法身份觉得很附近发生纠纷解决",
-							id: 76436,
-							number: 2,
-							price: 150,
-							icon: ''
-						}
-					]
-				},{
-					createDate: "2020-10-29 11:15:59",
-					orderFlag: "待发货",
-					payedAmount: 300,
-					id: 112,
-					amount: 300,
-					totalNum: 2,
-					itemList: [
-						{
-							name: "捐款事件的看法教科书上的发货角度思考JFK就是的JFK即将开放的",
-							id: 76440,
-							number: 2,
-							price: 150,
-							icon: ''
-						}
-					]
-				},{
-					createDate: "2020-10-29 11:15:59",
-					orderFlag: "已发货",
-					payedAmount: 300,
-					id: 1112,
-					amount: 300,
-					totalNum: 2,
-					itemList: [
-						{
-							name: "捐款事件的看法教科书上的发货角度思考JFK就是的JFK即将开放的",
-							id: 76420,
-							number: 2,
-							price: 150,
-							icon: ''
-						}
-					]
-				},{
-					createDate: "2020-10-29 11:15:59",
-					orderFlag: "已完成",
-					payedAmount: 300,
-					id: 1126,
-					amount: 300,
-					totalNum: 2,
-					itemList: [
-						{
-							name: "捐款事件的看法教科书上的发货角度思考JFK就是的JFK即将开放的",
-							id: 76496,
-							number: 2,
-							price: 150,
-							icon: ''
-						}
-					]
-				}]
-				return 
 				if (pageNo) {
 					this.pageNo = pageNo
 				}
 				let params = {
 					pageNo: this.pageNo,
 					pageSize: this.pageSize,
-					queryLabel: this.tabList[this.current].queryLabel, // tab分类
+					orderStateList: this.tabList[this.current].queryLabel, // tab分类
 				}
+				this.noDataText = '暂无数据'
 				this.status = "loading"
-				getBackLogList(params).then(res => {
+				getOrderList(params).then(res => {
 					if (res.status == 200) {
 						if (this.pageNo > 1) {
 							this.list = this.list.concat(res.data.list || [])
@@ -300,14 +228,14 @@
 				this.getRow(1)
 			},
 			// 查看物流
-			showLog (item) {
-				console.log(item,'111111')
+			showLog(item) {
+				console.log(item, '111111')
 				uni.navigateTo({
 					url: "/pages/order/LogList?id="
 				})
 			},
 			// 复制运单编号 
-			copyLogNum () {
+			copyLogNum() {
 				// H5 不支持
 				uni.setClipboardData({
 					data: this.logData.logNum,
@@ -380,6 +308,7 @@
 					}
 				}
 			}
+
 			// 列表样式
 			.check-order-list {
 				background: #ffffff;
@@ -388,6 +317,7 @@
 				border-radius: 6upx;
 				box-shadow: 1px 1px 3px #EEEEEE;
 				font-size: 28upx;
+
 				.check-row {
 					display: flex;
 					align-items: center;
@@ -418,22 +348,26 @@
 						}
 					}
 				}
+
 				// 订单中商品列表
 				.bundle-list {
 					display: flex;
 					padding: 20upx 10upx;
 					font-size: 28upx;
 					border-bottom: 1px solid #F8F8F8;
+
 					.img-cont {
 						width: 158rpx;
 						height: 140upx;
 						border-radius: 15upx;
 						overflow: hidden;
+
 						>image {
 							width: 100%;
 							height: 100%;
 						}
 					}
+
 					>view {
 						&:last-child {
 							flex: 1;
@@ -443,36 +377,44 @@
 							justify-content: space-between;
 						}
 					}
+
 					.bundle-num {
 						display: flex;
 						justify-content: space-between;
 					}
 				}
+
 				.btn-cont {
 					width: 180upx;
 					font-size: 30upx;
 				}
-				.price-text{
+
+				.price-text {
 					font-size: 20upx;
 					margin-left: 10upx;
 				}
-				.price-num{
+
+				.price-num {
 					font-size: 32upx;
 					color: red;
 				}
-				.total-text{
+
+				.total-text {
 					margin-right: 50upx;
 				}
-				.money-total{
+
+				.money-total {
 					margin-right: 10upx;
 				}
 			}
 		}
+
 		// 物流弹窗
 		.slot-content {
 			padding: 40upx 60upx;
 			font-size: 28upx;
-			>view{
+
+			>view {
 				line-height: 60upx;
 			}
 		}

+ 54 - 4
pages/toOrder/index.vue

@@ -50,13 +50,14 @@
 			  <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
 			</view>
 			<view>
-				<u-button size="mini" :custom-style="toOrderButton" type="error" @click="toPay">确认支付</u-button>
+				<u-button size="mini" :loading="btnLoading" :custom-style="toOrderButton" type="error" @click="toSave">确认支付</u-button>
 			</view>
 		</view>
 	</view>
 </template>
 
 <script>
+	import { saveOrder, signPay} from '@/api/order.js'
 	import {
 		findAddressBycustomerNo
 	} from '@/api/receiveAddress.js'
@@ -69,7 +70,13 @@
 					width: '180rpx',
 					height: '60rpx'
 				},
-				goodsList: []
+				goodsList: [],
+				userInfo: {
+					receiveAddress: '陕西省西安市未央区华帝金座',
+					receiverName: '王明',
+					receiverPhone: '14564654551',
+				},
+				btnLoading: false  // 提交按钮加载圈
 			};
 		},
 		onLoad() {
@@ -98,9 +105,52 @@
 					url:"/pages/toOrder/editAddress"
 				})
 			},
+			// 支付  保存订单
+			toSave(){
+				let orderGoodsList = []
+				this.goodsList.map((item,index)=>{
+					orderGoodsList[index] = {
+						goodsNo: item.goodsNo,
+						buyQty: item.buyQty
+					}
+				})
+				this.btnLoading = true
+				let params = Object.assign(this.userInfo,{orderGoodsList:orderGoodsList})
+				console.log(orderGoodsList,params,'orderGoodsList')
+				saveOrder(params).then(res=>{
+					console.log(res,'rrrrrrr')
+					if(res.status==200) {
+						let id = res.data.id
+						this.toPay(id)
+					} else {
+						this.btnLoading = false
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+				})
+			},
 			// 支付
-			toPay(){
-				
+			toPay(id) {
+				signPay({id:id}).then(res=>{
+					this.btnLoading = false
+					if(res.status == 200) {
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+						// 跳转到支付完成界面
+						uni.navigateTo({
+							url:""
+						})
+					} else{
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+				})
 			}
 		},
 	}

+ 38 - 0
pages/toOrder/payFinish.vue

@@ -0,0 +1,38 @@
+<template>
+	<view class="page-cont">
+		<view class="icon-cont">
+			<u-icon class="icon" name="checkmark" color="green" size="80"></u-icon>
+			<view>支付成功</view>
+		</view>
+	</view>
+</template>
+
+<script>
+</script>
+
+<style lang="less">
+	page{
+		height: 100%;
+	}
+	.page-cont{
+		width: 100%;
+		height: 100%;
+		background-color: #fff;
+		.icon-cont{
+			width: 100%;
+			height: 300upx;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			justify-content: center;
+		}
+		.icon{
+			width: 120upx;
+			height: 120upx;
+			background-color: #d1d1d1;
+			display: flex;
+			justify-content: center;
+			border-radius: 50%;
+		}
+	}
+</style>