future 11 kuukautta sitten
vanhempi
sitoutus
89332eea15

+ 6 - 3
xs-app/config/config.ts

@@ -111,6 +111,7 @@ export class config {
 			reset:'/user/reset', //重置用户
 			book_search:'/book/search', //书搜索
 			get_wxbook_to_bookid:'/book/get_wxbook_to_bookid', //获取书id
+			order_list:'/order/list',//订单列表 stype 1:充值 2:购买章节
 		},
 		
 		
@@ -179,11 +180,13 @@ export class config {
 	}
 	
 	/**
-	 * 	订单状态 1 支付中 2 已经支付
+	 * 	订单状态 1:支付中 2:已经支付 3:已取消 4:已退款
 	 */
 	public static order_status = {
-		ZHI_FUZHIONG:1, //支付中
-		YI_JING_ZHI_FU:2, //已经支付
+		PAYING:1, //支付中
+		HAVE_PAY:2, //已经支付
+		CANCEL:3,  //已取消
+		REFUNDED:4, //已退款
 	}
 	
 	/**

+ 17 - 0
xs-app/data/data.ts

@@ -126,4 +126,21 @@ export interface wx_pay_data{
 	package:string,
 	paySign:string,
 	signType:string,
+}
+
+export class order_status_info_data {
+	title:string = '';
+	bg_color:string = '';
+}
+
+export class trading_record_item_data {
+	id:number;
+	amount:number;
+	coin:number;
+	goods_name:string;
+	pay_time:string;
+	create_at:string;
+	status:number;
+	book_name:string;
+	chapter_name:string;
 }

+ 1 - 2
xs-app/framework/sdkUtil.ts

@@ -63,8 +63,7 @@ export class sdkUtil {
 	public static showPayment(data:wx_pay_data,cb:Function){
 		switch (tools.getCurPlatform()){
 			case config.Platform.WEIXIN:
-				// let wx_Info = wx.getSystemInfoSync()
-				// if(wx_Info.platform == 'ios'){
+				// if(sdkUtil.getIsIosDevice()){
 				// 	util.showInfoToast("ios 支付!,请调用客服!")
 				// }else{
 					wx.requestPayment({

+ 62 - 14
xs-app/framework/tools.ts

@@ -1,5 +1,5 @@
 import { config } from "../config/config";
-import { book_item_data, chapter_item_data, user_data } from "../data/data";
+import { book_item_data, chapter_item_data, order_status_info_data, user_data } from "../data/data";
 import { BookshelfManager } from "../stores/bookshelfManager";
 import { ReadHistoryManager } from "../stores/readHistoryManager";
 import { ReadSetting } from "../stores/readSetting";
@@ -51,6 +51,33 @@ export class tools {
 		return id
 	}
 	
+	// 获取订单状态信息
+	public static getOrderStatusInfo(type:number):order_status_info_data {
+		if(!type) {type = config.order_status.PAYING}
+		let info_data = new order_status_info_data()
+		switch (type){
+			case config.order_status.PAYING:
+			    info_data.title = '支付中'
+				info_data.bg_color = '#FDCC22'
+				break;
+			case config.order_status.HAVE_PAY:
+			    info_data.title = '已支付'
+			    info_data.bg_color = '#93DB6B'
+				break;
+			case config.order_status.CANCEL:
+			    info_data.title = '已取消'
+			    info_data.bg_color = '#999999'
+				break;
+			case config.order_status.REFUNDED:
+			    info_data.title = '已退款'
+			    info_data.bg_color = '#f26438'
+				break;
+			default:
+				break;
+		}
+		return info_data
+	}
+	
 	// 请求获取用户open_id
 	private static requestGetUserOpenId(cb:Function) {
 		sdkUtil.login((res:any)=>{
@@ -474,17 +501,17 @@ export class tools {
 	}
 	
 	public static getCurBuyType(){
-		let type = config.pay_type.WEI_XIN;
-		// switch (tools.getCurPlatform()){
-		// 	case config.Platform.WEIXIN:
-		// 		type = config.pay_type.WEI_XIN
-		// 		break;
-		// 	case config.Platform.TOUTIAO:
-		// 		type = config.pay_type.DOU_YIN
-		// 		break;
-		// 	default:
-		// 		break;
-		// }
+		let type = config.pay_type.NEI_BU;
+		switch (tools.getCurPlatform()){
+			case config.Platform.WEIXIN:
+				type = config.pay_type.WEI_XIN
+				break;
+			case config.Platform.TOUTIAO:
+				type = config.pay_type.DOU_YIN
+				break;
+			default:
+				break;
+		}
 		return type
 	}
 	
@@ -554,16 +581,18 @@ export class tools {
 	public static requestRechargeOrderBuy(pay_type:number, goods_id:number, cb:Function) {
 		let opt = {'pay_type':pay_type,'goods_id':goods_id}
 		http.DynamicRequest(config.url_confg.Dynamic.recharge.order_buy,opt,(err=null,data=null)=>{
-			log.Debug('下单  data=',data,'err=',err)
+			// log.Debug('下单  data=',data,'err=',err)
 			if(!err&&data) {
 				if(data.code==config.url_confg.StatesCode.SUCCESS){
 					let order_id = data.content.order_id
 					cb && cb(order_id,data.content.wxpay_info)
 				} else {
 					cb && cb('',null)
+					util.showErrorToast(data.message)
 				}
 			} else {
 				cb && cb('',null)
+				util.showErrorToast('下单错误!')
 			}
 		})
 	}
@@ -572,7 +601,7 @@ export class tools {
 	public static requestRechargeOrderInfo(order_id:string, cb:Function) {
 		let opt = {'order_id':order_id}
 		http.DynamicRequest(config.url_confg.Dynamic.recharge.order_info,opt,(err=null,data=null)=>{
-			log.Debug('查询订单  data=',data,'err=',err)
+			// log.Debug('查询订单  data=',data,'err=',err)
 			if(!err&&data) {
 				if(data.code==config.url_confg.StatesCode.SUCCESS){
 					let status = data.content.status //订单状态 1:支付中 2:已经支付
@@ -585,4 +614,23 @@ export class tools {
 			}
 		})
 	}
+	
+	// 订单列表  stype 1:充值 2:购买章节
+	public static requestOrderList(stype:number, page:number, limit:number=15, cb:Function) {
+		let opt = {'stype':stype,'page':page,'limit':limit}
+		util.showLoading('',true)
+		http.DynamicRequest(config.url_confg.Dynamic.order_list,opt,(err=null,data=null)=>{
+			util.hideLoading()
+			if(!err&&data) {
+				if(data.code==config.url_confg.StatesCode.SUCCESS){
+					let content = data.content
+					cb && cb(content)
+				} else {
+					cb && cb(null)
+				}
+			} else {
+				cb && cb(null)
+			}
+		})
+	}
 }

+ 1 - 0
xs-app/pages/mine/mine-module.vue

@@ -29,6 +29,7 @@
 	// 	{'id':config.mine_goto_type.GUANYUWOMEN,'name':'关于我们'},
 	// ]
 	let data_list = [
+		{'id':config.mine_goto_type.JIAOYIJILU,'name':'交易记录'},
 		{'id':config.mine_goto_type.LIANXIKEFU,'name':'联系客服'},
 		{'id':config.mine_goto_type.GUANYUWOMEN,'name':'关于我们'},
 	]

+ 1 - 1
xs-app/pagesA/readbook/read.vue

@@ -490,7 +490,7 @@
 				if(!err){
 					if(d.code == config.url_confg.StatesCode.SUCCESS){
 						let data:order_info_data = d.content
-						if(data.status==config.order_status.YI_JING_ZHI_FU){
+						if(data.status==config.order_status.HAVE_PAY){
 							clearInterval(temp)
 							cb()
 						}

+ 120 - 18
xs-app/pagesA/tradingRecord/tr-consume.vue

@@ -1,13 +1,32 @@
 <template>
-	<view class="content">
+	<view class="tr-consume_content">
 		<!--  :enable-back-to-top="current_index===tab_index" 在微信小程序上可以多加这一句,因为默认是允许点击返回顶部的,但是这个页面有多个scroll-view,会全部返回顶部,所以需要控制是当前index才允许点击返回顶部 -->
 		<!-- 如果当前页已经加载过数据或者当前切换到的tab是当前页,才展示当前页数据(懒加载) -->
-		<z-paging v-if="first_loaded || is_currentPage" ref="paging" v-model="data_list" @query="queryList" :fixed="false">
+		<view class="total-expend_coins">
+			<view class="total-expend_coins__title">累计使用书币</view>
+			<view class="total-expend_coins__coin">{{total_number}}</view>
+		</view>
+		<z-paging v-if="first_loaded || is_currentPage" 
+		    ref="paging" 
+			v-model="data_list"
+			:default-page-size="15"
+			@query="queryList" 
+			:fixed="false">
 			<!-- 如果希望其他view跟着页面滚动,可以放在z-paging标签内 -->
-			<view class="item" v-for="(item,index) in data_list" :key="index" @click="itemClick(item)">
-				<view class="item-title">{{item.title}}</view>
-				<view class="item-detail">{{item.detail}}</view>
-				<view class="item-line"></view>
+			<view class="list" v-for="(item,index) in data_list" :key="index" @click="itemClick(item)">
+				<view class="item">
+					<view class="item__info">
+						<view class="item__info__title">订阅章节</view>
+						<view class="item__info__date">{{item.create_at}}</view>
+					</view>
+					<view class="item__book">
+						<view class="item__book__name">{{item.book_name}}</view>
+						<view class="item__book__chapter">{{item.chapter_name}}</view>
+					</view>
+					<view class="item__coin">
+						-{{item.coin}}书币
+					</view>
+				</view>
 			</view>
 		</z-paging>
 	</view>
@@ -15,10 +34,13 @@
 
 <script setup lang="ts">
     import { nextTick, ref, watch } from 'vue';
+    import { trading_record_item_data } from '../../data/data';
+    import { tools } from '../../framework/tools';
 		
 	let data_list = ref([])         //v-model绑定的这个变量不要在分页请求结束中自己赋值!!!
 	let first_loaded = ref(false)   //当前组件是否已经加载过了
 	let is_currentPage = ref(false) //是否滚动到当前页
+	let total_number = ref(0)
 	const paging = ref(null)       //$ref:paging
 		
 	const props = defineProps({
@@ -29,6 +51,7 @@
 		if(new_v === props.tab_index){
 			// 懒加载,当滑动到当前的item时,才去加载
 			if(!first_loaded.value){
+				first_loaded.value = true
 				// 这里需要延迟渲染z-paging的原因是为了避免在一些平台上立即渲染可能引发的底层报错问题
 				nextTick(()=>{
 					setTimeout(() => {
@@ -39,25 +62,104 @@
 		}
 	},{immediate:true})
 	
-	function queryList(pageNo:number, pageSize:number) {
-		// console.log('pageNo=',pageNo,'pageSize=',pageSize)
-		let tem_list = []
-		for (let i = 0; i < 10; i++) {
-			let a = {'title':`消费-${i}`,'detail':`detail${i}`}
-			tem_list.push(a)
-		}
-		setTimeout(()=>{
-			paging.value.complete(tem_list)
-			first_loaded.value = true
-		},500)
+	function queryList(pageNum:number, pageSize:number) {
+		// console.log('pageNum=',pageNum,'pageSize=',pageSize)
+		tools.requestOrderList(2,pageNum,pageSize,(data)=>{
+			// console.log('消费data=',data)
+			if(data) {
+				if (pageNum == 1) {
+					data_list.value = []
+					total_number.value = data.total_number
+				}				
+				paging.value.complete(data.list)
+				data_list.value = data_list.value.concat(data.list)
+			} else {
+				paging.value.complete(false)				
+			}			
+		})
+	}
+	
+	function itemClick(item_data:trading_record_item_data) {
 	}
 	
 </script>
 
 <style lang="scss">
 	/* 注意:父节点需要固定高度,z-paging的height:100%才会生效 */
