Ver Fonte

Merge branch 'master' of http://git.liuniu946.com/lhl/sxg

lhl há 3 anos atrás
pai
commit
66d963cdc1
2 ficheiros alterados com 223 adições e 34 exclusões
  1. 44 0
      api/order.js
  2. 179 34
      pages/order/order.vue

+ 44 - 0
api/order.js

@@ -144,3 +144,47 @@ export function computedOrderkey(data) {
 	});
 	});
 }
 }
 
 
+//买单订单列表
+export function user_auction_order(data) {
+	return request({
+		url: '/api/auction/user_auction_order',
+		method: 'get',
+		data
+	});
+}
+
+//卖单订单列表
+export function seller(data) {
+	return request({
+		url: '/api/auction/seller',
+		method: 'get',
+		data
+	});
+}
+
+// 上传成功
+export function up_image(data) {
+	return request({
+		url: '/api/auction/up_image',
+		method: 'post',
+		data
+	});
+}
+
+// 取消挂售
+export function cancel(data) {
+	return request({
+		url: '/api/auction/cancel',
+		method: 'post',
+		data
+	});
+}
+
+//判断是否有新订单
+export function untreated(data) {
+	return request({
+		url: '/api/auction/untreated',
+		method: 'get',
+		data
+	});
+}

+ 179 - 34
pages/order/order.vue

@@ -1,17 +1,24 @@
 <template>
 <template>
 	<view class="content">
 	<view class="content">
 		<view class="order-title">
 		<view class="order-title">
-			<text>我的订单</text>
+			<view class="body-title">
+				<view class="goback-box" @click="toBack"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
+				<view class="header">我的订单</view>
+			</view>
 			<view class="roder-content">
 			<view class="roder-content">
 				<view class="left" :class="{ current: currentIndex === index }" :key="index" v-for="(item, index) in maiList" @click="navGo(index)">{{ item.title }}</view>
 				<view class="left" :class="{ current: currentIndex === index }" :key="index" v-for="(item, index) in maiList" @click="navGo(index)">{{ item.title }}</view>
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="navbar" v-show="currentIndex == 0">
 		<view class="navbar" v-show="currentIndex == 0">
-			<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index, 0)">{{ item.text }}</view>
+			<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index, 0)">
+				{{ item.text }}
+				<view class="dian" v-if="tabCurrentIndex != index && item.isnew == 2"></view>
+			</view>
 		</view>
 		</view>
 		<view class="navbar" v-show="currentIndex == 1">
 		<view class="navbar" v-show="currentIndex == 1">
 			<view v-for="(item, index) in navList1" :key="index" class="nav-item" :class="{ current: tabCurrentIndex1 === index }" @click="tabClick(index, 1)">
 			<view v-for="(item, index) in navList1" :key="index" class="nav-item" :class="{ current: tabCurrentIndex1 === index }" @click="tabClick(index, 1)">
 				{{ item.text }}
 				{{ item.text }}
+				<view class="dian" v-if="tabCurrentIndex1 != index && item.isnew == 2"></view>
 			</view>
 			</view>
 		</view>
 		</view>
 
 
@@ -26,7 +33,6 @@
 						<view class="i-top b-b">
 						<view class="i-top b-b">
 							<text class="time">{{ item.order_id }}</text>
 							<text class="time">{{ item.order_id }}</text>
 							<text class="state" :style="{ color: item.stateTipColor }">{{ item.stateTip }}</text>
 							<text class="state" :style="{ color: item.stateTipColor }">{{ item.stateTip }}</text>
-							<text v-if="item.status === 4" class="del-btn iconfont icondelete" @click="deleteOrder(index)"></text>
 						</view>
 						</view>
 
 
 						<view class="goods-box-single">
 						<view class="goods-box-single">
@@ -47,6 +53,7 @@
 							<text class="price">{{ moneyNum(item.price) }}</text>
 							<text class="price">{{ moneyNum(item.price) }}</text>
 						</view>
 						</view>
 						<view class="action-box b-t" v-if="item.stateTip == '待支付'"><button @click.stop="pay(item)" class="action-btn recom">立即支付</button></view>
 						<view class="action-box b-t" v-if="item.stateTip == '待支付'"><button @click.stop="pay(item)" class="action-btn recom">立即支付</button></view>
