lhl 2 months ago
parent
commit
0857f1073f
6 changed files with 421 additions and 36 deletions
  1. 10 0
      api/order.js
  2. 9 0
      api/three.js
  3. 10 3
      components/payment/index.vue
  4. 6 0
      pages.json
  5. 258 33
      pages/goods/order_list/serve.vue
  6. 128 0
      pages/goods/three/list.vue

+ 10 - 0
api/order.js

@@ -422,4 +422,14 @@ export function storecompleteSubscribe(data) {
 //提交退款申请
 export function SqRefund(data) {
 	return request.post(`v2/Subscribe/refund_order`, data);
+}
+
+//打赏
+export function ds(data) {
+	return request.post(`reward/create`, data);
+}
+
+//投诉
+export function ts(data) {
+	return request.post(`complaint/create`, data);
 }

+ 9 - 0
api/three.js

@@ -23,3 +23,12 @@ export function computedCz(data) {
 export function getCity(data) {
 	return request.get("recharge/screen_list", data);
 }
+
+
+export function getReward(data) {
+	return request.get("reward/lst", data);
+}
+///complaint/lst
+export function getComplaint(data) {
+	return request.get("complaint/lst", data);
+}

+ 10 - 3
components/payment/index.vue

@@ -35,6 +35,10 @@
 	import colors from '@/mixins/color.js';
 	export default {
 		props: {
+			payTT: {
+				type: Boolean,
+				default: false,
+			},
 			payMode: {
 				type: Array,
 				default: function() {
@@ -106,12 +110,15 @@
 					});
 				}
 				let that = this;
-				if (!that.order_id) return that.$util.Tips({
-					title: '请选择要支付的订单'
-				});
 				if (paytype == 'yue' && parseFloat(number) < parseFloat(that.totalPrice)) return that.$util.Tips({
 					title: '余额不足!'
 				});
+				if(that.payTT) {
+					return that.$emit('onChooseType', paytype);
+				}
+				if (!that.order_id) return that.$util.Tips({
+					title: '请选择要支付的订单'
+				});
 				uni.showLoading({
 					title: '支付中'
 				});

+ 6 - 0
pages.json

@@ -1819,6 +1819,12 @@
 						"navigationBarTitleText": "我的充值"
 					}
 				},
+				{
+					"path": "three/list",
+					"style": {
+						"navigationBarTitleText": ""
+					}
+				},
 				{
 					"path": "goods_list/list",
 					"style": {

+ 258 - 33
pages/goods/order_list/serve.vue

@@ -105,27 +105,17 @@
 						</view>
 					</view>
 					<view class="bottom acea-row row-right row-middle" v-if="item.status != 2">
-						<!-- <view class="icon acea-row row-middle" style="justify-self: flex-start;">
-							<view class="iconfont icon-dianhua" @click.stop="call(item.store.phone)"></view>
-							<view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(tem.store)"></view>
-						</view> -->
 						<view class="bnt cancelBnt" v-if="item.status == 0 || item.status==1"
 							@click="cancelOrder(index, item.id)">取消订单</view>
 						<view class="bnt cancelBnt" v-if="item.status == -1 && (item.refund_status == 1 ||  item.refund_status == 2 || item.refund_status == 3)">退款审核中</view>
 						<view class="bnt cancelBnt" v-if="item.status == -1 && (item.refund_status == 4 ||  item.refund_status == 5)">退款完成</view>
 						<view class="bnt cancelBnt" v-if="item.status == -1 && item.refund_status == -1 ">退款已拒绝</view>
-						<!-- <view class="bnt bg-color" v-if="item._status._type == 0"
-							@click="goPay(item.pay_price, item.order_id)">立即付款</view> -->
-						<!-- <view class="bnt bg-color" v-else-if="item._status._type == 3"
-							@click="goOrderDetails(item.order_id)">去评价</view> -->
-						<!-- <view class="bnt bg-color"
-							v-else-if="item.seckill_id < 1 && item.bargain_id < 1 && item.combination_id < 1 && item._status._type == 4"
-							@click="goOrderDetails(item.order_id)">
-							再次购买
-						</view> -->
-						<!-- <view class="bnt cancelBnt" v-if="item._status._type == 4"
-							@click="delOrder(item.order_id, index)">删除订单</view> -->
-						<!-- <view class="bnt bg-color" @click="goOrderDetails(item.order_id)">查看详情</view> -->
+					</view>
+					<view class="bottom acea-row row-right row-middle" v-if="item.status == 2">
+						<view class="bnt cancelBnt" v-if="item.reward && item.reward.id">已打赏</view>
+						<view class="bnt cancelBnt showbtn" v-else @click="das(item)">打赏</view>
+						<view class="bnt cancelBnt " v-if="item.complaint && item.complaint.id" >已投诉</view>
+						<view class="bnt cancelBnt " v-else @click="ts(item)">投诉</view>
 					</view>
 				</view>
 			</view>
@@ -139,10 +129,42 @@
 		</view>
 		<home v-if="navigation"></home>
 		<payment :payMode="payMode" :pay_close="pay_close" @onChangeFun="onChangeFun" :order_id="pay_order_id"
-			:totalPrice="totalPrice"></payment>
+			:totalPrice="totalPrice" :payTT="true" @onChooseType="onChooseType"></payment>
 		<!-- #ifdef MP -->
 		<!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
 		<!-- #endif -->
+		<uni-popup type="center" ref="dspop">
+			<view class="ds-wrap">
+				<view class="tit">
+					多少都是您的心意
+				</view>
+				<input type="number" v-model="dsPrice" placeholder="请输入任意打赏金额"/>
+				<view class="btn-wrap">
+					<view class="btn" @click="closeDs">
+						取消
+					</view>
+					<view class="btn s-btn" @click="confirmDs">
+						确定
+					</view>
+				</view>
+			</view>
+		</uni-popup>
+		<uni-popup type="center" ref="tspop">
+			<view class="ds-wrap">
+				<view class="tit">
+					投诉
+				</view>
+				<input type="text" v-model="tsyy" placeholder="请输入投诉原因"/>
+				<view class="btn-wrap">
+					<view class="btn" @click="closeTs">
+						取消
+					</view>
+					<view class="btn s-btn" @click="confirmTs">
+						确定
+					</view>
+				</view>
+			</view>
+		</uni-popup>
 	</view>
 </template>
 
@@ -153,7 +175,9 @@
 		orderCancel,
 		orderDel,
 		orderPay,
-		SqRefund
+		SqRefund,
+		ds,
+		ts
 	} from '@/api/order.js';
 	import {
 		getUserInfo,
@@ -206,7 +230,7 @@
 						icon: 'icon-zhifubao',
 						value: 'alipay',
 						title: '使用线上支付宝支付',
-						payStatus: true
+						payStatus: false
 					},
 					{
 						name: '余额支付',
@@ -221,7 +245,11 @@
 				pay_order_id: '',
 				totalPrice: '0',
 				isAuto: false, //没有授权的不会自动授权
-				isShowAuth: false //是否隐藏授权
+				isShowAuth: false ,//是否隐藏授权
+				dsItem: {},
+				dsPrice: '',
+				tsItem: {},
+				tsyy: ''
 			};
 		},
 		computed: mapGetters(['isLogin']),
@@ -244,6 +272,157 @@
 				options.status);
 		},
 		methods: {
+			ts(item) {
+				
+			},
+			onChooseType(payType) {
+				console.log(payType,'payType')
+				let that = this;
+				let dsData = {
+					member_id: that.dsItem.work_member_id,
+					pay_type: payType,
+					pay_price: that.dsPrice,
+					// #ifdef MP
+					'from': 'routine',
+					// #endif
+					// #ifdef H5
+					'from': this.$wechat.isWeixin() ? 'weixin' : 'weixinh5',
+					// #endif
+					subscribe_id: that.dsItem.order_id
+				}
+				uni.showLoading({
+					title: '支付中'
+				});
+				try{
+					ds(dsData).then(res => {
+						let jsConfig = res.data.result.jsConfig;
+						switch (payType) {
+							case 'weixin':
+								if (res.data.result === undefined) return that.$util.Tips({
+									title: '缺少支付参数'
+								});
+								let mp_pay_name=''
+								if(uni.requestOrderPayment){
+									mp_pay_name='requestOrderPayment'
+								}else{
+									mp_pay_name='requestPayment'
+								}
+								uni[mp_pay_name]({
+									timeStamp: jsConfig.timestamp,
+									nonceStr: jsConfig.nonceStr,
+									package: jsConfig.package,
+									signType: jsConfig.signType,
+									paySign: jsConfig.paySign,
+									success: function(res) {
+										uni.hideLoading();
+										return that.$util.Tips({
+											title: res.msg,
+											icon: 'success'
+										}, () => {
+											that.onChangeFun({
+												action: 'pay_complete'
+											})
+											
+										});
+									},
+									fail: function(e) {
+										uni.hideLoading();
+										return that.$util.Tips({
+											title: '取消支付'
+										}, () => {
+											that.onChangeFun({
+												action: 'pay_fail'
+											})
+										});
+									},
+									complete: function(e) {
+										uni.hideLoading();
+										if (e.errMsg == 'requestPayment:cancel') return that.$util
+											.Tips({
+												title: '取消支付'
+											}, () => {
+												that.onChangeFun({
+													action: 'pay_fail'
+												})
+											});
+									},
+								});
+								break;
+							case 'yue':
+								uni.hideLoading();
+								return that.$util.Tips({
+									title: res.msg,
+									icon: 'success'
+								}, () => {
+									that.onChangeFun({
+										action: 'pay_complete'
+									})
+								});
+								break;
+						}
+					})
+				}catch(e){
+					console.log('eer',e)
+					//TODO handle the exception
+				}
+				
+				// console.log(that.dsItem,dsData,'dsData')
+			},
+			confirmDs() {
+				let that = this;
+				if(!that.dsPrice) {
+					return that.$util.Tips({
+						title: '请输入打赏金额'
+					});
+				}
+				that.totalPrice = that.dsPrice + ''
+				console.log(that.totalPrice ,'that.totalPrice ')
+				that.$refs.dspop.close();
+				that.goPay()
+			},
+			confirmTs() {
+				let that = this;
+				if(!that.tsyy) {
+					return that.$util.Tips({
+						title: '请输入投诉原因'
+					});
+				}
+				ts({
+					reason:that.tsyy,
+					order_id: that.tsItem.order_id,
+					member_id: that.tsItem.work_member_id,
+				}).then(res => {
+					that.$refs.tspop.close();
+					that.$util.Tips({
+						title: '投诉已提交'
+					})
+				}).catch(err=> {
+					that.$util.Tips({
+						title: err.msg
+					})
+				})
+				
+				// that.goTs()
+				
+			},
+			closeDs() {
+				this.$refs.dspop.close();
+				this.dsItem = {};
+				this.dsPrice = 0;
+			},
+			closeTs() {
+				this.$refs.tspop.close();
+				this.tsItem = {};
+				this.tsyy = '';
+			},
+			das(row) {
+				this.dsItem = row;
+				this.$refs.dspop.open();
+			},
+			ts(row) {
+				this.tsItem = row;
+				this.$refs.tspop.open();
+			},
 			showOrder(item) {
 				return item.info[0].paid != 0
 			},
@@ -437,25 +616,28 @@
 			 */
 			goPay: function(pay_price, order_id) {
 				this.$set(this, 'pay_close', true);
-				this.$set(this, 'pay_order_id', order_id);
-				this.$set(this, 'totalPrice', pay_price);
+				// this.$set(this, 'pay_order_id', order_id);
+				// this.$set(this, 'totalPrice', pay_price);
 			},
 			/**
 			 * 支付成功回调
 			 *
 			 */
 			pay_complete: function() {
-				this.loadend = false;
-				this.page = 1;
-				this.$set(this, 'orderList', []);
-				this.pay_close = false;
-				uni.navigateTo({
-					url: '/pages/goods/order_pay_status/index?order_id=' + this.pay_order_id +
-						'&msg=支付成功&type=3&totalPrice=' + this.totalPrice
-				})
-				this.pay_order_id = '';
-				this.getOrderData();
-				this.getOrderList();
+				this.$set(this, 'pay_close', false);
+				 // this.page = 1;
+				this.getOrderList()
+				// this.loadend = false;
+				// // this.page = 1;
+				// this.$set(this, 'orderList', []);
+				// this.pay_close = false;
+				// uni.navigateTo({
+				// 	url: '/pages/goods/order_pay_status/index?order_id=' + this.pay_order_id +
+				// 		'&msg=支付成功&type=3&totalPrice=' + this.totalPrice
+				// })
+				// this.pay_order_id = '';
+				// this.getOrderData();
+				// this.getOrderList();
 			},
 			/**
 			 * 支付失败回调
@@ -795,4 +977,47 @@
 			margin-left: 26rpx;
 		}
 	}
+	.showbtn {
+		color: #e93323 !important;
+		border-color: #e93323 !important;
+	}
+	.ds-wrap {
+		width: 623rpx;
+		height: 334rpx;
+		border-radius: 20rpx;
+		background-color: #fff;
+		display: flex;
+		justify-content: space-around;
+		align-items: center;
+		flex-direction: column;
+		
+		input {
+			width: 575rpx;
+			height: 73rpx;
+			background-color: #f5f5f5;
+			color: #000;
+			padding-left: 20rpx;
+		}
+		.btn-wrap {
+			width: 575rpx;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			.btn {
+				width: 277rpx;
+				height: 82rpx;
+				// background-color: ;
+				color: #000;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				background-color: #f5f5f5;
+				border-radius: 15rpx;
+			}
+			.s-btn {
+				color: #fff;
+				background-color:#e93323;
+			}
+		}
+	}
 </style>

+ 128 - 0
pages/goods/three/list.vue

@@ -0,0 +1,128 @@
+<template>
+	<view class="content">
+		<view class="order-wrap" v-for="item in list">
+			<view class="tit">
+				订单编号:{{item.subscribe_id || item.order_id}}
+			</view>
+			<view class="tit" v-if="type == 1">
+				支付方式:{{item.pay_type == 'yue'?'余额': (item.pay_type == 'weixin'?'微信':'支付宝')}}
+			</view>
+			<view class="tit" v-if="type == 1">
+				打赏金额:{{item.pay_price}}
+			</view>
+			<view class="tit" v-if="type == 2">
+				投诉原因:{{item.reason}}
+			</view>
+			<view class="tit">
+				{{type == 1? '打赏时间':'投诉时间'}}:{{showTime( type == 1 ? item.add_time: item.create_time)}}
+			</view>
+		</view>
+		<emptyPage title="暂无充值记录~" v-if="list.length == 0 && loaded"></emptyPage>
+	</view>
+</template>
+
+<script>
+	import emptyPage from '@/components/emptyPage.vue'
+	import {
+		getLifeOrder,
+		getReward,
+		getComplaint
+	} from '@/api/three.js'
+	export default {
+		components: {
+			emptyPage
+		},
+		data() {
+			return {
+				list: [],
+				page: 1,
+				limit: 10,
+				loaded: false,
+				loadingType: 'more',
+				type: 1,
+			}
+		},
+		onLoad(opt) {
+			this.type = opt.type;
+			this.getLifeOrder()
+		},
+		onShow() {
+
+		},
+		onReachBottom() {
+			this.getLifeOrder()
+		},
+		onReady() {
+
+		},
+		methods: {
+			showTime(time) {
+				// 创建一个Date对象,参数为时间戳
+				let timestamp = time * 1000; // 例如:时间戳为1626864000000
+				let date = new Date(timestamp);
+
+				// 获取年、月、日等信息
+				let year = date.getFullYear();
+				let month = date.getMonth() + 1; // 月份是从0开始计数的,所以要加1
+				let day = date.getDate();
+				let hours = date.getHours();
+				let minutes = date.getMinutes();
+				let seconds = date.getSeconds();
+
+				// 格式化输出时间
+				return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+
+			},
+			getLifeOrder() {
+				let that = this
+				if (that.loadingType == 'loading' || that.loadingType == 'noMore') {
+					return
+				}
+				that.loadingType = 'loading'
+				let getList;
+				if (that.type == 1) {
+					getList = getReward
+				} else if (that.type == 2) {
+					getList = getComplaint
+				}
+				getList({
+					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>