瀏覽代碼

添加需求

潘超林 7 月之前
父節點
當前提交
0adc8e7ddd

File diff suppressed because it is too large
+ 1144 - 61
package-lock.json


+ 3 - 1
package.json

@@ -42,12 +42,14 @@
     "core-js": "3.37.1",
     "echarts": "5.4.0",
     "element-ui": "2.15.14",
+    "exceljs": "^4.4.0",
     "file-saver": "2.0.5",
     "fuse.js": "6.4.3",
     "highlight.js": "9.18.5",
     "js-beautify": "1.13.0",
     "js-cookie": "3.0.1",
     "jsencrypt": "3.0.0-rc.1",
+    "moment": "^2.30.1",
     "nprogress": "0.2.0",
     "quill": "2.0.2",
     "screenfull": "5.0.2",
@@ -87,4 +89,4 @@
     "> 1%",
     "last 2 versions"
   ]
-}
+}

+ 17 - 0
src/api/active/index.js

@@ -0,0 +1,17 @@
+import request from '@/utils/request'
+
+
+export function promotionList(query) {
+    return request({
+        url: '/system/promotion/list',
+        method: 'get',
+        params: query
+    })
+}
+export function promotionSku(query) {
+    return request({
+        url: '/system/promotion/sku',
+        method: 'post',
+        data: query
+    })
+}

+ 26 - 0
src/api/common/index.js

@@ -0,0 +1,26 @@
+import request from '@/utils/request'
+
+export function getCity(query) {
+    return request({
+        url: '/getCity',
+        method: 'get',
+        params: query
+    })
+}
+
+export function getClassificationListPage(query) {
+    return request({
+        url: '/system/classification/getClassificationListPage',
+        method: 'get',
+        params: query
+    })
+}
+
+
+export function getStoreInfo(query) {
+    return request({
+        url: '/system/appUser/getStoreInfo',
+        method: 'get',
+        params: query
+    })
+}

+ 45 - 0
src/api/manage/equipment.js

@@ -0,0 +1,45 @@
+import request from '@/utils/request'
+
+
+export function equipmentList(query) {
+    return request({
+        url: '/system/home/list',
+        method: 'get',
+        params: query
+    })
+}
+
+
+export function addPrinter(query) {
+    return request({
+        url: '/system/home/addPrinter',
+        method: 'post',
+        data: query
+    })
+}
+export function editPrinter(query) {
+    return request({
+        url: '/system/home/editPrinter',
+        method: 'post',
+        data: query
+    })
+}
+
+// 销量管理顶部统计接口
+export function removePrinter(query) {
+    return request({
+        url: '/system/home/' + query,
+        method: 'delete',
+    })
+}
+
+
+// 销量管理顶部统计接口
+export function printOrder(query) {
+    return request({
+        url: '/system/home/print',
+        method: 'post',
+        data: query
+    })
+}
+

+ 56 - 0
src/api/manage/order.js

@@ -0,0 +1,56 @@
+import request from '@/utils/request'
+
+// 销量管理分页接口
+export function queryUserOrderByShopId(query) {
+    return request({
+        url: '/system/order/queryUserOrderByShopId',
+        method: 'get',
+        params: query
+    })
+}
+
+// 销量管理顶部统计接口
+export function statisticsOrderNum(query) {
+    return request({
+        url: '/system/order/statisticsOrderNum',
+        method: 'get',
+        params: query
+    })
+}
+
+// 销量管理顶部统计接口
+export function userOrderInfo(query) {
+    return request({
+        url: '/system/order/userOrderInfo/' + query,
+        method: 'get',
+    })
+}
+
+
+
+// 销量管理顶部统计接口
+export function statisticsAfterSaleOrder(query) {
+    return request({
+        url: '/system/afterSale/statisticsAfterSaleOrder',
+        method: 'get',
+        params: query
+    })
+}
+
+
+
+export function queryAfterSalePage(query) {
+    return request({
+        url: '/system/afterSale/queryAfterSalePage',
+        method: 'get',
+        params: query
+    })
+}
+
+export function afterSaleOrderInfo(query) {
+    return request({
+        url: '/system/afterSale/afterSaleOrderInfo/' + query,
+        method: 'get',
+    })
+}
+

+ 20 - 0
src/api/manage/sales.js

@@ -0,0 +1,20 @@
+import request from '@/utils/request'
+
+// 销量管理分页接口
+export function getSalesStatisticsPage(query) {
+    return request({
+        url: '/system/sales/getSalesStatisticsPage',
+        method: 'get',
+        params: query
+    })
+}
+
+// 销量管理顶部统计接口
+export function getSalesStatistics(query) {
+    return request({
+        url: '/system/sales/getSalesStatistics',
+        method: 'get',
+        params: query
+    })
+}
+

+ 37 - 0
src/api/system/voucher.js

@@ -0,0 +1,37 @@
+import request from '@/utils/request'
+
+export function voucherCreate(query) {
+    return request({
+        url: '/system/voucher/rule',
+        method: 'post',
+        data: query
+    })
+}
+
+export function voucherList(query) {
+    return request({
+        url: '/system/voucher/rule/list',
+        method: 'get',
+        params: query
+    })
+}
+export function voucherEdit(query) {
+    return request({
+        url: '/system/voucher/rule',
+        method: 'put',
+        data: query
+    })
+}
+export function voucherRemove(id) {
+    return request({
+        url: '/system/voucher/rule/' + id,
+        method: 'delete',
+    })
+}
+export function voucherEnable(query) {
+    return request({
+        url: '/system/voucher/enable',
+        method: 'get',
+        params: query
+    })
+}

二進制
src/assets/login/title.png


+ 469 - 0
src/components/YearRangePicker/index.vue

@@ -0,0 +1,469 @@
+<template>
+    <div class="yearPicker" ref="yearPicker" :style="{ width: width + 'px' }">
+        <!-- <div class="_inner labelText" :style="{ width: labelWidth + 'px' }">{{ labelText }}</div> -->
+        <input class="_inner" ref="inputLeft" v-model="startShowYear" @focus="onFocus" type="text" @click="clickInput"
+            name="yearInput" @input="checkStartInput($event)" placeholder="选择年份" />
+        <span>{{ sp }}</span>
+        <input class="_inner" ref="inputRight" v-model="endShowYear" @focus="onFocus" type="text" @click="clickInput"
+            name="yearInput" @input="checkEndInput($event)" placeholder="选择年份" />
+        <div class="_inner floatPanel" v-if="showPanel">
+            <div class="_inner leftPanel">
+                <div class="_inner panelHead">
+                    <i class="_inner el-icon-d-arrow-left" @click="onClickLeft"></i>
+                    {{ leftYearList[0] + "-" + leftYearList[9] }}
+                </div>
+                <div class="_inner panelContent">
+                    <div v-for="item in leftYearList" :class="{
+                        disabled: checkValidYear(item)!= 0,
+                        oneSelected: item === startYear && oneSelected,
+                        startSelected: item === startYear,
+                        endSelected: item === endYear,
+                        _inner: true,
+                        betweenSelected: item > startYear && item < endYear
+                    }" :key="item">
+                        <a :class="{
+                            cell: true,
+                            _inner: true,
+                            selected: item === startYear || item === endYear
+                        }" @click="onClickItem(item)" @mouseover="onHoverItem(item)">
+                            {{ item }}
+                        </a>
+                    </div>
+                </div>
+            </div>
+            <div class="_inner rightPanel">
+                <div class="_inner panelHead">
+                    <i class="_inner el-icon-d-arrow-right" @click="onClickRight"></i>
+                    {{ rightYearList[0] + "-" + rightYearList[9] }}
+                </div>
+                <div class="_inner panelContent">
+                    <div :class="{
+                        disabled: checkValidYear(item) != 0,
+                        startSelected: item === startYear,
+                        endSelected: item === endYear,
+                        betweenSelected: item > startYear && item < endYear
+                    }" v-for="item in rightYearList" :key="item">
+                        <a :class="{
+                            cell: true,
+                            _inner: true,
+                            selected: item === endYear || item === startYear
+                        }" @click="onClickItem(item)" @mouseover="onHoverItem(item)">
+                            {{ item }}
+                        </a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+  
+<script>
+const SELECT_STATE = {
+    unselect: 0,
+    selecting: 1,
+    selected: 2,
+};
+export default {
+    name: "YearPicker",
+    computed: {
+        oneSelected() {
+            return (
+                this.curState === SELECT_STATE.selecting &&
+                (this.startYear === this.endYear || this.endYear == null)
+            );
+        },
+        startDate() {
+            return this.startYear;
+        },
+        leftYearList() {
+            return this.yearList.slice(0, 10);
+        },
+        rightYearList() {
+            return this.yearList.slice(10, 20);
+        }
+ 
+    },
+    props: {
+        width: {
+            default: 200,
+        },
+        labelWidth: {
+            default: 80,
+        },
+        labelText: {
+            default: "",
+        },
+        sp: {
+            default: "至",
+        },
+        initYear: {
+            default: null,
+        },
+    },
+    data() {
+        return {
+            itemBg: {},
+            startShowYear: null,
+            endShowYear: null,
+            yearList: [],
+            showPanel: false,
+            startYear: null,
+            endYear: null,
+            curYear: 0,
+            curSelectedYear: 0,
+            curState: SELECT_STATE.unselect,
+        };
+    },
+    methods: {
+        checkValidYear(iYear) {
+            if (this.initYear) {
+                if (iYear > this.initYear.endYear) {
+                    return 1
+                } else if (iYear < this.initYear.startYear) {
+                    return -1
+                }
+            }
+            return 0
+        },
+        checkStartInput(event) {
+            if (isNaN(this.startShowYear)) {
+                this.startShowYear = this.startYear;
+            } else {
+                this.startYear = this.startShowYear * 1;
+            }
+        },
+ 
+        checkEndInput() {
+            if (isNaN(this.endShowYear)) {
+                this.endShowYear = this.endYear;
+            } else {
+                this.endYear = this.endShowYear * 1;
+            }
+        },
+        changeYear() {
+            if (this.startYear > this.endYear) {
+                let tmp = this.endYear;
+                this.endYear = this.startYear;
+                this.startYear = tmp;
+ 
+            }
+            if (this.initYear) {
+                this.startYear = Math.max(this.startYear, this.initYear.startYear)
+                this.endYear = Math.min(this.endYear, this.initYear.endYear)
+            }
+            this.startShowYear = this.startYear;
+            this.endShowYear = this.endYear;
+ 
+ 
+            if (this.startYear && this.endYear) {
+                this.$emit("updateTimeRange", {
+                    startYear: this.startYear,
+                    endYear: this.endYear + ""
+                });
+            } else {
+                console.warn("WARN:年份不合法", this.startYear, this.endYear);
+            }
+        },
+        onHoverItem(iYear) {
+            if (this.checkValidYear(iYear) != 0) {
+                return;
+            }
+            if (this.curState === SELECT_STATE.selecting) {
+                let tmpStart = this.curSelectedYear;
+                this.endYear = Math.max(tmpStart, iYear);
+                this.startYear = Math.min(tmpStart, iYear);
+            }
+        },
+        onClickItem(iYear) {
+            if (this.checkValidYear(iYear) != 0) {
+                return;
+            }
+ 
+            if (
+                this.curState === SELECT_STATE.unselect ||
+                this.curState === SELECT_STATE.selected
+            ) {
+                this.startYear = iYear;
+                this.curSelectedYear = iYear;
+                this.endYear = null;
+                this.curState = SELECT_STATE.selecting;
+            } else if (this.curState === SELECT_STATE.selecting) {
+                this.endShowYear = this.endYear;
+                this.startShowYear = this.startYear;
+                this.curState = SELECT_STATE.selected;
+                this.$emit("updateTimeRange", {
+                    startYear: this.startYear,
+                    endYear: this.endYear,
+                });
+ 
+                setTimeout(() => {
+                    //为动画留的时间,可优化
+                    this.showPanel = false;
+                }, 300);
+            }
+        },
+        onFocus() {
+            this.$nextTick(() => {
+                this.showPanel = true;
+            });
+        },
+        clickInput(e) {
+            e.stopPropagation();
+            return false;
+        },
+ 
+        updateYearList() {
+            let iStart = Math.floor(this.curYear / 10) * 10 - 10;
+            iStart = iStart < 0 ? 0 : iStart;
+            this.yearList = [];
+            for (let index = 0; index < 20; index++) {
+                this.yearList.push(iStart + index);
+            }
+        },
+ 
+        checkValidYear(iYear) {
+            if (this.initYear) {
+                if (iYear > this.initYear.endYear) {
+                    return 1
+                } else if (iYear < this.initYear.startYear) {
+                    return -1
+                }
+            }
+            return 0
+        },
+        closePanel(e) {
+            if (!this.showPanel) {
+                return;
+            }
+            if (typeof e.target.className !== "string" || e.target.className === "") {
+                this.$nextTick(() => {
+                    this.changeYear();
+                    this.showPanel = false;
+                });
+                return;
+            }
+            if (
+                e.target.className.indexOf("_inner") === -1 ||
+                (e.target.name === "yearInput" &&
+                    e.target !== this.$refs.inputLeft &&
+                    e.target !== this.$refs.inputRight)
+            ) {
+                this.$nextTick(() => {
+                    this.changeYear();
+                    this.showPanel = false;
+                });
+            }
+ 
+            e.stopPropagation();
+            return false;
+        },
+        onClickLeft() {
+            this.curYear = this.curYear * 1 - 10;
+            this.updateYearList();
+        },
+        onClickRight() {
+            this.curYear = this.curYear * 1 + 10;
+            this.updateYearList();
+        },
+ 
+        //------------------对外接口------------------------
+        // //直接传时间戳
+        // setYear(startYearStamp, endYearStamp) {
+        //     if (!isNaN(startYearStamp) && !isNaN(endYearStamp)) {
+        //         let startYear = moment(startYearStamp).format("yyyy");
+        //         let endYear = moment(endYearStamp).format("yyyy");
+        //         this.startYear = startYear * 1;
+        //         this.endYear = endYear * 1;
+        //         this.endShowYear = endYear * 1;
+        //         this.startShowYear = startYear * 1;
+        //     }
+        // },
+    },
+ 
+    created() {
+        this.curYear = new Date().getFullYear();
+        this.updateYearList();
+    },
+    beforeUnmount() {
+        document.removeEventListener("click", this.closePanel.bind(this));
+    },
+ 
+    mounted() {
+        document.addEventListener("click", this.closePanel.bind(this));
+    },
+};
+</script>
+<style lang="scss" scoped>
+.yearPicker {
+    font-size: 14px;
+    display: flex;
+    position: relative;
+    transition: all 0.3s;
+    justify-content: center;
+    input {
+        text-align: center;
+    }
+ 
+    input:first-child {
+        text-align: right;
+    }
+ 
+    background-color: #fff;
+ 
+    .labelText {
+        text-align: center;
+    }
+ 
+    span {
+        padding: 0 8px;
+        height: 32px;
+        line-height: 32px;
+    }
+ 
+    border: 1px solid #eff1f3;
+    height: 34px;
+    line-height: 34px;
+    border-radius: 4px;
+    padding: 0 28px 0 8px;
+    box-sizing: border-box;
+ 
+    .floatPanel {
+        >div {
+            width: 50%;
+        }
+ 
+        padding: 0 16px;
+        position: absolute;
+        display: flex;
+        background-color: #fff;
+        z-index: 2000;
+        border-radius: 4px;
+        width: 650px;
+        height: 250px;
+        top: 40px;
+        left: -10px;
+        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ 
+        .panelContent {
+            display: flex;
+            flex-wrap: wrap;
+            width: 100%;
+            height: calc(100% - 70px);
+ 
+            .disabled {
+                color: #ccc;
+            }
+ 
+            .oneSelected {
+                border-top-right-radius: 24px;
+                border-bottom-right-radius: 24px;
+            }
+ 
+            .startSelected {
+                background-color: #f6f6f7;
+                border-top-left-radius: 24px;
+                border-bottom-left-radius: 24px;
+            }
+ 
+            .endSelected {
+                background-color: #f6f6f7;
+                border-top-right-radius: 24px;
+                border-bottom-right-radius: 24px;
+            }
+ 
+            .betweenSelected {
+                background-color: #f6f6f7;
+            }
+ 
+            >div {
+                width: 75px;
+                height: 48px;
+                line-height: 48px;
+                margin: 3px 0;
+                // border-radius: 24px;
+                text-align: center;
+ 
+                a {
+                    display: inline-block;
+                    width: 60px;
+                    height: 36px;
+                    cursor: pointer;
+                    line-height: 36px;
+                    border-radius: 18px;
+                }
+ 
+                .selected {
+                    background-color: #3e77fc;
+                    color: #fff;
+                }
+            }
+        }
+ 
+        .panelHead {
+            position: relative;
+            height: 46px;
+            line-height: 46px;
+            text-align: center;
+ 
+            i {
+                position: absolute;
+                cursor: pointer;
+ 
+                &:hover {
+                    color: #3e77fc;
+                }
+            }
+        }
+ 
+        .rightPanel {
+            padding-left: 8px;
+        }
+ 
+        .leftPanel .panelHead i {
+            left: 20px;
+            top:15px;
+        }
+ 
+        .rightPanel .panelHead i {
+            right: 20px;
+            top:15px;
+        }
+    }
+ 
+    .floatPanel::before {
+        content: "";
+        height: 100%;
+        position: absolute;
+        left: 50%;
+        width: 1px;
+        border-left: 1px solid #e4e4e4;
+    }
+}
+ 
+input {
+    width: 60px;
+    border: none;
+    height: 32px;
+    line-height: 32px;
+    box-sizing: border-box;
+    background-color: transparent;
+}
+ 
+input:focus {
+    outline: none;
+    background-color: transparent;
+}
+ 
+.yearPicker:hover {
+    border-color: #3e77fc;
+}
+ 
+.dateIcon {
+    position: absolute;
+    right: 16px;
+    top: 9px;
+    color: #adb2bc;
+}
+</style>
+  
+  ​

+ 4 - 2
src/main.js

@@ -17,6 +17,7 @@ import { download } from '@/utils/request'
 import './assets/icons' // icon
 import './permission' // permission control
 import { getDicts } from "@/api/system/dict/data";
+import { getCity } from "@/api/common/index";
 import { getConfigKey } from "@/api/system/config";
 import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
 // 分页组件
@@ -37,8 +38,9 @@ import DictTag from '@/components/DictTag'
 import VueMeta from 'vue-meta'
 // 字典数据组件
 import DictData from '@/components/DictData'
-
+import moment from 'moment'
 // 全局方法挂载
+Vue.prototype.getCity = getCity
 Vue.prototype.getDicts = getDicts
 Vue.prototype.getConfigKey = getConfigKey
 Vue.prototype.parseTime = parseTime
@@ -48,7 +50,7 @@ Vue.prototype.selectDictLabel = selectDictLabel
 Vue.prototype.selectDictLabels = selectDictLabels
 Vue.prototype.download = download
 Vue.prototype.handleTree = handleTree
-
+Vue.prototype.$moment = moment
 // 全局组件挂载
 Vue.component('DictTag', DictTag)
 Vue.component('Pagination', Pagination)

+ 0 - 3
src/permission.js

