2 lines
468 KiB
JavaScript
2 lines
468 KiB
JavaScript
|
|
(function(){"use strict";var t={346:function(t,e,a){Object.defineProperty(e,"B",{value:!0}),e.A=void 0,a(4114);var i=a(9252),s=a(9662);e.A={name:"AccountProductNew",data(){const t=(t,e,a)=>{"string"!==typeof e||0!==e.trim().length?a():a(new Error("内容不能全是空格"))},e=t=>{if("string"!==typeof t||0===t.length)return!1;const e=/[\u{1F300}-\u{1FAFF}]|[\u{1F1E6}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{FE0F}]|[\u{200D}]|[\u{20E3}]/u;return e.test(t)},a=(t,a,i)=>{"string"===typeof a&&e(a)?i(new Error("商品名称不能包含表情符号")):i()};return{submitting:!1,form:{name:"",type:0,coin:"",description:"",image:"",state:0,shopId:null},rules:{name:[{required:!0,message:"请输入商品名称",trigger:"blur"},{validator:t,trigger:"blur"},{validator:a,trigger:"blur"},{min:1,max:30,message:"商品名称长度在 2 到 30 个字符",trigger:"blur"}],type:[{required:!0,message:"请选择商品类型",trigger:"change"}],coin:[{required:!0,message:"请选择挖矿币种",trigger:"change"}],description:[{required:!0,message:"请输入商品描述",trigger:"blur"},{validator:t,trigger:"blur"},{min:1,max:100,message:"商品描述长度在 1 到 100 个字符",trigger:"blur"}],image:[],state:[{required:!0,message:"请选择商品状态",trigger:"change"}]}}},computed:{coinOptions(){return i.coinList||[{value:"nexa",label:"NEXA"},{value:"rxd",label:"RXD"},{value:"dgbo",label:"DGBO"},{value:"dgbq",label:"DGBQ"},{value:"dgbs",label:"DGBS"},{value:"alph",label:"ALPH"},{value:"enx",label:"ENX"},{value:"grs",label:"GRS"},{value:"mona",label:"MONA"}]}},created(){const t=this.$route.query.shopId;t&&(this.form.shopId=Number(t))},methods:{async fetchAddProduct(t){const e=await(0,s.createProduct)(t);!e||0!==e.code&&200!==e.code?this.$message({message:e&&e.msg?e.msg:"创建失败",type:"error",showClose:!0}):(this.$message({message:"商品创建成功",type:"success",showClose:!0}),this.$router.push("/account/products"))},async handleSubmit(){try{const t=await this.$refs.productForm.validate();if(!t)return;if(!this.form.shopId)return void this.$message({message:"缺少店铺ID,请从我的店铺页面进入",type:"error",showClose:!0});this.submitting=!0,this.fetchAddProduct(this.form)}catch(t){console.error("创建商品失败:",t)}finally{this.submitting=!1}},handleReset(){this.$refs.productForm.resetFields();const t=this.$route.query.shopId;t&&(this.form.shopId=Number(t))},handleCancel(){this.$router.push("/account/shops")}}}},379:function(t,e){e.Yp=e.XX=void 0;e.XX=function(){var t=this,e=t._self._c;return e("div",{staticClass:"account-products"},[e("div",{staticClass:"toolbar"},[t._m(0),e("div",{staticClass:"right-area"},[e("el-select",{staticClass:"mr-12",staticStyle:{width:"140px"},attrs:{placeholder:"矿机种类",size:"small"},on:{change:t.handleTypeChange},model:{value:t.listParams.type,callback:function(e){t.$set(t.listParams,"type",e)},expression:"listParams.type"}},[e("el-option",{attrs:{label:"ASIC",value:0}}),e("el-option",{attrs:{label:"GPU",value:1}})],1),e("el-input",{staticClass:"mr-12",staticStyle:{width:"280px"},attrs:{placeholder:t.searchPlaceholder,size:"small",clearable:""},on:{clear:t.handleClear},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleSearch.apply(null,arguments)}},model:{value:t.searchKeyword,callback:function(e){t.searchKeyword=e},expression:"searchKeyword"}}),e("el-button",{attrs:{type:"primary",size:"small"},on:{click:t.handleSearch}},[t._v("搜索")]),e("el-button",{staticClass:"ml-8",attrs:{size:"small"},on:{click:t.handleReset}},[t._v("重置")])],1)]),t.payTypes&&t.payTypes.length?e("div",{staticClass:"paytypes-bar"},[e("span",{staticClass:"pt-label"},[t._v("支持结算方式:")]),e("div",{staticClass:"pt-icons"},t._l(t.payTypes,function(a,i){return e("el-tooltip",{key:i,attrs:{content:t.formatPayTypeHead(a),placement:"top","open-delay":80}},[e("img",{staticClass:"paytype-icon",attrs:{src:t.getPayImage(a),alt:t.formatPayTypeHead(a)}})])}),1)]):t._e(),0===t.listParams.type&&t.payTypes&&t.payTypes.length?e("div",
|
|||
|
|
//# sourceMappingURL=app.d58df3d3.js.map
|