From a836f03a5d1fbfa81e147d09ffdfa87ba3975c13 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 18 三月 2025 16:45:02 +0800
Subject: [PATCH] 1

---
 admin/src/views/combo/record.vue |  390 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 390 insertions(+), 0 deletions(-)

diff --git a/admin/src/views/combo/record.vue b/admin/src/views/combo/record.vue
new file mode 100644
index 0000000..4333ac9
--- /dev/null
+++ b/admin/src/views/combo/record.vue
@@ -0,0 +1,390 @@
+<template>
+  <div class="main_app">
+    <Breadcrumb />
+    <QueryForm v-model="filters" :query-form-config="queryFormConfig" @handleQuery="getList(1)" @clear="clearQueryForm">
+    </QueryForm>
+    <div class="table_btns">
+      <el-button plain type="primary" @click="handleEx">瀵煎嚭</el-button>
+      <el-button plain type="danger" @click="openModal('zuofei')">浣滃簾</el-button>
+      <el-button plain @click="openModal('tiaozheng')">濂楅璋冩暣</el-button>
+    </div>
+    <el-table v-loading="loading" :data="list" stripe border @selection-change="handleSelectionChange">
+      <el-table-column fixed="left" align="center" type="selection" :selectable="handleDisable" width="55" />
+      <el-table-column align="center" label="濂楅绁ㄥ彿" min-width="160" show-overflow-tooltip>
+        <template v-slot="scope">
+          <span class="primaryColor pointer" @click="comboDetail(scope.row)">{{
+            scope.row.code
+          }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="濂楅绫诲瀷" min-width="80">
+        <template v-slot="scope">
+          <span v-if="scope.row.type == '0'">鏈熼檺鍗�</span>
+          <span v-if="scope.row.type == '1'">娆″崱</span>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="濂楅鍚嶇О" show-overflow-tooltip min-width="100" prop="name" />
+      <el-table-column align="center" label="鐢ㄦ埛淇℃伅" min-width="100" prop="openid" show-overflow-tooltip />
+      <el-table-column align="center" label="浣跨敤娆℃暟" min-width="80" prop="useTimes">
+      </el-table-column>
+      <el-table-column align="center" label="鏈夋晥鏃ユ湡" min-width="200" prop="remainCount">
+        <template v-slot="scope">
+          <span>{{ scope.row.useStartDate }}鑷硔{ scope.row.useEndDate }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="濂楅鐘舵��" min-width="80">
+        <template v-slot="scope">
+          <span v-if="scope.row.status == '0'" class="text_success">姝e父</span>
+          <span v-if="scope.row.status == '1'" class="text_warning">浣滃簾</span>
+          <span v-if="scope.row.status == '2'" class="text-danger">寰呮敮浠�</span>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="鎿嶄綔" fixed="right" min-width="150">
+        <template v-slot="scope">
+          <template>
+            <el-button v-if="scope.row.status == '0'" type="text" @click="openCan(scope.row)">浣滃簾</el-button>
+            <span v-else>-</span>
+          </template>
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="table_btns">
+      <Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
+    </div>
+
+    <el-dialog title="濂楅璋冩暣" :visible.sync="isShowAdjust" width="500px">
+      <div class="adjust_modal">
+        <div style="margin-top: -30px; margin-bottom: 10px;">
+          <el-radio v-model="adjustData.flag" label="0">宸查�墈{ selList.length }}鏉℃暟鎹�</el-radio>
+        </div>
+        <div style="margin-bottom: 16px;">
+          <el-radio v-model="adjustData.flag" label="1">閫夌幇鏈夌瓫閫夋潯浠朵笅鍏ㄩ儴鐨剓{ pagination.total }}鏉℃暟鎹�</el-radio>
+        </div>
+        <div class="df_ac mb5">
+          <span class="key">鏈夋晥鏈熷鍔狅細</span>
+          <el-input v-model="adjustData.addNum" oninput="value=value.replace(/[^\d]/g,'')" class="flex1 mr10" />
+          <span>澶�</span>
+        </div>
+        <div class="df_ac mb20">
+          <span class="key" />
+          <span class="text_warning">淇敼鍚庡椁愭湁鏁堟湡澧炲姞浠ヤ笂澶╂暟</span>
+        </div>
+        <div class="df_ac mt20">
+          <span class="key">璋冩暣澶囨敞锛�</span>
+          <el-input v-model="ModelRemark" style="width: 356px" placeholder="璇锋寜瑕佹眰杈撳叆澶囨敞璇存槑锛岄潪蹇呭~" />
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="isShowAdjust = false">鍙栨秷</el-button>
+        <el-button type="primary" :loading="subLoading" @click="handleModelEnter">纭畾</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="濂楅浣滃簾" :visible.sync="isShowCan" width="500px">
+      <div class="adjust_modal" style="margin-top: -30px;">
+        <div class="red" style="font-size: 16px;">纭畾浣滃簾閫変腑濂楅鍚楋紵浣滃簾鍚庯紝濂楅涓嶅彲浣跨敤</div>
+        <div class="df_ac mt10">
+          <el-input type="textarea" v-model="remarkCan" placeholder="璇锋寜瑕佹眰杈撳叆澶囨敞璇存槑锛岄潪蹇呭~" />
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="isShowCan = false">鍙栨秷</el-button>
+        <el-button type="primary" :loading="subLoading" @click="handleCan">纭畾</el-button>
+      </span>
+    </el-dialog>
+
+    <Refund v-if="isShowRefund" ref="RefundRef" @close="isShowRefund = false" @success="refundSuccess" />
+    <Detail v-if="isShowDetail" ref="detailRef" />
+    <Detail ref="DetailRef" />
+  </div>
+</template>
+
+<script>
+import BasePageTemp from '@/components/base/BasePageTemp'
+import Breadcrumb from '@/layouts/Breadcrumb'
+import Detail from './components/SaleDetail.vue'
+import { Message } from 'element-ui'
+import {
+  comboSalePage,
+  comboSaleEx,
+  comboSaleCancel,
+  comboSaleAdjust,
+} from '@/api/business/combo.js'
+export default {
+  name: 'SalesRecord',
+  extends: BasePageTemp,
+  components: { Breadcrumb, Detail },
+  data() {
+    return {
+      exportLoading: false,
+      isShowDetail: false,
+      isShowRefund: false,
+      queryFormConfig: {
+        formItems: [{
+          filed: 'code',
+          type: 'input',
+          label: '濂楅绁ㄥ彿',
+          placeholder: '璇疯緭鍏ュ椁愬彿',
+          clearable: true
+        }, {
+          filed: 'name',
+          type: 'input',
+          label: '濂楅鍚嶇О',
+          placeholder: '璇疯緭鍏ュ椁愬悕绉�',
+          clearable: true
+        }, {
+          filed: 'openid',
+          type: 'input',
+          label: '鐢ㄦ埛淇℃伅',
+          clearable: true
+        }, {
+          filed: 'status',
+          type: 'select',
+          label: '鐘舵��',
+          placeholder: '璇烽�夋嫨鐘舵��',
+          clearable: true,
+          options: [
+            { value: '0', label: '姝e父' },
+            { value: '1', label: '浣滃簾' },
+            // { value: '2', label: '寰呮敮浠�' }
+          ]
+        }],
+        online: true
+      },
+      querys: {
+        id: '',
+        mealsName: '',
+        memberSearchValue: '',
+        status: '',
+        indate: []
+      },
+
+      saleRecordList: [],
+      saleRecordTotal: 0,
+      selList: [],
+      saleRecordLoading: false,
+      subLoading: false,
+
+      isShowCan: false,
+      ModalTitle: '',
+      ModalText: '',
+      ModelRemark: '',
+      remarkCan: '',
+      // 猬囷笍adjust璋冩暣鐩稿叧
+      isShowAdjust: false,
+      isShowCan: false,
+      canList: [],
+      adjustData: {
+        flag: 0,
+        addNum: '',
+        addTime: ''
+      },
+      serviceChargePrice: '',
+      serviceChargeId: ''
+    }
+  },
+  created() {
+    // this.meta = this.$route.meta.buttons || []
+    this.getList(1)
+  },
+  methods: {
+    rowClickRefund(row) {
+      this.isShowRefund = true
+      this.$nextTick(() => {
+        this.$refs.RefundRef.getPrice(row)
+        this.$refs.RefundRef.isShow = true
+      })
+    },
+    refundSuccess() {
+      this.isShowRefund = false
+      this.getList()
+    },
+    handleEx() {
+      const { pagination, filters } = this
+      this.$dialog.exportConfirm('纭瀵煎嚭鍚楋紵')
+        .then(() => {
+          this.loading = true
+          comboSaleEx({
+            page: 1,
+            capacity: 1000000,
+            model: filters
+          })
+            .then(response => {
+              this.download(response)
+            })
+            .catch(e => {
+              this.$tip.apiFailed(e)
+            })
+            .finally(() => {
+              this.loading = false
+            })
+        })
+        .catch(() => { })
+    },
+    openCan(row) {
+      this.isShowCan = true
+      this.canList = [row]
+    },
+    handleDisable(row) {
+      // return row.status == 0
+      return true
+    },
+    // 鏌ヨ琛ㄦ牸鏁版嵁
+    getList(page) {
+      const { pagination, filters } = this
+      this.loading = true
+      if (page) { pagination.page = page }
+      comboSalePage({
+        model: {
+          ...filters
+        },
+        capacity: pagination.pageSize,
+        page: pagination.page,
+      }).then(res => {
+        this.loading = false
+        this.list = res.records || []
+        this.pagination.total = res.total || 0
+      }, () => {
+        this.loading = false
+      })
+    },
+    clearQueryForm() {
+      // eslint-disable-next-line no-unused-vars
+      this.filters = {}
+      this.getList(1)
+    },
+    // 鎵撳紑modal 鍐荤粨 瑙e喕 浣滃簾
+    openModal(type) {
+      const { selList } = this
+      this.ModelRemark = ''
+      this.adjustData.addNum = ''
+      this.adjustData.addTime = ''
+      switch (type) {
+        case 'zuofei':
+          this.ModalTitle = '濂楅浣滃簾'
+          this.ModalText = '纭畾浣滃簾閫変腑濂楅鍚楋紵浣滃簾鍚庯紝濂楅涓嶅彲浣跨敤'
+          break
+        case 'tiaozheng':
+          this.ModalTitle = '濂楅璋冩暣'
+          break
+        default:
+          break
+      }
+      if (selList.length === 0 && type == 'zuofei') {
+        return Message.warning(`璇峰厛閫夋嫨瑕�${this.ModalTitle.slice(2)}鐨勫椁恅)
+      }
+      if (this.ModalTitle === '濂楅璋冩暣') {
+        this.isShowAdjust = true
+        this.adjustData = {
+          flag: '0'
+        }
+      } else {
+        this.isShowCan = true
+      }
+    },
+    // 纭畾 鍐荤粨 瑙e喕 浣滃簾
+    handleModelEnter() {
+      switch (this.ModalTitle) {
+        case '濂楅浣滃簾':
+          this.cancellation()
+          break
+        case '濂楅璋冩暣':
+          this.handleAdjust()
+          break
+        default:
+          break
+      }
+    },
+    // 璋冩暣
+    async handleAdjust() {
+      if (!this.adjustData.addNum && !this.adjustData.addTime) {
+        return Message.warning('璇疯緭鍏ヨ璋冩暣鐨勬湁鏁堟湡澶╂暟鎴栬�呬綑閲忔鏁�')
+      }
+      const data = {
+        info: this.ModelRemark,
+        addDays: this.adjustData.addNum || 0,
+        choseIdList: this.adjustData.flag == 0 ? this.selList.map(i => i.id) : [],
+        ...this.filters
+      }
+
+      this.subLoading = true
+      const res = await comboSaleAdjust({ ...data }).catch(() => {
+        this.subLoading = false
+        this.isShowCan = false
+      })
+      this.subLoading = false
+      this.isShowCan = false
+      if (res) {
+        Message.success('濂楅璋冩暣鎴愬姛')
+        this.getList()
+        this.isShowAdjust = false
+      }
+    },
+    // 浣滃簾
+    async cancellation() {
+      const data = {
+        handleRemake: this.remarkCan,
+        choseIdList: this.selList.map(i => i.id)
+      }
+      this.subLoading = true
+      const res = await comboSaleCancel({ ...data }).catch(() => {
+        this.subLoading = false
+        this.isShowCan = false
+      })
+      this.subLoading = false
+      this.isShowCan = false
+      if (res) {
+        Message.success('浣滃簾鎴愬姛')
+        this.getList()
+      }
+    },
+    async handleCan() {
+      const data = {
+        handleRemake: this.remarkCan,
+        choseIdList: this.canList.map(i => i.id)
+      }
+      this.subLoading = true
+      const res = await comboSaleCancel({ ...data }).catch(() => {
+        this.subLoading = false
+        this.isShowCan = false
+      })
+      this.subLoading = false
+      this.isShowCan = false
+      if (res) {
+        Message.success('浣滃簾鎴愬姛')
+        this.getList()
+      }
+    },
+    handleSelectionChange(val) {
+      this.selList = val
+    },
+    comboDetail(item) {
+      this.$nextTick(() => {
+        this.$refs.DetailRef.isShowModal = true
+        this.$refs.DetailRef.getDetail(item)
+      })
+    },
+    pageSizeChange(val) {
+      this.pagination.rows = val
+      this.getList(1)
+    }
+
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.adjust_modal {
+  .df_ac {
+    .key {
+      width: 92px;
+      text-align: right;
+    }
+  }
+
+  .el-dialog__body {}
+
+  .text_warning {
+    color: #e89e42;
+  }
+}
+</style>

--
Gitblit v1.9.3