1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-scores-scores"],{"30f7":function(t,e,a){"use strict";a("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},a("7a76"),a("c9b5")},3468:function(t,e,a){var n=a("c86c");e=n(!1),e.push([t.i,'.container[data-v-483dce52]{background-color:#f5f5f5;min-height:100vh}\n\n/* 积分概览 */.score-header[data-v-483dce52]{background:linear-gradient(135deg,#667eea,#764ba2);padding:%?60?% %?40?% %?40?%;color:#fff}.current-score[data-v-483dce52]{text-align:center;margin-bottom:%?40?%}.score-label[data-v-483dce52]{display:block;font-size:%?28?%;opacity:.8;margin-bottom:%?10?%}.score-value[data-v-483dce52]{font-size:%?80?%;font-weight:700;display:block}.score-stats[data-v-483dce52]{display:flex;justify-content:space-around}.stat-item[data-v-483dce52]{text-align:center}.stat-value[data-v-483dce52]{display:block;font-size:%?36?%;font-weight:700;margin-bottom:%?8?%}.stat-label[data-v-483dce52]{font-size:%?24?%;opacity:.8}\n\n/* 筛选栏 */.filter-bar[data-v-483dce52]{background-color:#fff;display:flex;padding:0 %?30?%;border-bottom:%?1?% solid #eee}.filter-item[data-v-483dce52]{flex:1;text-align:center;padding:%?30?% 0;position:relative}.filter-text[data-v-483dce52]{font-size:%?28?%;color:#666}.filter-item.active .filter-text[data-v-483dce52]{color:#667eea;font-weight:700}.filter-item.active[data-v-483dce52]::after{content:"";position:absolute;bottom:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:%?60?%;height:%?4?%;background-color:#667eea}\n\n/* 记录列表 */.record-list[data-v-483dce52]{padding:%?20?%}.record-item[data-v-483dce52]{background-color:#fff;border-radius:%?16?%;margin-bottom:%?20?%;overflow:hidden}.record-content[data-v-483dce52]{display:flex;align-items:center;justify-content:space-between;padding:%?30?%}.record-info[data-v-483dce52]{flex:1}.record-note[data-v-483dce52]{display:block;font-size:%?30?%;color:#333;font-weight:500;margin-bottom:%?8?%}.record-time[data-v-483dce52]{font-size:%?24?%;color:#999}.record-amount[data-v-483dce52]{text-align:right}.amount-text[data-v-483dce52]{font-size:%?32?%;font-weight:700}.record-amount.positive .amount-text[data-v-483dce52]{color:#52c41a}.record-amount.negative .amount-text[data-v-483dce52]{color:#ff4d4f}\n\n/* 空状态 */.empty-state[data-v-483dce52]{text-align:center;padding:%?200?% 0}.empty-state uni-icons[data-v-483dce52]{margin-bottom:%?40?%}.empty-text[data-v-483dce52]{font-size:%?28?%;color:#999}\n\n/* 加载更多 */.load-more[data-v-483dce52], .loading[data-v-483dce52]{text-align:center;padding:%?40?%;color:#999;font-size:%?24?%}',""]),t.exports=e},"46c7":function(t,e,a){"use strict";a.d(e,"b",(function(){return r})),a.d(e,"c",(function(){return i})),a.d(e,"a",(function(){return n}));var n={uniIcons:a("f01b").default},r=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("v-uni-view",{staticClass:"container"},[a("v-uni-view",{staticClass:"score-header"},[a("v-uni-view",{staticClass:"current-score"},[a("v-uni-text",{staticClass:"score-label"},[t._v("当前积分")]),a("v-uni-text",{staticClass:"score-value"},[t._v(t._s(t.scoreStats.current_points||0))])],1),a("v-uni-view",{staticClass:"score-stats"},[a("v-uni-view",{staticClass:"stat-item"},[a("v-uni-text",{staticClass:"stat-value"},[t._v(t._s(t.scoreStats.total_income||0))]),a("v-uni-text",{staticClass:"stat-label"},[t._v("累计获得")])],1),a("v-uni-view",{staticClass:"stat-item"},[a("v-uni-text",{staticClass:"stat-value"},[t._v(t._s(t.scoreStats.total_expense||0))]),a("v-uni-text",{staticClass:"stat-label"},[t._v("累计消费")])],1)],1)],1),a("v-uni-view",{staticClass:"filter-bar"},[a("v-uni-view",{staticClass:"filter-item",class:{active:"all"===t.currentFilter},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.switchFilter("all")}}},[a("v-uni-text",{staticClass:"filter-text"},[t._v("全部")])],1),a("v-uni-view",{staticClass:"filter-item",class:{active:"positive"===t.currentFilter},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.switchFilter("positive")}}},[a("v-uni-text",{staticClass:"filter-text"},[t._v("收入")])],1),a("v-uni-view",{staticClass:"filter-item",class:{active:"negative"===t.currentFilter},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.switchFilter("negative")}}},[a("v-uni-text",{staticClass:"filter-text"},[t._v("支出")])],1)],1),a("v-uni-view",{staticClass:"record-list"},t._l(t.recordList,(function(e,n){return a("v-uni-view",{key:n,staticClass:"record-item"},[a("v-uni-view",{staticClass:"record-content"},[a("v-uni-view",{staticClass:"record-info"},[a("v-uni-text",{staticClass:"record-note"},[t._v(t._s(e.note))]),a("v-uni-text",{staticClass:"record-time"},[t._v(t._s(t.formatTime(e.created_at)))])],1),a("v-uni-view",{staticClass:"record-amount",class:{positive:e.change_number>0,negative:e.change_number<0}},[a("v-uni-text",{staticClass:"amount-text"},[t._v(t._s(e.change_number>0?"+":"")+t._s(e.change_number))])],1)],1)],1)})),1),0!==t.recordList.length||t.loading?t._e():a("v-uni-view",{staticClass:"empty-state"},[a("uni-icons",{attrs:{type:"wallet",size:"100",color:"#ccc"}}),a("v-uni-text",{staticClass:"empty-text"},[t._v("暂无积分记录")])],1),t.hasMore&&t.recordList.length>0?a("v-uni-view",{staticClass:"load-more"},[a("v-uni-text",[t._v("加载更多...")])],1):t._e(),t.loading?a("v-uni-view",{staticClass:"loading"},[a("v-uni-text",[t._v("加载中...")])],1):t._e()],1)},i=[]},47333:function(t,e,a){"use strict";a("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if(Array.isArray(t))return(0,n.default)(t)};var n=function(t){return t&&t.__esModule?t:{default:t}}(a("8d0b"))},"5c6c":function(t,e,a){"use strict";var n=a("bd44"),r=a.n(n);r.a},"6cad":function(t,e,a){"use strict";a.r(e);var n=a("db1b"),r=a.n(n);for(var i in n)["default"].indexOf(i)<0&&function(t){a.d(e,t,(function(){return n[t]}))}(i);e["default"]=r.a},"73e1":function(t,e,a){"use strict";var n=a("29d8");t.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(n)},"795c":function(t,e,a){"use strict";var n=a("8bdb"),r=a("db04").start,i=a("73e1");n({target:"String",proto:!0,forced:i},{padStart:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})},"993e":function(t,e,a){"use strict";a.r(e);var n=a("46c7"),r=a("6cad");for(var i in r)["default"].indexOf(i)<0&&function(t){a.d(e,t,(function(){return r[t]}))}(i);a("5c6c");var c=a("828b"),o=Object(c["a"])(r["default"],n["b"],n["c"],!1,null,"483dce52",null,!1,n["a"],void 0);e["default"]=o.exports},b7c7:function(t,e,a){"use strict";a("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return(0,n.default)(t)||(0,r.default)(t)||(0,i.default)(t)||(0,c.default)()};var n=o(a("47333")),r=o(a("d14d")),i=o(a("5d6b")),c=o(a("30f7"));function o(t){return t&&t.__esModule?t:{default:t}}},bd44:function(t,e,a){var n=a("3468");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var r=a("967d").default;r("5fe950ec",n,!0,{sourceMap:!1,shadowMode:!1})},d14d:function(t,e,a){"use strict";a("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},a("01a2"),a("e39c"),a("bf0f"),a("844d"),a("18f7"),a("de6c"),a("08eb")},db04:function(t,e,a){"use strict";var n=a("bb80"),r=a("c435"),i=a("9e70"),c=a("f298"),o=a("862c"),s=n(c),l=n("".slice),d=Math.ceil,u=function(t){return function(e,a,n){var c,u,f=i(o(e)),v=r(a),g=f.length,p=void 0===n?" ":i(n);return v<=g||""===p?f:(c=v-g,u=s(p,d(c/p.length)),u.length>c&&(u=l(u,0,c)),t?f+u:u+f)}};t.exports={start:u(!1),end:u(!0)}},db1b:function(t,e,a){"use strict";a("6a54");var n=a("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,a("c223"),a("795c");var r=n(a("b7c7")),i=n(a("2634")),c=n(a("2fdc")),o=n(a("95a3")),s={data:function(){return{scoreStats:{current_points:0,total_income:0,total_expense:0},recordList:[],currentFilter:"all",currentPage:1,pageSize:20,hasMore:!0,loading:!1}},onLoad:function(){var t=uni.getStorageSync("token");t?(this.loadScoreStats(),this.loadRecords()):uni.reLaunch({url:"/pages/login/login"})},onReachBottom:function(){this.hasMore&&!this.loading&&this.loadMore()},methods:{loadScoreStats:function(){var t=this;return(0,c.default)((0,i.default)().mark((function e(){var a;return(0,i.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o.default.get("/back/user/scores/stats");case 3:a=e.sent,a.success&&(t.scoreStats=a.data),e.next=10;break;case 7:e.prev=7,e.t0=e["catch"](0),console.error("加载积分统计失败:",e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))()},loadRecords:function(){var t=this;return(0,c.default)((0,i.default)().mark((function e(){var a,n,c;return(0,i.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.loading=!0,e.prev=1,a={page:t.currentPage,page_size:t.pageSize},"all"!==t.currentFilter&&(a.change_type=t.currentFilter),e.next=6,o.default.get("/back/user/scores/records",a);case 6:n=e.sent,n.success&&(c=n.data,1===t.currentPage?t.recordList=c.list||[]:t.recordList=[].concat((0,r.default)(t.recordList),(0,r.default)(c.list||[])),t.hasMore=t.recordList.length<c.total,void 0!==c.current_points&&(t.scoreStats.current_points=c.current_points,t.scoreStats.total_income=c.total_income||0,t.scoreStats.total_expense=c.total_expense||0)),e.next=14;break;case 10:e.prev=10,e.t0=e["catch"](1),console.error("加载积分记录失败:",e.t0),uni.showToast({title:"加载失败",icon:"none"});case 14:return e.prev=14,t.loading=!1,e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,10,14,17]])})))()},loadMore:function(){this.currentPage++,this.loadRecords()},switchFilter:function(t){this.currentFilter=t,this.currentPage=1,this.loadRecords()},formatTime:function(t){if(!t)return"";var e=new Date(t),a=new Date,n=a.getTime()-e.getTime(),r=Math.floor(n/864e5);return 0===r?"今天 ".concat(String(e.getHours()).padStart(2,"0"),":").concat(String(e.getMinutes()).padStart(2,"0")):1===r?"昨天 ".concat(String(e.getHours()).padStart(2,"0"),":").concat(String(e.getMinutes()).padStart(2,"0")):r<7?"".concat(r,"天前"):"".concat(e.getFullYear(),"-").concat(String(e.getMonth()+1).padStart(2,"0"),"-").concat(String(e.getDate()).padStart(2,"0"))}}};e.default=s},f298:function(t,e,a){"use strict";var n=a("497b"),r=a("9e70"),i=a("862c"),c=RangeError;t.exports=function(t){var e=r(i(this)),a="",o=n(t);if(o<0||o===1/0)throw new c("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(e+=e))1&o&&(a+=e);return a}}}]); |