+						<view class="action-box b-t" v-if="item.stateTip == '待挂售'"><button @click.stop="gsell(item)" class="action-btn recom">立即挂售</button></view>
 					</view>
 					</view>
 
 
 					<uni-load-more :status="tabItem.loadingType"></uni-load-more>
 					<uni-load-more :status="tabItem.loadingType"></uni-load-more>
@@ -60,7 +67,7 @@
 					<!-- 订单列表 -->
 					<!-- 订单列表 -->
 					<view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item">
 					<view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item">
 						<view class="i-top b-b">
 						<view class="i-top b-b">
-							<text class="time">{{ item.order_id }}</text>
+							<text class="time">{{ item.order_id ? item.order_id : item.order }}</text>
 							<text class="state" :style="{ color: item.stateTipColor }">{{ item.stateTip }}</text>
 							<text class="state" :style="{ color: item.stateTipColor }">{{ item.stateTip }}</text>
 						</view>
 						</view>
 						<view class="goods-box-single">
 						<view class="goods-box-single">
@@ -75,11 +82,19 @@
 						</view>
 						</view>
 
 
 						<view class="buy-box">
 						<view class="buy-box">
-							<view class="buy-info" v-if="item.status != 0">
+							<view class="buy-info" v-if="item.status != 0 && item.status">
 								<view class="font">买家:</view>
 								<view class="font">买家:</view>
 								<image class="avter" :src="item.avatar" mode=""></image>
 								<image class="avter" :src="item.avatar" mode=""></image>
 								<view class="buy-name">{{ item.nickname }}</view>
 								<view class="buy-name">{{ item.nickname }}</view>
-								<view class="phone">{{item.phone}}</view>
+								<view class="phone">{{ item.phone }}</view>
+							</view>
+							<view v-if="!item.status">
+								<view class="buy-info">
+									<view class="font">挂售价格:{{ item.hanging_price }}</view>
+								</view>
+								<view class="buy-info">
+									<view class="font">挂售时间:{{ item.update_time }}</view>
+								</view>
 							</view>
 							</view>
 						</view>
 						</view>
 						<view class="upimg" v-if="item.status == 2 || item.status == 3">
 						<view class="upimg" v-if="item.status == 2 || item.status == 3">
@@ -92,6 +107,10 @@
 							<!-- <button @click.stop="orderPay(item)" class="refuse recom">拒绝</button> -->
 							<!-- <button @click.stop="orderPay(item)" class="refuse recom">拒绝</button> -->
 							<button @click.stop="orderPay(item)" class="action-btn recom">通过</button>
 							<button @click.stop="orderPay(item)" class="action-btn recom">通过</button>
 						</view>
 						</view>
+						<view class="action-box b-t" v-if="!item.status">
+							<!-- <button @click.stop="orderPay(item)" class="refuse recom">拒绝</button> -->
+							<button @click.stop="cancel(item)" class="action-btn recom">取消挂售</button>
+						</view>
 					</view>
 					</view>
 
 
 					<uni-load-more :status="tabItem.loadingType"></uni-load-more>
 					<uni-load-more :status="tabItem.loadingType"></uni-load-more>
@@ -105,7 +124,7 @@
 <script>
 <script>
 import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
 import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
 import empty from '@/components/empty';
 import empty from '@/components/empty';
