1 line
9.7 KiB
JavaScript
1 line
9.7 KiB
JavaScript
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["seller/product/add"],{"060b":function(t,e,i){"use strict";i.r(e);var a=i("7ceb"),r=i("4e21");for(var n in r)["default"].indexOf(n)<0&&function(t){i.d(e,t,(function(){return r[t]}))}(n);i("bc92");var o=i("828b"),c=Object(o["a"])(r["default"],a["b"],a["c"],!1,null,null,null,!1,a["a"],void 0);e["default"]=c.exports},"4e21":function(t,e,i){"use strict";i.r(e);var a=i("9b96"),r=i.n(a);for(var n in a)["default"].indexOf(n)<0&&function(t){i.d(e,t,(function(){return a[t]}))}(n);e["default"]=r.a},"532d":function(t,e,i){"use strict";(function(t,e){var a=i("47a9");i("90c2");a(i("3240"));var r=a(i("060b"));t.__webpack_require_UNI_MP_PLUGIN__=i,e(r.default)}).call(this,i("3223")["default"],i("df3c")["createPage"])},"7ceb":function(t,e,i){"use strict";i.d(e,"b",(function(){return r})),i.d(e,"c",(function(){return n})),i.d(e,"a",(function(){return a}));var a={uniDrawer:function(){return i.e("components/uni-drawer/uni-drawer").then(i.bind(null,"2d81"))}},r=function(){var t=this,e=t.$createElement,i=(t._self._c,t.__("商品分类")),a=t.__("商品名称"),r=t.__("零售价"),n=t.__("市场价"),o=t.__("商品主图"),c=t.__("商品副图"),s=t.__("商品库存"),u=t.__("属性编号"),d=t.__("运费设置"),_=t.transports.length,m=t.__("店铺分类"),l=t.product_categorys.length,p=t.__("上下架"),g=t.__("发布商品"),f=t.__("一级分类"),h=t.__("二级分类"),y=t.__("三级分类");t.$mp.data=Object.assign({},{$root:{m0:i,m1:a,m2:r,m3:n,m4:o,m5:c,m6:s,m7:u,m8:d,g0:_,m9:m,g1:l,m10:p,m11:g,m12:f,m13:h,m14:y}})},n=[]},"9b96":function(t,e,i){"use strict";(function(t){var a=i("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r,n=a(i("7ca3")),o=i("8f59");function c(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function s(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?c(Object(i),!0).forEach((function(e){(0,n.default)(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):c(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var u=(r={data:function(){return{data_info:{order:{item:{}},comment_image:[]},transports:[],id:0,product_categorys:[],index:0,rightDrawerVisible:!1,rightDrawerVehicle:!1,tapindex:1,categorys:[],category_id:0,deep:0,onecategory:"",twocategory:"",threecategory:"",commodity_name:"",product_name:"",item_unit_price:"",item_market_price:"",item_quantity:"",item_number:"",product_category_id:0,transport_type_id:0,product_detail:"",item_enable:1001,parent_id:0,img:"",item_image_default:""}},computed:(0,o.mapState)(["Config","StateCode","notice","plantformInfo","shopInfo","userInfo","hasLogin"]),components:{uniDrawer:function(){i.e("components/uni-drawer/uni-drawer").then(function(){return resolve(i("2d81"))}.bind(null,i)).catch(i.oe)},uniList:function(){i.e("components/uni-list/uni-list").then(function(){return resolve(i("b193"))}.bind(null,i)).catch(i.oe)},uniListItem:function(){i.e("components/uni-list-item/uni-list-item").then(function(){return resolve(i("117b"))}.bind(null,i)).catch(i.oe)}}},(0,n.default)(r,"computed",(0,o.mapState)(["Config","StateCode","notice","plantformInfo","shopInfo","userInfo","hasLogin"])),(0,n.default)(r,"onLoad",(function(e){t.setNavigationBarTitle({title:this.__("发布商品")}),this.setData({options:e,order_id:e.on}),this.getfreightArrangement(),this.getProductCategory()})),(0,n.default)(r,"methods",s(s({},(0,o.mapMutations)(["login","logout","getPlantformInfo","forceUserInfo","getUserInfo"])),{},{getfreightArrangement:function(){var t=this;t.$.request({url:t.Config.URL.seller.Store_TransportType,data:{},success:function(e,i,a,r){200==i&&t.setData({transports:e.items})}})},getProductCategory:function(){var t=this;t.$.request({url:t.Config.URL.seller.Store_ProductCategory,data:{},success:function(e,i,a,r){200==i&&t.setData({product_categorys:e.items})}})},transportChange:function(t){var e=t.detail.value;this.setData({id:e,transport_type_id:this.transports[e].transport_type_id})},categorysChange:function(t){var e=t.detail.value;this.setData({index:t.detail.value,product_category_id:this.product_categorys[e].store_product_cat_id})},show:function(){this.setData({category_id:0}),this.getcategorys(),this.rightDrawerVisible=!0},onInputProductname:function(t){this.setData({product_name:t.detail.value})},onInputUnitprice:function(t){this.setData({item_unit_price:t.detail.value})},onInputMarketprice:function(t){this.setData({item_market_price:t.detail.value})},onInputQuantity:function(t){this.setData({item_quantity:t.detail.value})},onInputNumber:function(t){this.setData({item_number:t.detail.value})},onInputProductdetail:function(t){this.setData({product_detail:t.detail.value})},getCate:function(t){switch(this.tapindex){case 1:this.setData({deep:this.tapindex,category_id:t.currentTarget.dataset.category_id,onecategory:t.currentTarget.dataset.category_name,tapindex:2}),this.getcategorys();break;case 2:this.setData({deep:this.tapindex,category_id:t.currentTarget.dataset.category_id,twocategory:t.currentTarget.dataset.category_name,tapindex:3}),this.getcategorys();break;case 3:this.setData({threecategory:t.currentTarget.dataset.category_name,category_id:t.currentTarget.dataset.category_id,tapindex:1,deep:1,rightDrawerVisible:!1}),this.commodity_name=this.onecategory+">"+this.twocategory+">"+this.threecategory;break}},onecategorys:function(){this.setData({deep:1,category_id:0,tapindex:1}),this.getcategorys()},release:function(){this.$.isNull(this.category_id)?this.$.alert(this.__("请选择商品分类")):this.$.isNull(this.product_name)?this.$.alert(this.__("请填写商品名称")):this.$.isNull(this.item_unit_price)?this.$.alert(this.__("请填写商品市场价")):this.$.isNull(this.item_market_price)?this.$.alert(this.__("请填写商品销售价")):this.$.isNull(this.item_quantity)?this.$.alert(this.__("请填写商品库存")):this.addProduct()},addProduct:function(){var t=this,e={assistsIndex:[],brand_id:0,assists:{},productDetail:{product_detail:"<p><br></p>",product_tags:[]},productBase:{product_number:"",product_name:t.product_name,product_sale_time:"",product_video:"",kind_id:1201,product_inventory_lock:1001,product_state_id:1001,transport_type_id:t.transport_type_id?t.transport_type_id:t.transports[0].transport_type_id,store_category_ids:[].push(t.product_category_id),product_service:"",product_param:"",product_detail:t.product_detail,product_tips:"",category_id:t.category_id,text_category_id:t.category_name},productSpec:JSON.stringify([]),valid:{}},i=[{category_id:t.category_id,main_color_img:t.item_image_default,color_img:t.data_info.comment_image,item_enable:t.item_enable,item_is_default:!1,item_market_price:t.item_market_price,item_unit_price:t.item_unit_price,item_quantity:t.item_quantity,product_spec:JSON.stringify([]),item_number:t.item_number}],a={productObj:JSON.stringify(e),productItems:JSON.stringify(i)};t.$.request({url:t.Config.URL.seller.add_product,method:"POST",data:a,success:function(e,i,a,r){200==i&&(t.$.alert(t.__("商品添加成功")),setTimeout((function(){t.$.navigateTo({url:"/seller/product/lists"})}),1500))}})},getcategorys:function(t){var e=this,i={deep:e.deep};0!==e.category_id&&(i.category_id=e.category_id),e.$.request({url:e.Config.URL.product.category,data:i,success:function(t,i,a,r){200==i&&(0==t.items.length?(3==e.deep?e.commodity_name=e.onecategory+">"+e.twocategory+">"+e.threecategory:2==e.deep?e.commodity_name=e.onecategory+">"+e.twocategory:1==e.deep&&(e.commodity_name=e.onecategory),e.setData({tapindex:1,deep:1,rightDrawerVisible:!1})):e.setData({categorys:t.items}))}})},switchChange:function(t){t.target.value?this.setData({item_enable:1001}):this.setData({item_enable:1002})},ImgTap:function(t){var e=[];for(var i in this.data_info.comment_image)e.push(this.data_info.comment_image[i]);var a=t.target.dataset.src;this.$.previewImage({current:a,urls:e})},ImgTapDefault:function(t){var e=[];e.push(this.item_image_default);var i=t.target.dataset.src;this.$.previewImage({current:i,urls:e})},delImg:function(t){var e=this.data_info,i=this;i.$.confirm(i.__("是否放弃上传本张图片?"),(function(a){if(a.confirm){for(var r=[],n=0;n<e.comment_image.length;n++)if(n!=t.target.dataset.index){var o=e.comment_image[n];r.push(o)}e.comment_image=r,i.setData({data_info:e})}}),!0)},upImgsDefault:function(t){var e=this;e.$.chooseImage({count:1,sizeType:["compressed"],success:function(t){e.$.showLoading();var i=t.tempFilePaths;e.$.uploadFile({url:e.Config.URL.upload,method:"POST",filePath:i[0],name:"upfile",success:function(t){e.$.hideLoading();var i=e.$.parseJSON(t.data),a=i.data.url;e.setData({item_image_default:a})},fail:function(t){e.$.hideLoading()},complete:function(t){e.$.hideLoading()}})},fail:function(t){e.$.hideLoading()},complete:function(t){e.$.hideLoading()}})},upImgs:function(t){var e=this,i=(t.currentTarget.dataset.order_id,this.data_info);i.comment_image&&5==i.comment_image.length?e.$.alert(e.__("最多上传5张图片!")):e.$.chooseImage({count:1,sizeType:["compressed"],success:function(t){e.$.showLoading();var a=t.tempFilePaths;e.$.uploadFile({url:e.Config.URL.upload,method:"POST",filePath:a[0],name:"upfile",success:function(t){e.$.hideLoading();var a=e.$.parseJSON(t.data),r=a.data.url;i.comment_image.push(r),e.setData({data_info:i})},fail:function(t){e.$.hideLoading()},complete:function(t){e.$.hideLoading()}})},fail:function(t){e.$.hideLoading()},complete:function(t){e.$.hideLoading()}})},bindChange:function(t){}})),r);e.default=u}).call(this,i("df3c")["default"])},bc92:function(t,e,i){"use strict";var a=i("ffe3"),r=i.n(a);r.a},ffe3:function(t,e,i){t.exports={theme_bg:"#f30213"}}},[["532d","common/runtime","common/vendor"]]]); |