You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
9.1 KiB

3 weeks ago
"use strict";(self["webpackChunkshiweisuzhou"]=self["webpackChunkshiweisuzhou"]||[]).push([[597],{597:function(e,i,t){t.r(i),t.d(i,{default:function(){return c}});var s=function(){var e=this,i=e._self._c;return i("div",{staticClass:"bg"},[i("el-card",{staticStyle:{width:"100%"}},[i("div",{staticClass:"clearfix flex-between",attrs:{slot:"header"},slot:"header"},[i("div",[e._v(" 收货地址 "),i("span",{staticStyle:{"font-size":"12px",color:"#666"}},[e._v("收票人地址统一使用该地址管理设置")])]),i("el-button",{staticStyle:{float:"right"},attrs:{size:"small",type:"primary"},on:{click:function(i){return e.openDialog("add",{})}}},[e._v("新增地址")])],1),i("el-table",{staticStyle:{width:"100%"},attrs:{data:e.addresses,border:""}},[i("el-table-column",{attrs:{prop:"name",label:"收货人",width:"120"}}),i("el-table-column",{attrs:{prop:"address",label:"收货地址",width:"auto"}}),i("el-table-column",{attrs:{prop:"tel",label:"手机号码",width:"150"}}),i("el-table-column",{attrs:{label:"操作",width:"200"},scopedSlots:e._u([{key:"default",fn:function(t){return[i("el-button",{attrs:{size:"mini"},on:{click:function(i){return e.handleEdit(t.row)}}},[e._v("编辑")]),i("el-button",{attrs:{size:"mini",type:"danger"},on:{click:function(i){return e.handleDelete(t.row)}}},[e._v("删除")])]}}])})],1),i("div",{staticStyle:{"text-align":"right","margin-top":"20px"}},[i("el-pagination",{attrs:{"current-page":e.searchParam.currentPage,"page-sizes":[5,10,20],"page-size":e.searchParam.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.searchParam.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1)],1),i("AddressFormDialog",{attrs:{visible:e.dialogVisible,type:e.dialogType,"initial-data":e.dialogData},on:{"update:visible":function(i){e.dialogVisible=i},save:e.handleSaveAddress}})],1)},a=[],r=t(4294),l={name:"AddressManagement",components:{AddressFormDialog:r.A},data(){return{user:{},searchParam:{pageSize:5,currentPage:1,total:0},dialogVisible:!1,dialogType:"add",dialogData:{},addresses:[]}},mounted(){this.getAddress()},methods:{getAddress(){this.post({contactType:"CONSIGNEE",offset:"0",limit:"100"},"/api/uservice/user/getContactOrConsignee").then(e=>{e&&(this.addresses=e.data||[],this.searchParam.total=this.addresses.length)})},handleSizeChange(e){this.searchParam.pageSize=e,this.searchParam.currentPage=1},handleCurrentChange(e){this.searchParam.currentPage=e},openDialog(e,i){this.dialogType=e,this.dialogData={...i},this.dialogVisible=!0},handleSaveAddress(e){e.is_default=0,"add"===this.dialogType?this.post(e,"/api/uservice/user/addNewConsignee").then(e=>{1==e.code&&(this.$message.success("保存成功"),this.getAddress(),this.dialogVisible=!1)}):this.post(e,"/api/uservice/user/editConsignee").then(e=>{1==e.code&&(this.$message.success("保存成功"),this.getAddress(),this.dialogVisible=!1)})},handleEdit(e){console.log(e),e.username=e.name,e.mobile=e.tel,this.openDialog("edit",e)},handleDelete(e){this.$confirm("此操作将永久删除该地址, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{this.post({id:e.id},"/api/uservice/user/delConsignee").then(e=>{1==e.code&&(this.getAddress(),this.$message.success("删除成功!"))})}).catch(()=>{this.$message.info("已取消删除")})}}},n=l,o=t(845),d=(0,o.A)(n,s,a,!1,null,"b49931c8",null),c=d.exports},4294:function(e,i,t){t.d(i,{A:function(){return d}});var s=function(){var e=this,i=e._self._c;return i("el-dialog",{attrs:{title:("add"===e.type?"新增":"编辑")+"收货地址",visible:e.visible,width:"700px"},on:{close:e.handleClose}},[i("el-form",{ref:"addressForm",attrs:{model:e.form,rules:e.rules,"label-width":"100px",size:"small"}},[i("el-form-item",{attrs:{label:"收货人",prop:"username"}},[i("el-input",{attrs:{placeholder:"请填写收货人姓名,限制10个字符",maxlength:"10"},model:{value:e.form.username,callback:function(i){e.$set(e.form,"username",i)},expression:"form.username"}})],1),i("el-form-item",{attrs:{label:"所在地区",prop:"region"}},[i
//# sourceMappingURL=597.bc6f8420.js.map