123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444 |
- // pages/admin/admin.js
- const app = getApp()
- const link = app.globalData.url
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- page:1,
- pageSize:10,
- openId:"",
- userStatus:0,
- goodsList:[],
- count:0
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- //获取金额
- var that = this
- that.page = 1
- that.pageSize = 10
- that.openId = wx.getStorageSync('openId')
- that.userStatus = 3
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/admin/data"
- },
- method: "POST",
- data: { openId: "" },
- success (res) {
- console.log(res)
-
- that.setData({
- wallet: res.data.data,
- order:true,
- trans:false,
- adminTrans:false
- })
-
- }
- })
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/user/order/list"
- },
- method: "POST",
- data: { openId: "o0PAf400H9fbwDN6-a8ndU4di0JI",pageIndex:that.page,pageSize: that.pageSize,userStatus:that.userStatus},
- complete: function( res ) {
- console.log(res)
- if( res == null || res.data == null ) {
- console.error( '网络请求失败' );
- return;
- }
- console.log(res.data.data.rows)
- //that.count = res.data.data.count
- if (res.data.data.rows.orderInfo == null){
- that.count = res.data.data.count
- that.setData({
- goodsList: res.data.data.rows.orderInfo,
- lType:"end"
- })
- } else{
- that.count = res.data.data.count
- that.data.goodsList = res.data.data.rows.orderInfo
- that.setData({
- goodsList: that.data.goodsList,
- lType:"false"
- })
- }
-
- }
- })
- var opneId = wx.getStorageSync('openId')
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/user/open.id/get"
- },
- method: "POST",
- data: { openId: opneId },
- success (res) {
- console.log(res)
-
- wx.setStorageSync('nickName', res.data.data.user.nickName)
- wx.setStorageSync('userId', res.data.data.user.id)
- if (res.data.data.user.admin == 2){
- that.setData({
- admin:true
- })
- }
-
- }
- })
- },
- copy:function (options) {
- console.log(options)
- wx.setClipboardData({
- data: options.currentTarget.dataset.pay,
- success (res) {
- //点击确定
- wx.showToast({
- title: '复制成功',//提示文字
- duration:2000,//显示时长
- mask:true,//是否显示透明蒙层,防止触摸穿透,默认:false
- icon:'success', //图标,支持"success"、"loading"
- success:function(){ },//接口调用成功
- fail: function () { }, //接口调用失败的回调函数
- complete: function () { } //接口调用结束的回调函数
- })
- }
- })
-
- },
- statusFail:function (options) {
- console.log(options)
- var that = this
- var item = options.target.dataset.item
- wx.showModal({
- title: '拒绝提现',
- content: '金额等数据异常,拒绝发放提现',
- showCancel: true,//是否显示取消按钮
- cancelText:"取消",//默认是“取消”
- confirmText:"确定",//默认是“确定”
-
- success: function (res) {
- if (res.cancel) {
- //点击取消,默认隐藏弹框
- } else {
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/user/trans/update"
- },
- method: "POST",
- data: { pidStatus: item.pid_status,pay:item.pay,userId:item.userId,payName:item.payName,pid:item.pid,openId:item.openId,transStatus:2,id:item.id },
- success (res) {
- console.log(res)
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/user/trans/list"
- },
- method: "POST",
- data: { pageIndex:1,pageSize:999 },
- complete: function( res ) {
- console.log(res)
- if( res == null || res.data == null ) {
- console.error( '网络请求失败' );
- return;
- }
-
- that.setData({
- transList: res.data.data.rows,
- order:false,
- trans:true,
- adminTrans:false
- })
-
-
-
- }
- })
- }
- })
- }
- },
- fail: function (res) { },//接口调用失败的回调函数
- complete: function (res) { },//接口调用结束的回调函数(调用成功、失败都会执行)
- })
- },
- statusSuccess:function (options) {
- console.log(options)
- var that = this
- var item = options.target.dataset.item
- wx.showModal({
- title: '提现已发放',
- content: '金额已发放',
- showCancel: true,//是否显示取消按钮
- cancelText:"取消",//默认是“取消”
- confirmText:"确定",//默认是“确定”
-
- success: function (res) {
- if (res.cancel) {
- //点击取消,默认隐藏弹框
- } else {
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/user/trans/update"
- },
- method: "POST",
- data: { pidStatus: item.pid_status,pay:item.pay,userId:item.userId,payName:item.payName,pid:item.pid,openId:item.openId,transStatus:3,id:item.id },
- success (res) {
- console.log(res)
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/user/trans/list"
- },
- method: "POST",
- data: { pageIndex:1,pageSize:999 },
- complete: function( res ) {
- console.log(res)
- if( res == null || res.data == null ) {
- console.error( '网络请求失败' );
- return;
- }
-
- that.setData({
- transList: res.data.data.rows,
- order:false,
- trans:true,
- adminTrans:false
- })
-
-
-
- }
- })
- }
- })
- }
- },
- fail: function (res) { },//接口调用失败的回调函数
- complete: function (res) { },//接口调用结束的回调函数(调用成功、失败都会执行)
- })
- },
- changeTabs:function(options){
- console.log(options)
- var that = this
- if (options.detail.activeKey == "one"){
- //查询数据
- that.setData({
- order:true,
- trans:false,
- adminTrans:false
- })
- } else if (options.detail.activeKey == "two"){
- //查询提现数据
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/user/trans/list"
- },
- method: "POST",
- data: { pageIndex:1,pageSize:999 },
- complete: function( res ) {
- console.log(res)
- if( res == null || res.data == null ) {
- console.error( '网络请求失败' );
- return;
- }
-
- that.setData({
- transList: res.data.data.rows,
- order:false,
- trans:true,
- adminTrans:false
- })
-
-
-
- }
- })
- } else if (options.detail.activeKey == "three"){
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/admin/amount/list"
- },
- method: "POST",
- data: { pageIndex:1,pageSize:999 },
- complete: function( res ) {
- console.log(res)
- if( res == null || res.data == null ) {
- console.error( '网络请求失败' );
- return;
- }
-
- that.setData({
- adminTransList: res.data.data.rows,
- order:false,
- trans:false,
- adminTrans:true
- })
-
-
-
- }
- })
- }
- },
- adminAmount:function (options) {
- var that = this
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/admin/amount"
- },
- method: "POST",
- data: { },
- success (res) {
- console.log(res)
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/admin/data"
- },
- method: "POST",
- data: { openId: "" },
- success (res) {
- console.log(res)
-
- that.setData({
- wallet: res.data.data,
- })
-
- }
- })
- }
- })
- },
- trans:function(){
- console.log('trans')
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- //获取数据
- var that = this;
- if (that.page * that.pageSize >= that.count ){
- //提示页码到了
- that.setData({
- lType:"end"
- })
- return
- }
- that.page +=1
-
- wx.request( {
- url: link + "/v1/forward/lhf",
- header: {
- "Content-Type": "application/json",
- "function":"/v1/user/order/list"
- },
- method: "POST",
- data: { openId: "o0PAf400H9fbwDN6-a8ndU4di0JI",pageIndex:that.page,pageSize: that.pageSize,userStatus:that.userStatus},
- complete: function( res ) {
- wx.hideLoading();
- console.log(res)
-
- for (var i = 0; i < res.data.data.rows.orderInfo.length; i++) {
- that.data.goodsList.push( res.data.data.rows.orderInfo[i]);
- }
-
- that.setData({
- goodsList: that.data.goodsList,
- })
- console.log(res.data.data.goods_search_response)
- if( res == null || res.data == null ) {
- console.error( '网络请求失败' );
- return;
- }
- }
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|