import{b1 as e,aU as a,ag as t,D as l,r as o,b6 as n,bX as s,be as p,bV as i,c as d,e as r,N as c,bB as u,w as _,l as m,O as h,E as g,m as b,al as v,an as y,bd as f,t as w,g as k,R as F,bY as x,bZ as D,b0 as C,bu as q}from"./index.CR4_6n_-.js";import{_ as T}from"./index.DznrRYNI.js";import{j as V,k as j,l as U,m as I,n as L,p as A,q as R}from"./service.s_GtkORE.js";import{m as z,n as B,o as E}from"./commonOptions.Bjozp73a.js";import"./el-col.SmQn_i_C.js";import"./deposit.CkaXGwwi.js";import"./merchant.BfH9Tk81.js";import"./account.DJ0xDQZV.js";const O={class:"operate"},S={__name:"channel-taobao-shop-list",props:{channel_id:{type:[Number,String],default:""}},setup(S){const G=e(),K=a(),N=S,M=[{label:"禁用",value:0},{label:"正常",value:1}];let P=[],W=[];const X=t({columns:[],tableData:[],searchFields:[{label:"ID",prop:"id",type:"input",value:""},{label:"店铺唯一标识",prop:"shop_unique_code",type:"input",value:""},{label:"接单状态",type:"select",prop:"order_status",value:"",options:M},{label:"有效状态",type:"select",prop:"status",value:"",options:M},{prop:"created_at",label:"创建时间",type:"date",dateType:"datetimerange",value:[]},{prop:"updated_at",label:"更新时间",type:"date",dateType:"datetimerange",value:[]}],total:0,page:1,per_page:10,loading:!1,addForm:{title:"新增",fields:[{label:"淘宝登录账户",prop:"name",type:"input",value:""},{label:"店铺唯一标识",prop:"shop_unique_code",type:"input",value:""},{label:"店铺类型",prop:"shop_type",type:"select",options:W},{label:"页面",prop:"page",type:"select",options:P},{label:"备注",prop:"shop_remark",type:"input",value:""},{label:"token",prop:"token",type:"input",value:""},{label:"CK",prop:"cookie",type:"input",value:""},{label:"app链接",prop:"link",type:"password",value:"",htmlTxt:'
跳转店铺首页这里要写
格式:taobao://店铺特有地址,自己去淘宝看.tmall.com
'},{label:"每日收款笔数上限",prop:"daily_limit_count",type:"number",value:"",htmlTxt:'每日收款笔数上限(0不限)'},{label:"每日收款金额上限",prop:"daily_limit_amount",type:"number",value:"",htmlTxt:'每日每日收款金额上限(0不限)'}],rules:{shop_unique_code:[{required:!0,message:"请输入店铺唯一标识",trigger:"blur"}],page:[{required:!0,message:"请选择页面",trigger:"blur"}],shop_type:[{required:!0,message:"请选择店铺类型",trigger:"blur"}]},values:{shop_unique_code:"",link:"",shop_remark:"",token:"",cookie:"",page:0,shop_type:0,daily_limit_count:0,daily_limit_amount:0,channel_id:N.channel_id}},btnLoading:!1,showAddDialog:!1});l(()=>N.channel_id,e=>{X.columns=[{prop:"id",label:"ID",width:60,align:"center"},{prop:"service",label:"服务商名称",width:120,align:"center",slot:"service_name_slot"},{prop:"shop_type",label:"店铺类型",width:100,align:"center",slot:"shop_type_slot"},{prop:"shop_remark",label:"店铺备注",width:100,align:"center"},{prop:"name",label:"淘宝登录账户",width:120,align:"center"},{prop:"shop_unique_code",label:"店铺唯一标识",width:120,align:"center"},{prop:"total_count",label:"今日总笔数",width:100,align:"center"},{prop:"success_count",label:"今日成功笔数",width:110,align:"center"},{prop:"total_amount",label:"今日总跑量",width:100,align:"center"},{prop:"total_profit",label:"今日总收益",width:100,align:"center"},{prop:"total_revenue",label:"总收益",width:100,align:"center"},{prop:"success_rate",label:"今日成功率",width:100,align:"center"},{label:"总跑量",prop:"success_volume",align:"center",width:100},{prop:"order_status",label:"接单状态",width:130,align:"center",slot:"order_status_slot"},{prop:"status",label:"有效状态",width:130,align:"center",slot:"status_slot"},{prop:"created_at",label:"创建时间",width:160,align:"center"},{prop:"updated_at",label:"更新时间",width:160,align:"center"}],e&&X.columns.push({prop:"operate",label:"操作",width:430,align:"center",slot:"operate",fixed:"right"})},{deep:!0,immediate:!0});const Y=e=>{let a="";return W.some(t=>{if(t.value==e)return a=t.label,!0}),a},Z=()=>{X.searchFields.forEach(e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""}),ae()},H=o(null),J=x(async()=>{H.value&&H.value.hasValid&&H.value.hasValid().validate(e=>{if(e)if(X.btnLoading=!0,X.addForm.values.channel_id=N.channel_id,"新增"==X.addForm.title)A(X.addForm.values).then(e=>{ae(),X.showAddDialog=!1,X.btnLoading=!1}).catch(()=>{X.btnLoading=!1});else{X.addForm.values.channel_id=N.channel_id;let e={...X.addForm.values};R(e,X.addForm.values.id).then(e=>{X.showAddDialog=!1,X.btnLoading=!1,ae()}).catch(()=>{X.btnLoading=!1})}})},300),Q=(e,a)=>{let t="status"===a?I:L;X.loading=!0;const l={channel_id:N.channel_id};l[a]=e[a],t(e.id,l).then(e=>{X.loading=!1}).catch(()=>{const t=X.tableData.findIndex(a=>a.id==e.id);-1!==t&&(X.tableData[t][a]=1==e[a]?0:1),X.loading=!1})},$=(e,a)=>{if(1===a)X.addForm={title:"新增",fields:[{label:"淘宝登录账户",prop:"name",type:"input",value:""},{label:"店铺唯一标识",prop:"shop_unique_code",type:"input",value:""},{label:"店铺类型",prop:"shop_type",type:"select",options:W},{label:"页面",prop:"page",type:"select",options:P},{label:"备注",prop:"shop_remark",type:"input",value:""},{label:"token",prop:"token",type:"input",value:""},{label:"CK",prop:"cookie",type:"input",value:""},{label:"app链接",prop:"link",type:"password",value:"",htmlTxt:'跳转店铺首页这里要写
格式:taobao://店铺特有地址,自己去淘宝看.tmall.com
'},{label:"每日收款笔数上限",prop:"daily_limit_count",type:"number",value:"",htmlTxt:'每日收款笔数上限(0不限)'},{label:"每日收款金额上限",prop:"daily_limit_amount",type:"number",value:"",htmlTxt:'每日每日收款金额上限(0不限)'}],rules:{shop_unique_code:[{required:!0,message:"请输入店铺唯一标识",trigger:"blur"}],page:[{required:!0,message:"请选择页面",trigger:"blur"}],shop_type:[{required:!0,message:"请选择店铺类型",trigger:"blur"}]},values:{shop_unique_code:"",link:"",shop_remark:"",token:"",cookie:"",page:0,shop_type:0,daily_limit_count:0,daily_limit_amount:0,channel_id:N.channel_id}};else{X.addForm.title="修改";const a=X.addForm.fields.findIndex(e=>"shop_unique_code"===e.prop);-1!==a&&(X.addForm.fields[a].disabled=!0),X.addForm.values={...e}}X.showAddDialog=!0};n(()=>{ee(),ae()});const ee=()=>{const e=X.addForm.fields.findIndex(e=>"page"===e.prop);-1!==e&&(X.addForm.fields[e].options=P=z());const a=X.addForm.fields.findIndex(e=>"shop_type"===e.prop);-1!==a&&(X.addForm.fields[a].options=W=B());const t=X.addForm.fields.findIndex(e=>"protocol_type"===e.prop);-1!==t&&(X.addForm.fields[t].options=E())},ae=()=>{var e,a;X.loading=!0;let t={per_page:X.per_page,page:X.page,channel_id:N.channel_id},l=function(e){const a={};return e.forEach(e=>{e.prop&&void 0!==e.value&&(a[e.prop]=e.value)}),a}(X.searchFields);(null==(e=l.created_at)?void 0:e.length)>0&&(l.created_at_start=l.created_at[0]?s(l.created_at[0]):"",l.created_at_end=l.created_at[1]?s(l.created_at[1]):""),(null==(a=l.updated_at)?void 0:a.length)>0&&(l.updated_at_start=l.updated_at[0]?s(l.updated_at[0]):"",l.updated_at_end=l.updated_at[1]?s(l.updated_at[1]):""),delete l.created_at,delete l.updated_at,V(Object.assign(t,l)).then(e=>{X.tableData=e.data,X.total=e.total,X.loading=!1}).catch(()=>{X.loading=!1})};return(e,a)=>{const t=p("Plus"),l=g,o=f,n=y,s=T,x=D,V=i("click-debounce");return r(),d("div",null,[c(s,{type:"export",columns:k(X).columns,searchFields:k(X).searchFields,"onUpdate:searchFields":a[1]||(a[1]=e=>k(X).searchFields=e),data:k(X).tableData,per_page:k(X).per_page,"onUpdate:per_page":a[2]||(a[2]=e=>k(X).per_page=e),page:k(X).page,"onUpdate:page":a[3]||(a[3]=e=>k(X).page=e),total:k(X).total,onGetTableData:ae,onResetForm:Z,loading:k(X).loading,showSelection:!1,showRightRefreshSlot:!1},u({service_name_slot:_(({row:e})=>{var a;return[m("div",null,w(null==(a=null==e?void 0:e.service)?void 0:a.service_name),1)]}),shop_type_slot:_(({row:e})=>[m("div",null,w(Y(e.shop_type)),1)]),status_slot:_(({row:e})=>[c(o,{modelValue:e.status,"onUpdate:modelValue":a=>e.status=a,style:{"--el-switch-on-color":"#337ecc"},"active-value":1,"inactive-value":0,"active-text":"正常","inactive-text":"禁用",onChange:a=>Q(e,"status")},null,8,["modelValue","onUpdate:modelValue","onChange"])]),order_status_slot:_(({row:e})=>[c(o,{modelValue:e.order_status,"onUpdate:modelValue":a=>e.order_status=a,style:{"--el-switch-on-color":"#337ecc"},"active-value":1,"inactive-value":0,"active-text":"正常","inactive-text":"禁用",onChange:a=>Q(e,"order_status")},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:2},[1==S.channel_id||2==S.channel_id?{name:"btns",fn:_(()=>[m("div",{class:"blue",onClick:a[0]||(a[0]=a=>$(e.row,1))},[c(l,null,{default:_(()=>[c(t)]),_:1}),a[6]||(a[6]=h(" 新增 "))])]),key:"0"}:void 0,1==S.channel_id||2==S.channel_id?{name:"operate",fn:_(({row:e})=>[m("div",O,[c(n,{size:"small",type:"primary",onClick:a=>$(e,2)},{default:_(()=>a[7]||(a[7]=[h(" 编辑 ")])),_:2,__:[7]},1032,["onClick"]),c(n,{size:"small",onClick:a=>(e=>{G.push({name:"payee-channel-management-taobao-recharge",params:e}),K.setpageRechargeInfo(e)})(e)},{default:_(()=>a[8]||(a[8]=[h(" 充值账号 ")])),_:2,__:[8]},1032,["onClick"]),c(n,{type:"warning",size:"small",onClick:a=>(e=>{G.push({name:"payee-channel-management-taobao-goods-list",params:e}),K.setpageGoodsManagementInfo(e)})(e)},{default:_(()=>a[9]||(a[9]=[h(" 商品管理 ")])),_:2,__:[9]},1032,["onClick"]),e.token?(r(),b(n,{key:0,size:"small",type:"success",onClick:a=>(e=>{C.confirm("确认要同步商品吗","系统提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then(()=>{j({shop_id:e.id}).then(e=>{q.success("同步商品成功"),ae()})})})(e)},{default:_(()=>a[10]||(a[10]=[h(" 同步商品 ")])),_:2,__:[10]},1032,["onClick"])):v("",!0),c(n,{size:"small",type:"danger",onClick:a=>(async e=>{C.confirm("确认要删除吗","系统提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then(()=>{U(e.id).then(e=>{q.success("操作成功"),ae()})})})(e)},{default:_(()=>a[11]||(a[11]=[h(" 删除 ")])),_:2,__:[11]},1032,["onClick"])])]),key:"1"}:void 0]),1032,["columns","searchFields","data","per_page","page","total","loading"]),c(x,{showDialog:k(X).showAddDialog,"onUpdate:showDialog":a[4]||(a[4]=e=>k(X).showAddDialog=e),formData:k(X).addForm,"onUpdate:formData":a[5]||(a[5]=e=>k(X).addForm=e),ref_key:"addFormRef",ref:H,labelWidth:"130px"},{submit:_(()=>[F((r(),b(n,{type:"primary",loading:k(X).btnLoading},{default:_(()=>a[12]||(a[12]=[h("确定")])),_:1,__:[12]},8,["loading"])),[[V,k(J)]])]),_:1},8,["showDialog","formData"])])}}};export{S as default};