123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- var app = getApp();
- Page({
- data: {
- open: true,
- user: '',
- balance: '', //我的钱包
- phone: [],
- actionSheetHidden: true,
- state: '',
- arr:[],
- time:wx.getStorageSync('home').customer_service_time,
- screenHeight:'',
- adHeight:'',
- img:app.globalData.imgUrl,
- title:app.globalData.title,
- show:false,
- date: '',
- items: [],
- itemsId:[]
- },
- bindDateChange:function(e){
- console.log(e)
- this.setData({date:e.detail.value})
- },
- getNowFormatDate:function() {
- var date = new Date();
- var seperator1 = "-";
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- var currentdate = year + seperator1 + month + seperator1 + strDate;
- console.log(currentdate)
- this.setData({date:currentdate})
- return currentdate;
- },
- userinfo: function(e) {
- var that = this;
-
- },
- oneKey:function(){
- this.setData({show:true})
- },
- checkboxChange(e) {
- console.log('checkbox发生change事件,携带value值为:', e.detail.value)
- const items = this.data.items
- const values = e.detail.value
- for (let i = 0, lenI = items.length; i < lenI; ++i) {
- items[i].checked = false
- for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
- if (items[i].id == values[j]) {
- items[i].checked = true
- break
- }
- }
- }
- this.setData({
- items,
- itemsId:e.detail.value
- })
- },
- quxiao:function(){
- this.setData({show:false})
- },
- queren:function(){
- var items = this.data.items;
- if(this.data.itemsId==''){
- var arr = []
- for(var i=0;i<items.length;i++){
- arr = arr.concat(items[i].id)
- }
- console.log(arr)
- this.fenhao(arr)
- }else{
- this.fenhao(this.data.itemsId)
- }
- },
- fenhao:function(arr){
- var data = {
- 'date':this.data.date,
- 'sate':arr
- }
- wx.request({
- url: 'https://yutang.web.ximengnaikang.com/api/admin/makeNos',
- method: 'POST',
- data:data,
- header: {
- 'content-type': 'application/x-www-form-urlencoded',
- 'Authorization':wx.getStorageSync('token')
- },
- success: function (res) {
- console.log(res)
- if (res.statusCode == 200) {
- wx.showToast({
- title: '分号成功',
- icon:'none'
- })
- this.setData({show:false})
- }
- }
- })
- },
- onLoad: function(options) {
- this.setData({screenHeight: app.globalData.screenHeight,user:wx.getStorageSync('userInfo')})
- this.getNowFormatDate()
- var items = wx.getStorageSync('items');
- var arr = [];
- for(var i=0;i<items.length;i++){
- var obj = {}
- obj.name = items[i].name;
- obj.id = items[i].id;
- obj.checked = true;
- console.log(obj)
- arr = arr.concat(obj)
- }
- this.setData({
- items:arr
- });
- //获取实名认证状态
- },
- onReady: function() {
-
- },
- onShow: function() {
- var that = this;
- that.setData({time:wx.getStorageSync('home').customer_service_time})
- // app.request("/card_riding/user_card", '', "GET").then(res => {
- // console.log(res)
- // that.setData({ arr: res.data.user_card,show:res.data.is_card_begin })
- // })
- // app.request("/user/status", '', "GET").then(res => {
- // console.log(res)
- // if (res.statusCode == 200) {
- // if (res.data.is_card_certified == 1) {
- // this.setData({
- // state: '已实名'
- // })
- // } else {
- // this.setData({
- // state: '未实名'
- // })
- // }
- // wx.setStorageSync('userState', res.data)
- // }
- // })
- },
- onHide: function() {
- },
- onUnload: function() {
- },
- onPullDownRefresh: function() {
- wx.showNavigationBarLoading();
- var that = this;
- // app.request("/me", '', "GET").then(res => {
- // 200 == res.statusCode && wx.setStorageSync("userInfo", res.data), that.setData({
- // user: res.data
- // })
- // wx.hideNavigationBarLoading()
- // wx.stopPullDownRefresh();
- // })
- },
- onReachBottom: function() {
- },
- onShareAppMessage: function() {
-
- }
- })
|