|
@@ -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)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|