1 line
8.0 KiB
JavaScript
1 line
8.0 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0f7d5f2a"],{8832:function(t,e,a){"use strict";var r=a("b3f2"),s=a.n(r);s.a},b3f2:function(t,e,a){},f11c:function(t,e,a){"use strict";a.r(e);var r=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"setmeal"},[a("div",{staticClass:"setmeal__h"},[a("p",{staticClass:"setmeal__h--p"},[t._v(" "+t._s(t.updateId?t.$t("setmealadd_11"):t.$t("setmealadd_10"))+" ")])]),a("Form",{ref:"formValidate",staticClass:"setmeal__form",attrs:{model:t.formValidate,rules:t.ruleValidate,"label-width":100}},[a("FormItem",{staticClass:"formitem",attrs:{label:t.$t("design_28")+":",prop:"product_type"}},[a("RadioGroup",{on:{"on-change":t.changeType},model:{value:t.formValidate.product_type,callback:function(e){t.$set(t.formValidate,"product_type",e)},expression:"formValidate.product_type"}},[a("Radio",{attrs:{label:"api_buy"}},[t._v(t._s(t.$t("setmealadd_6")))]),a("Radio",{attrs:{label:"api_free"}},[t._v(t._s(t.$t("setmealadd_7")))]),a("Radio",{attrs:{label:"product_more"}},[t._v(t._s(t.$t("product_more")))])],1)],1),a("FormItem",{staticClass:"formitem",attrs:{label:t.$t("setmealadd_1")+":",prop:"product_name"}},[a("Input",{staticStyle:{width:"600px"},attrs:{clearable:""},model:{value:t.formValidate.product_name,callback:function(e){t.$set(t.formValidate,"product_name",e)},expression:"formValidate.product_name"}})],1),"product_more"!=t.formValidate.product_type?a("FormItem",{staticClass:"formitem",attrs:{label:t.$t("api_service")+":",prop:"product_key"}},[a("Select",{staticStyle:{width:"600px"},attrs:{clearable:""},model:{value:t.formValidate.product_key,callback:function(e){t.$set(t.formValidate,"product_key",e)},expression:"formValidate.product_key"}},t._l(t.allService,(function(e,r){return a("Option",{key:"service"+r+e.service,attrs:{value:e.service}},[t._v(t._s(e.service)+"-"+t._s(e.title))])})),1)],1):a("FormItem",{staticClass:"formitem",attrs:{label:t.$t("service_product")+":",prop:"product_key_more"}},[a("CheckboxGroup",{model:{value:t.formValidate.product_key_more,callback:function(e){t.$set(t.formValidate,"product_key_more",e)},expression:"formValidate.product_key_more"}},t._l(t.apiPayProductList,(function(e,r){return a("Checkbox",{key:"product"+r+e.id,attrs:{label:e.id+""}},[t._v("\n "+t._s(e.id)+". "+t._s(e.product_name)+" ("+t._s(e.amount)+t._s(t.$t("time"))+"/"+t._s(e.price)+t._s(t.$t("setmeallist_3"))+")\n ")])})),1)],1),"product_more"!=t.formValidate.product_type?a("FormItem",{staticClass:"formitem",attrs:{label:t.$t("setmealadd_2")+":",prop:"amount"}},[a("Input",{staticStyle:{width:"600px"},attrs:{clearable:""},model:{value:t.formValidate.amount,callback:function(e){t.$set(t.formValidate,"amount",e)},expression:"formValidate.amount"}}),t._v(t._s(t.$t("time"))+"\n ")],1):t._e(),a("FormItem",{staticClass:"formitem",attrs:{label:t.$t("setmealadd_3")+":",prop:"price"}},[a("Input",{staticStyle:{width:"600px"},attrs:{clearable:"",disabled:"api_free"==t.formValidate.product_type},model:{value:t.formValidate.price,callback:function(e){t.$set(t.formValidate,"price",e)},expression:"formValidate.price"}}),t._v(t._s(t.$t("setmeallist_3"))+"\n ")],1),a("FormItem",{staticClass:"formitem",attrs:{label:t.$t("setmealadd_4")+":",prop:"expire_time"}},[a("Select",{staticStyle:{width:"600px"},attrs:{clearable:""},model:{value:t.formValidate.expire_time,callback:function(e){t.$set(t.formValidate,"expire_time",e)},expression:"formValidate.expire_time"}},t._l(t.timeList,(function(e){return a("Option",{key:"time"+e.key,attrs:{value:e.key}},[t._v(t._s(e.name))])})),1)],1),a("FormItem",{staticClass:"formitem",attrs:{label:t.$t("setmealadd_5")+":",prop:"product_desc"}},[a("quill-editor",{staticClass:"inputbox",staticStyle:{width:"600px"},attrs:{options:t.quillOption},model:{value:t.formValidate.product_desc,callback:function(e){t.$set(t.formValidate,"product_desc",e)},expression:"formValidate.product_desc"}})],1),a("FormItem",{staticClass:"formitem",attrs:{label:t.$t("status")+":",prop:"product_status"}},[a("RadioGroup",{on:{"on-change":t.changeStatus},model:{value:t.formValidate.product_status,callback:function(e){t.$set(t.formValidate,"product_status",e)},expression:"formValidate.product_status"}},[a("Radio",{attrs:{label:"1"}},[t._v(t._s(t.$t("setmealadd_8")))]),a("Radio",{attrs:{label:"0"}},[t._v(t._s(t.$t("setmealadd_9")))])],1)],1),a("FormItem",{staticClass:"application__btn"},[t.updateId?a("Button",{attrs:{type:"primary"},on:{click:t.updateSetMeal}},[t._v(t._s(t.$t("setmealadd_15")))]):a("Button",{attrs:{type:"primary"},on:{click:t.addSetMeal}},[t._v(t._s(t.$t("save")))])],1)],1)],1)},s=[],i=a("a597"),o=a("c276"),d=a("953d"),l=(a("a753"),a("8096"),a("14e1"),a("9339")),c=a.n(l),p=a("f318"),u=a.n(p),m=a("5b47");c.a.register("modules/imageResize",u.a);var n={components:{quillEditor:d["quillEditor"]},data:function(){return{quillOption:m["a"],updateId:0,setmealTitle:"",access_token:Object(o["h"])(),allService:[],timeList:[],apiPayProductList:[],formValidate:{product_name:"",product_key:"",product_key_more:[],product_type:"api_buy",price:"0.00",amount:"100",expire_time:"",product_desc:" ",product_status:"1"},ruleValidate:{product_name:[{required:!0,message:this.$t("setmealadd_12"),trigger:"blur"}],product_key:[],product_type:[{required:!0,message:this.$t(""),trigger:"blur"}],price:[{required:!0,message:this.$t("setmealadd_14"),trigger:"blur"}],amount:[{message:this.$t("input_integer_warning"),pattern:/^\+?[1-9][0-9]*$/}],expire_time:[{required:!0,message:this.$t(""),trigger:"blur",type:"number"}],product_status:[{required:!0,message:this.$t(""),trigger:"blur"}]}}},created:function(){this.isUpdate(),this.updateId&&this.getProduct(this.updateId),this.getTimeList(),this.getAllService(),this.getPayProductListForMore()},methods:{isUpdate:function(){this.updateId=this.$route.query.id},getTimeList:function(){var t=this,e=this.access_token;Object(i["e"])({access_token:e}).then((function(e){t.timeList=e.data,t.formValidate.expire_time=t.timeList[0].key}))},getPayProductListForMore:function(){var t=this,e=this.access_token;Object(i["k"])({access_token:e}).then((function(e){t.apiPayProductList=e.data.items}))},getAllService:function(){var t=this,e=this.access_token;Object(i["n"])({access_token:e}).then((function(e){t.allService=e.data.items,t.updateId||(t.formValidate.product_key=t.allService[0].service)}))},getProduct:function(t){var e=this,a=new FormData;a.append("access_token",this.access_token),a.append("id",t),Object(i["l"])(a).then((function(t){e.formValidate=t.data.product,e.formValidate.product_status=e.formValidate.product_status+"",e.formValidate.amount=e.formValidate.amount+""}))},updateSetMeal:function(){var t=this;t.$refs["formValidate"].validate((function(e){e?t.changeSetMeal(i["r"],t.updateId):t.$Message.error(t.$t("input_error_please_check_again"))}))},addSetMeal:function(){var t=this;this.$refs["formValidate"].validate((function(e){e?t.changeSetMeal(i["b"]):t.$Message.error(t.$t("input_error_please_check_again"))}))},changeSetMeal:function(t,e){var a=this,r=this,s=new FormData;s.append("id",e),s.append("access_token",r.access_token),s.append("product_name",r.formValidate.product_name),s.append("product_key",r.formValidate.product_key),s.append("product_type",r.formValidate.product_type),s.append("price",r.formValidate.price),s.append("amount",r.formValidate.amount+""),s.append("expire_time",r.formValidate.expire_time),s.append("product_key_more",r.formValidate.product_key_more.join(",")),r.formValidate.product_desc&&s.append("product_desc",r.formValidate.product_desc),s.append("product_status",r.formValidate.product_status),t(s).then((function(t){200==t.ret&&t.data.id?(a.$Message.success(a.$t("add_successfully")),a.$router.push({name:"setMealList"})):200==t.ret&&t.data.isUpdate?(a.$Message.success(a.$t("update_successfully")),a.$router.push({name:"setMealList"})):a.$Message.error(t.msg)}))},changeType:function(t){this.formValidate.product_type=t,"api_free"==t&&(this.formValidate.price="0.00")},changeStatus:function(t){this.formValidate.product_status=t}}},_=n,f=(a("8832"),a("2877")),h=Object(f["a"])(_,r,s,!1,null,null,null);e["default"]=h.exports}}]); |