优化结算订单
This commit is contained in:
parent
861e62ce15
commit
2b8910f6a1
|
|
@ -5,7 +5,7 @@
|
|||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="Content-Security-Policy" />
|
||||
<title>Vite + Vue</title>
|
||||
<title>银收客</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
|
|
|||
|
|
@ -77,3 +77,16 @@ export function queryOrder(params) {
|
|||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印
|
||||
* @param {*} params
|
||||
* @returns
|
||||
*/
|
||||
export function print(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "cloudPrinter/print",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
|
@ -186,6 +186,9 @@ async function queryPayTypeAjax() {
|
|||
shopId: store.userInfo.shopId
|
||||
})
|
||||
payList.value = res
|
||||
if (res[0].payType == 'scanCode') {
|
||||
scanModalRef.value.show()
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,11 @@
|
|||
</div>
|
||||
<div class="input">
|
||||
<el-input ref="inputRef" v-model="scanCode"
|
||||
style="height: calc(var(--el-component-size-large) + 20px);" placeholder="请扫描付款码"
|
||||
@keydown.enter="enterHandle" clearable></el-input>
|
||||
style="height: calc(var(--el-component-size-large) + 30px);" placeholder="请扫描付款码" clearable
|
||||
@change="inputChange"></el-input>
|
||||
<div class="tips">注意:扫码支付请保证输入框获得焦点</div>
|
||||
</div>
|
||||
<div class="number_warp">
|
||||
<!-- <div class="number_warp">
|
||||
<div class="item" v-for="item in 9" :key="item" @click="inputHandle(item)">{{ item }}</div>
|
||||
<div class="item disabled">.</div>
|
||||
<div class="item" @click="inputHandle(0)">0</div>
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
<CloseBold />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="btn">
|
||||
<el-button type="primary" style="width: 100%;" v-loading="loading"
|
||||
@click="submitHandle">立即支付</el-button>
|
||||
|
|
@ -160,13 +161,14 @@ function delHandle() {
|
|||
}
|
||||
|
||||
// 监听扫码枪回车事件
|
||||
function enterHandle() {
|
||||
inputRef.value.focus()
|
||||
}
|
||||
// function enterHandle() {
|
||||
// inputRef.value.focus()
|
||||
// }
|
||||
|
||||
// const inputChange = _.debounce(function (e) {
|
||||
// console.log(e);
|
||||
// }, 300)
|
||||
const inputChange = _.debounce(function (e) {
|
||||
// console.log(e);
|
||||
submitHandle()
|
||||
}, 500)
|
||||
|
||||
function show() {
|
||||
dialogVisible.value = true
|
||||
|
|
@ -192,6 +194,11 @@ defineExpose({
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.tips {
|
||||
padding-top: 10px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.dialog :deep(.el-dialog__body) {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
|
@ -263,9 +270,9 @@ defineExpose({
|
|||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding-top: 20px;
|
||||
}
|
||||
// .btn {
|
||||
// padding-top: 20px;
|
||||
// }
|
||||
}
|
||||
|
||||
.pay_wait {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="header">
|
||||
<div class="menus scroll-x">
|
||||
<div class="item" :class="{ active: categorysActive == index }" v-for="(item, index) in categorys"
|
||||
:key="item.id" @click="changeCategory(item, index)">
|
||||
:key="item.id" @click="changeCategory(index)">
|
||||
<el-text>{{ item.name }}</el-text>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -58,6 +58,7 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import _ from 'lodash'
|
||||
import useStorage from "@/utils/useStorage";
|
||||
|
||||
import skuModal from '@/components/skuModal.vue'
|
||||
|
||||
|
|
@ -78,7 +79,6 @@ const skuModalRef = ref(null)
|
|||
|
||||
const shopListType = ref('text')
|
||||
|
||||
const categoryId = ref('')
|
||||
const categorys = ref([])
|
||||
const categorysActive = ref(0)
|
||||
|
||||
|
|
@ -135,16 +135,41 @@ function changeShopListType() {
|
|||
} else {
|
||||
shopListType.value = 'text'
|
||||
}
|
||||
useStorage.set('shopListType', shopListType.value)
|
||||
}
|
||||
|
||||
// 从本地更新商品显示模式
|
||||
function localUpdateShopListType() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let type = useStorage.get('shopListType')
|
||||
if (type != null) {
|
||||
shopListType.value = type
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
// 切换分类
|
||||
function changeCategory(item, index) {
|
||||
function changeCategory(index) {
|
||||
showPopover.value = false
|
||||
categorysActive.value = index
|
||||
categoryId.value = item.id
|
||||
|
||||
useStorage.set('categorysActive', index)
|
||||
|
||||
productqueryCommodityInfoAjax()
|
||||
}
|
||||
|
||||
// 从本地更新已选择的选项
|
||||
function updateCategoryActive() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let index = useStorage.get('categorysActive')
|
||||
if (index != null) {
|
||||
categorysActive.value = index
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
// 查询分类信息
|
||||
async function queryCategoryAjax() {
|
||||
try {
|
||||
|
|
@ -169,7 +194,7 @@ async function productqueryCommodityInfoAjax() {
|
|||
loading.value = true
|
||||
const res = await productqueryCommodityInfo({
|
||||
shopId: store.userInfo.shopId,
|
||||
categoryId: categoryId.value,
|
||||
categoryId: categorys.value[categorysActive.value].id,
|
||||
commdityName: commdityName.value,
|
||||
page: 1,
|
||||
pageSize: 500,
|
||||
|
|
@ -185,6 +210,8 @@ async function productqueryCommodityInfoAjax() {
|
|||
|
||||
// 更新商品数据
|
||||
async function updateData() {
|
||||
localUpdateShopListType()
|
||||
await updateCategoryActive()
|
||||
await queryCategoryAjax()
|
||||
await productqueryCommodityInfoAjax()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
<div class="master_id">{{ props.masterId }}</div>
|
||||
<div class="btm">
|
||||
<span class="p">服务员:{{ store.userInfo.shopName || '暂无' }}</span>
|
||||
<span class="t">03-01 09:05</span>
|
||||
<span class="t">{{ props.orderInfo.createdAt &&
|
||||
dayjs(props.orderInfo.createdAt).format('MM-DD HH:mm') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -47,12 +48,12 @@
|
|||
<el-checkbox v-model="isPrint" border label="打印结算小票" style="width: 100%;" />
|
||||
</div>
|
||||
<div class="print">
|
||||
<el-button type="primary" @click="printHandle">打印预结单</el-button>
|
||||
<el-button type="primary" v-loading="printLoading" @click="printHandle">打印预结单</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pay_wrap">
|
||||
<payCard :amount="props.amount" :orderId="props.orderId" @paySuccess="paySuccess" />
|
||||
<payCard :amount="props.amount" :orderId="props.orderInfo.id" @paySuccess="paySuccess" />
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
|
|
@ -62,6 +63,9 @@
|
|||
import { ref } from 'vue'
|
||||
import { useUser } from "@/store/user.js"
|
||||
import payCard from '@/components/payCard/payCard.vue'
|
||||
import { print } from '@/api/pay'
|
||||
import { ElMessage } from "element-plus";
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
import { ipcRenderer } from 'electron'
|
||||
|
||||
|
|
@ -69,6 +73,8 @@ const store = useUser()
|
|||
|
||||
const emit = defineEmits('paySuccess')
|
||||
|
||||
const printLoading = ref(false)
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const props = defineProps({
|
||||
cart: {
|
||||
|
|
@ -83,8 +89,8 @@ const props = defineProps({
|
|||
type: String,
|
||||
default: ''
|
||||
},
|
||||
orderId: {
|
||||
type: [String, Number],
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: ''
|
||||
},
|
||||
masterId: {
|
||||
|
|
@ -95,16 +101,29 @@ const props = defineProps({
|
|||
|
||||
const isPrint = ref(true)
|
||||
|
||||
function printHandle() {
|
||||
if (!isPrint.value) return
|
||||
const data = {
|
||||
shop_name: store.userInfo.merchantName,
|
||||
carts: props.cart,
|
||||
amount: props.amount,
|
||||
remark: props.remark,
|
||||
orderId: props.orderId
|
||||
async function printHandle() {
|
||||
// if (!isPrint.value) return
|
||||
// const data = {
|
||||
// shop_name: store.userInfo.merchantName,
|
||||
// carts: props.cart,
|
||||
// amount: props.amount,
|
||||
// remark: props.remark,
|
||||
// orderId: props.orderId
|
||||
// }
|
||||
// ipcRenderer.send('printerInfoSync', JSON.stringify(data))
|
||||
try {
|
||||
printLoading.value = true
|
||||
await print({
|
||||
type: 'normal',
|
||||
ispre: true,
|
||||
orderId: props.orderInfo.id
|
||||
})
|
||||
printLoading.value = false
|
||||
ElMessage.success('打印成功')
|
||||
} catch (error) {
|
||||
printLoading.value = false
|
||||
console.log(error)
|
||||
}
|
||||
ipcRenderer.send('printerInfoSync', JSON.stringify(data))
|
||||
}
|
||||
|
||||
// 订单已支付
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@
|
|||
<takeFoodCode ref="takeFoodCodeRef" title="修改取餐号" placeholder="请输入取餐号" @success="takeFoodCodeSuccess" />
|
||||
<!-- 结算订单 -->
|
||||
<settleAccount ref="settleAccountRef" :cart="cartList" :amount="cartInfo.totalAmount" :remark="remark"
|
||||
:orderId="orderId" :masterId="masterId" @paySuccess="createCodeAjax(1)" />
|
||||
:masterId="masterId" :orderInfo="orderInfo" @paySuccess="createCodeAjax(1)" />
|
||||
<!-- 挂起订单 -->
|
||||
<pendingCartModal ref="pendingCartModalRef" @select="pendingCartHandle" />
|
||||
</template>
|
||||
|
|
@ -142,7 +142,7 @@ const cartList = ref([])
|
|||
const cartInfo = ref({})
|
||||
const cartLoading = ref(false)
|
||||
|
||||
const orderId = ref('')
|
||||
const orderInfo = ref({})
|
||||
const createOrderLoading = ref(false)
|
||||
|
||||
// 取餐码
|
||||
|
|
@ -160,7 +160,7 @@ async function createOrderHandle() {
|
|||
shopId: store.userInfo.shopId,
|
||||
remark: remark.value
|
||||
})
|
||||
orderId.value = res
|
||||
orderInfo.value = res
|
||||
settleAccountRef.value.show()
|
||||
createOrderLoading.value = false
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default defineConfig({
|
|||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://cashierclient.sxczgkj.cn/cashier-client', // 测试
|
||||
target: 'https://cashierclient.sxczgkj.cn/cashier-client', // 线上
|
||||
// target: 'http://192.168.2.27:10587/cashier-client', // 国成
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
|
|
|
|||
Loading…
Reference in New Issue