123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // pages/my/address/address.js
- const app =getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- addressList:[],
- pageindex: 1
- },
- onLoad:function(){
- this.address()
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- this.setData({pageindex:this.data.pageindex+=1})
- this.address()
- },
-
- addSite(e){
- let {parmise} = e.currentTarget.dataset
- console.log(parmise);
- wx.navigateTo({
- url: './addSite/addSite?parmise='+parmise,
- })
- },
- editSite(e){
- let {parmise} = e.currentTarget.dataset
- console.log(parmise);
- wx.navigateTo({
- url: './addSite/addSite?parmise='+JSON.stringify(parmise),
- })
- },
- //获取地址列表
- address(){
- var that=this;
- app.api.useApi(app.globalData.baseAppUrl + "api/address/index", {
- network_id: 1,
- page: that.data.pageindex
- }, "get").then(function (res) {
- if (res.original.code != 200) {
- wx.showLoading({
- title:res.original.message.msg,
- })
- that.setData({pageindex: that.data.pageindex -= 1})
- } else {
- if (that.data.pageindex == 1) {
- that.setData({addressList: []})
- }
- if (res.original.message.data.data.length > 0) {
- that.setData({addressList: that.data.addressList.concat(res.original.message.data.data)})
- } else {
- that.setData({pageindex: that.data.pageindex -= 1})
- }
- }
- setTimeout(function () {
- wx.hideLoading({
- success: (res) => {},
- })
- }, 2000);
- }).catch(function (err) {
- console.log(222);
- })
- }
- })
|