tapd相关修改更新

This commit is contained in:
GaoHao
2025-03-19 18:19:34 +08:00
parent 994cf8bf2b
commit f01bc839f7
53 changed files with 1084 additions and 1032 deletions

71
App.vue
View File

@@ -4,7 +4,7 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
--> -->
<script setup> <script setup>
import { onLaunch } from '@dcloudio/uni-app'; import { onLaunch } from '@dcloudio/uni-app';
import { getFindBySource } from '@/http/yskApi/version.js' import { getVersion } from '@/http/api/index.js'
import appConfig from '@/config/appConfig.js'; import appConfig from '@/config/appConfig.js';
import { provide } from 'vue'; import { provide } from 'vue';
@@ -38,7 +38,8 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
plus.runtime.getProperty(plus.runtime.appid, widgetInfo => { plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
//请求后台接口 解析数据 对比版本 //请求后台接口 解析数据 对比版本
console.log("widgetInfo==",widgetInfo) console.log("widgetInfo==",widgetInfo)
getFindBySource({source:'APP'}).then(res => { let type = uni.getSystemInfoSync().platform == 'ios' ? 2 : 1
getVersion({source:'manager_app',type: type}).then(res => {
console.log("selectNewApp==",res) console.log("selectNewApp==",res)
console.log("version===",res.url && widgetInfo.version < res.version) console.log("version===",res.url && widgetInfo.version < res.version)
if (res.url && widgetInfo.version < res.version) { if (res.url && widgetInfo.version < res.version) {
@@ -59,8 +60,7 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
uni.showLoading('下载中...'); uni.showLoading('下载中...');
if (uni.getSystemInfoSync().platform == if (uni.getSystemInfoSync().platform == 'android') {
'android') {
uni.downloadFile({ uni.downloadFile({
url: downloadLink, url: downloadLink,
success: downloadResult => { success: downloadResult => {
@@ -69,24 +69,16 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
entry.getParent(_oldFile=>{ entry.getParent(_oldFile=>{
entry.moveTo(_oldFile,'.apk',newFilePath=>{ entry.moveTo(_oldFile,'.apk',newFilePath=>{
console.log('newFilePath',newFilePath.fullPath) console.log('newFilePath',newFilePath.fullPath)
plus.runtime plus.runtime.install(newFilePath.fullPath, { force: false },
.install(newFilePath.fullPath, { force: false }, d => {
d => { console .log( 'install success...' );
console plus.runtime .restart();
.log( },
'install success...' e => {
); console.log(e)
plus.runtime console .error( 'install fail...' );
.restart(); }
}, );
e => {
console.log(e)
console
.error(
'install fail...'
);
}
);
}) })
}) })
}) })
@@ -94,10 +86,8 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
} }
}); });
} }
if (uni.getSystemInfoSync().platform == if (uni.getSystemInfoSync().platform == 'ios') {
'ios') { plus.runtime.openURL(downloadLink, function( res) {});
plus.runtime.openURL(downloadLink, function(
res) {});
} }
} else if (res.cancel) { } else if (res.cancel) {
console.log('取消'); console.log('取消');
@@ -113,34 +103,23 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
uni.showLoading('下载中...'); uni.showLoading('下载中...');
if (uni.getSystemInfoSync().platform == if (uni.getSystemInfoSync().platform == 'android') {
'android') {
uni.downloadFile({ uni.downloadFile({
url: downloadLink, url: downloadLink,
success: downloadResult => { success: downloadResult => {
if (downloadResult if (downloadResult.statusCode == 200) {
.statusCode ===
200) {
plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => { plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
entry.getParent(_oldFile=>{ entry.getParent(_oldFile=>{
entry.moveTo(_oldFile,'.apk',newFilePath=>{ entry.moveTo(_oldFile,'.apk',newFilePath=>{
console.log('newFilePath',newFilePath.fullPath) console.log('newFilePath',newFilePath.fullPath)
plus.runtime plus.runtime.install(newFilePath.fullPath, { force: false },
.install(newFilePath.fullPath, { force: false },
d => { d => {
console console.log('install success...');
.log( plus.runtime.restart();
'install success...'
);
plus.runtime
.restart();
}, },
e => { e => {
console.log(e) console.log(e)
console console.error('install fail...');
.error(
'install fail...'
);
} }
); );
}) })
@@ -151,10 +130,8 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
} }
}); });
} }
if (uni.getSystemInfoSync().platform == if (uni.getSystemInfoSync().platform == 'ios') {
'ios') { plus.runtime.openURL(downloadLink, function( res) {});
plus.runtime.openURL(downloadLink, function(
res) {});
} }
} else if (res.cancel) { } else if (res.cancel) {
console.log('取消'); console.log('取消');

View File

@@ -1,25 +0,0 @@
/**
* @desc 函数防抖
* @param func 目标函数
* @param wait 延迟执行毫秒数
* @param immediate true - 立即执行, false - 延迟执行
*/
export const debounce = function(func, wait = 1000, immediate = true) {
let timer;
return function() {
let context = this,
args = arguments;
if (timer) clearTimeout(timer);
if (immediate) {
let callNow = !timer;
timer = setTimeout(() => {
timer = null;
}, wait);
if (callNow) func.apply(context, args);
} else {
timer = setTimeout(() => {
func.apply(context, args);
}, wait)
}
}
}

143
commons/utils/index.js Normal file
View File

@@ -0,0 +1,143 @@
export const utils = {
ColorMain: '#318AFE',
ColorRed: '#F02C45',
/**
* 限制只让输入数字
* @param {Object} e
*/
isNumber (e) {
console.log(e)
return e.replace(/[^\d]/g, '')
},
/**
* 限制金额输入格式
* @param {Object} e
*/
isPrice (e) {
return e.replace(/[^0-9.]/g, '').replace(/\.{2,}/g, "").replace(/^\./, '')
},
/**
* 金额保留两位小数
* @param {Object} e
*/
toFixed (price,item) {
if( item ){
if( item.productType == 'weight' || item.type == 'weight'){
return (Math.floor(price * 100)/100).toFixed(2)
} else {
return parseFloat(price).toFixed(2)
}
} else {
return parseFloat(price).toFixed(2)
}
},
/**
* 金额向下取整
* @param {Object} e
*/
formatPrice (e) {
return (Math.floor(n*100)/100).toFixed(2)
},
/**
* 消息提示框
*/
showToast(title, duration = 1.5, extObject) {
return new Promise((resolve, reject) => {
uni.showToast(Object.assign({ title: title, icon: 'none', mask: false, duration: (duration * 1000) }, extObject))
setTimeout(resolve, (duration * 1000));
})
},
/**
* 保留小数n位不进行四舍五入
* num你传递过来的数字,
* decimal你保留的几位,默认保留小数后两位
*/
formatDecimal (num, decimal = 2) {
num = num.toString()
const index = num.indexOf('.')
if (index !== -1) {
num = num.substring(0, decimal + index + 1)
} else {
num = num.substring(0)
}
//截取后保留两位小数
return parseFloat(num).toFixed(decimal)
},
/**
* 分转元
* amount - 金额
* parseFloat - 是否转换为数字格式,
* 默认String
*/
cert2Dollar(amount, needParseFloat = false) {
if (needParseFloat) { // parseFlot
return formatDecimal(amount / 100)
}
return formatDecimal(amount / 100)
},
/**
* @desc 函数防抖
* @param func 目标函数
* @param wait 延迟执行毫秒数
* @param immediate true - 立即执行, false - 延迟执行
*/
debounce (func, wait = 1000, immediate = true) {
let timer;
return function() {
let context = this,
args = arguments;
if (timer) clearTimeout(timer);
if (immediate) {
let callNow = !timer;
timer = setTimeout(() => {
timer = null;
}, wait);
if (callNow) func.apply(context, args);
} else {
timer = setTimeout(() => {
func.apply(context, args);
}, wait)
}
}
},
/**
* @desc 函数节流
* @param func 函数
* @param wait 延迟执行毫秒数
* @param type 1 使用表时间戳,在时间段开始的时候触发 2 使用表定时器,在时间段结束的时候触发
*/
throttle (func, wait = 1000, type = 1) {
let previous = 0;
let timeout;
return function() {
let context = this;
let args = arguments;
if (type === 1) {
let now = Date.now();
if (now - previous > wait) {
func.apply(context, args);
previous = now;
}
} else if (type === 2) {
if (!timeout) {
timeout = setTimeout(() => {
timeout = null;
func.apply(context, args)
}, wait)
}
}
}
}
}

View File

@@ -1,29 +0,0 @@
/**
* @desc 函数节流
* @param func 函数
* @param wait 延迟执行毫秒数
* @param type 1 使用表时间戳,在时间段开始的时候触发 2 使用表定时器,在时间段结束的时候触发
*/
export const throttle = (func, wait = 1000, type = 1) => {
let previous = 0;
let timeout;
return function() {
let context = this;
let args = arguments;
if (type === 1) {
let now = Date.now();
if (now - previous > wait) {
func.apply(context, args);
previous = now;
}
} else if (type === 2) {
if (!timeout) {
timeout = setTimeout(() => {
timeout = null;
func.apply(context, args)
}, wait)
}
}
}
}

View File

@@ -32,6 +32,7 @@ class WebsocketUtil {
}, },
fail: (error) => { fail: (error) => {
console.error('WebSocket连接失败', error); console.error('WebSocket连接失败', error);
uni.$emit('is-socket-open', true)
this.reconnect(); this.reconnect();
} }
}); });
@@ -42,10 +43,12 @@ class WebsocketUtil {
// 连接成功后启动心跳和消息监听 // 连接成功后启动心跳和消息监听
this.startHeartbeat(); this.startHeartbeat();
this.listenForMessages(); this.listenForMessages();
uni.$emit('is-socket-open', true)
}); });
this.socketTask.onError((res) => { this.socketTask.onError((res) => {
console.log('WebSocket连接失败==',res); console.log('WebSocket连接失败==',res);
uni.$emit('is-socket-open', false)
this.reconnect(); this.reconnect();
}); });
// 注意:这里的 onClose 监听器应该放在 uni.connectSocket 调用之后 // 注意:这里的 onClose 监听器应该放在 uni.connectSocket 调用之后
@@ -93,7 +96,7 @@ class WebsocketUtil {
const { data } = res; const { data } = res;
this.messageCallbacks.forEach(callback => callback(data.toString())); // 假设 data 是字符串或可转换为字符串 this.messageCallbacks.forEach(callback => callback(data.toString())); // 假设 data 是字符串或可转换为字符串
}); });
this.send("WebSocket连接正常"); // this.send("WebSocket连接正常");
} else { } else {
console.error('WebSocket 连接尚未建立,无法监听消息'); console.error('WebSocket 连接尚未建立,无法监听消息');
} }

View File

@@ -390,7 +390,6 @@
const month = arr[1] + 1 const month = arr[1] + 1
const day = arr[2] + 1 const day = arr[2] + 1
const hour = ('0' + (arr[3]||0)).slice(-2) const hour = ('0' + (arr[3]||0)).slice(-2)
console.log(hour)
const min = ('0' + (arr[4]||0)).slice(-2) const min = ('0' + (arr[4]||0)).slice(-2)
const sen = ('0' + (arr[5]||0)).slice(-2) const sen = ('0' + (arr[5]||0)).slice(-2)
if (isObj) { if (isObj) {
@@ -401,9 +400,7 @@
function confirm(e) { function confirm(e) {
console.log(value.value);
const start = returnDateString(value.value) const start = returnDateString(value.value)
console.log(start);
const end = returnDateString(value1.value) const end = returnDateString(value1.value)
if (!props.isArea) { if (!props.isArea) {
emits('confirm', start) emits('confirm', start)

View File

@@ -1,8 +1,10 @@
<template> <template>
<view class="model u-text-center" v-if="show" @tap="modelTap"> <view class="model u-text-center" v-if="show" @tap="modelTap">
<div @tap.stop="" class="box u-font-32 tranistion" :class="[returnBoxClass]" :style="[computeBoxStyle,computeStyle()]" > <div @tap.stop="" class="box u-font-32 tranistion" :class="[returnBoxClass]" :style="[computeBoxStyle,computeStyle()]" >
<view class="u-relative"> <view class="u-relative" style="display: flex;align-items: center;justify-content: space-between;">
<view class=" color-333 font-bold">{{props.title||'提示'}}</view> <view style=""></view>
<view class="color-333 font-bold up-line-1" style="width: 60%;">{{props.title||'提示'}}</view>
<view style=""></view>
<template v-if="showIcon"> <template v-if="showIcon">
<slot name="icon"> <slot name="icon">
<view class="close" @tap="close"> <view class="close" @tap="close">

View File

@@ -36,7 +36,7 @@
default: 10 default: 10
}, },
totalElements: { totalElements: {
type: Number, type: String,
default: 0 default: 0
}, },
page: { page: {

View File

@@ -9,6 +9,20 @@ export function uploadFile(file, data, urlType = 'account') {
return http.upload(`${urlType}/admin/common/upload`,data,file) return http.upload(`${urlType}/admin/common/upload`,data,file)
} }
/**
* 订阅二维码
* @returns
*/
export function getShopMsgPushCode(data, urlType = 'account') {
return request({
url: `${urlType}/admin/shopMsgPush/code`,
method: "GET",
data: {
...data
}
})
}
/** /**
* 获取店铺权限列表 * 获取店铺权限列表
* @returns * @returns
@@ -22,3 +36,17 @@ export function getShopPermission(data, urlType = 'account') {
} }
}) })
} }
/**
* 根据渠道获取版本信息
* @returns
*/
export function getVersion(data, urlType = 'account') {
return request({
url: `${urlType}/admin/version/${data.source}/${data.type}`,
method: "GET",
data: {
...data
}
})
}

View File

@@ -1,5 +1,5 @@
//服务器接口地址 //服务器接口地址
const baseURL : string = 'https://czgdoumei.sxczgkj.com/index.php/api/' const baseURL : string = 'https://newblockwlx.sxczgkj.cn/index.php/api/'
// 封装公共请求方法 // 封装公共请求方法
function request(url : string, method : "GET" | "POST" | undefined, data : object | any, toast : boolean) { function request(url : string, method : "GET" | "POST" | undefined, data : object | any, toast : boolean) {
let networkType = '' let networkType = ''

21
main.js
View File

@@ -3,6 +3,7 @@ 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 {utils} from '@/commons/utils/index.js'
import uviewPlus from 'uview-plus' import uviewPlus from 'uview-plus'
// 设置node环境 // 设置node环境
@@ -20,19 +21,25 @@ App.mpType = 'app'
const app = new Vue({ const app = new Vue({
...App ...App
}) })
app.$mount() app.$mount()
// #endif // #endif
// #ifdef VUE3 // #ifdef VUE3
import { createSSRApp } from 'vue' import { createSSRApp } from 'vue'
import App from './App.vue' import App from './App.vue'
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
app.use(uviewPlus)
app.config.globalProperties.$appName = appConfig.appName app.use(uviewPlus)
uni.$appName = appConfig.appName app.config.globalProperties.$appName = appConfig.appName
return { uni.$appName = appConfig.appName
app app.config.globalProperties.$utils = utils
} uni.$utils = utils
return {
app
}
} }
// #endif // #endif

View File

@@ -54,7 +54,6 @@
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import myCategory from './components/category.vue' import myCategory from './components/category.vue'
import infoBox from "@/commons/utils/infoBox.js" import infoBox from "@/commons/utils/infoBox.js"
import {$productCategory} from '@/http/yskApi/goods.js'
import { categoryPage,putCategory,delCategory } from '@/http/api/cateGory.js' import { categoryPage,putCategory,delCategory } from '@/http/api/cateGory.js'
const control=ref(null) const control=ref(null)
const delModel=ref(null) const delModel=ref(null)

View File

@@ -69,11 +69,7 @@
typelist: [], typelist: [],
nowStatusIndex: 0 nowStatusIndex: 0
}) })
// const props = defineProps({
// item: {
// type: String
// }
// })
onMounted(() => { onMounted(() => {
gettbConsTypeList() gettbConsTypeList()
}) })

View File

@@ -1,20 +1,23 @@
<template> <template>
<view class="addType"> <view>
<view v-for="item in datas.list"> <view class="addType">
<view class=""> <view v-for="item in datas.list">
{{item.name}}<up-icon color="#64A7FE" name="edit-pen" @tap="showoneEvent(item)"></up-icon> <view class="">
</view> {{item.name}}<up-icon color="#64A7FE" name="edit-pen" @tap="showoneEvent(item)"></up-icon>
<view class=""> </view>
是否启用 &nbsp;&nbsp; <view class="">
<up-switch checked="true" :activeValue="1" size="20" :inactiveValue="0" 是否启用 &nbsp;&nbsp;
@change="switchChangeEvent($event,item)" :modelValue="item.status" style="transform:scale(0.7)" /> <up-switch checked="true" :activeValue="1" size="20" :inactiveValue="0"
@change="switchChangeEvent($event,item)" :modelValue="item.status" style="transform:scale(0.7)" />
</view>
</view> </view>
</view> </view>
<view style="margin-top: 100rpx; padding: 0 28rpx;padding-bottom: 50rpx;">
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="datas.showtwo=true"
:plain="true" text="添加"></up-button>
</view>
</view> </view>
<view style="margin-top: 100rpx; padding: 0 28rpx;">
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="datas.showtwo=true"
:plain="true" text="添加"></up-button>
</view>
<!-- 新增类别 --> <!-- 新增类别 -->
<up-popup :show="datas.showtwo" :round="18" mode="center" @close="close"> <up-popup :show="datas.showtwo" :round="18" mode="center" @close="close">
<view class="zhezhaopops"> <view class="zhezhaopops">
@@ -27,7 +30,7 @@
耗材类型名称<input type="text" v-model="datas.name" style="padding: 0 20rpx;"/> 耗材类型名称<input type="text" v-model="datas.name" style="padding: 0 20rpx;"/>
</view> </view>
<view class="" style="margin-bottom: 20rpx;"> <view class="" style="margin-bottom: 20rpx;">
是否 是否
<up-switch checked="true" :activeValue="1" :inactiveValue="0" @change="switchChange" <up-switch checked="true" :activeValue="1" :inactiveValue="0" @change="switchChange"
:modelValue="datas.status" style="transform:scale(0.7)" /> :modelValue="datas.status" style="transform:scale(0.7)" />
</view> </view>
@@ -58,7 +61,7 @@
list: [], list: [],
showtwo: false, showtwo: false,
name: "", name: "",
status: 0, status: 1,
showone: false, showone: false,
activeData: "" activeData: ""
}) })

