| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042 |
- <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('bannerList:add')" size="mini" type="primary"
- icon="document" @click="addNotice">添加轮播图</el-button>
- </div>
- <el-table v-loading="tableDataLoading" :data="tableData">
- <el-table-column fixed prop="id" label="编号" width="50">
- </el-table-column>
- <el-table-column prop="imageUrl" label="头像">
- <template slot-scope="scope">
- <img :src="scope.row.imageUrl" width="60" height="60" />
- </template>
- </el-table-column>
- <el-table-column prop="name" label="轮播图名称">
- </el-table-column>
- <el-table-column prop="state" label="状态">
- <template slot-scope="scope">
- <span v-if='scope.row.state == 1'>显示</span>
- <span v-if='scope.row.state == 2' style="color: #f56c6c;">隐藏</span>
- </template>
- </el-table-column>
- <el-table-column prop="state" label="是否启用">
- <template slot-scope="scope">
- <el-switch v-model="scope.row.state" @change="change(scope.row.state,scope.row)" :active-value="openValue"
- :inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949" :disabled="!isAuth('bannerList:update')">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column prop="createTime" label="创建时间" width="160">
- </el-table-column>
- <el-table-column label="操作" width="180">
- <template slot-scope="scope">
- <el-button size="mini" type="primary" :disabled="!isAuth('bannerList:update')"
- @click="amendBanner(scope.$index, scope.row)">修改
- </el-button>
- <el-button size="mini" type="danger" :disabled="!isAuth('bannerList:delete')" @click="deletes(scope.row)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: center;margin-top: 10px;float:right">
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
- :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page" layout="total,sizes, prev, pager, next"
- :total="tableData.length">
- </el-pagination>
- </div>
- <!-- 添加弹框 -->
- <el-dialog title="添加" :visible.sync="dialogFormVisible" 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="imageUrl"
- action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
- :on-success="handleAvatarSuccess">
- <img v-if="imageUrl" :src="imageUrl" 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="url" 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="name" 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="describes" placeholder="请输入描述"></el-input>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="addNoticeTo()">确 定</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('bannerList:add')" size="mini" type="primary"
- icon="document" @click="addNotice2">添加任务分类</el-button>
- </div>
- <el-table v-loading="tableDataLoading" :data="tableData">
- <el-table-column fixed prop="id" label="编号" width="80">
- </el-table-column>
- <el-table-column prop="imageUrl" label="头像">
- <template slot-scope="scope">
- <img :src="scope.row.imageUrl" width="60" height="60" />
- </template>
- </el-table-column>
- <el-table-column prop="name" label="分类名称">
- </el-table-column>
- <el-table-column prop="url" label="链接" width="180">
- </el-table-column>
- <el-table-column prop="state" label="状态">
- <template slot-scope="scope">
- <span v-if='scope.row.state == 1'>显示</span>
- <span v-if='scope.row.state == 2' style="color: #f56c6c;">隐藏</span>
- </template>
- </el-table-column>
- <el-table-column prop="state" label="是否启用">
- <template slot-scope="scope">
- <el-switch v-model="scope.row.state" @change="change(scope.row.state,scope.row)" :active-value="openValue"
- :inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column prop="createTime" label="创建时间" width="160">
- </el-table-column>
- <el-table-column label="操作" width="180">
- <template slot-scope="scope">
- <el-button size="mini" type="primary" :disabled="!isAuth('bannerList:update')"
- @click="amendBanner(scope.$index, scope.row)">修改
- </el-button>
- <el-button size="mini" type="danger" :disabled="!isAuth('bannerList:delete')" @click="deletes(scope.row)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: center;margin-top: 10px;float:right">
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
- :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page" layout="total,sizes, prev, pager, next"
- :total="tableData.length">
- </el-pagination>
- </div> -->
- <!-- 添加弹框 -->
- <!-- <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="imageUrl"
- action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
- :on-success="handleAvatarSuccess">
- <img v-if="imageUrl" :src="imageUrl" 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="url" 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="name" 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="describes" placeholder="请输入描述"></el-input>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible2 = false">取 消</el-button>
- <el-button type="primary" @click="addNoticeTo2()">确 定</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('bannerList:add')" size="mini" type="primary"
- icon="document" @click="addNotice4">添加分类</el-button>
- </div>
- <el-table v-loading="tableDataLoading" :data="tableData" >
- <el-table-column fixed prop="id" label="编号" width="50">
- </el-table-column>
- <el-table-column prop="imageUrl" label="头像">
- <template slot-scope="scope">
- <img :src="scope.row.imageUrl" width="60" height="60" />
- </template>
- </el-table-column>
- <el-table-column prop="name" label="分类名称">
- </el-table-column>
- <el-table-column prop="url" label="链接" width="180">
- </el-table-column>
- <el-table-column prop="state" label="状态">
- <template slot-scope="scope">
- <span v-if='scope.row.state == 1'>显示</span>
- <span v-if='scope.row.state == 2' style="color: #f56c6c;">隐藏</span>
- </template>
- </el-table-column>
- <el-table-column prop="state" label="是否启用">
- <template slot-scope="scope">
- <el-switch v-model="scope.row.state" @change="change(scope.row.state,scope.row)" :active-value="openValue"
- :inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949" :disabled="!isAuth('bannerList:update')">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column prop="createTime" label="创建时间" width="160">
- </el-table-column>
- <el-table-column label="操作" width="180">
- <template slot-scope="scope">
- <el-button size="mini" type="primary" :disabled="!isAuth('bannerList:update')"
- @click="amendBanner(scope.$index, scope.row)">修改
- </el-button>
- <el-button size="mini" type="danger" :disabled="!isAuth('bannerList:delete')" @click="deletes(scope.row)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: center;margin-top: 10px;float:right">
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
- :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page" layout="total,sizes, prev, pager, next"
- :total="tableData.length">
- </el-pagination>
- </div>
- <!-- 添加弹框 -->
- <el-dialog title="添加" :visible.sync="dialogFormVisible4" 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="imageUrl"
- action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
- :on-success="handleAvatarSuccess">
- <img v-if="imageUrl" :src="imageUrl" 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="url" 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="name" 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="describes" placeholder="请输入描述"></el-input>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible4 = false">取 消</el-button>
- <el-button type="primary" @click="addNoticeTo4()">确 定</el-button>
- </div>
- </el-dialog>
- </el-tab-pane>
- <el-tab-pane label="背景图" name="fourthly">
- <div style="float: right;margin-right:2%;">
- <el-button style='margin: 10px 0;' :disabled="!isAuth('bannerList:add')" size="mini" type="primary"
- icon="document" @click="addNotice5">添加背景图</el-button>
- </div>
- <el-table v-loading="tableDataLoading" :data="tableData">
- <el-table-column fixed prop="id" label="编号" width="50">
- </el-table-column>
- <el-table-column prop="imageUrl" label="头像">
- <template slot-scope="scope">
- <img :src="scope.row.imageUrl" width="60" height="60" />
- </template>
- </el-table-column>
- <el-table-column prop="name" label="背景图名称">
- </el-table-column>
- <el-table-column prop="describes" label="活动描述">
- </el-table-column>
- <el-table-column prop="url" label="链接" width="180">
- </el-table-column>
- <el-table-column prop="createTime" label="创建时间" width="160">
- </el-table-column>
- <el-table-column label="操作" width="180">
- <template slot-scope="scope">
- <el-button size="mini" type="primary" :disabled="!isAuth('bannerList:update')"
- @click="amendBanner(scope.$index, scope.row)">修改
- </el-button>
- <el-button size="mini" type="danger" :disabled="!isAuth('bannerList:delete')" @click="deletes(scope.row)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: center;margin-top: 10px;float:right">
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
- :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page" layout="total,sizes, prev, pager, next"
- :total="tableData.length">
- </el-pagination>
- </div>
- <!-- 添加弹框 -->
- <el-dialog title="添加" :visible.sync="dialogFormVisible5" 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="imageUrl"
- action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
- :on-success="handleAvatarSuccess">
- <img v-if="imageUrl" :src="imageUrl" 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="url" 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="name" 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="describes" placeholder="请输入描述"></el-input>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible5 = false">取 消</el-button>
- <el-button type="primary" @click="addNoticeTo5()">确 定</el-button>
- </div>
- </el-dialog>
- </el-tab-pane>
- <!-- 修改弹框 -->
- <el-dialog title="修改" :visible.sync="dialogFormVisible1" center>
- <el-form :model="form">
- <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="imageUrl"
- action="https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload" :show-file-list="false"
- :on-success="handleAvatarSuccess2">
- <img v-if="form.imageUrl" :src="form.imageUrl" 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="form.url" style="width:65%;"></el-input>
- </el-form-item>
- <el-form-item label="名称:" :label-width="formLabelWidth">
- <el-input v-model="form.name" style="width:65%;"></el-input>
- </el-form-item>
- <el-form-item label="备注:" :label-width="formLabelWidth">
- <el-input v-model="form.describes" style="width:65%;"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible1 = false">取 消</el-button>
- <el-button type="primary" @click="amendNoticeTo()">确 定</el-button>
- </div>
- </el-dialog>
- </el-tabs>
- </template>
- <script>
- export default {
- data() {
- return {
- page: 1,
- limit: 10,
- classify: 1,
- openValue: 1,
- closeValue: 2,
- name: '',
- imageUrl: '',
- url: '',
- state: -1,
- describes: '',
- hideUpload: false,
- activeName: 'first',
- dialogFormVisible: false,
- dialogFormVisible1: false,
- dialogFormVisible2: false,
- dialogFormVisible3: false,
- dialogFormVisible4: false,
- dialogFormVisible5: false,
- dialogFormVisible6: false,
- tableDataLoading: true,
- formLabelWidth: '200px',
- tableData: [],
- choicenData: [],
- choicenData2: [],
- checkBoxData: [], //多选框选择的值
- keyword: '',
- info: {
- stockDate: this.getNowTime(), //日期
- },
- states: [{
- label: '显示',
- value: 1
- },
- {
- label: '隐藏',
- value: 2
- }
- ],
- form: {
- id: '',
- name: '',
- imageUrl: '',
- url: '',
- classify: '',
- createTime: '',
- sort: '',
- state: '',
- describes: ''
- }
- }
- },
- methods: {
- // 多选
- changeFun(val) {
- this.checkBoxData = val;
- },
- //处理默认选中当前日期
- getNowTime() {
- var now = new Date();
- var year = now.getFullYear(); //得到年份
- var month = now.getMonth(); //得到月份
- var date = now.getDate(); //得到日期
- var hh = now.getHours() < 10 ? "0" + now.getHours() : now.getHours();
- var mm = now.getMinutes() < 10 ? "0" + now.getMinutes() : now.getMinutes();
- var ss = now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds();
- month = month + 1;
- month = month.toString().padStart(2, "0");
- date = date.toString().padStart(2, "0");
- var defaultDate = `${year}-${month}-${date} ${hh}:${mm}:${ss}`;
- return defaultDate;
- this.$set(this.info, "stockDate", defaultDate);
- },
- // tabs切换
- handleClick(tab, event) {
- if (tab._props.label == '轮播图') {
- this.page = 1
- this.limit = 10
- this.classify = 1
- this.dataSelect()
- }
- // if (tab._props.label == '首页分类') {
- // this.page = 1
- // this.limit = 10
- // this.classify = 2
- // this.dataSelect()
- // }
- if (tab._props.label == '商家类型') {
- this.page = 1
- this.limit = 10
- this.classify = 3
- this.dataSelect()
- }
- if (tab._props.label == '首页分类') {
- this.page = 1
- this.limit = 10
- this.classify = 4
- this.dataSelect()
- }
- if (tab._props.label == '背景图') {
- this.page = 1
- this.limit = 10
- this.classify = 5
- this.dataSelect()
- }
- if (tab._props.label == '精选商品') {
- this.page = 1
- this.limit = 10
- this.choicenSelect()
- this.handpick()
- }
- },
- //上传成功
- handleAvatarSuccess(file) {
- this.imageUrl = file.data
- },
- handleAvatarSuccess2(file2) {
- this.form.imageUrl = file2.data
- },
- handleSizeChange(val) {
- this.limit = val;
- this.dataSelect();
- },
- handleCurrentChange(val) {
- this.page = val;
- this.dataSelect();
- },
- handleSizeChange3(val) {
- this.limit = val;
- this.choicenSelect()
- },
- handleCurrentChange3(val) {
- this.page = val;
- this.choicenSelect()
- },
- // 是否启用
- change(val, row) {
- this.$http({
- url: this.$http.adornUrl(`banner/updateBannerStateById?id=${row.id}`),
- method: 'post',
- data: this.$http.adornData({})
- }).then(({
- data
- }) => {
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.dataSelect()
- }
- })
- })
- },
- //添加banner图
- addNotice() {
- this.dialogFormVisible = true
- },
- // 添加banner图
- addNoticeTo() {
- if (this.imageUrl == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请上传图片',
- type: 'warning'
- });
- return
- }
- if (this.name == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请输入名称',
- type: 'warning'
- });
- return
- }
- this.classify = 1
- this.$http({
- url: this.$http.adornUrl('banner/insertBanner'),
- method: 'post',
- data: this.$http.adornData({
- 'classify': this.classify,
- 'imageUrl': this.imageUrl,
- 'state': this.state,
- 'url': this.url,
- 'name': this.name,
- 'describes': this.describes
- })
- }).then(({
- data
- }) => {
- this.dialogFormVisible = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.imageUrl = ''
- this.state = ''
- this.url = ''
- this.name = ''
- this.describes = ''
- this.dataSelect()
- }
- })
- })
- },
- // 修改
- amendBanner(index, rows) {
- this.dialogFormVisible1 = true
- this.form.id = rows.id
- this.form.imageUrl = rows.imageUrl
- this.form.url = rows.url
- this.form.sort = rows.sort
- this.form.state = rows.state
- this.form.name = rows.name
- this.form.describes = rows.describes
- },
- // 修改
- amendNoticeTo() {
- this.$http({
- url: this.$http.adornUrl(
- `banner/updateBannerById?id=${this.form.id}&createTime=${this.info.stockDate}&imageUrl=${this.form.imageUrl}&url=${this.form.url}&state=${this.form.state}&sort=${this.form.sort}&name=${this.form.name}&describes=${this.form.describes}`
- ),
- method: 'post',
- data: this.$http.adornData({})
- }).then(({
- data
- }) => {
- this.dialogFormVisible1 = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.dataSelect()
- }
- })
- })
- },
- //添加任务分类
- addNotice2() {
- this.dialogFormVisible2 = true
- },
- // 添加添加任务分类
- addNoticeTo2() {
- if (this.imageUrl == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请上传图片',
- type: 'warning'
- });
- return
- }
- if (this.name == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请输入名称',
- type: 'warning'
- });
- return
- }
- this.classify = 2
- this.$http({
- url: this.$http.adornUrl('banner/insertBanner'),
- method: 'post',
- data: this.$http.adornData({
- 'classify': this.classify,
- 'imageUrl': this.imageUrl,
- 'state': this.state,
- 'url': this.url,
- 'name': this.name,
- 'describes': this.describes
- })
- }).then(({
- data
- }) => {
- this.dialogFormVisible2 = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.imageUrl = ''
- this.state = ''
- this.url = ''
- this.name = ''
- this.describes = ''
- this.dataSelect()
- }
- })
- })
- },
- //添加活动
- addNotice3() {
- this.dialogFormVisible3 = true
- },
- // 添加添加活动
- addNoticeTo3() {
- if (this.imageUrl == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请上传图片',
- type: 'warning'
- });
- return
- }
- if (this.name == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请输入名称',
- type: 'warning'
- });
- return
- }
- this.classify = 3
- this.$http({
- url: this.$http.adornUrl('banner/insertBanner'),
- method: 'post',
- data: this.$http.adornData({
- 'classify': this.classify,
- 'imageUrl': this.imageUrl,
- 'state': this.state,
- 'url': this.url,
- 'name': this.name,
- 'describes': this.describes
- })
- }).then(({
- data
- }) => {
- this.dialogFormVisible3 = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.imageUrl = ''
- this.state = ''
- this.url = ''
- this.name = ''
- this.describes = ''
- this.dataSelect()
- }
- })
- })
- },
- //添加精品服务
- addNotice4() {
- this.dialogFormVisible4 = true
- },
- // 添加精品服务
- addNoticeTo4() {
- if (this.imageUrl == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请上传图片',
- type: 'warning'
- });
- return
- }
- if (this.name == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请输入名称',
- type: 'warning'
- });
- return
- }
- this.classify = 4
- this.$http({
- url: this.$http.adornUrl('banner/insertBanner'),
- method: 'post',
- data: this.$http.adornData({
- 'classify': this.classify,
- 'imageUrl': this.imageUrl,
- 'state': this.state,
- 'url': this.url,
- 'name': this.name,
- 'describes': this.describes
- })
- }).then(({
- data
- }) => {
- this.dialogFormVisible4 = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.imageUrl = ''
- this.state = ''
- this.url = ''
- this.name = ''
- this.describes = ''
- this.dataSelect()
- }
- })
- })
- },
- //添加活动背景图
- addNotice5() {
- if (this.tableData.length == 1) {
- this.$message({
- title: '提示',
- duration: 1800,
- message: '活动背景图只能添加一张',
- type: 'warning'
- });
- } else {
- this.dialogFormVisible5 = true
- }
- },
- // 添加背景图
- addNoticeTo5() {
- if (this.imageUrl == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- type: 'success',
- message: '请上传图片',
- type: 'warning'
- });
- return
- }
- if (this.name == '') {
- this.$notify({
- title: '提示',
- duration: 1800,
- message: '请输入名称',
- type: 'warning'
- });
- return
- }
- this.classify = 5
- this.$http({
- url: this.$http.adornUrl('banner/insertBanner'),
- method: 'post',
- data: this.$http.adornData({
- 'classify': this.classify,
- 'imageUrl': this.imageUrl,
- 'state': this.state,
- 'url': this.url,
- 'name': this.name,
- 'describes': this.describes
- })
- }).then(({
- data
- }) => {
- this.dialogFormVisible5 = false
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.imageUrl = ''
- this.state = ''
- this.url = ''
- this.name = ''
- this.describes = ''
- this.dataSelect()
- }
- })
- })
- },
- // 删除banner图
- deletes(row) {
- let delid = row.id
- this.$confirm(`确定删除此条信息?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$http({
- url: this.$http.adornUrl(`banner/deleteBannerById?ids=${delid}`),
- method: 'get',
- data: this.$http.adornData({})
- }).then(({
- data
- }) => {
- this.$message({
- message: '删除成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.dataSelect()
- }
- })
- })
- }).catch(() => {})
- },
- // 获取数据列表
- dataSelect() {
- this.tableDataLoading = true
- this.$http({
- url: this.$http.adornUrl('banner/selectBannerList'),
- method: 'get',
- params: this.$http.adornParams({
- 'state': this.state,
- 'classify': this.classify,
- })
- }).then(({
- data
- }) => {
- if (data && data.code === 0) {
- this.tableDataLoading = false
- let returnData = data.data;
- this.tableData = returnData;
- }
- })
- },
- //添加精选商品
- choiaddNotice() {
- this.dialogFormVisible6 = true
- },
- // 添加商品
- releasNoticeTo(row) {
- this.$http({
- url: this.$http.adornUrl('commodity/save'),
- method: 'post',
- data: this.$http.adornData({
- 'activityid': row.activityid,
- 'couponendtime': row.couponendtime,
- 'couponmoney': row.couponmoney,
- 'couponstarttime': row.couponstarttime,
- 'couponurl': row.couponurl,
- 'deposit': row.deposit,
- 'deposit_deduct': row.deposit_deduct,
- 'item_from': row.item_from,
- 'itemdesc': row.itemdesc,
- 'itemendprice': row.itemendprice,
- 'itemid': row.itemid,
- 'itempic': row.itempic,
- 'itemprice': row.itemprice,
- 'itemsale': row.itemsale,
- 'itemshorttitle': row.itemshorttitle,
- 'itemtitle': row.itemtitle,
- 'presale_end_time': row.presale_end_time,
- 'presale_start_time': row.presale_start_time,
- 'presale_tail_end_time': row.presale_tail_end_time,
- 'presale_tail_start_time': row.presale_tail_start_time,
- 'sellernick': row.sellernick,
- 'shopname': row.shopname,
- 'shoptype': row.shoptype,
- 'taobao_image': row.taobao_image,
- 'tkrates': row.tkrates,
- 'videoid': row.videoid,
- })
- }).then(({
- data
- }) => {
- if (data && data.code === 0) {
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.choicenSelect()
- this.keyword = ''
- }
- })
- } else {
- this.$message.error(data.msg)
- }
- })
- },
- // 精选淘宝商品
- handpick() {
- this.tableDataLoading = true
- this.keyword = '网红'
- this.$http({
- url: this.$http.adornUrl2(
- `/supersearch/apikey/maxd/back/20/sort/2/keyword/${this.keyword}/is_coupon/1/tb_p/1/min_id/1`),
- method: 'get',
- params: this.$http.adornParams({})
- }).then(({
- data
- }) => {
- if (data && data.code === 1) {
- this.tableDataLoading = false
- this.keyword = ''
- let returnData = data.data;
- this.choicenData2 = returnData
- }
- })
- },
- // 搜索
- shousuo() {
- this.tableDataLoading = true
- this.$http({
- url: this.$http.adornUrl2(
- `/supersearch/apikey/maxd/back/100/sort/2/keyword/${this.keyword}/is_coupon/1/tb_p/1/min_id/1`),
- method: 'get',
- params: this.$http.adornParams({})
- }).then(({
- data
- }) => {
- console.log(data)
- if (data && data.code === 1) {
- this.tableDataLoading = false
- let returnData = data.data;
- this.choicenData2 = returnData
- }
- })
- },
- // 精选商品列表
- choicenSelect() {
- this.tableDataLoading = true
- this.$http({
- url: this.$http.adornUrl('commodity/selectCommodityList'),
- method: 'get',
- params: this.$http.adornParams({
- 'page': this.page,
- 'limit': this.limit
- })
- }).then(({
- data
- }) => {
- this.tableDataLoading = false
- let returnData = data.data;
- this.choicenData = returnData
- })
- },
- // 批量删除任务
- choideletes(id) {
- var ids = id ? [id] : this.checkBoxData.map(item => {
- return item.id
- })
- this.$http({
- url: this.$http.adornUrl(`/commodity/deleteById?id=${ids}`),
- method: 'post',
- data: this.$http.adornData({})
- }).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.adornUrl(`/commodity/deleteById/?id=${delid}`),
- method: 'post',
- data: this.$http.adornData({})
- }).then(({
- data
- }) => {
- this.$message({
- message: '删除成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.choicenSelect()
- }
- })
- })
- }).catch(() => {})
- },
- },
- mounted() {
- this.dataSelect()
- }
- }
- </script>
- <style>
- .customWidth {
- width: 80% !important;
- }
- </style>
|