-import { orderList, orderCancel, orderDel, orderTake, adopt, user_auction_order, seller } from '@/api/order.js';
+import { orderList, orderCancel, orderDel, orderTake, adopt, user_auction_order, seller, cancel, untreated } from '@/api/order.js';
 import { tabbar } from '@/utils/tabbar.js';
 import { tabbar } from '@/utils/tabbar.js';
 export default {
 export default {
 	components: {
 	components: {
@@ -134,6 +153,7 @@ export default {
 					text: '已过期',
 					text: '已过期',
 					loadingType: 'more',
 					loadingType: 'more',
 					orderList: [],
 					orderList: [],
+					isnew:1,//判断是否有新的订单
 					page: 1, //当前页数
 					page: 1, //当前页数
 					limit: 10 //每次信息条数
 					limit: 10 //每次信息条数
 				},
 				},
@@ -142,6 +162,7 @@ export default {
 					text: '待支付',
 					text: '待支付',
 					loadingType: 'more',
 					loadingType: 'more',
 					orderList: [],
 					orderList: [],
+					isnew:1,//判断是否有新的订单
 					page: 1, //当前页数
 					page: 1, //当前页数
 					limit: 10 //每次信息条数
 					limit: 10 //每次信息条数
 				},
 				},
@@ -150,6 +171,16 @@ export default {
 					text: '待审核',
 					text: '待审核',
 					loadingType: 'more',
 					loadingType: 'more',
 					orderList: [],
 					orderList: [],
+					isnew:1,//判断是否有新的订单
+					page: 1, //当前页数
+					limit: 10 //每次信息条数
+				},
+				{
+					state: 4,
+					text: '待挂售',
+					loadingType: 'more',
+					orderList: [],
+					isnew:1,//判断是否有新的订单
 					page: 1, //当前页数
 					page: 1, //当前页数
 					limit: 10 //每次信息条数
 					limit: 10 //每次信息条数
 				},
 				},
@@ -158,6 +189,7 @@ export default {
 					text: '已完成',
 					text: '已完成',
 					loadingType: 'more',
 					loadingType: 'more',
 					orderList: [],
 					orderList: [],
+					isnew:1,//判断是否有新的订单
 					page: 1, //当前页数
 					page: 1, //当前页数
 					limit: 10 //每次信息条数
 					limit: 10 //每次信息条数
 				}
 				}
@@ -168,6 +200,16 @@ export default {
 					text: '已过期',
 					text: '已过期',
 					loadingType: 'more',
 					loadingType: 'more',
 					orderList: [],
 					orderList: [],
+					isnew:1,//判断是否有新的订单
+					page: 1, //当前页数
+					limit: 10 //每次信息条数
+				},
+				{
+					state: 4,
+					text: '售卖中',
+					loadingType: 'more',
+					orderList: [],
+					isnew:1,//判断是否有新的订单
 					page: 1, //当前页数
 					page: 1, //当前页数
 					limit: 10 //每次信息条数
 					limit: 10 //每次信息条数
 				},
 				},
@@ -176,6 +218,7 @@ export default {
 					text: '待支付',
 					text: '待支付',
 					loadingType: 'more',
 					loadingType: 'more',
 					orderList: [],
 					orderList: [],
+					isnew:1,//判断是否有新的订单
 					page: 1, //当前页数
 					page: 1, //当前页数
 					limit: 10 //每次信息条数
 					limit: 10 //每次信息条数
 				},
 				},
@@ -184,6 +227,7 @@ export default {
 					text: '待审核',
 					text: '待审核',
 					loadingType: 'more',
 					loadingType: 'more',
 					orderList: [],
 					orderList: [],
+					isnew:1,//判断是否有新的订单
 					page: 1, //当前页数
 					page: 1, //当前页数
 					limit: 10 //每次信息条数
 					limit: 10 //每次信息条数
 				},
 				},
@@ -192,6 +236,7 @@ export default {
 					text: '已完成',
 					text: '已完成',
 					loadingType: 'more',
 					loadingType: 'more',
 					orderList: [],
 					orderList: [],
+					isnew:1,//判断是否有新的订单
 					page: 1, //当前页数
 					page: 1, //当前页数
 					limit: 10 //每次信息条数
 					limit: 10 //每次信息条数
 				}
 				}
@@ -214,14 +259,10 @@ export default {
 		 * 替换onLoad下代码即可
 		 * 替换onLoad下代码即可
 		 */
 		 */
 		this.tabCurrentIndex = +options.state || 0;
 		this.tabCurrentIndex = +options.state || 0;
-		// #ifndef MP
+	},
+	onShow() {
 		this.loadData();
 		this.loadData();
-		// #endif
-		// #ifdef MP
-		if (options.state == 0) {
-			this.loadData();
-		}
-		// #endif
+		this.upData();
 	},
 	},
 	// #ifdef APP-PLUS || H5
 	// #ifdef APP-PLUS || H5
 	onBackPress(e) {
 	onBackPress(e) {
@@ -262,6 +303,11 @@ export default {
 				this.tabCurrentIndex1 = index;
 				this.tabCurrentIndex1 = index;
 			}
 			}
 		},
 		},