@@ -24,12 +24,9 @@ router.beforeEach((to, from, next) => {
       if (store.getters.roles.length === 0) {
         isRelogin.show = true
         // 判断当前用户是否已拉取完user_info信息
-        console.log('1231231231');
-
         store.dispatch('GetInfo').then(() => {
           isRelogin.show = false
           store.dispatch('GenerateRoutes').then(accessRoutes => {
-            console.log('11111111111111111', accessRoutes);
             // 根据roles权限生成可访问的路由表
             router.addRoutes(accessRoutes) // 动态添加可访问路由表
 

+ 73 - 0
src/utils/derive.js

@@ -0,0 +1,73 @@
+import ExcelJS from 'exceljs';
+import moment from 'moment'
+
+function getDateStr(AddDayCount) {
+    var dd = new Date();
+    dd.setDate(dd.getDate() + AddDayCount);//获取AddDayCount天后的日期
+    var y = dd.getFullYear();
+    var m = dd.getMonth() + 1;//获取当前月份的日期
+    var d = dd.getDate();
+    return y + '-' + (m < 10 ? '0' + m : m) + '-' + d;
+}
+
+function exportExcel(columns, datas, downloadName) {
+    let datalist = JSON.parse(JSON.stringify(datas));
+    let tableData = dataImpl(datalist)
+    const workbook = new ExcelJS.Workbook();
+    const worksheet = workbook.addWorksheet('Sheet 1'); // 创建一个工作表
+    // 设置列标题
+    worksheet.columns = columns
+    // 准备数据并添加到工作表中
+    const data = tableData
+    worksheet.addRows(data); // 添加数据行
+    // 创建一个 Blob 并下载文件
+
+    workbook.xlsx.writeBuffer().then((buffer) => {
+        const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
+        const link = document.createElement('a');
+        link.href = URL.createObjectURL(blob);
+        link.download = downloadName + moment().format('YYYY-MM-DD HH:mm:ss') || 'example.xlsx';
+        link.click(); // 模拟点击下载文件
+    });
+}
+function dataImpl(data) {
+    data.forEach(e => {
+        if (e.afterSaleStatus) {
+            if (e.afterSaleStatus == 0) {
+                e.afterSaleStatus = '未申请';
+            }
+            switch (e.afterSaleStatus) {
+                case 1: e.afterSaleStatus = '已申请'; break;
+                case 2: e.afterSaleStatus = '审核失败'; break;
+                case 3: e.afterSaleStatus = '审核成功(退款中)'; break;
+                case 4: e.afterSaleStatus = '退款成功'; break;
+                case 5: e.afterSaleStatus = '退款失败(联系客服解决)'; break;
+            }
+        } else if (e.orderStatus) {
+            switch (e.orderStatus) {
+                case 0:
+                    e.orderStatus = '待商家确认修改运费';
+                    break;
+                case 10: e.orderStatus = '等待买家支付'; break;
+                case 20: e.orderStatus = '等待商家发布货运信息'; break;
+                case 90: e.orderStatus = '等待司机接单'; break;
+                case 100: e.orderStatus = '等待司机支付保证金'; break;
+                case 110: e.orderStatus = '等待司机装货)'; break;
+                case 120: e.orderStatus = '已装货,运输中'; break;
+                case 30: e.orderStatus = '司机已到达,等待买家签收'; break;
+                case 40: e.orderStatus = '买家已收货'; break;
+                case 50: e.orderStatus = '已取消'; break;
+                case 60: e.orderStatus = '退款中'; break;
+                case 70: e.orderStatus = '退款成功'; break;
+                case 80: e.orderStatus = '退款失败'; break;
+                case 130: e.orderStatus = '待处理售后'; break;
+                case 140: e.orderStatus = '已处理售后'; break;
+            }
+        }
+
+    });
+    return data;
+}
+export default {
+    exportExcel
+}

+ 43 - 132
src/views/chat.js

@@ -1,57 +1,34 @@
 import * as echarts from "echarts";
 import { options } from "runjs";
 
-function transaction() {
+function transaction(data, type) {
+    console.log(type);
+
+    let unit = ''
+    switch (type) {
+        case 3:
+            unit = '时';
+            break;
+        case 4:
+            unit = '时';
+            break;
+        // case 5:
+        //     unit = '日';
+        //     break;
+        case 6:
+            unit = '月';
+            break;
+    }
+    console.log('123123123', unit);
+
     let bgColor = "#fff";
     let color = ["#0090FF", "#36CE9E", "#FFC005", "#FF515A", "#8B5CFF", "#00CA69"];
-    let echartData = [
-        {
-            name: "1",
-            value1: 100,
-            value2: 233,
-        },
-        {
-            name: "2",
-            value1: 138,
-            value2: 233,
-        },
-        {
-            name: "3",
-            value1: 350,
-            value2: 200,
-        },
-        {
-            name: "4",
-            value1: 173,
-            value2: 180,
-        },
-        {
-            name: "5",
-            value1: 180,
-            value2: 199,
-        },
-        {
-            name: "6",
-            value1: 150,
-            value2: 233,
-        },
-        {
-            name: "7",
-            value1: 180,
-            value2: 210,
-        },
-        {
-            name: "8",
-            value1: 230,
-            value2: 180,
-        },
-    ];
-    let xAxisData = echartData.map((v) => v.name);
-    //  ["1", "2", "3", "4", "5", "6", "7", "8"]
-    let yAxisData1 = echartData.map((v) => v.value1);
-    // [100, 138, 350, 173, 180, 150, 180, 230]
-    let yAxisData2 = echartData.map((v) => v.value2);
-    // [233, 233, 200, 180, 199, 233, 210, 180]
+    let xAxisData = [];
+    let yAxisData = []
+    for (const key in data) {
+        xAxisData.push(key)
+        yAxisData.push(data[key])
+    }
     const hexToRgba = (hex, opacity) => {
         let rgbaColor = "";
         let reg = /^#[\da-f]{6}$/i;
@@ -66,26 +43,9 @@ function transaction() {
     let option = {
         backgroundColor: bgColor,
         color: color,
-        legend: {
-            right: 100,
-            top: 10,
-        },
+
         tooltip: {
             trigger: "axis",
-            formatter: function (params) {
-                let html = "";
-                params.forEach((v) => {
-                    html += `<div style="color: #666;font-size: 14px;line-height: 24px">
-                    <span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${color[v.componentIndex]
-                        };"></span>
-                    ${v.seriesName}.${v.name}
-                    <span style="color:${color[v.componentIndex]
-                        };font-weight:700;font-size: 18px">${v.value}</span>
-                    万元`;
-                });
-
-                return html;
-            },
             extraCssText:
                 "background: #fff; border-radius: 0;box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);color: #333;",
             axisPointer: {
@@ -107,10 +67,12 @@ function transaction() {
                 type: "category",
                 boundaryGap: false,
                 axisLabel: {
-                    formatter: "{value}",
+                    formatter: "{value}" + unit,
                     textStyle: {
                         color: "#333",
                     },
+                    interval: 0,
+                    rotate: 40
                 },
                 axisLine: {
                     lineStyle: {
@@ -187,73 +149,28 @@ function transaction() {
                         shadowBlur: 10,
                     },
                 },
-                data: yAxisData1,
-            },
-            {
-                name: "昨日",
-                type: "line",
-                smooth: true,
-                // showSymbol: false,
-                symbolSize: 8,
-                zlevel: 3,
-                lineStyle: {
-                    normal: {
-                        color: color[1],
-                        shadowBlur: 3,
-                        shadowColor: hexToRgba(color[1], 0.5),
-                        shadowOffsetY: 8,
-                    },
-                },
-                areaStyle: {
-                    normal: {
-                        color: new echarts.graphic.LinearGradient(
-                            0,
-                            0,
-                            0,
-                            1,
-                            [
-                                {
-                                    offset: 0,
-                                    color: hexToRgba(color[1], 0.3),
-                                },
-                                {
-                                    offset: 1,
-                                    color: hexToRgba(color[1], 0.1),
-                                },
-                            ],
-                            false
-                        ),
-                        shadowColor: hexToRgba(color[1], 0.1),
-                        shadowBlur: 10,
-                    },
-                },
-                data: yAxisData2,
+                data: yAxisData,
             },
+
         ],
     };
     return option
 }
 
-function processed() {
+function processed(data) {
     var cityList = [
         "待付款订单",
         "待发货订单",
         "待收货订单",
         "待处理退款订单",
     ];
-    var top10CityList;
-    var top10CityData;
 
-    function setMockData() {
-        cityList.sort(() => (Math.random() > 0.5 ? 1 : -1));
-        top10CityList = cityList.slice(0, 10);
-        top10CityData = top10CityList.map((name) => {
-            var val = parseInt(100 + Math.random() * 0.01);
-            return val;
-        });
-        top10CityData.sort((a, b) => (a < b ? -1 : 1));
-    }
-    setMockData();
+    var data = [
+        data.waitPayOrderRate,
+        data.waitSendOrderRate,
+        data.waitReceiveOrderRate,
+        data.waitRefundOrderRate,
+    ]
     let option = {
         title: {
             show: false,
@@ -287,7 +204,7 @@ function processed() {
                     show: false,
                     inside: false,
                 },
-                data: top10CityList,
+                data: data,
             },
             {
                 type: "category",
@@ -316,7 +233,7 @@ function processed() {
                 splitLine: {
                     show: false,
                 },
-                data: top10CityData || [500, 400, 300, 200, 100],
+                data: data,
             },
         ],
         xAxis: {
@@ -377,7 +294,7 @@ function processed() {
                 },
                 zlevel: 2,
                 barWidth: "20px",
-                data: top10CityData,
+                data: data,
                 animationDuration: 1500,
                 label: {
                     normal: {
@@ -403,13 +320,7 @@ function processed() {
         // }
     };
 
-    setInterval(() => {
-        setMockData();
-        option.yAxis[0].data = top10CityList;
-        option.yAxis[1].data = top10CityData;
-        option.series[0].data = top10CityData;
-        // myChart.setOption(option, { notMerge: true, lazyUpdate: true });
-    }, 3000);
+
 
 
     return option;

+ 220 - 30
src/views/index.vue

@@ -9,14 +9,23 @@
                 <span>总销售额(元)</span>
               </div>
               <div class="count">
-                {{ statistics.totalCountUser ? statistics.totalCountUser : 0 }}
+                {{ statistics.totalSalePrice ? statistics.totalSalePrice : 0 }}
               </div>
+
               <div class="zz">
-                <span>
-                  {{ statistics.yesterdayAddUser ? statistics.yesterdayAddUser : 0 }}
-                  人</span
-                >
-                <span> 较昨日</span>
+                <div>
+                  <span>
+                    +{{
+                      statistics.totalSalePriceRate ? statistics.totalSalePriceRate : "0%"
+                    }}
+                  </span>
+                </div>
+                <div>
+                  <span> 今日新增</span>
+                  <span>
+                    {{ statistics.daySalePrice ? statistics.daySalePrice : 0 }}
+                  </span>
+                </div>
               </div>
             </div>
           </el-card>
@@ -28,11 +37,22 @@
                 <span>访问量</span>
               </div>
               <div class="count">
-                {{ statistics.totalPrice ? statistics.totalPrice : 0 }}
+                {{ statistics.totalSeeCount ? statistics.totalSeeCount : 0 }}
               </div>
               <div class="zz">
-                <span> {{ statistics.priceScale ? statistics.priceScale : 0 }} 元</span>
-                <span> 较上周</span>
+                <div>
+                  <span>
+                    +{{
+                      statistics.totalSeeCountRate ? statistics.totalSeeCountRate : "0%"
+                    }}
+                  </span>
+                </div>
+                <div>
+                  <span> 今日新增</span>
+                  <span>
+                    {{ statistics.daySeeCount ? statistics.daySeeCount : 0 }}
+                  </span>
+                </div>
               </div>
             </div>
           </el-card>
@@ -44,11 +64,24 @@
                 <span>总订单数</span>
               </div>
               <div class="count">
-                {{ statistics.totalPrice ? statistics.totalPrice : 0 }}
+                {{ statistics.totalOrderCount ? statistics.totalOrderCount : 0 }}
               </div>
               <div class="zz">
-                <span> {{ statistics.priceScale ? statistics.priceScale : 0 }} 元</span>
-                <span> 较上周</span>
+                <div>
+                  <span>
+                    +{{
+                      statistics.totalOrderCountRate
+                        ? statistics.totalOrderCountRate
+                        : "0%"
+                    }}
+                  </span>
+                </div>
+                <div>
+                  <span> 今日新增</span>
+                  <span>
+                    {{ statistics.dayOrderCount ? statistics.dayOrderCount : 0 }}
+                  </span>
+                </div>
               </div>
             </div>
           </el-card>
@@ -60,11 +93,24 @@
                 <span>退款(元)</span>
               </div>
               <div class="count">
-                {{ statistics.totalCountOrder ? statistics.totalCountOrder : 0 }}
+                {{ statistics.totalRefundPrice ? statistics.totalRefundPrice : 0 }}
               </div>
               <div class="zz">
-                <span>{{ statistics.orderScale ? statistics.orderScale : 0 }}单</span>
-                <span>较上周</span>
+                <div>
+                  <span>
+                    +{{
+                      statistics.totalRefundPriceRate
+                        ? statistics.totalRefundPriceRate
+                        : "0%"
+                    }}
+                  </span>
+                </div>
+                <div>
+                  <span> 今日新增</span>
+                  <span>
+                    {{ statistics.dayRefundPrice ? statistics.dayRefundPrice : 0 }}
+                  </span>
+                </div>
               </div>
             </div>
           </el-card>
@@ -75,6 +121,57 @@
       <el-row>
         <el-col :span="18">
           <div class="title">成交金额(元)</div>
+          <div
+            style="
+              display: flex;
+              flex-direction: row;
+              align-items: center;
+              height: 40px;
+              margin-top: 10px;
+            "
+          >
+            <el-radio-group v-model="params.queryType" @input="radiochange">
+              <el-radio :label="3">今日</el-radio>
+              <el-radio :label="4" :value="4">昨日</el-radio>
+              <el-radio :label="5" :value="5">本月</el-radio>
+              <el-radio :label="6" :value="6">本年</el-radio>
+              <el-radio :label="0" :value="0">按天</el-radio>
+              <el-radio :label="1" :value="1">按月</el-radio>
+              <el-radio :label="2" :value="2">按年</el-radio>
+            </el-radio-group>
+            <el-date-picker
+              @change="pickerChange"
+              style="margin-left: 20px"
+              v-if="params.queryType == 0"
+              v-model="picker"
+              type="daterange"
+              range-separator="至"
+              format="yyyy-MM-dd"
+              start-placeholder="开始时间"
+              end-placeholder="结束时间"
+            >
+            </el-date-picker>
+            <el-date-picker
+              @change="pickerChange"
+              style="margin-left: 20px"
+              v-if="params.queryType == 1"
+              v-model="pickerMonth"
+              type="monthrange"
+              range-separator="至"
+              start-placeholder="开始月份"
+              end-placeholder="结束月份"
+              value-format="yyyy-MM"
+              format="yyyy-MM"
+            >
+            </el-date-picker>
+            <YearRangePicker
+              @updateTimeRange="pickerChange"
+              style="margin-left: 20px"
+              v-if="params.queryType == 2"
+              start-placeholder="开始年份"
+              end-placeholder="结束年份"
+            ></YearRangePicker>
+          </div>
           <div id="transaction" style="height: 600px; width: 100%"></div>
         </el-col>
         <el-col :span="6">
@@ -82,7 +179,50 @@
           <div
             style="width: 100%; height: 600px; border: 1px solid #ccc; margin-top: 10px"
           >
-            <div id="processed" style="width: 100%; height: 100%"></div>
+            <div
+              id="processed"
+              style="
+                width: 100%;
+                height: 100%;
+                display: flex;
+                flex-direction: column;
+                justify-content: space-around;
+                padding: 25px;
+              "
+            >
+              <div style="line-height: 50px">
+                待付款订单
+                <el-progress
+                  :stroke-width="26"
+                  :format="format"
+                  :percentage="statistics.waitPayOrderRate"
+                ></el-progress>
+              </div>
+              <div style="line-height: 50px">
+                待发货订单
+                <el-progress
+                  :stroke-width="24"
+                  :percentage="statistics.waitSendOrderRate"
+                  :format="format"
+                ></el-progress>
+              </div>
+              <div style="line-height: 50px">
+                待收货订单
+                <el-progress
+                  :stroke-width="22"
+                  :percentage="statistics.waitReceiveOrderRate"
+                  :format="format"
+                ></el-progress>
+              </div>
+              <div style="line-height: 50px">
+                待处理退款订单
+                <el-progress
+                  :stroke-width="20"
+                  :percentage="statistics.waitRefundOrderRate"
+                  :format="format"
+                ></el-progress>
+              </div>
+            </div>
           </div>
         </el-col>
       </el-row>
@@ -101,15 +241,27 @@
 </template>
 
 <script>
+import YearRangePicker from "@/components/YearRangePicker/index";
 import { getHome } from "@/api/home/home.js";
 import * as echarts from "echarts";
 import chat from "./chat";
+import moment from "moment";
 export default {
+  components: {
+    YearRangePicker,
+  },
   name: "Index",
   data() {
     return {
       tabsRadio: 1,
       statistics: {},
+      params: {
+        queryType: 3,
+        startTime: "",
+        endTime: "",
+      },
+      picker: "",
+      pickerMonth: "",
     };
   },
   mounted() {
@@ -120,31 +272,65 @@ export default {
   },
 
   methods: {
-    tabsChange(val) {
+
+    pickerChange(val) {
+      console.log(val);
+      if (this.params.queryType == 0) {
+        this.params.startTime = moment(this.picker[0]).format("yyyy-MM-DD");
+        this.params.endTime = moment(this.picker[1]).format("yyyy-MM-DD");
+      } else if (this.params.queryType == 1) {
+        this.params.startTime = moment(this.pickerMonth[0]).format("yyyy-MM");
+        this.params.endTime = moment(this.pickerMonth[1]).format("yyyy-MM");
+      } else if (this.params.queryType == 2) {
+        this.params.startTime = val.startYear;
+        this.params.endTime = val.endYear;
+      }
+      this.init();
+      console.log(this.params);
+    },
+    tabsChange() {
       this.init(this.tabsRadio);
     },
-    init(type) {
-      this.processed();
-      this.transaction();
+    radiochange() {
+      switch (this.params.queryType) {
+        case 3:
+          this.init();
+          break;
+        case 4:
+          this.init();
+          break;
+        case 5:
+          this.init();
+          break;
+        case 6:
+          this.init();
+          break;
+      }
+    },
+    init() {
+      //
+      //
       // this.Pageview();
       // this.volume();
-      // getHome({ type: type }).then((res) => {
-      //   if (res.code == 200) {
-      //     this.statistics = res.data;
-      //     this.addSj();
-      //   }
-      // });
+      getHome(this.params).then((res) => {
+        if (res.code == 200) {
+          console.log(res.data);
+          this.statistics = res.data;
+          this.transaction(res.data.voMap);
+          // this.processed(res.data);
+        }
+      });
     },
-    transaction() {
+    transaction(data) {
       var chartDom = document.getElementById("transaction");
       var myChart = echarts.init(chartDom);
-      let option = chat.transaction();
+      let option = chat.transaction(data, this.params.queryType);
       option && myChart.setOption(option);
     },
-    processed() {
+    processed(data) {
       var chartDom = document.getElementById("processed");
       var myChart = echarts.init(chartDom);
-      let option = chat.processed();
+      let option = chat.processed(data);
       option && myChart.setOption(option);
     },
     volume() {
@@ -199,7 +385,11 @@ export default {
       font-weight: 500;
     }
     .zz {
+      display: flex;
+      flex-direction: row;
+      justify-content: space-between;
       font-size: 14px;
+      // color: #18c918;
       color: red;
       padding: 0px 10px;
     }

+ 361 - 48
src/views/manage/active.vue

@@ -1,73 +1,386 @@
+a
 <template>
-  <div style="padding: 20px">
-    <el-result>
-      <template slot="subTitle">
-        您暂未报名,请尽快完成所有的流程,即可开启活动
-      </template>
-      <template slot="extra">
-        <el-button type="primary" size="medium" @click="Sign">我要报名 </el-button>
-      </template>
-    </el-result>
-    <div>
-      <div>活动内容</div>
-    </div>
-    <el-dialog
-      title="活动设置"
-      :visible.sync="open"
-      width="800px"
-      append-to-body
-      :close-on-click-modal="false"
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      label-width="80px"
     >
+      <el-form-item label="活动名称" prop="title">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入活动名称"
+          clearable
+          style="width: 180px"
+        />
+      </el-form-item>
+      <el-form-item label="活动状态" prop="online">
+        <el-select
+          v-model="queryParams.online"
+          placeholder="请选择活动状态"
+          style="width: 180px"
+        >
+          <el-option label="未开始" :value="0"> </el-option>
+          <el-option label="进行中" :value="1"> </el-option>
+          <el-option label="已结束" :value="2"> </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
+          >搜索</el-button
+        >
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-table
+      v-loading="loading"
+      :data="configList"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column label="活动名称" align="center" prop="title" />
+      <el-table-column
+        label="活动介绍"
+        align="center"
+        prop="intro"
+        :show-overflow-tooltip="true"
+      >
+      </el-table-column>
+      <el-table-column
+        label="活动详情"
+        align="center"
+        prop="content"
+        :show-overflow-tooltip="true"
+      >
+      </el-table-column>
+      <el-table-column label="活动海报" align="center" prop="img">
+        <template slot-scope="scope">
+          <el-image
+            v-if="scope.row.img"
+            style="width: 60px; height: 60px"
+            :src="scope.row.img"
+            :preview-src-list="[scope.row.img]"
+          >
+          </el-image>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="浏览量" align="center" prop="hits" />
+
+      <el-table-column label="开始时间" align="center" prop="startTime">
+        <template slot-scope="scope">
+          {{
+            scope.row.startTime
+              ? $moment(scope.row.startTime).format("YYYY-MM-DD hh:mm:ss")
+              : ""
+          }}
+        </template>
+      </el-table-column>
+
+      <el-table-column label="结束时间" align="center" prop="endTime">
+        <template slot-scope="scope">
+          {{
+            scope.row.endTime
+              ? $moment(scope.row.endTime).format("YYYY-MM-DD hh:mm:ss")
+              : ""
+          }}
+        </template>
+      </el-table-column>
+      <!-- <el-table-column label="使用代金卷" align="center" key="useVoucher">
+        <template slot-scope="scope">
+          {{ scope.row.useVoucher == 0 ? "否" : "是" }}
+        </template>
+      </el-table-column> -->
+
+      <el-table-column label="活动状态" align="center" key="online" width="80">
+        <template slot-scope="scope">
+          {{
+            scope.row.online == 0 ? "未开始" : scope.row.online == 1 ? "进行中" : "已结束"
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column label="是否参与" align="center">
+        <template slot-scope="scope">
+          <el-tag>
+            {{ scope.row.isJoin == 0 ? "未参与" : scope.row.isJoin == 1 ? "已参与" : "" }}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <!-- <el-table-column label="备注" align="center" prop="remark"> </el-table-column> -->
+      <el-table-column label="创建时间" align="center" prop="createTime">
+        <template slot-scope="scope">
+          {{
+            scope.row.createTime
+              ? $moment(scope.row.createTime).format("YYYY-MM-DD hh:mm:ss")
+              : ""
+          }}
+        </template>
+      </el-table-column>
+
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            v-if="scope.row.isJoin == 0"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleParticipate(scope.row)"
+            v-hasPermi="['active:add']"
+            >参与活动</el-button
+          >
+          <el-button
+            v-if="scope.row.isJoin == 1"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="ParticipateEdit(scope.row)"
+            v-hasPermi="['active:edit']"
+            >编辑商品</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleDetail(scope.row)"
+            v-hasPermi="['active:detail']"
+            >活动详情</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改用户配置对话框 -->
+    <el-dialog title="详情" :visible.sync="detailOpen" width="600px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="适用商品" prop="configName">
-          <el-radio-group v-model="form.radio">
-            <el-radio :label="1">全部商品可用</el-radio>
-            <el-radio :label="2">指定商品可用 </el-radio>
-          </el-radio-group>
-        </el-form-item>
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="活动名称" prop="title">
+              {{ form.title }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="活动介绍" prop="intro">
+              {{ form.intro }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="活动详情" prop="content">
+              {{ form.content }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="活动时间" prop="dateRange">
+              {{
+                form.startTime
+                  ? $moment(form.startTime).format("YYYY-MM-DD HH:mm:ss")
+                  : ""
+              }}-
+              {{
+                form.endTime ? $moment(form.endTime).format("YYYY-MM-DD HH:mm:ss") : ""
+              }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="活动海报">
+              <img v-if="imageUrl" :src="imageUrl" class="avatar" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="备注">
+              {{ form.remark }}
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </el-dialog>
+
+    <!-- 添加或修改用户配置对话框 -->
+    <el-dialog title="参与活动" :visible.sync="open" width="800px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="适用商品" prop="title">
+              <el-radio v-model="shop.type" :label="0">全部商品</el-radio>
+              <el-radio v-model="shop.type" :label="1">指定商品</el-radio>
+              <span v-if="shop.type == 1" style="color: #134dd1b3; cursor: pointer"
+                >选择商品</span
+              >
+            </el-form-item>
+          </el-col>
+          <el-col :span="24" v-if="shop.type == 1">
+            <el-table :data="shopList">
+              <el-table-column label="商品名称" align="center" prop="title" />
+              <el-table-column label="商品图片" align="center" prop="title" />
+              <el-table-column label="商品单价" align="center" prop="title" />
+              <el-table-column label="库存" align="center" prop="title" />
+              <el-table-column label="起批量" align="center" prop="title" />
+              <el-table-column label="商品价格" align="center" prop="title" />
+              <el-table-column label="操作" align="center" prop="title" />
+            </el-table>
+          </el-col>
+        </el-row>
       </el-form>
-      <el-table
-        v-if="form.radio == 2"
-        :data="configList"
-        @selection-change="handleSelectionChange"
-      >
-        <el-table-column type="selection" width="55" align="center" />
-        <el-table-column
-          label="商品名称"
-          align="center"
-          prop="configName"
-          :show-overflow-tooltip="true"
-        />
-        <el-table-column label="商品单价" align="center" prop="configValue" />
-        <el-table-column label="库存" align="center" prop="configValue" />
-        <el-table-column label="起批量" align="center" prop="configValue" />
-        <el-table-column label="商品价格" align="center" prop="configType">
-        </el-table-column>
-      </el-table>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="open = false">取 消</el-button>
+        <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 
 <script>
+import { promotionList, promotionSku } from "@/api/active/index";
+import moment from "moment";
 export default {
+  name: "Config",
+  //   dicts: ["sys_yes_no"],
   data() {
     return {
+      // 遮罩层
+      loading: true,
+      total: 0,
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
       open: false,
-      form: {
-        radio: 1,
+      // 日期范围
+      dateRange: [],
+      // 查询参数
+      queryParams: {
+        pageNo: 1,
+        pageSize: 10,
+        online: "",
+        title: "",
+      },
+      // 表单参数
+      form: {},
+      shop: {
+        type: 0,
+        promotionId: "",
+      },
+      // 表单校验
+      rules: {
+        configName: [{ required: true, message: "参数名称不能为空", trigger: "blur" }],
+        configKey: [{ required: true, message: "参数键名不能为空", trigger: "blur" }],
+        configValue: [{ required: true, message: "参数键值不能为空", trigger: "blur" }],
       },
+      detailOpen: false,
+      imageUrl: "",
+      open: false,
+      shopList: [],
+      ParticipateId: "",
     };
   },
+  created() {
+    this.getList();
+  },
   methods: {
-    Sign() {
+    ParticipateEdit(record) {
+      this.ParticipateId = record.id;
       this.open = true;
     },
+    handleParticipate(record) {
+      this.ParticipateId = record.id;
+      this.open = true;
+    },
+    handleDetail(record) {
+      this.form = record;
+      this.imageUrl = record.img;
+      this.form.dateRange = [
+        moment(record.startTime).format("yyyy-MM-DD hh:mm:ss"),
+        moment(record.endTime).format("yyyy-MM-DD hh:mm:ss"),
+      ];
+      this.detailOpen = true;
+    },
+
+    /** 查询参数列表 */
+    getList() {
+      this.loading = true;
+      promotionList(this.addDateRange(this.queryParams, this.dateRange)).then(
+        (response) => {
+          this.configList = response.data.records;
+          this.total = response.data.total;
+          this.loading = false;
+        }
+      );
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNo = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+
+    /** 提交按钮 */
+    submitForm: function () {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          this.shop.promotionId = this.ParticipateId;
+          promotionSku(this.shop).then((res) => {
+            if (res.code == 200) {
+              this.$message({
+                type: "success",
+                message: "参与成功",
+              });
+              this.open = false;
+              this.getList();
+            }
+          });
+        }
+      });
+    },
   },
 };
 </script>
-
-<style></style>
+<style>
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409eff;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 138px;
+  height: 138px;
+  line-height: 138px;
+  text-align: center;
+}
+</style>
+<style scoped lang="scss">
+.avatar {
+  width: 138px;
+  height: 138px;
+  display: block;
+}
+</style>

+ 591 - 170
src/views/manage/afterSaleOrder.vue

@@ -1,4 +1,3 @@
-a
 <template>
   <div class="app-container">
     <div class="header" style="width: 100%">
@@ -9,7 +8,9 @@ a
               <div style="padding: 10px">
                 <span>今日售后订单</span>
               </div>
-              <div class="count">0</div>
+              <div class="count">
+                {{ orderStatistics ? orderStatistics.afterSalesOrder : 0 }}个
+              </div>
             </div>
           </el-card>
         </el-col>
@@ -19,7 +20,9 @@ a
               <div style="padding: 10px">
                 <span>今日退款处理金额</span>
               </div>
-              <div class="count">0</div>
+              <div class="count">
+                {{ orderStatistics ? orderStatistics.ameDayRefund : 0 }}元
+              </div>
             </div>
           </el-card>
         </el-col>
@@ -29,7 +32,9 @@ a
               <div style="padding: 10px">
                 <span>退款总金额</span>
               </div>
-              <div class="count">0</div>
+              <div class="count">
+                {{ orderStatistics ? orderStatistics.allDayRefund : 0 }}元
+              </div>
             </div>
           </el-card>
         </el-col>
@@ -43,35 +48,89 @@ a
       v-show="showSearch"
       label-width="80px"
     >
-      <el-form-item label="订单编号" prop="configName">
+      <el-form-item label="商品名称" prop="spuName">
+        <el-input
+          v-model="queryParams.spuName"
+          placeholder="请输入商品名称"
+          clearable
+          style="width: 180px"
+        />
+      </el-form-item>
+      <el-form-item label="订单编号" prop="userOrderSn">
         <el-input
-          v-model="queryParams.configName"
+          v-model="queryParams.userOrderSn"
           placeholder="请输入订单编号"
           clearable
-          style="width: 240px"
-          @keyup.enter.native="handleQuery"
+          style="width: 180px"
         />
       </el-form-item>
-      <el-form-item label="下单人手机号/姓名" prop="configName" label-width="140px">
+      <el-form-item label="下单人手机号" prop="userPhone" label-width="140px">
         <el-input
-          v-model="queryParams.configName"
-          placeholder="请输入下单用户手机号/姓名"
+          v-model="queryParams.userPhone"
+          placeholder="请输入下单用户手机号"
           clearable
-          style="width: 240px"
-          @keyup.enter.native="handleQuery"
+          style="width: 180px"
         />
       </el-form-item>
-      <el-form-item label="下单时间" prop="configType">
-        <el-date-picker v-model="value1" type="date" placeholder="请选择下单时间">
+      <el-form-item label="下单时间" prop="createTime">
+        <el-date-picker
+          v-model="queryParams.createTime"
+          value-format="yyyy-MM-dd"
+          format="yyyy-MM-dd"
+          type="date"
+          placeholder="请选择下单时间"
+        >
         </el-date-picker>
       </el-form-item>
-
-      <el-form-item label="交易状态">
-        <el-select v-model="value" placeholder="请选择交易状态">
-          <el-option :label="1" :value="1"> </el-option>
+      <!-- 
+      <el-form-item label="订单状态" prop="orderStatus">
+        <el-select
+          v-model="queryParams.orderStatus"
+          placeholder="请选择订单状态"
+          style="width: 180px"
+        >
+          <el-option label="待商家确认修改运费" :value="0"> </el-option>
+          <el-option label="等待买家支付" :value="10"> </el-option>
+          <el-option label="等待商家发布货运信息" :value="20"> </el-option>
+          <el-option label="等待司机接单" :value="90"> </el-option>
+          <el-option label="等待司机支付保证金" :value="100"> </el-option>
+          <el-option label="等待司机装货" :value="110"> </el-option>
+          <el-option label="已装货,运输中" :value="120"> </el-option>
+          <el-option label="司机已到达,等待买家签收" :value="30"> </el-option>
+          <el-option label="买家已收货" :value="40"> </el-option>
+          <el-option label="已取消" :value="50"> </el-option>
+          <el-option label="退款中" :value="60"> </el-option>
+          <el-option label="退款成功" :value="70"> </el-option>
+          <el-option label="退款失败" :value="80"> </el-option>
+          <el-option label="待处理售后" :value="130"> </el-option>
+          <el-option label="已处理售后" :value="140"> </el-option>
+        </el-select>
+      </el-form-item> -->
+      <el-form-item label="售后状态" prop="afterSaleStatus">
+        <el-select
+          v-model="queryParams.afterSaleStatus"
+          placeholder="请选择支付方式"
+          style="width: 180px"
+        >
+          <el-option label="未申请" value="0"> </el-option>
+          <el-option label="已申请" value="1"> </el-option>
+          <el-option label="审核失败" value="2"> </el-option>
+          <el-option label="审核成功(退款中)" value="3"> </el-option>
+          <el-option label="退款成功" value="4"> </el-option>
+          <el-option label="退款失败(联系客服解决)" value="5"> </el-option>
         </el-select>
       </el-form-item>
 
+      <el-form-item label="支付方式">
+        <el-select
+          v-model="queryParams.paymentType"
+          placeholder="请选择支付方式"
+          style="width: 180px"
+        >
+          <el-option label="支付宝" value="ALIPAY"> </el-option>
+          <el-option label="微信支付" value="WECHAT"> </el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
           >搜索</el-button
@@ -82,55 +141,160 @@ a
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button type="primary" plain size="mini" @click="printOrder"
+        <el-button
+          type="primary"
+          plain
+          size="mini"
+          @click="printOrderBtn"
+          :disabled="!selectList.length > 0"
           >订单打印</el-button
         >
       </el-col>
       <el-col :span="1.5">
-        <el-button type="primary" plain size="mini" @click="printOrder"
+        <el-button
+          type="primary"
+          plain
+          size="mini"
+          @click="handleExport"
+          :disabled="!selectList.length > 0"
           >导出</el-button
         >
       </el-col>
-      <el-col :span="1.5">
-        <el-button type="success" plain icon="el-icon-edit" size="mini" @click="All"
-          >全选</el-button
-        >
-      </el-col>
     </el-row>
 
     <el-table
+      ref="multipleTable"
       v-loading="loading"
-      :data="configList"
+      :data="spuList"
+      :span-method="objectSpanMethod"
       @selection-change="handleSelectionChange"
+      row-key="id"
     >
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="订单编号" align="center" prop="configId" />
+
+      <el-table-column label="商品图片" align="center" prop="skuPic">
+        <template slot-scope="scope">
+          <el-image :src="scope.row.skuPic" style="width: 60px; height: 60px"> </el-image>
+        </template>
+      </el-table-column>
+      <el-table-column label="商品类型" align="center" prop="categoryName">
+      </el-table-column>
+      <el-table-column label="单价/数量" align="center" prop="price">
+        <template slot-scope="scope">
+          <span>
+            {{ scope.row.price }}元 <br />
+            共{{ scope.row.quantity }}{{ scope.row.unit }}</span
+          >
+        </template>
+      </el-table-column>
+      <el-table-column label="包装方式" align="center" prop="packageType">
+      </el-table-column>
+      <el-table-column label="规格名称" align="center" prop="specsName" />
+      <el-table-column label="规格值" align="center" prop="specsValue" />
+      <el-table-column label="实付金额" align="center" prop="goodsAmount">
+        <template slot-scope="scope"> {{ scope.row.goodsAmount }}元 </template>
+      </el-table-column>
+      <el-table-column label="订单编号" align="center" prop="userOrderSn" width="220" />
+      <el-table-column label="买家姓名" align="center" prop="userNick" />
+      <el-table-column label="买家头像" align="center">
+        <template slot-scope="scope">
+          <el-avatar :size="40" :src="scope.row.userHeadUrl"></el-avatar>
+        </template>
+      </el-table-column>
+      <el-table-column label="买家手机号" align="center" prop="userPhone" />
+
       <el-table-column
         label="商品名称"
         align="center"
-        prop="configName"
+        prop="skuName"
         :show-overflow-tooltip="true"
-      />
-      <el-table-column label="单价/数量" align="center" prop="configKey" />
-      <el-table-column label="实付款" align="center" prop="configValue" />
-      <el-table-column label="下单时间" align="center" prop="configValue" />
-      <el-table-column label="付款时间" align="center" prop="configValue" />
-      <el-table-column label="买家信息" align="center" prop="configType">
-        <template slot-scope="scope"> </template>
+      >
       </el-table-column>
-      <el-table-column label="支付方式" align="center" prop="remark" />
-      <el-table-column label="配送方式" align="center" prop="remark" />
-      <el-table-column label="交易状态" align="center" prop="createTime" width="180">
-        <template slot-scope="scope"> </template>
+
+      <!-- <el-table-column label="运费(元)" align="center" prop="freightFee" /> -->
+      <!-- <el-table-column label="订单状态" align="center">
+        <template slot-scope="scope">
+          {{
+            scope.row.orderStatus == 0
+              ? "待商家确认修改运费"
+              : scope.row.orderStatus == 10
+              ? "等待买家支付"
+              : scope.row.orderStatus == 20
+              ? "等待商家发布货运信息"
+              : scope.row.orderStatus == 90
+              ? "等待司机接单"
+              : scope.row.orderStatus == 100
+              ? "等待司机支付保证金"
+              : scope.row.orderStatus == 110
+              ? "等待司机装货"
+              : scope.row.orderStatus == 120
+              ? "已装货,运输中"
+              : scope.row.orderStatus == 30
+              ? "司机已到达,等待买家签收"
+              : scope.row.orderStatus == 40
+              ? "买家已收货"
+              : scope.row.orderStatus == 50
+              ? "已取消"
+              : scope.row.orderStatus == 60
+              ? "退款中"
+              : scope.row.orderStatus == 70
+              ? "退款成功"
+              : scope.row.orderStatus == 80
+              ? "退款失败"
+              : scope.row.orderStatus == 130
+              ? "待处理售后"
+              : scope.row.orderStatus == 140
+              ? "已处理售后"
+              : ""
+          }}
+        </template>
+      </el-table-column> -->
+      <el-table-column label="配送方式" align="center">
+        <template slot-scope="scope">
+          {{
+            scope.row.deliveryMethod == -1
+              ? "未选择"
+              : scope.row.deliveryMethod == 0
+              ? "线下发货"
+              : scope.row.deliveryMethod == 1
+              ? "平台找司机"
+              : ""
+          }}
+        </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column label="售后状态" align="center" width="100">
         <template slot-scope="scope">
-          <el-button
+          {{
+            scope.row.afterSaleStatus == 0
+              ? "未申请"
+              : scope.row.afterSaleStatus == 1
+              ? "已申请"
+              : scope.row.afterSaleStatus == 2
+              ? "审核失败"
+              : scope.row.afterSaleStatus == 3
+              ? "审核成功(退款中)"
+              : scope.row.afterSaleStatus == 4
+              ? "退款成功"
+              : scope.row.afterSaleStatus == 5
+              ? "退款失败(联系客服解决)"
+              : ""
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" width="150">
+        <template slot-scope="scope">
+          <!-- <el-button
             size="mini"
             type="text"
-            icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['manage:order:detail']"
+            >我要发货</el-button
+          > -->
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleDetail(scope.row)"
+            v-hasPermi="['manage:order:detail']"
             >订单详情</el-button
           >
         </template>
@@ -146,54 +310,236 @@ a
     />
 
     <!-- 添加或修改参数配置对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="参数名称" prop="configName">
-          <el-input v-model="form.configName" placeholder="请输入参数名称" />
-        </el-form-item>
-        <el-form-item label="参数键名" prop="configKey">
-          <el-input v-model="form.configKey" placeholder="请输入参数键名" />
-        </el-form-item>
-        <el-form-item label="参数键值" prop="configValue">
-          <el-input v-model="form.configValue" placeholder="请输入参数键值" />
-        </el-form-item>
-        <el-form-item label="系统内置" prop="configType">
-          <!-- <el-radio-group v-model="form.configType">
-              <el-radio
-                v-for="dict in dict.type.sys_yes_no"
-                :key="dict.value"
-                :label="dict.value"
-                >{{ dict.label }}</el-radio
+    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
+      <el-descriptions title="" column="3">
+        <el-descriptions-item label="售后状态">
+          <el-tag>
+            {{
+              detailInfo.dxAfterSaleVO
+                ? detailInfo.dxAfterSaleVO.afterSaleStatus == 0
+                  ? "未申请"
+                  : detailInfo.dxAfterSaleVO.afterSaleStatus == 1
+                  ? "已申请"
+                  : detailInfo.dxAfterSaleVO.afterSaleStatus == 2
+                  ? "审核失败"
+                  : detailInfo.dxAfterSaleVO.afterSaleStatus == 3
+                  ? "审核成功(退款中)"
+                  : detailInfo.dxAfterSaleVO.afterSaleStatus == 4
+                  ? "退款成功"
+                  : detailInfo.dxAfterSaleVO.afterSaleStatus == 5
+                  ? "退款失败(联系客服解决)"
+                  : ""
+                : ""
+            }}
+          </el-tag>
+        </el-descriptions-item>
+      </el-descriptions>
+      <el-descriptions title="售后信息" column="3">
+        <el-descriptions-item label="订单id">{{
+          detailInfo.dxAfterSaleVO ? detailInfo.dxAfterSaleVO.orderId : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="申请原因">{{
+          detailInfo.dxAfterSaleVO ? detailInfo.dxAfterSaleVO.reason : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="申请时间">{{
+          detailInfo.dxAfterSaleVO ? detailInfo.dxAfterSaleVO.createTime : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="问题描述">{{
+          detailInfo.dxAfterSaleVO ? detailInfo.dxAfterSaleVO.problemDesc : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="实际退款金额">{{
+          detailInfo.dxAfterSaleVO ? detailInfo.dxAfterSaleVO.actualRefundAmount : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="退款时间">{{
+          detailInfo.dxAfterSaleVO ? detailInfo.dxAfterSaleVO.refundAuditTime : ""
+        }}</el-descriptions-item>
+        </el-descriptions>
+
+      <el-descriptions title="订单详情" column="3">
+        <el-descriptions-item label="订单编号">{{
+          detailInfo ? detailInfo.userOrderSn : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="订单状态">
+          {{
+            detailInfo
+              ? detailInfo.orderStatus == 0
+                ? "待商家确认修改运费"
+                : detailInfo.orderStatus == 10
+                ? "等待买家支付"
+                : detailInfo.orderStatus == 20
+                ? "等待商家发布货运信息"
+                : detailInfo.orderStatus == 90
+                ? "等待司机接单"
+                : detailInfo.orderStatus == 100
+                ? "等待司机支付保证金"
+                : detailInfo.orderStatus == 110
+                ? "等待司机装货"
+                : detailInfo.orderStatus == 120
+                ? "已装货,运输中"
+                : detailInfo.orderStatus == 30
+                ? "司机已到达,等待买家签收"
+                : detailInfo.orderStatus == 40
+                ? "买家已收货"
+                : detailInfo.orderStatus == 50
+                ? "已取消"
+                : detailInfo.orderStatus == 60
+                ? "退款中"
+                : detailInfo.orderStatus == 70
+                ? "退款成功"
+                : detailInfo.orderStatus == 80
+                ? "退款失败"
+                : detailInfo.orderStatus == 130
+                ? "待处理售后"
+                : detailInfo.orderStatus == 140
+                ? "已处理售后"
+                : ""
+              : ""
+          }}</el-descriptions-item
+        >
+        <el-descriptions-item label="配送方式">{{
+          detailInfo
+            ? detailInfo.deliveryMethod == -1
+              ? "未选择"
+              : detailInfo.deliveryMethod == 0
+              ? "线下发货"
+              : detailInfo.deliveryMethod == 1
+              ? "平台找司机"
+              : ""
+            : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="支付方式">
+          {{
+            detailInfo
+              ? detailInfo.paymentType == "ALIPAY"
+                ? "支付宝"
+                : detailInfo.paymentType == "WECHAT"
+                ? "微信支付"
+                : detailInfo.paymentType == "CARD"
+                ? "银行卡支付"
+                : ""
+              : ""
+          }}</el-descriptions-item
+        >
+        <el-descriptions-item label="下单时间">{{
+          detailInfo ? detailInfo.createTime : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="付款时间">
+          {{ detailInfo ? detailInfo.paymentTime : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="担保服务费">
+          {{ detailInfo ? detailInfo.serviceFee : "" }}
+        </el-descriptions-item>
+        <el-descriptions-item label="运费">
+          {{ detailInfo ? detailInfo.freightFee : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="实付款">
+          {{ detailInfo ? detailInfo.totalPrice : "" }}
+        </el-descriptions-item>
+      </el-descriptions>
+      <el-descriptions title="物流信息" column="3">
+        <el-descriptions-item label="运单号">
+          {{ detailInfo ? detailInfo.orderSn : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="司机">{{
+          detailInfo ? detailInfo.driverUservalue : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="车型">{{
+          detailInfo ? detailInfo.carType : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="车牌号"
+          >{{ detailInfo ? detailInfo.plateNo : "" }}
+        </el-descriptions-item>
+        <el-descriptions-item label="司机电话">{{
+          detailInfo ? detailInfo.driverPhone : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="装货时间">
+          {{ detailInfo ? detailInfo.shipmentTime : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="送达时间">
+          {{ detailInfo ? detailInfo.arriveTime : "" }}</el-descriptions-item
+        >
+      </el-descriptions>
+      <el-descriptions title="买家信息" column="3">
+        <el-descriptions-item label="昵称">{{
+          detailInfo ? detailInfo.userNick : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="头像">
+          <el-avatar
+            v-if="detailInfo.userHeadUrl"
+            :size="30"
+            :src="detailInfo.userHeadUrl"
+          ></el-avatar
+        ></el-descriptions-item>
+        <el-descriptions-item label="收货人">{{
+          detailInfo ? detailInfo.consigneeContactName : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="手机号">
+          {{ detailInfo ? detailInfo.userPhone : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="备注">
+          {{ detailInfo ? detailInfo.orderRemark : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="收货地址"
+          >{{ detailInfo ? detailInfo.consigneeAddressDetail : "" }}
+        </el-descriptions-item>
+      </el-descriptions>
+      <el-descriptions title="商品信息" column="3"> </el-descriptions>
+      <el-table :data="detailInfo.orderGoodInfoList" style="width: 100%">
+        <el-table-column prop="skuName" label="商品名称"> </el-table-column>
+        <el-table-column prop="skuName" label="商品图片">
+          <template slot-scope="scope">
+            <el-image :src="scope.row.skuPic" style="width: 50px; height: 50px">
+            </el-image>
+          </template>
+        </el-table-column>
+        <el-table-column prop="price" label="商品单价"> </el-table-column>
+        <el-table-column prop="quantity" label="下单数量"> </el-table-column>
+        <el-table-column prop="totalPrice" label="总金额"> </el-table-column>
+      </el-table>
+    </el-dialog>
+
+    <!-- 添加或修改参数配置对话框 -->
+    <el-dialog
+      title="打印订单"
+      :visible.sync="equipmentOpen"
+      width="500px"
+      append-to-body
+    >
+      <div>
+        <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+          <el-form-item label="选择打印机" prop="sn">
+            <el-select v-model="printForm.sn" placeholder="请选择打印机">
+              <el-option
+                v-for="item in printList"
+                :key="item.value"
+                :label="item.name"
+                :value="item.sn"
               >
-            </el-radio-group> -->
-        </el-form-item>
-        <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
-        </el-form-item>
-      </el-form>
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+      </div>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
+        <el-button type="primary" @click="printSubmitForm">确 定</el-button>
+        <el-button @click="equipmentOpen = false">取 消</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import {
-  listConfig,
-  getConfig,
-  delConfig,
-  addConfig,
-  updateConfig,
-  refreshCache,
-} from "@/api/system/config";
-
+import { queryAfterSalePage, afterSaleOrderInfo } from "@/api/manage/order";
+import { statisticsAfterSaleOrder } from "@/api/manage/order";
+import { printOrder, equipmentList } from "@/api/manage/equipment";
+import Utils from "@/utils/derive";
 export default {
   name: "Config",
   //   dicts: ["sys_yes_no"],
   data() {
     return {
+      spuList: [],
+      equipmentOpen: false,
       // 遮罩层
       loading: true,
       // 选中数组
@@ -216,35 +562,190 @@ export default {
       dateRange: [],
       // 查询参数
       queryParams: {
-        pageNum: 1,
+        pageNo: 1,
         pageSize: 10,
-        configName: undefined,
-        configKey: undefined,
-        configType: undefined,
       },
+      printForm: {
+        sn: "",
+      },
+      column: [
+        { header: "订单编号", key: "userOrderSn", width: 20 },
+        { header: "买家姓名", key: "userNick", width: 20 },
+        { header: "买家手机号", key: "userPhone", width: 20 },
+        { header: "商品名称", key: "skuName", width: 20 },
+        { header: "商品类型", key: "categoryName", width: 20 },
+        { header: "商品价格", key: "price", width: 20 },
+        { header: "包装方式", key: "packageType", width: 20 },
+        { header: "规格名称", key: "specsName", width: 20 },
+        { header: "规格值", key: "specsValue", width: 20 },
+        { header: "实付金额", key: "goodsAmount", width: 20 },
+        { header: "运费", key: "freightFee", width: 20 },
+        { header: "订单状态", key: "orderStatus", width: 20 },
+        { header: "售后状态", key: "afterSaleStatus", width: 20 },
+      ],
+
       // 表单参数
       form: {},
       // 表单校验
       rules: {
-        configName: [{ required: true, message: "参数名称不能为空", trigger: "blur" }],
-        configKey: [{ required: true, message: "参数键名不能为空", trigger: "blur" }],
         configValue: [{ required: true, message: "参数键值不能为空", trigger: "blur" }],
       },
+      orderStatistics: {},
+      mergeObj: {}, // 用来记录需要合并行的下标
+      selectList: [],
+      detailInfo: {},
+      dialogLoding: false,
+      printList: [],
     };
   },
   created() {
-    // this.getList();
+    this.getList();
+    this.getstatisticsAfterSaleOrder();
+    this.getEquipmentList();
   },
   methods: {
+    getEquipmentList() {
+      equipmentList().then((res) => {
+        if (res.code == 200) {
+          this.printList = res.data.records;
+        }
+      });
+    },
+    printSubmitForm() {
+      this.printForm.id = this.selectList.toString();
+      printOrder(this.printForm)
+        .then((res) => {
+          if (res.code == 200) {
+            this.equipmentOpen = false;
+            this.$modal.msgSuccess("操作成功!");
+          } else {
+            this.equipmentOpen = false;
+            this.$modal.msgError(res.msg);
+          }
+        })
+        .catch((err) => {
+          this.equipmentOpen = false;
+          this.$modal.msgError(err);
+        });
+    },
+    printOrderBtn() {
+      this.equipmentOpen = true;
+    },
+    getstatisticsAfterSaleOrder() {
+      statisticsAfterSaleOrder()
+        .then((res) => {
+          if (res.code == 200) {
+            this.orderStatistics = res.data;
+            console.log(this.orderStatistics);
+          }
+        })
+        .catch((err) => {
+          this.$modal.msgError(err);
+        });
+    },
     /** 查询参数列表 */
     getList() {
+      this.selectList = [];
       this.loading = true;
-      listConfig(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
-        this.configList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+      queryAfterSalePage(this.addDateRange(this.queryParams, this.dateRange))
+        .then((response) => {
+          let list = response.data.records;
+          let totalList = [];
+          for (let i = 0; i < list.length; i++) {
+            if (list[i].goodsInfo) {
+              var goods = JSON.parse(list[i].goodsInfo);
+              for (let a = 0; a < goods.length; a++) {
+                let bb = {};
+                if (goods[a].specsValue.length > 0) {
+                  for (let s = 0; s < goods[a].specsValue.length; s++) {
+                    bb = {
+                      ...list[i],
+                      ...goods[a],
+                      ...goods[a].specsValue[s],
+                    };
+                    totalList.push(bb);
+                  }
+                } else {
+                  bb = {
+                    ...list[i],
+                    ...goods[a],
+                  };
+                  totalList.push(bb);
+                }
+              }
+            }
+          }
+
+          this.spuList = totalList;
+          this.total = response.data.total;
+          this.loading = false;
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      if (
+        columnIndex === 0 ||
+        columnIndex === 8 ||
+        columnIndex === 9 ||
+        columnIndex === 10 ||
+        columnIndex === 11 ||
+        columnIndex === 12 ||
+        columnIndex === 16 ||
+        columnIndex === 14 ||
+        columnIndex === 13 ||
+        columnIndex === 15
+      ) {
+        if (rowIndex === 0 || row.userOrderSn != this.spuList[rowIndex - 1].userOrderSn) {
+          let rowspan = 0;
+          this.spuList.forEach((element) => {
+            if (element.userOrderSn === row.userOrderSn) {
+              rowspan++;
+            }
+          });
+          return [rowspan, 1];
+        } else {
+          return [0, 0];
+        }
+      }
+    },
+    handleDetail(record) {
+      this.title = "商品详情";
+      this.open = true;
+      this.dialogLoding = true;
+      afterSaleOrderInfo(record.id)
+        .then((res) => {
+          if (res.code == 200) {
+            this.detailInfo = res.data;
+            this.dialogLoding = false;
+          }
+        })
+        .catch((err) => {
+          this.dialogLoding = false;
+          console.log(err);
+        });
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.selectList = selection.map((item) => item.id);
+      // this.ids = Array.from(new Set(this.selectList));
     },
+
+    /** 导出按钮操作 */
+    handleExport() {
+      let lists = [];
+      for (let index = 0; index < this.spuList.length; index++) {
+        for (let a = 0; a < this.selectList.length; a++) {
+          if (this.spuList[index].id == this.selectList[a]) {
+            lists.push(this.spuList[index]);
+          }
+        }
+      }
+      console.log(lists);
+      Utils.exportExcel(this.column, lists, "售后订单列表"); //导出方法
+    },
+
     // 取消按钮
     cancel() {
       this.open = false;
@@ -252,14 +753,6 @@ export default {
     },
     // 表单重置
     reset() {
-      this.form = {
-        configId: undefined,
-        configName: undefined,
-        configKey: undefined,
-        configValue: undefined,
-        configType: "Y",
-        remark: undefined,
-      };
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
@@ -273,78 +766,6 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加参数";
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.configId);
-      this.single = selection.length != 1;
-      this.multiple = !selection.length;
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const configId = row.configId || this.ids;
-      getConfig(configId).then((response) => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改参数";
-      });
-    },
-    /** 提交按钮 */
-    submitForm: function () {
-      this.$refs["form"].validate((valid) => {
-        if (valid) {
-          if (this.form.configId != undefined) {
-            updateConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const configIds = row.configId || this.ids;
-      this.$modal
-        .confirm('是否确认删除参数编号为"' + configIds + '"的数据项?')
-        .then(function () {
-          return delConfig(configIds);
-        })
-        .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        })
-        .catch(() => {});
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download(
-        "system/config/export",
-        {
-          ...this.queryParams,
-        },
-        `config_${new Date().getTime()}.xlsx`
-      );
-    },
-    /** 刷新缓存按钮操作 */
-    handleRefreshCache() {
-      refreshCache().then(() => {
-        this.$modal.msgSuccess("刷新成功");
-      });
-    },
   },
 };
 </script>

+ 1 - 1
src/views/manage/client.vue

@@ -7,7 +7,7 @@ a
       size="small"
       :inline="true"
       v-show="showSearch"
-      label-width="80px"
+      label-width="120px"
     >
       <el-form-item label="客户昵称" prop="configName">
         <el-input

+ 52 - 29
src/views/manage/completedOrder.vue

@@ -48,7 +48,7 @@ a
           v-model="queryParams.configName"
           placeholder="请输入订单编号"
           clearable
-          style="width: 240px"
+          style="width: 180px"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
@@ -57,7 +57,7 @@ a
           v-model="queryParams.configName"
           placeholder="请输入下单用户手机号/姓名"
           clearable
-          style="width: 240px"
+          style="width: 180px"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
@@ -67,11 +67,15 @@ a
       </el-form-item>
 
       <el-form-item label="交易状态">
-        <el-select v-model="value" placeholder="请选择交易状态">
+        <el-select v-model="value" placeholder="请选择交易状态"   style="width: 180px">
+          <el-option :label="1" :value="1"> </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="支付方式">
+        <el-select v-model="value" placeholder="请选择支付方式"   style="width: 180px">
           <el-option :label="1" :value="1"> </el-option>
         </el-select>
       </el-form-item>
-
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
           >搜索</el-button
@@ -146,31 +150,50 @@ a
     />
 
     <!-- 添加或修改参数配置对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="参数名称" prop="configName">
-          <el-input v-model="form.configName" placeholder="请输入参数名称" />
-        </el-form-item>
-        <el-form-item label="参数键名" prop="configKey">
-          <el-input v-model="form.configKey" placeholder="请输入参数键名" />
-        </el-form-item>
-        <el-form-item label="参数键值" prop="configValue">
-          <el-input v-model="form.configValue" placeholder="请输入参数键值" />
-        </el-form-item>
-        <el-form-item label="系统内置" prop="configType">
-          <!-- <el-radio-group v-model="form.configType">
-              <el-radio
-                v-for="dict in dict.type.sys_yes_no"
-                :key="dict.value"
-                :label="dict.value"
-                >{{ dict.label }}</el-radio
-              >
-            </el-radio-group> -->
-        </el-form-item>
-        <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
-        </el-form-item>
-      </el-form>
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+      <el-descriptions title="订单详情" column="3">
+        <el-descriptions-item label="订单编号">kooriookami</el-descriptions-item>
+        <el-descriptions-item label="订单状态">18100000000</el-descriptions-item>
+        <el-descriptions-item label="配送方式">苏州市</el-descriptions-item>
+        <el-descriptions-item label="支付方式"> </el-descriptions-item>
+        <el-descriptions-item label="下单时间"> 1188 号</el-descriptions-item>
+        <el-descriptions-item label="付款时间"> </el-descriptions-item>
+        <el-descriptions-item label="担保服务费"> </el-descriptions-item>
+        <el-descriptions-item label="运费"> </el-descriptions-item>
+        <el-descriptions-item label="实付款"> </el-descriptions-item>
+      </el-descriptions>
+      <el-descriptions title="物流信息" column="3">
+        <el-descriptions-item label="运单号">kooriookami</el-descriptions-item>
+        <el-descriptions-item label="司机">18100000000</el-descriptions-item>
+        <el-descriptions-item label="车型">苏州市</el-descriptions-item>
+        <el-descriptions-item label="车牌号"> </el-descriptions-item>
+        <el-descriptions-item label="司机电话"> 1188 号</el-descriptions-item>
+        <el-descriptions-item label="装货时间"> </el-descriptions-item>
+        <el-descriptions-item label="送达时间"> </el-descriptions-item>
+      </el-descriptions>
+      <el-descriptions title="买家信息" column="3">
+        <el-descriptions-item label="昵称">kooriookami</el-descriptions-item>
+        <el-descriptions-item label="头像">18100000000</el-descriptions-item>
+        <el-descriptions-item label="收货人">苏州市</el-descriptions-item>
+        <el-descriptions-item label="手机号"> </el-descriptions-item>
+        <el-descriptions-item label="备注"> 1188 号</el-descriptions-item>
+        <el-descriptions-item label="收货地址"> </el-descriptions-item> </el-descriptions
+      >、
+      <el-descriptions title="商品信息" column="3"> </el-descriptions>
+      <el-table :data="tableData" style="width: 100%">
+        <el-table-column label="序号" align="center" >
+          <template slot-scope="scope">
+            {{ scope.$index + 1 }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="date" label="商品图片" > </el-table-column>
+        <el-table-column prop="name" label="商品名称"> </el-table-column>
+        <el-table-column prop="name" label="商品单价"> </el-table-column>
+        <el-table-column prop="name" label="下单数量" > </el-table-column>
+        <el-table-column prop="price" label="总金额"> </el-table-column>
+        <el-table-column prop="price" label="实付款"> </el-table-column>
+      </el-table>
+
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>

+ 86 - 95
src/views/manage/equipment.vue

@@ -9,18 +9,17 @@ a
       v-show="showSearch"
       label-width="100px"
     >
-      <el-form-item label="打印机编号" prop="configName">
+      <el-form-item label="打印机编号" prop="sn">
         <el-input
-          v-model="queryParams.configName"
+          v-model="queryParams.sn"
           placeholder="请输入打印机编号"
           clearable
           style="width: 240px"
-          @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="打印机名称" prop="configName" label-width="140px">
+      <el-form-item label="打印机名称" prop="name" label-width="140px">
         <el-input
-          v-model="queryParams.configName"
+          v-model="queryParams.name"
           placeholder="请输入打印机名称"
           clearable
           style="width: 240px"
@@ -49,19 +48,8 @@ a
       :data="configList"
       @selection-change="handleSelectionChange"
     >
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="用户ID" align="center" prop="configId" />
-      <el-table-column label="打印机编号" align="center" prop="configName" />
-      <el-table-column label="打印机KEY" align="center" prop="configKey" />
-      <el-table-column label="打印机名称" align="center" prop="configValue" />
-      <el-table-column label="自动切刀开关" align="center" prop="configValue" />
-      <el-table-column label="设备添加方式" align="center" prop="configValue" />
-      <el-table-column label="语音开关" align="center" prop="configType">
-        <template slot-scope="scope"> </template>
-      </el-table-column>
-      <el-table-column label="是否在线" align="center" prop="remark" />
-      <el-table-column label="备注" align="center" prop="remark" />
-
+      <el-table-column label="打印机名称" align="center" prop="name" />
+      <el-table-column label="打印机编码" align="center" prop="sn" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -75,8 +63,9 @@ a
           <el-button
             size="mini"
             type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
+            style="color: red"
+            icon="el-icon-remove"
+            @click="handleremove(scope.row)"
             v-hasPermi="['manage:order:detail']"
             >删除</el-button
           >
@@ -94,28 +83,18 @@ a
 
     <!-- 添加或修改参数配置对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="参数名称" prop="configName">
-          <el-input v-model="form.configName" placeholder="请输入参数名称" />
-        </el-form-item>
-        <el-form-item label="参数键名" prop="configKey">
-          <el-input v-model="form.configKey" placeholder="请输入参数键名" />
-        </el-form-item>
-        <el-form-item label="参数键值" prop="configValue">
-          <el-input v-model="form.configValue" placeholder="请输入参数键值" />
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+        <el-form-item label="打印机名称" prop="name">
+          <el-input v-model="form.name" placeholder="请输入打印机名称" />
         </el-form-item>
-        <el-form-item label="系统内置" prop="configType">
-          <!-- <el-radio-group v-model="form.configType">
-              <el-radio
-                v-for="dict in dict.type.sys_yes_no"
-                :key="dict.value"
-                :label="dict.value"
-                >{{ dict.label }}</el-radio
-              >
-            </el-radio-group> -->
+        <el-form-item label="打印机sn" prop="sn">
+          <el-input v-model="form.sn" placeholder="请输入打印机sn" />
         </el-form-item>
-        <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
+        <el-form-item label="操作类型" prop="type">
+          <el-radio-group v-model="form.type">
+            <el-radio :label="0" :value="0">新增</el-radio>
+            <el-radio :label="1" :value="1">绑定</el-radio>
+          </el-radio-group>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -127,14 +106,7 @@ a
 </template>
 
 <script>
-import {
-  listConfig,
-  getConfig,
-  delConfig,
-  addConfig,
-  updateConfig,
-  refreshCache,
-} from "@/api/system/config";
+import { equipmentList, addPrinter, removePrinter } from "@/api/manage/equipment";
 
 export default {
   name: "Config",
@@ -165,32 +137,37 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        configName: undefined,
-        configKey: undefined,
-        configType: undefined,
       },
       // 表单参数
-      form: {},
+      form: {
+        type: 0,
+      },
       // 表单校验
       rules: {
-        configName: [{ required: true, message: "参数名称不能为空", trigger: "blur" }],
-        configKey: [{ required: true, message: "参数键名不能为空", trigger: "blur" }],
-        configValue: [{ required: true, message: "参数键值不能为空", trigger: "blur" }],
+        name: [{ required: true, message: "打印机名称不能为空", trigger: "blur" }],
+        sn: [{ required: true, message: "打印机sn不能为空", trigger: "blur" }],
+        type: [{ required: true, message: "请选择操作类型", trigger: "blur" }],
       },
     };
   },
   created() {
-    // this.getList();
+    this.getList();
   },
   methods: {
     /** 查询参数列表 */
     getList() {
       this.loading = true;
-      listConfig(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
-        this.configList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+      equipmentList(this.addDateRange(this.queryParams, this.dateRange)).then(
+        (response) => {
+          this.configList = response.data.records;
+          this.total = response.data.total;
+          this.loading = false;
+        }
+      );
+    },
+    printOrder() {
+      this.title = "新增设备";
+      this.open = true;
     },
     // 取消按钮
     cancel() {
@@ -199,14 +176,6 @@ export default {
     },
     // 表单重置
     reset() {
-      this.form = {
-        configId: undefined,
-        configName: undefined,
-        configKey: undefined,
-        configValue: undefined,
-        configType: "Y",
-        remark: undefined,
-      };
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
@@ -220,43 +189,65 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加参数";
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.configId);
-      this.single = selection.length != 1;
-      this.multiple = !selection.length;
+
+    handleremove(row) {
+      this.$confirm("是否确认删除该设备?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          removePrinter(row.id).then((response) => {
+            if (response.code == 200) {
+              this.$modal.msgSuccess("删除成功");
+              this.getList();
+            } else {
+              this.$modal.msgError(response.msg);
+              this.getList();
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
     },
+
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
-      const configId = row.configId || this.ids;
-      getConfig(configId).then((response) => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改参数";
-      });
+      this.form = row;
+      this.title = "编辑设备";
+      this.open = true;
     },
     /** 提交按钮 */
     submitForm: function () {
       this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.configId != undefined) {
-            updateConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
+            editPrinter(this.form).then((response) => {
+              if (response.code == 200) {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              } else {
+                this.$modal.msgError(response.msg);
+                this.open = false;
+                this.getList();
+              }
             });
           } else {
-            addConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
+            addPrinter(this.form).then((response) => {
+              if (response.code == 200) {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              } else {
+                this.$modal.msgError(response.msg);
+                this.open = false;
+                this.getList();
+              }
             });
           }
         }

+ 598 - 184
src/views/manage/order.vue

@@ -1,84 +1,121 @@
-a
 <template>
   <div class="app-container">
     <div class="header" style="width: 100%">
       <el-row class="row" :gutter="12">
-        <el-col :span="4">
+        <el-col :span="3">
           <el-card shadow="always">
             <div class="item">
               <div style="padding: 10px">
                 <span>全部订单</span>
               </div>
-              <div class="count">0</div>
+              <div class="count">
+                {{ orderStatistics ? orderStatistics.AllOrder : 0 }} 个
+              </div>
             </div>
           </el-card>
         </el-col>
-        <el-col :span="4">
+        <el-col :span="3">
           <el-card shadow="always">
             <div class="item">
               <div style="padding: 10px">
                 <span>待发货</span>
               </div>
-              <div class="count">0</div>
-              <div class="zz">
-                <span> 0 元</span>
-                <span> 较上周</span>
+              <div class="count">
+                {{ orderStatistics ? orderStatistics.waitDelivery : 0 }}个
               </div>
             </div>
           </el-card>
         </el-col>
-        <el-col :span="4">
+        <el-col :span="3">
           <el-card shadow="always">
             <div class="item">
               <div style="padding: 10px">
                 <span>待收货</span>
               </div>
-              <div class="count">0</div>
-              <div class="zz">
-                <span> 0 元</span>
-                <span> 较上周</span>
+              <div class="count">
+                {{ orderStatistics ? orderStatistics.waitReceive : 0 }}个
               </div>
             </div>
           </el-card>
         </el-col>
-        <el-col :span="4">
+        <el-col :span="3">
           <el-card shadow="always">
             <div class="item">
               <div style="padding: 10px">
                 <span>待支付</span>
               </div>
-              <div class="count">0</div>
-              <div class="zz">
-                <span>0单</span>
-                <span>较上周</span>
+              <div class="count">
+                {{ orderStatistics ? orderStatistics.waitPay : 0 }}个
               </div>
             </div>
           </el-card>
         </el-col>
-        <el-col :span="4">
+        <el-col :span="3">
           <el-card shadow="always">
             <div class="item">
               <div style="padding: 10px">
                 <span>待退款</span>
               </div>
-              <div class="count">0</div>
-              <div class="zz">
-                <span>0单</span>
-                <span>较上周</span>
+              <div class="count">
+                {{ orderStatistics ? orderStatistics.waitRefund : 0 }}个
               </div>
             </div>
           </el-card>
         </el-col>
-        <el-col :span="4">
+        <el-col :span="3">
           <el-card shadow="always">
             <div class="item">
               <div style="padding: 10px">
                 <span>售后订单</span>
               </div>
-              <div class="count">0</div>
-              <div class="zz">
-                <span>0单</span>
-                <span>较上周</span>
+              <div class="count">
+                {{ orderStatistics ? orderStatistics.afterSalesOrder : 0 }}个
+              </div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="3">
+          <el-card shadow="always">
+            <div class="item">
+              <div style="padding: 10px">
+                <span>已完成订单</span>
+              </div>
+              <div class="count">
+                {{
+                  orderStatistics.successOrderCount
+                    ? orderStatistics.successOrderCount
+                    : 0
+                }}个
+              </div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="3">
+          <el-card shadow="always">
+            <div class="item">
+              <div style="padding: 10px">
+                <span>到账金额</span>
+              </div>
+              <div class="count">
+                {{
+                  orderStatistics.divideSuccessPrice
+                    ? orderStatistics.divideSuccessPrice
+                    : 0
+                }}元
+              </div>
+            </div>
+          </el-card>
+        </el-col>
+        <el-col :span="3">
+          <el-card shadow="always">
+            <div class="item">
+              <div style="padding: 10px">
+                <span>冻结金额</span>
+              </div>
+              <div class="count">
+                {{
+                  orderStatistics.divideWaitPrice ? orderStatistics.divideWaitPrice : 0
+                }}元
               </div>
             </div>
           </el-card>
@@ -93,35 +130,89 @@ a
       v-show="showSearch"
       label-width="80px"
     >
-      <el-form-item label="订单编号" prop="configName">
+      <el-form-item label="商品名称" prop="spuName">
         <el-input
-          v-model="queryParams.configName"
+          v-model="queryParams.spuName"
+          placeholder="请输入商品名称"
+          clearable
+          style="width: 180px"
+        />
+      </el-form-item>
+      <el-form-item label="订单编号" prop="userOrderSn">
+        <el-input
+          v-model="queryParams.userOrderSn"
           placeholder="请输入订单编号"
           clearable
-          style="width: 240px"
-          @keyup.enter.native="handleQuery"
+          style="width: 180px"
         />
       </el-form-item>
-      <el-form-item label="下单人手机号/姓名" prop="configName" label-width="140px">
+      <el-form-item label="下单人手机号" prop="userPhone" label-width="140px">
         <el-input
-          v-model="queryParams.configName"
-          placeholder="请输入下单用户手机号/姓名"
+          v-model="queryParams.userPhone"
+          placeholder="请输入下单用户手机号"
           clearable
-          style="width: 240px"
-          @keyup.enter.native="handleQuery"
+          style="width: 180px"
         />
       </el-form-item>
-      <el-form-item label="下单时间" prop="configType">
-        <el-date-picker v-model="value1" type="date" placeholder="请选择下单时间">
+      <el-form-item label="下单时间" prop="createTime">
+        <el-date-picker
+          v-model="queryParams.createTime"
+          value-format="yyyy-MM-dd"
+          format="yyyy-MM-dd"
+          type="date"
+          placeholder="请选择下单时间"
+        >
         </el-date-picker>
       </el-form-item>
 
-      <el-form-item label="交易状态">
-        <el-select v-model="value" placeholder="请选择交易状态">
-          <el-option :label="1" :value="1"> </el-option>
+      <el-form-item label="订单状态" prop="orderStatus">
+        <el-select
+          v-model="queryParams.orderStatus"
+          placeholder="请选择订单状态"
+          style="width: 180px"
+        >
+          <el-option label="待商家确认修改运费" :value="0"> </el-option>
+          <el-option label="等待买家支付" :value="10"> </el-option>
+          <el-option label="等待商家发布货运信息" :value="20"> </el-option>
+          <el-option label="等待司机接单" :value="90"> </el-option>
+          <el-option label="等待司机支付保证金" :value="100"> </el-option>
+          <el-option label="等待司机装货" :value="110"> </el-option>
+          <el-option label="已装货,运输中" :value="120"> </el-option>
+          <el-option label="司机已到达,等待买家签收" :value="30"> </el-option>
+          <el-option label="买家已收货" :value="40"> </el-option>
+          <el-option label="已取消" :value="50"> </el-option>
+          <el-option label="退款中" :value="60"> </el-option>
+          <el-option label="退款成功" :value="70"> </el-option>
+          <el-option label="退款失败" :value="80"> </el-option>
+          <el-option label="待处理售后" :value="130"> </el-option>
+          <el-option label="已处理售后" :value="140"> </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="售后状态" prop="afterSaleStatus">
+        <el-select
+          v-model="queryParams.afterSaleStatus"
+          placeholder="请选择支付方式"
+          style="width: 180px"
+        >
+          <el-option label="未申请" value="0"> </el-option>
+          <el-option label="已申请" value="1"> </el-option>
+          <el-option label="审核失败" value="2"> </el-option>
+          <el-option label="审核成功(退款中)" value="3"> </el-option>
+          <el-option label="退款成功" value="4"> </el-option>
+          <el-option label="退款失败(联系客服解决)" value="5"> </el-option>
         </el-select>
       </el-form-item>
 
+      <el-form-item label="支付方式">
+        <el-select
+          v-model="queryParams.paymentType"
+          placeholder="请选择支付方式"
+          style="width: 180px"
+        >
+          <el-option label="支付宝" value="ALIPAY"> </el-option>
+          <el-option label="微信支付" value="WECHAT"> </el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
           >搜索</el-button
@@ -132,55 +223,154 @@ a
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button type="primary" plain size="mini" @click="printOrder"
+        <el-button
+          type="primary"
+          plain
+          size="mini"
+          @click="printOrderBtn"
+          :disabled="!selectList.length > 0"
           >订单打印</el-button
         >
       </el-col>
       <el-col :span="1.5">
-        <el-button type="primary" plain size="mini" @click="printOrder"
+        <el-button
+          type="primary"
+          plain
+          size="mini"
+          @click="handleExport"
+          :disabled="!selectList.length > 0"
           >导出</el-button
         >
       </el-col>
-      <el-col :span="1.5">
+      <!-- <el-col :span="1.5">
         <el-button type="success" plain icon="el-icon-edit" size="mini" @click="All"
           >全选</el-button
         >
-      </el-col>
+      </el-col> -->
     </el-row>
 
     <el-table
+      ref="multipleTable"
       v-loading="loading"
-      :data="configList"
+      :data="spuList"
+      :span-method="objectSpanMethod"
       @selection-change="handleSelectionChange"
+      row-key="id"
     >
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="订单编号" align="center" prop="configId" />
+
+      <el-table-column label="商品图片" align="center" prop="skuPic">
+        <template slot-scope="scope">
+          <el-image :src="scope.row.skuPic" style="width: 60px; height: 60px"> </el-image>
+        </template>
+      </el-table-column>
+      <el-table-column label="商品类型" align="center" prop="categoryName">
+      </el-table-column>
+      <el-table-column label="单价/数量" align="center" prop="price">
+        <template slot-scope="scope">
+          <span>
+            {{ scope.row.price }}元 <br />
+            共{{ scope.row.quantity }}{{ scope.row.unit }}</span
+          >
+        </template>
+      </el-table-column>
+      <el-table-column label="包装方式" align="center" prop="packageType">
+      </el-table-column>
+      <el-table-column label="规格名称" align="center" prop="specsName" />
+      <el-table-column label="规格值" align="center" prop="specsValue" />
+      <el-table-column label="实付金额" align="center" prop="goodsAmount">
+        <template slot-scope="scope"> {{ scope.row.goodsAmount }}元 </template>
+      </el-table-column>
+      <el-table-column label="订单编号" align="center" prop="userOrderSn" width="220" />
+      <el-table-column label="买家姓名" align="center" prop="userNick" />
+      <el-table-column label="买家头像" align="center">
+        <template slot-scope="scope">
+          <el-avatar :size="40" :src="scope.row.userHeadUrl"></el-avatar>
+        </template>
+      </el-table-column>
+      <el-table-column label="买家手机号" align="center" prop="userPhone" />
+
       <el-table-column
         label="商品名称"
         align="center"
-        prop="configName"
+        prop="skuName"
         :show-overflow-tooltip="true"
-      />
-      <el-table-column label="单价/数量" align="center" prop="configKey" />
-      <el-table-column label="实付款" align="center" prop="configValue" />
-      <el-table-column label="下单时间" align="center" prop="configValue" />
-      <el-table-column label="付款时间" align="center" prop="configValue" />
-      <el-table-column label="买家信息" align="center" prop="configType">
-        <template slot-scope="scope"> </template>
+      >
       </el-table-column>
-      <el-table-column label="支付方式" align="center" prop="remark" />
-      <el-table-column label="配送方式" align="center" prop="remark" />
-      <el-table-column label="交易状态" align="center" prop="createTime" width="180">
-        <template slot-scope="scope"> </template>
+
+      <el-table-column label="运费(元)" align="center" prop="freightFee" />
+      <el-table-column label="订单状态" align="center">
+        <template slot-scope="scope">
+          <el-tag>
+            {{
+              scope.row.orderStatus == 0
+                ? "待商家确认修改运费"
+                : scope.row.orderStatus == 10
+                ? "等待买家支付"
+                : scope.row.orderStatus == 20
+                ? "等待商家发布货运信息"
+                : scope.row.orderStatus == 90
+                ? "等待司机接单"
+                : scope.row.orderStatus == 100
+                ? "等待司机支付保证金"
+                : scope.row.orderStatus == 110
+                ? "等待司机装货"
+                : scope.row.orderStatus == 120
+                ? "已装货,运输中"
+                : scope.row.orderStatus == 30
+                ? "司机已到达,等待买家签收"
+                : scope.row.orderStatus == 40
+                ? "买家已收货"
+                : scope.row.orderStatus == 50
+                ? "已取消"
+                : scope.row.orderStatus == 60
+                ? "退款中"
+                : scope.row.orderStatus == 70
+                ? "退款成功"
+                : scope.row.orderStatus == 80
+                ? "退款失败"
+                : scope.row.orderStatus == 130
+                ? "待处理售后"
+                : scope.row.orderStatus == 140
+                ? "已处理售后"
+                : ""
+            }}</el-tag
+          >
+        </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column label="售后状态" align="center">
         <template slot-scope="scope">
-          <el-button
+          {{
+            scope.row.afterSaleStatus == 0
+              ? "未申请"
+              : scope.row.afterSaleStatus == 1
+              ? "已申请"
+              : scope.row.afterSaleStatus == 2
+              ? "审核失败"
+              : scope.row.afterSaleStatus == 3
+              ? "审核成功(退款中)"
+              : scope.row.afterSaleStatus == 4
+              ? "退款成功"
+              : scope.row.afterSaleStatus == 5
+              ? "退款失败(联系客服解决)"
+              : ""
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" width="150">
+        <template slot-scope="scope">
+          <!-- <el-button
             size="mini"
             type="text"
-            icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['manage:order:detail']"
+            >我要发货</el-button
+          > -->
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleDetail(scope.row)"
+            v-hasPermi="['manage:order:detail']"
             >订单详情</el-button
           >
         </template>
@@ -196,34 +386,175 @@ a
     />
 
     <!-- 添加或修改参数配置对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="参数名称" prop="configName">
-          <el-input v-model="form.configName" placeholder="请输入参数名称" />
-        </el-form-item>
-        <el-form-item label="参数键名" prop="configKey">
-          <el-input v-model="form.configKey" placeholder="请输入参数键名" />
-        </el-form-item>
-        <el-form-item label="参数键值" prop="configValue">
-          <el-input v-model="form.configValue" placeholder="请输入参数键值" />
-        </el-form-item>
-        <el-form-item label="系统内置" prop="configType">
-          <!-- <el-radio-group v-model="form.configType">
-              <el-radio
-                v-for="dict in dict.type.sys_yes_no"
-                :key="dict.value"
-                :label="dict.value"
-                >{{ dict.label }}</el-radio
+    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
+      <el-descriptions title="订单详情" column="3">
+        <el-descriptions-item label="订单编号">{{
+          detailInfo ? detailInfo.userOrderSn : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="订单状态">
+          {{
+            detailInfo
+              ? detailInfo.orderStatus == 0
+                ? "待商家确认修改运费"
+                : detailInfo.orderStatus == 10
+                ? "等待买家支付"
+                : detailInfo.orderStatus == 20
+                ? "等待商家发布货运信息"
+                : detailInfo.orderStatus == 90
+                ? "等待司机接单"
+                : detailInfo.orderStatus == 100
+                ? "等待司机支付保证金"
+                : detailInfo.orderStatus == 110
+                ? "等待司机装货"
+                : detailInfo.orderStatus == 120
+                ? "已装货,运输中"
+                : detailInfo.orderStatus == 30
+                ? "司机已到达,等待买家签收"
+                : detailInfo.orderStatus == 40
+                ? "买家已收货"
+                : detailInfo.orderStatus == 50
+                ? "已取消"
+                : detailInfo.orderStatus == 60
+                ? "退款中"
+                : detailInfo.orderStatus == 70
+                ? "退款成功"
+                : detailInfo.orderStatus == 80
+                ? "退款失败"
+                : detailInfo.orderStatus == 130
+                ? "待处理售后"
+                : detailInfo.orderStatus == 140
+                ? "已处理售后"
+                : ""
+              : ""
+          }}</el-descriptions-item
+        >
+        <el-descriptions-item label="配送方式">{{
+          detailInfo
+            ? detailInfo.deliveryMethod == -1
+              ? "未选择"
+              : detailInfo.deliveryMethod == 0
+              ? "线下发货"
+              : detailInfo.deliveryMethod == 1
+              ? "平台找司机"
+              : ""
+            : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="支付方式">
+          {{
+            detailInfo
+              ? detailInfo.paymentType == "ALIPAY"
+                ? "支付宝"
+                : detailInfo.paymentType == "WECHAT"
+                ? "微信支付"
+                : detailInfo.paymentType == "CARD"
+                ? "银行卡支付"
+                : ""
+              : ""
+          }}</el-descriptions-item
+        >
+        <el-descriptions-item label="下单时间">{{
+          detailInfo ? detailInfo.createTime : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="付款时间">
+          {{ detailInfo ? detailInfo.paymentTime : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="担保服务费">
+          {{ detailInfo ? detailInfo.serviceFee : "" }}
+        </el-descriptions-item>
+        <el-descriptions-item label="运费">
+          {{ detailInfo ? detailInfo.freightFee : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="实付款">
+          {{ detailInfo ? detailInfo.totalPrice : "" }}
+        </el-descriptions-item>
+      </el-descriptions>
+      <el-descriptions title="物流信息" column="3">
+        <el-descriptions-item label="运单号">
+          {{ detailInfo ? detailInfo.orderSn : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="司机">{{
+          detailInfo ? detailInfo.driverUservalue : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="车型">{{
+          detailInfo ? detailInfo.carType : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="车牌号"
+          >{{ detailInfo ? detailInfo.plateNo : "" }}
+        </el-descriptions-item>
+        <el-descriptions-item label="司机电话">{{
+          detailInfo ? detailInfo.driverPhone : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="装货时间">
+          {{ detailInfo ? detailInfo.shipmentTime : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="送达时间">
+          {{ detailInfo ? detailInfo.arriveTime : "" }}</el-descriptions-item
+        >
+      </el-descriptions>
+      <el-descriptions title="买家信息" column="3">
+        <el-descriptions-item label="昵称">{{
+          detailInfo ? detailInfo.userNick : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="头像">
+          <el-avatar
+            v-if="detailInfo.userHeadUrl"
+            :size="30"
+            :src="detailInfo.userHeadUrl"
+          ></el-avatar
+        ></el-descriptions-item>
+        <el-descriptions-item label="收货人">{{
+          detailInfo ? detailInfo.consigneeContactName : ""
+        }}</el-descriptions-item>
+        <el-descriptions-item label="手机号">
+          {{ detailInfo ? detailInfo.userPhone : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="备注">
+          {{ detailInfo ? detailInfo.orderRemark : "" }}</el-descriptions-item
+        >
+        <el-descriptions-item label="收货地址"
+          >{{ detailInfo ? detailInfo.consigneeAddressDetail : "" }}
+        </el-descriptions-item>
+      </el-descriptions>
+      <el-descriptions title="商品信息" column="3"> </el-descriptions>
+      <el-table :data="detailInfo.orderGoodInfoList" style="width: 100%">
+        <el-table-column prop="skuName" label="商品名称"> </el-table-column>
+        <el-table-column prop="skuName" label="商品图片">
+          <template slot-scope="scope">
+            <el-image :src="scope.row.skuPic" style="width: 50px; height: 50px">
+            </el-image>
+          </template>
+        </el-table-column>
+        <el-table-column prop="price" label="商品单价"> </el-table-column>
+        <el-table-column prop="quantity" label="下单数量"> </el-table-column>
+        <el-table-column prop="totalPrice" label="总金额"> </el-table-column>
+      </el-table>
+    </el-dialog>
+
+    <!-- 添加或修改参数配置对话框 -->
+    <el-dialog
+      title="打印订单"
+      :visible.sync="equipmentOpen"
+      width="500px"
+      append-to-body
+    >
+      <div>
+        <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+          <el-form-item label="选择打印机" prop="sn">
+            <el-select v-model="printForm.sn" placeholder="请选择打印机">
+              <el-option
+                v-for="item in printList"
+                :key="item.value"
+                :label="item.name"
+                :value="item.sn"
               >
-            </el-radio-group> -->
-        </el-form-item>
-        <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
-        </el-form-item>
-      </el-form>
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+      </div>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
+        <el-button type="primary" @click="printSubmitForm">确 定</el-button>
+        <el-button @click="equipmentOpen = false">取 消</el-button>
       </div>
     </el-dialog>
   </div>
@@ -231,21 +562,21 @@ a
 
 <script>
 import {
-  listConfig,
-  getConfig,
-  delConfig,
-  addConfig,
-  updateConfig,
-  refreshCache,
-} from "@/api/system/config";
+  statisticsOrderNum,
+  queryUserOrderByShopId,
+  userOrderInfo,
+} from "@/api/manage/order";
+import { printOrder, equipmentList } from "@/api/manage/equipment";
 
+import Utils from "@/utils/derive";
 export default {
   name: "Config",
   //   dicts: ["sys_yes_no"],
   data() {
     return {
+      equipmentOpen: false,
       // 遮罩层
-      loading: true,
+      loading: false,
       // 选中数组
       ids: [],
       // 非单个禁用
@@ -257,44 +588,171 @@ export default {
       // 总条数
       total: 0,
       // 参数表格数据
-      configList: [],
+      spuList: [],
       // 弹出层标题
-      title: "",
+      title: "订单详情",
       // 是否显示弹出层
       open: false,
       // 日期范围
       dateRange: [],
       // 查询参数
       queryParams: {
-        pageNum: 1,
+        pageNo: 1,
         pageSize: 10,
-        configName: undefined,
-        configKey: undefined,
-        configType: undefined,
       },
+      printForm: {
+        sn: "",
+      },
+      column: [
+        { header: "订单编号", key: "userOrderSn", width: 20 },
+        { header: "买家姓名", key: "userNick", width: 20 },
+        { header: "买家手机号", key: "userPhone", width: 20 },
+        { header: "商品名称", key: "skuName", width: 20 },
+        { header: "商品类型", key: "categoryName", width: 20 },
+        { header: "商品价格", key: "price", width: 20 },
+        { header: "包装方式", key: "packageType", width: 20 },
+        { header: "规格名称", key: "specsName", width: 20 },
+        { header: "规格值", key: "specsValue", width: 20 },
+        { header: "实付金额", key: "goodsAmount", width: 20 },
+        { header: "运费", key: "freightFee", width: 20 },
+        { header: "订单状态", key: "orderStatus", width: 20 },
+        { header: "售后状态", key: "afterSaleStatus", width: 20 },
+      ],
       // 表单参数
       form: {},
       // 表单校验
       rules: {
-        configName: [{ required: true, message: "参数名称不能为空", trigger: "blur" }],
-        configKey: [{ required: true, message: "参数键名不能为空", trigger: "blur" }],
         configValue: [{ required: true, message: "参数键值不能为空", trigger: "blur" }],
       },
+      orderStatistics: {},
+      mergeObj: {}, // 用来记录需要合并行的下标
+      selectList: [],
+      detailInfo: {},
+      dialogLoding: false,
+      printList: [],
     };
   },
   created() {
-    // this.getList();
+    this.getList();
+    this.getEquipmentList();
+    this.getstatisticsOrder();
   },
   methods: {
+    getEquipmentList() {
+      equipmentList().then((res) => {
+        if (res.code == 200) {
+          this.printList = res.data.records;
+        }
+      });
+    },
+    printSubmitForm() {
+      this.printForm.id = this.selectList.toString();
+      printOrder(this.printForm)
+        .then((res) => {
+          if (res.code == 200) {
+            this.equipmentOpen = false;
+            this.$modal.msgSuccess("操作成功!");
+          } else {
+            this.equipmentOpen = false;
+            this.$modal.msgError(res.msg);
+          }
+        })
+        .catch((err) => {
+          this.equipmentOpen = false;
+          this.$modal.msgError(err);
+        });
+    },
+    printOrderBtn() {
+      this.equipmentOpen = true;
+    },
+    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      if (
+        columnIndex === 0 ||
+        columnIndex === 8 ||
+        columnIndex === 9 ||
+        columnIndex === 10 ||
+        columnIndex === 11 ||
+        columnIndex === 12 ||
+        columnIndex === 16 ||
+        columnIndex === 14 ||
+        columnIndex === 13 ||
+        columnIndex === 15
+      ) {
+        if (rowIndex === 0 || row.userOrderSn != this.spuList[rowIndex - 1].userOrderSn) {
+          let rowspan = 0;
+          this.spuList.forEach((element) => {
+            if (element.userOrderSn === row.userOrderSn) {
+              rowspan++;
+            }
+          });
+          return [rowspan, 1];
+        } else {
+          return [0, 0];
+        }
+      }
+    },
+    getstatisticsOrder() {
+      statisticsOrderNum()
+        .then((res) => {
+          if (res) {
+            this.orderStatistics = res;
+          }
+        })
+        .catch((err) => {
+          this.$modal.msgError(err);
+        });
+    },
+
     /** 查询参数列表 */
     getList() {
+      this.selectList = [];
       this.loading = true;
-      listConfig(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
-        this.configList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+      queryUserOrderByShopId(this.addDateRange(this.queryParams, this.dateRange))
+        .then((response) => {
+          let list = response.data.records;
+          let totalList = [];
+          for (let i = 0; i < list.length; i++) {
+            if (list[i].goodsInfo) {
+              var goods = JSON.parse(list[i].goodsInfo);
+              for (let a = 0; a < goods.length; a++) {
+                let bb = {};
+                if (goods[a].specsValue.length > 0) {
+                  for (let s = 0; s < goods[a].specsValue.length; s++) {
+                    bb = {
+                      ...list[i],
+                      ...goods[a],
+                      ...goods[a].specsValue[s],
+                    };
+                    totalList.push(bb);
+                  }
+                } else {
+                  bb = {
+                    ...list[i],
+                    ...goods[a],
+                  };
+                  totalList.push(bb);
+                }
+              }
+            }
+          }
+
+          this.spuList = totalList;
+          // for (let index = 0; index < this.spuList.length; index++) {
+          //   for (let a = 0; a < this.selectList.length; a++) {
+          //     if (this.spuList[index].id == this.selectList[a]) {
+          //       console.log("cxzczxczxczx", this.spuList[index]);
+          //       this.$refs.multipleTable.toggleRowSelection(this.spuList[index], true);
+          //     }
+          //   }
+          // }
+          this.total = response.data.total;
+          this.loading = false;
+        })
+        .catch((err) => {
+          console.log(err);
+        });
     },
+
     // 取消按钮
     cancel() {
       this.open = false;
@@ -302,14 +760,6 @@ export default {
     },
     // 表单重置
     reset() {
-      this.form = {
-        configId: undefined,
-        configName: undefined,
-        configKey: undefined,
-        configValue: undefined,
-        configType: "Y",
-        remark: undefined,
-      };
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
@@ -323,77 +773,41 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
+
+    handleDetail(record) {
+      this.title = "商品详情";
       this.open = true;
-      this.title = "添加参数";
+      this.dialogLoding = true;
+      userOrderInfo(record.id)
+        .then((res) => {
+          if (res) {
+            this.detailInfo = res;
+            this.dialogLoding = false;
+          }
+        })
+        .catch((err) => {
+          this.dialogLoding = false;
+          console.log(err);
+        });
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.configId);
-      this.single = selection.length != 1;
-      this.multiple = !selection.length;
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const configId = row.configId || this.ids;
-      getConfig(configId).then((response) => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改参数";
-      });
-    },
-    /** 提交按钮 */
-    submitForm: function () {
-      this.$refs["form"].validate((valid) => {
-        if (valid) {
-          if (this.form.configId != undefined) {
-            updateConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const configIds = row.configId || this.ids;
-      this.$modal
-        .confirm('是否确认删除参数编号为"' + configIds + '"的数据项?')
-        .then(function () {
-          return delConfig(configIds);
-        })
-        .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        })
-        .catch(() => {});
+      this.selectList = selection.map((item) => item.id);
+      // this.ids = Array.from(new Set(this.selectList));
     },
+
     /** 导出按钮操作 */
     handleExport() {
-      this.download(
-        "system/config/export",
-        {
-          ...this.queryParams,
-        },
-        `config_${new Date().getTime()}.xlsx`
-      );
-    },
-    /** 刷新缓存按钮操作 */
-    handleRefreshCache() {
-      refreshCache().then(() => {
-        this.$modal.msgSuccess("刷新成功");
-      });
+      let lists = [];
+      for (let index = 0; index < this.spuList.length; index++) {
+        for (let a = 0; a < this.selectList.length; a++) {
+          if (this.spuList[index].id == this.selectList[a]) {
+            lists.push(this.spuList[index]);
+          }
+        }
+      }
+      console.log(lists);
+      Utils.exportExcel(this.column, lists, "订单列表"); //导出方法
     },
   },
 };
@@ -411,7 +825,7 @@ export default {
     align-items: center;
     .count {
       padding: 10px;
-      font-size: 23px;
+      font-size: 20px;
       font-weight: 500;
     }
     .zz {

+ 428 - 109
src/views/manage/product.vue

@@ -50,11 +50,7 @@ a
       </el-col>
     </el-row>
 
-    <el-table
-      v-loading="loading"
-      :data="configList"
-      @selection-change="handleSelectionChange"
-    >
+    <el-table v-loading="loading" :data="configList">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="订单编号" align="center" prop="configId" />
       <el-table-column
@@ -99,7 +95,7 @@ a
 
     <!-- 添加或修改参数配置对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="140px">
+      <el-form ref="form" :model="form" :rules="rulesRole" label-width="140px">
         <el-row>
           <el-col :span="12">
             <el-form-item label="商品名称:" prop="configName">
@@ -118,7 +114,7 @@ a
           </el-col>
           <el-col :span="12">
             <el-form-item label="商品封面图:" prop="configKey">
-                <span style="font-size:12px">商品封面的展示</span>
+              <span style="font-size: 12px">商品封面的展示</span>
               <el-upload
                 action="https://jsonplaceholder.typicode.com/posts/"
                 list-type="picture-card"
@@ -131,7 +127,9 @@ a
           </el-col>
           <el-col :span="12">
             <el-form-item label="商品视频:" prop="configKey">
-              <span style="font-size:12px;color:red">上传视频有利于用户看的更直接</span>
+              <span style="font-size: 12px; color: red"
+                >上传视频有利于用户看的更直接</span
+              >
               <el-upload
                 action="https://jsonplaceholder.typicode.com/posts/"
                 list-type="picture-card"
@@ -144,7 +142,7 @@ a
           </el-col>
           <el-col :span="24">
             <el-form-item label="商品图:" prop="configKey">
-                <span style="font-size:12px;">可上传最多10张图</span>
+              <span style="font-size: 12px">可上传最多10张图</span>
               <el-upload
                 action="https://jsonplaceholder.typicode.com/posts/"
                 list-type="picture-card"
@@ -157,7 +155,7 @@ a
           </el-col>
           <el-col :span="24">
             <el-form-item label="详情图:" prop="configKey">
-                <span style="font-size:12px;">可上传最多10张图</span>
+              <span style="font-size: 12px">可上传最多10张图</span>
               <el-upload
                 action="https://jsonplaceholder.typicode.com/posts/"
                 list-type="picture-card"
@@ -170,7 +168,9 @@ a
           </el-col>
           <el-col :span="24">
             <el-form-item label="特殊资质图:" prop="configKey">
-                <span style="font-size:12px;">如有特殊资质例如农产检查有机认证最多10张图</span>
+              <span style="font-size: 12px"
+                >如有特殊资质例如农产检查有机认证最多10张图</span
+              >
               <el-upload
                 action="https://jsonplaceholder.typicode.com/posts/"
                 list-type="picture-card"
@@ -183,30 +183,37 @@ a
           </el-col>
           <el-col :span="24">
             <el-form-item label="商品价格与规格:" prop="configKey">
-              <el-button type="text">自定义添加规格</el-button>
+              <span style="color: #0fd70f">{{
+                specification.length > 0 ? "已添加" + specification.length + "个规格" : ""
+              }}</span>
+              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+
+              <el-button type="text" @click="custom('specification')">添加规格</el-button>
             </el-form-item>
           </el-col>
           <el-col :span="24">
             <el-form-item label="运费:" prop="configKey">
-              <el-button type="text">自定义添加运费模版</el-button>
+              <el-button type="text" @click="custom('freight')">添加运费模版</el-button>
             </el-form-item>
           </el-col>
           <el-col :span="24">
             <el-form-item label="发货地址:" prop="configKey">
               <div style="display: flex; flex-direction: row">
                 <el-cascader
-                  placeholder="请选择省市区"
-                  v-model="value"
-                  :options="options"
-                  @change="handleChange"
-                ></el-cascader>
+                  v-model="form.area"
+                  ref="myCascader"
+                  placeholder="请选择城市"
+                  :props="props"
+                  style="width: 300px"
+                  @change="(res) => araeChange(res, 'query')"
+                />
                 <el-input v-model="form.configKey" placeholder="请输入详细地址" />
               </div>
             </el-form-item>
           </el-col>
           <el-col :span="24">
             <el-form-item label="添加商品属性:" prop="configKey">
-              <el-button type="text">自定义添加商品属性</el-button>
+              <el-button type="text" @click="custom('stats')">添加商品属性</el-button>
             </el-form-item>
           </el-col>
           <el-col :span="24">
@@ -223,22 +230,278 @@ a
         </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button type="primary">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+    <!-- 规格列表 -->
+    <el-dialog
+      :title="specificationTitle"
+      :visible.sync="specificationOpen"
+      width="700px"
+      append-to-body
+    >
+      <el-form
+        :model="queryParams"
+        ref="queryForm"
+        size="small"
+        :inline="true"
+        label-width="120px"
+      >
+        <el-form-item label="计量单位" prop="configName">
+          <el-input
+            v-model="queryParams.configName"
+            placeholder="请选择计量单位"
+            clearable
+            style="width: 240px"
+          />
+        </el-form-item>
+        <el-button
+          type="primary"
+          @click="specificationAdd"
+          size="mini"
+          style="position: absolute; right: 20px"
+          >添加规格</el-button
+        >
+        <div style="max-height: 500px; overflow: auto">
+          <el-row
+            v-for="(item, index) in specification"
+            :key="index"
+            style="
+              padding: 20px 0px;
+              border: 1px solid #f1f1f1;
+              border-radius: 20px;
+              margin-bottom: 20px;
+            "
+          >
+            <el-col
+              :span="24"
+              style="text-align: right; padding: 0px 20px; position: absolute; top: 10px"
+            >
+              <i
+                class="el-icon-edit-outline"
+                style="font-size: 26px"
+                @click="specificationEdit(item)"
+              ></i>
+              <i
+                @click="specificationRemove(item, inex)"
+                class="el-icon-delete"
+                style="font-size: 26px; margin-left: 10px; color: red"
+              ></i>
+            </el-col>
+
+            <el-col :span="12">
+              <el-form-item label="规格名称:" prop="configName">
+                {{ item.name }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="规格内容:" prop="configName">
+                {{ item.contont }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="库存:" prop="configName">
+                {{ item.inventory }} 斤
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="起批量:" prop="configName">
+                {{ item.starting }}斤
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="批发价:" prop="configName">
+                {{ item.wholesale }}元/斤
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="商品单价:" prop="configName">
+                {{ item.wholesale }}元/斤
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </div>
+      </el-form>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary">确 定</el-button>
+        <el-button @click="specificationOpen = false">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog :title="subTitle" :visible.sync="subOpen" width="700px" append-to-body>
+      <el-form
+        :model="rules"
+        ref="queryForm"
+        size="small"
+        :inline="true"
+        label-width="80px"
+      >
+        <el-row v-if="subType == 'specification'">
+          <el-col :span="12">
+            <el-form-item label="规格名称" prop="name">
+              <el-input
+                v-model="rules.specification.name"
+                placeholder="请输入规格名称"
+                clearable
+                style="width: 240px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="规格内容" prop="contont">
+              <el-input
+                v-model="rules.specification.contont"
+                placeholder="请输入规格内容"
+                clearable
+                style="width: 240px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="库存" prop="inventory">
+              <el-input
+                v-model="rules.specification.inventory"
+                placeholder="请输入库存"
+                clearable
+                style="width: 240px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="起批量" prop="starting">
+              <el-input
+                v-model="rules.specification.starting"
+                placeholder="请输入起批量"
+                clearable
+                style="width: 240px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="批发价" prop="wholesale">
+              <el-input
+                v-model="rules.specification.wholesale"
+                placeholder="请输入批发价"
+                clearable
+                style="width: 240px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="商品单价" prop="configName">
+              {{ rules.wholesale ? rules.wholesale + "元/斤" : "" }}
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row v-if="subType == 'freight'">
+          <el-col :span="24">
+            <el-form-item label="运费模版名称" prop="configName" label-width="130px">
+              <el-input
+                v-model="queryParams.configName"
+                placeholder="请输入运费模版名称"
+                clearable
+                @keyup.enter.native="handleQuery"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="小于商品金额" prop="configName" label-width="130px">
+              <el-input
+                v-model="queryParams.configName"
+                placeholder="请输入商品金额"
+                style="with: 100px"
+                clearable
+              />
+            </el-form-item>
+            <el-form-item label="运费" prop="configName">
+              <el-input
+                style="with: 100px"
+                v-model="queryParams.configName"
+                placeholder="请输入运费"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="大于等于商品金额" prop="configName" label-width="130px">
+              <div style="width: 200px; display: flex; flex-direction: row">
+                <el-input
+                  v-model="queryParams.configName"
+                  placeholder="请输入起批量"
+                  clearable
+                />
+                <div style="width: 100px; margin-left: 5px">元免运费</div>
+              </div>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row v-if="subType == 'stats'">
+          <el-col :span="24" style="text-align: right; position: absolute; top: -40px">
+            <el-button type="primary" @click="productAdd" size="mini"
+              >自定义添加</el-button
+            ></el-col
+          >
+          <el-col :span="24">
+            <el-form-item label="包装方式" prop="configName" label-width="100px">
+              <el-select v-model="rules.stats.packing" placeholder="请选择包装方式">
+                <el-option label="纸箱装" value="1"> </el-option>
+                <el-option label="礼盒装" value="2"> </el-option>
+                <el-option label="胶框装" value="3"> </el-option>
+                <el-option label="泡沫箱装" value="4"> </el-option>
+                <el-option label="袋装" value="5"> </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="发货时间" prop="configName" label-width="100px">
+              <el-radio-group
+                v-model="rules.stats.deliveryTime"
+                style="width: 500px; line-height: 30px"
+              >
+                <el-radio
+                  :label="item.value"
+                  v-for="(item, index) in deliveryTimes"
+                  :key="index"
+                >
+                  {{ item.label }}
+                  <span
+                    v-if="item.type == 'add'"
+                    style="color: red"
+                    @click="removeRadio(index)"
+                    >删除</span
+                  >
+                </el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24" v-if="rules.stats.deliveryTime == 99">
+            <el-form-item label="自定义添加" prop="configName" label-width="100px">
+              <div style="margin-left: 20px">
+                <el-input
+                  v-model="optionTime"
+                  placeholder="请输入自定义发货时间"
+                  clearable
+                  style="width: 200px"
+                />
+                <span style="margin-left: 5px" @click="addOption">确定</span>
+              </div>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="costumSubmit">确 定</el-button>
+        <el-button @click="subOpen = false">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import {
-  listConfig,
-  getConfig,
-  delConfig,
-  addConfig,
-  updateConfig,
-  refreshCache,
-} from "@/api/system/config";
+import { listConfig, getConfig, delConfig, refreshCache } from "@/api/system/config";
 
 export default {
   name: "Config",
@@ -261,32 +524,119 @@ export default {
       configList: [],
       // 弹出层标题
       title: "",
+      subTitle: "",
       // 是否显示弹出层
       open: false,
+      subOpen: false,
       // 日期范围
       dateRange: [],
       // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        configName: undefined,
-        configKey: undefined,
-        configType: undefined,
       },
       // 表单参数
       form: {},
       // 表单校验
+
+      props: {
+        lazy: true,
+        lazyLoad: this.lazyLoad,
+      },
+      specification: [],
+      freight: [],
+      subType: "",
+      specificationOpen: false,
+      specificationTitle: "",
       rules: {
-        configName: [{ required: true, message: "参数名称不能为空", trigger: "blur" }],
-        configKey: [{ required: true, message: "参数键名不能为空", trigger: "blur" }],
-        configValue: [{ required: true, message: "参数键值不能为空", trigger: "blur" }],
+        specification: {
+          name: "",
+          contont: "",
+          inventory: "",
+          starting: "",
+          wholesale: "",
+        },
+        stats: {
+          packing: "",
+          deliveryTime: "",
+        },
       },
+      deliveryTimes: [
+        {
+          label: "付款24小时",
+          value: "1",
+        },
+        {
+          label: "付款36小时",
+          value: "2",
+        },
+        {
+          label: "付款48小时",
+          value: "3",
+        },
+        {
+          label: "自定义",
+          value: "99",
+        },
+      ],
+      optionTime: "",
     };
   },
   created() {
     // this.getList();
   },
   methods: {
+    addOption() {
+      if (this.optionTime) {
+        this.deliveryTimes.push({
+          label: this.optionTime,
+          value: this.deliveryTimes.length,
+          type: "add",
+        });
+        this.deliveryTimes.sort(function (a, b) {
+          return a.value - b.value;
+        });
+        this.optionTime = "";
+      }
+    },
+    removeRadio(index) {
+      this.deliveryTimes.splice(index, 1);
+    },
+    specificationAdd() {
+      for (const key in this.rules.specification) {
+        this.rules.specification[key] = "";
+      }
+      this.subTitle = "自定义添加规格";
+      this.subOpen = true;
+    },
+    specificationRemove(record, index) {
+      this.specification.splice(index, 1);
+    },
+    specificationEdit(record) {
+      this.subTitle = "编辑规格";
+      this.subOpen = true;
+      this.specification = record;
+    },
+    custom(type) {
+      this.subType = type;
+      if (type == "specification") {
+        this.specificationOpen = true;
+        this.specificationTitle = "自定义规格";
+      } else if (type == "freight") {
+        this.subTitle = "自定义运费模版";
+        this.subOpen = true;
+      } else if (type == "stats") {
+        this.subTitle = "添加商品属性";
+        this.subOpen = true;
+      }
+    },
+    costumSubmit() {
+      console.log(this.rules);
+      this.subOpen = false;
+      this.specification.push(this.rules.specification);
+      console.log(this.specification);
+    },
+
     /** 查询参数列表 */
     getList() {
       this.loading = true;
@@ -296,10 +646,7 @@ export default {
         this.loading = false;
       });
     },
-    prouctAdd() {
-      this.title = "添加商品";
-      this.open = true;
-    },
+
     // 取消按钮
     cancel() {
       this.open = false;
@@ -328,84 +675,56 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
+    /**
+     * 新增商品
+     */
+    prouctAdd() {
+      this.title = "添加商品";
       this.open = true;
-      this.title = "添加参数";
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.configId);
-      this.single = selection.length != 1;
-      this.multiple = !selection.length;
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const configId = row.configId || this.ids;
-      getConfig(configId).then((response) => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改参数";
-      });
-    },
-    /** 提交按钮 */
-    submitForm: function () {
-      this.$refs["form"].validate((valid) => {
-        if (valid) {
-          if (this.form.configId != undefined) {
-            updateConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const configIds = row.configId || this.ids;
-      this.$modal
-        .confirm('是否确认删除参数编号为"' + configIds + '"的数据项?')
-        .then(function () {
-          return delConfig(configIds);
-        })
-        .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        })
-        .catch(() => {});
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download(
-        "system/config/export",
-        {
-          ...this.queryParams,
-        },
-        `config_${new Date().getTime()}.xlsx`
-      );
-    },
-    /** 刷新缓存按钮操作 */
-    handleRefreshCache() {
-      refreshCache().then(() => {
-        this.$modal.msgSuccess("刷新成功");
-      });
+    lazyLoad(node, resolve) {
+      let level = node.level;
+      console.log(level);
+      if (!node.data) {
+        this.getCity().then((res) => {
+          //接口
+          const nodes = Array.from(res.data).map((item, index) => ({
+            value: item.cityId,
+            label: `${item.name}`,
+            leaf: level >= 2,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      } else if (level == 1) {
+        this.getCity({ parentCityId: node.data.value }).then((res) => {
+          const nodes = Array.from(res.data).map((item) => ({
+            value: item.cityId,
+            label: `${item.name}`,
+            leaf: level >= 2,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      } else if (level == 2) {
+        // resolve({});
+        this.getCity({ parentCityId: node.data.value }).then((res) => {
+          const nodes = Array.from(res.data).map((item) => ({
+            value: item.cityId,
+            label: `${item.name}`,
+            leaf: level >= 1,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      }
     },
   },
 };
 </script>
 <style>
-.el-form-item{
-        margin-bottom: 10px;
+.el-form-item {
+  margin-bottom: 10px;
 }
 .el-upload--picture-card {
   width: 50px;

+ 207 - 217
src/views/manage/sales.vue

@@ -8,7 +8,9 @@
               <div style="padding: 10px">
                 <span>全部上架商品</span>
               </div>
-              <div class="count">0</div>
+              <div class="count">
+                {{ Statistics ? Statistics.totalPutOnGoodsCount : 0 }}
+              </div>
             </div>
           </el-card>
         </el-col>
@@ -16,9 +18,32 @@
           <el-card shadow="always">
             <div class="item">
               <div style="padding: 10px">
-                <span>昨日销量</span>
+                <span>单日销量</span>
+                <el-popover placement="top-start" width="300" trigger="click">
+                  <el-date-picker
+                    v-model="timeDate"
+                    type="date"
+                    placeholder="选择日期"
+                    format="yyyy-MM-dd"
+                    value-format="yyyy-MM-dd"
+                  >
+                  </el-date-picker>
+                  <span
+                    slot="reference"
+                    :style="
+                      timeDate
+                        ? 'position: relative; left: 50px'
+                        : 'position: relative; left: 130px'
+                    "
+                  >
+                    {{ timeDate }}
+                    <i class="el-icon-date" style="color: #000"></i
+                  ></span>
+                </el-popover>
+              </div>
+              <div class="count">
+                ¥{{ Statistics ? Statistics.yseTotalSalePrice : 0 }}
               </div>
-              <div class="count">0</div>
             </div>
           </el-card>
         </el-col>
@@ -28,7 +53,9 @@
               <div style="padding: 10px">
                 <span>退款总金额</span>
               </div>
-              <div class="count">0</div>
+              <div class="count">
+                ¥{{ Statistics ? Statistics.totalRefundPrice : 0 }}
+              </div>
             </div>
           </el-card>
         </el-col>
@@ -38,7 +65,7 @@
               <div style="padding: 10px">
                 <span>销量统计</span>
               </div>
-              <div class="count">0</div>
+              <div class="count">{{ Statistics ? Statistics.totalSalePrice : 0 }}</div>
             </div>
           </el-card>
         </el-col>
@@ -52,45 +79,40 @@
       v-show="showSearch"
       label-width="68px"
     >
-      <el-form-item label="商品名称" prop="configName">
+      <el-form-item label="商品名称" prop="spuName">
         <el-input
-          v-model="queryParams.configName"
-          placeholder="请输入参数名称"
+          v-model="queryParams.spuName"
+          placeholder="请输入商品名称"
           clearable
           style="width: 240px"
-          @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="分类" prop="configType">
-        <el-select v-model="queryParams.configType" placeholder="请选择分类" clearable>
-          <!-- <el-option
-            v-for="dict in dict.type.sys_yes_no"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          /> -->
-        </el-select>
+      <el-form-item label="分类" prop="categoryId">
+        <el-cascader
+          v-model="queryParams.categoryId"
+          ref="formCascader"
+          placeholder="请选择分类"
+          :props="categoryprops"
+          @change="cascaderChange"
+        />
       </el-form-item>
-      <el-form-item label="状态" prop="configType">
-        <el-select v-model="queryParams.configType" placeholder="请选择状态" clearable>
-          <!-- <el-option
-            v-for="dict in dict.type.sys_yes_no"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          /> -->
+      <el-form-item label="状态" prop="spuStatus">
+        <el-select v-model="queryParams.spuStatus" placeholder="请选择状态" clearable>
+          <el-option label="上架" value="0" />
+          <el-option label="下架" value="1" />
         </el-select>
       </el-form-item>
       <el-form-item label="创建时间">
         <el-date-picker
           v-model="dateRange"
           style="width: 240px"
-          value-format="yyyy-MM-dd"
-          type="daterange"
-          range-separator="-"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="datetimerange"
+          range-separator=""
           start-placeholder="开始日期"
           end-placeholder="结束日期"
-        ></el-date-picker>
+        >
+        </el-date-picker>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
@@ -105,45 +127,40 @@
       @selection-change="handleSelectionChange"
     >
       <!-- <el-table-column type="selection" width="55" align="center" /> -->
-      <el-table-column label="商品图片" align="center" prop="configId" />
-      <el-table-column
-        label="商品名称"
-        align="center"
-        prop="configName"
-        :show-overflow-tooltip="true"
-      />
-      <el-table-column
-        label="分类"
-        align="center"
-        prop="configKey"
-        :show-overflow-tooltip="true"
-      />
-      <el-table-column
-        label="价格"
-        align="center"
-        prop="configValue"
-        :show-overflow-tooltip="true"
-      />
-      <el-table-column label="库存" align="center" prop="configType">
+      <el-table-column label="商品图片" align="center" prop="configId">
+        <template slot-scope="scope">
+          <el-image
+            v-if="scope.row.img"
+            style="width: 60px; height: 60px"
+            :src="scope.row.img"
+            :preview-src-list="[scope.row.img]"
+          >
+          </el-image>
+        </template>
+      </el-table-column>
+      <el-table-column label="商品名称" align="center" prop="spuName" />
+      <el-table-column label="分类" align="center" prop="categoryName" />
+      <el-table-column label="价格" align="center" prop="price" />
+      <el-table-column label="库存" align="center" prop="stock"> </el-table-column>
+      <el-table-column label="销量" align="center" prop="saleCount" />
+      <el-table-column label="销售额" align="center" prop="salePrice" />
+      <el-table-column label="状态" align="center" prop="spuStatus">
         <template slot-scope="scope">
-          <!-- <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType" /> -->
+          {{
+            scope.row.spuStatus == 2
+              ? "售罄"
+              : scope.row.spuStatus == 0
+              ? "上架"
+              : scope.row.spuStatus == 1
+              ? "下架"
+              : ""
+          }}
         </template>
       </el-table-column>
-      <el-table-column
-        label="销量"
-        align="center"
-        prop="remark"
-        :show-overflow-tooltip="true"
-      />
-      <el-table-column
-        label="状态"
-        align="center"
-        prop="remark"
-        :show-overflow-tooltip="true"
-      />
-      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
+
+      <el-table-column label="创建时间" align="center" prop="createDate" width="180">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.createTime) }}</span>
+          <span>{{ parseTime(scope.row.createDate) }}</span>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -151,18 +168,9 @@
           <el-button
             size="mini"
             type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:config:edit']"
-            >修改</el-button
-          >
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
+            @click="handleDetail(scope.row)"
             v-hasPermi="['system:config:remove']"
-            >删除</el-button
+            >详情</el-button
           >
         </template>
       </el-table-column>
@@ -177,56 +185,59 @@
     />
 
     <!-- 添加或修改参数配置对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="参数名称" prop="configName">
-          <el-input v-model="form.configName" placeholder="请输入参数名称" />
-        </el-form-item>
-        <el-form-item label="参数键名" prop="configKey">
-          <el-input v-model="form.configKey" placeholder="请输入参数键名" />
-        </el-form-item>
-        <el-form-item label="参数键值" prop="configValue">
-          <el-input v-model="form.configValue" placeholder="请输入参数键值" />
-        </el-form-item>
-        <el-form-item label="系统内置" prop="configType">
-          <!-- <el-radio-group v-model="form.configType">
-            <el-radio
-              v-for="dict in dict.type.sys_yes_no"
-              :key="dict.value"
-              :label="dict.value"
-              >{{ dict.label }}</el-radio
-            >
-          </el-radio-group> -->
-        </el-form-item>
-        <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
+    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
+      <el-descriptions title="" column="1">
+        <el-descriptions-item label="商品图片">
+          <el-image
+            v-if="form.img"
+            style="width: 60px; height: 60px"
+            :src="form.img"
+            :preview-src-list="[form.img]"
+          >
+          </el-image>
+        </el-descriptions-item>
+        <el-descriptions-item label="商品名称"> {{ form.spuName }}</el-descriptions-item>
+        <el-descriptions-item label="商品分类">
+          {{ form.categoryName }}</el-descriptions-item
+        >
+        <el-descriptions-item label="商品价格"> {{ form.price }} </el-descriptions-item>
+        <el-descriptions-item label="商品库存"> {{ form.stock }}</el-descriptions-item>
+
+        <el-descriptions-item label="商品销量">
+          {{ form.saleCount }}</el-descriptions-item
+        >
+        <el-descriptions-item label="商品销售额">
+          {{ form.salePrice }}</el-descriptions-item
+        >
+        <el-descriptions-item label="商品状态">
+          {{
+            form.spuStatus == 2
+              ? "售罄"
+              : form.spuStatus == 0
+              ? "上架"
+              : form.spuStatus == 1
+              ? "下架"
+              : ""
+          }}</el-descriptions-item
+        >
+        <el-descriptions-item label="商品创建时间">
+          {{ form.createDate }}</el-descriptions-item
+        >
+      </el-descriptions>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import {
-  listConfig,
-  getConfig,
-  delConfig,
-  addConfig,
-  updateConfig,
-  refreshCache,
-} from "@/api/system/config";
-
+import { getSalesStatisticsPage, getSalesStatistics } from "@/api/manage/sales";
+import { getClassificationListPage } from "@/api/common/index";
 export default {
   name: "Config",
   //   dicts: ["sys_yes_no"],
   data() {
     return {
       // 遮罩层
-      loading: true,
+      loading: false,
       // 选中数组
       ids: [],
       // 非单个禁用
@@ -240,62 +251,113 @@ export default {
       // 参数表格数据
       configList: [],
       // 弹出层标题
-      title: "",
+      title: "商品详情",
       // 是否显示弹出层
       open: false,
       // 日期范围
       dateRange: [],
       // 查询参数
       queryParams: {
-        pageNum: 1,
+        pageNo: 1,
         pageSize: 10,
-        configName: undefined,
-        configKey: undefined,
-        configType: undefined,
+        spuStatus: "",
+        spuName: "",
+        startTime: "",
+        endTime: "",
       },
       // 表单参数
       form: {},
-      // 表单校验
-      rules: {
-        configName: [{ required: true, message: "参数名称不能为空", trigger: "blur" }],
-        configKey: [{ required: true, message: "参数键名不能为空", trigger: "blur" }],
-        configValue: [{ required: true, message: "参数键值不能为空", trigger: "blur" }],
+      Statistics: {},
+      timeDate: "",
+      categoryprops: {
+        checkStrictly: true,
+        lazy: true,
+        lazyLoad: this.categoryLazyLoad,
       },
     };
   },
   created() {
-    // this.getList();
+    this.getList();
+    this.getStatistics();
   },
   methods: {
     /** 查询参数列表 */
     getList() {
       this.loading = true;
-      listConfig(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
-        this.configList = response.rows;
-        this.total = response.total;
+      getSalesStatisticsPage(this.queryParams).then((response) => {
+        this.configList = response.data.records;
+        this.total = response.data.total;
         this.loading = false;
       });
     },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
+    getStatistics() {
+      getSalesStatistics().then((response) => {
+        this.Statistics = response.data;
+      });
+    },
+    cascaderChange(val) {
+      console.log(val);
+      if (val.length == 1) {
+        this.queryParams.categoryId = val[0];
+      } else if (val.length == 2) {
+        this.queryParams.categoryId = val[1];
+      } else if (val.length == 3) {
+        this.queryParams.categoryId = val[2];
+      }
+      // this.getList();
     },
-    // 表单重置
-    reset() {
-      this.form = {
-        configId: undefined,
-        configName: undefined,
-        configKey: undefined,
-        configValue: undefined,
-        configType: "Y",
-        remark: undefined,
-      };
-      this.resetForm("form");
+    categoryLazyLoad(node, resolve) {
+      let that = this;
+      let level = node.level;
+      console.log(node);
+      if (!node.data) {
+        getClassificationListPage({ parentId: 0 }).then((res) => {
+          //接口
+          const nodes = Array.from(res.data).map((item, index) => ({
+            value: item.id,
+            label: `${item.className}`,
+            leaf: level >= 2,
+          }));
+          console.log("111", node);
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      } else if (level == 1) {
+        getClassificationListPage({ parentId: node.data.value }).then((res) => {
+          const nodes = Array.from(res.data).map((item) => ({
+            value: item.id,
+            label: `${item.className}`,
+            leaf: level >= 2,
+            // level: 2,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      } else if (level == 2) {
+        getClassificationListPage({ parentId: node.data.value }).then((res) => {
+          const nodes = Array.from(res.data).map((item) => ({
+            value: item.id,
+            label: `${item.className}`,
+            leaf: level >= 1,
+            // level: 2,
+          }));
+          // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+          resolve(nodes);
+        });
+      }
     },
+
+    handleDetail(record) {
+      this.form = record;
+      this.title = "详情";
+      this.open = true;
+    },
+
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
+      this.queryParams.pageNo = 1;
+      this.queryParams.startTime = this.dateRange[0];
+      this.queryParams.endTime = this.dateRange[1];
       this.getList();
     },
     /** 重置按钮操作 */
@@ -304,78 +366,6 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加参数";
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.configId);
-      this.single = selection.length != 1;
-      this.multiple = !selection.length;
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const configId = row.configId || this.ids;
-      getConfig(configId).then((response) => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改参数";
-      });
-    },
-    /** 提交按钮 */
-    submitForm: function () {
-      this.$refs["form"].validate((valid) => {
-        if (valid) {
-          if (this.form.configId != undefined) {
-            updateConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addConfig(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const configIds = row.configId || this.ids;
-      this.$modal
-        .confirm('是否确认删除参数编号为"' + configIds + '"的数据项?')
-        .then(function () {
-          return delConfig(configIds);
-        })
-        .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        })
-        .catch(() => {});
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download(
-        "system/config/export",
-        {
-          ...this.queryParams,
-        },
-        `config_${new Date().getTime()}.xlsx`
-      );
-    },
-    /** 刷新缓存按钮操作 */
-    handleRefreshCache() {
-      refreshCache().then(() => {
-        this.$modal.msgSuccess("刷新成功");
-      });
-    },
   },
 };
 </script>

+ 96 - 16
src/views/manage/shopInfo.vue

@@ -4,53 +4,133 @@
       <el-tab-pane label="基本信息" :name="1">
         <div style="padding: 20px">
           <el-descriptions title="基本信息" :column="1">
-            <el-descriptions-item label="店铺名称">kooriookami</el-descriptions-item>
-            <el-descriptions-item label="店铺认证">18100000000</el-descriptions-item>
-            <el-descriptions-item label="店铺头像">苏州市</el-descriptions-item>
+            <el-descriptions-item label="店铺名称">{{
+              shopInfo ? shopInfo.storeName : ""
+            }}</el-descriptions-item>
+            <el-descriptions-item label="店铺id">{{
+              shopInfo ? shopInfo.id : ""
+            }}</el-descriptions-item>
+            <el-descriptions-item label="店铺归属人id	">{{
+              shopInfo ? shopInfo.ownerBy : ""
+            }}</el-descriptions-item>
+            <el-descriptions-item label="店铺所在区域	">{{
+              shopInfo ? shopInfo.storeArea : ""
+            }}</el-descriptions-item>
+
+            <el-descriptions-item label="经营区域">{{
+              shopInfo ? (shopInfo.scope == 0 ? "全国" : "同城") : ""
+            }}</el-descriptions-item>
+
+            <el-descriptions-item label="店铺认证">
+              <el-tag>{{
+                shopInfo.authStatus == 0
+                  ? "审核中"
+                  : shopInfo.authStatus == 1
+                  ? "审核通过"
+                  : shopInfo.authStatus == 2
+                  ? "审核未通过"
+                  : ""
+              }}</el-tag></el-descriptions-item
+            >
+            <el-descriptions-item label="店铺头像">
+              <el-image
+                :src="shopInfo ? shopInfo.storeLogoUrl : ''"
+                mode=""
+                style="width: 100px; height: 100px"
+              />
+            </el-descriptions-item>
             <el-descriptions-item label="店铺地址">
-              <el-tag size="small">学校</el-tag>
+              {{ shopInfo ? shopInfo.storeAddress : "" }}
             </el-descriptions-item>
             <el-descriptions-item label="店铺背景图"
-              >江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item
-            >
+              ><el-image
+                :src="shopInfo ? shopInfo.storeBackgroundUrl : ''"
+                mode=""
+                style="width: 100px; height: 100px"
+            /></el-descriptions-item>
+            <el-descriptions-item label="店铺简介"
+              ><image :src="shopInfo ? shopInfo.storeIntro : ''" mode=""
+            /></el-descriptions-item>
+            <el-descriptions-item label="是否启用代金卷">
+              <el-tag> {{ shopInfo.enableVoucher == 0 ? "未启用" : "启用" }}</el-tag>
+            </el-descriptions-item>
+            <el-descriptions-item label="使用代金卷类型">
+              <el-tag> {{ shopInfo.useVoucherType == 0 ? "满减券" : "抵扣券" }}</el-tag>
+            </el-descriptions-item>
           </el-descriptions>
         </div>
         <div style="padding: 20px">
           <el-descriptions title="联系方式" :column="1">
-            <el-descriptions-item label="联系方式">kooriookami</el-descriptions-item>
-            <el-descriptions-item label="营业地址">18100000000</el-descriptions-item>
+            <el-descriptions-item label="联系方式">
+              {{ shopInfo ? shopInfo.storePhone : "" }}</el-descriptions-item
+            >
+            <el-descriptions-item label="营业地址">
+              {{ shopInfo ? shopInfo.storeAddress : "" }}</el-descriptions-item
+            >
           </el-descriptions>
         </div>
       </el-tab-pane>
       <el-tab-pane label="主体信息" :name="2">
         <div style="padding: 20px">
           <el-descriptions title="主体信息" :column="1">
-            <el-descriptions-item label="入驻姓名">kooriookami</el-descriptions-item>
-            <el-descriptions-item label="入驻身份证号">18100000000</el-descriptions-item>
+            <el-descriptions-item label="入驻姓名">{{
+              shopInfo.auth ? shopInfo.auth.authName : ""
+            }}</el-descriptions-item>
+            <el-descriptions-item label="入驻身份证号">{{
+              shopInfo.auth ? shopInfo.auth.authIdNum : ""
+            }}</el-descriptions-item>
             <el-descriptions-item label="入驻身份证">
+              <el-image
+                style="width: 100px; height: 100px"
+                v-for="(item, index) in JSON.parse(shopInfo.auth.idCardUrl)"
+                :src="item"
+                :key="index"
+                :preview-src-list="JSON.parse(shopInfo.auth.idCardUrl)"
+              />
             </el-descriptions-item>
-        
           </el-descriptions>
         </div>
         <div style="padding: 20px">
           <el-descriptions title="营业执照资质信息" :column="1">
-            <el-descriptions-item label="营业执照">kooriookami</el-descriptions-item>
-            <el-descriptions-item label="营业执照期限">18100000000</el-descriptions-item>
-            <el-descriptions-item label="营业执照信用代码">18100000000</el-descriptions-item>
+            <el-descriptions-item label="营业执照">
+              <el-image
+                style="width: 100px; height: 100px"
+                :src="shopInfo.auth.businessLicenseUrl"
+                :key="index"
+                :preview-src-list="[shopInfo.auth.businessLicenseUrl]"
+              />
+            </el-descriptions-item>
+            <el-descriptions-item label="营业执照信用代码">{{
+              shopInfo ? shopInfo.auth.regNum : ""
+            }}</el-descriptions-item>
           </el-descriptions>
         </div>
       </el-tab-pane>
     </el-tabs>
-  </div> 
-</template> 
+  </div>
+</template>
 
 <script>
+import { getStoreInfo } from "@/api/common/index";
 export default {
   data() {
     return {
       activeName: 1,
+      shopInfo: {},
     };
   },
+  mounted() {
+    this.getInfo();
+  },
+  methods: {
+    getInfo() {
+      getStoreInfo().then((res) => {
+        if (res.code == 200) {
+          this.shopInfo = res.data;
+        }
+      });
+    },
+  },
 };
 </script>
 

+ 319 - 0
src/views/manage/voucher/index.vue

@@ -0,0 +1,319 @@
+<template>
+  <div class="app-container">
+    <h3>开启设置</h3>
+    <el-form ref="form" :model="form" label-width="200px" style="margin-top: 20px">
+      <el-row>
+        <el-col :span="12">
+          <div style="display: flex; flex-direction: row">
+            <el-form-item label="店铺是否开启代金卷使用:">
+              <el-switch
+                v-model="enableVoucher"
+                active-text="开启"
+                inactive-text="关闭"
+                :active-value="1"
+                :inactive-value="0"
+              >
+              </el-switch>
+            </el-form-item>
+            <el-form-item label="折扣卷类型">
+              <el-radio-group v-model="useVoucherType">
+                <el-radio :label="0" :value="0">普通满减卷</el-radio>
+                <el-radio :label="1" :value="1">折扣卷</el-radio>
+              </el-radio-group>
+            </el-form-item>
+            <div style="margin-left: 20px; margin-top: 5px">
+              <el-button
+                v-hasPermi="['voucher:switch']"
+                type="primary"
+                size="small"
+                style="height: 30px"
+                @click="submitConfig"
+                >确认</el-button
+              >
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </el-form>
+    <h3>规则配置</h3>
+    <el-radio-group v-model="queryParams.useVoucherType" @change="radioChang  ">
+      <el-radio :label="0" value="0">普通满减卷</el-radio>
+      <el-radio :label="1" value="1">折扣卷</el-radio>
+    </el-radio-group>
+
+    <div style="margin-top: 20px">
+      <el-button type="primary" size="small" @click="addRole" v-hasPermi="['voucher:add']"
+        >新增规则</el-button
+      >
+    </div>
+    <template v-if="queryParams.useVoucherType == 0">
+      <el-col :span="24" v-if="this.form.length < 1">
+        <el-result icon="info" title="暂无规则" subTitle="请新增代金卷规则"> </el-result>
+      </el-col>
+      <template v-else>
+        <el-form ref="form" :model="form" label-width="140px" style="margin-top: 20px">
+          <el-row>
+            <el-col :span="24" v-for="(item, index) in form" :key="index">
+              <el-form-item label="满">
+                <div>
+                  <el-input
+                    v-model="item.min"
+                    placeholder="请输入金额"
+                    style="width: 140px"
+                  >
+                    <span slot="suffix">元 </span>
+                  </el-input>
+                  --
+                  <el-input
+                    v-model="item.max"
+                    placeholder="请输入金额"
+                    style="width: 140px"
+                  >
+                    <span slot="suffix">元 </span>
+                  </el-input>
+
+                  可抵扣
+                  <el-input
+                    v-model="item.amount"
+                    placeholder="请输入金额"
+                    style="width: 200px"
+                  >
+                    <span slot="suffix">元 </span>
+                  </el-input>
+                  <i
+                    class="el-icon-delete"
+                    style="color: red; margin-left: 20px; font-size: 18px"
+                    @click="removeRule(item, index)"
+                  ></i>
+                </div>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+        <div style="text-align: center; margin-top: 20px">
+          <el-button type="primary" @click="InviteSubmit" v-hasPermi="['voucher:edit']"
+            >确 定</el-button
+          >
+        </div>
+      </template>
+    </template>
+    <template v-if="queryParams.useVoucherType == 1">
+      <el-col :span="24" v-if="person.length < 1">
+        <el-result icon="info" title="暂无规则" subTitle="请新增代金卷规则"> </el-result>
+      </el-col>
+      <template v-else>
+        <el-form ref="form" :model="person" label-width="140px" style="margin-top: 20px">
+          <el-row>
+            <el-col :span="24" v-for="(item, index) in person" :key="index">
+              <el-form-item label="满">
+                <div>
+                  <el-input
+                    v-model="item.min"
+                    placeholder="请输入金额"
+                    style="width: 140px"
+                  >
+                    <span slot="suffix">元 </span>
+                  </el-input>
+                  --
+                  <el-input
+                    v-model="item.max"
+                    placeholder="请输入金额"
+                    style="width: 140px"
+                  >
+                    <span slot="suffix">元 </span>
+                  </el-input>
+
+                  打
+
+                  <el-input-number v-model="item.ratio" :min="0.5" :step="0.5" :max="10">
+                  </el-input-number>
+                  <span>折 </span>
+                  <i
+                    class="el-icon-delete"
+                    style="color: red; margin-left: 20px; font-size: 18px"
+                    @click="removeRule(item, index)"
+                  ></i>
+                </div>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+        <div style="text-align: center; margin-top: 20px">
+          <el-button type="primary" @click="InviteSubmit" v-hasPermi="['voucher:edit']"
+            >确 定</el-button
+          >
+        </div>
+      </template>
+    </template>
+  </div>
+</template>
+
+<script>
+import {
+  voucherCreate,
+  voucherList,
+  voucherEdit,
+  voucherRemove,
+  voucherEnable,
+} from "@/api/system/voucher";
+import { getStoreInfo } from "@/api/common/index";
+import axios from "axios";
+
+export default {
+  name: "User",
+  data() {
+    return {
+      // 表单参数
+      form: [],
+      person: [],
+      queryParams: {
+        subType: 2,
+        type: 1,
+        useVoucherType: 0,
+      },
+      enableVoucher: "",
+      useVoucherType: 0,
+    };
+  },
+  mounted() {
+    this.getvoucherList();
+    this.getInfo();
+  },
+  methods: {
+    getInfo() {
+      getStoreInfo().then((res) => {
+        if (res.code == 200) {
+          this.enableVoucher = res.data.enableVoucher;
+          this.useVoucherType = res.data.useVoucherType;
+        }
+      });
+    },
+    submitConfig() {
+      let params = {
+        enableVoucher: this.enableVoucher,
+        useVoucherType: this.queryParams.useVoucherType,
+      };
+      voucherEnable(params).then((res) => {
+        if (res.code == 200) {
+          this.$modal.msgSuccess("操作成功");
+        }
+      });
+    },
+
+    radioChange() {
+      this.getvoucherList();
+    },
+    removeRule(record, index) {
+      if (record.id) {
+        voucherRemove(record.id).then((res) => {
+          if (res.code == 200) {
+            this.$modal.msgSuccess("删除成功!");
+            this.getvoucherList();
+          }
+        });
+      } else {
+        if (this.queryParams.useVoucherType == 0) {
+          this.form.splice(index, 1);
+        } else {
+          this.person.splice(index, 1);
+        }
+      }
+    },
+    addRole() {
+      if (this.queryParams.useVoucherType == 0) {
+        this.form.push({
+          amount: "",
+          max: "",
+          min: "",
+          status: 0,
+          subType: 2,
+          type: 1,
+          useVoucherType: 0,
+        });
+      } else if (this.queryParams.useVoucherType == 1) {
+        this.person.push({
+          ratio: 10,
+          max: "",
+          min: "",
+          status: 0,
+          subType: 2,
+          type: 1,
+          useVoucherType: 1,
+        });
+      }
+    },
+    handleClick() {
+      this.getvoucherList();
+    },
+    getvoucherList() {
+      voucherList(this.queryParams).then((res) => {
+        if (res.code == 200) {
+          if (this.queryParams.useVoucherType == 1) {
+            this.person = res.data;
+          } else {
+            this.form = res.data;
+          }
+        }
+      });
+    },
+    InviteSubmit() {
+      let params = null;
+      if (this.queryParams.useVoucherType == 0) {
+        params = this.form;
+      } else {
+        params = this.person;
+      }
+
+      // for (let index = 0; index < params.length; index++) {
+      //   if (params[index].hasOwnProperty("id")) {
+      voucherEdit(params).then((res) => {});
+      //   } else {
+      //     voucherCreate([params[index]]).then((res) => {});
+      //   }
+      // }
+      this.$modal.msgSuccess("保存成功!");
+      this.getvoucherList();
+    },
+    personSubmit() {
+      if (this.person.id) {
+        voucherEdit([this.person]).then((res) => {
+          this.$modal.msgSuccess("修改成功!");
+          this.getvoucherList();
+          console.log("res", res);
+        });
+      } else {
+        voucherCreate([this.person]).then((res) => {
+          this.$modal.msgSuccess("新增成功!");
+          this.getvoucherList();
+          console.log("res", res);
+        });
+      }
+    },
+  },
+};
+</script>
+
+<style>
+.hide > .el-upload--picture-card {
+  display: none;
+}
+</style>
+<style lang="scss" scoped>
+.detail_Header {
+  margin-bottom: 35px;
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+  align-items: center;
+  .item {
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    .count {
+      font-weight: bold;
+      font-size: 18px;
+    }
+  }
+}
+</style>

+ 11 - 14
src/views/system/user/index.vue

@@ -88,7 +88,7 @@
                 size="mini"
                 type="text"
                 icon="el-icon-edit"
-                @click="handleAdd(scope.row)"
+                @click="handleEdit(scope.row)"
                 >修改</el-button
               >
               <el-button
@@ -232,7 +232,7 @@ export default {
       this.queryParams.pageNum = 1;
       this.getList();
     },
-    /** 重置按钮操作 */
+    /** 重置按钮操作 */ 
     resetQuery() {
       this.dateRange = [];
       this.resetForm("queryForm");
@@ -240,20 +240,17 @@ export default {
       this.$refs.tree.setCurrentKey(null);
       this.handleQuery();
     },
-
+    handleEdit(record) {
+      this.form = record;
+      this.open = true;
+      this.title = "编辑用户";
+    },
     /** 新增按钮操作 */
-    handleAdd(record) {
-      console.log(record);
-
+    handleAdd() { 
       this.reset();
-      if (record) {
-        this.form = record;
-        this.open = true;
-        this.title = "编辑用户";
-      } else {
-        this.open = true;
-        this.title = "添加用户";
-      }
+
+      this.open = true;
+      this.title = "添加用户";
     },
     /** 修改按钮操作 */
     handleUpdate(row) {

+ 1 - 1
vue.config.js

@@ -36,7 +36,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://192.168.1.13:30023/admin`,
+        target: `http://192.168.1.69:30023/admin`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''

File diff suppressed because it is too large
+ 10472 - 0
yarn.lock