文件

1146 行
51 KiB
HTML
可执行文件

<!--[1.7.90]-->
<style>
th > .cell, td > .cell {
text-align: center;
white-space: nowrap;
}
#expressOrder .cell {
font-size: 12px;
}
.title {
line-height: 20px;
color: #333;
font-weight: bold;
margin-bottom: 20px;
}
.path-url-input-box {
display: flex;
align-items: center;
}
.path-url {
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-left: 10px;
text-align: left;
}
.max-dialog-content {
position: absolute;
bottom: 0;
right: 0;
height: calc(100vh - 115px);
overflow-y: auto;
margin: 0;
}
.param-json-list {
display: flex;
align-items: center;
margin: 8px 0;
}
.param-json-list-title {
color: #333;
font-size: 12px;
width: 80px;
margin-left: 10px;
}
.param-json-list-require {
color: red;
font-size: 12px;
width: 50px;
text-align: right;
}
.param-json-list-not-require {
color: #999;
font-size: 12px;
width: 50px;
text-align: right;
}
.param-json-list .el-button {
margin-left: 10px;
}
.param-json-list-input {
flex: 1;
max-width: 294px;
}
#ruleForm .el-input {
max-width: 500px;
}
.choose-goods-img {
max-width: 40px;
max-height: 40px;
}
</style>
<div id="storeXcxRoute" v-cloak>
<div class="title">地址库列表</div>
<!--搜索-->
<div>
<date-picker-range :date-time.sync="time"></date-picker-range>
<el-input placeholder="输入名称"
type="text"
size="small"
v-model="keyword"
clearable
@keydown.enter.exact.native.prevent="search" style="width:200px">
</el-input>
<el-select size="small"
v-model="route_status"
clearable
placeholder="状态"
style="padding-left:20px;width:200px">
<el-option label="开启" value="1"></el-option>
<el-option label="关闭" value="2"></el-option>
</el-select>
<el-button type="primary" plain @click="search" size="small" style="margin-left:20px;">搜索</el-button>
<if condition="$authArr['addRoute']">
<el-button type="primary" plain @click="showAddRoute=true" size="small" style="margin-left:20px;">新增
</el-button>
</if>
</div>
<!--地址库列表-->
<div style="max-width: calc(100vw - 208px);margin-top: 20px;">
<el-table border size="small" :data="routeList" style="width: calc(100vw - 208px);box-sizing: border-box;">
<el-table-column type="index" label="序号" width="60"></el-table-column>
<el-table-column prop="name" label="名称" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="type_name" label="页面" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column label="旧地址" min-width="300" show-overflow-tooltip>
<template slot-scope="scope" slot="header">
<el-tooltip class="item"
effect="dark"
content="针对普通版商城2.0.28及以下版本和DIY3.0.20及以下版本的商城"
placement="top-start">
<div>旧地址<el-button type="text" size="mini" icon="el-icon-question"></el-button></div>
</el-tooltip>
</template>
<template slot-scope="scope">
<div class="path-url-input-box">
<el-button round size="mini" @click="copyUrl(scope.row.path)">复制</el-button>
<div class="path-url">{{scope.row.path}}</div>
</div>
</template>
</el-table-column>
<el-table-column label="新地址" min-width="300" show-overflow-tooltip>
<template slot-scope="scope" slot="header">
<el-tooltip class="item"
effect="dark"
content="DIY3.0.21及以上版本的商城"
placement="top-start">
<div>新地址<el-button type="text" size="mini" icon="el-icon-question"></el-button></div>
</el-tooltip>
</template>
<template slot-scope="scope">
<div class="path-url-input-box">
<el-button round size="mini" @click="copyUrl(scope.row.diy_path)">复制</el-button>
<div class="path-url">{{scope.row.diy_path}}</div>
</div>
</template>
</el-table-column>
<!--<el-table-column prop="status" label="状态" min-width="60" show-overflow-tooltip>
<template slot-scope="scope">
<el-switch @change="changeStatus(scope.$index,scope.row.status,scope.row.id)"
:disabled="!changeRouteState"
v-model="scope.row.status"
inactive-value="0"
active-value="1">
</el-switch>
</template>
</el-table-column>-->
<el-table-column prop="add_time" label="添加时间" width="140" show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="50px" style="border-right: none;">
<template slot-scope="scope">
<el-button @click="delRoute(scope.row.id)" :disabled="!delRouteState" type="text" size="small">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="currentLen">
</el-pagination>
</div>
<!--新建地址弹框-->
<el-dialog title="新建地址"
:visible.sync="showAddRoute"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
:top="'0px'"
:width="'calc(100vw - 160px)'"
:custom-class="'max-dialog-content'"
:close-on-press-escape="false">
<el-form label-width="100px" id="ruleForm" :model="ruleForm" :rules="rules" ref="ruleForm" size="mini">
<el-form-item label="名称" prop="name">
<el-input v-model="ruleForm.name" placeholder="请输入自定义地址名称"></el-input>
</el-form-item>
<el-form-item label="选择入口" prop="checkIndex">
<el-select v-model="checkIndex"
clearable
filterable
placeholder="选择入口">
<el-option v-for="(item,index) in systemRouteList"
:key="item.id"
:label="item.name"
:value="index+1"></el-option>
</el-select>
<div>
<template v-for="(item,key) in ruleForm.param.param_json">
<template title="次卡、卡包详情">
<div class="param-json-list" v-if="key=='sub_card_type'">
<div class="param-json-list-require">必选</div>
<div class="param-json-list-title">选择类型</div>
<el-radio-group v-model="item.value" @change="selectSubCardType">
<el-radio :label="1">次卡</el-radio>
<el-radio :label="2">卡包</el-radio>
</el-radio-group>
</div>
<div class="param-json-list"
v-if="key=='sub_card_id' && ruleForm.param.param_json.sub_card_type">
<div class="param-json-list-require">必选</div>
<div class="param-json-list-title">次卡或卡包</div>
<div class="param-json-list-input">
<el-input readonly v-model="item.sub_card_name" placeholder="请选择次卡或卡包"></el-input>
</div>
<el-button @click="toShowSubCard">选择</el-button>
</div>
</template>
<template title="分类id、名称">
<div class="param-json-list" v-if="key=='class_id'">
<div class="param-json-list-not-require">非必选</div>
<div class="param-json-list-title">选择分类</div>
<div class="param-json-list-input">
<el-input readonly v-model="ruleForm.param.param_json.class_name.value"
placeholder="请选择分类(一级)"></el-input>
</div>
<el-button @click="showClass=true;classPage=1;getClass();">选择</el-button>
</div>
</template>
<template title="秒杀详情">
<div class="param-json-list" v-if="key=='seckill_act_id'">
<div class="param-json-list-require">必选</div>
<div class="param-json-list-title">秒杀活动</div>
<div class="param-json-list-input">
<el-input readonly v-model="item.seckill_name" placeholder="请选择秒杀活动"></el-input>
</div>
<el-button @click="showSeckill=true;seckillPage=1;getSeckill();">选择</el-button>
</div>
</template>
<template title="拼团详情">
<div class="param-json-list" v-if="key=='group_act_id'">
<div class="param-json-list-require">必选</div>
<div class="param-json-list-title">拼团活动</div>
<div class="param-json-list-input">
<el-input readonly v-model="item.group_name" placeholder="请选择拼团活动"></el-input>
</div>
<el-button @click="showGroup=true;groupPage=1;getGroup();">选择</el-button>
</div>
</template>
<template title="礼品卡详情">
<div class="param-json-list" v-if="key=='gift_act_id'">
<div class="param-json-list-require">必选</div>
<div class="param-json-list-title">礼品卡</div>
<div class="param-json-list-input">
<el-input readonly v-model="item.gift_name" placeholder="请选择礼品卡"></el-input>
</div>
<el-button @click="showGift=true;giftPage=1;getGift();">选择</el-button>
</div>
</template>
<template title="商品详情">
<div class="param-json-list" v-if="key=='goods_id'">
<div class="param-json-list-require">必选</div>
<div class="param-json-list-title">商品</div>
<div class="param-json-list-input">
<el-input readonly v-model="item.goods_name" placeholder="请选择商品"></el-input>
</div>
<el-button @click="showGoods=true;goodsPage=1;getGoods();">选择
</el-button>
</div>
</template>
<template title="预售详情">
<div class="param-json-list" v-if="key=='advance_goods_id'">
<div class="param-json-list-require">必选</div>
<div class="param-json-list-title">预售商品</div>
<div class="param-json-list-input">
<el-input readonly v-model="item.goods_name" placeholder="请选择预售商品"></el-input>
</div>
<el-button @click="showAdvance=true;advancePage=1;getAdvance();">选择</el-button>
</div>
</template>
</template>
</div>
</el-form-item>
<el-form-item label="地址">
<el-input readonly v-model="ruleForm.path" placeholder="选择地址及相关参数后将自动生成"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="showAddRoute = false">取 消</el-button>
<el-button size="small" type="primary" @click="sureAddRoute('ruleForm')">添加到地址库</el-button>
</span>
</el-dialog>
<!--次卡、卡包列表弹框-->
<el-dialog :title="subCardTitle"
:visible.sync="showSubCard"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
:top="'0px'"
:width="'calc(100vw - 160px)'"
:custom-class="'max-dialog-content'"
:close-on-press-escape="false">
<el-input placeholder="名称"
type="text"
size="small"
v-model="subCardKeyword"
clearable
@keydown.enter.exact.native.prevent="subCardPage=1;getSubCard();" style="width:200px">
</el-input>
</el-select>
<el-button type="primary" plain @click="subCardPage=1;getSubCard();" size="small" style="margin-left:20px;">搜索
</el-button>
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);margin-top: 20px;">
<el-table border :data="subCardList"
style="width: calc(100vw - 208px);border: none;box-sizing: border-box;">
<el-table-column type="index" label="序号" width="60"></el-table-column>
<el-table-column prop="name" label="名称" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="end_time" label="购买截止日期" min-width="140" show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="80px" style="border-right: none;">
<template slot-scope="scope">
<el-button @click="chooseSubCard(scope.row.id,scope.row.name)" round size="mini">选择</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@current-change="getSubCard"
:current-page="subCardPage"
:page-size="10"
layout="total, prev, pager, next, jumper"
:total="subCardLen">
</el-pagination>
</div>
</el-dialog>
<!--分类弹框-->
<el-dialog title="选择一级分类"
:visible.sync="showClass"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
:top="'0px'"
:width="'calc(100vw - 160px)'"
:custom-class="'max-dialog-content'"
:close-on-press-escape="false">
<el-input placeholder="分类名称"
type="text"
size="small"
v-model="classKeyword"
clearable
@keydown.enter.exact.native.prevent="classPage=1;getClass();" style="width:200px">
</el-input>
<el-button type="primary" plain @click="classPage=1;getClass();" size="small" style="margin-left:20px;">搜索
</el-button>
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);margin-top: 20px;">
<el-table border :data="classList"
style="width: calc(100vw - 208px);border: none;box-sizing: border-box;">
<el-table-column type="index" label="序号" width="60"></el-table-column>
<el-table-column prop="class_name" label="分类名称" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="code" label="编号" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="80px" style="border-right: none;">
<template slot-scope="scope">
<el-button @click="chooseClass(scope.row.id,scope.row.class_name)" round size="mini">选择
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@current-change="getClass"
:current-page="classPage"
:page-size="10"
layout="total, prev, pager, next, jumper"
:total="classLen">
</el-pagination>
</div>
</el-dialog>
<!--秒杀弹框-->
<el-dialog title="选择秒杀活动"
:visible.sync="showSeckill"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
:top="'0px'"
:width="'calc(100vw - 160px)'"
:custom-class="'max-dialog-content'"
:close-on-press-escape="false">
<el-input placeholder="秒杀活动名称"
type="text"
size="small"
v-model="seckillKeyword"
clearable
@keydown.enter.exact.native.prevent="seckillPage=1;getSeckill();" style="width:200px">
</el-input>
<el-button type="primary" plain @click="seckillPage=1;getSeckill();" size="small" style="margin-left:20px;">搜索
</el-button>
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);margin-top: 20px;">
<el-table border :data="seckillList"
style="width: calc(100vw - 208px);border: none;box-sizing: border-box;">
<el-table-column type="index" label="序号" width="60"></el-table-column>
<el-table-column prop="name" label="活动名称" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="goods_name" label="商品名称" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="stock" label="活动库存" min-width="50" show-overflow-tooltip></el-table-column>
<el-table-column prop="time" label="活动有效时间" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="80px" style="border-right: none;">
<template slot-scope="scope">
<el-button @click="chooseSeckill(scope.row.id,scope.row.name)" round size="mini">选择
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@current-change="getSeckill"
:current-page="seckillPage"
:page-size="10"
layout="total, prev, pager, next, jumper"
:total="seckillLen">
</el-pagination>
</div>
</el-dialog>
<!--拼团弹框-->
<el-dialog title="选择拼团活动"
:visible.sync="showGroup"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
:top="'0px'"
:width="'calc(100vw - 160px)'"
:custom-class="'max-dialog-content'"
:close-on-press-escape="false">
<el-input placeholder="拼团活动名称"
type="text"
size="small"
v-model="groupKeyword"
clearable
@keydown.enter.exact.native.prevent="groupPage=1;getGroup();" style="width:200px">
</el-input>
<el-button type="primary" plain @click="groupPage=1;getGroup();" size="small" style="margin-left:20px;">搜索
</el-button>
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);margin-top: 20px;">
<el-table border :data="groupList"
style="width: calc(100vw - 208px);border: none;box-sizing: border-box;">
<el-table-column type="index" label="序号" width="60"></el-table-column>
<el-table-column prop="act_name" label="活动名称" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="goods_name" label="商品名称" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="act_num" label="活动库存" min-width="50" show-overflow-tooltip></el-table-column>
<el-table-column prop="time" label="活动有效时间" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="80px" style="border-right: none;">
<template slot-scope="scope">
<el-button @click="chooseGroup(scope.row.id,scope.row.act_name)" round size="mini">选择
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@current-change="getGroup"
:current-page="groupPage"
:page-size="10"
layout="total, prev, pager, next, jumper"
:total="groupLen">
</el-pagination>
</div>
</el-dialog>
<!--礼品卡弹框-->
<el-dialog title="选择礼品卡"
:visible.sync="showGift"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
:top="'0px'"
:width="'calc(100vw - 160px)'"
:custom-class="'max-dialog-content'"
:close-on-press-escape="false">
<el-input placeholder="礼品卡活动名称"
type="text"
size="small"
v-model="giftKeyword"
clearable
@keydown.enter.exact.native.prevent="giftPage=1;getGift();" style="width:200px">
</el-input>
<el-button type="primary" plain @click="giftPage=1;getGift();" size="small" style="margin-left:20px;">搜索
</el-button>
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);margin-top: 20px;">
<el-table border :data="giftList"
style="width: calc(100vw - 208px);border: none;box-sizing: border-box;">
<el-table-column type="index" label="序号" width="60"></el-table-column>
<el-table-column prop="title" label="活动名称" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="time" label="活动有效时间" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="80px" style="border-right: none;">
<template slot-scope="scope">
<el-button @click="chooseGift(scope.row.id,scope.row.title)" round size="mini">选择
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@current-change="getGift"
:current-page="giftPage"
:page-size="10"
layout="total, prev, pager, next, jumper"
:total="giftLen">
</el-pagination>
</div>
</el-dialog>
<!--商品弹框-->
<el-dialog title="选择商品"
:visible.sync="showGoods"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
:top="'0px'"
:width="'calc(100vw - 160px)'"
:custom-class="'max-dialog-content'"
:close-on-press-escape="false">
<el-input placeholder="商品名称/货号/条码"
type="text"
size="small"
v-model="goodsKeyword"
clearable
@keydown.enter.exact.native.prevent="goodsPage=1;getGoods();" style="width:200px">
</el-input>
<template>
<select-goods-category :user-type="2"
:store-id="store_id"
:category-id1.sync="goodsClassId1"
:category-id2.sync="goodsClassId2"
:category-id3.sync="goodsClassId3"></select-goods-category>
</template>
<el-button type="primary" plain @click="goodsPage=1;getGoods();" size="small" style="margin-left:20px;">搜索
</el-button>
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);margin-top: 20px;">
<el-table border :data="goodsList"
style="width: calc(100vw - 208px);border: none;box-sizing: border-box;">
<el-table-column type="index" label="序号" width="60"></el-table-column>
<el-table-column prop="goods_name" label="商品名称" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column label="封面图" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
<el-image class="choose-goods-img" :src="scope.row.goods_img">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</template>
</el-table-column>
<el-table-column prop="goods_number" label="货号" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column prop="goods_code" label="条码" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column prop="goods_num" label="库存" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="80px" style="border-right: none;">
<template slot-scope="scope">
<el-button @click="chooseGoods(scope.row.id,scope.row.goods_name)" round size="mini">选择
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@current-change="getGoods"
:current-page="goodsPage"
:page-size="10"
layout="total, prev, pager, next, jumper"
:total="goodsLen">
</el-pagination>
</div>
</el-dialog>
<!--预售弹框-->
<el-dialog title="选择预售活动"
:visible.sync="showAdvance"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
:top="'0px'"
:width="'calc(100vw - 160px)'"
:custom-class="'max-dialog-content'"
:close-on-press-escape="false">
<el-input placeholder="商品名称/货号/条码"
type="text"
size="small"
v-model="advanceKeyword"
clearable
@keydown.enter.exact.native.prevent="advancePage=1;getAdvance();" style="width:200px">
</el-input>
<el-button type="primary" plain @click="advancePage=1;getAdvance();" size="small" style="margin-left:20px;">搜索
</el-button>
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);margin-top: 20px;">
<el-table border :data="advanceList"
style="width: calc(100vw - 208px);border: none;box-sizing: border-box;">
<el-table-column type="index" label="序号" width="60"></el-table-column>
<el-table-column prop="goods_name" label="商品名称" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column label="封面图" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
<el-image class="choose-goods-img" :src="scope.row.goods_img">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</template>
</el-table-column>
<el-table-column prop="goods_number" label="货号" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column prop="goods_code" label="条码" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column prop="goods_num" label="库存" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column fixed="right" label="操作" width="80px" style="border-right: none;">
<template slot-scope="scope">
<el-button @click="chooseAdvance(scope.row.goods_id,scope.row.goods_name)" round size="mini">选择
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@current-change="getAdvance"
:current-page="advancePage"
:page-size="10"
layout="total, prev, pager, next, jumper"
:total="advanceLen">
</el-pagination>
</div>
</el-dialog>
</div>
<script>
var storeXcxRoute = new Vue({
el: '#storeXcxRoute',
data: {
store_id: localStorage.store_id,
systemRouteList: {$systemRouteList},
changeRouteState: "{$authArr['changeRoute']}" == 1 ? true : false,
delRouteState: "{$authArr['delRoute']}" == 1 ? true : false,
routeList: [],
currentPage: 1,
currentLimit: 10,
showAddRoute: false,
keyword: '',
time: '',
route_status: '',
currentLen: 0,
showSubCard: false,//是否显示次卡列表
subCardTitle: '',//选择次卡列表title
subCardKeyword: '',//次卡搜索关键词
subCardType: '',//次卡类型 1次卡 2卡包
subCardList: [],//次卡列表
subCardPage: 1,//次卡分页
subCardLen: 0,//次卡总数量
showClass: false,//是否显示分类列表
classKeyword: '',//分类搜索关键词
classList: [],//一级分类列表
classPage: 1,//分类分页
classLen: 0,//分类总数量
goodsClassId1: '',
goodsClassId2: '',
goodsClassId3: '',
showSeckill: false,//是否显示秒杀活动列表
seckillKeyword: '',//秒杀搜索关键词
seckillList: [],//秒杀列表
seckillPage: 1,//秒杀分页
seckillLen: 0,//秒杀总数量
showGroup: false,//是否显示拼团活动列表
groupKeyword: '',//拼团搜索关键词
groupList: [],//拼团列表
groupPage: 1,//拼团分页
groupLen: 0,//拼团总数量
showGift: false,//是否显示礼品卡活动列表
giftKeyword: '',//礼品卡搜索关键词
giftList: [],//礼品卡列表
giftPage: 1,//礼品卡分页
giftLen: 0,//礼品卡总数量
showGoods: false,//是否显示商品列表
goodsKeyword: '',//商品搜索关键词
goodsList: [],//商品列表
goodsPage: 1,//商品分页
goodsLen: 0,//商品总数量
showAdvance: false,//是否显示预售选择框
advanceKeyword: '',//预售搜索关键词
advanceList: [],//预售列表
advancePage: 1,//预售分页
advanceLen: 0,//预售总数量
checkIndex: '',
ruleForm: {
name: '',
path: '',
param: {},
checkIndex: null,
},
rules: {
name: [{message: '请输入名称', required: true, trigger: 'change'}],
path: [{message: '请选择地址', required: true, trigger: 'change'}],
checkIndex: [{
validator: function (rule, value, callback) {
if (value <= 0) {
callback(new Error("请选择入口"));
} else {
callback();
}
}, required: true, trigger: 'change'
}],
},
},
methods: {
//选择地址
selectRoute(index) {
this.ruleForm.checkIndex = index;
if (index >= 1) {
var param = JSON.parse(JSON.stringify(this.systemRouteList[index - 1]));
this.ruleForm.param = param;
delete param.param_json.store_id;
if (JSON.stringify(param.param_json) == '{}' || param.param_json.class_id) {
this.createPath();
} else {
this.ruleForm.path = '';
}
} else {
this.clearRuleForm();
}
},
//清空添加的表单
clearRuleForm() {
this.ruleForm = {
name: '',
path: '',
param: {},
checkIndex: null,
};
this.checkIndex = '';
},
//切换次卡卡包类型
selectSubCardType(type) {
var param = JSON.parse(JSON.stringify(this.systemRouteList[this.ruleForm.checkIndex - 1]));
param.param_json.sub_card_type.value = type;
this.ruleForm.param = param;
},
//显示次卡、卡包列表
toShowSubCard() {
if (this.ruleForm.param.param_json.sub_card_type.value != 1 && this.ruleForm.param.param_json.sub_card_type.value != 2) {
this.$message({message: '请先选择卡的类型', type: 'warning'});
return;
}
if (this.subCardType != this.ruleForm.param.param_json.sub_card_type.value) {
this.subCardTitle = this.ruleForm.param.param_json.sub_card_type.value == 1 ? '选择次卡' : '选择卡包';
this.subCardType = this.ruleForm.param.param_json.sub_card_type.value;
this.subCardPage = 1;
this.subCardList = [];
this.getSubCard();
}
this.showSubCard = true;
},
//确认选择次卡或卡包
chooseSubCard(id, name) {
this.ruleForm.param.param_json.sub_card_id.value = id;
this.ruleForm.param.param_json.sub_card_id.sub_card_name = name;
this.createPath();
this.showSubCard = false;
},
//确认选择分类
chooseClass(id, name) {
this.ruleForm.param.param_json.class_id.value = id;
this.ruleForm.param.param_json.class_name.value = name;
this.createPath();
this.showClass = false;
},
//确认选择秒杀
chooseSeckill(id, name) {
this.ruleForm.param.param_json.seckill_act_id.value = id;
this.ruleForm.param.param_json.seckill_act_id.seckill_name = name;
this.createPath();
this.showSeckill = false;
},
//确认选择拼团
chooseGroup(id, name) {
this.ruleForm.param.param_json.group_act_id.value = id;
this.ruleForm.param.param_json.group_act_id.group_name = name;
this.createPath();
this.showGroup = false;
},
//确认选择礼品卡
chooseGift(id, name) {
this.ruleForm.param.param_json.gift_act_id.value = id;
this.ruleForm.param.param_json.gift_act_id.gift_name = name;
this.createPath();
this.showGift = false;
},
//确认选择商品
chooseGoods(id, name) {
this.ruleForm.param.param_json.goods_id.value = id;
this.ruleForm.param.param_json.goods_id.goods_name = name;
this.createPath();
this.showGoods = false;
},
//确认选择预售活动
chooseAdvance(id, name) {
this.ruleForm.param.param_json.advance_goods_id.value = id;
this.ruleForm.param.param_json.advance_goods_id.goods_name = name;
this.createPath();
this.showAdvance = false;
},
//生成地址
createPath() {
var obj = this.ruleForm.param.param_json;
var path = this.ruleForm.param.path;
var arr = ['store_id=' + this.store_id];
for (var key in obj) {
var temp = '';
if (obj[key].value !== '') {
if (obj[key]['as']) {
temp = obj[key]['as'] + '=' + obj[key].value;
} else {
temp = key + '=' + obj[key].value;
}
arr.push(temp);
}
}
this.ruleForm.path = path + '?' + arr.join('&');
},
//确认添加地址
sureAddRoute(ruleForm) {
this.$refs[ruleForm].validate((valid) => {
if (valid) {
sendRequest({
url: "{:U('addRoute')}",
data: {
name: this.ruleForm.name,
path: this.ruleForm.path,
type_name: this.ruleForm.param.name,
},
success: (res) => {
this.isSave = false;
if (res.status == 1) {
this.getData();
this.$message({message: res.msg, type: 'success'});
this.showAddRoute = false;
this.clearRuleForm();
} else {
this.$message({message: res.msg, type: 'error'});
}
}
});
}
});
},
//复制地址
copyUrl(path) {
try {
var oInput = document.createElement("input");
oInput.value = path;
document.body.appendChild(oInput);
oInput.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
oInput.className = "oInput";
oInput.style.display = "none";
this.$notify({
title: '成功',
message: '地址已成功复制到剪切板',
type: 'success',
duration: 2000
});
} catch (err) {
this.$notify({
title: '失败',
message: '复制失败',
type: 'error',
duration: 1500
});
console.log(err);
}
},
//修改状态
changeStatus(index, status, id) {
sendRequest({
url: "{:U('changeRoute')}",
data: {
id: id,
status: status,
},
success: (res) => {
if (res.status == 1) {
this.$message({message: res.msg, type: 'success'});
} else {
this.getData();
this.$message({message: res.msg, type: 'error'});
}
}
})
},
//删除
delRoute(id) {
this.$confirm('您确认要删除该地址吗,删除后将不能找回,请谨慎操作!', '提示', {
confirmButtonText: '确认删除',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
this.$loading({
lock: true,
text: '删除中,请等待',
spinner: 'el-icon-loading',
background: 'rgba(255, 255, 255, 0.7)'
});
sendRequest({
url: "{:U('delRoute')}",
data: {
id: id,
},
success: (res) => {
this.$loading().close();
if (res.status == 1) {
this.$message({message: res.msg, type: 'success'});
this.getData();
} else {
this.$message({message: res.msg, type: 'error'});
}
}
})
});
},
//搜索地址
search() {
this.currentPage = 1;
this.getData();
},
//切换地址每页数量
handleSizeChange(val) {
this.currentLimit = val;
this.currentPage = 1;
this.getData();
},
//切换地址页数
handleCurrentChange(val) {
this.currentPage = val;
this.getData();
},
//获取地址列表
getData() {
sendRequest({
url: "{:U('getRouteList')}",
data: {
page: this.currentPage,
limit: this.currentLimit,
time: this.time,
keyword: this.keyword,
route_status: this.route_status,
},
success: (res) => {
if (res.status == 1) {
this.routeList = [];
this.routeList = res.data;
this.currentLen = res.count;
} else {
this.$message({message: res.msg, type: 'error'});
}
}
})
},
//获取次卡或卡包列表
getSubCard() {
sendRequest({
url: "{:U('getSubCardList')}",
data: {
page: this.subCardPage,
limit: 10,
type: this.subCardType,
keyword: this.subCardKeyword,
},
success: (res) => {
if (res.status == 1) {
this.subCardList = [];
this.subCardList = res.data;
this.subCardLen = res.count;
} else {
this.$message({message: res.msg, type: 'error'});
}
}
})
},
//获取分类
getClass() {
sendRequest({
url: "{:U('getClass')}",
data: {
page: this.classPage,
limit: 10,
keyword: this.classKeyword,
},
success: (res) => {
if (res.status == 1) {
this.classList = [];
this.classList = res.data;
this.classLen = res.count;
} else {
this.$message({message: res.msg, type: 'error'});
}
}
})
},
//获取秒杀列表
getSeckill(page) {
if (typeof page == "number") {
this.seckillPage = page;
}
sendRequest({
url: "{:U('getSeckill')}",
data: {
page: this.seckillPage,
limit: 10,
keyword: this.seckillKeyword,
},
success: (res) => {
if (res.status == 1) {
this.seckillList = [];
this.seckillList = res.data;
this.seckillLen = res.count;
} else {
this.$message({message: res.msg, type: 'error'});
}
}
})
},
//获取拼团列表
getGroup(page) {
if (typeof page == "number") {
this.groupPage = page;
}
sendRequest({
url: "{:U('getGroup')}",
data: {
page: this.groupPage,
limit: 10,
keyword: this.groupKeyword,
},
success: (res) => {
if (res.status == 1) {
this.groupList = [];
this.groupList = res.data;
this.groupLen = res.count;
} else {
this.$message({message: res.msg, type: 'error'});
}
}
})
},
//获取礼品卡列表
getGift(page) {
if (typeof page == "number") {
this.giftPage = page;
}
sendRequest({
url: "{:U('getGift')}",
data: {
page: this.giftPage,
limit: 10,
keyword: this.giftKeyword,
},
success: (res) => {
if (res.status == 1) {
this.giftList = [];
this.giftList = res.data;
this.giftLen = res.count;
} else {
this.$message({message: res.msg, type: 'error'});
}
}
})
},
//获取商品列表
getGoods(page) {
if (typeof page == "number") {
this.goodsPage = page;
}
sendRequest({
url: "{:U('getGoodsList')}",
data: {
page: this.goodsPage,
person1: this.goodsClassId1,
person2: this.goodsClassId2,
person3: this.goodsClassId3,
limit: 10,
keyword: this.goodsKeyword,
},
success: (res) => {
if (res.status == 1) {
this.goodsList = [];
this.goodsList = res.data;
this.goodsLen = res.count;
} else {
this.$message({message: res.msg, type: 'error'});
}
}
})
},
//获取预售列表
getAdvance(page) {
if (typeof page == "number") {
this.advancePage = page;
}
sendRequest({
url: "{:U('AdvanceSale/advanceList')}",
data: {
page: this.advancePage,
limit: 10,
order_number: this.advanceKeyword,
},
success: (res) => {
if (res.status == 1) {
this.advanceList = [];
this.advanceList = res.data;
this.advanceLen = res.count;
} else {
this.$message({message: res.msg, type: 'error'});
}
}
})
},
},
created() {
this.getData();
},
watch: {
checkIndex: {
deep: true, handler(n, o) {
if (n !== o) {
this.selectRoute(n);
}
}
}
}
});
/**
* ajax post发送请求
*/
function sendRequest(options) {
$.ajax({
url: options.url,
data: options.data,
type: 'post',
success: function (res) {
options.success(res);
},
error: function () {
var res = {
status: 0,
msg: '请求发生错误',
};
options.success(res);
}
})
}
</script>