"use strict";(self["webpackChunkvoghion_vue_admin"]=self["webpackChunkvoghion_vue_admin"]||[]).push([[92532],{92532:function(t,e,a){a.r(e),a.d(e,{default:function(){return d}});var r=function(){var t=this,e=t._self._c;return e("div",{staticClass:"points-manager"},[e("el-row",[e("el-col",{attrs:{span:8}},[e("h2",[t._v("查询积分")]),e("el-form",{attrs:{inline:!0,"label-width":"auto"},nativeOn:{submit:function(t){t.preventDefault()}}},[e("el-form-item",{attrs:{label:"uid"}},[e("el-input",{staticStyle:{width:"256px"},attrs:{clearable:""},model:{value:t.uid,callback:function(e){t.uid=e},expression:"uid"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.fetchBalanceAndDetail()}}},[t._v("搜索")])],1)],1),e("div",{staticStyle:{"margin-bottom":"40px"}},[t._v(" 积分余额： "+t._s(t.pointsInfo&&t.pointsInfo.points)+" 冻结金额： "+t._s(t.pointsInfo&&t.pointsInfo.frozen)+" ")])],1)],1),e("el-divider"),e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{"row-key":"id",data:t.dataSource.records}},[e("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"timestamp",label:"变动时间utc"}}),e("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"amountText",label:"积分变动"}}),e("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"transactionTypeText",label:"原因"}}),e("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"voucherId",label:"关联订单号"}})],1),e("div",{staticStyle:{"margin-top":"20px"}},[t.dataSource.prePageFlag?e("el-button",{on:{click:function(e){return t.prePage()}}},[t._v("上一页")]):t._e(),t.dataSource.nextPageFlag?e("el-button",{on:{click:function(e){return t.nextPage()}}},[t._v("下一页")]):t._e()],1)],1)},i=[],n=(a(81454),a(17422)),o=a.n(n),s={name:"PointsManager",data(){return{uid:"",loading:!1,pointsInfo:{points:0,frozen:0},dataSource:{records:[],cursor:0,preCursor:0,nextPageFlag:!1,prePageFlag:!1}}},methods:{fetchBalanceAndDetail(){this.uid?isNaN(this.uid)?this.$message.error("请输入数字"):(this.fetchBalance(),this.fetchPointsRecord(0)):this.$message.warning("请输入uid")},async fetchBalance(){try{const t=await this.$store.dispatch({type:"statistics/getPointsAccountInfo",payload:{userId:this.uid}});t&&(this.pointsInfo={points:t.points||0,frozen:t.frozen||0})}catch(t){console.error("查询积分余额失败:",t),this.$message.error("查询积分余额失败")}},async fetchPointsRecord(t){const e=20;this.loading=!0;try{const a=await this.$store.dispatch({type:"statistics/getPointsList",payload:{userId:this.uid,cursor:t,limit:e}});if(a){const r=a.list.map((t=>(t.timestamp=o()(t.timestamp).utc().format("YYYY-MM-DD HH:mm:ss"),t.voucherId&&t.voucherId.length>1&&"G"===t.voucherId.slice(0,1)&&(t.voucherId=t.voucherId.slice(1,t.voucherId.length)),t)));this.dataSource.records=r,this.dataSource.nextPageFlag=a.hasMore||!1,this.dataSource.cursor=a.cursor,this.dataSource.preCursor=a.preCursor-e,this.dataSource.prePageFlag=0!==t}}catch(a){console.error("查询积分记录失败:",a),this.$message.error("查询积分记录失败")}finally{this.loading=!1}},nextPage(){this.fetchPointsRecord(this.dataSource.cursor)},prePage(){this.fetchPointsRecord(this.dataSource.preCursor)}}},c=s,l=a(81656),u=(0,l.A)(c,r,i,!1,null,"9a0b2e62",null),d=u.exports}}]);