daShangDao_newAdmin/dist/assets/index.2b40dfca.js
2026-06-15 17:26:14 +08:00

2 lines
13 KiB
JavaScript

var e=Object.defineProperty,a=Object.defineProperties,l=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,s=(a,l,o)=>l in a?e(a,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[l]=o;import{d as i,a8 as d,_ as n,$ as u,ao as p,ah as c,ai as m,aa as h,a9 as f,a3 as y,ab as b,ac as g,ae as v,al as w,af as _,ag as V,aC as k,aD as N,am as C,as as z,o as j,k as O,l as S,m as U,w as A,v as T,at as x,H as G,t as I,an as $,E as P}from"./vendor.be06958f.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{g as R,a as D,d as E,b as q,u as B,c as L,e as H}from"./shop.845bfc63.js";import{R as J}from"./RefreshButton.7d989868.js";import"./index.c0a98caf.js";const F=async e=>{try{const l=await fetch(e,{method:"GET",headers:{Accept:"*/*"},cache:"no-cache"});if(!l.ok)throw new Error(`HTTP error! Status: ${l.status}`);const o=await l.text();if((e=>{try{return new URL(e),!0}catch(a){return!1}})(o))return console.log("直接返回URL:",o),{url:o.trim()};try{return JSON.parse(o)}catch(a){return{text:o}}}catch(l){throw console.error("外部API请求失败:",l),l}},K={class:"list-container"},M={class:"search-area"},Q={class:"action-bar"},W={class:"action-left"},X={class:"action-right"},Y={class:"pagination-container"},Z={class:"dialog-footer"};var ee=i({__name:"index",setup(e){const i=d({shopType:"",shopGroup:"",shopName:"",shopAliasName:"",shopAuthorize:"",status:"",pageNum:1,pageSize:20}),ee=n(!1),ae=n([]),le=n(0),oe=n([]),te=d({visible:!1,title:""}),re=n(),se=d({id:void 0,mallId:"",shopNike:"",shopType:"1",shopGroup:"",shopName:"",shopAliasName:"",shopAuthorize:"0",status:"0",account:"",password:"",isSynOrder:0}),ie={shopType:[{required:!0,message:"请选择店铺类型",trigger:"change"}],shopName:[{required:!0,message:"请输入店铺名称",trigger:"blur"}],shopAliasName:[{required:!0,message:"请输入三方名称",trigger:"blur"}]};u((()=>{ue()}));const de=e=>{switch(e){case"1":return"success";case"0":return"info";case"2":return"warning";default:return"info"}},ne=e=>{switch(e){case"1":return"已授权";case"0":return"未授权";case"2":return"已过期";default:return"未知"}},ue=async()=>{ee.value=!0;try{const e=await R(i);console.log("res",e),200===e.code?(ae.value=e.data.list,le.value=e.data.total):p.error(e.message||"获取数据失败")}catch(e){p.error("获取店铺列表失败")}finally{ee.value=!1}},pe=()=>{i.pageNum=1,ue()},ce=()=>{i.shopType="",i.shopGroup="",i.shopName="",i.shopAliasName="",i.shopAuthorize="",i.status="",i.pageNum=1,ue()},me=e=>{i.pageSize=e,ue()},he=e=>{i.pageNum=e,ue()},fe=e=>{oe.value=e},ye=()=>{te.title="添加店铺",te.visible=!0,se.id=void 0,se.mallId="",se.shopNike="",se.shopType="1",se.shopGroup="",se.shopName="",se.shopAliasName="",se.shopAuthorize="0",se.status="0",se.account="",se.password="",se.isSynOrder=0},be=e=>{if(te.title="编辑店铺",te.visible=!0,e){const a=e.id;a&&D(a).then((e=>{200===e.data.code&&Object.assign(se,e.data.data)}))}else{if(1!==oe.value.length)return p.warning("请选择一条记录进行修改"),void(te.visible=!1);const e=oe.value[0].id;e&&D(e).then((e=>{200===e.data.code&&Object.assign(se,e.data.data)}))}},ge=e=>{if(e)P.confirm("确认删除该店铺记录吗?","警告",{type:"warning"}).then((()=>{e.id&&E(e.id).then((e=>{200===e.data.code&&(p.success("删除成功"),ue())}))})).catch((()=>{}));else{if(0===oe.value.length)return void p.warning("请至少选择一条记录");P.confirm(`确认删除选中的${oe.value.length}条店铺记录吗?`,"警告",{type:"warning"}).then((()=>{const e=oe.value.map((e=>e.id)).filter((e=>void 0!==e));e.length>0&&q(e.join(",")).then((e=>{200===e.data.code&&(p.success("批量删除成功"),ue())}))})).catch((()=>{}))}},ve=async(e,i)=>{const d="0"===i?"启用":"停用";P.confirm(`确认要${d}该店铺吗?`,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((async()=>{try{const u=(n=((e,a)=>{for(var l in a||(a={}))t.call(a,l)&&s(e,l,a[l]);if(o)for(var l of o(a))r.call(a,l)&&s(e,l,a[l]);return e})({},e),a(n,l({status:i})));await L(u),p.success(`${d}成功`),ue()}catch(u){console.error(`${d}失败:`,u),p.error(`${d}失败`)}var n})).catch((()=>{}))},we=()=>{re.value.validate((e=>{e&&(se.id?L(se).then((e=>{200===e.data.code&&(p.success("修改成功"),te.visible=!1,ue())})):H(se).then((e=>{200===e.code&&(p.success(e.message),te.visible=!1,ue())})))}))};return(e,a)=>{const l=c,o=m,t=h,r=f,s=y,d=b,n=g,u=v,P=w,R=_,D=V,E=k,q=N,L=C,H=z;return j(),O("div",K,[S("div",M,[U(d,{model:i,inline:""},{default:A((()=>[U(t,{label:"店铺类型"},{default:A((()=>[U(o,{modelValue:i.shopType,"onUpdate:modelValue":a[0]||(a[0]=e=>i.shopType=e),placeholder:"请选择店铺类型",clearable:""},{default:A((()=>[U(l,{label:"拼多多",value:"1"})])),_:1},8,["modelValue"])])),_:1}),U(t,{label:"分组"},{default:A((()=>[U(r,{modelValue:i.shopGroup,"onUpdate:modelValue":a[1]||(a[1]=e=>i.shopGroup=e),placeholder:"请输入分组"},null,8,["modelValue"])])),_:1}),U(t,{label:"店铺名称"},{default:A((()=>[U(r,{modelValue:i.shopName,"onUpdate:modelValue":a[2]||(a[2]=e=>i.shopName=e),placeholder:"请输入店铺名称"},null,8,["modelValue"])])),_:1}),U(t,{label:"三方名称"},{default:A((()=>[U(r,{modelValue:i.shopAliasName,"onUpdate:modelValue":a[3]||(a[3]=e=>i.shopAliasName=e),placeholder:"请输入三方名称"},null,8,["modelValue"])])),_:1}),U(t,{label:"是否授权"},{default:A((()=>[U(o,{modelValue:i.shopAuthorize,"onUpdate:modelValue":a[4]||(a[4]=e=>i.shopAuthorize=e),placeholder:"请选择是否授权",clearable:""},{default:A((()=>[U(l,{label:"已授权",value:"1"}),U(l,{label:"未授权",value:"0"}),U(l,{label:"已过期",value:"2"})])),_:1},8,["modelValue"])])),_:1}),U(t,{label:"店铺状态"},{default:A((()=>[U(o,{modelValue:i.status,"onUpdate:modelValue":a[5]||(a[5]=e=>i.status=e),placeholder:"请选择店铺状态",clearable:""},{default:A((()=>[U(l,{label:"正常",value:"0"}),U(l,{label:"停用",value:"1"})])),_:1},8,["modelValue"])])),_:1}),U(t,null,{default:A((()=>[U(s,{type:"primary",icon:"Search",onClick:pe},{default:A((()=>[T("搜索")])),_:1}),U(s,{icon:"Refresh",onClick:ce},{default:A((()=>[T("重置")])),_:1})])),_:1})])),_:1},8,["model"])]),S("div",Q,[S("div",W,[U(s,{type:"primary",onClick:ye},{default:A((()=>[T("新增")])),_:1}),U(s,{type:"primary",onClick:be},{default:A((()=>[T("编辑")])),_:1}),U(s,{type:"danger",onClick:ge},{default:A((()=>[T("删除")])),_:1})]),S("div",X,[U(J,{onRefresh:ue})])]),x((j(),G(R,{data:ae.value,onSelectionChange:fe,border:"",stripe:"",style:{width:"100%"},"row-key":"id"},{default:A((()=>[U(n,{type:"selection",width:"55",align:"center"}),U(n,{label:"店铺编码",prop:"id",align:"center"}),U(n,{label:"店铺类型",align:"center"},{default:A((e=>[T(I("1"===e.row.shopType?"拼多多":"-"),1)])),_:1}),U(n,{label:"分组",prop:"shopGroup",align:"center"}),U(n,{label:"店铺名称",prop:"shopName",align:"center"}),U(n,{label:"三方名称",prop:"shopAliasName",align:"center"}),U(n,{label:"是否授权",align:"center"},{default:A((e=>["1"===e.row.shopAuthorize?(j(),G(u,{key:0,type:de(e.row.shopAuthorize)},{default:A((()=>[T(I(ne(e.row.shopAuthorize)),1)])),_:2},1032,["type"])):(j(),G(s,{key:1,size:"small",type:"primary",onClick:a=>(async e=>{try{p.info("正在获取授权链接,请稍候...");const a=`https://api.buzhiyushu.cn/huidiao/pdd/toPddGetCode?id=${e.id}&type=4`,l=await F(a);let o=null;if(l&&(l.url?o=l.url:"string"==typeof l&&l.includes("http")&&(o=l)),o){console.log("授权URL:",o);const e=window.open(o,"_blank");e&&!e.closed&&void 0!==e.closed||(window.location.href=o)}else console.error("无法解析授权链接:",l),p.error("获取授权链接失败")}catch(a){console.error("授权请求失败:",a),p.error("授权请求失败")}})(e.row)},{default:A((()=>[T(" 授权 ")])),_:2},1032,["onClick"]))])),_:1}),U(n,{label:"到期时间",align:"center"},{default:A((e=>[T(I(e.row.expirationTime),1)])),_:1}),U(n,{label:"添加时间",prop:"addTime",align:"center"}),U(n,{label:"店铺状态",align:"center"},{default:A((e=>[U(u,{type:"0"===e.row.status?"success":"danger"},{default:A((()=>[T(I("0"===e.row.status?"正常":"停用"),1)])),_:2},1032,["type"])])),_:1}),U(n,{label:"同步订单",align:"center"},{default:A((e=>[U(P,{modelValue:e.row.isSynOrder,"onUpdate:modelValue":a=>e.row.isSynOrder=a,"active-value":1,"inactive-value":0,class:"ml-2","inline-prompt":"","active-text":"开","inactive-text":"关",onChange:a=>(e=>{const a=1===e.isSynOrder?"开启":"关闭";e.id&&B(e.id,e.isSynOrder).then((l=>{200===l.data.code?p.success(`${a}同步订单成功`):(p.error(`${a}同步订单失败`),e.isSynOrder=1===e.isSynOrder?0:1)})).catch((()=>{e.isSynOrder=1===e.isSynOrder?0:1,p.error(`${a}同步订单失败`)}))})(e.row)},null,8,["modelValue","onUpdate:modelValue","onChange"])])),_:1}),U(n,{label:"设置",align:"center",width:"60"},{default:A((e=>[U(s,{type:"primary",icon:"Setting",circle:"",plain:"",size:"small",onClick:a=>{return l=e.row,void p.info(`设置店铺: ${l.shopName}`);var l}},null,8,["onClick"])])),_:1}),U(n,{label:"操作",align:"center",width:"220",fixed:"right"},{default:A((e=>[U(s,{size:"small",type:"primary",onClick:a=>be(e.row)},{default:A((()=>[T("编辑")])),_:2},1032,["onClick"]),U(s,{size:"small",type:"danger",onClick:a=>ge(e.row)},{default:A((()=>[T("删除")])),_:2},1032,["onClick"]),"0"===e.row.status?(j(),G(s,{key:0,size:"small",type:"warning",onClick:a=>ve(e.row,"1")},{default:A((()=>[T("停用")])),_:2},1032,["onClick"])):$("",!0),"1"===e.row.status?(j(),G(s,{key:1,size:"small",type:"success",onClick:a=>ve(e.row,"0")},{default:A((()=>[T("启用")])),_:2},1032,["onClick"])):$("",!0)])),_:1})])),_:1},8,["data"])),[[H,ee.value]]),S("div",Y,[U(D,{"current-page":i.pageNum,"onUpdate:currentPage":a[6]||(a[6]=e=>i.pageNum=e),"page-size":i.pageSize,"onUpdate:pageSize":a[7]||(a[7]=e=>i.pageSize=e),"page-sizes":[10,20,50,100],layout:"total, sizes, prev, pager, next, jumper",total:le.value,onSizeChange:me,onCurrentChange:he},null,8,["current-page","page-size","total"])]),U(L,{title:te.title,modelValue:te.visible,"onUpdate:modelValue":a[19]||(a[19]=e=>te.visible=e),width:"600px","close-on-click-modal":!1,"append-to-body":""},{footer:A((()=>[S("div",Z,[U(s,{onClick:a[18]||(a[18]=e=>te.visible=!1)},{default:A((()=>[T("取消")])),_:1}),U(s,{type:"primary",onClick:we},{default:A((()=>[T("确定")])),_:1})])])),default:A((()=>[U(d,{model:se,rules:ie,ref_key:"formRef",ref:re,"label-width":"100px"},{default:A((()=>[U(t,{label:"店铺类型",prop:"shopType"},{default:A((()=>[U(o,{modelValue:se.shopType,"onUpdate:modelValue":a[8]||(a[8]=e=>se.shopType=e),placeholder:"请选择店铺类型",style:{width:"100%"}},{default:A((()=>[U(l,{label:"拼多多",value:"1"})])),_:1},8,["modelValue"])])),_:1}),U(t,{label:"分组",prop:"shopGroup"},{default:A((()=>[U(r,{modelValue:se.shopGroup,"onUpdate:modelValue":a[9]||(a[9]=e=>se.shopGroup=e),placeholder:"请输入分组"},null,8,["modelValue"])])),_:1}),U(t,{label:"店铺名称",prop:"shopName"},{default:A((()=>[U(r,{modelValue:se.shopName,"onUpdate:modelValue":a[10]||(a[10]=e=>se.shopName=e),placeholder:"请输入店铺名称"},null,8,["modelValue"])])),_:1}),U(t,{label:"三方名称",prop:"shopAliasName"},{default:A((()=>[U(r,{modelValue:se.shopAliasName,"onUpdate:modelValue":a[11]||(a[11]=e=>se.shopAliasName=e),placeholder:"请输入三方名称"},null,8,["modelValue"])])),_:1}),U(t,{label:"店铺ID",prop:"mallId"},{default:A((()=>[U(r,{modelValue:se.mallId,"onUpdate:modelValue":a[12]||(a[12]=e=>se.mallId=e),placeholder:"请输入三方店铺ID"},null,8,["modelValue"])])),_:1}),U(t,{label:"万里牛ID",prop:"shopNike"},{default:A((()=>[U(r,{modelValue:se.shopNike,"onUpdate:modelValue":a[13]||(a[13]=e=>se.shopNike=e),placeholder:"请输入万里牛系统ID"},null,8,["modelValue"])])),_:1}),U(t,{label:"第三方账号",prop:"account"},{default:A((()=>[U(r,{modelValue:se.account,"onUpdate:modelValue":a[14]||(a[14]=e=>se.account=e),placeholder:"请输入第三方平台账号"},null,8,["modelValue"])])),_:1}),U(t,{label:"第三方密码",prop:"password"},{default:A((()=>[U(r,{modelValue:se.password,"onUpdate:modelValue":a[15]||(a[15]=e=>se.password=e),type:"password",placeholder:"请输入第三方平台密码","show-password":""},null,8,["modelValue"])])),_:1}),U(t,{label:"同步订单",prop:"isSynOrder"},{default:A((()=>[U(P,{modelValue:se.isSynOrder,"onUpdate:modelValue":a[16]||(a[16]=e=>se.isSynOrder=e),"active-value":1,"inactive-value":0,"inline-prompt":"","active-text":"开","inactive-text":"关"},null,8,["modelValue"])])),_:1}),U(t,{label:"店铺状态",prop:"status"},{default:A((()=>[U(q,{modelValue:se.status,"onUpdate:modelValue":a[17]||(a[17]=e=>se.status=e)},{default:A((()=>[U(E,{label:"0"},{default:A((()=>[T("正常")])),_:1}),U(E,{label:"1"},{default:A((()=>[T("停用")])),_:1})])),_:1},8,["modelValue"])])),_:1})])),_:1},8,["model"])])),_:1},8,["title","modelValue"])])}}});ee.__scopeId="data-v-69056776";export{ee as default};