更新gh分支

This commit is contained in:
GaoHao
2024-09-18 16:41:15 +08:00
parent d13405ee3f
commit ad93d41550
12 changed files with 1026 additions and 50 deletions

View File

@@ -59,7 +59,8 @@
<script setup>
import {
reactive,
onMounted
onMounted,
watch
} from 'vue';
import {
onLoad
@@ -68,7 +69,7 @@
import infoBox from '@/commons/utils/infoBox.js'
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
const pays = reactive({
list: ['普通支付', '混合支付'],
list: ['扫码收款', '二维码收款'],
payTypes: {
list: [],
selIndex: 0
@@ -90,7 +91,7 @@
async function getPayType() {
const payTypeList = await Api.$getPayType()
pays.payTypes.list = payTypeList.filter(v=>v.payType!='scanCode')
pays.payTypes.list = payTypeList
}
function changePayType(i) {
@@ -98,7 +99,7 @@
}
async function payOrder() {
const payType=pays.payTypes.list[pays.payTypes.selIndex].payType
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
await Api.$payOrder({
tableId: order.tableId,
masterId: order.masterId,
@@ -109,10 +110,10 @@
code: ''
})
infoBox.showToast('支付成功')
setTimeout(()=>{
setTimeout(() => {
uni.$emit('orderDetail:update')
uni.navigateBack()
},500)
}, 500)
}
onMounted(() => {
getPayType()
@@ -120,6 +121,29 @@
const order = reactive({
amount: 0
})
function saoma(){
uni.scanCode({
onlyFromCamera: true,
success: function (res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
}
});
}
watch(() => pays.payTypes.selIndex, (index) => {
const item = pays.payTypes.list[index]
if (item.payType == "vipPay") {
return
}
if (item.payType == "deposit") {
//储值卡支付
return saoma()
}
if (item.payType == "scanCode") {
//扫码支付
return saoma()
}
})
onLoad((opt) => {
Object.assign(order, opt)
})