增加部分公共样式
修改部分公共组件代码 修改台桌,代课下单逻辑代码 增加支付页面 修改用户列表页面
This commit is contained in:
@@ -9,9 +9,10 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-40 u-flex ">
|
||||
<view>应付金额</view>
|
||||
<view>实收金额</view>
|
||||
<view class="u-m-l-32 border-bottom u-flex-1">
|
||||
<uni-easyinput style="digit" @input="currentPriceChange" paddingNone :inputBorder="false" v-model="form.currentPrice"
|
||||
<uni-easyinput style="digit" @input="currentPriceInput" @change="currentPriceChange" paddingNone :inputBorder="false"
|
||||
v-model="form.currentPrice"
|
||||
placeholder="输入实际金额"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
@@ -19,7 +20,8 @@
|
||||
<view>优惠折扣</view>
|
||||
<view class="u-m-l-32 u-flex-1 u-flex border-bottom">
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput @input="discountChange" style="digit" paddingNone :inputBorder="false" v-model="form.discount"
|
||||
<uni-easyinput @input="discountInput" @change="discountChange" style="digit" paddingNone :inputBorder="false"
|
||||
v-model="form.discount"
|
||||
placeholder="输入折扣"></uni-easyinput>
|
||||
</view>
|
||||
<view class="u-font-32 color-333">%</view>
|
||||
@@ -32,7 +34,7 @@
|
||||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" showShadow>修改</my-button>
|
||||
<my-button type="cancel" bgColor="#fff" >取消</my-button>
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -43,11 +45,12 @@
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref
|
||||
ref,watch
|
||||
} from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
@@ -57,23 +60,42 @@
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
price:{
|
||||
type:Number,
|
||||
default:0
|
||||
price: {
|
||||
type: [Number,String],
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
|
||||
function currentPriceInput(newval){
|
||||
form.discount=(newval*100/form.price).toFixed()
|
||||
}
|
||||
function discountInput(newval){
|
||||
form.currentPrice=(form.price*newval/100).toFixed(2)
|
||||
}
|
||||
function currentPriceChange(newval){
|
||||
nextTick(()=>{
|
||||
form.discount=(newval*100/form.price).toFixed()
|
||||
})
|
||||
if(newval<0){
|
||||
form.currentPrice=0
|
||||
form.discount=100
|
||||
return infoBox.showToast('实收金额不能小于0')
|
||||
}
|
||||
if(newval>props.price){
|
||||
form.currentPrice=props.price
|
||||
form.discount=0
|
||||
return infoBox.showToast('实收金额不能大于应付金额')
|
||||
}
|
||||
}
|
||||
function discountChange(newval){
|
||||
nextTick(()=>{
|
||||
form.currentPrice=(form.price*newval/100).toFixed(2)
|
||||
})
|
||||
if(newval<0){
|
||||
form.currentPrice=props.price
|
||||
form.discount=0
|
||||
return infoBox.showToast('优惠折扣不能小于0')
|
||||
}
|
||||
if(newval>100){
|
||||
form.discount=100
|
||||
form.currentPrice=0
|
||||
return infoBox.showToast('优惠折扣不能大于100')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const $form = {
|
||||
price:props.price,
|
||||
currentPrice: props.price,
|
||||
@@ -82,7 +104,11 @@
|
||||
const form = reactive({
|
||||
...$form
|
||||
})
|
||||
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
form.currentPrice=newval
|
||||
})
|
||||
function resetForm() {
|
||||
Object.assign(form, {
|
||||
...$form
|
||||
@@ -78,12 +78,17 @@
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||
const props = defineProps({
|
||||
price: {
|
||||
type: [Number,String],
|
||||
default: 0
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
@@ -93,7 +98,9 @@
|
||||
default: []
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
function changeCauses(item) {
|
||||
item.checked = !item.checked
|
||||
}
|
||||
@@ -151,7 +158,11 @@
|
||||
const form = reactive({
|
||||
...$form
|
||||
})
|
||||
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
form.currentPrice=newval
|
||||
})
|
||||
function resetForm() {
|
||||
Object.assign(form, {
|
||||
...$form
|
||||
|
||||
@@ -207,10 +207,10 @@
|
||||
|
||||
</view>
|
||||
|
||||
<model-discount title="菜品打折/减免" :ref="setModel" name="discount"></model-discount>
|
||||
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
|
||||
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
|
||||
<my-remark title="单品备注" :ref="setModel" name="remark"></my-remark>
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney"></edit-discount>
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
import modelDiscount from './components/discount'
|
||||
import giveFood from './components/give-food'
|
||||
import myRemark from './components/remark'
|
||||
import editDiscount from './components/edit-discount'
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
returnBoolean
|
||||
@@ -362,7 +362,6 @@
|
||||
})
|
||||
const allPrice = computed(() => {
|
||||
return goods.list.reduce((prve, cur) => {
|
||||
console.log(cur.salePrice * cur.number);
|
||||
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
|
||||
}, 0).toFixed(2)
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
|
||||
<view class="u-font-32">
|
||||
<text>共</text>
|
||||
<text class="color-main font-bold"> {{goodsNumber}}</text>
|
||||
@@ -39,7 +39,7 @@
|
||||
</view>
|
||||
<view>
|
||||
<text>小计¥</text>
|
||||
<text class="font-bold u-font-32">16.00</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -47,10 +47,12 @@
|
||||
<view></view>
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">16.00</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<my-button type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||
<view class="u-m-t-30">
|
||||
<my-button type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -86,7 +88,9 @@
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.border-bottom{
|
||||
border-color: rgb(240, 240, 240);
|
||||
}
|
||||
.tag {
|
||||
padding: 2rpx 8rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>订单状态</view>
|
||||
<view>未支付</view>
|
||||
<view>{{returnStatus(data.status)}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>订单类型</view>
|
||||
@@ -10,7 +10,7 @@
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>桌位号</view>
|
||||
<view>A6</view>
|
||||
<view>{{table.name}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>就餐人数</view>
|
||||
@@ -28,10 +28,6 @@
|
||||
<view>下单时间</view>
|
||||
<view>2024-08-31 15:54:40</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>下单时间</view>
|
||||
<view>2024-08-31 15:54:40</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>订单编号</view>
|
||||
<view>2024083115544056362</view>
|
||||
@@ -44,6 +40,23 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table:{
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
|
||||
const statusMap={
|
||||
unpaid:'未支付'
|
||||
}
|
||||
function returnStatus(status){
|
||||
return statusMap[status]||''
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
<user-vue></user-vue>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<text class="color-666">桌位号:</text>
|
||||
<text class="font-bold">A6</text>
|
||||
<text class="font-bold">{{options.name}}</text>
|
||||
</view>
|
||||
<goods-list :data="orderDetail.goodsList"></goods-list>
|
||||
<order-vue></order-vue>
|
||||
<order-vue :data="orderDetail.info" :table="options"></order-vue>
|
||||
<step-vue></step-vue>
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view class="u-fixed bottom bg-fff ">
|
||||
@@ -16,7 +16,8 @@
|
||||
shape="circle" plain type="primary">加菜</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button borderRadius="0 100rpx 100rpx 0" shape="circle" type="primary" >结账</my-button>
|
||||
<my-button @tap="toPay" borderRadius="0 100rpx 100rpx 0" shape="circle"
|
||||
type="primary">结账</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -31,36 +32,76 @@
|
||||
import stepVue from './components/step.vue';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
onLoad,onHide
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive
|
||||
} from 'vue';
|
||||
import OrderDetail from './page.js'
|
||||
const uiPage=new OrderDetail()
|
||||
setTimeout(()=>{
|
||||
uiPage.setVal('user',{name:1})
|
||||
},1500)
|
||||
|
||||
const uiPage = new OrderDetail()
|
||||
setTimeout(() => {
|
||||
uiPage.setVal('user', {
|
||||
name: 1
|
||||
})
|
||||
}, 1500)
|
||||
|
||||
function diancan() {
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: options.tableId,
|
||||
tableName: options.name
|
||||
})
|
||||
}
|
||||
|
||||
const orderDetail=reactive({
|
||||
goodsList:[]
|
||||
|
||||
function toPay() {
|
||||
go.to('PAGES_CRESATE_ORDER_PAY', {
|
||||
...orderDetail.info,
|
||||
tableId: options.tableId,
|
||||
tableName: options.name,
|
||||
masterId: options.masterId,
|
||||
})
|
||||
}
|
||||
|
||||
const orderDetail = reactive({
|
||||
goodsList: [],
|
||||
info: {}
|
||||
})
|
||||
const options = reactive({})
|
||||
async function init(){
|
||||
const {masterId}=await Api.$getMasterId(options)
|
||||
async function init() {
|
||||
const {
|
||||
masterId
|
||||
} = await Api.$getMasterId(options)
|
||||
console.log(masterId);
|
||||
const {records} = await Api.getCart({
|
||||
...options,masterId
|
||||
options.masterId=masterId
|
||||
const {
|
||||
records
|
||||
} = await Api.getCart({
|
||||
...options,
|
||||
masterId
|
||||
})
|
||||
orderDetail.goodsList=records
|
||||
orderDetail.goodsList = records
|
||||
const info = await Api.$createOrder({
|
||||
masterId,
|
||||
vipUserId: '',
|
||||
tableId: options.tableId,
|
||||
note: '',
|
||||
postPay: true,
|
||||
orderld: ''
|
||||
})
|
||||
orderDetail.info = info
|
||||
}
|
||||
function watchEmit(){
|
||||
uni.$off('orderDetail:update')
|
||||
uni.$once('orderDetail:update',(newval)=>{
|
||||
console.log(newval);
|
||||
init()
|
||||
})
|
||||
}
|
||||
onShow(()=>{
|
||||
watchEmit()
|
||||
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log(options);
|
||||
|
||||
209
jeepay-ui-uapp-merchant/pagesCreateOrder/pay-order/pay-order.vue
Normal file
209
jeepay-ui-uapp-merchant/pagesCreateOrder/pay-order/pay-order.vue
Normal file
@@ -0,0 +1,209 @@
|
||||
<template>
|
||||
<view class="bg-gray min-page u-p-30 u-font-28">
|
||||
<view class="u-p-t-60 u-p-b-60 u-text-center">
|
||||
<view class="u-font-32 ">
|
||||
<text class="price-fuhao">¥</text>
|
||||
<text class="font-bold price">{{order.amount}}</text>
|
||||
</view>
|
||||
<view class="u-m-t-10 color-999 old-price">
|
||||
<text class="">¥</text>
|
||||
<text class=" ">{{order.amount}}</text>
|
||||
</view>
|
||||
<view class="u-m-t-10 u-flex u-row-center color-main">
|
||||
<view @click="showModel('editMoney',true)">修改</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 u-m-t-30">
|
||||
<view class="u-flex border-bottom-dashed u-row-between u-p-b-30">
|
||||
<view>优惠券</view>
|
||||
<view class="color-999 u-flex u-col-center">
|
||||
<text>选择优惠券</text>
|
||||
<view class="u-flex u-col-center">
|
||||
<uni-icons type="right"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
||||
<my-tabs :list="pays.list"></my-tabs>
|
||||
<view class="list">
|
||||
<view class="item" @click="changePayType(index)" v-for="(item,index) in pays.payTypes.list"
|
||||
:key="index">
|
||||
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
||||
<view class="u-flex">
|
||||
<image class="icon" :src="item.icon" mode=""></image>
|
||||
<text class="u-m-l-10">{{item.payName}}</text>
|
||||
</view>
|
||||
<view class="u-flex color-999 u-font-24">
|
||||
<!-- <view class="u-m-r-20">
|
||||
<text>余额:</text>
|
||||
<text>¥0.00</text>
|
||||
</view> -->
|
||||
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
|
||||
</my-radio>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-m-t-60 u-p-b-30">
|
||||
<my-button @click="payOrder">确认付款</my-button>
|
||||
</view>
|
||||
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="order.amount"></edit-discount>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
const pays = reactive({
|
||||
list: ['普通支付', '混合支付'],
|
||||
payTypes: {
|
||||
list: [],
|
||||
selIndex: 0
|
||||
}
|
||||
})
|
||||
|
||||
const models = new Map();
|
||||
|
||||
function setModel(el) {
|
||||
if (el && el.$attrs['name']) {
|
||||
models.set(el.$attrs['name'], el);
|
||||
}
|
||||
}
|
||||
|
||||
function showModel(key) {
|
||||
const model = models.get(key)
|
||||
model && model.open()
|
||||
}
|
||||
|
||||
async function getPayType() {
|
||||
const payTypeList = await Api.$getPayType()
|
||||
pays.payTypes.list = payTypeList.filter(v=>v.payType!='scanCode')
|
||||
}
|
||||
|
||||
function changePayType(i) {
|
||||
pays.payTypes.selIndex = i
|
||||
}
|
||||
|
||||
async function payOrder() {
|
||||
const payType=pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
await Api.$payOrder({
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id,
|
||||
payType,
|
||||
vipUserId: order.userId,
|
||||
discount: 1,
|
||||
code: ''
|
||||
})
|
||||
infoBox.showToast('支付成功')
|
||||
setTimeout(()=>{
|
||||
uni.$emit('orderDetail:update')
|
||||
uni.navigateBack()
|
||||
},500)
|
||||
}
|
||||
onMounted(() => {
|
||||
getPayType()
|
||||
})
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(order, opt)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box-shadow {
|
||||
box-shadow: 0 0 5px #eee;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.border-bottom-dashed {
|
||||
border-bottom: 1px dashed #bbb;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-color: rgb(240, 240, 240);
|
||||
}
|
||||
|
||||
.list {
|
||||
.item:last-child {
|
||||
.border-bottom {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.old-price {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.price-fuhao {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
$dotSize: 20rpx;
|
||||
$position: calc($dotSize / (-2));
|
||||
|
||||
.card {
|
||||
position: relative;
|
||||
|
||||
&::after,
|
||||
&:before {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
background-color: #F9F9F9;
|
||||
width: $dotSize;
|
||||
height: $dotSize;
|
||||
box-shadow: 0 0 5px #eee;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
&.top {
|
||||
&::after {
|
||||
right: $position;
|
||||
bottom: $position;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: $position;
|
||||
bottom: $position;
|
||||
}
|
||||
}
|
||||
|
||||
&.bottom {
|
||||
&::after {
|
||||
right: $position;
|
||||
top: $position;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: $position;
|
||||
top: $position;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user