lhl пре 2 година
родитељ
комит
61e788a227

+ 8 - 0
api/three.js

@@ -48,4 +48,12 @@ export function createCz(data) {
 		method: 'post',
 		data
 	});
+}
+
+export function getLifeOrder(data) {
+	return request({
+		url: '/api/Xinqiu/lst',
+		method: 'get',
+		data
+	});
 }

+ 24 - 0
api/zero.js

@@ -131,3 +131,27 @@ export function getCardInfo(data) {
 		data
 	});
 }
+
+export function createBuy(data) {
+	return request({
+		url: '/api/pass/buy_create',
+		method: 'post',
+		data
+	});
+}
+
+export function goBuy(data) {
+	return request({
+		url: '/api/pass/buy_save',
+		method: 'post',
+		data
+	});
+}
+
+export function cancelBuy(data) {
+	return request({
+		url: '/api/pass/buy_cancel',
+		method: 'post',
+		data
+	});
+}

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "精联惠选",
     "appid" : "__UNI__991D0D9",
     "description" : "精联惠选",
-    "versionName" : "1.2.4",
-    "versionCode" : 124,
+    "versionName" : "1.1.5",
+    "versionCode" : 115,
     "transformPx" : false,
     "app-plus" : {
         /* 5+App特有相关 */

+ 26 - 2
pages.json

@@ -19,6 +19,12 @@
 				"navigationBarTitleText": "开发中"
 			}
 		},
+		{
+			"path": "pages/index/buySale",
+			"style": {
+				"navigationBarTitleText": "交易市场"
+			}
+		},
 		{
 			"path": "pages/index/zero",
 			"style": {
@@ -52,6 +58,12 @@
 				"navigationBarTitleText": "更新"
 			}
 		},
