chunk-0d12.bf0229a0.js 20 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-0d12"],{"2JsF":function(t,e,a){},"7sgb":function(t,e,a){"use strict";a.r(e);var i=a("gDS+"),o=a.n(i),r=a("P2sY"),s=a.n(r),n=a("xA6U"),l=a("QbLZ"),u=a.n(l),c=a("t3Un"),p=a("Qyje"),d=a.n(p);var m=a("BiX5"),g=a("iXUw"),h=a("7Qib"),f=a("Mz3J"),v={name:"GoodsList",components:{BackToTop:m.a,Pagination:f.a},filters:{formatGmt:function(t){return null==t||""===t?"无":Object(g.formatDateAndTime)(t)}},data:function(){return{list:[],total:0,listLoading:!0,dialogFormVisible:!1,GroupShopStatusMap:[{value:0,name:"冻结"},{value:1,name:"活动"}],listQuery:{page:1,limit:20,spuName:void 0,status:void 0,id:void 0},dialogTitleMap:{create:"创建团购商品",update:"修改团购商品"},dialogStatus:"create",rules:{},dataForm:{spuId:void 0,gmtStart:void 0,gmtEnd:void 0,minimumNumber:1,automaticRefund:1,groupShopSkus:[],skuList:[]},goodsOptions:[],goodsOption:void 0,groupShopUpdateSkuPriceDialog:!1,skuForm:{}}},created:function(){this.getList()},methods:{getList:function(){var t=this;this.listLoading=!0,function(t){return Object(c.a)({method:"get",params:u()({_gp:"admin.groupShop",_mt:"queryGroupShop"},t)})}(this.listQuery).then(function(e){e.data.data.items.forEach(function(t){t.groupShopSkuDTOList.forEach(function(t){t.price=t.price/100,t.originalPrice=t.originalPrice/100,t.vipPrice=t.vipPrice/100,t.skuGroupShopPrice=t.skuGroupShopPrice/100})}),t.list=e.data.data.items,t.total=e.data.data.total,t.listLoading=!1}).catch(function(){t.list=[],t.total=0,t.listLoading=!1})},handleFilter:function(){this.listQuery.page=1,this.getList()},refreshDataForm:function(){this.dataForm={spuId:void 0,gmtStart:void 0,gmtEnd:void 0,minimumNumber:1,automaticRefund:1,skuList:[],groupShopSkus:[]}},openSpuCreateDialog:function(){this.refreshDataForm(),this.refreshGoodsOptions(),this.dialogStatus="create",this.goodsOption=void 0,this.dialogFormVisible=!0},openSpuUpdateDialog:function(t){this.refreshDataForm(),this.refreshGoodsOptions(),this.dialogStatus="update",this.goodsOption="G_"+t.spuId,this.dataForm=s()({},{id:t.id,spuId:t.spuId,automaticRefund:t.automaticRefund,gmtStart:new Date(t.gmtStart),gmtEnd:new Date(t.gmtEnd),minimumNumber:t.minimumNumber,skuList:t.groupShopSkuDTOList,groupShopSkus:[]}),this.dialogFormVisible=!0},handleDelete:function(t){var e=this;this.$confirm("此操作将永久删除商品--"+t.title+"--, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){(function(t){return Object(c.a)({method:"post",params:{_gp:"admin.groupShop",_mt:"deleteGroupShopSpu",id:t}})})(t.id).then(function(a){e.$notify.success({title:"成功",message:"删除成功"});var i=e.list.indexOf(t);e.list.splice(i,1)}).catch(function(t){e.$notify.error({title:"失败",message:t.data.errmsg})})}).catch(function(){return!1})},refreshGoodsOptions:function(){var t=this;0===this.goodsOptions.length&&Object(n.g)().then(function(e){t.goodsOptions=Object(h.a)(e.data.data)})},chooseGoods:function(t){var e=this;if(void 0!==t){var a=t[t.length-1];if(void 0===this.goodsOption||null===this.goodsOption||this.goodsOption.length<=3)return this.$notify.error({title:"提示",message:"请选择商品"}),!1;this.dataForm.spuId=a.substring(2),Object(n.c)(this.dataForm.spuId).then(function(t){t.data.data.skuList.forEach(function(t){t.price=t.price/100,t.originalPrice=t.originalPrice/100,t.vipPrice=t.vipPrice/100,t.skuGroupShopPrice=t.price}),e.dataForm.skuList=t.data.data.skuList,console.log(e.dataForm.skuList)}).catch(function(t){e.$notify.error({title:"失败",message:t.data.errmsg+",请重新选择"})})}},createOrUpdateData:function(){var t=this;if(null===this.dataForm.spuId||void 0===this.dataForm.spuId||null===this.dataForm.skuList||void 0===this.dataForm.skuList||0===this.dataForm.skuList.length)return this.$notify.error({title:"提示",message:"请选择商品"}),!1;if(null===this.dataForm.gmtStart||void 0===this.dataForm.gmtStart||null===this.dataForm.gmtEnd||void 0===this.dataForm.gmtEnd||this.dataForm.gmtStart>=this.dataForm.gmtEnd)return this.$notify.error({title:"提示",message:"请选择活动时间,且开始时间小于结束时间"}),!1;for(var e=0;e<this.dataForm.skuList.length;e++){var a={};a.skuId=this.dataForm.skuList[e].id,a.skuGroupShopPrice=100*this.dataForm.skuList[e].skuGroupShopPrice,this.dataForm.groupShopSkus.push(a)}this.dataForm.groupShopSkuList=o()(this.dataForm.groupShopSkus);var i={id:this.dataForm.id,gmtStart:this.dataForm.gmtStart.getTime(),gmtEnd:this.dataForm.gmtEnd.getTime(),groupShopSkuList:this.dataForm.groupShopSkuList,minimumNumber:this.dataForm.minimumNumber,spuId:this.dataForm.spuId,automaticRefund:this.dataForm.automaticRefund};"create"===this.dialogStatus?function(t){return Object(c.a)({method:"post",data:d.a.stringify(u()({_gp:"admin.groupShop",_mt:"addGroupShopSpu"},t))})}(i).then(function(e){t.$notify.success({title:"成功",message:"团购商品录入成功!"}),t.getList()}).catch(function(e){t.$notify.error({title:"提示",message:e.data.errmsg})}):"update"===this.dialogStatus&&function(t){return Object(c.a)({method:"post",data:d.a.stringify(u()({_gp:"admin.groupShop",_mt:"editGroupShopSpu"},t))})}(i).then(function(e){t.$notify.success({title:"成功",message:"团购商品更新成功!"}),t.getList()}).catch(function(e){t.$notify.error({title:"提示",message:e.data.errmsg})}),this.dialogFormVisible=!1},openSkuGroupShopPriceUpdateDialog:function(t){this.skuForm=void 0,this.groupShopUpdateSkuPriceDialog=!0,this.skuForm=t},skuGroupShopUpdate:function(t){this.groupShopUpdateSkuPriceDialog=!1}}},b=(a("Hcyd"),a("KHd+")),_=Object(b.a)(v,function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"app-container"},[a("div",{staticClass:"filter-container"},[a("el-input",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{clearable:"",placeholder:"请输入商品名称"},model:{value:t.listQuery.spuName,callback:function(e){t.$set(t.listQuery,"spuName",e)},expression:"listQuery.spuName"}}),t._v(" "),a("el-input",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{clearable:"",placeholder:"请输入团购ID"},model:{value:t.listQuery.id,callback:function(e){t.$set(t.listQuery,"id",e)},expression:"listQuery.id"}}),t._v(" "),a("el-select",{staticClass:"filter-item",staticStyle:{width:"200px"},attrs:{clearable:"",placeholder:"请选择团购状态"},model:{value:t.listQuery.status,callback:function(e){t.$set(t.listQuery,"status",e)},expression:"listQuery.status"}},t._l(t.GroupShopStatusMap,function(t,e){return a("el-option",{key:e,attrs:{label:t.name,value:t.value}})})),t._v(" "),a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["operation:groupShop:query"],expression:"['operation:groupShop:query']"}],staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-search"},on:{click:t.handleFilter}},[t._v("查找")]),t._v(" "),a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["operation:groupShop:create"],expression:"['operation:groupShop:create']"}],staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-edit"},on:{click:t.openSpuCreateDialog}},[t._v("添加")])],1),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],attrs:{data:t.list,size:"small","element-loading-text":"正在查询中。。。",border:"",fit:"","highlight-current-row":""}},[a("el-table-column",{attrs:{type:"expand"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-form",{staticClass:"table-expand",attrs:{"label-position":"left"}},[a("el-form-item",{attrs:{label:"商品单位"}},[a("span",[t._v(t._s(e.row.unit))])]),t._v(" "),a("el-form-item",{attrs:{label:"类目ID"}},[a("span",[t._v(t._s(e.row.categoryId))])]),t._v(" "),a("el-form-item",{attrs:{label:"商品sku属性"}},[a("el-table",{attrs:{data:e.row.groupShopSkuDTOList}},[a("el-table-column",{attrs:{align:"center",prop:"skuId",label:"skuId"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",prop:"title",label:"skuTitle"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",prop:"skuGroupShopPrice",label:"团购价格(元)"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",prop:"stock",label:"库存"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",prop:"originalPrice",label:"原始价格(元)"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",prop:"price",label:"售卖价格(元)"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",prop:"vipPrice",label:"会员价格(元)"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",prop:"freezeStock",label:"冻结库存"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",prop:"barCode",label:"国际条码"}})],1)],1)],1)]}}])}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"团购ID",prop:"id"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"商品(SPU)ID",prop:"spuId"}}),t._v(" "),a("el-table-column",{attrs:{align:"center","min-width":"100",label:"名称",prop:"title"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",property:"img",label:"图片"},scopedSlots:t._u([{key:"default",fn:function(t){return[a("img",{attrs:{src:t.row.img,width:"40"}})]}}])}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"到期人数未满,是否自动退款",prop:"status"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-tag",{attrs:{type:1==e.row.automaticRefund?"success":"error"}},[t._v(t._s(1==e.row.automaticRefund?"退款":"发货"))])]}}])}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"活动状态",prop:"status"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-tag",{attrs:{type:1==e.row.status?"success":"error"}},[t._v(t._s(1==e.row.status?"进行":"冻结"))])]}}])}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"团购开始时间",prop:"gmtStart",width:"85"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(t._s(t._f("formatGmt")(e.row.gmtStart)))]}}])}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"团购结束时间",prop:"gmtEnd",width:"85"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(t._s(t._f("formatGmt")(e.row.gmtEnd)))]}}])}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"当前人数",prop:"alreadyBuyNumber"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"目标人数",prop:"minimumNumber"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"操作",width:"200","class-name":"small-padding fixed-width"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["operation:groupShop:edit"],expression:"['operation:groupShop:edit']"},{name:"show",rawName:"v-show",value:0==e.row.status,expression:"scope.row.status == 0"}],attrs:{type:"primary",size:"mini"},on:{click:function(a){t.openSpuUpdateDialog(e.row)}}},[t._v("编辑")]),t._v(" "),a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["operation:groupShop:delete"],expression:"['operation:groupShop:delete']"},{name:"show",rawName:"v-show",value:0==e.row.status,expression:"scope.row.status == 0"}],attrs:{type:"danger",size:"mini"},on:{click:function(a){t.handleDelete(e.row)}}},[t._v("删除")])]}}])})],1),t._v(" "),a("pagination",{directives:[{name:"show",rawName:"v-show",value:t.total>0,expression:"total>0"}],attrs:{total:t.total,page:t.listQuery.page,limit:t.listQuery.limit},on:{"update:page":function(e){t.$set(t.listQuery,"page",e)},"update:limit":function(e){t.$set(t.listQuery,"limit",e)},pagination:t.getList}}),t._v(" "),a("el-tooltip",{attrs:{placement:"top",content:"返回顶部"}},[a("back-to-top",{attrs:{"visibility-height":100}})],1),t._v(" "),a("el-dialog",{attrs:{title:t.dialogTitleMap[t.dialogStatus],visible:t.dialogFormVisible,fullscreen:!0,"close-on-press-escape":!1,center:""},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-card",{staticClass:"box-card"},[a("h3",[t._v("商品属性(spu)")]),t._v(" "),a("el-form",{ref:"dataForm",staticStyle:{width:"700px","margin-left":"50px"},attrs:{rules:t.rules,model:t.dataForm,"status-icon":"","label-position":"left","label-width":"150px"}},[a("el-form-item",{attrs:{label:"团购商品"}},[a("el-cascader",{attrs:{options:t.goodsOptions,placeholder:"团购商品",filterable:""},on:{change:t.chooseGoods},model:{value:t.goodsOption,callback:function(e){t.goodsOption=e},expression:"goodsOption"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"团购时间"}},[a("el-col",{attrs:{span:11}},[a("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"datetime",placeholder:"选择日期"},model:{value:t.dataForm.gmtStart,callback:function(e){t.$set(t.dataForm,"gmtStart",e)},expression:"dataForm.gmtStart"}})],1),t._v(" "),a("el-col",{staticClass:"line",attrs:{span:2}},[t._v("     至")]),t._v(" "),a("el-col",{attrs:{span:11}},[a("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"datetime",placeholder:"选择日期"},model:{value:t.dataForm.gmtEnd,callback:function(e){t.$set(t.dataForm,"gmtEnd",e)},expression:"dataForm.gmtEnd"}})],1)],1),t._v(" "),a("el-form-item",{attrs:{label:"团购基础人数"}},[a("el-input-number",{attrs:{precision:0,"controls-position":"right"},model:{value:t.dataForm.minimumNumber,callback:function(e){t.$set(t.dataForm,"minimumNumber",e)},expression:"dataForm.minimumNumber"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"活动结束时人数没有达到基础人数处理"}},[a("el-radio-group",{model:{value:t.dataForm.automaticRefund,callback:function(e){t.$set(t.dataForm,"automaticRefund",e)},expression:"dataForm.automaticRefund"}},[a("el-radio-button",{attrs:{label:1}},[t._v("自动退款,我不发货")]),t._v(" "),a("el-radio-button",{attrs:{label:0}},[t._v("不退款,我要发货")])],1)],1)],1)],1),t._v(" "),a("el-card",{staticClass:"box-card"},[a("h3",[t._v("商品类型(sku)")]),t._v(" "),a("el-table",{attrs:{data:t.dataForm.skuList}},[a("el-table-column",{attrs:{property:"id",label:"SkuId"}}),t._v(" "),a("el-table-column",{attrs:{property:"barCode",label:"Sku条形码"}}),t._v(" "),a("el-table-column",{attrs:{property:"title",label:"类型名"}}),t._v(" "),a("el-table-column",{attrs:{property:"stock",label:"库存"}}),t._v(" "),a("el-table-column",{attrs:{property:"price",label:"现价/元"}}),t._v(" "),a("el-table-column",{attrs:{property:"skuGroupShopPrice",label:"团购价格/元"}}),t._v(" "),a("el-table-column",{attrs:{align:"center",label:"操作",width:"100","class-name":"small-padding fixed-width"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(a){t.openSkuGroupShopPriceUpdateDialog(e.row)}}},[t._v("更新")])]}}])})],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.groupShopUpdateSkuPriceDialog,modal:!0,"append-to-body":!0,"close-on-click-modal":!1,top:"10vh",width:"70%",title:"更新团购价格"},on:{"update:visible":function(e){t.groupShopUpdateSkuPriceDialog=e}}},[a("el-form",{ref:"specForm",staticStyle:{width:"400px","margin-left":"50px"},attrs:{model:t.skuForm,"status-icon":"","label-position":"left","label-width":"100px"}},[a("el-form-item",{attrs:{label:"团购价格"}},[a("el-input-number",{attrs:{precision:2,"controls-position":"right"},model:{value:t.skuForm.skuGroupShopPrice,callback:function(e){t.$set(t.skuForm,"skuGroupShopPrice",e)},expression:"skuForm.skuGroupShopPrice"}}),t._v("元\n ")],1),t._v(" "),a("el-form-item",{attrs:{label:"现价"}},[t._v("\n "+t._s(t.skuForm.price)+"元\n ")]),t._v(" "),a("el-form-item",{attrs:{label:"sku类型名"}},[t._v("\n "+t._s(t.skuForm.title)+"元\n ")])],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.groupShopUpdateSkuPriceDialog=!1}}},[t._v("取消")]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.skuGroupShopUpdate()}}},[t._v("确定")])],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("取消")]),t._v(" "),"create"===t.dialogStatus?a("el-button",{attrs:{type:"primary"},on:{click:t.createOrUpdateData}},[t._v("创建")]):t._e(),t._v(" "),"update"===t.dialogStatus?a("el-button",{attrs:{type:"primary"},on:{click:t.createOrUpdateData}},[t._v("更新")]):t._e()],1)],1)],1)},[],!1,null,null,null);_.options.__file="groupshop.vue";e.default=_.exports},BiX5:function(t,e,a){"use strict";var i={name:"BackToTop",props:{visibilityHeight:{type:Number,default:400},backPosition:{type:Number,default:0},customStyle:{type:Object,default:function(){return{right:"50px",bottom:"50px",width:"40px",height:"40px","border-radius":"4px","line-height":"45px",background:"#e7eaf1"}}},transitionName:{type:String,default:"fade"}},data:function(){return{visible:!1,interval:null,isMoving:!1}},mounted:function(){window.addEventListener("scroll",this.handleScroll)},beforeDestroy:function(){window.removeEventListener("scroll",this.handleScroll),this.interval&&clearInterval(this.interval)},methods:{handleScroll:function(){this.visible=window.pageYOffset>this.visibilityHeight},backToTop:function(){var t=this;if(!this.isMoving){var e=window.pageYOffset,a=0;this.isMoving=!0,this.interval=setInterval(function(){var i=Math.floor(t.easeInOutQuad(10*a,e,-e,500));i<=t.backPosition?(window.scrollTo(0,t.backPosition),clearInterval(t.interval),t.isMoving=!1):window.scrollTo(0,i),a++},16.7)}},easeInOutQuad:function(t,e,a,i){return(t/=i/2)<1?a/2*t*t+e:-a/2*(--t*(t-2)-1)+e}}},o=(a("zXup"),a("KHd+")),r=Object(o.a)(i,function(){var t=this.$createElement,e=this._self._c||t;return e("transition",{attrs:{name:this.transitionName}},[e("div",{directives:[{name:"show",rawName:"v-show",value:this.visible,expression:"visible"}],staticClass:"back-to-ceiling",style:this.customStyle,on:{click:this.backToTop}},[e("svg",{staticClass:"Icon Icon--backToTopArrow",staticStyle:{height:"16px",width:"16px"},attrs:{width:"16",height:"16",viewBox:"0 0 17 17",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"}},[e("title",[this._v("回到顶部")]),this._v(" "),e("g",[e("path",{attrs:{d:"M12.036 15.59c0 .55-.453.995-.997.995H5.032c-.55 0-.997-.445-.997-.996V8.584H1.03c-1.1 0-1.36-.633-.578-1.416L7.33.29c.39-.39 1.026-.385 1.412 0l6.878 6.88c.782.78.523 1.415-.58 1.415h-3.004v7.004z","fill-rule":"evenodd"}})])])])])},[],!1,null,"6172f71e",null);r.options.__file="index.vue";e.a=r.exports},Hcyd:function(t,e,a){"use strict";var i=a("2JsF");a.n(i).a},Qq1F:function(t,e,a){},"gDS+":function(t,e,a){t.exports={default:a("oh+g"),__esModule:!0}},"oh+g":function(t,e,a){var i=a("WEpk"),o=i.JSON||(i.JSON={stringify:JSON.stringify});t.exports=function(t){return o.stringify.apply(o,arguments)}},xA6U:function(t,e,a){"use strict";a.d(e,"g",function(){return c}),a.d(e,"f",function(){return p}),a.d(e,"d",function(){return d}),a.d(e,"b",function(){return m}),a.d(e,"a",function(){return g}),a.d(e,"c",function(){return h}),a.d(e,"e",function(){return f});var i=a("gDS+"),o=a.n(i),r=a("QbLZ"),s=a.n(r),n=a("t3Un"),l=a("Qyje"),u=a.n(l);function c(){return Object(n.a)({method:"get",params:{_gp:"admin.goods",_mt:"getSpuBigTree"}})}function p(t){return Object(n.a)({method:"get",params:s()({_gp:"admin.goods",_mt:"list"},t)})}function d(t){return Object(n.a)({method:"post",data:u.a.stringify({_gp:"admin.goods",_mt:"edit",spuDTO:o()(t)})})}function m(t){return Object(n.a)({method:"post",params:{_gp:"admin.goods",_mt:"delete",spuId:t}})}function g(t){return Object(n.a)({method:"post",data:u.a.stringify({_gp:"admin.goods",_mt:"create",spuDTO:o()(t)})})}function h(t){return Object(n.a)({method:"get",params:{_gp:"admin.goods",_mt:"detail",spuId:t}})}function f(t,e){return Object(n.a)({method:"post",params:{_gp:"admin.goods",_mt:"freezeOrActivation",spuId:t,status:e}})}},zXup:function(t,e,a){"use strict";var i=a("Qq1F");a.n(i).a}}]);