Browse Source

2024.11.22 - 排队免单相关

GuYun-D 4 months ago
parent
commit
e1f79a0ec2

+ 66 - 0
src/api/freeQueuing.js

@@ -0,0 +1,66 @@
+import request from '@/utils/request'
+
+// api docs: https://www.showdoc.com.cn/2275703555064913/11558417901706052
+
+// 查询免单列表
+export function getFreeQueuingListApi(params) {
+  return request({
+    url: '/platform-participation-free/getAll',
+    method: 'get',
+    params
+  })
+}
+
+// 查询排队免单列表详情
+export function getFreeQueuingDeatilApi(params) {
+  return request({
+    url: '/platform-participation-free/getById',
+    method: 'get',
+    params
+  })
+}
+
+// 发起免单: /platform-participation-free/create
+export function createFreeQueuingApi(data) {
+  return request({
+    url: '/platform-participation-free/create',
+    method: 'post',
+    data
+  })
+}
+
+// 修改免单 /platform-participation-free/updateById
+export function updateFreeQueuingApi(data) {
+  return request({
+    url: '/platform-participation-free/updateById',
+    method: 'post',
+    data
+  })
+}
+
+// 删除免单: /platform-participation-free/deleteById
+export function deleteFreeQueuingDeatilApi(params) {
+  return request({
+    url: '/platform-participation-free/deleteById',
+    method: 'DELETE',
+    params
+  })
+}
+
+// 查询免单池列表
+export function getFreeQueuingPoolListApi(params) {
+  return request({
+    url: '/platform-participation-free/getPoolAll',
+    method: 'get',
+    params
+  })
+}
+
+// 查询免单池详情
+export function getFreeQueuingPoolDeatilApi(params) {
+  return request({
+    url: '/platform-participation-free/getPoolById',
+    method: 'get',
+    params
+  })
+}

+ 64 - 0
src/views/freeQueuing/list/components/DetailModal.vue

