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>
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 { provide } from 'vue';
@ -38,7 +38,8 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
plus.runtime.getProperty(plus.runtime.appid, 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("version===",res.url && widgetInfo.version < res.version)
if (res.url && widgetInfo.version < res.version) {
@ -59,8 +60,7 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
success: res => {
if (res.confirm) {
uni.showLoading('下载中...');
if (uni.getSystemInfoSync().platform ==
'android') {
if (uni.getSystemInfoSync().platform == 'android') {
uni.downloadFile({
url: downloadLink,
success: downloadResult => {
@ -69,24 +69,16 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
entry.getParent(_oldFile=>{
entry.moveTo(_oldFile,'.apk',newFilePath=>{
console.log('newFilePath',newFilePath.fullPath)
plus.runtime
.install(newFilePath.fullPath, { force: false },
d => {
console
.log(
'install success...'
);
plus.runtime
.restart();
},
e => {
console.log(e)
console
.error(
'install fail...'
);
}
);
plus.runtime.install(newFilePath.fullPath, { force: false },
d => {
console .log( 'install success...' );
plus.runtime .restart();
},
e => {
console.log(e)
console .error( 'install fail...' );
}
);
})
})
})
@ -94,10 +86,8 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
}
});
}
if (uni.getSystemInfoSync().platform ==
'ios') {
plus.runtime.openURL(downloadLink, function(
res) {});
if (uni.getSystemInfoSync().platform == 'ios') {
plus.runtime.openURL(downloadLink, function( res) {});
}
} else if (res.cancel) {
console.log('取消');
@ -113,34 +103,23 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
success: res => {
if (res.confirm) {
uni.showLoading('下载中...');
if (uni.getSystemInfoSync().platform ==
'android') {
if (uni.getSystemInfoSync().platform == 'android') {
uni.downloadFile({
url: downloadLink,
success: downloadResult => {
if (downloadResult
.statusCode ===
200) {
if (downloadResult.statusCode == 200) {
plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
entry.getParent(_oldFile=>{
entry.moveTo(_oldFile,'.apk',newFilePath=>{
console.log('newFilePath',newFilePath.fullPath)
plus.runtime
.install(newFilePath.fullPath, { force: false },
plus.runtime.install(newFilePath.fullPath, { force: false },
d => {
console
.log(
'install success...'
);
plus.runtime
.restart();
console.log('install success...');
plus.runtime.restart();
},
e => {
console.log(e)
console
.error(
'install fail...'
);
console.error('install fail...');
}
);
})
@ -151,10 +130,8 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
}
});
}
if (uni.getSystemInfoSync().platform ==
'ios') {
plus.runtime.openURL(downloadLink, function(
res) {});
if (uni.getSystemInfoSync().platform == 'ios') {
plus.runtime.openURL(downloadLink, function( res) {});
}
} else if (res.cancel) {
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) => {
console.error('WebSocket连接失败', error);
uni.$emit('is-socket-open', true)
this.reconnect();
}
});
@ -42,10 +43,12 @@ class WebsocketUtil {
// 连接成功后启动心跳和消息监听
this.startHeartbeat();
this.listenForMessages();
uni.$emit('is-socket-open', true)
});
this.socketTask.onError((res) => {
console.log('WebSocket连接失败==',res);
uni.$emit('is-socket-open', false)
this.reconnect();
});
// 注意:这里的 onClose 监听器应该放在 uni.connectSocket 调用之后
@ -93,7 +96,7 @@ class WebsocketUtil {
const { data } = res;
this.messageCallbacks.forEach(callback => callback(data.toString())); // 假设 data 是字符串或可转换为字符串
});
this.send("WebSocket连接正常");
// this.send("WebSocket连接正常");
} else {
console.error('WebSocket 连接尚未建立,无法监听消息');
}

View File

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

View File

@ -1,8 +1,10 @@
<template>
<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()]" >
<view class="u-relative">
<view class=" color-333 font-bold">{{props.title||'提示'}}</view>
<view class="u-relative" style="display: flex;align-items: center;justify-content: space-between;">
<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">
<slot name="icon">
<view class="close" @tap="close">

View File

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

View File

@ -9,6 +9,20 @@ export function uploadFile(file, data, urlType = 'account') {
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
@ -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) {
let networkType = ''

21
main.js
View File

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

View File

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

View File

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

View File

@ -1,20 +1,23 @@
<template>
<view class="addType">
<view v-for="item in datas.list">
<view class="">
{{item.name}}<up-icon color="#64A7FE" name="edit-pen" @tap="showoneEvent(item)"></up-icon>
</view>
<view class="">
是否启用 &nbsp;&nbsp;
<up-switch checked="true" :activeValue="1" size="20" :inactiveValue="0"
@change="switchChangeEvent($event,item)" :modelValue="item.status" style="transform:scale(0.7)" />
<view>
<view class="addType">
<view v-for="item in datas.list">
<view class="">
{{item.name}}<up-icon color="#64A7FE" name="edit-pen" @tap="showoneEvent(item)"></up-icon>
</view>
<view class="">
是否启用 &nbsp;&nbsp;
<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 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 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">
<view class="zhezhaopops">
@ -27,7 +30,7 @@
耗材类型名称<input type="text" v-model="datas.name" style="padding: 0 20rpx;"/>
</view>
<view class="" style="margin-bottom: 20rpx;">
是否
是否
<up-switch checked="true" :activeValue="1" :inactiveValue="0" @change="switchChange"
:modelValue="datas.status" style="transform:scale(0.7)" />
</view>
@ -58,7 +61,7 @@
list: [],
showtwo: false,
name: "",
status: 0,
status: 1,
showone: false,
activeData: ""
})

View File

@ -30,7 +30,7 @@
<text style="color: red;">*</text> 排序
</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 File

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

View File

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

View File

@ -24,11 +24,11 @@
</view>
<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> <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 style="justify-content: space-between;">
<view> 单位 </view>
@ -65,7 +65,7 @@
<script setup>
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 go from '@/commons/utils/go.js';
import dayjs from 'dayjs';
@ -90,16 +90,9 @@
},
item: ""
})
const props = defineProps({
consId: {
type: String
},
item: {
type: String
}
})
onMounted(() => {
datas.item = JSON.parse(props.item)
onLoad((options) => {
datas.item = JSON.parse(options.item)
datas.form = Object.assign(datas.form, datas.item)
//
datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo]
@ -147,7 +140,7 @@
datas.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
}
function sumbit() {
let sumbit = uni.$utils.debounce(() => {
if (!datas.form.bodyList.inOutNumber) {
refs.ctx.$refs.uToastRef.show({
@ -175,7 +168,7 @@
}).then(res => {
go.back()
})
}
},1000)
</script>
<style>

View File

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

View File

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

View File

@ -22,11 +22,11 @@
</view>
<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> <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 style="justify-content: space-between;">
<view> 单位 </view>
@ -64,11 +64,12 @@
<script setup>
import { ref, computed, reactive, onMounted, getCurrentInstance } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { ref, computed, reactive, getCurrentInstance } from 'vue';
import { onShow, onLoad } from '@dcloudio/uni-app';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import dayjs from 'dayjs';
import { getVendorPage } from '@/http/api/vendor.js';
import { consStockIn } from '@/http/api/cons.js';
@ -89,16 +90,10 @@
},
item: ""
})
const props = defineProps({
consId: {
type: String
},
item: {
type: String
}
})
onMounted(() => {
datas.item = JSON.parse(props.item)
onLoad((options) => {
console.log(options)
datas.item = JSON.parse(options.item)
datas.form = Object.assign(datas.form, datas.item)
console.log(datas.form)
//
@ -151,7 +146,7 @@
}
function sumbit() {
let sumbit = uni.$utils.debounce(() => {
if (!datas.form.bodyList.inOutNumber) {
refs.ctx.$refs.uToastRef.show({
type: 'default',
@ -190,9 +185,8 @@
go.back()
}, 1000)
})
}
},1000)
//
const statusHeight = computed(() => {
return 30 * datas.status.length + 14 + 'px'
})

View File

@ -9,11 +9,11 @@
<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>
<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;">
<view class="goodsList">
<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
:key="item.id"
:name="item.id"
@ -132,6 +132,7 @@
}
.content{
display: flex;
width: 100%;
height: 672rpx;
.category{
min-width: 316rpx;
@ -153,6 +154,7 @@
overflow-y: auto;
display: flex;
flex-direction: column;
flex: 1;
.goodsItem{
width: 100%;
padding: 22rpx 24rpx;

View File

@ -10,7 +10,11 @@
<view class="item">
<view class="lable">使用门槛</view>
<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>
@ -35,7 +39,7 @@
<view class="item">
<view class="lable">有效期</view>
<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 class="item">
@ -43,13 +47,13 @@
<!-- <up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
</view>
<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 class="item">
<view class="lable">可用日期</view>
<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
:customStyle="{marginBottom: '8px',marginRight: '15px'}"
v-for="(item, index) in pageData.value"
@ -71,7 +75,6 @@
</up-radio-group>
</view>
<view class="time" v-if="formData.useTimeType=='custom'">
<!-- {{formData.useStartTime +'—'+ formData.useEndTime}} -->
<view @click="useTimeChange('useStartTime')">{{ formData.useStartTime || '开始时间'}}</view>--
<view @click="useTimeChange('useEndTime')">{{ formData.useEndTime || '结束时间'}}</view>
</view>
@ -81,13 +84,34 @@
<view class="card">
<view class="item">
<view class="lable">总发放数量
<!-- <up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
</view>
<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 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">
<button @click="save">保存</button>
</view>
@ -100,12 +124,17 @@
></up-datetime-picker>
<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>
<select-goods ref="goods" @affirm="affirm"></select-goods>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js'
import selectGoods from './components/select-goods';
import { addCoupon, updateCoupon } from '@/http/api/coupon.js'
const pageData = reactive({
value: [
@ -137,11 +166,23 @@
useTimeType: 'all',
useStartTime: '',
useEndTime: '',
validDays: null,
validDays: '',
daysToTakeEffect: null,
number: null,
proId: null,
proName: null,
})
let datePicker = ref(null)
let refTime = ref(null)
let goods = ref(null)
onLoad((options) => {
if ( options.isType ) {
formData.type = options.isType;
}
if ( options.type == 'info' ) {
let itemData = JSON.parse(options.item);
for (let item in itemData) {
@ -150,8 +191,18 @@
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 = () => {
if( !formData.title ){
uni.showToast({ title: '请输入优惠券名称' })
uni.$utils.showToast("请输入优惠券名称")
return false;
}
if( !formData.fullAmount || !formData.discountAmount ){
uni.showToast({ title: '请输入使用门槛' })
if( !formData.fullAmount || (formData.type == 1&&!formData.discountAmount) ){
uni.$utils.showToast("请输入使用门槛")
return false;
}
if( !formData.daysToTakeEffect ){
uni.showToast({ title: '请输入生效天数' })
uni.$utils.showToast("请输入生效天数")
return false;
}
if( !formData.number ){
uni.showToast({ title: '请输入发放数量' })
uni.$utils.showToast("请输入发放数量")
return false;
}
formData.userDays = formData.userDays.toString();
let userDays = formData.userDays.toString();
let params = {
...formData
...formData,
userDays
}
if(formData.id){
updateCoupon(params).then((res) => {
go.back(1)
uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
})
} else{
addCoupon(params).then((res) => {
go.back(1)
uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
})
}
@ -312,6 +369,65 @@
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{
position: fixed;
bottom: 0;

View File

@ -10,13 +10,13 @@
<view class="item">
<view class="lable">使用门槛</view>
<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 class="item">
<view class="lable">总发放数量</view>
<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>
@ -92,7 +92,6 @@
let affirm = (item) => {
formData.proId = item.id
formData.proName = item.name
}
/**
@ -100,15 +99,15 @@
*/
let save = () => {
if( !formData.title ){
uni.showToast({ title: '请输入商品名称' })
uni.$utils.showToast("请输入商品名称")
return false;
}
if( !formData.fullAmount ){
uni.showToast({ title: '请输入使用门槛' })
uni.$utils.showToast("请输入使用门槛")
return false;
}
if( !formData.number ){
uni.showToast({ title: '请输入发放数量' })
uni.$utils.showToast("请输入发放数量")
return false;
}
let params = {
@ -116,11 +115,17 @@
}
if(formData.id){
updateCoupon(params).then((res) => {
go.back(1)
uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
})
} else{
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 v-if="item.type == 1">
<view>
<view> 有效期 </view>
<view> 领券后{{ item.validDays }}天过期 </view>
</view>
@ -113,7 +113,6 @@
let getCoupon = () => {
let params = pageData.query;
getCouponList(params).then((res) => {
console.log(res)
pageData.couponList = res;
})
}
@ -124,9 +123,9 @@
*/
let addCoupon = ()=>{
if ( pageData.query.type == 1 ) {
go.to('PAGES_COUPON_DISCOUNTCOUPONS')
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{ isType: 1})
} else {
go.to('PAGES_COUPON_CERTIFICATE')
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{ isType: 2})
}
}
@ -135,11 +134,11 @@
* 修改
*/
let editCoupon = (item)=>{
console.log(item.id)
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 {
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 { onLoad } from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js'
import { debounce } from '@/commons/utils/debounce.js'
import { addCreditBuyer,editCreditBuyer } from '@/http/api/buyer.js';
const pageData = reactive({
@ -120,7 +120,7 @@
* 保存
*/
let save = debounce(() => {
let save = uni.$utils.debounce(() => {
console.log(pageData.formData)
uFormRef.value.validate().then(valid => {
if (valid) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<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="u-flex u-row-between">
<view class="u-font-32">{{data.name}}</view>
@ -74,7 +74,7 @@
import {hasPermission} from '@/commons/utils/hasPermission.js'
import { $status } from '@/commons/table-status.js'
import { $table } from '@/http/yskApi/table.js'
import infoBox from '@/commons/utils/infoBox.js'
const emits = defineEmits(['more', 'update', 'bind'])
const props = defineProps({
data: {
@ -140,46 +140,12 @@
console.log(res)
if(res){
const useType = props.status == 'using' ? props.data.useType : undefined
go.to('PAGES_CREATE_ORDER', {
tableId: props.data.id,
name: props.data.name,
maxCapacity: props.data.maxCapacity,
status: props.data.status,
})
console.log(props.data)
go.to('PAGES_CREATE_ORDER', props.data)
}
})
}
/**
* 查看订单详情
*/
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",
qrcode: item.id,
}).then(res => {
infoBox.showToast('清台成功')
uni.$utils.showToast('清台成功')
emits('update')
})
}

View File

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

View File

@ -130,7 +130,7 @@
</view>
<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>
@ -150,7 +150,6 @@
import { shopUserSummary, shopUserList,shopUserMoney } from '@/http/api/shopUser.js'
import { onShow } from '@dcloudio/uni-app';
import { midfiyAccount } from '@/http/yskApi/requestAll.js';
import { onReachBottom } from '@dcloudio/uni-app';
import { hasPermission } from '@/commons/utils/hasPermission.js';
@ -231,7 +230,9 @@
* @param {Object} 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()
getAllShopInfo()
}
@ -239,7 +240,7 @@
* 搜索
*/
function searchFunc() {
pageData.query.page = 1
pageData.query.page = 1;
getUser()
getAllShopInfo()
}
@ -312,6 +313,13 @@
* 修改余额确定
*/
let callTabletakeNumberEvent = async () => {
if( datas.form.money == ''){
uni.showToast({
title: '请输入增减金额',
icon: 'none'
})
return;
}
let res = await shopUserMoney({
id: datas.activeUser.id,
...datas.form

View File

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

View File

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

View File

@ -323,6 +323,7 @@
// token
storageManage.setLogin(loginBizData)
storageManage.token(loginBizData.tokenInfo)
uni.setStorageSync("promission",loginBizData.promissionList)
// var time1 = new Date();
// 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>
<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>
<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="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">
@ -321,6 +324,9 @@ let switchChange = ( type ) => {
case "isAccountPay":
params.isAccountPay = vdata.shopInfo.isAccountPay;
break;
case "isMemberPrice":
params.isMemberPrice = vdata.shopInfo.isMemberPrice;
break;
case "isTableFee":
if ( vdata.isTableFee ) {
params.isTableFee = 1;

View File

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

View File

@ -4,7 +4,7 @@
<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-text-left">
<view class="color-333">{{item.name}}</view>
<view class="color-333 up-line-1" >{{item.name}}</view>
</view>
<view class="u-flex u-m-t-20 u-flex-wrap">
<view class="item" @tap="chooseSkd(index,skd)"

View File

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

View File

@ -88,7 +88,7 @@
<view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template>
<template v-else-if="user.isVip == 1">
<template v-else-if="isVip == 1">
<view>{{item.num*item.memberPrice}}</view>
<view class="line-th color-666 ">{{item.num*item.price}}</view>
</template>
@ -147,11 +147,11 @@
</view>
<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 ">
已优惠{{youhuiAllPrice}}
已优惠{{discountsPrice}}
</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>
@ -221,8 +221,15 @@
<text>{{vipDiscountPrice}}</text>
</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>打折</view>
<view>服务改价优惠 </view>
<view class="color-red">
<text></text>
<text>{{to2(discountAmount) }}</text>
@ -235,11 +242,11 @@
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
</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 class="color-red">
<text></text>
<text> {{productCouponDiscountAmount }}</text>
<text> {{to2(orderInfo.productCouponDiscountAmount) }}</text>
</view>
</view>
<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 { isTui, isTuiCai, isGift, canTuiKuan, canTuicai, mathFloorPrice } from '@/commons/utils/goodsUtil.js'
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
const pop = reactive({
youhui: false
})
function youhuiDetailShow() {
pop.youhui = true
}
function productCouponDikou(item) {
return '商品券抵扣¥' + returnProductCoupPrice(item)
}
function youhuiDetailHide() {
pop.youhui = false
}
const props = defineProps({
orderInfo: {
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
})
}
/**
* 计算菜品数量
*/
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) {
if (!item.isMember) {
return item.price * item.num
@ -345,29 +492,7 @@
const price = item.memberPrice ? item.memberPrice : item.price
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) {
return (Math.floor(item.num*item.unitPrice*100)/100).toFixed(2)
@ -467,112 +592,6 @@
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>

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<template>
<view class="u-p-l-30 u-p-r-30 u-p-t-30 u-font-28 ">
<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>
<view class="u-m-t-32">
<template v-if="pageData.types.sel==0">
@ -60,8 +60,8 @@
<view class="u-flex">
<up-image width="80rpx" height="80rpx" :src="item.productCover"></up-image>
<view class="u-m-l-18">
<view class="u-m-l-18">{{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">{{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>
</view>
<view class=" u-m-t-14 u-flex">
@ -70,7 +70,7 @@
</view>
</view>
<view class="u-m-t-10 color-999 u-font-24">
{{ formatStr(item.useRestrictions)}}
{{ item.useRestrictions }}
</view>
</view>
<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 {
...calcCoup,
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.productCoupon = productCoupon
console.log(pageData)
console.log(res)
pageData.hasAjax = true;
}
@ -262,18 +267,24 @@
setModalShow('clear', false, '')
}
/**
* 继续选择
*/
async function confirmModelConfirm() {
if (modal.key == 'clear') {
pageData.fullReductionCouponSel = {
id: ''
if( modal.data ){
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, '')
}
}
@ -284,8 +295,6 @@
modal.data = data
}
function back() {
uni.navigateBack()
}
@ -295,14 +304,20 @@
* @param {Object} 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
}
if (pageData.fullReductionCouponSel.id && !item.checked) {
if (!item.checked) {
const goodsQuan = pageData.productCoupon.filter(v => v.checked)
const fullReductionCoupon = pageData.fullReductionCouponSel.id ? [pageData.fullReductionCouponSel] : []
let coupArr = [...goodsQuan, item]
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user)
console.log(payPrice)
if (payPrice<=0) {
modal.content = '选择该商品券后支付金额将为0继续选择将取消选择的满减券'
modal.cancelText = '取消'
@ -318,7 +333,7 @@
return
}
}
console.log(2)
item.checked = !item.checked
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
if (CheckedArr.length <= 0) {
@ -342,7 +357,6 @@
if (!item.use) {
return
}
console.log(item);
if (item.id == pageData.fullReductionCouponSel.id) {
pageData.fullReductionCouponSel = {
id: ''
@ -364,15 +378,23 @@
*/
function toEmitChooseQuan(item) {
let arr = []
let discountAmount = 0;
if (item) {
arr = [item]
} else {
if (pageData.fullReductionCouponSel.id) {
arr.push(pageData.fullReductionCouponSel)
}
const goodsQuan = pageData.productCoupon.filter(v => v.checked)
let goodsQuan = pageData.productCoupon.filter(v => v.checked)
arr.push(...goodsQuan)
}
arr.map(item=>{
discountAmount += item.discountAmount
})
if( discountAmount > option.orderPrice){
}
console.log(arr)
uni.$emit('choose-quan', arr)
back()
}

View File

@ -4,7 +4,7 @@ export function isTui(item) {
}
//是否使用会员价
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){
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.unitPrice;
let price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.unitPrice;
price = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : price
return price
}
//返回商品券抵扣的商品价格
@ -101,9 +102,9 @@ export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMembe
if(typeof cur==='object'){
curPrice=isMember?cur.memberPrice*1:cur.price
}else{
curPrice=cur*1
curPrice = cur*1
}
return prve+curPrice
return prve + curPrice
},0)
}
@ -172,24 +173,24 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
for(let i in arr){
const coup=arr[i]
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 {
...v,
payPrice:returnProductPayPrice(v,vipUser)
payPrice: returnProductPayPrice(v,vipUser)
}
}).sort((a,b)=>{
const aPrice=a.payPrice
const bPrice=b.payPrice
let aPrice=a.payPrice
let bPrice=b.payPrice
return aPrice-bPrice
})
goodsPayPriceMap[coup.proId]=goodsMap[coup.proId].reduce((prve,cur)=>{
const arr=new Array(cur.number).fill(cur.payPrice)
goodsPayPriceMap[coup.proId] = goodsMap[coup.proId].reduce((prve,cur)=>{
const arr=new Array(cur.num).fill(cur.payPrice)
prve.push(...arr)
return prve
},[])
}
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)
}
}
@ -230,7 +231,7 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
}
return {
...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="constantitem" @click="object_id =null,overlayshow = true">
<view>扫码核销</view>
<view>
<up-icon name="arrow-right" color="#909399" size="20"></up-icon>
</view>
<view><up-icon name="arrow-right" color="#909399" size="20"></up-icon></view>
</view>
<view class="constantitem" @click="clickpath('PAGES_WEITEOFF_RECORD',1)">
<view>美团记录</view>
<view>
<up-icon name="arrow-right" color="#909399" size="20"></up-icon>
</view>
<view><up-icon name="arrow-right" color="#909399" size="20"></up-icon></view>
</view>
<view class="constantitem" @click="clickpath('PAGES_WEITEOFF_RECORD',2)">
<view>抖音记录</view>
<view>
<up-icon name="arrow-right" color="#909399" size="20"></up-icon>
</view>
<view><up-icon name="arrow-right" color="#909399" size="20"></up-icon></view>
</view>
<!-- 核销准备 -->
<up-overlay :show="overlayshow">
<view class="boxoverlay">
@ -26,8 +21,7 @@
团购卷核销
</view>
<view class="subsection">
<up-subsection :list="subsectionlist" :current="subsectioncurrent" @change="sectionChange">
</up-subsection>
<up-subsection :list="subsectionlist" :current="subsectioncurrent" @change="sectionChange"></up-subsection>
</view>
<view class="search">
<up-search :show-action="false" searchIcon="scan" :clearabled="true" @clickIcon='clickIcon'
@ -38,18 +32,12 @@
:closable="true"></up-alert>
</view>
<view class="bouttonbox">
<view class="keep" @click="confirms">
确认
</view>
<view class="cancel" @click="overlayshow = false">
取消
</view>
<view class="keep" @click="confirms"> 确认 </view>
<view class="cancel" @click="overlayshow = false"> 取消 </view>
</view>
</view>
</view>
</up-overlay>
<!-- 绑定门店 -->
<dialogs ref="dialogsref"></dialogs>
<!-- 选择商品 -->
<commodity ref="refcommodity"></commodity>
<!-- 二维码 -->
@ -69,17 +57,13 @@
</template>
<script setup>
import {
onLoad,
onShow,
onUnload,
} from '@dcloudio/uni-app';
import {
computed,
reactive,
ref,
watch
} from 'vue';
import { onLoad, onShow, onUnload, } from '@dcloudio/uni-app'
import { computed, reactive, ref, watch } from 'vue'
import commodity from '../components/commodity.vue'
import go from '@/commons/utils/go.js'
import {
userlogout,
douyincheckIn,
@ -87,33 +71,50 @@
searchstorestatus, //
getuisdk //uisdk
} 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 subsectioncurrent = ref(0);
const subsectionlist = ref(['美团', '抖音']);
const sectionChange = (index) => {
subsectioncurrent.value = index;
uni.setStorageSync('clint_type', index + 1)
}
//
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 = () => {
uni.scanCode({ //
success: (res) => {
@ -123,15 +124,10 @@
}
});
}
//
const qrcodes = reactive({
val: 'www.baidu.com',
icon: '@/static/logo.png',
show: false
})
//
/**
* 首先获取状态
*/
let confirms = async () => {
if (object_id.value == null) {
uni.showToast({
@ -143,14 +139,30 @@
let res = await searchstorestatus()
// status == 0 ==1
if (res.status == 0) {
qrcodes.val = await getuisdk()
overlayshow.value = false
qrcodes.show = true
uni.showModal({
title: '首次核销需要绑定店铺,是否绑定',
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 {
clickkeep()
}
}
//
/**
* 点击确定去核销
*/
const clickkeep = async () => {
let data = null
if (uni.getStorageSync('clint_type') == 1) {
@ -166,26 +178,15 @@
overlayshow.value = false
refcommodity.value.open(res)
}
//
// const dialogsref = ref(null)
// const dialogconfirm = () => {
// dialogsref.value.open()
// }
//
const refcommodity = ref(null)
//
/**
* 跳转
*/
const clickpath = (URL, title) => {
uni.setStorageSync('clint_type', title)
go.to(URL)
}
onShow(async () => {})
//
onUnload(async () => {
// 退
await userlogout()
})
</script>
<style lang="scss" scoped>

View File

@ -1,17 +1,5 @@
<template>
<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 class="bottomconstant" v-for="(item,index) in form.list" :key="index">
@ -89,22 +77,13 @@
</template>
<script setup>
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app';
import {
computed,
reactive,
ref,
watch
} from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import { computed, reactive, ref, watch } from 'vue';
import dayjs from "dayjs";
import {
orderlist,
fulfilmentcertificatecanceles
} from '@/http/php/api.ts';
import { orderlist, fulfilmentcertificatecanceles } from '@/http/php/api.ts';
//
onReachBottom(() => {
if (form.status != 'nomore') {
@ -116,6 +95,7 @@
form.type = uni.getStorageSync('clint_type')
initial()
})
const dropdownvalue = ref(1)
const optionsdropdown = [{
label: '等待验证',
@ -149,6 +129,10 @@
count: '',
date: ''
});
/**
* 获取记录数据
*/
const getlist = async () => {
let data = null
if (uni.getStorageSync('clint_type') == 1) {
@ -196,6 +180,10 @@
}, 500)
}
}
/**
* 是否撤销核销
*/
const clickcancel = async (item) => {
uni.showModal({
title: '确认撤销吗?',
@ -226,7 +214,6 @@
}
})
}
</script>