146 lines
3.1 KiB
JavaScript
146 lines
3.1 KiB
JavaScript
// pages/member/myOrder/Aftersaleslist/Aftersaleslist.js
|
|
var app = getApp();
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
language: "",
|
|
list: [],
|
|
total_page: 0,
|
|
isLoadMore: true,
|
|
page: 1,
|
|
orderType: "",
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
if (options.orderType) {
|
|
this.setData({
|
|
orderType: options.orderType,
|
|
});
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
let language = wx.getStorageSync("langIndex");
|
|
this.setData({ language: language.en });
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
this._getNetData();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
this._getNetData();
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
if (this.data.isLoadMore) {
|
|
this._getMoreData();
|
|
} else {
|
|
console.log("没有更多数据");
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {},
|
|
_getNetData() {
|
|
let that = this;
|
|
let urlStr = "";
|
|
if (this.data.orderType && this.data.orderType == "grabGroup") {
|
|
urlStr += app.getNetAddresss("plugin.snatch-regiment.api.refund.index");
|
|
} else {
|
|
urlStr += app.getNetAddresss("refund.list");
|
|
}
|
|
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
var myData = res.data;
|
|
that.setData({
|
|
list: myData.data,
|
|
total_page: myData.last_page,
|
|
});
|
|
}
|
|
wx.stopPullDownRefresh();
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
},
|
|
});
|
|
},
|
|
_getMoreData() {
|
|
let that = this;
|
|
let urlStr = "";
|
|
if (this.data.page >= this.data.total_page) {
|
|
return;
|
|
} else {
|
|
this.setData({
|
|
page: this.data.page + 1,
|
|
});
|
|
urlStr += app.getNetAddresss("refund.list");
|
|
urlStr += "&page=" + this.data.page;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
var myData = res.data;
|
|
that.setData({
|
|
list: that.data.list.concat(myData.data),
|
|
});
|
|
} else {
|
|
that.setData({
|
|
page: that.data.page - 1,
|
|
isLoadMore: false,
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
},
|
|
});
|
|
}
|
|
},
|
|
goaftersales(e) {
|
|
let itemid = e.currentTarget.dataset.itemid;
|
|
let pluginid = e.currentTarget.dataset.pluginid;
|
|
wx.navigateTo({
|
|
url:
|
|
"/packageD/member/myOrder/Aftersales/Aftersales?refund_id=" +
|
|
itemid +
|
|
"&pluginid=" +
|
|
pluginid,
|
|
});
|
|
},
|
|
});
|