Commit b5785529b8b03985a72d84d17746d1379081b819

Authored by wangfan
1 parent 5c456e77

smsbatch

@@ -22,7 +22,8 @@ @@ -22,7 +22,8 @@
22 "pages/book/setting/sms_buy", 22 "pages/book/setting/sms_buy",
23 "pages/book/smsbatch/index", 23 "pages/book/smsbatch/index",
24 "pages/book/smsbatch/update", 24 "pages/book/smsbatch/update",
25 - "pages/book/smsbatch/detail" 25 + "pages/book/smsbatch/detail",
  26 + "pages/book/smsbatch/list"
26 ], 27 ],
27 "subpackages": [ 28 "subpackages": [
28 { 29 {
@@ -82,7 +82,7 @@ Page({ @@ -82,7 +82,7 @@ Page({
82 let list=[]; 82 let list=[];
83 if(res.data.length>0){ 83 if(res.data.length>0){
84 res.data.forEach(r=>{ 84 res.data.forEach(r=>{
85 - r.addtimeStr=util.unixtoTime(r.addtime,'MM-DD HH:II') 85 + r.addtimeStr=util.unixtoTime(r.addtime,'YYYY.MM.DD')
86 list.push(r) 86 list.push(r)
87 this.list[r.id]=r; 87 this.list[r.id]=r;
88 }) 88 })
@@ -13,10 +13,12 @@ @@ -13,10 +13,12 @@
13 <view class="page" style="padding-top: 0"> 13 <view class="page" style="padding-top: 0">
14 <view class="title Medium flex-lr"> 14 <view class="title Medium flex-lr">
15 <view>短信记录</view> 15 <view>短信记录</view>
16 - <view class="flex-rr">  
17 - <view style="margin-right: 20rpx;color: #999999;">更多</view>  
18 - <view class="more"></view>  
19 - </view> 16 + <formids url="./list?seller_id={{seller_id}}&hasScene={{hasScene}}">
  17 + <view class="flex-rr">
  18 + <view style="margin-right: 20rpx;color: #999999;">更多</view>
  19 + <view class="more"></view>
  20 + </view>
  21 + </formids>
20 </view> 22 </view>
21 <view class="flex-vc lists"> 23 <view class="flex-vc lists">
22 <block wx:if="{{list.length>0}}"> 24 <block wx:if="{{list.length>0}}">
  1 +// pages/book/smsbatch/list.js
  2 +import util from '../../../utils/util';
  3 +import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Page({
  6 + offset:0,
  7 + limit:10,
  8 + hasMore:true,
  9 + seller_id:0,
  10 + hasScene:0,
  11 + list:[],
  12 + /**
  13 + * 页面的初始数据
  14 + */
  15 + data: {
  16 + list:[],
  17 + hasMore:true,
  18 + },
  19 +
  20 + /**
  21 + * 生命周期函数--监听页面加载
  22 + */
  23 + onLoad: function (options) {
  24 + this.seller_id=options.seller_id;
  25 + this.hasScene=options.hasScene;
  26 + this.SmsBatchList();
  27 + },
  28 +
  29 + /**
  30 + * 生命周期函数--监听页面初次渲染完成
  31 + */
  32 + onReady: function () {
  33 +
  34 + },
  35 +
  36 + /**
  37 + * 生命周期函数--监听页面显示
  38 + */
  39 + onShow: function () {
  40 +
  41 + },
  42 +
  43 + /**
  44 + * 生命周期函数--监听页面隐藏
  45 + */
  46 + onHide: function () {
  47 +
  48 + },
  49 +
  50 + /**
  51 + * 生命周期函数--监听页面卸载
  52 + */
  53 + onUnload: function () {
  54 +
  55 + },
  56 +
  57 + /**
  58 + * 页面相关事件处理函数--监听用户下拉动作
  59 + */
  60 + onPullDownRefresh: function () {
  61 +
  62 + },
  63 +
  64 + /**
  65 + * 页面上拉触底事件的处理函数
  66 + */
  67 + onReachBottom: function () {
  68 + if(this.hasMore){
  69 + this.SmsBatchList(hasReachBottom);
  70 + }
  71 + },
  72 +
  73 + /**
  74 + * 用户点击右上角分享
  75 + */
  76 + onShareAppMessage: function () {
  77 +
  78 + },
  79 + SmsBatchList(hasReachBottom=false){
  80 + App.Reserve.SmsBatchList({
  81 + sid: this.seller_id,
  82 + offset: this.offset,
  83 + limit: this.limit,
  84 + }).then(res => {
  85 + let list = this.data.list;
  86 + let dl=res.data.length;
  87 + if (dl > 0) {
  88 + res.data.forEach(r => {
  89 + r.addtimeStr = util.unixtoTime(r.addtime, 'MM/DD HH:II')
  90 + list.push(r)
  91 + this.list[r.id] = r;
  92 + })
  93 + }
  94 + let obj={list:list};
  95 + if(dl<this.limit && hasReachBottom){
  96 + this.hasMore=false;
  97 + obj.hasMore=false;
  98 + }
  99 + this.setData(obj)
  100 + })
  101 + },
  102 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"light",
  5 + "usingComponents": {
  6 + "userinfo":"/components/userinfo/userinfo",
  7 + "nav":"/components/nav/nav",
  8 + "formids":"/components/formids/formids",
  9 + "rows":"/components/book/smsbatch/rows"
  10 + }
  11 +
  12 +}
  1 +<!--pages/book/smsbatch/list.wxml-->
  2 +<nav id="nav" hasHome backgroundColor="#199095" color="#fefefe">短信记录</nav>
  3 +<view class="page">
  4 + <view class="Medium title">短信记录</view>
  5 + <block wx:if="{{list.length>0}}">
  6 + <view class="rows" style="width: 100%" wx:for="{{list}}" wx:key="list.key" >
  7 + <rows item="{{item}}"></rows>
  8 + </view>
  9 + </block>
  10 + <view wx:else="">暂无短信记录</view>
  11 + <view wx:if="{{!hasMore}}">已经到底了</view>
  12 +</view>
  1 +/* pages/book/smsbatch/list.wxss */
  2 +.page{
  3 + width: 90%;
  4 + margin: 0 auto;
  5 + color: #353535;
  6 + padding-top: 28rpx;
  7 + font-size: 30rpx;
  8 + color: #353535;
  9 +}
  10 +.rows{
  11 + height: 140rpx;
  12 + line-height: 140rpx;
  13 + border-bottom: 2rpx solid #F1F0F4;
  14 +}
  15 +.rows:last-child{
  16 + border-bottom-width: 0;
  17 +}
  18 +.title{
  19 + height: 48rpx;
  20 + line-height: 48rpx;
  21 +}
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 "list": [] 30 "list": []
31 }, 31 },
32 "miniprogram": { 32 "miniprogram": {
33 - "current": 27, 33 + "current": 28,
34 "list": [ 34 "list": [
35 { 35 {
36 "id": 0, 36 "id": 0,
@@ -240,6 +240,12 @@ @@ -240,6 +240,12 @@
240 "name": "pages/book/smsbatch/update", 240 "name": "pages/book/smsbatch/update",
241 "pathName": "pages/book/smsbatch/update", 241 "pathName": "pages/book/smsbatch/update",
242 "query": "seller_id=80" 242 "query": "seller_id=80"
  243 + },
  244 + {
  245 + "id": 28,
  246 + "name": "pages/book/smsbatch/list",
  247 + "pathName": "pages/book/smsbatch/list",
  248 + "query": "seller_id=80"
243 } 249 }
244 ] 250 ]
245 } 251 }