1 line
9.7 KiB
JavaScript
1 line
9.7 KiB
JavaScript
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["seller/product/add"],{"1d14":function(t,e,a){"use strict";(function(t,e){var i=a("47a9");a("ec76");i(a("3240"));var r=i(a("84c6"));t.__webpack_require_UNI_MP_PLUGIN__=a,e(r.default)}).call(this,a("3223")["default"],a("df3c")["createPage"])},"52d7":function(t,e,a){"use strict";a.d(e,"b",(function(){return r})),a.d(e,"c",(function(){return n})),a.d(e,"a",(function(){return i}));var i={uniDrawer:function(){return a.e("components/uni-drawer/uni-drawer").then(a.bind(null,"efd5"))}},r=function(){var t=this,e=t.$createElement,a=(t._self._c,t.__("商品分类")),i=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:a,m1:i,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=[]},"83a5":function(t,e,a){"use strict";(function(t){var i=a("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r,n=i(a("7ca3")),o=a("8f59");function c(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function s(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?c(Object(a),!0).forEach((function(e){(0,n.default)(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):c(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,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(){a.e("components/uni-drawer/uni-drawer").then(function(){return resolve(a("efd5"))}.bind(null,a)).catch(a.oe)},uniList:function(){a.e("components/uni-list/uni-list").then(function(){return resolve(a("14fd"))}.bind(null,a)).catch(a.oe)},uniListItem:function(){a.e("components/uni-list-item/uni-list-item").then(function(){return resolve(a("5627"))}.bind(null,a)).catch(a.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,a,i,r){200==a&&t.setData({transports:e.items})}})},getProductCategory:function(){var t=this;t.$.request({url:t.Config.URL.seller.Store_ProductCategory,data:{},success:function(e,a,i,r){200==a&&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:{}},a=[{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}],i={productObj:JSON.stringify(e),productItems:JSON.stringify(a)};t.$.request({url:t.Config.URL.seller.add_product,method:"POST",data:i,success:function(e,a,i,r){200==a&&(t.$.alert(t.__("商品添加成功")),setTimeout((function(){t.$.navigateTo({url:"/seller/product/lists"})}),1500))}})},getcategorys:function(t){var e=this,a={deep:e.deep};0!==e.category_id&&(a.category_id=e.category_id),e.$.request({url:e.Config.URL.product.category,data:a,success:function(t,a,i,r){200==a&&(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 a in this.data_info.comment_image)e.push(this.data_info.comment_image[a]);var i=t.target.dataset.src;this.$.previewImage({current:i,urls:e})},ImgTapDefault:function(t){var e=[];e.push(this.item_image_default);var a=t.target.dataset.src;this.$.previewImage({current:a,urls:e})},delImg:function(t){var e=this.data_info,a=this;a.$.confirm(a.__("是否放弃上传本张图片?"),(function(i){if(i.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,a.setData({data_info:e})}}),!0)},upImgsDefault:function(t){var e=this;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),i=a.data.url;e.setData({item_image_default:i})},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,a=(t.currentTarget.dataset.order_id,this.data_info);a.comment_image&&5==a.comment_image.length?e.$.alert(e.__("最多上传5张图片!")):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),r=i.data.url;a.comment_image.push(r),e.setData({data_info:a})},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,a("df3c")["default"])},"84c6":function(t,e,a){"use strict";a.r(e);var i=a("52d7"),r=a("b01f");for(var n in r)["default"].indexOf(n)<0&&function(t){a.d(e,t,(function(){return r[t]}))}(n);a("a908");var o=a("828b"),c=Object(o["a"])(r["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],void 0);e["default"]=c.exports},a908:function(t,e,a){"use strict";var i=a("fa29"),r=a.n(i);r.a},b01f:function(t,e,a){"use strict";a.r(e);var i=a("83a5"),r=a.n(i);for(var n in i)["default"].indexOf(n)<0&&function(t){a.d(e,t,(function(){return i[t]}))}(n);e["default"]=r.a},fa29:function(t,e,a){t.exports={theme_bg:"#f30213"}}},[["1d14","common/runtime","common/vendor"]]]); |