+		{
+			"path": "pages/index/lifeOrder",
+			"style": {
+				"navigationBarTitleText": "我的订单"
+			}
+		},
 		{
 			"path": "pages/index/life",
 			"style": {
@@ -139,7 +151,13 @@
 		{
 			"path": "pages/zero/order",
 			"style": {
-				"navigationBarTitleText": "交易市场"
+				"navigationBarTitleText": "我的挂售"
+			}
+		},
+		{
+			"path": "pages/zero/orders",
+			"style": {
+				"navigationBarTitleText": "我的买入"
 			}
 		},
 		{
@@ -542,8 +560,14 @@
 				"selectedIconPath": "static/tabBar/xc-action.png",
 				"text": "我的薪酬"
 			},
+			// {
+			// 	"pagePath": "pages/zero/order",
+			// 	"iconPath": "static/tabBar/ll.png",
+			// 	"selectedIconPath": "static/tabBar/ll-action.png",
+			// 	"text": "交易市场"
+			// },
 			{
-				"pagePath": "pages/zero/order",
+				"pagePath": "pages/index/buySale",
 				"iconPath": "static/tabBar/ll.png",
 				"selectedIconPath": "static/tabBar/ll-action.png",
 				"text": "交易市场"

+ 513 - 0
pages/index/buySale.vue

@@ -0,0 +1,513 @@
+<template>
+	<view class="content">
+		<view class="nav-wrap flex">
+			<view class="item" v-for="(nav,inden) in navList" :class="{'action': navCurrent == inden}"
+				@click="changeNav(inden)">
+				{{nav.tit}}
+			</view>
+		</view>
+		<view class="order flex">
+			<view class="" @click="navto('/pages/zero/order')">
+				<image src="../../static/icon/order1.png" mode=""></image>挂售订单
+			</view>
+			<view class="" @click="navto('/pages/zero/orders')">
+				<image src="../../static/icon/order1.png" mode="">买入订单
+			</view>
+		</view>
+		<swiper :style="{'height':maxHeight}" class="scroll-wrap" :current="navCurrent">
+			<swiper-item v-for="(item,index) in navList" >
+				<scroll-view scroll-y="true" :style="{'height':maxHeight}">
+					<view class="order-wrap " v-for="orderItem in item.list" >
+						<view class="flex m-info">
+							<image src="../../static/icon/gs-av.png" mode="" class="card-img"></image>
+							<text style=" display: inline-block;line-height: 55rpx;" v-if="navCurrent == 0 && orderItem.user">{{orderItem.user.nickname}}</text>
+							<text style=" display: inline-block;line-height: 55rpx;" v-if="navCurrent == 1 && orderItem.to_user">{{orderItem.to_user.nickname}}</text>
+						</view>
+						<view class="price">
+							¥{{orderItem.total_price}}
+						</view>
+						<view class="num">
+							数量:{{orderItem.amount}}
+						</view>
+						<view class="num">
+							单价:{{orderItem.price}}
+						</view>
+						<view class="num">
+							{{ getTime(orderItem.add_time)}}
+						</view>
+						<view class="order-btn"  @click="gobuy(orderItem)">
+							{{navCurrent == 0? '立即购买':'立即抢单'}}
+						</view>
+					</view>
+					<empty v-if="item.list.length==0 && item.loaded"></empty>
+					<uni-load-more v-else :status="item.loadingType"></uni-load-more>
+				</scroll-view>
+			</swiper-item>
+		</swiper>
+	</view>
+
+</template>
+
+<script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+
+	import empty from '@/components/empty.vue'
+
+	import {
+		getGsList,
+		qxGs,
+		upEvaluation,
+		auth,
+		buyGs,
+		goBuy
+	} from '@/api/zero.js'
+	import {
+		upload
+	} from '@/api/order.js';
+	export default {
+		components: {
+			empty
+		},
+		data() {
+			return {
+				pzing: false,
+				orderId: '',
+				pz: '',
+				maxHeight: '',
+				navCurrent: 0, // 0-》买单 1-》卖单
+				current: 0, //二层次序
+				navList: [{
+					status: 0,
+						tit: '我要买',
+						list: [],
+						out: 1,
+						loadingType: 'more',
+						page: 1,
+						limit: 10,
+						loaded: false
+					},
+					{
+						out: 0,
+						tit: '我要卖',
+						list: [],
+						loadingType: 'more',
+						page: 1,
+						limit: 10,
+						status: 0,
+						loaded: false
+					},
+				]
+			}
+		},
+		computed: {
+			...mapState('user', ['userInfo'])
+		},
+		onLoad() {
+
+		},
+		onShow() {
+			this.getList('reload')
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+			var that = this;
+			uni.getSystemInfo({
+				success: resu => {
+					const query = uni.createSelectorQuery();
+					query.select('.scroll-wrap').boundingClientRect();
+					query.exec(function(res) {
+						that.maxHeight = resu.windowHeight - res[0].top + 'px';
+					});
+				},
+				fail: res => {}
+			});
+		},
+		methods: {
+			navto(url) {
+				uni.navigateTo({
+					url,
+					fail() {
+						uni.switchTab({
+							url
+						})
+					}
+				})
+			},
+			gobuy(item) {
+				if(this.buying) {
+					return
+				}
+				this.buying = true
+				if(this.navCurrent == 0) {
+					buyGs({
+						id: item.id
+					}).then(res => {
+						uni.showToast({
+							title:'购买成功',
+							duration:2000
+						});
+						this.buying = false
+						this.getList('reload')
+					}).catch( err => {
+						this.buying = false
+					})
+				}else {
+					goBuy({
+						id: item.id
+					}).then(res => {
+						uni.showToast({
+							title:'提交成功',
+							duration:2000
+						});
+						this.buying = false
+						this.getList('reload')
+					}).catch( err => {
+						this.buying = false
+					})
+				}
+				
+			},
+			showColor(status) {
+				if (status == -1 || status == 4) {
+					return '#aaa'
+				} else {
+					return '#FF5570'
+				}
+			},
+			auth(item, type) {
+				let that = this
+				uni.showModal({
+					title: '提示',
+					content: type == 1 ? '是否确认收款完成?' : '是否确认当前提交的凭证没有通过审核',
+					complete(e) {
+						if (e.confirm) {
+							auth({
+								id: item.id,
+								auth: type
+							}).then(res => {
+								uni.showToast({
+									title: '审核成功',
+									duration: 2000
+								});
+								that.getList('reload')
+							})
+						}
+					}
+
+				})
+			},
+			// 取消交易
+			qxOrder(item) {
+				let that = this
+				uni.showModal({
+					title: '提示',
+					content: '是否确认取消挂售?',
+					complete(e) {
+						if (e.confirm) {
+							qxGs({
+								id: item.id
+							}).then(res => {
+								uni.showToast({
+									title: '取消成功',
+									duration: 2000
+								});
+								that.getList('reload')
+							})
+						}
+					}
+
+				})
+			},
+			upPz(item) {
+				// if(item.up_files) {
+				// 	this.pz = item.up_files
+				// }
+				// this.orderId = item.id
+				// this.$refs.popup.open()
+				uni.navigateTo({
+					url: '/pages/zero/pay?id=' + item.id
+				})
+			},
+			//上传凭证
+			goUp() {
+				if (this.pzing) {
+					return
+				}
+				if (!this.pz) {
+					return this.$api.msg('请上传凭证')
+				}
+				this.pzing = true
+				upEvaluation({
+					id: this.orderId,
+					up_files: this.pz
+				}).then(res => {
+					uni.showToast({
+						title: '上传成功',
+						duration: 2000
+					});
+					this.$refs.popup.close()
+					this.orderId = ''
+					this.getList('reload')
+					this.pzing = false
+				}).catch(err => {
+					this.pzing = false
+				})
+			},
+			upimg() {
+				upload({
+						file: ''
+					})
+					.then(e => {
+						console.log(e, 'e')
+						this.pz = e[0].url
+						console.log(this.pz)
+					})
+					.catch(e => {});
+			},
+			lookimg(item) {
+				let arr = item.up_files.split(',')
+				uni.previewImage({
+					current: 0,
+					loop: false,
+					urls: arr,
+					indicator: 'default'
+				});
+			},
+			getTime(time) {
+				const num = 13 - (time + '').length;
+				let l = 1; //倍数
+				for (let i = 0; i < num; i++) {
+					l += '0';
+				}
+				// 重新解析为数字
+				l = parseInt(l)
+				const date = new Date(parseInt(time) * l);
+				const year = date.getFullYear();
+				const mon = date.getMonth() + 1;
+				const day = date.getDate();
+				const hours = date.getHours();
+				const minu = date.getMinutes();
+				const sec = date.getSeconds();
+				return year + '-' + (mon > 9 ? mon : ('0' + mun)) + '-' + (day > 9 ? day : ('0' + day))  + ' ' + (hours > 9 ? hours : ('0' + hours)) + ':' + (minu > 9 ? minu : ('0' + minu)) + ':' + (sec > 9 ? sec : ('0' + sec));
+			},
+			// 切换nav
+			changeNav(index) {
+				if (index === this.navCurrent) {
+					return
+				}
+				console.log('切换');
+				this.navCurrent = index
+				this.getList('tab')
+			},
+			changeNavT(index) {
+				if (index === this.current) {
+					return
+				}
+				console.log('切换');
+				this.current = index
+				this.getList('reload')
+
+			},
+			getList(type) {
+				let that = this
+				let item = that.navList[that.navCurrent]
+				if (type == 'reload' || type == 'tab') {
+					item.page = 1
+					item.list = []
+					item.loadingType = 'more'
+					item.loaded = false
+				}
+				if (item.loadingType == 'loading' || item.loadingType == 'noMore') {
+					return
+				}
+				item.loadingType = 'loading'
+				let qdata = {
+					page: item.page,
+					limit: item.limit,
+					status: item.status,
+					order: 'id desc',
+					out: item.out
+				}
+				getGsList(qdata).then(res => {
+					let arr = res.data.result.list
+					item.list = item.list.concat(arr)
+					console.log(item.list)
+					if (item.limit == arr.length) {
+						item.loadingType = 'more'
+						item.page++
+					} else {
+						item.loadingType = 'noMore'
+					}
+					item.loaded = true
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.nav-wrap {
+
+		padding: 28rpx 30rpx 20rpx;
+		background-color: #fff;
+
+		.item {
+			width: 336rpx;
+			height: 81rpx;
+			border-radius: 10rpx;
+			border: 1px solid #EC5A54;
+			color: #EC5A54;
+			line-height: 80rpx;
+			text-align: center;
+		}
+
+		.action {
+			background-color: #EC5A54;
+			color: #fff;
+		}
+
+	}
+
+	.nav-list {
+		justify-content: space-around;
+		background-color: #fff;
+		font-weight: 500;
+		color: #333333;
+
+		.item {
+			padding: 28rpx 20rpx 16rpx;
+
+		}
+
+		.action {
+			color: #EC5A54;
+			border-bottom: 2px solid red;
+		}
+	}
+
+	.scroll-wrap {
+		padding-top: 20rpx;
+	}
+
+	.order-wrap {
+		width: 686rpx;
+		// height: 297rpx;
+		background: #FFFFFF;
+		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
+		border-radius: 20rpx;
+		margin: 0 auto 20rpx;
+		padding: 33rpx 40rpx;
+		position: relative;
+
+		.m-info {
+			justify-content: flex-start;
+
+			image {
+				width: 55rpx;
+				height: 55rpx;
+				margin-right: 13rpx;
+			}
+
+			text {
+				font-size: 28rpx;
+				font-weight: bold;
+				color: #333333;
+			}
+		}
+
+		.price {
+			font-size: 40rpx;
+			font-family: PingFang SC;
+			font-weight: bold;
+			color: #FF4C4C;
+			padding: 40rpx 0 30rpx;
+		}
+
+		.num {
+			font-size: 26rpx;
+			font-weight: 500;
+			color: #888785;
+		}
+
+		.status {
+			position: absolute;
+			right: 10rpx;
+			top: 10rpx;
+			font-size: 26rpx;
+		}
+
+		.btn-list {
+			border-top: 1px solid #eee;
+			margin-top: 20rpx;
+			padding-top: 20rpx;
+			justify-content: flex-end;
+		}
+
+		.order-btn {
+			width: 148rpx;
+			height: 62rpx;
+			border: 2px solid #FF5570;
+			border-radius: 30rpx;
+			line-height: 62rpx;
+			text-align: center;
+			font-size: 28rpx;
+			font-weight: bold;
+			color: #FF4C4C;
+			position: absolute;
+			right: 40rpx;
+			bottom: 33rpx;
+		}
+
+		.order-btn-hui {
+			color: #aaa;
+			border: 2px solid #aaa;
+		}
+	}
+
+	.pz-wrap {
+		width: 550rpx;
+		// height: 500rpx;
+		background-color: #fff;
+		border-radius: 20rpx;
+		text-align: center;
+		font-size: 32rpx;
+		padding: 40rpx;
+
+		image {
+			width: 250rpx;
+			height: 250rpx;
+		}
+
+		.tit {
+			font-weight: bold;
+			padding: 20rpx 0;
+		}
+
+		.btn {
+			background-color: $base-color;
+			padding: 0 20rpx;
+			height: 65rpx;
+			border-radius: 25rpx;
+			width: 250rpx;
+			color: #fff;
+			line-height: 60rpx;
+			margin: 20rpx auto 0;
+		}
+	}
+	.order {
+		background-color: #fff;
+		padding:30rpx;
+		
+		image {
+			width: 30rpx;
+			height: 33rpx;
+			vertical-align: middle;
+			margin-right: 10rpx;
+		}
+	}
+</style>

+ 12 - 12
pages/index/index.vue

@@ -134,26 +134,26 @@
 						img: '../../static/icon/inx3.png',
 						tit: '普惠商城'
 					},
-					{
-						path: '/pages/index/gift?type=14',
-						img: '../../static/icon/inx4.png',
-						tit: '第三方商城'
-					},
 					// {
-					// 	path: '/pages/index/three',
+					// 	path: '/pages/index/gift?type=14',
 					// 	img: '../../static/icon/inx4.png',
 					// 	tit: '第三方商城'
 					// },
-					// {
-					// 	path: '/pages/index/life',
-					// 	img: '../../static/icon/inx5.png',
-					// 	tit: '本地生活'
-					// },
 					{
-						path: '/pages/index/gift?type=13',
+						path: '/pages/index/three',
+						img: '../../static/icon/inx4.png',
+						tit: '第三方商城'
+					},
+					{
+						path: '/pages/index/life',
 						img: '../../static/icon/inx5.png',
 						tit: '本地生活'
 					},
+					// {
+					// 	path: '/pages/index/gift?type=13',
+					// 	img: '../../static/icon/inx5.png',
+					// 	tit: '本地生活'
+					// },
 					{
 						path: '/pages/index/gift?type=13',
 						img: '../../static/icon/inx6.png',

+ 49 - 22
pages/index/life.vue

@@ -20,7 +20,7 @@
 						官方¥{{itemt.num}}
 					</view>
 					<view class="price">
-						¥{{itemt.price}}
+						¥{{(itemt.num * 1 * pUser.recharge_discount*1*0.01).toFixed(2)}}
 					</view>
 				</view>
 			</view>
@@ -45,7 +45,7 @@
 					到账时间:1-96小时 (高峰期96小时内)
 				</view>
 				<view class="">
-					充值号码:<text class="tip">{{this.phone}}</text> 
+					充值号码:<text class="tip">{{this.phone}}</text>
 				</view>
 				<view class="tip tips">
 					请仔细核对号码。输错号码后果自负
@@ -56,7 +56,7 @@
 			</view>
 		</uni-popup>
 	</view>
-	
+
 </template>
 
 <script>
@@ -64,9 +64,11 @@
 		getCzList,
 		createCz
 	} from '@/api/three'
+	import { passUser } from '@/api/zero.js'
 	export default {
 		data() {
 			return {
+				pUser: {},
 				phone: '',
 				info: [],
 				content: '',
@@ -77,7 +79,7 @@
 		},
 		onLoad() {},
 		onShow() {
-			this.getCzList()
+			this.passUser()
 		},
 		onReachBottom() {
 
@@ -86,9 +88,18 @@
 
 		},
 		onNavigationBarButtonTap(event) {
-		    console.log('nav button pressed', event)
+			console.log('nav button pressed', event)
+			uni.navigateTo({
+				url: '/pages/index/lifeOrder'
+			})
 		},
 		methods: {
+			passUser() {
+				passUser().then(res => {
+					this.pUser = res.data
+					this.getCzList()
+				})
+			},
 			goCz() {
 				if (!this.phone) {
 					return this.$api.msg('请输入手机号')
@@ -97,7 +108,7 @@
 				if (!pattern.test(this.phone)) {
 					return this.$api.msg('请输入正确的手机号')
 				}
-				if(!this.choose.goods_id) {
+				if (!this.choose.goods_id) {
 					return this.$api.msg('请选择需要充值的套餐')
 				}
 				this.$refs.popup.open()
@@ -106,13 +117,19 @@
 				createCz({
 					rechargeno: this.phone,
 					pay_type: 'yue',
-					goods_id: this.choose.goods_id
+					goods_id: this.choose.goods_id,
+					pay_price: (this.choose.num * 1 * this.pUser.recharge_discount*1*0.01).toFixed(2)
 				}).then(res => {
-					uni.showToast({
-						icon:'success',
-						title:'充值成功'
-					})
+					if(res.data.status == 'PAY_DEFICIENCY') {
+						this.$api.msg(res.msg)
+					}else {
+						uni.showToast({
+							icon: 'success',
+							title: '充值成功'
+						})
+					}
 					this.$refs.popup.close()
+					
 				})
 			},
 			chooseGood(item) {
@@ -153,21 +170,23 @@
 	}
 
 	.item-wrap {
-		
+
 		width: 690rpx;
 		background-color: #fff;
 		margin: 0 auto 20rpx;
 		padding: 20rpx 34rpx;
 		border-radius: 20rpx;
-.tip {
-		width: 620rpx;
-		margin: auto;
-		background-color: #e9f1fe;
-		padding: 20rpx;
-		border-radius: 20rpx;
-		margin-top: 40rpx;
 
-	}
+		.tip {
+			width: 620rpx;
+			margin: auto;
+			background-color: #e9f1fe;
+			padding: 20rpx;
+			border-radius: 20rpx;
+			margin-top: 40rpx;
+
+		}
+
 		.tit {
 			font-size: 30rpx;
 			font-weight: bold;
@@ -190,10 +209,12 @@
 					font-weight: bold;
 					font-size: 28rpx;
 				}
+
 				.base-price {
 					padding-top: 10rpx;
 					font-size: 22rpx;
 				}
+
 				.price {
 					font-size: 28rpx;
 					color: #f3253a;
@@ -207,7 +228,7 @@
 		}
 	}
 
-	
+
 
 	.top-search {
 		height: 80rpx;
@@ -248,26 +269,32 @@
 
 		}
 	}
+
 	.cz-model {
 		width: 750rpx;
 		background-color: #fff;
 		padding: 60rpx 0 30rpx;
 		text-align: center;
 		border-radius: 25rpx 25rpx 0 0;
+
 		view {
 			padding: 10rpx 0;
 		}
+
 		.price {
 			color: $base-color;
 			font-size: 48rpx;
 			font-weight: bold;
 		}
+
 		.tip {
-			color: #409eff ;
+			color: #409eff;
 		}
+
 		.tips {
 			padding-bottom: 20rpx;
 		}
+
 		.btn {
 			width: 690rpx;
 			text-align: center;

+ 97 - 0
pages/index/lifeOrder.vue

@@ -0,0 +1,97 @@
+<template>
+	<view class="content">
+		<view class="order-wrap" v-for="item in list">
+			<view class="tit">
+				订单号:{{item.order_id}}
+			</view>
+			<view class="tit">
+				支付方式:{{item.pay_type == 'yue'?'余额': (item.pay_price == 'weixin'?'微信':'支付宝')}}
+			</view>
+			<view class="tit">
+				充值号码:{{item.rechargeno}}
+			</view>
+			<view class="tit">
+				实付: {{item.pay_price}}
+			</view>
+		</view>
+		
+		<uni-load-more v-if="!(list.length == 0 && loaded)" :status="loadingType" ></uni-load-more>
+		<empty v-else></empty>
+	</view>
+</template>
+
+<script>
+	import empty from '@/components/empty.vue'
+	
+	import { getLifeOrder } from '@/api/three.js'
+	
+	export default {
+		components: {
+			empty
+		},
+		data() {
+			return {
+				list: [],
+				page: 1,
+				limit: 10,
+				loaded: false,
+				loadingType: 'more'
+			}
+		},
+		onLoad() {
+			
+		},
+		onShow() {
+			this.getLifeOrder()
+		},
+		onReachBottom() {
+			this.getLifeOrder()
+		},
+		onReady() {
+			
+		},
+		methods: {
+			getLifeOrder() {
+				let that = this
+				if(that.loadingType == 'loading' || that.loadingType == 'noMore') {
+					return
+				}
+				that.loadingType = 'loading'
+				getLifeOrder({
+					page: that.page,
+					limit: that.limit
+				}).then(res => {
+					let arr = res.data.data
+					that.list = that.list.concat(arr)
+					if(arr.length == that.limit) {
+						that.loadingType = 'more'
+						that.page++
+					}else {
+						that.loadingType = 'noMore'
+					}
+					that.loaded = true
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.content {
+		padding-top: 20rpx;
+	}
+	.order-wrap {
+		width: 690rpx;
+		background-color: #fff;
+		margin: 0 auto 20rpx;
+		padding: 20rpx 34rpx;
+		border-radius: 20rpx;
+		.tit {
+			font-size: 30rpx;
+			font-weight: bold;
+		}
+		.price {
+			text-align: right;
+		}
+	}
+</style>

+ 0 - 6
pages/index/zero.vue

@@ -43,9 +43,6 @@
 							<view class="name ">
 									{{cardItem.name}}
 							</view>
-	<!-- 						<view class="">
-								有效期{{cardItem.max_send ||0}}
-							</view> -->
 							<view class="" style="padding-right: 10rpx;">
 								周期{{cardItem.end_day || 0}}天,每日产出数量{{cardItem.day_pass || 0}},共富值+{{cardItem.holding_value || 0}}.最多可持有{{cardItem.max_count}}个
 							</view>
@@ -93,9 +90,6 @@
 						<view class="num">
 							{{ getTime(orderItem.add_time)}}
 						</view>
-						<!-- <view class="order-btn" @click="makeCall(orderItem.phone)">
-							联系卖家
-						</view> -->
 						<view class="order-btn" @click="gobuy(orderItem)">
 							立即购买
 						</view>

+ 1 - 1
pages/public/login.vue

@@ -33,7 +33,7 @@
 				<view class="forget" style="text-align: left;" @click="goDown">下载APP</view>
 				<!-- #endif -->
 				<view class="forget">
-					<navigator url="./forget">忘记密码</navigator>
+					<navigator url="/pages/set/password">忘记密码</navigator>
 				</view>
 			</view>
 			<!-- <view class="flex other">

+ 10 - 2
pages/set/password.vue

@@ -76,7 +76,9 @@ export default {
 					phone: obj.account,
 					type: ''
 				})
-					.then(({ data }) => {})
+					.then(({ data }) => {
+						this.$api.msg('发送成功');
+					})
 					.catch(err => {
 						console.log(err);
 					});
@@ -91,7 +93,13 @@ export default {
 			})
 				.then(({ data }) => {
 					this.loding = false;
-					this.$api.msg('修改成功');
+					uni.showToast({
+						title:'修改成功',
+						icon:'success'
+					})
+					setTimeout(()=> {
+						uni.navigateBack()
+					},1500)
 				})
 				.catch(err => {
 					this.loding = false;

+ 47 - 22
pages/zero/gs.vue

@@ -9,28 +9,32 @@
 		<!-- //挂售价格(元) -->
 		<view class="flex gs-item">
 			<view class="item-name">
-				挂售价格(元)
+				{{type == 1?'挂售': '买入'}}价格(元)
 			</view>
-			<input type="text" class="item-val" placeholder="请输入您的挂售价(单价)" v-model="total_price" />
+			<input type="text" class="item-val" :placeholder="'请输入您的' + (type == 1?'挂售': '买入') + '价(单价)'" v-model="total_price" />
 		</view>
 		<view class="flex gs-item">
 			<view class="item-name">
-				挂售数量
+				{{type == 1?'挂售': '买入'}}数量
 			</view>
-			<input type="text" class="item-val" placeholder="请输入挂售数量" v-model="amount" />
+			<input type="text" class="item-val" :placeholder="'请输入' + (type == 1?'挂售': '买入') + '数量'" v-model="amount" />
 		</view>
-		<view class="flex gs-item" v-if="type !=1">
+		<view class="flex gs-item" v-if="type !=1 && type != 3">
 			<view class="item-name">
 				联系方式
 			</view>
 			<input type="text" class="item-val" placeholder="请输入联系方式" v-model="phone" />
 		</view>
-		<view class="fwf" v-if="type != 1">
+		<view class="fwf" v-if="type != 1 && type != 3">
 			服务费:<text>{{(total_price * amount * pUser.fee_ratio / 100).toFixed(2) || 0}} 阅读积分</text>
 		</view>
-		<view class="fwf" v-else>
+		<view class="fwf" v-if="type == 1">
 			服务费:<text>{{( amount * 0.05).toFixed(4) || 0}} 余额宝</text>
 		</view>
+		<view class="fwf" v-if="type == 3">
+			<!-- 服务费:<text>{{( amount * 0.05).toFixed(4) || 0}} 余额宝</text> -->
+			买入价格不得低于参考价
+		</view>
 		<view class="btn" @click="createGs">
 			确认
 		</view>
@@ -40,7 +44,8 @@
 <script>
 	import {
 		createGs,
-		passUser
+		passUser,
+		createBuy
 	} from '@/api/zero.js'
 	export default {
 		data() {
@@ -56,6 +61,11 @@
 			if (opt.type) {
 				this.type = opt.type
 			}
+			if(opt.type == 3) {
+				uni.setNavigationBarTitle({
+					title: '买入'
+				})
+			}
 		},
 		onShow() {
 			this.passUser()
@@ -80,21 +90,36 @@
 				if(!that.amount) {
 					return that.$api.msg('请输入挂售数量')
 				}
+				if(that.type == 1) {
+					createGs({
+						total_price: that.total_price * that.amount,
+						amount: that.amount,
+						phone: that.phone,
+						type: that.type
+					}).then(res => {
+						uni.showToast({
+							title: '挂售成功',
+							duration: 2000
+						});
+						setTimeout(() => {
+							uni.navigateBack()
+						}, 1500)
+					})
+				}else {
+					createBuy({
+						total_price: that.total_price * that.amount,
+						amount: that.amount,
+					}).then(res => {
+						uni.showToast({
+							title: '提交成功',
+							duration: 2000
+						});
+						setTimeout(() => {
+							uni.navigateBack()
+						}, 1500)
+					})
+				}
 				
-				createGs({
-					total_price: that.total_price * that.amount,
-					amount: that.amount,
-					phone: that.phone,
-					type: that.type
-				}).then(res => {
-					uni.showToast({
-						title: '挂售成功',
-						duration: 2000
-					});
-					setTimeout(() => {
-						uni.navigateBack()
-					}, 1500)
-				})
 			}
 		}
 	}

+ 561 - 0
pages/zero/orders.vue

@@ -0,0 +1,561 @@
+<template>
+	<view class="content">
+		<view class="nav-wrap flex">
+			<view class="item" v-for="(nav,inden) in navList" :class="{'action': navCurrent == inden}"
+				@click="changeNav(inden)">
+				{{nav.tit}}
+			</view>
+		</view>
+		<view class="flex nav-list">
+			<view class="item" v-for="(item,index) in navList[navCurrent].list" :class="{'action': current == index}"
+				@click="changeNavT(index)">
+				{{item.tit}}
+			</view>
+		</view>
+		<swiper disable-touch :style="{'height': maxHeight}" class="scroll-wrap" :current="current">
+			<swiper-item v-for="navItem in navList[navCurrent].list">
+				<scroll-view scroll-y="true" :style="{'height': maxHeight}" @scrolltolower="getList">
+					<view class="order-wrap " v-for="orderItem in navItem.list">
+						<view class="flex m-info">
+							<image src="../../static/icon/gs-av.png" mode="" class="card-img"></image>
+							<text style=" display: inline-block;line-height: 55rpx;" v-if="orderItem.to_user && (orderItem.to_user.phone || orderItem.to_user.nickname)">{{orderItem.to_user.phone || orderItem.to_user.nickname}}</text>
+						</view>
+						<view class="price">
+							¥{{orderItem.total_price}}
+						</view>
+						
+						<view class="num">
+							数量:{{orderItem.amount}}
+						</view>
+						<view class="num">
+							单价:¥{{(orderItem.price*1).toFixed(2)}}
+						</view>
+						<view class="num">
+							{{ getTime(orderItem.add_time)}}
+						</view>
+						<view class="status" :style="{color: showColor(orderItem.status)}">
+							{{orderItem.status == 0 ? '挂售中': (orderItem.status == 1? '待支付': (orderItem.status == 2? '待审核': orderItem.status == 3 ? '已完成': (orderItem.status == 4? '已取消': '未通过')))}}
+						</view>
+						<view class="flex btn-list">
+							<view class="order-btn" v-if="orderItem.status == 0 && navCurrent == 1" @click="qxOrder(orderItem)">
+								取消交易
+							</view>
+							<view class="order-btn" v-if="orderItem.status == 1 && navCurrent == 1" @click="upPz(orderItem)">
+								上传凭证
+							</view>
+							<view class="order-btn" v-if="orderItem.status == 2 && navCurrent == 1" @click="upPz(orderItem)">
+								修改凭证
+							</view>
+							<view class="order-btn" v-if="orderItem.status == 2 || orderItem.status == 3" @click="lookimg(orderItem)">
+								查看凭证
+							</view>
+							<view class="order-btn" v-if="orderItem.status == 2 && navCurrent == 0" @click="auth(orderItem,-1)">
+								拒绝
+							</view>
+							<view class="order-btn" v-if="orderItem.status == 2 && navCurrent == 0" @click="auth(orderItem,1)">
+								通过
+							</view>
+							<view class="order-btn order-btn-hui" v-if="orderItem.status == 4">
+								已取消
+							</view>
+							<view class="order-btn order-btn-hui" v-if="orderItem.status == -1" @click="lookimg(orderItem)">
+								查看凭证
+							</view>
+							<view class="order-btn order-btn-hui" v-if="orderItem.status == -1">
+								未通过
+							</view>
+						</view>
+					</view>
+					<empty v-if="navItem.loaded && navItem.list == 0"></empty>
+					<uni-load-more :status="navItem.loadingType" v-else></uni-load-more>
+				</scroll-view>
+			</swiper-item>
+		</swiper>
+		<uni-popup ref="popup" type="center">
+			<view class="pz-wrap">
+				<view class="tit">
+					上传凭证
+				</view>
+				<image v-if="!pz" src="../../static/img/add.png" mode="" @click="upimg"></image>
+				<image v-else :src="pz" mode="" @click="upimg"></image>
+				<view class="btn" @click="goUp">
+					上传
+				</view>
+			</view>
+		</uni-popup>
+	</view>
+
+</template>
+
+<script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+	
+	import empty from '@/components/empty.vue'
+	
+	import {
+		getGsList,
+		qxGs,
+		upEvaluation,
+		auth,
+		cancelBuy
+	} from '@/api/zero.js'
+	import { upload } from '@/api/order.js';
+	export default {
+		components: {
+			empty
+		},
+		data() {
+			return {
+				pzing: false,
+				orderId: '',
+				pz: '',
+				maxHeight: '',
+				navCurrent: 0, // 0-》买单 1-》卖单
+				current: 0, //二层次序
+				navList: [{
+						tit: '我的抢单',
+						list: [
+							{
+								tit: '全部',
+								status: -2,
+								list: [],
+								loadingType: 'more',
+								page: 1,
+								limit: 10,
+								loaded: false
+							},
+							// {
+							// 	tit: '抢单中',
+							// 	status: 0,
+							// 	list: [],
+							// 	loadingType: 'more',
+							// 	page: 1,
+							// 	limit: 10,
+							// 	loaded: false
+							// },
+							{
+								tit: '待支付',
+								status: 1,
+								list: [],
+								loadingType: 'more',
+								page: 1,
+								limit: 10,
+								loaded: false
+							},
+							{
+								tit: '待审核',
+								status: 2,
+								list: [],
+								loadingType: 'more',
+								page: 1,
+								limit: 10,
+								loaded: false
+							},
+							{
+								tit: '已完成',
+								status: 3,
+								list: [],
+								loadingType: 'more',
+								page: 1,
+								limit: 10,
+								loaded: false
+							}
+						]
+					},
+					{
+						tit: '我的买入',
+						list: [{
+								tit: '全部',
+								status: -2,
+								list: [],
+								loadingType: 'more',
+								page: 1,
+								limit: 10,
+								loaded: false
+							},
+							{
+								tit: '抢单中',
+								status: 0,
+								list: [],
+								loadingType: 'more',
+								page: 1,
+								limit: 10,
+								loaded: false
+							},
+							{
+								tit: '待支付',
+								status: 1,
+								list: [],
+								loadingType: 'more',
+								page: 1,
+								limit: 10,
+								loaded: false
+							},
+							{
+								tit: '待审核',
+								status: 2,
+								list: [],
+								loadingType: 'more',
+								page: 1,
+								limit: 10,
+								loaded: false
+							}
+						]
+					}
+				]
+			}
+		},
+		computed: {
+			...mapState('user',['userInfo'])
+		},
+		onLoad() {
+			
+		},
+		onShow() {
+			this.getList('reload')
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+			var that = this;
+			uni.getSystemInfo({
+				success: resu => {
+					const query = uni.createSelectorQuery();
+					query.select('.scroll-wrap').boundingClientRect();
+					query.exec(function(res) {
+						that.maxHeight = resu.windowHeight - res[0].top + 'px';
+					});
+				},
+				fail: res => {}
+			});
+		},
+		methods: {
+			showColor(status) {
+				if(status == -1 || status == 4) {
+					return '#aaa'
+				}else {
+					return '#FF5570'
+				}
+			},
+			auth(item,type) {
+				let that =this
+				uni.showModal({
+					title: '提示',
+					content: type == 1?'是否确认收款完成?': '是否确认当前提交的凭证没有通过审核',
+					complete(e) {
+						if(e.confirm) {
+							auth({
+								id: item.id,
+								auth: type
+							}).then(res => {
+								uni.showToast({
+									title:'审核成功',
+									duration:2000
+								});
+								that.getList('reload')
+							})
+						}
+					}
+					
+				})
+			},
+			// 取消交易
+			qxOrder(item) {
+				let that = this
+				uni.showModal({
+					title: '提示',
+					content: '是否确认取消挂售?',
+					complete(e) {
+						if(e.confirm) {
+							cancelBuy({
+								id: item.id
+							}).then(res => {
+								uni.showToast({
+									title:'取消成功',
+									duration:2000
+								});
+								that.getList('reload')
+							})
+						}
+					}
+					
+				})
+			},
+			upPz(item) {
+				// if(item.up_files) {
+				// 	this.pz = item.up_files
+				// }
+				// this.orderId = item.id
+				// this.$refs.popup.open()
+				uni.navigateTo({
+					url: '/pages/zero/pay?id=' + item.id
+				})
+			},
+			//上传凭证
+			goUp() {
+				if(this.pzing) {
+					return
+				}
+				if(!this.pz) {
+					return this.$api.msg('请上传凭证')
+				}
+				this.pzing = true
+				upEvaluation({
+					id: this.orderId,
+					up_files: this.pz
+				}).then(res => {
+					uni.showToast({
+						title:'上传成功',
+						duration:2000
+					});
+					this.$refs.popup.close()
+					this.orderId = ''
+					this.getList('reload')
+					this.pzing = false
+				}).catch(err => {
+					this.pzing = false
+				})
+			},
+			upimg() {
+				upload({
+					file: ''
+				})
+					.then(e => {
+						console.log(e,'e')
+					this.pz = e[0].url
+					console.log(this.pz)
+					})
+					.catch(e => {});
+			},
+			lookimg(item) {
+				let arr = item.up_files.split(',')
+				uni.previewImage({
+					current: 0,
+					loop: false,
+					urls: arr,
+					indicator: 'default'
+				});
+			},
+			getTime(time) {
+				const num =13 - (time+'').length;
+				let l = 1;//倍数
+				for (let i = 0; i < num; i++) {
+					l+='0';
+				}
+				// 重新解析为数字
+				l = parseInt(l)
+				const date = new Date(parseInt(time) * l);
+				const year = date.getFullYear();
+				const mon = date.getMonth() + 1;
+				const day = date.getDate();
+				const hours = date.getHours();
+				const minu = date.getMinutes();
+				const sec = date.getSeconds();
+				return year + '-' + mon + '-' + day + ' ' + hours + ':' + minu + ':' + sec;
+			},
+			// 切换nav
+			changeNav(index) {
+				if (index === this.navCurrent) {
+					return
+				}
+				console.log('切换');
+				this.navCurrent = index
+				this.getList('tab')
+			},
+			changeNavT(index) {
+				if (index === this.current) {
+					return
+				}
+				console.log('切换');
+				this.current = index
+				this.getList('reload')
+
+			},
+			getList(type) {
+				let that = this
+				let item = that.navList[that.navCurrent].list[that.current]
+				if(type == 'reload') {
+					item.page = 1
+					item.list = []
+					item.loadingType = 'more'
+					item.loaded = false
+				}
+				if (item.loadingType == 'loading' || item.loadingType == 'noMore') {
+					return
+				}
+				if (type == 'tab' && item.loaded) {
+					return
+				}
+				item.loadingType = 'loading'
+				let qdata = {
+					page: item.page,
+					limit: item.limit,
+					status: item.status,
+					type: 1,
+					order: 'id desc',
+					out: 0,
+				}
+				if(that.navCurrent == 1) {
+					qdata.to_uid = that.userInfo.uid
+				}else {
+					qdata.uid = that.userInfo.uid
+				}
+				getGsList(qdata).then(res => {
+					let arr = res.data.result.list
+					item.list = item.list.concat(arr)
+					if (item.limit == arr.length) {
+						item.loadingType = 'more'
+						item.page++
+					} else {
+						item.loadingType = 'noMore'
+					}
+					item.loaded = true
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.nav-wrap {
+
+		padding: 28rpx 30rpx 20rpx;
+		background-color: #fff;
+
+		.item {
+			width: 336rpx;
+			height: 81rpx;
+			border-radius: 10rpx;
+			border: 1px solid #EC5A54;
+			color: #EC5A54;
+			line-height: 80rpx;
+			text-align: center;
+		}
+
+		.action {
+			background-color: #EC5A54;
+			color: #fff;
+		}
+
+	}
+
+	.nav-list {
+		justify-content: space-around;
+		background-color: #fff;
+		font-weight: 500;
+		color: #333333;
+
+		.item {
+			padding: 28rpx 20rpx 16rpx;
+
+		}
+
+		.action {
+			color: #EC5A54;
+			border-bottom: 2px solid red;
+		}
+	}
+
+	.scroll-wrap {
+		padding-top: 20rpx;
+	}
+
+	.order-wrap {
+		width: 686rpx;
+		// height: 297rpx;
+		background: #FFFFFF;
+		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
+		border-radius: 20rpx;
+		margin: 0 auto 20rpx;
+		padding: 33rpx 40rpx;
+		position: relative;
+		.m-info {
+			justify-content: flex-start;
+
+			image {
+				width: 55rpx;
+				height: 55rpx;
+				margin-right: 13rpx;
+			}
+
+			text {
+				font-size: 28rpx;
+				font-weight: bold;
+				color: #333333;
+			}
+		}
+
+		.price {
+			font-size: 40rpx;
+			font-family: PingFang SC;
+			font-weight: bold;
+			color: #FF4C4C;
+			padding: 40rpx 0 30rpx;
+		}
+
+		.num {
+			font-size: 26rpx;
+			font-weight: 500;
+			color: #888785;
+		}
+		.status {
+			position: absolute;
+			right: 10rpx;
+			top: 10rpx;
+			font-size: 26rpx;
+		}
+		.btn-list {
+			border-top: 1px solid #eee;
+			margin-top: 20rpx;
+			padding-top: 20rpx;
+			justify-content: flex-end;
+		}
+		.order-btn {
+			width: 148rpx;
+			height: 62rpx;
+			border: 2px solid #FF5570;
+			border-radius: 30rpx;
+			line-height: 62rpx;
+			text-align: center;
+			font-size: 28rpx;
+			font-weight: bold;
+			color: #FF4C4C;
+			margin-left: 20rpx;
+		}
+		.order-btn-hui {
+			color: #aaa;
+			border: 2px solid #aaa;
+		}
+	}
+	.pz-wrap {
+		width: 550rpx;
+		// height: 500rpx;
+		background-color: #fff;
+		border-radius: 20rpx;
+		text-align: center;
+		font-size: 32rpx;
+		padding:40rpx;
+		image {
+			width: 250rpx;
+			height: 250rpx;
+		}
+		.tit {
+			font-weight: bold;
+			padding: 20rpx 0;
+		}
+		.btn {
+			background-color: $base-color;
+			padding:0 20rpx;
+			height: 65rpx;
+			border-radius: 25rpx;
+			width:250rpx;
+			color: #fff;
+			line-height: 60rpx;
+			margin:20rpx auto 0; 
+		}
+	}
+</style>

+ 20 - 2
pages/zero/task.vue

@@ -56,8 +56,9 @@
 				<view class="btn" v-if="key.agent" @click="navto('/pages/zero/jfhz?type=1')">
 					兑换复投积分
 				</view>
-				<view class="btn" v-if="key.ygs" @click="navto('/pages/zero/gs?type=1')">
-					挂售
+				<!-- <view class="btn" v-if="key.ygs" @click="navto('/pages/zero/gs?type=1')"> -->
+					<view class="btn" v-if="key.ygs" @click="openT">
+					挂售/买入
 				</view>
 				<view class="btn" v-if="key.ye" @click="navto('/pages/zero/jfhz?type=2')">
 					兑换阅读积分
@@ -143,6 +144,23 @@
 			this.passUser()
 		},
 		methods: {
+			openT() {
+				uni.showActionSheet({
+					itemList:['挂售','买入'],
+					success(e) {
+						console.log(e.tapIndex)
+						if(e.tapIndex == 0) {
+							uni.navigateTo({
+								url:'/pages/zero/gs?type=1'
+							})
+						}else {
+							uni.navigateTo({
+								url:'/pages/zero/gs?type=3'
+							})
+						}
+					}
+				})
+			},
 			passUser() {
 				passUser().then(res => {
 					// console.log(res);

BIN
static/icon/order1.png