更换正式环境,测试修改

This commit is contained in:
GaoHao 2025-03-25 21:49:33 +08:00
parent f01bc839f7
commit 7fe5d028e4
71 changed files with 930 additions and 2016 deletions

View File

@ -6,13 +6,15 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
import { onLaunch } from '@dcloudio/uni-app'; import { onLaunch } from '@dcloudio/uni-app';
import { getVersion } from '@/http/api/index.js' import { getVersion } from '@/http/api/index.js'
import appConfig from '@/config/appConfig.js'; import appConfig from '@/config/appConfig.js';
import { provide } from 'vue'; import { provide,onMounted } from 'vue';
import WebsocketUtil from '@/commons/utils/websocket.js' import WebsocketUtil from '@/commons/utils/websocket.js'
const websocketUtil = new WebsocketUtil(appConfig.wss, 5000); // WebSocket const websocketUtil = new WebsocketUtil(appConfig.wss, 5000); // WebSocket
provide('websocketUtil', websocketUtil); // provide('websocketUtil', websocketUtil); //
onMounted(() => {
});
onLaunch(() => { onLaunch(() => {
let that = this let that = this
uni.hideTabBar() uni.hideTabBar()

View File

@ -43,21 +43,35 @@ export const $invoicingType = [{
value: '' value: ''
}, },
{ {
text: '供应商入库', text: '手动入库',
value: 'purveyor' value: 'manual-in'
}, },
{ {
text: '供应商退货', text: '手动出库',
value: 'reject' value: 'manual-out'
}, },
{ {
text: '其他入库', text: '盘盈入库',
value: 'purchase' value: 'win-in'
}, },
{ {
text: '其他出库', text: '盘亏出库',
value: 'loss-out'
},
{
text: '订单退款入库',
value: 'other-out' value: 'other-out'
},
{
text: '订单消费出库',
value: 'order-out'
},
{
text: '损耗出库',
value: 'damage-out'
} }
] ]
// 页面常用数据 // 页面常用数据

View File

@ -0,0 +1,19 @@
export const directive = {
vOnlyNumber : {
mounted(el) {
// 当元素挂载时设置事件监听器
el.addEventListener('input', (event) => {
// 使用正则表达式只允许数字通过
event.target.value = event.target.value.replace(/[^\d]/g, '');
});
},
// 如果需要处理组件更新后的情况,可以添加 updated 钩子
updated(el) {
el.addEventListener('input', (event) => {
event.target.value = event.target.value.replace(/[^\d]/g, '');
});
}
}
}

View File

@ -20,14 +20,10 @@ export function canTuiKuan(orderInfo, item) {
if( item ){ if( item ){
return (orderInfo.status == 'done' || orderInfo.status == 'part_refund') return (orderInfo.status == 'done' || orderInfo.status == 'part_refund')
&& item.status != 'return' && item.status != 'refund' && item.status != 'refunding' && item.status != 'return' && item.status != 'refund' && item.status != 'refunding'
&& (item.returnAmount < item.num*item.unitPrice) && (item.returnNum < item.num)
} else { } else {
let goodsList = []
let data = false; let data = false;
Object.entries(orderInfo.detailMap).map(([key, value]) => ( uni.$utils.objToArrary(orderInfo.detailMap).some((v,i)=>{
goodsList = [...goodsList,...value]
))
goodsList.some((v,i)=>{
if( orderInfo.refundAmount < orderInfo.payAmount || (orderInfo.status == 'done' || orderInfo.status == 'part_refund' ) && v.status != 'return' && v.status != 'refund' && v.status != 'refunding' && (v.returnNum+v.refundNum < v.num) ){ if( orderInfo.refundAmount < orderInfo.payAmount || (orderInfo.status == 'done' || orderInfo.status == 'part_refund' ) && v.status != 'return' && v.status != 'refund' && v.status != 'refunding' && (v.returnNum+v.refundNum < v.num) ){
data = true data = true
return data return data

View File

@ -16,8 +16,26 @@ export const utils = {
* 限制金额输入格式 * 限制金额输入格式
* @param {Object} e * @param {Object} e
*/ */
isPrice (e) { isMoney (e) {
return e.replace(/[^0-9.]/g, '').replace(/\.{2,}/g, "").replace(/^\./, '') return e.toString().replace(/[^0-9.]/g, '').replace(/^\./g, "").replace(".", "$#$").replace(/\./g, "").replace("$#$", ".").replace(/^(\-)*(\d+)\.(\d{0,2}).*$/, "$1$2.$3")
},
/**
* 判断菜品使用价格
* @param {Object} e
*/
isGoodsPrice(item,user) {
let isVip = uni.getStorageSync("shopInfo").isMemberPrice&&user.id&&user.isVip
let memberPrice = item.memberPrice ? item.memberPrice : item.price;
let price = isVip ? memberPrice : item.price;
price = item.discountSaleAmount ? item.discountSaleAmount : price
return price;
},
inputReg(value,key,regName){
//判断regList对象是否存在属性 避免报错
// utils.hasOwnProperty.call(utils,regName)&&(form[key]=utils[regName](value))
}, },
/** /**
@ -138,6 +156,27 @@ export const utils = {
} }
} }
} }
} },
/**
* 对象转数组
* @param {Object} e
*/
objToArrary (obj) {
if (Object.values(obj) && Array.isArray(Object.values(obj)[0])){
// 是数组
let arr = []
Object.values(obj).forEach(item=>{
arr = [...arr,...item]
})
return arr
} else {
// 不是数组
return Object.keys(obj).map(key => obj[key])
}
},
} }

View File

@ -1,7 +0,0 @@
export const objToArrary = (obj,keyNewName) => {
return Object.entries(obj).map(([key, value]) => ({
key,
[keyNewName]:key,
...value,
}))
}

View File

@ -68,7 +68,7 @@ class WebsocketUtil {
} }
this.heartbeatInterval = setInterval(() => { this.heartbeatInterval = setInterval(() => {
if (this.isOpen) { if (this.isOpen) {
this.send(JSON.stringify({"type": "ping_interval"})); this.send(JSON.stringify({"type": "ping_interval","set": "onboc"}));
} }
}, this.time); }, this.time);
} }

View File

@ -0,0 +1,97 @@
<template>
<view class="p-wrapper">
<input class="p-input" type="number" v-model="info" :focus="vdata.isFoucs" :maxlength="num" @input="inputChange" />
<view class="p-main" :style="{ margin: margin }">
<div class="p-number flex-center" v-for="v in num" :key="v" :class="{ 'p-active': v <= info.length }"></div>
</view>
</view>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
const emits = defineEmits(['inputChange'])
const props = defineProps({
focus: { type: Boolean, default: false }, // false
num: { type: Number, default: 6 }, //
margin: { type: String }, //
})
const info = ref('')
const vdata = reactive({
isFoucs: false
})
onMounted(() => {
// 怀 nextTick使
// 1. 2. input.
if(props.focus){
setTimeout(() => {vdata.isFoucs = true}, 500)
}
})
const clearInput = () => (info.value = '')
const inputChange = () => {
emits('inputChange', info.value)
}
defineExpose({ clearInput })
</script>
<style lang="scss" scoped>
.p-wrapper {
position: relative;
width: 100%;
height: 80rpx;
overflow: hidden;
&::after {
content: '';
display: block;
position: absolute;
top: 0;
left: 0;
z-index: 10;
width: 95rpx;
height: 100%;
}
&::before {
content: '';
display: block;
position: absolute;
top: 0;
right: 0;
z-index: 10;
width: 95rpx;
height: 100%;
}
.p-input {
position: absolute;
top: 10%;
left: -100vw;
right: 0;
opacity: 0;
color: transparent;
caret-color: transparent;
}
.p-main {
display: flex;
justify-content: space-between;
margin: 0 95rpx;
.p-number {
width: 80rpx;
height: 80rpx;
border-radius: 12rpx;
background-color: #f2f2f2;
}
.p-active::after {
content: '';
display: block;
width: 20rpx;
height: 20rpx;
border-radius: 50%;
background-color: #000;
}
}
}
</style>

View File

@ -67,16 +67,18 @@
form.discount = (newval*100/form.price).toFixed(2) form.discount = (newval*100/form.price).toFixed(2)
} }
function discountInput(newval){ function discountInput(newval){
form.currentPrice=(form.price*newval/100).toFixed(2) form.currentPrice= uni.$utils.isMoney(form.price*newval/100).toFixed(2)
} }
function currentPriceChange(newval){ function currentPriceChange(newval){
if(newval<0){ if(newval<0){
form.currentPrice=0 form.currentPrice = '0.00'
form.discount=100 form.discount=100
return infoBox.showToast('实收金额不能小于0') return infoBox.showToast('实收金额不能小于0')
} }
if(newval>props.price){ console.log(props.price)
form.currentPrice=props.price console.log(newval)
if(newval > props.price){
form.currentPrice = (uni.$utils.isMoney(props.price)*1).toFixed(2)
form.discount=0 form.discount=0
return infoBox.showToast('实收金额不能大于应付金额') return infoBox.showToast('实收金额不能大于应付金额')
} }
@ -95,7 +97,7 @@
} }
const $form = { const $form = {
price:props.price, price: props.price,
currentPrice: props.price, currentPrice: props.price,
discount: 100 discount: 100
} }
@ -103,7 +105,7 @@
...$form ...$form
}) })
watch(()=>props.price,(newval)=>{ watch(()=>props.price,(newval)=>{
form.price=newval form.price = (newval*1).toFixed(2)
form.currentPrice=newval form.currentPrice=newval
}) })
function resetForm() { function resetForm() {
@ -116,9 +118,10 @@
function open() { function open() {
model.value.open() model.value.open()
form.price=props.price form.price= (props.price*1).toFixed(2)
form.discount=props.discount form.discount=props.discount
form.currentPrice=(props.discount*props.price/100).toFixed(2) form.currentPrice=(props.discount*props.price/100).toFixed(2)
console.log(form)
} }
function close() { function close() {

View File

@ -63,9 +63,7 @@
function FileUploadselect(e) { function FileUploadselect(e) {
for (let i in e.tempFiles) { for (let i in e.tempFiles) {
const file = e.tempFiles[i] const file = e.tempFiles[i]
console.log(e)
uploadFile(file).then(res => { uploadFile(file).then(res => {
console.log(res);
imgList.value.push({ imgList.value.push({
url: res, url: res,
path: file.path path: file.path
@ -104,7 +102,6 @@
} }
function change() { function change() {
console.log(getFileList());
emits('change', getFileList()) emits('change', getFileList())
} }
defineExpose({ defineExpose({

View File

@ -10,7 +10,8 @@ const appConfig = {
// 环境变量相关 // 环境变量相关
env: {}, env: {},
wss: "wss://sockets.sxczgkj.com/wss", // wss: "wss://sockets.sxczgkj.com/wss", //测试环境
wss: "wss://czgeatws.sxczgkj.com/wss", //正式环境
// 环境变量常量 // 环境变量常量
ENV_ENUM: { ENV_ENUM: {
DEVELOPMENT: 'development', // 本地调试地址 DEVELOPMENT: 'development', // 本地调试地址

View File

@ -139,6 +139,33 @@ export function productReportDamage(data, urlType = 'product') {
}) })
} }
/**
* 商品商品-修改库存
* @returns
*/
export function productModifyStock(data, urlType = 'product') {
return request({
url: `${urlType}/admin/product/modifyStock`,
method: "POST",
data: {
...data
}
})
}
/**
* 商品-库存变动记录
* @returns
*/
export function productStockFlow(data, urlType = 'product') {
return request({
url: `${urlType}/admin/product/stockFlow`,
method: "GET",
data: {
...data
}
})
}
// 商品分类---------------------------------------------------------------------------------------------------- // 商品分类----------------------------------------------------------------------------------------------------
/** /**

View File

@ -22,13 +22,14 @@ import { reject } from 'lodash';
let baseUrl = '/api/' let baseUrl = '/api/'
// #endif // #endif
// #ifndef H5 // #ifndef H5
let baseUrl = 'https://tapi.cashier.sxczgkj.cn/' // let baseUrl = 'https://tapi.cashier.sxczgkj.cn/'
// #endif
//预发布 //预发布
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn' // let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
//正式 //正式
// let baseUrl = 'https://cashieradmin.sxczgkj.cn' let baseUrl = 'https://cashier.sxczgkj.com/'
// #endif
const loadingShowTime = 200 const loadingShowTime = 200

View File

@ -4,6 +4,7 @@ import envConfig from '@/env/config.js'
import appConfig from '@/config/appConfig.js' import appConfig from '@/config/appConfig.js'
import storageManage from '@/commons/utils/storageManage.js' import storageManage from '@/commons/utils/storageManage.js'
import {utils} from '@/commons/utils/index.js' import {utils} from '@/commons/utils/index.js'
import {directive} from '@/commons/utils/directive.js'
import uviewPlus from 'uview-plus' import uviewPlus from 'uview-plus'
// 设置node环境 // 设置node环境
@ -38,6 +39,8 @@ export function createApp() {
app.config.globalProperties.$utils = utils app.config.globalProperties.$utils = utils
uni.$utils = utils uni.$utils = utils
// 全局注册指令
app.directive('only-number', directive.vOnlyNumber);
return { return {
app app
} }

View File

@ -7,7 +7,7 @@
</view> </view>
<view class="boxconstantbox_tow"> <view class="boxconstantbox_tow">
<text>用户消费结账时成功充值</text> <text>用户消费结账时成功充值</text>
<input class="text" type="number" v-model="form.rechargeTimes" /> <input class="text" type="digit" v-model="form.rechargeTimes" @change="form.rechargeTimes = $utils.isMoney(form.rechargeTimes)"/>
<text>倍的金额本单即可享受免单</text> <text>倍的金额本单即可享受免单</text>
</view> </view>
</view> </view>
@ -17,7 +17,10 @@
</view> </view>
<view class="boxconstantbox_tow"> <view class="boxconstantbox_tow">
<text>订单支付金额需满</text> <text>订单支付金额需满</text>
<input class="text" type="number" v-model="form.rechargeThreshold"></input> <input class="text" type="digit" v-model="form.rechargeThreshold" @change="form.rechargeThreshold = $utils.isMoney(form.rechargeThreshold)"></input>
<!-- <input class="text" type="digit" v-model="form.rechargeThreshold" @input="form.rechargeThreshold = 2"></input> -->
<!-- <input class="text" type="digit" v-model.lazy="form.rechargeThreshold" @input="form.rechargeThreshold = $utils.debounce($utils.isMoney(form.rechargeThreshold))"></input> -->
<!-- <input class="text" type="digit" v-model="form.rechargeThreshold" @input="form.rechargeThreshold = $utils.isMoney(form.rechargeThreshold)"></input> -->
<text> 才能使用</text> <text> 才能使用</text>
</view> </view>
</view> </view>
@ -44,7 +47,7 @@
</template> </template>
<script setup> <script setup>
import { onShow, } from '@dcloudio/uni-app'; import { onShow ,onLoad} from '@dcloudio/uni-app';
import { reactive, ref, watch } from 'vue'; import { reactive, ref, watch } from 'vue';
import { getFreeDing, updateFreeDing } from '@/http/api/freeDing.js' import { getFreeDing, updateFreeDing } from '@/http/api/freeDing.js'
@ -54,11 +57,12 @@
enable: false, enable: false,
rechargeDesc: '', rechargeDesc: '',
}); });
onLoad(()=>{
// uni.$utils.inputReg.bind()()
})
onShow(() => { onShow(() => {
getlist() getlist()
}) })
/** /**
* 获取配置信息 * 获取配置信息
*/ */

View File

@ -145,9 +145,6 @@
* @param {Object} key * @param {Object} key
*/ */
function onfileChange(val, data, key) { function onfileChange(val, data, key) {
console.log(val)
console.log(data)
console.log(key)
data[key] = val data[key] = val
} }

View File

@ -19,7 +19,7 @@
<my-model desc="请确保此分类下没有任何商品确认删除?" ref="delModel" @confirm="delModelConfirm"></my-model> <my-model desc="请确保此分类下没有任何商品确认删除?" ref="delModel" @confirm="delModelConfirm"></my-model>
<!-- 分类修改排序弹窗 --> <!-- 分类修改排序弹窗 -->
<my-model ref="goodsSortModel" title="修改排序" @close="goodsSortModelClose"> <my-model ref="goodsSortModel" title="修改排序" >
<template #desc> <template #desc>
<view class="u-p-40 u-text-left"> <view class="u-p-40 u-text-left">
<view> <view>

View File

@ -20,112 +20,96 @@
<view> 预警值 </view> <view> 预警值 </view>
<view> <input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id=""> </view> <view> <input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id=""> </view>
</view> </view>
<view style="justify-content: space-between;"> <view v-if="!datas.form.id" style="justify-content: space-between;">
<view> 耗材类型 </view> <view> 耗材类型 </view>
<view style="width: 54%;" @tap="datas.showStatus = !datas.showStatus"> <view style="width: 54%;" @tap="datas.show = !datas.show">
{{datas.typelist[datas.nowStatusIndex]}} {{datas.consGroupName||'请选择耗材类型'}}
</view> </view>
<uni-icons type="bottom" size="16"></uni-icons> <uni-icons type="bottom" size="16"></uni-icons>
</view> </view>
</view> </view>
</view> </view>
<view :style="{height:datas.showStatus?statusHeight:0}" class="tranistion status overflow-hide">
<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
v-for="(item,index) in datas.typelist" :key="index">
<view :class="{'color-main':datas.nowStatusIndex===index}">{{item}}</view>
<uni-icons v-if="datas.nowStatusIndex===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
</view>
<view :style="{height: '14px'}"></view>
</view>
<view class="bottombutton"> <view class="bottombutton">
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true" <up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
text="保存"></up-button> text="保存"></up-button>
</view> </view>
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show=false" @confirm="confirmConsGroup" ></up-picker>
<!-- 消息提示 --> <!-- 消息提示 -->
<up-toast ref="uToastRef"></up-toast> <up-toast ref="uToastRef"></up-toast>
</template> </template>
<script setup> <script setup>
import { import { reactive } from 'vue';
reactive, import { onLoad } from '@dcloudio/uni-app';
computed,
onMounted, import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js';
getCurrentInstance
} from 'vue';
import {
tbConsTypeList,
tbConsInfoAddlist
} from '@/http/yskApi/requestAll.js';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import { getConsGrpupList,addCons } from '@/http/api/cons.js';
let datas = reactive({ let datas = reactive({
show: false,
form: { form: {
conWarning: 999 conUnit: '',
conName: '',
price: '',
conWarning: 999,
consGroupId: null,
}, },
showStatus: false, consGroupName: '',
list: [], typeList: [],
typelist: [],
nowStatusIndex: 0
}) })
onMounted(() => { onLoad((options) => {
gettbConsTypeList() if( options && options.item ) {
let obj = JSON.parse(options.item)
datas.form = obj
} else {
gettbConsTypeList()
}
uni.setNavigationBarTitle({
title: !datas.form.id ? '添加耗材' : '编辑耗材'
})
}) })
/** /**
* 获取耗材类别 * 获取耗材类别
*/ */
let gettbConsTypeList = () => { let gettbConsTypeList = () => {
datas.typelist = []
getConsGrpupList({ getConsGrpupList({
page: 0, page: 1,
size: 30, size: 30,
shopId: uni.getStorageSync("shopId"),
}).then(res => { }).then(res => {
datas.list = res datas.typeList = [res]
res.forEach(ele => {
datas.typelist.push(ele.name)
})
}) })
} }
const refs = getCurrentInstance()
let sumbit = () => { function confirmConsGroup(e){
datas.show = false
datas.form.consGroupId = e.value[0].id
datas.consGroupName = e.value[0].name
}
let sumbit = async () => {
let conUnitdata = datas.form.conUnit.replace(/(^\s*)|(\s*$)/g, "") let conUnitdata = datas.form.conUnit.replace(/(^\s*)|(\s*$)/g, "")
if (!conUnitdata) { if (!conUnitdata) {
refs.ctx.$refs.uToastRef.show({ uni.$utils.showToast('单位不能为空')
type: 'default',
message: "单位不能为空"
})
return return
} }
if (!datas.form.price) { if (!datas.form.price) {
refs.ctx.$refs.uToastRef.show({ uni.$utils.showToast('价格不能为空')
type: 'default',
message: "价格不能为空"
})
return return
} }
console.log(datas.list, 'tiaoshi1') if (!datas.form.consGroupId) {
console.log(datas.list[datas.nowStatusIndex], 'tiaoshi1') uni.$utils.showToast('耗材类型不能为空')
addCons({ return
...datas.form, }
shopId: uni.getStorageSync("shopId"), if ( !datas.form.id) {
consGroupId: datas.list[datas.nowStatusIndex].id await addCons({...datas.form})
}).then(res => { } else {
// go.to('PAGES_SALES_CONSUMABLES') await editCons({...datas.form})
go.back() }
}) uni.navigateBack()
} }
const statusHeight = computed(() => {
return 30 * datas.typelist.length + 14 + 'px'
})
function changeNowStatusIndex(i) {
datas.nowStatusIndex = i
datas.showStatus = false
}
</script> </script>
<style> <style>
page { page {

View File

@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<view class="addType"> <view class="addType">
<view v-for="item in datas.list"> <view v-for="(item,index) in datas.list" :key="index">
<view class=""> <view class="">
{{item.name}}<up-icon color="#64A7FE" name="edit-pen" @tap="showoneEvent(item)"></up-icon> {{item.name}}<up-icon color="#64A7FE" name="edit-pen" @tap="showoneEvent(item)"></up-icon>
</view> </view>

View File

@ -2,44 +2,24 @@
<view class="warehouseEntry"> <view class="warehouseEntry">
<view> <view>
<view> <view>
<view> <view><text style="color: red;">*</text>供应商</view>
<text style="color: red;">*</text> 供应商 <view><input type="text" placeholder="请输入供应商名称" v-model="datas.form.name" name="" id=""></view>
</view>
<view>
<input type="text" placeholder="请输入供应商名称" v-model="datas.form.name" name="" id="">
</view>
</view> </view>
<view> <view>
<view> <view><text style="color: red;">*</text>联系电话</view>
<text style="color: red;">*</text> 联系电话 <view><input type="text" placeholder="请输入联系电话" v-model="datas.form.telephone" name="" id=""></view>
</view>
<view>
<input type="text" placeholder="请输入联系电话" v-model="datas.form.telephone" name="" id="">
</view>
</view> </view>
<view> <view>
<view> <view><text style="color: red;">*</text>地址</view>
<text style="color: red;">*</text> 地址 <view><input type="text" placeholder="请输入地址" v-model="datas.form.address" name="" id=""></view>
</view>
<view>
<input type="text" placeholder="请输入地址" v-model="datas.form.address" name="" id="">
</view>
</view> </view>
<view> <view>
<view> <view><text style="color: red;">*</text>排序</view>
<text style="color: red;">*</text> 排序 <view><input type="number" placeholder="请输入排序" @change="datas.form.sort=$utils.isNumber(datas.form.sort)" v-model="datas.form.sort" name="" id=""></view>
</view>
<view>
<input type="number" placeholder="请输入排序" @change="datas.form.sort=$utils.isNumber(datas.form.sort)" v-model="datas.form.sort" name="" id="">
</view>
</view> </view>
<view> <view>
<view> <view>备注</view>
备注 <view><input type="text" placeholder="请输入备注" v-model="datas.form.remark" name="" id=""></view>
</view>
<view>
<input type="text" placeholder="请输入备注" v-model="datas.form.remark" name="" id="">
</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -27,7 +27,7 @@
<view class="reportDamage_cell"> <view class="reportDamage_cell">
<view class="cell_lable">报损图片</view> <view class="cell_lable">报损图片</view>
<view class="cell_value file"> <view class="cell_value file">
<view class="file_img" v-for="(item,index) in vdata.imgUrlList"> <view class="file_img" v-for="(item,index) in vdata.imgUrlList" :key="index">
<up-image class="file_img_item" :show-loading="true" :src="item"></up-image> <up-image class="file_img_item" :show-loading="true" :src="item"></up-image>
<view class="del" @tap="del(index)"> <view class="del" @tap="del(index)">
<up-icon name="trash" color="#fff" size="25" @tap="plus"></up-icon> <up-icon name="trash" color="#fff" size="25" @tap="plus"></up-icon>

View File

@ -1,122 +0,0 @@
<template>
<view class="topTitle">
耗材信息
</view>
<view class="addConsumables">
<view>
<view>
<view> 单位 </view>
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id=""> </view>
</view>
<view>
<view> 耗材名称 </view>
<view> <input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id=""> </view>
</view>
<view>
<view> 耗材价格 </view>
<view> <input class="uni-input" placeholder="请输入耗材价格" type="number" v-model="datas.form.price"> </view>
</view>
<view>
<view> 预警值 </view>
<view> <input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id=""> </view>
</view>
</view>
</view>
<view class="bottombutton">
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
text="保存"></up-button>
</view>
</template>
<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';
let datas = reactive({
form: {
conWarning: 999
},
})
onLoad((options) => {
let obj = JSON.parse(options.item)
datas.form = obj
})
let sumbit = () => {
editCons(datas.form).then(res => {
go.back()
})
}
</script>
<style>
page {
background-color: #f9f9f9;
}
</style>
<style scoped lang="less">
.topTitle {
font-weight: 400;
font-size: 32rpx;
color: #333333;
margin: 32rpx 28rpx;
}
.addConsumables {
width: 694rpx;
height: 540rpx;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
margin: 32rpx;
padding: 1rpx 24rpx;
box-sizing: border-box;
>view {
>view {
width: 646rpx;
height: 84rpx;
background: #fcfcfc;
border: 2rpx solid #F9F9F9;
margin-top: 32rpx;
.df;
>view:first-child {
width: 190rpx;
height: 84rpx;
line-height: 84rpx;
// text-align: left;
padding-left: 24rpx;
background: #F9F9F9;
border-radius: 8rpx 0rpx 0rpx 8rpx;
border: 2rpx solid #F9F9F9;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 32rpx;
color: #333333;
}
}
}
}
.bottombutton {
margin-top: 84rpx;
padding: 0 24rpx;
>button {
width: 530rpx;
height: 80rpx;
border-radius: 56rpx 56rpx 56rpx 56rpx;
}
}
.df() {
display: flex;
align-items: center;
}
</style>

View File

@ -1,27 +1,18 @@
<template> <template>
<view class="ConsumablesTop"> <view class="ConsumablesTop">
<view @tap="showStatus = !showStatus" style="display: flex;align-items: center;"> <view @tap="pageData.show = !pageData.show" style="display: flex;align-items: center;">
{{datas.title}}<up-icon name="arrow-down" size="12"></up-icon> {{pageData.title}}<up-icon name="arrow-down" size="12"></up-icon>
</view> </view>
<view> <view>
<input v-model="datas.conName" @input="inputEvent" type="text" placeholder="请输入耗材名称" /> <input v-model="pageData.query.conName" @input="inputEvent" type="text" placeholder="请输入耗材名称" />
</view> </view>
<view @tap="toUrl('PAGES_ADD_TYPE') "> <view @tap="toUrl('PAGES_ADD_TYPE') ">
新增类别 新增类别
</view> </view>
</view> </view>
<view :style="{height:showStatus?statusHeight:0}" class="tranistion status overflow-hide"> <view class="ConsumablesConent" v-if="pageData.list.length">
<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between" <view v-for="(item,index) in pageData.list" :key="index">
v-for="(item,index) in datas.typeLists" :key="index">
<view :class="{'color-main':nowStatusIndex===index}">{{item}}</view>
<uni-icons v-if="nowStatusIndex===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
</view>
<view :style="{height: '14px'}"></view>
</view>
<view class="ConsumablesConent" v-if="datas.list.length">
<view v-for="(item,index) in datas.list" :key="index">
<view> {{item.conName}} <view> {{item.conName}}
<view> {{item.consGroupName}} </view> <view> {{item.consGroupName}} </view>
</view> </view>
@ -59,7 +50,6 @@
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')"> 新增耗材 </view> <view @tap="toUrl('PAGES_ADD_CONSUMABLES')"> 新增耗材 </view>
<view @tap="toUrl('PAGES_SUPPLIER')"> 供应商管理 </view> <view @tap="toUrl('PAGES_SUPPLIER')"> 供应商管理 </view>
</view> </view>
<my-action-sheet @itemClick="sheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
<my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage> <my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage>
<up-popup :show="show" :round="18" mode="center" > <up-popup :show="show" :round="18" mode="center" >
@ -74,69 +64,69 @@
</view> </view>
</view> </view>
</up-popup> </up-popup>
<up-action-sheet :round="10" @select="actionSelect" @close="actions.show = false" cancelText="取消" :actions="actions.list"
:show="actions.show"></up-action-sheet>
<up-picker :show="pageData.show" :columns="pageData.typeList" keyName="name" @cancel="pageData.show=false" @confirm="confirmConsGroup" ></up-picker>
</template> </template>
<script setup> <script setup>
import { onShow } from '@dcloudio/uni-app' import { onShow, onLoad } from '@dcloudio/uni-app'
import { ref, reactive, computed } from 'vue'; import { ref, reactive, computed } from 'vue';
import myActionSheet from './components/my-action-sheet';
import myReportDamage from './components/my-reportDamage'; import myReportDamage from './components/my-reportDamage';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { hasPermission } from '@/commons/utils/hasPermission.js'; import { hasPermission } from '@/commons/utils/hasPermission.js';
import { getConsPage,getConsGrpupList } from '@/http/api/cons.js'; import { getConsPage,getConsGrpupList } from '@/http/api/cons.js';
let reportDamage = ref(null) let reportDamage = ref(null)
let refMoreSheet = ref(null)
let show = ref(false) let show = ref(false)
let showData = ref() let showData = ref()
const report = reactive({ const report = reactive({
data: { data: {
// thumbnail: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240918/a17a62b7b55a4b65a2a2542050672b34.png',
name: "美式咖啡", name: "美式咖啡",
// title: "",
unit: "杯", unit: "杯",
}, },
}) })
let datas = reactive({ let pageData = reactive({
show: false,
query: {
conName: '',
consGroupId: '',
size: 100,
page: 1
},
list: [], list: [],
conName: "",
showtwo: false,
status: '0',
// //
typeList: [], typeList: [],
//
typeLists: ['全部'],
title: '耗材类型' title: '耗材类型'
}) })
const statusHeight = computed(() => {
return 30 * datas.typeLists.length + 14 + 'px' /**
* 更多操作列表
*/
const actions = reactive({
list: [
{ name: '报损', color: 'red', fontSize: '16' },
{ name: '编辑', color: '#333', fontSize: '16' },
{ name: '清点', color: '#333', fontSize: '16' },
{ name: '入库', color: '#333', fontSize: '16' },
{ name: '出库', color: '#333', fontSize: '16' },
],
data: null,
show: false,
}) })
const actionSheet = reactive({
list: ['报损', '编辑', '清点', '入库', '出库', ],
activeId: null,
active: ""
})
let showStatus = ref(false)
let nowStatusIndex = ref(0)
onShow(() => { onShow(() => {
getList() getList()
//
gettbConsTypeList() gettbConsTypeList()
}) })
/** /**
* 获取耗材列表 * 获取耗材列表
*/ */
async function getList(d = "") { async function getList() {
getConsPage({ getConsPage(pageData.query).then(res => {
conName: datas.conName, pageData.list = res.records
conTypeId: d,
size: 100,
page: 1
}).then(res => {
datas.list = res.records
}) })
} }
@ -144,27 +134,19 @@
* 获取耗材类别 * 获取耗材类别
*/ */
let gettbConsTypeList = () => { let gettbConsTypeList = () => {
datas.typeLists = ['全部']
getConsGrpupList({ getConsGrpupList({
page: 1, page: 1,
size: 30, size: 30,
}).then(res => { }).then(res => {
datas.typeList = res pageData.typeList = [[{name:'全部',id:''},...res]]
res.forEach(ele => {
datas.typeLists.push(ele.name)
})
}) })
} }
function changeNowStatusIndex(i) {
nowStatusIndex.value = i function confirmConsGroup(e){
showStatus.value = false pageData.show = false
if (i == 0) { pageData.query.consGroupId = e.value[0].id
datas.title = '全部' pageData.title = e.value[0].name
getList() getList()
} else {
datas.title = datas.typeList[i - 1].conTypeName
getList(datas.typeList[i - 1].id)
}
} }
/** /**
@ -181,62 +163,58 @@
} }
let toggle = (d) => { let toggle = (d) => {
refMoreSheet.value.open() // refMoreSheet.value.open()
actionSheet.active = d actions.show = true;
actionSheet.activeId = d.id actions.actions = d
report.data.consId = d.id report.data.consId = d.id
} }
let sheetClick = (index) => { let actionSelect = ( e ) => {
if (index == 0) { if ( e.name == '报损' ) {
// //
hasPermission('允许提交报损').then(ele => { hasPermission('允许提交报损').then(ele => {
if (ele) { if (ele) {
// //
reportDamage.value.open(actionSheet.activeId); reportDamage.value.open(actions.actions.id);
report.data.name = actionSheet.active.conName report.data.name = actions.actions.conName
report.data.unit = actionSheet.active.conUnit report.data.unit = actions.actions.conUnit
} }
}) })
} else if (index == 1) { } else if ( e.name == '编辑' ) {
toUrl('PAGES_EDIT_CONSUMABLES', { toUrl('PAGES_ADD_CONSUMABLES', {
item: JSON.stringify(actionSheet.active) item: JSON.stringify(actions.actions)
}) })
} else if (index == 2) { } else if ( e.name == '清点' ) {
hasPermission('允许耗材盘点').then(ele => { hasPermission('允许耗材盘点').then(ele => {
if (ele) { if (ele) {
toUrl('PAGES_SALES_INVENTORYCHECK', { toUrl('PAGES_SALES_INVENTORYCHECK', {
item: JSON.stringify(actionSheet.active) item: JSON.stringify(actions.actions)
}) })
} }
}) })
} else if (index == 3) { } else if ( e.name == '入库' ) {
hasPermission('允许耗材入库').then(ele => { hasPermission('允许耗材入库').then(ele => {
if (ele) { if (ele) {
toUrl('PAGES_SALES_WAREHOUSEENTRY', { toUrl('PAGES_SALES_WAREHOUSEENTRY', {
consId: actionSheet.activeId, consId: actions.actions.id,
item: JSON.stringify(actionSheet.active) item: JSON.stringify(actions.actions)
}) })
} }
}) })
} else if (index == 4) { } else if ( e.name == '出库' ) {
hasPermission('允许耗材出库').then(ele => { hasPermission('允许耗材出库').then(ele => {
if (ele) { if (ele) {
toUrl('PAGES_SALES_OUTBOUND', { toUrl('PAGES_SALES_OUTBOUND', {
consId: actionSheet.activeId, consId: actions.actions.id,
item: JSON.stringify(actionSheet.active) item: JSON.stringify(actions.actions)
}) })
} }
}) })
} }
} }
// async function viewpermission(d) {
// let res = await hasPermission(d)
// return res
// }
function inputEvent(d) { function inputEvent(d) {
datas.conName = d.detail.value.replace(/\s*/g, ""); pageData.query.conName = d.detail.value.replace(/\s*/g, "");
getList() getList()
} }

View File

@ -28,7 +28,7 @@
</view> </view>
<view> <view>
<view> <text style="color: red;">*</text>单价 </view> <view> <text style="color: red;">*</text>单价 </view>
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" @change="datas.form.bodyList.purchasePrice = $utils.isPrice(datas.form.bodyList.purchasePrice)" name="" id=""> </view> <view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" @change="datas.form.bodyList.purchasePrice = $utils.isMoney(datas.form.bodyList.purchasePrice)" name="" id=""> </view>
</view> </view>
<view style="justify-content: space-between;"> <view style="justify-content: space-between;">
<view> 单位 </view> <view> 单位 </view>
@ -97,6 +97,8 @@
// //
datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo] datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo]
datas.form.bodyList.unit=datas.form.defaultUnit datas.form.bodyList.unit=datas.form.defaultUnit
datas.form.bodyList.conName = datas.form.conName
datas.form.bodyList.unitName = datas.form.unitName
}) })
onShow(() => { onShow(() => {
getList() getList()

View File

@ -26,7 +26,7 @@
</view> </view>
<view> <view>
<view> <text style="color: red;">*</text>单价 </view> <view> <text style="color: red;">*</text>单价 </view>
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" @change="datas.form.bodyList.purchasePrice = $utils.isPrice(datas.form.bodyList.purchasePrice)" name="" id=""> </view> <view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" @change="datas.form.bodyList.purchasePrice = $utils.isMoney(datas.form.bodyList.purchasePrice)" name="" id=""> </view>
</view> </view>
<view style="justify-content: space-between;"> <view style="justify-content: space-between;">
<view> 单位 </view> <view> 单位 </view>
@ -99,6 +99,8 @@
// //
datas.unitList = [ datas.form.conUnit, datas.form.conUnitTwo] datas.unitList = [ datas.form.conUnit, datas.form.conUnitTwo]
datas.form.bodyList.unit = datas.form.defaultUnit datas.form.bodyList.unit = datas.form.defaultUnit
datas.form.bodyList.conName = datas.form.conName
datas.form.bodyList.unitName = datas.form.unitName
}) })
onShow(() => { onShow(() => {
getList() getList()
@ -161,13 +163,7 @@
}) })
return return
} }
if (!datas.list[nowStatusIndex.value]) {
refs.ctx.$refs.uToastRef.show({
type: 'default',
message: "供应商不能为空",
})
return
}
datas.form.bodyList.conId = datas.item.id datas.form.bodyList.conId = datas.item.id
datas.form.bodyList = [datas.form.bodyList] datas.form.bodyList = [datas.form.bodyList]
datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD') datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')

View File

@ -11,9 +11,9 @@
<view class="lable">使用门槛</view> <view class="lable">使用门槛</view>
<view class="value"> <view class="value">
<view></view> <view></view>
<input v-model="formData.fullAmount" @change="formData.fullAmount = $utils.isPrice(formData.fullAmount)" type="digit" placeholder="填写金额" border="none"></input> <input v-model="formData.fullAmount" @change="formData.fullAmount = $utils.isMoney(formData.fullAmount)" type="digit" placeholder="填写金额" border="none"></input>
<view></view> <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 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.isMoney(formData.discountAmount)" type="digit" placeholder="填写金额" border="none"></input> <view></view> </view>
</view> </view>
</view> </view>

View File

@ -10,7 +10,7 @@
<view class="item"> <view class="item">
<view class="lable">使用门槛</view> <view class="lable">使用门槛</view>
<view class="value"> <view class="value">
<view></view><input v-model="formData.fullAmount" @change="formData.fullAmount = $utils.isPrice(formData.fullAmount)" type="digit" placeholder="填写金额" border="none"></input><view>可用</view> <view></view><input v-model="formData.fullAmount" @change="formData.fullAmount = $utils.isMoney(formData.fullAmount)" type="digit" placeholder="填写金额" border="none"></input><view>可用</view>
</view> </view>
</view> </view>
<view class="item"> <view class="item">

View File

@ -44,8 +44,9 @@
</up-radio-group> </up-radio-group>
</view> </view>
</up-form-item> </up-form-item>
<up-form-item label="还款金额(¥)" prop="repaymentAmount"> <up-form-item label="还款金额(¥)" prop="repaymentAmount">
<up-input v-model="pageData.formData.repaymentAmount" type="number" placeholder="请输入金额" customStyle="padding: 0!important;"> <up-input v-model="pageData.formData.repaymentAmount" type="digit" @change="pageData.formData.repaymentAmount = $utils.isMoney(pageData.formData.repaymentAmount)" placeholder="请输入金额" customStyle="padding: 0!important;">
<template #prefix> <template #prefix>
<up-button color="#e5e5e5" customStyle="font-size:32rpx;color: #999;width: 124rpx;margin-right: 10rpx;" :hairline="false"></up-button> <up-button color="#e5e5e5" customStyle="font-size:32rpx;color: #999;width: 124rpx;margin-right: 10rpx;" :hairline="false"></up-button>
</template> </template>

View File

@ -215,7 +215,7 @@
getList() getList()
} }
let repaymentOpen = (item) => { let repaymentOpen = (item) => {
if ( item.repaymentMethod == 'total' ) { if ( pageData.repaymentMethod == 'total' ) {
return; return;
} }
repayment.value.open({creditBuyerId:pageData.query.creditBuyerId,order:item}); repayment.value.open({creditBuyerId:pageData.query.creditBuyerId,order:item});

View File

@ -16,7 +16,7 @@
<view class="content_list" v-if="pageData.list.length > 0"> <view class="content_list" v-if="pageData.list.length > 0">
<view class="list_cell" v-for="(item,index) in pageData.list" :key="item.id"> <view class="list_cell" v-for="(item,index) in pageData.list" :key="item.id">
<view><text class="paymentMethod">{{item.paymentMethod}}</text><text class="repaymentAmount">{{item.repaymentAmount}}</text></view> <view><text class="paymentMethod">{{item.paymentMethod}}</text><text class="repaymentAmount">{{item.repaymentAmount}}</text></view>
<view><text class="remark">{{item.remark||'-'}}</text><text class="createTime">{{item.createTime}}</text></view> <view style="align-items: flex-start;"><text class="remark">{{item.remark||'-'}}</text><text class="createTime" style="flex-shrink: 0;">{{item.createTime}}</text></view>
</view> </view>
</view> </view>
<view v-else style="display: flex;flex-direction: column;align-items: center;justify-content: center;margin-top: 300rpx;"> <view v-else style="display: flex;flex-direction: column;align-items: center;justify-content: center;margin-top: 300rpx;">

View File

@ -105,9 +105,7 @@
popShow.value = newval popShow.value = newval
if (newval) { if (newval) {
data.value = props.item data.value = props.item
console.log(props.item);
Object.assign(category,props.item) Object.assign(category,props.item)
console.log(props.item);
} }
}) })
const isSku = computed(() => { const isSku = computed(() => {

View File

@ -35,7 +35,6 @@
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import infoBox from "@/commons/utils/infoBox.js"
import myCategory from './components/category.vue' import myCategory from './components/category.vue'
import editSort from './components/edit-sort.vue'; import editSort from './components/edit-sort.vue';
import editName from './components/edit-name.vue'; import editName from './components/edit-name.vue';
@ -118,7 +117,6 @@
* @param {Object} e * @param {Object} e
*/ */
function actionsShow(e) { function actionsShow(e) {
console.log(e)
popup.selData = pageData.list[e] popup.selData = pageData.list[e]
popup.selIndex = e popup.selIndex = e
actions.show = true actions.show = true
@ -172,7 +170,7 @@
popup.name.show = false; popup.name.show = false;
popup.time.show = false; popup.time.show = false;
pageData.list[popup.selIndex] = e pageData.list[popup.selIndex] = e
infoBox.showToast('更新成功') uni.$utils.showToast('更新成功')
} }
/** /**
@ -183,7 +181,7 @@
const res = await updateProdGroup({ const res = await updateProdGroup({
...data ...data
}) })
infoBox.showToast('修改成功') uni.$utils.showToast('修改成功')
// init() // init()
} }
@ -234,7 +232,7 @@
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
delProdGroup(pageData.list[index].id).then(res => { delProdGroup(pageData.list[index].id).then(res => {
infoBox.showToast('删除成功') uni.$utils.showToast('删除成功')
setTimeout(()=>{ setTimeout(()=>{
getList() getList()
},1500) },1500)

View File

@ -1,7 +1,6 @@
<template> <template>
<view class="page-gray color-333 u-font-28"> <view class="page-gray color-333 u-font-28">
<view class="block"> <view class="block">
<!-- <up-popup :show="show" @close="close" @open="open"> -->
<picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType" <picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType"
:list="pageData.brandList"></picker-item> :list="pageData.brandList"></picker-item>
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType" <picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
@ -164,13 +163,14 @@
id: null, id: null,
sort: "0", sort: "0",
status: 1, status: 1,
contentType: '',
subType: '',
connectionType: "network", connectionType: "network",
printType: [], printType: [],
name: '', name: '',
receiptSize: '58mm', receiptSize: '58mm',
classifyPrint: '0', classifyPrint: '0',
printQty: 'm1^1', printQty: 'm1^1',
printType: ["refund", 'handover', 'queue'],
printMethod: "all", printMethod: "all",
selectcheckbox:[] selectcheckbox:[]
@ -218,7 +218,8 @@
res.selectcheckbox = arrs res.selectcheckbox = arrs
} }
form = Object.assign(form, res) form = Object.assign(form, res)
form.printType = JSON.parse(form.printType) if(form.printType)form.printType = JSON.parse(form.printType)
} }

View File

@ -76,7 +76,6 @@
}) })
const emit = defineEmits(['init']) const emit = defineEmits(['init'])
const delModel=ref(null) const delModel=ref(null)
console.log(props.data)
/** /**
* 编辑 * 编辑
*/ */

View File

@ -1185,8 +1185,6 @@
coverImg: v.coverImg || '' coverImg: v.coverImg || ''
} }
}) })
console.log(skuList.list);
}) })
} }

