拉取叶代码
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
export const objToArrary = (obj) => {
|
||||
export const objToArrary = (obj,keyNewName) => {
|
||||
return Object.entries(obj).map(([key, value]) => ({
|
||||
key,
|
||||
[keyNewName]:key,
|
||||
...value,
|
||||
}))
|
||||
}
|
||||
306
components/my-components/my-reportDamage.vue
Normal file
306
components/my-components/my-reportDamage.vue
Normal file
@@ -0,0 +1,306 @@
|
||||
<template>
|
||||
<up-popup customStyle="overflow: hidden;" :show="show" round="20" mode="bottom" @close="close" @open="open">
|
||||
<view class="reportDamage">
|
||||
<view class="reportDamage_head">
|
||||
<view class="reportDamage_title">{{item.title}}</view>
|
||||
<up-icon name="close-circle-fill" color="#333" size="25" @tap="show=false"></up-icon>
|
||||
</view>
|
||||
<view class="reportDamage_content">
|
||||
<view class="reportDamage_cell">
|
||||
<view class="cell_lable">
|
||||
<up-image class="thumbnail" radius="10" :show-loading="true" :src="item.thumbnail"></up-image>
|
||||
<view>{{item.name}}</view>
|
||||
</view>
|
||||
<view class="cell_value">
|
||||
<up-icon name="minus-circle" color="#999" size="25" @tap="minus"></up-icon>
|
||||
<view class="text">{{vdata.num}}</view>
|
||||
<up-icon name="plus-circle-fill" color="#318AFE" size="25" @tap="plus"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="reportDamage_cell">
|
||||
<view class="cell_lable">商品单位</view>
|
||||
<view class="cell_value"><view>杯</view> <up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
|
||||
</view>
|
||||
<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">
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
<view class="file" @tap="chooseAndUploadAvatar()">
|
||||
<up-icon name="camera-fill" color="#E5E5E5" size="35"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="reportDamage_footer">
|
||||
<view class="reportDamage_btn" @tap="affirm">确认</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
reactive,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { $uploadFile } from '@/http/yskApi/file.js'
|
||||
const props = defineProps({
|
||||
show:{
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
item:{
|
||||
type: Object,
|
||||
},
|
||||
|
||||
})
|
||||
const emits = defineEmits(['close','open',"affirm"])
|
||||
const vdata = reactive({
|
||||
num: 1,
|
||||
imgUrlList: [],
|
||||
})
|
||||
watch(()=>props.show,(newval)=>{
|
||||
show.value=newval
|
||||
})
|
||||
let show = ref(props.show)
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
emits('close')
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开报损弹窗
|
||||
*/
|
||||
function open() {
|
||||
show.value = true
|
||||
emits('open')
|
||||
}
|
||||
|
||||
/**
|
||||
* 报损数量减少
|
||||
*/
|
||||
function minus() {
|
||||
if ( vdata.num <= 1) {
|
||||
return;
|
||||
}
|
||||
vdata.num--;
|
||||
}
|
||||
|
||||
/**
|
||||
* 报损数量增加
|
||||
*/
|
||||
function plus() {
|
||||
vdata.num++;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除报损图片
|
||||
*/
|
||||
function del ( index ) {
|
||||
vdata.imgUrlList.splice(index,1)
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传报损图片
|
||||
*/
|
||||
function chooseAndUploadAvatar () {
|
||||
if ( vdata.imgUrlList.length >= 6 ) {
|
||||
uni.showToast({
|
||||
title:'最多只可以上传六张',
|
||||
icon:'none'
|
||||
})
|
||||
return;
|
||||
}
|
||||
// 选择图片
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认为1,只选择一张图片
|
||||
sizeType: ['original', 'compressed'], // 图片质量,原图或压缩
|
||||
sourceType: ['album', 'camera'], // 图片来源,相册或相机
|
||||
success: (res) => {
|
||||
let file = res.tempFiles[0];
|
||||
console.log(res)
|
||||
$uploadFile(file).then(res => {
|
||||
console.log(res);
|
||||
vdata.imgUrlList.push(res.data[0])
|
||||
|
||||
}).catch(res=>{
|
||||
console.log(res);
|
||||
if(res.errMsg){
|
||||
uni.showToast({
|
||||
title:'图片大小超出限制',
|
||||
icon:'error'
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
fail: chooseImageError => {
|
||||
// 选择图片失败处理逻辑
|
||||
console.log('choose image fail:', chooseImageError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认
|
||||
*/
|
||||
function affirm () {
|
||||
emits('affirm')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
close,
|
||||
open,
|
||||
affirm
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.mask {
|
||||
background-color: rgba(51, 51, 51, .5);
|
||||
}
|
||||
::v-deep .u-popup__content{
|
||||
// background-color: transparent;
|
||||
|
||||
}
|
||||
.reportDamage{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.reportDamage_head{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx;
|
||||
box-sizing: border-box;
|
||||
background: #F4F4F4;
|
||||
.reportDamage_title{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.reportDamage_content{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
|
||||
.reportDamage_cell{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx;
|
||||
box-sizing: border-box;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
border-bottom: 2rpx solid #E5E5E5;
|
||||
.cell_lable{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
.thumbnail{
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
::v-deep .u-image,.u-image__loading,.u-image__image{
|
||||
width: 100%!important;
|
||||
height: 100%!important;
|
||||
}
|
||||
::v-deep uni-image{
|
||||
width: 112rpx!important;
|
||||
height: 112rpx!important;
|
||||
}
|
||||
}
|
||||
.cell_value{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
.text{
|
||||
margin-left: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.file{
|
||||
padding: 30rpx;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
box-sizing: border-box;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.file_img{
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin-left: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
position: relative;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
.del{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.file_img_item{
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
|
||||
}
|
||||
::v-deep .u-image,.u-image__loading,.u-image__image{
|
||||
width: 100%!important;
|
||||
height: 100%!important;
|
||||
}
|
||||
::v-deep uni-image{
|
||||
width: 120rpx!important;
|
||||
height: 120rpx!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.cell_value.file{
|
||||
// flex-direction: row-reverse;
|
||||
// justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
.reportDamage_cell:last-child{
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
.reportDamage_footer{
|
||||
background-color: #fff;
|
||||
padding: 32rpx;
|
||||
padding-bottom: 68rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.reportDamage_btn{
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
background: #318AFE;
|
||||
border-radius: 40rpx 40rpx 40rpx 40rpx;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,334 +0,0 @@
|
||||
<template>
|
||||
<view class="u-steps-item" ref="u-steps-item" :class="[`u-steps-item--${parentData.direction}`]">
|
||||
<view class="u-steps-item__line" v-if="index + 1 < childLength"
|
||||
:class="[`u-steps-item__line--${parentData.direction}`]" :style="[lineStyle]"></view>
|
||||
<view class="u-steps-item__wrapper"
|
||||
:class="[`u-steps-item__wrapper--${parentData.direction}`, parentData.dot && `u-steps-item__wrapper--${parentData.direction}--dot`]"
|
||||
:style="[itemStyleInner]">
|
||||
<slot name="icon">
|
||||
<view class="u-steps-item__wrapper__dot" v-if="parentData.dot" :style="{
|
||||
backgroundColor: statusColor
|
||||
}">
|
||||
|
||||
</view>
|
||||
<view class="u-steps-item__wrapper__icon" v-else-if="parentData.activeIcon || parentData.inactiveIcon">
|
||||
<u-icon :name="index <= parentData.current ? parentData.activeIcon : parentData.inactiveIcon"
|
||||
:size="iconSize"
|
||||
:color="index <= parentData.current ? parentData.activeColor : parentData.inactiveColor">
|
||||
</u-icon>
|
||||
</view>
|
||||
<view v-else :style="{
|
||||
backgroundColor: statusClass === 'process' ? parentData.activeColor : 'transparent',
|
||||
borderColor: statusColor
|
||||
}" class="u-steps-item__wrapper__circle">
|
||||
<text v-if="statusClass === 'process' || statusClass === 'wait'"
|
||||
class="u-steps-item__wrapper__circle__text" :style="{
|
||||
color: index == parentData.current ? '#ffffff' : parentData.inactiveColor
|
||||
}">{{ index + 1}}</text>
|
||||
<u-icon v-else :color="statusClass === 'error' ? 'error' : parentData.activeColor" size="12"
|
||||
:name="statusClass === 'error' ? 'close' : 'checkmark'"></u-icon>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<view class="u-steps-item__content" :class="[`u-steps-item__content--${parentData.direction}`]"
|
||||
:style="[contentStyle]">
|
||||
<u-text :text="title" :type="parentData.current == index ? 'primary' : 'content'" lineHeight="20px"
|
||||
:size="parentData.current == index ? 14 : 13"></u-text>
|
||||
<slot name="desc">
|
||||
<view class="u-p-b-20">
|
||||
<u-text :text="desc" :type="parentData.current == index ? 'primary' : 'content'" size="14"></u-text>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<!-- <view
|
||||
class="u-steps-item__line"
|
||||
v-if="showLine && parentData.direction === 'column'"
|
||||
:class="[`u-steps-item__line--${parentData.direction}`]"
|
||||
:style="[lineStyle]"
|
||||
></view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { props } from './prop/steps-item.js';
|
||||
import { mpMixin } from './libs/mixin/mpMixin';
|
||||
import { mixin } from './libs/mixin/mixin';
|
||||
import { sleep, error } from './libs/function/index';
|
||||
import color from './libs/config/color';
|
||||
// #ifdef APP-NVUE
|
||||
const dom = uni.requireNativePlugin('dom')
|
||||
// #endif
|
||||
/**
|
||||
* StepsItem 步骤条的子组件
|
||||
* @description 本组件需要和u-steps配合使用
|
||||
* @tutorial https://uview-plus.jiangruyi.com/components/steps.html
|
||||
* @property {String} title 标题文字
|
||||
* @property {String} current 描述文本
|
||||
* @property {String | Number} iconSize 图标大小 (默认 17 )
|
||||
* @property {Boolean} error 当前步骤是否处于失败状态 (默认 false )
|
||||
* @example <u-steps current="0"><u-steps-item title="已出库" desc="10:35" ></u-steps-item></u-steps>
|
||||
*/
|
||||
export default {
|
||||
name: 'u-steps-item',
|
||||
mixins: [mpMixin, mixin, props],
|
||||
data() {
|
||||
return {
|
||||
index: 0,
|
||||
childLength: 0,
|
||||
showLine: false,
|
||||
size: {
|
||||
height: 0,
|
||||
width: 0
|
||||
},
|
||||
parentData: {
|
||||
direction: 'row',
|
||||
current: 0,
|
||||
activeColor: '',
|
||||
inactiveColor: '',
|
||||
activeIcon: '',
|
||||
inactiveIcon: '',
|
||||
dot: false
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'parentData'(newValue, oldValue) {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
// #ifdef MP-TOUTIAO
|
||||
options: {
|
||||
virtualHost: false
|
||||
},
|
||||
// #endif
|
||||
computed: {
|
||||
lineStyle() {
|
||||
const style = {}
|
||||
if (this.parentData.direction === 'row') {
|
||||
style.width = this.size.width + 'px'
|
||||
style.left = this.size.width / 2 + 'px'
|
||||
} else {
|
||||
style.height = this.size.height + 'px'
|
||||
// style.top = this.size.height / 2 + 'px'
|
||||
}
|
||||
style.backgroundColor = this.parent.children?.[this.index + 1]?.error ? color.error : this.index <
|
||||
this
|
||||
.parentData
|
||||
.current ? this.parentData.activeColor : this.parentData.inactiveColor
|
||||
return style
|
||||
},
|
||||
itemStyleInner() {
|
||||
return {
|
||||
...this.itemStyle
|
||||
}
|
||||
},
|
||||
statusClass() {
|
||||
const {
|
||||
index,
|
||||
error
|
||||
} = this
|
||||
const {
|
||||
current
|
||||
} = this.parentData
|
||||
if (current == index) {
|
||||
return error === true ? 'error' : 'process'
|
||||
} else if (error) {
|
||||
return 'error'
|
||||
} else if (current > index) {
|
||||
return 'finish'
|
||||
} else {
|
||||
return 'wait'
|
||||
}
|
||||
},
|
||||
statusColor() {
|
||||
let colorTmp = ''
|
||||
switch (this.statusClass) {
|
||||
case 'finish':
|
||||
colorTmp = this.parentData.activeColor
|
||||
break
|
||||
case 'error':
|
||||
colorTmp = color.error
|
||||
break
|
||||
case 'process':
|
||||
colorTmp = this.parentData.dot ? this.parentData.activeColor : 'transparent'
|
||||
break
|
||||
default:
|
||||
colorTmp = this.parentData.inactiveColor
|
||||
break
|
||||
}
|
||||
return colorTmp
|
||||
},
|
||||
contentStyle() {
|
||||
const style = {}
|
||||
if (this.parentData.direction === 'column') {
|
||||
style.marginLeft = this.parentData.dot ? '2px' : '6px'
|
||||
style.marginTop = this.parentData.dot ? '0px' : '6px'
|
||||
} else {
|
||||
style.marginTop = this.parentData.dot ? '2px' : '6px'
|
||||
style.marginLeft = this.parentData.dot ? '2px' : '6px'
|
||||
}
|
||||
|
||||
return style
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.parent && this.parent.updateFromChild()
|
||||
sleep().then(() => {
|
||||
this.getStepsItemRect()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
// 初始化数据
|
||||
this.updateParentData()
|
||||
if (!this.parent) {
|
||||
return error('u-steps-item必须要搭配u-steps组件使用')
|
||||
}
|
||||
this.index = this.parent.children.indexOf(this)
|
||||
this.childLength = this.parent.children.length
|
||||
},
|
||||
updateParentData() {
|
||||
// 此方法在mixin中
|
||||
this.getParentData('u-steps')
|
||||
},
|
||||
// 父组件数据发生变化
|
||||
updateFromParent() {
|
||||
this.init()
|
||||
},
|
||||
// 获取组件的尺寸,用于设置横线的位置
|
||||
getStepsItemRect() {
|
||||
// #ifndef APP-NVUE
|
||||
this.$uGetRect('.u-steps-item').then(size => {
|
||||
this.size = size
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-NVUE
|
||||
dom.getComponentRect(this.$refs['u-steps-item'], res => {
|
||||
const {
|
||||
size
|
||||
} = res
|
||||
this.size = size
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "./libs/css/components.scss";
|
||||
|
||||
.u-steps-item {
|
||||
flex: 1;
|
||||
@include flex;
|
||||
|
||||
&--row {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&--column {
|
||||
position: relative;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
&__wrapper {
|
||||
@include flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
border-radius: 50px;
|
||||
|
||||
&--column {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
|
||||
&--dot {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
&--row {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
|
||||
&--dot {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
&__circle {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
/* #ifndef APP-NVUE */
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
/* #endif */
|
||||
border-radius: 100px;
|
||||
border-width: 1px;
|
||||
border-color: $u-tips-color;
|
||||
border-style: solid;
|
||||
@include flex(row);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&__text {
|
||||
color: $u-tips-color;
|
||||
font-size: 11px;
|
||||
@include flex(row);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
line-height: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
&__dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 100px;
|
||||
background-color: $u-content-color;
|
||||
}
|
||||
}
|
||||
|
||||
&__content {
|
||||
@include flex;
|
||||
flex: 1;
|
||||
|
||||
&--row {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&--column {
|
||||
flex-direction: column;
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
&__line {
|
||||
position: absolute;
|
||||
background: $u-tips-color;
|
||||
|
||||
&--row {
|
||||
top: 10px;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
&--column {
|
||||
width: 1px;
|
||||
left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,90 +0,0 @@
|
||||
<template>
|
||||
<view
|
||||
class="u-steps"
|
||||
:class="[`u-steps--${direction}`]"
|
||||
>
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { props } from './prop/steps.js';
|
||||
import { mpMixin } from './libs/mixin/mpMixin';
|
||||
import { mixin } from './libs/mixin/mixin';
|
||||
import test from './libs/function/test';
|
||||
/**
|
||||
* Steps 步骤条
|
||||
* @description 该组件一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
|
||||
* @tutorial https://uview-plus.jiangruyi.com/components/steps.html
|
||||
* @property {String} direction row-横向,column-竖向 (默认 'row' )
|
||||
* @property {String | Number} current 设置当前处于第几步 (默认 0 )
|
||||
* @property {String} activeColor 激活状态颜色 (默认 '#3c9cff' )
|
||||
* @property {String} inactiveColor 未激活状态颜色 (默认 '#969799' )
|
||||
* @property {String} activeIcon 激活状态的图标
|
||||
* @property {String} inactiveIcon 未激活状态图标
|
||||
* @property {Boolean} dot 是否显示点类型 (默认 false )
|
||||
* @example <u-steps current="0"><u-steps-item title="已出库" desc="10:35" ></u-steps-item></u-steps>
|
||||
*/
|
||||
export default {
|
||||
name: 'u-steps',
|
||||
mixins: [mpMixin, mixin, props],
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
children() {
|
||||
this.updateChildData()
|
||||
},
|
||||
parentData() {
|
||||
this.updateChildData()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 监听参数的变化,通过watch中,手动去更新子组件的数据,否则子组件不会自动变化
|
||||
parentData() {
|
||||
return [this.current, this.direction, this.activeColor, this.inactiveColor, this.activeIcon, this.inactiveIcon, this.dot]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 更新子组件的数据
|
||||
updateChildData() {
|
||||
this.children.map(child => {
|
||||
// 先判断子组件是否存在对应的方法
|
||||
test.func((child || {}).updateFromParent()) && child.updateFromParent()
|
||||
})
|
||||
},
|
||||
// 接受子组件的通知,去修改其他子组件的数据
|
||||
updateFromChild() {
|
||||
this.updateChildData()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.children = []
|
||||
},
|
||||
options: {
|
||||
virtualHost: false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "./libs/css/components.scss";
|
||||
|
||||
.u-steps {
|
||||
@include flex;
|
||||
|
||||
&--column {
|
||||
flex-direction: column
|
||||
}
|
||||
|
||||
&--row {
|
||||
flex-direction: row;
|
||||
flex: 1;
|
||||
/* #ifdef MP */
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
||||
/* #endif */
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -621,4 +621,4 @@ export function $uploadImg(data) {
|
||||
/* 获取上传form信息 */
|
||||
export function $NewOssFilesForm(data) {
|
||||
return http.req("/api/ossFiles/form", data, "POST")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ function commonsProcess(showLoading, httpReqCallback){
|
||||
|
||||
// 提示信息
|
||||
isShowErrorToast = true
|
||||
infoBox.showErrorToast('请登录').then(() => {
|
||||
go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
|
||||
})
|
||||
// infoBox.showErrorToast('请登录').then(() => {
|
||||
// go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
|
||||
// })
|
||||
return Promise.reject(bodyData) // 跳转到catch函数
|
||||
}
|
||||
// http响应码不正确
|
||||
|
||||
@@ -128,4 +128,9 @@ export function $tbProductV2(data) {
|
||||
export function $tbProskuConV2(data) {
|
||||
return http.req('/api/tbProskuCon/V2', data, 'POST')
|
||||
}
|
||||
|
||||
/* 修改商品相关(快捷接口) */
|
||||
export function $updateProductData(data) {
|
||||
return http.req('/api/stock/updateProductData', data, 'POST')
|
||||
}
|
||||
// v2 api end
|
||||
29
http/yskApi/pageWorkControl.js
Normal file
29
http/yskApi/pageWorkControl.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import http from './http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 查询交班记录
|
||||
* @returns
|
||||
*/
|
||||
export function tbHandover(data) {
|
||||
return request({
|
||||
url: '/api/tbHandover?' + data,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提交交班
|
||||
* @returns
|
||||
*/
|
||||
export function handoverData(data) {
|
||||
return request({
|
||||
url: '/api/tbHandover/handoverData',
|
||||
method: 'post',
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,6 +1,79 @@
|
||||
import http from './http.js'
|
||||
const request=http.request
|
||||
|
||||
|
||||
/**
|
||||
* 获取店铺列表
|
||||
* @returns
|
||||
*/
|
||||
export function getShopList(params) {
|
||||
return request({
|
||||
url: `/api/tbShopInfo`,
|
||||
method: 'get',
|
||||
params: {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺数据
|
||||
* @returns
|
||||
*/
|
||||
export function getShopInfo(params) {
|
||||
return request({
|
||||
url: `/api/tbShopInfo/${params}`,
|
||||
method: 'get',
|
||||
params: {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改店铺信息
|
||||
* @returns
|
||||
*/
|
||||
export function editShopInfo(data) {
|
||||
return request({
|
||||
url: `/api/tbShopInfo`,
|
||||
method: 'put',
|
||||
data:{
|
||||
// shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取店铺图片
|
||||
* @returns
|
||||
*/
|
||||
export function getShopExtend(params) {
|
||||
return request({
|
||||
url: `/tbShopExtend`,
|
||||
method: 'get',
|
||||
params:{
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺图片
|
||||
* @returns
|
||||
*/
|
||||
export function editShopExtend(data) {
|
||||
return request({
|
||||
url: `/tbShopExtend`,
|
||||
method: 'put',
|
||||
data:{
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 商品列表
|
||||
* @returns
|
||||
|
||||
25
http/yskApi/user.js
Normal file
25
http/yskApi/user.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import http from './http.js'
|
||||
const request=http.request
|
||||
/**
|
||||
* 用户详情
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopInfo(shopId) {
|
||||
const _shopId=uni.getStorageSync('shopId')
|
||||
return request({
|
||||
url: `/api/tbShopInfo/${shopId||_shopId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店铺信息
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopInfoPut(data) {
|
||||
return request({
|
||||
url: `/api/tbShopInfo`,
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
365
node_modules/.package-lock.json
generated
vendored
365
node_modules/.package-lock.json
generated
vendored
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "jeepay-ui-uapp-merchant",
|
||||
"name": "cashier_admin_app",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
@@ -402,11 +402,48 @@
|
||||
"ajv": "^8.8.2"
|
||||
}
|
||||
},
|
||||
"node_modules/anymatch": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/anymatch/-/anymatch-3.1.3.tgz",
|
||||
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"normalize-path": "^3.0.0",
|
||||
"picomatch": "^2.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmmirror.com/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"node_modules/big.js": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmmirror.com/big.js/-/big.js-5.2.2.tgz",
|
||||
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/binary-extensions": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
||||
"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/braces": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/braces/-/braces-3.0.3.tgz",
|
||||
@@ -489,6 +526,44 @@
|
||||
],
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/chokidar": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.6.0.tgz",
|
||||
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
"normalize-path": "~3.0.0",
|
||||
"readdirp": "~3.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/chokidar/node_modules/glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/chrome-trace-event": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz",
|
||||
@@ -499,6 +574,17 @@
|
||||
"node": ">=6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/clipboard": {
|
||||
"version": "2.0.11",
|
||||
"resolved": "https://registry.npmmirror.com/clipboard/-/clipboard-2.0.11.tgz",
|
||||
"integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"good-listener": "^1.2.2",
|
||||
"select": "^1.1.2",
|
||||
"tiny-emitter": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz",
|
||||
@@ -531,9 +617,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.6",
|
||||
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.6.tgz",
|
||||
"integrity": "sha512-zZbY5giJAinCG+7AGaw0wIhNZ6J8AhWuSXKvuc1KAyMiRsvGQWqh4L+MomvhdAYjN+lqvVCMq1I41e3YHvXkyQ=="
|
||||
"version": "1.11.13",
|
||||
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz",
|
||||
"integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/delegate": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/delegate/-/delegate-3.2.0.tgz",
|
||||
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.4.816",
|
||||
@@ -542,6 +635,16 @@
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/emojis-list": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/emojis-list/-/emojis-list-3.0.0.tgz",
|
||||
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
}
|
||||
},
|
||||
"node_modules/enhanced-resolve": {
|
||||
"version": "5.17.0",
|
||||
"resolved": "https://registry.npmmirror.com/enhanced-resolve/-/enhanced-resolve-5.17.0.tgz",
|
||||
@@ -668,8 +771,7 @@
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fastq": {
|
||||
"version": "1.17.1",
|
||||
@@ -741,6 +843,15 @@
|
||||
"to-arraybuffer": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/good-listener": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmmirror.com/good-listener/-/good-listener-1.2.2.tgz",
|
||||
"integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"delegate": "^3.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/graceful-fs": {
|
||||
"version": "4.2.11",
|
||||
"resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz",
|
||||
@@ -772,6 +883,26 @@
|
||||
"node": ">= 4"
|
||||
}
|
||||
},
|
||||
"node_modules/immutable": {
|
||||
"version": "4.3.7",
|
||||
"resolved": "https://registry.npmmirror.com/immutable/-/immutable-4.3.7.tgz",
|
||||
"integrity": "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/is-binary-path": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"binary-extensions": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/is-extglob": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||
@@ -827,6 +958,12 @@
|
||||
"resolved": "https://registry.npmmirror.com/jsbn/-/jsbn-1.1.0.tgz",
|
||||
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A=="
|
||||
},
|
||||
"node_modules/jsencrypt": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmmirror.com/jsencrypt/-/jsencrypt-3.3.2.tgz",
|
||||
"integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/json-parse-even-better-errors": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmmirror.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
|
||||
@@ -840,6 +977,29 @@
|
||||
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/json5": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz",
|
||||
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"json5": "lib/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/klona": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmmirror.com/klona/-/klona-2.0.6.tgz",
|
||||
"integrity": "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/loader-runner": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/loader-runner/-/loader-runner-4.3.0.tgz",
|
||||
@@ -850,6 +1010,27 @@
|
||||
"node": ">=6.11.5"
|
||||
}
|
||||
},
|
||||
"node_modules/loader-utils": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-2.0.4.tgz",
|
||||
"integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^3.0.0",
|
||||
"json5": "^2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
@@ -906,8 +1087,7 @@
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmmirror.com/neo-async/-/neo-async-2.6.2.tgz",
|
||||
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "2.0.14",
|
||||
@@ -994,6 +1174,19 @@
|
||||
"safe-buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz",
|
||||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"picomatch": "^2.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/require-from-string": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/require-from-string/-/require-from-string-2.0.2.tgz",
|
||||
@@ -1056,6 +1249,115 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.78.0",
|
||||
"resolved": "https://registry.npmmirror.com/sass/-/sass-1.78.0.tgz",
|
||||
"integrity": "sha512-AaIqGSrjo5lA2Yg7RvFZrlXDBCp3nV4XP73GrLGvdRWWwk+8H3l0SDvq/5bA4eF+0RFPLuWUk3E+P1U/YqnpsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
"immutable": "^4.0.0",
|
||||
"source-map-js": ">=0.6.2 <2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"sass": "sass.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sass-loader": {
|
||||
"version": "10.5.2",
|
||||
"resolved": "https://registry.npmmirror.com/sass-loader/-/sass-loader-10.5.2.tgz",
|
||||
"integrity": "sha512-vMUoSNOUKJILHpcNCCyD23X34gve1TS7Rjd9uXHeKqhvBG39x6XbswFDtpbTElj6XdMFezoWhkh5vtKudf2cgQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"klona": "^2.0.4",
|
||||
"loader-utils": "^2.0.0",
|
||||
"neo-async": "^2.6.2",
|
||||
"schema-utils": "^3.0.0",
|
||||
"semver": "^7.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"fibers": ">= 3.1.0",
|
||||
"node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
|
||||
"sass": "^1.3.0",
|
||||
"webpack": "^4.36.0 || ^5.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"fibers": {
|
||||
"optional": true
|
||||
},
|
||||
"node-sass": {
|
||||
"optional": true
|
||||
},
|
||||
"sass": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/sass-loader/node_modules/ajv": {
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz",
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/sass-loader/node_modules/ajv-keywords": {
|
||||
"version": "3.5.2",
|
||||
"resolved": "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
|
||||
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"ajv": "^6.9.1"
|
||||
}
|
||||
},
|
||||
"node_modules/sass-loader/node_modules/json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/sass-loader/node_modules/schema-utils": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-3.3.0.tgz",
|
||||
"integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.8",
|
||||
"ajv": "^6.12.5",
|
||||
"ajv-keywords": "^3.5.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
}
|
||||
},
|
||||
"node_modules/schema-utils": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-4.2.0.tgz",
|
||||
@@ -1075,6 +1377,25 @@
|
||||
"url": "https://opencollective.com/webpack"
|
||||
}
|
||||
},
|
||||
"node_modules/select": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/select/-/select-1.1.2.tgz",
|
||||
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.6.3",
|
||||
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.6.3.tgz",
|
||||
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/serialize-javascript": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
|
||||
@@ -1106,6 +1427,16 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-support": {
|
||||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmmirror.com/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||
@@ -1250,6 +1581,12 @@
|
||||
"url": "https://opencollective.com/webpack"
|
||||
}
|
||||
},
|
||||
"node_modules/tiny-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/to-arraybuffer": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
|
||||
@@ -1326,6 +1663,18 @@
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uview-plus": {
|
||||
"version": "3.3.32",
|
||||
"resolved": "https://registry.npmmirror.com/uview-plus/-/uview-plus-3.3.32.tgz",
|
||||
"integrity": "sha512-rl/Bw9uH7sNY8GAzKVv3Wel27wvUx08UuADEPxQB5U2LrkdHD2r6Cvk6BTbQbLKDTpFR7rrbVTQiK/DNKFIe4Q==",
|
||||
"dependencies": {
|
||||
"clipboard": "^2.0.11",
|
||||
"dayjs": "^1.11.3"
|
||||
},
|
||||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/watchpack": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.1.tgz",
|
||||
|
||||
2169
package-lock.json
generated
2169
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -71,12 +71,14 @@
|
||||
</view>
|
||||
|
||||
<my-action-sheet @itemClick="sheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
|
||||
<my-reportDamage ref="reportDamage" :item="report.data" @affirm="affirm"></my-reportDamage>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import color from '@/commons/color.js';
|
||||
import myEmpty from '../components/empty.vue';
|
||||
import productItem from './components/product-item.vue';
|
||||
import myReportDamage from '@/components/my-components/my-reportDamage';
|
||||
import myButton from '@/components/my-components/my-button';
|
||||
import myActionSheet from '@/components/my-components/my-action-sheet';
|
||||
import {$getStockOperate} from '@/http/yskApi/invoicing.js'
|
||||
@@ -85,7 +87,7 @@
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onPullDownRefresh
|
||||
onPullDownRefresh,
|
||||
} from '@dcloudio/uni-app';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
@@ -101,8 +103,25 @@
|
||||
}
|
||||
let refMoreSheet = ref(null)
|
||||
const actionSheet = reactive({
|
||||
list: ['编辑', '清点', '入库', '出库', '删除']
|
||||
list: ['报损', '编辑', '清点', '入库', '出库', '删除'],
|
||||
})
|
||||
|
||||
let reportDamage = ref(null)
|
||||
const report = reactive({
|
||||
data: {
|
||||
thumbnail: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240918/a17a62b7b55a4b65a2a2542050672b34.png',
|
||||
name: "美式咖啡",
|
||||
title: "商品报损",
|
||||
unit: "杯",
|
||||
},
|
||||
})
|
||||
/**
|
||||
* 报损确认
|
||||
*/
|
||||
function affirm () {
|
||||
console.log(2)
|
||||
}
|
||||
|
||||
|
||||
function moreShow() {
|
||||
console.log(refMoreSheet.value);
|
||||
@@ -110,6 +129,15 @@
|
||||
}
|
||||
function sheetClick(index){
|
||||
console.log(index);
|
||||
// 报损
|
||||
switch (index){
|
||||
case 0:
|
||||
//打开报损弹窗
|
||||
reportDamage.value.open();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
const product = reactive({
|
||||
list: new Array(1).fill(1)
|
||||
|
||||
2026
pageProduct/add-Product/add-Product-9-19-back.vue
Normal file
2026
pageProduct/add-Product/add-Product-9-19-back.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="u-p-30 safe-page">
|
||||
<up-sticky v-if="option.type==='edit'" offset-top="20" zIndex="99">
|
||||
<myTabs :list="tabsList" @change="tabsChange"></myTabs>
|
||||
<myTabs :list="tabsList" v-model="tabsCurrent"></myTabs>
|
||||
</up-sticky>
|
||||
|
||||
<view class="box">
|
||||
@@ -11,19 +11,30 @@
|
||||
err-show-type="toast" validateTrigger="submit" label-width="350" ref="Forms">
|
||||
<view class="block">
|
||||
<uni-forms-item label="商品类型" required showRequired>
|
||||
<view class="u-flex u-flex-wrap types " :class="{disabled:option.productId!==''}">
|
||||
<up-radio-group
|
||||
:disabled="option.type=='edit'"
|
||||
v-model="FormData.typeEnum"
|
||||
placement="row"
|
||||
>
|
||||
<up-radio
|
||||
:customStyle="{marginRight: '30px'}"
|
||||
v-for="(item, index) in pageData.types"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:name="item.value"
|
||||
>
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
<!-- <view class="u-flex u-flex-wrap types " :class="{disabled:option.productId!==''}">
|
||||
<view class="item" @tap="changeFormData('typeEnum',item.value)"
|
||||
:class="{active:FormData.typeEnum===item.value}"
|
||||
v-for="(item,index) in pageData.types" :key="index">
|
||||
<!-- <view class="gou u-flex u-row-right u-col-top u-p-t-4 u-p-r-4">
|
||||
<uni-icons type="checkmarkempty" :size="8" color="#fff"></uni-icons>
|
||||
</view> -->
|
||||
<view class="title">{{item.title}}</view>
|
||||
<view class="u-font-24 color-999 u-m-t-10">
|
||||
{{item.desc}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</uni-forms-item>
|
||||
<uni-forms-item ref="fileItem" label="图片">
|
||||
@@ -38,11 +49,6 @@
|
||||
</uni-forms-item>
|
||||
<template v-if="FormData.typeEnum!='group'">
|
||||
<uni-forms-item label="所属分类" required showRequired name="categoryId">
|
||||
<!-- <picker @change="bindPickerChange"
|
||||
range-key="name"
|
||||
:value="pageData.category" :range="pageData.category">
|
||||
<view class="uni-input">请选择分类</view>
|
||||
</picker> -->
|
||||
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
|
||||
placeholder="请选择分类" popup-title="请选择分类" :localdata="pageData.category"
|
||||
v-model="FormData.categoryId">
|
||||
@@ -50,10 +56,6 @@
|
||||
</uni-forms-item>
|
||||
</template>
|
||||
|
||||
<!-- <uni-forms-item label="产品编码">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.goodsCode" placeholder="请输入商品编码" />
|
||||
</uni-forms-item> -->
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="商品描述">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
@@ -82,7 +84,7 @@
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
|
||||
<template class="" v-if="FormData.typeEnum==='group'">
|
||||
<template v-if="FormData.typeEnum==='group'">
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="团购券分类" required showRequired name="categoryId">
|
||||
<view class="u-p-30 bg-gray u-m-b-20" v-if="FormData.groupCategoryId.length">
|
||||
@@ -726,161 +728,27 @@
|
||||
|
||||
</uni-forms>
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view style="padding-left: 110rpx;padding-right: 110rpx;" class="u-m-t-20" v-if="option.type==='edit'" @click="delModelShow">
|
||||
<my-button bgColor="#F9F9F9" shape="circle" type="cancel" >
|
||||
<view class="color-red">删除该商品</view>
|
||||
</my-button>
|
||||
</view>
|
||||
<view class="bootom">
|
||||
<view class="save-btn-box">
|
||||
<my-button shape="circle" @tap="save">保存</my-button>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-20" v-if="option.type==='edit'" @click="delModelShow">
|
||||
<my-button shape="circle" type="cancel" bgColor="#fff">
|
||||
<!-- <view class="u-m-t-20" v-if="option.type==='edit'" @click="delModelShow">
|
||||
<my-button bgColor="#fff" shape="circle" type="cancel" >
|
||||
<view class="color-red">删除该商品</view>
|
||||
</my-button>
|
||||
<!-- <text>删除该商品</text> -->
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template v-if="tabsCurrent===1">
|
||||
<view class="stock">
|
||||
<uni-forms :border="false" err-show-type="toast" validateTrigger="submit" ref="Forms1">
|
||||
<!-- <view class="block ">
|
||||
<uni-forms-item label="" required>
|
||||
<view class="u-flex">
|
||||
<view class="label-title">库存模式</view>
|
||||
<view class="u-flex-1 u-p-l-100">
|
||||
<uni-data-checkbox v-model="stockData.inventoryMode"
|
||||
:localdata="InventoryModeData"></uni-data-checkbox>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view> -->
|
||||
<view class="block ">
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">库存开关</view>
|
||||
<my-switch v-model="FormData.isStock"
|
||||
@change="updateProductStatus(FormData.id,'isStock')"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="block ">
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">共享库存</view>
|
||||
<my-switch v-model="FormData.isDistribute"
|
||||
@change="updateProductStatus(FormData.id,'isDistribute')"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="block ">
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">售罄</view>
|
||||
<my-switch v-model="FormData.isPauseSale"
|
||||
@change="updateProductStatus(FormData.id,'isPauseSale')"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
|
||||
<template v-if="FormData.typeEnum!=='sku'">
|
||||
<view class="block ">
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">上架</view>
|
||||
<my-switch v-model="FormData.isGrounding"
|
||||
@change="updateProductStatus(FormData.id,'isGrounding')"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="block default-box-padding">
|
||||
<view class="u-flex">
|
||||
<view class="">
|
||||
<my-button @tap="toRecoders" :height="60">库存记录</my-button>
|
||||
</view>
|
||||
<view class="u-m-l-40">
|
||||
<my-button :height="60" @tap="toCheck">库存盘点</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<template v-else>
|
||||
<view class="block default-box-padding">
|
||||
<view class="u-flex">
|
||||
<view class="">
|
||||
<my-button @tap="toRecoders" :height="60">库存记录</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-text-center block">
|
||||
<view class="u-flex font-bold u-m-t-30 u-m-b-20">
|
||||
<!-- <view class="u-flex-1">商品信息</view> -->
|
||||
<view class="u-flex-1">规格</view>
|
||||
<view class="u-flex-1">库存</view>
|
||||
<view class="u-flex-1">售罄</view>
|
||||
<view class="u-flex-1">上架</view>
|
||||
<view class="u-flex-1">操作</view>
|
||||
</view>
|
||||
<view class="" v-for="(item,index) in pageData.skuList" :key="index">
|
||||
<view class="u-flex u-p-b-12 u-p-t-12 ">
|
||||
<view class="u-flex-1">{{item.specSnap}}</view>
|
||||
<!-- <view class="u-flex-1">{{item.salePrice}}</view> -->
|
||||
<view class="u-flex-1">{{item.stockNumber}}{{item.unitName}}</view>
|
||||
<view class="u-flex-1 u-flex u-row-center"><my-switch v-model="item.isPauseSale"
|
||||
@change="updateProductStatus(item.skuId,'isPauseSale')"></my-switch>
|
||||
</view>
|
||||
<view class="u-flex-1 u-flex u-row-center"><my-switch v-model="item.isGrounding"
|
||||
@change="updateProductStatus(item.skuId,'isGrounding')"></my-switch>
|
||||
</view>
|
||||
<view class="u-flex u-row-center">
|
||||
<my-button @tap="skuToCheck(item)" :width="120" :height="40">
|
||||
<view class="u-font-24 no-wrap">库存盘点</view>
|
||||
</my-button>
|
||||
<!-- <my-button @tap="moreShow(item,index)" :width="100" :height="40">
|
||||
<view class="u-font-24 no-wrap">更多</view>
|
||||
</my-button> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<!-- <view class="block ">
|
||||
<uni-forms-item label="" required>
|
||||
<view class="u-flex">
|
||||
<view class="label-title">剩余库存数量</view>
|
||||
<view class="u-flex-1 u-p-l-40">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone"
|
||||
:placeholderStyle="placeholderStyle" type="number"
|
||||
:inputBorder="inputBorder" v-model="FormData.stockNumber"
|
||||
placeholder="填写库存" />
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view> -->
|
||||
<!-- <view class="block ">
|
||||
<uni-forms-item label="" required>
|
||||
<view class="u-flex">
|
||||
<view class="label-title">库存模式</view>
|
||||
<view class="u-flex-1 u-p-l-100">
|
||||
<uni-data-checkbox v-model="stockData.inventoryReset"
|
||||
:localdata="InventoryReset"></uni-data-checkbox>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view> -->
|
||||
</uni-forms>
|
||||
|
||||
<view class="btns">
|
||||
<my-button shape="circle">保存</my-button>
|
||||
<my-button shape="circle" type="default" @tap="back">取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
<edit-haocai :goods="FormData" @cancel="changeTabsCurrent(0)"></edit-haocai>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
@@ -894,11 +762,8 @@
|
||||
</template>
|
||||
</my-model>
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<!-- 删除弹窗 -->
|
||||
<my-model @confirm="delmodelConfirm" ref="delModel" desc="确认删除">
|
||||
</my-model>
|
||||
@@ -906,6 +771,9 @@
|
||||
<choose-goods ref="refChooseGoods" @confirm="refChooseGoodsConfirm" :category="pageData.category"></choose-goods>
|
||||
<!-- 更多操作 -->
|
||||
<my-action-sheet @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -922,6 +790,7 @@
|
||||
|
||||
import myModel from '@/components/my-components/my-model'
|
||||
import chooseGoods from './components/choose-goods'
|
||||
import editHaocai from './components/edit-haocai.vue'
|
||||
import chooseGroupCategory from './components/choose-coupon-category'
|
||||
import myRadio from '@/components/my-components/my-radio'
|
||||
import myUploadFile from '@/components/my-components/my-upload-file'
|
||||
@@ -929,6 +798,7 @@
|
||||
import myButton from '@/components/my-components/my-button'
|
||||
import mySwitch from '@/components/my-components/my-switch.vue'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
|
||||
import {
|
||||
$types,
|
||||
$defaultSku
|
||||
@@ -1274,7 +1144,13 @@
|
||||
}
|
||||
|
||||
|
||||
const tabsList = ['基础设置', '库存设置']
|
||||
const tabsList = ['基础设置', '耗材绑定']
|
||||
let tabsCurrent = ref(0)
|
||||
function changeTabsCurrent(newval){
|
||||
tabsCurrent.value=newval
|
||||
}
|
||||
|
||||
|
||||
const Forms = ref(null)
|
||||
|
||||
|
||||
@@ -1545,7 +1421,11 @@
|
||||
//页面全部数据
|
||||
const pageData = reactive({
|
||||
// 商品类型
|
||||
types: $types,
|
||||
// types: $types,
|
||||
types: [
|
||||
{name:'单规格',value:'normal'},
|
||||
{name:'多规格',value:'sku'}
|
||||
],
|
||||
// 单位
|
||||
units: [],
|
||||
// 分类
|
||||
@@ -1597,14 +1477,7 @@
|
||||
|
||||
|
||||
|
||||
let tabsCurrent = ref(0)
|
||||
|
||||
function tabsChange(i) {
|
||||
tabsCurrent.value = i
|
||||
// if (tabsCurrent.value === 1 && option.type === 'add') {
|
||||
// showModel('stockTips')
|
||||
// }
|
||||
}
|
||||
|
||||
let timer = null
|
||||
|
||||
@@ -1809,7 +1682,7 @@
|
||||
watchTimerSave(false)
|
||||
})
|
||||
onReady(() => {
|
||||
Forms.value.setRules(rules)
|
||||
Forms.value&&Forms.value.setRules(rules)
|
||||
})
|
||||
watch(() => pageData.types, (newval) => {
|
||||
Forms.value.setRules(rules)
|
||||
@@ -1884,13 +1757,13 @@
|
||||
position: fixed;
|
||||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
bottom: 110rpx;
|
||||
bottom: 140rpx;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.box {
|
||||
margin-top: 70rpx;
|
||||
margin-top: 36rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.block {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
|
||||
159
pageProduct/add-Product/components/choose-danwei.vue
Normal file
159
pageProduct/add-Product/components/choose-danwei.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<view class="u-relative choose-haocai">
|
||||
<view class="input u-flex" @click="toggle" >
|
||||
<up-input @blur="blur" @change="filterHaocaiList" border="none" v-model="text" placeholder="请选择"></up-input>
|
||||
<up-icon :size="10" name="arrow-down-fill"></up-icon>
|
||||
</view>
|
||||
<view class="u-absolute" v-if="popShow">
|
||||
<scroll-view scroll-y="true" class="scroll">
|
||||
<view class="item" v-for="(item,index) in $haocaiList" :key="index" @click="haocaiClick(item,index)">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view class="item no-wrap" @click="toggle" v-if="text&&!$haocaiList.length">没有该单位</view>
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
listMap: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
|
||||
})
|
||||
let text = ref('')
|
||||
|
||||
let popShow = ref(props.show)
|
||||
const emits = defineEmits(['update:show', 'close', 'confirm', 'update:modelValue'])
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
popShow.value = false
|
||||
}
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
console.log(newval);
|
||||
emits('update:show', newval)
|
||||
})
|
||||
let $haocaiList = ref(props.list)
|
||||
watch(() => props.list, (newval) => {
|
||||
$haocaiList.value = newval
|
||||
setText()
|
||||
})
|
||||
watch(() => props.modelValue, (newval) => {
|
||||
console.log(newval);
|
||||
setText()
|
||||
})
|
||||
|
||||
|
||||
|
||||
function setText() {
|
||||
// const item = props.listMap[props.modelValue]
|
||||
// text.value = item ? item.name : ''
|
||||
text.value=props.modelValue
|
||||
}
|
||||
|
||||
function toggle(e) {
|
||||
popShow.value = !popShow.value
|
||||
}
|
||||
|
||||
function filterHaocaiList(e) {
|
||||
if (e === '') {
|
||||
return $haocaiList.value = props.list
|
||||
}
|
||||
const arr = props.list.filter(v => v.name.match(e))
|
||||
$haocaiList.value = arr
|
||||
}
|
||||
|
||||
function haocaiClick(item, index) {
|
||||
console.log(item);
|
||||
// if (item.id != props.modelValue) {
|
||||
// emits('update:modelValue', item.id)
|
||||
// }
|
||||
if(item.name!=props.modelValue){
|
||||
emits('update:modelValue', item.name)
|
||||
}
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function focus(){
|
||||
console.log('focus');
|
||||
popShow.value = true
|
||||
}
|
||||
function blur() {
|
||||
console.log('blur');
|
||||
setTimeout(()=>{
|
||||
popShow.value = false
|
||||
},100)
|
||||
}
|
||||
onMounted(() => {
|
||||
setText()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.choose-haocai {
|
||||
.input {
|
||||
width: 172rpx;
|
||||
padding: 10rpx 16rpx;
|
||||
height: 60rpx;
|
||||
box-sizing: border-box;
|
||||
background: #FFFFFF;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
.u-absolute {
|
||||
top: calc(100% + 10rpx);
|
||||
border: 1px solid #E5E5E5;
|
||||
left: 0;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
right: 0;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.scroll {
|
||||
$line-h: 60rpx;
|
||||
max-height: calc($line-h * 4);
|
||||
|
||||
.item {
|
||||
line-height: $line-h;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
57
pageProduct/add-Product/components/choose-haocai - 副本.vue
Normal file
57
pageProduct/add-Product/components/choose-haocai - 副本.vue
Normal file
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<up-popup :round="10" :show="popShow" :closeable="true" @close="close">
|
||||
<view class="u-text-center font-bold u-font-32 u-p-t-30">选择状态</view>
|
||||
<view style="height: 20rpx;"></view>
|
||||
<view class="u-p-30 all-list u-flex u-flex-wrap gap-20">
|
||||
<view class="all-list-item" :class="{active:statusItemIndex==statusData.allListSel}" @click="changeAllListSel(statusItemIndex)" v-for="(statusItem,statusItemIndex) in statusData.allList" :key="statusItemIndex">
|
||||
{{statusItem.label}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-p-t-30 u-p-b-30 u-p-l-20 u-p-r-20 gap-20">
|
||||
<up-button @click="close">取消</up-button>
|
||||
<up-button type="primary" @click="confirm">确定</up-button>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
const props=defineProps({
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
|
||||
let popShow=ref(props.show)
|
||||
const emits=defineEmits(['update:show','close','confirm'])
|
||||
function close(){
|
||||
popShow.value=false
|
||||
}
|
||||
function confirm(){
|
||||
popShow.value=false
|
||||
}
|
||||
watch(()=>props.show,(newval)=>{
|
||||
popShow.value=newval
|
||||
})
|
||||
watch(()=>popShow.value,(newval)=>{
|
||||
emits('update:show',newval)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.all-list-item{
|
||||
text-align: center;
|
||||
width: 156rpx;
|
||||
white-space: nowrap;
|
||||
color: #666;
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 8rpx;
|
||||
transition: all .2s ease-in-out;
|
||||
border: 1px solid #eee;
|
||||
&.active {
|
||||
color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
149
pageProduct/add-Product/components/choose-haocai.vue
Normal file
149
pageProduct/add-Product/components/choose-haocai.vue
Normal file
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<view class="u-relative choose-haocai">
|
||||
<view class="input u-flex" @click="toggle">
|
||||
<!-- <view>
|
||||
<text v-if="modelValue">{{modelValue}}</text>
|
||||
<text v-else class="color-666">请选择</text>
|
||||
</view> -->
|
||||
<up-input @blur="blur" @change="filterHaocaiList" border="none" v-model="text" placeholder="请选择"></up-input>
|
||||
<up-icon :size="10" name="arrow-down-fill"></up-icon>
|
||||
</view>
|
||||
<view class="u-absolute" v-if="popShow">
|
||||
<scroll-view scroll-y="true" class="scroll">
|
||||
<view class="item" v-for="(item,index) in $haocaiList" :key="index" @click="haocaiClick(item,index)">
|
||||
{{item.conName}}
|
||||
</view>
|
||||
<view class="item no-wrap" @click="toggle" v-if="text&&!$haocaiList.length">没有该耗材</view>
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
listMap: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
|
||||
})
|
||||
let text = ref('')
|
||||
let popShow = ref(props.show)
|
||||
const emits = defineEmits(['update:show', 'close', 'confirm', 'update:modelValue','change'])
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
popShow.value = false
|
||||
}
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
let $haocaiList = ref(props.list)
|
||||
watch(() => props.list, (newval) => {
|
||||
$haocaiList.value = newval
|
||||
setText()
|
||||
})
|
||||
watch(() => props.modelValue, (newval) => {
|
||||
setText()
|
||||
})
|
||||
|
||||
function setText() {
|
||||
const item = props.listMap[props.modelValue]
|
||||
text.value = item ? item.conName : ''
|
||||
}
|
||||
|
||||
function toggle(e) {
|
||||
popShow.value = !popShow.value
|
||||
}
|
||||
|
||||
function filterHaocaiList(e) {
|
||||
if (e === '') {
|
||||
return $haocaiList.value = props.list
|
||||
}
|
||||
const arr = props.list.filter(v => v.conName.match(e))
|
||||
$haocaiList.value = arr
|
||||
}
|
||||
|
||||
function haocaiClick(item, index) {
|
||||
console.log(item);
|
||||
if (item.consId != props.modelValue) {
|
||||
emits('update:modelValue', item.consId)
|
||||
emits('change', item)
|
||||
}
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function blur() {
|
||||
setTimeout(()=>{
|
||||
popShow.value = false
|
||||
},100)
|
||||
}
|
||||
onMounted(() => {
|
||||
setText()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.choose-haocai {
|
||||
.input {
|
||||
width: 172rpx;
|
||||
padding: 10rpx 16rpx;
|
||||
height: 60rpx;
|
||||
box-sizing: border-box;
|
||||
background: #FFFFFF;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
.u-absolute {
|
||||
top: calc(100% + 10rpx);
|
||||
border: 1px solid #E5E5E5;
|
||||
left: 0;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
right: 0;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.scroll {
|
||||
$line-h: 60rpx;
|
||||
max-height: calc($line-h * 4);
|
||||
|
||||
.item {
|
||||
line-height: $line-h;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
359
pageProduct/add-Product/components/edit-haocai.vue
Normal file
359
pageProduct/add-Product/components/edit-haocai.vue
Normal file
@@ -0,0 +1,359 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="default-box-padding bg-fff border-r-18">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>商品名称</view>
|
||||
<template v-if="isSku">
|
||||
<view class="u-flex u-font-24 color-666">
|
||||
<view class="u-m-r-20">绑定至规格</view>
|
||||
<up-switch :size="18" v-model="isBindGuige" :disabled="!isSku">绑定至规格</up-switch>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="border-bottom u-m-t-16 u-p-b-32">{{goods.name}}</view>
|
||||
<view class="">
|
||||
<template v-if="isBindGuige&&isSku">
|
||||
<view class="list">
|
||||
<view class="u-p-b-32 u-p-t-32 border-bottom" v-for="(item,index) in skuList" :key="index">
|
||||
<view>规格名称</view>
|
||||
<view class="u-m-t-16">{{item.specSnap}}</view>
|
||||
<view class="color-666 u-m-t-24 u-flex">
|
||||
<view class="xuhao">序号</view>
|
||||
<view class="u-flex u-flex-1 u-p-l-32 gap-20">
|
||||
<view class="u-flex-1">耗材名称</view>
|
||||
<view class="u-flex-1">单位</view>
|
||||
<view class="u-flex-1">用量</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32 color-666">
|
||||
<view class="u-m-t-24" v-for="(haocai,haocaiIndex) in item.haoaiList"
|
||||
:key="haocaiIndex">
|
||||
<view class=" u-flex">
|
||||
<view class="xuhao">{{haocaiIndex+1}}</view>
|
||||
<view class="u-flex u-flex-1 u-p-l-32 gap-20">
|
||||
<view class="u-flex-1 ">
|
||||
<view class="u-flex input">
|
||||
<view>{{item.name}}</view>
|
||||
<up-icon :size="10" name="arrow-down-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex-1 ">
|
||||
<view class="u-flex input">
|
||||
<view>{{item.unit}}</view>
|
||||
<up-icon :size="10" name="arrow-down-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex-1 ">
|
||||
<view class="u-flex input">
|
||||
<up-input border="none"></up-input>
|
||||
<up-icon color="#EB4F4F" @click="delGuigeHaocao(index,haocaiIndex)"
|
||||
:size="16" name="minus-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-16 color-666 u-font-24">
|
||||
<view class="xuhao">
|
||||
</view>
|
||||
<view class="u-flex u-flex-1 u-p-l-32 gap-20">库存:{{item.stockNumber}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class=" u-p-t-32 u-flex" @click="addGuigeHaocai(index)">
|
||||
<up-icon :size="18" color="#318AFE" name="plus-circle-fill"></up-icon>
|
||||
<view class="u-m-l-16">添加耗材</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="list">
|
||||
<view class="u-p-b-32 u-p-t-32 border-bottom" v-for="(item,index) in conInfos" :key="index">
|
||||
<view class="color-666 u-flex">
|
||||
<view class="xuhao">序号</view>
|
||||
<view class="u-flex u-flex-1 u-p-l-32 gap-20">
|
||||
<view class="u-flex-1">耗材名称</view>
|
||||
<view class="u-flex-1">单位</view>
|
||||
<view class="u-flex-1">用量</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32 color-666">
|
||||
<view class=" u-m-t-24 u-flex">
|
||||
<view class="xuhao">{{index+1}}</view>
|
||||
<view class="u-flex u-flex-1 u-p-l-32 gap-20">
|
||||
<view class="u-flex-1 ">
|
||||
<choose-haocai @change="conInfosChange($event,item)" :listMap="$haocaiMap"
|
||||
:list="haoCaiList" v-model="item.conInfoId"></choose-haocai>
|
||||
<!-- <view class="u-flex input">
|
||||
<view>{{item.conName}}</view>
|
||||
<up-icon :size="10" name="arrow-down-fill"></up-icon>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="u-flex-1 ">
|
||||
<choose-danwei :listMap="$danweiMap" :list="danweiList"
|
||||
v-model="item.conUnit"></choose-danwei>
|
||||
<!-- <view class="u-flex input">
|
||||
<view>{{item.conUnit}}</view>
|
||||
<up-icon :size="10" name="arrow-down-fill"></up-icon>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="u-flex-1 ">
|
||||
<view class="u-flex input">
|
||||
<up-input border="none" v-model="item.surplusStock"></up-input>
|
||||
<up-icon @click="delHaocai(index)" color="#EB4F4F" :size="16"
|
||||
name="minus-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-16 u-font-24" v-if="item.stockNumber">
|
||||
<view class="xuhao">
|
||||
|
||||
</view>
|
||||
<view class="u-flex u-flex-1 u-p-l-32 gap-20">库存:{{item.stockNumber}}
|
||||
{{item.conUnit}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="!isBindGuige">
|
||||
<view class="u-flex">
|
||||
<view class=" u-p-t-32 u-flex" @click="addHaocai">
|
||||
<up-icon :size="18" color="#318AFE" name="plus-circle-fill"></up-icon>
|
||||
<view class="u-m-l-16">添加耗材</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="default-box-padding bg-fff border-r-18 u-flex u-row-between u-m-t-32">
|
||||
<view>当某个耗材的使用库存不足时,商品自动
|
||||
售罄。</view>
|
||||
<view class="u-flex u-p-l-32">
|
||||
<up-switch :size="20"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<my-button type="primary" shape="circle" @click="save">保存</my-button>
|
||||
<my-button bgColor="#F9F9F9" shape="circle" color="#999" @click="cancel">取消</my-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
toRefs,
|
||||
watch,
|
||||
computed,
|
||||
onMounted
|
||||
}
|
||||
from 'vue';
|
||||
import {
|
||||
getviewConSku,
|
||||
gettbProductSpec,
|
||||
gettbConsInfo,
|
||||
posttbProskuCons,
|
||||
puttbProskuCon,
|
||||
deletetbProskuCon,
|
||||
} from "@/http/yskApi/consumable.js";
|
||||
import {
|
||||
tbShopCurrencyGet,$hasPermission
|
||||
} from '@/http/yskApi/shop.js'
|
||||
|
||||
import chooseHaocai from './choose-haocai.vue';
|
||||
import chooseDanwei from './choose-danwei.vue';
|
||||
import {
|
||||
$tbProskuConV2
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const emits=defineEmits(['cancel'])
|
||||
function cancel(){
|
||||
emits('cancel')
|
||||
}
|
||||
const props = defineProps({
|
||||
goods: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
conInfos: [],
|
||||
skuList: [],
|
||||
typeEnum: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const conInfos = ref(props.goods.conInfos)
|
||||
watch(() => props.goods.conInfos, (newval) => {
|
||||
console.log(newval);
|
||||
conInfos.value = newval
|
||||
})
|
||||
function conInfosChange(newval, item) {
|
||||
console.log(newval);
|
||||
item.stockNumber = newval.balance
|
||||
item.conUnit = newval.conUnit
|
||||
}
|
||||
|
||||
const skuList = ref(props.goods.skuList)
|
||||
watch(() => props.goods.skuList, (newval) => {
|
||||
console.log(newval);
|
||||
skuList.value = newval
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function addHaocai() {
|
||||
conInfos.value.push({
|
||||
conInfoId: '',
|
||||
conUnit: '',
|
||||
surplusStock: ''
|
||||
})
|
||||
}
|
||||
const popup = reactive({
|
||||
haocai: {
|
||||
show: true
|
||||
}
|
||||
})
|
||||
|
||||
function addGuigeHaocai(index) {
|
||||
console.log(index);
|
||||
}
|
||||
|
||||
function delHaocai(index) {
|
||||
const item = conInfos.value[index]
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否删除该耗材',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
if (item.id) {
|
||||
deletetbProskuCon([item.id]).then(res1 => {
|
||||
conInfos.value.splice(index, 1)
|
||||
})
|
||||
} else {
|
||||
conInfos.value.splice(index, 1)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function delGuigeHaocao(guigeIndex, haocaiIndex) {
|
||||
skuList.value[guigeIndex].haoaiList.splice(haocaiIndex, 1)
|
||||
}
|
||||
|
||||
// 是否是多规格商品
|
||||
const isSku = computed(() => {
|
||||
return props.goods.typeEnum == 'sku'
|
||||
})
|
||||
let isBindGuige = ref(isSku.value)
|
||||
watch(() => props.goods.typeEnum, (newval) => {
|
||||
isBindGuige.value = isSku.value
|
||||
})
|
||||
|
||||
function save() {
|
||||
console.log('save');
|
||||
const isPas= conInfos.value.every(v=>{
|
||||
return v.conInfoId&&v.conUnit&&v.surplusStock>0
|
||||
})
|
||||
console.log(isPas);
|
||||
return
|
||||
let ajaxData = ''
|
||||
if (!isBindGuige.value) {
|
||||
//绑定至商品
|
||||
ajaxData = conInfos.value.map(v => {
|
||||
return {
|
||||
conInfoId: v.conInfoId,
|
||||
productId: props.goods.id,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
productSkuId: 0,
|
||||
surplusStock: v.surplusStock
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
}
|
||||
console.log(ajaxData);
|
||||
$tbProskuConV2(ajaxData)
|
||||
}
|
||||
|
||||
let haoCaiList = ref([])
|
||||
let $haocaiMap = reactive({})
|
||||
let danweiList = ref([])
|
||||
let $danweiMap = reactive({})
|
||||
|
||||
function init() {
|
||||
gettbConsInfo({
|
||||
page: 0,
|
||||
size: 200
|
||||
}).then(res => {
|
||||
for (let i in res.content) {
|
||||
const item = res.content[i]
|
||||
$haocaiMap[item.consId] = item
|
||||
}
|
||||
haoCaiList.value = res.content
|
||||
|
||||
})
|
||||
tbShopCurrencyGet({
|
||||
page: 0,
|
||||
size: 200
|
||||
}).then(res => {
|
||||
for (let i in res.content) {
|
||||
const item = res.content[i]
|
||||
$danweiMap[item.id] = item
|
||||
}
|
||||
danweiList.value = res.content
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bottom {
|
||||
padding: 84rpx 82rpx;
|
||||
}
|
||||
|
||||
.xuhao {
|
||||
width: 52rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 172rpx;
|
||||
padding: 10rpx 16rpx;
|
||||
height: 60rpx;
|
||||
box-sizing: border-box;
|
||||
background: #FFFFFF;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.list .border-bottom:last-child {
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
499
pageProduct/add-specifications/add-specifications - 副本 (2).vue
Normal file
499
pageProduct/add-specifications/add-specifications - 副本 (2).vue
Normal file
@@ -0,0 +1,499 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="box">
|
||||
<view class="block border-top-0">
|
||||
<uni-forms ref="nameFormRef" :model="specifications" :rules="rules" :label-width="350"
|
||||
label-position="top" validateTrigger="blur">
|
||||
<uni-forms-item label="模版名称" required name="name">
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="specifications.name" placeholder="模版名称,如:衣服" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view v-for="(item,index) in specifications.list" :key="index">
|
||||
<uni-forms :model="item" :rules="rules" err-show-type="undertext" validateTrigger="blur"
|
||||
:ref="setFormRef(index)" :border="true" label-position="top" label-width="350">
|
||||
|
||||
<view class="block">
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="规格组名" required name="name">
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="item.name" placeholder="规格组名,如:尺码" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-forms-item label="规格值">
|
||||
<view class="option">
|
||||
<view class="">
|
||||
<view class="u-flex option-item" v-for="(option,optionIndex) in item.options"
|
||||
:key="optionIndex">
|
||||
<view class="u-flex-1">
|
||||
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'name']"
|
||||
:ref="setFormInputRef(index,optionIndex)"
|
||||
:rules="[{'required': true,errorMessage: '必填'}]" label-width="0"
|
||||
label="" required :showRequired="false">
|
||||
<uni-easyinput
|
||||
v-model="specifications.list[index].options[optionIndex].name"
|
||||
@input="inpuChange(index,optionIndex)"
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
placeholder="请输入规格值,如:S、M" />
|
||||
</uni-forms-item>
|
||||
|
||||
</view>
|
||||
<view class=" u-flex">
|
||||
<uni-forms-item :key="optionIndex" label-width="0" label=""
|
||||
:showRequired="false">
|
||||
<view class="u-flex">
|
||||
<!-- <uni-easyinput v-model="specifications.list[index].options[optionIndex].optionPrice"
|
||||
@input="inpuChange(index,optionIndex)"
|
||||
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
type="digit" placeholder="填写价格" /> -->
|
||||
|
||||
<view class="icon icon-reduce u-m-l-38"
|
||||
@click="delOption(index,optionIndex)">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</uni-forms-item>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex" @click="addOptions(index)">
|
||||
<view class="icon icon-add u-m-r-22 ">
|
||||
|
||||
</view>
|
||||
<view class="color-main">添加规格</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
|
||||
<view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)">
|
||||
<view class="icon icon-reduce u-m-r-22 ">
|
||||
|
||||
</view>
|
||||
<view class="color-red">删除规格组</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view class="u-flex block u-p-l-20 u-p-r-20 u-p-t-28 u-p-b-28" @click="addSpecificationsGroup">
|
||||
<view class="icon icon-add u-m-r-22 ">
|
||||
|
||||
</view>
|
||||
<view class="color-main">添加规格组</view>
|
||||
</view>
|
||||
|
||||
<view class="save-btn-box">
|
||||
<button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom" ref="bottom"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
$productSpec
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
} from '@dcloudio/uni-app';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {
|
||||
onMounted,
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,
|
||||
onBeforeMount
|
||||
} from 'vue';
|
||||
const nameFormRef = ref(null)
|
||||
// 表单样式
|
||||
const placeholderStyle = ref('font-size:28rpx;')
|
||||
//表单边框
|
||||
const inputBorder = ref(false)
|
||||
const form = ref(null)
|
||||
const bottom = ref(null)
|
||||
//表单验证
|
||||
const rules = {
|
||||
name: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '必填'
|
||||
}]
|
||||
},
|
||||
MinOptional: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '必填'
|
||||
}]
|
||||
},
|
||||
MaxOptional: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '必填'
|
||||
}]
|
||||
},
|
||||
optionPrice: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '必填'
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 构造规格的选项值的基础数据
|
||||
const specificationsOptionsBasicData = {
|
||||
name: '',
|
||||
optionPrice: '0.00'
|
||||
}
|
||||
|
||||
function returnOptionsBasicData() {
|
||||
return {
|
||||
...specificationsOptionsBasicData
|
||||
}
|
||||
}
|
||||
// 构造规格的基础数据
|
||||
const specificationsBasicData = {
|
||||
name: '',
|
||||
// MinOptional: 1,
|
||||
// MaxOptional: 1,
|
||||
options: []
|
||||
}
|
||||
|
||||
function returnSpecificationsOptionsBasicData() {
|
||||
return {
|
||||
...specificationsBasicData,
|
||||
options: [returnOptionsBasicData()]
|
||||
}
|
||||
}
|
||||
|
||||
function onFieldChange(e) {
|
||||
console.log(e);
|
||||
}
|
||||
// 规格列表
|
||||
const specifications = reactive({
|
||||
name: '',
|
||||
list: [returnSpecificationsOptionsBasicData()]
|
||||
})
|
||||
|
||||
|
||||
|
||||
//添加规格组
|
||||
function addSpecificationsGroup() {
|
||||
specifications.list.push(returnSpecificationsOptionsBasicData())
|
||||
scrollPageBottom()
|
||||
}
|
||||
//删除规格组
|
||||
function delSpecificationsGroup(index) {
|
||||
specifications.list.splice(index, 1)
|
||||
}
|
||||
// 向指定索引的规格组添加规格项
|
||||
function addOptions(index) {
|
||||
specifications.list[index].options.push(returnOptionsBasicData())
|
||||
}
|
||||
// 删除指定索引的规格组添加规格项
|
||||
function delOption(index, optionIndex) {
|
||||
specifications.list[index].options.splice(optionIndex, 1)
|
||||
}
|
||||
//页面滚动到最底部
|
||||
function scrollPageBottom() {
|
||||
nextTick(() => {
|
||||
uni.pageScrollTo({
|
||||
duration: 100, // 过渡时间
|
||||
scrollTop: 100000, // 滚动的实际距离
|
||||
})
|
||||
})
|
||||
}
|
||||
//设置表单验证规则
|
||||
function setFormRules() {
|
||||
form.value.setRules(rules)
|
||||
}
|
||||
const formRefs = ref([]);
|
||||
//绑定表单元素
|
||||
function setFormRef(index) {
|
||||
formRefs.value[index] = null;
|
||||
return (el) => {
|
||||
if (el) {
|
||||
formRefs.value[index] = el;
|
||||
}
|
||||
};
|
||||
}
|
||||
// 绑定option input元素
|
||||
const refFormInput = ref([])
|
||||
|
||||
function setFormInputRef(index, index1) {
|
||||
const newIndex = index * 10000 + index1
|
||||
return (el) => {
|
||||
if (el) {
|
||||
if (!refFormInput.value[newIndex]) {
|
||||
refFormInput.value[newIndex] = el;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 当表单内容输入变化根据配置的rules进行验证
|
||||
function inpuChange(index, index1) {
|
||||
const newIndex = index * 10000 + index1
|
||||
console.log(refFormInput.value[newIndex]);
|
||||
refFormInput.value[newIndex].onFieldChange()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const option = {
|
||||
type: 'add',
|
||||
id: undefined
|
||||
}
|
||||
onLoad(opt => {
|
||||
console.log(opt);
|
||||
if (opt && JSON.stringify(opt) !== '{}' && opt.type) {
|
||||
option.type = opt.type
|
||||
const data = uni.getStorageSync('spec')
|
||||
uni.removeStorageSync('spec')
|
||||
if(data){
|
||||
specifications.name = data.name
|
||||
specifications.id = data.id
|
||||
specifications.list = data.specList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
options: v.value.map(v => {
|
||||
return {
|
||||
name: v
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
uni.setNavigationBarTitle({
|
||||
title: option.type === 'edit' ? '编辑规格模版' : '添加规格模版'
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
function returnPromise(prosise, index) {
|
||||
return new Promise((resolve, reject) => {
|
||||
prosise.then(res => {
|
||||
console.log(res);
|
||||
resolve({
|
||||
sucees: true
|
||||
})
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
resolve({
|
||||
sucees: false
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
let timer = null
|
||||
|
||||
function settimeoutBack(time) {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, time)
|
||||
}
|
||||
async function save() {
|
||||
let isAllPassForm = 0
|
||||
const nameFormRes = await returnPromise(nameFormRef.value.validate())
|
||||
console.log(nameFormRes);
|
||||
if (!nameFormRes.sucees) {
|
||||
isAllPassForm -= 1
|
||||
}
|
||||
for (let i in specifications.list) {
|
||||
const res = await returnPromise(formRefs.value[i].validate(), i)
|
||||
isAllPassForm += res.sucees ? 1 : 0
|
||||
}
|
||||
//判断验证是否通过
|
||||
if (isAllPassForm === specifications.list.length) {
|
||||
console.log('pass');
|
||||
const data = {
|
||||
name: specifications.name,
|
||||
id:specifications.id,
|
||||
specList: specifications.list.map(v => {
|
||||
return {
|
||||
...v,
|
||||
value: v.options.map(v => v.name),
|
||||
options: undefined
|
||||
}
|
||||
})
|
||||
}
|
||||
if (option.type === 'add') {
|
||||
return $productSpec.add(data).then(res => {
|
||||
infoBox.showSuccessToast('添加成功')
|
||||
settimeoutBack(1500)
|
||||
})
|
||||
}
|
||||
|
||||
$productSpec.update(data).then(res => {
|
||||
infoBox.showSuccessToast('修改成功')
|
||||
settimeoutBack(1500)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
$icon-size: 34rpx;
|
||||
$icon-line-width: 20rpx;
|
||||
$icon-line-height: 4rpx;
|
||||
|
||||
.page {
|
||||
background: #F9F9F9;
|
||||
padding: 30rpx;
|
||||
padding-bottom: 200rpx;
|
||||
}
|
||||
|
||||
.my-switch {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
::v-deep .uni-forms-item__error {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
::v-deep .option .uni-forms-item {
|
||||
padding: 0;
|
||||
min-height: inherit;
|
||||
background-color: transparent;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: $icon-size;
|
||||
height: $icon-size;
|
||||
position: relative;
|
||||
border-radius: 50%;
|
||||
|
||||
&:before,
|
||||
&::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: '';
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-add {
|
||||
background-color: $my-main-color;
|
||||
|
||||
&::before {
|
||||
width: $icon-line-height;
|
||||
height: $icon-line-width;
|
||||
top: calc(($icon-size /2) - ($icon-line-width / 2));
|
||||
left: calc(($icon-size /2) - ($icon-line-height / 2));
|
||||
}
|
||||
|
||||
&::after {
|
||||
width: $icon-line-width;
|
||||
height: 4rpx;
|
||||
top: calc(($icon-size /2) - ($icon-line-height / 2));
|
||||
left: calc(($icon-size /2) - ($icon-line-width / 2));
|
||||
}
|
||||
}
|
||||
|
||||
.icon-reduce {
|
||||
background-color: $my-red-color;
|
||||
|
||||
&::after {
|
||||
width: $icon-line-width;
|
||||
height: $icon-line-height;
|
||||
top: calc(($icon-size /2) - ($icon-line-height / 2));
|
||||
left: calc(($icon-size /2) - ($icon-line-width / 2));
|
||||
}
|
||||
}
|
||||
|
||||
.label-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
}
|
||||
|
||||
.lh40 {
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.box {
|
||||
margin-top: 70rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.block {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
padding: 12rpx 24rpx;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn-box {
|
||||
position: fixed;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
bottom: 60rpx;
|
||||
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item {
|
||||
align-items: inherit;
|
||||
}
|
||||
|
||||
::v-deep .uni-forms-item .uni-forms-item__label {
|
||||
text-indent: 0;
|
||||
font-size: 28rpx !important;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
::v-deep .border-top-0 .uni-forms-item.is-direction-top {
|
||||
border-color: transparent !important;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
border-radius: 12rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.btn-hover-class {
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
.zuofa {
|
||||
padding: 28rpx 0;
|
||||
background: #F9F9F9;
|
||||
padding-left: 42rpx;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
}
|
||||
|
||||
::v-deep .uni-input-placeholder {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.option {
|
||||
padding: 26rpx 30rpx 24rpx 24rpx;
|
||||
background: #F9F9F9;
|
||||
}
|
||||
|
||||
.option-item {
|
||||
margin-bottom: 34rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,53 +1,62 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="box">
|
||||
<view class="block border-top-0">
|
||||
<uni-forms ref="nameFormRef" :model="specifications" :rules="rules" :label-width="350"
|
||||
label-position="top" validateTrigger="blur">
|
||||
<uni-forms-item label="模版名称" required name="name">
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="specifications.name" placeholder="模版名称,如:衣服" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view v-for="(item,index) in specifications.list" :key="index">
|
||||
<uni-forms :model="item" :rules="rules" err-show-type="undertext" validateTrigger="blur"
|
||||
:ref="setFormRef(index)" :border="true" label-position="top" label-width="350">
|
||||
|
||||
<view class="block">
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="规格组名" required name="name">
|
||||
<uni-forms-item label="规格组名" required name="name" >
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="item.name" placeholder="规格组名,如:尺码" />
|
||||
v-model="item.name" placeholder="规格组名" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-forms-item label="规格值">
|
||||
<!-- <uni-forms-item label="最少可选" required name="MinOptional" >
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="item.MinOptional" type="number" placeholder="填写最小数量" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="最大可选" required name="MaxOptional" >
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="item.MaxOptional" type="number" placeholder="填写最大数量" />
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="选项值">
|
||||
<view class="option">
|
||||
<view class="">
|
||||
<view class="u-flex option-item" v-for="(option,optionIndex) in item.options"
|
||||
:key="optionIndex">
|
||||
<view class="u-flex">
|
||||
<view class="u-flex-1">名称</view>
|
||||
<view class="u-flex-1 u-p-l-60">加价</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-flex option-item"
|
||||
|
||||
v-for="(option,optionIndex) in item.options"
|
||||
:key="optionIndex"
|
||||
>
|
||||
<view class="u-flex-1">
|
||||
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'name']"
|
||||
:ref="setFormInputRef(index,optionIndex)"
|
||||
:rules="[{'required': true,errorMessage: '必填'}]" label-width="0"
|
||||
label="" required :showRequired="false">
|
||||
<uni-easyinput
|
||||
v-model="specifications.list[index].options[optionIndex].name"
|
||||
@input="inpuChange(index,optionIndex)"
|
||||
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'optionName']"
|
||||
:ref="setFormInputRef(index,optionIndex)"
|
||||
:rules="[{'required': true,errorMessage: '必填'}]"
|
||||
label-width="0" label="" required :showRequired="false"
|
||||
>
|
||||
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionName"
|
||||
@input="inpuChange(index,optionIndex)"
|
||||
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
placeholder="请输入规格值,如:S、M" />
|
||||
placeholder="选项名" />
|
||||
</uni-forms-item>
|
||||
|
||||
</view>
|
||||
<view class=" u-flex">
|
||||
<uni-forms-item :key="optionIndex" label-width="0" label=""
|
||||
:showRequired="false">
|
||||
<view class="u-p-l-60 u-flex-1 u-flex">
|
||||
<uni-forms-item :key="optionIndex"
|
||||
:rules="[{'required': true,errorMessage: '必填'}]"
|
||||
:ref="setFormInputRef(index,optionIndex)"
|
||||
:name="['options',optionIndex,'optionPrice']" label-width="0" label="" required :showRequired="false"
|
||||
>
|
||||
<view class="u-flex">
|
||||
<!-- <uni-easyinput v-model="specifications.list[index].options[optionIndex].optionPrice"
|
||||
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionPrice"
|
||||
@input="inpuChange(index,optionIndex)"
|
||||
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
type="digit" placeholder="填写价格" /> -->
|
||||
type="digit" placeholder="填写价格" />
|
||||
|
||||
<view class="icon icon-reduce u-m-l-38"
|
||||
@click="delOption(index,optionIndex)">
|
||||
@@ -70,7 +79,7 @@
|
||||
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
|
||||
|
||||
<view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)">
|
||||
<view class="icon icon-reduce u-m-r-22 ">
|
||||
|
||||
@@ -97,14 +106,10 @@
|
||||
|
||||
<script setup>
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
$productSpec
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onReady
|
||||
} from '@dcloudio/uni-app';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {
|
||||
onMounted,
|
||||
reactive,
|
||||
@@ -112,9 +117,8 @@
|
||||
ref,
|
||||
onBeforeMount
|
||||
} from 'vue';
|
||||
const nameFormRef = ref(null)
|
||||
// 表单样式
|
||||
const placeholderStyle = ref('font-size:28rpx;')
|
||||
const placeholderStyle = ref('font-size:28rpx;')
|
||||
//表单边框
|
||||
const inputBorder = ref(false)
|
||||
const form = ref(null)
|
||||
@@ -139,6 +143,12 @@
|
||||
errorMessage: '必填'
|
||||
}]
|
||||
},
|
||||
optionName: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '必填'
|
||||
}]
|
||||
},
|
||||
optionPrice: {
|
||||
rules: [{
|
||||
required: true,
|
||||
@@ -147,10 +157,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 构造规格的选项值的基础数据
|
||||
const specificationsOptionsBasicData = {
|
||||
name: '',
|
||||
optionName: '',
|
||||
optionPrice: '0.00'
|
||||
}
|
||||
|
||||
@@ -162,8 +172,8 @@
|
||||
// 构造规格的基础数据
|
||||
const specificationsBasicData = {
|
||||
name: '',
|
||||
// MinOptional: 1,
|
||||
// MaxOptional: 1,
|
||||
MinOptional: 1,
|
||||
MaxOptional: 1,
|
||||
options: []
|
||||
}
|
||||
|
||||
@@ -179,7 +189,6 @@
|
||||
}
|
||||
// 规格列表
|
||||
const specifications = reactive({
|
||||
name: '',
|
||||
list: [returnSpecificationsOptionsBasicData()]
|
||||
})
|
||||
|
||||
@@ -226,8 +235,7 @@
|
||||
};
|
||||
}
|
||||
// 绑定option input元素
|
||||
const refFormInput = ref([])
|
||||
|
||||
const refFormInput=ref([])
|
||||
function setFormInputRef(index, index1) {
|
||||
const newIndex = index * 10000 + index1
|
||||
return (el) => {
|
||||
@@ -244,104 +252,61 @@
|
||||
console.log(refFormInput.value[newIndex]);
|
||||
refFormInput.value[newIndex].onFieldChange()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const option = {
|
||||
type: 'add',
|
||||
id: undefined
|
||||
|
||||
|
||||
let emitName=''
|
||||
function triggerEvent (emitName,data){
|
||||
if(emitName){
|
||||
uni.$emit(emitName,data)
|
||||
}
|
||||
}
|
||||
onLoad(opt => {
|
||||
onLoad(opt=>{
|
||||
const arr=uni.getStorageSync('guige')
|
||||
if(arr.length){
|
||||
specifications.list=arr
|
||||
console.log(arr);
|
||||
}
|
||||
console.log(opt);
|
||||
if (opt && JSON.stringify(opt) !== '{}' && opt.type) {
|
||||
option.type = opt.type
|
||||
const data = uni.getStorageSync('spec')
|
||||
uni.removeStorageSync('spec')
|
||||
if(data){
|
||||
specifications.name = data.name
|
||||
specifications.id = data.id
|
||||
specifications.list = data.specList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
options: v.value.map(v => {
|
||||
return {
|
||||
name: v
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if(opt&&JSON.stringify(opt)!=='{}'&&opt.emitName){
|
||||
emitName=opt.emitName
|
||||
}
|
||||
uni.setNavigationBarTitle({
|
||||
title: option.type === 'edit' ? '编辑规格模版' : '添加规格模版'
|
||||
title:emitName?'编辑规格模版':'添加规格模版'
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
function returnPromise(prosise, index) {
|
||||
return new Promise((resolve, reject) => {
|
||||
prosise.then(res => {
|
||||
function emitspecificationsSave(){
|
||||
// emitspecificationsSave 触发规格保存事件将数据给到添加商品页面
|
||||
// guigeEdit 触发规格保存事件将数据给到添加规格页面
|
||||
uni.removeStorageSync('guige')
|
||||
triggerEvent(emitName,specifications.list)
|
||||
}
|
||||
function returnPromise(index,prosise){
|
||||
return new Promise((resolve,reject)=>{
|
||||
prosise.then(res=>{
|
||||
console.log(res);
|
||||
resolve({
|
||||
sucees: true
|
||||
})
|
||||
}).catch(err => {
|
||||
resolve({sucees:true})
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
resolve({
|
||||
sucees: false
|
||||
})
|
||||
resolve({sucees:false})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
let timer = null
|
||||
|
||||
function settimeoutBack(time) {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, time)
|
||||
}
|
||||
async function save() {
|
||||
let isAllPassForm = 0
|
||||
const nameFormRes = await returnPromise(nameFormRef.value.validate())
|
||||
console.log(nameFormRes);
|
||||
if (!nameFormRes.sucees) {
|
||||
isAllPassForm -= 1
|
||||
}
|
||||
async function save() {
|
||||
let isAllPassForm=0
|
||||
for (let i in specifications.list) {
|
||||
const res = await returnPromise(formRefs.value[i].validate(), i)
|
||||
isAllPassForm += res.sucees ? 1 : 0
|
||||
const res=await returnPromise(i,formRefs.value[i].validate())
|
||||
isAllPassForm+=res.sucees?1:0
|
||||
}
|
||||
//判断验证是否通过
|
||||
if (isAllPassForm === specifications.list.length) {
|
||||
if(isAllPassForm===specifications.list.length){
|
||||
console.log('pass');
|
||||
const data = {
|
||||
name: specifications.name,
|
||||
id:specifications.id,
|
||||
specList: specifications.list.map(v => {
|
||||
return {
|
||||
...v,
|
||||
value: v.options.map(v => v.name),
|
||||
options: undefined
|
||||
}
|
||||
})
|
||||
}
|
||||
if (option.type === 'add') {
|
||||
return $productSpec.add(data).then(res => {
|
||||
infoBox.showSuccessToast('添加成功')
|
||||
settimeoutBack(1500)
|
||||
})
|
||||
}
|
||||
|
||||
$productSpec.update(data).then(res => {
|
||||
infoBox.showSuccessToast('修改成功')
|
||||
settimeoutBack(1500)
|
||||
})
|
||||
emitspecificationsSave()
|
||||
go.back()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
134
pageProduct/index/components/baosun.vue
Normal file
134
pageProduct/index/components/baosun.vue
Normal file
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="9" :zIndex="999">
|
||||
<view class="u-p-32 box u-font-28">
|
||||
<view class="u-flex u-relative u-row-center">
|
||||
<view class="u-font-32">报损</view>
|
||||
<view class="u-absolute close">
|
||||
<up-icon @click="close" :size="16" color="#000" name="close-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-48">
|
||||
<view>商品名称</view>
|
||||
<view class="u-m-t-16">{{data.name}}</view>
|
||||
<view class="u-m-t-38">
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex ">
|
||||
报损数量
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="form.number">
|
||||
<template #suffix>
|
||||
<view>{{data.unitName}}</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>备注</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>上传图片</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<scroll-view scroll-y="true" style="max-height: 300rpx;">
|
||||
<my-up-upload v-model="form.images"></my-up-upload>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-60">
|
||||
<my-button type="primary" shape="circle" @tap="save">
|
||||
<view class="u-font-32">
|
||||
保存
|
||||
</view>
|
||||
</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
goods: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
skuList: []
|
||||
}
|
||||
}
|
||||
})
|
||||
const data = ref(props.goods)
|
||||
const emits = defineEmits(['update:show', 'save'])
|
||||
const form = reactive({
|
||||
note: '',
|
||||
number: 1,
|
||||
images: []
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.goods
|
||||
}
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
}
|
||||
|
||||
function save() {
|
||||
console.log(form.images);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
141
pageProduct/index/components/edit-guige.vue
Normal file
141
pageProduct/index/components/edit-guige.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="9">
|
||||
<view class="u-p-32 box u-font-28">
|
||||
<view class="u-flex u-relative u-row-center">
|
||||
<view class="u-font-32">{{data.specSnap}}</view>
|
||||
<view class="u-absolute close">
|
||||
<up-icon @click="close" :size="16" color="#000" name="close-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-48">
|
||||
<view class="u-flex u-row-between border-bottom u-p-b-30">
|
||||
<view>当前状态</view>
|
||||
<view class="u-flex">
|
||||
<up-radio-group v-model="isGrounding" placement="row" @change="isGroundingChange">
|
||||
<up-radio :customStyle="{marginRight: '10px'}" v-for="(item, index) in status.list"
|
||||
:key="index" :label="item.label" :name="item.name">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class=" u-flex u-row-between u-m-t-30">
|
||||
<view>售罄</view>
|
||||
<up-switch :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$updateGrounding, $updateProductStatus
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
goods: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
skuList: []
|
||||
}
|
||||
}
|
||||
})
|
||||
const status = reactive({
|
||||
list: [{
|
||||
name: 1,
|
||||
label: '上架中'
|
||||
}, {
|
||||
name: 0,
|
||||
label: '已下架'
|
||||
}],
|
||||
})
|
||||
// 是否售罄
|
||||
const isPauseSale = ref(false)
|
||||
// 是否上架
|
||||
const isGrounding = ref(1)
|
||||
const data = ref(props.goods)
|
||||
const emits = defineEmits(['update:show', 'save', 'isGroundingChange','isPauseSaleChange'])
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
console.log(props.goods);
|
||||
data.value = props.goods
|
||||
isPauseSale.value = props.goods.isPauseSale ? true : false
|
||||
isGrounding.value = props.goods.isGrounding
|
||||
}
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
}
|
||||
|
||||
function save() {
|
||||
emits('save')
|
||||
}
|
||||
async function isGroundingChange(e) {
|
||||
console.log(e);
|
||||
await $updateGrounding({
|
||||
isGrounding: e ? true : false,
|
||||
skuId: props.goods.id
|
||||
})
|
||||
emits('isGroundingChange', e)
|
||||
infoBox.showToast('更新成功')
|
||||
}
|
||||
async function isPauseSaleChange(e) {
|
||||
console.log(e);
|
||||
await $updateProductStatus({
|
||||
targetId: props.goods.id,
|
||||
updateKey: "pauseSaleSku",
|
||||
updateValue: e?1:0
|
||||
})
|
||||
emits('isPauseSaleChange', e)
|
||||
infoBox.showToast('更新成功')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
186
pageProduct/index/components/edit-price.vue
Normal file
186
pageProduct/index/components/edit-price.vue
Normal file
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="9">
|
||||
<view class="u-p-32 box u-font-28">
|
||||
<view class="u-flex u-relative u-row-center">
|
||||
<view class="u-font-32">修改价格</view>
|
||||
<view class="u-absolute close">
|
||||
<up-icon @click="close" :size="16" color="#000" name="close-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-48">
|
||||
<view>商品名称</view>
|
||||
<view class="u-m-t-16" v-if="isSku">{{data.name}}</view>
|
||||
<view class="u-m-t-38">
|
||||
<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">
|
||||
<text>变动金额:</text>
|
||||
<text class="number">{{data.lowPrice-data._lowPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="data.lowPrice">
|
||||
<template #suffix>
|
||||
<view>元</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>备注</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<scroll-view scroll-y="true" style="max-height: 50vh;">
|
||||
<view class="u-m-b-32" v-for="(item,index) in data.skuList" :key="index">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>{{item.name}}</view>
|
||||
<view class="u-font-24">
|
||||
<text>变动金额:</text>
|
||||
<text class="number">{{item.lowPrice-item._lowPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="item.lowPrice">
|
||||
<template #suffix>
|
||||
<view>元</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>备注</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<view class="u-m-t-60">
|
||||
<my-button type="primary" shape="circle" @tap="save">
|
||||
<view class="u-font-32">
|
||||
保存
|
||||
</view>
|
||||
</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
goods: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
lowPrice:0,
|
||||
skuList: []
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
const data = ref(props.goods)
|
||||
const emits = defineEmits(['update:show', 'save'])
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.goods
|
||||
}
|
||||
})
|
||||
const isSku=computed(()=>{
|
||||
return data.value.typeEnum=='多规格'
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
}
|
||||
|
||||
function save() {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
})
|
||||
}
|
||||
|
||||
// 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)
|
||||
// })
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
235
pageProduct/index/components/edit-stock.vue
Normal file
235
pageProduct/index/components/edit-stock.vue
Normal file
@@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="9">
|
||||
<view class="u-p-32 box u-font-28">
|
||||
<view class="u-flex u-relative u-row-center">
|
||||
<view class="u-font-32">修改库存</view>
|
||||
<view class="u-absolute close">
|
||||
<up-icon @click="close" :size="16" color="#000" name="close-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-48">
|
||||
<view>商品名称</view>
|
||||
<view class="u-m-t-16" v-if="isSku">{{data.name}}</view>
|
||||
<view class="u-m-t-38">
|
||||
<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">
|
||||
<text>变动数量:</text>
|
||||
<text class="number">{{data.stockNumber-data._stockNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="data.stockNumber">
|
||||
<template #suffix>
|
||||
<view>{{data.unitName||''}}</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>备注</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<scroll-view scroll-y="true" style="max-height: 30vh;">
|
||||
<view class="u-m-b-32" v-for="(item,index) in data.skuList" :key="index">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>{{item.name}}</view>
|
||||
<view class="u-font-24">
|
||||
<text>变动数量:</text>
|
||||
<text class="number">{{item.stockNumber-item._stockNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="item.stockNumber">
|
||||
<template #suffix>
|
||||
<view>{{data.unitName||''}}</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>备注</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<view class="u-m-t-60">
|
||||
<my-button type="primary" shape="circle" @tap="save">
|
||||
<view class="u-font-32">
|
||||
保存
|
||||
</view>
|
||||
</my-button>
|
||||
<view class="u-m-t-30">
|
||||
<template v-if="!recoders.show">
|
||||
<view class="color-999 u-font-24 u-flex u-row-center u-col-center">
|
||||
<view class="u-flex" @click="changeShowRecoders(true)">
|
||||
<view class="u-m-r-6">查看记录</view>
|
||||
<up-icon name="arrow-down" :size="12"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<scroll-view scroll-y="true" style="max-height: 30vh;">
|
||||
<my-step :list="recoders.list"></my-step>
|
||||
</scroll-view>
|
||||
<view class="color-999 u-font-24 u-flex u-row-center u-col-center">
|
||||
<view class="u-flex" @click="changeShowRecoders(false)">
|
||||
<view class="u-m-r-6">收起记录</view>
|
||||
<up-icon name="arrow-up" :size="12"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
goods: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
skuList: []
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function changeShowRecoders(show) {
|
||||
recoders.show = show
|
||||
}
|
||||
const recoders = reactive({
|
||||
list: [{
|
||||
title: '2024-09-15 11:20:30',
|
||||
content: '开启了库存,库存由0件修改为5件'
|
||||
},
|
||||
{
|
||||
title: '2024-09-15 ',
|
||||
content: '开启了库存,库存由0件修改为4件'
|
||||
},
|
||||
{
|
||||
title: '2024-09-15 ',
|
||||
content: '开启了库存,库存由0件修改为3件'
|
||||
},
|
||||
{
|
||||
title: '2024-09-15 ',
|
||||
content: '开启了库存,库存由0件修改为2件'
|
||||
},
|
||||
],
|
||||
show: false,
|
||||
active: 0
|
||||
})
|
||||
|
||||
const data = ref(props.goods)
|
||||
const emits = defineEmits(['update:show', 'save'])
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.goods
|
||||
}
|
||||
})
|
||||
const isSku = computed(() => {
|
||||
// return data.value.typeEnum == '多规格'
|
||||
return false
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
}
|
||||
function save() {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
})
|
||||
}
|
||||
// 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)
|
||||
// })
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
@@ -7,55 +7,81 @@
|
||||
<text class="u-m-l-20">{{data.sort}}</text>
|
||||
</view>
|
||||
<view class="color-333 u-m-l-42 u-flex">
|
||||
<up-icon name="edit-pen" :size="16" :color="ColorMain"></up-icon>
|
||||
<text class="stock">库存:</text>
|
||||
<text class="font-bold u-m-l-10">{{data.stockNumber}}</text>
|
||||
<up-icon @click="editStock" name="edit-pen" :size="16" :color="ColorMain"></up-icon>
|
||||
<text class="stock u-m-l-4">库存:{{data.stockNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="u-font-28 color-666" @click="changeClick">修改</text>
|
||||
<view>
|
||||
<!-- <text class="u-font-28 color-666" @click="changeClick">修改</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>
|
||||
|
||||
|
||||
<view class="u-m-t-48 u-flex">
|
||||
<view class="u-m-t-48 u-flex u-col-top u-relative">
|
||||
<view v-if="props.showChecked">
|
||||
<label class="radio">
|
||||
<radio :color="ColorMain" style="transform: scale(0.7);" @click="radioClick"
|
||||
:checked="props.data.checked" /><text></text>
|
||||
</label>
|
||||
</view>
|
||||
<image :src="data.coverImg" lazy-load class="img"></image>
|
||||
<view class="h-100 u-p-l-16 u-flex-1 u-flex u-flex-col u-row-between">
|
||||
<view class="color-333 w-full u-flex u-row-between">
|
||||
<view class="img">
|
||||
<up--image :width="63" :height="63" :radius="3" :src="data.coverImg"></up--image>
|
||||
</view>
|
||||
<view class="w-full info">
|
||||
<view class="info-p-l color-333 u-flex u-row-between">
|
||||
<view class="u-flex">
|
||||
<text class="u-m-r-24">{{data.name}}</text><uni-tag size="small" type="primary"
|
||||
custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag>
|
||||
<text class="u-m-r-24">{{data.name}}</text>
|
||||
<!-- <uni-tag size="small" type="primary"
|
||||
custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag> -->
|
||||
</view>
|
||||
<view class="u-font-32">
|
||||
<text>{{data.lowPrice}}</text>
|
||||
<!-- <text>¥</text>
|
||||
<text>{{data.lowPrice}}</text>
|
||||
<text v-if="data.typeEnum == '多规格'">~¥{{data.maxPrice }}</text> -->
|
||||
</view>
|
||||
<view class="price">¥{{data.lowPrice}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-44">
|
||||
<template v-if="data.skuList.length>=2">
|
||||
<view class="u-flex u-flex-wrap w-full gap-10 u-col-top">
|
||||
<view class="u-font-24 info-p-l u-m-t-14">规格:</view>
|
||||
<view class="skd" v-for="(item,index) in data.skuList" :key="index"
|
||||
@click="guigeClick(index)">
|
||||
<text>{{item.specSnap||item.name}}</text>
|
||||
<view class="tag-primary tag" v-if="item.isGrounding">上架中</view>
|
||||
<view class="tag-gray tag" v-else>已下架</view>
|
||||
<!-- <template v-if="item.isPauseSale">
|
||||
<view class="tag-gray tag" >已售罄</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="tag-primary tag" v-if="item.isGrounding">上架中</view>
|
||||
<view class="tag-gray tag" v-else>已下架</view>
|
||||
</template> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view style="height: 24rpx;">
|
||||
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-16 skus u-text-center" v-if="data.skuList.length>=2">
|
||||
<!-- <view class="u-flex u-row-between font-bold">
|
||||
<view class="u-flex-1">商品信息</view>
|
||||
<view class="u-flex-1">售价</view>
|
||||
<view class="u-flex-1">库存</view>
|
||||
</view>
|
||||
<view v-for="(item,index) in data.skuList" :key="index">
|
||||
<view class="u-flex u-m-t-10">
|
||||
<view class="color-333 u-flex-1"> <text class="u-m-r-24">{{item.specSnap||''}}</text></view>
|
||||
<view class="price u-flex-1">¥{{data.lowPrice||0}}</view>
|
||||
<view class=" u-flex-1">{{item.stockNumber||0}} {{data.unitName||''}}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view class="u-m-t-16 skus u-text-center" v-if="data.skuList.length>=2">
|
||||
<view class="u-flex u-flex-wrap skds">
|
||||
<view class="skd" v-for="(item,index) in data.skuList" :key="index"><text>{{item.specSnap}}</text>
|
||||
<view class="tag-primary tag">上架中</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="u-m-t-24 u-flex u-row-between">
|
||||
<view class="u-flex">
|
||||
<view class="u-flex">
|
||||
@@ -93,7 +119,7 @@
|
||||
import {
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del'])
|
||||
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','editStock'])
|
||||
const props = defineProps({
|
||||
index: {
|
||||
type: Number
|
||||
@@ -113,7 +139,8 @@
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
function isHotChange(e) {
|
||||
$goodsIsHot({
|
||||
@@ -155,6 +182,20 @@
|
||||
emits('del', props.index)
|
||||
}
|
||||
|
||||
function changePrice() {
|
||||
emits('changePrice', props.index)
|
||||
}
|
||||
|
||||
function baosun() {
|
||||
emits('baosun', props.index)
|
||||
}
|
||||
|
||||
function guigeClick(guigeIndex) {
|
||||
emits('guigeClick', props.index, guigeIndex)
|
||||
}
|
||||
function editStock(){
|
||||
emits('editStock', props.index)
|
||||
}
|
||||
//携带参数type edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
function toEdit() {
|
||||
go.to('PAGES_PRODUCT_ADD', {
|
||||
@@ -174,9 +215,12 @@
|
||||
border: 2rpx solid transparent;
|
||||
}
|
||||
|
||||
.gap-10 {
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
border-color: $my-main-color;
|
||||
;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
@@ -194,8 +238,15 @@
|
||||
}
|
||||
|
||||
.img {
|
||||
width: $imgSize;
|
||||
height: $imgSize;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
// width: $imgSize;
|
||||
// height: $imgSize;
|
||||
}
|
||||
|
||||
.info-p-l {
|
||||
padding-left: 71px;
|
||||
}
|
||||
|
||||
.icon-arrow-right {
|
||||
@@ -219,6 +270,10 @@
|
||||
// border: 2rpx solid #333333;
|
||||
}
|
||||
|
||||
.color-red {
|
||||
color: #F0465B;
|
||||
}
|
||||
|
||||
.goods {
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
background-color: #fff;
|
||||
@@ -239,33 +294,37 @@
|
||||
.skds {
|
||||
gap: 10rpx 50rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.skd {
|
||||
padding: 14rpx 40rpx 14rpx 20rpx;
|
||||
background: #F0F2F5;
|
||||
border-radius: 4rpx;
|
||||
position: relative;
|
||||
color: #666;
|
||||
overflow: hidden;
|
||||
margin-bottom: 10rpx;
|
||||
.skd {
|
||||
padding: 14rpx 40rpx 14rpx 20rpx;
|
||||
background: #F0F2F5;
|
||||
border-radius: 4rpx;
|
||||
position: relative;
|
||||
color: #666;
|
||||
overflow: hidden;
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
.tag {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 12rpx;
|
||||
right: 0;
|
||||
padding: 2rpx 4rpx;
|
||||
border-radius: 0rpx 4rpx 4rpx 4rpx;
|
||||
}
|
||||
|
||||
.tag-primary {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.tag {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 12rpx;
|
||||
right: 0;
|
||||
padding: 2rpx 4rpx;
|
||||
border-radius: 0rpx 4rpx 4rpx 4rpx;
|
||||
}
|
||||
|
||||
.tag-primary {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tag-gray {
|
||||
background-color: rgb(144, 147, 153);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -8,7 +8,8 @@
|
||||
<view class="input-wrapper">
|
||||
<view class="input-main">
|
||||
<view class="u-flex u-p-r-30 u-font-28" @click="onCategoryShowChange(true)">
|
||||
<text class="u-m-r-10 u-line-1" style="max-width: 100rpx;">{{pageData.categoryName||'分类' }}</text>
|
||||
<text class="u-m-r-10 u-line-1"
|
||||
style="max-width: 100rpx;">{{pageData.categoryName||'分类' }}</text>
|
||||
<up-icon name="arrow-down" size="16"></up-icon>
|
||||
</view>
|
||||
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
|
||||
@@ -40,8 +41,10 @@
|
||||
<view class="goods-list u-p-30">
|
||||
<template v-if="pageData.goodsList.length">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||
<my-goods @changeClick="goodsChangeClick" @radioClick="goodsRadioClick" :index="index" :data="item"
|
||||
@del="goodsDel" :showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
<my-goods @changePrice="changePriceShow" @changeClick="goodsChangeClick"
|
||||
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow"
|
||||
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
||||
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="pageData.hasAjax&&!pageData.goodsList.length">
|
||||
@@ -53,9 +56,8 @@
|
||||
</view>
|
||||
|
||||
<my-control ref="control" :categoryShow="pageData.categoryShow" :categoryName="pageData.categoryName"
|
||||
@categoryChange="categoryIdChange" @offShelf="offShelf" @allCheckedChange="allCheckedChange"
|
||||
@controlChange="controlChange" @toggleCategory="toggleCategory"
|
||||
:bottom="pageData.componentBottom"></my-control>
|
||||
@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> -->
|
||||
<!-- 下架弹窗 -->
|
||||
@@ -113,7 +115,19 @@
|
||||
</my-model>
|
||||
|
||||
<!-- 分类 -->
|
||||
<my-category v-model:isShow="pageData.categoryShow" @confirm="setCategory"></my-category>
|
||||
<my-category v-model:isShow="pageData.categoryShow" @confirm="setCategory"></my-category>
|
||||
<!-- 修改价格弹窗 -->
|
||||
<edit-price :category="pageData.categoryList" v-model:show="popup.price.show" @save="changePriceConfirm"
|
||||
:goods="pageData.selGoods"></edit-price>
|
||||
<!-- 修改库存弹窗 -->
|
||||
<edit-stock :category="pageData.categoryList" v-model:show="popup.stock.show" @save="changeStockConfirm"
|
||||
:goods="pageData.selGoods"></edit-stock>
|
||||
<!-- 规格弹窗 -->
|
||||
<edit-guige @isGroundingChange="isGroundingChange" v-model:show="popup.guige.show"
|
||||
:goods="popup.guige.data"></edit-guige>
|
||||
<!-- 报损 -->
|
||||
<baosun-vue :category="pageData.categoryList" v-model:show="popup.baosun.show"
|
||||
:goods="pageData.selGoods"></baosun-vue>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
@@ -136,14 +150,25 @@
|
||||
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 {
|
||||
$tbProduct,
|
||||
$upProSort,
|
||||
$updateProduct,
|
||||
$getProductDetail,
|
||||
$delProduct,
|
||||
$updateProductStatus
|
||||
$tbShopCategory,
|
||||
$updateProductStatus,
|
||||
$tbProductV2,
|
||||
$updateProductData
|
||||
} from "@/http/yskApi/goods.js"
|
||||
import {
|
||||
returnAllCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
|
||||
const pageData = reactive({
|
||||
modelDesc: '是否下架',
|
||||
stateCurrent: 0,
|
||||
@@ -154,6 +179,7 @@
|
||||
},
|
||||
showGoodsDetail: false,
|
||||
selGoodsIndex: '',
|
||||
selGoods: {},
|
||||
totalElements: 0,
|
||||
totalPage: 0,
|
||||
goodsList: [],
|
||||
@@ -164,24 +190,179 @@
|
||||
name: ''
|
||||
},
|
||||
category: '',
|
||||
categoryList: [], //分类列表
|
||||
categoryShow: false,
|
||||
categoryName: '',
|
||||
hasAjax: false
|
||||
})
|
||||
watch(()=>pageData.query.categoryId,(newval)=>{
|
||||
watch(() => pageData.query.categoryId, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
|
||||
const popup = reactive({
|
||||
price: {
|
||||
show: false
|
||||
},
|
||||
guige: {
|
||||
show: false,
|
||||
data: {},
|
||||
goodsIndex: '',
|
||||
guigeIndex: '',
|
||||
},
|
||||
stock: {
|
||||
show: false
|
||||
},
|
||||
baosun: {
|
||||
show: false
|
||||
}
|
||||
})
|
||||
|
||||
//报损弹窗展示
|
||||
function baosunShow(index) {
|
||||
pageData.selGoodsIndex = index
|
||||
const goods = pageData.goodsList[index]
|
||||
pageData.selGoods = goods
|
||||
popup.baosun.show = true
|
||||
}
|
||||
|
||||
// 修改价格弹窗展示
|
||||
function changePriceShow(index) {
|
||||
pageData.selGoodsIndex = index
|
||||
const goods = pageData.goodsList[index]
|
||||
goods.skuList = goods.skuList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
_lowPrice: v.lowPrice
|
||||
}
|
||||
})
|
||||
const lowPrice = goods.lowPrice.replace('¥', '') * 1
|
||||
pageData.selGoods = {
|
||||
...goods,
|
||||
lowPrice,
|
||||
_lowPrice: lowPrice
|
||||
}
|
||||
popup.price.show = true
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function changePriceConfirm(goods) {
|
||||
let goodsArr = []
|
||||
if (goods.typeEnum == '单规格') {
|
||||
goodsArr = [{
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
isSku: false,
|
||||
id: goods.id,
|
||||
key: 'salePrice',
|
||||
value: goods.lowPrice
|
||||
}]
|
||||
} else {
|
||||
goodsArr = goods.skuList.map(v => {
|
||||
return {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
isSku: true,
|
||||
id: v.id,
|
||||
key: 'salePrice',
|
||||
value: v.lowPrice
|
||||
}
|
||||
})
|
||||
}
|
||||
const res = await $updateProductData(goodsArr)
|
||||
popup.price.show = false
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
|
||||
// 修改库存弹窗展示
|
||||
function changeStockShow(index) {
|
||||
pageData.selGoodsIndex = index
|
||||
const goods = pageData.goodsList[index]
|
||||
goods.skuList = goods.skuList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
_stockNumber: v.stockNumber
|
||||
}
|
||||
})
|
||||
const stockNumber = goods.stockNumber
|
||||
pageData.selGoods = {
|
||||
...goods,
|
||||
stockNumber,
|
||||
_stockNumber: stockNumber
|
||||
}
|
||||
popup.stock.show = true
|
||||
}
|
||||
async function changeStockConfirm(goods) {
|
||||
let goodsArr = []
|
||||
// if (goods.typeEnum == '单规格') {
|
||||
// goodsArr = [{
|
||||
// shopId: uni.getStorageSync('shopId'),
|
||||
// isSku: false,
|
||||
// id: goods.id,
|
||||
// key: 'stockNumber',
|
||||
// value: goods.stockNumber
|
||||
// }]
|
||||
// } else {
|
||||
// goodsArr = goods.skuList.map(v => {
|
||||
// return {
|
||||
// shopId: uni.getStorageSync('shopId'),
|
||||
// isSku: true,
|
||||
// id: v.id,
|
||||
// key: 'stockNumber',
|
||||
// value: v.stockNumber
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
goodsArr = [{
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
isSku: false,
|
||||
id: goods.id,
|
||||
key: 'stockNumber',
|
||||
value: goods.stockNumber
|
||||
}]
|
||||
const res = await $updateProductData(goodsArr)
|
||||
popup.stock.show = false
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
//修改规格上下架,售罄
|
||||
function editGuigeShow(goodsIndex, guigeIndex) {
|
||||
console.log(goodsIndex, guigeIndex);
|
||||
const goodsGuige = pageData.goodsList[goodsIndex].skuList[guigeIndex]
|
||||
popup.guige.data = goodsGuige
|
||||
popup.guige.goodsIndex = goodsIndex
|
||||
popup.guige.guigeIndex = guigeIndex
|
||||
popup.guige.show = true
|
||||
}
|
||||
|
||||
function isGroundingChange(e) {
|
||||
const {
|
||||
goodsIndex,
|
||||
guigeIndex
|
||||
} = popup.guige
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isGrounding = e
|
||||
}
|
||||
|
||||
function isPauseSaleChange(e) {
|
||||
const {
|
||||
goodsIndex,
|
||||
guigeIndex
|
||||
} = popup.guige
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isPauseSale = e
|
||||
}
|
||||
|
||||
function onCategoryShowChange(show) {
|
||||
console.log(show);
|
||||
pageData.categoryShow = show
|
||||
}
|
||||
function setCategory(category){
|
||||
|
||||
function setCategory(category) {
|
||||
pageData.query.categoryId = category.id
|
||||
pageData.categoryName = category.name
|
||||
}
|
||||
|
||||
function getGoodsList() {
|
||||
$tbProduct(pageData.query).then(res => {
|
||||
$tbProductV2(pageData.query).then(res => {
|
||||
pageData.hasAjax = true
|
||||
console.log(res);
|
||||
pageData.goodsList = res.content.map(v => {
|
||||
@@ -198,9 +379,18 @@
|
||||
onShow(() => {
|
||||
getGoodsList()
|
||||
})
|
||||
onLoad(() => {
|
||||
$tbShopCategory({
|
||||
page: 0,
|
||||
size: 200
|
||||
}).then(res => {
|
||||
pageData.categoryList = returnAllCategory(res.content)
|
||||
console.log(pageData.categoryList);
|
||||
})
|
||||
})
|
||||
|
||||
const tabsList = ['简洁', '详情']
|
||||
const statesTabsList = ['全部', '已售罄','在售中', '已下架']
|
||||
const statesTabsList = ['全部', '已售罄', '在售中', '已下架']
|
||||
const control = ref(null)
|
||||
const model = ref(null)
|
||||
const goodsStockModel = ref(null)
|
||||
|
||||
41
pageProduct/util.js
Normal file
41
pageProduct/util.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
$types
|
||||
} from '@/pageProduct/goodsData.js'
|
||||
export function returnSkuSnap(goods) {
|
||||
const selectSpec = typeof goods.selectSpec === 'string' ? JSON.parse(goods.selectSpec) : goods.selectSpec
|
||||
let result = selectSpec.map(v => {
|
||||
return {
|
||||
name: v.name,
|
||||
value: v.selectSpecResult.join(',')
|
||||
}
|
||||
})
|
||||
return result
|
||||
}
|
||||
export function returnTypeEnum(typeEnum) {
|
||||
const item = $types.find(v => v.title == typeEnum)
|
||||
let result = item ? item.value : undefined
|
||||
return result
|
||||
}
|
||||
export function returnCategory(cateName, cateList) {
|
||||
console.log(cateName);
|
||||
console.log(cateList);
|
||||
const item = cateList.find(v => v.name == cateName)
|
||||
let result = item ? item : undefined
|
||||
return result
|
||||
}
|
||||
export function returnAllCategory(arr) {
|
||||
const result = arr.reduce((prve, cur) => {
|
||||
prve.push(...[{
|
||||
...cur,
|
||||
name: '' + cur.name,
|
||||
childrenList: undefined
|
||||
}, ...cur.childrenList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
name: '' + v.name
|
||||
}
|
||||
})])
|
||||
return prve
|
||||
}, [])
|
||||
return result
|
||||
}
|
||||
@@ -125,11 +125,12 @@
|
||||
function more() {
|
||||
emits('more')
|
||||
}
|
||||
|
||||
|
||||
|
||||
function diancan() {
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: props.data.tableId,
|
||||
tableName: props.data.name
|
||||
name: props.data.name
|
||||
})
|
||||
}
|
||||
|
||||
@@ -140,14 +141,16 @@
|
||||
name,
|
||||
status,
|
||||
amount,
|
||||
areaId
|
||||
areaId,
|
||||
orderId
|
||||
} = props.data
|
||||
go.to('PAGES_CRESATE_ORDER_DETAIL', {
|
||||
go.to('PAGES_ORDER_DETAIL', {
|
||||
tableId,
|
||||
name,
|
||||
status,
|
||||
amount,
|
||||
areaId
|
||||
areaId,
|
||||
id:orderId
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<view class=" u-font-28 color-333 min-page bg-gray default-box-padding">
|
||||
|
||||
<view class="bg-fff border-r-18 default-box-padding u-flex">
|
||||
<view class="">交班人:</view>
|
||||
<view class="">交班人:{{form.staffName}}</view>
|
||||
<view class=" u-flex u-m-l-24 ">
|
||||
<text class="color-999" v-if="form.banciItem===''">暂未选择</text>
|
||||
<text v-else>
|
||||
@@ -11,12 +11,12 @@
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="bg-fff u-m-t-32 border-r-18 u-flex default-box-padding">
|
||||
<view class="u-flex-1 border-r">
|
||||
<view>
|
||||
<view>班次号</view>
|
||||
<view class="color-666 u-font-24 u-m-t-8">10001</view>
|
||||
<view class="color-666 u-font-24 u-m-t-8">{{form.dutyId}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view>班次</view>
|
||||
@@ -26,21 +26,21 @@
|
||||
<view class="u-flex-1">
|
||||
<view>
|
||||
<view>开班时间</view>
|
||||
<view class="color-666 u-font-24 u-m-t-8">2024-05-17 14:44:50</view>
|
||||
<view class="color-666 u-font-24 u-m-t-8">{{form.startTime}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view>交班时间</view>
|
||||
<view class="color-666 u-font-24 u-m-t-8">2024-05-17 14:44:56</view>
|
||||
<view class="color-666 u-font-24 u-m-t-8">{{form.endTime}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-font-32 u-m-t-32 u-m-b-32">数据统计</view>
|
||||
<view class="bg-fff u-m-t-32 border-r-18 default-box-padding">
|
||||
<view class="u-flex list u-text-center u-flex-wrap">
|
||||
<view class="item u-m-b-32" v-for="(item,index) in form.infolists" :key="index">
|
||||
<view class="color-666 u-font-24">{{item.name}}</view>
|
||||
<view class="u-m-t-8 color-333">{{item.value}}</view>
|
||||
<view class="item u-m-b-32" v-for="(item,index) in form.memberData" :key="index">
|
||||
<view class="color-666 u-font-24">{{item.deposit}}</view>
|
||||
<view class="u-m-t-8 color-333">{{item.amount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -53,17 +53,31 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive
|
||||
} from 'vue';
|
||||
import myButton from '@/components/my-components/my-button';
|
||||
onLoad((e) => {
|
||||
form.dutyId = e.dutyId
|
||||
form.staffName = e.staffName
|
||||
form.startTime = e.startTime
|
||||
form.endTime = e.endTime
|
||||
form.memberData = JSON.parse(e.memberData)
|
||||
console.log(e)
|
||||
})
|
||||
|
||||
const form = reactive({
|
||||
isDayin: false,
|
||||
kaibanTime: '2024-07-29 11:47:28',
|
||||
jiaobanTime: '2024-07-29 11:47:28',
|
||||
startTime: '2024-07-29 11:47:28',
|
||||
endTime: '2024-07-29 11:47:28',
|
||||
banciItem: {
|
||||
name: '班次'
|
||||
},
|
||||
staffName: '',
|
||||
memberData: [],
|
||||
infolists: [{
|
||||
name: '订单数',
|
||||
value: 0
|
||||
@@ -84,162 +98,162 @@
|
||||
{
|
||||
name: '订单线下支付金额',
|
||||
value: 0
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
name: '订单支付宝支付额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'堂食订单数',
|
||||
name: '堂食订单数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'堂食订单金额',
|
||||
name: '堂食订单金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'自取订单数',
|
||||
name: '自取订单数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'自取订单金额',
|
||||
name: '自取订单金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'外卖订单数',
|
||||
name: '外卖订单数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'外卖订单金额',
|
||||
name: '外卖订单金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'退款订单数',
|
||||
name: '退款订单数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'成功退款金额',
|
||||
name: '成功退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'微信成功退款金额',
|
||||
name: '微信成功退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'余额成功退款金额',
|
||||
name: '余额成功退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'线下成功退款金额',
|
||||
name: '线下成功退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'支付宝成功退款金额',
|
||||
name: '支付宝成功退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'充值数',
|
||||
name: '充值数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'充值金额',
|
||||
name: '充值金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'开通会员数',
|
||||
name: '开通会员数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'开通会员金额',
|
||||
name: '开通会员金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'配送费',
|
||||
name: '配送费',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'收银笔数',
|
||||
name: '收银笔数',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'收银金额',
|
||||
name: '收银金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'订单满减优惠金额',
|
||||
name: '订单满减优惠金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'订单积分兑换金额',
|
||||
name: '订单积分兑换金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'订单优惠券减免金额',
|
||||
name: '订单优惠券减免金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'订单会员优惠金额',
|
||||
name: '订单会员优惠金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'充值赠送金额',
|
||||
name: '充值赠送金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'堂食退款金额',
|
||||
name: '堂食退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'外卖退款金额',
|
||||
name: '外卖退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'自取退款金额',
|
||||
name: '自取退款金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'堂食订单金额',
|
||||
name: '堂食订单金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'外卖订单金额',
|
||||
name: '外卖订单金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'配送费退款',
|
||||
name: '配送费退款',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'配送费总额',
|
||||
name: '配送费总额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'微信到账金额',
|
||||
name: '微信到账金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'支付宝到账金额',
|
||||
name: '支付宝到账金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'收银支付金额',
|
||||
name: '收银支付金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'收银余额支付金额',
|
||||
name: '收银余额支付金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'收银微信支付金额',
|
||||
name: '收银微信支付金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'挂账金额',
|
||||
name: '挂账金额',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name:'商家减免',
|
||||
name: '商家减免',
|
||||
value: 0
|
||||
}
|
||||
]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<view class="top fixed-top bg-fff">
|
||||
<my-tabs :list="tabs.list" @change="tabsChange"></my-tabs>
|
||||
<view class="u-flex color-main u-m-t-32 " v-if="tabs.current===1">
|
||||
<view class="u-flex u-p-l-20 " @tap="showJiaobanPickerView">
|
||||
<!-- <view class="u-flex u-p-l-20 " @tap="showJiaobanPickerView">
|
||||
<view class=" u-flex u-row-between ">
|
||||
<view>
|
||||
<text class="" v-if="filters.jiaobanSelItem===''">暂未选择</text>
|
||||
@@ -15,16 +15,14 @@
|
||||
class="icon-arrow-down-fill " mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="u-flex u-p-l-20 u-flex-1 u-row-center">
|
||||
<view @tap="timeToggle">
|
||||
<view class=" u-font-24 color-main u-flex" v-if="filters.time.start&&filters.time.end">
|
||||
<uni-dateformat format="yyyy-MM-dd" :date="filters.time.start"></uni-dateformat>
|
||||
<text>{{timeFormat(filters.time.start, 'yyyy年mm月dd日') || '开始'}}</text>
|
||||
<text class="u-p-l-10 u-p-r-10">至</text>
|
||||
<uni-dateformat format="yyyy-MM-dd" :date="filters.time.end"></uni-dateformat>
|
||||
<!-- <view class="u-m-l-10 u-flex" @tap="clearTime">
|
||||
<uni-icons type="clear" size="18" :color="color.ColorMain"></uni-icons>
|
||||
</view> -->
|
||||
<text>{{timeFormat(filters.time.end, 'yyyy年mm月dd日') || '结束'}}</text>
|
||||
|
||||
</view>
|
||||
<view class="" v-else>所有时间</view>
|
||||
</view>
|
||||
@@ -39,7 +37,18 @@
|
||||
<view class="color-333 u-font-28 min-page bg-gray default-box-padding" style="padding-top: 83px;">
|
||||
<view class="bg-fff border-r-12 default-box-padding">
|
||||
<view>
|
||||
<view class="font-bold">班次</view>
|
||||
<view class="font-bold">是否打印销售区间的商品数据</view>
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom">
|
||||
<view>
|
||||
<text>
|
||||
{{banci.switchvalue?'打印':'不打印'}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<up-switch v-model="banci.switchvalue"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<!--<view class="font-bold">班次</view>
|
||||
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom" @tap="showJiaobanPickerView">
|
||||
<view>
|
||||
@@ -51,7 +60,7 @@
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <picker @change="banciChange" :value="banci.current" range-key="name" :range="banci.list">
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom">
|
||||
<view>
|
||||
@@ -67,7 +76,7 @@
|
||||
</picker> -->
|
||||
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<!-- <view class="u-m-t-24">
|
||||
<view class="font-bold">开班时间</view>
|
||||
<view class="u-m-t-16 u-flex u-row-between u-p-b-24 border-bottom" @tap="jiaobanStartShow">
|
||||
<view>
|
||||
@@ -86,11 +95,11 @@
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="form.jiaobanTime"></uni-dateformat>
|
||||
<text></text>
|
||||
</view>
|
||||
<!-- <view class="u-flex">
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -98,51 +107,42 @@
|
||||
<view class="color-333 u-font-28 min-page bg-gray default-box-padding" style="padding-top: 116px;">
|
||||
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
||||
<view class="bg-fff border-r-12 u-flex no-wrap u-col-top">
|
||||
<view class="">
|
||||
<view class="head">班次号</view>
|
||||
<view class="item" @tap="toDetail(item)" v-for="(item,index) in 10" :key="index">10002</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="head">班次</view>
|
||||
<view class="item" @tap="toDetail(item)" v-for="(item,index) in 10" :key="index">早班</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="head">交班人</view>
|
||||
<view class="item" @tap="toDetail(item)" v-for="(item,index) in 10" :key="index">交班人</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="head">开班时间</view>
|
||||
<view class="item" @tap="toDetail(item)" v-for="(item,index) in 10" :key="index">2024-05-29 11:15:18</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="head">交班时间</view>
|
||||
<view class="item" @tap="toDetail(item)" v-for="(item,index) in 10" :key="index">2024-05-29 11:15:18</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="head">订单数</view>
|
||||
<view class="item" @tap="toDetail(item)" v-for="(item,index) in 10" :key="index">0</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="head">订单金额(元)</view>
|
||||
<view class="item u-flex u-row-between" @tap="toDetail(item)" v-for="(item,index) in 10" :key="index">
|
||||
<text>0.00</text>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
<view class="constantbox">
|
||||
<view class="constantboxitem">
|
||||
<view class="head">班次号</view>
|
||||
<view class="head">班次</view>
|
||||
<view class="head">交班人</view>
|
||||
<view class="head">开班时间</view>
|
||||
<view class="head">交班时间</view>
|
||||
<view class="head">订单数</view>
|
||||
<view class="head">订单金额(元)</view>
|
||||
</view>
|
||||
<view class="constantboxitem" v-for="(item,index) in tableData.data" :key="index"
|
||||
@click="toDetail(item)">
|
||||
<view class="head">{{item.dutyId|| '无'}}</view>
|
||||
<view class="head">班次</view>
|
||||
<view class="head">{{item.staffName || '无'}}</view>
|
||||
<view class="head">{{item.startTime|| '无'}}</view>
|
||||
<view class="head">{{item.endTime|| '无'}}</view>
|
||||
<view class="head">{{item.orderNum|| '无'}}</view>
|
||||
<view class="head">{{item.totalAmount|| '无'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<uni-load-more :status="table.status"></uni-load-more>
|
||||
<up-loadmore :status="tableData.status" />
|
||||
<view style="height: 100px;"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view class="u-fixed bottom u-flex bg-fff ">
|
||||
<view class="u-flex-1">
|
||||
<!-- <view class="u-flex-1">
|
||||
<my-button bgColor="#333" color="#fff" borderRadius="100rpx 0 0 100rpx" shape="circle" plain type="primary"
|
||||
@tap="toSetting">设置</my-button>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="u-flex-1">
|
||||
<my-button borderRadius="0 100rpx 100rpx 0" shape="circle" type="primary" @tap="jiaoban">开始交班</my-button>
|
||||
<!-- <my-button borderRadius="0 100rpx 100rpx 0" shape="circle" type="primary" @tap="jiaoban">开始交班</my-button> -->
|
||||
<my-button borderRadius="100rpx" shape="circle" type="primary" @tap="jiaoban">开始交班</my-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -163,7 +163,8 @@
|
||||
onHide,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onPullDownRefresh
|
||||
onPullDownRefresh,
|
||||
onReachBottom,
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
computed,
|
||||
@@ -176,24 +177,64 @@
|
||||
import color from '@/commons/color.js';
|
||||
import myDatePickerview from '@/components/my-components/my-date-pickerview'
|
||||
import myPickerview from '@/components/my-components/my-pickerview'
|
||||
import {
|
||||
timeFormat
|
||||
} from '@/node_modules/uview-plus';
|
||||
import go from '@/commons/utils/go.js'
|
||||
function toDetail(){
|
||||
go.to('PAGES_WORK_HANDOVER_DETAIL')
|
||||
import {
|
||||
tbHandover,
|
||||
handoverData
|
||||
} from '@/http/yskApi/pageWorkControl.js'
|
||||
|
||||
function toDetail(item) {
|
||||
go.to('PAGES_WORK_HANDOVER_DETAIL', item)
|
||||
}
|
||||
|
||||
function toSetting() {
|
||||
go.to('PAGES_WORK_SETTING')
|
||||
}
|
||||
|
||||
function jiaoban() {
|
||||
if (banci.selItem === '') {
|
||||
return uni.showToast({
|
||||
title: '请选择班次',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
go.to('PAGES_WORK_HANDOVER_CONFIRM')
|
||||
const jiaoban = async () => {
|
||||
// if (banci.selItem === '') {
|
||||
// return uni.showToast({
|
||||
// title: '请选择班次',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// }
|
||||
// go.to('PAGES_WORK_HANDOVER_CONFIRM')
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认交班吗?',
|
||||
success:async (res) => {
|
||||
if (res.confirm) {
|
||||
await handoverData({
|
||||
isprintProduct: banci.switchvalue
|
||||
})
|
||||
uni.clearStorageSync()
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/index'
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const query = reactive({
|
||||
createdAt: [],
|
||||
proName: '',
|
||||
cateId: '',
|
||||
sort: 'id,desc'
|
||||
})
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 15,
|
||||
total: 0,
|
||||
status: 'loadmore'
|
||||
})
|
||||
|
||||
const jiaobanDatePicker = ref(null)
|
||||
|
||||
@@ -212,9 +253,6 @@
|
||||
form.kaibanTime = e
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const form = reactive({
|
||||
kaibanTime: new Date(),
|
||||
jiaobanTime: new Date()
|
||||
@@ -255,7 +293,8 @@
|
||||
},
|
||||
],
|
||||
selItem: '',
|
||||
current: ''
|
||||
current: '',
|
||||
switchvalue: false
|
||||
})
|
||||
|
||||
function banciConfirm(e) {
|
||||
@@ -276,16 +315,19 @@
|
||||
current: 0
|
||||
})
|
||||
|
||||
// 切换tab
|
||||
function tabsChange(i) {
|
||||
console.log(i)
|
||||
tabs.current = i
|
||||
// 清除时间
|
||||
clearTime()
|
||||
if (tabs.current == 1) {
|
||||
resetHandle()
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const table = reactive({
|
||||
status: 'noMore'
|
||||
})
|
||||
|
||||
|
||||
const filters = reactive({
|
||||
jiaobanCurrent: '',
|
||||
jiaobanSelItem: '',
|
||||
@@ -295,6 +337,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
// 清除时间
|
||||
function clearTime() {
|
||||
filters.time.start = ''
|
||||
filters.time.end = ''
|
||||
@@ -307,22 +350,63 @@
|
||||
const datePicker = ref(null)
|
||||
|
||||
function datePickerConfirm(e) {
|
||||
console.log(e);
|
||||
filters.time.start = e.start
|
||||
filters.time.end = e.end
|
||||
filters.time.start = new Date(e.start).getTime()
|
||||
filters.time.end = new Date(e.end).getTime()
|
||||
console.log(filters);
|
||||
getTableData()
|
||||
}
|
||||
|
||||
function filterBanciChange(e) {
|
||||
filters.jiaobanCurrent = e.detail.value
|
||||
// 重置列表
|
||||
function resetHandle() {
|
||||
query.sort = 'id,desc'
|
||||
tableData.data = []
|
||||
tableData.page = 0
|
||||
tableData.size = 15
|
||||
tableData.total = 0
|
||||
getTableData()
|
||||
}
|
||||
// 列表
|
||||
const getTableData = async () => {
|
||||
tableData.status = 'loading';
|
||||
let urlData = null
|
||||
if (!filters.time.start) {
|
||||
urlData =
|
||||
`page=${tableData.page}&size=${tableData.size}&shopId=${uni.getStorageSync('shopId')}&sort=${query.sort}`
|
||||
} else {
|
||||
urlData =
|
||||
`page=${tableData.page}&size=${tableData.size}&shopId=${uni.getStorageSync('shopId')}&tradeDay=${timeFormat(filters.time.start,'yyyymmdd')}&tradeDay=${timeFormat(filters.time.end,'yyyymmdd')}&sort=${query.sort}`
|
||||
}
|
||||
let res = await tbHandover(urlData)
|
||||
tableData.total = res.totalElements
|
||||
if (tableData.page == 0 && res.content.length < 10) {
|
||||
tableData.data = res.content
|
||||
tableData.status = 'nomore'
|
||||
return false;
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
tableData.data = [...tableData.data, ...res.content]
|
||||
if (tableData.data.length >= tableData.total) tableData.status = 'nomore';
|
||||
else tableData.status = 'loadmore';
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
form.jiaobanTime = new Date()
|
||||
updateJiaoban()
|
||||
|
||||
})
|
||||
onHide(() => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
|
||||
onReachBottom(() => {
|
||||
if (tableData.status != 'nomore') {
|
||||
tableData.page++
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => tabs.current, (newval) => {
|
||||
if (newval) {
|
||||
clearInterval(timer)
|
||||
@@ -354,15 +438,44 @@
|
||||
overflow: hidden;
|
||||
font-size: 24rpx;
|
||||
|
||||
.head {
|
||||
padding: 24rpx;
|
||||
background: #AEBAD2;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.constantbox {
|
||||
.constantboxitem {
|
||||
display: flex;
|
||||
|
||||
.item {
|
||||
padding: 24rpx;
|
||||
.head {
|
||||
width: 200rpx;
|
||||
padding: 32rpx 24rpx;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
overflow: hidden; //超出的文本隐藏
|
||||
text-overflow: ellipsis; //溢出用省略号显示
|
||||
white-space: nowrap; //溢出不换行
|
||||
}
|
||||
|
||||
.head:nth-child(4) {
|
||||
width: 300rpx;
|
||||
}
|
||||
|
||||
.head:nth-child(5) {
|
||||
width: 300rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.constantboxitem:nth-child(even) {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.constantboxitem:nth-child(odd) {
|
||||
background: #F7F6FB;
|
||||
}
|
||||
|
||||
.constantboxitem:nth-child(1) {
|
||||
background: #AEBAD2;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item:nth-of-type(2n+1) {
|
||||
|
||||
56
pages.json
56
pages.json
@@ -99,6 +99,35 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_SHOP_SETUP",
|
||||
"path": "pages/shopSetUp/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置中心"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_SHOP_EDITVAL",
|
||||
"path": "pages/shopSetUp/editVal",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_SHOP_QRCODE",
|
||||
"path": "pages/shopSetUp/shopQRcode",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_SHOP_LIST",
|
||||
"path": "pages/shopSetUp/shopList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "选择门店"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"pageId": "PAGES_USER_SETUP",
|
||||
"path": "pages/userSetUp/userSetUp",
|
||||
@@ -1217,7 +1246,32 @@
|
||||
"navigationBarTitleText": "订单详情"
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_ORDER_DETAIL",
|
||||
"path" : "detail/detail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "订单详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_ORDER_PAY",
|
||||
"path" : "pay-order/pay-order",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "结账"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_ORDER_TUIKUAN",
|
||||
"path" : "tuikuan/tuikuan",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "退款"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -52,6 +52,11 @@
|
||||
icon: '/static/indexImg/icon-cashier.svg',
|
||||
pageUrl: 'PAGES_QUICK_PAY',
|
||||
},
|
||||
{
|
||||
title: '设置中心',
|
||||
icon: '/static/indexImg/icon-cashier.svg',
|
||||
pageUrl: 'PAGES_SHOP_SETUP',
|
||||
},
|
||||
{
|
||||
title: '商品管理',
|
||||
icon: '/static/indexImg/icon-product-control.svg',
|
||||
@@ -152,8 +157,7 @@
|
||||
{
|
||||
title: '成员管理',
|
||||
icon: '/static/indexImg/icon-staff.svg',
|
||||
pageUrl: 'PAGES_USER',
|
||||
entId: 'ENT_UR_USER_LIST'
|
||||
pageUrl: 'PAGES_USER'
|
||||
},
|
||||
{
|
||||
title: '数据中心',
|
||||
|
||||
59
pages/shopSetUp/editVal.vue
Normal file
59
pages/shopSetUp/editVal.vue
Normal file
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<view class="page-wrapper">
|
||||
<view class="content">
|
||||
<up-textarea v-model="vdata.value" placeholder="请输入内容" maxlength="20" border="none" placeholderStyle="font-size: 28rpx" count></up-textarea>
|
||||
</view>
|
||||
<view class="save" @tap="save">保存</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
|
||||
const vdata = reactive({
|
||||
value: "",
|
||||
name: ""
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
vdata.value = options.value;
|
||||
vdata.name = options.name;
|
||||
})
|
||||
|
||||
|
||||
let save = (e) => {
|
||||
// console.log(e)
|
||||
uni.$emit('refreshPreviousPage', {name: vdata.name, value: vdata.value});
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.page-wrapper {
|
||||
min-height: calc(100vh - 90rpx);
|
||||
padding: 32rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.content{
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-radius: 18rpx;
|
||||
|
||||
}
|
||||
|
||||
.save{
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
background: #318AFE;
|
||||
border-radius: 12rpx;
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
margin-top: 48rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
523
pages/shopSetUp/index.vue
Normal file
523
pages/shopSetUp/index.vue
Normal file
@@ -0,0 +1,523 @@
|
||||
<template>
|
||||
<view class="page-wrapper">
|
||||
<view class="page-cell">
|
||||
<view class="label">头像</view>
|
||||
<view class="right" @tap="uploadImg.preview()">
|
||||
<up-avatar class="fileImg" :src="vdata.shopInfo.coverImg?vdata.shopInfo.coverImg:''"></up-avatar>
|
||||
<view class="file" @tap="chooseAndUploadAvatar('coverImg')"></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="page-cell m" @tap="updateValue('商户名称','shopName',vdata.shopInfo.shopName)"> -->
|
||||
<view class="page-cell m" @tap="go.to('PAGES_SHOP_EDITVAL',{name:'shopName',value: vdata.shopInfo.shopName})">
|
||||
<view class="label">商户名称</view>
|
||||
<view class="right"><view>{{ vdata.shopInfo.shopName }}</view><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
|
||||
</view>
|
||||
<view class="page-cell m" @tap="go.to('PAGES_SHOP_EDITVAL',{name:'phone',value: vdata.shopInfo.phone})">
|
||||
<view class="label">商户电话</view>
|
||||
<view class="right"><view>{{ vdata.shopInfo.phone }}</view><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
|
||||
</view>
|
||||
<!-- <view class="page-cell m" >
|
||||
<view class="label">到期时间</view>
|
||||
<view class="right"><view>{{ vdata.shopInfo.realname }}</view><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
|
||||
</view> -->
|
||||
<view class="page-cell m">
|
||||
<view class="label">营业状态</view>
|
||||
<view class="right"><up-switch v-model="vdata.shopInfo.status" size="20" :inactiveValue="2" :activeValue="1" activeColor="#0FC161" @change="switchChange('status')"></up-switch></view>
|
||||
</view>
|
||||
<view class="page-cell m" @tap="showMap">
|
||||
<view class="label">门店详细地址</view>
|
||||
<view class="right"><view>{{ vdata.shopInfo.address }}</view><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
|
||||
</view>
|
||||
<view class="page-cell">
|
||||
<view class="label">堂食功能</view>
|
||||
<view class="right"><up-switch v-model="vdata.dineIn" size="20" activeColor="#0FC161" @change="switchChange('eatModel')"></up-switch></view>
|
||||
</view>
|
||||
<view class="page-cell">
|
||||
<view class="label">允许打包</view>
|
||||
<view class="right"><up-switch v-model="vdata.takeout" size="20"activeColor="#0FC161" @change="switchChange('eatModel')"></up-switch></view>
|
||||
</view>
|
||||
<view class="page-cell m">
|
||||
<view class="label">是否开启会员支付</view>
|
||||
<view class="right"><up-switch v-model="vdata.shopInfo.isUseVip" size="20" :inactiveValue="0" :activeValue="1" activeColor="#0FC161" @change="switchChange('isUseVip')"></up-switch></view>
|
||||
</view>
|
||||
|
||||
<view class="page-cell">
|
||||
<view class="label">桌位费<view v-if="vdata.isTableFee" class="tableFee" @tap="go.to('PAGES_SHOP_EDITVAL',{name:'tableFee',value: vdata.shopInfo.tableFee})">{{vdata.shopInfo.tableFee}}</view></view>
|
||||
<view class="right">
|
||||
<view>
|
||||
<up-checkbox-group><up-checkbox label="免桌位费" v-model:checked="vdata.isTableFee" activeColor="#0FC161" shape="circle" @change="isTableFeeChange"> </up-checkbox></up-checkbox-group>
|
||||
</view><up-icon name="arrow-right" color="#999999" size="15"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-cell" @tap="go.to('PAGES_SHOP_QRCODE',{paymentQrcode: vdata.shopInfo.paymentQrcode})">
|
||||
<view class="label">店铺收款码</view>
|
||||
<view class="right"><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
|
||||
</view>
|
||||
<view class="page-cell column" >
|
||||
<view class="label">店铺图片</view>
|
||||
<view class="extendList">
|
||||
<view class="extendTab">
|
||||
<view class="extendTab_item"
|
||||
v-for="(item,index) in vdata.extendList" :key="index"
|
||||
:class="{'active':vdata.extendIndex==index}"
|
||||
@click="extendTabClick(item,index)"
|
||||
>{{item.title}}</view>
|
||||
</view>
|
||||
<view class="extend_content">
|
||||
<view class="preview">
|
||||
<up-image class="index_bg" v-if="'index_bg' == vdata.extendInfo.autokey" :src="vdata.extendInfo.value"></up-image>
|
||||
<up-image class="my_bg" v-if="'my_bg' == vdata.extendInfo.autokey" :src="vdata.extendInfo.value"></up-image>
|
||||
<up-image class="bg" v-if="'member_bg' == vdata.extendInfo.autokey" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/cashier_admin_app_shopSet/'+vdata.extendInfo.autokey+'1.png'" ></up-image>
|
||||
<up-image class="member_bg" v-if="'member_bg' == vdata.extendInfo.autokey" :src="vdata.extendInfo.value"></up-image>
|
||||
<up-image class="shopinfo_bg" v-if="'shopinfo_bg' == vdata.extendInfo.autokey" :src="vdata.extendInfo.value"></up-image>
|
||||
<view class="shopinfo_bg_f" v-if="'shopinfo_bg' == vdata.extendInfo.autokey"></view>
|
||||
<up-image class="bg" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/cashier_admin_app_shopSet/'+vdata.extendInfo.autokey+'.png'" ></up-image>
|
||||
</view>
|
||||
<view class="extend_img">
|
||||
<view class="extend_title">{{vdata.extendInfo.title}}背景图片</view>
|
||||
<view class="fileUp">
|
||||
<up-image :src="vdata.extendInfo.value"></up-image>
|
||||
<view class="file" @tap="chooseAndUploadAvatar('extendUp')"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cutShop" @tap="go.to('PAGES_SHOP_LIST')">切换门店</view>
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import { getShopInfo , editShopInfo, getShopExtend, editShopExtend } from '@/http/yskApi/shop.js'
|
||||
import storageManage from '@/commons/utils/storageManage.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import { $uploadFile } from '@/http/yskApi/file.js'
|
||||
|
||||
const uploadImg = ref()
|
||||
const phone = ref(null)
|
||||
const vdata = reactive({
|
||||
shopInfo: {},
|
||||
extendList: [],
|
||||
extendIndex: 0,
|
||||
extendInfo: {},
|
||||
dineIn: false,
|
||||
takeout: false,
|
||||
isTableFee: false,
|
||||
label: "",
|
||||
type: "",
|
||||
inputValue: "",
|
||||
inputType: "text",
|
||||
maxLength: '999',
|
||||
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
shopExtend();
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
shopInfo();
|
||||
uni.$on('refreshPreviousPage', (params) => {
|
||||
// 这里执行刷新数据的操作,例如重新调用API获取数据
|
||||
refreshData(params);
|
||||
});
|
||||
})
|
||||
|
||||
let refreshData = (e) => {
|
||||
let params = {
|
||||
id : vdata.shopInfo.id,
|
||||
}
|
||||
for(let item in params){
|
||||
params[e.name] = e.value;
|
||||
}
|
||||
vdata.type = e.name;
|
||||
vdata.inputValue = e.value;
|
||||
updateShopInfo(params,'input')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺信息
|
||||
*/
|
||||
const shopInfo = () => {
|
||||
getShopInfo(storageManage.shopId()).then((res) => {
|
||||
vdata.isTableFee = res.isTableFee == 1 ? true: false;
|
||||
if (res.eatModel.join(",").indexOf("dine-in") != -1) {
|
||||
vdata.dineIn = true
|
||||
}
|
||||
if (res.eatModel.join(",").indexOf("take-out") != -1) {
|
||||
vdata.takeout = true
|
||||
}
|
||||
vdata.shopInfo = res;
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺图片
|
||||
*/
|
||||
let shopExtend = () => {
|
||||
getShopExtend({
|
||||
autokey: "index_bg",
|
||||
}).then((res) => {
|
||||
if ( res.content && res.content.length > 0 ) {
|
||||
vdata.extendList = res.content;
|
||||
vdata.extendIndex = 0;
|
||||
vdata.extendInfo = res.content[0];
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
let updateShopInfo = (params,type) => {
|
||||
editShopInfo(params).then((res) => {
|
||||
if (type && type == "input") {
|
||||
console.log(vdata.type)
|
||||
switch ( vdata.type ){
|
||||
case "shopName":
|
||||
vdata.shopInfo.shopName = vdata.inputValue;
|
||||
break;
|
||||
case "phone":
|
||||
vdata.shopInfo.phone = vdata.inputValue;
|
||||
break;
|
||||
case "tableFee":
|
||||
vdata.shopInfo.tableFee = vdata.inputValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
let updateShopExtend = () => {
|
||||
editShopExtend(vdata.extendInfo).then((res) => {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 上传头像
|
||||
*/
|
||||
let chooseAndUploadAvatar = ( type ) => {
|
||||
// 选择图片
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认为1,只选择一张图片
|
||||
sizeType: ['original', 'compressed'], // 图片质量,原图或压缩
|
||||
sourceType: ['album', 'camera'], // 图片来源,相册或相机
|
||||
success: (res) => {
|
||||
let file = res.tempFiles[0];
|
||||
console.log(res)
|
||||
$uploadFile(file).then(res => {
|
||||
console.log(res);
|
||||
if ( type == "coverImg") {
|
||||
vdata.shopInfo.coverImg = res.data[0];
|
||||
let params = {
|
||||
id : vdata.shopInfo.id,
|
||||
coverImg : vdata.shopInfo.coverImg,
|
||||
}
|
||||
updateShopInfo(params)
|
||||
}
|
||||
if ( type == "extendUp") {
|
||||
vdata.extendInfo.value = res.data[0];
|
||||
updateShopExtend()
|
||||
}
|
||||
|
||||
}).catch(res=>{
|
||||
console.log(res);
|
||||
if(res.errMsg){
|
||||
uni.showToast({
|
||||
title:'图片大小超出限制',
|
||||
icon:'error'
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
fail: chooseImageError => {
|
||||
// 选择图片失败处理逻辑
|
||||
console.log('choose image fail:', chooseImageError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺图片TAB切换
|
||||
*/
|
||||
let extendTabClick = (item,index) => {
|
||||
vdata.extendInfo = item;
|
||||
vdata.extendIndex = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否免桌位费
|
||||
*/
|
||||
let isTableFeeChange = (e) => {
|
||||
if ( e ) {
|
||||
vdata.isTableFee = true;
|
||||
} else {
|
||||
vdata.isTableFee = false;
|
||||
}
|
||||
switchChange('isTableFee')
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
let switchChange = ( type ) => {
|
||||
let params = {
|
||||
id : vdata.shopInfo.id,
|
||||
}
|
||||
switch ( type ){
|
||||
case "isUseVip":
|
||||
params.lng = vdata.shopInfo.lng;
|
||||
params.lat = vdata.shopInfo.lat;
|
||||
params.address = vdata.shopInfo.address;
|
||||
break;
|
||||
case "status":
|
||||
params.status = vdata.shopInfo.status;
|
||||
break;
|
||||
case "eatModel":
|
||||
params.eatModel = [];
|
||||
if ( vdata.dineIn ) {
|
||||
params.eatModel.push('dine-in');
|
||||
}
|
||||
if ( vdata.takeout ) {
|
||||
params.eatModel.push('take-out');
|
||||
}
|
||||
break;
|
||||
case "isUseVip":
|
||||
params.isUseVip = vdata.shopInfo.isUseVip;
|
||||
break;
|
||||
case "isTableFee":
|
||||
if ( vdata.isTableFee ) {
|
||||
params.isTableFee = 1;
|
||||
} else {
|
||||
params.isTableFee = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
updateShopInfo(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择地图
|
||||
*/
|
||||
let showMap = () => {
|
||||
// 本地 测试选择
|
||||
// return test();
|
||||
// 打开地图 && 获取省市县
|
||||
uni.chooseLocation().then((res) => {
|
||||
console.log(res);
|
||||
vdata.shopInfo.lng = res.longitude.toFixed(6); // IOS 小程序中: 经纬度12位。
|
||||
vdata.shopInfo.lat = res.latitude.toFixed(6);
|
||||
vdata.shopInfo.address = res.name;
|
||||
switchChange('address')
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-wrapper{
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 32rpx;
|
||||
.page-cell {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 32rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
.label {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.tableFee {
|
||||
width: 186rpx;
|
||||
height: 54rpx;
|
||||
line-height: 54rpx;
|
||||
margin-left: 10rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
text-align: left;
|
||||
padding: 0 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
.extendList{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 24rpx;
|
||||
.extendTab{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
.extendTab_item{
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
}
|
||||
.active{
|
||||
background: #318AFE;
|
||||
border: 2rpx solid #318AFE;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.extend_content{
|
||||
display: flex;
|
||||
margin-top: 32rpx;
|
||||
.preview{
|
||||
width: 146rpx;
|
||||
height: 342rpx;
|
||||
position: relative;
|
||||
margin-right: 32rpx;
|
||||
background-color: #f7f7f7;
|
||||
::v-deep .bg,::v-deep .bg .u-image,::v-deep .bg .u-image__image{
|
||||
width: 146rpx!important;
|
||||
height: 342rpx!important;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
::v-deep .index_bg .u-image,::v-deep .index_bg .u-image__image{
|
||||
width: 146rpx!important;
|
||||
height: 242rpx!important;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
::v-deep .my_bg .u-image,::v-deep .my_bg .u-image__image{
|
||||
width: 146rpx!important;
|
||||
height: 90rpx!important;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
::v-deep .member_bg .u-image,::v-deep .member_bg .u-image__image{
|
||||
width: 134rpx!important;
|
||||
height: 63rpx!important;
|
||||
position: absolute;
|
||||
top: 22rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
border-radius: 5rpx!important;
|
||||
}
|
||||
|
||||
::v-deep .shopinfo_bg .u-image,::v-deep .shopinfo_bg .u-image__image{
|
||||
width: 146rpx!important;
|
||||
height: 50rpx!important;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.shopinfo_bg_f{
|
||||
width: 146rpx;
|
||||
height: 290rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
}
|
||||
.extend_img{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.extend_title{
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.fileUp{
|
||||
width: 148rpx;
|
||||
height: 148rpx;
|
||||
position: relative;
|
||||
.file{
|
||||
width: 148rpx;
|
||||
height: 148rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
::v-deep .u-image,::v-deep .u-image__image{
|
||||
width: 148rpx!important;
|
||||
height: 148rpx!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.column{
|
||||
flex-direction: column;
|
||||
.label{
|
||||
align-self: flex-start;
|
||||
}
|
||||
}
|
||||
.m{
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.cutShop{
|
||||
width: 530rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
background: #318AFE;
|
||||
border-radius: 56rpx;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
margin: 48rpx auto 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
position: relative;
|
||||
|
||||
.file{
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
line-height: 112rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.fileImg{
|
||||
width: 112rpx!important;
|
||||
height: 112rpx!important;
|
||||
::v-deep .u-avatar__image{
|
||||
width: 112rpx!important;
|
||||
height: 112rpx!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
161
pages/shopSetUp/shopList.vue
Normal file
161
pages/shopSetUp/shopList.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<view class="page-wrapper">
|
||||
|
||||
<view class="shopList">
|
||||
<view class="tip">选择你要登录的门店</view>
|
||||
<view class="shopList_item" @tap="createStore(item)" v-for="(item,index) in vdata.shopList" :key="index">
|
||||
<view class="shopList_item_top">
|
||||
<view class="shopList_item_top_left">
|
||||
<text class="sort">{{index+1}}</text>
|
||||
<up-avatar class="fileImg" :src="vdata.coverImg?vdata.coverImg:''"></up-avatar>
|
||||
<view class="shopList_item_top_left_info">
|
||||
<text class="shopName">双屿</text>
|
||||
<text class="phone">15333333333</text>
|
||||
</view>
|
||||
</view>
|
||||
<up-icon name="arrow-right" color="#999999" size="15"></up-icon>
|
||||
</view>
|
||||
<view class="shopList_item_bom">
|
||||
<viwe class="shopList_item_bom_i">
|
||||
<text class="name">今日实收</text>
|
||||
<text class="num">0.00</text>
|
||||
</viwe>
|
||||
<viwe class="shopList_item_bom_i">
|
||||
<text class="name">今日实收</text>
|
||||
<text class="num">0.00</text>
|
||||
</viwe>
|
||||
<viwe class="shopList_item_bom_i">
|
||||
<text class="name">今日实收</text>
|
||||
<text class="num">0.00</text>
|
||||
</viwe>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { nextTick, reactive, ref } from 'vue';
|
||||
import { onReachBottom, onShow, onUnload } from '@dcloudio/uni-app';
|
||||
import ak from '@/commons/utils/ak.js';
|
||||
import { getShopList } from '@/http/yskApi/shop.js'
|
||||
|
||||
const vdata = reactive({
|
||||
shopList:[
|
||||
{name: 1},
|
||||
{name: 2},
|
||||
]
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
// getshopList()
|
||||
})
|
||||
|
||||
let getshopList = () => {
|
||||
getShopList().then((res) => {
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
let createStore = () => {
|
||||
ak.go.back(1)
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.page-wrapper {
|
||||
min-height: calc(100vh - 90rpx);
|
||||
.shopList{
|
||||
padding: 32rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
.tip{
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
.shopList_item{
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 32rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 32rpx;
|
||||
.shopList_item_top{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.shopList_item_top_left{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.sort{
|
||||
margin-right: 28rpx;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
.fileImg{
|
||||
width: 72rpx!important;
|
||||
height: 72rpx!important;
|
||||
margin-right: 24rpx;
|
||||
::v-deep .u-avatar__image{
|
||||
width: 72rpx!important;
|
||||
height: 72rpx!important;
|
||||
}
|
||||
}
|
||||
.shopList_item_top_left_info{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.shopName{
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.phone{
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.shopList_item_bom{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #F9F9F9;
|
||||
border-radius: 12rpx;
|
||||
padding: 32rpx 0 ;
|
||||
box-sizing: border-box;
|
||||
margin-top: 24rpx;
|
||||
.shopList_item_bom_i{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.name{
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
.num{
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
208
pages/shopSetUp/shopQRcode.vue
Normal file
208
pages/shopSetUp/shopQRcode.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<view class="page-wrapper">
|
||||
<view class="content">
|
||||
<view class="title">门店收款码</view>
|
||||
<view ref="qrcode" class="qrcode">
|
||||
<up-qrcode :size="vdata.size" @result="result" :val="vdata.paymentQrcode"></up-qrcode>
|
||||
</view>
|
||||
<view class="bom">
|
||||
<view @click="download">下载收款码</view>
|
||||
<view>下载收款码样式</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import ak from '@/commons/utils/ak.js';
|
||||
import { getShopList } from '@/http/yskApi/shop.js'
|
||||
|
||||
const vdata = reactive({
|
||||
size: 0,
|
||||
qrcodeUrl: null,
|
||||
paymentQrcode: null,
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
vdata.paymentQrcode = options.paymentQrcode;
|
||||
|
||||
})
|
||||
|
||||
|
||||
onShow(() => {
|
||||
// getshopList()
|
||||
|
||||
})
|
||||
onMounted(() => {
|
||||
|
||||
// 设置二维码大小
|
||||
let query = uni.createSelectorQuery().in(this);
|
||||
query.select('.qrcode').boundingClientRect(data => {
|
||||
if (data) {
|
||||
vdata.size = data.width
|
||||
}
|
||||
}).exec();
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 二维码图片
|
||||
*/
|
||||
let result = (e) => {
|
||||
vdata.qrcodeUrl = e;
|
||||
console.log(vdata.qrcodeUrl)
|
||||
let blob = dataURLtoBlob()
|
||||
console.log(blob)
|
||||
}
|
||||
let dataURLtoBlob = (dataurl) => {
|
||||
var arr = vdata.qrcodeUrl.split(',')
|
||||
var mime = arr[0].match(/:(.*?);/)[1]
|
||||
var bstr = atob(arr[1])
|
||||
var n = bstr.length
|
||||
var u8arr = new Uint8Array(n)
|
||||
while (n--) {
|
||||
u8arr[n] = bstr.charCodeAt(n)
|
||||
}
|
||||
return new Blob([u8arr], { type: mime })
|
||||
}
|
||||
let saveImageToPhotosAlbum = (imgSrc) => {
|
||||
let base64 = imgSrc.replace(/^data:image\/\w+;base64,/, ""); //图片替换
|
||||
let filePath = '123' + '/qrcode.png';
|
||||
uni.getFileSystemManager().writeFile({
|
||||
filePath: filePath, //创建一个临时文件名
|
||||
data: base64, //写入的文本或二进制数据
|
||||
encoding: 'base64', //写入当前文件的字符编码
|
||||
success: (res) => {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: filePath,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: "none",
|
||||
duration: 5000
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
uni.showToast({
|
||||
title: '保存失败',
|
||||
icon: "none",
|
||||
duration: 5000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let getUrlBase64 = (url) => {
|
||||
return new Promise(resolve => {
|
||||
let canvas = document.createElement('canvas')
|
||||
let ctx = canvas.getContext('2d')
|
||||
let img = new Image()
|
||||
img.crossOrigin = 'Anonymous' //允许跨域
|
||||
img.src = vdata.qrcodeUrl
|
||||
img.onload = function() {
|
||||
canvas.height = 300
|
||||
canvas.width = 300
|
||||
ctx.drawImage(img, 0, 0, 300, 300)
|
||||
let dataURL = canvas.toDataURL('image/png')
|
||||
canvas = null
|
||||
resolve(dataURL)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let download = () => {
|
||||
// 这里是获取到的图片base64编码
|
||||
let link = document.createElement('a')
|
||||
let url = vdata.qrcodeUrl//要下载的路径
|
||||
// 这里是将url转成blob地址,
|
||||
fetch(url).then(res => res.blob()).then(blob => { //将链接地址字符内容转变成blob地址
|
||||
link.href = URL.createObjectURL(blob)
|
||||
console.log(link.href)
|
||||
link.download ='QrCode'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.page-wrapper {
|
||||
min-height: calc(100vh - 90rpx);
|
||||
padding: 48rpx 52rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.content{
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-radius: 40rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 64rpx 0;
|
||||
box-sizing: border-box;
|
||||
.title{
|
||||
font-weight: bold;
|
||||
font-size: 40rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.qrcode{
|
||||
width: 416rpx;
|
||||
height: 416rpx;
|
||||
margin-top: 50rpx;
|
||||
border: 2rpx solid #333;
|
||||
padding: 15rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
::v-deep .u-qrcode,::v-deep .u-qrcode__content,::v-deep .u-qrcode__canvas{
|
||||
width: 100%!important;
|
||||
height: 100%!important;
|
||||
|
||||
}
|
||||
.bom{
|
||||
display: flex;
|
||||
margin-top: 110rpx;
|
||||
view{
|
||||
width: 218rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #318AFE;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
view:nth-child(1){
|
||||
color: #318AFE;
|
||||
border: 2rpx solid #318AFE;
|
||||
margin-right: 80rpx;
|
||||
}
|
||||
view:nth-child(2){
|
||||
color: #7074A0;
|
||||
border: 2rpx solid #7074A0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -33,8 +33,10 @@
|
||||
<template #btn>
|
||||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" showShadow>修改</my-button>
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
||||
<my-button @tap="confirm" shape="circle" >修改</my-button>
|
||||
<view class="">
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -60,6 +62,10 @@
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
discount:{
|
||||
type: [Number,String],
|
||||
default:100
|
||||
},
|
||||
price: {
|
||||
type: [Number,String],
|
||||
default: 0
|
||||
@@ -119,6 +125,9 @@
|
||||
|
||||
function open() {
|
||||
model.value.open()
|
||||
form.price=props.price
|
||||
form.currentPrice=props.price
|
||||
form.discount=props.discount
|
||||
}
|
||||
|
||||
function close() {
|
||||
@@ -127,11 +136,9 @@
|
||||
const emits = defineEmits(['confirm'])
|
||||
|
||||
function confirm() {
|
||||
const {
|
||||
price,
|
||||
} = form
|
||||
console.log(form);
|
||||
emits('confirm',{...form,currentPrice:Number(form.currentPrice).toFixed(2)})
|
||||
close()
|
||||
emits('confirm',form)
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
<view class="u-m-t-24 u-flex u-row-between " @tap="chooseUser">
|
||||
<view v-if="!user">选择用户</view>
|
||||
<view class="u-flex" v-else>
|
||||
<view class="headeimg">
|
||||
<up-avatar :src="user.headImg" shape="square" :size="30"></up-avatar>
|
||||
<!-- <view class="headeimg">
|
||||
<image class="img" :src="user.headImg" mode=""></image>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="u-m-l-20">{{user.nickName}}</view>
|
||||
<view class="color-main u-m-l-10 u-font-24">{{user.isVip?'会员':'' }}</view>
|
||||
<view class="u-font-24 u-m-l-30"><text>余额:</text><text class="color-main">{{user.amount}}</text>
|
||||
@@ -16,69 +17,55 @@
|
||||
<view class="u-font-24 u-m-l-30"><text>积分:</text><text
|
||||
class="color-main">{{user.totalScore}}</text></view>
|
||||
</view>
|
||||
<uni-icons type="right" color="#999" size="22"></uni-icons>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-p-b-24 u-m-b-24 border-bottom">
|
||||
<view>就餐类型</view>
|
||||
<view class="u-m-t-24 u-flex ">
|
||||
<view class="u-flex color-666">
|
||||
<radio-group @change="radioGroupChange">
|
||||
<label class="radio u-m-r-60" v-for="(item,index) in eatTypes.list" :key="index">
|
||||
<radio :value="''+item.value" :checked="item.value == eatTypes.active"
|
||||
class="scale7 " />
|
||||
<text>{{item.label}}</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
|
||||
<up-radio-group v-model="eatTypes.active" placement="row">
|
||||
<up-radio :customStyle="{marginRight: '30px'}" v-for="(item, index) in eatTypes.list"
|
||||
:key="index" :label="item.name" :name="item.value">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-p-b-24 u-m-b-24 border-bottom" @tap="chooseTable">
|
||||
<view class=" " @tap="chooseTable">
|
||||
<view>选择桌码</view>
|
||||
<view class="u-m-t-24 u-flex u-row-between ">
|
||||
<view>
|
||||
<text v-if="table">{{table.name}}</text>
|
||||
<text v-else>不选择桌台</text>
|
||||
</view>
|
||||
<uni-icons type="right" color="#999" size="22"></uni-icons>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="block">
|
||||
<template v-if="!user">
|
||||
<view class="u-p-b-24 u-m-b-24 border-bottom">
|
||||
<view>用餐人数(人)</view>
|
||||
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex" :range="userNumbers.list">
|
||||
<view class="u-m-t-24 u-flex u-row-between ">
|
||||
<view class="color-333">{{userNumbers.defaultCateIndex||''}}</view>
|
||||
<uni-icons type="right" color="#999" size="22"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view>
|
||||
<view class="u-flex border-bottom u-p-b-24">
|
||||
<image class="headeimg" src="@/static/uni.png" mode=""></image>
|
||||
<template v-if="user">
|
||||
<view class="block">
|
||||
<view class="">
|
||||
<view class="u-flex border-bottom u-p-b-24 ">
|
||||
<up-avatar :src="user.headImg" shape="square" :size="60"></up-avatar>
|
||||
<!-- <image class="headeimg" src="@/static/uni.png" mode=""></image> -->
|
||||
<view class="u-m-l-32">
|
||||
<view class="">{{user.name}}</view>
|
||||
<view class="color-main u-font-24">{{user.isVip?'永久会员':'' }}</view>
|
||||
<view class="">{{user.nickName}}</view>
|
||||
<view class="color-main u-font-24">{{user.isVip?'会员':'' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-24 u-row-between u-font-24 color-999">
|
||||
<view class="u-flex">
|
||||
<view>余额</view>
|
||||
<view class="color-333 u-m-l-10"> 0.00</view>
|
||||
<view class="color-333 u-m-l-10"> {{user.amount}}</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view>积分</view>
|
||||
<view class="color-333 u-m-l-10"> 0</view>
|
||||
<view class="color-333 u-m-l-10"> {{user.totalScore}}</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view>已消费</view>
|
||||
@@ -86,10 +73,23 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="$shop.registerType!='restaurant'">
|
||||
<!-- 不免餐位费 -->
|
||||
<view class="block">
|
||||
<view class=" ">
|
||||
<view>用餐人数(人)</view>
|
||||
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex" :range="userNumbers.list">
|
||||
<view class="u-m-t-24 u-flex u-row-between ">
|
||||
<view class="color-333">{{userNumbers.defaultCateIndex||''}}</view>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<view class="block">
|
||||
<view class="u-p-b-24 ">
|
||||
@@ -150,9 +150,9 @@
|
||||
|
||||
<scroll-view scroll-x="true" v-if="index==goods.sel">
|
||||
<view class="u-m-t-32 u-flex no-wrap">
|
||||
<view class="u-flex u-m-r-20 u-m-b-20">
|
||||
<!-- <view class="u-flex u-m-r-20 u-m-b-20">
|
||||
<button class="tag" hover-class="hover-class" @tap="showModel('discount')">单品打折</button>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="u-flex u-m-r-20 u-m-b-20">
|
||||
<!-- <button class="tag" hover-class="hover-class" @tap="showModel('giveFood')">赠菜</button> -->
|
||||
<button class="tag" hover-class="hover-class"
|
||||
@@ -177,7 +177,7 @@
|
||||
|
||||
<view class="u-flex u-row-between u-m-t-30 u-p-b-34 border-bottom">
|
||||
<view>
|
||||
<text v-if="eatTypes.active==2">包装费</text>
|
||||
<text v-if="eatTypes.active=='takeout'">包装费</text>
|
||||
<text v-else>桌位费</text>
|
||||
</view>
|
||||
<view>¥{{$seatFee.totalAmount||'0.00'}}</view>
|
||||
@@ -196,14 +196,16 @@
|
||||
|
||||
<view style="height: 300rpx;"></view>
|
||||
<view class="safe-bottom fixed">
|
||||
<view>
|
||||
<!-- <view class="u-m-b-48">
|
||||
<label class="radio">
|
||||
<radio value="" class="scale7" /><text>打印预结算</text>
|
||||
</label>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="u-m-t-48 btn">
|
||||
<my-button shape="circle" @click="createOrder">提交</my-button>
|
||||
<view class="btn ">
|
||||
<my-button shape="circle" @click="createOrder">
|
||||
{{$shop.registerType=='munchies'?'结算': '下单'}}
|
||||
</my-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -240,7 +242,12 @@
|
||||
} from '@/commons/utils/format.js';
|
||||
import color from '@/commons/color.js';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {getNowCart} from '@/pagesCreateOrder/util.js'
|
||||
import {
|
||||
tbShopInfo
|
||||
} from '@/http/yskApi/user.js'
|
||||
import {
|
||||
getNowCart
|
||||
} from '@/pagesCreateOrder/util.js'
|
||||
const models = new Map();
|
||||
//备注
|
||||
let note = ref('')
|
||||
@@ -270,16 +277,22 @@
|
||||
defaultCateIndex: 1,
|
||||
})
|
||||
watch(() => userNumbers.defaultCateIndex, (newval) => {
|
||||
console.log(newval);
|
||||
updateChoseCount()
|
||||
})
|
||||
|
||||
|
||||
//更新就餐人数
|
||||
async function updateChoseCount(){
|
||||
await Api.$choseCount({
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
num: userNumbers.defaultCateIndex,
|
||||
})
|
||||
async function updateChoseCount() {
|
||||
console.log($shop.value);
|
||||
if($shop.value.registerType!='restaurant'){
|
||||
//不免餐位费
|
||||
await Api.$choseCount({
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
num: userNumbers.defaultCateIndex,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function userNumberChange(e) {
|
||||
@@ -315,21 +328,17 @@
|
||||
|
||||
const eatTypes = reactive({
|
||||
list: [{
|
||||
label: '堂食',
|
||||
value: 1
|
||||
name: "堂食",
|
||||
value: "dine-in",
|
||||
},
|
||||
{
|
||||
label: '自取',
|
||||
value: 2
|
||||
},
|
||||
name: "自取",
|
||||
value: "takeout",
|
||||
}
|
||||
],
|
||||
active: 1
|
||||
active: 'dine-in'
|
||||
})
|
||||
|
||||
function radioGroupChange(e) {
|
||||
eatTypes.active = e.detail.value
|
||||
}
|
||||
|
||||
|
||||
function chooseUser() {
|
||||
go.to('PAGES_CHOOSE_USER')
|
||||
@@ -343,12 +352,24 @@
|
||||
|
||||
// 监听选择用户事件
|
||||
let user = ref(null)
|
||||
//更新选择用户
|
||||
function setUser(par) {
|
||||
const submitPar = {
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
vipUserId: user.value.id ? user.value.id : '',
|
||||
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
||||
}
|
||||
Object.assign(submitPar, par)
|
||||
return Api.$setUser(submitPar)
|
||||
}
|
||||
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
console.log(data);
|
||||
user.value = data
|
||||
setUser()
|
||||
})
|
||||
}
|
||||
let table = ref(null)
|
||||
@@ -415,15 +436,24 @@
|
||||
records,
|
||||
seatFee
|
||||
} = await Api.getCart(par)
|
||||
goods.list =getNowCart(records)
|
||||
if(seatFee&&seatFee.totalNumber){
|
||||
goods.list = getNowCart(records)
|
||||
if (seatFee && seatFee.totalNumber) {
|
||||
userNumbers.defaultCateIndex = seatFee.totalNumber || 1
|
||||
Object.assign($seatFee, seatFee)
|
||||
}
|
||||
|
||||
|
||||
console.log(goods.list);
|
||||
}
|
||||
|
||||
let $shop = ref()
|
||||
// 获取账号信息
|
||||
async function getTbShopInfo() {
|
||||
const res = await tbShopInfo()
|
||||
$shop.value = res
|
||||
console.log(res);
|
||||
return res
|
||||
}
|
||||
|
||||
// 创建订单
|
||||
async function createOrder(par = {
|
||||
masterId: option.masterId,
|
||||
@@ -435,6 +465,13 @@
|
||||
}) {
|
||||
updateChoseCount()
|
||||
const res = await Api.$createOrder(par)
|
||||
console.log($shop.value);
|
||||
if($shop.value.registerType=='munchies'){
|
||||
//先付
|
||||
return go.to('PAGES_ORDER_DETAIL',{
|
||||
id:res.id
|
||||
})
|
||||
}
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'none'
|
||||
@@ -453,10 +490,36 @@
|
||||
if (opt) {
|
||||
table.value = {
|
||||
tableId: opt.tableId,
|
||||
name: opt.tableName
|
||||
name: opt.name
|
||||
}
|
||||
}
|
||||
getCart()
|
||||
getTbShopInfo()
|
||||
updateChoseCount()
|
||||
})
|
||||
|
||||
async function changeUseType() {
|
||||
const {
|
||||
registerType
|
||||
} = $shop.value
|
||||
//munchies 先付 restaurant 后付
|
||||
const isPayAfter = registerType == "munchies" ? false : true;
|
||||
let useType = "takeout";
|
||||
if (eatTypes.active == "takeout") {
|
||||
uni.setStorageSync("useType", "takeout");
|
||||
} else {
|
||||
//堂食
|
||||
useType = `dine-in-${isPayAfter? "after" : "before"}`;
|
||||
uni.setStorageSync("useType", useType);
|
||||
}
|
||||
const res = await Api.$changeUseType({
|
||||
useType,
|
||||
cartIds: goods.list.map((v) => v.id),
|
||||
})
|
||||
return res
|
||||
}
|
||||
watch(() => eatTypes.active, (newval) => {
|
||||
changeUseType()
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
|
||||
@@ -2,7 +2,18 @@
|
||||
<view class="u-wrap">
|
||||
|
||||
<view class="top bg-fff w-full">
|
||||
<view class="u-flex u-row-between choose-user" @tap="chooseUser">
|
||||
<view class="u-flex u-row-between choose-user" @tap="chooseTable">
|
||||
<view>
|
||||
<view v-if="!data.table.tableId">选择桌台</view>
|
||||
<view class="u-flex" v-else>
|
||||
<view class="u-m-l-20">{{data.table.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" size="20" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-between choose-user" @tap="chooseUser">
|
||||
<view>
|
||||
<view v-if="!data.vipUser.id">选择用户</view>
|
||||
<view class="u-flex" v-else>
|
||||
@@ -20,7 +31,7 @@
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" size="20" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="search u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
|
||||
@@ -86,6 +97,7 @@
|
||||
<script setup>
|
||||
import _ from 'lodash';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {$table} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
$tbShopCategory
|
||||
} from '@/http/yskApi/goods.js'
|
||||
@@ -107,12 +119,15 @@
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
nextTick
|
||||
nextTick,
|
||||
watch
|
||||
} from 'vue';
|
||||
import myCar from './components/car'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import {getNowCart} from '@/pagesCreateOrder/util.js'
|
||||
import {
|
||||
getNowCart
|
||||
} from '@/pagesCreateOrder/util.js'
|
||||
const cars = reactive([])
|
||||
const data = reactive({
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
@@ -294,16 +309,23 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//获取台桌信息
|
||||
async function getTableInfo(){
|
||||
const res=await $table.get({qrcode:data.table.tableId})
|
||||
console.log(res);
|
||||
if(res&&res.content[0]){
|
||||
// data.table=res.content[0]
|
||||
}
|
||||
}
|
||||
async function init() {
|
||||
getTableInfo()
|
||||
const {
|
||||
masterId
|
||||
} = await getMasterId()
|
||||
data.masterId = masterId
|
||||
const cartRes = await getCart()
|
||||
cars.length = 0
|
||||
const cartArr =getNowCart(cartRes.records)
|
||||
const cartArr = getNowCart(cartRes.records)
|
||||
for (let i in cartArr) {
|
||||
cars.push(cartArr[i])
|
||||
}
|
||||
@@ -351,13 +373,27 @@
|
||||
let searchValue = ref('')
|
||||
|
||||
function search() {
|
||||
|
||||
console.log(searchValue.value);
|
||||
console.log(data.tabbar );
|
||||
}
|
||||
|
||||
function chooseUser() {
|
||||
go.to('PAGES_CHOOSE_USER')
|
||||
}
|
||||
|
||||
function chooseTable() {
|
||||
go.to('PAGES_CHOOSE_TABLE', {
|
||||
...data.table
|
||||
})
|
||||
}
|
||||
|
||||
function watchChooseTable() {
|
||||
uni.$off('choose-table')
|
||||
uni.$on('choose-table', (tableData) => {
|
||||
data.table = tableData
|
||||
})
|
||||
}
|
||||
|
||||
function toLinshi() {
|
||||
go.to('PAGES_ADD_TEMP_CUISINE')
|
||||
}
|
||||
@@ -499,7 +535,7 @@
|
||||
prve[i] = matchArr
|
||||
.filter((v) => v.specSnap.match(i))
|
||||
.every((v) => {
|
||||
return util.isCanBuy(v)
|
||||
return !util.isCanBuy(v)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -801,9 +837,14 @@
|
||||
setUser()
|
||||
})
|
||||
}
|
||||
watch(()=>data.table.tableId,(newval)=>{
|
||||
console.log(newval);
|
||||
init()
|
||||
})
|
||||
onBeforeUnmount(() => {})
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
// watchChooseuser()
|
||||
watchChooseTable()
|
||||
})
|
||||
onLoad((opt) => {
|
||||
console.log(opt)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<view class="item u-m-b-20" v-for="(item,index) in order.info" :key="index">
|
||||
<view class="u-flex u-col-top">
|
||||
<view>
|
||||
<image class="img" :src="item.coverImg" mode=""></image>
|
||||
<image class="img" :src="item.coverImg||item.productImg" mode=""></image>
|
||||
</view>
|
||||
<view class="u-p-l-30 u-flex-1">
|
||||
<view class="u-flex u-row-between u-col-top">
|
||||
@@ -21,20 +21,27 @@
|
||||
<view class="tui" v-if="item.status=='return'">
|
||||
已退
|
||||
</view>
|
||||
<view :class="{'line-th':item.status=='return'}">{{item.name}}</view>
|
||||
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view>
|
||||
</view>
|
||||
<view class="u-text-right">
|
||||
<view>¥{{item.salePrice}}</view>
|
||||
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">¥{{item.salePrice}}</view>
|
||||
<view class="u-m-t-10 u-font-24">X{{item.number}}</view>
|
||||
<view>¥{{item.salePrice||item.price}}</view>
|
||||
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">¥{{item.salePrice||item.price}}</view>
|
||||
<view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
|
||||
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
|
||||
<my-button :width="168" :height="60" plain shape="circle" @tap="tuicai(item,index)">退菜</my-button>
|
||||
</view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
|
||||
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
|
||||
<my-button :width="168" :height="60" plain shape="circle" @tap="tuicai(item,index)">退菜</my-button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="orderInfo.status=='closed'">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
|
||||
<my-button :width="168" :height="60" plain shape="circle" @tap="tuikuan(item,index)">退款</my-button>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-gray u-p-20 u-m-t-20">
|
||||
@@ -45,9 +52,15 @@
|
||||
|
||||
<view class="u-m-t-40">
|
||||
<view class="u-flex u-row-between border-bottom u-p-b-20">
|
||||
<view class="tag no-pay">
|
||||
未支付
|
||||
<view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view class="tag no-pay">
|
||||
未支付
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<text>小计¥</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
@@ -73,11 +86,21 @@
|
||||
computed
|
||||
} from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
const emits=defineEmits(['tuicai'])
|
||||
const emits=defineEmits(['tuicai','tuikuan','printOrder'])
|
||||
function tuicai(item,index){
|
||||
emits('tuicai',item,index)
|
||||
}
|
||||
function tuikuan(item,index){
|
||||
emits('tuikuan',item,index)
|
||||
}
|
||||
function printOrder(){
|
||||
emits('printOrder')
|
||||
}
|
||||
const props = defineProps({
|
||||
orderInfo:{
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
@@ -90,7 +113,7 @@
|
||||
const allPrice = computed(() => {
|
||||
return props.data.reduce((prve, cur) => {
|
||||
const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{
|
||||
return a+b.salePrice * b.number
|
||||
return a+(b.salePrice||b.price) * (b.number||b.num)
|
||||
},0)
|
||||
return prve + curTotal
|
||||
}, 0).toFixed(2)
|
||||
@@ -100,15 +123,13 @@
|
||||
let result = 0
|
||||
result = props.data.reduce((a, b) => {
|
||||
const bTotal = b.info.reduce((prve, cur) => {
|
||||
return prve + cur.number * 1;
|
||||
return prve + (cur.number||cur.num) * 1;
|
||||
}, 0);
|
||||
return a + bTotal
|
||||
}, 0)
|
||||
return result
|
||||
})
|
||||
function printOrder(){
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>桌位号</view>
|
||||
<view>{{table.name}}</view>
|
||||
<view>{{table.name||data.tableName}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>就餐人数</view>
|
||||
<view>{{seatFee.totalNumber}}</view>
|
||||
<view>{{seatFee.number||''}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>支付方式</view>
|
||||
<view></view>
|
||||
<view>{{data.payType||''}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>预约时间</view>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<template>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<up-steps :dot="true" current="0" direction="column">
|
||||
<my-step :list="recoders.list"></my-step>
|
||||
<!-- <up-steps :dot="true" current="0" direction="column">
|
||||
<up-steps-item title="2024-09-02 09:19" :itemStyle="itemStyle" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
|
||||
</up-steps-item>
|
||||
<up-steps-item title="2024-09-02 09:19" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
|
||||
</up-steps-item>
|
||||
</up-steps>
|
||||
</up-steps> -->
|
||||
|
||||
</view>
|
||||
|
||||
@@ -19,7 +20,14 @@
|
||||
const itemStyle = reactive({
|
||||
color: 'rgb(255,0,0)'
|
||||
})
|
||||
|
||||
const recoders = reactive({
|
||||
list:[
|
||||
{title:'2024-09-15 11:20:30',content:'[东风(id:124413)]使用代客下单提交。(未打印预结单)'},
|
||||
{title:'2024-09-15 ',content:'[东风(id:124413)]使用代客下单提交。(未打印预结单)'},
|
||||
{title:'2024-09-15 ',content:'[东风(id:124413)]使用代客下单提交。(未打印预结单)'}
|
||||
],
|
||||
active:0
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<view class="u-font-28 default-box-padding u-relative bg-fff border-r-12 u-overflow-hide">
|
||||
<view class="change u-absolute my-bg-main color-fff left-top" >切换</view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view class="change u-absolute my-bg-main color-fff left-top" @click="chooseUser">切换</view>
|
||||
</template>
|
||||
<view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20">
|
||||
<view class="u-flex">
|
||||
<up-avatar :size="30"></up-avatar>
|
||||
@@ -27,14 +29,28 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script setup>
|
||||
import go from '@/commons/utils/go.js'
|
||||
const props = defineProps({
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
user: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
|
||||
function chooseUser() {
|
||||
go.to('PAGES_CHOOSE_USER')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.change{
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 0 0 16rpx 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.change {
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 0 0 16rpx 0;
|
||||
z-index: 2;
|
||||
}
|
||||
</style>
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<view class="min-page bg-gray u-font-28 u-p-30">
|
||||
<user-vue></user-vue>
|
||||
<user-vue :orderInfo="orderDetail.info"></user-vue>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<text class="color-666">桌位号:</text>
|
||||
<text class="font-bold">{{options.name}}</text>
|
||||
<text class="font-bold">{{orderDetail.info.tableName}}</text>
|
||||
</view>
|
||||
<goods-list :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount"
|
||||
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info" :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount"
|
||||
@tuicai="onTuiCai"></goods-list>
|
||||
<extra-vue :data="orderDetail.seatFee"></extra-vue>
|
||||
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
|
||||
@@ -23,7 +23,7 @@
|
||||
type="primary">结账</my-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
<script setup>
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import * as orderApi from '@/http/yskApi/order.js'
|
||||
import {
|
||||
objToArrary
|
||||
} from '@/commons/utils/returrn-data.js'
|
||||
import userVue from './components/user.vue';
|
||||
import orderVue from './components/order.vue';
|
||||
import goodsList from './components/list.vue';
|
||||
@@ -41,13 +44,14 @@
|
||||
import extraVue from './components/extra.vue';
|
||||
import tuicaiVue from './components/tuicai.vue';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive
|
||||
reactive, ref
|
||||
} from 'vue';
|
||||
import OrderDetail from './page.js'
|
||||
const tuicai = reactive({
|
||||
@@ -56,16 +60,47 @@
|
||||
})
|
||||
|
||||
function onTuiCai(goods, index) {
|
||||
console.log(goods);
|
||||
tuicai.show = true
|
||||
tuicai.selGoods = goods
|
||||
}
|
||||
async function printDishes(){
|
||||
try{
|
||||
const res= await Api.$printDishes({
|
||||
tableId:orderDetail.info.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
}
|
||||
function onPrintOrder(){
|
||||
uni.showModal({
|
||||
title:'提示',
|
||||
content:'是否打印当前台桌菜品',
|
||||
success(res) {
|
||||
if(res.confirm){
|
||||
printDishes()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function onTuikuan(goods, index){
|
||||
go.to('PAGES_ORDER_TUIKUAN',{
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async function tuicaiConfirm() {
|
||||
const res=await Api.$returnCart({
|
||||
cartId: tuicai.selGoods.id,
|
||||
tableId:options.tableId,
|
||||
console.log(tuicai.selGoods);
|
||||
const res = await Api.$returnCart({
|
||||
cartId:tuicai.selGoods.hasOwnProperty('cartId')? tuicai.selGoods.cartId:tuicai.selGoods.id,
|
||||
tableId: orderDetail.info.tableId,
|
||||
})
|
||||
tuicai.selGoods.status='return'
|
||||
tuicai.selGoods.status = 'return'
|
||||
tuicai.show = false
|
||||
}
|
||||
const uiPage = new OrderDetail()
|
||||
@@ -84,7 +119,7 @@
|
||||
}
|
||||
|
||||
function toPay() {
|
||||
go.to('PAGES_CRESATE_ORDER_PAY', {
|
||||
go.to('PAGES_ORDER_PAY', {
|
||||
tableId: options.tableId,
|
||||
tableName: options.name,
|
||||
masterId: options.masterId,
|
||||
@@ -102,22 +137,51 @@
|
||||
})
|
||||
const options = reactive({})
|
||||
async function init() {
|
||||
const res= await orderApi.tbOrderInfoDetail(options.id)
|
||||
const masterId=res.masterId
|
||||
const res = await orderApi.tbOrderInfoDetail(options.id)
|
||||
if(res.detailList.length){
|
||||
uni.setStorageSync('useType',res.detailList[0].useType)
|
||||
}
|
||||
const masterId = res.masterId
|
||||
options.masterId = res.masterId
|
||||
if(res.status=='unpaid'){
|
||||
if (res.status == 'unpaid') {
|
||||
// if (false) {
|
||||
const {
|
||||
records,
|
||||
seatFee
|
||||
} = await Api.getCart({
|
||||
masterId,
|
||||
tableId:res.tableId
|
||||
tableId: res.tableId,
|
||||
page: 1,
|
||||
size: 200
|
||||
})
|
||||
orderDetail.goodsList = records
|
||||
orderDetail.seatFee = seatFee
|
||||
}else{
|
||||
orderDetail.goodsList = res.detailList
|
||||
orderDetail.seatFee = seatFee ? seatFee : orderDetail.seatFee
|
||||
} else {
|
||||
const goodsMap = {}
|
||||
for (let i in res.detailList) {
|
||||
const goods = res.detailList[i]
|
||||
if (goods.productName != '客座费') {
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum].push(goods)
|
||||
} else {
|
||||
goodsMap[goods.placeNum] = [goods]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
orderDetail.seatFee = {
|
||||
name: '餐位费',
|
||||
number: res.seatCount,
|
||||
totalNumber: res.seatCount,
|
||||
totalAmount: res.seatAmount
|
||||
}
|
||||
orderDetail.goodsList = Object.entries(goodsMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
placeNum: key
|
||||
}))
|
||||
console.log(orderDetail.goodsList);
|
||||
}
|
||||
console.log(orderDetail);
|
||||
orderDetail.info = res
|
||||
}
|
||||
|
||||
@@ -128,8 +192,32 @@
|
||||
init()
|
||||
})
|
||||
}
|
||||
|
||||
// 监听选择用户事件
|
||||
let user = ref(null)
|
||||
//更新选择用户
|
||||
function setUser(par) {
|
||||
const submitPar = {
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
vipUserId: user.value.id ? user.value.id : '',
|
||||
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
||||
}
|
||||
Object.assign(submitPar, par)
|
||||
return Api.$setUser(submitPar)
|
||||
}
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
console.log(data);
|
||||
user.value = data
|
||||
setUser()
|
||||
})
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
watchChooseuser()
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<view class="u-m-l-16">{{formatTime(data.createdAt)}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-font-32">1种商品,共1件</view>
|
||||
<view class="u-font-32">{{goosZhonglei}}种商品,共{{goodsNumber}}件</view>
|
||||
<view class="border-bottom u-p-b-32">
|
||||
<view class="u-flex u-row-between u-m-t-24" v-for="(item,index) in data.detailList" :key="index">
|
||||
<view>
|
||||
@@ -32,12 +32,12 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view>×1</view>
|
||||
<view class="u-m-l-24">¥15.00</view>
|
||||
<view>×{{item.num}}</view>
|
||||
<view class="u-m-l-24">¥{{item.price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="u-flex u-row-between border-bottom u-m-t-32 u-p-b-32">
|
||||
<view>订单备注</view>
|
||||
@@ -49,7 +49,7 @@
|
||||
<text class="font-bold u-font-32">{{data.orderAmount}}</text>
|
||||
</view>
|
||||
<view class="u-flex u-row-right u-m-t-24">
|
||||
<view class="print">重新打印</view>
|
||||
<view class="print" @click.stop="print(item)">重新打印</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -60,19 +60,51 @@
|
||||
import dayjs from 'dayjs';
|
||||
import orderEnum from '@/commons/orderEnum.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
const emits=defineEmits(['printOrder'])
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
default: () => {
|
||||
detailList: []
|
||||
}
|
||||
},
|
||||
index: {
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
function formatTime(time){
|
||||
let $goodsMap = {}
|
||||
let goosZhonglei =ref(0)
|
||||
let goodsNumber = ref(0)
|
||||
function goodsMapInit(){
|
||||
for (let i in props.data.detailList) {
|
||||
const goods = props.data.detailList[i]
|
||||
if ($goodsMap.hasOwnProperty(goods.productId)) {
|
||||
$goodsMap[goods.productId] += goods.num*1
|
||||
goodsNumber.value+=goods.num*1
|
||||
} else {
|
||||
$goodsMap[goods.productId] = goods.num*1
|
||||
goosZhonglei.value+=1
|
||||
goodsNumber.value+=goods.num*1
|
||||
}
|
||||
}
|
||||
}
|
||||
goodsMapInit()
|
||||
watch(() => props.data.detailList, (newval) => {
|
||||
goodsMapInit()
|
||||
})
|
||||
|
||||
|
||||
function formatTime(time) {
|
||||
return dayjs(time).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
function returnStatus(status) {
|
||||
const item = orderEnum.status.find(v => v.key == status)
|
||||
return item ? item.label : ''
|
||||
@@ -85,11 +117,15 @@
|
||||
return t;
|
||||
}
|
||||
}
|
||||
function toDetail(){
|
||||
go.to('PAGES_ORDER_DETAIL',{
|
||||
id:props.data.id
|
||||
|
||||
function toDetail() {
|
||||
go.to('PAGES_ORDER_DETAIL', {
|
||||
id: props.data.id
|
||||
})
|
||||
}
|
||||
function print(item) {
|
||||
emits('printOrder',props.data)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -110,10 +146,11 @@
|
||||
.unpaid {
|
||||
color: #FD7B49;
|
||||
}
|
||||
.print{
|
||||
|
||||
.print {
|
||||
padding: 6rpx 14rpx 8rpx 18rpx;
|
||||
border:1px solid $my-main-color;
|
||||
color:$my-main-color;
|
||||
border: 1px solid $my-main-color;
|
||||
color: $my-main-color;
|
||||
font-size: 24rpx;
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="list">
|
||||
<view v-for="(item,index) in list" :key="index">
|
||||
<order-item :data="item" :index="index"></order-item>
|
||||
<order-item @printOrder="print" :data="item" :index="index"></order-item>
|
||||
</view>
|
||||
<view v-if="hasAjax&&!list.length">
|
||||
<my-img-empty tips="亲,你还没有订单哦~"></my-img-empty>
|
||||
@@ -21,7 +21,10 @@
|
||||
default:false
|
||||
}
|
||||
})
|
||||
|
||||
const emits=defineEmits(['printOrder'])
|
||||
function print(item) {
|
||||
emits('printOrder',item)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -6,14 +6,18 @@
|
||||
</view>
|
||||
<filter-vue v-model:time="pageData.order.query.createdAt"></filter-vue>
|
||||
</view>
|
||||
<order-list :hasAjax="pageData.order.hasAjax" :list="pageData.order.list"></order-list>
|
||||
<order-list @printOrder="onPrintOrder" :hasAjax="pageData.order.hasAjax" :list="pageData.order.list"></order-list>
|
||||
<my-pagination :totalElements="pageData.order.totalElements"></my-pagination>
|
||||
<view style="height: 100rpx;"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as Api from '@/http/yskApi/order.js'
|
||||
import {$printOrder} from '@/http/yskApi/Instead.js'
|
||||
import filterVue from './compoents/filter.vue';
|
||||
import orderList from './compoents/order-list.vue';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {
|
||||
reactive, watch
|
||||
} from 'vue';
|
||||
@@ -28,10 +32,11 @@
|
||||
textAlign: 'right'
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const pageData = reactive({
|
||||
order: {
|
||||
list: [],
|
||||
totalElements:0,
|
||||
hasAjax:false,
|
||||
query: {
|
||||
createdAt: [],
|
||||
@@ -50,12 +55,40 @@
|
||||
init()
|
||||
})
|
||||
async function init() {
|
||||
const {content}=await Api.tbOrderInfoData(pageData.order.query)
|
||||
const {content,totalElements}=await Api.tbOrderInfoData(pageData.order.query)
|
||||
pageData.order.hasAjax=true
|
||||
pageData.order.totalElements=totalElements
|
||||
pageData.order.list=content
|
||||
console.log(content);
|
||||
}
|
||||
init()
|
||||
|
||||
async function printOrder(item){
|
||||
try{
|
||||
console.log(item);
|
||||
const res= await $printOrder({
|
||||
tableId:item.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
}
|
||||
function onPrintOrder(e){
|
||||
console.log(e);
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否打印该订单',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
printOrder(e)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
320
pagesOrder/pay-order/pay-order.vue
Normal file
320
pagesOrder/pay-order/pay-order.vue
Normal file
@@ -0,0 +1,320 @@
|
||||
<template>
|
||||
<view class="bg-gray min-page u-p-30 u-font-28">
|
||||
<view class="u-p-t-60 u-p-b-60 u-text-center">
|
||||
<view class="u-font-32 ">
|
||||
<text class="price-fuhao">¥</text>
|
||||
<text class="font-bold price">{{discount.currentPrice?discount.currentPrice:order.amount}}</text>
|
||||
</view>
|
||||
<view class="u-m-t-10 color-999 old-price">
|
||||
<text class="">¥</text>
|
||||
<text class=" ">{{order.amount}}</text>
|
||||
</view>
|
||||
<view class="u-m-t-10 u-flex u-row-center color-main">
|
||||
<view @click="showModel('editMoney',true)">修改</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content bg-fff box-shadow border-r-12">
|
||||
<view class=" u-p-t-30 u-p-l-26 u-p-r-26 card top u-m-t-30">
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 border-bottom-dashed u-row-between u-p-b-30">
|
||||
<view>优惠券</view>
|
||||
<view class="color-999 u-flex u-col-center">
|
||||
<text>选择优惠券</text>
|
||||
<view class="u-flex u-col-center">
|
||||
<uni-icons type="right" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-p-l-24 u-p-r-24 border-bottom u-row-between u-p-t-30 u-p-b-30"
|
||||
v-if="discount.price&&discount.currentPrice!=order.amount">
|
||||
<view>服务员改价</view>
|
||||
<view class=" u-flex u-col-center">
|
||||
<text style="color: rgb(255, 95, 46);">-¥{{order.amount- discount.currentPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff border-r-12 ">
|
||||
<view class="u-p-t-30 u-p-l-50 u-p-r-50 card bottom">
|
||||
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
||||
<template v-if="pays.selIndex==0">
|
||||
<view class="list">
|
||||
<view class="item" @click="changePayType(index)" v-for="(item,index) in pays.payTypes.list"
|
||||
:key="index">
|
||||
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
||||
<view class="u-flex">
|
||||
<image class="icon" :src="item.icon" mode=""></image>
|
||||
<text class="u-m-l-10">{{item.payName}}</text>
|
||||
</view>
|
||||
<view class="u-flex color-999 u-font-24">
|
||||
<!-- <view class="u-m-r-20">
|
||||
<text>余额:</text>
|
||||
<text>¥0.00</text>
|
||||
</view> -->
|
||||
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
|
||||
</my-radio>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-60 u-p-b-30">
|
||||
<my-button @click="payOrder">确认付款</my-button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="">
|
||||
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
|
||||
<view class="u-flex u-row-center u-m-t-40 ">
|
||||
<up-qrcode :size="140" val="uview-plus"></up-qrcode>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<!-- 二维码支付扫码 -->
|
||||
<template v-if="pays.selIndex==1">
|
||||
<view class="card border-bottom top u-m-t-32">
|
||||
|
||||
</view>
|
||||
<view class="bg-fff card bottom border-r-12 u-p-32">
|
||||
<view class="font-bold u-font-32 u-text-center">
|
||||
¥{{discount.currentPrice?discount.currentPrice: order.amount}}</view>
|
||||
<view class="u-flex u-row-center u-m-t-24">
|
||||
<up-loading-icon size="14" text="等待支付"></up-loading-icon>
|
||||
<view class="u-flex pay-success">
|
||||
<up-icon color="#5CBB6F" name="checkmark-circle-fill"></up-icon>
|
||||
<view class="u-m-l-6">支付成功</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
||||
:price="order.amount"></edit-discount>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
onMounted,
|
||||
watch,
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import * as orderApi from '@/http/yskApi/order.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
|
||||
let payStatus = ref(null) //loading success
|
||||
|
||||
|
||||
const pays = reactive({
|
||||
list: ['扫码收款', '二维码收款'],
|
||||
selIndex: 0,
|
||||
payTypes: {
|
||||
list: [],
|
||||
selIndex: 0
|
||||
}
|
||||
})
|
||||
|
||||
const models = new Map();
|
||||
|
||||
function setModel(el) {
|
||||
if (el && el.$attrs['name']) {
|
||||
models.set(el.$attrs['name'], el);
|
||||
}
|
||||
}
|
||||
|
||||
function showModel(key) {
|
||||
const model = models.get(key)
|
||||
model && model.open()
|
||||
}
|
||||
|
||||
//打折相关数据
|
||||
const discount = reactive({
|
||||
|
||||
})
|
||||
|
||||
function editDiscountConfirm(form) {
|
||||
console.log(form);
|
||||
Object.assign(discount, form)
|
||||
}
|
||||
async function getPayType() {
|
||||
const payTypeList = await Api.$getPayType()
|
||||
pays.payTypes.list = payTypeList
|
||||
}
|
||||
|
||||
function changePayType(i) {
|
||||
pays.payTypes.selIndex = i
|
||||
}
|
||||
//支付成功回调
|
||||
function paySuccess() {
|
||||
infoBox.showToast('支付成功')
|
||||
setTimeout(() => {
|
||||
// uni.$emit('orderDetail:update')
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
async function payOrder() {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
await Api.$payOrder({
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id || order.orderId,
|
||||
payType,
|
||||
vipUserId: order.userId,
|
||||
discount: 1,
|
||||
code: ''
|
||||
})
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getPayType()
|
||||
})
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
})
|
||||
|
||||
function saomaPay() {
|
||||
const item = pays.payTypes.list[pays.payTypes.selIndex]
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
success: function(res) {
|
||||
console.log('条码类型:' + res.scanType);
|
||||
console.log('条码内容:' + res.result);
|
||||
Api.$payOrder({
|
||||
"orderId": order.orderId, // 订单id
|
||||
"payType": item.payType, //
|
||||
"discount": order.discount,
|
||||
"code": res.result
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
paySuccess()
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
watch(() => pays.payTypes.selIndex, (newval) => {
|
||||
const item = pays.payTypes.list[newval]
|
||||
if (item.payType == "vipPay") {
|
||||
return
|
||||
}
|
||||
if (item.payType == "deposit") {
|
||||
//储值卡支付
|
||||
return saomaPay('deposit')
|
||||
}
|
||||
if (item.payType == "scanCode") {
|
||||
//扫码支付
|
||||
return saomaPay('scanCode')
|
||||
}
|
||||
})
|
||||
async function init() {
|
||||
const res = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||
Object.assign(order, res)
|
||||
}
|
||||
onLoad((opt) => {
|
||||
Object.assign(order, opt)
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box-shadow {
|
||||
box-shadow: 0 0 5px #E5E5E5;
|
||||
}
|
||||
|
||||
.pay-success {
|
||||
color: #5CBB6F;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.border-bottom-dashed {
|
||||
border-bottom: 1px dashed #bbb;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-color: rgb(240, 240, 240);
|
||||
}
|
||||
|
||||
.list {
|
||||
.item:last-child {
|
||||
.border-bottom {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.old-price {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.price-fuhao {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
$dotSize: 20rpx;
|
||||
$position: calc($dotSize / (-2));
|
||||
|
||||
.card {
|
||||
position: relative;
|
||||
|
||||
&::after,
|
||||
&:before {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
background-color: #F9F9F9;
|
||||
width: $dotSize;
|
||||
height: $dotSize;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
&.top {
|
||||
&::after {
|
||||
right: $position;
|
||||
bottom: $position;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: $position;
|
||||
bottom: $position;
|
||||
}
|
||||
}
|
||||
|
||||
&.bottom {
|
||||
&::after {
|
||||
right: $position;
|
||||
top: $position;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: $position;
|
||||
top: $position;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
22
pagesOrder/tuikuan/tuikuan.vue
Normal file
22
pagesOrder/tuikuan/tuikuan.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user