-	.content {
+	.tr-consume_content {
 		height: 100%;
 		background-color: #ffffff;
+		
+		.total-expend_coins{
+			display: flex;
+			flex-direction: row;
+			justify-content: space-between;
+			font-size: 15px;
+			color: #737373;
+			padding: 0 30rpx;
+			padding-top: 20rpx;
+			&__title{}
+			&__coin{}
+		}
+		
+		.list{
+			display: flex;
+			justify-content: center;
+			
+			.item{
+				margin-top: 4%;
+				display: flex;
+				flex-direction: row;
+				width: 88%;
+				padding: 3% 3%;
+				border-radius: 20rpx;
+				box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
+				background-color: #ffffff;
+				&__info{
+					width: 40%;
+					&__title {
+						font-size: 17px;
+						color: #000;
+						white-space: nowrap; /* 防止文本换行 */
+						overflow: hidden; /* 隐藏溢出的文本 */
+						text-overflow: ellipsis; /* 超出部分显示为省略号 */
+					}
+					&__date{
+						margin-top: 16rpx;
+						font-size: 13px;
+						color: #6D6D6D;
+						white-space: nowrap; /* 防止文本换行 */
+						overflow: hidden; /* 隐藏溢出的文本 */
+						text-overflow: ellipsis; /* 超出部分显示为省略号 */
+					}
+				}
+				&__book{
+					width: 40%;
+					&__name {
+						font-size: 17px;
+						color: #000;
+						white-space: nowrap; /* 防止文本换行 */
+						overflow: hidden; /* 隐藏溢出的文本 */
+						text-overflow: ellipsis; /* 超出部分显示为省略号 */
+					}
+					&__chapter{
+						margin-top: 16rpx;
+						font-size: 13px;
+						color: #6D6D6D;
+						white-space: nowrap; /* 防止文本换行 */
+						overflow: hidden; /* 隐藏溢出的文本 */
+						text-overflow: ellipsis; /* 超出部分显示为省略号 */
+					}
+				}
+				&__coin{
+					margin-top: 2%;
+					display: flex;
+					justify-content: right;
+					width: 20%;
+					font-size: 15px;
+					color: #FF133A;
+				}
+			}
+		}
 	}
 </style>

+ 110 - 22
xs-app/pagesA/tradingRecord/tr-recharge.vue

@@ -1,13 +1,33 @@
 <template>
-	<view class="content">
+	<view class="tr-recharge_content">
 		<!--  :enable-back-to-top="current_index===tab_index" 在微信小程序上可以多加这一句,因为默认是允许点击返回顶部的,但是这个页面有多个scroll-view,会全部返回顶部,所以需要控制是当前index才允许点击返回顶部 -->
 		<!-- 如果当前页已经加载过数据或者当前切换到的tab是当前页,才展示当前页数据(懒加载) -->
-		<z-paging v-if="first_loaded || is_currentPage" ref="paging" v-model="data_list" @query="queryList" :fixed="false">
+		<z-paging v-if="first_loaded || is_currentPage" 
+		    ref="paging" 
+			v-model="data_list"
+			:default-page-size="15"
+			@query="queryList" 
+			:fixed="false">
 			<!-- 如果希望其他view跟着页面滚动,可以放在z-paging标签内 -->
-			<view class="item" v-for="(item,index) in data_list" :key="index" @click="itemClick(item)">
-				<view class="item-title">{{item.title}}</view>
-				<view class="item-detail">{{item.detail}}</view>
-				<view class="item-line"></view>
+			<view class="list" v-for="(item,index) in data_list" :key="index" @click="itemClick(item)">
+				<view class="item">
+					<view class="item__info">
+						<view class="item__info__title">
+							<view class="item__info__title__text">
+							    {{item.goods_name}}
+							</view>
+							<view class="item__info__title__status" :style="{backgroundColor:tools.getOrderStatusInfo(item.status).bg_color}">
+								{{tools.getOrderStatusInfo(item.status).title}}
+							</view>
+						</view>
+						<view class="item__info__date">
+							{{item.create_at}}
+						</view>
+					</view>
+					<view class="item__rmb">
+						-{{(item.amount/100).toFixed(2)}}
+					</view>
+				</view>
 			</view>
 		</z-paging>
 	</view>
@@ -15,7 +35,9 @@
 
 <script setup lang="ts">
     import { nextTick, ref, watch } from 'vue';
-		
+    import { trading_record_item_data } from '../../data/data';
+    import { tools } from '../../framework/tools';
+	
 	let data_list = ref([])         //v-model绑定的这个变量不要在分页请求结束中自己赋值!!!
 	let first_loaded = ref(false)   //当前组件是否已经加载过了
 	let is_currentPage = ref(false) //是否滚动到当前页
@@ -29,6 +51,7 @@
 		if(new_v === props.tab_index){
 			// 懒加载,当滑动到当前的item时,才去加载
 			if(!first_loaded.value){
+				first_loaded.value = true
 				// 这里需要延迟渲染z-paging的原因是为了避免在一些平台上立即渲染可能引发的底层报错问题
 				nextTick(()=>{
 					setTimeout(() => {
@@ -39,29 +62,94 @@
 		}
 	},{immediate:true})
 	
-	function queryList(pageNo:number, pageSize:number) {
-		// console.log('pageNo=',pageNo,'pageSize=',pageSize)
-		let tem_list = []
-		for (let i = 0; i < 10; i++) {
-			let a = {'title':`充值-${i}`,'detail':`detail${i}`}
-			tem_list.push(a)
-		}
-		setTimeout(()=>{
-			paging.value.complete(tem_list)
-			first_loaded.value = true
-		},500)
+	function queryList(pageNum:number, pageSize:number) {
+		// console.log('pageNum=',pageNum,'pageSize=',pageSize)
+		tools.requestOrderList(1,pageNum,pageSize,(data)=>{
+			// console.log('充值data=',data)
+			if(data) {
+				if (pageNum == 1) {
+					data_list.value = []
+				}				
+				paging.value.complete(data.list)
+				data_list.value = data_list.value.concat(data.list)
+			} else {
+				paging.value.complete(false)				
+			}			
+		})
+	}
+	
+	function itemClick(item_data:trading_record_item_data) {
 	}
 	
 </script>
 
 <style lang="scss">
 	/* 注意:父节点需要固定高度,z-paging的height:100%才会生效 */
-	.content {
+	.tr-recharge_content {
 		height: 100%;
 		background-color: #ffffff;
-		.item{
-			// display: flex;
-			// flex-direction: row;
+		.list{		
+		    display: flex;
+			justify-content: center;
+						
+			.item{
+				margin-top: 4%;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				width: 88%;
+				padding: 3% 3%;
+				border-radius: 20rpx;
+				box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
+				background-color: #ffffff;
+				
+				&__info {
+					display: flex;
+					flex-direction: column;
+					width: 78%;
+					margin-right: 2%;
+					&__title {
+						display: flex;
+						flex-direction: row;
+						
+						&__text {
+							font-size: 17px;
+							color: #000;
+							max-width: 80%;
+							white-space: nowrap; /* 防止文本换行 */
+							overflow: hidden; /* 隐藏溢出的文本 */
+							text-overflow: ellipsis; /* 超出部分显示为省略号 */
+						}
+						&__status{
+							display: flex;
+							justify-content: center;
+							align-items: center;
+							margin-left: 15rpx;
+							padding: 0 10rpx;
+							font-size: 12.5px;
+							color: #ffffff;
+							background-color: #93DB6B; // #FDCC22
+							border-top-left-radius: 20rpx;
+							border-top-right-radius: 20rpx;
+							border-bottom-right-radius: 20rpx;
+						}
+					}
+					&__date{
+						margin-top: 16rpx;
+						font-size: 14px;
+						color: #6D6D6D;
+					}
+					
+				}
+				&__rmb{
+					margin-top: -2%;
+					display: flex;
+					justify-content: right;
+					width: 20%;
+					font-size: 17px;
+					color: #FF133A;
+				}
+			}
 		}
 		
 	}

+ 3 - 3
xs-app/pagesA/tradingRecord/tr-rewards.vue

@@ -29,6 +29,7 @@
 		if(new_v === props.tab_index){
 			// 懒加载,当滑动到当前的item时,才去加载
 			if(!first_loaded.value){
+				first_loaded.value = true
 				// 这里需要延迟渲染z-paging的原因是为了避免在一些平台上立即渲染可能引发的底层报错问题
 				nextTick(()=>{
 					setTimeout(() => {
@@ -39,8 +40,8 @@
 		}
 	},{immediate:true})
 	
-	function queryList(pageNo:number, pageSize:number) {
-		// console.log('pageNo=',pageNo,'pageSize=',pageSize)
+	function queryList(pageNum:number, pageSize:number) {
+		// console.log('pageNum=',pageNum,'pageSize=',pageSize)
 		let tem_list = []
 		for (let i = 0; i < 10; i++) {
 			let a = {'title':`奖励-${i}`,'detail':`detail${i}`}
@@ -48,7 +49,6 @@
 		}
 		setTimeout(()=>{
 			paging.value.complete(tem_list)
-			first_loaded.value = true
 		},500)
 	}
 	

+ 4 - 4
xs-app/pagesA/tradingRecord/tradingRecord.vue

@@ -5,15 +5,15 @@
 		<!-- 注意!此处的z-tabs为独立的组件,可替换为第三方的tabs,若需要使用z-tabs,请在插件市场搜索z-tabs并引入,否则会报插件找不到的错误 -->
 		<template #top>
 			<z-tabs ref="tabs" :list="tab_list" :current="current" @change="tabsChange" 
-			activeColor="#FD4A76"
+			inactiveColor='#000' activeColor="#FD4A76"
 			:active-style="{'font-size': '18px', 'font-weight': '400'}"
 			:inactive-style="{'font-size': '18px', 'font-weight': '400'}"
 			barWidth="90"
 			/>
 		</template>
 		<!-- swiper必须设置height:100%,因为swiper有默认的高度,只有设置高度100%才可以铺满页面  -->
-		<swiper class="swiper" duration="1" :current="current" @transition="swiperTransition" @animationfinish="swiperAnimationfinish">
-			<swiper-item class="swiper-item" v-for="(item, index) in tab_list" :key="index" @touchmove.stop>
+		<swiper class="swiper" duration="100" :current="current" @transition="swiperTransition" @animationfinish="swiperAnimationfinish">
+			<swiper-item class="swiper-item" v-for="(item, index) in tab_list" :key="index">
 				<recharge v-if="index==0" :tab_index="index" :current_index="current"></recharge>
 				<consume v-if="index==1" :tab_index="index" :current_index="current"></consume>
 				<rewards v-if="index==2" :tab_index="index" :current_index="current"></rewards>
@@ -28,7 +28,7 @@
     import consume from '../tradingRecord/tr-consume.vue'
 	import rewards from '../tradingRecord/tr-rewards.vue'
 	
-	let tab_list = ref(['充值记录','消费记录','奖励记录'])
+	let tab_list = ref(['充值记录','消费记录']) //ref(['充值记录','消费记录','奖励记录'])
 	let current = ref(0) // tabs组件的current值,表示当前活动的tab选项
 	const tabs = ref(null)
 	

+ 1 - 1
xs-app/pagesA/webview/webview.vue

@@ -9,7 +9,7 @@
 	uni.setNavigationBarTitle({
 		title:tools.value_gotoWebview.title
 	})
-	console.log('tools.value_gotoWebview.html=',tools.value_gotoWebview.html)
+	// console.log('tools.value_gotoWebview.html=',tools.value_gotoWebview.html)
 </script>
 
 <style lang="scss">