123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- const app = getApp();
- const api = require('../../api/api');
- Page({
- data: {
- test: {
- name: "团长"
- },
- height: 0,
- tabs: [
- "订阅团长", "最近浏览", "我的订单"
- ],
- ordertabs: [
- "全部", "待支付", "待收货", "已完成", "退款/售后"
- ],
- orderindex: 0,
- zhong: 0,
- dingyues: [],
- pintuan: [],
- orders: [],
- showSearchPopup: false,
- keywords: '',
- time: -1,
- goodName: '',
- share_order_id: 0,
- },
- onLoad(options) {
- let that = this;
- that.setData({
- height: app.globalData.height,
- enterType: Number(options.type)
- })
-
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Member_order,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- orders: res.data.data
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- },
- onShow() {
- let that = this;
-
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Head_list,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- dingyues: res.data.data
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
-
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.footprints,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- pintuan: res.data.data
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- },
-
- onShareAppMessage: function () {
- let order_id = this.data.share_order_id;
- return {
- title: '订单分享',
- path: '/pages/orderdetail/orderdetail?id=' + order_id,
- imageUrl: 'https://s4.ax1x.com/2021/12/29/TccgfK.jpg'
- }
- },
-
- tabsbind(e) {
- this.setData({
- zhong: e.currentTarget.dataset.id
- })
- },
-
- ordertap(e) {
- let that = this;
- let oid = e.currentTarget.dataset.oid;
- let order_status = 0;
- if (oid === 0) {
-
- order_status = '';
- } else if (oid === 1) {
-
- order_status = 0;
- } else if (oid === 2) {
-
- order_status = 1;
- } else if (oid === 3) {
-
- order_status = 2;
- } else if (oid === 4) {
-
- order_status = 4;
- }
- if (oid === 0) {
-
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Member_order,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- orders: res.data.data,
- orderindex: oid
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- } else {
-
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Member_order,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- method: 'POST',
- data: {
- order_status: order_status
- },
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- orders: res.data.data,
- orderindex: oid
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- }
-
-
-
- },
-
- inputGoodName(e) {
- let that = this;
- that.setData({
- goodName: e.detail.value
- })
-
- clearTimeout(this.data.time);
-
- this.data.time = setTimeout(() => {
- wx.showLoading({
- title: '搜索中',
- mask: true
- })
- wx.request({
- url: api.footprints,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- method: 'POST',
- data: {
- name: that.data.goodName
- },
- success: (res) => {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- pintuan: res.data.data
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail: (err) => {
- console.log(err);
- },
- complete: () => {
- wx.hideLoading()
- }
- })
- }, 500)
- },
-
- navToTuanZhang(e) {
- let url = e.currentTarget.dataset.url;
- let id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: url + '&id=' + id
- })
- },
-
- navToPinTuanDetail(e) {
- let id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/pages/pintuandetail/pintuandetail?type=dingyue&id=' + id,
- })
- },
-
- navToOrderDetail(e) {
- let id = e.currentTarget.dataset.id;
- let order_status = e.currentTarget.dataset.status;
-
- if(order_status == 4) {
- wx.navigateTo({
- url: '/pages/confirmrefund/confirmrefund?id=' + id,
- })
- }else {
- wx.navigateTo({
- url: '/pages/orderdetail/orderdetail?id=' + id,
- })
- }
- },
-
- openSearchPopup() {
- this.setData({
- showSearchPopup: true
- })
- },
-
- clsoeSearchPopup() {
- this.setData({
- showSearchPopup: false
- })
- },
-
- inputKeyWords(e) {
- this.setData({
- keywords: e.detail.value
- })
- },
-
- searchKeyWords() {
- let that = this;
- if (that.data.keywords == '') {
- wx.showToast({
- title: '请输入搜索关键字',
- mask: true,
- icon: 'none'
- })
- return
- }
- that.setData({
- orderindex: 0
- })
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Member_order,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- data: {
- gang_name: that.data.keywords
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- orders: res.data.data,
- showSearchPopup: false
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- },
-
- shareOrder(e) {
- this.setData({
- share_order_id: e.detail.value
- })
- }
- })
|