From 2c2babd88603a1d337df633c693c938989715796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=99=96?= Date: Wed, 6 Mar 2019 19:46:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=8B=BC=E5=9B=A2=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/spellGroup/spellGroup.js | 98 +++++++++++++++++++------------- pages/spellGroup/spellGroup.wxml | 22 ++++--- utils/spell.js | 21 ++++++- 3 files changed, 89 insertions(+), 52 deletions(-) diff --git a/pages/spellGroup/spellGroup.js b/pages/spellGroup/spellGroup.js index e5c4cdc..eb30e60 100644 --- a/pages/spellGroup/spellGroup.js +++ b/pages/spellGroup/spellGroup.js @@ -1,6 +1,7 @@ var config = require("../../config/config.js"); const Http = require("../../utils/HttpBasics"); const imgurl = require("../../utils/imgurl"); +const { spellStatus02 } = require("../../utils/spell"); Page({ /** * 页面的初始数据 @@ -8,8 +9,8 @@ Page({ data: { bannerUrl: imgurl.banner.url, loadingUrl: imgurl.loading.url, - bargaingoods: true, - mybargain: false, + spellList: true, + myspellList: false, list: [], lists: [], myLists:[], @@ -20,7 +21,7 @@ Page({ myorder: false, actUrl: imgurl.act.url, loadingUrl: imgurl.loading.url, - flag: 'bargaingoods', + flag: 'spellList', }, onLoad: function () { let that = this; @@ -29,26 +30,30 @@ Page({ that.setData({ todayDate: todayDate }) - that.getList(1, "bargaingoods"); + that.getList(1, "spellList"); that.setData({ - flag: "bargaingoods", - bargaingoods: true, - mybargain: false + flag: "spellList", + spellList: true, + myspellList: false }) }, //切换拼团列表 getSpellList(){ this.setData({ - flag: "bargaingoods" + flag: "spellList", + page:1, + allow_load:true }) - this.getList(1, "bargaingoods") + this.getList(1, "spellList") }, //切换我的拼团 getmyList(){ this.setData({ - flag: "mybargain" + flag: "myspellList", + page: 1, + allow_load: true }) - this.getList(1, "mybargain") + this.getList(1, "myspellList") }, /** * banner @@ -67,31 +72,43 @@ Page({ }); }); }, + changeStatus(status){ + return spellStatus02.filter(item=>status==item.value)[0].name + }, + gotoEdit(e){ + console.log(e.currentTarget.dataset.status) + let status = e.currentTarget.dataset.status + if (status==10){ + + } + }, getList(pageNum, flag) { var that = this; console.log(pageNum) if (that.data.allow_load) { /** - * mybargain: 我的砍价 - * bargaingoods: 砍价商品 + * myspellList: 我的砍价 + * spellList: 砍价商品 */ that.setData({ loading: true, content: '小主,我在玩命加载中...' }) var param = {}; - if (flag == 'mybargain') { + if (flag == 'myspellList') { + console.log(22222222) that.setData({ - flag: "mybargain" + flag: "myspellList" }) var param = { pageNum: pageNum, pageSize: 10 }; var url = config.api.getMySepllList; - } else if (flag == 'bargaingoods') { + } else if (flag == 'spellList') { + console.log(111111) that.setData({ - flag: "bargaingoods" + flag: "spellList" }) var param = { pageNum: pageNum, @@ -129,15 +146,18 @@ Page({ lists: [], }) } - if (flag == 'bargaingoods') { + if (flag == 'spellList') { var tmpArr = that.data.lists; tmpArr.push.apply(tmpArr, res.data.list); that.setData({ lists: tmpArr }) - } else if (flag == 'mybargain') { + } else if (flag == 'myspellList') { console.log(res.data.list) var tmpArr = that.data.lists; + res.data.list.map((item,index)=>{ + item.statusText = that.changeStatus(item.status) + }) tmpArr.push.apply(tmpArr, res.data.list); console.log(tmpArr) let lists = []; @@ -219,35 +239,35 @@ Page({ // let orderId = e.currentTarget.dataset.id; that.orderSave(couponId, couponChannelId) }, - mybargain: function () { + myspellList: function () { let that = this; that.setData({ - bargaingoods: false, - mybargain: true, - flag: "mybargain", + spellList: false, + myspellList: true, + flag: "myspellList", allow_load: true, loading: false, content: "", page: 1 }) - that.getList(1, 'mybargain'); + that.getList(1, 'myspellList'); wx.setNavigationBarTitle({ title: '我的砍价' }) }, - bargaingoods: function () { + spellList: function () { let that = this; that.setData({ - bargaingoods: true, - mybargain: false, - flag: "bargaingoods", + spellList: true, + myspellList: false, + flag: "spellList", allow_load: true, loading: false, page: 1, content: "" }) - that.getList(1, 'bargaingoods'); + that.getList(1, 'spellList'); wx.setNavigationBarTitle({ title: '砍价专场' }) @@ -279,24 +299,24 @@ Page({ */ onPullDownRefresh: function (e) { let that = this; - if (that.data.flag == 'bargaingoods') { + if (that.data.flag == 'spellList') { that.getBannerlist(); var todayDate = new Date().getTime(); that.setData({ todayDate: todayDate }) - that.getList(1, "bargaingoods"); + that.getList(1, "spellList"); that.setData({ - flag: "bargaingoods", - bargaingoods: true, - mybargain: false + flag: "spellList", + spellList: true, + myspellList: false }) - } else if (that.data.flag == 'mybargain') { - that.getList(1, "mybargain"); + } else if (that.data.flag == 'myspellList') { + that.getList(1, "myspellList"); that.setData({ - flag: "mybargain", - bargaingoods: false, - mybargain: true + flag: "myspellList", + spellList: false, + myspellList: true }) } }, diff --git a/pages/spellGroup/spellGroup.wxml b/pages/spellGroup/spellGroup.wxml index 84b977d..588108e 100644 --- a/pages/spellGroup/spellGroup.wxml +++ b/pages/spellGroup/spellGroup.wxml @@ -5,7 +5,7 @@ - + @@ -23,33 +23,31 @@ 去拼团 - 已拼27 + 剩余{{item.remainInventory}} - + {{item.title}} {{item.subTitle}} - {{item.pressLimitNum+'人团'}} - + - {{item.salePriceStr}} + 拼团价 + {{item.salePrice/100}} - {{item.priceStr}} - - 去拼团 - 已拼27 + + {{item.statusText}} - 拼团商品 - 我的拼团 + 拼团商品 + 我的拼团 \ No newline at end of file diff --git a/utils/spell.js b/utils/spell.js index 7030b58..b5ae722 100644 --- a/utils/spell.js +++ b/utils/spell.js @@ -16,6 +16,25 @@ const spellStatus=[ value: 13 } ] +const spellStatus02 = [ + { + name: '继续邀请好友', + value: 10 + }, + { + name: '去使用', + value: 11 + }, + { + name: '已过期', + value: 12 + }, + { + name: '重新拼团', + value: 13 + } +] module.exports={ - spellStatus + spellStatus, + spellStatus02 } \ No newline at end of file