Commit 42adb2e62833d47120255fbedfcc3cab551d081e
1 parent
a2dcf50b
套盒商品列表、详情和服务卡项详情修改
Showing
7 changed files
with
190 additions
and
80 deletions
packageA/pages/goodsInfo/goodsInfo.js
| @@ -637,7 +637,7 @@ Page({ | @@ -637,7 +637,7 @@ Page({ | ||
| 637 | //listServiceItem: t.data.data.listServiceItem, | 637 | //listServiceItem: t.data.data.listServiceItem, |
| 638 | }); | 638 | }); |
| 639 | 639 | ||
| 640 | - console.log('0xxxxx999999', t.data.data); | 640 | + // console.log('0xxxxx999999', t.data.data); |
| 641 | //-----商品详情--- | 641 | //-----商品详情--- |
| 642 | if(!t.data.data.serviceContent) t.data.data.serviceContent=" "; | 642 | if(!t.data.data.serviceContent) t.data.data.serviceContent=" "; |
| 643 | a.wxParse("content", "html", t.data.data.serviceContent, ee, 6); | 643 | a.wxParse("content", "html", t.data.data.serviceContent, ee, 6); |
packageA/pages/goodsInfo/goodsInfo.wxml
| @@ -214,7 +214,8 @@ | @@ -214,7 +214,8 @@ | ||
| 214 | </view> | 214 | </view> |
| 215 | <view class="flex ai_c jc_sb fs24 c-6"> | 215 | <view class="flex ai_c jc_sb fs24 c-6"> |
| 216 | <view class="ellipsis-1">备注:{{filters.show_default(item.remark, '无')}}</view> | 216 | <view class="ellipsis-1">备注:{{filters.show_default(item.remark, '无')}}</view> |
| 217 | - <!-- <view class="pdl30 shrink0">有效期:50天/2022-02-02</view> --> | 217 | + <!-- 指定开始日期和结束日期 --> |
| 218 | + <view class="pdl30 shrink0">有效期:{{filters.showStartAndEndDate(item)}}</view> | ||
| 218 | </view> | 219 | </view> |
| 219 | </view> | 220 | </view> |
| 220 | </block> | 221 | </block> |
| @@ -231,7 +232,7 @@ | @@ -231,7 +232,7 @@ | ||
| 231 | </view> | 232 | </view> |
| 232 | <view class="flex ai_c jc_sb fs24 c-6 pdt10"> | 233 | <view class="flex ai_c jc_sb fs24 c-6 pdt10"> |
| 233 | <view class="ellipsis-1">备注:{{filters.show_default(item.remark, '无')}}</view> | 234 | <view class="ellipsis-1">备注:{{filters.show_default(item.remark, '无')}}</view> |
| 234 | - <view class="pdl30 shrink0">有效期:{{item.effective_days}}天<text wx:if="{{item.effective_date}}">/{{item.effective_date}}</text></view> | 235 | + <view class="pdl30 shrink0">有效期:{{filters.showStartAndEndDate(item)}}</view> |
| 235 | </view> | 236 | </view> |
| 236 | </view> | 237 | </view> |
| 237 | </block> | 238 | </block> |
packageB/pages/boxes-details/boxes-details.js
| @@ -51,7 +51,7 @@ Page({ | @@ -51,7 +51,7 @@ Page({ | ||
| 51 | * 生命周期函数--监听页面显示 | 51 | * 生命周期函数--监听页面显示 |
| 52 | */ | 52 | */ |
| 53 | onShow: function() { | 53 | onShow: function() { |
| 54 | - console.log('show~~~'); | 54 | + // console.log('show~~~'); |
| 55 | if (app.globalData.userInfo) { | 55 | if (app.globalData.userInfo) { |
| 56 | if (!this.data.isLogin) { | 56 | if (!this.data.isLogin) { |
| 57 | this.setData({ | 57 | this.setData({ |
| @@ -60,20 +60,22 @@ Page({ | @@ -60,20 +60,22 @@ Page({ | ||
| 60 | isLogin: true, | 60 | isLogin: true, |
| 61 | }); | 61 | }); |
| 62 | 62 | ||
| 63 | - let url = '/api/weshop/serviceGoods/list' | 63 | + let url = '/api/weshop/serviceCard/listWriteoffWare' |
| 64 | let data = { | 64 | let data = { |
| 65 | store_id: app.globalData.setting.stoid, | 65 | store_id: app.globalData.setting.stoid, |
| 66 | - service_id: this.data.options.service_id, | 66 | + user_id: this.data.userInfo.user_id, |
| 67 | + Id: this.data.options.formlistid, | ||
| 67 | }; | 68 | }; |
| 68 | 69 | ||
| 69 | // 请求数据 | 70 | // 请求数据 |
| 70 | - app.promiseGet(url, { | 71 | + app.request.promiseGet(url, { |
| 71 | data: data, | 72 | data: data, |
| 72 | }).then(res => { | 73 | }).then(res => { |
| 73 | if (res.data.code == 0) { | 74 | if (res.data.code == 0) { |
| 74 | - console.log('请求成功', res); | 75 | + // console.log('请求成功', res); |
| 75 | this.setData({ | 76 | this.setData({ |
| 76 | details: res.data.data, | 77 | details: res.data.data, |
| 78 | + writeOffCode: res.data.data[0].WriteOffCode | ||
| 77 | }); | 79 | }); |
| 78 | } else { | 80 | } else { |
| 79 | throw (res); | 81 | throw (res); |
| @@ -128,42 +130,48 @@ Page({ | @@ -128,42 +130,48 @@ Page({ | ||
| 128 | 130 | ||
| 129 | 131 | ||
| 130 | // 图片异常时加载默认图片 | 132 | // 图片异常时加载默认图片 |
| 131 | - bind_bnerr(e) { | ||
| 132 | - var errImg = e.currentTarget.dataset.errorimg; | ||
| 133 | - var errObj = {}; | ||
| 134 | - errObj[errImg] = 'public/images/default_goods_image_240.gif'; | ||
| 135 | - this.setData(errObj); // this.setData({ details.list[0].img_url}); | ||
| 136 | - }, | 133 | + // bind_bnerr(e) { |
| 134 | + // var errImg = e.currentTarget.dataset.errorimg; | ||
| 135 | + // var errObj = {}; | ||
| 136 | + // errObj[errImg] = 'public/images/default_goods_image_240.gif'; | ||
| 137 | + // this.setData(errObj); // this.setData({ details.list[0].img_url}); | ||
| 138 | + // }, | ||
| 137 | 139 | ||
| 138 | 140 | ||
| 139 | - createQr() { | ||
| 140 | - wx.showLoading({ | ||
| 141 | - title:'生成核销码中', | 141 | + showQr() { |
| 142 | + // wx.showLoading({ | ||
| 143 | + // title:'生成核销码中', | ||
| 144 | + // }); | ||
| 145 | + | ||
| 146 | + let writeOffCode = this.data.details[0].WriteOffCode; | ||
| 147 | + self.qrcode(writeOffCode); | ||
| 148 | + self.setData({ | ||
| 149 | + showQr: true, | ||
| 142 | }); | 150 | }); |
| 143 | 151 | ||
| 144 | - let store_id = app.globalData.setting.stoid; | ||
| 145 | - let id = this.data.options.id; | ||
| 146 | - let url = `/api/weshop/rechargeServicelist/update/${store_id}/${id}`; | 152 | + // let store_id = app.globalData.setting.stoid; |
| 153 | + // let id = this.data.options.id; | ||
| 154 | + // let url = `/api/weshop/rechargeServicelist/update/${store_id}/${id}`; | ||
| 147 | 155 | ||
| 148 | - app.request.put(url, { | ||
| 149 | - data: {}, | ||
| 150 | - success: function(res) { | ||
| 151 | - wx.hideLoading(); | ||
| 152 | - if(res.data.code == 0) { | ||
| 153 | - let verify_code = res.data.data.verify_code; | ||
| 154 | - self.qrcode(verify_code); | ||
| 155 | - self.setData({ | ||
| 156 | - verify_code, | ||
| 157 | - showQr: true, | ||
| 158 | - }); | ||
| 159 | - }; | ||
| 160 | - } | ||
| 161 | - }); | 156 | + // app.request.put(url, { |
| 157 | + // data: {}, | ||
| 158 | + // success: function(res) { | ||
| 159 | + // wx.hideLoading(); | ||
| 160 | + // if(res.data.code == 0) { | ||
| 161 | + // let verify_code = res.data.data.verify_code; | ||
| 162 | + // self.qrcode(verify_code); | ||
| 163 | + // self.setData({ | ||
| 164 | + // verify_code, | ||
| 165 | + // showQr: true, | ||
| 166 | + // }); | ||
| 167 | + // }; | ||
| 168 | + // } | ||
| 169 | + // }); | ||
| 162 | }, | 170 | }, |
| 163 | 171 | ||
| 164 | - showQr() { | ||
| 165 | - this.debounce(this.createQr, 300)(); | ||
| 166 | - }, | 172 | + // showQr() { |
| 173 | + // // this.debounce(this.createQr, 300)(); | ||
| 174 | + // }, | ||
| 167 | 175 | ||
| 168 | 176 | ||
| 169 | closeQr() { | 177 | closeQr() { |
| @@ -176,29 +184,78 @@ Page({ | @@ -176,29 +184,78 @@ Page({ | ||
| 176 | title: '刷新中', | 184 | title: '刷新中', |
| 177 | mask: true, | 185 | mask: true, |
| 178 | }); | 186 | }); |
| 179 | - let store_id = app.globalData.setting.stoid; | ||
| 180 | - let id = this.data.options.id; | ||
| 181 | - let url = `/api/weshop/rechargeServicelist/update/${store_id}/${id}`; | ||
| 182 | 187 | ||
| 183 | - app.request.put(url, { | ||
| 184 | - data: {}, | ||
| 185 | - success: function(res) { | ||
| 186 | - wx.hideLoading(); | ||
| 187 | - if(res.data.code == 0) { | ||
| 188 | - // console.log('xxx000', res.data.data.use_state); | 188 | + // let store_id = app.globalData.setting.stoid; |
| 189 | + // let id = this.data.options.id; | ||
| 190 | + let url = '/api/weshop/serviceCard/listWriteoffWare'; | ||
| 191 | + | ||
| 192 | + app.request.promiseGet(url, { | ||
| 193 | + data: { | ||
| 194 | + store_id: app.globalData.setting.stoid, | ||
| 195 | + user_id: this.data.userInfo.user_id, | ||
| 196 | + Id: this.data.options.formlistid, | ||
| 197 | + }, | ||
| 198 | + }).then(res => { | ||
| 199 | + wx.hideLoading(); | ||
| 200 | + if (res.data.code == 0) { | ||
| 201 | + | ||
| 202 | + let posNo = res.data.data[0].PosNo; | ||
| 203 | + if(posNo != '') { | ||
| 204 | + self.setData({ | ||
| 205 | + ['options.usestate']: 1, | ||
| 206 | + }); | ||
| 207 | + } else { | ||
| 189 | self.setData({ | 208 | self.setData({ |
| 190 | - ['options.usestate']: res.data.data.use_state, | 209 | + ['options.usestate']: 0, |
| 191 | }); | 210 | }); |
| 192 | }; | 211 | }; |
| 193 | - } | 212 | + |
| 213 | + } else { | ||
| 214 | + throw (res); | ||
| 215 | + }; | ||
| 216 | + }).catch(err => { | ||
| 217 | + // wx.showToast({ | ||
| 218 | + // title: err.data.data, | ||
| 219 | + // icon: 'error', | ||
| 220 | + // }); | ||
| 194 | }); | 221 | }); |
| 222 | + | ||
| 223 | + | ||
| 224 | + | ||
| 225 | + // app.promiseGet(url, { | ||
| 226 | + // data: { | ||
| 227 | + // store_id: app.globalData.setting.stoid, | ||
| 228 | + // user_id: self.data.userInfo.user_id, | ||
| 229 | + // Id: self.data.options.formlistid, | ||
| 230 | + // }, | ||
| 231 | + // success: function(res) { | ||
| 232 | + // wx.hideLoading(); | ||
| 233 | + // if(res.data.code == 0) { | ||
| 234 | + // console.log('xxx000', res.data.data); | ||
| 235 | + // // let posNo = res.data.data[0].PosNo; | ||
| 236 | + // // if(posNo != '') { | ||
| 237 | + // // self.setData({ | ||
| 238 | + // // ['options.usestate']: 1, | ||
| 239 | + // // }); | ||
| 240 | + // // } else { | ||
| 241 | + // // self.setData({ | ||
| 242 | + // // ['options.usestate']: 0, | ||
| 243 | + // // }); | ||
| 244 | + // // }; | ||
| 245 | + | ||
| 246 | + // }; | ||
| 247 | + // } | ||
| 248 | + // }); | ||
| 249 | + | ||
| 250 | + | ||
| 251 | + | ||
| 195 | }, | 252 | }, |
| 196 | 253 | ||
| 197 | /** | 254 | /** |
| 198 | * 生成二维码 | 255 | * 生成二维码 |
| 199 | * by sty | 256 | * by sty |
| 200 | */ | 257 | */ |
| 201 | - qrcode:function(val){ | 258 | + qrcode(val) { |
| 202 | barcode('barcode', val, 600,140); | 259 | barcode('barcode', val, 600,140); |
| 203 | qrcode('qrcode', val, 300, 300); | 260 | qrcode('qrcode', val, 300, 300); |
| 204 | }, | 261 | }, |
packageB/pages/boxes-details/boxes-details.wxml
| @@ -8,12 +8,12 @@ | @@ -8,12 +8,12 @@ | ||
| 8 | </view> | 8 | </view> |
| 9 | <view class="pdl20 f1"> | 9 | <view class="pdl20 f1"> |
| 10 | <view class="flex jc_sb ai_c"> | 10 | <view class="flex jc_sb ai_c"> |
| 11 | - <view class="title ellipsis-2 pdr40">{{item.goods_name}}</view> | ||
| 12 | - <text class="c-6">x{{item.frequency}}</text> | 11 | + <view class="title ellipsis-2 pdr40">{{item.WareName}}</view> |
| 12 | + <text class="c-6">x{{item.Qty}}</text> | ||
| 13 | </view> | 13 | </view> |
| 14 | <view class="flex ai_c c-9 fs26"> | 14 | <view class="flex ai_c c-9 fs26"> |
| 15 | - <text class="rmb c-red">{{item.vipprice}}</text> | ||
| 16 | - <view class="fs22 del pdl10 c-c7">零售价<text class="rmb">{{item.show_price}}</text></view> | 15 | + <text class="rmb c-red">{{filters.show_default(item.VipPrice, '0')}}</text> |
| 16 | + <view class="fs22 del pdl10 c-c7">零售价<text class="rmb">{{filters.show_default(item.PosPrice, '0')}}</text></view> | ||
| 17 | </view> | 17 | </view> |
| 18 | </view> | 18 | </view> |
| 19 | </view> | 19 | </view> |
| @@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
| 47 | <canvas class="qrcode" canvas-id="qrcode"/> | 47 | <canvas class="qrcode" canvas-id="qrcode"/> |
| 48 | </view> | 48 | </view> |
| 49 | <view class="pdv20 c-7b fs26 bdt"> | 49 | <view class="pdv20 c-7b fs26 bdt"> |
| 50 | - <text>核销码: {{verify_code}}</text> | 50 | + <text>核销码: {{writeOffCode}}</text> |
| 51 | </view> | 51 | </view> |
| 52 | </view> | 52 | </view> |
| 53 | </view> | 53 | </view> |
packageB/pages/boxes-list/boxes-list.js
| @@ -36,12 +36,11 @@ Page({ | @@ -36,12 +36,11 @@ Page({ | ||
| 36 | let data = { | 36 | let data = { |
| 37 | store_id: app.globalData.setting.stoid, | 37 | store_id: app.globalData.setting.stoid, |
| 38 | user_id: this.data.userInfo.user_id, | 38 | user_id: this.data.userInfo.user_id, |
| 39 | - service_type: 1, | ||
| 40 | - use_state: 0, | 39 | + IsPos: 0, |
| 41 | }; | 40 | }; |
| 42 | 41 | ||
| 43 | // 默认获取'待核销' | 42 | // 默认获取'待核销' |
| 44 | - this.getData(true, '/api/weshop/rechargeServicelist/page', data) | 43 | + this.getData(true, '/api/weshop/serviceCard/pageWriteoff', data) |
| 45 | .then(()=>{ | 44 | .then(()=>{ |
| 46 | this.setData({ | 45 | this.setData({ |
| 47 | currentData: data, | 46 | currentData: data, |
| @@ -57,20 +56,20 @@ Page({ | @@ -57,20 +56,20 @@ Page({ | ||
| 57 | * 页面上拉触底事件的处理函数 | 56 | * 页面上拉触底事件的处理函数 |
| 58 | */ | 57 | */ |
| 59 | onReachBottom: function () { | 58 | onReachBottom: function () { |
| 60 | - this.scrollToLower('/api/weshop/rechargeServicelist/page', this.data.currentData); | 59 | + this.scrollToLower('/api/weshop/serviceCard/pageWriteoff', this.data.currentData); |
| 61 | }, | 60 | }, |
| 62 | 61 | ||
| 63 | 62 | ||
| 64 | // 图片异常时加载默认图片 | 63 | // 图片异常时加载默认图片 |
| 65 | - bind_bnerr: function (e) { | ||
| 66 | - var _errImg = e.target.dataset.errorimg; | ||
| 67 | - var val = e.target.dataset.val; | ||
| 68 | - if(val!=undefined && val!=null && val!='null' ){ | ||
| 69 | - var _errObj = {}; | ||
| 70 | - _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; | ||
| 71 | - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | ||
| 72 | - } | ||
| 73 | - }, | 64 | + // bind_bnerr: function (e) { |
| 65 | + // var _errImg = e.target.dataset.errorimg; | ||
| 66 | + // var val = e.target.dataset.val; | ||
| 67 | + // if(val!=undefined && val!=null && val!='null' ){ | ||
| 68 | + // var _errObj = {}; | ||
| 69 | + // _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; | ||
| 70 | + // this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | ||
| 71 | + // } | ||
| 72 | + // }, | ||
| 74 | 73 | ||
| 75 | 74 | ||
| 76 | 75 | ||
| @@ -90,17 +89,17 @@ Page({ | @@ -90,17 +89,17 @@ Page({ | ||
| 90 | 89 | ||
| 91 | switch(currentTabIndex) { | 90 | switch(currentTabIndex) { |
| 92 | case 0: { | 91 | case 0: { |
| 93 | - currentData.use_state = 0; | 92 | + currentData.IsPos = 0; |
| 94 | break; | 93 | break; |
| 95 | }; | 94 | }; |
| 96 | case 1: { | 95 | case 1: { |
| 97 | - currentData.use_state = 1; | 96 | + currentData.IsPos = 1; |
| 98 | break; | 97 | break; |
| 99 | }; | 98 | }; |
| 100 | }; | 99 | }; |
| 101 | 100 | ||
| 102 | // 请求 | 101 | // 请求 |
| 103 | - this.getData(true, '/api/weshop/rechargeServicelist/page', currentData); | 102 | + this.getData(true, '/api/weshop/serviceCard/pageWriteoff', currentData); |
| 104 | 103 | ||
| 105 | }, | 104 | }, |
| 106 | 105 | ||
| @@ -180,12 +179,11 @@ Page({ | @@ -180,12 +179,11 @@ Page({ | ||
| 180 | 179 | ||
| 181 | 180 | ||
| 182 | viewDetails(e) { | 181 | viewDetails(e) { |
| 183 | - let id = e.currentTarget.dataset.id; | 182 | + let formlistid = e.currentTarget.dataset.formlistid; |
| 184 | let title = e.currentTarget.dataset.title; | 183 | let title = e.currentTarget.dataset.title; |
| 185 | - let serviceId = e.currentTarget.dataset.serviceid; | ||
| 186 | let date = e.currentTarget.dataset.date; //有效截止日期 | 184 | let date = e.currentTarget.dataset.date; //有效截止日期 |
| 187 | let use_state = this.data.currentTabIndex; //0待核销 1已核销 | 185 | let use_state = this.data.currentTabIndex; //0待核销 1已核销 |
| 188 | - let url = `/packageB/pages/boxes-details/boxes-details?service_id=${serviceId}&id=${id}&title=${title}&usestate=${use_state}&date=${date}`; | 186 | + let url = `/packageB/pages/boxes-details/boxes-details?formlistid=${formlistid}&title=${title}&usestate=${use_state}&date=${date}`; |
| 189 | 187 | ||
| 190 | app.goto(url); | 188 | app.goto(url); |
| 191 | }, | 189 | }, |
packageB/pages/boxes-list/boxes-list.wxml
| @@ -11,20 +11,20 @@ | @@ -11,20 +11,20 @@ | ||
| 11 | <view class="list"> | 11 | <view class="list"> |
| 12 | 12 | ||
| 13 | <block wx:for="{{list.pageData}}"> | 13 | <block wx:for="{{list.pageData}}"> |
| 14 | - <view class="list-item" bindtap="viewDetails" data-serviceid="{{item.card_id}}" data-id="{{item.id}}" data-title="{{item.service_name}}" data-date="{{item.EffectiveDates}}"> | 14 | + <view class="list-item" bindtap="viewDetails" data-formlistid="{{item.FormLIstID}}" data-title="{{item.ItemName}}" data-date="{{item.EndDate}}"> |
| 15 | <view class="pd20"> | 15 | <view class="pd20"> |
| 16 | - <view class="fs26"><text class="c-9">卡项编号:</text>{{item.service_sn}}</view> | ||
| 17 | - <view class="ellipsis-2 title fs28">{{item.service_name}}</view> | 16 | + <!-- <view class="fs26"><text class="c-9">卡项编号:</text></view> --> |
| 17 | + <view class="ellipsis-2 title fs28">{{item.ItemName}} ({{item.ItemNo}})</view> | ||
| 18 | <view class="flex ai-center"> | 18 | <view class="flex ai-center"> |
| 19 | - <text class="rmb fs40 c-red">{{item.money}}</text> | ||
| 20 | - <view class="fs22 del pdl10 c-c7">零售价<text class="rmb">{{item.show_price}}</text></view> | 19 | + <text class="rmb fs40 c-red">{{filters.show_default(item.VipPrice, '0')}}</text> |
| 20 | + <view class="fs22 del pdl10 c-c7">零售价<text class="rmb">{{filters.show_default(item.PosPrice, '0')}}</text></view> | ||
| 21 | </view> | 21 | </view> |
| 22 | - <view class="fs24 c-red">*兑换截止日期:{{item.BeginDates}}至{{item.EffectiveDates}}</view> | 22 | + <view class="fs24 c-red">*兑换截止日期:{{item.BeginDate}}至{{item.EndDate}}</view> |
| 23 | </view> | 23 | </view> |
| 24 | 24 | ||
| 25 | <view class="pd20 bdt fs24 t-r"> | 25 | <view class="pd20 bdt fs24 t-r"> |
| 26 | <block wx:if="{{currentTabIndex == 0}}"> | 26 | <block wx:if="{{currentTabIndex == 0}}"> |
| 27 | - <view class="btn bg-gray white" wx:if="{{filters.isExpired(item.EffectiveDates)}}">已过期</view> | 27 | + <view class="btn bg-gray white" wx:if="{{filters.isExpired(item.EndDate)}}">已过期</view> |
| 28 | <view class="btn bg-red white" wx:else>立即兑换</view> | 28 | <view class="btn bg-red white" wx:else>立即兑换</view> |
| 29 | </block> | 29 | </block> |
| 30 | 30 |
utils/filter.wxs
| @@ -38,6 +38,28 @@ var filters = { | @@ -38,6 +38,28 @@ var filters = { | ||
| 38 | } | 38 | } |
| 39 | return fm; | 39 | return fm; |
| 40 | }, | 40 | }, |
| 41 | + | ||
| 42 | + format_time2: function (ts, isFull) { | ||
| 43 | + // 如果数值位数为1,则补0 | ||
| 44 | + function appendZero(obj) { | ||
| 45 | + if (obj < 10) { | ||
| 46 | + return "0" + "" + obj; | ||
| 47 | + } else { | ||
| 48 | + return obj; | ||
| 49 | + } | ||
| 50 | + }; | ||
| 51 | + | ||
| 52 | + if (ts == null || ts == undefined || ts == '') return ""; | ||
| 53 | + var d = getDate(ts) | ||
| 54 | + var fm = [appendZero(d.getFullYear()), appendZero(d.getMonth() + 1), appendZero(d.getDate())].join('-'); | ||
| 55 | + var md = appendZero(d.getMonth() + 1) + '月' + appendZero(d.getDate()) + '日'; | ||
| 56 | + if (isFull == 1) | ||
| 57 | + fm = fm + ' ' + [appendZero(d.getHours()), appendZero(d.getMinutes()), appendZero(d.getSeconds())].join(':'); | ||
| 58 | + if (isFull == 2) { | ||
| 59 | + fm = md + ' ' + [appendZero(d.getHours()), appendZero(d.getMinutes())].join(':'); | ||
| 60 | + } | ||
| 61 | + return fm; | ||
| 62 | + }, | ||
| 41 | 63 | ||
| 42 | pInt: function (t) { | 64 | pInt: function (t) { |
| 43 | var d = parseInt(t); | 65 | var d = parseInt(t); |
| @@ -196,6 +218,37 @@ var filters = { | @@ -196,6 +218,37 @@ var filters = { | ||
| 196 | }; | 218 | }; |
| 197 | }, | 219 | }, |
| 198 | 220 | ||
| 221 | + // 显示开始和结束日期 | ||
| 222 | + showStartAndEndDate: function(o) { | ||
| 223 | + var dateType = o.date_type; | ||
| 224 | + var currentDate = getDate().getTime(); | ||
| 225 | + var startDate, endDate, days, begin_days; | ||
| 226 | + | ||
| 227 | + if(dateType === 0) { | ||
| 228 | + days = (o.effective_days === 0 ? o.effective_days : (o.effective_days - 1)) * 24 * 60 * 60 * 1000; | ||
| 229 | + endDate = filters.format_time2(currentDate + days); | ||
| 230 | + currentDate = filters.format_time2(currentDate); | ||
| 231 | + return currentDate + '至' + endDate; | ||
| 232 | + }; | ||
| 233 | + | ||
| 234 | + if(dateType === 1) { | ||
| 235 | + return o.begin_date + '至' + o.effective_date; | ||
| 236 | + }; | ||
| 237 | + | ||
| 238 | + if(dateType === 2) { | ||
| 239 | + // N天后开始 | ||
| 240 | + begin_days = (o.begin_days === 0 ? o.begin_days : (o.begin_days - 1)) * 24 * 60 * 60 * 1000; | ||
| 241 | + // 有效天数 | ||
| 242 | + days = (o.effective_days - 1) * 24 * 60 * 60 * 1000; | ||
| 243 | + startDate = filters.format_time2(currentDate + begin_days); | ||
| 244 | + endDate = filters.format_time2(getDate(startDate).getTime() + days); | ||
| 245 | + return startDate + '至' + endDate; | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + // console.log('999***', currentDate); | ||
| 249 | + // return currentDate.toLocaleDateString(); | ||
| 250 | + }, | ||
| 251 | + | ||
| 199 | 252 | ||
| 200 | 253 | ||
| 201 | }; | 254 | }; |
| @@ -219,4 +272,5 @@ module.exports = { | @@ -219,4 +272,5 @@ module.exports = { | ||
| 219 | JSONStringify: filters.JSONStringify, | 272 | JSONStringify: filters.JSONStringify, |
| 220 | count: filters.count, | 273 | count: filters.count, |
| 221 | isExpired: filters.isExpired, | 274 | isExpired: filters.isExpired, |
| 275 | + showStartAndEndDate: filters.showStartAndEndDate, | ||
| 222 | } | 276 | } |
| 223 | \ No newline at end of file | 277 | \ No newline at end of file |