| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-share-pop');
- ?>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <div>
- <span>次卡列表</span>
- <el-form size="small" :inline="true" style="float: right;margin-top: -5px;">
- <el-form-item>
- <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="toAdd()">新建次卡
- </el-button>
- </el-form-item>
- </el-form>
- </div>
- </div>
- <div class="table-body">
- 次卡名称:
- <div class="input-item">
- <el-input @keyup.enter.native="search" size="small" placeholder="请输入次卡名称" v-model="searchData.name" clearable @clear="search"></el-input>
- </div>
- 状态:
- <el-select size="small" v-model="searchData.is_on_sales" @change='search' class="select" style="float:none;width: 140px;">
- <el-option key="" label="全部" value=""></el-option>
- <el-option key="0" label="下架" value="0"></el-option>
- <el-option key="1" label="正常" value="1"></el-option>
- </el-select>
- 选择日期:
- <el-date-picker
- size="small"
- v-model="searchData.date_time"
- type="datetimerange"
- range-separator="至"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- value-format="yyyy-MM-dd HH:mm:ss"
- >
- </el-date-picker>
- <div style="display: inline-block;margin-left: 10px;">
- <el-button type="primary" size="small" @click="search">查询</el-button>
- <el-button type="primary" size="small" @click="resetForm" style=" margin-left: 0px;background-color: #ef1818;border-color: #ef1818;">重置</el-button>
- </div>
- </div>
- <div class="table-body">
- <template>
- <el-table ref="multipleTable" :data="list" @sort-change="sortChange"
- >
- <!-- 空数据 -->
- <template slot="empty">
- <el-empty description="暂无数据"></el-empty>
- </template>
- <el-table-column prop="id" label="id" align="center"></el-table-column>
- <el-table-column prop="name" label="次卡名称" align="center"></el-table-column>
- <el-table-column prop="store_counts" label="适用门店" align="center">
- <template slot-scope="scope">
- <el-button @click="showCanClerkStore(scope.row.id,scope.row.name)" type="text" size="small">{{scope.row.store_counts}}</el-button>
- </template>
- </el-table-column>
- <el-table-column prop="max_times" label="库存" align="center" sortable="max_times"></el-table-column>
- <el-table-column prop="total_redemption" label="累计兑卡张数" align="center" sortable="total_redemption"></el-table-column>
- <el-table-column prop="total_sales" label="累计售卡数" align="center" sortable="total_sales"></el-table-column>
- <el-table-column prop="total_sales_price" label="累计售卡金额" align="center" sortable="total_sales_price"></el-table-column>
- <el-table-column prop="source" label="创建来源" align="center"></el-table-column>
- <el-table-column prop="is_on_sales" label="次卡状态" align="center">
- <template slot-scope="scope">
- <div v-if="scope.row.is_on_sales ==0">
- 下架
- </div>
- <div v-else>
- 正常
- </div>
- </template>
- </el-table-column>
- <el-table-column label="创建时间" prop="created_at" align="center" width="200" sortable="created_at">
- <template slot-scope="scope">
- {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
- </template>
- </el-table-column>
- <el-table-column align="center" label="操作" width="200">
- <template slot-scope="scope">
- <el-button @click="toPromotion(scope.row)" type="text" size="small">推广</el-button>
- <el-button @click="toEdit(scope.row)" type="text" size="small">编辑</el-button>
- <el-button @click="toRedemptionCode(scope.row.id)" type="text" size="small">兑换码</el-button>
- <el-dropdown style="margin-left: 10px">
- <el-button type="text" class="el-dropdown-link">
- 更多<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item v-if="scope.row.is_on_sales==1">
- <div style="width: 100%; height: 100%;" @click="changeIsOnSales(scope.row.id)">
- <el-button type="text" class="copy_btn">下架</el-button>
- </div>
- </el-dropdown-item>
- <el-dropdown-item v-if="scope.row.is_on_sales==0">
- <div style="width: 100%; height: 100%;" @click="uploadIsOnSales(scope.row.id)">
- <el-button type="text" class="copy_btn">上架</el-button>
- </div>
- </el-dropdown-item>
- <el-dropdown-item>
- <el-button @click="toOrder(scope.row.name,scope.row.id)" type="text" size="small">记录</el-button>
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- </el-table-column>
- </el-table>
- </template>
- <!-- 分页 -->
- <el-row type="flex" class="page" justify="end">
- <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount" v-if="list"></el-pagination>
- </el-row>
- </div>
- <el-dialog title="可核销店铺" :visible.sync="dialogContent" :before-close="handleClose">
- 权益卡:{{secondary_card_name}}
- <el-table :data="gridData">
- <el-table-column property="store_name" label="店铺名称" width="150" align="center"></el-table-column>
- <el-table-column property="type_text" label="类型" align="center"></el-table-column>
- <el-table-column property="address" label="地址" align="center"></el-table-column>
- <el-table-column label="店长/联系方式" width="200" align="center">
- <template slot-scope="scope">
- {{scope.row.shop_owner}}</br>
- {{scope.row.shop_mobile}}</br>
- </template>
- </el-table-column>
- </el-table>
- <el-row type="flex" class="page" justify="end">
- <el-pagination @current-change="paginationClerkStore" background layout="prev, pager, next" :page-count="pageCountClerk" v-if="list"></el-pagination>
- </el-row>
- </el-dialog>
- <el-dialog title="推广二维码/链接(使用对应的APP扫码,即可访问内容详情)" :visible.sync="dialogVisible" width="40%">
- <el-tabs :tab-position="tabPosition">
- <el-tab-pane label="微信公众号" class="flex-x-centet">
- <div style="width: 180px; height: 180px;background: #F2F2F2;margin-right: 12px;" flex="main:center cross:center">
- <el-image id="code-img" style="width: 144px; height: 144px;" :src="qrCodeImg"></el-image>
- </div>
- <el-button flex type="text" @click="downloadShareImg('qrcode')">下载二维码</el-button>
- <template>
- <span id="target"> {{promotion_code}}
- <el-button type="text" id="copy_btn" data-clipboard-action="copy" data-clipboard-target="#target" size="mini">复制</el-button>
- </span>
- </template>
- </el-tab-pane>
- <el-tab-pane label="微信小程序" class="flex-x-centet">
- <div style="width: 180px; height: 180px;background: #F2F2F2;margin-right: 12px;" flex="main:center cross:center">
- <el-image id="code-img" style="width: 144px; height: 144px;" :src="applet_code"></el-image>
- </div>
- <el-button flex type="text" @click="downloadShareImg('mini_qrcode')">下载二维码</el-button>
- </el-tab-pane>
- </el-tabs>
- </el-dialog>
- <div id="qrcode" style="width:100px; height:100px; margin-top:15px; display: none"></div>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- loading: false,
- list: [],
- searchData: {
- name: '',
- is_on_sales: '',
- date_time: '',
- },
- pageCount: 0,
- page: 1,
- currentPage: null,
- listLoading: false,
- type: '',
- sort: '',
- sort_column:'',
- sort_order:'',
- dialogContent:false,
- gridData: [],
- secondary_card_name: '',
- secondary_card_id: '',
- page_clerk: 1,
- pageCountClerk: 0,
- currentPageClerk: null,
- dialogVisible: false,
- tabPosition:'left',
- qrCodeImg:"",
- applet_code:"",
- promotion_code:""
- };
- },
- created() {
- this.searchData.order_no = getQuery('order_no')
- },
- methods: {
- //搜索
- search() {
- this.page = 1;
- this.loadData();
- },
- pagination(currentPage) {
- this.page = currentPage;
- this.loadData();
- },
- loadData() {
- this.listLoading = true;
- var param = {
- r: 'secondary-card/default/index',
- page: this.page,
- name: this.searchData.name,
- is_on_sales: this.searchData.is_on_sales,
- date_time: this.searchData.date_time,
- sort_column:this.sort_column,
- sort_order:this.sort_order,
- limit: 15
- }
- request({
- params: param,
- }).then(e => {
- if (e.data.code === 0) {
- this.list = e.data.data.list;
- this.pageCount = e.data.data.page_count;
- this.currentPage = e.data.data.pagination.current_page;
- } else {
- this.$message.error(e.data.msg);
- }
- this.listLoading = false;
- }).catch(e => {
- this.listLoading = false;
- });
- },
- //重置
- resetForm() {
- this.searchData.is_on_sales = '';
- this.searchData.date_time = '';
- this.searchData.name = '';
- },
- toAdd(){
- this.$navigate({
- r: 'secondary-card/default/edit'
- })
- },
- toEdit(row){
- this.$navigate({
- r: 'secondary-card/default/edit',
- id: row.id,
- use_type:row.use_type
- })
- },
- toRedemptionCode(id){
- this.$navigate({
- r: 'secondary-card/default/redemption-code',
- id: id
- })
- },
- toOrder(secondary_card_name,id){
- this.$navigate({
- r: 'secondary-card/default/order',
- secondary_card_name: secondary_card_name,
- secondary_card_id: id,
- })
- },
- sortChange( column, prop, order){
- this.sort_order = column.order;
- this.sort_column = column.prop;
- this.loadData();
- },
- handleClose(done) {
- this.page_clerk= 1;
- this.pageCountClerk=0;
- this.currentPageClerk=null;
- this.dialogContent = false;
- },
- changeIsOnSales(id){
- let self = this;
- self.$confirm('是否下架该次卡?', '警告', {
- type: 'warning'
- }).then(() => {
- request({
- params: {
- r: 'secondary-card/default/change-is-on-sales',
- },
- method: 'post',
- data: {
- id: id,
- is_on_sales: 0,
- },
- }).then(e => {
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.loadData();
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- })
- },
- uploadIsOnSales(id){
- let self = this;
- self.$confirm('是否上架该次卡?', '警告', {
- type: 'warning'
- }).then(() => {
- request({
- params: {
- r: 'secondary-card/default/upload-is-on-sales',
- },
- method: 'post',
- data: {
- id: id,
- is_on_sales: 1,
- },
- }).then(e => {
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.loadData();
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- })
- },
- showCanClerkStore(secondary_card_id,secondary_card_name){
- this.secondary_card_name =secondary_card_name;
- this.secondary_card_id = secondary_card_id;
- this.dialogContent = true;
- var param = {
- r: 'secondary-card/default/can-clerk-store-list',
- page: this.page_clerk,
- id: secondary_card_id,
- limit: 15
- }
- request({
- params: param,
- }).then(e => {
- if (e.data.code === 0) {
- this.gridData = e.data.data.list;
- this.pageCountClerk = e.data.data.page_count;
- this.currentPageClerk = e.data.data.pagination.current_page;
- } else {
- this.$message.error(e.data.msg);
- }
- this.listLoading = false;
- }).catch(e => {
- this.listLoading = false;
- });
- },
- paginationClerkStore(currentPage) {
- this.page_clerk = currentPage;
- this.showCanClerkStore(this.secondary_card_id ,this.secondary_card_name );
- },
- toPromotion(row){
- this.dialogVisible = true;
- let qrCodeDom = document.getElementById("qrcode")
- var qrcode = new QRCode(qrCodeDom, {
- width : 100,
- height : 100
- });
- var url = row.promotion_code;
- console.log(url,11111)
- this.promotion_code = url;
- qrcode.makeCode(url);
- let src = "";
- if(row.applet_code==''){
- request({
- params: {
- r: 'secondary-card/default/show-mini-promotion-code',
- },
- method: 'post',
- data: {
- id: row.id,
- },
- }).then(e => {
- if (e.data.code == 0) {
- this.applet_code = e.data.data.applet_code;
- } else {
- }
- }).catch(e => {
- console.log(e);
- });
- }else{
- this.applet_code = row.applet_code;
- }
- return new Promise((req, rej) => {
- setTimeout(() => {
- let img_arr = qrCodeDom.getElementsByTagName("img");
- let len = img_arr.length;
- src = img_arr[len-1].src;
- this.qrCodeImg = src
- req(src)
- }, 10);
- })
- },
- // 图片下载
- downloadShareImg(type, img) {
- let img_url = img;
- if ('qrcode' == type) {
- img_url = this.qrCodeImg;
- }
- if ('mini_qrcode' == type) {
- img_url = this.applet_code;
- }
- fetch(img_url).then(res => res.blob().then(blob => {
- var a = document.createElement('a');
- var url = window.URL.createObjectURL(blob);
- a.href = url;
- a.download = "";
- a.click();
- window.URL.revokeObjectURL(url);
- }))
- },
- },
- mounted: function() {
- this.page = getQuery('page') ? getQuery('page') : 1;
- this.loadData();
- },
- });
- var clipboard = new ClipboardJS('#copy_btn');
- var self = this;
- clipboard.on('success', function(e) {
- self.ELEMENT.Message.success('复制成功');
- e.clearSelection();
- });
- clipboard.on('error', function(e) {
- self.ELEMENT.Message.success('复制失败,请手动复制');
- });
- </script>
- <style>
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- /* .table-info .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- } */
- .input-item {
- display: inline-block;
- width: 150px;
- margin: 0 0 20px;
- margin-right: 10px;
- }
- .input-item .el-input__inner {
- border-right: 1px solid #dcdfe6;
- }
- .input-item .el-input__inner:hover {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- .select {
- float: left;
- width: 100px;
- margin-right: 10px;
- }
- .el-table th>.cell {
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper,
- .el-table__header-wrapper {
- border-bottom: 1.4px solid #D6D6D6;
- }
- .search-sort {
- display: inline-block;
- margin: 0px 10px;
- cursor: pointer;
- color: rgb(51, 51, 51);
- }
- .caret-wrapper {
- display: inline-flex;
- flex-direction: column;
- align-items: center;
- height: 25px;
- width: 11px;
- vertical-align: middle;
- cursor: pointer;
- overflow: initial;
- position: relative;
- }
- .caret-top {
- border: 5px solid transparent;
- margin: 1px 0;
- border-bottom-color: rgb(51, 51, 51);
- }
- .caret-bottom {
- border: 5px solid transparent;
- margin: 1px 0;
- border-top-color: rgb(51, 51, 51);
- }
- .active {
- border-top-color: rgb(41, 186, 156);
- }
- .ellipsis {
- font-size: 14px;
- color: #333;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .goods-wrapper {
- border: 2px solid #CCCCCC;
- display: inline-block
- }
- .goods-select {
- border: 2px solid #bb730c;
- }
- .goods-price {
- text-align: center;
- }
- .goods-price .number {
- color: red;
- font-weight: 600;
- font-size: 18px;
- }
- .goods-price .title {
- padding: 5px 0;
- color: #999;
- ;
- font-size: 10px;
- font-weight: 600;
- }
- .bottom-price .title {
- padding: 5px 0;
- color: #8b8888;
- ;
- font-size: 10px;
- }
- .bottom-price .number {
- color: #ff5100;
- font-size: 10px;
- }
- .goods-action {
- margin-top: 8px;
- }
- .goods-action .title {
- color: #0634aa;
- }
- .bottom-active {
- border-bottom-color: rgb(186, 41, 92);
- }
- .top-active {
- border-top-color: rgb(186, 41, 92);
- }
- .price {
- white-space: nowrap;
- }
- .goods-image {
- display: flex;
- justify-content: center;
- }
- .page {
- padding: 10px 0;
- }
- .flex-x-centet{
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- </style>
|