commodityManage.js 6.0 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageD/commodityManage/commodityManage"],{"0448":function(t,o,e){"use strict";(function(t,o){var n=e("47a9");e("abeb");n(e("3240"));var i=n(e("4ec1c"));t.__webpack_require_UNI_MP_PLUGIN__=e,o(i.default)}).call(this,e("3223")["default"],e("df3c")["createPage"])},"1a49":function(t,o,e){"use strict";e.d(o,"b",(function(){return i})),e.d(o,"c",(function(){return s})),e.d(o,"a",(function(){return n}));var n={"u-Input":function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u--input/u--input")]).then(e.bind(null,"7780"))},uCheckboxGroup:function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u-checkbox-group/u-checkbox-group")]).then(e.bind(null,"c952"))},uCheckbox:function(){return Promise.all([e.e("common/vendor"),e.e("uview-ui/components/u-checkbox/u-checkbox")]).then(e.bind(null,"5fa3"))},uToast:function(){return e.e("uview-ui/components/u-toast/u-toast").then(e.bind(null,"e7d9"))}},i=function(){var t=this.$createElement;this._self._c},s=[]},"47fd":function(t,o,e){"use strict";(function(t){Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var n={components:{GoodsInformation:function(){e.e("pageD/commodityManage/component/goodsInformation").then(function(){return resolve(e("8512"))}.bind(null,e)).catch(e.oe)},ScreenPopup:function(){e.e("pageD/commodityManage/component/screenPopup").then(function(){return resolve(e("baeb"))}.bind(null,e)).catch(e.oe)},DiscountsPopup:function(){e.e("pageD/commodityManage/component/discountsPopup").then(function(){return resolve(e("99e2"))}.bind(null,e)).catch(e.oe)},BatchDiscountPopup:function(){e.e("pageD/commodityManage/component/batchDiscountPopup").then(function(){return resolve(e("5859"))}.bind(null,e)).catch(e.oe)},agreePopup:function(){e.e("pageD/components/agreePopup").then(function(){return resolve(e("ed04"))}.bind(null,e)).catch(e.oe)}},data:function(){return{follow:"",status:"1",show:!1,discountsShow:!1,selectGoodsInformation:{},batch:!1,value:!1,batchPopup:!1,goodsList:[],keywords:"",source:"",selectedGoods:[],userId:"",agreeShow:!1,needDeleteGoods:{},title:""}},computed:{i18n:function(){return this.$t("index")},goodsLength:function(){var t=0;return this.goodsList.map((function(o){"down"!=o.status&&t++})),t}},onLoad:function(o){var e=this;t.getStorage({key:"user_info",success:function(t){var o=t.data;console.log("305",o),e.userId=o.merchant.id}})},watch:{selectedGoods:function(t){this.goodsLength==t.length?this.value=!0:this.value=!1}},methods:{deleteGoods:function(t){console.log(t),this.agreeShow=!0,this.title="是否删除商品",this.needDeleteGoods=t},closeDelete:function(o){var e=this;this.agreeShow=!1,o&&("是否下架商品"==this.title?this.goodsApi(this.needDeleteGoods,"down"):t.$u.http.post("/api/goods/merchant_goods_del",{merchant_goods_id:this.needDeleteGoods.id}).then((function(o){e.getCommodityList(e.follow),t.showToast({title:"商品已删除",icon:"none"})})))},goodsApi:function(o,e){var n=this;t.$u.http.post("/api/goods/modify_status",{merchant_goods_id:o.id,status:e}).then((function(o){t.showToast({title:"down"==e?"商品已下架":"商品已上架"}),n.getCommodityList(n.follow)}))},addAndRemove:function(t,o){"down"==o?(this.title="是否下架商品",this.agreeShow=!0,this.needDeleteGoods=t):this.goodsApi(t,o)},tabSwitch:function(t){this.follow=t,this.getCommodityList(t)},toPlatform:function(){t.navigateTo({url:"/pageD/platformProducts/platformProducts"})},checkboxChange:function(t){console.log(t)},search:function(t){this.getCommodityList()},openPopup:function(){this.show=!0},close:function(t){this.show=!1,t?(this.keywords=t.keywords,this.source=t.source,this.getCommodityList(t.status)):(this.keywords="",this.source="",this.getCommodityList())},allSelect:function(){var t=this;this.selectedGoods.length==this.goodsLength?this.selectedGoods=[]:this.goodsList.map((function(o){-1==t.selectedGoods.indexOf(o.id)&&"down"!=o.status&&t.selectedGoods.push(o.id)}))},batchDiscount:function(){this.batch=!this.batch,t.setNavigationBarTitle({title:"批量打折"})},cancelDiscount:function(){this.batch=!1,t.setNavigationBarTitle({title:"商品管理"}),this.selectedGoods=[]},wantDiscount:function(){0!=this.selectedGoods?this.batchPopup=!0:this.$refs.uToast.show({type:"default",title:"默认主题",message:"请选择至少一个商品"})},closeDiscountsPopup:function(o){var e=this;this.batchPopup?(this.batchPopup=!1,o&&(t.$u.http.post("/api/goods/discount",{merchant_goods_id:this.selectedGoods.join(","),mer_discount:o}).then((function(t){e.getCommodityList(e.follow)})),this.batch=!1,t.setNavigationBarTitle({title:"商品管理"}))):this.discountsShow&&(this.discountsShow=!1,o&&t.$u.http.post("/api/goods/discount",{merchant_goods_id:this.selectGoodsInformation.id,mer_discount:o}).then((function(t){e.getCommodityList(e.follow)})))},openDiscountsPopup:function(t){this.selectGoodsInformation=t,this.discountsShow=!0},toDetail:function(o){t.navigateTo({url:"/pageD/productDetails/productDetails?goodsId=".concat(o.id)})},getCommodityList:function(){var o=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";console.log("309",this.userId),t.$u.http.post("/api/goods/merchant_goods",{page:1,limit:10,merchant_id:this.userId,status:e,keywords:this.keywords,source:this.source}).then((function(t){o.goodsList=t.data}))}},mounted:function(){this.getCommodityList(),t.setNavigationBarTitle({title:"商品管理"})}};o.default=n}).call(this,e("df3c")["default"])},"4ec1c":function(t,o,e){"use strict";e.r(o);var n=e("1a49"),i=e("57bb");for(var s in i)["default"].indexOf(s)<0&&function(t){e.d(o,t,(function(){return i[t]}))}(s);e("7685");var c=e("828b"),u=Object(c["a"])(i["default"],n["b"],n["c"],!1,null,"8a9c30be",null,!1,n["a"],void 0);o["default"]=u.exports},"57bb":function(t,o,e){"use strict";e.r(o);var n=e("47fd"),i=e.n(n);for(var s in n)["default"].indexOf(s)<0&&function(t){e.d(o,t,(function(){return n[t]}))}(s);o["default"]=i.a},7685:function(t,o,e){"use strict";var n=e("933d"),i=e.n(n);i.a},"933d":function(t,o,e){}},[["0448","common/runtime","common/vendor"]]]);