123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- const app = getApp();
- const api = require('../../api/api');
- import pintuanData from '../../mocks/pintuan';
- Page({
-
- data: {
- navbarData: {
- showCapsule: 1,
- title: '拼团管理',
- capsuleMode: 'navBack',
- },
- tabs: [
- "全部", "未发布", "已发布", "已截团"
- ],
- zhong: 0,
- icon: {
- normal: '../../images/unchecked.png',
- active: '../../images/checked.png',
- },
- pintuan: [],
- time: -1,
- goodName: '',
- code_result: '',
- },
-
- onLoad(options) {
- },
-
- onReady() {
- },
-
- onShow() {
- let that = this;
- that.getData();
- },
-
- onHide() {
- },
-
- onUnload() {
- },
-
- onPullDownRefresh() {
- },
-
- onReachBottom() {
- },
-
- onShareAppMessage() {
- },
- tabsbind(e) {
- this.setData({
- zhong: e.currentTarget.dataset.id
- })
- this.getData()
- },
-
- navToPinTuanDetail(e) {
- let id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/pages/pintuandetail/pintuandetail?type=manage&id=' + id,
- })
- },
-
- searchGood(e) {
- let that = this;
- that.setData({
- goodName: e.detail.value
- })
-
- clearTimeout(that.data.time);
-
- that.data.time = setTimeout(() => {
- that.getData()
- }, 500)
- },
-
- getData() {
- let that = this;
-
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.list_info,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- data: {
- id: wx.getStorageSync('userinfo').id,
- gang_name: that.data.goodName,
- status: that.data.zhong
- },
- success(res) {
- wx.hideLoading()
- 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.hideLoading()
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
-
- }
- })
- },
- })
|