diff --git a/pages/index/coupons/index.js b/pages/index/coupons/index.js index 52473ba..4bc7201 100644 --- a/pages/index/coupons/index.js +++ b/pages/index/coupons/index.js @@ -187,9 +187,12 @@ Component({ type: 1 } }).then(res => { + console.log(res) + let businessObj = [{id:0,title: "全部",type: 1}]; that.setData({ - tabs: res.data.list + tabs: res.data.list.concat(businessObj).sort(compare("id")) }); + console.log(that.data.tabs) }) .catch(err => { wx.showToast({ @@ -208,4 +211,17 @@ Component({ }) that.getList(0, 1); } -}); \ No newline at end of file +}); +function compare(pro) { + return function (obj2, obj1) { + var val1 = obj1[pro]; + var val2 = obj2[pro]; + if (val1 < val2) { + return 1; + } else if (val1 > val2) { + return -1; + } else { + return 0; + } + } +} \ No newline at end of file diff --git a/pages/user/index.wxml b/pages/user/index.wxml index 64c88c4..1ee2be9 100644 --- a/pages/user/index.wxml +++ b/pages/user/index.wxml @@ -74,7 +74,7 @@ - 我的特权 + 特享礼遇