瀏覽代碼

我的拼团页面逻辑修改

tags/富茂链客4.1.0
刘晖 6 年之前
父節點
當前提交
2c2babd886
共有 3 個檔案被更改,包括 89 行新增52 行删除
  1. +59
    -39
      pages/spellGroup/spellGroup.js
  2. +10
    -12
      pages/spellGroup/spellGroup.wxml
  3. +20
    -1
      utils/spell.js

+ 59
- 39
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
})
}
},

+ 10
- 12
pages/spellGroup/spellGroup.wxml 查看文件

@@ -5,7 +5,7 @@
</view>
</view>
<view class='content'>
<view class='sepll-list' wx:for="{{lists}}" wx:key="{{index}}" data-couponId='{{item.couponId}}' data-id='{{item.id}}' bindtap='invite'>
<view class='sepll-list' wx:if='{{flag=="spellList"}}' wx:for="{{lists}}" wx:key="{{index}}" data-couponId='{{item.couponId}}' data-id='{{item.id}}' bindtap='invite'>
<view class='spell-left'>
<image src='{{item.coverImg}}'></image>
</view>
@@ -23,33 +23,31 @@
</view>
<view class='spell-right'>
<view class='right-button'>去拼团</view>
<view class='right-text'>已拼27</view>
<view class='right-text'>剩余{{item.remainInventory}}</view>
</view>
</view>
<view class='sepll-list' wx:for="{{lists}}" wx:key="{{index}}" data-couponId='{{item.couponId}}' data-id='{{item.id}}' bindtap='invite'>
<view class='sepll-list' wx:if='{{flag=="myspellList"}}' wx:for="{{lists}}" wx:key="{{index}}" data-couponId='{{item.couponId}}' data-id='{{item.id}}' bindtap='invite' style='position:relative;'>
<view class='spell-left'>
<image src='{{item.coverImg}}'></image>
</view>
<view class='spell-center'>
<view class='tilte'>{{item.title}}</view>
<view class='remark'>{{item.subTitle}}</view>
<view class='spell-num'>{{item.pressLimitNum+'人团'}}</view>
<view class='price'>
<view class='price' style='margin-top:50rpx;'>
<view class='price01'>
<view class='price-num'>{{item.salePriceStr}}</view>
<view class='price-text'style="display: inline;font-size: 24rpx;">拼团价</view>
<view class='price-num'>{{item.salePrice/100}}</view>
<view class='price-unit'>元</view>
</view>
<view class='price02'>{{item.priceStr}}</view>
</view>
</view>
<view class='spell-right'>
<view class='right-button'>去拼团</view>
<view class='right-text'>已拼27</view>
<view class='spell-right' style='position:absolute;width:auto;bottom:30rpx;right:20rpx;'>
<view class='right-button' data-status='{{item.status}}' bindtap='gotoEdit' style="width:auto;display:inline-block;padding:0 8rpx;">{{item.statusText}}</view>
</view>
</view>
</view>
<view class='bottom'>
<view class='bottom-left' bindtap="getSpellList" style="background:{{flag=='bargaingoods'?'#FF7250':'#F3453A'}}">拼团商品</view>
<view class='bottom-right' bindtap="getmyList" style="background:{{flag!='bargaingoods'?'#FF7250':'#F3453A'}}">我的拼团</view>
<view class='bottom-left' bindtap="getSpellList" style="background:{{flag=='spellList'?'#FF7250':'#F3453A'}}">拼团商品</view>
<view class='bottom-right' bindtap="getmyList" style="background:{{flag!='spellList'?'#FF7250':'#F3453A'}}">我的拼团</view>
</view>
</view>

+ 20
- 1
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
}

Loading…
取消
儲存