2025-08-29 17:20:14 +08:00
|
|
|
import{aG as e,b2 as o,ag as l,r as a,bm as t,aZ as r,c as d,e as i,N as s,w as n,l as p,O as u,E as c,al as m,t as f,g as h,bo as _,bp as g,am as F,cI as b,a7 as v,a8 as w,m as y,cJ as V,an as j,cd as k,aX as J,bQ as D,a_ as C,aO as x}from"./index.17564591406745lmpCs6q.js";/* empty css */import{_ as E}from"./index.17564591406749F8tamFh.js";import"./el-col.1756459140674Gn9OdUhz.js";function P(o){return e({url:"/platformApi/product/delete",method:"post",data:o})}const U={key:0},O={class:"operate"},R=["onClick"],S=["onClick"],T={class:"dialog-footer"},A=o({__name:"product",setup(o){const A=l({columns:[{prop:"id",label:"编号",width:80,align:"center"},{prop:"pro_name",label:"产品名称",width:180,align:"center"},{prop:"field_json",label:"收款码字段",align:"center",slot:"field_json"},{prop:"rate",label:"费率%",width:80,align:"center"},{prop:"create_time",label:"创建时间",width:200,align:"center",formatter:function(e){return D(1e3*e)}},{prop:"operate",label:"操作",width:160,align:"center",slot:"operate",fixed:"right"}],tableData:[],searchFields:[{label:"产品名称",type:"input",prop:"pro_name",value:""}],total:0,page:1,limit:10,loading:!1,productForm:{title:"",fields:[{label:"产品名称",prop:"pro_name",type:"input",value:null,placeholder:"请输入产品名称"},{label:"费率%",prop:"rate",type:"input",placeholder:"请输入返点"},{label:"排序",prop:"sort",type:"input",placeholder:"排序值越大越靠前"}],rules:{pro_name:[{required:!0,message:"请输入产品名称",trigger:"change"}],rate:[{required:!0,message:"请输入返点",trigger:"blur"}],field_arr:[{required:!0,message:"请选择字段",trigger:"change"}]},proForm:{pro_name:"",rate:"",field_arr:[],sort:""}},editRow:{},showProductDialog:!1,selectList:[],fieldJson:{},oldValue:{}}),N=()=>{A.searchFields.forEach(e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""}),I()},B=e=>{A.selectList=e};const L=e=>{if(!e)return;e=JSON.parse(e);let o=[];return e.forEach(e=>{for(let l in e)o.push(e[l])}),o.join(",")};let q=null;const G=()=>{(function(o){return e({url:"/platformApi/product/field",method:"get",params:o})})({}).then(e=>{A.fieldJson=e,q=JSON.stringify(e||{})}).catch(()=>{})},I=()=>{A.loading=!0;let o={limit:A.limit,page:A.page},l=function(e){const o={};return e.forEach(e=>{e.prop&&void 0!==e.value&&(o[e.prop]=e.value)}),o}(A.searchFields);(function(o){return e({url:"/platformApi/product/list",method:"get",params:o})})(Object.assign(o,l)).then(e=>{A.tableData=e.list,A.total=e.total,A.loading=!1}).catch(()=>{A.loading=!1})},Z=a(null),$=e=>{if(A.fieldJson=JSON.parse(q),A.editRow=e,null==e?void 0:e.id){A.productForm.title=`修改"${e.pro_name}"`;for(let o in e)A.productForm.proForm[o]=e[o];(e.field_json?JSON.parse(e.field_json):[]).forEach(e=>{let o=Object.keys(e);A.productForm.proForm.field_arr.push(o[0]),A.fieldJson[o[0]]=e[o[0]]})}else A.productForm.title="添加产品";A.showProductDialog=!0},z=k(async()=>{await Z.value.validate((o,l)=>{var a;if(o)if(null==(a=A.editRow)?void 0:a.id){let o=[];A.productForm.proForm.field_arr.forEach(e=>{let l={};l[e]=A.fieldJson[e],o.push(l)}),function(o){return e({url:"/platformApi/product/edit",method:"post",data:o})}({...A.editRow,...A.productForm.proForm,field_arr:o}).then(e=>{x.success(e),A.showProductDialog=!1,I()})}else{let o=[];A.productForm.proForm.field_arr.forEach(e=>{let l={};l[e]=A.fieldJson[e],o.push(l)}),function(o){return e({url:"/platformApi/product/add",method:"post",data:o})}({...A.productForm.proForm,field_arr:o}).then(e=>{x.success(e),A.showProductDialog=!1,I()})}})},300),Q=async()=>{if(0==A.selectList.length)return x.warning("请选择要删除的产品");C.confirm("是否删除所选中的产品?","系统提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then(()=>{let e=[];A.selectList.forEach(o=>{e.push(o.id)}),P({ids:e.join(",")}).then(e=>{x.success(e),I()})}).catch(()=>{})},X=()=>{A.showProductDialog=!1,A.productForm.proForm={pro_name:"",rate:"",field_arr:[],sort:""}};return t(()=>{I(),G()}),(e,o)=>{const l=r("Plus"),a
|