购物车历史订单增加,代码优化
This commit is contained in:
parent
5a655ba09e
commit
5e6646b574
8
App.vue
8
App.vue
|
|
@ -16,6 +16,11 @@ App.vue本身不是页面,这里不能编写视图元素,也就是没有<tem
|
||||||
|
|
||||||
});
|
});
|
||||||
onLaunch(() => {
|
onLaunch(() => {
|
||||||
|
// 非开发工具移除 console.log console.info
|
||||||
|
if (uni.getSystemInfoSync().platform !== "devtools") {
|
||||||
|
console.log = () => {};
|
||||||
|
console.info = () => {};
|
||||||
|
}
|
||||||
let that = this
|
let that = this
|
||||||
uni.hideTabBar()
|
uni.hideTabBar()
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
|
|
@ -32,7 +37,8 @@ App.vue本身不是页面,这里不能编写视图元素,也就是没有<tem
|
||||||
// 新版本下载失败
|
// 新版本下载失败
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
|
// console.log("getSystemSetting==",uni.getSystemInfoSync())
|
||||||
|
// console.log("getSystemSetting==",uni.getSystemSetting())
|
||||||
|
|
||||||
|
|
||||||
//#ifdef APP-PLUS
|
//#ifdef APP-PLUS
|
||||||
|
|
|
||||||
|
|
@ -28,3 +28,10 @@ export function getThisMonthTimestamps() {
|
||||||
return { start, end ,label:'本月'};
|
return { start, end ,label:'本月'};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取上个月的开始和结束时间
|
||||||
|
export function getThisLastMonthTimestamps() {
|
||||||
|
const start = dayjs().subtract(1, 'month').startOf('month').format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
const end = dayjs().subtract(1, 'month').endOf('month').format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
return { start, end ,label:'上月'};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -8,7 +8,6 @@ export const utils = {
|
||||||
* @param {Object} e
|
* @param {Object} e
|
||||||
*/
|
*/
|
||||||
isNumber (e) {
|
isNumber (e) {
|
||||||
console.log(e)
|
|
||||||
return e.replace(/[^\d]/g, '')
|
return e.replace(/[^\d]/g, '')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import {
|
|
||||||
getCurrentInstance,
|
import { getCurrentInstance } from 'vue';
|
||||||
} from 'vue';
|
|
||||||
export async function getElRect(elClass, instance,option) {
|
export async function getElRect(elClass, instance,option) {
|
||||||
instance = instance ? instance : getCurrentInstance();
|
instance = instance ? instance : getCurrentInstance();
|
||||||
const query = uni.createSelectorQuery().in(instance.proxy);
|
const query = uni.createSelectorQuery().in(instance.proxy);
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,6 @@ const model = {
|
||||||
if (envMode) {
|
if (envMode) {
|
||||||
uni.setStorageSync(appConfig.storeEnvEnumKey, envMode) // 改变存储
|
uni.setStorageSync(appConfig.storeEnvEnumKey, envMode) // 改变存储
|
||||||
}
|
}
|
||||||
console.log(appConfig.storeEnvEnumKey)
|
|
||||||
|
|
||||||
return uni.getStorageSync(appConfig.storeEnvEnumKey)
|
return uni.getStorageSync(appConfig.storeEnvEnumKey)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="u-p-30 u-flex u-flex-wrap gap-20 fastTime" v-if="props.isArea">
|
<view class="u-p-30 u-flex u-flex-wrap gap-20 fastTime" v-if="props.isArea">
|
||||||
<view class="item" v-for="(item,index) in fastTime" :key="index" @tap="changeTime(item.key)">
|
<view class="item" v-for="(item,index) in fastTime" :key="index" @tap="changeTime(item)">
|
||||||
{{item.title}}
|
{{item.label}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<picker-view :immediate-change="true" @pickend="pickend" :value="value" @change="bindChange"
|
<picker-view :immediate-change="true" @pickend="pickend" :value="value" @change="bindChange"
|
||||||
|
|
@ -95,12 +95,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { reactive, nextTick, ref } from 'vue';
|
||||||
|
import * as $time from '@/commons/utils/dayjs-time.js';
|
||||||
import myButton from "@/components/my-components/my-button.vue"
|
import myButton from "@/components/my-components/my-button.vue"
|
||||||
import {
|
|
||||||
reactive,
|
|
||||||
nextTick,
|
|
||||||
ref
|
|
||||||
} from 'vue';
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
selTime:{
|
selTime:{
|
||||||
type: [String,Number],
|
type: [String,Number],
|
||||||
|
|
@ -178,24 +176,28 @@
|
||||||
const seconds = new Array(60).fill(1).map((v, index) => {
|
const seconds = new Array(60).fill(1).map((v, index) => {
|
||||||
return index
|
return index
|
||||||
})
|
})
|
||||||
const fastTime = reactive([{
|
// const fastTime = reactive([{
|
||||||
title: '今日',
|
// title: '今日',
|
||||||
key: 'now'
|
// key: 'now'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
title: '昨日',
|
// title: '昨日',
|
||||||
key: 'prve'
|
// key: 'prve'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
title: '本月',
|
// title: '本月',
|
||||||
key: 'nowMonth'
|
// key: 'nowMonth'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
title: '上月',
|
// title: '上月',
|
||||||
key: 'prveMonth'
|
// key: 'prveMonth'
|
||||||
}
|
// }
|
||||||
])
|
// ])
|
||||||
|
const today = $time.getTodayTimestamps();
|
||||||
|
const yesterday = $time.getYesterdayTimestamps();
|
||||||
|
const thisMonth = $time.getThisMonthTimestamps();
|
||||||
|
const thisLastMonth = $time.getThisLastMonthTimestamps()
|
||||||
|
const fastTime = reactive([today, yesterday, thisMonth, thisLastMonth])
|
||||||
|
|
||||||
|
|
||||||
function setPrveDay() {
|
function setPrveDay() {
|
||||||
|
|
@ -230,84 +232,10 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeTime(key) {
|
function changeTime(e) {
|
||||||
const yearIndex = years.findIndex(v => v == nowDate.year)
|
console.log(e)
|
||||||
const prveyearIndex = years.findIndex(v => v == nowDate.year) - 1
|
const start = e.start
|
||||||
const nowMonthIndex = nowDate.month - 1
|
const end = e.end
|
||||||
const nowDayIndex = nowDate.day - 1
|
|
||||||
const dataMap = {
|
|
||||||
now: function() {
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year: yearIndex,
|
|
||||||
month: nowMonthIndex,
|
|
||||||
day: nowDayIndex
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year: yearIndex,
|
|
||||||
month: nowMonthIndex,
|
|
||||||
day: nowDayIndex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
prve: function() {
|
|
||||||
const oneDay = 1000 * 60 * 60 * 24
|
|
||||||
const date = new Date(new Date(nowDate.year, nowDate.month, nowDate.day, 0, 0, 0).getTime() -
|
|
||||||
oneDay)
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year: years.findIndex(v => v == date.getFullYear()),
|
|
||||||
month: date.getMonth() - 1 < 0 ? 11 : date.getMonth() - 1,
|
|
||||||
day: date.getDate() - 1
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year: years.findIndex(v => v == date.getFullYear()),
|
|
||||||
month: date.getMonth() - 1 < 0 ? 11 : date.getMonth() - 1,
|
|
||||||
day: date.getDate() - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nowMonth: function() {
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year: yearIndex,
|
|
||||||
month: nowMonthIndex,
|
|
||||||
day: 0
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year: yearIndex,
|
|
||||||
month: nowMonthIndex,
|
|
||||||
day: new Date(nowDate.year, nowDate.month, 0).getDate() - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
prveMonth: function() {
|
|
||||||
const oneDay = 1000 * 60 * 60 * 24
|
|
||||||
const date = new Date(new Date(nowDate.year, nowDate.month - 1, 0, 0, 0).getTime() - oneDay)
|
|
||||||
console.log(date.getMonth());
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year: years.findIndex(v => v == date.getFullYear()),
|
|
||||||
month: date.getMonth(),
|
|
||||||
day: 0
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year: years.findIndex(v => v == date.getFullYear()),
|
|
||||||
month: date.getMonth(),
|
|
||||||
day: date.getDate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const data = dataMap[key]()
|
|
||||||
setDay(data.start, data.end)
|
|
||||||
changeDays(false, value.value)
|
|
||||||
changeDays(true, value1.value)
|
|
||||||
|
|
||||||
console.log(value1.value);
|
|
||||||
const start = returnDateString(value.value)
|
|
||||||
const end = returnDateString(value1.value)
|
|
||||||
|
|
||||||
emits('confirm', {
|
emits('confirm', {
|
||||||
text: `${start}——${end}`,
|
text: `${start}——${end}`,
|
||||||
start,
|
start,
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,7 @@ const processEnv = process.env.NODE_ENV
|
||||||
// 改变env环境
|
// 改变env环境
|
||||||
function changeEnv(envMode){
|
function changeEnv(envMode){
|
||||||
appConfig.env = allEnvMap[envMode || processEnv]
|
appConfig.env = allEnvMap[envMode || processEnv]
|
||||||
|
appConfig.wss = allEnvMap[envMode || processEnv].JEEPAY_BASE_URL_WSS
|
||||||
// // 动态导包的方式:设置全局env配置项目 : 当参数不存在, 那么获取node环境
|
|
||||||
// import(`./env.${envMode || processEnv}.js`).then(module => {
|
|
||||||
// appConfig.env = module.default
|
|
||||||
// }).catch(() => {
|
|
||||||
// appConfig.env = production //当出现错误, 比如本地没有复制dev文件时, 默认使用生产环境
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { changeEnv: changeEnv }
|
export default { changeEnv: changeEnv }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
export default {
|
export default {
|
||||||
'JEEPAY_BASE_URL': 'https://b.rscygroup.com', // 请求URL(生产环境)
|
'JEEPAY_BASE_URL': 'http://192.168.1.31/', // 请求URL(生产环境)
|
||||||
'JEEPAY_BASE_URL_H5': 'https://b.rscygroup.com'
|
'JEEPAY_BASE_URL_H5': 'http://192.168.1.31/',
|
||||||
// 'JEEPAY_BASE_URL': 'http://192.168.1.8:9218' // 请求URL(测试环境)
|
'JEEPAY_BASE_URL_WSS': 'ws://192.168.1.31:2348' ,// sockets
|
||||||
// 'JEEPAY_BASE_URL': 'https://b.qilinshuzi.com' //支付网关URL
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
export default {
|
export default {
|
||||||
'JEEPAY_BASE_URL': 'https://b.rscygroup.com', // 请求URL(生产环境)
|
'JEEPAY_BASE_URL': 'https://cashier.sxczgkj.com/', // 请求URL(生产环境)
|
||||||
'JEEPAY_BASE_URL_H5': 'https://b.rscygroup.com'
|
'JEEPAY_BASE_URL_H5': 'https://cashier.sxczgkj.com/',
|
||||||
// 'JEEPAY_BASE_URL': 'http://192.168.1.8:9218' // 请求URL(测试环境)
|
'JEEPAY_BASE_URL_WSS': 'wss://czgeatws.sxczgkj.com/wss' // sockets
|
||||||
// 'JEEPAY_BASE_URL': 'https://b.qilinshuzi.com' //支付网关URL
|
|
||||||
}
|
}
|
||||||
|
|
@ -85,5 +85,32 @@ export function printOrder(data, urlType = 'order') {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空历史订单
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function cancelOrder(data, urlType = 'order') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/order/cancelOrder`,
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空某一次历史订单
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function rmPlaceOrder(data, urlType = 'order') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/order/rmPlaceOrder`,
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
16
http/http.js
16
http/http.js
|
|
@ -6,16 +6,17 @@
|
||||||
* @site https://www.jeequan.com
|
* @site https://www.jeequan.com
|
||||||
* @date 2021/12/16 18:35
|
* @date 2021/12/16 18:35
|
||||||
*/
|
*/
|
||||||
|
// 设置env配置文件
|
||||||
|
import envConfig from '@/env/config.js'
|
||||||
// 导入全局属性
|
// 导入全局属性
|
||||||
import appConfig from '@/config/appConfig.js'
|
import appConfig from '@/config/appConfig.js'
|
||||||
import storageManage from '@/commons/utils/storageManage.js'
|
import storageManage from '@/commons/utils/storageManage.js'
|
||||||
import {
|
import { sm4DecryptByResData } from '@/commons/utils/encryptUtil.js'
|
||||||
sm4DecryptByResData
|
|
||||||
} from '@/commons/utils/encryptUtil.js'
|
|
||||||
import infoBox from "@/commons/utils/infoBox.js"
|
import infoBox from "@/commons/utils/infoBox.js"
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import { reject } from 'lodash';
|
import { reject } from 'lodash';
|
||||||
|
// 设置node环境
|
||||||
|
envConfig.changeEnv(storageManage.env())
|
||||||
|
|
||||||
// 测试服
|
// 测试服
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
|
|
@ -27,13 +28,12 @@ let baseUrl = '/api/'
|
||||||
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||||
|
|
||||||
//正式
|
//正式
|
||||||
let baseUrl = 'https://cashier.sxczgkj.com/'
|
// let baseUrl = 'https://cashier.sxczgkj.com/'
|
||||||
|
let baseUrl = appConfig.env.JEEPAY_BASE_URL
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
const loadingShowTime = 200
|
const loadingShowTime = 200
|
||||||
|
|
||||||
|
|
||||||
function getHeader(){
|
function getHeader(){
|
||||||
const headerObject={}
|
const headerObject={}
|
||||||
headerObject["token"] = storageManage.token()
|
headerObject["token"] = storageManage.token()
|
||||||
|
|
@ -134,7 +134,7 @@ function commonsProcess(showLoading, httpReqCallback) {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if(res.code==501){
|
if(res.code==501){
|
||||||
storageManage.token(null, true)
|
storageManage.token(null, true)
|
||||||
infoBox.showToast(res.msg||'请登录').then(() => {
|
infoBox.showToast('登录过期,请重新登录').then(() => {
|
||||||
uni.redirectTo({url: '/pages/login/index'})
|
uni.redirectTo({url: '/pages/login/index'})
|
||||||
reject()
|
reject()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox_tow">
|
<view class="boxconstantbox_tow">
|
||||||
<text>用户消费结账时,成功充值</text>
|
<text>用户消费结账时,成功充值</text>
|
||||||
<input class="text" type="digit" v-model="form.rechargeTimes" @change="form.rechargeTimes = $utils.isMoney(form.rechargeTimes)"/>
|
<input class="text" type="number" :min='2' v-model="form.rechargeTimes" @change="rechargeTimesInput"/>
|
||||||
<text>倍的金额本单即可享受免单</text>
|
<text>倍的金额本单即可享受免单</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
import { getFreeDing, updateFreeDing } from '@/http/api/freeDing.js'
|
import { getFreeDing, updateFreeDing } from '@/http/api/freeDing.js'
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
rechargeTimes: '',
|
rechargeTimes: 2,
|
||||||
rechargeThreshold: '',
|
rechargeThreshold: '',
|
||||||
enable: false,
|
enable: false,
|
||||||
rechargeDesc: '',
|
rechargeDesc: '',
|
||||||
|
|
@ -71,6 +71,14 @@
|
||||||
Object.assign(form, res)
|
Object.assign(form, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let rechargeTimesInput = (e) => {
|
||||||
|
if( uni.$utils.isNumber(e.detail.value) == '' || uni.$utils.isNumber(e.detail.value) < 2 ){
|
||||||
|
form.rechargeTimes = 2;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
form.rechargeTimes = uni.$utils.isNumber(e.detail.value)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改配置信息
|
* 修改配置信息
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,12 @@
|
||||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
||||||
text="保存"></up-button>
|
text="保存"></up-button>
|
||||||
</view>
|
</view>
|
||||||
<!-- 消息提示 -->
|
|
||||||
<up-toast ref="uToastRef"></up-toast>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, getCurrentInstance } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import { addVendor } from '@/http/api/vendor.js';
|
import { addVendor } from '@/http/api/vendor.js';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -42,7 +41,6 @@
|
||||||
shopId: uni.getStorageSync("shopId"),
|
shopId: uni.getStorageSync("shopId"),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const currentInstance = getCurrentInstance()
|
|
||||||
|
|
||||||
function sumbit() {
|
function sumbit() {
|
||||||
if (!datas.form.name || !datas.form.telephone || !datas.form.address) {
|
if (!datas.form.name || !datas.form.telephone || !datas.form.address) {
|
||||||
|
|
@ -53,10 +51,7 @@
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
addVendor(datas.form).then(res => {
|
addVendor(datas.form).then(res => {
|
||||||
currentInstance.ctx.$refs.uToastRef.show({
|
uni.$utils.showToast("添加成功")
|
||||||
message: "添加成功",
|
|
||||||
type: 'default',
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted, reactive, getCurrentInstance } from 'vue';
|
import { ref, computed, onMounted, reactive } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,13 +58,11 @@
|
||||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
||||||
text="保存"></up-button>
|
text="保存"></up-button>
|
||||||
</view>
|
</view>
|
||||||
<!-- 消息提示 -->
|
|
||||||
<up-toast ref="uToastRef"></up-toast>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, reactive, onMounted, getCurrentInstance } from 'vue';
|
import { ref, computed, reactive, onMounted } from 'vue';
|
||||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
@ -73,7 +71,6 @@
|
||||||
import { stockOut } from '@/http/api/cons.js';
|
import { stockOut } from '@/http/api/cons.js';
|
||||||
|
|
||||||
let showStatus = ref(false)
|
let showStatus = ref(false)
|
||||||
const refs = getCurrentInstance()
|
|
||||||
let datas = reactive({
|
let datas = reactive({
|
||||||
show: false,
|
show: false,
|
||||||
// 供应商列表
|
// 供应商列表
|
||||||
|
|
@ -144,17 +141,11 @@
|
||||||
let sumbit = uni.$utils.debounce(() => {
|
let sumbit = uni.$utils.debounce(() => {
|
||||||
|
|
||||||
if (!datas.form.bodyList.inOutNumber) {
|
if (!datas.form.bodyList.inOutNumber) {
|
||||||
refs.ctx.$refs.uToastRef.show({
|
uni.$utils.showToast("请输入必填项")
|
||||||
type: 'default',
|
|
||||||
message: "请输入必填项",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!datas.form.bodyList.purchasePrice) {
|
if (!datas.form.bodyList.purchasePrice) {
|
||||||
refs.ctx.$refs.uToastRef.show({
|
uni.$utils.showToast("请输入必填项")
|
||||||
type: 'default',
|
|
||||||
message: "请输入必填项",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
datas.form.bodyList.conId = datas.item.id
|
datas.form.bodyList.conId = datas.item.id
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, getCurrentInstance, ref, reactive } from 'vue';
|
import { onMounted, ref, reactive } from 'vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
import datePickerview from './components/my-date-pickerview.vue'
|
import datePickerview from './components/my-date-pickerview.vue'
|
||||||
|
|
@ -139,7 +139,7 @@
|
||||||
PopUp: false,
|
PopUp: false,
|
||||||
form: {}
|
form: {}
|
||||||
})
|
})
|
||||||
const currentInstance = getCurrentInstance()
|
const datePicker = ref()
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: Number
|
type: Number
|
||||||
|
|
@ -256,7 +256,7 @@
|
||||||
function changeTime(e) {
|
function changeTime(e) {
|
||||||
selected.value = e
|
selected.value = e
|
||||||
if (e == 'custom') {
|
if (e == 'custom') {
|
||||||
currentInstance.ctx.$refs.datePicker.toggle()
|
datePicker.value.toggle()
|
||||||
} else {
|
} else {
|
||||||
getlist()
|
getlist()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, reactive, ref, computed, getCurrentInstance } from 'vue';
|
import { onMounted, reactive, ref, computed } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { stockFlow,consStatistics } from '@/http/api/cons.js';
|
import { stockFlow,consStatistics } from '@/http/api/cons.js';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, reactive, getCurrentInstance } from 'vue';
|
import { ref, computed, reactive } from 'vue';
|
||||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
@ -94,7 +94,6 @@
|
||||||
console.log(options)
|
console.log(options)
|
||||||
datas.item = JSON.parse(options.item)
|
datas.item = JSON.parse(options.item)
|
||||||
datas.form = Object.assign(datas.form, datas.item)
|
datas.form = Object.assign(datas.form, datas.item)
|
||||||
console.log(datas.form)
|
|
||||||
// 单位列表
|
// 单位列表
|
||||||
datas.unitList = [ datas.form.conUnit, datas.form.conUnitTwo]
|
datas.unitList = [ datas.form.conUnit, datas.form.conUnitTwo]
|
||||||
datas.form.bodyList.unit = datas.form.defaultUnit
|
datas.form.bodyList.unit = datas.form.defaultUnit
|
||||||
|
|
@ -105,8 +104,6 @@
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
|
|
||||||
const refs = getCurrentInstance()
|
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
go.to('PAGES_ADD_SUPPLIER')
|
go.to('PAGES_ADD_SUPPLIER')
|
||||||
}
|
}
|
||||||
|
|
@ -149,17 +146,11 @@
|
||||||
|
|
||||||
let sumbit = uni.$utils.debounce(() => {
|
let sumbit = uni.$utils.debounce(() => {
|
||||||
if (!datas.form.bodyList.inOutNumber) {
|
if (!datas.form.bodyList.inOutNumber) {
|
||||||
refs.ctx.$refs.uToastRef.show({
|
uni.$utils.showToast("请输入必填项")
|
||||||
type: 'default',
|
|
||||||
message: "请输入必填项",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!datas.form.bodyList.purchasePrice) {
|
if (!datas.form.bodyList.purchasePrice) {
|
||||||
refs.ctx.$refs.uToastRef.show({
|
uni.$utils.showToast("请输入必填项")
|
||||||
type: 'default',
|
|
||||||
message: "请输入必填项",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,10 +163,7 @@
|
||||||
vendorId: datas.list[nowStatusIndex.value].id,
|
vendorId: datas.list[nowStatusIndex.value].id,
|
||||||
amountPayable: datas.form.bodyList[0].inOutNumber * datas.form.bodyList[0].purchasePrice,
|
amountPayable: datas.form.bodyList[0].inOutNumber * datas.form.bodyList[0].purchasePrice,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
refs.ctx.$refs.uToastRef.show({
|
uni.$utils.showToast("保存成功")
|
||||||
type: 'default',
|
|
||||||
message: "保存成功",
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
go.back()
|
go.back()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
|
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import { reactive, ref, computed, getCurrentInstance } from 'vue';
|
import { reactive, ref, computed } from 'vue';
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import myRepayment from './components/my-repayment';
|
import myRepayment from './components/my-repayment';
|
||||||
import datePickerview from './components/my-date-pickerview.vue'
|
import datePickerview from './components/my-date-pickerview.vue'
|
||||||
|
|
@ -107,9 +107,8 @@
|
||||||
let statusHeight = computed(() => {
|
let statusHeight = computed(() => {
|
||||||
return 30 * pageData.statusList.length + 40 + 'px'
|
return 30 * pageData.statusList.length + 40 + 'px'
|
||||||
})
|
})
|
||||||
const currentInstance = getCurrentInstance()
|
|
||||||
let repayment = ref(null)
|
let repayment = ref(null)
|
||||||
|
const datePicker = ref()
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
if ( options.id ) {
|
if ( options.id ) {
|
||||||
pageData.query.creditBuyerId = options.id;
|
pageData.query.creditBuyerId = options.id;
|
||||||
|
|
@ -187,7 +186,7 @@
|
||||||
function changeTime(e) {
|
function changeTime(e) {
|
||||||
pageData.selected = e
|
pageData.selected = e
|
||||||
if (e == 'custom') {
|
if (e == 'custom') {
|
||||||
currentInstance.ctx.$refs.datePicker.toggle()
|
datePicker.value.toggle()
|
||||||
} else {
|
} else {
|
||||||
pageData.query.page = 1;
|
pageData.query.page = 1;
|
||||||
pageData.list = [];
|
pageData.list = [];
|
||||||
|
|
|
||||||
|
|
@ -107,16 +107,15 @@
|
||||||
<up-button text="确认" @tap="confirmtow" type="primary" class="buttomStyle" shape="circle"></up-button>
|
<up-button text="确认" @tap="confirmtow" type="primary" class="buttomStyle" shape="circle"></up-button>
|
||||||
</view>
|
</view>
|
||||||
</up-popup>
|
</up-popup>
|
||||||
<!-- <up-toast ref="uToastRef"></up-toast> -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, getCurrentInstance, onMounted } from 'vue';
|
import { reactive, ref, onMounted } from 'vue';
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
|
|
||||||
import { getCallTableQueue, getCallTable, callTableTakeNumber, callTableCall, updateCallTableState } from '@/http/api/callTable.js'
|
import { getCallTableQueue, getCallTable, callTableTakeNumber, callTableCall, updateCallTableState } from '@/http/api/callTable.js'
|
||||||
|
|
||||||
let getrefs = getCurrentInstance()
|
|
||||||
let datas = reactive({
|
let datas = reactive({
|
||||||
msgType: "",
|
msgType: "",
|
||||||
// 关闭取号弹窗
|
// 关闭取号弹窗
|
||||||
|
|
@ -143,6 +142,8 @@
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const alertDialog = ref()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取列表
|
* 获取列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -209,7 +210,7 @@
|
||||||
callQueueId: item.id
|
callQueueId: item.id
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
datas.profilepicturedata = res
|
datas.profilepicturedata = res
|
||||||
getrefs.ctx.$refs.alertDialog.open()
|
alertDialog.value.open()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,8 +109,6 @@
|
||||||
<my-button shape="circle" @click="save">保存</my-button>
|
<my-button shape="circle" @click="save">保存</my-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 消息提示 -->
|
|
||||||
<up-toast ref="uToastRef"></up-toast>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
@ -118,7 +116,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, getCurrentInstance } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import pickerItem from './components/picker-item.vue';
|
import pickerItem from './components/picker-item.vue';
|
||||||
|
|
@ -176,8 +174,6 @@
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const refs = getCurrentInstance()
|
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
getlist()
|
getlist()
|
||||||
if (options.id) {
|
if (options.id) {
|
||||||
|
|
@ -233,17 +229,11 @@
|
||||||
async function save() {
|
async function save() {
|
||||||
// 效验
|
// 效验
|
||||||
if (!form.contentType || !form.subType || !form.name || !form.address) {
|
if (!form.contentType || !form.subType || !form.name || !form.address) {
|
||||||
refs.ctx.$refs.uToastRef.show({
|
uni.$utils.showToast("请输入必填项")
|
||||||
type: 'default',
|
|
||||||
message: "请输入必填项",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (form.classifyPrint == 1 && form.selectcheckbox.length == 0) {
|
if (form.classifyPrint == 1 && form.selectcheckbox.length == 0) {
|
||||||
refs.ctx.$refs.uToastRef.show({
|
uni.$utils.showToast("请选择部分分类")
|
||||||
type: 'default',
|
|
||||||
message: "请选择部分分类",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 部分分类处理
|
// 部分分类处理
|
||||||
|
|
|
||||||
|
|
@ -72,12 +72,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, getCurrentInstance, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import datePickerview from './components/my-date-pickerview.vue'
|
import datePickerview from './components/my-date-pickerview.vue'
|
||||||
import dayjs from 'dayjs' //时间格式库
|
import dayjs from 'dayjs' //时间格式库
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
import { getTrade, productSaleDate } from '@/http/api/summary.js'
|
import { getTrade, productSaleDate } from '@/http/api/summary.js'
|
||||||
|
|
||||||
|
const datePicker=ref()
|
||||||
const timeList = [{
|
const timeList = [{
|
||||||
label: '今天',
|
label: '今天',
|
||||||
value: 'today'
|
value: 'today'
|
||||||
|
|
@ -100,7 +101,6 @@
|
||||||
]
|
]
|
||||||
let selected = ref('today')
|
let selected = ref('today')
|
||||||
let list = ref({})
|
let list = ref({})
|
||||||
const currentInstance = getCurrentInstance()
|
|
||||||
let tableList = ref([])
|
let tableList = ref([])
|
||||||
let day = ref(1)
|
let day = ref(1)
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
@ -209,7 +209,7 @@
|
||||||
function changeTime(e) {
|
function changeTime(e) {
|
||||||
selected.value = e
|
selected.value = e
|
||||||
if (e == 'custom') {
|
if (e == 'custom') {
|
||||||
currentInstance.ctx.$refs.datePicker.toggle()
|
datePicker.value.toggle()
|
||||||
} else {
|
} else {
|
||||||
getlist()
|
getlist()
|
||||||
gettableData()
|
gettableData()
|
||||||
|
|
|
||||||
|
|
@ -67,14 +67,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { getCurrentInstance, reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { onShow } from '@dcloudio/uni-app';
|
import { onShow } from '@dcloudio/uni-app';
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
|
|
||||||
import { shopStaffDetail,getShopStaffPermission,shopStaffAdd,shopStaffPut } from "@/http/api/staff.js"
|
import { shopStaffDetail,getShopStaffPermission,shopStaffAdd,shopStaffPut } from "@/http/api/staff.js"
|
||||||
import { getShopPermission } from "@/http/api/index.js"
|
import { getShopPermission } from "@/http/api/index.js"
|
||||||
import { getRoleList } from "@/http/api/role.js"
|
import { getRoleList } from "@/http/api/role.js"
|
||||||
const currentInstance = getCurrentInstance()
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: {
|
type: {
|
||||||
type: String
|
type: String
|
||||||
|
|
@ -99,6 +99,7 @@
|
||||||
[]
|
[]
|
||||||
]);
|
]);
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
|
const message = ref()
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
|
|
@ -170,16 +171,13 @@
|
||||||
async function sumbitEvent() {
|
async function sumbitEvent() {
|
||||||
// 效验
|
// 效验
|
||||||
if (!datas.formData.name || !datas.formData.phone || !datas.formData.code || !datas.formData.accountPwd) {
|
if (!datas.formData.name || !datas.formData.phone || !datas.formData.code || !datas.formData.accountPwd) {
|
||||||
currentInstance.ctx.$refs.uToastRef.show({
|
uni.$utils.showToast("请输入必填项")
|
||||||
message: "请填写必填项",
|
|
||||||
type: 'default',
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let rolesId = datas.rolesList.filter(ele => ele.name == datas.rolesdata)
|
let rolesId = datas.rolesList.filter(ele => ele.name == datas.rolesdata)
|
||||||
if (rolesId.length == 0) {
|
if (rolesId.length == 0) {
|
||||||
currentInstance.ctx.$refs.message.open()
|
message.value.open()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
datas.formData.roleId = rolesId[0].id
|
datas.formData.roleId = rolesId[0].id
|
||||||
|
|
|
||||||
|
|
@ -259,11 +259,7 @@
|
||||||
* @param {Object} item
|
* @param {Object} item
|
||||||
*/
|
*/
|
||||||
function scanCode(item) {
|
function scanCode(item) {
|
||||||
console.log(item)
|
|
||||||
if ( item.tableCode != '') {
|
|
||||||
uni.$utils.showToast('当前桌台已绑定')
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
onlyFromCamera: true,
|
onlyFromCamera: true,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { getCurrentInstance, ref, reactive } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import { onShow } from '@dcloudio/uni-app';
|
import { onShow } from '@dcloudio/uni-app';
|
||||||
|
|
||||||
import dayjs from 'dayjs' //时间格式库
|
import dayjs from 'dayjs' //时间格式库
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
value: 'custom'
|
value: 'custom'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
const currentInstance = getCurrentInstance()
|
const datePicker = ref()
|
||||||
onShow((options) => {
|
onShow((options) => {
|
||||||
let iToken = uni.getStorageSync('iToken').tokenValue
|
let iToken = uni.getStorageSync('iToken').tokenValue
|
||||||
if (iToken) {
|
if (iToken) {
|
||||||
|
|
@ -185,7 +185,7 @@
|
||||||
function changeTime(e) {
|
function changeTime(e) {
|
||||||
selected.value = e
|
selected.value = e
|
||||||
if (e == 'custom') {
|
if (e == 'custom') {
|
||||||
currentInstance.ctx.$refs.datePicker.toggle()
|
datePicker.value.toggle()
|
||||||
} else {
|
} else {
|
||||||
getlist()
|
getlist()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onLoad, onReady, onShow,onHide } from '@dcloudio/uni-app'
|
import { onLoad, onReady, onShow,onHide } from '@dcloudio/uni-app'
|
||||||
import { ref, inject, onUnmounted, reactive, computed, watch } from 'vue';
|
import { ref, inject, onUnmounted, nextTick, reactive, computed, watch } from 'vue';
|
||||||
|
|
||||||
import modelDiscount from './components/discount'
|
import modelDiscount from './components/discount'
|
||||||
import giveFood from './components/give-food'
|
import giveFood from './components/give-food'
|
||||||
|
|
@ -369,6 +369,7 @@
|
||||||
pageData.table.id = opt.tableId
|
pageData.table.id = opt.tableId
|
||||||
pageData.table.tableCode = opt.tableCode
|
pageData.table.tableCode = opt.tableCode
|
||||||
}
|
}
|
||||||
|
pageData.shopInfo = uni.getStorageSync('shopInfo')
|
||||||
getTbShopInfo()
|
getTbShopInfo()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
@ -399,6 +400,7 @@
|
||||||
console.log("onUnmounted")
|
console.log("onUnmounted")
|
||||||
websocketUtil.offMessage()
|
websocketUtil.offMessage()
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单详情
|
* 获取订单详情
|
||||||
* @param {Object} tableCode
|
* @param {Object} tableCode
|
||||||
|
|
@ -457,6 +459,7 @@
|
||||||
return prve + (cur.is_gift ? 0 : tPrice)
|
return prve + (cur.is_gift ? 0 : tPrice)
|
||||||
}, 0)
|
}, 0)
|
||||||
const tpackFee = $packFee.value > 0 ? $packFee.value*1 : 0
|
const tpackFee = $packFee.value > 0 ? $packFee.value*1 : 0
|
||||||
|
|
||||||
return ((goodsTotalPrice - discount_sale_amount.value + tpackFee) || 0).toFixed(2)
|
return ((goodsTotalPrice - discount_sale_amount.value + tpackFee) || 0).toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -490,6 +493,9 @@
|
||||||
* init
|
* init
|
||||||
*/
|
*/
|
||||||
async function init() {
|
async function init() {
|
||||||
|
nextTick(()=>{
|
||||||
|
onMessage()
|
||||||
|
})
|
||||||
// 获取商品列表
|
// 获取商品列表
|
||||||
$goods = await getProductList({},'product', false)
|
$goods = await getProductList({},'product', false)
|
||||||
// console.log("商品列表===",$goods)
|
// console.log("商品列表===",$goods)
|
||||||
|
|
@ -500,9 +506,11 @@
|
||||||
/**
|
/**
|
||||||
* socket消息监听
|
* socket消息监听
|
||||||
*/
|
*/
|
||||||
|
function onMessage() {
|
||||||
websocketUtil.offMessage()
|
websocketUtil.offMessage()
|
||||||
websocketUtil.onMessage(res => {
|
websocketUtil.onMessage(res => {
|
||||||
let msg = JSON.parse(res);
|
let msg = JSON.parse(res);
|
||||||
|
console.log(msg)
|
||||||
let cartItem;
|
let cartItem;
|
||||||
if( msg.msg_id ){
|
if( msg.msg_id ){
|
||||||
websocketUtil.send(JSON.stringify({
|
websocketUtil.send(JSON.stringify({
|
||||||
|
|
@ -518,8 +526,10 @@
|
||||||
switch (msg.operate_type) {
|
switch (msg.operate_type) {
|
||||||
case 'onboc_init':
|
case 'onboc_init':
|
||||||
goods.list = []
|
goods.list = []
|
||||||
|
console.log(msg.data)
|
||||||
msg.data.map(item=>{
|
msg.data.map(item=>{
|
||||||
cartItem = getNowCart(item,$goods,pageData.user)
|
cartItem = getNowCart(item,$goods,pageData.user)
|
||||||
|
console.log(cartItem)
|
||||||
if( cartItem.isGrounding||cartItem.is_temporary == 1 ){
|
if( cartItem.isGrounding||cartItem.is_temporary == 1 ){
|
||||||
cartControls(cartItem,'add')
|
cartControls(cartItem,'add')
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -579,6 +589,10 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除购物车菜品
|
* 删除购物车菜品
|
||||||
*/
|
*/
|
||||||
|
|
@ -840,9 +854,11 @@
|
||||||
userNumbers.defaultCateIndex = maxCapacity - 1
|
userNumbers.defaultCateIndex = maxCapacity - 1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
console.log(pageData.shopInfo)
|
||||||
|
console.log(!pageData.shopInfo.isTableFee)
|
||||||
if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id && goods.list.length > 0) {
|
if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id && goods.list.length > 0) {
|
||||||
//不免餐位费
|
//不免餐位费
|
||||||
|
console.log("不免餐位费")
|
||||||
let seatFee = {
|
let seatFee = {
|
||||||
totalNumber: userNumbers.defaultCateIndex * 1 + 1,
|
totalNumber: userNumbers.defaultCateIndex * 1 + 1,
|
||||||
totalAmount: (userNumbers.defaultCateIndex * 1 + 1) * pageData.shopInfo.tableFee,
|
totalAmount: (userNumbers.defaultCateIndex * 1 + 1) * pageData.shopInfo.tableFee,
|
||||||
|
|
@ -897,7 +913,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let vipPrice = isVip.value ? 1 : 0
|
let vipPrice = isVip.value ? 1 : 0
|
||||||
let placeNum = pageData.shopInfo.registerType == 'after'&&pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1;
|
let placeNum = pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1;
|
||||||
let originAmount = goodsPrice.value*1+youhui.value*1
|
let originAmount = goodsPrice.value*1+youhui.value*1
|
||||||
let par = {
|
let par = {
|
||||||
shopId: pageData.shopInfo.id, //店铺Id
|
shopId: pageData.shopInfo.id, //店铺Id
|
||||||
|
|
@ -915,7 +931,7 @@
|
||||||
if(!pageData.shopInfo.isTableFee&&pageData.table&&pageData.table.id){
|
if(!pageData.shopInfo.isTableFee&&pageData.table&&pageData.table.id){
|
||||||
par.seatNum = userNumbers.defaultCateIndex * 1 + 1
|
par.seatNum = userNumbers.defaultCateIndex * 1 + 1
|
||||||
}
|
}
|
||||||
if(pageData.shopInfo.registerType == 'after'&&pageData.orderInfo){
|
if(pageData.orderInfo){
|
||||||
par.orderId = pageData.orderInfo.id
|
par.orderId = pageData.orderInfo.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -928,6 +944,7 @@
|
||||||
operate_type:'cleanup',
|
operate_type:'cleanup',
|
||||||
table_code: pageData.table.tableCode,
|
table_code: pageData.table.tableCode,
|
||||||
}))
|
}))
|
||||||
|
uni.removeStorageSync("table_code")
|
||||||
if (pageData.shopInfo.registerType == 'before' || pageData.eatTypes.active == 'take-out') {
|
if (pageData.shopInfo.registerType == 'before' || pageData.eatTypes.active == 'take-out') {
|
||||||
//先付
|
//先付
|
||||||
return go.to('PAGES_ORDER_PAY', {
|
return go.to('PAGES_ORDER_PAY', {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<view>已添加{{goodsNumber.toFixed(0)}}件商品</view>
|
<view>已添加{{goodsNumber.toFixed(0)}}件商品</view>
|
||||||
<view class="color-666">
|
<view class="color-666">
|
||||||
<uni-icons color="#666" type="trash"></uni-icons>
|
<uni-icons color="#666" type="trash"></uni-icons>
|
||||||
<text class="u-m-l-10" @tap="setModalShow('clear',true)">清空</text>
|
<text class="u-m-l-10" @tap="setModalShow('clear',true,'cart','是否清空全部已添加的商品')">清空购物车</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view scroll-y="true" class="tranistion" :style="{height:switchGoods?'50vh':0 }">
|
<scroll-view scroll-y="true" class="tranistion" :style="{height:switchGoods?'50vh':0 }">
|
||||||
|
|
@ -45,9 +45,44 @@
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<my-empty v-if="!data.length" text="暂未有添加商品"></my-empty>
|
<view style="margin: 50rpx auto 110rpx auto;" v-if="!data.length">
|
||||||
</scroll-view>
|
<my-empty text="暂未有添加商品"></my-empty>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 历史订单 -->
|
||||||
|
|
||||||
|
<view v-if="historyOrder.length > 0"
|
||||||
|
class="u-p-t-32 u-p-b-32 u-p-r-28 u-p-l-28 u-m-t-40 bg-fff u-flex u-row-between">
|
||||||
|
<view class="color-333" style="font-weight: bold;">历史订单</view>
|
||||||
|
<view class="color-666">
|
||||||
|
<uni-icons color="#666" type="trash"></uni-icons>
|
||||||
|
<text class="u-m-l-10" @tap="setModalShow('clear',true,'allHistoryOrder','清空历史订单')">清空历史订单</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-for="(item,index) in historyOrder" :key="index">
|
||||||
|
<view v-if="historyOrder.length > 0"
|
||||||
|
class="u-p-t-32 border-top bg-fff u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between">
|
||||||
|
<view class="color-333" style="font-size: 30rpx;">第{{item.placeNum}}次下单</view>
|
||||||
|
<view class="color-666">
|
||||||
|
<uni-icons color="#666" type="trash"></uni-icons>
|
||||||
|
<text class="u-m-l-10" @tap="setModalShow('clear',true,item.placeNum,'清空第'+item.placeNum+'次下单历史订单')">清空</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="color-333 item border-top u-flex u-row-center u-row-between"
|
||||||
|
v-for="(v,i) in item.info" :key="i">
|
||||||
|
<view style="display: flex;align-items: center;">
|
||||||
|
<view class="up-line-1" style="margin-right: 10rpx;">{{v.productName}}</view>
|
||||||
|
<uni-tag v-if="v.returnNum>0" :text="'退菜X'+v.returnNum"
|
||||||
|
custom-style="background-color: #EB4F4F; border-color: #EB4F4F; color: #fff;">
|
||||||
|
</uni-tag>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex" style="flex-shrink: 0;">
|
||||||
|
<view class="font-bold red u-m-r-32">¥{{formatPrice(v.price*(v.num - v.returnNum)) }}</view>
|
||||||
|
<view class="u-m-l-30 u-m-r-30 color-333"> X{{v.num.toFixed(2)}} </view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<view class="icon-car-box" @tap="toggleGoods">
|
<view class="icon-car-box" @tap="toggleGoods">
|
||||||
<image src="/pagesCreateOrder/static/images/icon-car.svg" class="icon-car" />
|
<image src="/pagesCreateOrder/static/images/icon-car.svg" class="icon-car" />
|
||||||
|
|
@ -63,15 +98,15 @@
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<up-modal title="提示" content="是否清空全部已添加的商品?" :show="modal.clear" showCancelButton closeOnClickOverlay
|
<up-modal title="提示" :content="modal.title" :show="modal.clear" showCancelButton closeOnClickOverlay
|
||||||
@confirm="confirmModelConfirm" @cancel="setModalShow('clear',false)" @close="setModalShow('clear',false)"
|
@confirm="confirmModelConfirm" @cancel="setModalShow('clear',false)" @close="setModalShow('clear',false)"
|
||||||
width="300px"></up-modal>
|
width="300px"></up-modal>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, ref } from 'vue';
|
import { computed, reactive, ref, watch } from 'vue';
|
||||||
|
import myButton from '@/components/my-components/my-button.vue'
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import infoBox from '@/commons/utils/infoBox.js';
|
import infoBox from '@/commons/utils/infoBox.js';
|
||||||
import { formatPrice } from '@/commons/utils/format.js';
|
import { formatPrice } from '@/commons/utils/format.js';
|
||||||
|
|
@ -83,10 +118,24 @@
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
historyOrder: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
isCreateOrderToDetail: {
|
isCreateOrderToDetail: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
orderInfo: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
id: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
table: {
|
table: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
|
|
@ -96,8 +145,43 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
let allHistoryOrder = ref([]);
|
||||||
|
const allPrice = computed(() => {
|
||||||
|
let cartPrice = props.data.reduce((prve, cur) => {
|
||||||
|
let price = Math.floor((cur.lowPrice * cur.number)*100)/100
|
||||||
|
return prve + price
|
||||||
|
}, 0)
|
||||||
|
let historyOrderPrice = allHistoryOrder.value.reduce((prve, cur) => {
|
||||||
|
let price = Math.floor((cur.price * (cur.num-cur.returnNum))*100)/100
|
||||||
|
return prve + price
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
return (cartPrice + historyOrderPrice).toFixed(2)
|
||||||
|
})
|
||||||
|
|
||||||
|
const goodsNumber = computed(() => {
|
||||||
|
let result = 0
|
||||||
|
let cart = props.data.reduce((prve, cur) => {
|
||||||
|
return prve + cur.number
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
let historyOrderNum = allHistoryOrder.value.reduce((prve, cur) => {
|
||||||
|
return prve + cur.num
|
||||||
|
}, 0)
|
||||||
|
result = cart + historyOrderNum
|
||||||
|
result = result > 0 ? result.toFixed(2) : 0
|
||||||
|
return result >= 99 ? 99 : parseFloat(result)
|
||||||
|
})
|
||||||
|
watch(() => props.historyOrder, (newval) => {
|
||||||
|
allHistoryOrder.value = [];
|
||||||
|
newval.forEach(item=>{
|
||||||
|
allHistoryOrder.value = [...allHistoryOrder.value,...item.info]
|
||||||
|
})
|
||||||
|
})
|
||||||
const modal = reactive({
|
const modal = reactive({
|
||||||
key: '',
|
key: '',
|
||||||
|
title: '',
|
||||||
|
type: '',
|
||||||
clear: false
|
clear: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -107,10 +191,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setModalShow(key = 'show', show = true) {
|
function setModalShow(key = 'show',show = true, type = '' , title = '') {
|
||||||
// if (key == 'clear' && show && props.data.length <= 0) {
|
// if (key == 'clear' && show && props.data.length <= 0) {
|
||||||
// return infoBox.showToast('购物车是空的!')
|
// return infoBox.showToast('购物车是空的!')
|
||||||
// }
|
// }
|
||||||
|
if( title ){ modal.title = title }
|
||||||
|
if( type ){ modal.type = type }
|
||||||
modal.key = key
|
modal.key = key
|
||||||
modal[key] = show
|
modal[key] = show
|
||||||
console.log(modal);
|
console.log(modal);
|
||||||
|
|
@ -134,11 +220,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function toConfimOrder() {
|
function toConfimOrder() {
|
||||||
if (props.data.length <= 0) {
|
if ( props.data.length <= 0 && allHistoryOrder.value.length <= 0 ) {
|
||||||
return infoBox.showToast('还没有选择商品')
|
return infoBox.showToast('还没有选择商品')
|
||||||
}
|
}
|
||||||
const { name, status, type } = props.table
|
const { name, status, type } = props.table
|
||||||
console.log(props.table)
|
if ( props.data.length <= 0 && allHistoryOrder.value.length > 0 ) {
|
||||||
|
go.to('PAGES_ORDER_PAY', {
|
||||||
|
orderId: props.orderInfo.id,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (props.table.id == '' && props.table.tableCode == '') {
|
if (props.table.id == '' && props.table.tableCode == '') {
|
||||||
go.to('PAGES_CONFIRM_ORDER', {
|
go.to('PAGES_CONFIRM_ORDER', {
|
||||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||||
|
|
@ -155,21 +248,7 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const allPrice = computed(() => {
|
|
||||||
return props.data.reduce((prve, cur) => {
|
|
||||||
let price = Math.floor((cur.lowPrice * cur.number)*100)/100
|
|
||||||
return prve + price
|
|
||||||
}, 0).toFixed(2)
|
|
||||||
})
|
|
||||||
|
|
||||||
const goodsNumber = computed(() => {
|
|
||||||
let result = 0
|
|
||||||
result = props.data.reduce((prve, cur) => {
|
|
||||||
return prve + cur.number
|
|
||||||
}, 0)
|
|
||||||
result = result > 0 ? result.toFixed(2) : 0
|
|
||||||
return result >= 99 ? 99 : parseFloat(result)
|
|
||||||
})
|
|
||||||
|
|
||||||
function updateNumber(isAdd, index, goods) {
|
function updateNumber(isAdd, index, goods) {
|
||||||
const step = isAdd ? 1 : -1
|
const step = isAdd ? 1 : -1
|
||||||
|
|
@ -183,12 +262,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
setModalShow('clear', false)
|
if ( modal.type == 'cart') {
|
||||||
edmits('clear')
|
|
||||||
hideGoods()
|
hideGoods()
|
||||||
}
|
}
|
||||||
|
setModalShow('clear', false)
|
||||||
|
edmits('clear',modal.type)
|
||||||
|
}
|
||||||
|
|
||||||
import myButton from '@/components/my-components/my-button.vue'
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, getCurrentInstance, reactive, ref, watch } from 'vue';
|
import { computed, reactive, ref, watch } from 'vue';
|
||||||
import infobox from '@/commons/utils/infoBox.js'
|
import infobox from '@/commons/utils/infoBox.js'
|
||||||
import myModel from '@/components/my-components/my-model.vue'
|
import myModel from '@/components/my-components/my-model.vue'
|
||||||
import myButton from '@/components/my-components/my-button.vue'
|
import myButton from '@/components/my-components/my-button.vue'
|
||||||
|
|
@ -48,6 +48,7 @@
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const model = ref(null)
|
const model = ref(null)
|
||||||
|
const popup = ref()
|
||||||
let datas = reactive({
|
let datas = reactive({
|
||||||
item: "",
|
item: "",
|
||||||
title: "",
|
title: "",
|
||||||
|
|
@ -75,7 +76,6 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
const emits = defineEmits(['confirm', 'updateSku'])
|
const emits = defineEmits(['confirm', 'updateSku'])
|
||||||
const instance = getCurrentInstance();
|
|
||||||
|
|
||||||
function confirm() {
|
function confirm() {
|
||||||
// 将数据保存进对应的值
|
// 将数据保存进对应的值
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
emits('confirm', arr, datas.item)
|
emits('confirm', arr, datas.item)
|
||||||
close()
|
close()
|
||||||
} else {
|
} else {
|
||||||
instance.ctx.$refs.popup.open()
|
popup.value.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
|
|
||||||
<view class="bottom w-full">
|
<view class="bottom w-full">
|
||||||
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange"
|
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange"
|
||||||
:table="data.table" :data="cars" @clear="cleaCart"></my-car>
|
:table="data.table" :data="cars" :orderInfo="data.orderInfo" :historyOrder="data.historyOrder" @clear="cleaCart"></my-car>
|
||||||
</view>
|
</view>
|
||||||
<!-- 套餐选择规格 -->
|
<!-- 套餐选择规格 -->
|
||||||
<taocanModel ref="taocanModelRef" @confirm="taocanConfirm" :goodsData="selGoods"></taocanModel>
|
<taocanModel ref="taocanModelRef" @confirm="taocanConfirm" :goodsData="selGoods"></taocanModel>
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
import { getProductList } from '@/http/api/product.js'
|
import { getProductList } from '@/http/api/product.js'
|
||||||
import { categoryPage } from '@/http/api/cateGory.js'
|
import { categoryPage } from '@/http/api/cateGory.js'
|
||||||
import { getShopInfo } from '@/http/api/shop.js'
|
import { getShopInfo } from '@/http/api/shop.js'
|
||||||
|
import { getHistoryOrder, cancelOrder, rmPlaceOrder } from '@/http/api/order.js'
|
||||||
|
|
||||||
const modal = reactive({
|
const modal = reactive({
|
||||||
key: '',
|
key: '',
|
||||||
|
|
@ -178,6 +178,8 @@
|
||||||
orderId: null,
|
orderId: null,
|
||||||
isGoodsAdd: true,
|
isGoodsAdd: true,
|
||||||
goodsData: null,
|
goodsData: null,
|
||||||
|
orderInfo: null,
|
||||||
|
historyOrder: [],
|
||||||
})
|
})
|
||||||
const guigeModelData = reactive({
|
const guigeModelData = reactive({
|
||||||
title: '',
|
title: '',
|
||||||
|
|
@ -192,12 +194,12 @@
|
||||||
let option = {
|
let option = {
|
||||||
type: ''
|
type: ''
|
||||||
}
|
}
|
||||||
|
const taocanModelRef = ref()
|
||||||
const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例
|
const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
option = opt
|
option = opt
|
||||||
Object.assign(data.table, opt)
|
Object.assign(data.table, opt)
|
||||||
|
console.log(opt)
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: (opt && opt.type == 'add') ? '顾客加菜' : '代客下单'
|
title: (opt && opt.type == 'add') ? '顾客加菜' : '代客下单'
|
||||||
})
|
})
|
||||||
|
|
@ -296,6 +298,21 @@
|
||||||
initCart()
|
initCart()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取订单详情
|
||||||
|
*/
|
||||||
|
async function getHistoryOrderDetail(){
|
||||||
|
data.historyOrder = [];
|
||||||
|
let res = await getHistoryOrder({tableCode:data.table.tableCode});
|
||||||
|
data.orderInfo = res;
|
||||||
|
if( res ){
|
||||||
|
data.historyOrder = Object.entries(data.orderInfo.detailMap).map(([key, value]) => ({
|
||||||
|
info: value,
|
||||||
|
placeNum: key
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监听socket是否连接正常
|
* 监听socket是否连接正常
|
||||||
*/
|
*/
|
||||||
|
|
@ -361,6 +378,7 @@
|
||||||
delCart(cartItem.id)
|
delCart(cartItem.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
getHistoryOrderDetail()
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
break;
|
break;
|
||||||
case 'onboc_add':
|
case 'onboc_add':
|
||||||
|
|
@ -388,6 +406,7 @@
|
||||||
data.tabbar[i].foods[k].chooseNumber = 0
|
data.tabbar[i].foods[k].chooseNumber = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getHistoryOrderDetail()
|
||||||
break;
|
break;
|
||||||
case 'init':
|
case 'init':
|
||||||
case 'rottable':
|
case 'rottable':
|
||||||
|
|
@ -403,6 +422,9 @@
|
||||||
case 'product_update':
|
case 'product_update':
|
||||||
init()
|
init()
|
||||||
break;
|
break;
|
||||||
|
case 'clearOrder':
|
||||||
|
getHistoryOrderDetail()
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -458,7 +480,8 @@
|
||||||
/**
|
/**
|
||||||
* 清除购物车
|
* 清除购物车
|
||||||
*/
|
*/
|
||||||
function cleaCart () {
|
async function cleaCart (e) {
|
||||||
|
if( e == 'cart' ){
|
||||||
let params = {
|
let params = {
|
||||||
...data.socketData,
|
...data.socketData,
|
||||||
operate_type:'cleanup',
|
operate_type:'cleanup',
|
||||||
|
|
@ -466,6 +489,26 @@
|
||||||
}
|
}
|
||||||
console.log('购物车清空菜品参数===',params)
|
console.log('购物车清空菜品参数===',params)
|
||||||
websocketUtil.send(JSON.stringify(params))
|
websocketUtil.send(JSON.stringify(params))
|
||||||
|
} else if ( e == 'allHistoryOrder' ) {
|
||||||
|
await cancelOrder({orderId: data.orderInfo.id, shopId: uni.getStorageSync("shopInfo").id })
|
||||||
|
let params = {
|
||||||
|
...data.socketData,
|
||||||
|
operate_type:'clearOrder',
|
||||||
|
table_code: data.table.tableCode,
|
||||||
|
}
|
||||||
|
websocketUtil.send(JSON.stringify(params))
|
||||||
|
initCart()
|
||||||
|
} else {
|
||||||
|
await rmPlaceOrder({orderId: data.orderInfo.id, placeNum: e, shopId: uni.getStorageSync("shopInfo").id })
|
||||||
|
let params = {
|
||||||
|
...data.socketData,
|
||||||
|
operate_type:'clearOrder',
|
||||||
|
table_code: data.table.tableCode,
|
||||||
|
}
|
||||||
|
websocketUtil.send(JSON.stringify(params))
|
||||||
|
initCart()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -755,7 +798,7 @@
|
||||||
selGoods.value = $goods
|
selGoods.value = $goods
|
||||||
if ($goods.groupType == 1) {
|
if ($goods.groupType == 1) {
|
||||||
data.goodsData = $goods
|
data.goodsData = $goods
|
||||||
instance.ctx.$refs.taocanModelRef.open()
|
taocanModelRef.value.open()
|
||||||
} else {
|
} else {
|
||||||
guigeModelData.title = $goods.name
|
guigeModelData.title = $goods.name
|
||||||
const skuMap = returnSelGoodsSkuMap($goods.skuList)
|
const skuMap = returnSelGoodsSkuMap($goods.skuList)
|
||||||
|
|
|
||||||
|
|
@ -64,26 +64,12 @@
|
||||||
const yesterday = $time.getYesterdayTimestamps();
|
const yesterday = $time.getYesterdayTimestamps();
|
||||||
const thisWeek = $time.getThisWeekTimestamps();
|
const thisWeek = $time.getThisWeekTimestamps();
|
||||||
const thisMonth = $time.getThisMonthTimestamps();
|
const thisMonth = $time.getThisMonthTimestamps();
|
||||||
|
const thisLastMonth = $time.getThisLastMonthTimestamps()
|
||||||
const timeData = reactive({
|
const timeData = reactive({
|
||||||
list: [today, yesterday, thisWeek, thisMonth],
|
list: [today, yesterday, thisWeek, thisMonth],
|
||||||
sel: 0
|
sel: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
function changeTimeDataSel(i) {
|
|
||||||
timeData.sel = i
|
|
||||||
if (i == -1) {
|
|
||||||
datePicker.value.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(() => timeData.sel, (newval) => {
|
|
||||||
|
|
||||||
const data = timeData.list[newval]
|
|
||||||
if (newval != -1) {
|
|
||||||
emits('update:time', [data.start, data.end])
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const statusData = reactive({
|
const statusData = reactive({
|
||||||
allList: uni.$dict.orderStatus,
|
allList: uni.$dict.orderStatus,
|
||||||
moreShow: false,
|
moreShow: false,
|
||||||
|
|
@ -116,6 +102,20 @@
|
||||||
sel: ''
|
sel: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function changeTimeDataSel(i) {
|
||||||
|
timeData.sel = i
|
||||||
|
if (i == -1) {
|
||||||
|
datePicker.value.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => timeData.sel, (newval) => {
|
||||||
|
const data = timeData.list[newval]
|
||||||
|
if (newval != -1) {
|
||||||
|
emits('update:time', [data.start, data.end])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
function moreShowHide() {
|
function moreShowHide() {
|
||||||
statusData.moreShow = false
|
statusData.moreShow = false
|
||||||
}
|
}
|
||||||
|
|
@ -126,17 +126,16 @@
|
||||||
|
|
||||||
function changeStatusSel(i) {
|
function changeStatusSel(i) {
|
||||||
statusData.sel = i
|
statusData.sel = i
|
||||||
|
statusData.allListSel = -1
|
||||||
emits('updateStatus', i)
|
emits('updateStatus', i)
|
||||||
}
|
}
|
||||||
|
|
||||||
function datePickerConfirm(e) {
|
function datePickerConfirm(e) {
|
||||||
console.log(e);
|
|
||||||
emits('update:time', [e.start, e.end])
|
emits('update:time', [e.start, e.end])
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeAllListSel(i,item) {
|
function changeAllListSel(i,item) {
|
||||||
statusData.allListSel = i
|
statusData.allListSel = i
|
||||||
console.log(i);
|
|
||||||
}
|
}
|
||||||
function statusConfirm(){
|
function statusConfirm(){
|
||||||
const status = statusData.allList[statusData.allListSel].type
|
const status = statusData.allList[statusData.allListSel].type
|
||||||
|
|
|
||||||
|
|
@ -1000,7 +1000,6 @@
|
||||||
uni.$utils.showToast('支付成功')
|
uni.$utils.showToast('支付成功')
|
||||||
payStatus = 'success'
|
payStatus = 'success'
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.removeStorageSync("table_code")
|
|
||||||
// uni.$emit('orderDetail:update')
|
// uni.$emit('orderDetail:update')
|
||||||
uni.$emit('get:table')
|
uni.$emit('get:table')
|
||||||
uni.$emit('update:orderDetail')
|
uni.$emit('update:orderDetail')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue