import{r as n,m as i,v as c,S as u}from"./index.lP_uh0LI.js";import{a}from"./curriculum.model.DmH5tfDc.js";import{l as m}from"./lodash.BFZPcw-o.js";import{g as o,b as d,l as p,F as f}from"./vue.BxlDVA1H.js";const h=`${i.knowledge}course/order/manage/`;function _(s){return n({url:h,method:"get",params:s})}const S=function({crudExpose:s}){return{crudOptions:{request:{pageRequest:async e=>await _(e),transformQuery:({page:e,form:t})=>{const r=(e==null?void 0:e.pageSize)||10,l=(e==null?void 0:e.currentPage)||1;return delete t.order_time,{offset:(l-1)*r,limit:r,...t}},transformRes:({res:e,query:t})=>{const r=e;return r.success?{records:r.data.results||[],currentPage:t.offset/t.limit+1,pageSize:t.limit,total:r.data.count}:{records:[],currentPage:t.offset/t.limit+1,pageSize:t.limit,total:0}}},actionbar:{buttons:{add:{show:!1}}},toolbar:{buttons:{export:{show:!1}}},search:{autoSearch:!1},rowHandle:{show:!1,fixed:"right",width:200,buttons:{view:{show:!1},edit:{show:!1},remove:{show:!1}}},table:{rowKey:"uuid"},columns:{_index:{title:"序号",form:{show:!1},column:{align:"center",width:"70px",columnSetDisabled:!0,formatter:e=>{let t=e.index??1,r=s.crudBinding.value.pagination;return((r.currentPage??1)-1)*r.pageSize+t+1}}},order_no:{title:"订单号",search:{show:!0,order:1,col:{span:6},component:{placeholder:"请输入订单号"}},type:["text","colspan"],column:{minWidth:200,align:"left"},form:{show:!1}},user_id:{title:"用户",search:{title:"用户ID",show:!0,order:2,col:{span:6},component:{placeholder:"请输入用户ID"}},type:["text","colspan"],column:{minWidth:200,align:"left",formatter:({row:e})=>e.user_id?o("div",{style:"color: #409EFF;cursor: pointer;",onClick:()=>{const t=u.get("sessionId");window.parent.postMessage({sessionId:t,data:{operation:"userList",userId:e.user_id,name:e.user_name}},"*")}},[`${e.user_name??""}（#${e.user_id}）`]):""},form:{show:!1}},course_home_picture_url:{title:"课程图片",type:["cropper-uploader","colspan"],search:{show:!1},column:{minWidth:120,align:"left"},form:{show:!1}},course_title:{title:"课程名称",search:{show:!0,order:4,col:{span:6},component:{placeholder:"请输入课程名称"}},type:["text","colspan"],column:{minWidth:200,align:"left",formatter:({row:e})=>{const t={content:()=>o(f,null,[e.course_title])};return o(d("el-tooltip"),{placement:"top","popper-class":"mdd-tooltip"},{default:()=>[o("div",{class:"mdd-line-clamp-2"},[e.course_title]),p(";")],...t})}},form:{show:!1}},purchase_type:{title:"购买方式",type:["dict-radio","colspan"],search:{show:!0,order:3,col:{span:6},component:{placeholder:"请选择购买方式"}},column:{minWidth:160,align:"left",formatter:({row:e})=>{let t="";switch(e.purchase_type){case a.cash:t=`现金（￥${e.payed_amount}）`;break;case a.free:t="免费";break;case a.integral:t=`积分抵扣（${e.payed_amount}）`;break}return t}},form:{show:!1},dict:c({data:[{label:"现金",value:a.cash},{label:"免费",value:a.free},{label:"积分抵扣",value:a.integral}]})},platform_amount:{title:"平台抽成",search:{show:!1},type:["text","colspan"],column:{minWidth:100,align:"left",formatter:({row:e})=>{let t="";switch(e.purchase_type){case a.cash:t=`￥${e.platform_amount||0}`;break}return t}},form:{show:!1}},order_time:{title:"下单时间",type:"daterange",search:{show:!0,order:5,col:{span:8},component:{type:"daterange",props:{"start-placeholder":"开始时间","end-placeholder":"结束时间","value-format":"YYYY-MM-DD"}},valueResolve({key:e,value:t,form:r}){t!=null&&m.isArray(t)&&t.length>1&&(r.order_time__gte=`${t[0]} 00:00:00`,r.order_time__lte=`${t[1]} 23:59:59`)}},column:{minWidth:120,align:"left",formatter:e=>e.value},form:{show:!1}},valid_end_time:{title:"有效期至",type:"daterange",search:{show:!1},column:{minWidth:120,align:"left",formatter:e=>e.value||"永久"},form:{show:!1}}},form:{wrapper:{width:"600px"}}}}};export{S as createCrudOptions};
