1 |
- import{u as z}from"./useInstance.af7c9e87.js";import{D as r,d as $,a6 as H,s as J,r as A,b as y,p as E,c as i,e as s,k as c,i as n,h as d,u as a,f as L,j as S,F as P,A as w,g as V,a2 as K,m,E as C,b4 as M,R as Q,S as W,_ as X}from"./index.76214426.js";import{s as Y}from"./goodsManage.6c9c05e5.js";const ye=u=>r.request({url:"merchant/tuangouquan.third_coupons_mapping/list",params:u}),be=u=>r.request({url:"merchant/tuangouquan.third_coupons_mapping/delete",method:"POST",data:u}),Z=u=>r.request({url:"merchant/tuangouquan.third_coupons_mapping/detail",params:u}),ee=u=>r.request({url:"merchant/tuangouquan.third_coupons_mapping/edit",method:"POST",data:u}),oe=u=>r.request({url:"merchant/tuangouquan.third_coupons_mapping/add",method:"POST",data:u}),te=u=>r.request({url:"merchant/tuangouquan.third_coupons_mapping/otherPlatformGoodsList",params:u}),ue=u=>r.request({url:"merchant/tuangouquan.third_coupons_mapping/getMeituanCouponCode",params:u}),le=u=>(Q("data-v-580a42a1"),u=u(),W(),u),ae=m("\u7F8E\u56E2"),ne=m("\u6296\u97F3"),de={style:{display:"flex","flex-direction":"column"}},ie=m("\u83B7\u53D6\u5238\u7801id"),se=le(()=>V("view",{style:{"font-size":"12px",color:"#999","margin-top":"10px"}}," \u7F8E\u56E2\u5238\u7F16\u7801\u7528\u56E2\u8D2D\u5238\u6838\u9500\u7801\u7684\u6570\u5B57\u8F93\u5165 ",-1)),re=m("\u63D0\u4EA4"),pe=m("\u53D6\u6D88"),_e=$({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(u,{emit:F}){const _=u;H();const{global:I}=z();let O=J(()=>Number(_.id)>0);const b=A(!1),D=A(),e=y({id:"",goods_id:"",type:"",third_coupon_id:"",third_coupon_name:""}),U=()=>{e.id>0?ee(e).then(t=>{C({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),g()}):oe(e).then(t=>{C({message:"\u65B0\u589E\u6210\u529F",type:"success"}),g()})};E(()=>_.modelValue,t=>{b.value=t,t&&_.id&&(e.id=_.id,N())}),y({list:[]});const N=()=>{Z({id:_.id}).then(t=>{t=t.data,e.goods_id=t.goods_id,e.type=t.type,e.third_coupon_id=t.third_coupon_id,e.id=t.id})},g=()=>{F("update:modelValue",!1),F("onClose"),I.$resetForm(D.value,e)},v=y({list:[]});(()=>{Y({}).then(t=>{console.log("res",t),v.list=t})})();const f=y({list:[]}),T=()=>{f.list=[];const t=M.service({target:".el-dialog",lock:!0,text:"\u52A0\u8F7D\u4E2D",background:"rgba(0, 0, 0, 0.7)"});te({type:e.type}).then(o=>{f.list=o,t.close()})};E(()=>e.type,t=>{t&&T()}),E(()=>e.third_coupon_id,t=>{var o;t&&e.type=="douyin"&&(e.third_coupon_name=(o=f.list.find(h=>h.product_id===t))==null?void 0:o.product_name)});const G=()=>{if(console.log("\u83B7\u53D6\u5238\u7801"),!e.third_coupon_id){C({message:"\u8BF7\u8F93\u5165\u5238\u7801\u6362\u53D6id",type:"error"});return}const t=M.service({target:".el-dialog",lock:!0,text:"\u52A0\u8F7D\u4E2D",background:"rgba(0, 0, 0, 0.7)"});ue({code:e.third_coupon_id}).then(o=>{console.log("res",o),o&&o.id&&o.name?(e.third_coupon_id=String(o.id),e.third_coupon_name=String(o.name),console.log("Updated formData:",e)):console.error("Invalid response data:",o),t.close()}).catch(o=>{console.error("API call failed:",o),t.close()})};return(t,o)=>{const h=i("el-radio"),j=i("el-radio-group"),p=i("el-form-item"),k=i("el-option"),q=i("el-select"),x=i("el-input"),B=i("el-button"),R=i("el-dialog");return s(),c(R,{modelValue:b.value,"onUpdate:modelValue":o[5]||(o[5]=l=>b.value=l),title:a(O)?"\u67E5\u770B":"\u65B0\u589E",width:"70%","destroy-on-close":"",onClose:g},{default:n(()=>[d(a(K),{ref_key:"formRef",ref:D,model:a(e),"inline-message":!0,"label-width":"160px"},{default:n(()=>[d(p,{label:"\u7B2C\u4E09\u65B9\u5238\u7C7B\u578B",prop:"type"},{default:n(()=>[d(j,{modelValue:a(e).type,"onUpdate:modelValue":o[0]||(o[0]=l=>a(e).type=l)},{default:n(()=>[d(h,{label:"meituan"},{default:n(()=>[ae]),_:1}),d(h,{label:"douyin"},{default:n(()=>[ne]),_:1})]),_:1},8,["modelValue"])]),_:1}),a(e).type=="douyin"?(s(),c(p,{key:0,label:"\u7B2C\u4E09\u65B9\u5238id",prop:"third_coupon_id"},{default:n(()=>[d(q,{modelValue:a(e).third_coupon_id,"onUpdate:modelValue":o[1]||(o[1]=l=>a(e).third_coupon_id=l),placeholder:"\u8BF7\u9009\u62E9\u7B2C\u4E09\u65B9\u5238",clearable:"",filterable:""},{default:n(()=>[(s(!0),L(P,null,S(a(f).list,l=>(s(),c(k,{key:l.product_id,label:l.product_name,value:l.product_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):w("",!0),a(e).type=="meituan"?(s(),c(p,{key:1,label:"\u7B2C\u4E09\u65B9\u5238id",prop:"third_coupon_id"},{default:n(()=>[V("view",de,[V("view",null,[d(x,{modelValue:a(e).third_coupon_id,"onUpdate:modelValue":o[2]||(o[2]=l=>a(e).third_coupon_id=l),placeholder:"\u8BF7\u8F93\u5165\u5238\u7801\u6362\u53D6id",style:{width:"200px"}},null,8,["modelValue"]),d(B,{type:"primary",onClick:G,style:{"margin-left":"10px"}},{default:n(()=>[ie]),_:1})]),se])]),_:1})):w("",!0),d(p,{label:"\u7B2C\u4E09\u65B9\u5238\u6807\u9898",prop:"third_coupon_name"},{default:n(()=>[d(x,{modelValue:a(e).third_coupon_name,"onUpdate:modelValue":o[3]||(o[3]=l=>a(e).third_coupon_name=l),placeholder:"\u8BF7\u8F93\u5165\u7B2C\u4E09\u65B9\u5238\u6807\u9898"},null,8,["modelValue"])]),_:1}),d(p,{label:"\u5546\u54C1",prop:"goods_id"},{default:n(()=>[d(q,{modelValue:a(e).goods_id,"onUpdate:modelValue":o[4]||(o[4]=l=>a(e).goods_id=l),placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1",clearable:"",filterable:""},{default:n(()=>[(s(!0),L(P,null,S(a(v).list,l=>(s(),c(k,{key:l.id,label:l.title,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),d(p,null,{default:n(()=>[d(B,{type:"primary",onClick:U},{default:n(()=>[re]),_:1}),d(B,{onClick:g},{default:n(()=>[pe]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});const ce=X(_e,[["__scopeId","data-v-580a42a1"]]),Be=Object.freeze(Object.defineProperty({__proto__:null,default:ce},Symbol.toStringTag,{value:"Module"}));export{ce as E,Be as a,be as d,ye as g};
|