| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095 |
- <template>
- <el-tabs v-model = "activeName" @tab-click = "handleClick">
- <el-tab-pane label = "首页轮播" name = "first">
- <div style = "float: right;margin-right:2%;">
- <el-button style = "margin: 10px 0;" :disabled = "!isAuth('shopConfig:add')" size = "mini" type = "primary" icon = "document"
- @click = "advertNotice">添加轮播</el-button>
- </div>
- <el-table v-loading = "tableDataLoading" :data = "advertData">
- <el-table-column fixed prop = "id" label = "编号" width = "80">
- </el-table-column>
- <el-table-column prop = "imgUrl" label = "图片">
- <template slot-scope = "scope">
- <img :src = "scope.row.imgUrl" alt = "" width = "170px" height = "60">
- </template>
- </el-table-column>
- <el-table-column prop = "linkUrl" label = "跳转链接">
- </el-table-column>
- <el-table-column prop = "createAt" label = "创建时间">
- </el-table-column>
- <el-table-column fixed = "right" label = "操作" width = "150">
- <template slot-scope = "scope">
- <el-button size = "mini" type = "primary" :disabled = "!isAuth('shopConfig:update')"
- @click = "advertUpdates(scope.$index, scope.row)">修改
- </el-button>
- <el-button size = "mini" type = "danger" :disabled = "!isAuth('shopConfig:delete')" @click = "advertdeletes(scope.row)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 添加广告 -->
- <el-dialog title = "添加轮播" :visible.sync = "dialogFormVisible2" center>
- <div style = "margin-bottom: 10px;display: flex;">
- <span style = "width: 200px;display: inline-block;text-align: right;">图片地址:</span>
- <div style = " width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
- <el-upload class = "avatar-uploader" v-model = "imgUrl" action = "https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload"
- :show-file-list = "false" :on-success = "handleAvatarSuccess1">
- <img v-if = "imgUrl" :src = "imgUrl" class = "avatar" style = "border-radius: 6px;width:148px;height: 148px;"/>
- <i v-else class = "el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- </div>
- </div>
- <div style = "margin-bottom: 10px;">
- <span style = "width: 200px;display: inline-block;text-align: right;">跳转地址:</span>
- <el-input style = "width:50%;" v-model = "linkUrl" placeholder = "请输入跳转地址"></el-input>
- </div>
- <div slot = "footer" class = "dialog-footer">
- <el-button @click = "dialogFormVisible2 = false">取 消</el-button>
- <el-button type = "primary" @click = "advertNoticeTo()">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 修改广告 -->
- <el-dialog title = "修改轮播" :visible.sync = "dialogFormVisible" center>
- <el-form :model = "form2">
- <el-form-item label = "图片地址:" :label-width = "formLabelWidth">
- <div style = " width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height:148px;">
- <el-upload class = "avatar-uploader" v-model = "imgUrl" action = "https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload"
- :show-file-list = "false" :on-success = "handleAvatarSuccess3">
- <img v-if = "form2.imgUrl" :src = "form2.imgUrl" class = "avatar" style = "border-radius: 6px;width:148px;height: 148px;"/>
- <i v-else class = "el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- </div>
- </el-form-item>
- <el-form-item label = "跳转地址:" :label-width = "formLabelWidth">
- <el-input v-model = "form2.linkUrl" style = "width:65%;"></el-input>
- </el-form-item>
- </el-form>
- <div slot = "footer" class = "dialog-footer">
- <el-button @click = "dialogFormVisible = false">取 消</el-button>
- <el-button type = "primary" @click = "amendadvertTo()">确 定</el-button>
- </div>
- </el-dialog>
- </el-tab-pane>
- <el-tab-pane label = "首页导航" name = "second">
- <div style = "float: right;margin-right:2%;">
- <el-button style = "margin: 10px 0;" :disabled = "!isAuth('shopConfig:add')" size = "mini" type = "primary" icon = "document"
- @click = "addNavigation">添加导航</el-button>
- </div>
- <el-table v-loading = "tableDataLoading" :data = "homeData">
- <el-table-column fixed prop = "id" label = "编号" width = "80">
- </el-table-column>
- <el-table-column prop = "title" label = "名称">
- </el-table-column>
- <el-table-column prop = "url" label = "路由">
- </el-table-column>
- <el-table-column prop = "content" label = "图片">
- <template slot-scope = "scope">
- <img :src = "scope.row.image_url" alt = "" width = "40" height = "40">
- </template>
- </el-table-column>
- <el-table-column prop = "createAt" label = "创建时间" width = "160">
- </el-table-column>
- <el-table-column label = "操作" width = "150">
- <template slot-scope = "scope">
- <el-button size = "mini" type = "primary" :disabled = "!isAuth('shopConfig:update')" @click = "compile(scope.$index, scope.row)">编辑
- </el-button>
- <el-button size = "mini" type = "danger" :disabled = "!isAuth('shopConfig:delete')" @click = "navdeletes(scope.row)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 添加导航弹框 -->
- <el-dialog title = "添加导航" :visible.sync = "dialogFormVisible7" center>
- <div style = "margin-bottom: 10px;">
- <span style = "width: 200px;display: inline-block;text-align: right;">标题:</span>
- <el-input style = "width:50%;" v-model = "title" placeholder = "请输入导航标题"></el-input>
- </div>
- <div style = "margin-bottom: 10px;">
- <span style = "width: 200px;display: inline-block;text-align: right;">路由:</span>
- <el-input style = "width: 50%;" v-model = "url" placeholder = "请输入导航路由"></el-input>
- </div>
- <div style = "margin-bottom: 10px;">
- <span style = "width: 200px;display: inline-block;text-align: right;">分类:</span>
- <el-select v-model = "state" placeholder = "请选择类型" style = "width:50%;">
- <el-option v-for = "item in states" :key = "item.value" :label = "item.label" :value = "item.value">
- </el-option>
- </el-select>
- </div>
- <div style = "display: flex;">
- <span style = "width: 200px;display: inline-block;text-align: right;">图片:</span>
- <div style = " width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
- <el-upload class = "avatar-uploader" v-model = "image_url" action = "https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload"
- :show-file-list = "false" :on-success = "handleAvatarSuccess4">
- <img v-if = "image_url" :src = "image_url" class = "avatar" style = "border-radius: 6px;width: 86px;height: 86px;"/>
- <i v-else class = "el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- </div>
- </div>
- <div slot = "footer" class = "dialog-footer">
- <el-button @click = "dialogFormVisible7 = false">取 消</el-button>
- <el-button type = "primary" @click = "NagNoticeTo()">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 首页编辑 -->
- <el-dialog title = "修改" :visible.sync = "dialogFormVisible1" center>
- <el-form :model = "form1">
- <el-form-item label = "标题:" :label-width = "formLabelWidth">
- <el-input v-model = "form1.title" style = "width:65%;"></el-input>
- </el-form-item>
- <el-form-item label = "路由:" :label-width = "formLabelWidth">
- <el-input v-model = "form1.url" style = "width:65%;"></el-input>
- </el-form-item>
- <el-form-item label = "分类:" :label-width = "formLabelWidth">
- <el-select v-model = "form1.state" placeholder = "请选择类型" style = "width:65%;">
- <el-option v-for = "item in states" :key = "item.value" :label = "item.label" :value = "item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label = "图片:" :label-width = "formLabelWidth">
- <div style = " width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
- <el-upload class = "avatar-uploader" v-model = "image_url" action = "https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload"
- :show-file-list = "false" :on-success = "handleAvatarSuccess2">
- <img v-if = "form1.image_url" :src = "form1.image_url" class = "avatar" style = "border-radius: 6px;width: 86px;height: 86px;"/>
- <i v-else class = "el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- </div>
- </el-form-item>
- </el-form>
- <div slot = "footer" class = "dialog-footer">
- <el-button @click = "dialogFormVisible1 = false">取 消</el-button>
- <el-button type = "primary" @click = "compileNoticeTo()">确 定</el-button>
- </div>
- </el-dialog>
- </el-tab-pane>
- <el-tab-pane label = "精选商品" name = "fifth">
- <div style = "float: right;margin-right:2%;">
- <el-button style = "margin: 10px 0;" :disabled = "!isAuth('shopConfig:add')" size = "mini" type = "primary" icon = "document"
- @click = "choiaddNotice()">添加商品</el-button>
- <el-button style = "margin: 10px 0;" :disabled = "!isAuth('shopConfig:delete') || checkBoxData.length <= 0 " size = "mini"
- type = "danger" icon = "document" @click = "choideletes()">批量删除</el-button>
- </div>
- <el-table v-loading = "tableDataLoading" @selection-change = "changeFun" :data = "choicenData.content">
- <el-table-column type = "selection" fixed>
- </el-table-column>
- <el-table-column fixed prop = "id" label = "编号" width = "80">
- </el-table-column>
- <el-table-column fixed prop = "coverImg" label = "商品图片">
- <template slot-scope = "scope">
- <img :src = "scope.row.coverImg" alt = "" width = "60" height = "60">
- </template>
- </el-table-column>
- <el-table-column prop = "title" label = "商品标题" width = "200">
- </el-table-column>
- <el-table-column prop = "originalPrice" label = "商品原价">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.originalPrice | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "price" label = "商品价格">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.price | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "memberPrice" label = "会员价格">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.memberPrice | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "commissionPrice" label = "佣金">
- </el-table-column>
- <el-table-column prop = "sales" label = "商品销量">
- </el-table-column>
- <el-table-column prop = "createAt" label = "创建时间" width = "160">
- </el-table-column>
- <el-table-column fixed = "right" label = "操作" prop = "id" width = "120">
- <template slot-scope = "scope">
- <el-button size = "mini" type = "danger" :disabled = "!isAuth('shopConfig:delete')" @click = "choidelete(scope.row)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style = "text-align: center;margin-top: 10px;float:right">
- <el-pagination @size-change = "handleSizeChange3" @current-change = "handleCurrentChange3" :page-sizes = "[10, 20, 30, 50, 100]"
- :page-size = "size" :current-page = "page" layout = "total,sizes, prev, pager, next,jumper"
- :total = "choicenData.totalElements">
- </el-pagination>
- </div>
- <!-- 添加弹框 -->
- <el-dialog title = "添加商品" customClass = "customWidth" :visible.sync = "dialogFormVisible5" center>
- <div style = "position: relative;display: inline-block;float: right;">
- <el-input style = "width: 200px;" @keydown.enter.native = "shousuo" placeholder = "根据标题搜索商品" v-model = "title"></el-input>
- <span @click = "shousuo" style = "position: absolute;right: 0;top:8px;">
- <icon-svg name = "shousuo" class = "site-sidebar__menu-icon"></icon-svg></span>
- </div>
- <el-table v-loading = "tableDataLoading" height = "450" :data = "choicenData2.content">
- <el-table-column fixed prop = "id" label = "编号" width = "80">
- </el-table-column>
- <el-table-column fixed prop = "coverImg" label = "商品图片">
- <template slot-scope = "scope">
- <img :src = "scope.row.coverImg" alt = "" width = "60" height = "60">
- </template>
- </el-table-column>
- <el-table-column prop = "type.name" label = "商品类型">
- </el-table-column>
- <el-table-column prop = "title" label = "商品标题" width = "200">
- </el-table-column>
- <el-table-column prop = "originalPrice" label = "商品原价">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.originalPrice | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "price" label = "商品价格">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.price | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "memberPrice" label = "会员价格">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.memberPrice | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "commissionPrice" label = "佣金">
- </el-table-column>
- <el-table-column prop = "sales" label = "商品销量">
- </el-table-column>
- <el-table-column prop = "createAt" label = "创建时间" width = "160">
- </el-table-column>
- <el-table-column fixed = "right" label = "操作" prop = "id">
- <template slot-scope = "scope">
- <el-button size = "mini" type = "primary" @click = "releasNoticeTo(scope.row)">添加
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style = "text-align: center;margin-top: 10px;">
- <el-pagination @size-change = "handleSizeChange4" @current-change = "handleCurrentChange4" :page-sizes = "[10, 20, 30, 50, 100]"
- :page-size = "size" :current-page = "page" layout = "total,sizes, prev, pager, next,jumper"
- :total = "choicenData2.totalElements">
- </el-pagination>
- </div>
- </el-dialog>
- </el-tab-pane>
- <el-tab-pane label = "每日推荐" name = "sixth">
- <div style = "float: right;margin-right:2%;">
- <el-button style = "margin: 10px 0;" :disabled = "!isAuth('shopConfig:add')" size = "mini" type = "primary" icon = "document"
- @click = "recomNotice()">添加商品</el-button>
- <el-button style = "margin: 10px 0;" :disabled = "!isAuth('shopConfig:delete') || checkBoxData.length <= 0 " size = "mini"
- type = "danger" icon = "document" @click = "recomdeletes()">批量删除</el-button>
- </div>
- <el-table v-loading = "tableDataLoading" @selection-change = "changeFun" :data = "recomData.content">
- <el-table-column type = "selection" fixed>
- </el-table-column>
- <el-table-column fixed prop = "id" label = "编号" width = "80">
- </el-table-column>
- <el-table-column fixed prop = "coverImg" label = "商品图片">
- <template slot-scope = "scope">
- <img :src = "scope.row.coverImg" alt = "" width = "60" height = "60">
- </template>
- </el-table-column>
- <el-table-column prop = "title" label = "商品标题" width = "200">
- </el-table-column>
- <el-table-column prop = "originalPrice" label = "商品原价">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.originalPrice | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "price" label = "商品价格">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.price | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "memberPrice" label = "会员价格">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.memberPrice | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "commissionPrice" label = "佣金">
- </el-table-column>
- <el-table-column prop = "sales" label = "商品销量">
- </el-table-column>
- <el-table-column prop = "createAt" label = "创建时间" width = "160">
- </el-table-column>
- <el-table-column fixed = "right" label = "操作" prop = "id" width = "120">
- <template slot-scope = "scope">
- <el-button size = "mini" type = "danger" :disabled = "!isAuth('shopConfig:delete')" @click = "recomdelete(scope.row)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style = "text-align: center;margin-top: 10px;float:right">
- <el-pagination @size-change = "handleSizeChange5" @current-change = "handleCurrentChange5" :page-sizes = "[10, 20, 30, 50, 100]"
- :page-size = "size" :current-page = "page" layout = "total,sizes, prev, pager, next,jumper"
- :total = "recomData.totalElements">
- </el-pagination>
- </div>
- <!-- 添加弹框 -->
- <el-dialog title = "添加" customClass = "customWidth" :visible.sync = "dialogFormVisible6" center>
- <div style = "position: relative;display: inline-block;float: right;">
- <el-input style = "width: 200px;" @keydown.enter.native = "shousuo" placeholder = "根据标题搜索商品" v-model = "title"></el-input>
- <span @click = "shousuo" style = "position: absolute;right: 0;top:8px;"><icon-svg name = "shousuo"
- class = "site-sidebar__menu-icon"></icon-svg></span>
- </div>
- <el-table v-loading = "tableDataLoading" height = "450" :data = "choicenData2.content">
- <el-table-column fixed prop = "id" label = "编号" width = "80">
- </el-table-column>
- <el-table-column fixed prop = "coverImg" label = "商品图片">
- <template slot-scope = "scope">
- <img :src = "scope.row.coverImg" alt = "" width = "60" height = "60">
- </template>
- </el-table-column>
- <el-table-column prop = "type.name" label = "商品类型">
- </el-table-column>
- <el-table-column prop = "title" label = "商品标题" width = "200">
- </el-table-column>
- <el-table-column prop = "originalPrice" label = "商品原价">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.originalPrice | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "price" label = "商品价格">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.price | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "memberPrice" label = "会员价格">
- <template slot-scope = "scope">
- <span style = "color: #f56c6c;">{{ scope.row.memberPrice | numFilter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop = "commissionPrice" label = "佣金">
- </el-table-column>
- <el-table-column prop = "sales" label = "商品销量">
- </el-table-column>
- <el-table-column prop = "createAt" label = "创建时间" width = "160">
- </el-table-column>
- <el-table-column fixed = "right" label = "操作" prop = "id">
- <template slot-scope = "scope">
- <el-button size = "mini" type = "primary" @click = "recomNoticeTo(scope.row)">添加
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style = "text-align: center;margin-top: 10px;">
- <el-pagination @size-change = "handleSizeChange4" @current-change = "handleCurrentChange4" :page-sizes = "[10, 20, 30, 50, 100]"
- :page-size = "size" :current-page = "page" layout = "total,sizes, prev, pager, next,jumper"
- :total = "choicenData2.totalElements">
- </el-pagination>
- </div>
- </el-dialog>
- </el-tab-pane>
- </el-tabs>
- </template>
- <script>
- export default {
- data () {
- return {
- size: 10,
- page: 1,
- id: '',
- img: '',
- title: '',
- type: '',
- sort: 'createAt',
- readonly: true,
- merchants: '',
- price: '',
- memberPrice: '',
- sales: 0,
- status: 0,
- status2: '',
- descrition: '',
- totalnum: 0,
- nav: '',
- imgUrl: '',
- linkUrl: '',
- image_url: '',
- url: '',
- checkBoxData: [],//多选框选择的值
- choicenData: [],
- choicenData2: [],
- recomData: [],
- recomData2: [],
- state: 1,
- states: [
- {
- value: '1',
- label: '首页导航'
- },
- {
- value: '2',
- label: '精选好物'
- },
- {
- value: '3',
- label: '热卖榜单'
- },
- {
- value: '4',
- label: '每日上新'
- },
- {
- value: '5',
- label: '拼团购'
- },
- {
- value: '6',
- label: '邀请图'
- },
- {
- value: '7',
- label: '首页邀请图'
- }
- ],
- form1: {
- id: '',
- image_url: '',
- title: '',
- url: '',
- state: '',
- createAt: ''
- },
- form2: {
- id: '',
- imgUrl: '',
- linkUrl: '',
- createAt: ''
- },
- statusmain: [
- {
- value: 0,
- label: '全部'
- },
- {
- value: 1,
- label: '上架'
- },
- {
- value: 2,
- label: '下架'
- }
- ],
- statusmain2: [
- {
- value: 1,
- label: '上架'
- },
- {
- value: 2,
- label: '下架'
- }
- ],
- formLabelWidth: '200px',
- activeName: 'first',
- tableDataLoading: false,
- dialogFormVisible1: false,
- dialogFormVisible: false,
- dialogFormVisible2: false,
- dialogFormVisible5: false,
- dialogFormVisible6: false,
- dialogFormVisible7: false,
- typeDatas: [],
- advertData: [],
- tableData: [],
- homeData: []
- }
- },
- filters: {
- numFilter (value) {
- let realVal = ''
- if (!isNaN(value) && value !== '') {
- // 截取当前数据到小数点后三位
- let tempVal = parseFloat(value).toFixed(3)
- realVal = tempVal.substring(0, tempVal.length - 1)
- } else {
- realVal = '--'
- }
- return realVal
- }
- },
- methods: {
- // 多选
- changeFun (val) {
- this.checkBoxData = val
- },
- handleAvatarSuccess (file) {
- this.img = file.data
- },
- handleAvatarSuccess2 (file) {
- this.form1.image_url = file.data
- },
- handleAvatarSuccess1 (file) {
- this.imgUrl = file.data
- },
- handleAvatarSuccess3 (file) {
- this.form2.imgUrl = file.data
- },
- handleAvatarSuccess4 (file) {
- this.image_url = file.data
- },
- handleSizeChange (val) {
- this.size = val
- this.dataSelect()
- },
- handleCurrentChange (val) {
- this.page = val
- this.dataSelect()
- },
- handleSizeChange1 (val) {
- this.size = val
- this.homeSelect()
- },
- handleCurrentChange1 (val) {
- this.page = val
- this.homeSelect()
- },
- handleSizeChange3 (val) {
- this.size = val
- this.choicenSelect()
- },
- handleCurrentChange3 (val) {
- this.page = val
- this.choicenSelect()
- },
- handleSizeChange4 (val) {
- this.size = val
- this.handpick()
- },
- handleCurrentChange4 (val) {
- this.page = val
- this.handpick()
- },
- handleSizeChange5 (val) {
- this.size = val
- this.recomSelect()
- },
- handleCurrentChange5 (val) {
- this.page = val
- this.recomSelect()
- },
- handleClick (tab, event) {
- if (tab._props.label == '首页轮播') {
- this.advertSelect()
- }
- if (tab._props.label == '首页导航') {
- this.state = ''
- this.homeSelect()
- }
- if (tab._props.label == '精选商品') {
- this.page = 1
- this.size = 5
- this.choicenSelect()
- this.handpick()
- }
- if (tab._props.label == '每日推荐') {
- this.page = 1
- this.size = 5
- this.recomSelect()
- this.handpick()
- }
- },
- // 添加首页导航弹框
- addNavigation () {
- this.dialogFormVisible7 = true
- },
- // 添加首页导航
- NagNoticeTo () {
- if (this.title == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请选择导航标题',
- type: 'warning'
- })
- return
- }
- if (this.url == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请选择导航路由',
- type: 'warning'
- })
- return
- }
- if (this.image_url == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请上传图片',
- type: 'warning'
- })
- return
- }
- this.$http({
- url: this.$http.adornUrl2('/selfActivity/save'),
- method: 'post',
- data: this.$http.adornData({
- 'state': this.state,
- 'url': this.url,
- 'title': this.title,
- 'image_url': this.image_url
- })
- }).then(({data}) => {
- this.dialogFormVisible7 = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.url = ''
- this.title = ''
- this.image_url = ''
- this.homeSelect()
- }
- })
- })
- },
- // 添加广告弹框
- advertNotice () {
- this.dialogFormVisible2 = true
- },
- // 添加广告
- advertNoticeTo () {
- if (this.linkUrl == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请输入跳转链接',
- type: 'warning'
- })
- return
- }
- if (this.imgUrl == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请上传图片',
- type: 'warning'
- })
- return
- }
- this.$http({
- url: this.$http.adornUrl2('/advert/save'),
- method: 'post',
- data: this.$http.adornData({
- 'imgUrl': this.imgUrl,
- 'linkUrl': this.linkUrl
- })
- }).then(({data}) => {
- this.dialogFormVisible2 = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.advertSelect()
- }
- })
- })
- },
- // 修改广告
- advertUpdates (index, rows) {
- this.dialogFormVisible = true
- this.form2.id = rows.id
- this.form2.imgUrl = rows.imgUrl
- this.form2.linkUrl = rows.linkUrl
- this.form2.createAt = rows.createAt
- },
- // 修改广告
- amendadvertTo () {
- this.$http({
- url: this.$http.adornUrl2('/advert/save'),
- method: 'post',
- data: this.$http.adornData({
- 'id': this.form2.id,
- 'imgUrl': this.form2.imgUrl,
- 'linkUrl': this.form2.linkUrl,
- 'createAt': this.form2.createAt
- })
- }).then(({data}) => {
- this.dialogFormVisible = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.advertSelect()
- }
- })
- })
- },
- // 删除广告
- advertdeletes (row) {
- this.$confirm(`确定删除此条信息?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$http({
- url: this.$http.adornUrl2('/advert/delete'),
- method: 'get',
- params: this.$http.adornParams({
- 'id': row.id
- })
- }).then(({data}) => {
- this.$message({
- message: '删除成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.advertSelect()
- }
- })
- })
- }).catch(() => {
- })
- },
- // 删除导航
- navdeletes (row) {
- this.$confirm(`确定删除此条信息?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$http({
- url: this.$http.adornUrl2('/selfActivity/delete'),
- method: 'get',
- params: this.$http.adornParams({
- 'id': row.id
- })
- }).then(({data}) => {
- this.$message({
- message: '删除成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.homeSelect()
- }
- })
- })
- }).catch(() => {
- })
- },
- // 编辑弹框
- compile (index, rows) {
- this.dialogFormVisible1 = true
- this.form1.url = rows.url
- this.form1.image_url = rows.image_url
- this.form1.id = rows.id
- this.form1.state = rows.state
- this.form1.createAt = rows.createAt
- this.form1.title = rows.title
- },
- // 修改商品类别
- compileNoticeTo () {
- this.$http({
- url: this.$http.adornUrl2('/selfActivity/update'),
- method: 'post',
- data: this.$http.adornData({
- 'id': this.form1.id,
- 'state': this.form1.state,
- 'title': this.form1.title,
- 'url': this.form1.url,
- 'image_url': this.form1.image_url,
- })
- }).then(({data}) => {
- this.dialogFormVisible1 = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.homeSelect()
- }
- })
- })
- },
- //添加精选商品
- choiaddNotice () {
- this.dialogFormVisible5 = true
- },
- // 添加商品
- releasNoticeTo (row) {
- this.$http({
- url: this.$http.adornUrl2('/goods/addSelectGoods'),
- method: 'get',
- params: this.$http.adornParams({
- 'id': row.id,
- })
- }).then(({data}) => {
- if (data && data.status === 0) {
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.choicenSelect()
- }
- })
- } else {
- this.$message.error(data.msg)
- }
- })
- },
- // 精选淘宝商品
- handpick () {
- let page = this.page - 1
- this.tableDataLoading = true
- this.$http({
- url: this.$http.adornUrl2('/goods/list'),
- method: 'get',
- params: this.$http.adornParams({
- 'page': page,
- 'size': this.size,
- 'title': this.title,
- 'type': this.type,
- 'status': this.status
- })
- }).then(({data}) => {
- if (data && data.status === 0) {
- this.tableDataLoading = false
- let returnData = data.data
- this.choicenData2 = returnData
- }
- })
- },
- // 搜索
- shousuo () {
- let page = this.page - 1
- this.tableDataLoading = true
- this.$http({
- url: this.$http.adornUrl2('/goods/list'),
- method: 'get',
- params: this.$http.adornParams({
- 'page': page,
- 'size': this.size,
- 'title': this.title,
- 'type': this.type,
- 'status': this.status
- })
- }).then(({data}) => {
- if (data && data.status === 0) {
- this.tableDataLoading = false
- let returnData = data.data
- this.choicenData2 = returnData
- }
- })
- },
- // 批量删除商品
- choideletes (id) {
- var ids = id ? [id] : this.checkBoxData.map(item => {
- return item.id
- })
- for (var i in ids) {
- this.$http({
- url: this.$http.adornUrl2('/goods/deleteSelectGoods'),
- method: 'get',
- params: this.$http.adornParams({
- 'ids': ids[i]
- })
- }).then(({data}) => {
- this.$message({
- message: '批量删除成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.choicenSelect()
- }
- })
- })
- }
- },
- // 删除商品
- choidelete (row) {
- let delid = row.id
- this.$confirm(`确定删除此条信息?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$http({
- url: this.$http.adornUrl2('/goods/deleteSelectGoods'),
- method: 'get',
- params: this.$http.adornParams({
- 'ids': delid
- })
- }).then(({data}) => {
- this.$message({
- message: '删除成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.choicenSelect()
- }
- })
- })
- }).catch(() => {
- })
- },
- // 精选商品列表
- choicenSelect () {
- let page = this.page - 1
- this.tableDataLoading = true
- this.$http({
- url: this.$http.adornUrl2('/goods/selectGoods'),
- method: 'get',
- params: this.$http.adornParams({
- 'page': page,
- 'size': this.size,
- 'sort': this.sort
- })
- }).then(({data}) => {
- this.tableDataLoading = false
- let returnData = data.data
- this.choicenData = returnData
- })
- },
- // 每日推荐列表
- recomSelect () {
- let page = this.page - 1
- this.tableDataLoading = true
- this.$http({
- url: this.$http.adornUrl2('/goods/recommend'),
- method: 'get',
- params: this.$http.adornParams({
- 'page': page,
- 'size': this.size,
- 'sort': this.sort
- })
- }).then(({data}) => {
- this.tableDataLoading = false
- let returnData = data.data
- this.recomData = returnData
- })
- },
- //添加每日推荐
- recomNotice () {
- this.dialogFormVisible6 = true
- },
- // 添加每日推荐
- recomNoticeTo (row) {
- this.$http({
- url: this.$http.adornUrl2('/goods/addRecommend'),
- method: 'get',
- params: this.$http.adornParams({
- 'id': row.id,
- })
- }).then(({data}) => {
- if (data && data.status === 0) {
- this.recomSelect()
- this.handpick()
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.choicenSelect()
- }
- })
- } else {
- this.$message.error(data.msg)
- }
- })
- },
- // 批量删除每日推荐商品
- recomdeletes (id) {
- var ids = id ? [id] : this.checkBoxData.map(item => {
- return item.id
- })
- for (var i in ids) {
- this.$http({
- url: this.$http.adornUrl2('/goods/deleteRecommend'),
- method: 'get',
- params: this.$http.adornParams({
- 'ids': ids[i]
- })
- }).then(({data}) => {
- this.recomSelect()
- this.handpick()
- this.$message({
- message: '批量删除成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.choicenSelect()
- }
- })
- })
- }
- },
- // 删除每日推荐商品
- recomdelete (row) {
- let delid = row.id
- this.$confirm(`确定删除此条信息?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$http({
- url: this.$http.adornUrl2('/goods/deleteRecommend'),
- method: 'get',
- params: this.$http.adornParams({
- 'ids': delid
- })
- }).then(({data}) => {
- this.recomSelect()
- this.handpick()
- this.$message({
- message: '删除成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.choicenSelect()
- }
- })
- })
- }).catch(() => {
- })
- },
- // 获取首页导航列表
- homeSelect () {
- this.tableDataLoading = true
- this.$http({
- url: this.$http.adornUrl2(`/selfActivity/list?state=${this.state}`),
- method: 'get',
- params: this.$http.adornParams({})
- }).then(({data}) => {
- this.tableDataLoading = false
- let returnData = data.data
- this.homeData = returnData
- })
- },
- // 获取广告位数据
- advertSelect () {
- this.tableDataLoading = true
- this.$http({
- url: this.$http.adornUrl2('/advert/list'),
- method: 'get',
- params: this.$http.adornParams({})
- }).then(({data}) => {
- this.tableDataLoading = false
- let returnData = data.data
- this.advertData = returnData
- })
- },
- },
- mounted () {
- this.advertSelect()
- }
- }
- </script>
- <style>
- .customWidth {
- width: 80% !important;
- }
- .el-input--medium .el-input__inner{
- padding: 0 24px 0 15px;
- }
- </style>
|