From c6ac7827159e71f6906a42ceb29a4f83a2f239f6 Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期五, 21 二月 2025 14:12:38 +0800 Subject: [PATCH] ll --- admin/src/views/combo/record.vue | 400 +++++++++++++++++++++------------------------------------ 1 files changed, 148 insertions(+), 252 deletions(-) diff --git a/admin/src/views/combo/record.vue b/admin/src/views/combo/record.vue index a30b1b8..8d8b0c7 100644 --- a/admin/src/views/combo/record.vue +++ b/admin/src/views/combo/record.vue @@ -2,71 +2,48 @@ <div class="main_app"> <Breadcrumb /> <QueryForm v-model="querys" :query-form-config="queryFormConfig" @handleQuery="getList(1)" @clear="clearQueryForm"> - <template #btns> - <el-button v-if="meta.indexOf('MealsUseDetailExport') > -1" type="primary" - @click="comboRecordExport">瀵煎嚭</el-button> - </template> - <template #indate> - <el-date-picker v-model="querys.indate" type="datetimerange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" class="w400" - :picker-options="pickerOptions" /> - </template> </QueryForm> <div class="table_btns"> - <el-button v-preventReClick plain type="primary" @click="handleEx">瀵煎嚭</el-button> - <el-button v-preventReClick plain type="danger" @click="openModal('zuofei')">浣滃簾</el-button> - <el-button v-preventReClick plain @click="openModal('tiaozheng')">濂楅璋冩暣</el-button> + <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="濂楅绁ㄥ彿" width="300" show-overflow-tooltip> + <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.id - }}</span> + scope.row.code + }}</span> </template> </el-table-column> - <el-table-column align="center" label="濂楅绫诲瀷" width="120"> + <el-table-column align="center" label="濂楅绫诲瀷" min-width="80"> <template v-slot="scope"> - <span v-if="scope.row.mealsType === '0'">闂ㄧエ娆″崱</span> - <span v-if="scope.row.mealsType === '1'">闂ㄧエ鏈熼檺鍗�</span> - <span v-if="scope.row.mealsType === '2'">棰勫畾娆″崱</span> - <span v-if="scope.row.mealsType === '3'">璇剧▼棰勭害娆″崱</span> - <span v-if="scope.row.mealsType === '4'">璇剧▼鏈熼檺鍗�</span> + <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 width="160" prop="mealsName" /> - <el-table-column align="center" label="鐢ㄦ埛淇℃伅" min-width="240" prop="memberInfo" show-overflow-tooltip /> - <el-table-column align="center" label="浣跨敤娆℃暟" width="80" prop="useCount"> + <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 v-if="scope.row.mealsType === '1'">-</span> - <span v-else>{{ scope.row.useCount }}</span> + <span>{{ scope.row.useStartDate }}鑷硔{ scope.row.useEndDate }}</span> </template> </el-table-column> - <el-table-column align="center" label="鏈夋晥鏃ユ湡" width="80" prop="remainCount"> + <el-table-column align="center" label="濂楅鐘舵��" min-width="80"> <template v-slot="scope"> - <span v-if="scope.row.mealsType === '1'">-</span> - <span v-else>{{ scope.row.remainCount }}</span> + <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 fixed="right" align="center" label="濂楅鐘舵��" 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> - <span v-if="scope.row.status === '3'" class="text-danger">澶辨晥</span> - </template> - </el-table-column> - <el-table-column align="center" label="鏈夋晥鏃ユ湡" width="120" prop="validTime" /> - <el-table-column align="center" label="鎿嶄綔" fixed="right" width="150"> + <el-table-column align="center" label="鎿嶄綔" fixed="right" min-width="150"> <template v-slot="scope"> <template> - <el-button v-if=" - meta.indexOf('MealsMemberPartRefund') > -1 && - (scope.row.status == '0' || scope.row.status == '1') - " type="text" @click="rowClickRefund(scope.row)">閫�娆�</el-button> - <el-button v-if="scope.row.status == '0'" type="text" - @click="getServiceChargePriceBtn('2', scope.row.id)">鍐荤粨</el-button> + <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> @@ -78,14 +55,14 @@ <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.aa" label="1">宸查�夊綋鍓�2鏉℃暟鎹�</el-radio> + <el-radio v-model="adjustData.flag" label="0">宸查�墈{ selList.length }}鏉℃暟鎹�</el-radio> </div> <div style="margin-bottom: 16px;"> - <el-radio v-model="adjustData.aa" label="1">宸查�夌幇鏈夌瓫閫夋潯浠朵笅鍏ㄩ儴鐨�11鏉℃暟鎹�</el-radio> + <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.addTime" oninput="value=value.replace(/[^\d]/g,'')" class="flex1 mr10" /> + <el-input v-model="adjustData.addNum" oninput="value=value.replace(/[^\d]/g,'')" class="flex1 mr10" /> <span>澶�</span> </div> <div class="df_ac mb20"> @@ -99,26 +76,43 @@ </div> <span slot="footer" class="dialog-footer"> <el-button @click="isShowAdjust = false">鍙栨秷</el-button> - <el-button v-preventReClick type="primary" :loading="subLoading" @click="handleModelEnter">纭畾</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" /> - <orderDialog ref="child" @orderSuccess="getList()" /> + <Detail ref="DetailRef" /> </div> </template> <script> -import { pickerOptions } from './components/config' import BasePageTemp from '@/components/base/BasePageTemp' import Breadcrumb from '@/layouts/Breadcrumb' -// import Detail from '../comboDetail' -// import Refund from './refund.vue' +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 }, + components: { Breadcrumb, Detail }, data() { return { exportLoading: false, @@ -126,19 +120,19 @@ isShowRefund: false, queryFormConfig: { formItems: [{ - filed: 'id', + filed: 'code', type: 'input', label: '濂楅绁ㄥ彿', placeholder: '璇疯緭鍏ュ椁愬彿', clearable: true }, { - filed: 'mealsName', + filed: 'name', type: 'input', label: '濂楅鍚嶇О', placeholder: '璇疯緭鍏ュ椁愬悕绉�', clearable: true }, { - filed: 'memberSearchValue', + filed: 'openid', type: 'input', label: '鐢ㄦ埛淇℃伅', clearable: true @@ -150,13 +144,12 @@ clearable: true, options: [ { value: '0', label: '姝e父' }, - { value: '1', label: '鍐荤粨' }, - { value: '2', label: '浣滃簾' }, - { value: '3', label: '澶辨晥' }] + { value: '1', label: '浣滃簾' }, + // { value: '2', label: '寰呮敮浠�' } + ] }], online: true }, - pickerOptions, querys: { id: '', mealsName: '', @@ -167,17 +160,21 @@ saleRecordList: [], saleRecordTotal: 0, - selectSalesList: [], + selList: [], saleRecordLoading: false, subLoading: false, - isShowModal: false, + isShowCan: false, ModalTitle: '', ModalText: '', ModelRemark: '', + remarkCan: '', // 猬囷笍adjust璋冩暣鐩稿叧 isShowAdjust: false, + isShowCan: false, + canList: [], adjustData: { + flag: 0, addNum: '', addTime: '' }, @@ -187,7 +184,7 @@ }, created() { // this.meta = this.$route.meta.buttons || [] - // this.getList(1) + this.getList(1) }, methods: { rowClickRefund(row) { @@ -201,84 +198,53 @@ this.isShowRefund = false this.getList() }, - getServiceChargePriceBtn(type, mealsMemberId) { - this.serviceChargeId = mealsMemberId - getServiceChargePrice({ - param: { - type, - mealsMemberId - } - }).then((res) => { - if (res.errorCode === '000000') { - this.serviceChargePrice = res.record.price - this.openModal('dongjie') - } - }) + 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(() => { }) }, - handleEx() { - const { querys } = this - this.exportLoading = true - recordExport({ - param: { - ...querys - } - }).then((res) => { - this.exportLoading = false - if (res.errorCode === '000000') { - const a = document.createElement('a') // 鍒涘缓涓�涓猘鏍囩鍏冪礌 - a.style.display = 'none' // 璁剧疆鍏冪礌涓嶅彲瑙� - a.href = res.record.showUrl // 璁剧疆涓嬭浇鍦板潃 - document.body.appendChild(a) // 鍔犲叆 - a.click() // 瑙﹀彂鐐瑰嚮,涓嬭浇 - document.body.removeChild(a) // - this.$message.success('瀵煎嚭鎴愬姛') - } - }) - .catch(() => { - this.exportLoading = false - }) + openCan(row) { + this.isShowCan = true + this.canList = [row] }, - handleDisable(row, index) { - if (row.status === '2') { - return false - } else { - return true - } + handleDisable(row) { + // return row.status == 0 + return true }, // 鏌ヨ琛ㄦ牸鏁版嵁 getList(page) { - const { querys, pagination } = this - if (page) { - pagination.page = page - this.pagination.page = Number(page) - } - if (querys.indate && querys.indate.length > 0) { - querys.startTime = querys.indate[0] - querys.endTime = querys.indate[1] - } else { - querys.startTime = null - querys.endTime = null - } - pagination.firstQueryTime = parseTime(new Date()) - this.saleRecordLoading = true - comboSalesRecordPost({ - pagination, param: { - ...querys, - venueId: sessionStorage.getItem('venueId') - } + const { pagination, filters } = this + this.loading = true + if (page) { pagination.page = page } + comboSalePage({ + model: { + ...filters + }, + capacity: pagination.pageSize, + page: pagination.page, }).then(res => { - this.saleRecordLoading = false - if (res.errorCode === '000000') { - this.saleRecordLoading = false - this.saleRecordTotal = res.totalCount - this.saleRecordList = res.recordList - if (res.totalCount && res.recordList.length === 0 && pagination.page > 1) { - this.getList(Math.ceil(res.totalCount / pagination.rows)) - } - } - }).catch(() => { - this.saleRecordLoading = false + this.loading = false + this.list = res.records || [] + this.pagination.total = res.total || 0 + }, () => { + this.loading = false }) }, clearQueryForm() { @@ -288,19 +254,11 @@ }, // 鎵撳紑modal 鍐荤粨 瑙e喕 浣滃簾 openModal(type) { - const { selectSalesList } = this + const { selList } = this this.ModelRemark = '' this.adjustData.addNum = '' this.adjustData.addTime = '' switch (type) { - case 'dongjie': - this.ModalTitle = '濂楅鍐荤粨' - this.ModalText = '纭畾鍐荤粨閫変腑濂楅鍚楋紵鍐荤粨鍚庯紝濂楅灏嗘棤娉曚娇鐢�' - break - case 'jiedong': - this.ModalTitle = '濂楅瑙e喕' - this.ModalText = '纭畾瑙e喕閫変腑濂楅鍚楋紵瑙e喕鍚庯紝濂楅鍙珛鍗崇敓鏁堜娇鐢�' - break case 'zuofei': this.ModalTitle = '濂楅浣滃簾' this.ModalText = '纭畾浣滃簾閫変腑濂楅鍚楋紵浣滃簾鍚庯紝濂楅涓嶅彲浣跨敤' @@ -311,28 +269,21 @@ default: break } - if (selectSalesList.length === 0 && type !== 'dongjie') { - return this.$message.warning(`璇峰厛閫夋嫨瑕�${this.ModalTitle.slice(2)}鐨勫椁恅) + 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.isShowModal = true + this.isShowCan = true } }, // 纭畾 鍐荤粨 瑙e喕 浣滃簾 handleModelEnter() { - // if (!this.ModelRemark) { - // this.$message.warning('鎿嶄綔澶囨敞蹇呭~') - // return - // } switch (this.ModalTitle) { - case '濂楅鍐荤粨': - this.Freeze() - break - case '濂楅瑙e喕': - this.Unfreeze() - break case '濂楅浣滃簾': this.cancellation() break @@ -343,92 +294,27 @@ break } }, - // 鍐荤粨 - Freeze() { - const that = this - const data = { - type: '1', - handleRemake: this.ModelRemark, - isCreateOrder: '1', - id: this.serviceChargeId - } - this.subLoading = true - handleComboSalesPost({ param: { ...data } }).then(res => { - this.subLoading = false - this.isShowModal = false - if (res.errorCode === '000000') { - const obj = res.record - if (obj && obj.price) { - obj.goodsInfos = obj.serviceChargeOrderInfo - obj.allPrice = obj.price - this.$refs.child.continuePay(obj, 'handlingFees') - } else { - this.$message.success('鍐荤粨鎴愬姛') - this.getList() - } - // - } else if (res.errorCode === '200001') { - this.$confirm('瀛樺湪鏈鐞嗚鍗�, 鏄惁璺宠浆?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning', - callback: () => { }, - beforeClose: (action, ctx, close) => { - if (action !== 'confirm') { - close() - return - } - ctx.confirmButtonLoading = true - that.$router.push({ name: 'HandlingFees' }) - } - }).finally(() => { - this.subLoading = false - this.isShowModal = false - }) - } - }) - }, - // 瑙e喕 - async Unfreeze() { - const data = { - type: '2', - handleRemake: this.ModelRemark, - id: this.selectSalesList.map(i => i.id).join(',') - } - this.subLoading = true - const res = await handleComboSalesPost({ param: { ...data } }).catch(() => { - this.subLoading = false - this.isShowModal = false - }) - this.subLoading = false - this.isShowModal = false - if (res && res.errorCode === '000000') { - this.$message.success('瑙e喕鎴愬姛') - this.getList() - } - }, // 璋冩暣 async handleAdjust() { if (!this.adjustData.addNum && !this.adjustData.addTime) { - return this.$message.warning('璇疯緭鍏ヨ璋冩暣鐨勬湁鏁堟湡澶╂暟鎴栬�呬綑閲忔鏁�') + return Message.warning('璇疯緭鍏ヨ璋冩暣鐨勬湁鏁堟湡澶╂暟鎴栬�呬綑閲忔鏁�') } const data = { - type: '3', - handleRemake: this.ModelRemark, - addNum: this.adjustData.addNum || 0, - addTime: this.adjustData.addTime || 0, - id: this.selectSalesList.map(i => i.id).join(',') + 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 handleComboSalesPost({ param: { ...data } }).catch(() => { + const res = await comboSaleAdjust({ ...data }).catch(() => { this.subLoading = false - this.isShowModal = false + this.isShowCan = false }) this.subLoading = false - this.isShowModal = false - if (res && res.errorCode === '000000') { - this.$message.success('濂楅璋冩暣鎴愬姛') + this.isShowCan = false + if (res) { + Message.success('濂楅璋冩暣鎴愬姛') this.getList() this.isShowAdjust = false } @@ -436,36 +322,46 @@ // 浣滃簾 async cancellation() { const data = { - type: '4', - handleRemake: this.ModelRemark, - id: this.selectSalesList.map(i => i.id).join(',') + handleRemake: this.remarkCan, + choseIdList: this.selList.map(i => i.id) } this.subLoading = true - const res = await handleComboSalesPost({ param: { ...data } }).catch(() => { + const res = await comboSaleCancel({ ...data }).catch(() => { this.subLoading = false - this.isShowModal = false + this.isShowCan = false }) this.subLoading = false - this.isShowModal = false - if (res && res.errorCode === '000000') { - this.$message.success('浣滃簾鎴愬姛') + 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.selectSalesList = val + this.selList = val }, comboDetail(item) { - this.isShowDetail = true this.$nextTick(() => { - this.$refs.detailRef.isShowModal = true - this.$refs.detailRef.comboDetail(item) + this.$refs.DetailRef.isShowModal = true + this.$refs.DetailRef.getDetail(item) }) - - // this.$router.push({ - // name: 'comboDetail', - // query: item - // }) }, pageSizeChange(val) { this.pagination.rows = val @@ -484,9 +380,9 @@ text-align: right; } } - .el-dialog__body{ - - } + + .el-dialog__body {} + .text_warning { color: #e89e42; } -- Gitblit v1.9.3