新增团购券订单

This commit is contained in:
gyq 2024-05-22 15:37:03 +08:00
parent 94fb2d2c8e
commit d08ef6f271
6 changed files with 137 additions and 92 deletions

View File

@ -1,86 +1 @@
"use strict"; "use strict";const s=require("path"),e=require("electron");let t;e.app.whenReady().then(()=>{t=new e.BrowserWindow({title:"银收客",width:1024,height:768,fullscreenable:!0,fullscreen:!process.env.VITE_DEV_SERVER_URL,simpleFullscreen:!0,frame:!!process.env.VITE_DEV_SERVER_URL,webPreferences:{nodeIntegration:!0,contextIsolation:!1}}),process.env.VITE_DEV_SERVER_URL?t.loadURL(process.env.VITE_DEV_SERVER_URL):t.loadFile(s.resolve(__dirname,"../dist/index.html")),e.app.on("activate",()=>{e.BrowserWindow.getAllWindows().length===0&&createWindow()}),e.ipcMain.on("quitHandler",(r,n)=>{e.app.quit()}),e.ipcMain.on("getPrintList",()=>{t.webContents.getPrintersAsync().then(r=>{t.webContents.send("printList",r)})});const i=new e.BrowserWindow({show:!1,width:464,height:1726,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?i.loadFile(s.join(__dirname,"../public/print.html")):i.loadFile(s.resolve(__dirname,"../dist/print.html")),e.ipcMain.on("printerInfoSync",(r,n)=>{i.webContents.send("getParams",n)}),e.ipcMain.on("printStart",(r,n)=>{console.log(n);let o=JSON.parse(n).deviceName;i.webContents.print({silent:!0,deviceName:o,pageSize:{width:58e3,height:216e3},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})})});e.app.on("window-all-closed",()=>{process.platform!=="darwin"&&e.app.quit()});
const path = require("path");
const electron = require("electron");
let win;
electron.app.whenReady().then(() => {
win = new electron.BrowserWindow({
title: "银收客",
width: 1024,
height: 768,
fullscreenable: true,
fullscreen: process.env.VITE_DEV_SERVER_URL ? false : true,
simpleFullscreen: true,
frame: process.env.VITE_DEV_SERVER_URL ? true : false,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
win.loadURL(process.env.VITE_DEV_SERVER_URL);
} else {
win.loadFile(path.resolve(__dirname, "../dist/index.html"));
}
electron.app.on("activate", () => {
if (electron.BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
electron.ipcMain.on("quitHandler", (_, msg) => {
electron.app.quit();
});
electron.ipcMain.on("getPrintList", () => {
win.webContents.getPrintersAsync().then((res) => {
win.webContents.send("printList", res);
});
});
const printWin = new electron.BrowserWindow({
show: false,
width: 464,
height: 1726,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
printWin.loadFile(path.join(__dirname, "../public/print.html"));
} else {
printWin.loadFile(path.resolve(__dirname, "../dist/print.html"));
}
electron.ipcMain.on("printerInfoSync", (event, arg) => {
printWin.webContents.send("getParams", arg);
});
electron.ipcMain.on("printStart", (event, arg) => {
console.log(arg);
const _parmas = JSON.parse(arg);
let name = _parmas.deviceName;
printWin.webContents.print({
silent: true,
deviceName: name,
pageSize: {
width: 58e3,
height: 216e3
},
scaleFactor: 80,
landscape: false,
margins: {
marginType: "none",
top: 0,
bottom: 0,
left: 0,
right: 0
},
dpi: {
horizontal: 203,
vertical: 203
}
});
});
});
electron.app.on("window-all-closed", () => {
if (process.platform !== "darwin")
electron.app.quit();
});

View File

@ -1,7 +1,7 @@
{ {
"name": "vite-electron", "name": "vite-electron",
"private": true, "private": true,
"version": "1.1.9", "version": "1.1.10",
"main": "dist-electron/main.js", "main": "dist-electron/main.js",
"scripts": { "scripts": {
"dev": "chcp 65001 && vite", "dev": "chcp 65001 && vite",

View File

@ -38,3 +38,16 @@ export function groupOrdergroupScan(params) {
params, params,
}); });
} }
/**
* 退单
* @param {*} data
* @returns
*/
export function returnGpOrder(data) {
return request({
method: "post",
url: "/pay/returnGpOrder",
data,
});
}

View File

@ -0,0 +1,111 @@
<template>
<el-dialog title="退款" v-model="showDialog" width="400px" @close="reset">
<el-form ref="refundFormRef" :model="refundForm" :rules="refundFormRules" label-position="top">
<el-form-item label="退单数" prop="num">
<el-select v-model="refundForm.num" placeholder="请选择退单数" style="width: 100%;" @change="refundNumChange">
<el-option :label="item" :value="item" v-for="item in refundNumList" :key="item"></el-option>
</el-select>
</el-form-item>
<el-form-item label="退单金额">
<el-input v-model="refundForm.refundAmount" disabled placeholder="请选择退单数"></el-input>
</el-form-item>
<el-form-item label="退款原因">
<el-input v-model="refundForm.refundReason" type="textarea" placeholder="请输入退款原因"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="showDialog = false" style="width: 100%;">取消</el-button>
<el-button type="primary" :loading="refundLoading" @click="refundConfirm" style="width: 100%;">
</el-button>
</span>
</el-dialog>
</template>
<script setup>
import { returnGpOrder } from '@/api/group'
import { ref, reactive } from 'vue'
import { ElMessage } from "element-plus";
const emits = defineEmits(["success"]);
const newRow = ref('')
const showDialog = ref(false)
const refundLoading = ref(false)
const refundFormRef = ref(null)
const refundForm = reactive({
num: '',
orderId: '',
refundAmount: '',
refundDesc: '',
refundReason: ''
})
const refundFormRules = reactive({
num: [
{
required: true,
message: ' ',
trigger: 'change'
}
]
})
const refundNumList = ref([])
// 退
function refundConfirm() {
refundFormRef.value.validate(async valid => {
if (valid) {
try {
refundLoading.value = true
const res = await returnGpOrder(refundForm)
ElMessage.success('退单成功')
refundLoading.value = false
showDialog.value = false
emits('succcess')
} catch (error) {
console.log(error);
refundLoading.value = false
}
}
})
}
// 退
function refundNumChange(e) {
refundForm.refundAmount = Math.floor(newRow.value.orderAmount / e * 100) / 100
}
//
function show(row) {
showDialog.value = true;
newRow.value = row
let arr = []
for (let i = 1; i <= row.number - row.refundNumber; i++) {
arr.push(i)
}
refundNumList.value = arr
refundForm.orderId = row.id
}
//
function reset() {
newRow.value = ''
refundNumList.value = []
refundForm.orderId = ''
for (let key in refundForm) {
refundForm[key] = ''
}
refundFormRef.value.resetFields()
}
defineExpose({
show
});
</script>
<style scoped lang="scss">
.dialog-footer {
display: flex;
}
</style>

View File

@ -18,8 +18,8 @@
</div> </div>
<div class="tab_container"> <div class="tab_container">
<el-table :data="tableData.list" height="540px" v-loading="tableData.loading"> <el-table :data="tableData.list" height="540px" v-loading="tableData.loading">
<el-table-column label="订单号" prop="orderNo" width="150px"></el-table-column> <el-table-column label="订单号" prop="orderNo" width="100px"></el-table-column>
<el-table-column label="优惠卷" prop="proImg" width="220px"> <el-table-column label="优惠卷" prop="proImg" width="200px">
<template v-slot="scope"> <template v-slot="scope">
<div class="info_wrap"> <div class="info_wrap">
<el-image :src="scope.row.proImg" style="width: 40px;height: 40px;flex-shrink: 0;" /> <el-image :src="scope.row.proImg" style="width: 40px;height: 40px;flex-shrink: 0;" />
@ -54,7 +54,10 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right"> <el-table-column label="操作" fixed="right">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="primary" size="small">退款</el-button> <el-button type="primary" size="small"
v-if="scope.row.refundAble == 1 && scope.row.status == 'unused'"
@click="refundDialogRef.show(scope.row)">退款</el-button>
<el-button type="primary" size="small" disabled v-else>退款</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -67,6 +70,7 @@
</div> </div>
</div> </div>
<scanGroup ref="scanGroupRef" @succcess="groupOrderlistAjax" /> <scanGroup ref="scanGroupRef" @succcess="groupOrderlistAjax" />
<refundDialog ref="refundDialogRef" @success="groupOrderlistAjax" />
</div> </div>
</template> </template>
@ -75,10 +79,12 @@ import { groupOrderlist } from '@/api/group'
import { Search, RefreshRight, MagicStick } from '@element-plus/icons-vue' import { Search, RefreshRight, MagicStick } from '@element-plus/icons-vue'
import { ref, onMounted, reactive } from 'vue' import { ref, onMounted, reactive } from 'vue'
import scanGroup from './components/scanGroup.vue' import scanGroup from './components/scanGroup.vue'
import refundDialog from './components/refundDialog.vue'
import { useUser } from "@/store/user.js" import { useUser } from "@/store/user.js"
const store = useUser() const store = useUser()
const scanGroupRef = ref(null) const scanGroupRef = ref(null)
const refundDialogRef = ref(null)
const tableData = reactive({ const tableData = reactive({
resetLoading: false, resetLoading: false,

View File

@ -9,11 +9,11 @@ export default defineConfig({
server: { server: {
proxy: { proxy: {
'/api': { '/api': {
target: 'http://192.168.2.96:10587/cashier-client', // 阿伟 // target: 'http://192.168.2.96:10587/cashier-client', // 阿伟
// target: 'https://cashierclient.sxczgkj.cn/cashier-client', // 线上 // target: 'https://cashierclient.sxczgkj.cn/cashier-client', // 线上
// target: 'http://192.168.2.116:10587/cashier-client', // 国成 // target: 'http://192.168.2.116:10587/cashier-client', // 国成
// target: 'http://192.168.2.171:10587/cashier-client', // 鹏辉 // target: 'http://192.168.2.171:10587/cashier-client', // 鹏辉
// target: 'https://cashier-client.sxczgkj.cn/cashier-client', // 测试 target: 'https://cashier-client.sxczgkj.cn/cashier-client', // 测试
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '') rewrite: (path) => path.replace(/^\/api/, '')
} }