Explorar o código

对接团购活动

linwenxin hai 1 ano
pai
achega
b243a227af

+ 20 - 1
src/api/groupbuy.js

@@ -1,4 +1,23 @@
-import request from '@/utils/request'
+import request, { postBlob } from '@/utils/request'
+
+
+export function promotionGroupListPageV2(data) {
+  return request({
+    url: `/promotion/group/list/pageV2?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function promotionGroupPageExport(data, name) {
+  return postBlob({
+    url: '/promotion/group/pageExport',
+    data,
+    name
+  })
+}
+
+
 
 
 // 获取活动统计
 // 获取活动统计
 export function getActivityCount(params) {
 export function getActivityCount(params) {

+ 0 - 1
src/components/template/template-page-1.vue

@@ -146,7 +146,6 @@ export default {
         ? [
         ? [
           [
           [
             {
             {
-              isRole: this.$restrict('export'),
               name: '导出',
               name: '导出',
               click: this.export,
               click: this.export,
               loading: false
               loading: false

+ 78 - 70
src/views/mallManagement/activity/groupbuy_index/index.vue

@@ -1,34 +1,47 @@
 <template>
 <template>
   <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
   <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
     :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
     :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
-    :operation="operation" :exportList="exportList">
-    <el-dialog title="" width="500px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
-      :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
-      <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
-        <zj-form-module :title="formDialogTitles[formDialogType]" label-width="100px" :showPackUp="false"
-          :form-data="formData" :form-items="formItems">
-        </zj-form-module>
-      </zj-form-container>
-      <div slot="footer" class="dialog-footer">
-        <el-button size="mini" @click="formCancel">取 消</el-button>
-        <el-button size="mini" @click="formConfirm" type="primary">确 定</el-button>
-      </div>
-    </el-dialog>
+    :operation="operation" :exportList="exportList" :operationColumnWidth="210">
+    <div slot="moreSearch">
+      <el-radio-group v-model="type" size="mini" @change="changeType">
+        <el-radio-button label="">全部({{ statistics.all || 0 }})</el-radio-button>
+        <el-radio-button :label="1">进行中({{ statistics.jxz || 0 }})</el-radio-button>
+        <el-radio-button :label="0">已结束({{ statistics.yjs || 0 }})</el-radio-button>
+      </el-radio-group>
+      <br><br>
+    </div>
   </template-page>
   </template-page>
 </template>
 </template>
 
 
 <script>
 <script>
 import TemplatePage from '@/components/template/template-page-1.vue'
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 import import_mixin from '@/components/template/import_mixin.js'
-import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
-import { orderShareListPageV2, orderSharePageExport, settlement, saveRemark } from "@/api/settlement";
+import { promotionGroupListPageV2, promotionGroupPageExport, getActivityCount, changeStatus } from '@/api/groupbuy'
+import { downloadFiles } from '@/utils/util'
 export default {
 export default {
   components: { TemplatePage },
   components: { TemplatePage },
   mixins: [import_mixin],
   mixins: [import_mixin],
   data() {
   data() {
     return {
     return {
+      type: "",
+      statistics: {},
       // 事件组合
       // 事件组合
-      optionsEvensGroup: [],
+      optionsEvensGroup: [
+        [
+          [
+            {
+              name: '添加团购活动',
+              isRole: true,
+              click: () => {
+                this.$router.push({
+                  name: "groupbuy_add",
+                  query: {}
+                })
+              }
+            }
+          ],
+        ],
+      ],
       // 表格属性
       // 表格属性
       tableAttributes: {
       tableAttributes: {
         // 启用勾选列
         // 启用勾选列
@@ -40,13 +53,6 @@ export default {
       },
       },
       // 勾选选中行
       // 勾选选中行
       recordSelected: [],
       recordSelected: [],
-      /** 表单变量 */
-      formDialogType: 0,
-      formDialogTitles: ["备注"],
-      formDialog: false,
-      formData: {
-        remark: '',
-      },
     }
     }
   },
   },
   computed: {
   computed: {
@@ -54,25 +60,31 @@ export default {
     moreParameters() {
     moreParameters() {
       return []
       return []
     },
     },
-    formItems() {
-      return [{
-        md: 24,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: "textarea", maxlength: "100" },
-        formItemAttributes: {
-          label: '备注',
-          prop: 'remark',
-          rules: [...required]
-        }
-      }]
-    }
   },
   },
   methods: {
   methods: {
+    // 切换状态
+    changeType(val) {
+      this.$refs.pageRef.refreshList()
+    },
     // 列表请求函数
     // 列表请求函数
-    getList: orderShareListPageV2,
+    getList(p) {
+      try {
+        var pam = JSON.parse(JSON.stringify(p))
+        if (this.type) {
+          pam.status = this.type
+          pam.params.push({ "param": "a.status", "compare": "=", "value": this.type })
+        }
+        return promotionGroupListPageV2(pam)
+      } catch (error) {
+        console.log(error)
+      } finally {
+        getActivityCount().then(res => {
+          this.statistics = res.data
+        })
+      }
+    },
     // 列表导出函数
     // 列表导出函数
-    exportList: orderSharePageExport,
+    exportList: promotionGroupPageExport,
     // 表格列解析渲染数据更改
     // 表格列解析渲染数据更改
     columnParsing(item, defaultData) {
     columnParsing(item, defaultData) {
       return defaultData
       return defaultData
@@ -85,46 +97,42 @@ export default {
     operation(h, { row, index, column }) {
     operation(h, { row, index, column }) {
       return (
       return (
         <div class='operation-btns'>
         <div class='operation-btns'>
-          <el-button type="text" onClick={() => {
-            Object.assign(this.formData, row)
-            this.formDialogType = 0
-            this.openForm()
-          }}>备注</el-button>
-          {row.orderStatus == 'OVER' && row.status == 'ING' ? <el-popconfirm
-            title="是否确定结算?"
+          <el-popconfirm
+            title={`是否确定${Number(row.status) ? "关闭" : "开启"}?`}
             onConfirm={() => {
             onConfirm={() => {
-              settlement({
-                orderId: row.orderId
-              }).then(res => {
-                this.$message({ type: 'success', message: `结算成功!` })
+              changeStatus({ promotionGroupId: row.promotionGroupId, status: Number(row.status) ? 0 : 1 }).then(res => {
+                this.$message({ type: 'success', message: `${Number(row.status) ? "关闭" : "开启"}成功!` })
                 this.$refs.pageRef.refreshList()
                 this.$refs.pageRef.refreshList()
               })
               })
             }}
             }}
           >
           >
-            <el-button type="text" slot="reference">结算</el-button>
-          </el-popconfirm> : null}
+            <el-button type="text" slot="reference">{Number(row.status) ? "关闭" : "开启"}</el-button>
+          </el-popconfirm>
+          <el-button type="text" onClick={() => {
+            this.$router.push({
+              name: "groupbuy_add",
+              query: {
+                id: row.promotionGroupId
+              }
+            })
+          }}>编辑</el-button>
+          <el-button type="text" onClick={() => {
+            this.$router.push({
+              name: "groupbuy_detail",
+              query: {
+                id: row.promotionGroupId
+              }
+            })
+          }}>拼团详情</el-button>
+          <el-button type="text" onClick={() => {
+            let screenData = {
+              promotionGroupId: row.promotionGroupId
+            };
+            downloadFiles('order/export', screenData);
+          }}>导出订单</el-button>
         </div>
         </div>
       )
       )
     },
     },
-    openForm() {
-      this.formDialog = true;
-    },
-    formCancel() {
-      this.$refs.formRef.$refs.inlineForm.clearValidate()
-      this.$data.formData = this.$options.data().formData
-      this.formDialog = false
-    },
-    formConfirm() {
-      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
-        if (valid) {
-          ([saveRemark][this.formDialogType])(this.formData).then(res => {
-            this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
-            this.formCancel()
-            this.$refs.pageRef.refreshList()
-          })
-        }
-      })
-    }
   }
   }
 }
 }
 </script>
 </script>

+ 0 - 241
src/views/mallManagement/activity/groupbuy_index/index_cp.vue

@@ -1,241 +0,0 @@
-<template>
-  <div class="app-container">
-
-    <div class="mymain-container">
-      <div class="btn-group clearfix" style="margin-bottom: 20px">
-        <div class="fl">
-          <el-button size="small" icon="el-icon-refresh" @click="getListByScreen">刷新</el-button>
-          <el-button size="small" type="primary" icon="el-icon-plus" @click="addOrEdit('add')">添加团购活动</el-button>
-        </div>
-      </div>
-
-      <div class="tabs-container clearfix">
-        <div class="fl">
-          <el-tabs v-model="tabCurrent" type="card" @tab-click="getListByScreen">
-            <el-tab-pane :name="key" v-for="(value, key, index) in tabList" :key="index">
-              <div slot="label">{{value.name}}(<b style="color: red;">{{value.num}}</b>)</div>
-            </el-tab-pane>
-          </el-tabs>
-        </div>
-        <!-- <div class="fr">
-          <el-date-picker
-            v-model="screenForm.activityDate"
-            @change="getListByScreen"
-            type="daterange"
-            size="small"
-            style="margin-right: 20px; width: 260px !important;"
-            value-format="yyyy-MM-dd"
-            range-separator="至"
-            start-placeholder="活动开始时间"
-            end-placeholder="活动结束时间">
-          </el-date-picker>
-          <el-input placeholder="请输入活动名称进行搜索" v-model="screenForm.keyword" size="small" style="width: 240px; margin-top: 10px;" clearable>
-            <el-button slot="append" icon="el-icon-search" size="small" @click="getListByScreen"></el-button>
-          </el-input>
-        </div> -->
-      </div>
-
-      <div class="table">
-        <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit stripe>
-          <el-table-column align="center" label="活动名称" prop="name" min-width="200"></el-table-column>
-          <el-table-column align="center" label="参与产品数量" prop="goodsNum" min-width="120"></el-table-column>
-          <el-table-column align="center" label="活动时间" min-width="200">
-            <template slot-scope="scope">
-              {{ scope.row.startTime | dateToDayFilter }} 至 {{ scope.row.endTime | dateToDayFilter }}
-            </template>
-          </el-table-column>
-          <el-table-column align="center" label="状态">
-            <template slot-scope="scope">
-              {{ scope.row.status | statusFilter }}
-            </template>
-          </el-table-column>
-          <el-table-column align="center" label="订单数量" prop="orderNum" min-width="120"></el-table-column>
-          <el-table-column align="center" label="订单台数" prop="orderDetailNum" min-width="120"></el-table-column>
-          <el-table-column align="center" label="订单总金额" prop="orderTotalAmount" min-width="120"></el-table-column>
-          <el-table-column align="center" label="团长分佣总额" prop="shareTotalAmount" min-width="120"></el-table-column>
-          <el-table-column align="center" label="商户" prop="companyName" min-width="120"></el-table-column>
-          <el-table-column align="center" label="备注" prop="remark" min-width="200"></el-table-column>
-          <el-table-column align="center" label="操作" width="240" fixed="right">
-            <template slot-scope="scope">
-              <el-button type="text" @click="addOrEdit('edit', scope.row.promotionGroupId)">编辑</el-button>
-              <template>
-                <el-popconfirm v-if="scope.row.status" style="margin: 0 10px;" title="确定关闭吗?" @confirm="changeActivityStatus(scope.row.promotionGroupId, false)" >
-                  <el-button slot="reference" type="text">关闭</el-button>
-                </el-popconfirm>
-                <el-popconfirm v-else style="margin: 0 10px;" title="确定开启吗?" @confirm="changeActivityStatus(scope.row.promotionGroupId, true)" >
-                  <el-button slot="reference" type="text">开启</el-button>
-                </el-popconfirm>
-              </template>
-              <el-button type="text" @click="toDetail(scope.row.promotionGroupId)">拼团详情</el-button>
-              <el-button type="text" @click="handleExport(scope.row.promotionGroupId)">导出订单</el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
-      <div class="pagination clearfix">
-        <div class="fr">
-          <el-pagination
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page="currentPage"
-            :page-sizes="[10, 20, 30, 50]"
-            :page-size="10"
-            layout="total, sizes, prev, pager, next, jumper"
-            :total="listTotal">
-          </el-pagination>
-        </div>
-      </div>
-    </div>
-  </div>
-</template>
-
-<script>
-import { getActivityCount, getActivityList, changeStatus } from '@/api/groupbuy'
-import { downloadFiles } from '@/utils/util'
-
-export default {
-  filters: {
-    statusFilter(val) {
-      const MAP = {
-        true: '进行中',
-        false: '已结束',
-      }
-      return MAP[val];
-    }
-  },
-
-  data() {
-    return {
-      dataList: null, // 列表数据
-      listLoading: true, // 列表加载loading
-      currentPage: 1, // 当前页码
-      pageSize: 10, // 每页数量
-      listTotal: 0, // 列表总数
-      tabCurrent: 'all',
-      tabList: {
-        all: {name: '全部', num: 0, state: ''},
-        jxz: {name: '进行中', num: 0, state: true},
-        yjs: {name: '已结束', num: 0, state: false},
-      },
-      screenForm: {
-        keyword: '',
-        activityDate: '',
-      },
-    }
-  },
-  created() {
-    this.getCount();
-    this.getList();
-  },
-  methods: {
-    // 获取统计
-    getCount() {
-      getActivityCount().then(res => {
-        this.tabList.all.num = res.data.all;
-        this.tabList.jxz.num = res.data.jxz;
-        this.tabList.yjs.num = res.data.yjs;
-      })
-    },
-
-    // 获取活动列表
-    getList() {
-      getActivityList({
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        status: this.tabList[this.tabCurrent].state,
-        // keyword: this.screenForm.keyword,
-        // startTime: this.screenForm.activityDate ? this.screenForm.activityDate[0] + ' 00:00:00' : '',
-        // endTime: this.screenForm.activityDate ? this.screenForm.activityDate[1] + ' 23:59:59' : '',
-      }).then(res => {
-        this.dataList = res.data.records;
-        this.listTotal = res.data.total;
-        this.listLoading = false;
-      })
-    },
-
-    // 筛选后重新获取列表
-    getListByScreen() {
-      this.currentPage = 1;
-      this.getCount();
-      this.getList();
-    },
-
-    // 更改活动列表每页数量
-    handleSizeChange(val) {
-      this.pageSize = val;
-      this.currentPage = 1;
-      this.getList();
-    },
-
-    // 更改活动列表当前页
-    handleCurrentChange(val) {
-      this.currentPage = val;
-      this.getList();
-    },
-
-    // 添加活动
-    addOrEdit(type, id) {
-      if(type == 'add') {
-        this.$router.push({
-          name:"groupbuy_add",
-          query: {}
-        })
-      }else {
-        this.$router.push({
-          name:"groupbuy_add",
-          query: {
-            id
-          }
-        })
-      }
-    },
-
-    // 操作 - 更改活动状态(type: 禁用0,启用1)
-    changeActivityStatus(id, type) {
-      changeStatus({promotionGroupId: id, status: type}).then(res => {
-        this.getCount();
-        this.getList();
-        this.$successMsg();
-      })
-    },
-
-    // 去详情
-    toDetail(id) {
-      this.$router.push({
-        name:"groupbuy_detail",
-        query: {
-          id
-        }
-      })
-    },
-
-    // 导出
-    handleExport(id) {
-      let screenData = {
-        promotionGroupId: id
-      };
-      downloadFiles('order/export', screenData);
-    },
-
-  },
-
-}
-</script>
-
-<style scoped>
-  .app-container >>> .el-tabs__header {
-    margin-bottom: 0;
-  }
-  .app-container >>> .el-tabs__nav-wrap::after {
-    background: none;
-  }
-  .app-container >>> #tab-activity, .app-container >>> #tab-goods {
-    font-size: 16px;
-  }
-  .table >>> .el-tag {
-    margin-right: 6px;
-  }
-  .table >>> .el-tag:last-child {
-    margin-right: 0;
-  }
-</style>