View File

@@ -30,7 +30,7 @@
<text style="color: red;">*</text> 排序 <text style="color: red;">*</text> 排序
</view> </view>
<view> <view>
<input type="text" placeholder="请输入排序" v-model="datas.form.sort" name="" id=""> <input type="number" placeholder="请输入排序" @change="datas.form.sort=$utils.isNumber(datas.form.sort)" v-model="datas.form.sort" name="" id="">
</view> </view>
</view> </view>
<view> <view>

View File

@@ -30,23 +30,19 @@
<script setup> <script setup>
import { reactive, computed, onMounted } from 'vue'; import { reactive, computed, onMounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { editCons } from '@/http/api/cons.js'; import { editCons } from '@/http/api/cons.js';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
const props = defineProps({
item: {
type: String
}
})
let datas = reactive({ let datas = reactive({
form: { form: {
conWarning: 999 conWarning: 999
}, },
}) })
onMounted(() => { onLoad((options) => {
let obj = JSON.parse(props.item) let obj = JSON.parse(options.item)
datas.form = obj datas.form = obj
}) })

View File

@@ -6,8 +6,9 @@
<view> {{datas.item.stockNumber}} </view> <view> {{datas.item.stockNumber}} </view>
</view> </view>
<view> <view>
<view> 实际数量 </view> <view> 实际数量 </view>
<view> <input type="number" v-model="datas.form.actualNumber" placeholder="输入数量" name="" id=""> </view> <view> <input type="number" @change="datas.form.actualNumber=$utils.isNumber(datas.form.actualNumber)" v-model="datas.form.actualNumber" placeholder="输入数量" name="" id=""> </view>
</view> </view>
<view> <view>
<view> 单价 </view> <view> 单价 </view>
@@ -30,30 +31,20 @@
<script setup> <script setup>
import { import { ref, computed, onMounted, reactive, getCurrentInstance } from 'vue';
ref, import { onLoad } from '@dcloudio/uni-app';
computed,
onMounted,
reactive
} from 'vue';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import {
tbConsInfotbConCheck
} from '@/http/yskApi/requestAll.js';
import { stockCheck } from '@/http/api/cons.js'; import { stockCheck } from '@/http/api/cons.js';
const props = defineProps({
item: {
type: ''
}
})
let datas = reactive({ let datas = reactive({
item: "", item: "",
form: {} form: {}
}) })
onMounted(() => { onLoad((options) => {
datas.item = JSON.parse(props.item) console.log(options)
datas.item = JSON.parse(options.item)
datas.form = { datas.form = {
...datas.item, ...datas.item,
actualNumber: 0 actualNumber: 0
@@ -66,28 +57,25 @@
*/ */
let profitPrice = computed(() => { let profitPrice = computed(() => {
// 如果剩余数量为负数 // 如果剩余数量为负数
if (datas.form.stockNumber < 0) { // if (datas.form.stockNumber < 0) {
return (0 - datas.item.stockNumber) * datas.item.price // return (0 - datas.item.stockNumber) * datas.item.price
} else { // } else {
return ((datas.form.actualNumber - datas.item.stockNumber) * datas.item.price).toFixed(2); return ((datas.form.actualNumber - datas.item.stockNumber) * datas.item.price).toFixed(2);
} // }
}) })
/** /**
* 盈亏数量 * 盈亏数量
*/ */
let profitNumber = computed(() => { let profitNumber = computed(() => {
if (datas.form.stockNumber < 0) { // if (datas.form.stockNumber < 0) {
return 0 - datas.item.stockNumber // return 0 - datas.item.stockNumber
} else { // } else {
return datas.form.actualNumber - datas.item.stockNumber return datas.form.actualNumber - datas.item.stockNumber
} // }
}) })
function toggle() { let toggle = uni.$utils.debounce(()=> {
if(!datas.form.actualNumber){
return
}
stockCheck({ stockCheck({
...datas.form, ...datas.form,
actualNumber: datas.form.actualNumber, actualNumber: datas.form.actualNumber,
@@ -95,9 +83,15 @@
winLossNumber: profitNumber._value winLossNumber: profitNumber._value
}).then(res => { }).then(res => {
// go.to('PAGES_SALES_CONSUMABLES') // go.to('PAGES_SALES_CONSUMABLES')
go.back() uni.showToast({
title: '操作成功',
icon: "none"
})
setTimeout(()=>{
go.back()
},1000)
}) })
} },1000)
</script> </script>
<style> <style>

View File

@@ -24,11 +24,11 @@
</view> </view>
<view> <view>
<view> <text style="color: red;">*</text>出库数量 </view> <view> <text style="color: red;">*</text>出库数量 </view>
<view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" name="" id=""> </view> <view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" @change="datas.form.bodyList.inOutNumber = $utils.isNumber(datas.form.bodyList.inOutNumber)" name="" id=""> </view>
</view> </view>
<view> <view>
<view> <text style="color: red;">*</text>单价 </view> <view> <text style="color: red;">*</text>单价 </view>
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" name="" id=""> </view> <view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" @change="datas.form.bodyList.purchasePrice = $utils.isPrice(datas.form.bodyList.purchasePrice)" name="" id=""> </view>
</view> </view>
<view style="justify-content: space-between;"> <view style="justify-content: space-between;">
<view> 单位 </view> <view> 单位 </view>
@@ -65,7 +65,7 @@
<script setup> <script setup>
import { ref, computed, reactive, onMounted, getCurrentInstance } from 'vue'; import { ref, computed, reactive, onMounted, getCurrentInstance } from 'vue';
import { onShow } from '@dcloudio/uni-app'; import { onShow, onLoad } from '@dcloudio/uni-app';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@@ -90,16 +90,9 @@
}, },
item: "" item: ""
}) })
const props = defineProps({
consId: { onLoad((options) => {
type: String datas.item = JSON.parse(options.item)
},
item: {
type: String
}
})
onMounted(() => {
datas.item = JSON.parse(props.item)
datas.form = Object.assign(datas.form, datas.item) datas.form = Object.assign(datas.form, datas.item)
// 单位列表 // 单位列表
datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo] datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo]
@@ -147,7 +140,7 @@
datas.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD') datas.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
} }
function sumbit() { let sumbit = uni.$utils.debounce(() => {
if (!datas.form.bodyList.inOutNumber) { if (!datas.form.bodyList.inOutNumber) {
refs.ctx.$refs.uToastRef.show({ refs.ctx.$refs.uToastRef.show({
@@ -175,7 +168,7 @@
}).then(res => { }).then(res => {
go.back() go.back()
}) })
} },1000)
</script> </script>
<style> <style>

View File

@@ -23,17 +23,11 @@
<view :style="{color:item.waitAmount>0?' #F02C45;':''}"> <view :style="{color:item.waitAmount>0?' #F02C45;':''}">
{{item.waitAmount}} {{item.waitAmount}}
</view> </view>
<view class=""> <view class=""> 剩余支付金额 </view>
剩余支付金额
</view>
</view> </view>
<view class=""> <view class="">
<view style="color: #318AFE;"> <view style="color: #318AFE;"> {{item.waitCount}}未付 </view>
{{item.waitCount}}未付 <view class=""> 待付款笔数 </view>
</view>
<view class="">
待付款笔数
</view>
</view> </view>
</view> </view>
<view class="df"> <view class="df">
@@ -66,6 +60,8 @@
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="toUrl('PAGES_ADD_SUPPLIER')" <up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="toUrl('PAGES_ADD_SUPPLIER')"
:plain="true" text="添加供应商"></up-button> :plain="true" text="添加供应商"></up-button>
</view> </view>
</template> </template>
<script setup> <script setup>
@@ -98,10 +94,21 @@
* 删除供应商 * 删除供应商
*/ */
let deleteEvent = (id) => { let deleteEvent = (id) => {
delVendor(id).then(() => { uni.showModal({
getList() title: '提示',
}) content: '是否确认删除此供应商?',
success: res => {
if(res.confirm){
delVendor(id).then(() => {
getList()
})
}
},
fail: () => {},
complete: () => {}
});
} }
let toUrl = (url, d) => { let toUrl = (url, d) => {
go.to(url, d) go.to(url, d)
} }

View File

@@ -2,7 +2,7 @@
<view class="viewrecordsTop" v-if="datas.countList"> <view class="viewrecordsTop" v-if="datas.countList">
<view style="padding:32rpx 16rpx;"> <view style="padding:32rpx 16rpx;">
<view @tap="getInOutType('in')"> <view @tap="getInOutType('in')">
增加数量 <text 增加数量 &nbsp;<text
style="color: #76ACF0;font-weight: bold;">{{datas.countList.inSumTotal?datas.countList.inSumTotal:'0'}}</text> style="color: #76ACF0;font-weight: bold;">{{datas.countList.inSumTotal?datas.countList.inSumTotal:'0'}}</text>
</view> </view>
<view class="df viewdf"> <view class="df viewdf">
@@ -27,7 +27,7 @@
</view> </view>
<view style="padding:32rpx 16rpx;"> <view style="padding:32rpx 16rpx;">
<view class="" @tap="getInOutType('out')"> <view class="" @tap="getInOutType('out')">
减少数量 <text 减少数量 &nbsp;<text
style="color: #52BDA4;font-weight: bold;">{{datas.countList.outSumTotal?datas.countList.outSumTotal:0}}</text> style="color: #52BDA4;font-weight: bold;">{{datas.countList.outSumTotal?datas.countList.outSumTotal:0}}</text>
</view> </view>
<view class="df viewdf"> <view class="df viewdf">
@@ -78,7 +78,7 @@
</view> </view>
<view class=""> <view class="">
<view :style="{color:item.inOutType=='in'?'#1bca72':'red'}" style="font-weight: 400;"> <view :style="{color:item.inOutType=='in'?'#1bca72':'red'}" style="font-weight: 400;">
{{ item.inOutType == 'in' ? '+' : '-' }}{{ item.inOutNumber|0 }} {{ item.inOutType == 'in' ? '+' : '' }}{{ item.inOutNumber|0 }}
</view> </view>
<view style="font-size: 24rpx;color: #666666;"> <view style="font-size: 24rpx;color: #666666;">
变动库存 变动库存
@@ -91,24 +91,20 @@
<script setup> <script setup>
import { onMounted, reactive, ref, computed, getCurrentInstance } from 'vue'; import { onMounted, reactive, ref, computed, getCurrentInstance } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import { stockFlow,consStatistics } from '@/http/api/cons.js'; import { stockFlow,consStatistics } from '@/http/api/cons.js';
let props = defineProps({
item: {
type: String
}
})
let datas = reactive({ let datas = reactive({
list: [], list: [],
countList: {}, countList: {},
inOutType: '', inOutType: '',
inOutItem: '', inOutItem: '',
item: null,
}) })
onMounted(() => { onLoad((options) => {
let items = JSON.parse(props.item) datas.item = JSON.parse(options.item)
getlist() getlist()
}) })
@@ -135,10 +131,9 @@
* 获取数据 * 获取数据
*/ */
function getlist (conTypeId = "", start, end, ) { function getlist (conTypeId = "", start, end, ) {
let ids = JSON.parse(props.item)
// 列表 // 列表
stockFlow({ stockFlow({
conId: ids.id, conId: datas.item.id,
inOutType: datas.inOutType, inOutType: datas.inOutType,
inOutItem: datas.inOutItem inOutItem: datas.inOutItem
}).then(res => { }).then(res => {
@@ -146,7 +141,7 @@
}) })
// 顶部数据 // 顶部数据
consStatistics({ consStatistics({
conId: ids.id, id: datas.item.id,
}).then(res => { }).then(res => {
datas.countList = res datas.countList = res
}) })

View File

@@ -22,11 +22,11 @@
</view> </view>
<view> <view>
<view> <text style="color: red;">*</text> 入库数量 </view> <view> <text style="color: red;">*</text> 入库数量 </view>
<view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" name="" id=""> </view> <view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" @change="datas.form.bodyList.inOutNumber = $utils.isNumber(datas.form.bodyList.inOutNumber)" name="" id=""> </view>
</view> </view>
<view> <view>
<view> <text style="color: red;">*</text>单价 </view> <view> <text style="color: red;">*</text>单价 </view>
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" name="" id=""> </view> <view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" @change="datas.form.bodyList.purchasePrice = $utils.isPrice(datas.form.bodyList.purchasePrice)" name="" id=""> </view>
</view> </view>
<view style="justify-content: space-between;"> <view style="justify-content: space-between;">
<view> 单位 </view> <view> 单位 </view>
@@ -64,11 +64,12 @@
<script setup> <script setup>
import { ref, computed, reactive, onMounted, getCurrentInstance } from 'vue'; import { ref, computed, reactive, getCurrentInstance } from 'vue';
import { onShow } from '@dcloudio/uni-app'; import { onShow, onLoad } from '@dcloudio/uni-app';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { getVendorPage } from '@/http/api/vendor.js'; import { getVendorPage } from '@/http/api/vendor.js';
import { consStockIn } from '@/http/api/cons.js'; import { consStockIn } from '@/http/api/cons.js';
@@ -89,16 +90,10 @@
}, },
item: "" item: ""
}) })
const props = defineProps({
consId: { onLoad((options) => {
type: String console.log(options)
}, datas.item = JSON.parse(options.item)
item: {
type: String
}
})
onMounted(() => {
datas.item = JSON.parse(props.item)
datas.form = Object.assign(datas.form, datas.item) datas.form = Object.assign(datas.form, datas.item)
console.log(datas.form) console.log(datas.form)
// 单位列表 // 单位列表
@@ -151,7 +146,7 @@
} }
function sumbit() { let sumbit = uni.$utils.debounce(() => {
if (!datas.form.bodyList.inOutNumber) { if (!datas.form.bodyList.inOutNumber) {
refs.ctx.$refs.uToastRef.show({ refs.ctx.$refs.uToastRef.show({
type: 'default', type: 'default',
@@ -190,9 +185,8 @@
go.back() go.back()
}, 1000) }, 1000)
}) })
} },1000)
// 获取供应商 // 获取供应商
const statusHeight = computed(() => { const statusHeight = computed(() => {
return 30 * datas.status.length + 14 + 'px' return 30 * datas.status.length + 14 + 'px'
}) })

View File

