代码更新
This commit is contained in:
parent
fd0c452a76
commit
4f65b08c06
|
|
@ -15,6 +15,20 @@ export function getCouponList(data, urlType = 'account') {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成订单后使用
|
||||
* @returns
|
||||
*/
|
||||
export function getFindCoupon(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/coupon/findCoupon`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺优惠券新增
|
||||
* @returns
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 交班记录-分页
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecord(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handover-record/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 交班记录-查看
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecordView(id, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handover-record/${id}`,
|
||||
method: "GET",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 交班记录-导出
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecordExport(id, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handover-record/export/${id}`,
|
||||
method: "GET",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银机-交班数据统计
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecordTotal(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handover-record/total`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银机-交班/关班
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecordHandover(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handover-record/handover`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
28
api/order.js
28
api/order.js
|
|
@ -15,6 +15,20 @@ export function getOrderList(data, urlType = 'order') {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
* @returns
|
||||
*/
|
||||
export function getOrderById(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/getOrderById`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 历史订单(多次下单使用)
|
||||
* @returns
|
||||
|
|
@ -43,4 +57,18 @@ export function createOrder(data, urlType = 'order') {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款 只传订单id
|
||||
* @returns
|
||||
*/
|
||||
export function refundOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/refundOrder`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export default {
|
|||
label: '退单'
|
||||
},
|
||||
{
|
||||
key: 'part-refund',
|
||||
key: 'part_refund',
|
||||
label: '部分退单'
|
||||
},
|
||||
{
|
||||
|
|
@ -49,21 +49,17 @@ export default {
|
|||
// label: '支付中'
|
||||
// }
|
||||
],
|
||||
sendType: [
|
||||
dineMode: [
|
||||
{
|
||||
key: 'post',
|
||||
label: '快递'
|
||||
},
|
||||
{
|
||||
key: 'takeaway',
|
||||
key: 'take-away',
|
||||
label: '外卖'
|
||||
},
|
||||
{
|
||||
key: 'takeself',
|
||||
key: 'take-out',
|
||||
label: '自提'
|
||||
},
|
||||
{
|
||||
key: 'table',
|
||||
key: 'dine-in',
|
||||
label: '堂食'
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@ export function isTuiCai(item) {
|
|||
return item.status == 'return'
|
||||
}
|
||||
export function isTui(item) {
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||
console.log(item)
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding' || item.status == 'part_refund'
|
||||
}
|
||||
export function isGift(item) {
|
||||
return !isTui(item) && item.payAmount<=0
|
||||
return !isTui(item) && item.isGift == 1
|
||||
}
|
||||
export function numSum(arr) {
|
||||
const sum = arr.reduce((a, b) => {
|
||||
|
|
|
|||
|
|
@ -39,15 +39,15 @@ class WebsocketUtil {
|
|||
// 连接成功后启动心跳和消息监听
|
||||
this.startHeartbeat();
|
||||
this.listenForMessages();
|
||||
// 注意:这里的 onClose 监听器应该放在 uni.connectSocket 调用之后
|
||||
this.socketTask.onClose((result) => {
|
||||
this.isOpen = false;
|
||||
// if( this.isOpen ){
|
||||
this.reconnect();
|
||||
// }
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// 注意:这里的 onClose 监听器应该放在 uni.connectSocket 调用之后
|
||||
this.socketTask.onClose((result) => {
|
||||
this.isOpen = false;
|
||||
// if( this.isOpen ){
|
||||
this.reconnect();
|
||||
// }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,67 +168,13 @@
|
|||
"devServer" : {
|
||||
"disableHostCheck" : true,
|
||||
"proxy" : {
|
||||
"/shopApi" : {
|
||||
"/api" : {
|
||||
// 需要被代理的后台地址
|
||||
"target" : "https://wxcashiertest.sxczgkj.cn/cashierService",
|
||||
"target" : "https://tapi.cashier.sxczgkj.cn",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"^/shopApi" : ""
|
||||
}
|
||||
},
|
||||
"/mch" : {
|
||||
// 需要被代理的后台地址
|
||||
"target" : "https://b.rscygroup.com",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"^/mch" : ""
|
||||
}
|
||||
},
|
||||
"/server1" : {
|
||||
// 需要被代理的后台地址
|
||||
"target" : "http://101.37.12.135:8080",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"^/server1" : ""
|
||||
}
|
||||
},
|
||||
"/server3" : {
|
||||
// 需要被代理的后台地址
|
||||
"target" : "http://101.37.12.135:8080",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"^/server3" : ""
|
||||
}
|
||||
},
|
||||
"/ysk" : {
|
||||
// 需要被代理的后台地址
|
||||
"target" : "https://admintestpapi.sxczgkj.cn",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"/ysk" : ""
|
||||
}
|
||||
},
|
||||
"/yufabu" : {
|
||||
// 需要被代理的后台地址
|
||||
"target" : "https://pre-cashier.sxczgkj.cn",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"/yufabu" : ""
|
||||
}
|
||||
},
|
||||
"/ww" : {
|
||||
// 需要被代理的后台地址
|
||||
"target" : "http://192.168.1.15:8000",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"/ww" : ""
|
||||
"^/api" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<template>
|
||||
<view class=" goods">
|
||||
|
||||
<view class=" u-flex">
|
||||
<view class="u-flex">
|
||||
<up-image width="126rpx" height="126rpx" :src="data.pic" :radius="6"></up-image>
|
||||
<view class=" u-p-l-16 u-flex u-p-r-16 u-flex-1 u-col-top">
|
||||
<view class="u-flex-1">
|
||||
<view class="color-333 font-bold">{{data.name}}</view>
|
||||
<view class="color-333 font-bold" style="word-wrap: break-word;word-break: normal;white-space: normal;">{{data.name}}</view>
|
||||
<view class="color-999 u-m-t-20">
|
||||
<text class="">排序:</text>
|
||||
<text class="u-m-l-10">{{data.sort}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="u-flex" style="flex-shrink: 0;">
|
||||
<text class="u-font-28 color-666" @click="changeClick">修改排序</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@
|
|||
</view>
|
||||
<view>
|
||||
<view> <text style="color: red;">*</text>出库数量 </view>
|
||||
<view> <input type="text" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" name="" id=""> </view>
|
||||
<view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" name="" id=""> </view>
|
||||
</view>
|
||||
<view>
|
||||
<view> <text style="color: red;">*</text>单价 </view>
|
||||
<view> <input type="text" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" name="" id=""> </view>
|
||||
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" name="" id=""> </view>
|
||||
</view>
|
||||
<view style="justify-content: space-between;">
|
||||
<view> 单位 </view>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,4 @@
|
|||
<template>
|
||||
<!-- <view class="viewrecordsType">
|
||||
<view style="display: flex;align-items: center;" @tap="popPu">
|
||||
筛选时间<up-icon style="transform: rotate(90deg);" name="play-right-fill" size="12"></up-icon>
|
||||
</view>
|
||||
<view @tap="showStatus = !showStatus" style="display: flex;align-items: center;">
|
||||
{{datas.statusTitle}} <up-icon style="transform: rotate(90deg);" name="play-right-fill" size="12"></up-icon>
|
||||
</view>
|
||||
|
||||
</view> -->
|
||||
<view style="position: fixed;right: 50rpx;top: 80vh;background-color: #fff;border-radius: 50%;width: 65rpx;height: 65rpx;display: flex;align-items: center;justify-content: center;">
|
||||
<image src="./time.png" style="width: 50rpx;height: 50rpx;" @tap="popPu"
|
||||
mode=""></image>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<view> <text style="color: red;">*</text> 入库时间 </view>
|
||||
<view >
|
||||
<up-datetime-picker
|
||||
<!-- hasInput -->
|
||||
hasInput
|
||||
v-model="datas.form.inOutDate"
|
||||
mode="date"
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@
|
|||
<view class="u-m-t-38">
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="sort">
|
||||
</up-input>
|
||||
<up-input type="number" v-model="sort"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
<template>
|
||||
<view class="safe-page" style="padding-bottom: 230rpx!important;">
|
||||
<view class="bg-fff u-p-l-30 u-p-r-30 ">
|
||||
<view class="myTabs u-m-t-20">
|
||||
<my-tabs :list="pageData.tabsList" :textKey="'label'" @change="tabsChange"></my-tabs>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- 用户列表 -->
|
||||
<template>
|
||||
<view class="input-wrapper u-p-l-30 u-p-r-30 u-p-b-30 bg-fff">
|
||||
|
|
@ -151,7 +156,9 @@
|
|||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
const moreOperate = ref(null)
|
||||
const moreOperateList = ['增减余额', '修改信息', ]
|
||||
|
||||
let datas = reactive({
|
||||
|
||||
show: false,
|
||||
form: {
|
||||
type: '1',
|
||||
|
|
@ -160,7 +167,12 @@
|
|||
},
|
||||
activeUser: null
|
||||
})
|
||||
|
||||
const pageData = reactive({
|
||||
tabsList: [
|
||||
{label: '会员用户', value: 1},
|
||||
{label: '普通用户', value: 0},
|
||||
],
|
||||
search: {
|
||||
placeholder: '搜索昵称、手机号码'
|
||||
},
|
||||
|
|
@ -168,7 +180,7 @@
|
|||
page: 1,
|
||||
size: 10,
|
||||
key: '',
|
||||
// isVip: 1
|
||||
isVip: 1,
|
||||
},
|
||||
showGoodsDetail: false,
|
||||
userList: [],
|
||||
|
|
@ -193,7 +205,7 @@
|
|||
* 获取用户数据统计
|
||||
*/
|
||||
async function getAllShopInfo() {
|
||||
const res = await shopUserSummary({isVip: 1})
|
||||
const res = await shopUserSummary({isVip: pageData.query.isVip})
|
||||
pageData.allShopInfo = res
|
||||
}
|
||||
|
||||
|
|
@ -214,12 +226,22 @@
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* tabs切换
|
||||
* @param {Object} i
|
||||
*/
|
||||
function tabsChange(i) {
|
||||
pageData.query.isVip = pageData.tabsList[i].value
|
||||
getUser()
|
||||
getAllShopInfo()
|
||||
}
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function searchFunc() {
|
||||
pageData.query.page = 1
|
||||
getUser()
|
||||
getAllShopInfo()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,311 +0,0 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class=" u-font-28 min-page bg-gray default-box-padding">
|
||||
<view class="bg-fff border-r-18 default-box-padding">
|
||||
|
||||
<view class="u-m-t-24">
|
||||
<view class="font-bold">开班时间</view>
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom">
|
||||
<view>
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="form.kaibanTime"></uni-dateformat>
|
||||
<text></text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<view class="font-bold">交班时间</view>
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom">
|
||||
<view>
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="form.jiaobanTime"></uni-dateformat>
|
||||
<text></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<view class="font-bold">交班人</view>
|
||||
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom">
|
||||
<view>
|
||||
<text class="color-999" v-if="form.banciItem===''">暂未选择</text>
|
||||
<text v-else>
|
||||
{{form.banciItem.name}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<view class="font-bold">班次</view>
|
||||
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 ">
|
||||
<view>
|
||||
<text class="color-999" v-if="form.banciItem===''">暂未选择</text>
|
||||
<text v-else>
|
||||
{{form.banciItem.name}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="bg-fff u-m-t-32 border-r-18 default-box-padding">
|
||||
<view class="u-flex list u-text-center u-flex-wrap">
|
||||
<view class="item u-m-b-32" v-for="(item,index) in form.infolists" :key="index">
|
||||
<view class="color-666 u-font-24">{{item.name}}</view>
|
||||
<view class="u-m-t-8 color-333">{{item.value}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view style="height: 200rpx;"></view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-fixed bottom u-flex bg-fff ">
|
||||
<view class="u-absolute u-flex" @tap="toggleIsDayin">
|
||||
<label class="radio">
|
||||
<radio @tap.stop="toggleIsDayin" :checked="form.isDayin" class="scale7" />
|
||||
</label>
|
||||
<text class="color-333 u-font-32">打印</text>
|
||||
</view>
|
||||
|
||||
<view class="u-flex-1">
|
||||
<my-button bgColor="#333" color="#fff" borderRadius="100rpx 0 0 100rpx" shape="circle" plain type="primary"
|
||||
@tap="back">返回</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button borderRadius="0 100rpx 100rpx 0" shape="circle" type="primary" @tap="jiaoban">确认交班</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive
|
||||
} from 'vue';
|
||||
import myButton from '@/components/my-components/my-button';
|
||||
const form = reactive({
|
||||
isDayin:false,
|
||||
kaibanTime: '2024-07-29 11:47:28',
|
||||
jiaobanTime: '2024-07-29 11:47:28',
|
||||
banciItem: {
|
||||
name: '班次'
|
||||
},
|
||||
infolists: [{
|
||||
name: '微信实际到账',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '支付宝实际到账',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '订单总数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '订单总额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '订单微信支付额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '订单支付宝支付额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '订单余额支付额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '订单线下支付额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '订单退款成功数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '订单退款成功额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '支付宝退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '余额退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '线下退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '堂食订单数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '自取订单额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '外卖订单数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '外卖订单额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '满减金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '积分抵扣金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '优惠券抵扣金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '会员抵扣金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '堂食退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '堂食实际收入',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '外卖实际收入',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '外卖退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '自取退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '自取实际收入',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '配送费收入',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '配送费退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '配送费实际收入',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '挂账金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '商家减免金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '开通会员数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '开通会员收入',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '充值数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '充值赠送额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '收银笔数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '收银金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '充值额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '微信收银金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '余额收银金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: '支付宝收银金额',
|
||||
value: 0
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
function toggleIsDayin(){
|
||||
form.isDayin=!form.isDayin
|
||||
}
|
||||
|
||||
function back(){
|
||||
uni.navigateBack()
|
||||
}
|
||||
function jiaoban(){
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
.item {
|
||||
width: 33.333%;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
background-color: transparent;
|
||||
bottom: 84rpx;
|
||||
left: 28rpx;
|
||||
right: 28rpx;
|
||||
.u-absolute{
|
||||
bottom: 100%;
|
||||
margin-bottom: 32rpx;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,27 +1,13 @@
|
|||
<template>
|
||||
<view class="top fixed-top bg-fff">
|
||||
<!-- <my-tabs :list="tabs.list" @change="tabsChange"></my-tabs> -->
|
||||
<view class="u-flex color-main u-m-t-32 " v-if="tabs.current===1">
|
||||
<!-- <view class="u-flex u-p-l-20 " @tap="showJiaobanPickerView">
|
||||
<view class=" u-flex u-row-between ">
|
||||
<view>
|
||||
<text class="" v-if="filters.jiaobanSelItem===''">暂未选择</text>
|
||||
<text v-else>
|
||||
{{filters.jiaobanSelItem.name}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="u-flex u-p-l-20 u-flex-1">
|
||||
<image src="/pageWorkControl/static/images/icon-arrow-down-fill.svg"
|
||||
class="icon-arrow-down-fill " mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="u-flex color-main u-m-t-32 ">
|
||||
|
||||
<view class="u-flex u-p-l-20 u-flex-1 u-row-center">
|
||||
<view @tap="timeToggle">
|
||||
<view class=" u-font-24 color-main u-flex" v-if="filters.time.start&&filters.time.end">
|
||||
<text>{{timeFormat(filters.time.start, 'yyyy年mm月dd日') || '开始'}}</text>
|
||||
<view class=" u-font-24 color-main u-flex" v-if="pageData.time.start&&pageData.time.end">
|
||||
<text>{{timeFormat(pageData.time.start, 'yyyy年mm月dd日') || '开始'}}</text>
|
||||
<text class="u-p-l-10 u-p-r-10">至</text>
|
||||
<text>{{timeFormat(filters.time.end, 'yyyy年mm月dd日') || '结束'}}</text>
|
||||
<text>{{timeFormat(pageData.time.end, 'yyyy年mm月dd日') || '结束'}}</text>
|
||||
|
||||
</view>
|
||||
<view class="" v-else>所有时间</view>
|
||||
|
|
@ -33,385 +19,121 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="tabs.current===0">
|
||||
<view class="color-333 u-font-28 min-page bg-gray default-box-padding" style="padding-top: 43px;">
|
||||
<view class="bg-fff border-r-12 default-box-padding">
|
||||
<view>
|
||||
<view class="font-bold">是否打印销售区间的商品数据</view>
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom">
|
||||
<view>
|
||||
<text>
|
||||
{{banci.switchvalue?'打印':'不打印'}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<up-switch v-model="banci.switchvalue"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<!--<view class="font-bold">班次</view>
|
||||
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom" @tap="showJiaobanPickerView">
|
||||
<view>
|
||||
<text class="color-999" v-if="banci.selItem===''">暂未选择</text>
|
||||
<text v-else>
|
||||
{{banci.selItem.name}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <picker @change="banciChange" :value="banci.current" range-key="name" :range="banci.list">
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom">
|
||||
<view>
|
||||
<text class="color-999" v-if="banci.current===''">暂未选择</text>
|
||||
<text v-else>
|
||||
{{banci.list[banci.current].name}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</picker> -->
|
||||
|
||||
</view>
|
||||
<!-- <view class="u-m-t-24">
|
||||
<view class="font-bold">开班时间</view>
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom" @tap="jiaobanStartShow">
|
||||
<view>
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="form.kaibanTime"></uni-dateformat>
|
||||
<text></text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<view class="font-bold">交班时间</view>
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom">
|
||||
<view>
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="form.jiaobanTime"></uni-dateformat>
|
||||
<text></text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="tabs.current===1">
|
||||
<template>
|
||||
<view class="color-333 u-font-28 min-page bg-gray default-box-padding" style="padding-top:80px;">
|
||||
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
||||
<view class="bg-fff border-r-12 u-flex no-wrap u-col-top">
|
||||
<view class="constantbox">
|
||||
<view class="constantboxitem">
|
||||
<view class="head">班次号</view>
|
||||
<!-- <view class="head">班次</view> -->
|
||||
<view class="head">交班人</view>
|
||||
<view class="head">开班时间</view>
|
||||
<view class="head">交班时间</view>
|
||||
<view class="head">订单数</view>
|
||||
<view class="head">订单金额(元)</view>
|
||||
</view>
|
||||
<view class="constantboxitem" v-for="(item,index) in tableData.data" :key="index"
|
||||
<view class="constantboxitem" v-for="(item,index) in pageData.tableData.data" :key="index"
|
||||
@click="toDetail(item)">
|
||||
<view class="head">{{item.dutyId|| '无'}}</view>
|
||||
<view class="head">{{item.staffName || '无'}}</view>
|
||||
<view class="head">{{item.startTime|| '无'}}</view>
|
||||
<view class="head">{{item.endTime|| '无'}}</view>
|
||||
<view class="head">{{item.orderNum|| '无'}}</view>
|
||||
<view class="head">{{item.totalAmount|| '无'}}</view>
|
||||
<view class="head">{{item.loginTime|| '无'}}</view>
|
||||
<view class="head">{{item.handoverTime|| '无'}}</view>
|
||||
<view class="head">{{item.orderCount|| '无'}}</view>
|
||||
<view class="head">{{item.handAmount|| '无'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<up-loadmore :status="tableData.status" />
|
||||
<up-loadmore :status="pageData.tableData.status" />
|
||||
<view style="height: 100px;"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view class="u-fixed bottom u-flex bg-fff ">
|
||||
<!-- <view class="u-flex-1">
|
||||
<my-button bgColor="#333" color="#fff" borderRadius="100rpx 0 0 100rpx" shape="circle" plain type="primary"
|
||||
@tap="toSetting">设置</my-button>
|
||||
</view> -->
|
||||
<!-- <view class="u-flex-1">
|
||||
<my-button borderRadius="0 100rpx 100rpx 0" shape="circle" type="primary" @tap="jiaoban">开始交班</my-button>
|
||||
<my-button borderRadius="100rpx" shape="circle" type="primary" @tap="jiaoban">开始交班</my-button>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 交班开班时间选择 -->
|
||||
<my-date-pickerview @confirm="jiaobanPickerConfirm" :defaultTime="jiaobanDateIndex" :isArea="false"
|
||||
ref="jiaobanDatePicker"></my-date-pickerview>
|
||||
<!-- 交班记录时间筛选 -->
|
||||
<my-date-pickerview @confirm="datePickerConfirm" mode="date" ref="datePicker"></my-date-pickerview>
|
||||
<!-- 班次选择 -->
|
||||
<my-pickerview autoClear @confirm="banciConfirm" :showTitle="false" range-key="name" ref="jiaobanPickerView"
|
||||
:list="banci.list"></my-pickerview>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onHide,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onPullDownRefresh,
|
||||
onReachBottom,
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { onHide, onShow, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import myButton from '@/components/my-components/my-button';
|
||||
import myTabs from '@/components/my-components/my-tabs';
|
||||
import color from '@/commons/color.js';
|
||||
import myDatePickerview from '@/components/my-components/my-date-pickerview'
|
||||
import myPickerview from '@/components/my-components/my-pickerview'
|
||||
import {
|
||||
timeFormat
|
||||
} from '@/node_modules/uview-plus';
|
||||
import { timeFormat } from '@/node_modules/uview-plus';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
tbHandover,
|
||||
handoverData
|
||||
} from '@/http/yskApi/pageWorkControl.js'
|
||||
|
||||
function toDetail(item) {
|
||||
// go.to('PAGES_WORK_HANDOVER_DETAIL', item)
|
||||
}
|
||||
import { getHandoverRecord } from '@/api/handover.js'
|
||||
|
||||
function toSetting() {
|
||||
go.to('PAGES_WORK_SETTING')
|
||||
}
|
||||
|
||||
const jiaoban = async () => {
|
||||
// if (banci.selItem === '') {
|
||||
// return uni.showToast({
|
||||
// title: '请选择班次',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// }
|
||||
// go.to('PAGES_WORK_HANDOVER_CONFIRM')
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认交班吗?',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
await handoverData({
|
||||
isprintProduct: banci.switchvalue
|
||||
})
|
||||
uni.clearStorageSync()
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/index'
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const query = reactive({
|
||||
createdAt: [],
|
||||
proName: '',
|
||||
cateId: '',
|
||||
sort: 'id,desc'
|
||||
})
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 15,
|
||||
total: 0,
|
||||
status: 'loadmore'
|
||||
})
|
||||
|
||||
const jiaobanDatePicker = ref(null)
|
||||
|
||||
function jiaobanStartShow() {
|
||||
jiaobanDatePicker.value.open()
|
||||
}
|
||||
|
||||
const jiaobanPickerView = ref(null)
|
||||
|
||||
function showJiaobanPickerView() {
|
||||
jiaobanPickerView.value.open()
|
||||
}
|
||||
|
||||
|
||||
function jiaobanPickerConfirm(e) {
|
||||
form.kaibanTime = e
|
||||
}
|
||||
|
||||
const form = reactive({
|
||||
kaibanTime: new Date(),
|
||||
jiaobanTime: new Date()
|
||||
})
|
||||
const jiaobanDateIndex = ref([
|
||||
form.kaibanTime.getFullYear(),
|
||||
form.kaibanTime.getMonth(),
|
||||
form.kaibanTime.getDate(),
|
||||
form.kaibanTime.getHours(),
|
||||
form.kaibanTime.getMinutes(),
|
||||
form.kaibanTime.getSeconds(),
|
||||
])
|
||||
|
||||
|
||||
|
||||
let timer = null
|
||||
|
||||
function updateJiaoban() {
|
||||
clearInterval(timer)
|
||||
timer = setInterval(() => {
|
||||
form.jiaobanTime = new Date()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
const banci = reactive({
|
||||
list: [{
|
||||
name: '早班',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
name: '中班',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
name: '晚班',
|
||||
value: 3
|
||||
},
|
||||
],
|
||||
selItem: '',
|
||||
current: '',
|
||||
switchvalue: false
|
||||
})
|
||||
|
||||
function banciConfirm(e) {
|
||||
if (tabs.current) {
|
||||
filters.jiaobanSelItem = e[0]
|
||||
} else {
|
||||
banci.selItem = e[0]
|
||||
}
|
||||
}
|
||||
|
||||
function banciChange(e) {
|
||||
banci.current = e.detail.value
|
||||
}
|
||||
|
||||
|
||||
const tabs = reactive({
|
||||
list: ['交班', '交班记录'],
|
||||
current: 1
|
||||
})
|
||||
|
||||
// 切换tab
|
||||
function tabsChange(i) {
|
||||
console.log(i)
|
||||
tabs.current = i
|
||||
// 清除时间
|
||||
clearTime()
|
||||
if (tabs.current == 1) {
|
||||
resetHandle()
|
||||
} else {}
|
||||
}
|
||||
|
||||
const filters = reactive({
|
||||
jiaobanCurrent: '',
|
||||
jiaobanSelItem: '',
|
||||
const pageData = reactive({
|
||||
time: {
|
||||
start: '',
|
||||
end: ''
|
||||
},
|
||||
query: {
|
||||
page: 1,
|
||||
size: 10,
|
||||
beginDate: '',
|
||||
endDate: ''
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 15,
|
||||
total: 0,
|
||||
status: 'loadmore'
|
||||
}
|
||||
})
|
||||
|
||||
// 清除时间
|
||||
function clearTime() {
|
||||
filters.time.start = ''
|
||||
filters.time.end = ''
|
||||
}
|
||||
|
||||
function timeToggle() {
|
||||
datePicker.value.toggle()
|
||||
}
|
||||
|
||||
const datePicker = ref(null)
|
||||
|
||||
function datePickerConfirm(e) {
|
||||
filters.time.start = new Date(e.start.replaceAll('-', '/')).getTime()
|
||||
filters.time.end = new Date(e.end.replaceAll('-', '/')).getTime()
|
||||
onShow(() => {
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 重置列表
|
||||
function resetHandle() {
|
||||
query.sort = 'id,desc'
|
||||
tableData.data = []
|
||||
tableData.page = 0
|
||||
tableData.size = 15
|
||||
tableData.total = 0
|
||||
getTableData()
|
||||
}
|
||||
// 列表
|
||||
const getTableData = async () => {
|
||||
tableData.status = 'loading';
|
||||
let urlData = null
|
||||
if (!filters.time.start) {
|
||||
urlData =
|
||||
`page=${tableData.page}&size=${tableData.size}&shopId=${uni.getStorageSync('shopId')}&sort=${query.sort}`
|
||||
} else {
|
||||
urlData =
|
||||
`page=${tableData.page}&size=${tableData.size}&shopId=${uni.getStorageSync('shopId')}&tradeDay=${timeFormat(filters.time.start,'yyyymmdd')}&tradeDay=${timeFormat(filters.time.end,'yyyymmdd')}&sort=${query.sort}`
|
||||
})
|
||||
onReachBottom(() => {
|
||||
if (pageData.tableData.status != 'nomore') {
|
||||
pageData.tableData.page++
|
||||
getTableData()
|
||||
}
|
||||
let res = await tbHandover(urlData)
|
||||
tableData.total = res.totalElements
|
||||
if (tableData.page == 0 && res.content.length < 10) {
|
||||
tableData.data = res.content
|
||||
tableData.status = 'nomore'
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取交班记录
|
||||
*/
|
||||
const getTableData = async () => {
|
||||
pageData.tableData.status = 'loading';
|
||||
|
||||
let res = await getHandoverRecord(pageData.query)
|
||||
pageData.tableData.total = res.totalRow
|
||||
if (pageData.tableData.page == 1 && res.records.length < 10) {
|
||||
pageData.tableData.data = res.records
|
||||
pageData.tableData.status = 'nomore'
|
||||
return false;
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
tableData.data = [...tableData.data, ...res.content]
|
||||
if (tableData.data.length >= tableData.total) tableData.status = 'nomore';
|
||||
else tableData.status = 'loadmore';
|
||||
pageData.tableData.data = [...pageData.tableData.data, ...res.records]
|
||||
if (pageData.tableData.data.length >= pageData.tableData.total) pageData.tableData.status = 'nomore';
|
||||
else pageData.tableData.status = 'loadmore';
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
form.jiaobanTime = new Date()
|
||||
updateJiaoban()
|
||||
resetHandle()
|
||||
})
|
||||
onHide(() => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
/**
|
||||
* 选择时间
|
||||
*/
|
||||
function timeToggle() {
|
||||
datePicker.value.toggle()
|
||||
}
|
||||
|
||||
/**
|
||||
* 筛选时间确认
|
||||
* @param {Object} e
|
||||
*/
|
||||
function datePickerConfirm(e) {
|
||||
pageData.tableData.query.beginDate = timeFormat(new Date(e.start.replaceAll('-', '/')).getTime())
|
||||
pageData.tableData.query.endDate = timeFormat(new Date(e.end.replaceAll('-', '/')).getTime())
|
||||
pageData.time.start = new Date(e.start.replaceAll('-', '/')).getTime()
|
||||
pageData.time.end = new Date(e.end.replaceAll('-', '/')).getTime()
|
||||
getTableData()
|
||||
}
|
||||
function toDetail(item) {
|
||||
// go.to('PAGES_WORK_HANDOVER_DETAIL', item)
|
||||
}
|
||||
|
||||
onReachBottom(() => {
|
||||
if (tableData.status != 'nomore') {
|
||||
tableData.page++
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => tabs.current, (newval) => {
|
||||
if (newval) {
|
||||
clearInterval(timer)
|
||||
filters.jiaobanSelItem = ''
|
||||
} else {
|
||||
banci.selItem = ''
|
||||
updateJiaoban()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -1,250 +0,0 @@
|
|||
<template>
|
||||
<my-model ref="model" :borderRadius="18" :title="title" iconColor="#000" @close="resetForm">
|
||||
<template #desc>
|
||||
<view class="u-text-left u-p-30 ">
|
||||
<view class="u-m-t-40 ">
|
||||
<view>班名次</view>
|
||||
<view class="u-p-l-32 border u-m-t-24 u-flex-1">
|
||||
<uni-easyinput paddingNone :inputBorder="false" v-model="form.name"
|
||||
placeholder="请输入班次名称"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="active!=1">
|
||||
<view class="u-m-t-40 " @tap="timePickerShow(form.start,'start')">
|
||||
<view>开始时间</view>
|
||||
<view class="u-p-l-32 border lh35 u-flex u-m-t-24 u-flex-1">
|
||||
<view class="u-flex">
|
||||
<image src="/pageWorkControl/static/images/icon-time.svg" class="icon-time" mode=""></image>
|
||||
</view>
|
||||
<view class="u-m-l-12">
|
||||
<text v-if="!form.start" class="color-666">请选择开始时间</text>
|
||||
<text v-else>{{form.start}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-40 " @tap="timePickerShow(form.end,'end')">
|
||||
<view>结束时间</view>
|
||||
<view class="u-p-l-32 border lh35 u-flex u-m-t-24 u-flex-1">
|
||||
<view class="u-flex">
|
||||
<image src="/pageWorkControl/static/images/icon-time.svg" class="icon-time" mode=""></image>
|
||||
</view>
|
||||
<view class="u-m-l-12">
|
||||
<text v-if="!form.end" class="color-666">请选择结束时间</text>
|
||||
<text v-else>{{form.end}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<template #btn>
|
||||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" showShadow>{{props.title==='添加'?'添加':'提交'}}</my-button>
|
||||
<my-button type="cancel" bgColor="#fff" @tap="close">取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</my-model>
|
||||
|
||||
<my-pickerview autoClear :isLink="false" mode="time" @confirm="timeConfirm" :showTitle="false" ref="timePicker"
|
||||
:defaultIndex="times.defaultIndex"
|
||||
></my-pickerview>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref
|
||||
} from 'vue';
|
||||
import myPickerview from '@/components/my-components/my-pickerview'
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
const props = defineProps({
|
||||
active:{
|
||||
type:[String,Number],
|
||||
default:1
|
||||
},
|
||||
mode:{
|
||||
//time none
|
||||
type:String,
|
||||
default:'none'
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: []
|
||||
}
|
||||
})
|
||||
|
||||
function timeConfirm(e){
|
||||
form[times.selType]=e.join(':')
|
||||
}
|
||||
|
||||
const times=reactive({
|
||||
defaultIndex:[0,0],
|
||||
selType:'',
|
||||
})
|
||||
|
||||
|
||||
|
||||
const timePicker = ref(null)
|
||||
function timePickerShow(time,timeshowKey){
|
||||
times.selType=timeshowKey
|
||||
const date=new Date()
|
||||
if(time===''){
|
||||
times.defaultIndex=[date.getHours(),date.getMinutes()]
|
||||
}else{
|
||||
console.log(time.split(':').map(v=>parseInt(v)));
|
||||
times.defaultIndex=time.split(':').map(v=>parseInt(v))
|
||||
}
|
||||
timePicker.value.open()
|
||||
}
|
||||
|
||||
function currentPriceChange(newval){
|
||||
nextTick(()=>{
|
||||
form.discount=(newval*100/form.price).toFixed()
|
||||
})
|
||||
}
|
||||
function discountChange(newval){
|
||||
nextTick(()=>{
|
||||
form.currentPrice=(form.price*newval/100).toFixed(2)
|
||||
})
|
||||
}
|
||||
|
||||
const $form = {
|
||||
name:'',
|
||||
start:'',
|
||||
end:'',
|
||||
}
|
||||
const form = reactive({
|
||||
...$form
|
||||
})
|
||||
|
||||
function resetForm() {
|
||||
Object.assign(form, {
|
||||
...$form
|
||||
})
|
||||
}
|
||||
|
||||
const model = ref(null)
|
||||
|
||||
function open(item) {
|
||||
if(item){
|
||||
Object.assign(form,item)
|
||||
}
|
||||
model.value.open()
|
||||
emits('open')
|
||||
}
|
||||
|
||||
function close() {
|
||||
model.value.close()
|
||||
resetForm()
|
||||
emits('close')
|
||||
}
|
||||
const emits = defineEmits(['confirm','close','open'])
|
||||
|
||||
function confirm() {
|
||||
const {
|
||||
name,start,end
|
||||
} = form
|
||||
if(!name){
|
||||
return uni.showToast({
|
||||
title:'请输入班次名',
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
if(props.active==0){
|
||||
if(!start){
|
||||
return uni.showToast({
|
||||
title:'请选择开始时间',
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
if(!end){
|
||||
return uni.showToast({
|
||||
title:'请选择结束时间',
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
emits('confirm',{...form})
|
||||
close()
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.lh35{
|
||||
line-height: 35px;
|
||||
}
|
||||
.icon-time{
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
}
|
||||
.border{
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.lh34 {
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.tag {
|
||||
background-color: #fff;
|
||||
border: 1px solid #E5E5E5;
|
||||
line-height: inherit;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
padding: 6rpx 20rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
&.active {
|
||||
border-color: #E6F0FF;
|
||||
color: $my-main-color;
|
||||
}
|
||||
}
|
||||
|
||||
.hover-class {
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
|
||||
.discount {
|
||||
.u-absolute {
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.bg1 {
|
||||
background: #F7F7FA;
|
||||
}
|
||||
|
||||
.tab {
|
||||
padding: 0 80rpx;
|
||||
}
|
||||
|
||||
.border {
|
||||
border: 1px solid #E5E5E5;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.input-box {
|
||||
padding: 22rpx 32rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.placeholder-class {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,235 +0,0 @@
|
|||
<template>
|
||||
<view class="min-page bg-gray u-p-30 u-font-28 color-333">
|
||||
<view class="bg-fff border-r-12 default-box-padding">
|
||||
<view class="font-bold">交班模式</view>
|
||||
<view class="u-m-t-24">
|
||||
<radio-group @change="jiaobanModelChange">
|
||||
<label class="radio u-m-r-60" v-for="(item,index) in jiaobanModel.list" :key="index">
|
||||
<radio :value="''+index" :checked="index == jiaobanModel.active" class="scale7 " />
|
||||
<text>{{item.label}}</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="jiaobanModel.active==0">
|
||||
<view v-for="(item,index) in bancis.timeList" :key="index" >
|
||||
<view class="bg-fff u-m-t-32 border-r-12 default-box-padding">
|
||||
<view class="color-666">班次</view>
|
||||
<view class="u-flex u-m-t-24 u-p-b-24 border-bottom u-row-between" @tap="addBanciOpen(item,index)">
|
||||
<view class="">
|
||||
<text>{{item.name}}</text>
|
||||
<text>,</text>
|
||||
<text>{{item.start}}</text>
|
||||
<text>-</text>
|
||||
<text>{{item.end}}</text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-28" @tap="listDel(bancis.timeList,index)">
|
||||
<view class="u-flex">
|
||||
<uni-icons size="20" type="minus-filled" :color="$colorRed"></uni-icons>
|
||||
</view>
|
||||
<view class="u-m-l-12 red">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="jiaobanModel.active==1">
|
||||
<view v-for="(item,index) in bancis.list" :key="index">
|
||||
<view class="bg-fff u-m-t-32 border-r-12 default-box-padding">
|
||||
<view class="color-666">班次</view>
|
||||
<view class="u-flex u-m-t-24 u-p-b-24 border-bottom u-row-between" @tap="addBanciOpen(item,index)">
|
||||
<view class="">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-28" @tap="listDel(bancis.list,index)">
|
||||
<view class="u-flex">
|
||||
<uni-icons size="20" type="minus-filled" :color="$colorRed"></uni-icons>
|
||||
</view>
|
||||
<view class="u-m-l-12 red">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<view class="bg-fff u-flex u-m-t-32 border-r-12 default-box-padding" @tap="addBanciOpen">
|
||||
<uni-icons type="plus-filled" :color="color.ColorMain" size="20"></uni-icons>
|
||||
<view class="u-m-l-16">添加选项</view>
|
||||
</view>
|
||||
|
||||
<view class="bg-fff u-m-t-32 border-r-18 default-box-padding">
|
||||
<view class="" v-for="(radios,index) in radioGroups" :key="index">
|
||||
<view class="font-bold">{{radios.title}}</view>
|
||||
<view class="u-m-t-24 u-p-b-24 u-m-b-24" :class="{'border-bottom':index<radioGroups.length-1}">
|
||||
<radio-group @change="radioGroupChange($event,radios)">
|
||||
<label class="radio u-m-r-60" v-for="(item,itemindex) in radios.list" :key="itemindex">
|
||||
<radio :value="''+itemindex" :checked="itemindex === radios.active" class="scale7 " />
|
||||
<text>{{item.label}}</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-fixed bottom u-flex bg-fff ">
|
||||
<view class="u-flex-1">
|
||||
<my-button bgColor="#333" color="#fff" borderRadius="100rpx 0 0 100rpx" shape="circle" plain type="primary"
|
||||
@tap="back">返回</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button @tap="confirm" borderRadius="0 100rpx 100rpx 0" shape="circle" type="primary">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<add-banci @confirm="addBanciConfirm" :active="jiaobanModel.active" :title="refAddBanciTitle" ref="refAddBanci"></add-banci>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import color from '@/commons/color.js'
|
||||
import myButton from '@/components/my-components/my-button';
|
||||
import addBanci from './components/add-banci';
|
||||
import {
|
||||
reactive, ref
|
||||
} from 'vue';
|
||||
|
||||
const refAddBanci=ref(null)
|
||||
const refAddBanciTitle=ref('添加')
|
||||
|
||||
function addBanciOpen(item,index){
|
||||
bancis.selIndex=index
|
||||
refAddBanciTitle.value=item.hasOwnProperty('name')?'编辑':'添加'
|
||||
refAddBanci.value.open(item.hasOwnProperty('name')?item:null)
|
||||
}
|
||||
function addBanciConfirm(e){
|
||||
console.log(e);
|
||||
if(refAddBanciTitle.value==='添加'){
|
||||
if(jiaobanModel.active==1){
|
||||
bancis.list.push(e)
|
||||
}else{
|
||||
bancis.timeList.push(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
function listDel(list,index){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定删除【'+list[index].name+'】吗?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
list.splice(index,1)
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
const $colorRed = '#EB4F4F'
|
||||
const bancis = reactive({
|
||||
selIndex:'',
|
||||
timeList: [{
|
||||
name: '测试',
|
||||
start: '6:00',
|
||||
end: '12:00'
|
||||
}],
|
||||
list: [{
|
||||
name: '早班'
|
||||
},
|
||||
{
|
||||
name: '中班'
|
||||
},
|
||||
{
|
||||
name: '晚班'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
function back() {
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
|
||||
}
|
||||
|
||||
const jiaobanModel = reactive({
|
||||
list: [{
|
||||
label: '按时间段',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: '自定义',
|
||||
value: 1
|
||||
},
|
||||
],
|
||||
active: 1
|
||||
})
|
||||
|
||||
const radioBasicArr = [{
|
||||
label: '统计',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: '不统计',
|
||||
value: 1
|
||||
},
|
||||
]
|
||||
|
||||
function returnRadioGroups(arr) {
|
||||
return arr.map(v => {
|
||||
return {
|
||||
title: v,
|
||||
active: 0,
|
||||
list: [...radioBasicArr],
|
||||
}
|
||||
})
|
||||
}
|
||||
const textlists = [
|
||||
'订单数', '订单额', '订单微信支付金额', '订单余额支付金额', '订单线下支付金额', '订单支付宝金额',
|
||||
'堂食订单数', '堂食订单金额', '自取订单数', '自取订单金额', '外卖订单数', '外卖订单金额', '退款订单数',
|
||||
'成功退款金额', '微信成功退款金额', '余额成功退款金额', '线下成功退款金额', '支付宝成功退款金额', '充值数',
|
||||
'充值金额', '开通会员数', '开通会员金额', '配送费', '收银笔数', '收银金额', '订单满减优惠金额', '订单积分兑换金额',
|
||||
'订单优惠券减免金额', '订单会员优惠金额', '充值赠送金额', '堂食退款金额', '外卖退款金额', '自取退款金额', '配送费退款',
|
||||
'配送费总额', '微信到账金额', '支付宝到账金额', '收银支付宝金额', '收银余额支付金额', '收银微信支付金额'
|
||||
]
|
||||
const radioGroups = reactive(returnRadioGroups(textlists))
|
||||
|
||||
function radioGroupChange(e, item) {
|
||||
console.log(e);
|
||||
console.log(item);
|
||||
item.active = e.detail.value
|
||||
console.log(radioGroups);
|
||||
}
|
||||
|
||||
function jiaobanModelChange(e) {
|
||||
jiaobanModel.active = e.detail.value
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
$red: #EB4F4F;
|
||||
|
||||
.red {
|
||||
color: $red;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
background-color: transparent;
|
||||
bottom: 84rpx;
|
||||
left: 28rpx;
|
||||
right: 28rpx;
|
||||
}
|
||||
</style>
|
||||
15
pages.json
15
pages.json
|
|
@ -236,21 +236,6 @@
|
|||
"navigationBarTitleText": "交班"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_WORK_SETTING",
|
||||
"path": "setting/setting",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置加班信息"
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_WORK_HANDOVER_CONFIRM",
|
||||
"path": "handover-confirm/handover-confirm",
|
||||
"style": {
|
||||
"navigationBarTitleText": "确认交班"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_WORK_HANDOVER_DETAIL",
|
||||
"path": "handover-detail/handover-detail",
|
||||
|
|
|
|||
|
|
@ -161,7 +161,15 @@
|
|||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="isVip&&item.lowMemberPrice&&item.lowMemberPrice*1!=item.lowPrice*1">
|
||||
<template v-if="item.discount_sale_amount&&item.discount_sale_amount*1>0">
|
||||
<text
|
||||
class="line-th color-999">¥{{formatPrice(item.lowPrice*item.number) }}</text>
|
||||
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
||||
<text
|
||||
class="font-bold">¥{{formatPrice(item.discount_sale_amount*item.number) }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else-if="isVip&&item.lowMemberPrice&&item.lowMemberPrice*1!=item.lowPrice*1">
|
||||
<text
|
||||
class="line-th color-999">¥{{formatPrice(item.lowPrice*item.number) }}</text>
|
||||
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
||||
|
|
@ -289,8 +297,6 @@
|
|||
import oneRemark from './components/remark'
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { returnBoolean } from '@/commons/utils/format.js';
|
||||
import color from '@/commons/color.js';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import $storageManage from '@/commons/utils/storageManage.js'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
|
|
@ -298,7 +304,7 @@
|
|||
import { getShopInfo } from '@/api/shop.js'
|
||||
import { getShopTableDetail } from '@/api/table.js'
|
||||
import { getProductList } from '@/api/product.js'
|
||||
import { createOrder } from '@/api/order.js'
|
||||
import { createOrder,getHistoryOrder } from '@/api/order.js'
|
||||
import { number } from 'uview-plus/libs/function/test';
|
||||
|
||||
const models = new Map();
|
||||
|
|
@ -350,13 +356,14 @@
|
|||
},
|
||||
form: {
|
||||
note: ""
|
||||
}
|
||||
},
|
||||
orderInfo: {}
|
||||
})
|
||||
|
||||
onLoad((opt) => {
|
||||
Object.assign(option, opt)
|
||||
console.log(opt);
|
||||
if (opt) {
|
||||
if (opt.tableId) {
|
||||
userNumbers.list = new Array(opt.maxCapacity ? opt.maxCapacity * 1 : 100).fill(1).map((v, index) => {
|
||||
return (index + 1) + '人'
|
||||
})
|
||||
|
|
@ -377,7 +384,7 @@
|
|||
updateChoseCount()
|
||||
})
|
||||
|
||||
watch(() => eatTypes.active, (newval) => {
|
||||
watch(() => pageData.eatTypes.active, (newval) => {
|
||||
changeUseType()
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
|
@ -388,6 +395,15 @@
|
|||
watchChooseTable()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
* @param {Object} tableCode
|
||||
*/
|
||||
async function getHistoryOrderDetail(tableCode){
|
||||
let res = await getHistoryOrder({tableCode:tableCode});
|
||||
pageData.orderInfo = res;
|
||||
}
|
||||
|
||||
//餐位费
|
||||
const $seatFee = reactive({
|
||||
totalNumber: 0,
|
||||
|
|
@ -413,9 +429,10 @@
|
|||
return result
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 判断是否是会员
|
||||
*/
|
||||
const isVip = computed(() => {
|
||||
console.log("pageData==",pageData)
|
||||
return pageData.shopInfo.isMemberPrice && pageData.user && pageData.user.id && pageData.user.isVip
|
||||
})
|
||||
|
||||
|
|
@ -429,19 +446,19 @@
|
|||
})
|
||||
|
||||
const goodsPrice = computed(() => {
|
||||
console.log("isVip===",isVip.value)
|
||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
const lowMemberPrice = cur.lowMemberPrice ? cur.lowMemberPrice : cur.lowPrice
|
||||
const tPrice = (isVip.value ? lowMemberPrice : cur.lowPrice) * cur.number
|
||||
const tpackFee = parseFloat(cur.pack_number).toFixed(0) > 0 ? cur.packFee*parseFloat(cur.pack_number).toFixed(0) : 0
|
||||
return prve + (cur.is_gift ? 0 : tPrice) + tpackFee
|
||||
}, 0)
|
||||
console.log("discount_sale_amount===",discount_sale_amount)
|
||||
return ((goodsTotalPrice - discount_sale_amount.value) || 0).toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 实收金额
|
||||
*/
|
||||
const allPrice = computed(() => {
|
||||
console.log("isVip===",goodsPrice.value)
|
||||
const n = goodsPrice.value * 1 + $seatFee.totalAmount
|
||||
return n.toFixed(2)
|
||||
})
|
||||
|
|
@ -454,10 +471,12 @@
|
|||
if (pageData.user && pageData.user.id && pageData.user.isVip) {
|
||||
goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
const tPrice = cur.lowPrice * cur.number
|
||||
const tpackFee = cur.is_pack ? cur.packFee * 1 : 0
|
||||
return prve + tPrice + tpackFee
|
||||
const tpackFee = (cur.pack_number*1) > 0 ? cur.packFee * (cur.pack_number*1) : 0
|
||||
console.log(cur)
|
||||
return prve + tPrice + tpackFee
|
||||
}, 0)
|
||||
return goodsTotalPrice - allPrice.value
|
||||
console.log(goodsTotalPrice)
|
||||
return (goodsTotalPrice + $seatFee.totalAmount) - allPrice.value
|
||||
} else {
|
||||
return (discount_sale_amount.value)
|
||||
}
|
||||
|
|
@ -468,11 +487,10 @@
|
|||
/**
|
||||
* socket消息监听
|
||||
*/
|
||||
websocketUtil.onMessage(data => {
|
||||
let msg = JSON.parse(data);
|
||||
websocketUtil.onMessage(res => {
|
||||
let msg = JSON.parse(res);
|
||||
let cartItem;
|
||||
if( msg.msg_id ){
|
||||
// console.log('Received data:', msg);
|
||||
websocketUtil.send(JSON.stringify({
|
||||
type: 'receipt',
|
||||
msg_id: msg.msg_id,
|
||||
|
|
@ -482,20 +500,57 @@
|
|||
infoBox.showToast('添加失败')
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (msg.operate_type) {
|
||||
case 'onboc_init':
|
||||
goods.list = []
|
||||
msg.data.map(item=>{
|
||||
cartItem = getNowCart(item,$goods)
|
||||
goods.list.push(cartItem)
|
||||
cartItem = getNowCart(item,$goods,pageData.user)
|
||||
cartControls(cartItem,'add')
|
||||
})
|
||||
console.log("goods.list===",goods.list)
|
||||
break;
|
||||
|
||||
case 'onboc_add':
|
||||
case 'add':
|
||||
cartItem = getNowCart(msg.data,$originGoods,pageData.user)
|
||||
cartControls(cartItem,'add')
|
||||
break;
|
||||
case 'onboc_edit':
|
||||
case 'edit':
|
||||
cartItem = getNowCart(msg.data,$originGoods,pageData.user)
|
||||
cartControls(cartItem,'edit')
|
||||
break;
|
||||
case 'onboc_del':
|
||||
case 'del':
|
||||
cartItem = getNowCart(msg.data,$originGoods,pageData.user)
|
||||
cartControls(cartItem,'del')
|
||||
break;
|
||||
case 'onboc_cleanup':
|
||||
case 'cleanup':
|
||||
goods.lis = []
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* socket通知购物车商品数量修改处理
|
||||
*/
|
||||
function cartControls (cartItem,type) {
|
||||
if( !pageData.table.tableCode ){
|
||||
pageData.table.tableCode = cartItem.table_code
|
||||
}
|
||||
let cartIndex = 0;
|
||||
|
||||
if( type == 'del' ) {
|
||||
goods.list.splice(cartIndex, 1)
|
||||
return;
|
||||
}
|
||||
if( type == 'add' ){
|
||||
goods.list.push(cartItem)
|
||||
}
|
||||
if( type == 'edit' ){
|
||||
goods.list[cartIndex].number = cartItem.number
|
||||
}
|
||||
}
|
||||
|
||||
async function init() {
|
||||
let goodsRes = await getGoods()
|
||||
|
|
@ -542,6 +597,7 @@
|
|||
async function getTbShopInfo() {
|
||||
const res = await getShopInfo({id: uni.getStorageSync('shopInfo').id})
|
||||
pageData.shopInfo = res
|
||||
uni.setStorageSync('shopInfo',res)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -550,6 +606,7 @@
|
|||
async function getTableInfo(id) {
|
||||
const res = await getShopTableDetail({id: id})
|
||||
pageData.table = res
|
||||
getHistoryOrderDetail(res.tableCode)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -559,20 +616,6 @@
|
|||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
pageData.user = data
|
||||
|
||||
goods.list.map(item => {
|
||||
let par = {
|
||||
id: item.id,
|
||||
product_id: item.product_id ,
|
||||
sku_id: item.sku_id
|
||||
}
|
||||
let lowMemberPrice = item.lowMemberPrice ? item.lowMemberPrice : item.lowPrice
|
||||
let tPrice = (isVip.value ? lowMemberPrice : item.lowPrice)
|
||||
let discount_sale_amount = item.is_gift ? 0 : tPrice
|
||||
par['discount_sale_amount'] = discount_sale_amount
|
||||
updateCart(par)
|
||||
}, 0)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -595,13 +638,7 @@
|
|||
if (!goods.list.length) {
|
||||
return
|
||||
}
|
||||
const res = await Api.$changeUseType({
|
||||
useType,
|
||||
tableId: tableId || '',
|
||||
cartIds: goods.list.map((v) => v.id),
|
||||
})
|
||||
getCart()
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -665,7 +702,7 @@
|
|||
}
|
||||
let lowMemberPrice = modelData.data.lowMemberPrice ? modelData.data.lowMemberPrice : modelData.data.lowPrice
|
||||
let tPrice = (isVip.value ? lowMemberPrice : modelData.data.lowPrice)
|
||||
let discount_sale_amount = modelData.data.is_gift ? 0 : tPrice - form.discountMoney
|
||||
let discount_sale_amount = modelData.data.is_gift ? 0 : form.discountMoney
|
||||
let par = {
|
||||
id: modelData.data.id,
|
||||
product_id: modelData.data.product_id,
|
||||
|
|
@ -723,7 +760,7 @@
|
|||
modelData.data = goods.list[index]
|
||||
modelData.selIndex = index
|
||||
const model = models.get(key)
|
||||
|
||||
console.log("弹窗数据===",modelData.data)
|
||||
if( key == 'packNumber'){
|
||||
if( item.pack_number > 0 ){
|
||||
let par = {
|
||||
|
|
@ -838,6 +875,7 @@
|
|||
}
|
||||
|
||||
let vipPrice = isVip.value ? 1 : 0
|
||||
let placeNum = pageData.shopInfo.registerType == 'after'&&pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1;
|
||||
let par = {
|
||||
shopId: pageData.shopInfo.id, //店铺Id
|
||||
userId: pageData.user.userId, //用户Id
|
||||
|
|
@ -847,10 +885,14 @@
|
|||
seatNum: userNumbers.defaultCateIndex * 1 + 1, //用餐人数
|
||||
packFee: $packFee.value, //打包费
|
||||
originAmount: goodsPrice.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
placeNum: 0, //当前订单下单次数
|
||||
placeNum: placeNum, //当前订单下单次数
|
||||
waitCall: 0, //是否等叫 0 否 1 等叫
|
||||
vipPrice: vipPrice, //是否使用会员价
|
||||
}
|
||||
if(pageData.shopInfo.registerType == 'after'&&pageData.orderInfo){
|
||||
par.orderId = pageData.orderInfo.id
|
||||
}
|
||||
|
||||
console.log(userNumbers.defaultCateIndex * 1 + 1)
|
||||
console.log(pageData.shopInfo.registerType)
|
||||
const res = await createOrder(par)
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@
|
|||
$table,
|
||||
tableswitch
|
||||
} from '@/http/yskApi/table.js'
|
||||
import { getShopTable } from '@/api/table.js'
|
||||
let datas = reactive({
|
||||
current: 0,
|
||||
item: "",
|
||||
|
|
@ -108,10 +109,28 @@
|
|||
})
|
||||
onLoad((opt) => {
|
||||
datas.item = JSON.parse(opt.item)
|
||||
console.log(datas.item)
|
||||
})
|
||||
onShow(() => {
|
||||
gettableList()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取桌台
|
||||
*/
|
||||
async function gettableList() {
|
||||
const res = await getShopTable({
|
||||
status: 'idle',
|
||||
})
|
||||
let arr = []
|
||||
res.records.forEach((ele) => {
|
||||
if (ele.status == 'using' && props.tableId != ele.tableId) {
|
||||
arr.push(ele)
|
||||
}
|
||||
});
|
||||
datas.tableList = arr
|
||||
}
|
||||
|
||||
async function confirm() {
|
||||
// 是否选择其他桌
|
||||
if (datas.selecttableList) {
|
||||
|
|
@ -167,20 +186,7 @@
|
|||
datas.current = e.currentIndex
|
||||
}
|
||||
}
|
||||
// 获取桌台
|
||||
async function gettableList() {
|
||||
const res = await $table.get({
|
||||
page: 1,
|
||||
size: 999
|
||||
})
|
||||
let arr = []
|
||||
res.content.forEach((ele) => {
|
||||
if (ele.status == 'using' && props.tableId != ele.tableId) {
|
||||
arr.push(ele)
|
||||
}
|
||||
});
|
||||
datas.tableList = arr
|
||||
}
|
||||
|
||||
|
||||
function formatPrice(n) {
|
||||
return Number(n).toFixed(2)
|
||||
|
|
|
|||
|
|
@ -152,13 +152,8 @@
|
|||
if (props.data.length <= 0) {
|
||||
return infoBox.showToast('还没有选择商品')
|
||||
}
|
||||
const {
|
||||
name,
|
||||
maxCapacity,
|
||||
status,
|
||||
type
|
||||
} = props.table
|
||||
|
||||
const { name, maxCapacity, status, type } = props.table
|
||||
console.log(props.table)
|
||||
if (props.table.id == '') {
|
||||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@
|
|||
})
|
||||
|
||||
const goods = computed(() => {
|
||||
console.log(props.skuMap[selSku.value])
|
||||
return props.skuMap[selSku.value]
|
||||
})
|
||||
watch(() => goods.value, (newval) => {
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@
|
|||
},
|
||||
|
||||
table: {
|
||||
tableId: ""
|
||||
id: ""
|
||||
},
|
||||
socketData: {
|
||||
type:'onboc',
|
||||
|
|
@ -261,7 +261,7 @@
|
|||
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(uni.getStorageSync("shopInfo"))
|
||||
uni.setStorageSync('useType', useType)
|
||||
|
||||
await getTableInfo()
|
||||
// await getTableInfo()
|
||||
|
||||
// 获取分类数据
|
||||
let categoryRes = await categoryPage({ page: 1, size: 300 })
|
||||
|
|
@ -294,9 +294,7 @@
|
|||
websocketUtil.onMessage(res => {
|
||||
let msg = JSON.parse(res);
|
||||
let cartItem;
|
||||
console.log(msg)
|
||||
if( msg.msg_id ){
|
||||
// console.log('Received data:', msg);
|
||||
websocketUtil.send(JSON.stringify({
|
||||
type: 'receipt',
|
||||
msg_id: msg.msg_id,
|
||||
|
|
@ -338,7 +336,6 @@
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -468,6 +465,7 @@
|
|||
data.table = {
|
||||
...item
|
||||
}
|
||||
initCart()
|
||||
return;
|
||||
}
|
||||
if (item.status == "unbind") {
|
||||
|
|
@ -477,6 +475,7 @@
|
|||
return infoBox.showToast('该台桌已在使用中')
|
||||
}
|
||||
data.table = item
|
||||
initCart()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -488,11 +487,11 @@
|
|||
* @param {Object} showCurrentInput
|
||||
*/
|
||||
async function goodsUpdate(foodsindex, index, isAdd, searchGoodsIndex, showCurrentInput) { // showCurrentInput 称重才会传的参数
|
||||
if (!data.table.id) {
|
||||
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
|
||||
chooseTable()
|
||||
})
|
||||
}
|
||||
// if (!data.table.id) {
|
||||
// return infoBox.showToast('请先选择桌台', 0.5).then(res => {
|
||||
// chooseTable()
|
||||
// })
|
||||
// }
|
||||
let $goods = data.tabbar[index].foods[foodsindex]
|
||||
if ($goods.type !== 'sku') {
|
||||
//单规格
|
||||
|
|
@ -552,6 +551,9 @@
|
|||
* socket通知购物车商品数量修改处理
|
||||
*/
|
||||
function cartControls (cartItem,type) {
|
||||
if( !data.table.tableCode ){
|
||||
data.table.tableCode = cartItem.table_code
|
||||
}
|
||||
let cartIndex = 0;
|
||||
let product_id = cartItem.product_id
|
||||
let sku_id = cartItem.sku_id
|
||||
|
|
@ -569,7 +571,7 @@
|
|||
$goods = !product_id ? undefined : tabbarItem.foods.find(v => v.id == product_id)
|
||||
}
|
||||
})
|
||||
|
||||
console.log($goods)
|
||||
let $sku;
|
||||
if( $goods.type != 'package'){
|
||||
//临时菜没有skuList
|
||||
|
|
@ -592,8 +594,6 @@
|
|||
$goods.chooseNumber = cartItem.number
|
||||
}
|
||||
}
|
||||
|
||||
console.log(cars)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -651,11 +651,11 @@
|
|||
* @param {Object} index
|
||||
*/
|
||||
function chooseGuige(foodsindex, index) {
|
||||
if (!data.table.id) {
|
||||
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
|
||||
chooseTable()
|
||||
})
|
||||
}
|
||||
// if (!data.table.id) {
|
||||
// return infoBox.showToast('请先选择桌台', 0.5).then(res => {
|
||||
// chooseTable()
|
||||
// })
|
||||
// }
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
console.log($goods)
|
||||
selGoods.value = $goods
|
||||
|
|
@ -869,18 +869,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const instance = getCurrentInstance();
|
||||
let canXiadan = ref(false)
|
||||
async function xiadanClick() {
|
||||
|
|
@ -906,7 +894,7 @@
|
|||
const tableId = par.code
|
||||
|
||||
onChooseTable({
|
||||
tableId
|
||||
id: tableId
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
|
|
@ -971,40 +959,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
//更新购物车
|
||||
function updateCartGoods(par) {
|
||||
const submitPar = {
|
||||
cartId: '',
|
||||
tableId: data.table.id,
|
||||
isPack: false,
|
||||
num: 1,
|
||||
productId: '',
|
||||
skuId: '',
|
||||
vipUserId: data.vipUser.id
|
||||
}
|
||||
Object.assign(submitPar, par)
|
||||
return Api.$updateCart(submitPar)
|
||||
}
|
||||
|
||||
//更新选择用户
|
||||
function setUser(par) {
|
||||
const submitPar = {
|
||||
tableId: data.table.id,
|
||||
vipUserId: data.vipUser.id ? data.vipUser.id : '',
|
||||
type: data.vipUser.id ? 0 : 1 //0 设置 1 取消
|
||||
}
|
||||
Object.assign(submitPar, par)
|
||||
return Api.$setUser(submitPar)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 监听选择用户事件
|
||||
|
||||
|
||||
|
||||
const surcharge = ref(null)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
// 返回购物车未下单的数据
|
||||
export function getNowCart(carItem,goodsList) {
|
||||
export function getNowCart(carItem,goodsList,user) {
|
||||
// console.log("carItem===",carItem)
|
||||
// console.log("goodsList===",goodsList)
|
||||
// const nowCart = records.find(v => v.placeNum == 0)
|
||||
|
|
@ -10,9 +10,16 @@ export function getNowCart(carItem,goodsList) {
|
|||
if(carItem.product_id == goodsItem.id){
|
||||
goodsItem.skuList.map(item=>{
|
||||
if(carItem.sku_id == item.id){
|
||||
console.log(item)
|
||||
carItem.lowPrice = item.salePrice
|
||||
carItem.lowMemberPrice = item.memberPrice
|
||||
carItem.specInfo = item.specInfo
|
||||
if( uni.getStorageSync('shopInfo').isMemberPrice && user && user.id && user.isVip ){
|
||||
carItem.salePrice = item.memberPrice
|
||||
} else {
|
||||
carItem.salePrice = item.salePrice
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
carItem.name = goodsItem.name
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-8">
|
||||
<view class="u-m-r-20 u-flex " v-if="item.payAmount<=0">
|
||||
<view class="u-m-r-20 u-flex" v-if="item.isGift">
|
||||
<uni-tag text="赠送"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
|
|
@ -57,8 +57,12 @@
|
|||
<view class="color-666">退款金额:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnAmount}}</view>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnNum">
|
||||
<view class="color-666">退菜数量:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnNum}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="color-999 u-font-24 u-m-t-8">{{item.productSkuName||''}}</view>
|
||||
<view class="color-999 u-font-24 u-m-t-8">{{item.skuName||''}}</view>
|
||||
|
||||
|
||||
<view class="u-m-t-12 color-666 u-font-24" v-if="item.remark">
|
||||
|
|
@ -66,21 +70,20 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-text-right u-m-t-28">
|
||||
{{isTui(item)}}
|
||||
<template v-if="isTui(item)">
|
||||
<view>¥0.00</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||
</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else-if="isGift(item)||item.userCouponId">
|
||||
<template v-else-if="item.userCouponId">
|
||||
<view>¥0.00</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||
</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
|
||||
<view>¥{{returnCanTuiMoney(item)}}</view>
|
||||
<view>¥{{returnTotalMoney(item)}}</view>
|
||||
<view class=" color-666 line-th">
|
||||
¥{{returnTotalMoney(item)}}</view>
|
||||
¥{{returnCanTuiMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view>¥{{returnTotalMoney(item)}}</view>
|
||||
|
|
@ -353,7 +356,7 @@
|
|||
}
|
||||
|
||||
function returnTotalMoney(item) {
|
||||
return (item.payAmount * item.num).toFixed(2)
|
||||
return (item.payAmount).toFixed(2)
|
||||
}
|
||||
|
||||
const canTuiKuanPrice = computed(() => {
|
||||
|
|
@ -394,12 +397,13 @@
|
|||
})
|
||||
|
||||
function returnCanTuiMoney(item) {
|
||||
return props.orderInfo.status == 'unpaid' ? item.payAmount : item.payAmount
|
||||
if (props.orderInfo.status == 'unpaid') {
|
||||
return returnTotalMoney(item)
|
||||
} else {
|
||||
if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
|
||||
return item.canReturnAmount
|
||||
} else if (item.price != item.unitPrice) {
|
||||
return item.price*item.num
|
||||
} else {
|
||||
return item.payAmount
|
||||
}
|
||||
|
|
@ -476,8 +480,8 @@
|
|||
return 0
|
||||
}
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" && (v.isMember &&
|
||||
v.memberPrice) && (v.memberPrice != v.price)).reduce((
|
||||
const curTotal = cur.info.filter(v => v.discountSaleAmount <= 0 && v.isGift != 1 && v.status !== "return" && (v.price !=
|
||||
v.unitPrice) && (v.memberPrice != v.price)).reduce((
|
||||
a,
|
||||
b) => {
|
||||
return a + (b.num * (b.price - b.memberPrice))
|
||||
|
|
@ -504,20 +508,15 @@
|
|||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 已优惠金额
|
||||
*/
|
||||
const youhuiAllPrice = computed(() => {
|
||||
const n = props.orderInfo.originAmount - props.orderInfo.amount + vipDiscountPrice.value * 1
|
||||
const n = props.orderInfo.orderAmount - props.orderInfo.payAmount + vipDiscountPrice.value * 1
|
||||
return (n < 0 ? 0 : n).toFixed(2)
|
||||
// if(props.orderInfo.status!='unpaid'){
|
||||
// const seatfee=(props.orderInfo.amount==0&&allPrice.value==0)?seatFeePrice.value:0
|
||||
// return (goodsOriginAllPrice.value-allPrice.value+seatfee*1).toFixed(2)
|
||||
// }
|
||||
// return (freePrice.value * 1 + vipDiscountPrice.value * 1 + props.orderInfo.fullCouponDiscountAmount + props
|
||||
// .orderInfo.pointsDiscountAmount + (props.orderInfo.status == 'unpaid' ? productCoupPrice.value :
|
||||
// productCouponDiscountAmount.value) * 1 + (props.orderInfo.discountAmount ||
|
||||
// 0)).toFixed(2)
|
||||
|
||||
})
|
||||
|
||||
const packFee = computed(() => {
|
||||
//不是退菜只要有打包费的都计算,包括赠送
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>支付方式</view>
|
||||
<view>{{data.payType||''}}</view>
|
||||
<view>{{returnPayType(data.payType)||''}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>下单时间</view>
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import orderEnum from '@/commons/orderEnum.js'
|
||||
const props = defineProps({
|
||||
data: {
|
||||
|
|
@ -62,7 +63,24 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
const payTypeList = [
|
||||
{name: '主扫', type:'main_scan'},
|
||||
{name: '被扫', type:'back_scan'},
|
||||
{name: '微信小程序', type:'wechat_mini'},
|
||||
{name: '支付宝小程序', type:'alipay_mini'},
|
||||
{name: '会员支付', type:'vip_pay'},
|
||||
{name: '现金支付', type:'cash_pay'},
|
||||
]
|
||||
const payTypeName = ref(null)
|
||||
|
||||
/**
|
||||
* 获取支付方式
|
||||
*/
|
||||
function returnPayType(payType) {
|
||||
let item = payTypeList.find( v=> v.type == payType )
|
||||
return item ? item.name : ''
|
||||
}
|
||||
|
||||
function returnStatus(status) {
|
||||
const item = orderEnum.status.find(v => v.key == status)
|
||||
return item ? item.label : ''
|
||||
|
|
|
|||
|
|
@ -60,12 +60,9 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const emits = defineEmits(['update:show', 'confirm'])
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
|
|
@ -83,7 +80,6 @@
|
|||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
const emits = defineEmits(['update:show', 'confirm'])
|
||||
let model = ref(null)
|
||||
let modelShow = ref(props.show)
|
||||
let number = ref(0)
|
||||
|
|
@ -101,7 +97,18 @@
|
|||
checked: false
|
||||
}])
|
||||
let timer = null
|
||||
|
||||
watch(() => props.show, (newval) => {
|
||||
modelShow.value = newval
|
||||
})
|
||||
watch(() => modelShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
if (newval) {
|
||||
open()
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
})
|
||||
|
||||
function parseIntNumber(val, isNow) {
|
||||
let newval = val * 1
|
||||
if (newval > props.data.num) {
|
||||
|
|
@ -125,18 +132,7 @@
|
|||
function changeTagSel(item) {
|
||||
item.checked = !item.checked
|
||||
}
|
||||
watch(() => props.show, (newval) => {
|
||||
modelShow.value = newval
|
||||
})
|
||||
watch(() => modelShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
if (newval) {
|
||||
open()
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function toggleModelShow(show) {
|
||||
modelShow.value = show ? true : false
|
||||
}
|
||||
|
|
@ -165,7 +161,10 @@
|
|||
})
|
||||
form.note = ''
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 确认退菜
|
||||
*/
|
||||
function confirm() {
|
||||
const selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",")
|
||||
const note = selTag + (form.note.length > 0 ? "," + form.note : "");
|
||||
|
|
@ -176,10 +175,17 @@
|
|||
if (!note) {
|
||||
return infoBox.showToast("请输入退菜原因");
|
||||
}
|
||||
emits('confirm', {
|
||||
note,
|
||||
num: number.value
|
||||
})
|
||||
let par = {
|
||||
orderId: props.data.orderId,
|
||||
refundAmount: number.value*props.data.unitPrice,
|
||||
refundReason: note,
|
||||
refundDetails: [{
|
||||
id: props.data.id,
|
||||
returnAmount: number.value*props.data.unitPrice,
|
||||
num: number.value,
|
||||
}],
|
||||
}
|
||||
emits('confirm', par)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<view style="height: 200rpx;"></view>
|
||||
<view class="u-fixed bottom bg-fff ">
|
||||
<view class="u-flex u-abso">
|
||||
<template v-if="orderDetail.info.useType=='takeout'||!orderDetail.info.tableId||orderDetail.info.useType=='dine-in-before'">
|
||||
<template v-if="orderDetail.info.useType=='take-out'||!orderDetail.info.tableCode||orderDetail.info.useType=='dine-in-before'">
|
||||
<view class="u-flex-1" v-if="orderDetail.info.status=='unpaid'">
|
||||
<my-button @tap="toPay" borderRadius="100rpx" shape="circle"
|
||||
type="primary">结账</my-button>
|
||||
|
|
@ -42,11 +42,6 @@
|
|||
|
||||
<script setup>
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import * as orderApi from '@/http/yskApi/order.js'
|
||||
import {queryAllShopUser} from '@/http/yskApi/shop-user.js'
|
||||
import {
|
||||
objToArrary
|
||||
} from '@/commons/utils/returrn-data.js'
|
||||
import userVue from './components/user.vue';
|
||||
import orderVue from './components/order.vue';
|
||||
import goodsList from './components/list.vue';
|
||||
|
|
@ -62,7 +57,7 @@
|
|||
ref
|
||||
} from 'vue';
|
||||
import OrderDetail from './page.js'
|
||||
import { getHistoryOrder } from '@/api/order.js'
|
||||
import { getHistoryOrder, refundOrder,getOrderById } from '@/api/order.js'
|
||||
import { shopStaffDetail } from '@/api/staff.js'
|
||||
import { shopUserDetail } from '@/api/shopUser.js'
|
||||
|
||||
|
|
@ -172,17 +167,14 @@
|
|||
tuicai.selGoods = goods
|
||||
}
|
||||
async function tuicaiConfirm(e) {
|
||||
const res = await Api.$returnCart({
|
||||
...e,
|
||||
cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
|
||||
tableId: orderDetail.info.tableId,
|
||||
})
|
||||
console.log(e)
|
||||
const res = await refundOrder(e)
|
||||
tuicai.show = false
|
||||
console.log(res)
|
||||
if(res){
|
||||
go.back()
|
||||
}else{
|
||||
|
||||
init()
|
||||
getOrderDetail()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +285,7 @@
|
|||
uni.$off('orderDetail:update')
|
||||
uni.$once('orderDetail:update', (newval) => {
|
||||
console.log(newval);
|
||||
init()
|
||||
getOrderDetail()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -309,7 +301,7 @@
|
|||
}
|
||||
Object.assign(submitPar, par)
|
||||
const res=await Api.$setUser(submitPar)
|
||||
init()
|
||||
getOrderDetail()
|
||||
return res
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<view class="line"></view>
|
||||
<view class=" color-main">
|
||||
<text>
|
||||
{{sendTypeFilter(data.sendType)}}
|
||||
{{sendTypeFilter(data.dineMode)}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -35,30 +35,23 @@
|
|||
<view>
|
||||
<view class=""> {{item.productName}}</view>
|
||||
<view class="color-999 u-font-24 u-m-t-8">
|
||||
{{item.productSkuName}}
|
||||
{{item.skuName}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-flex-1 u-row-right">
|
||||
<view>×{{item.num}}</view>
|
||||
<template v-if="item.gift||item.userCouponId">
|
||||
<template v-if="item.userCouponId">
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||
<text class="line-th">¥{{item.payAmount}}</text>
|
||||
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||
¥0
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else-if="item.isMember&&data.userId&&item.memberPrice&&item.memberPrice!=item.price">
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||
¥{{goodsVipPriceAmount(item)}}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text>¥{{goodsPriceAmount(item)}}</text>
|
||||
<text>¥{{item.payAmount}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
|
@ -119,17 +112,7 @@
|
|||
import dayjs from 'dayjs';
|
||||
import orderEnum from '@/commons/orderEnum.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
isTui,
|
||||
canTuiKuan,
|
||||
canTuicai
|
||||
} from '@/commons/utils/goodsUtil.js'
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
const emits = defineEmits(['printOrder'])
|
||||
const props = defineProps({
|
||||
data: {
|
||||
|
|
@ -156,31 +139,24 @@
|
|||
|
||||
const priceSize = 9
|
||||
let minWidth=ref(36)
|
||||
|
||||
/**
|
||||
* 计算菜品价格
|
||||
* @param {Object} item
|
||||
*/
|
||||
function goodsPriceAmount(item) {
|
||||
const total=(item.price * item.num).toFixed(2)
|
||||
const total=(item.payAmount * item.num).toFixed(2)
|
||||
const minW=total.length * priceSize + 15
|
||||
minWidth.value=minW<minWidth.value?minWidth.value:minW
|
||||
return total
|
||||
}
|
||||
|
||||
function goodsVipPriceAmount(item) {
|
||||
const price = item.memberPrice ? item.memberPrice : item.price
|
||||
return (price * item.num).toFixed(2)
|
||||
}
|
||||
// const packeFee=computed(()=>{
|
||||
// return props.data.goods.reduce((prve,cur)=>{
|
||||
// return prve+cur.packAmount
|
||||
// },0).toFixed(2)
|
||||
// })
|
||||
function computedPriceStyle() {
|
||||
return {
|
||||
'min-width':minWidth.value + 'px'
|
||||
}
|
||||
}
|
||||
// const computedPriceStyle = computed(() => {
|
||||
|
||||
// })
|
||||
|
||||
|
||||
function goodsMapInit() {
|
||||
for (let i in props.data.goods) {
|
||||
const goods = props.data.goods[i]
|
||||
|
|
@ -211,9 +187,8 @@
|
|||
}
|
||||
|
||||
function sendTypeFilter(t) {
|
||||
console.log(t);
|
||||
if (t) {
|
||||
const item = orderEnum.sendType.find(item => item.key == t)
|
||||
const item = orderEnum.dineMode.find(item => item.key == t)
|
||||
return item ? item.label : '';
|
||||
} else {
|
||||
return t;
|
||||
|
|
|
|||
|
|
@ -99,15 +99,15 @@
|
|||
<text class="u-m-l-10 no-wrap">{{item.payName}}</text>
|
||||
</view>
|
||||
<view class="u-flex color-999 u-font-24">
|
||||
<view class="u-m-r-20" v-if="item.payType=='virtual'&&user.id"
|
||||
<view class="u-m-r-20" v-if="item.payType=='virtual'&&pageData.user.id"
|
||||
@click.stop="chooseUser">
|
||||
<view>
|
||||
<text>会员:</text>
|
||||
<text class="u-m-r-4">{{user.telephone||user.nickName}}</text>
|
||||
<text class="u-m-r-4">{{pageData.user.phone||pageData.user.nickName}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>余额:</text>
|
||||
<text>¥{{user.amount||'0'}}</text>
|
||||
<text>¥{{pageData.user.amount||'0'}}</text>
|
||||
</view>
|
||||
<!-- <view>
|
||||
<text>积分:</text>
|
||||
|
|
@ -125,12 +125,12 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="border-bottom-dashed "></view>
|
||||
<view class="u-flex u-row-between u-p-t-24" v-if="user.id" @click="changeAccountPoints">
|
||||
<view class="u-flex u-row-between u-p-t-24" v-if="pageData.user.id" @click="changeAccountPoints">
|
||||
<view class="u-flex ">
|
||||
<view class="">积分抵扣</view>
|
||||
<view class="color-999 u-m-l-10">
|
||||
<text>(</text>
|
||||
<text>{{user.accountPoints||'0'}}</text>
|
||||
<text>{{pageData.user.accountPoints||'0'}}</text>
|
||||
<text>)</text>
|
||||
</view>
|
||||
<!-- <view><text class="color-red font-bold">{{accountPoints.price}}</text>元</view> -->
|
||||
|
|
@ -260,7 +260,13 @@
|
|||
let option = {
|
||||
isNowPay: false
|
||||
}
|
||||
|
||||
const pageData = reactive({
|
||||
goodsList: [], //菜品列表
|
||||
user: { //会员信息
|
||||
userId: null,
|
||||
amount: 0
|
||||
}
|
||||
})
|
||||
const order = reactive({
|
||||
orderAmount: 0
|
||||
})
|
||||
|
|
@ -294,10 +300,7 @@
|
|||
price: 0
|
||||
})
|
||||
let timer = null
|
||||
|
||||
let user = ref({
|
||||
amount: 0
|
||||
});
|
||||
|
||||
const refPoints = ref(null)
|
||||
let payCodeUrl = ref('') //收款二维码地址
|
||||
onShow(() => {
|
||||
|
|
@ -319,6 +322,43 @@
|
|||
uni.$emit('orderDetail:update')
|
||||
console.log('onBackPress');
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
async function init() {
|
||||
// 获取订单详情
|
||||
const orderRes = await getHistoryOrder({orderId:order.orderId})
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailMap)
|
||||
pageData.goodsList = [];
|
||||
Object.values(orderRes.detailMap).forEach(item=>{
|
||||
pageData.goodsList = [...pageData.goodsList,...item]
|
||||
})
|
||||
const hasSelQuan = orderRes.couponInfoList ? JSON.parse(orderRes.couponInfoList) : {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: []
|
||||
};
|
||||
const fullReductionCoupon = hasSelQuan.fullReductionCoupon.filter(v => v.type == 1)
|
||||
const productCoupon = hasSelQuan.productCoupon.filter(v => v.type == 2)
|
||||
setQuan([...fullReductionCoupon, ...productCoupon])
|
||||
|
||||
// 获取用户信息
|
||||
console.log(order.userId)
|
||||
console.log(!pageData.user.userId)
|
||||
if (order.userId&&!pageData.user.userId) {
|
||||
calcUsablePoints()
|
||||
if (orderRes.pointsNum) {
|
||||
accountPoints.sel = true
|
||||
}
|
||||
shopUserDetail({
|
||||
userId: order.userId || pageData.user.userId
|
||||
}).then(res => {
|
||||
pageData.user = res
|
||||
})
|
||||
}
|
||||
}
|
||||
const coupAllPrice = computed(() => {
|
||||
const n = pays.quan.reduce((prve, cur) => {
|
||||
return prve + cur.discountAmount * 1
|
||||
|
|
@ -326,43 +366,60 @@
|
|||
return n
|
||||
})
|
||||
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
const payPrice = computed(() => {
|
||||
const total = (originPrice.value) - vipDiscount.value - productCouponDiscountAmount.value - discount
|
||||
.value -
|
||||
fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 菜品打包费
|
||||
*/
|
||||
const packAmount = computed(() => {
|
||||
if(pageData.goodsList){
|
||||
let price = pageData.goodsList.filter(v => v.packNumber > 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + (b.packNumber * b.packAmount)
|
||||
}, 0)
|
||||
return price
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
const originPrice = computed(() => {
|
||||
console.log(order)
|
||||
const n = (order.orderAmount || 0) * 1 + vipDiscount.value * 1 + (order.fullCouponDiscountAmount || 0) + (order
|
||||
.productCouponDiscountAmount || 0) +
|
||||
(order.pointsDiscountAmount || 0)
|
||||
console.log(n)
|
||||
return n.toFixed(2)
|
||||
console.log(packAmount)
|
||||
if(pageData.goodsList){
|
||||
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + (b.num * b.price)
|
||||
}, 0)
|
||||
return (goodsPrice + order.seatNum + packAmount.value).toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 会员优惠金额
|
||||
*/
|
||||
const vipDiscount = computed(() => {
|
||||
if (!user.value.isVip) {
|
||||
if (!pageData.user.isVip) {
|
||||
return 0
|
||||
}
|
||||
let goods_list = []
|
||||
Object.values(order.detailMap).forEach(item=>{
|
||||
goods_list = [...goods_list,...item]
|
||||
})
|
||||
const goodsPrice = goods_list.filter(v => v.price != 0 && v.status !== "return" && v.memberPrice && (v.memberPrice != v.price)).reduce((
|
||||
a,
|
||||
b) => {
|
||||
return a + (b.num * (b.price - b.memberPrice))
|
||||
}, 0)
|
||||
console.log(goodsPrice)
|
||||
return goodsPrice.toFixed(2)
|
||||
if(pageData.goodsList){
|
||||
let price = pageData.goodsList.filter(v => v.price != 0 && v.discountSaleAmount <= 0 && v.status !== "return" && v.memberPrice && (v.memberPrice != v.price)).reduce((a, b) => {
|
||||
return a + (b.num * (b.price - b.memberPrice))
|
||||
}, 0)
|
||||
return price.toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 菜品折扣金额
|
||||
*/
|
||||
const discountSaleAmount = computed(() => {
|
||||
if(pageData.goodsList){
|
||||
let price = pageData.goodsList.filter(v => v.discountSaleAmount > 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + (b.num * b.discountSaleAmount)
|
||||
}, 0)
|
||||
return price
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 优惠券金额
|
||||
*/
|
||||
|
|
@ -372,6 +429,7 @@
|
|||
return prve + cur.discountAmount * 1
|
||||
}, 0)
|
||||
})
|
||||
|
||||
/**
|
||||
* 商品券金额
|
||||
*/
|
||||
|
|
@ -385,11 +443,30 @@
|
|||
* 积分计算
|
||||
*/
|
||||
const pointCanDicountPrice = computed(() => {
|
||||
const total = (order.orderAmount || 0) - productCouponDiscountAmount.value - discount.value -
|
||||
let total = (originPrice.value || 0) - productCouponDiscountAmount.value - discount.value -
|
||||
fullCouponDiscountAmount.value
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
const payPrice = computed(() => {
|
||||
console.log("originPrice===",originPrice.value)
|
||||
console.log("vipDiscount===",vipDiscount.value)
|
||||
console.log("discountSaleAmount===",discountSaleAmount.value)
|
||||
console.log("pointCanDicountPrice===",pointCanDicountPrice.value)
|
||||
console.log("productCouponDiscountAmount===",productCouponDiscountAmount.value)
|
||||
console.log("discount===",discount.value)
|
||||
console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value)
|
||||
console.log("accountPoints===",accountPoints)
|
||||
let total = (originPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
console.log(total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
watch(() => accountPoints.sel, (newval) => {
|
||||
if (newval) {
|
||||
calcDeDuctionPoints()
|
||||
|
|
@ -442,58 +519,26 @@
|
|||
* 获取店铺订单支付URL
|
||||
*/
|
||||
function getPayUrl() {
|
||||
getOrderPayUrl({
|
||||
console.log(vipDiscount.value)
|
||||
let par = {
|
||||
shopId: uni.getStorageSync("shopInfo").id,
|
||||
orderId: order.id,
|
||||
orderAmount: payPrice.value,
|
||||
userId: order.userId||user.value.userId,
|
||||
seatNum: order.seatNum, // 用餐人数
|
||||
discountRatio: (discount.discount/100).toFixed(0), // 折扣比例
|
||||
discountAmount: discount.value, // 手动优惠金额
|
||||
fullCouponDiscountAmount: fullCouponDiscountAmount.value, // 满减金额
|
||||
orderAmount: originPrice.value, // 订单金额
|
||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||
// couponList: pays.quan.map(v => {
|
||||
// return {
|
||||
// userCouponId: v.id,
|
||||
// num: v.number
|
||||
// }
|
||||
// }),
|
||||
}).then(res => {
|
||||
vipPrice: vipDiscount.value > 0 ? 1: 0, // 是否使用会员价
|
||||
}
|
||||
if( order.userId||pageData.user.userId ){
|
||||
par.userId = order.userId||pageData.user.userId
|
||||
}
|
||||
getOrderPayUrl(par).then(res => {
|
||||
payCodeUrl.value = res
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
async function init() {
|
||||
// 获取订单详情
|
||||
const orderRes = await getHistoryOrder({orderId:order.orderId})
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailMap)
|
||||
|
||||
const hasSelQuan = orderRes.couponInfoList ? JSON.parse(orderRes.couponInfoList) : {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: []
|
||||
};
|
||||
const fullReductionCoupon = hasSelQuan.fullReductionCoupon.filter(v => v.type == 1)
|
||||
const productCoupon = hasSelQuan.productCoupon.filter(v => v.type == 2)
|
||||
setQuan([...fullReductionCoupon, ...productCoupon])
|
||||
|
||||
// 获取用户信息
|
||||
if (order.userId||user.value.userId) {
|
||||
calcUsablePoints()
|
||||
if (orderRes.pointsNum) {
|
||||
accountPoints.sel = true
|
||||
}
|
||||
shopUserDetail({
|
||||
userId: order.userId || user.value.userId
|
||||
}).then(res => {
|
||||
user.value = res
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付方式
|
||||
|
|
@ -581,12 +626,11 @@
|
|||
accountPoints.num = e
|
||||
}
|
||||
async function calcUsablePoints(orderAmount) {
|
||||
if (!order.userId&&!user.value.userId) {
|
||||
if (!order.userId&&!pageData.user.userId) {
|
||||
return
|
||||
}
|
||||
console.log(orderAmount);
|
||||
const res = await Api.$calcUsablePoints({
|
||||
userId: order.userId||user.value.userId,
|
||||
userId: order.userId||pageData.user.userId,
|
||||
orderAmount: orderAmount ? orderAmount : payPrice.value
|
||||
})
|
||||
accountPoints.calcRes = res
|
||||
|
|
@ -600,7 +644,7 @@
|
|||
return ''
|
||||
}
|
||||
const res = await Api.$calcDeDuctionPoints({
|
||||
userId: order.userId||user.value.userId,
|
||||
userId: order.userId||pageData.user.userId,
|
||||
orderAmount: originPrice.value,
|
||||
points: accountPoints.num
|
||||
})
|
||||
|
|
@ -626,14 +670,14 @@
|
|||
*/
|
||||
function toQuan() {
|
||||
console.log(order);
|
||||
if (!order.userId&&!user.value.id) {
|
||||
if (!order.userId&&!pageData.user.id) {
|
||||
return infoBox.showToast('请先选择会员', 0.5).then(() => {
|
||||
chooseUser()
|
||||
})
|
||||
}
|
||||
go.to('PAGES_ORDER_QUAN', {
|
||||
orderId: order.id,
|
||||
userId: order.userId||user.value.userId,
|
||||
shopUserId: pageData.user.id,
|
||||
orderPrice: (payPrice.value * 1 + coupAllPrice.value * 1).toFixed(2)
|
||||
})
|
||||
}
|
||||
|
|
@ -683,7 +727,7 @@
|
|||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
console.log(data);
|
||||
user.value = data
|
||||
pageData.user = data
|
||||
pays.quan = []
|
||||
init()
|
||||
})
|
||||
|
|
@ -723,8 +767,8 @@
|
|||
}
|
||||
pays.payTypes.selIndex = i
|
||||
console.log(item.payType)
|
||||
console.log(user.value.id)
|
||||
if (item.payType == 'virtual' && !user.value.id) {
|
||||
console.log(pageData.user.id)
|
||||
if (item.payType == 'virtual' && !pageData.user.id) {
|
||||
chooseUser()
|
||||
}
|
||||
}
|
||||
|
|
@ -761,7 +805,7 @@
|
|||
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||
return cashConfirmShow()
|
||||
}
|
||||
if (payType == 'virtual' && user.value.amount * 1 < order.orderAmount * 1) {
|
||||
if (payType == 'virtual' && pageData.user.amount * 1 < order.orderAmount * 1) {
|
||||
infoBox.showToast('余额不足')
|
||||
return
|
||||
}
|
||||
|
|
@ -789,12 +833,12 @@
|
|||
shopId: uni.getStorageSync("shopInfo").id,
|
||||
checkOrderPay: {
|
||||
orderId: order.id || order.orderId,
|
||||
userId: order.userId||user.value.userId,
|
||||
seatNum: order.seatNum, // 用餐人数
|
||||
discountRatio: (discount.discount/100).toFixed(0), // 折扣比例
|
||||
discountAmount: discount.value, // 手动优惠金额
|
||||
fullCouponDiscountAmount: fullCouponDiscountAmount.value, // 满减金额
|
||||
orderAmount: originPrice.value, // 订单金额
|
||||
orderAmount: payPrice.value, // 订单金额
|
||||
vipPrice: vipDiscount.value > 0 ? 1: 0, // 是否使用会员价
|
||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||
couponList: pays.quan.map(v => {
|
||||
return {
|
||||
|
|
@ -806,16 +850,29 @@
|
|||
},
|
||||
|
||||
}
|
||||
if( order.userId||pageData.user.userId ){
|
||||
params.checkOrderPay.userId = order.userId||pageData.user.userId
|
||||
}
|
||||
console.log(params)
|
||||
if (payType == 'scanCode' || payType == 'deposit' || payType == 'bank') {
|
||||
}
|
||||
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||
await cashPay(params)
|
||||
try {
|
||||
await cashPay(params)
|
||||
} catch (error) {
|
||||
payStatus = '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (payType == 'virtual' && user.value.amount * 1 > order.orderAmount * 1) {
|
||||
if (payType == 'virtual' && pageData.user.amount * 1 > order.orderAmount * 1) {
|
||||
params.payType = 'userPay'
|
||||
params.shopUserId = user.value.id
|
||||
await vipPay(params)
|
||||
params.shopUserId = pageData.user.id
|
||||
try {
|
||||
await vipPay(params)
|
||||
} catch (error) {
|
||||
payStatus = '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
paySuccess()
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@
|
|||
} from '../quan_util.js'
|
||||
import { getHistoryOrder } from '@/api/order.js'
|
||||
import { shopUserDetail } from '@/api/shopUser.js'
|
||||
import { getCouponList } from '@/api/coupon.js'
|
||||
import { getFindCoupon } from '@/api/coupon.js'
|
||||
|
||||
|
||||
const modal = reactive({
|
||||
|
|
@ -161,7 +161,7 @@
|
|||
|
||||
const option = reactive({
|
||||
orderId: '',
|
||||
userId: '',
|
||||
shopUserId: '',
|
||||
orderPrice: 0
|
||||
})
|
||||
const pageData = reactive({
|
||||
|
|
@ -218,13 +218,16 @@
|
|||
* 获取优惠券
|
||||
*/
|
||||
async function getQuan() {
|
||||
shopUserDetail({ id: option.userId }).then(res=>{
|
||||
shopUserDetail({ id: option.shopUserId }).then(res=>{
|
||||
pageData.user = res
|
||||
})
|
||||
pageData.order = await getHistoryOrder({orderId:option.orderId})
|
||||
|
||||
console.log(pageData.order);
|
||||
const res = await getCouponList()
|
||||
const res = await getFindCoupon({
|
||||
shopUserId: option.shopUserId,
|
||||
type: pageData.types.sel
|
||||
})
|
||||
let fullReductionCoupon = res.filter(v => v.type == 1)
|
||||
let productCoupon = res.filter(v => v.type == 2)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,30 +4,9 @@ const path = require('path')
|
|||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
// devServer: {
|
||||
// proxy: {
|
||||
// '/shopApi': {
|
||||
// target: 'https://wxcashiertest.sxczgkj.cn/cashierService',
|
||||
// changeOrigin: true,
|
||||
// pathRewrite: {
|
||||
// '^/shopApi': ''
|
||||
// },
|
||||
// bypass(req, res, options) {
|
||||
// const proxyURL = options.target + options.rewrite(req.url);
|
||||
// req.headers['x-req-proxyURL'] = proxyURL; // 设置未生效
|
||||
// res.setHeader('x-req-proxyURL', proxyURL); // 设置响应头可以看到
|
||||
// },
|
||||
// onProxyRes(proxyRes, req, res) {
|
||||
// const realUrl = process.env.BASEURL + req.url || ''; // 真实请求网址
|
||||
// console.log(realUrl); // 在终端显示
|
||||
// proxyRes.headers['A-Real-Url'] = realUrl; // 添加响应标头(A-Real-Url为自定义命名),在浏览器中显示
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
devServer: {
|
||||
proxy: {
|
||||
'/account': {
|
||||
'/api': {
|
||||
target: 'https://tapi.cashier.sxczgkj.cn', // 目标服务器地址
|
||||
changeOrigin: true, // 是否改变源地址
|
||||
rewrite: '/' // 重写路径
|
||||
|
|
|
|||
Loading…
Reference in New Issue