xiaol пре 10 месеци
родитељ
комит
e0743373c0
4 измењених фајлова са 193 додато и 22 уклоњено
  1. 16 2
      api/game.js
  2. 111 16
      pages/index/order.vue
  3. 55 4
      pages/index/orderDetail.vue
  4. 11 0
      pages/index/pledge.vue

+ 16 - 2
api/game.js

@@ -113,7 +113,21 @@ export  function moneyLog(data) {
 		data
 	});
 }
-
-
+//取消挂出订单
+export  function cancelLog(data) {
+	return request({
+		url: `/api/sell/${data.id}`,
+		method: 'post',
+		data
+	});
+}
+//查看凭证确认订单
+export  function comfirLog(data) {
+	return request({
+		url: `/api/sell/check/${data.id}`,
+		method: 'post',
+		data
+	});
+}
 
 

+ 111 - 16
pages/index/order.vue

@@ -37,20 +37,31 @@
 					<view class="" style="text-align: right;">
 						<image src="/static/image/img21.png" style="width: 40rpx;height: 31rpx;margin-bottom: 25rpx;" mode="widthFix">
 						</image>
-						<view class="tipBtn" v-if="item.voucher">查看凭证</view>
+						<view class="tipBtn" v-if="status==5 && item.voucher" @click.stop="comfirOrder(item.id,item.voucher)">查看凭证</view>
 						<view class="tipBtn" v-if="status==3">上传凭证</view>
+						<view class="tipBtn" v-if="status==1" @click.stop="cancel(item.id)">取消</view>
 					</view>
 				</view>
 			</view>
 		</view>
 		<uni-load-more :status="loadingType"></uni-load-more>
