更换正式环境,测试修改
This commit is contained in:
parent
f01bc839f7
commit
7fe5d028e4
6
App.vue
6
App.vue
|
|
@ -6,13 +6,15 @@ App.vue本身不是页面,这里不能编写视图元素,也就是没有<tem
|
|||
import { onLaunch } from '@dcloudio/uni-app';
|
||||
import { getVersion } from '@/http/api/index.js'
|
||||
import appConfig from '@/config/appConfig.js';
|
||||
import { provide } from 'vue';
|
||||
|
||||
import { provide,onMounted } from 'vue';
|
||||
import WebsocketUtil from '@/commons/utils/websocket.js'
|
||||
|
||||
const websocketUtil = new WebsocketUtil(appConfig.wss, 5000); // 创建 WebSocket 工具类实例
|
||||
provide('websocketUtil', websocketUtil); // 提供给所有子组件
|
||||
onMounted(() => {
|
||||
|
||||
|
||||
});
|
||||
onLaunch(() => {
|
||||
let that = this
|
||||
uni.hideTabBar()
|
||||
|
|
|
|||
|
|
@ -43,21 +43,35 @@ export const $invoicingType = [{
|
|||
value: ''
|
||||
},
|
||||
{
|
||||
text: '供应商入库',
|
||||
value: 'purveyor'
|
||||
text: '手动入库',
|
||||
value: 'manual-in'
|
||||
},
|
||||
{
|
||||
text: '供应商退货',
|
||||
value: 'reject'
|
||||
text: '手动出库',
|
||||
value: 'manual-out'
|
||||
},
|
||||
{
|
||||
text: '其他入库',
|
||||
value: 'purchase'
|
||||
text: '盘盈入库',
|
||||
value: 'win-in'
|
||||
},
|
||||
{
|
||||
text: '其他出库',
|
||||
text: '盘亏出库',
|
||||
value: 'loss-out'
|
||||
},
|
||||
{
|
||||
text: '订单退款入库',
|
||||
value: 'other-out'
|
||||
},
|
||||
{
|
||||
text: '订单消费出库',
|
||||
value: 'order-out'
|
||||
},
|
||||
{
|
||||
text: '损耗出库',
|
||||
value: 'damage-out'
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
// 页面常用数据
|
||||
|
|
|
|||
|
|
@ -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, '');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -20,14 +20,10 @@ export function canTuiKuan(orderInfo, item) {
|
|||
if( item ){
|
||||
return (orderInfo.status == 'done' || orderInfo.status == 'part_refund')
|
||||
&& item.status != 'return' && item.status != 'refund' && item.status != 'refunding'
|
||||
&& (item.returnAmount < item.num*item.unitPrice)
|
||||
&& (item.returnNum < item.num)
|
||||
} else {
|
||||
let goodsList = []
|
||||
let data = false;
|
||||
Object.entries(orderInfo.detailMap).map(([key, value]) => (
|
||||
goodsList = [...goodsList,...value]
|
||||
))
|
||||
goodsList.some((v,i)=>{
|
||||
uni.$utils.objToArrary(orderInfo.detailMap).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) ){
|
||||
data = true
|
||||
return data
|
||||
|
|
|
|||
|
|
@ -16,8 +16,26 @@ export const utils = {
|
|||
* 限制金额输入格式
|
||||
* @param {Object} e
|
||||
*/
|
||||
isPrice (e) {
|
||||
return e.replace(/[^0-9.]/g, '').replace(/\.{2,}/g, "").replace(/^\./, '')
|
||||
isMoney (e) {
|
||||
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])
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
export const objToArrary = (obj,keyNewName) => {
|
||||
return Object.entries(obj).map(([key, value]) => ({
|
||||
key,
|
||||
[keyNewName]:key,
|
||||
...value,
|
||||
}))
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ class WebsocketUtil {
|
|||
}
|
||||
this.heartbeatInterval = setInterval(() => {
|
||||
if (this.isOpen) {
|
||||
this.send(JSON.stringify({"type": "ping_interval"}));
|
||||
this.send(JSON.stringify({"type": "ping_interval","set": "onboc"}));
|
||||
}
|
||||
}, this.time);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -67,16 +67,18 @@
|
|||
form.discount = (newval*100/form.price).toFixed(2)
|
||||
}
|
||||
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){
|
||||
if(newval<0){
|
||||
form.currentPrice=0
|
||||
form.currentPrice = '0.00'
|
||||
form.discount=100
|
||||
return infoBox.showToast('实收金额不能小于0')
|
||||
}
|
||||
if(newval>props.price){
|
||||
form.currentPrice=props.price
|
||||
console.log(props.price)
|
||||
console.log(newval)
|
||||
if(newval > props.price){
|
||||
form.currentPrice = (uni.$utils.isMoney(props.price)*1).toFixed(2)
|
||||
form.discount=0
|
||||
return infoBox.showToast('实收金额不能大于应付金额')
|
||||
}
|
||||
|
|
@ -95,7 +97,7 @@
|
|||
}
|
||||
|
||||
const $form = {
|
||||
price:props.price,
|
||||
price: props.price,
|
||||
currentPrice: props.price,
|
||||
discount: 100
|
||||
}
|
||||
|
|
@ -103,7 +105,7 @@
|
|||
...$form
|
||||
})
|
||||
watch(()=>props.price,(newval)=>{
|
||||
form.price=newval
|
||||
form.price = (newval*1).toFixed(2)
|
||||
form.currentPrice=newval
|
||||
})
|
||||
function resetForm() {
|
||||
|
|
@ -116,9 +118,10 @@
|
|||
|
||||
function open() {
|
||||
model.value.open()
|
||||
form.price=props.price
|
||||
form.price= (props.price*1).toFixed(2)
|
||||
form.discount=props.discount
|
||||
form.currentPrice=(props.discount*props.price/100).toFixed(2)
|
||||
console.log(form)
|
||||
}
|
||||
|
||||
function close() {
|
||||
|
|
|
|||
|
|
@ -63,9 +63,7 @@
|
|||
function FileUploadselect(e) {
|
||||
for (let i in e.tempFiles) {
|
||||
const file = e.tempFiles[i]
|
||||
console.log(e)
|
||||
uploadFile(file).then(res => {
|
||||
console.log(res);
|
||||
imgList.value.push({
|
||||
url: res,
|
||||
path: file.path
|
||||
|
|
@ -104,7 +102,6 @@
|
|||
}
|
||||
|
||||
function change() {
|
||||
console.log(getFileList());
|
||||
emits('change', getFileList())
|
||||
}
|
||||
defineExpose({
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ const appConfig = {
|
|||
// 环境变量相关
|
||||
env: {},
|
||||
|
||||
wss: "wss://sockets.sxczgkj.com/wss",
|
||||
// wss: "wss://sockets.sxczgkj.com/wss", //测试环境
|
||||
wss: "wss://czgeatws.sxczgkj.com/wss", //正式环境
|
||||
// 环境变量常量
|
||||
ENV_ENUM: {
|
||||
DEVELOPMENT: 'development', // 本地调试地址
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 商品分类----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,13 +22,14 @@ import { reject } from 'lodash';
|
|||
let baseUrl = '/api/'
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
let baseUrl = 'https://tapi.cashier.sxczgkj.cn/'
|
||||
// #endif
|
||||
// let baseUrl = 'https://tapi.cashier.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
|
||||
|
||||
|
|
|
|||
3
main.js
3
main.js
|
|
@ -4,6 +4,7 @@ import envConfig from '@/env/config.js'
|
|||
import appConfig from '@/config/appConfig.js'
|
||||
import storageManage from '@/commons/utils/storageManage.js'
|
||||
import {utils} from '@/commons/utils/index.js'
|
||||
import {directive} from '@/commons/utils/directive.js'
|
||||
import uviewPlus from 'uview-plus'
|
||||
|
||||
// 设置node环境
|
||||
|
|
@ -38,6 +39,8 @@ export function createApp() {
|
|||
app.config.globalProperties.$utils = utils
|
||||
uni.$utils = utils
|
||||
|
||||
// 全局注册指令
|
||||
app.directive('only-number', directive.vOnlyNumber);
|
||||
return {
|
||||
app
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
</view>
|
||||
<view class="boxconstantbox_tow">
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -17,7 +17,10 @@
|
|||
</view>
|
||||
<view class="boxconstantbox_tow">
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -44,7 +47,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onShow, } from '@dcloudio/uni-app';
|
||||
import { onShow ,onLoad} from '@dcloudio/uni-app';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
|
||||
import { getFreeDing, updateFreeDing } from '@/http/api/freeDing.js'
|
||||
|
|
@ -54,11 +57,12 @@
|
|||
enable: false,
|
||||
rechargeDesc: '',
|
||||
});
|
||||
|
||||
onLoad(()=>{
|
||||
// uni.$utils.inputReg.bind()()
|
||||
})
|
||||
onShow(() => {
|
||||
getlist()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取配置信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -145,9 +145,6 @@
|
|||
* @param {Object} key
|
||||
*/
|
||||
function onfileChange(val, data, key) {
|
||||
console.log(val)
|
||||
console.log(data)
|
||||
console.log(key)
|
||||
data[key] = val
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<my-model desc="请确保此分类下没有任何商品确认删除?" ref="delModel" @confirm="delModelConfirm"></my-model>
|
||||
|
||||
<!-- 分类修改排序弹窗 -->
|
||||
<my-model ref="goodsSortModel" title="修改排序" @close="goodsSortModelClose">
|
||||
<my-model ref="goodsSortModel" title="修改排序" >
|
||||
<template #desc>
|
||||
<view class="u-p-40 u-text-left">
|
||||
<view>
|
||||
|
|
|
|||
|
|
@ -20,112 +20,96 @@
|
|||
<view> 预警值 </view>
|
||||
<view> <input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id=""> </view>
|
||||
</view>
|
||||
<view style="justify-content: space-between;">
|
||||
<view v-if="!datas.form.id" style="justify-content: space-between;">
|
||||
<view> 耗材类型 </view>
|
||||
<view style="width: 54%;" @tap="datas.showStatus = !datas.showStatus">
|
||||
{{datas.typelist[datas.nowStatusIndex]}}
|
||||
<view style="width: 54%;" @tap="datas.show = !datas.show">
|
||||
{{datas.consGroupName||'请选择耗材类型'}}
|
||||
</view>
|
||||
<uni-icons type="bottom" size="16"></uni-icons>
|
||||
</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">
|
||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
||||
text="保存"></up-button>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
computed,
|
||||
onMounted,
|
||||
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';
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js';
|
||||
|
||||
let datas = reactive({
|
||||
show: false,
|
||||
form: {
|
||||
conWarning: 999
|
||||
conUnit: '',
|
||||
conName: '',
|
||||
price: '',
|
||||
conWarning: 999,
|
||||
consGroupId: null,
|
||||
},
|
||||
showStatus: false,
|
||||
list: [],
|
||||
typelist: [],
|
||||
nowStatusIndex: 0
|
||||
consGroupName: '',
|
||||
typeList: [],
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
gettbConsTypeList()
|
||||
onLoad((options) => {
|
||||
if( options && options.item ) {
|
||||
let obj = JSON.parse(options.item)
|
||||
datas.form = obj
|
||||
} else {
|
||||
gettbConsTypeList()
|
||||
}
|
||||
uni.setNavigationBarTitle({
|
||||
title: !datas.form.id ? '添加耗材' : '编辑耗材'
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取耗材类别
|
||||
*/
|
||||
let gettbConsTypeList = () => {
|
||||
datas.typelist = []
|
||||
getConsGrpupList({
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 30,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
}).then(res => {
|
||||
datas.list = res
|
||||
res.forEach(ele => {
|
||||
datas.typelist.push(ele.name)
|
||||
})
|
||||
datas.typeList = [res]
|
||||
})
|
||||
}
|
||||
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, "")
|
||||
if (!conUnitdata) {
|
||||
refs.ctx.$refs.uToastRef.show({
|
||||
type: 'default',
|
||||
message: "单位不能为空"
|
||||
})
|
||||
uni.$utils.showToast('单位不能为空')
|
||||
return
|
||||
}
|
||||
if (!datas.form.price) {
|
||||
refs.ctx.$refs.uToastRef.show({
|
||||
type: 'default',
|
||||
message: "价格不能为空"
|
||||
})
|
||||
uni.$utils.showToast('价格不能为空')
|
||||
return
|
||||
}
|
||||
console.log(datas.list, 'tiaoshi1')
|
||||
console.log(datas.list[datas.nowStatusIndex], 'tiaoshi1')
|
||||
addCons({
|
||||
...datas.form,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
consGroupId: datas.list[datas.nowStatusIndex].id
|
||||
}).then(res => {
|
||||
// go.to('PAGES_SALES_CONSUMABLES')
|
||||
go.back()
|
||||
})
|
||||
if (!datas.form.consGroupId) {
|
||||
uni.$utils.showToast('耗材类型不能为空')
|
||||
return
|
||||
}
|
||||
if ( !datas.form.id) {
|
||||
await addCons({...datas.form})
|
||||
} else {
|
||||
await editCons({...datas.form})
|
||||
}
|
||||
uni.navigateBack()
|
||||
}
|
||||
const statusHeight = computed(() => {
|
||||
return 30 * datas.typelist.length + 14 + 'px'
|
||||
})
|
||||
|
||||
function changeNowStatusIndex(i) {
|
||||
datas.nowStatusIndex = i
|
||||
datas.showStatus = false
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
page {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="addType">
|
||||
<view v-for="item in datas.list">
|
||||
<view v-for="(item,index) in datas.list" :key="index">
|
||||
<view class="">
|
||||
{{item.name}}<up-icon color="#64A7FE" name="edit-pen" @tap="showoneEvent(item)"></up-icon>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -2,44 +2,24 @@
|
|||
<view class="warehouseEntry">
|
||||
<view>
|
||||
<view>
|
||||
<view>
|
||||
<text style="color: red;">*</text> 供应商
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入供应商名称" v-model="datas.form.name" name="" id="">
|
||||
</view>
|
||||
<view><text style="color: red;">*</text>供应商</view>
|
||||
<view><input type="text" placeholder="请输入供应商名称" v-model="datas.form.name" name="" id=""></view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<text style="color: red;">*</text> 联系电话
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入联系电话" v-model="datas.form.telephone" name="" id="">
|
||||
</view>
|
||||
<view><text style="color: red;">*</text>联系电话</view>
|
||||
<view><input type="text" placeholder="请输入联系电话" v-model="datas.form.telephone" name="" id=""></view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<text style="color: red;">*</text> 地址
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入地址" v-model="datas.form.address" name="" id="">
|
||||
</view>
|
||||
<view><text style="color: red;">*</text>地址</view>
|
||||
<view><input type="text" placeholder="请输入地址" v-model="datas.form.address" name="" id=""></view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<text style="color: red;">*</text> 排序
|
||||
</view>
|
||||
<view>
|
||||
<input type="number" placeholder="请输入排序" @change="datas.form.sort=$utils.isNumber(datas.form.sort)" v-model="datas.form.sort" name="" id="">
|
||||
</view>
|
||||
<view><text style="color: red;">*</text>排序</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>
|
||||
<input type="text" placeholder="请输入备注" v-model="datas.form.remark" name="" id="">
|
||||
</view>
|
||||
<view>备注</view>
|
||||
<view><input type="text" placeholder="请输入备注" v-model="datas.form.remark" name="" id=""></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<view class="reportDamage_cell">
|
||||
<view class="cell_lable">报损图片</view>
|
||||
<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>
|
||||
<view class="del" @tap="del(index)">
|
||||
<up-icon name="trash" color="#fff" size="25" @tap="plus"></up-icon>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -1,27 +1,18 @@
|
|||
<template>
|
||||
<view class="ConsumablesTop">
|
||||
<view @tap="showStatus = !showStatus" style="display: flex;align-items: center;">
|
||||
{{datas.title}}<up-icon name="arrow-down" size="12"></up-icon>
|
||||
<view @tap="pageData.show = !pageData.show" style="display: flex;align-items: center;">
|
||||
{{pageData.title}}<up-icon name="arrow-down" size="12"></up-icon>
|
||||
</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 @tap="toUrl('PAGES_ADD_TYPE') ">
|
||||
新增类别
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view :style="{height: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.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 class="ConsumablesConent" v-if="pageData.list.length">
|
||||
<view v-for="(item,index) in pageData.list" :key="index">
|
||||
<view> {{item.conName}}
|
||||
<view> {{item.consGroupName}} </view>
|
||||
</view>
|
||||
|
|
@ -59,7 +50,6 @@
|
|||
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')"> 新增耗材 </view>
|
||||
<view @tap="toUrl('PAGES_SUPPLIER')"> 供应商管理 </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>
|
||||
|
||||
<up-popup :show="show" :round="18" mode="center" >
|
||||
|
|
@ -74,69 +64,69 @@
|
|||
</view>
|
||||
</view>
|
||||
</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>
|
||||
|
||||
<script setup>
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
import myActionSheet from './components/my-action-sheet';
|
||||
import myReportDamage from './components/my-reportDamage';
|
||||
import color from '@/commons/color.js';
|
||||
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
import { getConsPage,getConsGrpupList } from '@/http/api/cons.js';
|
||||
|
||||
let reportDamage = ref(null)
|
||||
let refMoreSheet = ref(null)
|
||||
let show = ref(false)
|
||||
let showData = ref()
|
||||
const report = reactive({
|
||||
data: {
|
||||
// thumbnail: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240918/a17a62b7b55a4b65a2a2542050672b34.png',
|
||||
name: "美式咖啡",
|
||||
// title: "商品报损",
|
||||
unit: "杯",
|
||||
},
|
||||
})
|
||||
let datas = reactive({
|
||||
let pageData = reactive({
|
||||
show: false,
|
||||
query: {
|
||||
conName: '',
|
||||
consGroupId: '',
|
||||
size: 100,
|
||||
page: 1
|
||||
},
|
||||
list: [],
|
||||
conName: "",
|
||||
showtwo: false,
|
||||
status: '0',
|
||||
// 类型列表
|
||||
typeList: [],
|
||||
// 类型列表渲染数组
|
||||
typeLists: ['全部'],
|
||||
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(() => {
|
||||
getList()
|
||||
// 获取分类列表
|
||||
gettbConsTypeList()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取耗材列表
|
||||
*/
|
||||
async function getList(d = "") {
|
||||
getConsPage({
|
||||
conName: datas.conName,
|
||||
conTypeId: d,
|
||||
size: 100,
|
||||
page: 1
|
||||
}).then(res => {
|
||||
datas.list = res.records
|
||||
async function getList() {
|
||||
getConsPage(pageData.query).then(res => {
|
||||
pageData.list = res.records
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -144,27 +134,19 @@
|
|||
* 获取耗材类别
|
||||
*/
|
||||
let gettbConsTypeList = () => {
|
||||
datas.typeLists = ['全部']
|
||||
getConsGrpupList({
|
||||
page: 1,
|
||||
size: 30,
|
||||
}).then(res => {
|
||||
datas.typeList = res
|
||||
res.forEach(ele => {
|
||||
datas.typeLists.push(ele.name)
|
||||
})
|
||||
pageData.typeList = [[{name:'全部',id:''},...res]]
|
||||
})
|
||||
}
|
||||
function changeNowStatusIndex(i) {
|
||||
nowStatusIndex.value = i
|
||||
showStatus.value = false
|
||||
if (i == 0) {
|
||||
datas.title = '全部'
|
||||
getList()
|
||||
} else {
|
||||
datas.title = datas.typeList[i - 1].conTypeName
|
||||
getList(datas.typeList[i - 1].id)
|
||||
}
|
||||
|
||||
function confirmConsGroup(e){
|
||||
pageData.show = false
|
||||
pageData.query.consGroupId = e.value[0].id
|
||||
pageData.title = e.value[0].name
|
||||
getList()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -181,62 +163,58 @@
|
|||
}
|
||||
|
||||
let toggle = (d) => {
|
||||
refMoreSheet.value.open()
|
||||
actionSheet.active = d
|
||||
actionSheet.activeId = d.id
|
||||
// refMoreSheet.value.open()
|
||||
actions.show = true;
|
||||
actions.actions = d
|
||||
report.data.consId = d.id
|
||||
}
|
||||
|
||||
let sheetClick = (index) => {
|
||||
if (index == 0) {
|
||||
let actionSelect = ( e ) => {
|
||||
if ( e.name == '报损' ) {
|
||||
// 权限
|
||||
hasPermission('允许提交报损').then(ele => {
|
||||
if (ele) {
|
||||
//打开报损弹窗
|
||||
reportDamage.value.open(actionSheet.activeId);
|
||||
report.data.name = actionSheet.active.conName
|
||||
report.data.unit = actionSheet.active.conUnit
|
||||
reportDamage.value.open(actions.actions.id);
|
||||
report.data.name = actions.actions.conName
|
||||
report.data.unit = actions.actions.conUnit
|
||||
}
|
||||
})
|
||||
} else if (index == 1) {
|
||||
toUrl('PAGES_EDIT_CONSUMABLES', {
|
||||
item: JSON.stringify(actionSheet.active)
|
||||
} else if ( e.name == '编辑' ) {
|
||||
toUrl('PAGES_ADD_CONSUMABLES', {
|
||||
item: JSON.stringify(actions.actions)
|
||||
})
|
||||
} else if (index == 2) {
|
||||
} else if ( e.name == '清点' ) {
|
||||
hasPermission('允许耗材盘点').then(ele => {
|
||||
if (ele) {
|
||||
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 => {
|
||||
if (ele) {
|
||||
toUrl('PAGES_SALES_WAREHOUSEENTRY', {
|
||||
consId: actionSheet.activeId,
|
||||
item: JSON.stringify(actionSheet.active)
|
||||
consId: actions.actions.id,
|
||||
item: JSON.stringify(actions.actions)
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (index == 4) {
|
||||
} else if ( e.name == '出库' ) {
|
||||
hasPermission('允许耗材出库').then(ele => {
|
||||
if (ele) {
|
||||
toUrl('PAGES_SALES_OUTBOUND', {
|
||||
consId: actionSheet.activeId,
|
||||
item: JSON.stringify(actionSheet.active)
|
||||
consId: actions.actions.id,
|
||||
item: JSON.stringify(actions.actions)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// async function viewpermission(d) {
|
||||
// let res = await hasPermission(d)
|
||||
// return res
|
||||
// }
|
||||
|
||||
function inputEvent(d) {
|
||||
datas.conName = d.detail.value.replace(/\s*/g, "");
|
||||
pageData.query.conName = d.detail.value.replace(/\s*/g, "");
|
||||
getList()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
</view>
|
||||
<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 style="justify-content: space-between;">
|
||||
<view> 单位 </view>
|
||||
|
|
@ -97,6 +97,8 @@
|
|||
// 单位列表
|
||||
datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo]
|
||||
datas.form.bodyList.unit=datas.form.defaultUnit
|
||||
datas.form.bodyList.conName = datas.form.conName
|
||||
datas.form.bodyList.unitName = datas.form.unitName
|
||||
})
|
||||
onShow(() => {
|
||||
getList()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
</view>
|
||||
<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 style="justify-content: space-between;">
|
||||
<view> 单位 </view>
|
||||
|
|
@ -99,6 +99,8 @@
|
|||
// 单位列表
|
||||
datas.unitList = [ datas.form.conUnit, datas.form.conUnitTwo]
|
||||
datas.form.bodyList.unit = datas.form.defaultUnit
|
||||
datas.form.bodyList.conName = datas.form.conName
|
||||
datas.form.bodyList.unitName = datas.form.unitName
|
||||
})
|
||||
onShow(() => {
|
||||
getList()
|
||||
|
|
@ -161,13 +163,7 @@
|
|||
})
|
||||
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 = [datas.form.bodyList]
|
||||
datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
<view class="lable">使用门槛</view>
|
||||
<view class="value">
|
||||
<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 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>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<view class="item">
|
||||
<view class="lable">使用门槛</view>
|
||||
<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 class="item">
|
||||
|
|
|
|||
|
|
@ -44,8 +44,9 @@
|
|||
</up-radio-group>
|
||||
</view>
|
||||
</up-form-item>
|
||||
|
||||
<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>
|
||||
<up-button color="#e5e5e5" customStyle="font-size:32rpx;color: #999;width: 124rpx;margin-right: 10rpx;" :hairline="false">¥</up-button>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@
|
|||
getList()
|
||||
}
|
||||
let repaymentOpen = (item) => {
|
||||
if ( item.repaymentMethod == 'total' ) {
|
||||
if ( pageData.repaymentMethod == 'total' ) {
|
||||
return;
|
||||
}
|
||||
repayment.value.open({creditBuyerId:pageData.query.creditBuyerId,order:item});
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<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><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 v-else style="display: flex;flex-direction: column;align-items: center;justify-content: center;margin-top: 300rpx;">
|
||||
|
|
|
|||
|
|
@ -105,9 +105,7 @@
|
|||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.item
|
||||
console.log(props.item);
|
||||
Object.assign(category,props.item)
|
||||
console.log(props.item);
|
||||
}
|
||||
})
|
||||
const isSku = computed(() => {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
import { reactive, ref } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import myCategory from './components/category.vue'
|
||||
import editSort from './components/edit-sort.vue';
|
||||
import editName from './components/edit-name.vue';
|
||||
|
|
@ -118,7 +117,6 @@
|
|||
* @param {Object} e
|
||||
*/
|
||||
function actionsShow(e) {
|
||||
console.log(e)
|
||||
popup.selData = pageData.list[e]
|
||||
popup.selIndex = e
|
||||
actions.show = true
|
||||
|
|
@ -172,7 +170,7 @@
|
|||
popup.name.show = false;
|
||||
popup.time.show = false;
|
||||
pageData.list[popup.selIndex] = e
|
||||
infoBox.showToast('更新成功')
|
||||
uni.$utils.showToast('更新成功')
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -183,7 +181,7 @@
|
|||
const res = await updateProdGroup({
|
||||
...data
|
||||
})
|
||||
infoBox.showToast('修改成功')
|
||||
uni.$utils.showToast('修改成功')
|
||||
// init()
|
||||
}
|
||||
|
||||
|
|
@ -234,7 +232,7 @@
|
|||
success: res => {
|
||||
if (res.confirm) {
|
||||
delProdGroup(pageData.list[index].id).then(res => {
|
||||
infoBox.showToast('删除成功')
|
||||
uni.$utils.showToast('删除成功')
|
||||
setTimeout(()=>{
|
||||
getList()
|
||||
},1500)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<view class="page-gray color-333 u-font-28">
|
||||
<view class="block">
|
||||
<!-- <up-popup :show="show" @close="close" @open="open"> -->
|
||||
<picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType"
|
||||
:list="pageData.brandList"></picker-item>
|
||||
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
|
||||
|
|
@ -164,13 +163,14 @@
|
|||
id: null,
|
||||
sort: "0",
|
||||
status: 1,
|
||||
contentType: '',
|
||||
subType: '',
|
||||
connectionType: "network",
|
||||
printType: [],
|
||||
name: '',
|
||||
receiptSize: '58mm',
|
||||
classifyPrint: '0',
|
||||
printQty: 'm1^1',
|
||||
printType: ["refund", 'handover', 'queue'],
|
||||
printMethod: "all",
|
||||
selectcheckbox:[]
|
||||
|
||||
|
|
@ -218,7 +218,8 @@
|
|||
res.selectcheckbox = arrs
|
||||
}
|
||||
form = Object.assign(form, res)
|
||||
form.printType = JSON.parse(form.printType)
|
||||
if(form.printType)form.printType = JSON.parse(form.printType)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@
|
|||
})
|
||||
const emit = defineEmits(['init'])
|
||||
const delModel=ref(null)
|
||||
console.log(props.data)
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1185,8 +1185,6 @@
|
|||
coverImg: v.coverImg || ''
|
||||
}
|
||||
})
|
||||
|
||||
console.log(skuList.list);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,13 +16,9 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
formatPrice
|
||||
} from "@/commons/utils/format.js";
|
||||
import {
|
||||
ref,
|
||||
watch,nextTick
|
||||
} from 'vue';
|
||||
import { ref,reactive,watch,nextTick } from 'vue';
|
||||
import { formatPrice } from "@/commons/utils/format.js";
|
||||
|
||||
const props = defineProps({
|
||||
inputType:{
|
||||
type:String,
|
||||
|
|
@ -48,8 +44,8 @@
|
|||
default: '请输入'
|
||||
}
|
||||
})
|
||||
let number = ref(props.modelValue)
|
||||
|
||||
let number = ref(props.modelValue*1)
|
||||
function changeNumber(type) {
|
||||
const newval = number.value + props.step * (type == 'add' ? 1 : -1)
|
||||
if (newval < props.min) {
|
||||
|
|
@ -63,12 +59,12 @@
|
|||
|
||||
function priceFormat(e) {
|
||||
nextTick(() => {
|
||||
const min = props
|
||||
.min;
|
||||
const min = props.min;
|
||||
const max = props.max;
|
||||
if (e === '') {
|
||||
return
|
||||
}
|
||||
console.log(e)
|
||||
const newval = formatPrice(e, min, max, true)
|
||||
if (typeof newval !== 'number') {
|
||||
number.value = newval.value
|
||||
|
|
@ -82,7 +78,7 @@
|
|||
})
|
||||
}
|
||||
watch(() => props.modelValue, (newval) => {
|
||||
number.value = newval
|
||||
number.value = newval*1
|
||||
})
|
||||
const emits = defineEmits(['update:modelValue'])
|
||||
watch(() => number.value, (newval) => {
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@
|
|||
const res= await productReportDamage(par)
|
||||
infoBox.showToast('提交成功!')
|
||||
popShow.value=false
|
||||
emits('save')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,38 +1,13 @@
|
|||
<template>
|
||||
<view class="control" :style="getComputedStyle()">
|
||||
<view class="u-flex control1" v-if="showControl1">
|
||||
<!-- <view class="btn" @click="changeShowControl1">批量管理</view> -->
|
||||
<view class="u-flex control1">
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {$tbShopCategory} from '@/http/yskApi/goods.js'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {ColorMain} from '@/commons/color.js'
|
||||
import {
|
||||
onMounted,
|
||||
reactive,
|
||||
|
|
@ -43,53 +18,18 @@
|
|||
type: [Number, String],
|
||||
default: 30
|
||||
},
|
||||
categoryName:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
categoryShow:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
let showControl1 = ref(true)
|
||||
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() {
|
||||
return {
|
||||
bottom: props.bottom + 'rpx'
|
||||
}
|
||||
}
|
||||
//设置是否全选
|
||||
function setisSelectAll(checked){
|
||||
isSelectAll.value =checked
|
||||
}
|
||||
defineExpose({
|
||||
setisSelectAll
|
||||
})
|
||||
|
||||
//下架
|
||||
function offShelf(){
|
||||
emits('offShelf')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
<template v-if="!isSku">
|
||||
<view class="u-m-b-32" >
|
||||
<view class="u-flex u-row-between">
|
||||
<view>{{data.name}}</view>
|
||||
<view class="u-font-24">
|
||||
<view class="up-line-1" style="width: 60%;">{{data.name}}</view>
|
||||
<view class="u-font-24" style="flex-shrink: 1;">
|
||||
<text>变动数量:</text>
|
||||
<text class="number">{{data.stockNumber-data._stockNumber}}</text>
|
||||
</view>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
<view>{{item.name}}</view>
|
||||
<view class="u-font-24">
|
||||
<text>变动数量:</text>
|
||||
<text class="number">{{item.stockNumber-item._stockNumber}}</text>
|
||||
<text class="number">{{(item.stockNumber-item._stockNumber).toFixed(2)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
|
|
@ -110,21 +110,10 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit,$getProductStockDetail
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import { reactive, ref, watch, onMounted, computed } from 'vue';
|
||||
|
||||
import { $invoicingType } from '@/commons/goodsData.js'
|
||||
import { productStockFlow } from '@/http/api/product.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
const refForm = ref(null)
|
||||
const props = defineProps({
|
||||
|
|
@ -156,7 +145,6 @@
|
|||
]
|
||||
})
|
||||
function toRecodes(){
|
||||
console.log(props.goods.id);
|
||||
go.to('PAGES_PRODUCT_INVOICING_LIST',{
|
||||
productId:props.goods.id
|
||||
})
|
||||
|
|
@ -185,26 +173,27 @@
|
|||
getProductStockDetail()
|
||||
}
|
||||
})
|
||||
let getTypeName = (type) => {
|
||||
let item = $invoicingType.filter(item=> item.value == type)[0]
|
||||
return item?item.text:''
|
||||
}
|
||||
async function getProductStockDetail(){
|
||||
const {content}=await $getProductStockDetail({
|
||||
page:0,
|
||||
size:2,
|
||||
productId:props.goods.id,
|
||||
column:'/api/tbProductStockDetail/stock/count',
|
||||
shopId:uni.getStorageSync('shopId'),
|
||||
createdAt:[]
|
||||
const { records }=await productStockFlow({
|
||||
page: 1,
|
||||
size: 2,
|
||||
productId: props.goods.id,
|
||||
})
|
||||
console.log(content);
|
||||
recoders.list=content.map(v=>{
|
||||
console.log(records);
|
||||
recoders.list = records.map(v=>{
|
||||
return {
|
||||
...v,
|
||||
title:v.createdAt,
|
||||
content:v.type+':'+Math.abs(v.stockNumber)
|
||||
title: v.createTime,
|
||||
content: getTypeName(v.inOutItem)+':'+Math.abs(v.inOutNumber)
|
||||
}
|
||||
})
|
||||
}
|
||||
const isSku = computed(() => {
|
||||
// return data.value.typeEnum == '多规格'
|
||||
// return data.value.type == 'sku'
|
||||
return false
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
|
|
@ -223,6 +212,7 @@
|
|||
refForm.value.validate().then(valid => {
|
||||
if (valid) {
|
||||
emits('save', {
|
||||
remark: form.note,
|
||||
...data.value,
|
||||
})
|
||||
} 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(()=>{
|
||||
// #ifndef H5
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
</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>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -90,7 +90,6 @@
|
|||
</view>
|
||||
<view class="u-flex">
|
||||
<!-- <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>
|
||||
</view>
|
||||
|
|
@ -104,7 +103,7 @@
|
|||
import go from '@/commons/utils/go.js';
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.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'
|
||||
])
|
||||
const props = defineProps({
|
||||
|
|
@ -145,7 +144,6 @@
|
|||
const max=247;
|
||||
for(let i in props.data.skuList){
|
||||
const sku=props.data.skuList[i]
|
||||
console.log(sku)
|
||||
width+=(fontSize*sku.specInfo.length+boxWith+gap)
|
||||
if(width>max){
|
||||
isOne=false
|
||||
|
|
@ -233,10 +231,6 @@
|
|||
emits('radioClick', props.index)
|
||||
}
|
||||
|
||||
function changeClick() {
|
||||
emits('changeClick', props.index)
|
||||
}
|
||||
|
||||
function reportDamage () {
|
||||
emits('reportDamage', props.index)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@
|
|||
<template v-if="pageData.goodsList.length">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow"
|
||||
@changeClick="goodsChangeClick" @edit="toGoodsDetail" @editStock="changeStockShow"
|
||||
@guigeClick="editGuigeShow" @baosun="baosunShow" @radioClick="goodsRadioClick" :index="index"
|
||||
:data="item" @del="goodsDel" :showChecked="showChecked"
|
||||
@edit="toGoodsDetail" @editStock="changeStockShow"
|
||||
@guigeClick="editGuigeShow" @baosun="baosunShow" :index="index"
|
||||
:data="item"
|
||||
:showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -61,39 +61,11 @@
|
|||
</view>
|
||||
|
||||
<my-control ref="control" :categoryShow="pageData.categoryShow" :categoryName="pageData.categoryName"
|
||||
@offShelf="offShelf" @allCheckedChange="allCheckedChange" @controlChange="controlChange"
|
||||
@toggleCategory="toggleCategory" :bottom="pageData.componentBottom"></my-control>
|
||||
<!-- <my-category ref="category" @change="onCategoryShowChange" @cateClick="cateClick"
|
||||
:bottom="pageData.componentBottom+100"></my-category> -->
|
||||
:bottom="pageData.componentBottom"></my-control>
|
||||
|
||||
|
||||
<!-- 下架弹窗 -->
|
||||
<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>
|
||||
<!-- 修改价格弹窗 -->
|
||||
|
|
@ -107,7 +79,7 @@
|
|||
:goods="popup.guige.data"></edit-guige>
|
||||
<!-- 报损 -->
|
||||
<baosun-vue :category="pageData.categoryList" v-model:show="popup.baosun.show"
|
||||
:goods="pageData.selGoods"></baosun-vue>
|
||||
:goods="pageData.selGoods" @save="getGoodsList"></baosun-vue>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
|
@ -115,34 +87,21 @@
|
|||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
|
||||
import myGoods from './components/goods.vue'
|
||||
import myControl from './components/control.vue'
|
||||
import myCategory from './components/category.vue'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import editPrice from './components/edit-price.vue';
|
||||
import editGuige from './components/edit-guige.vue';
|
||||
import editStock from './components/edit-stock.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 {
|
||||
returnAllCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import { getProductPage, getCategoryList, updateProduct, productModifyStock } from '@/http/api/product.js'
|
||||
|
||||
import { returnAllCategory } from '@/pageProduct/util.js'
|
||||
|
||||
const pageData = reactive({
|
||||
modelDesc: '是否下架',
|
||||
|
|
@ -181,8 +140,6 @@
|
|||
const tabsList = ['简洁', '详情']
|
||||
const control = ref(null)
|
||||
const model = ref(null)
|
||||
const goodsStockModel = ref(null)
|
||||
let reportDamage = ref(null) //报损组件
|
||||
watch(() => pageData.query.categoryId, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
|
|
@ -250,7 +207,10 @@
|
|||
})
|
||||
}
|
||||
|
||||
//报损弹窗展示
|
||||
/**
|
||||
* 报损弹窗展示
|
||||
* @param {Object} index
|
||||
*/
|
||||
function baosunShow(index) {
|
||||
pageData.selGoodsIndex = index
|
||||
const goods = pageData.goodsList[index]
|
||||
|
|
@ -290,7 +250,6 @@
|
|||
* @param {Object} goods
|
||||
*/
|
||||
async function changePriceConfirm(goods) {
|
||||
|
||||
let goodsArr = []
|
||||
if (goods.type == 'sku') {
|
||||
goodsArr = goods.skuList.map(v => {
|
||||
|
|
@ -313,13 +272,15 @@
|
|||
}]
|
||||
}
|
||||
const res = await updateProduct(goodsArr)
|
||||
infoBox.showToast('修改成功')
|
||||
uni.$utils.showToast('修改成功')
|
||||
popup.price.show = false
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
|
||||
// 修改库存弹窗展示
|
||||
/**
|
||||
* 修改库存弹窗展示
|
||||
* @param {Object} index
|
||||
*/
|
||||
async function changeStockShow(index) {
|
||||
const res = await hasPermission('允许修改商品库存')
|
||||
if (!res) {
|
||||
|
|
@ -341,26 +302,29 @@
|
|||
}
|
||||
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,
|
||||
key: 'stockNumber',
|
||||
value: goods.stockNumber
|
||||
}]
|
||||
const res = await $updateProductData(goodsArr)
|
||||
infoBox.showToast('修改成功')
|
||||
stockNumber: goods.stockNumber,
|
||||
remark: goods.remark
|
||||
})
|
||||
uni.$utils.showToast('修改成功')
|
||||
popup.stock.show = false
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
//修改规格上下架,售罄
|
||||
/**
|
||||
* 修改规格上下架,售罄
|
||||
* @param {Object} goodsIndex
|
||||
* @param {Object} guigeIndex
|
||||
*/
|
||||
function editGuigeShow(goodsIndex, guigeIndex) {
|
||||
const goodsGuige = pageData.goodsList[goodsIndex].skuList[guigeIndex]
|
||||
console.log(goodsIndex, guigeIndex);
|
||||
popup.guige.data = goodsGuige
|
||||
popup.guige.goodsIndex = goodsIndex
|
||||
popup.guige.guigeIndex = guigeIndex
|
||||
|
|
@ -373,7 +337,6 @@
|
|||
*/
|
||||
function isGroundingChange(e) {
|
||||
const { goodsIndex, guigeIndex } = popup.guige
|
||||
console.log(goodsIndex,guigeIndex)
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isGrounding = e
|
||||
}
|
||||
|
||||
|
|
@ -383,15 +346,21 @@
|
|||
*/
|
||||
function isPauseSaleChange(e) {
|
||||
const { goodsIndex, guigeIndex } = popup.guige
|
||||
console.log(goodsIndex,guigeIndex)
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isPauseSale = e
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类筛选打开
|
||||
* @param {Object} show
|
||||
*/
|
||||
function onCategoryShowChange(show) {
|
||||
console.log(show);
|
||||
pageData.categoryShow = show
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类筛选确定
|
||||
* @param {Object} category
|
||||
*/
|
||||
function setCategory(category) {
|
||||
pageData.query.categoryId = category.id
|
||||
pageData.categoryName = category.name
|
||||
|
|
@ -413,88 +382,10 @@
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 商品报损
|
||||
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()
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品修改
|
||||
* @param {Object} id
|
||||
*/
|
||||
async function toGoodsDetail(id) {
|
||||
const res = await hasPermission('允许修改商品')
|
||||
if (!res) {
|
||||
|
|
@ -513,109 +404,35 @@
|
|||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index;
|
||||
pageData.query.status = pageData.statesTabsList[index].value
|
||||
resetQuery()
|
||||
}
|
||||
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
|
||||
searchFunc()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function searchFunc() {
|
||||
console.log('searchFunc');
|
||||
resetQuery()
|
||||
pageData.totalElements = 0;
|
||||
pageData.query.page = 1;
|
||||
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() {
|
||||
console.log('confirm');
|
||||
model.value.close()
|
||||
}
|
||||
|
||||
//商品end
|
||||
|
||||
//控制条
|
||||
function controlChange(bol) {
|
||||
showChecked.value = bol
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 全选
|
||||
function allCheckedChange(checked) {
|
||||
changeGoodsChecked(checked)
|
||||
}
|
||||
|
||||
// 页数改变事件
|
||||
/**
|
||||
* 页数改变事件
|
||||
* @param {Object} page
|
||||
*/
|
||||
function pageChange(page) {
|
||||
console.log(page);
|
||||
pageData.query.page = page
|
||||
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>
|
||||
<style scoped>
|
||||
page {
|
||||
|
|
|
|||
|
|
@ -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 edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -2,37 +2,17 @@
|
|||
<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="">
|
||||
<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 class="tag">{{data.type}}</view>
|
||||
<view class="tag">{{getTypeName(data.inOutItem)}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-text-left u-row-left u-m-t-30">
|
||||
<view class="name">{{data.productName}}</view>
|
||||
<!-- <view class="category u-flex u-m-l-10">
|
||||
<view class="tag">分类</view>
|
||||
</view> -->
|
||||
<view class="id color-999 u-font-24 bg-gray u-m-l-10">
|
||||
ID:{{data.id}}
|
||||
</view>
|
||||
<view class="name up-line-1">{{data.productName}}</view>
|
||||
<view class="id color-999 u-font-24 bg-gray u-m-l-10"> ID:{{data.id}} </view>
|
||||
</view>
|
||||
<view class="info u-flex bg-gray u-p-24 u-m-t-20 u-row-between">
|
||||
<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="text-ming-w">订单号</view>
|
||||
<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="text-ming-w">库存</view>
|
||||
<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">
|
||||
<uni-icons type="arrow-right" :color="color.ColorMain" size="16"></uni-icons>
|
||||
<text class="color-main u-m-l-10">{{data.leftNumber+data.stockNumber}}</text>
|
||||
<uni-icons type="arrow-right" :color="$utils.ColorMain" size="16"></uni-icons>
|
||||
<text class="color-main u-m-l-10">{{data.afterNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="u-m-t-10 u-flex">
|
||||
<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 class="u-flex-1 u-flex u-row-right">
|
||||
<view>
|
||||
<view class="no-wrap">
|
||||
<text class="color-main font-bold" v-if="data.stockNumber>0">{{data.stockNumber}}</text>
|
||||
<text class="color-red font-bold" v-else>{{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.inOutNumber}}</text>
|
||||
<text>{{data.unitName}}</text>
|
||||
</view>
|
||||
<!-- <view class="u-m-t-10">剩余库存</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>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import color from '@/commons/color.js'
|
||||
|
||||
function del() {
|
||||
console.log('del');
|
||||
}
|
||||
import { $invoicingType } from '@/commons/goodsData.js'
|
||||
const props = defineProps({
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
|
@ -100,11 +62,13 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
const emits = defineEmits(['more'])
|
||||
|
||||
function more() {
|
||||
emits('more', props.index)
|
||||
let getTypeName = (type) => {
|
||||
let item = $invoicingType.filter(item=> item.value == type)[0]
|
||||
return item?item.text:''
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<view class=" bg-fff u-flex u-p-l-30 u-row-between">
|
||||
<view class="u-flex ">
|
||||
<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"
|
||||
mode="">
|
||||
</image>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
<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">
|
||||
<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 :style="{height: types.bottomHeight+'px'}"></view>
|
||||
</view>
|
||||
|
|
@ -31,26 +31,18 @@
|
|||
|
||||
|
||||
<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">
|
||||
<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>
|
||||
<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">
|
||||
<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 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">
|
||||
<view class="u-m-b-28 " v-for="(item,index) in pageData.list" :key="index">
|
||||
<my-list-item :data="item" ></my-list-item>
|
||||
|
|
@ -74,28 +66,15 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app';
|
||||
import color from '@/commons/color';
|
||||
import { onLoad, onReady, onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import { ref, reactive, computed, watch } from 'vue';
|
||||
|
||||
import myListItem from './components/list-item.vue';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
$getProductDetail,
|
||||
$getProductStockDetail,$getProductStockDetailSum
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import {
|
||||
$invoicingType
|
||||
} from '@/commons/goodsData.js'
|
||||
|
||||
import { $invoicingType } from '@/commons/goodsData.js'
|
||||
import { productStockFlow } from '@/http/api/product.js'
|
||||
|
||||
|
||||
const search = reactive({
|
||||
keyword: '',
|
||||
show: false
|
||||
|
|
@ -135,53 +114,71 @@
|
|||
|
||||
function changeTypesActive(i) {
|
||||
types.active = i
|
||||
pageData.query.inOutItem = types.list[i].value
|
||||
types.show = false
|
||||
toggleMask()
|
||||
}
|
||||
|
||||
/**
|
||||
* 类型选择
|
||||
*/
|
||||
function showTypesToggle() {
|
||||
types.show = !types.show
|
||||
maskShow()
|
||||
}
|
||||
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
pageData.query.page=page-1
|
||||
init()
|
||||
}
|
||||
|
||||
|
||||
const filters = reactive({
|
||||
time: {
|
||||
start: '',
|
||||
end: ''
|
||||
}
|
||||
})
|
||||
|
||||
function resetQuery(){
|
||||
pageData.query.page=0
|
||||
pageData.query.page = 1
|
||||
}
|
||||
function clearTime() {
|
||||
filters.time.start = ''
|
||||
filters.time.end = ''
|
||||
pageData.query.beginDate = ''
|
||||
pageData.query.endDate = ''
|
||||
resetQuery()
|
||||
init()
|
||||
}
|
||||
|
||||
const datePicker = ref(null)
|
||||
function datePickerConfirm(e) {
|
||||
filters.time.start = e.start
|
||||
filters.time.end = e.end
|
||||
const mask = ref(null)
|
||||
const pageData = reactive({
|
||||
query: {
|
||||
page: 1,
|
||||
size: 10,
|
||||
productId:'',
|
||||
inOutItem:'',
|
||||
beginDate:'',
|
||||
endDate:'',
|
||||
},
|
||||
totalElements: 0,
|
||||
list: [],
|
||||
status: 'noMore',
|
||||
hasAjax:false,
|
||||
changeSum:0
|
||||
})
|
||||
watch(()=>types.active,(newval)=>{
|
||||
resetQuery()
|
||||
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() {
|
||||
datePicker.value.toggle()
|
||||
}
|
||||
|
||||
|
||||
const mask = ref(null)
|
||||
function datePickerConfirm(e) {
|
||||
pageData.query.beginDate = e.start
|
||||
pageData.query.endDate = e.end
|
||||
resetQuery()
|
||||
init()
|
||||
}
|
||||
|
||||
function toggleMask(show) {
|
||||
mask.value.toggle()
|
||||
|
|
@ -195,50 +192,11 @@
|
|||
mask.value.close()
|
||||
}
|
||||
|
||||
|
||||
const pageData = reactive({
|
||||
query: {
|
||||
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()
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
pageData.query.page = page
|
||||
init()
|
||||
})
|
||||
|
||||
onLoad(opt => {
|
||||
console.log(opt);
|
||||
Object.assign(pageData.query,opt)
|
||||
init()
|
||||
// getSum()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -141,8 +141,6 @@
|
|||
startTime = s + ' 00:00:00'
|
||||
endTime = e + ' 23:59:59'
|
||||
}
|
||||
console.log(startTime)
|
||||
console.log(endTime)
|
||||
getTrade({
|
||||
beginDate: startTime,
|
||||
endDate: endTime,
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@
|
|||
function getShopStaffDetail(id) {
|
||||
shopStaffDetail({id:id}).then(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)
|
||||
datas.rolesdata = rolefilter[0].name
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
*/
|
||||
function getList() {
|
||||
shopStaffList({
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 100
|
||||
}).then((res) => {
|
||||
pageData.list = res.records
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
<view class="input-wrapper">
|
||||
<view class="input-main">
|
||||
<view class="u-flex u-p-r-30 u-font-28" @click="showstatusToggle">
|
||||
<text class="u-m-r-10 u-line-1" :class="{'color-main':status.active!=0}"
|
||||
style="max-width: 100rpx;">{{status.list[status.active].label }}</text>
|
||||
<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':pageData.query.status!=''}"
|
||||
style="max-width: 100rpx;">{{pageData.statusName }}</text>
|
||||
<up-icon name="arrow-down" size="16"></up-icon>
|
||||
</view>
|
||||
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
|
||||
|
|
@ -26,21 +26,9 @@
|
|||
</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>
|
||||
</up-sticky>
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="list u-p-30">
|
||||
<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)"
|
||||
|
|
@ -74,38 +62,25 @@
|
|||
<view class="color-999 u-p-30 u-text-center border-bottom">桌号:{{actionSheet.title}}</view>
|
||||
</template>
|
||||
</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>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onReady, onShow, } from '@dcloudio/uni-app';
|
||||
import { ref, reactive, computed, watch } from 'vue';
|
||||
|
||||
import { objToArrary } from '@/commons/utils/returrn-data.js'
|
||||
import { $status } from '@/commons/table-status.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 tableItem from './components/table-item'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import { getShopTable, shopTableBind, shopTableClear } from '@/http/api/table.js'
|
||||
import { getShopArea } from '@/http/api/area.js'
|
||||
import { printOrder } from '@/http/api/order.js'
|
||||
|
||||
const statusList = objToArrary($status)
|
||||
statusList.unshift({
|
||||
key: '',
|
||||
label: '全部'
|
||||
})
|
||||
const status = reactive({
|
||||
list: statusList,
|
||||
active: 0,
|
||||
show: false,
|
||||
bottomHeight: 14
|
||||
})
|
||||
import { getHistoryOrder } from '@/http/api/order.js'
|
||||
|
||||
const pageData = reactive({
|
||||
statusShow: false,
|
||||
hasAjax: false,
|
||||
areaMap: {},
|
||||
query: {
|
||||
|
|
@ -116,15 +91,19 @@
|
|||
name: '',
|
||||
},
|
||||
totalElements:0,
|
||||
statusList: [[{
|
||||
key: '',
|
||||
label: '全部'
|
||||
},...uni.$utils.objToArrary($status)]],
|
||||
statusName: '全部',
|
||||
tabList: [],
|
||||
area: {
|
||||
list: [],
|
||||
sel: ''
|
||||
}
|
||||
})
|
||||
const search = reactive({
|
||||
show: false
|
||||
},
|
||||
orderInfo: null,
|
||||
})
|
||||
|
||||
const refMoreSheet = ref(null)
|
||||
const actionSheet = reactive({
|
||||
list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单','绑定码牌'],
|
||||
|
|
@ -132,18 +111,10 @@
|
|||
selTable: ''
|
||||
})
|
||||
|
||||
const statusHeight = computed(() => {
|
||||
return 30 * status.list.length + status.bottomHeight + 'px'
|
||||
})
|
||||
|
||||
watch(() => pageData.area.sel, (newval) => {
|
||||
pageData.query.page = 1
|
||||
getTable()
|
||||
})
|
||||
watch(() => status.active, (newval) => {
|
||||
pageData.query.page = 1
|
||||
getTable()
|
||||
})
|
||||
|
||||
onShow(opt => {
|
||||
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
|
||||
|
|
@ -192,6 +174,11 @@
|
|||
actionSheet.title = table.name
|
||||
actionSheet.selTable = table
|
||||
refMoreSheet.value.open()
|
||||
if( actionSheet.selTable.orderId ){
|
||||
getHistoryOrder({orderId: actionSheet.selTable.orderId}).then(res=>{
|
||||
pageData.orderInfo = res
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -240,7 +227,8 @@
|
|||
if (!item.orderId) {
|
||||
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
|
||||
}
|
||||
if (index == 6) {
|
||||
|
|
@ -313,61 +301,14 @@
|
|||
* 搜索
|
||||
*/
|
||||
function searchConfirm() {
|
||||
search.show = false
|
||||
pageData.query.page = 1;
|
||||
maskHide()
|
||||
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) {
|
||||
pageData.query.page = page
|
||||
getTable()
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<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="color-999">优惠券</view>
|
||||
<view class="u-flex">
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
<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>
|
||||
</view>
|
||||
<my-pagination @change="pageChange"></my-pagination>
|
||||
</view>
|
||||
<view class="fixed_b">
|
||||
<my-button showShadow @tap="toAddUser" shape="circle">新建用户</my-button>
|
||||
|
|
@ -130,7 +129,7 @@
|
|||
|
||||
</view>
|
||||
<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>
|
||||
|
|
@ -213,7 +212,6 @@
|
|||
*/
|
||||
async function getUser() {
|
||||
const res = await shopUserList(pageData.query)
|
||||
console.log(res)
|
||||
if ( res ) {
|
||||
if (res.pageNumber <= 1) {
|
||||
pageData.userList = res.records
|
||||
|
|
@ -330,13 +328,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
console.log(page);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
|
|
|
|||
|
|
@ -68,14 +68,12 @@
|
|||
},
|
||||
query: {
|
||||
page: 1,
|
||||
size: 10,
|
||||
size: 15,
|
||||
beginDate: '',
|
||||
endDate: ''
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 15,
|
||||
total: 0,
|
||||
status: 'loadmore'
|
||||
}
|
||||
|
|
@ -85,8 +83,9 @@
|
|||
getTableData()
|
||||
})
|
||||
onReachBottom(() => {
|
||||
console.log(pageData.tableData.status)
|
||||
if (pageData.tableData.status != 'nomore') {
|
||||
pageData.tableData.page++
|
||||
pageData.query.page++
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
|
|
@ -97,19 +96,23 @@
|
|||
const getTableData = async () => {
|
||||
pageData.tableData.status = 'loading';
|
||||
|
||||
let res = await getHandoverRecord(pageData.query)
|
||||
pageData.tableData.total = res.totalRow
|
||||
if (pageData.tableData.page == 1 && res.records.length < 10) {
|
||||
pageData.tableData.data = res.records
|
||||
getHandoverRecord(pageData.query).then(res=>{
|
||||
pageData.tableData.total = res.totalRow
|
||||
if (pageData.query.page == 1 && res.records.length < 10) {
|
||||
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'
|
||||
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)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
15
pages.json
15
pages.json
|
|
@ -131,13 +131,6 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": "库存记录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_PRODUCT_INVOICING_CHECK",
|
||||
"path": "invoicing-check/invoicing-check",
|
||||
"style": {
|
||||
"navigationBarTitleText": "库存盘点"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
|
|
@ -438,13 +431,7 @@
|
|||
"pageId": "PAGES_ADD_CONSUMABLES",
|
||||
"path": "addConsumables",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新增耗材"
|
||||
}
|
||||
}, {
|
||||
"pageId": "PAGES_EDIT_CONSUMABLES",
|
||||
"path": "editConsumables",
|
||||
"style": {
|
||||
"navigationBarTitleText": "编辑耗材"
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
}, {
|
||||
"pageId": "PAGES_ADD_TYPE",
|
||||
|
|
|
|||
|
|
@ -13,25 +13,26 @@
|
|||
textKey="label"></my-tabs>
|
||||
</view>
|
||||
<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-easyinput class='jeepay-easyinput' placeholder="请输入登录名/手机号"
|
||||
<uni-easyinput class='jeepay-easyinput' :placeholder="accountType.sel==1?'请输入商户号':'请输入登录名/手机号'"
|
||||
v-model="vdata.formData.username" :clearable="false">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/login/icon-user.svg" class="input-icon" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</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-easyinput class='jeepay-easyinput' :type="vdata.isShowPwd ? 'text' : 'password'"
|
||||
|
|
@ -156,7 +157,7 @@
|
|||
|
||||
const loginFormRef = ref()
|
||||
const rules = {
|
||||
merchantName: {
|
||||
staffUserName: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('商户号')],
|
||||
},
|
||||
username: {
|
||||
|
|
@ -193,7 +194,7 @@
|
|||
pwd: '', // 账密登录: 密码
|
||||
code: '',
|
||||
uuid: '',
|
||||
merchantName: '',
|
||||
staffUserName: '',
|
||||
loginType: 1
|
||||
},
|
||||
|
||||
|
|
@ -210,7 +211,7 @@
|
|||
function accountTypeChange(e) {
|
||||
// #ifdef H5
|
||||
if (e == 1) {
|
||||
vdata.formData.merchantName = '18049104914'
|
||||
vdata.formData.staffUserName = '18049104914'
|
||||
vdata.formData.username = '13666666666'
|
||||
vdata.formData.pwd = '123456'
|
||||
} else {
|
||||
|
|
@ -220,7 +221,7 @@
|
|||
}
|
||||
watch(() => accountType.sel, (newval) => {
|
||||
if (newval == 1) {
|
||||
vdata.formData.merchantName = uni.getStorageSync('merchantName') || ''
|
||||
vdata.formData.staffUserName = uni.getStorageSync('staffUserName') || ''
|
||||
} else {
|
||||
vdata.formData.username = ''
|
||||
}
|
||||
|
|
@ -229,8 +230,8 @@
|
|||
getCode()
|
||||
// 获取商户信息,有就回显
|
||||
let info = uni.getStorageSync('MerchantId')
|
||||
if (info.merchantName) {
|
||||
vdata.formData.merchantName = info.merchantName
|
||||
if (info.staffUserName) {
|
||||
vdata.formData.staffUserName = info.staffUserName
|
||||
vdata.formData.username = info.username
|
||||
}
|
||||
})
|
||||
|
|
@ -269,7 +270,7 @@
|
|||
}
|
||||
//商户号参数
|
||||
if ( accountType.sel == 1 ) {
|
||||
params.merchantName = vdata.formData.merchantName
|
||||
params.staffUserName = vdata.formData.staffUserName
|
||||
}
|
||||
loginPromise = login(params)
|
||||
|
||||
|
|
@ -289,7 +290,7 @@
|
|||
loginFinishFunc(res)
|
||||
// 保存商户号
|
||||
uni.setStorageSync('MerchantId', {
|
||||
merchantName: vdata.formData.merchantName,
|
||||
staffUserName: vdata.formData.staffUserName,
|
||||
username: vdata.formData.username,
|
||||
})
|
||||
}).catch(e => {
|
||||
|
|
|
|||
|
|
@ -288,8 +288,8 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onReady, onShow } from '@dcloudio/uni-app'
|
||||
import { ref, inject, onBeforeUnmount, reactive, computed, watch } from 'vue';
|
||||
import { onLoad, onReady, onShow,onHide } from '@dcloudio/uni-app'
|
||||
import { ref, inject, onUnmounted, reactive, computed, watch } from 'vue';
|
||||
|
||||
import modelDiscount from './components/discount'
|
||||
import giveFood from './components/give-food'
|
||||
|
|
@ -385,16 +385,20 @@
|
|||
watch(() => pageData.eatTypes.active, (newval) => {
|
||||
pageData.eatTypes.isShow = true
|
||||
changeUseType()
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
})
|
||||
onShow(() => {
|
||||
init()
|
||||
watchChooseuser()
|
||||
watchChooseTable()
|
||||
})
|
||||
|
||||
onHide(() => {
|
||||
console.log("onHide")
|
||||
websocketUtil.offMessage()
|
||||
})
|
||||
onUnmounted(() => {
|
||||
console.log("onUnmounted")
|
||||
websocketUtil.offMessage()
|
||||
});
|
||||
/**
|
||||
* 获取订单详情
|
||||
* @param {Object} tableCode
|
||||
|
|
@ -488,7 +492,7 @@
|
|||
async function init() {
|
||||
// 获取商品列表
|
||||
$goods = await getProductList({},'product', false)
|
||||
console.log("商品列表===",$goods)
|
||||
// console.log("商品列表===",$goods)
|
||||
getTableInfo(pageData.table)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,8 +116,6 @@
|
|||
console.log(modal);
|
||||
}
|
||||
|
||||
console.log(props.data);
|
||||
|
||||
const edmits = defineEmits(['clear', 'updateNumber'])
|
||||
|
||||
// mask
|
||||
|
|
@ -158,7 +156,6 @@
|
|||
}
|
||||
|
||||
const allPrice = computed(() => {
|
||||
console.log("购物车数据==",props.data)
|
||||
return props.data.reduce((prve, cur) => {
|
||||
let price = Math.floor((cur.lowPrice * cur.number)*100)/100
|
||||
return prve + price
|
||||
|
|
@ -170,7 +167,6 @@
|
|||
result = props.data.reduce((prve, cur) => {
|
||||
return prve + cur.number
|
||||
}, 0)
|
||||
console.log(result)
|
||||
result = result > 0 ? result.toFixed(2) : 0
|
||||
return result >= 99 ? 99 : parseFloat(result)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@
|
|||
|
||||
</template>
|
||||
<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 guigeModel from './components/guige'
|
||||
|
|
@ -177,7 +177,6 @@
|
|||
is_gift: 0
|
||||
},
|
||||
orderId: null,
|
||||
isCars: false,
|
||||
isGoodsAdd: true,
|
||||
goodsData: null,
|
||||
})
|
||||
|
|
@ -198,7 +197,6 @@
|
|||
const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例
|
||||
onLoad((opt) => {
|
||||
option = opt
|
||||
console.log("opt===",opt)
|
||||
Object.assign(data.table, opt)
|
||||
|
||||
uni.setNavigationBarTitle({
|
||||
|
|
@ -220,15 +218,22 @@
|
|||
}
|
||||
})
|
||||
onShow(() => {
|
||||
watchChooseTable()
|
||||
watchUpdate()
|
||||
watchSocketOpen()
|
||||
data.isGoodsAdd = true;
|
||||
|
||||
nextTick(()=>{
|
||||
uni.showLoading({
|
||||
title: '购物车加载中',
|
||||
mask: true
|
||||
});
|
||||
watchChooseTable()
|
||||
watchUpdate()
|
||||
watchSocketOpen()
|
||||
data.isGoodsAdd = true;
|
||||
|
||||
init()
|
||||
onMessage()
|
||||
})
|
||||
|
||||
init()
|
||||
|
||||
})
|
||||
onReady(() => {
|
||||
getElRect('list-tight-top').then(res => {
|
||||
|
|
@ -237,12 +242,15 @@
|
|||
getMenuItemTop()
|
||||
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
onHide(() => {
|
||||
console.log("onHide")
|
||||
uni.$off('is-socket-open')
|
||||
websocketUtil.offMessage()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
uni.$off('is-socket-open')
|
||||
websocketUtil.offMessage()
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -262,7 +270,6 @@
|
|||
setTabBar($category, $originGoods, [])
|
||||
}
|
||||
let shopInfo = await getShopInfo({id:uni.getStorageSync('shopInfo').id})
|
||||
console.log(shopInfo)
|
||||
uni.setStorageSync("shopInfo",shopInfo)
|
||||
// 获取分类数据
|
||||
let categoryRes = await categoryPage({ page: 1, size: 300 })
|
||||
|
|
@ -298,11 +305,13 @@
|
|||
uni.$on('is-socket-open', (res) => {
|
||||
console.log("is-socket-open===",res)
|
||||
if( res){
|
||||
data.isCars = true;
|
||||
data.isGoodsAdd = true;
|
||||
initCart()
|
||||
} else {
|
||||
data.isCars = false;
|
||||
uni.showLoading({
|
||||
title: '购物车加载中',
|
||||
mask: true
|
||||
});
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
})
|
||||
|
|
@ -339,7 +348,6 @@
|
|||
switch (msg.operate_type) {
|
||||
case 'onboc_init':
|
||||
cars.length = 0
|
||||
data.isCars = true;
|
||||
console.log("购物车信息onboc_init===",msg)
|
||||
if( !data.table.tableCode ){
|
||||
data.table.tableCode = msg.table_code
|
||||
|
|
@ -348,7 +356,6 @@
|
|||
console.log("商品信息===",cartArr)
|
||||
msg.data.map(item=>{
|
||||
cartItem = getNowCart(item,cartArr)
|
||||
console.log("cartItem===",cartItem)
|
||||
if( cartItem.isGrounding||cartItem.is_temporary == 1 ){
|
||||
cartControls(cartItem,'add')
|
||||
} else {
|
||||
|
|
@ -569,10 +576,8 @@
|
|||
// chooseTable()
|
||||
// })
|
||||
// }
|
||||
if( !data.isCars ){
|
||||
return uni.$utils.showToast('购物车加载失败请刷新重试...')
|
||||
}
|
||||
if( !data.isGoodsAdd ){ return;uni.$utils.showToast('isGoodsAdd...') }
|
||||
|
||||
if( !data.isGoodsAdd ){ return;}
|
||||
let $goods = data.tabbar[index].foods[foodsindex]
|
||||
if ($goods.type !== 'sku') {
|
||||
//单规格
|
||||
|
|
@ -713,8 +718,6 @@
|
|||
delCart(e.goods.id)
|
||||
return
|
||||
}
|
||||
console.log(e)
|
||||
// product_name
|
||||
params.product_name = e.goods.name
|
||||
params.sku_name = e.goods.sku_name
|
||||
}
|
||||
|
|
@ -749,10 +752,6 @@
|
|||
* @param {Object} index
|
||||
*/
|
||||
function chooseGuige(foodsindex, index) {
|
||||
|
||||
if( !data.isCars ){
|
||||
return uni.$utils.showToast('购物车加载失败请刷新重试...')
|
||||
}
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
selGoods.value = $goods
|
||||
if ($goods.groupType == 1) {
|
||||
|
|
@ -1110,9 +1109,6 @@
|
|||
*/
|
||||
const refweighitem = ref(null)
|
||||
const tapweigh = (foodsindex, index) => {
|
||||
if( !data.isCars ){
|
||||
return uni.$utils.showToast('购物车加载失败请刷新重试...')
|
||||
}
|
||||
const goods = data.tabbar[index].foods[foodsindex]
|
||||
refweighitem.value.open(foodsindex, index, goods)
|
||||
}
|
||||
|
|
@ -1271,7 +1267,6 @@
|
|||
uni.$off('add:cashCai')
|
||||
uni.$on('update:createOrderIndex', () => {
|
||||
cars.length = 0
|
||||
console.log('update:createOrderIndex');
|
||||
init()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<view class=" u-font-24 u-m-t-12 u-flex">
|
||||
<view class=" u-flex">
|
||||
<text class="">挂账额度:</text>
|
||||
<text class="color-main">{{item.creditAmount}}</text>
|
||||
<text class="color-main">{{item.remainingAmount}}</text>
|
||||
</view>
|
||||
<view class="u-m-l-30 u-flex">
|
||||
<text class="">账户余额:</text>
|
||||
|
|
|
|||
|
|
@ -80,17 +80,20 @@
|
|||
</view>
|
||||
<view class="u-text-right u-m-t-28">
|
||||
<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>
|
||||
</template>
|
||||
<template v-else-if="item.userCouponId">
|
||||
<view>¥0.00</view>
|
||||
<template v-else-if="item.couponNum > 0">
|
||||
<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>
|
||||
</template>
|
||||
<template v-else-if="isVip == 1">
|
||||
<view>¥{{item.num*item.memberPrice}}</view>
|
||||
<view class="line-th color-666 ">¥{{item.num*item.price}}</view>
|
||||
<view>¥{{mathFloorPrice(item.num*item.memberPrice,item)}}</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
|
||||
|
|
@ -206,7 +209,7 @@
|
|||
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -374,12 +377,13 @@
|
|||
* 总优惠金额
|
||||
*/
|
||||
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)
|
||||
})
|
||||
|
||||
|
|
@ -394,14 +398,13 @@
|
|||
let memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
|
||||
let tPrice = (isVip.value ? memberPrice : cur.price)
|
||||
tPrice = cur.memberPrice != cur.unitPrice&& cur.price != cur.unitPrice ? cur.unitPrice : tPrice
|
||||
console.log(tPrice)
|
||||
let Total = Math.floor(tPrice * cur.num * 100) / 100
|
||||
|
||||
return prve + Total - (cur.returnNum*tPrice) - (cur.refundNum*cur.unitPrice)
|
||||
}, 0)
|
||||
return a + curTotal
|
||||
}, 0)
|
||||
console.log("菜品金额==",goodsPrice)
|
||||
// console.log("菜品金额==",goodsPrice)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
|
@ -495,7 +498,7 @@
|
|||
|
||||
|
||||
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) {
|
||||
// if (props.orderInfo.status == 'unpaid') {
|
||||
|
|
@ -566,7 +569,7 @@
|
|||
obj.number = '0.00'
|
||||
obj.skuName = obj.skuName || ''
|
||||
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)
|
||||
})
|
||||
arr = [...arr,...infoLit]
|
||||
|
|
|
|||
|
|
@ -173,11 +173,11 @@
|
|||
}
|
||||
let par = {
|
||||
orderId: props.data.orderId,
|
||||
refundAmount: number.value*props.data.unitPrice,
|
||||
refundAmount: number.value * props.data.unitPrice,
|
||||
refundReason: note,
|
||||
refundDetails: [{
|
||||
id: props.data.id,
|
||||
returnAmount: number.value*props.data.unitPrice,
|
||||
returnAmount: number.value * props.data.unitPrice,
|
||||
num: number.value,
|
||||
}],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@
|
|||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log("opt===",options);
|
||||
getShopInfoData()
|
||||
})
|
||||
onShow(() => {
|
||||
|
|
@ -109,24 +108,27 @@
|
|||
*/
|
||||
async function getOrderDetail () {
|
||||
let res = await getHistoryOrder({orderId: options.id})
|
||||
console.log("订单详情===",res)
|
||||
// console.log("订单详情===",res)
|
||||
if(res.userId){
|
||||
shopUserDetail({userId:res.userId}).then(res=>{
|
||||
if(res){
|
||||
user.value = res
|
||||
}
|
||||
})
|
||||
let resUser = await shopUserDetail({userId:res.userId})
|
||||
user.value = resUser
|
||||
}
|
||||
orderDetail.seatFee = {
|
||||
seatNum: res.seatNum,
|
||||
seatAmount: res.seatAmount,
|
||||
}
|
||||
|
||||
orderDetail.goodsList = Object.entries(res.detailMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
placeNum: key
|
||||
}))
|
||||
|
||||
orderDetail.goodsList.map(item=>{
|
||||
item.info.map(item=>{
|
||||
item.unitPrice = uni.$utils.isGoodsPrice(item,user.value)
|
||||
})
|
||||
})
|
||||
orderDetail.info = res
|
||||
console.log("orderDetail===",orderDetail);
|
||||
}
|
||||
|
||||
function onSeatFeeTuicai(seatFee) {
|
||||
|
|
@ -195,7 +197,9 @@
|
|||
if (res.confirm) {
|
||||
try {
|
||||
const res = await printOrder({
|
||||
id: orderDetail.info.id
|
||||
id: orderDetail.info.id,
|
||||
type: orderDetail.info.status == 'unpaid' ? 1 : 0
|
||||
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
} catch (e) {
|
||||
|
|
@ -213,6 +217,7 @@
|
|||
return
|
||||
}
|
||||
if (Array.isArray(goods)) {
|
||||
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
orderInfo: JSON.stringify(orderDetail.info),
|
||||
goodsList:JSON.stringify(goods)
|
||||
|
|
@ -221,8 +226,9 @@
|
|||
} else {
|
||||
goods.number = 0
|
||||
goods.skuName = goods.skuName || ''
|
||||
goods.priceAmount = goods.priceAmount ? goods.priceAmount : (goods.num*goods.unitPrice).toFixed(2)
|
||||
goods.unitPrice = goods.unitPrice
|
||||
goods.priceAmount = goods.priceAmount ? goods.priceAmount : (goods.num*uni.$utils.isGoodsPrice(goods,user.value)).toFixed(2)
|
||||
console.log(goods)
|
||||
goods.unitPrice = uni.$utils.isGoodsPrice(goods,user.value)
|
||||
goods.userCouponId = goods.userCouponId ? goods.userCouponId:''
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
orderInfo: JSON.stringify(orderDetail.info),
|
||||
|
|
|
|||
|
|
@ -40,20 +40,9 @@
|
|||
</view>
|
||||
<view class="u-flex u-flex-1 u-row-right" style="align-items: center;">
|
||||
<view style="margin-right: 10rpx;">×{{item.num}}</view>
|
||||
<template v-if="item.userCouponId">
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text class="line-th">¥{{item.payAmount}}</text>
|
||||
<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 class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text>¥{{item.unitPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -98,9 +87,9 @@
|
|||
<view class="u-m-t-32">
|
||||
<view class="u-flex u-row-right">
|
||||
<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 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>
|
||||
</view>
|
||||
|
|
@ -137,7 +126,7 @@
|
|||
let $goodsMap = {}
|
||||
let goosZhonglei = ref(0)
|
||||
let goodsNumber = ref(0)
|
||||
|
||||
let originAmount = ref(0)
|
||||
const priceSize = 9
|
||||
let minWidth=ref(36)
|
||||
|
||||
|
|
@ -158,6 +147,7 @@
|
|||
$goodsMap[goods.productId] = goods.num * 1
|
||||
goosZhonglei.value += 1
|
||||
}
|
||||
originAmount.value += goods.unitPrice
|
||||
}
|
||||
}
|
||||
goodsMapInit()
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@
|
|||
if (res.confirm) {
|
||||
try{
|
||||
const res= await printOrder({
|
||||
id :item.id
|
||||
id :item.id,
|
||||
type: item.status == 'unpaid' ? 1 : 0
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
|
|
|
|||
|
|
@ -38,12 +38,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { reactive, nextTick, ref, watch } from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||
|
|
|
|||
|
|
@ -35,6 +35,14 @@
|
|||
</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="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>
|
||||
</view>
|
||||
<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">
|
||||
<view>
|
||||
<text>挂账人:</text>
|
||||
|
|
@ -107,7 +115,7 @@
|
|||
</view>
|
||||
<view>
|
||||
<text>挂账额度:</text>
|
||||
<text>¥{{pageData.buyer.creditAmount||'0'}}</text>
|
||||
<text>¥{{pageData.buyer.remainingAmount||'0'}}</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
|
@ -224,7 +232,7 @@
|
|||
|
||||
<edit-discount :nowPrice="order.orderAmount-productCouponDiscountAmount-fullCouponDiscountAmount"
|
||||
@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"
|
||||
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
|
||||
|
|
@ -237,7 +245,7 @@
|
|||
</template>
|
||||
|
||||
<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 go from '@/commons/utils/go.js'
|
||||
|
||||
|
|
@ -259,7 +267,7 @@
|
|||
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl,queryOrderStatus } from '@/http/api/pay.js'
|
||||
import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/http/api/points.js'
|
||||
|
||||
|
||||
const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例
|
||||
const modal = reactive({
|
||||
title: '提示',
|
||||
cancelText: '取消',
|
||||
|
|
@ -323,7 +331,6 @@
|
|||
watchChooseQuan()
|
||||
})
|
||||
onLoad(async (opt) => {
|
||||
console.log(opt);
|
||||
Object.assign(order, opt)
|
||||
getPayType()
|
||||
init()
|
||||
|
|
@ -345,17 +352,13 @@
|
|||
// 获取订单详情
|
||||
const orderRes = await getHistoryOrder({orderId:order.orderId})
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailMap)
|
||||
pageData.goodsList = [];
|
||||
Object.values(orderRes.detailMap).forEach(item=>{
|
||||
pageData.goodsList = [...pageData.goodsList,...item]
|
||||
})
|
||||
pageData.goodsList = uni.$utils.objToArrary(orderRes.detailMap)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(pageData.goodsList)
|
||||
|
||||
// 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) {
|
||||
|
||||
shopUserDetail({
|
||||
userId: order.userId || pageData.user.userId
|
||||
}).then(res => {
|
||||
|
|
@ -366,7 +369,6 @@
|
|||
}
|
||||
})
|
||||
}
|
||||
console.log("order==",order)
|
||||
pageData.seatNum = order.seatNum;
|
||||
}
|
||||
|
||||
|
|
@ -395,7 +397,7 @@
|
|||
console.log(b)
|
||||
return a + ((b.packAmount||0)*b.packNumber).toFixed(2)*1
|
||||
}, 0)
|
||||
console.log(price)
|
||||
// console.log("菜品打包费===",price)
|
||||
return price
|
||||
}
|
||||
})
|
||||
|
|
@ -404,7 +406,7 @@
|
|||
* 桌位费
|
||||
*/
|
||||
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
|
||||
})
|
||||
|
||||
|
|
@ -416,7 +418,7 @@
|
|||
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + parseFloat(mathFloorPrice(b.num * b.price,b))
|
||||
}, 0)
|
||||
console.log("菜品原金额===",goodsPrice)
|
||||
// console.log("菜品原金额===",goodsPrice)
|
||||
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 memberPrice = b.memberPrice ? b.memberPrice : b.price
|
||||
let tPrice = (isVip.value ? memberPrice : b.price)
|
||||
tPrice = b.memberPrice != b.unitPrice&& b.price != b.unitPrice ? b.unitPrice : tPrice
|
||||
return a + parseFloat(mathFloorPrice(b.num * tPrice,b) - mathFloorPrice(b.returnNum*tPrice,b) - mathFloorPrice(b.refundNum*b.unitPrice,b))
|
||||
tPrice = (b.discountSaleAmount ? b.discountSaleAmount : tPrice )
|
||||
return a + parseFloat(mathFloorPrice(b.num * tPrice,b)*1 - mathFloorPrice(b.returnNum*tPrice,b)*1 - mathFloorPrice(b.refundNum*tPrice,b)*1)
|
||||
}, 0)
|
||||
console.log("减去退款退费的菜品金额===",goodsPrice)
|
||||
// console.log("减去退款退费的菜品金额===",goodsPrice)
|
||||
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) => {
|
||||
return a + ((b.num * b.price) - (b.num * b.discountSaleAmount))
|
||||
}, 0)
|
||||
return price
|
||||
// console.log("单品折扣金额====",price)
|
||||
return price.toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -466,7 +469,7 @@
|
|||
*/
|
||||
const fullCouponDiscountAmount = computed(() => {
|
||||
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
|
||||
}, 0)
|
||||
})
|
||||
|
|
@ -493,15 +496,15 @@
|
|||
* 支付金额
|
||||
*/
|
||||
const payPrice = computed(() => {
|
||||
console.log("newOriginPrice===",newOriginPrice.value)
|
||||
console.log("vipDiscount===",vipDiscount.value)
|
||||
console.log("productCouponDiscountAmount===",productCouponDiscountAmount.value)
|
||||
console.log("discount===",discount.value)
|
||||
console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value)
|
||||
console.log("accountPoints===",accountPoints)
|
||||
// console.log("newOriginPrice===",newOriginPrice.value)
|
||||
// console.log("vipDiscount===",vipDiscount.value)
|
||||
// console.log("productCouponDiscountAmount===",productCouponDiscountAmount.value)
|
||||
// console.log("discount===",discount.value)
|
||||
// console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value)
|
||||
// console.log("accountPoints===",accountPoints)
|
||||
let total = (newOriginPrice.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
console.log("payPrice===",total)
|
||||
// console.log("支付金额===",total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
|
|
@ -509,8 +512,7 @@
|
|||
* 积分使用前金额
|
||||
*/
|
||||
const orderAmount = computed(() => {
|
||||
let total = (newOriginPrice.value*1) - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value
|
||||
let total = (newOriginPrice.value*1) - productCouponDiscountAmount.value - discount.value - fullCouponDiscountAmount.value
|
||||
console.log(total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
|
@ -527,7 +529,9 @@
|
|||
})
|
||||
watch(() => payPrice.value, (newval) => {
|
||||
if( pageData.payUrlShow){
|
||||
getPayUrl()
|
||||
setTimeout(()=>{
|
||||
getPayUrl()
|
||||
})
|
||||
}
|
||||
if (newval <= 0) {
|
||||
const arr = ['cash', 'member-account']
|
||||
|
|
@ -577,7 +581,7 @@
|
|||
originAmount: originPrice.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
orderAmount: payPrice.value, // 订单金额
|
||||
seatNum: pageData.seatNum, // 用餐人数
|
||||
discountAmount: discount.value, // 手动优惠金额
|
||||
discountAmount: discount.value.toFixed(2), // 手动优惠金额
|
||||
fullCouponDiscountAmount: fullCouponDiscountAmount.value, // 满减金额
|
||||
productCouponDiscountAmount: productCouponDiscountAmount.value,
|
||||
vipPrice: vipDiscount.value != 0 ? 1: 0, // 是否使用会员价
|
||||
|
|
@ -654,7 +658,7 @@
|
|||
if(!goods)return;
|
||||
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.price
|
||||
tPrice = (isVip.value ? memberPrice : goods.price)
|
||||
tPrice = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : tPrice
|
||||
tPrice = goods.discountSaleAmount ? goods.discountSaleAmount : tPrice
|
||||
item.discountAmount = tPrice
|
||||
})
|
||||
|
||||
|
|
@ -662,18 +666,11 @@
|
|||
productCoup = [];
|
||||
}
|
||||
// productCoup = productCoup.filter(v => v.number >= 1)
|
||||
pays.quan = [...setmanjianCoup, ...productCoup,...setproductCoup]
|
||||
pays.quan = [...manjianCoup, ...productCoup]
|
||||
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) {
|
||||
return
|
||||
}
|
||||
console.log("calcUsablePoints",pageData.user)
|
||||
const res = await calcUsablePoints({
|
||||
shopUserId: pageData.user.id,
|
||||
orderAmount: payPrice.value
|
||||
|
|
@ -716,9 +712,10 @@
|
|||
accountPoints.price = 0
|
||||
return ''
|
||||
}
|
||||
console.log(payPrice.value)
|
||||
const res = await calcDeductionAmount({
|
||||
shopUserId: pageData.user.id,
|
||||
orderAmount: payPrice.value,
|
||||
orderAmount: orderAmount.value,
|
||||
points: accountPoints.num
|
||||
})
|
||||
if (res) {
|
||||
|
|
@ -751,7 +748,7 @@
|
|||
go.to('PAGES_ORDER_QUAN', {
|
||||
orderId: order.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);
|
||||
pageData.user = data
|
||||
pays.quan = []
|
||||
discount.discount = 100
|
||||
discount.value = 0
|
||||
init()
|
||||
})
|
||||
}
|
||||
|
|
@ -819,7 +828,6 @@
|
|||
function watchChoosebuyer() {
|
||||
uni.$off('choose-buyer')
|
||||
uni.$on('choose-buyer', (data) => {
|
||||
console.log(data);
|
||||
pageData.buyer = data
|
||||
})
|
||||
}
|
||||
|
|
@ -830,13 +838,11 @@
|
|||
* @param {Object} form
|
||||
*/
|
||||
function editDiscountConfirm(form) {
|
||||
console.log(form);
|
||||
accountPoints.sel = false
|
||||
Object.assign(discount, {
|
||||
...form,
|
||||
value: form.price - form.currentPrice
|
||||
})
|
||||
console.log(discount.discount);
|
||||
const fullCoupon = pays.quan.find(v => v.type == 1)
|
||||
if (fullCoupon && form.currentPrice < fullCoupon.fullAmount) {
|
||||
modal.content = '改价后价格不满足满减券最低满减需求' + fullCoupon.fullAmount + '元'
|
||||
|
|
@ -845,7 +851,7 @@
|
|||
modal.cancelText = '取消改价'
|
||||
modal.confirmText = '删除满减券'
|
||||
}
|
||||
getPayUrl()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -858,12 +864,10 @@
|
|||
return uni.$utils.showToast(item.payName + '不可用')
|
||||
}
|
||||
pays.payTypes.selIndex = i
|
||||
console.log(item.payType)
|
||||
console.log(pageData.user.id)
|
||||
if (item.payType == 'member-account' && !pageData.user.id) {
|
||||
chooseUser()
|
||||
}
|
||||
if (item.payType == 'virtual' && !pageData.buyer.id) {
|
||||
if (item.payType == 'arrears' && !pageData.buyer.id) {
|
||||
chooseBuyer()
|
||||
}
|
||||
|
||||
|
|
@ -894,19 +898,17 @@
|
|||
}
|
||||
function payOrderClick() {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
console.log(payType);
|
||||
if (payType == 'scanCode' || payType == 'deposit') {
|
||||
return saomaPay(payType)
|
||||
}
|
||||
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||
return cashConfirmShow()
|
||||
}
|
||||
if (payType == 'virtual') {
|
||||
// return cashConfirmShow()
|
||||
if (payType == 'arrears' && pageData.buyer.remainingAmount < payPrice.value * 1 ) {
|
||||
return uni.$utils.showToast('挂账额度不足')
|
||||
}
|
||||
if (payType == 'member-account' && pageData.user.amount * 1 < payPrice.value * 1) {
|
||||
uni.$utils.showToast('余额不足')
|
||||
return
|
||||
return uni.$utils.showToast('余额不足')
|
||||
}
|
||||
if (payStatus) {
|
||||
return uni.$utils.showToast(tipsMap[payStatus])
|
||||
|
|
@ -939,7 +941,7 @@
|
|||
if( order.userId||pageData.user.userId ){
|
||||
params.checkOrderPay.userId = order.userId||pageData.user.userId
|
||||
}
|
||||
if( payType == 'virtual' ){
|
||||
if( payType == 'arrears' ){
|
||||
params.creditBuyerId = pageData.buyer.id
|
||||
}
|
||||
|
||||
|
|
@ -953,7 +955,7 @@
|
|||
if (payType == 'cash') {
|
||||
await cashPay(params)
|
||||
}
|
||||
if (payType == 'virtual') {
|
||||
if (payType == 'arrears') {
|
||||
await creditPay(params)
|
||||
}
|
||||
if( payType == 'member-account' || payType == 'deposit' ) {
|
||||
|
|
@ -984,6 +986,10 @@
|
|||
console.log(res)
|
||||
},1000)
|
||||
}
|
||||
if( error.code == 701 ){
|
||||
uni.removeStorageSync("table_code")
|
||||
uni.navigateBack()
|
||||
}
|
||||
payStatus = '';
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1005,6 +1011,13 @@
|
|||
uni.navigateBack({
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,10 +73,8 @@
|
|||
{{ item.useRestrictions }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="right u-flex u-flex-col u-col-bottom u-row-center">
|
||||
<view class="u-flex ">
|
||||
<view class="use-btn" @click.stop="toEmitChooseQuan(item)">去使用</view>
|
||||
</view>
|
||||
<view class="right u-flex u-flex-col u-col-bottom u-row-center" style="flex-shrink: 1;">
|
||||
<view class="use-btn" @click.stop="toEmitChooseQuan(item)" style="flex-shrink: 1;">去使用</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -142,7 +140,8 @@
|
|||
returnCoupCanUse,
|
||||
returnCouponAllPrice,
|
||||
returnProductCoupon,
|
||||
returnCanUseFullReductionCoupon
|
||||
returnCanUseFullReductionCoupon,
|
||||
returnProductAllCoup
|
||||
} from '../quan_util.js'
|
||||
import { getHistoryOrder } from '@/http/api/order.js'
|
||||
import { shopUserDetail } from '@/http/api/shopUser.js'
|
||||
|
|
@ -227,13 +226,12 @@
|
|||
})
|
||||
pageData.order = await getHistoryOrder({orderId:option.orderId})
|
||||
|
||||
console.log(pageData.order);
|
||||
const res = await getFindCoupon({
|
||||
shopUserId: option.shopUserId,
|
||||
type: pageData.types.sel+1
|
||||
})
|
||||
let fullReductionCoupon = res.filter(v => v.type == 1)
|
||||
let productCoupon = res.filter(v => v.type == 2)
|
||||
let fullReductionCoupon = res ? res.filter(v => v.type == 1) : []
|
||||
let productCoupon = res ? res.filter(v => v.type == 2) : []
|
||||
|
||||
canDikouGoodsArr = returnNewGoodsList(pageData.order.detailMap || [])
|
||||
fullReductionCoupon = fullReductionCoupon.map((v) => {
|
||||
|
|
@ -259,7 +257,6 @@
|
|||
// .filter((v) => v.use);
|
||||
pageData.fullReductionCoupon = fullReductionCoupon
|
||||
pageData.productCoupon = productCoupon
|
||||
console.log(res)
|
||||
pageData.hasAjax = true;
|
||||
}
|
||||
|
||||
|
|
@ -316,8 +313,6 @@
|
|||
const goodsQuan = pageData.productCoupon.filter(v => v.checked)
|
||||
let coupArr = [...goodsQuan, item]
|
||||
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user)
|
||||
|
||||
console.log(payPrice)
|
||||
if (payPrice<=0) {
|
||||
modal.content = '选择该商品券后支付金额将为0,继续选择将取消选择的满减券'
|
||||
modal.cancelText = '取消'
|
||||
|
|
@ -333,7 +328,7 @@
|
|||
return
|
||||
}
|
||||
}
|
||||
console.log(2)
|
||||
|
||||
item.checked = !item.checked
|
||||
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
|
||||
if (CheckedArr.length <= 0) {
|
||||
|
|
@ -569,7 +564,6 @@
|
|||
&.goods {
|
||||
.right {
|
||||
background-color: #fff;
|
||||
position: initial;
|
||||
|
||||
.use-btn {
|
||||
padding: 10rpx 40rpx;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export function isTui(item) {
|
||||
console.log("isTui",item.status);
|
||||
// console.log("isTui",item.status);
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||
}
|
||||
//是否使用会员价
|
||||
|
|
@ -22,11 +22,7 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
|||
|
||||
//返回新的商品列表,过滤掉退菜的,退单的商品
|
||||
export function returnNewGoodsList(arr) {
|
||||
let goods_list = []
|
||||
Object.values(arr).forEach(item=>{
|
||||
goods_list = [...goods_list,...item]
|
||||
})
|
||||
return goods_list.filter(v => !isTui(v))
|
||||
return uni.$utils.objToArrary(arr).filter(v => !isTui(v))
|
||||
}
|
||||
//根据当前购物车商品以及数量,已选券对应商品数量,判断该商品券是否可用
|
||||
export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
||||
|
|
@ -38,10 +34,10 @@ export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
|||
return false
|
||||
}
|
||||
const findGoodsTotalNumber = findGoods.reduce((prve, cur) => {
|
||||
return prve + cur.num * 1
|
||||
return prve + cur.num
|
||||
}, 0)
|
||||
const selCoupNumber = selCoupArr.filter(v => v.proId == coup.proId).reduce((prve, cur) => {
|
||||
return prve + cur.num * 1
|
||||
return prve + 1
|
||||
}, 0)
|
||||
if (selCoupNumber >= findGoodsTotalNumber) {
|
||||
return false
|
||||
|
|
@ -59,9 +55,10 @@ export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
|||
use: false
|
||||
}
|
||||
}
|
||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
||||
const discountAmount = (price * coup.num).toFixed(2)
|
||||
let memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||
let price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
||||
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=discountAmount>0
|
||||
|
|
@ -90,9 +87,10 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
|
|||
}
|
||||
//返回商品实际支付价格
|
||||
export function returnProductPayPrice(goods,vipUser){
|
||||
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.unitPrice;
|
||||
let price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.unitPrice;
|
||||
price = goods.memberPrice != goods.unitPrice&& goods.price != goods.unitPrice ? goods.unitPrice : price
|
||||
console.log(goods)
|
||||
let memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
|
||||
let price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
|
||||
price = goods.discountSaleAmount ? goods.discountSaleAmount : price
|
||||
return price
|
||||
}
|
||||
//返回商品券抵扣的商品价格
|
||||
|
|
@ -129,11 +127,7 @@ export function returnProCoupStartIndex(coupArr,index){
|
|||
}
|
||||
//返回商品数量从0到n每一个对应的价格对照表
|
||||
export function returnGoodsPayPriceMap(goodsArr){
|
||||
let goods_arr = []
|
||||
Object.values(goodsArr).forEach(item=>{
|
||||
goods_arr = [...goods_arr,...Object.values(item)]
|
||||
})
|
||||
return goods_arr.reduce((prve,cur)=>{
|
||||
return goodsArr.reduce((prve,cur)=>{
|
||||
if(!prve.hasOwnProperty(cur.productId)){
|
||||
prve[cur.productId]=[]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<view class="u-flex u-m-l-32 u-col-center">
|
||||
<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>
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -93,8 +93,9 @@
|
|||
<view style="height: 200rpx;"></view>
|
||||
<view class="fixed-b">
|
||||
<up-button text="确认退款" @click="tuikuanConfirm" shape="circle" type="primary" size="large"
|
||||
:color="color.ColorMain"></up-button>
|
||||
:color="$utils.ColorMain"></up-button>
|
||||
</view>
|
||||
<confirmRefundPopup ref="refundPopup" />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -102,8 +103,8 @@
|
|||
<script setup>
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import color from '@/commons/color.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import confirmRefundPopup from './components/confirmRefundPopup.vue';
|
||||
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import { refundOrder } from '@/http/api/order.js'
|
||||
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
|
||||
|
|
@ -132,10 +133,11 @@
|
|||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
const refundPopup = ref(null);
|
||||
|
||||
onLoad((opt) => {
|
||||
orderDetail.info = JSON.parse(opt.orderInfo)
|
||||
orderDetail.goodsList = JSON.parse(opt.goodsList)
|
||||
console.log(orderDetail)
|
||||
option.productId = orderDetail.goodsList[0].productId
|
||||
option.orderId = orderDetail.goodsList[0].orderId
|
||||
})
|
||||
|
|
@ -251,22 +253,23 @@
|
|||
/**
|
||||
* 确认退款
|
||||
*/
|
||||
let params;
|
||||
async function tuikuanConfirm() {
|
||||
const canTuikuan=await hasPermission('允许退款')
|
||||
if(!canTuikuan){
|
||||
return infoBox.showToast('您没有退款权限')
|
||||
return uni.$utils.showToast('您没有退款权限')
|
||||
}
|
||||
if (pageData.tabsIndex != 2&&tuikuanNumber.value <= 0) {
|
||||
return infoBox.showToast('退款商品数量不能为0!')
|
||||
return uni.$utils.showToast('退款商品数量不能为0!')
|
||||
}
|
||||
|
||||
const selTag=tuikuan.list[tuikuan.sel]
|
||||
const noteResult=`${selTag?selTag:''}${note.value?(','+note.value):''}`
|
||||
if (!noteResult) {
|
||||
return infoBox.showToast('请输入或选择退款原因!')
|
||||
return uni.$utils.showToast('请输入或选择退款原因!')
|
||||
}
|
||||
|
||||
let params = {
|
||||
params = {
|
||||
orderId: option.orderId,
|
||||
refundReason: noteResult,
|
||||
refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
|
||||
|
|
@ -285,10 +288,21 @@
|
|||
params.refundAmount = pageData.tabsIndex == 1 ? alltuikuanPrice.value : tuikuanPrice.value
|
||||
}
|
||||
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)
|
||||
infoBox.showToast('退款请求提交成功')
|
||||
uni.$utils.showToast('退款请求提交成功')
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack({delta:1})
|
||||
},500)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
style="display: flex; flex-direction: column; align-items: center; justify-content: center;">
|
||||
<!-- <view>{{subsectioncurrent==0?'请用美团':'抖音'}}</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>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
Loading…
Reference in New Issue