@@ -9,11 +9,11 @@
<view class="category"> <view class="category">
<view class="category_item" @tap="itemClick(item,index)" :class="{active:index===category.active}" v-for="(item,index) in category.list" :key="index">{{item.name}}</view> <view class="category_item" @tap="itemClick(item,index)" :class="{active:index===category.active}" v-for="(item,index) in category.list" :key="index">{{item.name}}</view>
</view> </view>
<view style="flex-shrink: 0;"> <view style="flex-shrink: 0;flex: 1;">
<up-radio-group v-model="goodsValue" @change="groupChange" style="width: 100%;display: initial;"> <up-radio-group v-model="goodsValue" @change="groupChange" style="width: 100%;display: initial;">
<view class="goodsList"> <view class="goodsList">
<view class="goodsItem" @tap="goodsClick(item,index)" v-for="(item,index) in category.goodsList" :key="index"> <view class="goodsItem" @tap="goodsClick(item,index)" v-for="(item,index) in category.goodsList" :key="index">
<view>{{item.name}}</view> <view class="up-line-1" style="width: 260rpx;">{{item.name}}</view>
<up-radio <up-radio
:key="item.id" :key="item.id"
:name="item.id" :name="item.id"
@@ -132,6 +132,7 @@
} }
.content{ .content{
display: flex; display: flex;
width: 100%;
height: 672rpx; height: 672rpx;
.category{ .category{
min-width: 316rpx; min-width: 316rpx;
@@ -153,6 +154,7 @@
overflow-y: auto; overflow-y: auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 1;
.goodsItem{ .goodsItem{
width: 100%; width: 100%;
padding: 22rpx 24rpx; padding: 22rpx 24rpx;

View File

@@ -10,7 +10,11 @@
<view class="item"> <view class="item">
<view class="lable">使用门槛</view> <view class="lable">使用门槛</view>
<view class="value"> <view class="value">
<view></view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>元</view><view>减</view><input v-model="formData.discountAmount" type="number" placeholder="填写金额" border="none"></input><view></view> <view></view>
<input v-model="formData.fullAmount" @change="formData.fullAmount = $utils.isPrice(formData.fullAmount)" type="digit" placeholder="填写金额" border="none"></input>
<view></view>
<view v-if="formData.type == 1" style="display: flex;align-items: center;justify-content: flex-start;"> <view>减</view> <input v-model="formData.discountAmount" @change="formData.discountAmount = $utils.isPrice(formData.discountAmount)" type="digit" placeholder="填写金额" border="none"></input> <view></view> </view>
</view> </view>
</view> </view>
</view> </view>
@@ -35,7 +39,7 @@
<view class="item"> <view class="item">
<view class="lable">有效期</view> <view class="lable">有效期</view>
<view class="value"> <view class="value">
<up-input v-model="formData.validDays" type="number" placeholder="填写天数" border="none"></up-input> <input style="width: 100%;text-align: left;padding-left: 20rpx;" v-model="formData.validDays" @input="formData.validDays = $utils.isNumber(formData.validDays)" type="number" placeholder="填写天数" border="none"></input>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@@ -43,13 +47,13 @@
<!-- <up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> --> <!-- <up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
</view> </view>
<view class="value"> <view class="value">
<view></view><input v-model="formData.daysToTakeEffect" type="number" placeholder="填写天数" border="none" ></input><view>天生效</view> <view></view><input v-model="formData.daysToTakeEffect" @change="formData.daysToTakeEffect = $utils.isNumber(formData.daysToTakeEffect)" type="number" placeholder="填写天数" border="none" ></input><view>天生效</view>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="lable">可用日期</view> <view class="lable">可用日期</view>
<view class="value"> <view class="value">
<up-checkbox-group v-model="formData.userDays" placement="row" @change="checkboxChange" > <up-checkbox-group v-model="formData.userDays" placement="row">
<up-checkbox <up-checkbox
:customStyle="{marginBottom: '8px',marginRight: '15px'}" :customStyle="{marginBottom: '8px',marginRight: '15px'}"
v-for="(item, index) in pageData.value" v-for="(item, index) in pageData.value"
@@ -71,7 +75,6 @@
</up-radio-group> </up-radio-group>
</view> </view>
<view class="time" v-if="formData.useTimeType=='custom'"> <view class="time" v-if="formData.useTimeType=='custom'">
<!-- {{formData.useStartTime +''+ formData.useEndTime}} -->
<view @click="useTimeChange('useStartTime')">{{ formData.useStartTime || '开始时间'}}</view>-- <view @click="useTimeChange('useStartTime')">{{ formData.useStartTime || '开始时间'}}</view>--
<view @click="useTimeChange('useEndTime')">{{ formData.useEndTime || '结束时间'}}</view> <view @click="useTimeChange('useEndTime')">{{ formData.useEndTime || '结束时间'}}</view>
</view> </view>
@@ -81,13 +84,34 @@
<view class="card"> <view class="card">
<view class="item"> <view class="item">
<view class="lable">总发放数量 <view class="lable">总发放数量
<!-- <up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
</view> </view>
<view class="value"> <view class="value">
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input> <input style="width: 100%;text-align: left;padding-left: 20rpx;" v-model="formData.number" @change="formData.number = $utils.isNumber(formData.number)" placeholder="填写数量" border="none" clearable ></input>
</view> </view>
</view> </view>
</view> </view>
<view class="card product" v-if="formData.type == 2">
<view class="item">
<view class="lable">指定抵扣商品</view>
<view class="value">
<view class="selectGoods" @tap="selectGoodsOpen">
<view>
<view class="title">选择商品</view>
<view class="goodsName" v-if='!formData.proId'>选择指定商品</view>
<view class="goodsName" v-else>
<view class="goodsItem" >
<view class="productName">{{formData.proName}}</view>
<!-- <up-input @tap.stop="stop" style="border-bottom: 1rpx solid #666;" v-model="item.num" placeholder="填写数量" border="none" ></up-input> -->
</view>
</view>
</view>
<up-icon name="arrow-right" color="#9F9F9F" size="22"></up-icon>
</view>
</view>
</view>
</view>
<view class="bottomPop"> <view class="bottomPop">
<button @click="save">保存</button> <button @click="save">保存</button>
</view> </view>
@@ -100,12 +124,17 @@
></up-datetime-picker> ></up-datetime-picker>
<my-date-pickerview @confirm="datePickerConfirm" :mode="pageData.mode" ref="datePicker"></my-date-pickerview> <my-date-pickerview @confirm="datePickerConfirm" :mode="pageData.mode" ref="datePicker"></my-date-pickerview>
<up-modal :show="pageData.show" :title="pageData.title" @confirm="pageData.show = false" ></up-modal> <up-modal :show="pageData.show" :title="pageData.title" @confirm="pageData.show = false" ></up-modal>
<select-goods ref="goods" @affirm="affirm"></select-goods>
</view> </view>
</template> </template>
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app'; import { onLoad, onShow } from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'
import selectGoods from './components/select-goods';
import { addCoupon, updateCoupon } from '@/http/api/coupon.js' import { addCoupon, updateCoupon } from '@/http/api/coupon.js'
const pageData = reactive({ const pageData = reactive({
value: [ value: [
@@ -137,11 +166,23 @@
useTimeType: 'all', useTimeType: 'all',
useStartTime: '', useStartTime: '',
useEndTime: '', useEndTime: '',
validDays: null, validDays: '',
daysToTakeEffect: null, daysToTakeEffect: null,
number: null, number: null,
proId: null,
proName: null,
}) })
let datePicker = ref(null)
let refTime = ref(null)
let goods = ref(null)
onLoad((options) => { onLoad((options) => {
if ( options.isType ) {
formData.type = options.isType;
}
if ( options.type == 'info' ) { if ( options.type == 'info' ) {
let itemData = JSON.parse(options.item); let itemData = JSON.parse(options.item);
for (let item in itemData) { for (let item in itemData) {
@@ -150,8 +191,18 @@
formData.userDays = formData.userDays.split(","); formData.userDays = formData.userDays.split(",");
} }
}) })
let datePicker = ref(null)
let refTime = ref(null) /**
* 选择商品
*/
let selectGoodsOpen = () => {
goods.value.open();
}
let affirm = (item) => {
formData.proId = item.id
formData.proName = item.name
}
/** /**
* 查看生效时间/发放数量提示 * 查看生效时间/发放数量提示
@@ -215,33 +266,39 @@
*/ */
let save = () => { let save = () => {
if( !formData.title ){ if( !formData.title ){
uni.showToast({ title: '请输入优惠券名称' }) uni.$utils.showToast("请输入优惠券名称")
return false; return false;
} }
if( !formData.fullAmount || !formData.discountAmount ){ if( !formData.fullAmount || (formData.type == 1&&!formData.discountAmount) ){
uni.showToast({ title: '请输入使用门槛' }) uni.$utils.showToast("请输入使用门槛")
return false; return false;
} }
if( !formData.daysToTakeEffect ){ if( !formData.daysToTakeEffect ){
uni.showToast({ title: '请输入生效天数' }) uni.$utils.showToast("请输入生效天数")
return false; return false;
} }
if( !formData.number ){ if( !formData.number ){
uni.showToast({ title: '请输入发放数量' }) uni.$utils.showToast("请输入发放数量")
return false; return false;
} }
let userDays = formData.userDays.toString();
formData.userDays = formData.userDays.toString();
let params = { let params = {
...formData ...formData,
userDays
} }
if(formData.id){ if(formData.id){
updateCoupon(params).then((res) => { updateCoupon(params).then((res) => {
go.back(1) uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
}) })
} else{ } else{
addCoupon(params).then((res) => { addCoupon(params).then((res) => {
go.back(1) uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
}) })
} }
@@ -312,6 +369,65 @@
margin-bottom: 0; margin-bottom: 0;
} }
} }
.card.product{
padding: 32rpx 24rpx;
background-color: #fff;
margin-bottom: 32rpx;
.item{
padding-bottom: 24rpx;
border-bottom: 2rpx solid #E5E5E5;
margin-bottom: 24rpx;
.lable{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
display: flex;
align-items: center;
}
.value{
display: flex;
justify-content: flex-start;
align-items: center;
input{
width: 150rpx;
text-align: center;
}
.selectGoods{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 16rpx;
background: #F9F9F9;
border-radius: 12rpx 12rpx 12rpx 12rpx;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
}
.goodsName{
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.goodsItem{
display: flex;
align-items: center;
.productName{
margin-right: 20rpx;
}
}
}
}
}
.item:last-child{
border-bottom: none;
margin-bottom: 0;
}
}
.bottomPop{ .bottomPop{
position: fixed; position: fixed;
bottom: 0; bottom: 0;

View File

@@ -10,13 +10,13 @@
<view class="item"> <view class="item">
<view class="lable">使用门槛</view> <view class="lable">使用门槛</view>
<view class="value"> <view class="value">
<view></view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>可用</view> <view></view><input v-model="formData.fullAmount" @change="formData.fullAmount = $utils.isPrice(formData.fullAmount)" type="digit" placeholder="填写金额" border="none"></input><view>可用</view>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="lable">总发放数量</view> <view class="lable">总发放数量</view>
<view class="value"> <view class="value">
<up-input v-model="formData.number" type="number" placeholder="填写数量" border="none" clearable ></up-input> <up-input v-model="formData.number" @change="formData.number = $utils.isNumber(formData.number)" type="number" placeholder="填写数量" border="none" clearable ></up-input>
</view> </view>
</view> </view>
</view> </view>
@@ -92,7 +92,6 @@
let affirm = (item) => { let affirm = (item) => {
formData.proId = item.id formData.proId = item.id
formData.proName = item.name formData.proName = item.name
} }
/** /**
@@ -100,15 +99,15 @@
*/ */
let save = () => { let save = () => {
if( !formData.title ){ if( !formData.title ){
uni.showToast({ title: '请输入商品名称' }) uni.$utils.showToast("请输入商品名称")
return false; return false;
} }
if( !formData.fullAmount ){ if( !formData.fullAmount ){
uni.showToast({ title: '请输入使用门槛' }) uni.$utils.showToast("请输入使用门槛")
return false; return false;
} }
if( !formData.number ){ if( !formData.number ){
uni.showToast({ title: '请输入发放数量' }) uni.$utils.showToast("请输入发放数量")
return false; return false;
} }
let params = { let params = {
@@ -116,11 +115,17 @@
} }
if(formData.id){ if(formData.id){
updateCoupon(params).then((res) => { updateCoupon(params).then((res) => {
go.back(1) uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
}) })
} else{ } else{
addCoupon(params).then((res) => { addCoupon(params).then((res) => {
go.back(1) uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
}) })
} }
} }

View File

@@ -26,7 +26,7 @@
<view> 领取方式 </view> <view> 领取方式 </view>
<view> 用户不可自行领取 </view> <view> 用户不可自行领取 </view>
</view> --> </view> -->
<view v-if="item.type == 1"> <view>
<view> 有效期 </view> <view> 有效期 </view>
<view> 领券后{{ item.validDays }}天过期 </view> <view> 领券后{{ item.validDays }}天过期 </view>
</view> </view>
@@ -113,7 +113,6 @@
let getCoupon = () => { let getCoupon = () => {
let params = pageData.query; let params = pageData.query;
getCouponList(params).then((res) => { getCouponList(params).then((res) => {
console.log(res)
pageData.couponList = res; pageData.couponList = res;
}) })
} }
@@ -124,9 +123,9 @@
*/ */
let addCoupon = ()=>{ let addCoupon = ()=>{
if ( pageData.query.type == 1 ) { if ( pageData.query.type == 1 ) {
go.to('PAGES_COUPON_DISCOUNTCOUPONS') go.to('PAGES_COUPON_DISCOUNTCOUPONS',{ isType: 1})
} else { } else {
go.to('PAGES_COUPON_CERTIFICATE') go.to('PAGES_COUPON_DISCOUNTCOUPONS',{ isType: 2})
} }
} }
@@ -135,11 +134,11 @@
* 修改 * 修改
*/ */
let editCoupon = (item)=>{ let editCoupon = (item)=>{
console.log(item.id)
if ( item.type == 1 ) { if ( item.type == 1 ) {
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{type: 'info', item: JSON.stringify(item)}) go.to('PAGES_COUPON_DISCOUNTCOUPONS',{type: 'info', isType: 1, item: JSON.stringify(item)})
} else { } else {
go.to('PAGES_COUPON_CERTIFICATE',{type: 'info', item: JSON.stringify(item)}) go.to('PAGES_COUPON_DISCOUNTCOUPONS',{type: 'info', isType: 2, item: JSON.stringify(item)})
// go.to('PAGES_COUPON_CERTIFICATE',{type: 'info', item: JSON.stringify(item)})
} }
} }

View File

@@ -59,7 +59,7 @@
import { reactive, ref } from 'vue'; import { reactive, ref } 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 { debounce } from '@/commons/utils/debounce.js'
import { addCreditBuyer,editCreditBuyer } from '@/http/api/buyer.js'; import { addCreditBuyer,editCreditBuyer } from '@/http/api/buyer.js';
const pageData = reactive({ const pageData = reactive({
@@ -120,7 +120,7 @@
* 保存 * 保存
*/ */
let save = debounce(() => { let save = uni.$utils.debounce(() => {
console.log(pageData.formData) console.log(pageData.formData)
uFormRef.value.validate().then(valid => { uFormRef.value.validate().then(valid => {
if (valid) { if (valid) {

View File

@@ -71,7 +71,7 @@
<script setup> <script setup>
import { reactive,ref } from 'vue'; import { reactive,ref } from 'vue';
import { debounce } from '@/commons/utils/debounce.js'
import { getCreditBuyerPage,creditBuyerRepayment,creditBuyerOrderPay } from '@/http/api/buyer.js'; import { getCreditBuyerPage,creditBuyerRepayment,creditBuyerOrderPay } from '@/http/api/buyer.js';
const props=defineProps({ const props=defineProps({
@@ -124,7 +124,6 @@
function open(options){ function open(options){
show.value = true; show.value = true;
console.log(options)
if (options.creditBuyerId) { if (options.creditBuyerId) {
pageData.formData.creditBuyerId = options.creditBuyerId; pageData.formData.creditBuyerId = options.creditBuyerId;
pageData.formData.orderId = options.order.orderId; pageData.formData.orderId = options.order.orderId;
@@ -149,7 +148,7 @@
/** /**
* 确认 * 确认
*/ */
let affirm = debounce(() => { let affirm = uni.$utils.debounce(() => {
uFormRef.value.validate().then(valid => { uFormRef.value.validate().then(valid => {
if (valid) { if (valid) {
console.log(pageData.formData) console.log(pageData.formData)

View File

@@ -3,7 +3,7 @@
<view v-for="item in datas.list" :key="item.id"> <view v-for="item in datas.list" :key="item.id">
<view> <view>
<view> {{item.callNum}} </view> <view> {{item.callNum}} </view>
<view> {{item.note}}</view> <view>{{item.note}}</view>
</view> </view>
<view :class="[item.state==3?'rightTopstyle':'rightTop']"> <view :class="[item.state==3?'rightTopstyle':'rightTop']">
{{filterEvent(item.state)}} {{filterEvent(item.state)}}
@@ -11,7 +11,7 @@
<view> <view>
<view> <view>
<view> 时间 </view> <view> 时间 </view>
<view> {{item.callTime}} </view> <view class="up-line-1"> {{item.callTime}} </view>
</view> </view>
<view> <view>
<view> 手机号 </view> <view> 手机号 </view>
@@ -82,13 +82,13 @@
position: relative; position: relative;
>view:first-child { >view:first-child {
padding: 0 58rpx; padding: 0 30rpx;
box-sizing: border-box; box-sizing: border-box;
>view:first-child { >view:first-child {
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500; font-weight: 500;
font-size: 56rpx; font-size: 50rpx;
color: #333333; color: #333333;
text-align: center; text-align: center;
} }

View File

@@ -1,48 +1,50 @@
<template> <template>
<view class="pageLineUpTop"> <view class="container" style="display: flex;flex-direction: column;height: 100vh;">
<view :class="[[datas.selecttopType==''?'active':'']]" @tap="gettypeevent('')"> <view class="pageLineUpTop">
<view style="border-bottom: 1px dashed #ccc;line-height: 70rpx;">全部</view> <view :class="[[datas.selecttopType==''?'active':'']]" @tap="gettypeevent('')">
<view style="line-height: 50rpx;">{{datas.list.totalCount}}</view> <view style="border-bottom: 1px dashed #ccc;line-height: 70rpx;">全部</view>
<view style="line-height: 50rpx;">{{datas.list.totalCount}}</view>
</view>
<view v-for='item in datas.list.records' :key="item.id" @tap="gettypeevent(item.id)"
:class="[[datas.selecttopType==item.id?'active':'']]">
<view class="up-line-1" style="border-bottom: 1px dashed #ccc;line-height: 70rpx;">{{item.name}}</view>
<view style="line-height: 50rpx;color: #999;">{{item.totalCount}}({{item.note}})</view>
</view>
</view> </view>
<view v-for='item in datas.list.records' :key="item.id" @tap="gettypeevent(item.id)" <view class="userinfo">
:class="[[datas.selecttopType==item.id?'active':'']]"> <view>用户</view>
<view style="border-bottom: 1px dashed #ccc;line-height: 70rpx;">{{item.name}}</view> <span>号码</span>
<view style="line-height: 50rpx;color: #999;">{{item.totalCount}}({{item.note}})</view> <span>等待</span>
</view> </view>
</view> <view class="" style="overflow-y: auto;flex: 1;padding-bottom: 186rpx;">
<view class="userinfo"> <view class="userinfoBox" v-for="item in datas.listType.records" :key="item.id">
<view>用户</view> <view class="userinfo1">
<span>号码</span>
<span>等待</span>
</view>
<view class="userinfoBox" v-for="item in datas.listType.records" :key="item.id">
<view class="userinfo1">
<view>
<image src="./avation.svg" style="width: 64rpx;height: 64rpx;margin-right: 16rpx;" mode=""></image>
<view>
<view> <view>
{{item.phone}} <image src="./avation.svg" style="width: 64rpx;height: 64rpx;margin-right: 16rpx;" mode=""></image>
</view> <view>
<view> <view> {{item.phone}} </view>
{{item.callTime}} <view> {{item.callTime}} </view>
</view>
</view> </view>
<span>{{item.callNum}}</span>
<span>{{item.waitingCount}}</span>
</view>
<view class="userinfo2">
<view>{{item.name}}{{item.note}}</view>
<button type="primary" class="mini-btn" size="mini" style="border-radius: 200rpx;" @tap="quxiaoevent(item)"
plain="true">取消</button>
<button class="mini-btn" type="primary" style="border-radius: 200rpx;" @tap="profilepicture(item)"
size="mini">播报</button>
</view> </view>
</view> </view>
<span>{{item.callNum}}</span>
<span>{{item.waitingCount}}</span>
</view> </view>
<view class="userinfo2">
<view>{{item.name}}{{item.note}}</view> <view class="bottomBUtton" style="padding-bottom: 30rpx;">
<button type="primary" class="mini-btn" size="mini" style="border-radius: 200rpx;" @tap="quxiaoevent(item)" <button class="mini-btn" type="primary" @tap="showFalse">取号</button>
plain="true">取消</button> <button type="text" class="mini-btn" plain="true" @tap="toUrl">叫号记录</button>
<button class="mini-btn" type="primary" style="border-radius: 200rpx;" @tap="profilepicture(item)"
size="mini">播报</button>
</view> </view>
</view> </view>
<view class="bottomBUtton">
<button class="mini-btn" type="primary" @tap="showFalse">取号</button>
<button type="text" class="mini-btn" plain="true" @tap="toUrl">叫号记录</button>
</view>
<!-- 播报弹窗 --> <!-- 播报弹窗 -->
<uni-popup ref="alertDialog" type="dialog"> <uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog :type="datas.msgType" cancelText="完成" confirmText="过号" confirmText-color="#000" title="播报" <uni-popup-dialog :type="datas.msgType" cancelText="完成" confirmText="过号" confirmText-color="#000" title="播报"
@@ -62,7 +64,7 @@
</uni-popup-dialog> </uni-popup-dialog>
</uni-popup> </uni-popup>
<!-- 取号遮罩层 --> <!-- 取号遮罩层 -->
<up-popup :show="datas.show" :round="18" mode="center" @close="close" @open="open"> <up-popup :show="datas.show" :round="18" mode="center">
<view class="zhezhaopop"> <view class="zhezhaopop">
<view class=""> <view class="">
<span></span> <span></span>
@@ -75,14 +77,12 @@
<view class="pageLineUpTop"> <view class="pageLineUpTop">
<view v-for='item in datas.list.records' :key="item.id" <view v-for='item in datas.list.records' :key="item.id"
:class="[datas.selectTabletype.id==item.id?'active':'']" @tap="selectTypeEvent(item)"> :class="[datas.selectTabletype.id==item.id?'active':'']" @tap="selectTypeEvent(item)">
<view style="border-bottom: 1px dashed #ccc;line-height: 70rpx;">{{item.name}}</view> <view class="up-line-1" style="border-bottom: 1px dashed #ccc;line-height: 70rpx;">{{item.name}}</view>
<view style="line-height: 50rpx;">等待{{item.totalCount}}</view> <view style="line-height: 50rpx;">等待{{item.totalCount}}</view>
</view> </view>
</view> </view>
<view class=""> <view class=""> 手机号码 </view>
手机号码
</view>
<view style="margin-bottom: 48rpx;"> <view style="margin-bottom: 48rpx;">
<input v-model="datas.phone" type="text" placeholder="填写号码" maxlength="11"/> <input v-model="datas.phone" type="text" placeholder="填写号码" maxlength="11"/>
</view> </view>
@@ -91,7 +91,7 @@
</view> </view>
</up-popup> </up-popup>
<!-- 取号成功 --> <!-- 取号成功 -->
<up-popup :show="datas.showtwo" :round="18" mode="center" @close="close" @open="open"> <up-popup :show="datas.showtwo" :round="18" mode="center">
<view class="zhezhaopops"> <view class="zhezhaopops">
<view class=""> <view class="">
<span></span> <span></span>
@@ -150,7 +150,7 @@
getCallTable({ getCallTable({
page: 1, page: 1,
size: 9999, size: 9999,
callTableId: datas.selecttopType, // callTableId: datas.selecttopType,
state: 1 state: 1
}).then((res) => { }).then((res) => {
datas.list = res datas.list = res
@@ -178,6 +178,9 @@
* 取号 * 取号
*/ */
function callTabletakeNumberEvent() { function callTabletakeNumberEvent() {
if( !datas.phone ){
return uni.$utils.showToast("请输入取号手机号码")
}
callTableTakeNumber({ callTableTakeNumber({
callTableId: datas.selectTabletype.id, callTableId: datas.selectTabletype.id,
phone: datas.phone, phone: datas.phone,
@@ -381,7 +384,6 @@
.bottomBUtton { .bottomBUtton {
width: 100%; width: 100%;
height: 200rpx;
background-color: #fff; background-color: #fff;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
@@ -485,7 +487,8 @@
font-size: 80rpx; font-size: 80rpx;
color: #333333; color: #333333;
margin-top: 64rpx; margin-top: 64rpx;
margin-left: 34%; width: 100%;
text-align: center;
} }
>view:nth-child(3) { >view:nth-child(3) {

View File

@@ -19,8 +19,8 @@ import { reactive, ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app'; import { onLoad, onShow } from '@dcloudio/uni-app';
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
import qrCode from '@/commons/utils/qrCode.js' import qrCode from '@/commons/utils/qrCode.js'
import { getSubQrCode } from '@/http/yskApi/pageNotification.js' import { getShopMsgPushCode } from '@/http/api/index.js'
import { saveHeadImgFile } from '@/commons/utils/saveImg.js'
const vdata = reactive({ const vdata = reactive({
size: 20, size: 20,
QrcodeUrl: "", QrcodeUrl: "",
@@ -31,14 +31,12 @@ onLoad((options) => {
}) })
onShow(() => { onShow(() => {
getSubQrCode().then((res) => { getShopMsgPushCode().then((res) => {
vdata.QrcodeUrl = res; vdata.QrcodeUrl = res;
}) })
}) })
const saveImage = () => { const saveImage = () => {
uni.downloadFile({ uni.downloadFile({
url: vdata.QrcodeUrl, url: vdata.QrcodeUrl,
@@ -63,10 +61,8 @@ const saveImage = () => {
infoBox.showErrorToast('保存失败') infoBox.showErrorToast('保存失败')
} }
}) })
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page-wrapper { .page-wrapper {

View File

@@ -210,18 +210,14 @@
*/ */
async function getdetails(id) { async function getdetails(id) {
const res = await getPrinterDetail({id: id}) const res = await getPrinterDetail({id: id})
if (res.categoryIds) { if (res.categoryList) {
let arr = res.categoryIds.split(',')
let arrs = [] let arrs = []
console.log(arrs) res.categoryList.forEach(eles => {
arr.forEach(eles => {
arrs.push(eles) arrs.push(eles)
}) })
res.selectcheckbox = arrs res.selectcheckbox = arrs
} }
form = Object.assign(form, res) form = Object.assign(form, res)
console.log(res)
console.log(form)
form.printType = JSON.parse(form.printType) form.printType = JSON.parse(form.printType)
} }
@@ -257,9 +253,12 @@
idstr += element + ',' idstr += element + ','
arr.push(pageData.partList.filter(ele => ele.id == element)[0]) arr.push(pageData.partList.filter(ele => ele.id == element)[0])
}) })
console.log(form.selectcheckbox)
form.categoryIds = idstr.substring(0, idstr.length - 1) form.categoryIds = idstr.substring(0, idstr.length - 1)
form.categoryIds = JSON.stringify(form.selectcheckbox)
form.categoryList = JSON.stringify(arr) form.categoryList = JSON.stringify(arr)
} }
delete form.selectcheckbox;
form.printType = JSON.stringify(form.printType) form.printType = JSON.stringify(form.printType)
if (form.id) { if (form.id) {
delete form.createdAt delete form.createdAt

View File

@@ -8,15 +8,15 @@ export const brand = [{
} }
] ]
export const receipts = [{ export const receipts = [{
value: '标签', value: 'label',
name: '标签' name: '标签'
}, },
{ {
value: '出品', value: 'kitchen',
name: '出品' name: '出品'
}, },
{ {
value: '小票', value: 'cash',
name: '小票' name: '小票'
} }
] ]

View File

@@ -19,7 +19,7 @@
</view> </view>
<view class=""> <view class="">
<view class=""> 客单价() </view> <view class=""> 客单价() </view>
<view class=""> {{list.customerUnitPrice?customerUnitPrice:0}} </view> <view class=""> {{list.customerUnitPrice?list.customerUnitPrice:0}} </view>
</view> </view>
<view class=""> <view class="">
<view class=""> 会员消费() </view> <view class=""> 会员消费() </view>
@@ -141,6 +141,8 @@
startTime = s + ' 00:00:00' startTime = s + ' 00:00:00'
endTime = e + ' 23:59:59' endTime = e + ' 23:59:59'
} }
console.log(startTime)
console.log(endTime)
getTrade({ getTrade({
beginDate: startTime, beginDate: startTime,
endDate: endTime, endDate: endTime,
@@ -221,7 +223,9 @@
* @param {Object} e * @param {Object} e
*/ */
function datePickerConfirm(e) { function datePickerConfirm(e) {
console.log(e)
getlist(e.start, e.end) getlist(e.start, e.end)
gettableData()
} }
/** /**

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="item color-fff border-r-12" :class="[computedClass]" @click="toOrderDetail"> <view class="item color-fff border-r-12" :class="[computedClass]">
<view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}"> <view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="u-font-32">{{data.name}}</view> <view class="u-font-32">{{data.name}}</view>
@@ -74,7 +74,7 @@
import {hasPermission} from '@/commons/utils/hasPermission.js' import {hasPermission} from '@/commons/utils/hasPermission.js'
import { $status } from '@/commons/table-status.js' import { $status } from '@/commons/table-status.js'
import { $table } from '@/http/yskApi/table.js' import { $table } from '@/http/yskApi/table.js'
import infoBox from '@/commons/utils/infoBox.js'
const emits = defineEmits(['more', 'update', 'bind']) const emits = defineEmits(['more', 'update', 'bind'])
const props = defineProps({ const props = defineProps({
data: { data: {
@@ -140,46 +140,12 @@
console.log(res) console.log(res)
if(res){ if(res){
const useType = props.status == 'using' ? props.data.useType : undefined const useType = props.status == 'using' ? props.data.useType : undefined
go.to('PAGES_CREATE_ORDER', { console.log(props.data)
tableId: props.data.id, go.to('PAGES_CREATE_ORDER', props.data)
name: props.data.name,
maxCapacity: props.data.maxCapacity,
status: props.data.status,
})
} }
}) })
} }
/**
* 查看订单详情
*/
function toOrderDetail() {
if (props.data.status == 'using' && props.data.orderId) {
const {
id,
name,
status,
amount,
areaId,
orderId
} = props.data
if (!orderId) {
return uni.showToast({
icon: 'none',
title: '台桌未返回订单id'
})
}
go.to('PAGES_ORDER_DETAIL', {
id,
name,
status,
amount,
areaId,
id: orderId
})
}
}
/** /**
* 清台 * 清台
@@ -196,7 +162,7 @@
status: "idle", status: "idle",
qrcode: item.id, qrcode: item.id,
}).then(res => { }).then(res => {
infoBox.showToast('清台成功') uni.$utils.showToast('清台成功')
emits('update') emits('update')
}) })
} }

View File

@@ -12,8 +12,9 @@
<up-icon name="arrow-down" size="16"></up-icon> <up-icon name="arrow-down" size="16"></up-icon>
</view> </view>
<uni-easyinput clearable class='jeepay-search' :inputBorder="false" <uni-easyinput clearable class='jeepay-search' :inputBorder="false"
trim="all" trim="all"
placeholder="搜索" v-model="search.keyword" placeholder="搜索"
v-model="pageData.query.name"
@clear="searchConfirm" @clear="searchConfirm"
@confirm="searchConfirm"> @confirm="searchConfirm">
<template #prefixIcon> <template #prefixIcon>
@@ -29,7 +30,7 @@
<view @tap="changestatusActive(index,item)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between" <view @tap="changestatusActive(index,item)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
v-for="(item,index) in status.list" :key="index"> v-for="(item,index) in status.list" :key="index">
<view>{{item.label}}</view> <view>{{item.label}}</view>
<uni-icons v-if="status.active===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons> <uni-icons v-if="status.active===index" type="checkmarkempty" :color="$utils.ColorMain"></uni-icons>
</view> </view>
<view :style="{height: status.bottomHeight+'px'}"></view> <view :style="{height: status.bottomHeight+'px'}"></view>
</view> </view>
@@ -58,7 +59,7 @@
<table-item @bind="scanCode" @update="getTable" :areaMap="pageData.areaMap" @more="moreShow(item)" :data="item"></table-item> <table-item @bind="scanCode" @update="getTable" :areaMap="pageData.areaMap" @more="moreShow(item)" :data="item"></table-item>
</view> </view>
</view> </view>
<my-pagination :page="pageData.query.page" :totalElements="pageData.query.totalElements" :size="pageData.query.size" <my-pagination :page="pageData.query.page" :totalElements="pageData.totalElements" :size="pageData.query.size"
@change="pageChange"></my-pagination> @change="pageChange"></my-pagination>
</template> </template>
@@ -79,27 +80,20 @@
<script setup> <script setup>
import { onLoad, onReady, onShow, } from '@dcloudio/uni-app'; import { onLoad, onReady, onShow, } from '@dcloudio/uni-app';
import { ref, reactive, computed, watch } from 'vue'; import { ref, reactive, computed, watch } from 'vue';
import {
$table,
$tableArea,
$bind
} from '@/http/yskApi/table.js'
import { objToArrary } from '@/commons/utils/returrn-data.js' import { objToArrary } from '@/commons/utils/returrn-data.js'
import { $status } from '@/commons/table-status.js' import { $status } from '@/commons/table-status.js'
import color from '@/commons/color';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import myMask from '@/components/my-components/my-mask' import myMask from '@/components/my-components/my-mask'
import addTable from './components/add-table' import addTable from './components/add-table'
import myActionSheet from '@/components/my-components/my-action-sheet'; import myActionSheet from '@/components/my-components/my-action-sheet';
import tableItem from './components/table-item' import tableItem from './components/table-item'
import * as $fun from './util.js'
import infoBox from '@/commons/utils/infoBox.js'
import { hasPermission } from '@/commons/utils/hasPermission.js' import { hasPermission } from '@/commons/utils/hasPermission.js'
import { getShopTable, shopTableBind, shopTableClear } from '@/http/api/table.js' import { getShopTable, shopTableBind, shopTableClear } from '@/http/api/table.js'
import { getShopArea } from '@/http/api/area.js' import { getShopArea } from '@/http/api/area.js'
import { printOrder } from '@/http/api/order.js'
const statusList = objToArrary($status) const statusList = objToArrary($status)
console.log(statusList)
statusList.unshift({ statusList.unshift({
key: '', key: '',
label: '全部' label: '全部'
@@ -119,8 +113,9 @@
size: 10, size: 10,
status: '', status: '',
areaId: '', areaId: '',
totalElements:0 name: '',
}, },
totalElements:0,
tabList: [], tabList: [],
area: { area: {
list: [], list: [],
@@ -128,7 +123,6 @@
} }
}) })
const search = reactive({ const search = reactive({
keyword: '',
show: false show: false
}) })
const refMoreSheet = ref(null) const refMoreSheet = ref(null)
@@ -166,7 +160,7 @@
const res = await getShopTable(pageData.query) const res = await getShopTable(pageData.query)
pageData.hasAjax = true pageData.hasAjax = true
pageData.tabList = res.records pageData.tabList = res.records
pageData.query.totalElements= res.totalRow pageData.totalElements = res.totalRow
} }
/** /**
@@ -209,9 +203,9 @@
const item = actionSheet.selTable const item = actionSheet.selTable
if (index == 0) { if (index == 0) {
if (!item.orderId) { if (!item.orderId) {
return infoBox.showToast('该桌台暂无要结账的订单!') return uni.$utils.showToast('该桌台暂无要结账的订单!')
} }
const canJieZhang=await hasPermission('允许收款') const canJieZhang = await hasPermission('允许收款')
if(!canJieZhang){ if(!canJieZhang){
return return
} }
@@ -227,7 +221,7 @@
shopTableClear({ shopTableClear({
id: item.id, id: item.id,
}).then(res => { }).then(res => {
infoBox.showToast('清台成功') uni.$utils.showToast('清台成功')
pageData.query.page = 1 pageData.query.page = 1
getTable() getTable()
}) })
@@ -236,14 +230,17 @@
}) })
} }
if (index == 2) { if (index == 2) {
return infoBox.showToast('待开放,请敬请期待!') return uni.$utils.showToast('待开放,请敬请期待!')
} }
if (index == 3) { if (index == 3) {
return infoBox.showToast('待开放,请敬请期待!') return uni.$utils.showToast('待开放,请敬请期待!')
} }
if (index == 4) { if (index == 4) {
//打印订单 //打印订单
const res = await $fun.printOrder(actionSheet.selTable.tableId) if (!item.orderId) {
return uni.$utils.showToast('该桌台暂无要打印的订单!')
}
let res = await printOrder( {id: actionSheet.selTable.orderId } )
return return
} }
if (index == 6) { if (index == 6) {
@@ -251,7 +248,7 @@
scanCode(item) scanCode(item)
return return
} }
infoBox.showToast('待开放,请敬请期待!') uni.$utils.showToast('待开放,请敬请期待!')
} }
/** /**
@@ -275,7 +272,7 @@
function scanCode(item) { function scanCode(item) {
console.log(item) console.log(item)
if ( item.tableCode != '') { if ( item.tableCode != '') {
infoBox.showToast('当前桌台已绑定') uni.$utils.showToast('当前桌台已绑定')
return; return;
} }
uni.scanCode({ uni.scanCode({
@@ -288,7 +285,7 @@
"tableCode": params.code, "tableCode": params.code,
"id": item.id, "id": item.id,
}).then(res => { }).then(res => {
infoBox.showToast('桌台绑定成功') uni.$utils.showToast('桌台绑定成功')
setTimeout(()=>{ setTimeout(()=>{
getTable() getTable()
},1500) },1500)

View File

@@ -1,31 +0,0 @@
import * as Api from '@/http/yskApi/Instead.js'
import go from '@/commons/utils/go.js'
//打印订单
export function printOrder(tableId) {
return new Promise((resolve, reject) => {
uni.showModal({
title: '提示',
content: '确定要打印订单吗?',
success(res) {
if (res.confirm) {
Api.$printOrder({
tableId
}).then(res => {
resolve(res)
})
}
}
})
})
}
//去支付页面
export function toPay(options) {
go.to('PAGES_CRESATE_ORDER_PAY', {
tableId: options.tableId,
tableName: options.name,
masterId: options.masterId,
orderId: orderDetail.info.id,
discount: 1
})
}

View File

@@ -84,7 +84,7 @@
function toOrder(){ function toOrder(){
go.to('PAGES_ORDER_INDEX',{ go.to('PAGES_ORDER_INDEX',{
userId:props.data.id||'', userId: props.data.userId||'',
type:'user' type:'user'
}) })
} }

View File

@@ -130,7 +130,7 @@
</view> </view>
<view class=""> <view class="">
<input type="number" v-model="datas.form.money" placeholder="请输入金额" /> <input type="digit" v-model="datas.form.money" @change="datas.form.money = $utils.isPrice(datas.form.money)" placeholder="请输入金额" />
<view class=""> <view class="">
</view> </view>
@@ -150,7 +150,6 @@
import { shopUserSummary, shopUserList,shopUserMoney } from '@/http/api/shopUser.js' import { shopUserSummary, shopUserList,shopUserMoney } from '@/http/api/shopUser.js'
import { onShow } from '@dcloudio/uni-app'; import { onShow } from '@dcloudio/uni-app';
import { midfiyAccount } from '@/http/yskApi/requestAll.js';
import { onReachBottom } from '@dcloudio/uni-app'; import { onReachBottom } from '@dcloudio/uni-app';
import { hasPermission } from '@/commons/utils/hasPermission.js'; import { hasPermission } from '@/commons/utils/hasPermission.js';
@@ -231,7 +230,9 @@
* @param {Object} i * @param {Object} i
*/ */
function tabsChange(i) { function tabsChange(i) {
pageData.query.isVip = pageData.tabsList[i].value pageData.userList = [];
pageData.query.page = 1;
pageData.query.isVip = pageData.tabsList[i].value;
getUser() getUser()
getAllShopInfo() getAllShopInfo()
} }
@@ -239,7 +240,7 @@
* 搜索 * 搜索
*/ */
function searchFunc() { function searchFunc() {
pageData.query.page = 1 pageData.query.page = 1;
getUser() getUser()
getAllShopInfo() getAllShopInfo()
} }
@@ -312,6 +313,13 @@
* 修改余额确定 * 修改余额确定
*/ */
let callTabletakeNumberEvent = async () => { let callTabletakeNumberEvent = async () => {
if( datas.form.money == ''){
uni.showToast({
title: '请输入增减金额',
icon: 'none'
})
return;
}
let res = await shopUserMoney({ let res = await shopUserMoney({
id: datas.activeUser.id, id: datas.activeUser.id,
...datas.form ...datas.form

View File

@@ -124,8 +124,9 @@
* @param {Object} e * @param {Object} e
*/ */
function datePickerConfirm(e) { function datePickerConfirm(e) {
pageData.tableData.query.beginDate = timeFormat(new Date(e.start.replaceAll('-', '/')).getTime()) pageData.tableData.data = [];
pageData.tableData.query.endDate = timeFormat(new Date(e.end.replaceAll('-', '/')).getTime()) pageData.query.beginDate = timeFormat(new Date(e.start.replaceAll('-', '/')).getTime())
pageData.query.endDate = timeFormat(new Date(e.end.replaceAll('-', '/')).getTime())
pageData.time.start = new Date(e.start.replaceAll('-', '/')).getTime() pageData.time.start = new Date(e.start.replaceAll('-', '/')).getTime()
pageData.time.end = new Date(e.end.replaceAll('-', '/')).getTime() pageData.time.end = new Date(e.end.replaceAll('-', '/')).getTime()
getTableData() getTableData()

View File

@@ -54,14 +54,10 @@
import Stats from './components/Stats.vue'; import Stats from './components/Stats.vue';
import statistics from './components/statistics.vue' import statistics from './components/statistics.vue'
import storageManage from '@/commons/utils/storageManage.js'; import storageManage from '@/commons/utils/storageManage.js';
import { import { hasPermission } from '@/commons/utils/hasPermission.js'
hasPermission
} from '@/commons/utils/hasPermission.js'
uni.hideTabBar() uni.hideTabBar()
let shopName = ref() let shopName = ref()
let totalRevenuedata = ref() let totalRevenuedata = ref()
let totalRevenue = (d) => { let totalRevenue = (d) => {
totalRevenuedata.value = d totalRevenuedata.value = d

View File

@@ -323,6 +323,7 @@
// 保存 token // 保存 token
storageManage.setLogin(loginBizData) storageManage.setLogin(loginBizData)
storageManage.token(loginBizData.tokenInfo) storageManage.token(loginBizData.tokenInfo)
uni.setStorageSync("promission",loginBizData.promissionList)
// var time1 = new Date(); // var time1 = new Date();
// var time2 = new Date(loginBizData.expireDate); // var time2 = new Date(loginBizData.expireDate);

View File

@@ -37,10 +37,13 @@
<view class="right"><up-switch v-model="vdata.takeout" size="20" activeColor="#0FC161" @change="switchChange('eatModel')"></up-switch></view> <view class="right"><up-switch v-model="vdata.takeout" size="20" activeColor="#0FC161" @change="switchChange('eatModel')"></up-switch></view>
</view> </view>
<view class="page-cell m"> <view class="page-cell m">
<view class="label">是否开启会员支付</view> <view class="label">是否开启会员余额支付</view>
<view class="right"><up-switch v-model="vdata.shopInfo.isAccountPay" size="20" :inactiveValue="0" :activeValue="1" activeColor="#0FC161" @change="switchChange('isAccountPay')"></up-switch></view> <view class="right"><up-switch v-model="vdata.shopInfo.isAccountPay" size="20" :inactiveValue="0" :activeValue="1" activeColor="#0FC161" @change="switchChange('isAccountPay')"></up-switch></view>
</view> </view>
<view class="page-cell m">
<view class="label">是否开启会员价支付</view>
<view class="right"><up-switch v-model="vdata.shopInfo.isMemberPrice" size="20" :inactiveValue="0" :activeValue="1" activeColor="#0FC161" @change="switchChange('isMemberPrice')"></up-switch></view>
</view>
<view class="page-cell"> <view class="page-cell">
<view class="label">桌位费<view v-if="!vdata.isTableFee" class="tableFee" @tap="go.to('PAGES_SHOP_EDITVAL',{name:'tableFee',value: vdata.shopInfo.tableFee})">{{vdata.shopInfo.tableFee}}</view></view> <view class="label">桌位费<view v-if="!vdata.isTableFee" class="tableFee" @tap="go.to('PAGES_SHOP_EDITVAL',{name:'tableFee',value: vdata.shopInfo.tableFee})">{{vdata.shopInfo.tableFee}}</view></view>
<view class="right"> <view class="right">
@@ -321,6 +324,9 @@ let switchChange = ( type ) => {
case "isAccountPay": case "isAccountPay":
params.isAccountPay = vdata.shopInfo.isAccountPay; params.isAccountPay = vdata.shopInfo.isAccountPay;
break; break;
case "isMemberPrice":
params.isMemberPrice = vdata.shopInfo.isMemberPrice;
break;
case "isTableFee": case "isTableFee":
if ( vdata.isTableFee ) { if ( vdata.isTableFee ) {
params.isTableFee = 1; params.isTableFee = 1;

View File

@@ -155,7 +155,7 @@
<view class=""> <view class="">
<view class=" u-relative"> <view class=" u-relative">
<template v-if="item.is_gift"> <template v-if="item.is_gift">
<text class="line-th color-999">{{formatPrice(item.lowPrice*item.number) }}</text> <text class="line-th color-999">{{$utils.toFixed(item.lowPrice*item.number,item) }}</text>
<view class="u-absolute" style="right: 0;bottom: 100%;"> <view class="u-absolute" style="right: 0;bottom: 100%;">
<text class="font-bold">0</text> <text class="font-bold">0</text>
</view> </view>
@@ -163,24 +163,24 @@
<template v-else> <template v-else>
<template v-if="item.discount_sale_amount&&item.discount_sale_amount*1>0"> <template v-if="item.discount_sale_amount&&item.discount_sale_amount*1>0">
<text <text
class="line-th color-999">{{formatPrice(item.lowPrice*item.number) }}</text> class="line-th color-999">{{$utils.toFixed(item.lowPrice*item.number,item) }}</text>
<view class="u-absolute" style="right: 0;bottom: 100%;"> <view class="u-absolute" style="right: 0;bottom: 100%;">
<text <text
class="font-bold">{{formatPrice(item.discount_sale_amount*item.number) }}</text> class="font-bold">{{$utils.toFixed(item.discount_sale_amount*item.number,item) }}</text>
</view> </view>
</template> </template>
<template v-else-if="isVip&&item.lowMemberPrice&&item.lowMemberPrice*1!=item.lowPrice*1"> <template v-else-if="isVip&&item.lowMemberPrice&&item.lowMemberPrice*1!=item.lowPrice*1">
<text <text
class="line-th color-999">{{formatPrice(item.lowPrice*item.number) }}</text> class="line-th color-999">{{$utils.toFixed(item.lowPrice*item.number,item) }}</text>
<view class="u-absolute" style="right: 0;bottom: 100%;"> <view class="u-absolute" style="right: 0;bottom: 100%;">
<text <text
class="font-bold">{{formatPrice(item.lowMemberPrice*item.number) }}</text> class="font-bold">{{$utils.toFixed(item.lowMemberPrice*item.number,item) }}</text>
</view> </view>
</template> </template>
<template v-else> <template v-else>
<view class="font-bold"> <view class="font-bold">
<text></text> <text></text>
<text class="">{{formatPrice(item.lowPrice*item.number) }}</text> <text class="">{{$utils.toFixed(item.lowPrice*item.number,item) }}</text>
</view> </view>
</template> </template>
@@ -250,7 +250,7 @@
<view class="u-flex"> <view class="u-flex">
<view class="u-flex price" v-if="youhui*1>0"> <view class="u-flex price" v-if="youhui*1>0">
<view class="">优惠金额</view> <view class="">优惠金额</view>
<view class="font-bold u-font-32">{{formatPrice(youhui) }}</view> <view class="font-bold u-font-32">{{$utils.toFixed(youhui) }}</view>
</view> </view>
</view> </view>
@@ -368,7 +368,6 @@
if (opt.tableId||opt.tableCode) { if (opt.tableId||opt.tableCode) {
pageData.table.id = opt.tableId pageData.table.id = opt.tableId
pageData.table.tableCode = opt.tableCode pageData.table.tableCode = opt.tableCode
getTableInfo(opt)
} }
getTbShopInfo() getTbShopInfo()
@@ -490,10 +489,8 @@
// 获取商品列表 // 获取商品列表
$goods = await getProductList({},'product', false) $goods = await getProductList({},'product', false)
console.log("商品列表===",$goods) console.log("商品列表===",$goods)
getTableInfo(pageData.table)
// 获取购物车数据
getCart()
} }
/** /**
@@ -569,6 +566,7 @@
$seatFee.totalNumber = 0 $seatFee.totalNumber = 0
$seatFee.totalAmount = 0 $seatFee.totalAmount = 0
userNumbers.defaultCateIndex = 0 userNumbers.defaultCateIndex = 0
init()
break; break;
case 'product_update': case 'product_update':
init() init()
@@ -647,13 +645,16 @@
* 获取桌台信息 * 获取桌台信息
*/ */
async function getTableInfo(opt) { async function getTableInfo(opt) {
const res = await getShopTableDetail({id: opt.tableId,tableCode: opt.tableCode}) const res = await getShopTableDetail({id: opt.id,tableCode: opt.tableCode})
Object.assign(pageData.table, res) Object.assign(pageData.table, res)
if(!pageData.shopInfo.isTableFee&&pageData.table&&pageData.table.id){ if(!pageData.shopInfo.isTableFee&&pageData.table&&pageData.table.id){
userNumbers.list = new Array(res.maxCapacity ? res.maxCapacity * 1 : 100).fill(1).map((v, index) => { userNumbers.list = new Array(res.maxCapacity ? res.maxCapacity * 1 : 100).fill(1).map((v, index) => {
return (index + 1) + '人' return (index + 1) + '人'
}) })
} }
// 获取购物车数据
getCart()
// 获取购物车数据
getHistoryOrderDetail(opt.tableCode) getHistoryOrderDetail(opt.tableCode)
} }
@@ -831,9 +832,7 @@
async function updateChoseCount() { async function updateChoseCount() {
const maxCapacity = pageData.table&&pageData.table.id ? (pageData.table.maxCapacity || 0) : 100 const maxCapacity = pageData.table&&pageData.table.id ? (pageData.table.maxCapacity || 0) : 100
if (pageData.table&&pageData.table.id && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) { if (pageData.table&&pageData.table.id && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) {
uni.showToast({ uni.$utils.showToast('当前台桌最大人数为: ' + maxCapacity)
title: '当前台桌最大人数为: ' + maxCapacity
})
userNumbers.defaultCateIndex = maxCapacity - 1 userNumbers.defaultCateIndex = maxCapacity - 1
return return
} }

View File

@@ -4,7 +4,7 @@
<scroll-view scroll-y="true" style="height: 50vh;" class="u-p-30 guigeModel"> <scroll-view scroll-y="true" style="height: 50vh;" class="u-p-30 guigeModel">
<view class="u-m-b-40" v-for="(item,index) in skus" :key="index"> <view class="u-m-b-40" v-for="(item,index) in skus" :key="index">
<view class="u-text-left"> <view class="u-text-left">
<view class="color-333">{{item.name}}</view> <view class="color-333 up-line-1" >{{item.name}}</view>
</view> </view>
<view class="u-flex u-m-t-20 u-flex-wrap"> <view class="u-flex u-m-t-20 u-flex-wrap">
<view class="item" @tap="chooseSkd(index,skd)" <view class="item" @tap="chooseSkd(index,skd)"

View File

@@ -113,7 +113,7 @@
</template> </template>
<script setup> <script setup>
import { onLoad, onReady, onShow } from '@dcloudio/uni-app'; import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
import { computed, reactive, ref, nextTick, watch, getCurrentInstance, onUnmounted, onBeforeUnmount } from 'vue'; import { inject, computed, reactive, ref, nextTick, watch, getCurrentInstance, onUnmounted, onBeforeUnmount } from 'vue';
import guigeModel from './components/guige' import guigeModel from './components/guige'
import taocanModel from './components/taocanModel.vue' import taocanModel from './components/taocanModel.vue'
@@ -124,7 +124,6 @@
import util from './util.js'; import util from './util.js';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import infoBox from '@/commons/utils/infoBox.js';
import { getNowCart } from '@/pagesCreateOrder/util.js' import { getNowCart } from '@/pagesCreateOrder/util.js'
import storageManage from '@/commons/utils/storageManage.js' import storageManage from '@/commons/utils/storageManage.js'
import { hasPermission } from '@/commons/utils/hasPermission.js' import { hasPermission } from '@/commons/utils/hasPermission.js'
@@ -133,7 +132,6 @@
import { getShopTable,getShopTableDetail } from '@/http/api/table.js' import { getShopTable,getShopTableDetail } from '@/http/api/table.js'
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 { inject } from 'vue';
import { getShopInfo } from '@/http/api/shop.js' import { getShopInfo } from '@/http/api/shop.js'
@@ -196,6 +194,7 @@
let option = { let option = {
type: '' type: ''
} }
const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例 const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例
onLoad((opt) => { onLoad((opt) => {
option = opt option = opt
@@ -208,9 +207,10 @@
if (JSON.stringify(opt) == '{}') { if (JSON.stringify(opt) == '{}') {
isCreateOrderToDetail.value = true isCreateOrderToDetail.value = true
} }
if(uni.getStorageSync("table_code")){ if(uni.getStorageSync("table_code")&&!opt.tableCode){
data.table.tableCode = uni.getStorageSync("table_code") data.table.tableCode = uni.getStorageSync("table_code")
} }
// init() // init()
xiadanClick() xiadanClick()
}) })
@@ -222,10 +222,12 @@
onShow(() => { onShow(() => {
watchChooseTable() watchChooseTable()
watchUpdate() watchUpdate()
watchSocketOpen()
data.isGoodsAdd = true; data.isGoodsAdd = true;
nextTick(()=>{ nextTick(()=>{
onMessage() onMessage()
}) })
init() init()
}) })
onReady(() => { onReady(() => {
@@ -233,6 +235,7 @@
data.topZhanwei = res.height data.topZhanwei = res.height
}) })
getMenuItemTop() getMenuItemTop()
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
@@ -242,6 +245,7 @@
}); });
/** /**
* 判断是否允许下单 * 判断是否允许下单
*/ */
@@ -286,6 +290,24 @@
initCart() initCart()
} }
/**
* 监听socket是否连接正常
*/
function watchSocketOpen (){
uni.$off('is-socket-open')
uni.$on('is-socket-open', (res) => {
console.log("is-socket-open===",res)
if( res){
data.isCars = true;
data.isGoodsAdd = true;
initCart()
} else {
data.isCars = false;
data.isGoodsAdd = false;
}
})
}
/** /**
* socket消息监听 * socket消息监听
*/ */
@@ -296,11 +318,6 @@
let cartItem; let cartItem;
let cartArr = []; let cartArr = [];
console.log("onMessage===",msg) console.log("onMessage===",msg)
if( msg.msg == "收到了"){
data.isCars = true;
data.isGoodsAdd = true;
initCart()
}
if( msg.msg_id ){ if( msg.msg_id ){
websocketUtil.send(JSON.stringify({ websocketUtil.send(JSON.stringify({
type: 'receipt', type: 'receipt',
@@ -308,7 +325,7 @@
})) }))
} }
if( msg.status == 0 ){ if( msg.status == 0 ){
infoBox.showToast('添加失败') uni.$utils.showToast('添加失败')
data.isGoodsAdd = true; data.isGoodsAdd = true;
return; return;
} }
@@ -344,13 +361,13 @@
case 'add': case 'add':
cartItem = getNowCart(msg.data,cartArr) cartItem = getNowCart(msg.data,cartArr)
cartControls(cartItem,'add') cartControls(cartItem,'add')
infoBox.showToast('操作成功') uni.$utils.showToast('操作成功')
break; break;
case 'onboc_edit': case 'onboc_edit':
case 'edit': case 'edit':
cartItem = getNowCart(msg.data,cartArr) cartItem = getNowCart(msg.data,cartArr)
cartControls(cartItem,'edit') cartControls(cartItem,'edit')
infoBox.showToast('操作成功') uni.$utils.showToast('操作成功')
break; break;
case 'onboc_del': case 'onboc_del':
case 'del': case 'del':
@@ -501,7 +518,7 @@
}) })
// #endif // #endif
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
infoBox.showToast('桌台不存在或不是该店铺的桌台') uni.$utils.showToast('桌台不存在或不是该店铺的桌台')
// #endif // #endif
return return
} }
@@ -526,10 +543,10 @@
return; return;
} }
if (item.status == "unbind") { if (item.status == "unbind") {
return infoBox.showToast('该台桌未绑定,清先去桌台管理里绑定码牌') return uni.$utils.showToast('该台桌未绑定,清先去桌台管理里绑定码牌')
} }
if (item.status != "idle") { if (item.status != "idle") {
return infoBox.showToast('该台桌已在使用中') return uni.$utils.showToast('该台桌已在使用中')
} }
data.table = item data.table = item
if( cars.length > 0){ if( cars.length > 0){
@@ -548,14 +565,14 @@
*/ */
async function goodsUpdate(foodsindex, index, isAdd, searchGoodsIndex, showCurrentInput) { // showCurrentInput 称重才会传的参数 async function goodsUpdate(foodsindex, index, isAdd, searchGoodsIndex, showCurrentInput) { // showCurrentInput 称重才会传的参数
// if (!data.table.id) { // if (!data.table.id) {
// return infoBox.showToast('请先选择桌台', 0.5).then(res => { // return uni.$utils.showToast('请先选择桌台', 0.5).then(res => {
// chooseTable() // chooseTable()
// }) // })
// } // }
if( !data.isCars ){ if( !data.isCars ){
return infoBox.showToast('购物车加载失败请刷新重试...') return uni.$utils.showToast('购物车加载失败请刷新重试...')
} }
if( !data.isGoodsAdd ){ return;infoBox.showToast('isGoodsAdd...') } if( !data.isGoodsAdd ){ return;uni.$utils.showToast('isGoodsAdd...') }
let $goods = data.tabbar[index].foods[foodsindex] let $goods = data.tabbar[index].foods[foodsindex]
if ($goods.type !== 'sku') { if ($goods.type !== 'sku') {
//单规格 //单规格
@@ -563,6 +580,7 @@
return carsGoods.sku_id == $goods.skuList[0].id && carsGoods.product_id == $goods.id; return carsGoods.sku_id == $goods.skuList[0].id && carsGoods.product_id == $goods.id;
}); });
let product_id = $goods.id let product_id = $goods.id
let product_type = $goods.type
let sku_id = $goods.skuList[0].id let sku_id = $goods.skuList[0].id
let suitNum = $goods.skuList[0].suitNum || 1 let suitNum = $goods.skuList[0].suitNum || 1
if (goodsInCarIndex !== -1) { if (goodsInCarIndex !== -1) {
@@ -586,6 +604,7 @@
id: cartItem.id, id: cartItem.id,
number: number, number: number,
product_id: product_id, product_id: product_id,
product_type: product_type,
sku_id: sku_id, sku_id: sku_id,
is_temporary: cartItem.is_temporary is_temporary: cartItem.is_temporary
},'edit') },'edit')
@@ -602,6 +621,7 @@
editCart({ editCart({
number: suitNum, number: suitNum,
product_id: product_id, product_id: product_id,
product_type: product_type,
sku_id: sku_id, sku_id: sku_id,
is_temporary: 0, //是否是临时菜 is_temporary: 0, //是否是临时菜
},'add') },'add')
@@ -663,7 +683,13 @@
if( !data.isGoodsAdd ){ return; } if( !data.isGoodsAdd ){ return; }
let $sku; let $sku;
let $goods; let $goods;
let params = {
number: e.num,
id: e.goods.id,
product_id: e.goods.product_id,
sku_id: e.goods.sku_id,
is_temporary: e.goods.is_temporary
}
if( e.goods.is_temporary != 1){ if( e.goods.is_temporary != 1){
data.tabbar.map(tabbarItem=>{ data.tabbar.map(tabbarItem=>{
if(tabbarItem.foods.find(v => v.id == e.goods.product_id)){ if(tabbarItem.foods.find(v => v.id == e.goods.product_id)){
@@ -687,15 +713,13 @@
delCart(e.goods.id) delCart(e.goods.id)
return return
} }
console.log(e)
// product_name
params.product_name = e.goods.name
params.sku_name = e.goods.sku_name
} }
editCart({ editCart(params,'edit')
number: e.num,
id: e.goods.id,
product_id: e.goods.product_id,
sku_id: e.goods.sku_id,
is_temporary: e.goods.is_temporary
},'edit')
data.isGoodsAdd = false; data.isGoodsAdd = false;
} }
@@ -708,6 +732,7 @@
editCart({ editCart({
number: item.skuList[0].suitNum, number: item.skuList[0].suitNum,
product_id: item.id, product_id: item.id,
product_type: item.type,
sku_id: item.skuList[0].id, sku_id: item.skuList[0].id,
pro_group_info: JSON.stringify(d), pro_group_info: JSON.stringify(d),
is_temporary: 0, //是否是临时菜 is_temporary: 0, //是否是临时菜
@@ -726,7 +751,7 @@
function chooseGuige(foodsindex, index) { function chooseGuige(foodsindex, index) {
if( !data.isCars ){ if( !data.isCars ){
return infoBox.showToast('购物车加载失败请刷新重试...') return uni.$utils.showToast('购物车加载失败请刷新重试...')
} }
const $goods = data.tabbar[index].foods[foodsindex] const $goods = data.tabbar[index].foods[foodsindex]
selGoods.value = $goods selGoods.value = $goods
@@ -789,6 +814,7 @@
let goods = guigeModelData.chooseGoods.item let goods = guigeModelData.chooseGoods.item
let sku_id = sku.id let sku_id = sku.id
let product_id = goods.id let product_id = goods.id
let product_type = goods.type
let res = findGoodsInCar(goods, sku_id) let res = findGoodsInCar(goods, sku_id)
if (res) { if (res) {
//更新 //更新
@@ -810,6 +836,7 @@
editCart({ editCart({
number: suitNum, number: suitNum,
product_id: product_id, product_id: product_id,
product_type: product_type,
sku_id: sku_id, sku_id: sku_id,
is_temporary: 0, //是否是临时菜 is_temporary: 0, //是否是临时菜
},'add') },'add')
@@ -1084,7 +1111,7 @@
const refweighitem = ref(null) const refweighitem = ref(null)
const tapweigh = (foodsindex, index) => { const tapweigh = (foodsindex, index) => {
if( !data.isCars ){ if( !data.isCars ){
return infoBox.showToast('购物车加载失败请刷新重试...') return uni.$utils.showToast('购物车加载失败请刷新重试...')
} }
const goods = data.tabbar[index].foods[foodsindex] const goods = data.tabbar[index].foods[foodsindex]
refweighitem.value.open(foodsindex, index, goods) refweighitem.value.open(foodsindex, index, goods)

View File

@@ -88,7 +88,7 @@
<view>0.00</view> <view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view> <view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template> </template>
<template v-else-if="user.isVip == 1"> <template v-else-if="isVip == 1">
<view>{{item.num*item.memberPrice}}</view> <view>{{item.num*item.memberPrice}}</view>
<view class="line-th color-666 ">{{item.num*item.price}}</view> <view class="line-th color-666 ">{{item.num*item.price}}</view>
</template> </template>
@@ -147,11 +147,11 @@
</view> </view>
<view class="u-flex"> <view class="u-flex">
<view class="u-flex u-m-r-24" v-if="youhuiAllPrice>0"> <view class="u-flex u-m-r-24" v-if="discountsPrice>0">
<view class="color-red u-m-r-6 "> <view class="color-red u-m-r-6 ">
已优惠{{youhuiAllPrice}} 已优惠{{discountsPrice}}
</view> </view>
<!-- <up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon> --> <up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon>
</view> </view>
<!-- <view> <!-- <view>
@@ -221,8 +221,15 @@
<text>{{vipDiscountPrice}}</text> <text>{{vipDiscountPrice}}</text>
</view> </view>
</view> </view>
<view class="u-flex u-row-between u-m-b-18" v-if="discountSaleAmount">
<view>单品打折</view>
<view class="color-red">
<text></text>
<text>{{ discountSaleAmount }}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-b-18" v-if="discountAmount"> <view class="u-flex u-row-between u-m-b-18" v-if="discountAmount">
<view>打折</view> <view>服务改价优惠 </view>
<view class="color-red"> <view class="color-red">
<text></text> <text></text>
<text>{{to2(discountAmount) }}</text> <text>{{to2(discountAmount) }}</text>
@@ -235,11 +242,11 @@
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text> <text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
</view> </view>
</view> </view>
<view class="u-flex u-row-between u-m-t-18" v-if="productCouponDiscountAmount*1>0"> <view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.productCouponDiscountAmount*1>0">
<view>商品券抵扣</view> <view>商品券抵扣</view>
<view class="color-red"> <view class="color-red">
<text></text> <text></text>
<text> {{productCouponDiscountAmount }}</text> <text> {{to2(orderInfo.productCouponDiscountAmount) }}</text>
</view> </view>
</view> </view>
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.pointsDiscountAmount"> <view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.pointsDiscountAmount">
@@ -262,21 +269,11 @@
import { hasPermission } from '@/commons/utils/hasPermission.js' import { hasPermission } from '@/commons/utils/hasPermission.js'
import { isTui, isTuiCai, isGift, canTuiKuan, canTuicai, mathFloorPrice } from '@/commons/utils/goodsUtil.js' import { isTui, isTuiCai, isGift, canTuiKuan, canTuicai, mathFloorPrice } from '@/commons/utils/goodsUtil.js'
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
const pop = reactive({ const pop = reactive({
youhui: false youhui: false
}) })
function youhuiDetailShow() {
pop.youhui = true
}
function productCouponDikou(item) {
return '商品券抵扣¥' + returnProductCoupPrice(item)
}
function youhuiDetailHide() {
pop.youhui = false
}
const props = defineProps({ const props = defineProps({
orderInfo: { orderInfo: {
type: Object, type: Object,
@@ -300,6 +297,166 @@
} }
} }
}) })
/**
* 计算菜品数量
*/
const goodsNumber = computed(() => {
let result = 0
result = props.data.reduce((a, b) => {
const bTotal = b.info.length
return a + bTotal
}, 0)
return result.toFixed(0)
})
/**
* 桌位费
*/
const seatFeePrice = computed(() => {
const n = props.orderInfo.seatNum > 0 ? props.orderInfo.seatNum*uni.getStorageSync('shopInfo').tableFee : 0
return n.toFixed(2)
})
/**
* 判断是否是会员
*/
const isVip = computed(() => {
return uni.getStorageSync('shopInfo').isMemberPrice && props.user && props.user.id && props.user.isVip
})
const freePrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
b) => {
const price = (b.isMember && b.memberPrice) ? b.memberPrice : b.price
return a + (b.num * price)
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const vipDiscountPrice = computed(() => {
if (!isVip.value) {
return 0
}
const goodsPrice = props.data.reduce((prve, cur) => {
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))
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
/**
* 单品打折优惠
*/
const discountSaleAmount = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.discountSaleAmount > 0 && v.isGift != 1 && v.status !== "return" ).reduce(( a, b) => {
return a + (b.num * (b.price - b.discountSaleAmount))
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
/**
* 打折优惠
*/
const discountAmount = computed(() => {
return props.orderInfo.discountAmount||0
})
/**
* 总优惠金额
*/
const discountsPrice = computed(() => {
// 满减券优惠
let fullCouponDiscountAmount = props.orderInfo.fullCouponDiscountAmount
// 商品券优惠
let productCouponDiscountAmount = props.orderInfo.productCouponDiscountAmount
// 积分抵扣优惠
let pointsDiscountAmount = props.orderInfo.pointsDiscountAmount
return (parseFloat(vipDiscountPrice.value) + parseFloat(discountSaleAmount.value) + discountAmount.value + fullCouponDiscountAmount + productCouponDiscountAmount + pointsDiscountAmount).toFixed(2)
})
// 菜品金额
const productCoupPrice = computed(() => {
if (props.orderInfo.status == 'done') {
return props.orderInfo.productCouponDiscountAmount
}
const goodsPrice = props.data.reduce((a, b) => {
const curTotal = b.info.filter(v => !v.isGift).reduce((prve, cur) => {
let memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
let tPrice = (isVip.value ? memberPrice : cur.price)
tPrice = cur.memberPrice != cur.unitPrice&& cur.price != cur.unitPrice ? cur.unitPrice : tPrice
console.log(tPrice)
let Total = Math.floor(tPrice * cur.num * 100) / 100
return prve + Total - (cur.returnNum*tPrice) - (cur.refundNum*cur.unitPrice)
}, 0)
return a + curTotal
}, 0)
console.log("菜品金额==",goodsPrice)
return goodsPrice.toFixed(2)
})
const allPpackFee = computed(() => {
//不是退菜只要有打包费的都计算,包括赠送
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.packNumber > 0).reduce((a,
b) => {
return a + parseFloat(b.packAmount*b.packNumber).toFixed(2)*1
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const packFee = computed(() => {
//不是退菜只要有打包费的都计算,包括赠送
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.status !== "return" && (v.returnNum+v.refundNum < v.num)).reduce((a,
b) => {
return a + parseFloat((b.packAmount*(b.num-(b.returnNum+b.refundNum)>b.packNumber?b.packNumber:b.num-(b.returnNum+b.refundNum))).toFixed(2))
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const allPrice = computed(() => {
let seatAmount = props.orderInfo.seatAmount || 0
const total = productCoupPrice.value*1 + seatAmount*1 + packFee.value*1
return (total <= 0 ? 0 : total).toFixed(2)
})
/**
* 已优惠金额
*/
const youhuiAllPrice = computed(() => {
const n = vipDiscountPrice.value * 1
return (n < 0 ? 0 : n).toFixed(2)
})
function youhuiDetailShow() {
pop.youhui = true
}
function productCouponDikou(item) {
return '商品券抵扣¥' + returnProductCoupPrice(item)
}
function youhuiDetailHide() {
pop.youhui = false
}
/** /**
* 转桌/并桌 * 转桌/并桌
*/ */
@@ -327,17 +484,7 @@
.orderInfo.tableId .orderInfo.tableId
}) })
} }
/**
* 计算菜品数量
*/
const goodsNumber = computed(() => {
let result = 0
result = props.data.reduce((a, b) => {
const bTotal = b.info.length
return a + bTotal
}, 0)
return result.toFixed(0)
})
function returnProductCoupPrice(item) { function returnProductCoupPrice(item) {
if (!item.isMember) { if (!item.isMember) {
return item.price * item.num return item.price * item.num
@@ -345,29 +492,7 @@
const price = item.memberPrice ? item.memberPrice : item.price const price = item.memberPrice ? item.memberPrice : item.price
return price * item.num return price * item.num
} }
const productCouponDiscountAmount = computed(() => {
// if(props.orderInfo.productCouponDiscountAmount){
// return orderInfo.productCouponDiscountAmount.toFixed(2)
// }
if (!props.data.length) {
return 0
}
const n = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.userCouponId).reduce((a, b) => {
return a + returnProductCoupPrice(b)
}, 0)
return prve + curTotal
}, 0)
return n.toFixed(2)
})
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function returnVipMoney(item) {
if (!item.memberPrice || !props.user.isVip) {
return 0
}
return (item.memberPrice * item.num).toFixed(2)
}
function returnTotalMoney(item) { function returnTotalMoney(item) {
return (Math.floor(item.num*item.unitPrice*100)/100).toFixed(2) return (Math.floor(item.num*item.unitPrice*100)/100).toFixed(2)
@@ -467,112 +592,6 @@
emits('printOrder') emits('printOrder')
} }
/**
* 桌位费
*/
const seatFeePrice = computed(() => {
const n = props.orderInfo.seatNum > 0 ? props.orderInfo.seatNum*props.orderInfo.seatAmount : 0
return n.toFixed(2)
})
const discountAmount = computed(() => {
if (props.orderInfo.discountAmount) {
return props.orderInfo.discountAmount
}
return (props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio))
})
const freePrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
b) => {
const price = (b.isMember && b.memberPrice) ? b.memberPrice : b.price
return a + (b.num * price)
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const vipDiscountPrice = computed(() => {
if (!props.user.isVip) {
return 0
}
const goodsPrice = props.data.reduce((prve, cur) => {
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))
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
// 菜品金额
const productCoupPrice = computed(() => {
if (props.orderInfo.status == 'done') {
return props.orderInfo.productCouponDiscountAmount
}
const goodsPrice = props.data.reduce((a, b) => {
const curTotal = b.info.filter(v => !v.isGift).reduce((prve,
cur) => {
console.log(cur)
let Total = Math.floor(cur.unitPrice * cur.num * 100) / 100
return prve + Total - (cur.returnNum*cur.unitPrice) - (cur.refundNum*cur.unitPrice)
}, 0)
console.log("菜品金额111==",curTotal)
return a + curTotal
}, 0)
console.log("菜品金额==",goodsPrice)
return goodsPrice.toFixed(2)
})
const allPpackFee = computed(() => {
//不是退菜只要有打包费的都计算,包括赠送
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.packNumber > 0).reduce((a,
b) => {
return a + parseFloat(b.packAmount*b.packNumber).toFixed(2)*1
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const packFee = computed(() => {
//不是退菜只要有打包费的都计算,包括赠送
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.status !== "return" && (v.returnNum+v.refundNum < v.num)).reduce((a,
b) => {
return a + parseFloat((b.packAmount*(b.num-(b.returnNum+b.refundNum)>b.packNumber?b.packNumber:b.num-(b.returnNum+b.refundNum))).toFixed(2))
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const allPrice = computed(() => {
let seatAmount = (props.orderInfo.seatNum * props.orderInfo.seatAmount) || 0
const total = productCoupPrice.value*1 + seatAmount*1 + packFee.value*1
console.log(seatAmount*1)
console.log(packFee.value*1)
console.log(total)
return (total <= 0 ? 0 : total).toFixed(2)
})
/**
* 已优惠金额
*/
const youhuiAllPrice = computed(() => {
const n = vipDiscountPrice.value * 1
return (n < 0 ? 0 : n).toFixed(2)
})
</script> </script>

View File

@@ -44,7 +44,8 @@
total: 0, total: 0,
query: { query: {
orderNo: "", orderNo: "",
platformType: "APP", userId: "",
platformType: "",
page: 1, page: 1,
pageSize: 10, pageSize: 10,
startTime: today.start, startTime: today.start,
@@ -54,7 +55,9 @@
}) })
onLoad((opt)=>{ onLoad((opt)=>{
if( opt.type == 'user' && opt.userId ) {
pageData.query.userId = opt.userId
}
}) })
onShow(init) onShow(init)
onPullDownRefresh(()=>{ onPullDownRefresh(()=>{

View File

@@ -52,7 +52,7 @@
<view class="u-flex"> <view class="u-flex">
<view class="hui"></view> <view class="hui"></view>
<view class="u-m-l-18">{{item.name}}</view> <view class="u-m-l-18">{{item.name}}</view>
<view class="u-m-l-18 color-999">x{{item.number}}</view> <view class="u-m-l-18 color-999">x1</view>
</view> </view>
<view class="u-flex"> <view class="u-flex">
<view class="color-red"> <view class="color-red">
@@ -224,7 +224,7 @@
<edit-discount :nowPrice="order.orderAmount-productCouponDiscountAmount-fullCouponDiscountAmount" <edit-discount :nowPrice="order.orderAmount-productCouponDiscountAmount-fullCouponDiscountAmount"
@confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney" @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
:price="order.orderAmount-productCouponDiscountAmount" :discount="discount.discount"></edit-discount> :price="payPrice-productCouponDiscountAmount" :discount="discount.discount"></edit-discount>
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText" <up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm" :cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
@@ -242,7 +242,6 @@
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'
import { hasPermission } from '@/commons/utils/hasPermission.js' import { hasPermission } from '@/commons/utils/hasPermission.js'
import infoBox from '@/commons/utils/infoBox.js'
import editDiscount from '@/components/my-components/edit-discount.vue' import editDiscount from '@/components/my-components/edit-discount.vue'
import editAccountPoints from './components/edit-accountPoints.vue' import editAccountPoints from './components/edit-accountPoints.vue'
import { import {
@@ -256,8 +255,8 @@
import { getCouponList } from '@/http/api/coupon.js' import { getCouponList } from '@/http/api/coupon.js'
import { getHistoryOrder } from '@/http/api/order.js' import { getHistoryOrder } from '@/http/api/order.js'
import { getPayTypeList } from '@/http/api/payType.js' import { getPayTypeList } from '@/http/api/payType.js'
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl,queryOrderStatus } from '@/http/api/pay.js'
import { shopUserDetail } from '@/http/api/shopUser.js' import { shopUserDetail } from '@/http/api/shopUser.js'
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl,queryOrderStatus } from '@/http/api/pay.js'
import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/http/api/points.js' import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/http/api/points.js'
@@ -270,16 +269,16 @@
show: false, show: false,
data: '' data: ''
}) })
let option = {
isNowPay: false
}
const pageData = reactive({ const pageData = reactive({
goodsList: [], //菜品列表 goodsList: [], //菜品列表
user: { //会员信息 user: { //会员信息
userId: null, userId: null,
amount: 0 amount: 0
}, },
buyer: {} shopInfo: uni.getStorageSync('shopInfo'),
buyer: {},
payUrlShow: false,
}) })
const order = reactive({ const order = reactive({
orderAmount: 0 orderAmount: 0
@@ -325,7 +324,6 @@
}) })
onLoad(async (opt) => { onLoad(async (opt) => {
console.log(opt); console.log(opt);
option = opt
Object.assign(order, opt) Object.assign(order, opt)
getPayType() getPayType()
init() init()
@@ -352,15 +350,9 @@
Object.values(orderRes.detailMap).forEach(item=>{ Object.values(orderRes.detailMap).forEach(item=>{
pageData.goodsList = [...pageData.goodsList,...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===",order)
console.log("pageData.user===",pageData.user) console.log("pageData.user===",pageData.user)
if (order.userId||pageData.user.userId) { if (order.userId||pageData.user.userId) {
@@ -377,6 +369,15 @@
console.log("order==",order) console.log("order==",order)
pageData.seatNum = order.seatNum; pageData.seatNum = order.seatNum;
} }
/**
* 判断是否是会员
*/
const isVip = computed(() => {
return uni.getStorageSync('shopInfo').isMemberPrice && pageData.user && pageData.user.id && pageData.user.isVip
})
const coupAllPrice = computed(() => { const coupAllPrice = computed(() => {
const n = pays.quan.reduce((prve, cur) => { const n = pays.quan.reduce((prve, cur) => {
return prve + cur.discountAmount * 1 return prve + cur.discountAmount * 1
@@ -399,14 +400,13 @@
} }
}) })
/** /**
* 桌位费 * 桌位费
*/ */
const tableFee = computed(() => { const tableFee = computed(() => {
return order.seatNum > 0 ? order.seatNum*order.seatAmount : 0 console.log("桌位费===", order.seatNum > 0 ? order.seatNum*pageData.shopInfo.tableFee : 0)
return order.seatNum > 0 ? order.seatNum*pageData.shopInfo.tableFee : 0
}) })
/** /**
* 菜品金额 * 菜品金额
@@ -414,21 +414,22 @@
const originPrice = computed(() => { const originPrice = computed(() => {
if(pageData.goodsList){ if(pageData.goodsList){
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => { let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
return a + parseFloat(mathFloorPrice(b.num * b.unitPrice,b)) return a + parseFloat(mathFloorPrice(b.num * b.price,b))
}, 0) }, 0)
console.log("菜品原金额===",goodsPrice) console.log("菜品原金额===",goodsPrice)
return (parseFloat(goodsPrice) + parseFloat(tableFee.value) + parseFloat(packAmount.value)).toFixed(2) return (parseFloat(goodsPrice) + parseFloat(tableFee.value) + parseFloat(packAmount.value)).toFixed(2)
} }
}) })
const newOriginPrice = computed(() => { const newOriginPrice = computed(() => {
if(pageData.goodsList){ if(pageData.goodsList){
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => { let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
return a + parseFloat(mathFloorPrice(b.num * b.unitPrice,b) - mathFloorPrice(b.returnNum*b.unitPrice,b) - mathFloorPrice(b.refundNum*b.unitPrice,b)) let memberPrice = b.memberPrice ? b.memberPrice : b.price
let tPrice = (isVip.value ? memberPrice : b.price)
tPrice = b.memberPrice != b.unitPrice&& b.price != b.unitPrice ? b.unitPrice : tPrice
return a + parseFloat(mathFloorPrice(b.num * tPrice,b) - mathFloorPrice(b.returnNum*tPrice,b) - mathFloorPrice(b.refundNum*b.unitPrice,b))
}, 0) }, 0)
console.log("减去退款退费的菜品金额===",goodsPrice) console.log("减去退款退费的菜品金额===",goodsPrice)
console.log("桌位费===", tableFee.value)
return (goodsPrice + tableFee.value + packAmount.value).toFixed(2) return (goodsPrice + tableFee.value + packAmount.value).toFixed(2)
} }
}) })
@@ -437,7 +438,7 @@
* 会员优惠金额 * 会员优惠金额
*/ */
const vipDiscount = computed(() => { const vipDiscount = computed(() => {
if (!pageData.user.isVip) { if (!isVip.value) {
return 0 return 0
} }
if(pageData.goodsList){ if(pageData.goodsList){
@@ -492,15 +493,13 @@
* 支付金额 * 支付金额
*/ */
const payPrice = computed(() => { const payPrice = computed(() => {
console.log("originPrice===",newOriginPrice.value) console.log("newOriginPrice===",newOriginPrice.value)
console.log("vipDiscount===",vipDiscount.value) console.log("vipDiscount===",vipDiscount.value)
console.log("discountSaleAmount===",discountSaleAmount.value)
console.log("pointCanDicountPrice===",pointCanDicountPrice.value)
console.log("productCouponDiscountAmount===",productCouponDiscountAmount.value) console.log("productCouponDiscountAmount===",productCouponDiscountAmount.value)
console.log("discount===",discount.value) console.log("discount===",discount.value)
console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value) console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value)
console.log("accountPoints===",accountPoints) console.log("accountPoints===",accountPoints)
let total = (newOriginPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount let total = (newOriginPrice.value*1) - productCouponDiscountAmount.value - discount
.value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0) .value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
console.log("payPrice===",total) console.log("payPrice===",total)
return (total < 0 ? 0 : total).toFixed(2) return (total < 0 ? 0 : total).toFixed(2)
@@ -510,7 +509,7 @@
* 积分使用前金额 * 积分使用前金额
*/ */
const orderAmount = computed(() => { const orderAmount = computed(() => {
let total = (newOriginPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount let total = (newOriginPrice.value*1) - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
.value - fullCouponDiscountAmount.value .value - fullCouponDiscountAmount.value
console.log(total) console.log(total)
return (total < 0 ? 0 : total).toFixed(2) return (total < 0 ? 0 : total).toFixed(2)
@@ -527,7 +526,9 @@
} }
}) })
watch(() => payPrice.value, (newval) => { watch(() => payPrice.value, (newval) => {
getPayUrl() if( pageData.payUrlShow){
getPayUrl()
}
if (newval <= 0) { if (newval <= 0) {
const arr = ['cash', 'member-account'] const arr = ['cash', 'member-account']
pays.payTypes.list.map(v => { pays.payTypes.list.map(v => {
@@ -563,11 +564,14 @@
} }
}) })
}, 2000) }, 2000)
if( newval == 1 ){
getPayUrl()
}
} }
}) })
function getPayParam () { function getPayParam () {
return { let params = {
shopId: uni.getStorageSync("shopInfo").id, shopId: uni.getStorageSync("shopInfo").id,
orderId: order.id, orderId: order.id,
originAmount: originPrice.value, //订单原金额(包含打包费+餐位费) 不含折扣价格 originAmount: originPrice.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
@@ -575,18 +579,27 @@
seatNum: pageData.seatNum, // 用餐人数 seatNum: pageData.seatNum, // 用餐人数
discountAmount: discount.value, // 手动优惠金额 discountAmount: discount.value, // 手动优惠金额
fullCouponDiscountAmount: fullCouponDiscountAmount.value, // 满减金额 fullCouponDiscountAmount: fullCouponDiscountAmount.value, // 满减金额
productCouponDiscountAmount: productCouponDiscountAmount.value,
vipPrice: vipDiscount.value != 0 ? 1: 0, // 是否使用会员价 vipPrice: vipDiscount.value != 0 ? 1: 0, // 是否使用会员价
pointsDiscountAmount: accountPoints.sel ? accountPoints.price : 0, pointsDiscountAmount: accountPoints.sel ? accountPoints.price : 0,
pointsNum: accountPoints.sel ? accountPoints.num : 0, pointsNum: accountPoints.sel ? accountPoints.num : 0,
couponList: [],
} }
if( pays.quan.length > 0 ){
pays.quan.forEach(v => {
params.couponList.push(v.id)
})
}
params.couponList = params.couponList.join(",")
// params.couponList = JSON.stringify(params.couponList)
return params
} }
/** /**
* 获取店铺订单支付URL * 获取店铺订单支付URL
*/ */
function getPayUrl() { function getPayUrl() {
console.log(discount) console.log("支付参数 ===",getPayParam())
console.log(getPayParam())
let par = getPayParam() let par = getPayParam()
let params = { let params = {
shopId: uni.getStorageSync("shopInfo").id, shopId: uni.getStorageSync("shopInfo").id,
@@ -597,6 +610,7 @@
} }
getOrderPayUrl(params).then(res => { getOrderPayUrl(params).then(res => {
payCodeUrl.value = res payCodeUrl.value = res
pageData.payUrlShow = true
}) })
} }
@@ -624,39 +638,32 @@
*/ */
function setQuan(arr) { function setQuan(arr) {
console.log("choose-quan===",arr) console.log("choose-quan===",arr)
discount.discount = 100 let manjianCoup = arr.filter(v => v.type == 1)
discount.value = 0
discount.currentPrice = order.orderAmount
const manjianCoup = arr.filter(v => v.type == 1 && v.number >= 1)
let productCoup = arr.filter(v => v.type == 2) let productCoup = arr.filter(v => v.type == 2)
let setmanjianCoup = pays.quan.filter(v => v.type == 1)
let setproductCoup = pays.quan.filter(v => v.type == 2)
if ( manjianCoup.length > 0) {
setmanjianCoup = manjianCoup
}
//商品券分组 //商品券分组
let coupMap = {} let goods;
for (let i in productCoup) { let tPrice;
const coup = productCoup[i] productCoup.map(item=>{
if (coupMap.hasOwnProperty(coup.proId)) { goods = pageData.goodsList.find(v => v.productId == item.proId)
coupMap[coup.proId].push(coup) if(!goods)return;
} else { let memberPrice = goods.memberPrice ? goods.memberPrice : goods.price
coupMap[coup.proId] = [coup] tPrice = (isVip.value ? memberPrice : goods.price)
} tPrice = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : tPrice
item.discountAmount = tPrice
})
if( !goods || tPrice > payPrice.value){
productCoup = [];
} }
for (let key in coupMap) { // productCoup = productCoup.filter(v => v.number >= 1)
const arr = coupMap[key] pays.quan = [...setmanjianCoup, ...productCoup,...setproductCoup]
for (let i in arr) { console.log("优惠券2===",pays.quan)
const coup = arr[i]
const proCoupStartIndex = returnProCoupStartIndex(arr, i)
console.log(proCoupStartIndex);
const coupUseNum = returnProductCanUseNum($goodsPayPriceMap[coup.proId], proCoupStartIndex,
coup.number)
const number = Math.min($goodsPayPriceMap[coup.proId].length, coupUseNum)
coup.number = number
const findGoods = order.detailList.find(v => v.productId == coup.proId)
const isMember = findGoods.isMember
coup.discountAmount = returnProductCoupAllPrice($goodsPayPriceMap[coup.proId],
proCoupStartIndex, number, isMember).toFixed(2)
}
}
productCoup = productCoup.filter(v => v.number >= 1)
pays.quan = [...manjianCoup, ...productCoup]
} }
@@ -696,8 +703,8 @@
} }
console.log("calcUsablePoints",pageData.user) console.log("calcUsablePoints",pageData.user)
const res = await calcUsablePoints({ const res = await calcUsablePoints({
userId: pageData.user.id, shopUserId: pageData.user.id,
orderAmount: orderAmount ? orderAmount : payPrice.value orderAmount: payPrice.value
}) })
accountPoints.calcRes = res accountPoints.calcRes = res
accountPoints.num = res.maxUsablePoints accountPoints.num = res.maxUsablePoints
@@ -710,8 +717,8 @@
return '' return ''
} }
const res = await calcDeductionAmount({ const res = await calcDeductionAmount({
userId: pageData.user.id, shopUserId: pageData.user.id,
orderAmount: orderAmount.value, orderAmount: payPrice.value,
points: accountPoints.num points: accountPoints.num
}) })
if (res) { if (res) {
@@ -735,16 +742,16 @@
* 选择优惠券 * 选择优惠券
*/ */
function toQuan() { function toQuan() {
console.log(order); console.log(pageData.user);
if (!order.userId&&!pageData.user.id) { if (!order.userId&&!pageData.user.id) {
return infoBox.showToast('请先选择会员', 0.5).then(() => { return uni.$utils.showToast('请先选择会员', 0.5).then(() => {
chooseUser() chooseUser()
}) })
} }
go.to('PAGES_ORDER_QUAN', { go.to('PAGES_ORDER_QUAN', {
orderId: order.id, orderId: order.id,
shopUserId: pageData.user.id, shopUserId: pageData.user.id,
orderPrice: (payPrice.value * 1 + coupAllPrice.value * 1).toFixed(2) orderPrice: (payPrice.value * 1).toFixed(2)
}) })
} }
@@ -848,7 +855,7 @@
*/ */
function changePayType(i, item) { function changePayType(i, item) {
if (item.disabled) { if (item.disabled) {
return infoBox.showToast(item.payName + '不可用') return uni.$utils.showToast(item.payName + '不可用')
} }
pays.payTypes.selIndex = i pays.payTypes.selIndex = i
console.log(item.payType) console.log(item.payType)
@@ -898,11 +905,11 @@
// return cashConfirmShow() // return cashConfirmShow()
} }
if (payType == 'member-account' && pageData.user.amount * 1 < payPrice.value * 1) { if (payType == 'member-account' && pageData.user.amount * 1 < payPrice.value * 1) {
infoBox.showToast('余额不足') uni.$utils.showToast('余额不足')
return return
} }
if (payStatus) { if (payStatus) {
return infoBox.showToast(tipsMap[payStatus]) return uni.$utils.showToast(tipsMap[payStatus])
} }
try { try {
pay() pay()
@@ -919,18 +926,12 @@
async function pay(par) { async function pay(par) {
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
let pars = getPayParam() let pars = getPayParam()
console.log(payType) console.log(pars)
console.log(discount)
payStatus = 'paying' payStatus = 'paying'
let params = { let params = {
shopId: uni.getStorageSync("shopInfo").id, shopId: uni.getStorageSync("shopInfo").id,
checkOrderPay: { checkOrderPay: {
couponList: pays.quan.map(v => {
return {
userCouponId: v.id,
num: v.number
}
}),
...pars ...pars
}, },
...par ...par
@@ -961,7 +962,7 @@
params.shopUserId = pageData.user.id params.shopUserId = pageData.user.id
await vipPay(params) await vipPay(params)
} else { } else {
infoBox.showToast('余额不足') uni.$utils.showToast('余额不足')
return return
} }
} }
@@ -994,7 +995,7 @@
* 支付成功回调 * 支付成功回调
*/ */
function paySuccess() { function paySuccess() {
infoBox.showToast('支付成功') uni.$utils.showToast('支付成功')
payStatus = 'success' payStatus = 'success'
setTimeout(() => { setTimeout(() => {
uni.removeStorageSync("table_code") uni.removeStorageSync("table_code")

View File

@@ -1,7 +1,7 @@
<template> <template>
<view class="u-p-l-30 u-p-r-30 u-p-t-30 u-font-28 "> <view class="u-p-l-30 u-p-r-30 u-p-t-30 u-font-28 ">
<up-sticky offset-top="0"> <up-sticky offset-top="0">
<my-tabs v-model="pageData.types.sel" :list="pageData.types.list"></my-tabs> <my-tabs v-model="pageData.types.sel" @change="tabChange" :list="pageData.types.list"></my-tabs>
</up-sticky> </up-sticky>
<view class="u-m-t-32"> <view class="u-m-t-32">
<template v-if="pageData.types.sel==0"> <template v-if="pageData.types.sel==0">
@@ -60,8 +60,8 @@
<view class="u-flex"> <view class="u-flex">
<up-image width="80rpx" height="80rpx" :src="item.productCover"></up-image> <up-image width="80rpx" height="80rpx" :src="item.productCover"></up-image>
<view class="u-m-l-18"> <view class="u-m-l-18">
<view class="u-m-l-18">{{item.productName}}</view> <view class="u-m-l-18">{{item.name}}{{item.productName?' | '+item.productName : ''}}</view>
<view class="u-m-l-18 u-m-t-10 u-font-24 color-666">x{{item.num}}</view> <!-- <view class="u-m-l-18 u-m-t-10 u-font-24 color-666">x{{item.num}}</view> -->
</view> </view>
</view> </view>
<view class=" u-m-t-14 u-flex"> <view class=" u-m-t-14 u-flex">
@@ -70,7 +70,7 @@
</view> </view>
</view> </view>
<view class="u-m-t-10 color-999 u-font-24"> <view class="u-m-t-10 color-999 u-font-24">
{{ formatStr(item.useRestrictions)}} {{ item.useRestrictions }}
</view> </view>
</view> </view>
<view class="right u-flex u-flex-col u-col-bottom u-row-center"> <view class="right u-flex u-flex-col u-col-bottom u-row-center">
@@ -200,6 +200,10 @@
}) })
}) })
function tabChange () {
getQuan()
}
/** /**
* 抵扣金额 * 抵扣金额
*/ */
@@ -249,12 +253,13 @@
return { return {
...calcCoup, ...calcCoup,
checked: false, checked: false,
use:option.orderPrice<=0?false:v.use use: option.orderPrice<=0?false:v.use
} }
}).filter((v) => v.use); })
// .filter((v) => v.use);
pageData.fullReductionCoupon = fullReductionCoupon pageData.fullReductionCoupon = fullReductionCoupon
pageData.productCoupon = productCoupon pageData.productCoupon = productCoupon
console.log(pageData) console.log(res)
pageData.hasAjax = true; pageData.hasAjax = true;
} }
@@ -262,18 +267,24 @@
setModalShow('clear', false, '') setModalShow('clear', false, '')
} }
/**
* 继续选择
*/
async function confirmModelConfirm() { async function confirmModelConfirm() {
if (modal.key == 'clear') { if (modal.key == 'clear') {
pageData.fullReductionCouponSel = { if( modal.data ){
id: '' pageData.fullReductionCouponSel = {
id: ''
}
const item = modal.data
item.checked = !item.checked
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
const noCheckedArr = pageData.productCoupon.filter(v => !v.checked)
noCheckedArr.map(v => {
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
})
} }
const item = modal.data
item.checked = !item.checked
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
const noCheckedArr = pageData.productCoupon.filter(v => !v.checked)
noCheckedArr.map(v => {
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
})
setModalShow('clear', false, '') setModalShow('clear', false, '')
} }
} }
@@ -284,8 +295,6 @@
modal.data = data modal.data = data
} }
function back() { function back() {
uni.navigateBack() uni.navigateBack()
} }
@@ -295,14 +304,20 @@
* @param {Object} item * @param {Object} item
*/ */
function changeProductCoupon(item) { function changeProductCoupon(item) {
if (!item.use) { if (!item.use) { return }
if ( payPrice.value <= 0 ) {
modal.content = '当前支付金额不满足选择商品券的最低使用需求,无法选择'
modal.cancelText = '取消'
modal.confirmText = '确定'
setModalShow('clear', true)
return return
} }
if (pageData.fullReductionCouponSel.id && !item.checked) { if (!item.checked) {
const goodsQuan = pageData.productCoupon.filter(v => v.checked) const goodsQuan = pageData.productCoupon.filter(v => v.checked)
const fullReductionCoupon = pageData.fullReductionCouponSel.id ? [pageData.fullReductionCouponSel] : []
let coupArr = [...goodsQuan, item] let coupArr = [...goodsQuan, item]
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user) const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user)
console.log(payPrice)
if (payPrice<=0) { if (payPrice<=0) {
modal.content = '选择该商品券后支付金额将为0继续选择将取消选择的满减券' modal.content = '选择该商品券后支付金额将为0继续选择将取消选择的满减券'
modal.cancelText = '取消' modal.cancelText = '取消'
@@ -318,7 +333,7 @@
return return
} }
} }
console.log(2)
item.checked = !item.checked item.checked = !item.checked
const CheckedArr = pageData.productCoupon.filter(v => v.checked) const CheckedArr = pageData.productCoupon.filter(v => v.checked)
if (CheckedArr.length <= 0) { if (CheckedArr.length <= 0) {
@@ -342,7 +357,6 @@
if (!item.use) { if (!item.use) {
return return
} }
console.log(item);
if (item.id == pageData.fullReductionCouponSel.id) { if (item.id == pageData.fullReductionCouponSel.id) {
pageData.fullReductionCouponSel = { pageData.fullReductionCouponSel = {
id: '' id: ''
@@ -364,15 +378,23 @@
*/ */
function toEmitChooseQuan(item) { function toEmitChooseQuan(item) {
let arr = [] let arr = []
let discountAmount = 0;
if (item) { if (item) {
arr = [item] arr = [item]
} else { } else {
if (pageData.fullReductionCouponSel.id) { if (pageData.fullReductionCouponSel.id) {
arr.push(pageData.fullReductionCouponSel) arr.push(pageData.fullReductionCouponSel)
} }
const goodsQuan = pageData.productCoupon.filter(v => v.checked) let goodsQuan = pageData.productCoupon.filter(v => v.checked)
arr.push(...goodsQuan) arr.push(...goodsQuan)
} }
arr.map(item=>{
discountAmount += item.discountAmount
})
if( discountAmount > option.orderPrice){
}
console.log(arr)
uni.$emit('choose-quan', arr) uni.$emit('choose-quan', arr)
back() back()
} }

View File

@@ -4,7 +4,7 @@ export function isTui(item) {
} }
//是否使用会员价 //是否使用会员价
export function isUseVipPrice(vipUser,goods){ export function isUseVipPrice(vipUser,goods){
return vipUser.id&&vipUser.isVip&&goods.isMember return vipUser.id&&vipUser.isVip&&uni.getStorageSync("shopInfo").isMemberPrice
} }
//计算商品券优惠价格 //计算商品券优惠价格
@@ -90,8 +90,9 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
} }
//返回商品实际支付价格 //返回商品实际支付价格
export function returnProductPayPrice(goods,vipUser){ export function returnProductPayPrice(goods,vipUser){
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price; let memberPrice = goods.memberPrice ? goods.memberPrice : goods.unitPrice;
const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price; let price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.unitPrice;
price = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : price
return price return price
} }
//返回商品券抵扣的商品价格 //返回商品券抵扣的商品价格
@@ -101,9 +102,9 @@ export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMembe
if(typeof cur==='object'){ if(typeof cur==='object'){
curPrice=isMember?cur.memberPrice*1:cur.price curPrice=isMember?cur.memberPrice*1:cur.price
}else{ }else{
curPrice=cur*1 curPrice = cur*1
} }
return prve+curPrice return prve + curPrice
},0) },0)
} }
@@ -172,24 +173,24 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
for(let i in arr){ for(let i in arr){
const coup=arr[i] const coup=arr[i]
if(!goodsMap.hasOwnProperty(coup.proId)){ if(!goodsMap.hasOwnProperty(coup.proId)){
goodsMap[coup.proId]=goodsArr.filter(v=>v.productId==coup.proId).map(v=>{ goodsMap[coup.proId]= goodsArr.filter(v=>v.productId==coup.proId).map((v,i)=>{
return { return {
...v, ...v,
payPrice:returnProductPayPrice(v,vipUser) payPrice: returnProductPayPrice(v,vipUser)
} }
}).sort((a,b)=>{ }).sort((a,b)=>{
const aPrice=a.payPrice let aPrice=a.payPrice
const bPrice=b.payPrice let bPrice=b.payPrice
return aPrice-bPrice return aPrice-bPrice
}) })
goodsPayPriceMap[coup.proId]=goodsMap[coup.proId].reduce((prve,cur)=>{ goodsPayPriceMap[coup.proId] = goodsMap[coup.proId].reduce((prve,cur)=>{
const arr=new Array(cur.number).fill(cur.payPrice) const arr=new Array(cur.num).fill(cur.payPrice)
prve.push(...arr) prve.push(...arr)
return prve return prve
},[]) },[])
} }
const proCoupStartIndex=returnProCoupStartIndex(arr,i) const proCoupStartIndex=returnProCoupStartIndex(arr,i)
const coupNum = Math.min(goodsPayPriceMap[coup.proId].length,coup.number) const coupNum = Math.min(coupMap[coup.proId].length)
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum) total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
} }
} }
@@ -230,7 +231,7 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
} }
return { return {
...v, ...v,
use: v.use && isfullAmount use: isfullAmount
} }
}) })
} }

View File

@@ -1,155 +0,0 @@
<template>
<view class="">
<up-overlay :show="overlayshow" @click="overlayshow = false">
<view class="boxoverlay">
<view class="rect" @tap.stop>
<!-- 抖音 -->
<view class="bottomconstant">
<view class="itemlist">
<!-- <view class="ordernumber">
订单号111
</view> -->
<view class="title">
绑定门店
</view>
<view class="itemlists" v-for="(item,index) in 4" :key="index">
<view class="top">
<view class="tag">
名称qqqqqqqqq
</view>
<view class="date">
地址qqqqqqq
</view>
</view>
<view class="bottom">
操作
</view>
</view>
</view>
</view>
</view>
</view>
</up-overlay>
</view>
</template>
<script setup>
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app';
import {
computed,
reactive,
ref,
watch,
defineExpose
} from 'vue';
//显示
const overlayshow = ref(false);
const open = () => {
overlayshow.value = true
}
defineExpose({
open
})
</script>
<style lang="scss" scoped>
page {
background: #F9F9F9;
}
.boxoverlay {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
.rect {
padding: 32rpx 28rpx;
width: 80%;
background-color: #fff;
border-radius: 18rpx;
.bottomconstant {
padding: 0 28rpx;
width: 100%;
border-radius: 18rpx 18rpx 18rpx 18rpx;
.itemlist:nth-child(1) {
margin-top: 0;
}
.itemlist {
// margin-top: 16rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
.ordernumber {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.title {
margin-top: 16rpx;
padding-bottom: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 28rpx;
color: #333333;
border-bottom: 1rpx solid #E5E5E5;
}
.itemlists {
padding-top: 16rpx;
display: flex;
justify-content: space-between;
align-items: center;
.top {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
.date {
margin-top: 10rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.tag {
width: 350rpx;
overflow: hidden; //超出的文本隐藏
text-overflow: ellipsis; //溢出用省略号显示
white-space: nowrap; //溢出不换行
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
.bottom {
background: #EAF4FD;
border-radius: 4rpx 4rpx 4rpx 4rpx;
padding: 6rpx 12rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 20rpx;
color: #318AFE;
}
}
}
}
}
}
</style>

View File

@@ -2,22 +2,17 @@
<view class="constant"> <view class="constant">
<view class="constantitem" @click="object_id =null,overlayshow = true"> <view class="constantitem" @click="object_id =null,overlayshow = true">
<view>扫码核销</view> <view>扫码核销</view>
<view> <view><up-icon name="arrow-right" color="#909399" size="20"></up-icon></view>
<up-icon name="arrow-right" color="#909399" size="20"></up-icon>
</view>
</view> </view>
<view class="constantitem" @click="clickpath('PAGES_WEITEOFF_RECORD',1)"> <view class="constantitem" @click="clickpath('PAGES_WEITEOFF_RECORD',1)">
<view>美团记录</view> <view>美团记录</view>
<view> <view><up-icon name="arrow-right" color="#909399" size="20"></up-icon></view>
<up-icon name="arrow-right" color="#909399" size="20"></up-icon>
</view>
</view> </view>
<view class="constantitem" @click="clickpath('PAGES_WEITEOFF_RECORD',2)"> <view class="constantitem" @click="clickpath('PAGES_WEITEOFF_RECORD',2)">
<view>抖音记录</view> <view>抖音记录</view>
<view> <view><up-icon name="arrow-right" color="#909399" size="20"></up-icon></view>
<up-icon name="arrow-right" color="#909399" size="20"></up-icon>
</view>
</view> </view>
<!-- 核销准备 --> <!-- 核销准备 -->
<up-overlay :show="overlayshow"> <up-overlay :show="overlayshow">
<view class="boxoverlay"> <view class="boxoverlay">
@@ -26,8 +21,7 @@
团购卷核销 团购卷核销
</view> </view>
<view class="subsection"> <view class="subsection">
<up-subsection :list="subsectionlist" :current="subsectioncurrent" @change="sectionChange"> <up-subsection :list="subsectionlist" :current="subsectioncurrent" @change="sectionChange"></up-subsection>
</up-subsection>
</view> </view>
<view class="search"> <view class="search">
<up-search :show-action="false" searchIcon="scan" :clearabled="true" @clickIcon='clickIcon' <up-search :show-action="false" searchIcon="scan" :clearabled="true" @clickIcon='clickIcon'
@@ -38,18 +32,12 @@
:closable="true"></up-alert> :closable="true"></up-alert>
</view> </view>
<view class="bouttonbox"> <view class="bouttonbox">
<view class="keep" @click="confirms"> <view class="keep" @click="confirms"> 确认 </view>
确认 <view class="cancel" @click="overlayshow = false"> 取消 </view>
</view>
<view class="cancel" @click="overlayshow = false">
取消
</view>
</view> </view>
</view> </view>
</view> </view>
</up-overlay> </up-overlay>
<!-- 绑定门店 -->
<dialogs ref="dialogsref"></dialogs>
<!-- 选择商品 --> <!-- 选择商品 -->
<commodity ref="refcommodity"></commodity> <commodity ref="refcommodity"></commodity>
<!-- 二维码 --> <!-- 二维码 -->
@@ -69,17 +57,13 @@
</template> </template>
<script setup> <script setup>
import { import { onLoad, onShow, onUnload, } from '@dcloudio/uni-app'
onLoad, import { computed, reactive, ref, watch } from 'vue'
onShow,
onUnload, import commodity from '../components/commodity.vue'
} from '@dcloudio/uni-app';
import { import go from '@/commons/utils/go.js'
computed,
reactive,
ref,
watch
} from 'vue';
import { import {
userlogout, userlogout,
douyincheckIn, douyincheckIn,
@@ -87,33 +71,50 @@
searchstorestatus, //状态查询 searchstorestatus, //状态查询
getuisdk //获取uisdk 绑定 链接 getuisdk //获取uisdk 绑定 链接
} from '@/http/php/api.ts'; } from '@/http/php/api.ts';
import go from '@/commons/utils/go.js'
import dialogs from '../components/dialogs.vue'
import commodity from '../components/commodity.vue'
onLoad(async () => {
// 登录 会员入签
let res = await douyincheckIn({
token: uni.getStorageSync("iToken").tokenValue,
loginName: uni.getStorageSync("shopId"),
clientType: 'ADMIN'
})
uni.setStorageSync('phpuserinfo', res.userInfo)
uni.setStorageSync('clint_type', 1)
})
//显示 //显示
const overlayshow = ref(false); const overlayshow = ref(false);
// 切换 // 切换
const subsectioncurrent = ref(0); const subsectioncurrent = ref(0);
const subsectionlist = ref(['美团', '抖音']); const subsectionlist = ref(['美团', '抖音']);
const sectionChange = (index) => { const sectionChange = (index) => {
subsectioncurrent.value = index; subsectioncurrent.value = index;
uni.setStorageSync('clint_type', index + 1) uni.setStorageSync('clint_type', index + 1)
} }
// 二维码或者条形码 // 二维码或者条形码
const object_id = ref(null) const object_id = ref(null)
// // 二维
const qrcodes = reactive({
val: 'www.baidu.com',
icon: '@/static/logo.png',
show: false
})
// 选择商品
const refcommodity = ref(null)
onShow(async () => {})
// 销毁组件
onUnload(async () => {
// 退出
await userlogout()
})
onLoad(async () => {
// 登录 会员入签
let res = await douyincheckIn({
token: uni.getStorageSync("iToken").tokenValue,
loginName: uni.getStorageSync("shopInfo").id,
clientType: 'ADMIN'
})
uni.setStorageSync('phpuserinfo', res.userInfo)
uni.setStorageSync('clint_type', 1)
})
/**
* 拉起扫码
*/
const clickIcon = () => { const clickIcon = () => {
uni.scanCode({ // 允许从相机和相册扫码 uni.scanCode({ // 允许从相机和相册扫码
success: (res) => { success: (res) => {
@@ -123,15 +124,10 @@
} }
}); });
} }
// 二维码 /**
const qrcodes = reactive({ * 首先获取状态
val: 'www.baidu.com', */
icon: '@/static/logo.png',
show: false
})
// 首先获取状态
let confirms = async () => { let confirms = async () => {
if (object_id.value == null) { if (object_id.value == null) {
uni.showToast({ uni.showToast({
@@ -143,14 +139,30 @@
let res = await searchstorestatus() let res = await searchstorestatus()
// status == 0 则需要显示二维码 ==1 去核销 // status == 0 则需要显示二维码 ==1 去核销
if (res.status == 0) { if (res.status == 0) {
qrcodes.val = await getuisdk() uni.showModal({
overlayshow.value = false title: '首次核销需要绑定店铺,是否绑定',
qrcodes.show = true confirmText:"去绑定",
cancelText:"取消",
success: async (res) => {
if (res.confirm) {
qrcodes.val = await getuisdk()
overlayshow.value = false
qrcodes.show = true
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
} else { } else {
clickkeep() clickkeep()
} }
} }
// 点击确定
/**
* 点击确定去核销
*/
const clickkeep = async () => { const clickkeep = async () => {
let data = null let data = null
if (uni.getStorageSync('clint_type') == 1) { if (uni.getStorageSync('clint_type') == 1) {
@@ -166,26 +178,15 @@
overlayshow.value = false overlayshow.value = false
refcommodity.value.open(res) refcommodity.value.open(res)
} }
// 这是选择门店
// const dialogsref = ref(null) /**
// const dialogconfirm = () => { * 跳转
// dialogsref.value.open() */
// }
// 选择商品
const refcommodity = ref(null)
// 跳转
const clickpath = (URL, title) => { const clickpath = (URL, title) => {
uni.setStorageSync('clint_type', title) uni.setStorageSync('clint_type', title)
go.to(URL) go.to(URL)
} }
onShow(async () => {})
// 销毁组件
onUnload(async () => {
// 退出
await userlogout()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -1,17 +1,5 @@
<template> <template>
<view class="constant"> <view class="constant">
<!-- <view class="topbox">
<view class="left">
<view class="">
筛选
</view>
<view class=""></view>
</view>
<view class="right">
<up-input class="input" placeholder="搜索订单号" v-model="value"
@change="change"></up-input>
</view>
</view> -->
<!-- 抖音 --> <!-- 抖音 -->
<view v-if="form.type == 2"> <view v-if="form.type == 2">
<view class="bottomconstant" v-for="(item,index) in form.list" :key="index"> <view class="bottomconstant" v-for="(item,index) in form.list" :key="index">
@@ -89,22 +77,13 @@
</template> </template>
<script setup> <script setup>
import { import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
onLoad, import { computed, reactive, ref, watch } from 'vue';
onShow,
onReachBottom
} from '@dcloudio/uni-app';
import {
computed,
reactive,
ref,
watch
} from 'vue';
import dayjs from "dayjs"; import dayjs from "dayjs";
import {
orderlist, import { orderlist, fulfilmentcertificatecanceles } from '@/http/php/api.ts';
fulfilmentcertificatecanceles
} from '@/http/php/api.ts';
// 下拉加载 // 下拉加载
onReachBottom(() => { onReachBottom(() => {
if (form.status != 'nomore') { if (form.status != 'nomore') {
@@ -116,6 +95,7 @@
form.type = uni.getStorageSync('clint_type') form.type = uni.getStorageSync('clint_type')
initial() initial()
}) })
const dropdownvalue = ref(1) const dropdownvalue = ref(1)
const optionsdropdown = [{ const optionsdropdown = [{
label: '等待验证', label: '等待验证',
@@ -149,6 +129,10 @@
count: '', count: '',
date: '' date: ''
}); });
/**
* 获取记录数据
*/
const getlist = async () => { const getlist = async () => {
let data = null let data = null
if (uni.getStorageSync('clint_type') == 1) { if (uni.getStorageSync('clint_type') == 1) {
@@ -196,6 +180,10 @@
}, 500) }, 500)
} }
} }
/**
* 是否撤销核销
*/
const clickcancel = async (item) => { const clickcancel = async (item) => {
uni.showModal({ uni.showModal({
title: '确认撤销吗?', title: '确认撤销吗?',
@@ -226,7 +214,6 @@
} }
}) })
} }
</script> </script>