View File

@ -16,13 +16,9 @@
</template> </template>
<script setup> <script setup>
import { import { ref,reactive,watch,nextTick } from 'vue';
formatPrice import { formatPrice } from "@/commons/utils/format.js";
} from "@/commons/utils/format.js";
import {
ref,
watch,nextTick
} from 'vue';
const props = defineProps({ const props = defineProps({
inputType:{ inputType:{
type:String, type:String,
@ -48,8 +44,8 @@
default: '请输入' default: '请输入'
} }
}) })
let number = ref(props.modelValue)
let number = ref(props.modelValue*1)
function changeNumber(type) { function changeNumber(type) {
const newval = number.value + props.step * (type == 'add' ? 1 : -1) const newval = number.value + props.step * (type == 'add' ? 1 : -1)
if (newval < props.min) { if (newval < props.min) {
@ -63,12 +59,12 @@
function priceFormat(e) { function priceFormat(e) {
nextTick(() => { nextTick(() => {
const min = props const min = props.min;
.min;
const max = props.max; const max = props.max;
if (e === '') { if (e === '') {
return return
} }
console.log(e)
const newval = formatPrice(e, min, max, true) const newval = formatPrice(e, min, max, true)
if (typeof newval !== 'number') { if (typeof newval !== 'number') {
number.value = newval.value number.value = newval.value
@ -82,7 +78,7 @@
}) })
} }
watch(() => props.modelValue, (newval) => { watch(() => props.modelValue, (newval) => {
number.value = newval number.value = newval*1
}) })
const emits = defineEmits(['update:modelValue']) const emits = defineEmits(['update:modelValue'])
watch(() => number.value, (newval) => { watch(() => number.value, (newval) => {

View File

@ -110,6 +110,7 @@
const res= await productReportDamage(par) const res= await productReportDamage(par)
infoBox.showToast('提交成功!') infoBox.showToast('提交成功!')
popShow.value=false popShow.value=false
emits('save')
} }
</script> </script>

View File

@ -1,38 +1,13 @@
<template> <template>
<view class="control" :style="getComputedStyle()"> <view class="control" :style="getComputedStyle()">
<view class="u-flex control1" v-if="showControl1"> <view class="u-flex control1">
<!-- <view class="btn" @click="changeShowControl1">批量管理</view> -->
<view class="btn add font-bold u-font-28 color-fff" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view> <view class="btn add font-bold u-font-28 color-fff" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view>
<!-- <view class="color-999 btn u-flex u-row-center" @click="emitToggleCategory">
<text class="u-m-r-10">{{categoryName||'选择分类'}}</text>
<view class="arrow-down" :class="{'up':categoryShow}">
<uni-icons type="right" size="16" color="#999"></uni-icons>
</view>
</view> -->
</view>
<view class="u-flex control2 u-row-between" v-else>
<view class="u-flex btn">
<view class="u-m-r-58">
<label class="radio" @click="changeIsSelectAll">
<radio class="scale7" @tap.stop="changeIsSelectAll" :color="ColorMain" value="" :checked="isSelectAll" />
<text>全选</text>
</label>
</view>
<view class="u-p-l-30 u-p-r-30 my-bg-main" @click="changeShowControl1">取消</view>
<view class="u-p-l-60 u-p-r-60 borde-r" @click="offShelf">下架</view>
</view>
<view class=" u-flex u-row-center btn" @click="emitToggleCategory">
<text class="u-m-r-10">分类至</text>
<uni-icons type="right" size="16" color="#fff"></uni-icons>
</view>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import {$tbShopCategory} from '@/http/yskApi/goods.js'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import {ColorMain} from '@/commons/color.js'
import { import {
onMounted, onMounted,
reactive, reactive,
@ -43,53 +18,18 @@
type: [Number, String], type: [Number, String],
default: 30 default: 30
}, },
categoryName:{
type:String,
default:''
},
categoryShow:{
type:Boolean,
default:false
}
}) })
let showControl1 = ref(true) let showControl1 = ref(true)
const emits = defineEmits(['toggleCategory','controlChange','allCheckedChange','offShelf','categoryChange']) const emits = defineEmits(['toggleCategory','controlChange','allCheckedChange','offShelf','categoryChange'])
function emitToggleCategory() {
emits('toggleCategory')
}
function changeShowControl1() {
showControl1.value = !showControl1.value
emits('controlChange',!showControl1.value)
}
let isSelectAll = ref(false)
function changeIsSelectAll() {
isSelectAll.value = !isSelectAll.value
emits('allCheckedChange',isSelectAll.value)
}
function getComputedStyle() { function getComputedStyle() {
return { return {
bottom: props.bottom + 'rpx' bottom: props.bottom + 'rpx'
} }
} }
//
function setisSelectAll(checked){
isSelectAll.value =checked
}
defineExpose({
setisSelectAll
})
//
function offShelf(){
emits('offShelf')
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -15,8 +15,8 @@
<template v-if="!isSku"> <template v-if="!isSku">
<view class="u-m-b-32" > <view class="u-m-b-32" >
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view>{{data.name}}</view> <view class="up-line-1" style="width: 60%;">{{data.name}}</view>
<view class="u-font-24"> <view class="u-font-24" style="flex-shrink: 1;">
<text>变动数量</text> <text>变动数量</text>
<text class="number">{{data.stockNumber-data._stockNumber}}</text> <text class="number">{{data.stockNumber-data._stockNumber}}</text>
</view> </view>
@ -48,7 +48,7 @@
<view>{{item.name}}</view> <view>{{item.name}}</view>
<view class="u-font-24"> <view class="u-font-24">
<text>变动数量</text> <text>变动数量</text>
<text class="number">{{item.stockNumber-item._stockNumber}}</text> <text class="number">{{(item.stockNumber-item._stockNumber).toFixed(2)}}</text>
</view> </view>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
@ -110,21 +110,10 @@
</template> </template>
<script setup> <script setup>
import { import { reactive, ref, watch, onMounted, computed } from 'vue';
reactive,
ref, import { $invoicingType } from '@/commons/goodsData.js'
watch, import { productStockFlow } from '@/http/api/product.js'
onMounted,
computed
} from 'vue';
import {
returnSkuSnap,
returnTypeEnum,
returnCategory
} from '@/pageProduct/util.js'
import {
$tbShopUnit,$getProductStockDetail
} from '@/http/yskApi/goods.js'
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'
const refForm = ref(null) const refForm = ref(null)
const props = defineProps({ const props = defineProps({
@ -156,7 +145,6 @@
] ]
}) })
function toRecodes(){ function toRecodes(){
console.log(props.goods.id);
go.to('PAGES_PRODUCT_INVOICING_LIST',{ go.to('PAGES_PRODUCT_INVOICING_LIST',{
productId:props.goods.id productId:props.goods.id
}) })
@ -185,26 +173,27 @@
getProductStockDetail() getProductStockDetail()
} }
}) })
let getTypeName = (type) => {
let item = $invoicingType.filter(item=> item.value == type)[0]
return item?item.text:''
}
async function getProductStockDetail(){ async function getProductStockDetail(){
const {content}=await $getProductStockDetail({ const { records }=await productStockFlow({
page:0, page: 1,
size:2, size: 2,
productId:props.goods.id, productId: props.goods.id,
column:'/api/tbProductStockDetail/stock/count',
shopId:uni.getStorageSync('shopId'),
createdAt:[]
}) })
console.log(content); console.log(records);
recoders.list=content.map(v=>{ recoders.list = records.map(v=>{
return { return {
...v, ...v,
title:v.createdAt, title: v.createTime,
content:v.type+':'+Math.abs(v.stockNumber) content: getTypeName(v.inOutItem)+':'+Math.abs(v.inOutNumber)
} }
}) })
} }
const isSku = computed(() => { const isSku = computed(() => {
// return data.value.typeEnum == '' // return data.value.type == 'sku'
return false return false
}) })
watch(() => popShow.value, (newval) => { watch(() => popShow.value, (newval) => {
@ -223,6 +212,7 @@
refForm.value.validate().then(valid => { refForm.value.validate().then(valid => {
if (valid) { if (valid) {
emits('save', { emits('save', {
remark: form.note,
...data.value, ...data.value,
}) })
} else { } else {
@ -232,28 +222,7 @@
// //
}); });
} }
// function save() {
// const skuSnap = returnSkuSnap(data.value)
// let typeEnum = returnTypeEnum(data.value.typeEnum)
// let lowPrice = undefined
// typeEnum = typeEnum ? typeEnum : 'normal'
// const findCategory = returnCategory(data.value.categoryName, props.category)
// console.log(typeEnum);
// console.log(findCategory);
// const categoryId = findCategory ? findCategory.id : ''
// if (typeEnum == 'normal') {
// //
// lowPrice = data.value.skuList[0].salePrice
// }
// emits('save', {
// ...data.value,
// lowPrice,
// typeEnum,
// images: data.value.images ? data.value.images : [data.value.coverImg],
// categoryId,
// skuSnap: JSON.stringify(skuSnap)
// })
// }
onMounted(()=>{ onMounted(()=>{
// #ifndef H5 // #ifndef H5

View File

@ -12,7 +12,7 @@
</view> </view>
</view> </view>
<view> <view>
<text class="u-font-28 color-666" @click="changePrice">改价</text> <!-- <text class="u-font-28 color-666" @click="changePrice">改价</text> -->
<text class="u-font-28 color-red u-m-l-24" @click="baosun">报损</text> <text class="u-font-28 color-red u-m-l-24" @click="baosun">报损</text>
</view> </view>
</view> </view>
@ -90,7 +90,6 @@
</view> </view>
<view class="u-flex"> <view class="u-flex">
<!-- <view class="btn-default btn" @tap="xiajia">下架商品</view> --> <!-- <view class="btn-default btn" @tap="xiajia">下架商品</view> -->
<!-- <view class="btn-default btn" @tap="del">删除</view> -->
<view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view> <view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view>
</view> </view>
</view> </view>
@ -104,7 +103,7 @@
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import {hasPermission} from '@/commons/utils/hasPermission.js'; import {hasPermission} from '@/commons/utils/hasPermission.js';
import { ColorMain } from '@/commons/color.js' import { ColorMain } from '@/commons/color.js'
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update', const emits = defineEmits(['radioClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update',
'editStock' 'editStock'
]) ])
const props = defineProps({ const props = defineProps({
@ -145,7 +144,6 @@
const max=247; const max=247;
for(let i in props.data.skuList){ for(let i in props.data.skuList){
const sku=props.data.skuList[i] const sku=props.data.skuList[i]
console.log(sku)
width+=(fontSize*sku.specInfo.length+boxWith+gap) width+=(fontSize*sku.specInfo.length+boxWith+gap)
if(width>max){ if(width>max){
isOne=false isOne=false
@ -233,10 +231,6 @@
emits('radioClick', props.index) emits('radioClick', props.index)
} }
function changeClick() {
emits('changeClick', props.index)
}
function reportDamage () { function reportDamage () {
emits('reportDamage', props.index) emits('reportDamage', props.index)
} }

View File

@ -43,9 +43,9 @@
<template v-if="pageData.goodsList.length"> <template v-if="pageData.goodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index"> <view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" <my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow"
@changeClick="goodsChangeClick" @edit="toGoodsDetail" @editStock="changeStockShow" @edit="toGoodsDetail" @editStock="changeStockShow"
@guigeClick="editGuigeShow" @baosun="baosunShow" @radioClick="goodsRadioClick" :index="index" @guigeClick="editGuigeShow" @baosun="baosunShow" :index="index"
:data="item" @del="goodsDel" :showChecked="showChecked" :data="item"
:showDetail="pageData.showGoodsDetail"></my-goods> :showDetail="pageData.showGoodsDetail"></my-goods>
</view> </view>
</template> </template>
@ -61,39 +61,11 @@
</view> </view>
<my-control ref="control" :categoryShow="pageData.categoryShow" :categoryName="pageData.categoryName" <my-control ref="control" :categoryShow="pageData.categoryShow" :categoryName="pageData.categoryName"
@offShelf="offShelf" @allCheckedChange="allCheckedChange" @controlChange="controlChange" :bottom="pageData.componentBottom"></my-control>
@toggleCategory="toggleCategory" :bottom="pageData.componentBottom"></my-control>
<!-- <my-category ref="category" @change="onCategoryShowChange" @cateClick="cateClick"
:bottom="pageData.componentBottom+100"></my-category> -->
<!-- 下架弹窗 --> <!-- 下架弹窗 -->
<my-model :desc="pageData.modelDesc" ref="model" @confirm="modelConfirm"></my-model> <my-model :desc="pageData.modelDesc" ref="model" @confirm="modelConfirm"></my-model>
<!-- 商品库存修改弹窗 -->
<my-model ref="goodsStockModel" title="商品修改" @close="goodsStockModelClose">
<template #desc>
<view class="u-p-40 u-text-left">
<view>
<view class="">排序:</view>
<view class="u-m-t-24">
<uni-easyinput v-model="goodsStockData.orderBy" placeholder="请输入排序"></uni-easyinput>
</view>
</view>
<view class="u-flex u-m-t-32">
<view class="">库存开关:</view>
<view class="u-m-l-46 ">
<my-switch v-model="goodsStockData.isStock"></my-switch>
</view>
</view>
</view>
</template>
<template #btn>
<view class="stock-btns u-p-b-40">
<my-button shape="circle" @tap="goodsStockModelSave">保存</my-button>
<my-button shape="circle" type="default" @tap="goodsStockModelCancel">取消</my-button>
</view>
</template>
</my-model>
<!-- 分类 --> <!-- 分类 -->
<my-category v-model:isShow="pageData.categoryShow" @confirm="setCategory"></my-category> <my-category v-model:isShow="pageData.categoryShow" @confirm="setCategory"></my-category>
<!-- 修改价格弹窗 --> <!-- 修改价格弹窗 -->
@ -107,7 +79,7 @@
:goods="popup.guige.data"></edit-guige> :goods="popup.guige.data"></edit-guige>
<!-- 报损 --> <!-- 报损 -->
<baosun-vue :category="pageData.categoryList" v-model:show="popup.baosun.show" <baosun-vue :category="pageData.categoryList" v-model:show="popup.baosun.show"
:goods="pageData.selGoods"></baosun-vue> :goods="pageData.selGoods" @save="getGoodsList"></baosun-vue>
</view> </view>
</template> </template>
@ -115,34 +87,21 @@
<script setup> <script setup>
import { onLoad, onShow } from '@dcloudio/uni-app'; import { onLoad, onShow } from '@dcloudio/uni-app';
import { reactive, ref, watch } from 'vue'; import { reactive, ref, watch } from 'vue';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { hasPermission } from '@/commons/utils/hasPermission.js'; import { hasPermission } from '@/commons/utils/hasPermission.js';
import myGoods from './components/goods.vue' import myGoods from './components/goods.vue'
import myControl from './components/control.vue' import myControl from './components/control.vue'
import myCategory from './components/category.vue' import myCategory from './components/category.vue'
import infoBox from "@/commons/utils/infoBox.js"
import editPrice from './components/edit-price.vue'; import editPrice from './components/edit-price.vue';
import editGuige from './components/edit-guige.vue'; import editGuige from './components/edit-guige.vue';
import editStock from './components/edit-stock.vue'; import editStock from './components/edit-stock.vue';
import baosunVue from './components/baosun.vue'; import baosunVue from './components/baosun.vue';
import {
$updateProduct,
$getProductDetail,
$delProduct,
$tbShopCategory,
$updateProductStatus,
$tbProductV2,
$updateProductData
} from "@/http/yskApi/goods.js"
import {
getProductPage,
getCategoryList,
updateProduct
} from '@/http/api/product.js'
import { import { getProductPage, getCategoryList, updateProduct, productModifyStock } from '@/http/api/product.js'
returnAllCategory
} from '@/pageProduct/util.js' import { returnAllCategory } from '@/pageProduct/util.js'
const pageData = reactive({ const pageData = reactive({
modelDesc: '是否下架', modelDesc: '是否下架',
@ -181,8 +140,6 @@
const tabsList = ['简洁', '详情'] const tabsList = ['简洁', '详情']
const control = ref(null) const control = ref(null)
const model = ref(null) const model = ref(null)
const goodsStockModel = ref(null)
let reportDamage = ref(null) //
watch(() => pageData.query.categoryId, (newval) => { watch(() => pageData.query.categoryId, (newval) => {
getGoodsList() getGoodsList()
}) })
@ -250,7 +207,10 @@
}) })
} }
// /**
* 报损弹窗展示
* @param {Object} index
*/
function baosunShow(index) { function baosunShow(index) {
pageData.selGoodsIndex = index pageData.selGoodsIndex = index
const goods = pageData.goodsList[index] const goods = pageData.goodsList[index]
@ -290,7 +250,6 @@
* @param {Object} goods * @param {Object} goods
*/ */
async function changePriceConfirm(goods) { async function changePriceConfirm(goods) {
let goodsArr = [] let goodsArr = []
if (goods.type == 'sku') { if (goods.type == 'sku') {
goodsArr = goods.skuList.map(v => { goodsArr = goods.skuList.map(v => {
@ -313,13 +272,15 @@
}] }]
} }
const res = await updateProduct(goodsArr) const res = await updateProduct(goodsArr)
infoBox.showToast('修改成功') uni.$utils.showToast('修改成功')
popup.price.show = false popup.price.show = false
getGoodsList() getGoodsList()
} }
/**
// * 修改库存弹窗展示
* @param {Object} index
*/
async function changeStockShow(index) { async function changeStockShow(index) {
const res = await hasPermission('允许修改商品库存') const res = await hasPermission('允许修改商品库存')
if (!res) { if (!res) {
@ -341,26 +302,29 @@
} }
popup.stock.show = true popup.stock.show = true
} }
async function changeStockConfirm(goods) {
let goodsArr = []
goodsArr = [{ /**
shopId: uni.getStorageSync('shopId'), * 库存修改确认
isSku: false, * @param {Object} goods
*/
async function changeStockConfirm(goods) {
const res = await productModifyStock({
id: goods.id, id: goods.id,
key: 'stockNumber', stockNumber: goods.stockNumber,
value: goods.stockNumber remark: goods.remark
}] })
const res = await $updateProductData(goodsArr) uni.$utils.showToast('修改成功')
infoBox.showToast('修改成功')
popup.stock.show = false popup.stock.show = false
getGoodsList() getGoodsList()
} }
// /**
* 修改规格上下架售罄
* @param {Object} goodsIndex
* @param {Object} guigeIndex
*/
function editGuigeShow(goodsIndex, guigeIndex) { function editGuigeShow(goodsIndex, guigeIndex) {
const goodsGuige = pageData.goodsList[goodsIndex].skuList[guigeIndex] const goodsGuige = pageData.goodsList[goodsIndex].skuList[guigeIndex]
console.log(goodsIndex, guigeIndex);
popup.guige.data = goodsGuige popup.guige.data = goodsGuige
popup.guige.goodsIndex = goodsIndex popup.guige.goodsIndex = goodsIndex
popup.guige.guigeIndex = guigeIndex popup.guige.guigeIndex = guigeIndex
@ -373,7 +337,6 @@
*/ */
function isGroundingChange(e) { function isGroundingChange(e) {
const { goodsIndex, guigeIndex } = popup.guige const { goodsIndex, guigeIndex } = popup.guige
console.log(goodsIndex,guigeIndex)
pageData.goodsList[goodsIndex].skuList[guigeIndex].isGrounding = e pageData.goodsList[goodsIndex].skuList[guigeIndex].isGrounding = e
} }
@ -383,15 +346,21 @@
*/ */
function isPauseSaleChange(e) { function isPauseSaleChange(e) {
const { goodsIndex, guigeIndex } = popup.guige const { goodsIndex, guigeIndex } = popup.guige
console.log(goodsIndex,guigeIndex)
pageData.goodsList[goodsIndex].skuList[guigeIndex].isPauseSale = e pageData.goodsList[goodsIndex].skuList[guigeIndex].isPauseSale = e
} }
/**
* 分类筛选打开
* @param {Object} show
*/
function onCategoryShowChange(show) { function onCategoryShowChange(show) {
console.log(show);
pageData.categoryShow = show pageData.categoryShow = show
} }
/**
* 分类筛选确定
* @param {Object} category
*/
function setCategory(category) { function setCategory(category) {
pageData.query.categoryId = category.id pageData.query.categoryId = category.id
pageData.categoryName = category.name pageData.categoryName = category.name
@ -413,88 +382,10 @@
} }
/**
* 商品修改
// * @param {Object} id
function reportDamageClick(index) { */
pageData.reportData = pageData.goodsList[index]
reportDamage.value.open();
}
function returnGoodsStockData() {
return reactive({
sort: 0,
isStock: false,
isDistribute: false,
isSoldStock: false,
isGrounding: false,
stockNumber: 0,
})
}
let goodsStockData = returnGoodsStockData()
function goodsStockModelClose() {
console.log('goodsStockModelClose');
goodsStockData = returnGoodsStockData()
}
function goodsStockModelCancel() {
console.log('goodsStockModelCancel');
goodsStockModel.value.close()
goodsStockData = returnGoodsStockData()
}
async function goodsStockModelSave() {
const item = pageData.goodsList[pageData.selGoodsIndex]
const goods = await $getProductDetail(item.id, false)
$updateProduct({
...goods,
sort: goodsStockData.sort,
isStock: goodsStockData.isStock
}).then(res => {
item.sort = goodsStockData.sort
item.isStock = goodsStockData.isStock
item.stockNumber = goodsStockData.stockNumber
goodsStockModelCancel()
})
}
//
function goodsChangeClick(index) {
pageData.selGoodsIndex = index
const goods = pageData.goodsList[index]
Object.assign(goodsStockData, goods)
goodsStockModel.value.open()
}
//
function goodsDel(index) {
const goods = pageData.goodsList[index]
uni.showModal({
title: '提示',
content: '确认删除该商品',
success: function(res) {
if (res.confirm) {
$delProduct([goods.id]).then(res => {
uni.showToast({
title: '删除成功',
icon: 'none'
})
pageData.goodsList.splice(index, 1)
})
} else if (res.cancel) {}
}
});
}
function resetQuery() {
pageData.totalElements = 0;
pageData.query.page = 1;
getGoodsList()
}
async function toGoodsDetail(id) { async function toGoodsDetail(id) {
const res = await hasPermission('允许修改商品') const res = await hasPermission('允许修改商品')
if (!res) { if (!res) {
@ -513,109 +404,35 @@
function statesTableClick(index) { function statesTableClick(index) {
pageData.stateCurrent = index; pageData.stateCurrent = index;
pageData.query.status = pageData.statesTabsList[index].value pageData.query.status = pageData.statesTabsList[index].value
resetQuery() searchFunc()
}
let test = ref(false)
function tabsChange(i) {
console.log(i);
pageData.showGoodsDetail = i ? true : false
}
//
function changeGoodsChecked(checked, index) {
if (index !== undefined) {
pageData.goodsList[index].checked = checked
} else {
pageData.goodsList.map(v => {
v.checked = checked
})
}
control.value.setisSelectAll(isAllChecked() ? true : false)
}
//
function getChechkedGoodsList() {
return pageData.goodsList.filter(v => v.checked)
}
//
function isAllChecked() {
return getChechkedGoodsList().length === pageData.goodsList.length
}
//
function isHasChekdGoods() {
return getChechkedGoodsList().length ? true : false
} }
/**
* 搜索
*/
function searchFunc() { function searchFunc() {
console.log('searchFunc'); pageData.totalElements = 0;
resetQuery() pageData.query.page = 1;
getGoodsList() getGoodsList()
} }
let showChecked = ref(false) /**
* 下架确认
//start */
function goodsRadioClick(index) {
var checked = !pageData.goodsList[index].checked
changeGoodsChecked(checked, index)
}
//
function offShelf() {
const hasCheckedArr = getChechkedGoodsList()
const hasChecked = isHasChekdGoods()
if (!hasChecked) {
return infoBox.showToast('您还没有选中商品!')
}
model.value.open()
}
//
function modelConfirm() { function modelConfirm() {
console.log('confirm'); console.log('confirm');
model.value.close() model.value.close()
} }
//end /**
* 页数改变事件
// * @param {Object} page
function controlChange(bol) { */
showChecked.value = bol
}
//
function allCheckedChange(checked) {
changeGoodsChecked(checked)
}
//
function pageChange(page) { function pageChange(page) {
console.log(page);
pageData.query.page = page pageData.query.page = page
getGoodsList() getGoodsList()
} }
//
const category = ref(null)
function toggleCategory() {
category.value.toggle()
}
function cateClick(cate) {
console.log(cate);
pageData.query.categoryId = cate.id
pageData.categoryName = cate.name
pageData.category = cate
getGoodsList()
}
</script> </script>
<style scoped> <style scoped>
page { page {

View File

@ -1,171 +0,0 @@
<template>
<view class="u-m-b-30 goods">
<view class="u-flex color-999">
<text class="">{{data.createTime}}</text>
</view>
<view class="u-m-t-20 u-flex u-col-top ">
<image :src="data.coverImg" lazy-load class="img"></image>
<view class=" u-p-l-24 h-100 u-flex u-flex-1 u-col-top u-flex-col u-row-between">
<view class="u-flex">
<view class="color-333"> <text class="font-bold">{{data.name}}</text></view>
<view class="price u-m-l-20">¥{{data.price}}</view>
</view>
<view class="u-flex u-row-between w-full">
<view>
<text class="color-999">盈亏数量:</text>
<text>{{data.phaseNum}}</text>
</view>
<view>
<text class="color-999">盈亏金额:</text>
<text>{{data.phasePrice}}</text>
</view>
</view>
<view class="u-flex u-row-between w-full">
<view>
<text class="color-999">账存库存:</text>
<text>{{data.stock}}</text>
</view>
<view>
<text class="color-999">实际库存:</text>
<text>{{data.inventoryStock}}</text>
</view>
</view>
</view>
</view>
<view class="u-m-t-20 u-flex " v-if="data.note">
<view class="color-333">备注:</view>
<view class="bg-gray u-m-l-20 u-p-t-10 u-p-b-10 u-p-l-20 u-p-r-20 color-999">{{data.note}}</view>
</view>
</view>
</template>
<script setup>
import {
ref,
watchEffect
} from 'vue';
import {
$goodsIsHot
} from '@/http/yskApi/goods.js'
import mySwitch from '@/components/my-components/my-switch.vue'
import go from '@/commons/utils/go.js';
import {
ColorMain
} from '@/commons/color.js'
const emits = defineEmits(['radioClick', 'xiajia', 'del'])
const props = defineProps({
index: {
type: Number
},
data: {
type: Object,
default: () => {
return {}
}
}
})
function isHotChange(e) {
$goodsIsHot({
id: props.data.id,
isHot: props.data.isHot
}).then(res => {
uni.showToast({
title: '修改成功',
icon: 'none'
})
})
}
let isSellNone = ref(false)
isSellNone.value = props.isSellNone
function isSellNoneChange() {
console.log(isSellNone.value);
console.log('isSellNoneChange');
}
let checked = ref(false)
function radioClick() {
console.log(props.index);
emits('radioClick', props.index)
}
function xiajia() {
emits('xiajia', props.index)
}
function del() {
emits('del', props.index)
}
//type edittype
function toEdit() {
go.to('PAGES_PRODUCT_ADD', {
type: 'edit',
productId: props.data.id
})
}
</script>
<style lang="scss" scoped>
$imgSize: 126rpx;
$price-color: #F02C45;
.btn {
padding: 6rpx 28rpx;
border-radius: 100rpx;
border: 2rpx solid transparent;
}
.btn-primary {
border-color: $my-main-color;
;
color: $my-main-color;
}
.btn-default {
border-color: #F4F4F4;
color: #999;
}
.price {
color: $price-color;
}
.h-100 {
height: $imgSize;
}
.img {
width: $imgSize;
height: $imgSize;
}
.icon-arrow-right {
width: 32rpx;
height: 32rpx;
}
.stock {
position: relative;
}
.goods {
border-radius: 10rpx 10rpx 10rpx 10rpx;
background-color: #fff;
padding: 24rpx 28rpx 16rpx 28rpx;
font-size: 28rpx;
}
</style>

View File

@ -1,204 +0,0 @@
<template>
<view class="min-page bg-gray u-p-30">
<view v-for="(item,index) in pageData.list" :key="index">
<list-item :data="item"></list-item>
</view>
<view class="u-m-t-44" v-if="pageData.totalElements>0">
<my-pagination :size="pageData.query.size" :totalElements="pageData.totalElements"
@change="pageChange"></my-pagination>
<view style="height: 200rpx;"></view>
</view>
<template v-if="pageData.hasAjax&&!pageData.list.length">
<my-img-empty tips="暂无数据"></my-img-empty>
</template>
</view>
<view class="u-fixed fixed-b">
<my-button shape="circle" @tap="formShow">变动库存</my-button>
</view>
<my-mask ref="refMask">
<view class="u-p-30 ">
<view class="bg-fff border-r-18 default-box-padding">
<uni-forms :label-width="100" ref="refForm" :model="formData">
<uni-forms-item label="账存数量" required>
<uni-easyinput disabled v-model="formData.stock" placeholder="请输入账存数量" />
</uni-forms-item>
<uni-forms-item label="实际数量" required>
<uni-number-box
:max="999999999"
v-model="formData.stocktakinNum" ></uni-number-box>
<!-- <uni-easyinput v-model="formData.stocktakinNum" placeholder="请输入实际数量" /> -->
</uni-forms-item>
<view :class="{red:computedNumber<0}">
<uni-forms-item label="盈亏数量" required>
<uni-easyinput disabled v-model="computedNumber" placeholder="请输入盈亏数量" />
</uni-forms-item>
</view>
<uni-forms-item label="单价" required>
<uni-easyinput disabled v-model="formData.price" placeholder="请输入单价" />
</uni-forms-item>
<view :class="{red:computedMoney<0}">
<uni-forms-item label="盈亏金额" required>
<uni-easyinput disabled v-model="computedMoney" placeholder="请输入盈亏金额" />
</uni-forms-item>
</view>
<uni-forms-item label="备注" required>
<uni-easyinput type="textarea" v-model="formData.note" placeholder="请输入备注" />
</uni-forms-item>
<view class="u-flex u-m-t-30">
<view class="u-flex-1 u-p-r-16">
<my-button type="default" shape="circle" @tap="formHide">取消</my-button>
</view>
<view class="u-flex-1 u-p-l-16">
<my-button shape="circle" @tap="addStocktakin">确定</my-button>
</view>
</view>
</uni-forms>
</view>
</view>
</my-mask>
</template>
<script setup>
import {
onLoad
} from '@dcloudio/uni-app'
import {
$addStocktakin,
$getStocktakin
} from '@/http/yskApi/goods.js'
import infoBox from "@/commons/utils/infoBox.js"
import listItem from './components/list-item';
import {
$pageData
} from '@/commons/goodsData.js'
import {
computed,
reactive,
ref
} from 'vue';
const refForm = ref(null)
const refMask = ref(null)
function formShow() {
refMask.value.open()
}
function formHide() {
formData.note=''
refMask.value.close()
}
const formData = reactive({
stock:0,
note: '',
price:'',
productId:"",
skuId:'',
stocktakinNum:0
})
const computedMoney=computed(()=>{
return (formData.stocktakinNum-formData.stock)*formData.price
})
const computedNumber=computed(()=>{
return formData.stocktakinNum-formData.stock
})
const pageData = reactive({
...$pageData,
query: {
...$pageData.query,
name: '',
skuId: '',
sort: 'id,desc'
}
})
//
function pageChange(page) {
pageData.query.page=page-1
init()
}
async function addStocktakin() {
const res = await $addStocktakin(formData)
infoBox.showToast('添加成功')
formHide()
init()
}
async function init() {
const res = await $getStocktakin(pageData.query)
pageData.hasAjax=true
if(pageData.query.page===0&&res.content.length){
const zero=res.content[0]
formData.stock=zero.inventoryStock*1
formData.stocktakinNum=formData.stock
formData.price=zero.price
}else{
formData.stock=option.stock*1
formData.stocktakinNum=formData.stock
formData.price=option.price*1
}
pageData.list = res.content
pageData.totalElements = res.totalElements
}
let option={}
onLoad(opt => {
console.log(opt);
if (JSON.stringify(opt) !== '{}') {
option=opt
Object.assign(pageData.query, opt)
formData.skuId=opt.skuId
formData.productId=opt.productId
init()
}
})
</script>
<style lang="scss" scoped>
.form-box {
margin: auto;
}
::v-deep.uni-forms-item {
min-height: 100rpx;
}
::v-deep.uni-forms-item .uni-forms-item__label {
text-indent: 0;
font-size: 28rpx !important;
font-weight: bold;
color: #333;
text-align: right;
}
::v-deep .none-label .uni-forms-item.is-direction-top {
padding: 0 !important;
min-height: initial !important;
}
::v-deep .none-label .uni-forms-item .uni-forms-item__label {
padding: 0 !important;
}
::v-deep.is-disabled .uni-easyinput__placeholder-class{
color: #333;
}
.fixed-b {
bottom: 80rpx;
left: 110rpx;
right: 110rpx;
}
::v-deep.uni-input-input{
color: #333;
}
::v-deep .red .uni-input-input{
color: $my-red-color;
}
</style>

View File

@ -2,37 +2,17 @@
<view class="item bg-fff border-r-12"> <view class="item bg-fff border-r-12">
<view class="u-flex u-text-left u-row-between border-bottom u-p-b-30"> <view class="u-flex u-text-left u-row-between border-bottom u-p-b-30">
<view class=""> <view class="">
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="data.createdAt"></uni-dateformat> <uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="data.createTime"></uni-dateformat>
</view> </view>
<view class="tag">{{data.type}}</view> <view class="tag">{{getTypeName(data.inOutItem)}}</view>
</view> </view>
<view class="u-flex u-text-left u-row-left u-m-t-30"> <view class="u-flex u-text-left u-row-left u-m-t-30">
<view class="name">{{data.productName}}</view> <view class="name up-line-1">{{data.productName}}</view>
<!-- <view class="category u-flex u-m-l-10"> <view class="id color-999 u-font-24 bg-gray u-m-l-10"> ID:{{data.id}} </view>
<view class="tag">分类</view>
</view> -->
<view class="id color-999 u-font-24 bg-gray u-m-l-10">
ID:{{data.id}}
</view>
</view> </view>
<view class="info u-flex bg-gray u-p-24 u-m-t-20 u-row-between"> <view class="info u-flex bg-gray u-p-24 u-m-t-20 u-row-between">
<view class="u-text-right"> <view class="u-text-right">
<!-- <view>
<text>总价值</text>
<text class="u-m-l-10">3</text>
</view>
<view class="u-m-t-10">
<text>单价</text>
<text class="u-m-l-10">2</text>
</view>
<view class="u-m-t-10">
<text>货品编码</text>
<text class="u-m-l-10">2</text>
</view>
<view class="u-m-t-10">
<text>供应商名称</text>
<text class="u-m-l-10">2</text>
</view> -->
<view class="u-flex"> <view class="u-flex">
<view class="text-ming-w">订单号</view> <view class="text-ming-w">订单号</view>
<text class="u-m-l-10 u-font-24 color-main">{{data.orderNo||''}}</text> <text class="u-m-l-10 u-font-24 color-main">{{data.orderNo||''}}</text>
@ -40,59 +20,41 @@
<view class="u-m-t-10 u-flex u-relative"> <view class="u-m-t-10 u-flex u-relative">
<view class="text-ming-w">库存</view> <view class="text-ming-w">库存</view>
<view class="u-relative"> <view class="u-relative">
<text class="u-m-l-10">{{data.leftNumber}}</text> <text class="u-m-l-10">{{data.beforeNumber}}</text>
<view class="u-absolute u-flex addNumber"> <view class="u-absolute u-flex addNumber">
<uni-icons type="arrow-right" :color="color.ColorMain" size="16"></uni-icons> <uni-icons type="arrow-right" :color="$utils.ColorMain" size="16"></uni-icons>
<text class="color-main u-m-l-10">{{data.leftNumber+data.stockNumber}}</text> <text class="color-main u-m-l-10">{{data.afterNumber}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="u-m-t-10 u-flex"> <view class="u-m-t-10 u-flex">
<view class="text-ming-w">剩余库存</view> <view class="text-ming-w">剩余库存</view>
<view class="u-m-l-10 color-main">{{data.leftNumber+data.stockNumber}}{{data.unitName}}</view> <view class="u-m-l-10 color-main">{{data.afterNumber}}{{data.unitName}}</view>
</view>
<view class="u-m-t-10 u-flex" v-if="data.remark" style="align-items: flex-start;">
<view class="text-ming-w">备注</view>
<view class="u-m-l-10" style="text-align: left;">{{data.remark}}</view>
</view> </view>
</view> </view>
<view class="u-flex-1 u-flex u-row-right"> <view class="u-flex-1 u-flex u-row-right">
<view> <view>
<view class="no-wrap"> <view class="no-wrap">
<text class="color-main font-bold" v-if="data.stockNumber>0">{{data.stockNumber}}</text> <text class="color-main font-bold" v-if="data.inOutNumber > 0">{{data.inOutNumber}}</text>
<text class="color-red font-bold" v-else>{{data.stockNumber}}</text> <text class="color-red font-bold" v-else>{{data.inOutNumber}}</text>
<text>{{data.unitName}}</text> <text>{{data.unitName}}</text>
</view> </view>
<!-- <view class="u-m-t-10">剩余库存</view> -->
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="u-flex u-row-right u-m-t-20">
<view class="u-flex u-m-r-30">
<my-button shape="circle" height="70" type="default" @tap="del">
<view class="u-p-l-30 u-p-r-30">
删除
</view>
</my-button>
</view>
<view class="u-flex">
<my-button shape="circle" height="70" plain type="primary" @tap="more">更多操作</my-button>
</view>
</view> -->
</view> </view>
</template> </template>
<script setup> <script setup>
import { reactive } from 'vue';
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'
import color from '@/commons/color.js' import { $invoicingType } from '@/commons/goodsData.js'
function del() {
console.log('del');
}
const props = defineProps({ const props = defineProps({
index: {
type: Number
},
data: { data: {
type: Object, type: Object,
default: () => { default: () => {
@ -100,11 +62,13 @@
} }
} }
}) })
const emits = defineEmits(['more'])
function more() { let getTypeName = (type) => {
emits('more', props.index) let item = $invoicingType.filter(item=> item.value == type)[0]
return item?item.text:''
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -4,7 +4,7 @@
<view class=" bg-fff u-flex u-p-l-30 u-row-between"> <view class=" bg-fff u-flex u-p-l-30 u-row-between">
<view class="u-flex "> <view class="u-flex ">
<view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="timeToggle"> <view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="timeToggle">
<text class="u-m-r-12 no-wrap" :class="{'color-main':filters.time.start&&filters.time.end}">筛选时间</text> <text class="u-m-r-12 no-wrap" :class="{'color-main':pageData.query.beginDate&&pageData.query.endDate}">筛选时间</text>
<image src="/pageProduct/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" <image src="/pageProduct/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill"
mode=""> mode="">
</image> </image>
@ -22,7 +22,7 @@
<view @tap="changeTypesActive(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between" <view @tap="changeTypesActive(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
v-for="(item,index) in types.list" :key="index"> v-for="(item,index) in types.list" :key="index">
<view>{{item.text}}</view> <view>{{item.text}}</view>
<uni-icons v-if="types.active===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons> <uni-icons v-if="types.active===index" type="checkmarkempty" :color="$utils.ColorMain"></uni-icons>
</view> </view>
<view :style="{height: types.bottomHeight+'px'}"></view> <view :style="{height: types.bottomHeight+'px'}"></view>
</view> </view>
@ -31,26 +31,18 @@
<view class=" min-page bg-gray list u-p-30"> <view class=" min-page bg-gray list u-p-30">
<view class="u-flex u-m-b-30" v-if="filters.time.start&&filters.time.end"> <view class="u-flex u-m-b-30" v-if="pageData.query.beginDate&&pageData.query.endDate">
<view class="time-area u-font-24 color-main u-flex"> <view class="time-area u-font-24 color-main u-flex">
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="filters.time.start"></uni-dateformat> <uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="pageData.query.beginDate"></uni-dateformat>
<text class="u-p-l-10 u-p-r-10"></text> <text class="u-p-l-10 u-p-r-10"></text>
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="filters.time.end"></uni-dateformat> <uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="pageData.query.endDate"></uni-dateformat>
<view class="u-m-l-10 u-flex" @tap="clearTime"> <view class="u-m-l-10 u-flex" @tap="clearTime">
<uni-icons type="clear" size="18" :color="color.ColorMain"></uni-icons> <uni-icons type="clear" size="18" :color="$utils.ColorMain"></uni-icons>
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="recoreds color-fff ">
<view class="u-font-32">详情记录</view>
<view class="u-flex u-row-between u-m-t-48">
<view class="u-flex u-flex-col u-row-center u-col-center">
<view>变动数量</view>
<view class="u-font-32 u-m-t-10 font-bold">{{pageData.changeSum}}</view>
</view>
</view>
</view> -->
<template v-if="pageData.list.length"> <template v-if="pageData.list.length">
<view class="u-m-b-28 " v-for="(item,index) in pageData.list" :key="index"> <view class="u-m-b-28 " v-for="(item,index) in pageData.list" :key="index">
<my-list-item :data="item" ></my-list-item> <my-list-item :data="item" ></my-list-item>
@ -74,28 +66,15 @@
</template> </template>
<script setup> <script setup>
import { import { onLoad, onReady, onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
onLoad, import { ref, reactive, computed, watch } from 'vue';
onReady,
onShow,
onPageScroll,
onPullDownRefresh
} from '@dcloudio/uni-app';
import color from '@/commons/color';
import myListItem from './components/list-item.vue'; import myListItem from './components/list-item.vue';
import {
ref, import { $invoicingType } from '@/commons/goodsData.js'
reactive, import { productStockFlow } from '@/http/api/product.js'
computed,
watch
} from 'vue';
import {
$getProductDetail,
$getProductStockDetail,$getProductStockDetailSum
} from '@/http/yskApi/goods.js'
import {
$invoicingType
} from '@/commons/goodsData.js'
const search = reactive({ const search = reactive({
keyword: '', keyword: '',
show: false show: false
@ -135,53 +114,71 @@
function changeTypesActive(i) { function changeTypesActive(i) {
types.active = i types.active = i
pageData.query.inOutItem = types.list[i].value
types.show = false types.show = false
toggleMask() toggleMask()
} }
/**
* 类型选择
*/
function showTypesToggle() { function showTypesToggle() {
types.show = !types.show types.show = !types.show
maskShow() maskShow()
} }
//
function pageChange(page) {
pageData.query.page=page-1
init()
}
const filters = reactive({
time: {
start: '',
end: ''
}
})
function resetQuery(){ function resetQuery(){
pageData.query.page=0 pageData.query.page = 1
} }
function clearTime() { function clearTime() {
filters.time.start = '' pageData.query.beginDate = ''
filters.time.end = '' pageData.query.endDate = ''
resetQuery() resetQuery()
init() init()
} }
const datePicker = ref(null) const datePicker = ref(null)
function datePickerConfirm(e) { const mask = ref(null)
filters.time.start = e.start const pageData = reactive({
filters.time.end = e.end query: {
page: 1,
size: 10,
productId:'',
inOutItem:'',
beginDate:'',
endDate:'',
},
totalElements: 0,
list: [],
status: 'noMore',
hasAjax:false,
changeSum:0
})
watch(()=>types.active,(newval)=>{
resetQuery() resetQuery()
init() init()
} })
onLoad(opt => {
console.log(opt);
Object.assign(pageData.query,opt)
init()
})
async function init() {
const res = await productStockFlow(pageData.query)
pageData.hasAjax=true
pageData.list = res.records
pageData.totalElements = res.totalRow
}
function timeToggle() { function timeToggle() {
datePicker.value.toggle() datePicker.value.toggle()
} }
function datePickerConfirm(e) {
pageData.query.beginDate = e.start
const mask = ref(null) pageData.query.endDate = e.end
resetQuery()
init()
}
function toggleMask(show) { function toggleMask(show) {
mask.value.toggle() mask.value.toggle()
@ -195,50 +192,11 @@
mask.value.close() mask.value.close()
} }
//
const pageData = reactive({ function pageChange(page) {
query: { pageData.query.page = page
page: 0,
size: 10,
productId:'',
column:'/api/tbProductStockDetail/stock/count',
shopId:uni.getStorageSync('shopId'),
createdAt:[]
},
totalElements: 0,
list: [],
status: 'noMore',
hasAjax:false,
changeSum:0
})
async function init() {
const createdAt=(filters.time.start&&filters.time.end)?[filters.time.start,filters.time.end ]:[]
const res = await $getProductStockDetail({
...pageData.query,
type:types.active!==''?types.list[types.active].value:'',
createdAt
})
pageData.hasAjax=true
pageData.list = res.content
pageData.totalElements = res.totalElements
}
async function getSum(){
const res = await $getProductStockDetailSum({
productId: pageData.query.productId
})
pageData.changeSum = res.exchange
}
watch(()=>types.active,(newval)=>{
resetQuery()
init() init()
}) }
onLoad(opt => {
console.log(opt);
Object.assign(pageData.query,opt)
init()
// getSum()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -141,8 +141,6 @@
startTime = s + ' 00:00:00' startTime = s + ' 00:00:00'
endTime = e + ' 23:59:59' endTime = e + ' 23:59:59'
} }
console.log(startTime)
console.log(endTime)
getTrade({ getTrade({
beginDate: startTime, beginDate: startTime,
endDate: endTime, endDate: endTime,

View File

@ -160,7 +160,7 @@
function getShopStaffDetail(id) { function getShopStaffDetail(id) {
shopStaffDetail({id:id}).then(res => { shopStaffDetail({id:id}).then(res => {
Object.assign(datas.formData, res) Object.assign(datas.formData, res)
if (datas.rolesList) { if (datas.rolesList&&datas.rolesList.length>0) {
let rolefilter = datas.rolesList.filter(ele => ele.id == res.roleId) let rolefilter = datas.rolesList.filter(ele => ele.id == res.roleId)
datas.rolesdata = rolefilter[0].name datas.rolesdata = rolefilter[0].name
} }

View File

@ -59,7 +59,7 @@
*/ */
function getList() { function getList() {
shopStaffList({ shopStaffList({
page: 0, page: 1,
size: 100 size: 100
}).then((res) => { }).then((res) => {
pageData.list = res.records pageData.list = res.records

View File

@ -1,358 +0,0 @@
<template>
<my-model ref="model" :title="title" :borderRadius="16" @confirm="submit" :confirmClickClose="false">
<template #desc>
<view>
<uni-forms ref="refform" label-position="left" :model="form" label-align="left" :label-width="400"
:rules="rules">
<view class="form">
<view class="border-bottom u-p-b-10 u-p-t-10">
<uni-forms-item required label="" name="areaId">
<template #label>
<view class="u-text-left ">
<text class="color-red">*</text>
<text class="color-333 u-font-28">选择区域</text>
</view>
</template>
<picker @change="areaChange"
:value="area.selIndex"
range-key="name" :range="area.list">
<view class=" u-flex u-row-between u-relative ">
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
<view class="u-flex-1">
<uni-easyinput :inputBorder="false" paddingNone v-model="area.sel.name"
placeholder="请选择区域"></uni-easyinput>
</view>
<uni-icons type="right" size="18" color="#999"></uni-icons>
</view>
</picker>
</uni-forms-item>
</view>
<view class="border-bottom u-p-b-10 u-p-t-10">
<uni-forms-item required label="" name="status">
<template #label>
<view class="u-text-left ">
<!-- <text class="color-red">*</text> -->
<text class="color-333 u-font-28">桌台状态</text>
</view>
</template>
<picker @change="statusChange" range-key="label"
:value="status.selIndex"
:range="status.list">
<view class=" u-flex u-row-between u-relative ">
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
<view class="u-flex-1">
<uni-easyinput :inputBorder="false" paddingNone v-model="status.sel.label"
placeholder="请选择桌台状态"></uni-easyinput>
</view>
<uni-icons type="right" size="18" color="#999"></uni-icons>
</view>
</picker>
</uni-forms-item>
</view>
<view class="border-bottom u-p-b-10">
<uni-forms-item required label="" name="name">
<template #label>
<view class="u-text-left">
<text class="color-333 u-font-28">桌台名称</text>
<!-- <text class="color-red">*</text> -->
</view>
</template>
<view class="u-flex-1">
<uni-easyinput :inputBorder="false" paddingNone v-model="form.name"
placeholder="请输入桌台名称"></uni-easyinput>
</view>
</uni-forms-item>
</view>
<view class="border-bottom u-p-b-10">
<uni-forms-item required label="" name="maxCapacity">
<template #label>
<view class="u-text-left">
<text class="color-333 u-font-28">客座数</text>
<!-- <text class="color-red">*</text> -->
</view>
</template>
<view class="u-flex-1">
<uni-number-box v-model="form.maxCapacity"></uni-number-box>
</view>
</uni-forms-item>
</view>
<view class="border-bottom u-p-b-10">
<uni-forms-item required label="" name="isPredate">
<template #label>
<view class="u-text-left">
<text class="color-333 u-font-28">网络预定开关</text>
<!-- <text class="color-red">*</text> -->
</view>
</template>
<view class="u-flex-1 u-flex u-row-right">
<my-switch v-model="form.isPredate"></my-switch>
</view>
</uni-forms-item>
</view>
<view class="border-bottom u-p-b-10">
<uni-forms-item required label="" name="types">
<template #label>
<view class="u-text-left">
<text class="color-333 u-font-28">类型</text>
<!-- <text class="color-red">*</text> -->
</view>
</template>
<view class="u-flex-1">
<my-tabs @change="tabsChange" :list="tabs.list" v-model="tabs.sel"></my-tabs>
</view>
</uni-forms-item>
</view>
<view class="border-bottom u-p-b-10">
<uni-forms-item required label="" name="types">
<template #label>
<view class="u-text-left">
<text class="color-333 u-font-28">清台管理</text>
<!-- <text class="color-red">*</text> -->
</view>
</template>
<view class="u-flex-1">
<my-tabs @change="autoClearsChange" :list="autoClears.list" v-model="form.autoClear"></my-tabs>
</view>
</uni-forms-item>
</view>
<template v-if="tabs.sel==1">
<view class=" u-p-b-10">
<uni-forms-item required label="" >
<template #label>
<view class="u-text-left">
<text class="color-333 u-font-28">每小时收费</text>
<!-- <text class="color-red">*</text> -->
</view>
</template>
<view class="u-flex-1">
<uni-easyinput :inputBorder="false" paddingNone v-model="form.perhour" type="number"
placeholder="请输入每小时收费"></uni-easyinput>
</view>
</uni-forms-item>
</view>
</template>
<template v-else>
<view class=" u-p-b-10">
<uni-forms-item required label="" >
<template #label>
<view class="u-text-left">
<text class="color-333 u-font-28">最低消费</text>
<!-- <text class="color-red">*</text> -->
</view>
</template>
<view class="u-flex-1">
<uni-easyinput :inputBorder="false" paddingNone v-model="form.amount" type="number"
placeholder="请输入最低消费"></uni-easyinput>
</view>
</uni-forms-item>
</view>
</template>
</view>
</uni-forms>
</view>
</template>
</my-model>
</template>
<script setup>
import {
$tableArea,$table
} from '@/http/yskApi/table.js'
import {
ref,
reactive,
onMounted
} from 'vue';
import {
$status
} from '@/commons/table-status.js'
import {objToArrary} from '@/commons/utils/returrn-data.js'
import infoBox from '@/commons/utils/infoBox.js'
const emits= defineEmits(['update'])
const tabs=reactive({
list:['低消','计时'],
sel:1
})
//
const autoClears=reactive({
list:['手动清台','自动清台']
})
function autoClearsChange(i){
form.autoClearsChange=i
}
const status = reactive({
list:objToArrary($status),
sel: '',
selIndex:0
})
console.log(status.list);
const props = defineProps({
title: {
type: String,
default: '编辑桌台'
}
})
const model = ref(null)
const area = reactive({
list: [],
sel: '',
selIndex:0
})
async function getArea() {
const {
content
} = await $tableArea.get({
page: 0,
size: 300
})
area.list = content.map(v => {
return {
...v,
name: v.name,
value: v.id,
label: v.name
}
})
console.log(area.list);
}
function tabsChange(e){
if(e){
form.type=2
}else{
form.type=0
}
}
function statusChange(e){
status.sel = status.list[e.detail.value]
form.status = status.sel.key
}
function areaChange(e) {
console.log(e);
area.sel = area.list[e.detail.value]
form.areaId = area.sel.id
}
onMounted(()=>{
getArea()
})
function open(tableData) {
Object.assign(form,tableData)
getArea()
model.value.open()
if(tableData){//
const {areaId,type}=tableData
area.sel=area.list.find(v=>v.id==areaId)
area.selIndex=area.list.findIndex(v=>v.id==areaId)
status.sel=status.list.find(v=>v.key==tableData.status)
status.selIndex=status.list.findIndex(v=>v.key==tableData.status)
tabs.sel=form.type==2?1:0
}
}
function close() {
model.value.close()
}
defineExpose({
open,
close
})
function unitChange(e) {
units.current = e.detail.value
form.unit = units.list[e.detail.value].name
}
const refform = ref(null)
const form = reactive({
id: '',
name: '',
areaId: '',
status:'',
maxCapacity: 0,
isPredate: 1,
type: 2,
perhour: 0,
amount: 0
})
//
const rules = {
areaId: {
rules: [{
required: true,
errorMessage: '请选择区域'
}]
},
name: {
rules: [{
required: true,
errorMessage: '请输入桌台名称'
}]
}
}
function submit() {
refform.value.validate(res => {
console.log(res)
console.log(form);
$table.update({...form,qrcode:form.tableId}).then(Response=>{
infoBox.showSuccessToast('更新成功')
close()
emits('update')
})
}).catch(err => {
console.log(err);
})
}
const page = reactive({
type: 'add'
})
function cancel() {
uni.navigateBack()
}
</script>
<style lang="scss" scoped>
.border-bottom {
padding: 10rpx 0;
}
.form {
margin-top: 32rpx;
background-color: #fff;
padding: 32rpx 24rpx 32rpx 24rpx;
border-radius: 18rpx 18rpx 18rpx 18rpx;
.u-text-left {
min-width: 160rpx;
}
// background-color: transparent;
}
::v-deep.uni-forms-item {
min-height: 80rpx;
}
::v-deep.uni-forms-item .uni-forms-item__label {
font-size: 28rpx !important;
}
::v-deep.uni-easyinput__placeholder-class {
font-size: 28rpx;
}
::v-deep.uni-forms-item__error {
display: none;
}
</style>

View File

@ -6,9 +6,9 @@
<view class="input-wrapper"> <view class="input-wrapper">
<view class="input-main"> <view class="input-main">
<view class="u-flex u-p-r-30 u-font-28" @click="showstatusToggle"> <view class="u-flex u-p-r-30 u-font-28" @click="pageData.statusShow = !pageData.statusShow">
<text class="u-m-r-10 u-line-1" :class="{'color-main':status.active!=0}" <text class="u-m-r-10 u-line-1 " :class="{'color-main':pageData.query.status!=''}"
style="max-width: 100rpx;">{{status.list[status.active].label }}</text> style="max-width: 100rpx;">{{pageData.statusName }}</text>
<up-icon name="arrow-down" size="16"></up-icon> <up-icon name="arrow-down" size="16"></up-icon>
</view> </view>
<uni-easyinput clearable class='jeepay-search' :inputBorder="false" <uni-easyinput clearable class='jeepay-search' :inputBorder="false"
@ -26,21 +26,9 @@
</view> </view>
</view> </view>
</view> </view>
<view :style="{height:status.show?statusHeight:0}" class="tranistion status overflow-hide">
<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="$utils.ColorMain"></uni-icons>
</view>
<view :style="{height: status.bottomHeight+'px'}"></view>
</view>
</view> </view>
</up-sticky> </up-sticky>
<view class="list u-p-30"> <view class="list u-p-30">
<view class="my-bg-main table-type u-flex border-r-12 color-fff "> <view class="my-bg-main table-type u-flex border-r-12 color-fff ">
<view class="item u-p-20" :class="{sel:pageData.area.sel===item.id}" @tap="changeAreaSel(item)" <view class="item u-p-20" :class="{sel:pageData.area.sel===item.id}" @tap="changeAreaSel(item)"
@ -74,38 +62,25 @@
<view class="color-999 u-p-30 u-text-center border-bottom">桌号{{actionSheet.title}}</view> <view class="color-999 u-p-30 u-text-center border-bottom">桌号{{actionSheet.title}}</view>
</template> </template>
</my-action-sheet> </my-action-sheet>
<my-mask ref="mask" @close="hideType"></my-mask> <up-picker :show="pageData.statusShow" :columns="pageData.statusList" keyName="label" @cancel="pageData.statusShow=false" @confirm="confirmStatus" ></up-picker>
</template> </template>
<script setup> <script setup>
import { onLoad, onReady, onShow, } from '@dcloudio/uni-app'; import { onLoad, onReady, onShow, } from '@dcloudio/uni-app';
import { ref, reactive, computed, watch } from 'vue'; import { ref, reactive, computed, watch } from 'vue';
import { objToArrary } from '@/commons/utils/returrn-data.js'
import { $status } from '@/commons/table-status.js' import { $status } from '@/commons/table-status.js'
import go from '@/commons/utils/go.js'; 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 myActionSheet from '@/components/my-components/my-action-sheet';
import tableItem from './components/table-item' import tableItem from './components/table-item'
import { hasPermission } from '@/commons/utils/hasPermission.js' import { hasPermission } from '@/commons/utils/hasPermission.js'
import { getShopTable, shopTableBind, shopTableClear } from '@/http/api/table.js' import { getShopTable, shopTableBind, shopTableClear } from '@/http/api/table.js'
import { getShopArea } from '@/http/api/area.js' import { getShopArea } from '@/http/api/area.js'
import { printOrder } from '@/http/api/order.js' import { printOrder } from '@/http/api/order.js'
import { getHistoryOrder } from '@/http/api/order.js'
const statusList = objToArrary($status)
statusList.unshift({
key: '',
label: '全部'
})
const status = reactive({
list: statusList,
active: 0,
show: false,
bottomHeight: 14
})
const pageData = reactive({ const pageData = reactive({
statusShow: false,
hasAjax: false, hasAjax: false,
areaMap: {}, areaMap: {},
query: { query: {
@ -116,15 +91,19 @@
name: '', name: '',
}, },
totalElements:0, totalElements:0,
statusList: [[{
key: '',
label: '全部'
},...uni.$utils.objToArrary($status)]],
statusName: '全部',
tabList: [], tabList: [],
area: { area: {
list: [], list: [],
sel: '' sel: ''
} },
}) orderInfo: null,
const search = reactive({
show: false
}) })
const refMoreSheet = ref(null) const refMoreSheet = ref(null)
const actionSheet = reactive({ const actionSheet = reactive({
list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单','绑定码牌'], list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单','绑定码牌'],
@ -132,18 +111,10 @@
selTable: '' selTable: ''
}) })
const statusHeight = computed(() => {
return 30 * status.list.length + status.bottomHeight + 'px'
})
watch(() => pageData.area.sel, (newval) => { watch(() => pageData.area.sel, (newval) => {
pageData.query.page = 1 pageData.query.page = 1
getTable() getTable()
}) })
watch(() => status.active, (newval) => {
pageData.query.page = 1
getTable()
})
onShow(opt => { onShow(opt => {
getData() getData()
@ -175,6 +146,17 @@
}, {}) }, {})
} }
/**
* 类型选择
* @param {Object} e
*/
function confirmStatus(e){
pageData.statusShow = false
pageData.query.status = e.value[0].key
pageData.statusName = e.value[0].label
getTable()
}
/** /**
* 区域选择确定 * 区域选择确定
* @param {Object} item * @param {Object} item
@ -192,6 +174,11 @@
actionSheet.title = table.name actionSheet.title = table.name
actionSheet.selTable = table actionSheet.selTable = table
refMoreSheet.value.open() refMoreSheet.value.open()
if( actionSheet.selTable.orderId ){
getHistoryOrder({orderId: actionSheet.selTable.orderId}).then(res=>{
pageData.orderInfo = res
})
}
} }
/** /**
@ -240,7 +227,8 @@
if (!item.orderId) { if (!item.orderId) {
return uni.$utils.showToast('该桌台暂无要打印的订单!') return uni.$utils.showToast('该桌台暂无要打印的订单!')
} }
let res = await printOrder( {id: actionSheet.selTable.orderId } )
let res = await printOrder( {id: actionSheet.selTable.orderId, type: pageData.orderInfo.status == 'unpaid' ? 1 : 0 } )
return return
} }
if (index == 6) { if (index == 6) {
@ -313,61 +301,14 @@
* 搜索 * 搜索
*/ */
function searchConfirm() { function searchConfirm() {
search.show = false
pageData.query.page = 1; pageData.query.page = 1;
maskHide()
getTable() getTable()
} }
const times = reactive({
list: [10, 15, 20, 30],
active: 0,
show: false,
bottomHeight: 14
})
function hideType() {
status.show = false
search.show = false
times.show = false
}
/** /**
* 打开类型 * 页数改变事件
* @param {Object} page
*/ */
function showstatusToggle() {
status.show = !status.show
search.show = false
times.show = false
if (status.show) {
maskShow()
} else {
maskHide()
}
}
/**
* 类型选择
* @param {Object} i
*/
function changestatusActive(i) {
status.active = i
status.show = false
pageData.query.status = status.list[i].key
mask.value.toggle()
}
const mask = ref(null)
function maskShow() {
mask.value.open()
}
function maskHide() {
mask.value.close()
}
//
function pageChange(page) { function pageChange(page) {
pageData.query.page = page pageData.query.page = page
getTable() getTable()

View File

@ -41,7 +41,7 @@
</view> </view>
</view> </view>
<view class="u-flex-1 u-text-center" > <view class="u-flex-1 u-text-center" >
<view class="font-bold color-000 pr-16" >{{0}}</view> <view class="font-bold color-000 pr-16" >{{data.couponNum||0}}</view>
<view class="u-flex u-row-center" > <view class="u-flex u-row-center" >
<view class="color-999">优惠券</view> <view class="color-999">优惠券</view>
<view class="u-flex"> <view class="u-flex">

View File

@ -43,7 +43,6 @@
<view class="u-m-b-32" v-for="(item,index) in pageData.userList" :key="index"> <view class="u-m-b-32" v-for="(item,index) in pageData.userList" :key="index">
<my-user @moreOperate="moreOperateClick" :index="index" :data="item" :showDetail="pageData.showGoodsDetail"></my-user> <my-user @moreOperate="moreOperateClick" :index="index" :data="item" :showDetail="pageData.showGoodsDetail"></my-user>
</view> </view>
<my-pagination @change="pageChange"></my-pagination>
</view> </view>
<view class="fixed_b"> <view class="fixed_b">
<my-button showShadow @tap="toAddUser" shape="circle">新建用户</my-button> <my-button showShadow @tap="toAddUser" shape="circle">新建用户</my-button>
@ -130,7 +129,7 @@
</view> </view>
<view class=""> <view class="">
<input type="digit" v-model="datas.form.money" @change="datas.form.money = $utils.isPrice(datas.form.money)" placeholder="请输入金额" /> <input type="digit" v-model="datas.form.money" @change="datas.form.money = $utils.isMoney(datas.form.money)" placeholder="请输入金额" />
<view class=""> <view class="">
</view> </view>
@ -213,7 +212,6 @@
*/ */
async function getUser() { async function getUser() {
const res = await shopUserList(pageData.query) const res = await shopUserList(pageData.query)
console.log(res)
if ( res ) { if ( res ) {
if (res.pageNumber <= 1) { if (res.pageNumber <= 1) {
pageData.userList = res.records pageData.userList = res.records
@ -330,13 +328,6 @@
} }
//
function pageChange(page) {
console.log(page);
}
</script> </script>
<style scoped> <style scoped>
page { page {

View File

@ -68,14 +68,12 @@
}, },
query: { query: {
page: 1, page: 1,
size: 10, size: 15,
beginDate: '', beginDate: '',
endDate: '' endDate: ''
}, },
tableData: { tableData: {
data: [], data: [],
page: 0,
size: 15,
total: 0, total: 0,
status: 'loadmore' status: 'loadmore'
} }
@ -85,8 +83,9 @@
getTableData() getTableData()
}) })
onReachBottom(() => { onReachBottom(() => {
console.log(pageData.tableData.status)
if (pageData.tableData.status != 'nomore') { if (pageData.tableData.status != 'nomore') {
pageData.tableData.page++ pageData.query.page++
getTableData() getTableData()
} }
}) })
@ -97,19 +96,23 @@
const getTableData = async () => { const getTableData = async () => {
pageData.tableData.status = 'loading'; pageData.tableData.status = 'loading';
let res = await getHandoverRecord(pageData.query) getHandoverRecord(pageData.query).then(res=>{
pageData.tableData.total = res.totalRow pageData.tableData.total = res.totalRow
if (pageData.tableData.page == 1 && res.records.length < 10) { if (pageData.query.page == 1 && res.records.length < 10) {
pageData.tableData.data = res.records pageData.tableData.data = res.records
pageData.tableData.status = 'nomore'
return false;
} else {
setTimeout(() => {
pageData.tableData.data = [...pageData.tableData.data, ...res.records]
if (pageData.tableData.data.length >= pageData.tableData.total) pageData.tableData.status = 'nomore';
else pageData.tableData.status = 'loadmore';
}, 500)
}
}).catch(res=>{
pageData.tableData.status = 'nomore' pageData.tableData.status = 'nomore'
return false; })
} else {
setTimeout(() => {
pageData.tableData.data = [...pageData.tableData.data, ...res.records]
if (pageData.tableData.data.length >= pageData.tableData.total) pageData.tableData.status = 'nomore';
else pageData.tableData.status = 'loadmore';
}, 500)
}
} }
/** /**

View File

@ -131,13 +131,6 @@
"style": { "style": {
"navigationBarTitleText": "库存记录" "navigationBarTitleText": "库存记录"
} }
},
{
"pageId": "PAGES_PRODUCT_INVOICING_CHECK",
"path": "invoicing-check/invoicing-check",
"style": {
"navigationBarTitleText": "库存盘点"
}
} }
] ]
@ -438,13 +431,7 @@
"pageId": "PAGES_ADD_CONSUMABLES", "pageId": "PAGES_ADD_CONSUMABLES",
"path": "addConsumables", "path": "addConsumables",
"style": { "style": {
"navigationBarTitleText": "新增耗材" "navigationBarTitleText": ""
}
}, {
"pageId": "PAGES_EDIT_CONSUMABLES",
"path": "editConsumables",
"style": {
"navigationBarTitleText": "编辑耗材"
} }
}, { }, {
"pageId": "PAGES_ADD_TYPE", "pageId": "PAGES_ADD_TYPE",

View File

@ -13,25 +13,26 @@
textKey="label"></my-tabs> textKey="label"></my-tabs>
</view> </view>
<view v-if="vdata.loginType == 'pwd' "> <view v-if="vdata.loginType == 'pwd' ">
<template v-if="accountType.sel==1">
<uni-forms-item name="merchantName">
<uni-easyinput class='jeepay-easyinput' placeholder="请输入商户号"
v-model="vdata.formData.merchantName" :clearable="false">
<template #prefixIcon>
<image src="@/static/login/icon-user.svg" class="input-icon" />
</template>
</uni-easyinput>
</uni-forms-item>
</template>
<uni-forms-item name="username"> <uni-forms-item name="username">
<uni-easyinput class='jeepay-easyinput' placeholder="请输入登录名/手机号" <uni-easyinput class='jeepay-easyinput' :placeholder="accountType.sel==1?'请输入商户号':'请输入登录名/手机号'"
v-model="vdata.formData.username" :clearable="false"> v-model="vdata.formData.username" :clearable="false">
<template #prefixIcon> <template #prefixIcon>
<image src="@/static/login/icon-user.svg" class="input-icon" /> <image src="@/static/login/icon-user.svg" class="input-icon" />
</template> </template>
</uni-easyinput> </uni-easyinput>
</uni-forms-item> </uni-forms-item>
<template v-if="accountType.sel==1">
<uni-forms-item name="staffUserName">
<uni-easyinput class='jeepay-easyinput' placeholder="请输入登录名/手机号"
v-model="vdata.formData.staffUserName" :clearable="false">
<template #prefixIcon>
<image src="@/static/login/icon-user.svg" class="input-icon" />
</template>
</uni-easyinput>
</uni-forms-item>
</template>
<uni-forms-item name="pwd"> <uni-forms-item name="pwd">
<uni-easyinput class='jeepay-easyinput' :type="vdata.isShowPwd ? 'text' : 'password'" <uni-easyinput class='jeepay-easyinput' :type="vdata.isShowPwd ? 'text' : 'password'"
@ -156,7 +157,7 @@
const loginFormRef = ref() const loginFormRef = ref()
const rules = { const rules = {
merchantName: { staffUserName: {
rules: [formUtil.rules.requiredInputShowToast('商户号')], rules: [formUtil.rules.requiredInputShowToast('商户号')],
}, },
username: { username: {
@ -193,7 +194,7 @@
pwd: '', // pwd: '', //
code: '', code: '',
uuid: '', uuid: '',
merchantName: '', staffUserName: '',
loginType: 1 loginType: 1
}, },
@ -210,7 +211,7 @@
function accountTypeChange(e) { function accountTypeChange(e) {
// #ifdef H5 // #ifdef H5
if (e == 1) { if (e == 1) {
vdata.formData.merchantName = '18049104914' vdata.formData.staffUserName = '18049104914'
vdata.formData.username = '13666666666' vdata.formData.username = '13666666666'
vdata.formData.pwd = '123456' vdata.formData.pwd = '123456'
} else { } else {
@ -220,7 +221,7 @@
} }
watch(() => accountType.sel, (newval) => { watch(() => accountType.sel, (newval) => {
if (newval == 1) { if (newval == 1) {
vdata.formData.merchantName = uni.getStorageSync('merchantName') || '' vdata.formData.staffUserName = uni.getStorageSync('staffUserName') || ''
} else { } else {
vdata.formData.username = '' vdata.formData.username = ''
} }
@ -229,8 +230,8 @@
getCode() getCode()
// , // ,
let info = uni.getStorageSync('MerchantId') let info = uni.getStorageSync('MerchantId')
if (info.merchantName) { if (info.staffUserName) {
vdata.formData.merchantName = info.merchantName vdata.formData.staffUserName = info.staffUserName
vdata.formData.username = info.username vdata.formData.username = info.username
} }
}) })
@ -269,7 +270,7 @@
} }
// //
if ( accountType.sel == 1 ) { if ( accountType.sel == 1 ) {
params.merchantName = vdata.formData.merchantName params.staffUserName = vdata.formData.staffUserName
} }
loginPromise = login(params) loginPromise = login(params)
@ -289,7 +290,7 @@
loginFinishFunc(res) loginFinishFunc(res)
// //
uni.setStorageSync('MerchantId', { uni.setStorageSync('MerchantId', {
merchantName: vdata.formData.merchantName, staffUserName: vdata.formData.staffUserName,
username: vdata.formData.username, username: vdata.formData.username,
}) })
}).catch(e => { }).catch(e => {

View File

@ -288,8 +288,8 @@
</template> </template>
<script setup> <script setup>
import { onLoad, onReady, onShow } from '@dcloudio/uni-app' import { onLoad, onReady, onShow,onHide } from '@dcloudio/uni-app'
import { ref, inject, onBeforeUnmount, reactive, computed, watch } from 'vue'; import { ref, inject, onUnmounted, reactive, computed, watch } from 'vue';
import modelDiscount from './components/discount' import modelDiscount from './components/discount'
import giveFood from './components/give-food' import giveFood from './components/give-food'
@ -385,16 +385,20 @@
watch(() => pageData.eatTypes.active, (newval) => { watch(() => pageData.eatTypes.active, (newval) => {
pageData.eatTypes.isShow = true pageData.eatTypes.isShow = true
changeUseType() changeUseType()
})
onBeforeUnmount(() => {
}) })
onShow(() => { onShow(() => {
init() init()
watchChooseuser() watchChooseuser()
watchChooseTable() watchChooseTable()
}) })
onHide(() => {
console.log("onHide")
websocketUtil.offMessage()
})
onUnmounted(() => {
console.log("onUnmounted")
websocketUtil.offMessage()
});
/** /**
* 获取订单详情 * 获取订单详情
* @param {Object} tableCode * @param {Object} tableCode
@ -488,7 +492,7 @@
async function init() { async function init() {
// //
$goods = await getProductList({},'product', false) $goods = await getProductList({},'product', false)
console.log("商品列表===",$goods) // console.log("===",$goods)
getTableInfo(pageData.table) getTableInfo(pageData.table)
} }

View File

@ -116,8 +116,6 @@
console.log(modal); console.log(modal);
} }
console.log(props.data);
const edmits = defineEmits(['clear', 'updateNumber']) const edmits = defineEmits(['clear', 'updateNumber'])
// mask // mask
@ -158,7 +156,6 @@
} }
const allPrice = computed(() => { const allPrice = computed(() => {
console.log("购物车数据==",props.data)
return props.data.reduce((prve, cur) => { return props.data.reduce((prve, cur) => {
let price = Math.floor((cur.lowPrice * cur.number)*100)/100 let price = Math.floor((cur.lowPrice * cur.number)*100)/100
return prve + price return prve + price
@ -170,7 +167,6 @@
result = props.data.reduce((prve, cur) => { result = props.data.reduce((prve, cur) => {
return prve + cur.number return prve + cur.number
}, 0) }, 0)
console.log(result)
result = result > 0 ? result.toFixed(2) : 0 result = result > 0 ? result.toFixed(2) : 0
return result >= 99 ? 99 : parseFloat(result) return result >= 99 ? 99 : parseFloat(result)
}) })

View File

@ -112,7 +112,7 @@
</template> </template>
<script setup> <script setup>
import { onLoad, onReady, onShow } from '@dcloudio/uni-app'; import { onLoad, onReady, onShow, onUnload, onHide } from '@dcloudio/uni-app';
import { inject, computed, reactive, ref, nextTick, watch, getCurrentInstance, onUnmounted, onBeforeUnmount } from 'vue'; import { inject, computed, reactive, ref, nextTick, watch, getCurrentInstance, onUnmounted, onBeforeUnmount } from 'vue';
import guigeModel from './components/guige' import guigeModel from './components/guige'
@ -177,7 +177,6 @@
is_gift: 0 is_gift: 0
}, },
orderId: null, orderId: null,
isCars: false,
isGoodsAdd: true, isGoodsAdd: true,
goodsData: null, goodsData: null,
}) })
@ -198,7 +197,6 @@
const websocketUtil = inject('websocketUtil'); // WebSocket const websocketUtil = inject('websocketUtil'); // WebSocket
onLoad((opt) => { onLoad((opt) => {
option = opt option = opt
console.log("opt===",opt)
Object.assign(data.table, opt) Object.assign(data.table, opt)
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
@ -220,15 +218,22 @@
} }
}) })
onShow(() => { onShow(() => {
watchChooseTable()
watchUpdate()
watchSocketOpen()
data.isGoodsAdd = true;
nextTick(()=>{ nextTick(()=>{
uni.showLoading({
title: '购物车加载中',
mask: true
});
watchChooseTable()
watchUpdate()
watchSocketOpen()
data.isGoodsAdd = true;
init()
onMessage() onMessage()
}) })
init()
}) })
onReady(() => { onReady(() => {
getElRect('list-tight-top').then(res => { getElRect('list-tight-top').then(res => {
@ -237,12 +242,15 @@
getMenuItemTop() getMenuItemTop()
}) })
onBeforeUnmount(() => {
onHide(() => {
console.log("onHide")
uni.$off('is-socket-open')
websocketUtil.offMessage()
}) })
onUnmounted(() => { onUnmounted(() => {
uni.$off('is-socket-open')
websocketUtil.offMessage()
}); });
@ -262,7 +270,6 @@
setTabBar($category, $originGoods, []) setTabBar($category, $originGoods, [])
} }
let shopInfo = await getShopInfo({id:uni.getStorageSync('shopInfo').id}) let shopInfo = await getShopInfo({id:uni.getStorageSync('shopInfo').id})
console.log(shopInfo)
uni.setStorageSync("shopInfo",shopInfo) uni.setStorageSync("shopInfo",shopInfo)
// //
let categoryRes = await categoryPage({ page: 1, size: 300 }) let categoryRes = await categoryPage({ page: 1, size: 300 })
@ -298,11 +305,13 @@
uni.$on('is-socket-open', (res) => { uni.$on('is-socket-open', (res) => {
console.log("is-socket-open===",res) console.log("is-socket-open===",res)
if( res){ if( res){
data.isCars = true;
data.isGoodsAdd = true; data.isGoodsAdd = true;
initCart() initCart()
} else { } else {
data.isCars = false; uni.showLoading({
title: '购物车加载中',
mask: true
});
data.isGoodsAdd = false; data.isGoodsAdd = false;
} }
}) })
@ -339,7 +348,6 @@
switch (msg.operate_type) { switch (msg.operate_type) {
case 'onboc_init': case 'onboc_init':
cars.length = 0 cars.length = 0
data.isCars = true;
console.log("购物车信息onboc_init===",msg) console.log("购物车信息onboc_init===",msg)
if( !data.table.tableCode ){ if( !data.table.tableCode ){
data.table.tableCode = msg.table_code data.table.tableCode = msg.table_code
@ -348,7 +356,6 @@
console.log("商品信息===",cartArr) console.log("商品信息===",cartArr)
msg.data.map(item=>{ msg.data.map(item=>{
cartItem = getNowCart(item,cartArr) cartItem = getNowCart(item,cartArr)
console.log("cartItem===",cartItem)
if( cartItem.isGrounding||cartItem.is_temporary == 1 ){ if( cartItem.isGrounding||cartItem.is_temporary == 1 ){
cartControls(cartItem,'add') cartControls(cartItem,'add')
} else { } else {
@ -569,10 +576,8 @@
// chooseTable() // chooseTable()
// }) // })
// } // }
if( !data.isCars ){
return uni.$utils.showToast('购物车加载失败请刷新重试...') if( !data.isGoodsAdd ){ return;}
}
if( !data.isGoodsAdd ){ return;uni.$utils.showToast('isGoodsAdd...') }
let $goods = data.tabbar[index].foods[foodsindex] let $goods = data.tabbar[index].foods[foodsindex]
if ($goods.type !== 'sku') { if ($goods.type !== 'sku') {
// //
@ -713,8 +718,6 @@
delCart(e.goods.id) delCart(e.goods.id)
return return
} }
console.log(e)
// product_name
params.product_name = e.goods.name params.product_name = e.goods.name
params.sku_name = e.goods.sku_name params.sku_name = e.goods.sku_name
} }
@ -749,10 +752,6 @@
* @param {Object} index * @param {Object} index
*/ */
function chooseGuige(foodsindex, index) { function chooseGuige(foodsindex, index) {
if( !data.isCars ){
return uni.$utils.showToast('购物车加载失败请刷新重试...')
}
const $goods = data.tabbar[index].foods[foodsindex] const $goods = data.tabbar[index].foods[foodsindex]
selGoods.value = $goods selGoods.value = $goods
if ($goods.groupType == 1) { if ($goods.groupType == 1) {
@ -1110,9 +1109,6 @@
*/ */
const refweighitem = ref(null) const refweighitem = ref(null)
const tapweigh = (foodsindex, index) => { const tapweigh = (foodsindex, index) => {
if( !data.isCars ){
return uni.$utils.showToast('购物车加载失败请刷新重试...')
}
const goods = data.tabbar[index].foods[foodsindex] const goods = data.tabbar[index].foods[foodsindex]
refweighitem.value.open(foodsindex, index, goods) refweighitem.value.open(foodsindex, index, goods)
} }
@ -1271,7 +1267,6 @@
uni.$off('add:cashCai') uni.$off('add:cashCai')
uni.$on('update:createOrderIndex', () => { uni.$on('update:createOrderIndex', () => {
cars.length = 0 cars.length = 0
console.log('update:createOrderIndex');
init() init()
}) })

View File

@ -23,7 +23,7 @@
<view class=" u-font-24 u-m-t-12 u-flex"> <view class=" u-font-24 u-m-t-12 u-flex">
<view class=" u-flex"> <view class=" u-flex">
<text class="">挂账额度</text> <text class="">挂账额度</text>
<text class="color-main">{{item.creditAmount}}</text> <text class="color-main">{{item.remainingAmount}}</text>
</view> </view>
<view class="u-m-l-30 u-flex"> <view class="u-m-l-30 u-flex">
<text class="">账户余额</text> <text class="">账户余额</text>

View File

@ -80,17 +80,20 @@
</view> </view>
<view class="u-text-right u-m-t-28"> <view class="u-text-right u-m-t-28">
<template v-if="item.refundNum>0||item.returnNum>0"> <template v-if="item.refundNum>0||item.returnNum>0">
<!-- <view>{{mathFloorPrice( - mathFloorPrice(parseFloat(item.returnNum*item.unitPrice),item) - mathFloorPrice(parseFloat(item.refundNum*item.unitPrice),item))}}</view> --> <view>{{mathFloorPrice( parseFloat(mathFloorPrice(item.num*item.unitPrice,item)) - (parseFloat(mathFloorPrice(item.returnNum*item.unitPrice,item)) + parseFloat(mathFloorPrice(item.refundNum*item.unitPrice,item))))}}</view>
<view>{{mathFloorPrice( parseFloat(mathFloorPrice(item.num*item.unitPrice),item) - (parseFloat(mathFloorPrice(item.returnNum*item.unitPrice,item)) + parseFloat(mathFloorPrice(item.refundNum*item.unitPrice,item))))}}</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view> <view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template> </template>
<template v-else-if="item.userCouponId"> <template v-else-if="item.couponNum > 0">
<view>0.00</view> <view>{{mathFloorPrice((item.num-item.couponNum)*item.unitPrice,item)}}</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template>
<template v-else-if="item.discountSaleAmount > 0">
<view>{{mathFloorPrice(item.num*item.discountSaleAmount,item)}}</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view> <view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template> </template>
<template v-else-if="isVip == 1"> <template v-else-if="isVip == 1">
<view>{{item.num*item.memberPrice}}</view> <view>{{mathFloorPrice(item.num*item.memberPrice,item)}}</view>
<view class="line-th color-666 ">{{item.num*item.price}}</view> <view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template> </template>
<template v-else> <template v-else>
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1"> <template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
@ -206,7 +209,7 @@
</view> </view>
<view class="u-m-t-24"> <view class="u-m-t-24" v-if="orderInfo.status == 'unpaid'||orderInfo.status == 'done'">
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button> <my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
</view> </view>
</view> </view>
@ -374,12 +377,13 @@
* 总优惠金额 * 总优惠金额
*/ */
const discountsPrice = computed(() => { const discountsPrice = computed(() => {
// //
let fullCouponDiscountAmount = props.orderInfo.fullCouponDiscountAmount let fullCouponDiscountAmount = props.orderInfo.status == 'done' ? props.orderInfo.fullCouponDiscountAmount : 0
// //
let productCouponDiscountAmount = props.orderInfo.productCouponDiscountAmount let productCouponDiscountAmount = props.orderInfo.status == 'done' ? props.orderInfo.productCouponDiscountAmount : 0
// //
let pointsDiscountAmount = props.orderInfo.pointsDiscountAmount let pointsDiscountAmount = props.orderInfo.status == 'done' ? props.orderInfo.pointsDiscountAmount : 0
return (parseFloat(vipDiscountPrice.value) + parseFloat(discountSaleAmount.value) + discountAmount.value + fullCouponDiscountAmount + productCouponDiscountAmount + pointsDiscountAmount).toFixed(2) return (parseFloat(vipDiscountPrice.value) + parseFloat(discountSaleAmount.value) + discountAmount.value + fullCouponDiscountAmount + productCouponDiscountAmount + pointsDiscountAmount).toFixed(2)
}) })
@ -394,14 +398,13 @@
let memberPrice = cur.memberPrice ? cur.memberPrice : cur.price let memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
let tPrice = (isVip.value ? memberPrice : cur.price) let tPrice = (isVip.value ? memberPrice : cur.price)
tPrice = cur.memberPrice != cur.unitPrice&& cur.price != cur.unitPrice ? cur.unitPrice : tPrice tPrice = cur.memberPrice != cur.unitPrice&& cur.price != cur.unitPrice ? cur.unitPrice : tPrice
console.log(tPrice)
let Total = Math.floor(tPrice * cur.num * 100) / 100 let Total = Math.floor(tPrice * cur.num * 100) / 100
return prve + Total - (cur.returnNum*tPrice) - (cur.refundNum*cur.unitPrice) return prve + Total - (cur.returnNum*tPrice) - (cur.refundNum*cur.unitPrice)
}, 0) }, 0)
return a + curTotal return a + curTotal
}, 0) }, 0)
console.log("菜品金额==",goodsPrice) // console.log("==",goodsPrice)
return goodsPrice.toFixed(2) return goodsPrice.toFixed(2)
}) })
@ -495,7 +498,7 @@
function returnTotalMoney(item) { function returnTotalMoney(item) {
return (Math.floor(item.num*item.unitPrice*100)/100).toFixed(2) return (Math.floor(item.num*item.price*100)/100).toFixed(2)
} }
function returnCanTuiMoney(item) { function returnCanTuiMoney(item) {
// if (props.orderInfo.status == 'unpaid') { // if (props.orderInfo.status == 'unpaid') {
@ -566,7 +569,7 @@
obj.number = '0.00' obj.number = '0.00'
obj.skuName = obj.skuName || '' obj.skuName = obj.skuName || ''
obj.unitPrice = obj.unitPrice obj.unitPrice = obj.unitPrice
obj.num = obj.num - obj.returnNum - obj.refundNum obj.num = obj.num - obj.returnNum - obj.refundNum - obj.couponNum
obj.priceAmount = mathFloorPrice(obj.num*obj.unitPrice ,obj) obj.priceAmount = mathFloorPrice(obj.num*obj.unitPrice ,obj)
}) })
arr = [...arr,...infoLit] arr = [...arr,...infoLit]

View File

@ -173,11 +173,11 @@
} }
let par = { let par = {
orderId: props.data.orderId, orderId: props.data.orderId,
refundAmount: number.value*props.data.unitPrice, refundAmount: number.value * props.data.unitPrice,
refundReason: note, refundReason: note,
refundDetails: [{ refundDetails: [{
id: props.data.id, id: props.data.id,
returnAmount: number.value*props.data.unitPrice, returnAmount: number.value * props.data.unitPrice,
num: number.value, num: number.value,
}], }],
} }

View File

@ -85,7 +85,6 @@
}) })
onLoad((opt) => { onLoad((opt) => {
Object.assign(options, opt) Object.assign(options, opt)
console.log("opt===",options);
getShopInfoData() getShopInfoData()
}) })
onShow(() => { onShow(() => {
@ -109,24 +108,27 @@
*/ */
async function getOrderDetail () { async function getOrderDetail () {
let res = await getHistoryOrder({orderId: options.id}) let res = await getHistoryOrder({orderId: options.id})
console.log("订单详情===",res) // console.log("===",res)
if(res.userId){ if(res.userId){
shopUserDetail({userId:res.userId}).then(res=>{ let resUser = await shopUserDetail({userId:res.userId})
if(res){ user.value = resUser
user.value = res
}
})
} }
orderDetail.seatFee = { orderDetail.seatFee = {
seatNum: res.seatNum, seatNum: res.seatNum,
seatAmount: res.seatAmount, seatAmount: res.seatAmount,
} }
orderDetail.goodsList = Object.entries(res.detailMap).map(([key, value]) => ({ orderDetail.goodsList = Object.entries(res.detailMap).map(([key, value]) => ({
info: value, info: value,
placeNum: key placeNum: key
})) }))
orderDetail.goodsList.map(item=>{
item.info.map(item=>{
item.unitPrice = uni.$utils.isGoodsPrice(item,user.value)
})
})
orderDetail.info = res orderDetail.info = res
console.log("orderDetail===",orderDetail);
} }
function onSeatFeeTuicai(seatFee) { function onSeatFeeTuicai(seatFee) {
@ -195,7 +197,9 @@
if (res.confirm) { if (res.confirm) {
try { try {
const res = await printOrder({ const res = await printOrder({
id: orderDetail.info.id id: orderDetail.info.id,
type: orderDetail.info.status == 'unpaid' ? 1 : 0
}) })
infoBox.showToast('已发送打印请求') infoBox.showToast('已发送打印请求')
} catch (e) { } catch (e) {
@ -213,6 +217,7 @@
return return
} }
if (Array.isArray(goods)) { if (Array.isArray(goods)) {
go.to('PAGES_ORDER_TUIKUAN', { go.to('PAGES_ORDER_TUIKUAN', {
orderInfo: JSON.stringify(orderDetail.info), orderInfo: JSON.stringify(orderDetail.info),
goodsList:JSON.stringify(goods) goodsList:JSON.stringify(goods)
@ -221,8 +226,9 @@
} else { } else {
goods.number = 0 goods.number = 0
goods.skuName = goods.skuName || '' goods.skuName = goods.skuName || ''
goods.priceAmount = goods.priceAmount ? goods.priceAmount : (goods.num*goods.unitPrice).toFixed(2) goods.priceAmount = goods.priceAmount ? goods.priceAmount : (goods.num*uni.$utils.isGoodsPrice(goods,user.value)).toFixed(2)
goods.unitPrice = goods.unitPrice console.log(goods)
goods.unitPrice = uni.$utils.isGoodsPrice(goods,user.value)
goods.userCouponId = goods.userCouponId ? goods.userCouponId:'' goods.userCouponId = goods.userCouponId ? goods.userCouponId:''
go.to('PAGES_ORDER_TUIKUAN', { go.to('PAGES_ORDER_TUIKUAN', {
orderInfo: JSON.stringify(orderDetail.info), orderInfo: JSON.stringify(orderDetail.info),

View File

@ -40,20 +40,9 @@
</view> </view>
<view class="u-flex u-flex-1 u-row-right" style="align-items: center;"> <view class="u-flex u-flex-1 u-row-right" style="align-items: center;">
<view style="margin-right: 10rpx;">×{{item.num}}</view> <view style="margin-right: 10rpx;">×{{item.num}}</view>
<template v-if="item.userCouponId"> <view class="u-text-right u-relative" :style="computedPriceStyle()">
<view class="u-text-right u-relative" :style="computedPriceStyle()"> <text>{{item.unitPrice}}</text>
<text class="line-th">{{item.payAmount}}</text> </view>
<view class="u-absolute" style="bottom: 100%;right: 0;">
0
</view>
</view>
</template>
<template v-else>
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text>{{item.payAmount}}</text>
</view>
</template>
</view> </view>
</view> </view>
@ -98,9 +87,9 @@
<view class="u-m-t-32"> <view class="u-m-t-32">
<view class="u-flex u-row-right"> <view class="u-flex u-row-right">
<text>总计</text> <text>总计</text>
<text class="font-bold u-font-32">{{data.originAmount}}</text> <text class="font-bold u-font-32">{{originAmount.toFixed(2)}}</text>
</view> </view>
<view class="u-flex u-row-right u-m-t-24"> <view class="u-flex u-row-right u-m-t-24" v-if="data.status == 'unpaid'||data.status == 'done'">
<view class="print" @click.stop="print(item)">重新打印</view> <view class="print" @click.stop="print(item)">重新打印</view>
</view> </view>
</view> </view>
@ -137,7 +126,7 @@
let $goodsMap = {} let $goodsMap = {}
let goosZhonglei = ref(0) let goosZhonglei = ref(0)
let goodsNumber = ref(0) let goodsNumber = ref(0)
let originAmount = ref(0)
const priceSize = 9 const priceSize = 9
let minWidth=ref(36) let minWidth=ref(36)
@ -158,6 +147,7 @@
$goodsMap[goods.productId] = goods.num * 1 $goodsMap[goods.productId] = goods.num * 1
goosZhonglei.value += 1 goosZhonglei.value += 1
} }
originAmount.value += goods.unitPrice
} }
} }
goodsMapInit() goodsMapInit()

View File

@ -94,7 +94,8 @@
if (res.confirm) { if (res.confirm) {
try{ try{
const res= await printOrder({ const res= await printOrder({
id :item.id id :item.id,
type: item.status == 'unpaid' ? 1 : 0
}) })
infoBox.showToast('已发送打印请求') infoBox.showToast('已发送打印请求')
}catch(e){ }catch(e){

View File

@ -38,12 +38,7 @@
</template> </template>
<script setup> <script setup>
import { import { reactive, nextTick, ref, watch } from 'vue';
reactive,
nextTick,
ref,
watch
} from 'vue';
import myModel from '@/components/my-components/my-model.vue' import myModel from '@/components/my-components/my-model.vue'
import myButton from '@/components/my-components/my-button.vue' import myButton from '@/components/my-components/my-button.vue'
import myTabs from '@/components/my-components/my-tabs.vue' import myTabs from '@/components/my-components/my-tabs.vue'

View File

@ -35,6 +35,14 @@
</view> </view>
</view> </view>
</view> </view>
<view class="border-bottom-dashed u-p-b-30 u-p-t-30" v-if="discountSaleAmount*1>0">
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between ">
<view>单品打折优惠</view>
<view class="color-red">
-{{discountSaleAmount}}
</view>
</view>
</view>
<view class="border-bottom-dashed u-p-b-30 u-p-t-30"> <view class="border-bottom-dashed u-p-b-30 u-p-t-30">
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between " @click="toQuan"> <view class="u-flex u-p-l-24 u-p-r-24 u-row-between " @click="toQuan">
@ -99,7 +107,7 @@
<text class="u-m-l-10 no-wrap">{{item.payName}}</text> <text class="u-m-l-10 no-wrap">{{item.payName}}</text>
</view> </view>
<view class="u-flex color-999 u-font-24"> <view class="u-flex color-999 u-font-24">
<view class="u-m-r-20" v-if="item.payType=='virtual'&&pageData.buyer.id" <view class="u-m-r-20" v-if="item.payType=='arrears'&&pageData.buyer.id"
@click.stop="chooseBuyer"> @click.stop="chooseBuyer">
<view> <view>
<text>挂账人</text> <text>挂账人</text>
@ -107,7 +115,7 @@
</view> </view>
<view> <view>
<text>挂账额度</text> <text>挂账额度</text>
<text>{{pageData.buyer.creditAmount||'0'}}</text> <text>{{pageData.buyer.remainingAmount||'0'}}</text>
</view> </view>
</view> </view>
@ -224,7 +232,7 @@
<edit-discount :nowPrice="order.orderAmount-productCouponDiscountAmount-fullCouponDiscountAmount" <edit-discount :nowPrice="order.orderAmount-productCouponDiscountAmount-fullCouponDiscountAmount"
@confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney" @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
:price="payPrice-productCouponDiscountAmount" :discount="discount.discount"></edit-discount> :price="payPrice" :discount="discount.discount"></edit-discount>
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText" <up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm" :cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
@ -237,7 +245,7 @@
</template> </template>
<script setup> <script setup>
import { reactive, onMounted, watch, ref, onBeforeUnmount, computed } from 'vue'; import { reactive, onMounted, watch, ref, onBeforeUnmount, computed, inject } from 'vue';
import { onLoad, onBackPress, onShow } from '@dcloudio/uni-app' import { onLoad, onBackPress, onShow } from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'
@ -259,7 +267,7 @@
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl,queryOrderStatus } from '@/http/api/pay.js' import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl,queryOrderStatus } from '@/http/api/pay.js'
import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/http/api/points.js' import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/http/api/points.js'
const websocketUtil = inject('websocketUtil'); // WebSocket
const modal = reactive({ const modal = reactive({
title: '提示', title: '提示',
cancelText: '取消', cancelText: '取消',
@ -323,7 +331,6 @@
watchChooseQuan() watchChooseQuan()
}) })
onLoad(async (opt) => { onLoad(async (opt) => {
console.log(opt);
Object.assign(order, opt) Object.assign(order, opt)
getPayType() getPayType()
init() init()
@ -345,17 +352,13 @@
// //
const orderRes = await getHistoryOrder({orderId:order.orderId}) const orderRes = await getHistoryOrder({orderId:order.orderId})
Object.assign(order, orderRes) Object.assign(order, orderRes)
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailMap) pageData.goodsList = uni.$utils.objToArrary(orderRes.detailMap)
pageData.goodsList = []; $goodsPayPriceMap = returnGoodsPayPriceMap(pageData.goodsList)
Object.values(orderRes.detailMap).forEach(item=>{
pageData.goodsList = [...pageData.goodsList,...item]
})
// console.log("order===",order)
// console.log("pageData.user===",pageData.user)
// //
console.log("order===",order)
console.log("pageData.user===",pageData.user)
if (order.userId||pageData.user.userId) { if (order.userId||pageData.user.userId) {
shopUserDetail({ shopUserDetail({
userId: order.userId || pageData.user.userId userId: order.userId || pageData.user.userId
}).then(res => { }).then(res => {
@ -366,7 +369,6 @@
} }
}) })
} }
console.log("order==",order)
pageData.seatNum = order.seatNum; pageData.seatNum = order.seatNum;
} }
@ -395,7 +397,7 @@
console.log(b) console.log(b)
return a + ((b.packAmount||0)*b.packNumber).toFixed(2)*1 return a + ((b.packAmount||0)*b.packNumber).toFixed(2)*1
}, 0) }, 0)
console.log(price) // console.log("===",price)
return price return price
} }
}) })
@ -404,7 +406,7 @@
* 桌位费 * 桌位费
*/ */
const tableFee = computed(() => { const tableFee = computed(() => {
console.log("桌位费===", order.seatNum > 0 ? order.seatNum*pageData.shopInfo.tableFee : 0) // console.log("===", order.seatNum > 0 ? order.seatNum*pageData.shopInfo.tableFee : 0)
return order.seatNum > 0 ? order.seatNum*pageData.shopInfo.tableFee : 0 return order.seatNum > 0 ? order.seatNum*pageData.shopInfo.tableFee : 0
}) })
@ -416,7 +418,7 @@
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => { let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
return a + parseFloat(mathFloorPrice(b.num * b.price,b)) return a + parseFloat(mathFloorPrice(b.num * b.price,b))
}, 0) }, 0)
console.log("菜品原金额===",goodsPrice) // console.log("===",goodsPrice)
return (parseFloat(goodsPrice) + parseFloat(tableFee.value) + parseFloat(packAmount.value)).toFixed(2) return (parseFloat(goodsPrice) + parseFloat(tableFee.value) + parseFloat(packAmount.value)).toFixed(2)
} }
}) })
@ -426,10 +428,10 @@
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => { let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
let memberPrice = b.memberPrice ? b.memberPrice : b.price let memberPrice = b.memberPrice ? b.memberPrice : b.price
let tPrice = (isVip.value ? memberPrice : b.price) let tPrice = (isVip.value ? memberPrice : b.price)
tPrice = b.memberPrice != b.unitPrice&& b.price != b.unitPrice ? b.unitPrice : tPrice tPrice = (b.discountSaleAmount ? b.discountSaleAmount : tPrice )
return a + parseFloat(mathFloorPrice(b.num * tPrice,b) - mathFloorPrice(b.returnNum*tPrice,b) - mathFloorPrice(b.refundNum*b.unitPrice,b)) return a + parseFloat(mathFloorPrice(b.num * tPrice,b)*1 - mathFloorPrice(b.returnNum*tPrice,b)*1 - mathFloorPrice(b.refundNum*tPrice,b)*1)
}, 0) }, 0)
console.log("减去退款退费的菜品金额===",goodsPrice) // console.log("退退===",goodsPrice)
return (goodsPrice + tableFee.value + packAmount.value).toFixed(2) return (goodsPrice + tableFee.value + packAmount.value).toFixed(2)
} }
}) })
@ -457,7 +459,8 @@
let price = pageData.goodsList.filter(v => v.discountSaleAmount > 0 && v.status !== "return").reduce((a, b) => { let price = pageData.goodsList.filter(v => v.discountSaleAmount > 0 && v.status !== "return").reduce((a, b) => {
return a + ((b.num * b.price) - (b.num * b.discountSaleAmount)) return a + ((b.num * b.price) - (b.num * b.discountSaleAmount))
}, 0) }, 0)
return price // console.log("====",price)
return price.toFixed(2)
} }
}) })
@ -466,7 +469,7 @@
*/ */
const fullCouponDiscountAmount = computed(() => { const fullCouponDiscountAmount = computed(() => {
return pays.quan.filter(v => v.type == 1).reduce((prve, cur) => { return pays.quan.filter(v => v.type == 1).reduce((prve, cur) => {
console.log("优惠券金额",prve + cur.discountAmount * 1) // console.log("",prve + cur.discountAmount * 1)
return prve + cur.discountAmount * 1 return prve + cur.discountAmount * 1
}, 0) }, 0)
}) })
@ -493,15 +496,15 @@
* 支付金额 * 支付金额
*/ */
const payPrice = computed(() => { const payPrice = computed(() => {
console.log("newOriginPrice===",newOriginPrice.value) // console.log("newOriginPrice===",newOriginPrice.value)
console.log("vipDiscount===",vipDiscount.value) // console.log("vipDiscount===",vipDiscount.value)
console.log("productCouponDiscountAmount===",productCouponDiscountAmount.value) // console.log("productCouponDiscountAmount===",productCouponDiscountAmount.value)
console.log("discount===",discount.value) // console.log("discount===",discount.value)
console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value) // console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value)
console.log("accountPoints===",accountPoints) // console.log("accountPoints===",accountPoints)
let total = (newOriginPrice.value*1) - productCouponDiscountAmount.value - discount let total = (newOriginPrice.value*1) - productCouponDiscountAmount.value - discount
.value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0) .value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
console.log("payPrice===",total) // console.log("===",total)
return (total < 0 ? 0 : total).toFixed(2) return (total < 0 ? 0 : total).toFixed(2)
}) })
@ -509,8 +512,7 @@
* 积分使用前金额 * 积分使用前金额
*/ */
const orderAmount = computed(() => { const orderAmount = computed(() => {
let total = (newOriginPrice.value*1) - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount let total = (newOriginPrice.value*1) - productCouponDiscountAmount.value - discount.value - fullCouponDiscountAmount.value
.value - fullCouponDiscountAmount.value
console.log(total) console.log(total)
return (total < 0 ? 0 : total).toFixed(2) return (total < 0 ? 0 : total).toFixed(2)
}) })
@ -527,7 +529,9 @@
}) })
watch(() => payPrice.value, (newval) => { watch(() => payPrice.value, (newval) => {
if( pageData.payUrlShow){ if( pageData.payUrlShow){
getPayUrl() setTimeout(()=>{
getPayUrl()
})
} }
if (newval <= 0) { if (newval <= 0) {
const arr = ['cash', 'member-account'] const arr = ['cash', 'member-account']
@ -577,7 +581,7 @@
originAmount: originPrice.value, //+ originAmount: originPrice.value, //+
orderAmount: payPrice.value, // orderAmount: payPrice.value, //
seatNum: pageData.seatNum, // seatNum: pageData.seatNum, //
discountAmount: discount.value, // discountAmount: discount.value.toFixed(2), //
fullCouponDiscountAmount: fullCouponDiscountAmount.value, // fullCouponDiscountAmount: fullCouponDiscountAmount.value, //
productCouponDiscountAmount: productCouponDiscountAmount.value, productCouponDiscountAmount: productCouponDiscountAmount.value,
vipPrice: vipDiscount.value != 0 ? 1: 0, // 使 vipPrice: vipDiscount.value != 0 ? 1: 0, // 使
@ -654,7 +658,7 @@
if(!goods)return; if(!goods)return;
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.price let memberPrice = goods.memberPrice ? goods.memberPrice : goods.price
tPrice = (isVip.value ? memberPrice : goods.price) tPrice = (isVip.value ? memberPrice : goods.price)
tPrice = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : tPrice tPrice = goods.discountSaleAmount ? goods.discountSaleAmount : tPrice
item.discountAmount = tPrice item.discountAmount = tPrice
}) })
@ -662,18 +666,11 @@
productCoup = []; productCoup = [];
} }
// productCoup = productCoup.filter(v => v.number >= 1) // productCoup = productCoup.filter(v => v.number >= 1)
pays.quan = [...setmanjianCoup, ...productCoup,...setproductCoup] pays.quan = [...manjianCoup, ...productCoup]
console.log("优惠券2===",pays.quan) console.log("优惠券2===",pays.quan)
} }
/**
* 删除优惠券
* @param {Object} i
*/
function delQuan(i) {
pays.quan.splice(i, 1)
}
/** /**
* 积分选择 * 积分选择
@ -701,7 +698,6 @@
if (!order.userId&&!pageData.user.userId) { if (!order.userId&&!pageData.user.userId) {
return return
} }
console.log("calcUsablePoints",pageData.user)
const res = await calcUsablePoints({ const res = await calcUsablePoints({
shopUserId: pageData.user.id, shopUserId: pageData.user.id,
orderAmount: payPrice.value orderAmount: payPrice.value
@ -716,9 +712,10 @@
accountPoints.price = 0 accountPoints.price = 0
return '' return ''
} }
console.log(payPrice.value)
const res = await calcDeductionAmount({ const res = await calcDeductionAmount({
shopUserId: pageData.user.id, shopUserId: pageData.user.id,
orderAmount: payPrice.value, orderAmount: orderAmount.value,
points: accountPoints.num points: accountPoints.num
}) })
if (res) { if (res) {
@ -751,7 +748,7 @@
go.to('PAGES_ORDER_QUAN', { go.to('PAGES_ORDER_QUAN', {
orderId: order.id, orderId: order.id,
shopUserId: pageData.user.id, shopUserId: pageData.user.id,
orderPrice: (payPrice.value * 1).toFixed(2) orderPrice: (payPrice.value * 1 + coupAllPrice.value * 1).toFixed(2)
}) })
} }
@ -786,6 +783,16 @@
}) })
} }
/**
* 删除优惠券
* @param {Object} i
*/
function delQuan(i) {
pays.quan.splice(i, 1)
discount.discount = 100
discount.value = 0
}
/** /**
* 选择用户 * 选择用户
*/ */
@ -802,6 +809,8 @@
console.log(data); console.log(data);
pageData.user = data pageData.user = data
pays.quan = [] pays.quan = []
discount.discount = 100
discount.value = 0
init() init()
}) })
} }
@ -819,7 +828,6 @@
function watchChoosebuyer() { function watchChoosebuyer() {
uni.$off('choose-buyer') uni.$off('choose-buyer')
uni.$on('choose-buyer', (data) => { uni.$on('choose-buyer', (data) => {
console.log(data);
pageData.buyer = data pageData.buyer = data
}) })
} }
@ -830,13 +838,11 @@
* @param {Object} form * @param {Object} form
*/ */
function editDiscountConfirm(form) { function editDiscountConfirm(form) {
console.log(form);
accountPoints.sel = false accountPoints.sel = false
Object.assign(discount, { Object.assign(discount, {
...form, ...form,
value: form.price - form.currentPrice value: form.price - form.currentPrice
}) })
console.log(discount.discount);
const fullCoupon = pays.quan.find(v => v.type == 1) const fullCoupon = pays.quan.find(v => v.type == 1)
if (fullCoupon && form.currentPrice < fullCoupon.fullAmount) { if (fullCoupon && form.currentPrice < fullCoupon.fullAmount) {
modal.content = '改价后价格不满足满减券最低满减需求' + fullCoupon.fullAmount + '元' modal.content = '改价后价格不满足满减券最低满减需求' + fullCoupon.fullAmount + '元'
@ -845,7 +851,7 @@
modal.cancelText = '取消改价' modal.cancelText = '取消改价'
modal.confirmText = '删除满减券' modal.confirmText = '删除满减券'
} }
getPayUrl()
} }
/** /**
@ -858,12 +864,10 @@
return uni.$utils.showToast(item.payName + '不可用') return uni.$utils.showToast(item.payName + '不可用')
} }
pays.payTypes.selIndex = i pays.payTypes.selIndex = i
console.log(item.payType)
console.log(pageData.user.id)
if (item.payType == 'member-account' && !pageData.user.id) { if (item.payType == 'member-account' && !pageData.user.id) {
chooseUser() chooseUser()
} }
if (item.payType == 'virtual' && !pageData.buyer.id) { if (item.payType == 'arrears' && !pageData.buyer.id) {
chooseBuyer() chooseBuyer()
} }
@ -894,19 +898,17 @@
} }
function payOrderClick() { function payOrderClick() {
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
console.log(payType);
if (payType == 'scanCode' || payType == 'deposit') { if (payType == 'scanCode' || payType == 'deposit') {
return saomaPay(payType) return saomaPay(payType)
} }
if (payType == 'cash' && payPrice.value * 1 > 0) { if (payType == 'cash' && payPrice.value * 1 > 0) {
return cashConfirmShow() return cashConfirmShow()
} }
if (payType == 'virtual') { if (payType == 'arrears' && pageData.buyer.remainingAmount < payPrice.value * 1 ) {
// return cashConfirmShow() return uni.$utils.showToast('挂账额度不足')
} }
if (payType == 'member-account' && pageData.user.amount * 1 < payPrice.value * 1) { if (payType == 'member-account' && pageData.user.amount * 1 < payPrice.value * 1) {
uni.$utils.showToast('余额不足') return uni.$utils.showToast('余额不足')
return
} }
if (payStatus) { if (payStatus) {
return uni.$utils.showToast(tipsMap[payStatus]) return uni.$utils.showToast(tipsMap[payStatus])
@ -939,7 +941,7 @@
if( order.userId||pageData.user.userId ){ if( order.userId||pageData.user.userId ){
params.checkOrderPay.userId = order.userId||pageData.user.userId params.checkOrderPay.userId = order.userId||pageData.user.userId
} }
if( payType == 'virtual' ){ if( payType == 'arrears' ){
params.creditBuyerId = pageData.buyer.id params.creditBuyerId = pageData.buyer.id
} }
@ -953,7 +955,7 @@
if (payType == 'cash') { if (payType == 'cash') {
await cashPay(params) await cashPay(params)
} }
if (payType == 'virtual') { if (payType == 'arrears') {
await creditPay(params) await creditPay(params)
} }
if( payType == 'member-account' || payType == 'deposit' ) { if( payType == 'member-account' || payType == 'deposit' ) {
@ -984,6 +986,10 @@
console.log(res) console.log(res)
},1000) },1000)
} }
if( error.code == 701 ){
uni.removeStorageSync("table_code")
uni.navigateBack()
}
payStatus = ''; payStatus = '';
return false; return false;
} }
@ -1005,6 +1011,13 @@
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })
websocketUtil.send(JSON.stringify({
type:'onboc',
account: uni.getStorageSync("iToken").loginId,
shop_id: uni.getStorageSync("shopInfo").id,
operate_type:'cleanup',
table_code: order.tableCode,
}))
}, 1500) }, 1500)
} }

View File

@ -73,10 +73,8 @@
{{ item.useRestrictions }} {{ item.useRestrictions }}
</view> </view>
</view> </view>
<view class="right u-flex u-flex-col u-col-bottom u-row-center"> <view class="right u-flex u-flex-col u-col-bottom u-row-center" style="flex-shrink: 1;">
<view class="u-flex "> <view class="use-btn" @click.stop="toEmitChooseQuan(item)" style="flex-shrink: 1;">去使用</view>
<view class="use-btn" @click.stop="toEmitChooseQuan(item)">去使用</view>
</view>
</view> </view>
</view> </view>
@ -142,7 +140,8 @@
returnCoupCanUse, returnCoupCanUse,
returnCouponAllPrice, returnCouponAllPrice,
returnProductCoupon, returnProductCoupon,
returnCanUseFullReductionCoupon returnCanUseFullReductionCoupon,
returnProductAllCoup
} from '../quan_util.js' } from '../quan_util.js'
import { getHistoryOrder } from '@/http/api/order.js' import { getHistoryOrder } from '@/http/api/order.js'
import { shopUserDetail } from '@/http/api/shopUser.js' import { shopUserDetail } from '@/http/api/shopUser.js'
@ -227,13 +226,12 @@
}) })
pageData.order = await getHistoryOrder({orderId:option.orderId}) pageData.order = await getHistoryOrder({orderId:option.orderId})
console.log(pageData.order);
const res = await getFindCoupon({ const res = await getFindCoupon({
shopUserId: option.shopUserId, shopUserId: option.shopUserId,
type: pageData.types.sel+1 type: pageData.types.sel+1
}) })
let fullReductionCoupon = res.filter(v => v.type == 1) let fullReductionCoupon = res ? res.filter(v => v.type == 1) : []
let productCoupon = res.filter(v => v.type == 2) let productCoupon = res ? res.filter(v => v.type == 2) : []
canDikouGoodsArr = returnNewGoodsList(pageData.order.detailMap || []) canDikouGoodsArr = returnNewGoodsList(pageData.order.detailMap || [])
fullReductionCoupon = fullReductionCoupon.map((v) => { fullReductionCoupon = fullReductionCoupon.map((v) => {
@ -259,7 +257,6 @@
// .filter((v) => v.use); // .filter((v) => v.use);
pageData.fullReductionCoupon = fullReductionCoupon pageData.fullReductionCoupon = fullReductionCoupon
pageData.productCoupon = productCoupon pageData.productCoupon = productCoupon
console.log(res)
pageData.hasAjax = true; pageData.hasAjax = true;
} }
@ -316,8 +313,6 @@
const goodsQuan = pageData.productCoupon.filter(v => v.checked) const goodsQuan = pageData.productCoupon.filter(v => v.checked)
let coupArr = [...goodsQuan, item] let coupArr = [...goodsQuan, item]
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user) const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user)
console.log(payPrice)
if (payPrice<=0) { if (payPrice<=0) {
modal.content = '选择该商品券后支付金额将为0继续选择将取消选择的满减券' modal.content = '选择该商品券后支付金额将为0继续选择将取消选择的满减券'
modal.cancelText = '取消' modal.cancelText = '取消'
@ -333,7 +328,7 @@
return return
} }
} }
console.log(2)
item.checked = !item.checked item.checked = !item.checked
const CheckedArr = pageData.productCoupon.filter(v => v.checked) const CheckedArr = pageData.productCoupon.filter(v => v.checked)
if (CheckedArr.length <= 0) { if (CheckedArr.length <= 0) {
@ -569,7 +564,6 @@
&.goods { &.goods {
.right { .right {
background-color: #fff; background-color: #fff;
position: initial;
.use-btn { .use-btn {
padding: 10rpx 40rpx; padding: 10rpx 40rpx;

View File

@ -1,5 +1,5 @@
export function isTui(item) { export function isTui(item) {
console.log("isTui",item.status); // console.log("isTui",item.status);
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding' return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
} }
//是否使用会员价 //是否使用会员价
@ -22,11 +22,7 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
//返回新的商品列表,过滤掉退菜的,退单的商品 //返回新的商品列表,过滤掉退菜的,退单的商品
export function returnNewGoodsList(arr) { export function returnNewGoodsList(arr) {
let goods_list = [] return uni.$utils.objToArrary(arr).filter(v => !isTui(v))
Object.values(arr).forEach(item=>{
goods_list = [...goods_list,...item]
})
return goods_list.filter(v => !isTui(v))
} }
//根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用 //根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用
export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) { export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
@ -38,10 +34,10 @@ export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
return false return false
} }
const findGoodsTotalNumber = findGoods.reduce((prve, cur) => { const findGoodsTotalNumber = findGoods.reduce((prve, cur) => {
return prve + cur.num * 1 return prve + cur.num
}, 0) }, 0)
const selCoupNumber = selCoupArr.filter(v => v.proId == coup.proId).reduce((prve, cur) => { const selCoupNumber = selCoupArr.filter(v => v.proId == coup.proId).reduce((prve, cur) => {
return prve + cur.num * 1 return prve + 1
}, 0) }, 0)
if (selCoupNumber >= findGoodsTotalNumber) { if (selCoupNumber >= findGoodsTotalNumber) {
return false return false
@ -59,9 +55,10 @@ export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
use: false use: false
} }
} }
const memberPrice = item.memberPrice ? item.memberPrice : item.price; let memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0; let price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
const discountAmount = (price * coup.num).toFixed(2) price = item.discountSaleAmount ? item.discountSaleAmount : price
const discountAmount = (price * 1).toFixed(2)
// const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr)) // const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
// const canUse=discountAmount>0 // const canUse=discountAmount>0
@ -90,9 +87,10 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
} }
//返回商品实际支付价格 //返回商品实际支付价格
export function returnProductPayPrice(goods,vipUser){ export function returnProductPayPrice(goods,vipUser){
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.unitPrice; console.log(goods)
let price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.unitPrice; let memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
price = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : price let price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
price = goods.discountSaleAmount ? goods.discountSaleAmount : price
return price return price
} }
//返回商品券抵扣的商品价格 //返回商品券抵扣的商品价格
@ -129,11 +127,7 @@ export function returnProCoupStartIndex(coupArr,index){
} }
//返回商品数量从0到n每一个对应的价格对照表 //返回商品数量从0到n每一个对应的价格对照表
export function returnGoodsPayPriceMap(goodsArr){ export function returnGoodsPayPriceMap(goodsArr){
let goods_arr = [] return goodsArr.reduce((prve,cur)=>{
Object.values(goodsArr).forEach(item=>{
goods_arr = [...goods_arr,...Object.values(item)]
})
return goods_arr.reduce((prve,cur)=>{
if(!prve.hasOwnProperty(cur.productId)){ if(!prve.hasOwnProperty(cur.productId)){
prve[cur.productId]=[] prve[cur.productId]=[]
} }

View File

@ -0,0 +1,77 @@
<template>
<uni-popup ref="popup" type="top" mask-background-color="rgba(0,0,0,.5)" :safe-area="false">
<view class="card-wrapper">
<image class="icon-close" src="/static/iconImg/icon-x.svg" mode="scaleToFill" @tap="close" />
<view class="title">请输入支付密码</view>
<view class="sub-title">退款</view>
<view class="refund-money">{{ vdata.refundAmount }}</view>
<JPasswordInput v-if="vdata.isShowPwdInput" margin="0 50rpx" :focus="true" ref="pwdInput" @inputChange="inputChange" />
</view>
</uni-popup>
</template>
<script setup>
import { onMounted, reactive, ref, nextTick } from 'vue'
const vdata = reactive({
refundAmount: 0,
isShowPwdInput: false,
})
const proms = {}
const popup = ref(null)
const pwdInput = ref(null)
const open = (money, callBack) => {
vdata.refundAmount = money
vdata.callBack = callBack
popup.value.open()
vdata.isShowPwdInput = false
nextTick(() => {
vdata.isShowPwdInput = true
})
}
const close = () => {
popup.value.close()
vdata.isShowPwdInput = false
}
// e
const inputChange = (e) => {
if (e.length >= 6) return vdata.callBack(e)
}
const clearInput = () => pwdInput.value.clearInput()
defineExpose({ open, clearInput, close })
</script>
<style lang="scss" scoped>
.card-wrapper {
margin: 0 50rpx;
padding-bottom: 50rpx;
margin-top: 162rpx;
background-color: $J-bg-ff;
border-radius: $J-b-r32;
.icon-close {
padding: 30rpx;
width: 60rpx;
height: 60rpx;
}
.title {
text-align: center;
font-size: 30rpx;
font-weight: 500;
}
.sub-title {
margin-top: 40rpx;
margin-bottom: 20rpx;
text-align: center;
font-size: 30rpx;
color: #808080;
}
.refund-money {
margin-bottom: 70rpx;
text-align: center;
font-size: 50rpx;
font-weight: 500;
}
}
</style>

View File

@ -39,7 +39,7 @@
<view class="u-flex u-m-l-32 u-col-center"> <view class="u-flex u-m-l-32 u-col-center">
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon> <up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view> <view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
<up-icon @click="changeItem(item,1)" :color="color.ColorMain" :size="20" <up-icon @click="changeItem(item,1)" :color="$utils.ColorMain" :size="20"
name="plus-circle-fill"></up-icon> name="plus-circle-fill"></up-icon>
</view> </view>
</view> </view>
@ -93,8 +93,9 @@
<view style="height: 200rpx;"></view> <view style="height: 200rpx;"></view>
<view class="fixed-b"> <view class="fixed-b">
<up-button text="确认退款" @click="tuikuanConfirm" shape="circle" type="primary" size="large" <up-button text="确认退款" @click="tuikuanConfirm" shape="circle" type="primary" size="large"
:color="color.ColorMain"></up-button> :color="$utils.ColorMain"></up-button>
</view> </view>
<confirmRefundPopup ref="refundPopup" />
</view> </view>
</template> </template>
@ -102,8 +103,8 @@
<script setup> <script setup>
import { computed, reactive, ref, watch } from 'vue'; import { computed, reactive, ref, watch } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app'; import { onLoad, onShow } from '@dcloudio/uni-app';
import color from '@/commons/color.js'; import confirmRefundPopup from './components/confirmRefundPopup.vue';
import infoBox from '@/commons/utils/infoBox.js';
import {hasPermission} from '@/commons/utils/hasPermission.js' import {hasPermission} from '@/commons/utils/hasPermission.js'
import { refundOrder } from '@/http/api/order.js' import { refundOrder } from '@/http/api/order.js'
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js' import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
@ -132,10 +133,11 @@
totalAmount: 0 totalAmount: 0
} }
}) })
const refundPopup = ref(null);
onLoad((opt) => { onLoad((opt) => {
orderDetail.info = JSON.parse(opt.orderInfo) orderDetail.info = JSON.parse(opt.orderInfo)
orderDetail.goodsList = JSON.parse(opt.goodsList) orderDetail.goodsList = JSON.parse(opt.goodsList)
console.log(orderDetail)
option.productId = orderDetail.goodsList[0].productId option.productId = orderDetail.goodsList[0].productId
option.orderId = orderDetail.goodsList[0].orderId option.orderId = orderDetail.goodsList[0].orderId
}) })
@ -251,22 +253,23 @@
/** /**
* 确认退款 * 确认退款
*/ */
let params;
async function tuikuanConfirm() { async function tuikuanConfirm() {
const canTuikuan=await hasPermission('允许退款') const canTuikuan=await hasPermission('允许退款')
if(!canTuikuan){ if(!canTuikuan){
return infoBox.showToast('您没有退款权限') return uni.$utils.showToast('您没有退款权限')
} }
if (pageData.tabsIndex != 2&&tuikuanNumber.value <= 0) { if (pageData.tabsIndex != 2&&tuikuanNumber.value <= 0) {
return infoBox.showToast('退款商品数量不能为0') return uni.$utils.showToast('退款商品数量不能为0')
} }
const selTag=tuikuan.list[tuikuan.sel] const selTag=tuikuan.list[tuikuan.sel]
const noteResult=`${selTag?selTag:''}${note.value?(','+note.value):''}` const noteResult=`${selTag?selTag:''}${note.value?(','+note.value):''}`
if (!noteResult) { if (!noteResult) {
return infoBox.showToast('请输入或选择退款原因!') return uni.$utils.showToast('请输入或选择退款原因!')
} }
let params = { params = {
orderId: option.orderId, orderId: option.orderId,
refundReason: noteResult, refundReason: noteResult,
refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{ refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
@ -285,10 +288,21 @@
params.refundAmount = pageData.tabsIndex == 1 ? alltuikuanPrice.value : tuikuanPrice.value params.refundAmount = pageData.tabsIndex == 1 ? alltuikuanPrice.value : tuikuanPrice.value
} }
if ( pageData.tabsIndex == 2 && params.refundAmount > orderDetail.info.payAmount){ if ( pageData.tabsIndex == 2 && params.refundAmount > orderDetail.info.payAmount){
return infoBox.showToast('退款金额不能大于付款金额!') return uni.$utils.showToast('退款金额不能大于付款金额!')
}
if( uni.getStorageSync("shopInfo").isReturnPwd == 1){
refundPopup.value.open(params.refundAmount, refundPost);
return;
}
refundPost()
}
async function refundPost (payPassword) {
if( payPassword ){
params.pwd = payPassword
} }
await refundOrder(params) await refundOrder(params)
infoBox.showToast('退款请求提交成功') uni.$utils.showToast('退款请求提交成功')
setTimeout(()=>{ setTimeout(()=>{
uni.navigateBack({delta:1}) uni.navigateBack({delta:1})
},500) },500)

View File

@ -47,7 +47,6 @@
style="display: flex; flex-direction: column; align-items: center; justify-content: center;"> style="display: flex; flex-direction: column; align-items: center; justify-content: center;">
<!-- <view>{{subsectioncurrent==0?'请用美团':'抖音'}}</view> --> <!-- <view>{{subsectioncurrent==0?'请用美团':'抖音'}}</view> -->
<view style="padding-bottom:40rpx;font-weight: 600;">请进行手机扫码</view> <view style="padding-bottom:40rpx;font-weight: 600;">请进行手机扫码</view>
<!-- <up-qrcode :size="200" :val="qrcodes.val" :icon='qrcodes.icon'></up-qrcode> -->
<up-qrcode :size="200" :val="qrcodes.val"></up-qrcode> <up-qrcode :size="200" :val="qrcodes.val"></up-qrcode>
</view> </view>
</view> </view>