@@ -0,0 +1,64 @@
+<template>
+  <el-dialog title="提示" :visible.sync="detailVisible" width="30%">
+    <el-descriptions class="margin-top" title="排队免单信息" :column="2" :size="size" border>
+      <el-descriptions-item>
+        <template slot="label">活动名称</template>
+        {{ detailInfo.activitiesName }}
+      </el-descriptions-item>
+      <el-descriptions-item>
+        <template slot="label">发起方</template>
+        <el-tag size="mini" v-if="detailInfo.isPlatformInit === 1">平台</el-tag>
+        <el-tag size="mini" type="success" v-else-if="detailInfo.isPlatformInit === 0">商家</el-tag>
+        <el-tag size="mini" v-else type="info"></el-tag>
+      </el-descriptions-item>
+    </el-descriptions>
+    <h3>参与商家</h3>
+
+    <el-table border :data="detailInfo.shops || []">
+      <el-table-column align="center" type="index" label="#" width="55"></el-table-column>
+      <el-table-column prop="shopName" label="店铺名称" align="center" />
+      <el-table-column prop="shopPhone" label="店铺手机号" align="center" />
+    </el-table>
+
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="detailVisible = false">取 消</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { getFreeQueuingDeatilApi } from '@/api/freeQueuing'
+
+export default {
+  data() {
+    return {
+      detailVisible: false,
+      detailInfo: {}
+    }
+  },
+
+  methods: {
+    show(id) {
+      if (!id) {
+        return this.$message.error('id 不能为空')
+      }
+      this.getDetail(id)
+      this.detailVisible = true
+    },
+
+    async getDetail(id) {
+      const res = await getFreeQueuingDeatilApi({ id })
+      this.detailInfo = res.data
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+h3 {
+  font-weight: bold;
+  color: #303133;
+  font-size: 16px;
+  margin: 20px 0 10px 0;
+}
+</style>

+ 132 - 0
src/views/freeQueuing/list/components/FreeQueuingModal.vue

@@ -0,0 +1,132 @@
+<template>
+  <el-dialog :close-on-click-modal="false" :visible.sync="freeQueuingModalVisible" :title="dialogTitle" :before-close="handleBeforeClose">
+    <el-form ref="freeQueuingModalRef" :rules="rules" :model="form" label-width="auto">
+      <el-form-item label="活动名称" prop="activitiesName">
+        <el-input placeholder="请输入活动名称" v-model="form.activitiesName" size="mini"></el-input>
+      </el-form-item>
+      <el-form-item label="支持商家" prop="shopIds">
+        <el-select style="width: 100%" multiple filterable remote reserve-keyword placeholder="请输入商家名称" :remote-method="handleSerachShop" :loading="searchShopLoading" v-model="form.shopIds">
+          <el-option v-for="shop in shopList" :key="shop.shopId" :label="shop.shopName" :value="shop.shopId"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="发起方" prop="isPlatformInit">
+        <el-radio-group size="mini" v-model="form.isPlatformInit">
+          <el-radio :label="1">平台</el-radio>
+          <el-radio :label="0">商家</el-radio>
+        </el-radio-group>
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button size="mini" @click="close">取消</el-button>
+        <el-button size="mini" type="primary" :loading="isLoading" @click="onConfirm">{{ form.id ? '确认编辑' : '确认创建排队免单' }}</el-button>
+      </span>
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+import { createFreeQueuingApi, updateFreeQueuingApi } from '@/api/freeQueuing'
+import { businessListGetAll } from '@/api/business'
+
+export default {
+  data() {
+    return {
+      isLoading: false,
+      freeQueuingModalVisible: false,
+      dialogTitle: '新增排队免单',
+      form: {
+        id: undefined,
+        activitiesName: '', // 活动名称
+        shopIds: [],
+        isPlatformInit: 1 // 是否为平台发起 0:商家
+      },
+      rules: {
+        activitiesName: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
+        shopIds: [{ required: true, type: 'array', message: '请选择商家', trigger: 'change' }],
+        isPlatformInit: [{ required: true, message: '请选择是否是平台发起', trigger: 'change' }]
+      },
+      shopList: [],
+      searchShopLoading: false
+    }
+  },
+
+  methods: {
+    show(row) {
+      this.reset()
+      if (row) {
+        this.form.id = row.id
+        this.form.isPlatformInit = Number(row.isPlatformInit)
+        this.form.activitiesName = row.activitiesName
+        this.form.shopIds = row.shopIds ? row.shopIds.split(',') : []
+        this.dialogTitle = '编辑排队免单'
+      }else{
+        this.dialogTitle = '新增排队免单'
+      }
+      this.freeQueuingModalVisible = true
+      this.$nextTick(() => {
+        this.$refs.freeQueuingModalRef.clearValidate()
+      })
+    },
+
+    // 搜索商家
+    async handleSerachShop(query) {
+      if (query !== '') {
+        this.searchShopLoading = true
+        const res = await businessListGetAll({
+          page: 1,
+          pageSize: 50,
+          shopName: query, // 店铺名称
+          shopCode: '', // 店铺编码
+          chargePersonName: '', // 店铺负责人
+          contractState: '', // 合同状态 1-有效 0-无效
+          shopType: 2,
+          keyword: '' // 手机号搜索
+        })
+
+        this.shopList = res.data.list
+        this.searchShopLoading = false
+      } else {
+        this.shopList = []
+      }
+    },
+
+    async onConfirm() {
+      try {
+        this.isLoading = true
+        await this.$refs.freeQueuingModalRef.validate()
+        const api = this.form.id ? updateFreeQueuingApi : createFreeQueuingApi
+        const data = JSON.parse(JSON.stringify(this.form))
+        data.shopIds = data.shopIds.join(',')
+        await api(data)
+        this.$message.success(data.id ? '编辑成功' : '发起排队免单成功')
+        this.$emit('refresh')
+        this.close()
+      } finally {
+        this.isLoading = false
+      }
+    },
+
+    handleBeforeClose(done) {
+      this.$refs.freeQueuingModalRef.resetFields()
+      done()
+    },
+
+    close() {
+      this.reset()
+      this.freeQueuingModalVisible = false
+    },
+
+    reset() {
+      this.form = {
+        id: undefined,
+        activitiesName: '', // 活动名称
+        shopIds: [],
+        isPlatformInit: 1 // 是否为平台发起 0:商家
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 142 - 0
src/views/freeQueuing/list/index.vue

@@ -0,0 +1,142 @@
+<template>
+  <div class="payreturnPage">
+    <!-- 搜索 -->
+    <div class="formSearch">
+      <!-- 搜索条件 -->
+      <el-form :inline="true" :model="query" class="demo-form-inline">
+        <el-form-item label="活动名称">
+          <el-input v-model="query.search" maxlength="20" placeholder="请输入活动名称" />
+        </el-form-item>
+
+        <el-form-item>
+          <el-button type="primary" plain @click="search">查询</el-button>
+          <el-button plain @click="clear">重置</el-button>
+          <el-button type="primary" plain @click="$refs.freeQueuingModalRef && $refs.freeQueuingModalRef.show()">发起排队免单</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+    <!-- 表格 -->
+    <div class="tableBox">
+      <el-table ref="multipleTable" :data="tableData" border :header-cell-style="{ background: '#EEF3FF', color: '#333333' }" tooltip-effect="dark" style="width: 100%">
+        <el-table-column align="center" type="index" label="#" width="55"></el-table-column>
+        <el-table-column prop="activitiesName" label="活动名称" align="center" width="220" />
+        <el-table-column prop="productImage" label="参与商家ID" align="center">
+          <template slot-scope="scope">
+            <span v-if="!scope.row.shopIds">---</span>
+            <el-tag style="margin: 3px" v-for="(item, index) in scope.row.shopIds.split(',')" size="mini" :key="index">{{ item }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="productPrice" label="发起类型" align="center" width="120">
+          <template slot-scope="scope">
+            <el-tag size="mini" v-if="scope.row.isPlatformInit === 1">平台发起</el-tag>
+            <el-tag type="success" size="mini" v-else>商家发起</el-tag>
+          </template>
+        </el-table-column>
+
+        <el-table-column width="280" label="操作" align="center" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <div class="btnList">
+              <el-button type="text" @click="$refs.freeQueuingModalRef && $refs.freeQueuingModalRef.show(scope.row)">编辑</el-button>
+              <el-button type="text" @click="$refs.detailModalRef && $refs.detailModalRef.show(scope.row.id)">详情</el-button>
+              <el-button type="text" style="color: #f56c6c" @click="handleDelete(scope.row)">删除</el-button>
+            </div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="fenye">
+        <el-pagination
+          :current-page="query.page"
+          :page-sizes="[10, 20, 50, 100]"
+          :page-size="10"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="total"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+        />
+      </div>
+    </div>
+
+    <FreeQueuingModal @refresh="search" ref="freeQueuingModalRef"></FreeQueuingModal>
+    <DetailModal ref="detailModalRef"></DetailModal>
+  </div>
+</template>
+
+<script>
+import { getFreeQueuingListApi, deleteFreeQueuingDeatilApi } from '@/api/freeQueuing'
+import FreeQueuingModal from './components/FreeQueuingModal'
+import DetailModal from './components/DetailModal'
+
+export default {
+  components: {
+    FreeQueuingModal,
+    DetailModal
+  },
+  data() {
+    return {
+      query: { page: 1, pageSize: 10, search: undefined },
+      total: 1,
+      tableData: []
+    }
+  },
+  created() {
+    this.getAll()
+  },
+  methods: {
+    async getAll() {
+      const res = await getFreeQueuingListApi(this.query)
+      this.tableData = res.data.list
+      this.total = res.data.total
+    },
+    handleSizeChange(val) {
+      this.query.pageSize = val
+      this.getAll()
+    },
+    handleCurrentChange(val) {
+      this.query.page = val
+      this.getAll()
+    },
+    search() {
+      this.total = 1
+      this.query.page = 1
+      this.getAll()
+    },
+    clear() {
+      this.query = {
+        page: 1,
+        pageSize: 10,
+        search: ''
+      }
+      this.getAll()
+    },
+
+    // 删除
+    async handleDelete(row) {
+      this.$confirm(`是否删除【${row.activitiesName}】这项排队免单?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(async () => {
+          const res = await deleteFreeQueuingDeatilApi({ id: row.id })
+          if (res.code == '200') {
+            this.$message.success('删除成功')
+            this.getAll()
+          }
+        })
+        .catch(() => {})
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.payreturnPage {
+  padding: 30px;
+
+  .tableBox {
+    .fenye {
+      margin: 20px;
+    }
+  }
+}
+</style>

+ 74 - 0
src/views/freeQueuing/pool/components/DetailModal.vue

@@ -0,0 +1,74 @@
+<template>
+  <el-dialog title="详情" :visible.sync="detailVisible" width="40%">
+    <el-descriptions class="margin-top" :column="2" :size="size" border>
+      <el-descriptions-item>
+        <template slot="label">免单池金额</template>
+        <span style="color: #f40">¥ {{ detailInfo.amount || '--' }}</span>
+      </el-descriptions-item>
+      <el-descriptions-item>
+        <template slot="label">对应活动名称</template>
+        <span>{{ detailInfo.platformParticipationFreeActivities.activitiesName || '--' }}</span>
+      </el-descriptions-item>
+    </el-descriptions>
+    <h3>免单记录</h3>
+
+    <el-table border :data="detailInfo.records || []">
+      <el-table-column align="center" type="index" label="#" width="55"></el-table-column>
+      <el-table-column prop="orderNo" label="关联订单号" align="center" />
+      <el-table-column prop="amount" label="操作金额" align="center" />
+      <el-table-column prop="type" label="类型" align="center">
+        <template slot-scope="scope">
+          <el-tag size="mini" v-if="scope.row.type === 1">入账</el-tag>
+          <el-tag type="danger" size="mini" v-else>出账(免单)</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column prop="isUsed" label="是否参与过免单结算" align="center">
+        <template slot-scope="scope">
+          <el-tag size="mini" v-if="scope.row.isUsed === 1">是</el-tag>
+          <el-tag type="danger" size="mini" v-else>否</el-tag>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="detailVisible = false">取 消</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { getFreeQueuingPoolDeatilApi } from '@/api/freeQueuing'
+
+export default {
+  data() {
+    return {
+      detailVisible: false,
+      detailInfo: {}
+    }
+  },
+
+  methods: {
+    show(id) {
+      if (!id) {
+        return this.$message.error('id 不能为空')
+      }
+      this.getDetail(id)
+      this.detailVisible = true
+    },
+
+    async getDetail(id) {
+      const res = await getFreeQueuingPoolDeatilApi({ id })
+      this.detailInfo = res.data
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+h3 {
+  font-weight: bold;
+  color: #303133;
+  font-size: 16px;
+  margin: 20px 0 10px 0;
+}
+</style>

+ 110 - 0
src/views/freeQueuing/pool/index.vue

@@ -0,0 +1,110 @@
+<template>
+  <div class="payreturnPage">
+    <!-- 搜索 -->
+    <div class="formSearch">
+      <!-- 搜索条件 -->
+      <el-form :inline="true" :model="query" class="demo-form-inline">
+        <el-form-item label="活动名称">
+          <el-input v-model="query.search" maxlength="20" placeholder="请输入活动名称" />
+        </el-form-item>
+
+        <el-form-item>
+          <el-button type="primary" plain @click="search">查询</el-button>
+          <el-button plain @click="clear">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+    <!-- 表格 -->
+    <div class="tableBox">
+      <el-table ref="multipleTable" :data="tableData" border :header-cell-style="{ background: '#EEF3FF', color: '#333333' }" tooltip-effect="dark" style="width: 100%">
+        <el-table-column align="center" type="index" label="#" width="55"></el-table-column>
+        <el-table-column prop="amount" label="免单池金额" align="center">
+          <template slot-scope="scope">
+            <span style="color: #f40">¥{{ scope.row.amount || '--' }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="platformParticipationFreeActivities.activitiesName" label="对应活动名称" align="center"></el-table-column>
+
+        <el-table-column width="280" label="操作" align="center" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <div class="btnList">
+              <el-button type="text" @click="$refs.detailModalRef && $refs.detailModalRef.show(scope.row.id)">详情</el-button>
+            </div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="fenye">
+        <el-pagination
+          :current-page="query.page"
+          :page-sizes="[10, 20, 50, 100]"
+          :page-size="10"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="total"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+        />
+      </div>
+    </div>
+
+    <!-- 详情 -->
+    <DetailModal ref="detailModalRef"></DetailModal>
+  </div>
+</template>
+
+<script>
+import { getFreeQueuingPoolListApi } from '@/api/freeQueuing'
+import DetailModal from './components/DetailModal.vue'
+
+export default {
+  components: {DetailModal},
+  data() {
+    return {
+      query: { page: 1, pageSize: 10, search: undefined },
+      total: 1,
+      tableData: []
+    }
+  },
+  created() {
+    this.getAll()
+  },
+  methods: {
+    async getAll() {
+      const res = await getFreeQueuingPoolListApi(this.query)
+      this.tableData = res.data.list
+      this.total = res.data.total
+    },
+    handleSizeChange(val) {
+      this.query.pageSize = val
+      this.getAll()
+    },
+    handleCurrentChange(val) {
+      this.query.page = val
+      this.getAll()
+    },
+    search() {
+      this.total = 1
+      this.query.page = 1
+      this.getAll()
+    },
+    clear() {
+      this.query = {
+        page: 1,
+        pageSize: 10,
+        search: ''
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.payreturnPage {
+  padding: 30px;
+
+  .tableBox {
+    .fenye {
+      margin: 20px;
+    }
+  }
+}
+</style>