+		<!-- 查看凭证弹窗 -->
+		<u-popup :show="popShow" @close="popShow = false" :round="10" @open="popShow = true" mode="center">
+			<view class="popBox">
+				<image :src="popShowImg" mode="aspectFit"></image>
+				<view class="popBtn" v-if="tabIndex == 0" @click="comirOrder">确认订单</view>
+				<view class="popBtn" v-if="tabIndex == 1" @click="popShow = false">关闭查看</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
 <script>
 	import {
 		sellMy,
-		sellBuyMy
+		sellBuyMy,
+		cancelLog,
+		comfirLog
 	} from '@/api/game.js';
 	import {
 		mapState
@@ -70,22 +81,22 @@
 				tabIndex: 0, //当前选中的一级分类
 				navItem: ['卖币订单', '买币订单'],
 				tabCurr: 0, //当前选中的二级分类
-				status: 0, //当前选中状态
+				status: 1, //当前选中状态
 				navList: [
 					[ {
 						name: '挂出',
 						status: 1
-					}, {
-						name: '待上传',
-						status: 3
-					}, {
+					},{
+						name: '待确认',
+						status: 5
+					},{
 						name: '完成',
 						status: 2
 					},{
 						name: '结束',
 						status: 0
-					},],
-					[ {
+					}],
+					[{
 						name: '待上传',
 						status: 3
 					}, {
@@ -99,10 +110,16 @@
 				page: 1,
 				limit: 10,
 				loadingType: "more",
-				list: []
+				list: [],
+				popShow:false,
+				popShowImg:'',
+				popId:''
 			}
 		},
-		onLoad() {
+		onShow() {
+			this.page = 1;
+			this.loadingType = "more";
+			this.list = []
 			this.loadData()
 		},
 		onReachBottom() {
@@ -111,7 +128,7 @@
 		methods: {
 			navItemTo(item){
 				uni.navigateTo({
-					url:`/pages/index/orderDetail?id=${item.id}`
+					url:`/pages/index/orderDetail?id=${item.id}&tab=${this.tabIndex}`
 				})
 			},
 			loadData() {
@@ -121,14 +138,22 @@
 					return;
 				}
 				obj.loadingType = "loading";
-				console.log(obj.status);
+				console.log(obj.status,'obj.status');
+				console.log(obj.tabIndex,'obj.tabIndex');
+				console.log(obj.list,'obj.list');
 				if (this.tabIndex == 0) {
 					sellMy({
 						page: obj.page,
 						limit: obj.limit,
 						status:obj.status
 					}, obj.status).then(res => {
-						obj.dataList(res.data.list)
+						let ar = res.data.list.map((re)=>{
+							re.num = +re.num;
+							re.price = +re.price;
+							re.money = +(re.num*re.price).toFixed(8);
+							return re
+						})
+						obj.dataList(ar)
 					});
 				} else if (this.tabIndex == 1) {
 					sellBuyMy({
@@ -137,7 +162,6 @@
 						status:obj.status
 					}, obj.status).then(res => {
 						let ar = res.data.list.map((re)=>{
-							console.log(re,'re');
 							re.num = +re.num;
 							re.price = +re.price;
 							re.money = +(re.num*re.price).toFixed(8);
@@ -147,6 +171,62 @@
 					});
 				}
 			},
+			//取消挂出
+			cancel(id){
+				let obj = this;
+				cancelLog({
+					id:id
+				}).then(res => {
+					if(res.status == 200){
+						uni.showToast({
+							title: res.msg,
+							icon: 'none',
+						})
+						setTimeout(function () {
+							obj.page = 1;
+							obj.loadingType = "more";
+							obj.list = []
+							obj.loadData()
+						}, 1000);
+					}else{
+						uni.showToast({
+							title: res.msg,
+							icon: 'none',
+						})
+					}
+				});
+			},
+			//确认订单
+			comirOrder(){
+				const that = this;
+				comfirLog({
+					id:that.id,
+				}).then(res => {
+					if(res.status == 200){
+						uni.showToast({
+							title: res.msg,
+							icon: 'none',
+						})
+						setTimeout(()=>{
+							obj.page = 1;
+							obj.loadingType = "more";
+							obj.list = []
+							obj.loadData()
+						},1000)
+					}else{
+						uni.showToast({
+							title: res.msg,
+							icon: 'none',
+						})
+					}
+				});
+			},
+			//点击查看凭证
+			comfirOrder(id,img){
+				this.popShowImg = img
+				this.popId = id
+				this.popShow = true
+			},
 			dataList(ar) {
 				const obj = this;
 				if (ar.length > 0) {
@@ -158,7 +238,6 @@
 				} else {
 					obj.loadingType = "nomore";
 				}
-				console.log(obj.list,"list");
 			},
 			tabClick(index,type) {
 				if (type == 1) {
@@ -282,4 +361,20 @@
 			}
 		}
 	}
+	.popBox{
+		max-height: 70vh;
+		padding: 35rpx 35rpx;
+		image{
+			max-height: 60vh;
+		}
+		.popBtn{
+			background: linear-gradient(90deg, #0C5AFA, #1356FF);
+			border-radius: 7rpx;
+			padding: 15rpx 35rpx;
+			width: 60%;
+			margin: 35rpx auto;
+			text-align: center;
+			color: #fff;
+		}
+	}
 </style>

+ 55 - 4
pages/index/orderDetail.vue

@@ -17,7 +17,7 @@
 			</view>
 		</view>
 		
-		<view class="login_text">
+		<view class="login_text" v-if="baseData.status!=1">
 			<view class="example-title flex_item">
 				<view class="titleTip"></view>
 				<view class="">打款凭证</view>
@@ -31,9 +31,13 @@
 					<image class="showImage" mode="widthFix" :src="baseData.voucher"></image>
 				</view>
 			</view>
-			<view class="submission" v-if="baseData.status==3"><button class="golden" type="golden" hover-class="none"
-					@click="submission">确认提交</button></view>
 		</view>
+		<view class="submission" v-if="baseData.status==3 && tab == 1"><button class="golden" type="golden" hover-class="none"
+				@click="submission">确认提交</button></view>
+		<view class="submission" v-if="baseData.status==5 && tab == 0"><button class="golden" type="golden" hover-class="none"
+				@click="comirOrder">确认订单</button></view>
+		<view class="submission" v-if="baseData.status==1 && tab == 0"><button class="golden" type="golden" hover-class="none"
+				@click="cancel">取消订单</button></view>
 	</view>
 </template>
 <script type="text/javascript">
@@ -43,7 +47,9 @@
 	} from '@/api/order.js';
 	import {
 		getSell,
-		setSellVoucher
+		setSellVoucher,
+		cancelLog,
+		comfirLog
 	} from '@/api/game.js';
 	import {
 		copyText
@@ -56,10 +62,12 @@
 				id: '',
 				baseData: {},
 				allmoney: 0,
+				tab:0
 			};
 		},
 		onLoad(opt) {
 			this.id = opt.id;
+			this.tab = opt.tab;
 			this.getData();
 		},
 		methods: {
@@ -81,6 +89,49 @@
 						console.log(e);
 					});
 			},
+			//取消挂出
+			cancel(id){
+				const that = this;
+				cancelLog({
+					id:that.id,
+				}).then(res => {
+					if(res.status == 200){
+						uni.showToast({
+							title: res.msg,
+							icon: 'none',
+						})
+						setTimeout(()=>{
+							uni.navigateBack()
+						},1000)
+					}else{
+						uni.showToast({
+							title: res.msg,
+							icon: 'none',
+						})
+					}
+				});
+			},
+			comirOrder(){
+				const that = this;
+				comfirLog({
+					id:that.id,
+				}).then(res => {
+					if(res.status == 200){
+						uni.showToast({
+							title: res.msg,
+							icon: 'none',
+						})
+						setTimeout(()=>{
+							uni.navigateBack()
+						},1000)
+					}else{
+						uni.showToast({
+							title: res.msg,
+							icon: 'none',
+						})
+					}
+				});
+			},
 			// 下载图片
 			domImage() {
 				uni.downloadFile({

+ 11 - 0
pages/index/pledge.vue

@@ -189,6 +189,7 @@
 			
 			// 购买订单
 			commitorder(item) {
+				let obj = this
 				uni.showModal({
 					title: '请输入支付密码',
 					editable:true,
@@ -211,6 +212,12 @@
 											content: data.msg,
 											showCancel: false,
 										});
+										setTimeout(function () {
+											obj.page = 1;
+											obj.list = [];
+											obj.loadingType = 'more';
+											obj.loadData();
+										}, 1000);
 									})
 									.catch(e => {
 										uni.hideLoading()
@@ -263,6 +270,10 @@
 			},
 			tabClick(index) {
 				this.tabCurrentIndex = index;
+				this.page = 1;
+				this.list = [];
+				this.loadingType = 'more';
+				this.loadData();
 			},
 			async loadData(source) {
 				const that = this;