2 lines
4.7 KiB
JavaScript
2 lines
4.7 KiB
JavaScript
"use strict";const e=require("../../common/vendor.js"),o=require("../../api/goods.js"),n=require("../../api/request.js");if(!Array){(e.resolveComponent("nut-input")+e.resolveComponent("nut-form-item")+e.resolveComponent("nut-icon")+e.resolveComponent("nut-textarea")+e.resolveComponent("nut-radio")+e.resolveComponent("nut-radio-group")+e.resolveComponent("shmily-drag-image")+e.resolveComponent("nut-button")+e.resolveComponent("nut-form")+e.resolveComponent("nut-picker")+e.resolveComponent("nut-popup")+e.resolveComponent("nut-cascader"))()}Math||((()=>"../../uni_modules/nutui-uni/components/input/input.js")+(()=>"../../uni_modules/nutui-uni/components/formitem/formitem.js")+(()=>"../../uni_modules/nutui-uni/components/icon/icon.js")+(()=>"../../uni_modules/nutui-uni/components/textarea/textarea.js")+(()=>"../../uni_modules/nutui-uni/components/radio/radio.js")+(()=>"../../uni_modules/nutui-uni/components/radiogroup/radiogroup.js")+(()=>"../../uni_modules/shmily-drag-image/components/shmily-drag-image/shmily-drag-image.js")+(()=>"../../uni_modules/nutui-uni/components/button/button.js")+(()=>"../../uni_modules/nutui-uni/components/form/form.js")+(()=>"../../uni_modules/nutui-uni/components/picker/picker.js")+(()=>"../../uni_modules/nutui-uni/components/popup/popup.js")+(()=>"../../uni_modules/nutui-uni/components/cascader/cascader.js"))();const t={__name:"goodsAdd",setup(t){const a=()=>{e.index.scanCode({onlyFromCamera:!0,success:e=>{console.log(e),r.goods_no=e.result},fail:()=>{e.index.showToast({icon:"none",title:"扫码失败"})}})},l=e.reactive({}),i=e.ref(!1),u=e.ref(!1),s=e.ref([]),d=e.ref([]),r=e.reactive({goods_name:"",goods_no:"",goods_price:"",goods_stock:"",content:"",details_content:"",status:"10",images:[],add_person:"",degree_id:0,degree_name:"未选择",type_id:0,type_name:"未选择",brand_id:0,brand_name:"未选择",product_id:0,product_name:"未选择"}),m=(...e)=>{},p=()=>{console.log("form====>",r),o.fetchGoodsAdd(r).then((o=>{e.index.showToast({icon:"none",title:"新增商品成功"}),setTimeout((()=>{e.index.navigateBack({delta:1})}),500)}))},c=e=>{console.log(e),r.type_id=0,r.type_name="",r.brand_id=0,r.brand_name="",r.product_id=0,r.product_name="",e.length>=1&&null!==e[0]&&(r.type_id=e[0].value,r.type_name=e[0].text),e.length>=2&&null!==e[1]&&(r.brand_id=e[1].value,r.brand_name=e[1].text),e.length>=3&&null!==e[2]&&(r.product_id=e[2].value,r.product_name=e[2].text)},_=()=>{r.degree_id=s.value[0],l.degree_list.forEach((e=>{e.degree_id===r.degree_id&&(r.degree_name=e.degree_name)})),u.value=!1};e.onMounted((()=>{o.fetchFilterParmas(1).then((e=>{Object.assign(l,e),l.degree_list.unshift({degree_id:0,degree_name:"未选择"}),console.log("filter_params",l)}))}));const g=()=>{var o;e.index.chooseImage({count:9-((null==(o=r.image)?void 0:o.length)||0),sourceType:["album","camera"],success:o=>{o.tempFiles.forEach((o=>{e.index.uploadFile({url:n.getUploadImageUrl(),filePath:o.path,name:"iFile",formData:{group_id:1},success:e=>{let o=JSON.parse(e.data).data;r.images.push({id:parseInt(o.file_id),file_path:o.file_path})}})}))}})};return(o,n)=>({a:e.o((e=>r.goods_name=e)),b:e.p({placeholder:"请输入名称",type:"text",modelValue:r.goods_name}),c:e.p({label:"名称"}),d:e.o(a),e:e.p({name:"scan2",size:"30","custom-color":"#000000"}),f:e.o((e=>r.goods_no=e)),g:e.p({placeholder:"请输入串号",type:"text",modelValue:r.goods_no}),h:e.p({label:"串号"}),i:e.o((e=>r.goods_price=e)),j:e.p({placeholder:"请输入售价",type:"nubmer",modelValue:r.goods_price}),k:e.p({label:"售价"}),l:e.o((e=>r.content=e)),m:e.p({autosize:!0,placeholder:"请输入说明",type:"text",modelValue:r.content}),n:e.p({label:"说明"}),o:e.o((e=>r.details_content=e)),p:e.p({autosize:!0,placeholder:"请输入介绍",type:"text",modelValue:r.details_content}),q:e.p({label:"介绍"}),r:e.p({label:"10"}),s:e.p({label:"20"}),t:e.o((e=>r.status=e)),v:e.p({direction:"horizontal",modelValue:r.status}),w:e.p({label:"状态"}),x:e.t(r.degree_name),y:e.o((e=>u.value=!0)),z:e.t(r.type_name),A:e.t(r.brand_name),B:e.t(r.product_name),C:e.o((e=>i.value=!0)),D:e.o((e=>r.images=e)),E:e.p({number:9,"add-image":g,keyName:"file_path",modelValue:r.images}),F:e.o(p),G:e.p({type:"primary",block:!0}),H:e.o(_),I:e.o((e=>u.value=!1)),J:e.o((e=>s.value=e)),K:e.p({columns:l.degree_list,"field-names":{text:"degree_name",value:"degree_id"},title:"选择成色",modelValue:s.value}),L:e.o((e=>u.value=e)),M:e.p({position:"bottom","safe-area-inset-bottom":!0,visible:u.value}),N:e.o(m),O:e.o(c),P:e.o((e=>i.value=e)),Q:e.o((e=>d.value=e)),R:e.p({title:"机型选择","text-key":"label","value-key":"value","title-ellipsis":!1,"children-key":"children",options:l.drop_down_options,visible:i.value,modelValue:d.value})})}},a=e._export_sfc(t,[["__scopeId","data-v-22116fcf"]]);wx.createPage(a);
|