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.
1 lines
15 KiB
1 lines
15 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-53032860"],{"241a":function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t._self._c;return e("coupon-detail",{attrs:{isEdit:!1}})},r=[],u=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"form-container",attrs:{shadow:"never"}},[e("el-form",{ref:"couponFrom",attrs:{model:t.coupon,rules:t.rules,"label-width":"150px",size:"small"}},[e("el-form-item",{attrs:{label:"优惠券类型:"}},[e("span",[t._v("全场赠券")])]),e("el-form-item",{attrs:{label:"优惠券名称:",prop:"name"}},[e("el-input",{staticClass:"input-width",model:{value:t.coupon.name,callback:function(e){t.$set(t.coupon,"name",e)},expression:"coupon.name"}})],1),e("el-form-item",{attrs:{label:"适用平台:"}},[e("span",[t._v("全平台")])]),e("el-form-item",{attrs:{label:"总发行量:",prop:"publishCount"}},[e("el-input",{staticClass:"input-width",attrs:{placeholder:"只能输入正整数"},model:{value:t.coupon.publishCount,callback:function(e){t.$set(t.coupon,"publishCount",t._n(e))},expression:"coupon.publishCount"}})],1),e("el-form-item",{attrs:{label:"面额:",prop:"amount"}},[e("el-input",{staticClass:"input-width",attrs:{placeholder:"面值只能是数值,限2位小数"},nativeOn:{keyup:function(e){t.coupon.amount=t.UpNumber(t.coupon.amount,2)}},model:{value:t.coupon.amount,callback:function(e){t.$set(t.coupon,"amount",e)},expression:"coupon.amount"}},[e("template",{slot:"append"},[t._v("元")])],2)],1),e("el-form-item",{attrs:{label:"每人限领:"}},[e("el-input",{staticClass:"input-width",attrs:{placeholder:"只能输入正整数"},model:{value:t.coupon.perLimit,callback:function(e){t.$set(t.coupon,"perLimit",e)},expression:"coupon.perLimit"}},[e("template",{slot:"append"},[t._v("张")])],2)],1),e("el-form-item",{attrs:{label:"使用门槛:",prop:"minPoint"}},[e("el-input",{staticClass:"input-width",attrs:{placeholder:"只能输入正整数"},model:{value:t.coupon.minPoint,callback:function(e){t.$set(t.coupon,"minPoint",t._n(e))},expression:"coupon.minPoint"}},[e("template",{slot:"prepend"},[t._v("满")]),e("template",{slot:"append"},[t._v("元可用")])],2)],1),e("el-form-item",{attrs:{label:"有效期:"}},[e("el-date-picker",{staticStyle:{width:"200px"},attrs:{type:"datetime",placeholder:"选择日期","default-time":"00:00:00"},model:{value:t.coupon.startTime,callback:function(e){t.$set(t.coupon,"startTime",e)},expression:"coupon.startTime"}}),e("span",{staticStyle:{"margin-left":"5px","margin-right":"5px"}},[t._v("至")]),e("el-date-picker",{staticStyle:{width:"200px"},attrs:{type:"datetime",placeholder:"选择日期","default-time":"23:59:59"},model:{value:t.coupon.endTime,callback:function(e){t.$set(t.coupon,"endTime",e)},expression:"coupon.endTime"}})],1),e("el-form-item",{attrs:{label:"可使用商品:"}},[e("el-radio-group",{model:{value:t.coupon.useType,callback:function(e){t.$set(t.coupon,"useType",e)},expression:"coupon.useType"}},[e("el-radio-button",{attrs:{label:0}},[t._v("全场通用")]),e("el-radio-button",{attrs:{label:1}},[t._v("指定分类")]),e("el-radio-button",{attrs:{label:2}},[t._v("指定商品")])],1)],1),e("el-form-item",{directives:[{name:"show",rawName:"v-show",value:1===t.coupon.useType,expression:"coupon.useType===1"}]},[e("el-cascader",{attrs:{clearable:"",placeholder:"请选择分类名称",options:t.productCateOptions},model:{value:t.selectProductCate,callback:function(e){t.selectProductCate=e},expression:"selectProductCate"}}),e("el-button",{on:{click:function(e){return t.handleAddProductCategoryRelation()}}},[t._v("添加")]),e("el-table",{ref:"productCateRelationTable",staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:t.coupon.productCategoryRelationList,border:""}},[e("el-table-column",{attrs:{label:"分类名称",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(t._s(e.row.parentCategoryName)+">"+t._s(e.row.productCategoryName))]}}])}),e("el-table-column",{attrs:{label:"操作",align:"center",width:"100"},scopedSlots:t._u([{key:"default",fn:function(n){return[e("el-button",{attrs:{size:"mini",type:"text"},on:{click:function(e){return t.handleDeleteProductCateRelation(n.$index,n.row)}}},[t._v("删除 ")])]}}])})],1)],1),e("el-form-item",{directives:[{name:"show",rawName:"v-show",value:2===t.coupon.useType,expression:"coupon.useType===2"}]},[e("el-select",{attrs:{filterable:"",remote:"","reserve-keyword":"",placeholder:"商品名称/商品货号","remote-method":t.searchProductMethod,loading:t.selectProductLoading},model:{value:t.selectProduct,callback:function(e){t.selectProduct=e},expression:"selectProduct"}},t._l(t.selectProductOptions,(function(n){return e("el-option",{key:n.productId,attrs:{label:n.productName,value:n.productId}},[e("span",{staticStyle:{float:"left"}},[t._v(t._s(n.productName))]),e("span",{staticStyle:{float:"right",color:"#8492a6","font-size":"13px"}},[t._v("NO."+t._s(n.productSn))])])})),1),e("el-button",{on:{click:function(e){return t.handleAddProductRelation()}}},[t._v("添加")]),e("el-table",{ref:"productRelationTable",staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:t.coupon.productRelationList,border:""}},[e("el-table-column",{attrs:{label:"商品名称",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(t._s(e.row.productName))]}}])}),e("el-table-column",{attrs:{label:"货号",align:"center",width:"120"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("NO."+t._s(e.row.productSn))]}}])}),e("el-table-column",{attrs:{label:"操作",align:"center",width:"100"},scopedSlots:t._u([{key:"default",fn:function(n){return[e("el-button",{attrs:{size:"mini",type:"text"},on:{click:function(e){return t.handleDeleteProductRelation(n.$index,n.row)}}},[t._v("删除 ")])]}}])})],1)],1),e("el-form-item",{attrs:{label:"备注:"}},[e("el-input",{staticClass:"input-width",attrs:{type:"textarea",rows:5,placeholder:"请输入内容"},model:{value:t.coupon.note,callback:function(e){t.$set(t.coupon,"note",e)},expression:"coupon.note"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.onSubmit("couponFrom")}}},[t._v("提交")]),t.isEdit?t._e():e("el-button",{on:{click:function(e){return t.resetForm("couponFrom")}}},[t._v("重置")]),e("el-button",{attrs:{type:"info",size:"small"},on:{click:function(e){return t.handleReturn()}}},[t._v("关闭")])],1)],1)],1)},a=[],l=n("6b30"),c=n("c4c8"),s=n("d1f3"),i={type:0,name:null,platform:0,amount:null,perLimit:1,minPoint:null,startTime:null,endTime:null,useType:0,note:null,publishCount:null,productRelationList:[],productCategoryRelationList:[]},d=[{label:"全场赠券",value:0},{label:"会员赠券",value:1},{label:"购物赠券",value:2},{label:"注册赠券",value:3}],p=[{label:"全平台",value:0},{label:"移动平台",value:1},{label:"PC平台",value:2}],m={name:"CouponDetail",props:{isEdit:{type:Boolean,default:!1},dataId:{type:Number,default:0}},data:function(){return{coupon:Object.assign({},i),typeOptions:Object.assign({},d),platformOptions:Object.assign({},p),rules:{name:[{required:!0,message:"请输入优惠券名称",trigger:"blur"},{min:2,max:140,message:"长度在 2 到 140 个字符",trigger:"blur"}],publishCount:[{type:"number",required:!0,message:"只能输入正整数",trigger:"blur"}],amount:[{required:!0,message:"面值只能是数值,0.01-10000,限2位小数",trigger:"blur"}],minPoint:[{type:"number",required:!0,message:"只能输入正整数",trigger:"blur"}]},selectProduct:null,selectProductLoading:!1,selectProductOptions:[],selectProductCate:null,productCateOptions:[]}},created:function(){var t=this;if(this.isEdit){var e=this.dataId;alert(this.dataId),Object(l["d"])(e).then((function(e){t.coupon=e.data}))}this.getProductCateList()},methods:{handleReturn:function(){this.$router.back()},dateChange:function(t){console.log("val",t)},UpNumber:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;t=t.replace(/[^\d.]/g,""),t=t.replace(/^00/,"0."),t=t.replace(/^\./g,"0."),t=t.replace(/\.{2,}/g,"."),t=t.replace(".","$#$").replace(/\./g,"").replace("$#$","."),/^0\d+/.test(t)&&(t=t.slice(1));var n="^(\\d+)\\.(\\d{"+e+"}).*$",o=new RegExp(n);return t=0===e?t.replace(o,"$1"):t.replace(o,"$1.$2"),t},onSubmit:function(t){var e=this;this.$refs[t].validate((function(n){return n?parseFloat(e.coupon.amount)>=parseFloat(e.coupon.minPoint)?(e.$message({message:"优惠券面值金额须小于使用门槛金额",type:"error",duration:1e3}),!1):void e.$confirm("是否提交数据","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.isEdit?Object(l["e"])(e.$route.query.id,e.coupon).then((function(n){e.$refs[t].resetFields(),e.$message({message:"修改成功",type:"success",duration:1e3}),e.$router.back()})):Object(l["a"])(e.coupon).then((function(n){e.$refs[t].resetFields(),e.$message({message:"提交成功",type:"success",duration:1e3}),e.$router.back()}))})):(e.$message({message:"验证失败",type:"error",duration:1e3}),!1)}))},resetForm:function(t){this.$refs[t].resetFields(),this.coupon=Object.assign({},i)},searchProductMethod:function(t){var e=this;""!==t?(this.loading=!0,Object(c["f"])({keyword:t}).then((function(t){e.loading=!1;var n=t.data;e.selectProductOptions=[];for(var o=0;o<n.length;o++){var r=n[o];e.selectProductOptions.push({productId:r.id,productName:r.name,productSn:r.productSn})}}))):this.selectProductOptions=[]},handleAddProductRelation:function(){null!==this.selectProduct?(this.coupon.productRelationList.push(this.getProductById(this.selectProduct)),this.selectProduct=null):this.$message({message:"请先选择商品",type:"warning"})},handleDeleteProductRelation:function(t,e){this.coupon.productRelationList.splice(t,1)},handleAddProductCategoryRelation:function(){null!==this.selectProductCate&&0!==this.selectProductCate.length?(this.coupon.productCategoryRelationList.push(this.getProductCateByIds(this.selectProductCate)),this.selectProductCate=[]):this.$message({message:"请先选择商品分类",type:"warning"})},handleDeleteProductCateRelation:function(t,e){this.coupon.productCategoryRelationList.splice(t,1)},getProductById:function(t){for(var e=0;e<this.selectProductOptions.length;e++)if(t===this.selectProductOptions[e].productId)return this.selectProductOptions[e];return null},getProductCateList:function(){var t=this;Object(s["e"])().then((function(e){var n=e.data;t.productCateOptions=[];for(var o=0;o<n.length;o++){var r=[];if(null!=n[o].children&&n[o].children.length>0)for(var u=0;u<n[o].children.length;u++)r.push({label:n[o].children[u].name,value:n[o].children[u].id});t.productCateOptions.push({label:n[o].name,value:n[o].id,children:r})}}))},getProductCateByIds:function(t){for(var e,n,o=0;o<this.productCateOptions.length;o++)if(this.productCateOptions[o].value===t[0]){n=this.productCateOptions[o].label;for(var r=0;r<this.productCateOptions[o].children.length;r++)this.productCateOptions[o].children[r].value===t[1]&&(e=this.productCateOptions[o].children[r].label)}return{productCategoryId:t[1],productCategoryName:e,parentCategoryName:n}}}},f=m,h=(n("ab10"),n("2877")),b=Object(h["a"])(f,u,a,!1,null,"04c69ec5",null),g=b.exports,P={name:"addCoupon",components:{CouponDetail:g},methods:{showAdd:function(){}}},v=P,y=Object(h["a"])(v,o,r,!1,null,"436c54c4",null);e["default"]=y.exports},"6b30":function(t,e,n){"use strict";n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return u})),n.d(e,"d",(function(){return a})),n.d(e,"e",(function(){return l})),n.d(e,"b",(function(){return c}));var o=n("b775");function r(t){return Object(o["a"])({url:"/sms/SmsCoupon/list",method:"get",params:t})}function u(t){return Object(o["a"])({url:"/sms/SmsCoupon/create",method:"post",data:t})}function a(t){return Object(o["a"])({url:"/sms/SmsCoupon/"+t,method:"get"})}function l(t,e){return Object(o["a"])({url:"/sms/SmsCoupon/update/"+t,method:"post",data:e})}function c(t){return Object(o["a"])({url:"/sms/SmsCoupon/delete/"+t,method:"get"})}},"70fb":function(t,e,n){},ab10:function(t,e,n){"use strict";n("70fb")},c4c8:function(t,e,n){"use strict";n.d(e,"c",(function(){return r})),n.d(e,"f",(function(){return u})),n.d(e,"g",(function(){return a})),n.d(e,"b",(function(){return l})),n.d(e,"i",(function(){return c})),n.d(e,"l",(function(){return s})),n.d(e,"m",(function(){return i})),n.d(e,"k",(function(){return d})),n.d(e,"h",(function(){return p})),n.d(e,"n",(function(){return m})),n.d(e,"a",(function(){return f})),n.d(e,"j",(function(){return h})),n.d(e,"d",(function(){return b})),n.d(e,"e",(function(){return g}));var o=n("b775");function r(t){return Object(o["a"])({url:"/pms/PmsProduct/list",method:"get",params:t})}function u(t){return Object(o["a"])({url:"/pms/PmsProduct/simpleProductList",method:"get",params:t})}function a(t){return Object(o["a"])({url:"/pms/PmsProduct/update/deleteStatus",method:"post",params:t})}function l(t){return Object(o["a"])({url:"/pms/PmsProduct/delete/"+t,method:"get"})}function c(t){return Object(o["a"])({url:"/pms/PmsProduct/update/newStatus",method:"post",params:t})}function s(t){return Object(o["a"])({url:"/pms/PmsProduct/update/recommendStatus",method:"post",params:t})}function i(t){return Object(o["a"])({url:"/pms/PmsProduct/update/verifyStatus",method:"post",params:t})}function d(t){return Object(o["a"])({url:"/pms/PmsProduct/update/publishStatus",method:"post",params:t})}function p(t){return Object(o["a"])({url:"/pms/PmsProduct/update/isFenxiao",method:"post",params:t})}function m(t){return Object(o["a"])({url:"/pms/PmsProduct/update/isVip",method:"post",params:t})}function f(t){return Object(o["a"])({url:"/pms/PmsProduct/create",method:"post",data:t})}function h(t,e){return Object(o["a"])({url:"/pms/PmsProduct/update/"+t,method:"post",data:e})}function b(t){return Object(o["a"])({url:"/pms/PmsProduct/fetchVList/"+t,method:"get"})}function g(t){return Object(o["a"])({url:"/pms/PmsProduct/updateInfo/"+t,method:"get"})}},d1f3:function(t,e,n){"use strict";n.d(e,"d",(function(){return r})),n.d(e,"c",(function(){return u})),n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return l})),n.d(e,"i",(function(){return c})),n.d(e,"f",(function(){return s})),n.d(e,"j",(function(){return i})),n.d(e,"g",(function(){return d})),n.d(e,"h",(function(){return p})),n.d(e,"e",(function(){return m}));var o=n("b775");function r(t){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/list",method:"post",data:t})}function u(t,e){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/list/"+t,method:"get",params:e})}function a(t){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/delete",method:"DELETE",data:t,headers:{"Content-Type":"application/json"}})}function l(t){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/create",method:"post",data:t})}function c(t,e){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/update/"+t,method:"post",data:e})}function s(t){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/"+t,method:"get"})}function i(t){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/update/showStatus",method:"post",data:t})}function d(t){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/update/indexStatus",method:"post",data:t})}function p(t){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/update/navStatus",method:"post",data:t})}function m(){return Object(o["a"])({url:"/mall/pms/PmsProductCategory/list/withChildren",method:"get"})}}}]);
|