+		toBack() {
+			uni.switchTab({
+				url: '/pages/order/index'
+			});
+		},
 		navGo(index) {
 		navGo(index) {
 			this.currentIndex = index;
 			this.currentIndex = index;
 			console.log(this.currentIndex, '点击');
 			console.log(this.currentIndex, '点击');
@@ -271,10 +317,33 @@ export default {
 		moneyNum(value) {
 		moneyNum(value) {
 			return +value;
 			return +value;
 		},
 		},
+		upData() {
+			untreated().then(({ data }) => {
+				console.log(data);
+				if(data.user.hanging != 0){
+					this.navList[3].isnew = 2
+				}
+				if(data.user.hanging == 0){
+					this.navList[3].isnew = 1
+				}
+				if(data.user.paid != 0){
+					this.navList[1].isnew = 2
+				}
+				if(data.user.paid == 0){
+					this.navList[1].isnew = 1
+				}
+				if(data.seller.reviewed != 0) {
+					this.navList1[3].isnew = 2
+				}
+				if(data.seller.reviewed == 0) {
+					this.navList1[3].isnew = 1
+				} 
+			});
+		},
 		// 查看大图
 		// 查看大图
 		lookimg(src) {
 		lookimg(src) {
 			console.log(src);
 			console.log(src);
-			let arr = [src]
+			let arr = [src];
 			uni.previewImage({
 			uni.previewImage({
 				current: src,
 				current: src,
 				urls: arr
 				urls: arr
@@ -316,14 +385,25 @@ export default {
 		// 订单支付
 		// 订单支付
 		pay(item) {
 		pay(item) {
 			uni.navigateTo({
 			uni.navigateTo({
-				url:'/pages/hall/hallpay?ordid='+item.order_id
-			})
+				url: '/pages/hall/hallpay?ordid=' + item.order_id
+			});
+		},
+		gsell(item) {
+			uni.navigateTo({
+				url: '/pages/hall/gsell?id=' + item.product_id
+			});
 		},
 		},
 		orderPay(e) {
 		orderPay(e) {
-			console.log(e);
-			adopt({order_id: e.order_id}).then(({data}) =>{
-				this.loadData()
-			})
+			adopt({ order_id: e.order_id }).then(({ data }) => {
+				console.log('1111');
+				this.loadData('reload');
+			});
+		},
+		cancel(e) {
+			cancel({ id: e.id }).then(({ data }) => {
+				this.loadData('reload');
+				this.upData()
+			});
 		},
 		},
 		//获取订单列表
 		//获取订单列表
 		loadData(source) {
 		loadData(source) {
@@ -339,6 +419,12 @@ export default {
 			}
 			}
 
 
 			let state = navItem.state;
 			let state = navItem.state;
+			if (source == 'reload') {
+				navItem.orderList = [];
+				navItem.page = 1;
+				navItem.limit = 10;
+				navItem.loadingType = 'more';
+			}
 			if (source === 'tabChange' && navItem.loaded === true) {
 			if (source === 'tabChange' && navItem.loaded === true) {
 				//tab切换只有第一次需要加载数据
 				//tab切换只有第一次需要加载数据
 				return;
 				return;
@@ -360,13 +446,19 @@ export default {
 					limit: navItem.limit
 					limit: navItem.limit
 				})
 				})
 					.then(({ data }) => {
 					.then(({ data }) => {
-						console.log(data);
 						let arr = data.map(e => {
 						let arr = data.map(e => {
-							let b = this.orderStateExp(e.status);
-							e.stateTip = b.stateTip;
-							e.stateTipColor = b.stateTipColor;
+							console.log(state == 4);
+							if (state == 4) {
+								e.stateTip = '待挂售';
+								e.stateTipColor = '#fa436a';
+							} else {
+								let b = this.orderStateExp(e.status);
+								e.stateTip = b.stateTip;
+								e.stateTipColor = b.stateTipColor;
+							}
 							return e;
 							return e;
 						});
 						});
+						console.log(arr, '123456');
 						navItem.orderList = navItem.orderList.concat(arr);
 						navItem.orderList = navItem.orderList.concat(arr);
 
 
 						// console.log(navItem.orderList);
 						// console.log(navItem.orderList);
@@ -395,9 +487,14 @@ export default {
 					.then(({ data }) => {
 					.then(({ data }) => {
 						console.log(data);
 						console.log(data);
 						let arr = data.map(e => {
 						let arr = data.map(e => {
-							let b = this.orderStateExp(e.status);
-							e.stateTip = b.stateTip;
-							e.stateTipColor = b.stateTipColor;
+							if (state == 4) {
+								e.stateTip = '售卖中';
+								e.stateTipColor = '#fa436a';
+							} else {
+								let b = this.orderStateExp(e.status);
+								e.stateTip = b.stateTip;
+								e.stateTipColor = b.stateTipColor;
+							}
 							return e;
 							return e;
 						});
 						});
 						navItem.orderList = navItem.orderList.concat(arr);
 						navItem.orderList = navItem.orderList.concat(arr);
@@ -491,6 +588,9 @@ export default {
 				case 3:
 				case 3:
 					stateTip = '已完成';
 					stateTip = '已完成';
 					break;
 					break;
+				case 4:
+					stateTip = '待挂售';
+					break;
 				case 9:
 				case 9:
 					stateTip = '订单已关闭';
 					stateTip = '订单已关闭';
 					stateTipColor = '#909399';
 					stateTipColor = '#909399';
@@ -516,14 +616,51 @@ page,
 
 
 .order-title {
 .order-title {
 	width: 750rpx;
 	width: 750rpx;
-	height: 135px;
-	// background: linear-gradient(-41deg, rgba(60, 237, 237, 0.99), #04B8FF, #375AFE);
+	height: 270rpx;
 	background: url(../../static/img/order99.png) repeat-x 0;
 	background: url(../../static/img/order99.png) repeat-x 0;
 	display: flex;
 	display: flex;
 	flex-direction: column;
 	flex-direction: column;
 	// padding: 50rpx 0;
 	// padding: 50rpx 0;
 	text-align: center;
 	text-align: center;
 
 
+	.body-title {
+		height: 80rpx;
+		text-align: center;
+		font-size: 35rpx;
+		position: relative;
+		.header {
+			position: absolute;
+			left: 0;
+			top: 30rpx;
+			width: 100%;
+			font-size: 36rpx;
+			font-family: PingFang SC;
+			font-weight: bold;
+			color: #fffeff;
+			height: 80rpx;
+			font-size: 36rpx;
+			font-weight: 700;
+			z-index: 9;
+			display: flex;
+			justify-content: center;
+			align-items: center;
+		}
+		.goback-box {
+			position: absolute;
+			left: 18rpx;
+			top: 30rpx;
+			height: 80rpx;
+			display: flex;
+			align-items: center;
+		}
+
+		.goback {
+			z-index: 100;
+			width: 34rpx;
+			height: 34rpx;
+		}
+	}
+
 	text {
 	text {
 		margin: 30px 0;
 		margin: 30px 0;
 		font-size: 17px;
 		font-size: 17px;
@@ -533,6 +670,7 @@ page,
 	}
 	}
 
 
 	.roder-content {
 	.roder-content {
+		margin-top: 80rpx;
 		display: flex;
 		display: flex;
 		justify-content: space-around;
 		justify-content: space-around;
 
 
@@ -587,7 +725,15 @@ page,
 		font-size: 15px;
 		font-size: 15px;
 		color: $font-color-dark;
 		color: $font-color-dark;
 		position: relative;
 		position: relative;
-
+		.dian {
+			position: absolute;
+			top: 20rpx;
+			right: 10rpx;
+			width: 8rpx;
+			height: 8rpx;
+			border-radius: 50%;
+			background-color: $base-color;
+		}
 		&.current {
 		&.current {
 			color: $base-color;
 			color: $base-color;
 
 
@@ -724,13 +870,12 @@ page,
 		}
 		}
 	}
 	}
 	.buy-box {
 	.buy-box {
-		height: 84rpx;
-		padding: 0 22rpx;
+		padding: 10rpx 22rpx;
 		background-color: #ffffff;
 		background-color: #ffffff;
 		.buy-info {
 		.buy-info {
-			height: 100%;
 			display: flex;
 			display: flex;
 			align-items: center;
 			align-items: center;
+			margin-top: 20rpx;
 			.font {
 			.font {
 				font-size: 32rpx;
 				font-size: 32rpx;
 				font-family: PingFang SC;
 				font-family: PingFang SC;