This commit is contained in:
GaoHao 2024-09-28 15:35:14 +08:00
commit 530ce34194
58 changed files with 4460 additions and 885 deletions

45
commons/class/list.js Normal file
View File

@ -0,0 +1,45 @@
import {
reactive, ref
} from 'vue';
function isSameType(a, b) {
return a instanceof b === true || b instanceof a === true;
}
class LIST{
constructor(data) {
this.data=reactive({
page:0,
totalPage:0,
total:0,
list:[],
hasAjax:false,
status:'',//loading fail success
query:{
}
})
Object.assign(this.data, data)
}
add(item){
this.data.list.push(item)
}
del(index){
this.data.list.splice(index,1)
}
update(index,item){
this.data.list[index]=item
}
get(index){
return this.data.list[index]
}
getVal(key){
return this.data[key]
}
setVal(key,val){
this.data[key]=val
if(key=='page'){
this.data['page']=val
}
}
}
export default LIST

View File

@ -329,7 +329,9 @@ text {
flex-direction: column; flex-direction: column;
background: #F9F9F9; background: #F9F9F9;
} }
.box-shadow{
box-shadow: 0 0 5px #eee;
}
.safe-bottom{ .safe-bottom{
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
/* #ifdef H5 */ /* #ifdef H5 */

View File

@ -79,7 +79,27 @@ const model = {
return appCache.shopId return appCache.shopId
} }
}, },
// 获取和放置useType就餐类型
useType: (val, isDelete = false) => {
if (isDelete) {
appCache.useType = ""
return uni.removeStorageSync('useType')
}
if (val) {
// 有值,为放置
appCache.useType = val
uni.setStorageSync('useType', val)
} else {
// 否则为获取
if (!appCache.useType) {
//缓存取不到,获取应用本地信息
appCache.useType = uni.getStorageSync('useType')
}
return appCache.useType
}
},
// 已经登录的用户记录 // 已经登录的用户记录
loggedInUser: (addUserName = null, removeUserName = null) => { loggedInUser: (addUserName = null, removeUserName = null) => {
let key = "loggedInUserList" let key = "loggedInUserList"

View File

@ -105,7 +105,7 @@ import { computed } from 'vue';
margin: auto; margin: auto;
} }
.shadow{ .shadow{
box-shadow: 0 0 10px #999; box-shadow: 0 0 10px #aaa;
} }
.btn { .btn {
font-size: 28rpx; font-size: 28rpx;

View File

@ -1,10 +1,11 @@
<template> <template>
<view class="my-radio u-font-28 u-flex color-333" @tap.stop="changeVal" > <view class="my-radio u-font-28 u-flex color-333" @tap.stop="changeVal">
<view class="circle u-flex u-row-center" :style="computedStyle()" :class="{active:modelValue,square:shape==='square'}"> <view class="circle u-flex u-row-center" :style="computedStyle()"
:class="{active:modelValue,square:shape==='square'}">
<uni-icons type="checkmarkempty" v-if="modelValue" :size="size-4" color="#fff"></uni-icons> <uni-icons type="checkmarkempty" v-if="modelValue" :size="size-4" color="#fff"></uni-icons>
</view> </view>
<view class="u-m-l-12"> <view class="u-m-l-12">
{{text}} <slot>{{text}}</slot>
</view> </view>
</view> </view>
</template> </template>
@ -14,11 +15,11 @@
} from 'vue' } from 'vue'
import color from '@/commons/color.js' import color from '@/commons/color.js'
const props = defineProps({ const props = defineProps({
disabled:{ disabled: {
type: [Boolean], type: [Boolean],
default: false default: false
}, },
borderColor:{ borderColor: {
type: String, type: String,
default: '#bbb', default: '#bbb',
}, },
@ -29,10 +30,10 @@
}, },
// v-modal // v-modal
modelValue: { modelValue: {
type: [Number,Boolean], type: [Number, Boolean],
default: false, default: false,
}, },
shape:{ shape: {
//circle square //circle square
type: String, type: String,
default: 'circle', default: 'circle',
@ -52,18 +53,19 @@
` `
} }
const emits = defineEmits(['update:modelValue', 'change']) const emits = defineEmits(['update:modelValue', 'change'])
function changeVal() { function changeVal() {
if(props.disabled){ if (props.disabled) {
return return
} }
emits('click') emits('click')
let currentVal=props.modelValue let currentVal = props.modelValue
let type=typeof currentVal let type = typeof currentVal
if(type==='number'){ if (type === 'number') {
currentVal=currentVal===0?1:0 currentVal = currentVal === 0 ? 1 : 0
} }
if(type==='boolean'){ if (type === 'boolean') {
currentVal=!currentVal currentVal = !currentVal
} }
emits('update:modelValue', currentVal) emits('update:modelValue', currentVal)
emits('change', currentVal) emits('change', currentVal)
@ -84,7 +86,8 @@
border: 1px solid #707070; border: 1px solid #707070;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
&.square{
&.square {
border-radius: 8rpx; border-radius: 8rpx;
} }
} }

View File

@ -6,7 +6,7 @@
<view class="left-line" :class="{hide:index==list.length-1}"></view> <view class="left-line" :class="{hide:index==list.length-1}"></view>
</view> </view>
<view class="u-p-l-12 "> <view class="u-p-l-12 ">
<view class="u-font-20">{{item[titleKey]||''}}</view> <view class="u-font-20">{{formatTitle(item[titleKey]||'') }}</view>
<view class="u-font-24 u-m-t-2">{{item[contentKey]||''}}</view> <view class="u-font-24 u-m-t-2">{{item[contentKey]||''}}</view>
</view> </view>
</view> </view>
@ -14,6 +14,7 @@
</template> </template>
<script setup> <script setup>
import dayjs from 'dayjs';
const props = defineProps({ const props = defineProps({
active: { active: {
type: [String, Number], type: [String, Number],
@ -32,6 +33,10 @@
default: 'content' default: 'content'
} }
}) })
function formatTitle(time){
return dayjs(time).format('YYYY-M-D HH:MM:ss')
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,69 +1,103 @@
<template> <template>
<up-upload :fileList="images" @afterRead="afterRead" @delete="deletePic" :multiple="multiple" <up-upload :fileList="images" @afterRead="afterRead" @delete="deletePic" :multiple="multiple" :width="width"
:width="width" :height="height" :height="height" :maxCount="maxCount"></up-upload>
:maxCount="10"></up-upload>
</template> </template>
<script setup> <script setup>
import {$uploadFile} from '@/http/yskApi/file.js'
import { import {
ref, watch $uploadFile
} from '@/http/yskApi/file.js'
import {
ref,
watch
} from 'vue'; } from 'vue';
const props=defineProps({ const props = defineProps({
modelValue:{ modelValue: {
type:Array, type: Array,
default:()=>[] default: () => []
}, },
width:{ width: {
type:[String,Number], type: [String, Number],
default:60 default: 60
}, },
height:{ height: {
type:[String,Number], type: [String, Number],
default:60 default: 60
}, },
multiple:{ maxCount: {
type:Boolean, type: [Number],
default:true default: 10
},
multiple: {
type: Boolean,
default: true
} }
}) })
const emits=defineEmits(['update:modelValue']) const emits = defineEmits(['update:modelValue'])
const images = ref(props.modelValue) const images = ref(props.modelValue)
function afterRead(e){
for(let i in e.file){ function afterRead(e) {
const file=e.file[i].file console.log(e);
if (Array.isArray(e)) {
for (let i in e.file) {
const file = e.file[i].file
$uploadFile(file).then(res => { $uploadFile(file).then(res => {
console.log(res); console.log(res);
images.value.push({ images.value.push({
url: e.file[i].url, url: e.file[i].url,
serveUrl: res.data[0] serveUrl: res.data[0]
}) })
}).catch(res=>{ }).catch(res => {
console.log(res); console.log(res);
if(res.errMsg){ if (res.errMsg) {
images.value.splice(i,1) images.value.splice(i, 1)
uni.showToast({ uni.showToast({
title:'图片大小超出限制', title: '图片大小超出限制',
icon:'error' icon: 'error'
}) })
} }
}) })
} }
} }else{
function deletePic(e){ const i=0
const {index}=e const file = e.file.file
images.value.splice(index,1) $uploadFile(file).then(res => {
console.log(res);
images.value.push({
url: e.file.url,
serveUrl: res.data[0]
})
}).catch(res => {
console.log(res);
if (res.errMsg) {
images.value.splice(i, 1)
uni.showToast({
title: '图片大小超出限制',
icon: 'error'
})
} }
watch(()=>images.value,(newval)=>{
emits('update:modelValue',newval)
}) })
watch(()=>props.modelValue,(newval)=>{ }
images.value=newval
}
function deletePic(e) {
const {
index
} = e
images.value.splice(index, 1)
}
watch(() => images.value, (newval) => {
emits('update:modelValue', newval)
})
watch(() => props.modelValue, (newval) => {
images.value = newval
}) })
</script> </script>

View File

@ -47,7 +47,7 @@ export function gettbConsInfo(params) {
// params // params
// }); // });
return request({ return request({
url: "/api/viewConInfoFlow", url: "/api/tbConsInfo",
method: "get", method: "get",
params: { params: {
...params, ...params,

View File

@ -133,4 +133,8 @@ export function $tbProskuConV2(data) {
export function $updateProductData(data) { export function $updateProductData(data) {
return http.req('/api/stock/updateProductData', data, 'POST') return http.req('/api/stock/updateProductData', data, 'POST')
} }
/* 商品报损 */
export function $frmLoss(data) {
return http.req('/api/tbProductStockDetail/frmLoss', {...data,shopId:uni.getStorageSync('shopId')}, 'POST')
}
// v2 api end // v2 api end

View File

@ -15,7 +15,12 @@ import {
} from '@/commons/utils/encryptUtil.js' } from '@/commons/utils/encryptUtil.js'
import infoBox from "@/commons/utils/infoBox.js" import infoBox from "@/commons/utils/infoBox.js"
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
// 测试服
let baseUrl = 'https://admintestpapi.sxczgkj.cn' let baseUrl = 'https://admintestpapi.sxczgkj.cn'
// 王伟本地测
// let baseUrl = '/ww'
// let baseUrl = 'http://192.168.1.15:8000'
// 多少 ms 以内, 不提示loading // 多少 ms 以内, 不提示loading
const loadingShowTime = 200 const loadingShowTime = 200

View File

@ -1,5 +1,5 @@
import http from './http.js' import http from './http.js'
const request=http.request const request = http.request
/** /**
* 查询订单 * 查询订单
@ -91,3 +91,18 @@ export function returnGpOrder(data) {
data data
}); });
} }
/**
* 店铺订单支付获取链接
*/
export function $getOrderPayUrl(data) {
return request({
url: `/api/shopPayApi/getOrderPayUrl`,
method: "get",
data: {
shopId: uni.getStorageSync('shopId'),
...data
}
});
}

View File

@ -223,6 +223,15 @@
"pathRewrite" : { "pathRewrite" : {
"/ysk" : "" "/ysk" : ""
} }
},
"/ww" : {
//
"target" : "http://192.168.1.15:8000",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"/ww" : ""
}
} }
} }
} }

View File

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@ -0,0 +1,106 @@
<template>
<up-picker :show="show" keyName="name" @confirm="confirm" :columns="category.list" @close="close" @cancel="close" :closeOnClickOverlay="true"></up-picker>
</template>
<script setup>
import {
ref, warn, watch, watchEffect,
onMounted,reactive
} from 'vue';
import {$tbShopCategory} from '@/http/yskApi/goods.js'
const emite=defineEmits(['change','update:isShow','confirm'])
const props = defineProps({
showAllText:{
type:Boolean,
default:true
},
width: {
type: [Number, String],
default: 264
},
height: {
type: [Number, String],
default: 420
},
right: {
type: [Number, String],
default: 30
},
bottom: {
type: [Number, String],
default: 0
},
isShow:{
type:Boolean,
default:false
}
})
let show = ref(props.isShow)
watch(()=>show.value,(newval)=>{
emite('change',newval)
emite('update:isShow',newval)
})
watch(()=>props.isShow,(newval)=>{
console.log(newval);
show.value=newval
})
function confirm(e){
console.log(e.value[0]);
show.value = false
emite('confirm',e.value[0])
}
function close() {
console.log('close');
show.value = false
}
const category=reactive({
list:[],
})
onMounted(()=>{
$tbShopCategory({
page:0,size:200
}).then(res=>{
res.content.unshift({
name:'全部',
id:'',
childrenList:[]
})
category.list=[res.content.reduce((prve, cur) => {
prve.push(...[{
...cur,
name: '' + cur.name,
childrenList:undefined
}, ...cur.childrenList.map(v => {
return {
...v,
name: '' + v.name
}
})])
return prve
}, [])]
console.log(category.list);
})
})
</script>
<style lang="scss" scoped>
.category {
background: #FFFFFF;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
border-radius: 14rpx 14rpx 14rpx 14rpx;
position: fixed;
font-size: 24rpx;
color: #333;
.list{
box-sizing: border-box;
.item{
padding: 24rpx 24rpx 24rpx 48rpx;
}
}
}
</style>

View File

@ -0,0 +1,166 @@
<template>
<view class="control" :style="getComputedStyle()">
<view class="u-flex control1" v-if="showControl1">
<view class="btn" @click="changeShowControl1">批量管理</view>
<view class="btn" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view>
<!-- <view class="color-999 btn u-flex u-row-center" @click="emitToggleCategory">
<text class="u-m-r-10">{{categoryName||'选择分类'}}</text>
<view class="arrow-down" :class="{'up':categoryShow}">
<uni-icons type="right" size="16" color="#999"></uni-icons>
</view>
</view> -->
</view>
<view class="u-flex control2 u-row-between" v-else>
<view class="u-flex u-flex-1 btn " @click="changeIsSelectAll">
<view class="u-m-l-28">
<my-radio v-model="isSelectAll" >
<view class="color-fff">全选</view>
</my-radio>
</view>
<!-- <label class="radio u-m-l-28" >
<radio class="scale7" @tap.stop="changeIsSelectAll" :color="ColorMain" value="" :checked="isSelectAll" />
<text>全选</text>
</label> -->
</view>
<view class=" btn u-flex-1 my-bg-main" @click="changeShowControl1">取消</view>
</view>
</view>
</template>
<script setup>
import {$tbShopCategory} from '@/http/yskApi/goods.js'
import go from '@/commons/utils/go.js';
import {ColorMain} from '@/commons/color.js'
import {
onMounted,
reactive,
ref
} from 'vue';
const props = defineProps({
bottom: {
type: [Number, String],
default: 30
},
categoryName:{
type:String,
default:''
},
categoryShow:{
type:Boolean,
default:false
}
})
let showControl1 = ref(true)
const emits = defineEmits(['toggleCategory','controlChange','allCheckedChange','offShelf','categoryChange'])
function emitToggleCategory() {
emits('toggleCategory')
}
function changeShowControl1() {
showControl1.value = !showControl1.value
if(!showControl1.value){
isSelectAll.value=false
}
emits('controlChange',!showControl1.value)
}
let isSelectAll = ref(false)
function changeIsSelectAll() {
console.log('changeIsSelectAll');
isSelectAll.value = !isSelectAll.value
emits('allCheckedChange',isSelectAll.value)
}
function getComputedStyle() {
return {
bottom: props.bottom + 'rpx'
}
}
//
function setisSelectAll(checked){
isSelectAll.value =checked
}
defineExpose({
setisSelectAll
})
//
function offShelf(){
emits('offShelf')
}
</script>
<style lang="scss" scoped>
.scale7 {
transform: scale(0.7);
}
.borde-r {
position: relative;
&::after {
display: block;
content: '';
position: absolute;
top: 20rpx;
bottom: 20rpx;
width: 2px;
background-color: #fff;
right: 0;
}
}
.control {
position: fixed;
left: 110rpx;
right: 110rpx;
z-index: 100;
background: #3E3A3A;
border-radius: 100rpx;
overflow: hidden;
.btn{
color: #fff;
box-sizing: border-box;
}
.control1 {
.arrow-down {
transform: rotate(90deg);
transition: all .2s ease-in-out;
&.up{
transform: rotate(-90deg);
}
}
}
.control1 .btn:not(:last-child)::after {
display: block;
content: '';
position: absolute;
top: 20rpx;
bottom: 20rpx;
width: 2px;
background-color: #fff;
right: 0;
}
.control1 .btn {
flex: 1;
}
.control1 .btn,
.control2 .btn{
position: relative;
line-height: 76rpx;
text-align: center;
}
.control2 {
overflow: hidden;
// padding: 0 28rpx;
}
}
</style>

View File

@ -0,0 +1,286 @@
<template>
<view>
<template v-if="isBind">
<view class="goods">
<view class="u-flex u-row-between">
<view class="u-flex">
<view class="color-333">
<text class="">排序</text>
<text class="u-m-l-20">{{data.sort}}</text>
</view>
<view class="color-333 u-m-l-42 u-flex">
<text class="stock u-m-l-4">库存:{{data.stockNumber}}</text>
</view>
</view>
</view>
<view class="u-m-t-32 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>
<view class="img">
<up--image :width="63" :height="63" :radius="3" :src="data.coverImg"></up--image>
</view>
<view class="w-full info u-p-l-30">
<view class=" color-333 u-flex u-row-between">
<view class="u-flex">
<text class="u-m-r-24">{{data.name}}</text>
</view>
<view class="u-font-32">
<text v-if="data.typeEnum=='单规格'">¥</text>
<text>{{data.lowPrice}}</text>
</view>
</view>
<view class="u-flex u-m-t-10 u-row-right">
<view class="btn-default btn" @tap="del">删除</view>
</view>
</view>
</view>
</view>
</template>
<template v-else>
<view class=" u-flex u-p-l-30 u-p-r-30 u-p-t-16 u-p-b-16" @click="goodsClick">
<my-radio disabled @click.stop="goodsClick" :modelValue="data.checked"></my-radio>
<view class="u-flex u-m-l-32">
<text class="">{{data.name}}</text>
</view>
</view>
</template>
</view>
</template>
<script setup>
import {
ref,
watch,
watchEffect
} from 'vue';
import {
$goodsIsHot,
$tbProskuConV2,
$updateProductData
} from '@/http/yskApi/goods.js'
import mySwitch from '@/components/my-components/my-switch.vue'
import go from '@/commons/utils/go.js';
import {
ColorMain
} from '@/commons/color.js'
const emits = defineEmits(['goodsClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick',
'editStock'
])
const props = defineProps({
isBind: {
type: Boolean,
default: false
},
index: {
type: Number
},
data: {
type: Object,
default: () => {
return {
checked:false,
}
}
},
showChecked: {
type: Boolean,
default: false
},
showDetail: {
type: Boolean,
default: false
}
})
function goodsClick(){
emits('goodsClick',props.index)
}
async function upDateGoods(par) {
const res = await $updateProductData([{
id: props.data.id,
isSku: 0,
shopId: uni.getStorageSync('shopId'),
...par
}])
uni.showToast({
title: '修改成功',
icon: 'none'
})
}
function radioClick() {
console.log(props.index);
emits('radioClick', props.index)
}
function changeClick() {
emits('changeClick', props.index)
}
function xiajia() {
emits('xiajia', props.index)
}
function del() {
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 edittype
function toEdit() {
go.to('PAGES_PRODUCT_ADD', {
type: 'edit',
productId: props.data.id
})
}
</script>
<style lang="scss" scoped>
$imgSize: 126rpx;
$price-color: #F02C45;
.btn {
padding: 6rpx 28rpx;
border-radius: 100rpx;
border: 2rpx solid transparent;
}
.gap-10 {
gap: 10rpx;
}
.btn-primary {
border-color: $my-main-color;
color: $my-main-color;
}
.btn-default {
border-color: #999;
color: #999;
}
.price {
color: $price-color;
}
.h-100 {
height: $imgSize;
}
.img {
width: $imgSize;
height: $imgSize;
}
.info-p-l {
padding-left: 71px;
}
.icon-arrow-right {
width: 32rpx;
height: 32rpx;
}
.stock {
// padding-right: 46rpx;
position: relative;
}
.stock::after {
// content: '';
// position: absolute;
// right: 10rpx;
// top: 50%;
// transform: translateY(-50%);
// display: block;
// width: 16rpx;
// border: 2rpx solid #333333;
}
.color-red {
color: #F0465B;
}
.goods {
border-radius: 10rpx 10rpx 10rpx 10rpx;
background-color: #fff;
padding: 24rpx 28rpx 16rpx 28rpx;
font-size: 28rpx;
.skus {
background: #F9F9F9;
border-radius: 14rpx 14rpx 14rpx 14rpx;
padding: 20rpx;
.sku {
color: #000;
font-weight: 700;
padding: 6rpx 40rpx;
}
.skds {
gap: 10rpx 50rpx;
}
}
}
.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-gray {
background-color: rgb(144, 147, 153);
color: #fff;
}
}
</style>

View File

@ -0,0 +1,552 @@
<template>
<view class="safe-page">
<up-sticky>
<view class="bg-fff u-p-l-30 u-p-r-30 u-p-b-30">
<!-- <view class="myTabs ">
<myTabs :list="tabsList" @change="tabsChange"></myTabs>
</view> -->
<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>
<up-icon name="arrow-down" size="16"></up-icon>
</view>
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
:placeholder="pageData.search.placeholder" v-model="pageData.query.name"
@confirm="searchFunc">
<template #prefixIcon>
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
</template>
</uni-easyinput>
<button type="text" @click="searchFunc()">搜索</button>
</view>
</view>
<view class="u-flex states1 u-row-between u-font-28">
<view class=" u-flex-1 item u-flex u-row-center tranistion u-text-center color-333"
:class="{'active':pageData.stateCurrent==index}" @tap="statesTableClick(index)"
v-for="(item,index) in statesTabsList" :key="index">
<view class="text">{{item}}</view>
</view>
</view>
</view>
</up-sticky>
<template v-if="pageData.stateCurrent==0">
<view class="goods-list u-p-30">
<template v-if="pageData.bindGoodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.bindGoodsList" :key="index">
<my-goods isBind @radioClick="goodsRadioClick" :index="index"
:data="item" @del="goodsDel" :showChecked="showChecked"
:showDetail="pageData.showGoodsDetail"></my-goods>
</view>
</template>
<template v-if="pageData.hasAjax&&!pageData.bindGoodsList.length">
<my-img-empty tips="暂无绑定商品"></my-img-empty>
</template>
<view style="height: 100rpx;"></view>
</view>
</template>
<template v-else>
<view class="goods-list u-p-30">
<view class="bg-fff border-r-18 u-p-t-16 u-p-b-16 box-shadow">
<template v-if="pageData.goodsList.length">
<view class="" v-for="(item,index) in pageData.goodsList" :key="index">
<my-goods @goodsClick="goodsClick"
@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">
<my-img-empty tips="未找到相关商品"></my-img-empty>
</template>
</view>
<view class="fixed-b">
<my-button shape="circle" @click="save">确定</my-button>
</view>
<view style="height: 100rpx;"></view>
<!-- <my-pagination :totalElements="pageData.totalElements" :size="pageData.query.size"
@change="pageChange"></my-pagination> -->
<!-- <my-control></my-control> -->
</view>
</template>
<!-- 分类 -->
<my-category v-model:isShow="pageData.categoryShow" @confirm="setCategory"></my-category>
</view>
</template>
<script setup>
import {
onLoad,
onReady,
onShow,
onPageScroll,
onPullDownRefresh
} from '@dcloudio/uni-app';
import {
reactive,
ref,
watch
} from 'vue';
import go from '@/commons/utils/go.js';
import myGoods from './components/goods.vue'
import myCategory from './components/category.vue'
import infoBox from "@/commons/utils/infoBox.js"
import myControl from './components/control.vue'
import {
$tbProduct,
$upProSort,
$updateProduct,
$getProductDetail,
$delProduct,
$tbShopCategory,
$updateProductStatus,
$tbProductV2,
$updateProductData
} from "@/http/yskApi/goods.js"
import {
productListGet,
tbProductGroupGet,
tbProductGroupDelete,
tbProductGroupPut,
upGroupSort,
tbProductGroupPost
} from "@/http/yskApi/shop.js"
import {
returnAllCategory
} from '@/pageProduct/util.js'
const pageData = reactive({
modelDesc: '是否下架',
stateCurrent: 0,
componentBottom: 45,
search: {
value: '',
placeholder: '输入搜索的商品'
},
showGoodsDetail: false,
selGoodsIndex: '',
selGoods: {},
totalElements: 0,
totalPage: 0,
bindGoodsList: [],
goodsList: [],
query: {
page: 0,
size: 999,
categoryId: '',
name: ''
},
category: '',
categoryList: [], //
categoryShow: false,
categoryName: '',
hasAjax: false
})
watch(() => pageData.query.categoryId, (newval) => {
getGoodsList()
})
watch(()=>pageData.stateCurrent,(newval)=>{
if(newval){
setGoodsList()
}else{
init()
}
})
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 goodsClick(e) {
console.log(e);
pageData.goodsList[e].checked = !pageData.goodsList[e].checked
}
function setCategory(category) {
pageData.query.categoryId = category.id
pageData.categoryName = category.name
}
let $goodsList=[]
function setGoodsList(){
pageData.goodsList = $goodsList.filter(v=>!pageData.bindGoodsList.find(bindGoods=>bindGoods.id==v.id))
}
function getGoodsList() {
$tbProductV2(pageData.query).then(res => {
pageData.hasAjax = true
pageData.totalElements = res.totalElements
$goodsList=res.content.map(v=>{
return {
...v,checked:false
}
})
setGoodsList()
})
}
onShow(() => {
// getGoodsList()
})
async function getGroupBindGoods() {
const res = await productListGet(option.id)
pageData.bindGoodsList = res
}
const option = reactive({})
async function init() {
const res = await productListGet(option.id)
pageData.bindGoodsList = res
getGoodsList()
}
onLoad((opt) => {
tbProductGroupGet({
page: 0,
size: 999,
sort: 'id',
shopId: uni.getStorageSync('shopId')
})
Object.assign(option, opt)
init()
// $tbShopCategory({
// page: 0,
// size: 200
// }).then(res => {
// pageData.categoryList = returnAllCategory(res.content)
// console.log(pageData.categoryList);
// })
})
const statesTabsList = ['已添加', '未添加']
const control = ref(null)
const model = ref(null)
const goodsStockModel = ref(null)
function returnGoodsStockData() {
return reactive({
sort: 0,
isStock: false,
isDistribute: false,
isPauseSale: false,
isGrounding: false,
stockNumber: 0,
})
}
async function save() {
console.log(pageData.goodsList);
await tbProductGroupPut({
...option,
shopId:uni.getStorageSync('shopId'),
productIds:[...pageData.bindGoodsList.map(v=>v.id),...pageData.goodsList.filter(v=>v.checked).map(v=>v.id)]
})
pageData.stateCurrent=0
}
function updateGroup(){
}
//
function goodsDel(index) {
const goods = pageData.bindGoodsList[index]
uni.showModal({
title: '提示',
content: '是否确认将' + goods.name + '从该分组中移除',
success: function(res) {
if (res.confirm) {
pageData.bindGoodsList.splice(index, 1)
tbProductGroupPut({
...option,
shopId:uni.getStorageSync('shopId'),
productIds:pageData.bindGoodsList.map(v=>v.id)
})
} else if (res.cancel) {}
}
});
}
function statesTableClick(index) {
pageData.stateCurrent = index
}
function tabsChange(i) {
console.log(i);
pageData.showGoodsDetail = i ? true : false
}
//
function changeGoodsChecked(checked, index) {
if (index !== undefined) {
pageData.goodsList[index].checked = checked
} else {
pageData.goodsList.map(v => {
v.checked = checked
})
}
control.value.setisSelectAll(isAllChecked() ? true : false)
}
//
function getChechkedGoodsList() {
return pageData.goodsList.filter(v => v.checked)
}
//
function isAllChecked() {
return getChechkedGoodsList().length === pageData.goodsList.length
}
//
function isHasChekdGoods() {
return getChechkedGoodsList().length ? true : false
}
function searchFunc() {
console.log('searchFunc');
getGoodsList()
}
let showChecked = ref(false)
//start
function goodsRadioClick(index) {
var checked = !pageData.goodsList[index].checked
changeGoodsChecked(checked, index)
}
//
function offShelf() {
const hasCheckedArr = getChechkedGoodsList()
const hasChecked = isHasChekdGoods()
if (!hasChecked) {
return infoBox.showToast('您还没有选中商品!')
}
model.value.open()
}
//
function modelConfirm() {
console.log('confirm');
model.value.close()
}
//end
//
function controlChange(bol) {
showChecked.value = bol
}
//
function allCheckedChange(checked) {
changeGoodsChecked(checked)
}
//
function pageChange(page) {
console.log(page);
pageData.query.page = page - 1
getGoodsList()
}
//
const category = ref(null)
function toggleCategory() {
category.value.toggle()
}
function cateClick(cate) {
console.log(cate);
pageData.query.categoryId = cate.id
pageData.categoryName = cate.name
pageData.category = cate
getGoodsList()
}
</script>
<style scoped>
page {
background: #F9F9F9;
}
</style>
<style lang="scss" scoped>
.stock-btns {
padding: 0 100rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
}
.safe-page {
background: #F9F9F9;
}
.icon-guige {
width: 42rpx;
height: 42rpx;
}
.bg-fff {
background-color: #fff;
}
.myTabs {
margin: 0 auto;
width: 434rpx;
height: 64rpx;
}
.input-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 26rpx;
background-color: $J-bg-ff;
.input-main {
flex: 1;
display: flex;
align-items: center;
height: 64rpx;
image {
padding: 22rpx;
width: 26rpx;
height: 26rpx;
}
input {
flex: 1;
font-size: 27rpx;
}
::v-deep uni-button {
font-size: 28rpx;
color: $my-main-color;
background: rgba(255, 255, 255, 1);
}
::v-deep.uni-easyinput {
.uni-easyinput__content {
background-color: $J-bg-f5 !important;
border-radius: $J-b-r12;
.uni-easyinput__content-input {
padding-left: 0 !important;
.uni-input-input {
border-radius: $J-b-r12 !important;
overflow: hidden !important;
}
}
.uni-input-placeholder {
font-size: 27rpx;
}
.uni-icons {
color: rgba(230, 230, 230, 1) !important;
}
}
}
}
}
.input-icon {
position: relative;
z-index: 10;
}
.search-button {
position: absolute;
right: 0;
background-color: transparent !important;
color: transparent !important;
}
.states1 {
margin-top: 24rpx;
.item {
font-size: 28rpx;
color: #666;
.text {
position: relative;
padding-top: 14rpx;
padding-bottom: 16rpx;
&::after {
content: '';
display: block;
position: absolute;
transition: all .2s ease-in-out;
left: 10rpx;
right: 10rpx;
bottom: 0;
height: 4rpx;
background: transparent;
border-radius: 12rpx 12rpx 12rpx 12rpx;
}
}
&.active {
color: $my-main-color;
border-radius: 8rpx 8rpx 8rpx 8rpx;
.text {
&::after {
background-color: $my-main-color;
}
}
}
}
}
.fixed-b {
position: fixed;
bottom: calc(env(safe-area-inset-bottom) + 16rpx);
/* #ifdef H5 */
bottom: 50rpx;
/* #endif */
left: 110rpx;
right: 110rpx;
}
</style>

View File

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@ -0,0 +1,555 @@
<template>
<view class="page">
<view class="box">
<view>
<uni-forms :model="category" :rules="rules" err-show-type="toast" ref="form" :border="true"
label-position="top" label-width="350">
<view class="block">
<view class="">
<uni-forms-item label="分类名称" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="category.name" placeholder="输入分类名称" />
</uni-forms-item>
</view>
<template v-if="option.type=='edit'">
<uni-forms-item label="排序" required name="sort">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="category.sort" type="number" placeholder="排序越小越靠前" />
</uni-forms-item>
</template>
<uni-forms-item label="">
<view class="u-flex u-row-between u-col-center">
<view class="label-title">分组状态</view>
<view class="u-flex">
<my-switch v-model="category.isShow"></my-switch>
</view>
</view>
</uni-forms-item>
</view>
</uni-forms>
</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 tColorPicker from '@/components/t-color-picker/t-color-picker'
import go from '@/commons/utils/go.js';
import infoBox from '@/commons/utils/infoBox.js';
import {
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
onMounted,
reactive,
nextTick,
ref,
onBeforeMount,
watch
} from 'vue';
import {
tbProductGroupGet,
tbProductGroupDelete,
tbProductGroupPut,
upGroupSort,
tbProductGroupPost
} from '@/http/yskApi/shop.js'
const $productCategory = {
add: tbProductGroupPost,
del: tbProductGroupDelete,
update: tbProductGroupPut,
get: tbProductGroupGet
}
const refAddChilCate = ref(null)
const refAddChilCateTitle = ref('添加子分类')
function refAddChilCateClose() {
refAddChilCate.value.close()
categoryChild.value = {
...categoryBasicData
}
}
let refMoreSheet = ref(null)
let selItem = {
data: '',
index: ''
}
//
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: '输入分类名称'
}]
},
sort: {
rules: [{
required: true,
errorMessage: '输入排序'
}]
}
}
const refFiles = ref([])
function setRefFile(index) {
refFiles.value[index] = null;
return (el) => {
if (el) {
refFiles.value[index] = el;
}
};
}
function toTimer(timer, index) {
console.log(timer);
uni.setStorageSync('timer', timer.map(v => {
return {
...v,
cycleChecked: v.cycleChecked.map(v => v.value)
}
}))
go.to('PAGES_CATEGORY_TIMER', {
index: index
})
}
function returnTimers(timers) {
const {
listingTime,
offShelf,
cycleChecked
} = timers
let len = cycleChecked.length
if (len === 7) {
return `每天 ${listingTime.value} - ${offShelf.value}`
}
let result = cycleChecked.reduce((prve, cur) => {
return prve + cur.text.replace('星期', '周')
}, '')
return `${result} ${listingTime.value} - ${offShelf.value}`
}
//
function FileUploadprogress() {
}
function FileUploadsuccess() {
}
function FileUploadail() {
}
function FileUploadselect(e) {
// TEST
// FormData.images.push(e)
}
function returnOptionsBasicData() {
return {
...categoryOptionsBasicData
}
}
//
const categoryBasicData = {
id: '',
name: '',
isShow: 1,
sort: 0,
productIds: [],
saleTime: [],
useTime: 0,
shopId: uni.getStorageSync('shopId')
}
const categoryChild = ref({
...categoryBasicData
})
function onFieldChange(e) {
console.log(e);
}
//
const category = reactive({
...categoryBasicData,
childrenList: []
})
//
function addcategoryChildren() {
refAddChilCate.value.open()
// category.childrenList.push({
// ...categoryBasicData
// })
// scrollPageBottom()
}
//
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()
}
function triggerEvent(emitName, data) {
if (emitName) {
uni.$emit(emitName, data)
}
}
const option = reactive({
type: ''
})
function isNoEmpty(obj) {
return obj && JSON.stringify(obj) !== '{}'
}
/**
* 监听定时器保存,拿到数据
* @param {Boolean} open //
*/
function watchTimerSave(open = true) {
if (open) {
uni.$on('timerSave', function(res) {
const {
index,
data
} = res
console.log('timerSave get');
console.log(res);
if (index == -1) {
category.timers = data
} else {
category.childrenList[index].timers = data
}
})
} else {
uni.$off('timerSave', function(data) {
console.log('timerSave remove');
})
}
}
watchTimerSave()
onLoad(params => {
let cateItem = uni.getStorageSync('cateItem')
if (isNoEmpty(params)) {
option.type = params.type
}
if (option.type === 'edit' && isNoEmpty(cateItem)) {
console.log(cateItem);
for (let i in cateItem) {
if (i.substring(0, 2) === 'is' && i.length > 2) {
cateItem[i] = cateItem[i] * 1
} else {
cateItem[i] = cateItem[i] === 'null' ? '' : cateItem[i]
}
}
Object.assign(category, cateItem)
}
console.log(category);
uni.setNavigationBarTitle({
title: option.type === 'add' ? '添加分组' : '编辑分组'
})
})
function emitcategorySave() {
// emitcategorySave
// guigeEdit
uni.removeStorageSync('guige')
triggerEvent(emitName, category.list)
}
function returnValidateResult(obj) {
const validateFuncObj = {
name: (value) => {
return {
pass: value.length >= 1,
errMeessage: '请输入分类名称'
}
},
sort: (value) => {
return {
pass: value !== '',
errMeessage: '请输入排序'
}
}
}
function validateFunc(key, value) {
if (validateFuncObj.hasOwnProperty(key)) {
const func = validateFuncObj[key]
return func(value)
}
return {
pass: true
}
}
let resultArr = []
for (let key in obj) {
resultArr.push(validateFunc(key, obj[key]))
}
resultArr = resultArr.filter(v => !v.pass)
return resultArr
}
let timer = null
function onfileChange(val, data, key) {
data[key] = val
}
async function save() {
let isAllPassForm = 0
const formRules = {}
const result = []
result.push(...returnValidateResult(category))
for (let obj of category.childrenList) {
const res = returnValidateResult(obj)
result.push(...res)
}
if (result.length) {
return infoBox.showToast(result[0].errMeessage)
}
if (option.type === 'edit') {
const res = await $productCategory.update({
...category,
childrenList: ''
})
} else {
const res = await $productCategory.add({
...category,
childrenList: ''
})
}
infoBox.showToast(option.type === 'edit' ? '修改成功' : '添加成功')
timer = setTimeout(() => {
clearTimeout(timer)
go.back()
}, 1500);
// const res = await form.value.validate().then(res => {
// go.back()
// })
}
</script>
<style scoped>
page {
background: #F9F9F9;
}
</style>
<style lang="scss" scoped>
$icon-size: 34rpx;
$icon-line-width: 20rpx;
$icon-line-height: 4rpx;
.category-icon {
width: 60rpx;
height: 60rpx;
}
.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 {
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>

View File

@ -0,0 +1,213 @@
<template>
<view class="u-p-30 min-page">
<view class="u-flex">
<view style="width: 210rpx;">
<my-button shape="circle" @click="addTimer">添加定时器</my-button>
</view>
</view>
<view class="list u-m-t-20" v-if="list.length">
<view class="block" v-for="(item,index) in list" :key="index">
<view class="u-flex u-row-between">
<view>定时器{{index+1}}</view>
<uni-icons @click="delTimer(index)" type="trash"></uni-icons>
</view>
<view class="u-flex u-m-t-20 u-row-between">
<view>周期</view>
<view @click="selectAllClick(index)">全选</view>
</view>
<view class="u-m-t-20">
<uni-data-checkbox multiple v-model="item.cycleChecked" :localdata="cycle"></uni-data-checkbox>
</view>
<view class="u-m-t-20">
<view class="u-flex">
<view>上架时间:</view>
<view class="u-flex-1 u-m-l-10">
<picker mode="multiSelector" @change="listingTimeChange($event,index)"
:value="item.listingTime.index" :range="times">
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
{{item.listingTime.value}}
</view>
</picker>
</view>
</view>
<view class="u-flex u-m-t-20">
<view>下架时间:</view>
<view class="u-flex-1 u-m-l-10">
<picker mode="multiSelector" @change="offShelfChange($event,index)"
:value="item.offShelf.index" :range="times">
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
{{item.offShelf.value}}
</view>
</picker>
</view>
</view>
</view>
</view>
</view>
<view class="u-flex u-row-center u-m-t-60">
<my-button width="580" shape="circle" @click="save">保存</my-button>
</view>
</view>
</template>
<script setup>
import {
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
ref
} from 'vue';
import go from '@/commons/utils/go.js';
import myButton from '@/components/my-components/my-button.vue'
//
function returnDayTime() {
return new Array(2).fill(1).map((v, index) => {
if (index === 0) {
return new Array(24).fill(1).map((hour, index) => {
return `0${index}`.slice(-2)
})
}
if (index === 1) {
return new Array(60).fill(1).map((hour, index) => {
return `0${index}`.slice(-2)
})
}
})
}
const times = ref(returnDayTime())
let defaultTimeIndex = ref(0)
function getTime(indexArr) {
const hour = times.value[0][indexArr[0]]
const month = times.value[1][indexArr[1]]
return `${hour}:${month}`
}
//$event.detail.value
function getEnentDetailValue(e) {
return e.detail.value
}
function setListTimeValue(index, key, time) {
list.value[index][key].value = time
}
function listingTimeChange(e, index) {
const indexArr = getEnentDetailValue(e)
const time = getTime(indexArr)
setListTimeValue(index, 'listingTime', time)
}
function offShelfChange(e, index) {
const indexArr = getEnentDetailValue(e)
const time = getTime(indexArr)
setListTimeValue(index, 'offShelf', time)
}
const cycle = [{
value: 0,
text: '星期一'
},
{
value: 1,
text: '星期二'
},
{
value: 2,
text: '星期三'
},
{
value: 3,
text: '星期四'
},
{
value: 4,
text: '星期五'
},
{
value: 5,
text: '星期六'
},
{
value: 6,
text: '星期日'
}
]
const ListDataconstructor = {
cycleChecked: [0, 1, 2, 3, 4, 5, 6],
}
function returnBasicTimeConstructor() {
return {
listingTime: {
value: '09:00',
index: [9, 0]
},
offShelf: {
value: '18:00',
index: [18, 0]
}
}
}
const list = ref([returnBasicDataConstructor()])
function returnBasicDataConstructor() {
return {
...ListDataconstructor,
...returnBasicTimeConstructor()
}
}
function addTimer() {
list.value.push(returnBasicDataConstructor())
}
function delTimer(index) {
list.value.splice(index,1)
}
function selectAllClick(index){
list.value[index].cycleChecked=ListDataconstructor.cycleChecked
}
let index=null
//
function emitTimerSave(){
uni.$emit('timerSave',{
data:list.value.map(v=>{
return {
...v,
cycleChecked:v.cycleChecked.map(index=>{
return {value:index,text:cycle[index].text}
})
}
}),
index:index
})
go.back()
}
function save(){
console.log(list.value);
emitTimerSave()
}
onLoad((opt)=>{
index=opt.index
const arr=uni.getStorageSync('timer')
if(arr.length){
list.value=arr
}
})
</script>
<style lang="scss">
.min-page {
background-color: #F9F9F9;
}
.block {
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding: 30rpx;
margin-bottom: 20rpx;
}
</style>

View File

@ -0,0 +1,231 @@
<template>
<view class=" goods">
<view class="u-flex u-font-24 u-col-center u-row-between u-p-b-16 border-bottom">
<view class="u-flex u-col-center">
<view class="u-font-24">
<text>排序</text>
<text class="u-m-l-12">{{data.sort}}</text>
</view>
<view class="u-flex u-m-l-16 " @click="editSort">
<image src="/pageGoodsGroup/static/image/icon-edit.svg" class="icon-edit" mode=""></image>
</view>
</view>
<view class="u-flex">
<view class="u-m-r-14 color-999">是否启用</view>
<up-switch :activeValue="1" :inactiveValue="0" v-model="isShow" @change="isShowChange" :size="18"></up-switch>
</view>
</view>
<view class="u-m-t-24 u-p-l-54 ">
<view class="u-flex-1 u-flex">
<view class="color-666">分组名</view>
<view class="color-333 u-m-l-60">{{data.name}}</view>
<view class="u-flex u-m-l-16 " @click="editName">
<image src="/pageGoodsGroup/static/image/icon-edit.svg" class="icon-edit" mode=""></image>
</view>
</view>
<view class="u-flex u-m-t-24">
<view class="color-666">售卖时间</view>
<view class="color-main u-m-l-32" v-if="data.saleStartTime&&data.saleEndTime">
<text>{{data.saleStartTime}}</text>
<text>-</text>
<text>{{data.saleEndTime}}</text>
</view>
</view>
</view>
<view class="u-m-t-24 u-flex u-row-right">
<view class="btn-default btn" @click="del">删除</view>
<view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view>
</view>
</view>
</template>
<script setup>
import {
computed,
ref,
watchEffect
} from 'vue';
import mySwitch from '@/components/my-components/my-switch.vue'
import go from '@/commons/utils/go.js';
import {
ColorMain
} from '@/commons/color.js'
const emits = defineEmits(['changeClick','edit', 'editName','editSort', 'del', 'isShowChange'])
const props = defineProps({
index: {
type: Number
},
data: {
type: Object,
default: () => {
return {
isShow:true
}
}
},
})
let isShow = ref(props.data.isShow)
function isShowChange() {
console.log(isShow.value);
emits('isShowChange', {
...props.data,
isShow: isShow.value
})
}
let isSellNone = ref(true)
isSellNone.value = props.isSellNone
function isSellNoneChange() {
console.log(isSellNone.value);
console.log('isSellNoneChange');
}
let checked = ref(false)
function radioClick() {
console.log(props.index);
emits('radioClick', props.index)
}
function changeClick() {
emits('changeClick', props.index)
}
function useTypeClick() {
emits('useTypeClick', props.index)
}
function del() {
emits('del', props.index)
}
function editName() {
emits('editName', props.index)
}
//type edittype
function editSort() {
emits('editSort', props.index)
}
function toEdit() {
emits('edit', props.index)
// uni.setStorageSync('cateItem', props.data)
// go.to('PAGES_CATEGORY_EDIT', {
// type: 'edit',
// })
}
</script>
<style lang="scss" scoped>
$imgSize: 126rpx;
$price-color: #F02C45;
.btn {
padding: 6rpx 28rpx;
border-radius: 100rpx;
font-size: 24rpx;
border: 1px solid transparent;
}
.btn-primary {
border-color: $my-main-color;
color: $my-main-color;
}
.btn-default {
border-color: #999;
color: #999;
}
.price {
color: $price-color;
}
.h-100 {
height: $imgSize;
}
.img {
width: $imgSize;
height: $imgSize;
}
.icon-arrow-right {
width: 32rpx;
height: 32rpx;
}
.stock {
padding-right: 46rpx;
position: relative;
}
.icon-edit {
width: 24rpx;
height: 24rpx;
}
.stock::after {
content: '';
position: absolute;
right: 10rpx;
top: 50%;
transform: translateY(-50%);
display: block;
width: 16rpx;
border: 2rpx solid #333333;
}
.goods {
border-radius: 10rpx 10rpx 10rpx 10rpx;
background-color: #fff;
padding: 24rpx 28rpx 16rpx 28rpx;
font-size: 28rpx;
.skus {
background: #F9F9F9;
border-radius: 14rpx 14rpx 14rpx 14rpx;
padding: 28rpx 42rpx;
.sku {
color: #000;
font-weight: 700;
padding: 6rpx 40rpx;
}
.skds {
gap: 10rpx 50rpx;
}
.skd {
padding: 14rpx 40rpx;
background: #F0F2F5;
border-radius: 4rpx;
position: relative;
color: #666;
overflow: hidden;
.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;
}
}
}
}
</style>

View File

@ -0,0 +1,128 @@
<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-36">
<view>修改排序</view>
<view class="u-m-t-38">
<view class="u-m-b-32">
<view class="u-m-t-16">
<up-input v-model="sort">
</up-input>
</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,
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: () => []
},
item: {
type: Object,
default: () => {
sort:''
}
}
})
function changeShowRecoders(show) {
recoders.show = show
}
const data = ref(props.item)
const emits = defineEmits(['update:show', 'save'])
const form = reactive({
note: ''
})
let popShow = ref(props.show)
let sort=ref('')
watch(()=>props.item.sort,(newval)=>{
sort.value=newval
})
watch(() => props.show, (newval) => {
popShow.value = newval
if (newval) {
data.value = props.item
}
})
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,
sort:sort.value
})
}
</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>

View File

@ -0,0 +1,128 @@
<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-36">
<view>修改排序</view>
<view class="u-m-t-38">
<view class="u-m-b-32">
<view class="u-m-t-16">
<up-input v-model="sort">
</up-input>
</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,
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: () => []
},
item: {
type: Object,
default: () => {
sort:''
}
}
})
function changeShowRecoders(show) {
recoders.show = show
}
const data = ref(props.item)
const emits = defineEmits(['update:show', 'save'])
const form = reactive({
note: ''
})
let popShow = ref(props.show)
let sort=ref('')
watch(()=>props.item.sort,(newval)=>{
sort.value=newval
})
watch(() => props.show, (newval) => {
popShow.value = newval
if (newval) {
data.value = props.item
}
})
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,
sort:sort.value
})
}
</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>

View File

@ -0,0 +1,483 @@
<template>
<view class="safe-page">
<view class="goods-list u-p-30">
<view class="u-m-b-32" v-for="(item,index) in pageData.list" :key="index">
<my-category @del="categoryDel" @useTypeClick="categoryUseTypeClick"
@editSort="popupShow($event,'sort',true)" @edit="actionsShow" @radioClick="goodsRadioClick"
@isShowChange="isSHowChange" :index="index" :data="item" :showChecked="showChecked"
:showDetail="pageData.showGoodsDetail"></my-category>
</view>
<view class="u-m-t-44">
<my-pagination :size="pageData.query.size" :totalElements="pageData.totalElements"
@change="pageChange"></my-pagination>
<view style="height: 200rpx;"></view>
</view>
</view>
<!-- 删除弹窗 -->
<my-model desc="请确保此分类下没有任何商品确认删除?" ref="delModel" @confirm="delModelConfirm"></my-model>
<view class="fixed-b">
<my-button :height="80" shape="circle" showShadow @tap="toAddCategory">新建分组</my-button>
</view>
</view>
<edit-sort @save="updataGroup" :item="popup.selData" v-model:show="popup.sort.show"></edit-sort>
<up-action-sheet :round="10" @select="actionSelect" @close="actionsHide" cancelText="取消" :actions="actions.list"
:show="actions.show"></up-action-sheet>
</template>
<script setup>
import {
reactive,
ref,
watch
} from 'vue';
import {
onShow
} from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js';
import myCategory from './components/category.vue'
import infoBox from "@/commons/utils/infoBox.js"
import editSort from './components/edit-sort.vue';
import {
tbProductGroupGet,
tbProductGroupDelete,
tbProductGroupPut,
upGroupSort,
tbProductGroupPost
} from '@/http/yskApi/shop.js'
const $productCategory = {
add: tbProductGroupPost,
del: tbProductGroupDelete,
update: tbProductGroupPut,
get: tbProductGroupGet
}
const actions = reactive({
list: [{
name: '排序',
color: '#333',
fontSize: '16'
}, {
name: '管理商品',
color: '#333',
fontSize: '16'
}],
show: false,
})
function actionSelect(e) {
console.log(e);
if (e.name == '排序') {
return popupShow(actions.selIndex, 'sort', true)
}
if (e.name == '管理商品') {
const {id,isShow,name,sort}=actions.selData
return go.to('PAGES_GOODS_GROUP_EDIT_GOODS', {
id,isShow,name,sort
})
}
}
function actionsHide() {
actions.show = false
}
function actionsShow(e) {
console.log(e);
actions.selData = pageData.list[e]
actions.selIndex = e
actions.show = true
}
const popup = reactive({
selIndex: -1,
selData: {
sort: ''
},
sort: {
show: false
}
})
function popupShow(e, key, show) {
popup.selData = pageData.list[e]
popup.selIndex = e
popup[key].show = show
}
async function updataGroup(e) {
console.log(e);
const res = await $productCategory.update(e)
popup.sort.show = false;
pageData.list[popup.selIndex] = e
infoBox.showToast('更新成功')
}
const tabsList = ['简洁', '详情']
const statesTabsList = ['在售中', '已下架']
const states1TabsList = ['全部', '已售罄']
const control = ref(null)
const delModel = ref(null)
const goodsSortModel = ref(null)
const goodsTypeModel = ref(null)
let sort = ref(0)
const goodsTypeModelData = reactive({
selCategory: '',
title: '',
index: null,
useTypes: [{
name: '堂食',
isOpen: true
},
{
name: '自取',
isOpen: true
},
{
name: '外卖',
isOpen: true
},
{
name: '快递',
isOpen: true
}
]
})
const pageData = reactive({
stateCurrent: 0,
stateCurrent1: 0,
componentBottom: 264,
search: {
value: '',
placeholder: '输入搜索的商品'
},
showGoodsDetail: false,
query: {
page: 0,
size: 10,
sort: 'id',
shopId: uni.getStorageSync('shopId')
},
totalElements: 0,
list: [],
selCategory: ''
})
async function init() {
const res = await $productCategory.get(pageData.query)
pageData.list = res.content
pageData.totalElements = res.totalElements
}
onShow(() => {
init()
})
function toAddCategory() {
go.to('PAGES_GOODS_GROUP_EDIT', {
type: 'add'
})
}
function goodsSortModelCancel() {
console.log('goodsSortModelCancel');
goodsSortModel.value.close()
}
async function goodsSortModelSave() {
console.log('goodsSortModelSave');
const res = await $productCategory.update({
...pageData.selCategory,
sort: sort.value
})
infoBox.showToast('修改成功')
goodsSortModelCancel()
init()
}
async function isSHowChange(data) {
const res = await $productCategory.update({
...data
})
infoBox.showToast('修改成功')
// init()
}
function categoryUseTypeClick(index) {
goodsTypeModelData.index = index
// goodsTypeModelData.useTypes=pageData.list[index].useTypes
const cateItem = pageData.list[index]
console.log(cateItem);
goodsTypeModelData.selCategory = cateItem
goodsTypeModelData.title = cateItem.name
goodsTypeModel.value.open()
}
//
function goodsChangeClick(index) {
console.log(index);
const goods = pageData.list[index]
sort.value = goods.sort
pageData.selCategory = goods
goodsSortModel.value.open()
}
function statesTableClick(index) {
pageData.stateCurrent = index
}
function states1TableClick(index) {
pageData.stateCurrent1 = index
}
let test = ref(false)
function tabsChange(i) {
console.log(i);
pageData.showGoodsDetail = i ? true : false
}
//
function changeGoodsChecked(checked, index) {
if (index !== undefined) {
pageData.list[index].checked = checked
} else {
pageData.list.map(v => {
v.checked = checked
})
}
control.value.setisSelectAll(isAllChecked() ? true : false)
}
//
function getChechkedlist() {
return pageData.list.filter(v => v.checked)
}
//
function isAllChecked() {
return getChechkedlist().length === pageData.list.length
}
//
function isHasChekdGoods() {
return getChechkedlist().length ? true : false
}
function searchFunc() {
console.log('searchFunc');
}
let showChecked = ref(false)
//start
function goodsRadioClick(index) {
var checked = !pageData.list[index].checked
changeGoodsChecked(checked, index)
}
//
function offShelf() {
const hasCheckedArr = getChechkedlist()
const hasChecked = isHasChekdGoods()
if (!hasChecked) {
return infoBox.showToast('您还没有选中商品!')
}
model.value.open()
}
let nowCateIndex = null
function categoryDel(index) {
// nowCateIndex=index
// delModel.value.open()
uni.showModal({
title: '提示',
content: '请确保此分类下没有任何商品确认删除?',
success: res => {
if (res.confirm) {
const islast = pageData.list.length === 1
$productCategory.del([pageData.list[index].id]).then(res => {
infoBox.showToast('删除成功')
// if(islast&&pageData.query.page>=1){
// pageData.query.page--
// }
init()
})
}
},
fail: () => {},
complete: () => {}
});
}
//
function delModelConfirm() {
console.log('confirm');
pageData.list.splice(nowCateIndex, 1)
delModel.value.close()
}
//end
//
function controlChange(bol) {
console.log(bol);
showChecked.value = bol
}
//
function allCheckedChange(checked) {
changeGoodsChecked(checked)
}
//
function pageChange(page) {
pageData.query.page = page - 1
init()
}
//
const category = ref(null)
function toggleCategory() {
category.value.toggle()
}
function cateClick(cate) {
console.log(cate);
}
</script>
<style scoped>
page {
background: #F9F9F9;
}
</style>
<style lang="scss" scoped>
.stock-btns {
padding: 0 100rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
}
.safe-page {
background: #F9F9F9;
}
.icon-guige {
width: 42rpx;
height: 42rpx;
}
.bg-fff {
background-color: #fff;
}
.myTabs {
margin: 0 auto;
width: 434rpx;
height: 64rpx;
}
.input-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 26rpx;
background-color: $J-bg-ff;
.input-main {
flex: 1;
display: flex;
align-items: center;
height: 64rpx;
image {
padding: 22rpx;
width: 26rpx;
height: 26rpx;
}
input {
flex: 1;
font-size: 27rpx;
}
::v-deep uni-button {
font-size: 28rpx;
color: $my-main-color;
background: rgba(255, 255, 255, 1);
}
::v-deep.uni-easyinput {
.uni-easyinput__content {
background-color: $J-bg-f5 !important;
border-radius: $J-b-r12;
.uni-easyinput__content-input {
padding-left: 0 !important;
.uni-input-input {
border-radius: $J-b-r12 !important;
overflow: hidden !important;
}
}
.uni-input-placeholder {
font-size: 27rpx;
}
.uni-icons {
color: rgba(230, 230, 230, 1) !important;
}
}
}
}
}
.input-icon {
position: relative;
z-index: 10;
}
.search-button {
position: absolute;
right: 0;
background-color: transparent !important;
color: transparent !important;
}
.states1 {
margin-top: 78rpx;
.item {
font-size: 24rpx;
color: #666;
margin-right: 70rpx;
background: #F4F4F4;
border-radius: 8rpx 8rpx 8rpx 8rpx;
}
.item.active {
background: #E6F0FF;
color: $my-main-color;
border-radius: 8rpx 8rpx 8rpx 8rpx;
}
}
.fixed-b {
position: fixed;
left: 110rpx;
right: 110rpx;
bottom: 110rpx;
}
</style>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="11.864" height="11.592" viewBox="0 0 11.864 11.592"><defs><style>.a{fill:#64a7fe;}</style></defs><path class="a" d="M79.676,85.867H68.721a.409.409,0,0,0,0,.818h11a.407.407,0,0,0,.409-.409.534.534,0,0,0-.455-.409Zm-11-1.227H70.63A.324.324,0,0,0,70.9,84.5l6.728-6.728a.388.388,0,0,0,0-.591L75.722,75.23a.388.388,0,0,0-.591,0l-1.364,1.364L68.4,81.957a.393.393,0,0,0-.136.273v1.955a.491.491,0,0,0,.136.318.324.324,0,0,0,.273.136ZM75.4,76.093l1.364,1.364-.773.773-1.364-1.364ZM69.13,82.412l4.955-4.955,1.364,1.364-4.955,4.955H69.13Z" transform="translate(-68.267 -75.093)"/></svg>

After

Width:  |  Height:  |  Size: 622 B

View File

@ -76,12 +76,12 @@
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
* { // * {
padding: 0; // padding: 0;
margin: 0; // margin: 0;
text-decoration: none; // text-decoration: none;
outline: none; // outline: none;
} // }
ul, ul,
li { li {

View File

@ -3,7 +3,6 @@
<up-sticky v-if="option.type==='edit'" offset-top="20" zIndex="99"> <up-sticky v-if="option.type==='edit'" offset-top="20" zIndex="99">
<myTabs :list="tabsList" v-model="tabsCurrent"></myTabs> <myTabs :list="tabsList" v-model="tabsCurrent"></myTabs>
</up-sticky> </up-sticky>
<view class="box"> <view class="box">
<template v-if="tabsCurrent===0"> <template v-if="tabsCurrent===0">
<view class="basic"> <view class="basic">
@ -11,18 +10,11 @@
err-show-type="toast" validateTrigger="submit" label-width="350" ref="Forms"> err-show-type="toast" validateTrigger="submit" label-width="350" ref="Forms">
<view class="block"> <view class="block">
<uni-forms-item label="商品类型" required showRequired> <uni-forms-item label="商品类型" required showRequired>
<up-radio-group <up-radio-group :disabled="option.type=='edit'" v-model="FormData.typeEnum"
:disabled="option.type=='edit'" placement="row">
v-model="FormData.typeEnum" <up-radio :customStyle="{marginRight: '30px'}"
placement="row" v-for="(item, index) in pageData.types" :key="index" :label="item.name"
> :name="item.value">
<up-radio
:customStyle="{marginRight: '30px'}"
v-for="(item, index) in pageData.types"
:key="index"
:label="item.name"
:name="item.value"
>
</up-radio> </up-radio>
</up-radio-group> </up-radio-group>
<!-- <view class="u-flex u-flex-wrap types " :class="{disabled:option.productId!==''}"> <!-- <view class="u-flex u-flex-wrap types " :class="{disabled:option.productId!==''}">
@ -37,7 +29,7 @@
</view> --> </view> -->
</uni-forms-item> </uni-forms-item>
<uni-forms-item ref="fileItem" label="图片"> <uni-forms-item ref="fileItem" label="图片" required showRequired>
<my-upload-file ref="refFile" :images="FormData.images"></my-upload-file> <my-upload-file ref="refFile" :images="FormData.images"></my-upload-file>
<view class="u-m-t-16 color-999 u-font-24"> <view class="u-m-t-16 color-999 u-font-24">
:第一张图为商品封面图图片尺寸为750x750 :第一张图为商品封面图图片尺寸为750x750
@ -63,17 +55,6 @@
</uni-forms-item> </uni-forms-item>
</view> </view>
<!-- <uni-forms-item label="商品详情" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
type="textarea" v-model="FormData.goodsDetail" placeholder="请填写商品详情" />
</uni-forms-item> -->
<!-- <view class="">
<uni-forms-item label="规格模式" required>
<uni-data-checkbox v-model="FormData.specificationsPattern"
:localdata="specificationMode" />
</uni-forms-item>
</view> -->
<view class="border-top-0"> <view class="border-top-0">
<uni-forms-item label="单位" required showRequired name="categoryId"> <uni-forms-item label="单位" required showRequired name="categoryId">
@ -118,179 +99,29 @@
<choose-group-category @confirm="refChooseCouponCategoryConfirm" <choose-group-category @confirm="refChooseCouponCategoryConfirm"
ref="refChooseGroupCategory"></choose-group-category> ref="refChooseGroupCategory"></choose-group-category>
</template> </template>
<!-- <view class="">
<uni-forms-item label=" " required>
<view class="u-flex u-row-between zuofa" @tap="toGuige ">
<view class="color-333">{{returnSpecificationsGroup }}</view>
<uni-icons type="right"></uni-icons>
</view> </view>
</uni-forms-item> <template v-if="FormData.typeEnum=='sku' ">
</view> -->
<!-- <uni-forms-item label="底价(元)" name="floorPrice" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.floorPrice" placeholder="请输入底价(元)" />
</uni-forms-item> -->
<!-- <uni-forms-item label="售卖方式" required>
<view style="display: none;"><uni-easyinput :paddingNone="inputPaddingNone"
:inputBorder="inputBorder" v-model="FormData.salesMethod"
placeholder="请选择售卖方式" />
</view>
<picker @change="salesMethodChange" :value="salesMethod.defaultIndex"
:range="salesMethod.list">
<view class="u-flex u-row-between lh40" v-if="FormData.salesMethod===0">
<view class="color-333">{{salesMethod.list[FormData.salesMethod]||'售卖方式'}}
</view>
<uni-icons type="right"></uni-icons>
</view>
<view class="u-flex u-row-between lh40" v-if="FormData.salesMethod===1">
<view class="u-flex">
<text
class="color-333">{{salesMethod.list[FormData.salesMethod]||'售卖方式'}}</text>
<view class="u-flex color-999">
<text>(</text>
<text class="color-red">*</text>
<text class="u-font-24">注意:预售商品不支持堂食</text>
<text>)</text>
</view>
</view>
<uni-icons type="right"></uni-icons>
</view>
<view class="u-flex u-row-between lh40" v-if="FormData.salesMethod===2">
<view class="u-flex">
<text
class="color-333">{{salesMethod.list[FormData.salesMethod]||'售卖方式'}}</text>
<view class="u-flex color-999">
<text>(</text>
<text class="color-red">*</text>
<text class="u-font-24">注意:该商品仅作展示无法进行下单</text>
<text>)</text>
</view>
</view>
<uni-icons type="right"></uni-icons>
</view>
</picker>
</uni-forms-item> -->
<!-- <template v-if="FormData.salesMethod==1">
<view class="bg-gray border-top-0">
<uni-forms-item label="交货时间" required>
<radio-group @change="DeliveryTimeChange">
<label class="u-flex " :class="{
'u-m-b-40':index===0
}" v-for="(item, index) in DeliveryTime" :key="item.value">
<view>
<radio :color="ColorMain" :value="item.value"
:checked="index === DeliveryTimeCurrent" />
</view>
<view class="u-flex-1">
<template v-if="index===0">
<uni-datetime-picker v-model="FormData.startTime"
:hide-second="true" :end="limitDayTime">
<view class="u-flex u-row-between">
<view>
<text></text>
<text
class="color-999">{{FormData.startTime||'选择开始时间'}}</text>
</view>
<uni-icons type="right" color="#999"></uni-icons>
</view>
</uni-datetime-picker>
</template>
<template v-if="index===1">
<view class="u-flex ">
<view>
付款成功
</view>
<uni-easyinput :paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle"
:inputBorder="false"
v-model="FormData.paySuccessAfterDay" type="number"
placeholder="请填写天数" />
<view>
天后交货
</view>
</view>
</template>
</view>
</label>
</radio-group>
</uni-forms-item>
</view>
<view class="color-999 u-font-24 u-m-t-20 u-p-b-30">
<text class="color-red">*</text> 注意: 只允许设置{{limitDay}}天内的发货时间请务必按照约定时间发货以免引起客户投诉
</view>
<view class="">
<uni-forms-item label="" required>
<slot name="label">
<view class="class">
<text class="label-title u-m-r-6">预售可预约天数</text>
<uni-icons @click="showModel('help')" color="#999"
type="help"></uni-icons>
</view>
</slot>
<view class="u-flex">
<uni-easyinput :paddingNone="inputPaddingNone" :min="1" :max="15"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.discountPrice" type="number" placeholder="填写天数" />
<text></text>
</view>
</uni-forms-item>
</view>
</template> -->
<!-- <uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">库存</view>
<my-switch v-model="FormData.isStock"></my-switch>
</view>
</uni-forms-item>
<view class="border-top-0 none-label" v-if="FormData.isStock">
<uni-forms-item label="" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.stockNumber" type="number"
placeholder="请填写库存" />
</uni-forms-item>
</view> -->
</view>
<template v-if="FormData.typeEnum==='sku' ">
<!-- <view class="block border-top-0">
<uni-forms-item label="选择规格" required name="categoryId">
<uni-data-picker :clear-icon="false" @change="specIdChange"
:map="{text:'name',value:'id'}" placeholder="请选择规格" popup-title="请选择规格"
:localdata="pageData.specList" v-model="FormData.specId">
</uni-data-picker>
</uni-forms-item>
</view> -->
<view class="block border-top-0"> <view class="block border-top-0">
<uni-forms-item label=" "> <uni-forms-item label=" ">
<view class="u-flex u-row-between " @tap="toGuige"> <view class="u-flex u-row-between " @tap="toGuige">
<view class="color-333 font-bold"> <view class="color-333 font-bold">
<text v-if="!skuList.length">选择规格</text> <text v-if="!skuList.list.length">选择规格</text>
<text v-else>编辑规格</text> <text v-else>编辑规格</text>
</view> </view>
<uni-icons type="right"></uni-icons> <uni-icons type="right"></uni-icons>
</view> </view>
</uni-forms-item> </uni-forms-item>
<template v-if="skuList.length"> <template v-if="skuList.list.length">
<view class="u-text-center"> <view class="u-text-center">
<view class="u-flex font-bold u-m-b-12"> <view class="u-flex font-bold u-m-b-12">
<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>
<view class="u-flex u-p-b-12 u-p-t-12" v-for="(item,index) in skuList" <view class="u-flex u-p-b-12 u-p-t-12" v-for="(item,index) in skuList.list"
:key="index"> :key="index">
<view class="u-flex-1">{{item.specSnap}}</view> <view class="u-flex-1">{{item.specSnap}}</view>
<view class="u-flex-1">{{item.salePrice}}</view> <view class="u-flex-1">{{item.salePrice}}</view>
<view class="u-flex-1">{{item.stockNumber}}</view> <view class="u-flex-1">{{item.stockNumber}}</view>
</view> </view>
</view> </view>
@ -374,9 +205,9 @@
</view> </view>
</template> </template>
<template v-if="FormData.typeEnum!=='sku'"> <template v-if="FormData.typeEnum!='sku'">
<view class="u-m-t-32 u-font-32 u-m-l-10 u-m-b-32">规格属性</view> <view class="u-m-t-32 u-font-32 u-m-l-10 u-m-b-32">规格属性</view>
<view class="block" v-for="(sku,index) in skuList" :key="index"> <view class="block" v-for="(sku,index) in skuList.list" :key="index">
<view class="border-top-0"> <view class="border-top-0">
<uni-forms-item label="售价"> <uni-forms-item label="售价">
<uni-easyinput :paddingNone="inputPaddingNone" <uni-easyinput :paddingNone="inputPaddingNone"
@ -392,7 +223,7 @@
:inputBorder="inputBorder" v-model="sku.memberPrice" type="digit" :inputBorder="inputBorder" v-model="sku.memberPrice" type="digit"
placeholder="请输入会员价(元)" /> placeholder="请输入会员价(元)" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="成本价(元)"> <!-- <uni-forms-item label="成本价(元)">
<uni-easyinput @blur="priceFormat(sku,'costPrice')" :paddingNone="inputPaddingNone" <uni-easyinput @blur="priceFormat(sku,'costPrice')" :paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder" :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="sku.costPrice" type="digit" placeholder="请输入成本价(元)" /> v-model="sku.costPrice" type="digit" placeholder="请输入成本价(元)" />
@ -402,7 +233,7 @@
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle" :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="sku.originPrice" type="digit" :inputBorder="inputBorder" v-model="sku.originPrice" type="digit"
placeholder="请输入原价(元)" /> placeholder="请输入原价(元)" />
</uni-forms-item> </uni-forms-item> -->
<uni-forms-item label="起售数量"> <uni-forms-item label="起售数量">
<uni-easyinput @blur="priceFormat(sku,'suit')" :paddingNone="inputPaddingNone" <uni-easyinput @blur="priceFormat(sku,'suit')" :paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder" :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
@ -598,138 +429,11 @@
</template> </template>
</view> </view>
</template> </template>
<!-- <view class="block">
<view class="border-top-0">
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">打折设置</view>
<my-switch v-model="FormData.openDiscount"
@change="openDiscountChange"></my-switch>
</view>
</uni-forms-item>
</view>
<view class="border-top-0 none-label" v-if="FormData.openDiscount">
<uni-forms-item label="" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.discountPrice" type="digit"
placeholder="请填写折后价" />
</uni-forms-item>
</view>
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">不参与会员折扣</view>
<my-switch v-model="FormData.isVipDiscount"></my-switch>
</view>
</uni-forms-item>
<uni-forms-item label="会员价(元)" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.vipPrice" type="digit"
placeholder="请输入会员价(元)" />
</uni-forms-item>
<uni-forms-item label="包装费(元)" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.packagingFee" type="digit"
placeholder="请输入包装费(元)" />
</uni-forms-item>
<uni-forms-item label="重量(千克)" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.weight" type="digit"
placeholder="请输入重量(千克)" />
</uni-forms-item>
<uni-forms-item label="赠送积分" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.integral" type="digit"
placeholder="请输入赠送积分" />
</uni-forms-item>
</view> -->
<!-- <view class="block">
<view class="border-top-0 ">
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">每日销量上限</view>
<my-switch v-model="FormData.openDailySalesLimit"></my-switch>
</view>
</uni-forms-item>
</view>
<view class="border-top-0 none-label" v-if="FormData.openDailySalesLimit">
<uni-forms-item label="" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.dailySalesLimit" type="digit"
placeholder="请填写每日销量上限" />
</uni-forms-item>
</view>
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">每单限购</view>
<my-switch v-model="FormData.openOrderBuyLimit"></my-switch>
</view>
</uni-forms-item>
<view class="border-top-0 none-label" v-if="FormData.openOrderBuyLimit">
<uni-forms-item label="" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.orderBuyLimit" type="digit"
placeholder="请填写每单限购" />
</uni-forms-item>
</view>
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">每人限购</view>
<my-switch v-model="FormData.openEveryoneBuyLimit"></my-switch>
</view>
</uni-forms-item>
<view class="border-top-0 none-label" v-if="FormData.openEveryoneBuyLimit">
<uni-forms-item label="" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.everyoneBuyLimit" type="digit"
placeholder="请填写每人限购" />
</uni-forms-item>
</view>
<uni-forms-item label="最低起售(件)" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.minBuyLimit" type="number"
placeholder="请输入最低起售(件)" />
</uni-forms-item>
<uni-forms-item label="包装费(元)" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.packagingFee" type="digit"
placeholder="请输入包装费(元)" />
</uni-forms-item>
<uni-forms-item label="">
<view class="u-flex u-row-between" @tap="toTimerPage">
<view>
<view class="label-title">定时上下架</view>
</view>
<view class="u-flex">
<view class="color-666">{{returnTimerText()}}</view>
<uni-icons type="right"></uni-icons>
</view>
</view>
</uni-forms-item>
<uni-forms-item label="虚拟销量" required>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.virtualSales" type="number"
placeholder="虚拟销量" />
</uni-forms-item>
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">设为推荐</view>
<my-switch v-model="FormData.isRecommend"></my-switch>
</view>
</uni-forms-item>
</view> -->
</uni-forms> </uni-forms>
<view style="height: 200rpx;"></view> <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"> <view style="padding-left: 110rpx;padding-right: 110rpx;" class="u-m-t-20"
<my-button bgColor="#F9F9F9" shape="circle" type="cancel" > v-if="option.type==='edit'" @click="delModelShow">
<my-button bgColor="#F9F9F9" shape="circle" type="cancel">
<view class="color-red">删除该商品</view> <view class="color-red">删除该商品</view>
</my-button> </my-button>
</view> </view>
@ -737,18 +441,13 @@
<view class="save-btn-box"> <view class="save-btn-box">
<my-button shape="circle" @tap="save">保存</my-button> <my-button shape="circle" @tap="save">保存</my-button>
</view> </view>
<!-- <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>
</view> -->
</view> </view>
</view> </view>
</template> </template>
<template v-if="tabsCurrent===1"> <template v-if="tabsCurrent===1">
<edit-haocai :goods="FormData" @cancel="changeTabsCurrent(0)"></edit-haocai> <edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData" @cancel="changeTabsCurrent(0)"></edit-haocai>
</template> </template>
</view> </view>
@ -768,7 +467,8 @@
<my-model @confirm="delmodelConfirm" ref="delModel" desc="确认删除"> <my-model @confirm="delmodelConfirm" ref="delModel" desc="确认删除">
</my-model> </my-model>
<!-- 选择商品 --> <!-- 选择商品 -->
<choose-goods ref="refChooseGoods" @confirm="refChooseGoodsConfirm" :category="pageData.category"></choose-goods> <choose-goods ref="refChooseGoods" @confirm="refChooseGoodsConfirm"
:category="pageData.category"></choose-goods>
<!-- 更多操作 --> <!-- 更多操作 -->
<my-action-sheet @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet> <my-action-sheet @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
</view> </view>
@ -1146,8 +846,9 @@
const tabsList = ['基础设置', '耗材绑定'] const tabsList = ['基础设置', '耗材绑定']
let tabsCurrent = ref(0) let tabsCurrent = ref(0)
function changeTabsCurrent(newval){
tabsCurrent.value=newval function changeTabsCurrent(newval) {
tabsCurrent.value = newval
} }
@ -1253,10 +954,15 @@
usageRules: "" usageRules: ""
} }
}) })
const skuList = reactive([{ const skuList = reactive({
list: [{
...$defaultSku, ...$defaultSku,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}` barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
}]) }]
})
watch(() => skuList.list, (newval) => {
console.log(newval);
})
// //
const stockData = reactive({ const stockData = reactive({
inventoryMode: 0, inventoryMode: 0,
@ -1294,13 +1000,21 @@
url: v url: v
} }
}) })
for(let i in res.conInfos){
const con=res.conInfos[i]
const item=res.skuList.find(v=>v.id==con.productSkuId)
if(item){
if(item.hasOwnProperty('haoCaiList')){
item.haoCaiList.push(con)
}else{
item.haoCaiList=[con]
}
}
}
$goodsData = res $goodsData = res
console.log(res);
Object.assign(FormData, res) Object.assign(FormData, res)
if (res.skuList.length) { skuList.list = res.skuList || []
for (let i in res.skuList) {
skuList[i] = res.skuList[i]
}
}
// //
if (res.typeEnum === 'sku') { if (res.typeEnum === 'sku') {
const selectSpec = JSON.parse(res.selectSpec) const selectSpec = JSON.parse(res.selectSpec)
@ -1319,13 +1033,12 @@
selectSpec: selectSpec.map(s => { selectSpec: selectSpec.map(s => {
return { return {
...s, ...s,
// value: s.value.map(v => { value: s.value.map(v => {
// return { return typeof v === 'string' ? {
// text: v, text: v,
// value: v value: v
// } } : v
// }) })
} }
}), }),
result: res.skuList.map(v => { result: res.skuList.map(v => {
@ -1339,7 +1052,8 @@
...v ...v
}, },
names, names,
specSnap: v.specSnap specSnap: v.specSnap,
coverImg:v.coverImg
} }
}), }),
specList: [], specList: [],
@ -1422,9 +1136,14 @@
const pageData = reactive({ const pageData = reactive({
// //
// types: $types, // types: $types,
types: [ types: [{
{name:'单规格',value:'normal'}, name: '单规格',
{name:'多规格',value:'sku'} value: 'normal'
},
{
name: '多规格',
value: 'sku'
}
], ],
// //
units: [], units: [],
@ -1441,6 +1160,10 @@
pageData.skuList = res pageData.skuList = res
}) })
} }
function updateGoodsDetail(){
getGoodsDetail()
getProductSku()
}
onLoad((params) => { onLoad((params) => {
if (isEmpty(params)) { if (isEmpty(params)) {
option.type = params.type ? params.type : 'add' option.type = params.type ? params.type : 'add'
@ -1454,6 +1177,10 @@
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: option.type === 'add' ? '添加商品' : '编辑商品' title: option.type === 'add' ? '添加商品' : '编辑商品'
}) })
if (option.type === 'edit') {
getGoodsDetail()
getProductSku()
}
defaultValueInit() defaultValueInit()
getCategory() getCategory()
getTbShopUnit() getTbShopUnit()
@ -1461,10 +1188,10 @@
}) })
onShow(() => { onShow(() => {
if (option.type === 'edit') { // if (option.type === 'edit') {
getGoodsDetail() // getGoodsDetail()
getProductSku() // getProductSku()
} // }
}) })
@ -1498,15 +1225,23 @@
if (typeEnum === 'group' && !groupCategoryId.length) { if (typeEnum === 'group' && !groupCategoryId.length) {
return infoBox.showToast('请选择团购券分类') return infoBox.showToast('请选择团购券分类')
} }
// if(typeEnum==='sku'){ // if(typeEnum==='sku'){
// return infoBox.showErrorToast('') // return infoBox.showErrorToast('')
// } // }
const images = refFile.value.getFileList() const images = refFile.value.getFileList()
if(images.length<=0){
return infoBox.showToast('请上传商品图片')
}
const skuSnap = [] const skuSnap = []
const submitSkuList = FormData.specificationsGroup ? skuList : [{ let submitSkuList = FormData.specificationsGroup ? skuList.list : [{
...$defaultSku, ...$defaultSku,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}` barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
}] }];
if(typeEnum=='normal'){
submitSkuList=skuList.list ;
}
console.log(submitSkuList);
if (FormData.specificationsGroup) { if (FormData.specificationsGroup) {
for (let i of FormData.specificationsGroup.selectSpec) { for (let i of FormData.specificationsGroup.selectSpec) {
if (i.selectSpecResult.length) { if (i.selectSpecResult.length) {
@ -1517,7 +1252,6 @@
} }
} }
} }
const submitData = { const submitData = {
...FormData, ...FormData,
images: images, images: images,
@ -1526,7 +1260,13 @@
specInfo: JSON.stringify(submitSkuList), specInfo: JSON.stringify(submitSkuList),
lowPrice: submitSkuList[0].salePrice, lowPrice: submitSkuList[0].salePrice,
specificationsGroup: undefined, specificationsGroup: undefined,
selectSpec: JSON.stringify(FormData.specificationsGroup.selectSpec), selectSpec: JSON.stringify(FormData.specificationsGroup.selectSpec.map(spe=>{
return {
...spe,value:spe.value.map(v=>{
return typeof v==='string'?v:v.text||v.value
})
}
})),
skuSnap: JSON.stringify(skuSnap) skuSnap: JSON.stringify(skuSnap)
} }
// //
@ -1562,29 +1302,33 @@
/** /**
* 监听规格保存,拿到数据 * 监听规格保存,拿到数据
* @param {Boolean} open //
*/ */
function watchSpecificationsSave(open = true) { const newSkuList = reactive({
if (open) { list: []
})
function watchSpecificationsSave() {
uni.$off('emitspecificationsSave')
uni.$on('emitspecificationsSave', function(data) { uni.$on('emitspecificationsSave', function(data) {
FormData.specificationsGroup = data FormData.specificationsGroup = data
skuList.length = data.result.length skuList.list = data.result.map(v => {
for (let i in data.result) { return {
const v = data.result[i]
skuList[i] = {
...v.skus, ...v.skus,
...v.names, ...v.names,
specSnap: v.specSnap, specSnap: v.specSnap,
coverImg: v.coverImg || ''
} }
}
console.log(skuList);
})
} else {
uni.$off('emitspecificationsSave', function(data) {
console.log('emitspecificationsSave remove');
}) })
newSkuList.list = data.result.map(v => {
return {
...v.skus,
...v.names,
specSnap: v.specSnap,
coverImg: v.coverImg || ''
} }
})
console.log(skuList.list);
})
} }
function toGroup() { function toGroup() {
@ -1666,23 +1410,20 @@
watch(() => FormData.typeEnum, (newval) => { watch(() => FormData.typeEnum, (newval) => {
if (option.type === 'add') { if (option.type === 'add') {
if (newval === 'sku') { if (newval === 'sku') {
skuList.length = 0 skuList.list = []
} else { } else {
skuList[0] = { skuList.list[0] = {
...$defaultSku, ...$defaultSku,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}` barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
} }
} }
} }
}) })
onShow(() => {
watchSpecificationsSave() watchSpecificationsSave()
watchTimerSave()
onBeforeUnmount(() => {
watchSpecificationsSave(false)
watchTimerSave(false)
}) })
onReady(() => { onReady(() => {
Forms.value&&Forms.value.setRules(rules) Forms.value && Forms.value.setRules(rules)
}) })
watch(() => pageData.types, (newval) => { watch(() => pageData.types, (newval) => {
Forms.value.setRules(rules) Forms.value.setRules(rules)
@ -1764,6 +1505,7 @@
.box { .box {
margin-top: 36rpx; margin-top: 36rpx;
font-size: 28rpx; font-size: 28rpx;
.block { .block {
background: #FFFFFF; background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx; border-radius: 18rpx 18rpx 18rpx 18rpx;

View File

@ -91,8 +91,8 @@
function haocaiClick(item, index) { function haocaiClick(item, index) {
console.log(item); console.log(item);
if (item.consId != props.modelValue) { if (item.id != props.modelValue) {
emits('update:modelValue', item.consId) emits('update:modelValue', item.id)
emits('change', item) emits('change', item)
} }
popShow.value = false popShow.value = false

View File

@ -14,9 +14,9 @@
<view class=""> <view class="">
<template v-if="isBindGuige&&isSku"> <template v-if="isBindGuige&&isSku">
<view class="list"> <view class="list">
<view class="u-p-b-32 u-p-t-32 border-bottom" v-for="(item,index) in skuList" :key="index"> <view class="u-p-b-32 u-p-t-32 border-bottom" v-for="(sku,index) in skuList" :key="index">
<view>规格名称</view> <view>规格名称</view>
<view class="u-m-t-16">{{item.specSnap}}</view> <view class="u-m-t-16">{{sku.specSnap}}</view>
<view class="color-666 u-m-t-24 u-flex"> <view class="color-666 u-m-t-24 u-flex">
<view class="xuhao">序号</view> <view class="xuhao">序号</view>
<view class="u-flex u-flex-1 u-p-l-32 gap-20"> <view class="u-flex u-flex-1 u-p-l-32 gap-20">
@ -26,29 +26,24 @@
</view> </view>
</view> </view>
<view class="u-m-t-32 color-666"> <view class="u-m-t-32 color-666">
<view class="u-m-t-24" v-for="(haocai,haocaiIndex) in item.haoaiList" <view class="u-m-t-24" v-for="(item,haocaiIndex) in sku.haoCaiList"
:key="haocaiIndex"> :key="haocaiIndex">
<view class=" u-flex"> <view class=" u-flex">
<view class="xuhao">{{haocaiIndex+1}}</view> <view class="xuhao">{{haocaiIndex+1}}</view>
<view class="u-flex u-flex-1 u-p-l-32 gap-20"> <view class="u-flex u-flex-1 u-p-l-32 gap-20">
<view class="u-flex-1 "> <view class="u-flex-1 ">
<view class="u-flex input"> <choose-haocai @change="conInfosChange($event,item)"
<view>{{item.name}}</view> :listMap="$haocaiMap" :list="haoCaiList"
<up-icon :size="10" name="arrow-down-fill"></up-icon> v-model="item.conInfoId"></choose-haocai>
</view>
</view> </view>
<view class="u-flex-1 "> <view class="u-flex-1 ">
<choose-danwei :listMap="$danweiMap" :list="danweiList"
v-model="item.conUnit"></choose-danwei>
</view>
<view class="u-flex input"> <view class="u-flex input">
<view>{{item.unit}}</view> <up-input border="none" v-model="item.surplusStock"></up-input>
<up-icon :size="10" name="arrow-down-fill"></up-icon> <up-icon @click="delGuigeHaocao(index,haocaiIndex)" color="#EB4F4F" :size="16"
</view> name="minus-circle-fill"></up-icon>
</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>
</view> </view>
@ -173,16 +168,20 @@
deletetbProskuCon, deletetbProskuCon,
} from "@/http/yskApi/consumable.js"; } from "@/http/yskApi/consumable.js";
import { import {
tbShopCurrencyGet,$hasPermission tbShopCurrencyGet,
$hasPermission
} from '@/http/yskApi/shop.js' } from '@/http/yskApi/shop.js'
import infoBox from '@/commons/utils/infoBox.js'
import chooseHaocai from './choose-haocai.vue'; import chooseHaocai from './choose-haocai.vue';
import chooseDanwei from './choose-danwei.vue'; import chooseDanwei from './choose-danwei.vue';
import { import {
$tbProskuConV2 $tbProskuConV2
} from '@/http/yskApi/goods.js' } from '@/http/yskApi/goods.js'
const emits=defineEmits(['cancel']) import { cloneWith } from 'lodash';
function cancel(){ const emits = defineEmits(['cancel', 'updateGoods'])
function cancel() {
emits('cancel') emits('cancel')
} }
const props = defineProps({ const props = defineProps({
@ -203,6 +202,7 @@
console.log(newval); console.log(newval);
conInfos.value = newval conInfos.value = newval
}) })
function conInfosChange(newval, item) { function conInfosChange(newval, item) {
console.log(newval); console.log(newval);
item.stockNumber = newval.balance item.stockNumber = newval.balance
@ -216,14 +216,15 @@
}) })
const $baseicHaocaiData = {
function addHaocai() {
conInfos.value.push({
conInfoId: '', conInfoId: '',
conUnit: '', conUnit: '',
surplusStock: '' surplusStock: ''
}
function addHaocai() {
conInfos.value.push({
...$baseicHaocaiData
}) })
} }
const popup = reactive({ const popup = reactive({
@ -233,11 +234,21 @@
}) })
function addGuigeHaocai(index) { function addGuigeHaocai(index) {
console.log(index); if (skuList.value[index].haoCaiList) {
skuList.value[index].haoCaiList.push({
...$baseicHaocaiData
})
} else {
skuList.value[index].haoCaiList = [{
...$baseicHaocaiData
}]
}
console.log(skuList.value[index]);
} }
function delHaocai(index) { function delHaocai(index) {
const item = conInfos.value[index] const item = conInfos.value[index]
console.log(item);
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '是否删除该耗材', content: '是否删除该耗材',
@ -258,7 +269,24 @@
} }
function delGuigeHaocao(guigeIndex, haocaiIndex) { function delGuigeHaocao(guigeIndex, haocaiIndex) {
skuList.value[guigeIndex].haoaiList.splice(haocaiIndex, 1) const item = skuList.value[guigeIndex].haoCaiList[haocaiIndex]
console.log(item);
uni.showModal({
title: '提示',
content: '是否删除该耗材',
success(res) {
if (res.confirm) {
if (item&&item.id) {
deletetbProskuCon([item.id]).then(res1 => {
skuList.value[guigeIndex].haoCaiList.splice(haocaiIndex, 1)
})
} else {
skuList.value[guigeIndex].haoCaiList.splice(haocaiIndex, 1)
}
}
}
})
} }
// //
@ -270,30 +298,66 @@
isBindGuige.value = isSku.value isBindGuige.value = isSku.value
}) })
function save() { async function save() {
console.log('save'); console.log('save');
const isPas= conInfos.value.every(v=>{ let isPas=false
return v.conInfoId&&v.conUnit&&v.surplusStock>0 if(!isBindGuige.value){
//
isPas = conInfos.value.every(v => {
return v.conInfoId && v.conUnit && v.surplusStock > 0
}) })
console.log(isPas); }else{
return //
let ajaxData = '' isPas = skuList.value.filter(v=>v.haoCaiList&&v.haoCaiList.length).every(sku => {
console.log(sku.haoCaiList);
return sku.haoCaiList.every(v=>{
return v.conInfoId && v.conUnit && v.surplusStock > 0
})
})
}
if (!isPas) {
return infoBox.showToast('请填写全部耗材选项值')
}
let ajaxData = {
productId: props.goods.id,
cons: []
}
if (!isBindGuige.value) { if (!isBindGuige.value) {
// //
ajaxData = conInfos.value.map(v => { ajaxData.cons = conInfos.value.map(v => {
return { return {
id: v.id || '',
conInfoId: v.conInfoId, conInfoId: v.conInfoId,
productId: props.goods.id, productId: props.goods.id,
shopId: uni.getStorageSync('shopId'), shopId: uni.getStorageSync('shopId'),
productSkuId: 0, productSkuId: 0,
surplusStock: v.surplusStock surplusStock: v.surplusStock * 1,
status: 1
} }
}) })
} else { } else {
for(let i in skuList.value){
const haocaiList=skuList.value[i].haoCaiList||[]
for(let k in haocaiList){
const v=haocaiList[k]
ajaxData.cons.push({
id: v.id || '',
conInfoId: v.conInfoId,
productId: props.goods.id,
shopId: uni.getStorageSync('shopId'),
productSkuId: skuList.value[i].id,
surplusStock: v.surplusStock * 1,
status: 1
})
}
}
} }
console.log(ajaxData); console.log(ajaxData);
$tbProskuConV2(ajaxData) await $tbProskuConV2(ajaxData)
emits('updateGoods')
infoBox.showToast('修改成功')
} }
let haoCaiList = ref([]) let haoCaiList = ref([])
@ -303,12 +367,11 @@
function init() { function init() {
gettbConsInfo({ gettbConsInfo({
page: 0, "status": 1,
size: 200
}).then(res => { }).then(res => {
for (let i in res.content) { for (let i in res.content) {
const item = res.content[i] const item = res.content[i]
$haocaiMap[item.consId] = item $haocaiMap[item.id] = item
} }
haoCaiList.value = res.content haoCaiList.value = res.content

View File

@ -21,7 +21,6 @@
</view> </view>
<view class="u-m-t-24"> <view class="u-m-t-24">
{{item.selectSpecResult}}
<uni-data-checkbox @change="createResult" multiple :selectedColor="color.ColorMain" <uni-data-checkbox @change="createResult" multiple :selectedColor="color.ColorMain"
v-model="item.selectSpecResult" :localdata="item.value"></uni-data-checkbox> v-model="item.selectSpecResult" :localdata="item.value"></uni-data-checkbox>
@ -30,6 +29,19 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="block u-m-b-32 u-p-30">
<view class="font-bold">批量修改</view>
<view class="u-flex fast-edit u-flex-wrap gap-20 u-m-t-12">
<view class="color-main item u-flex u-row-center u-col-center" v-for="(item,index) in fastEdit.list" :key="index">
<view class="u-flex u-col-center">
<view class="u-m-r-12">{{item.text}}</view>
<up-icon size="16" :color="color.ColorMain" name="edit-pen"></up-icon>
</view>
</view>
</view>
</view> -->
<view> <view>
<view class="block u-m-b-32" v-for="(item,index) in FormData.result" :key="index"> <view class="block u-m-b-32" v-for="(item,index) in FormData.result" :key="index">
@ -97,12 +109,12 @@
<uni-easyinput @blur="priceFormat(item.skus,'firstShared')" <uni-easyinput @blur="priceFormat(item.skus,'firstShared')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle" :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="item.skus.firstShared" type="digit" :inputBorder="inputBorder" v-model="item.skus.firstShared" type="digit"
placeholder="请输入起售数量" /> placeholder="请输入分销金额" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="商品条码" required> <uni-forms-item label="商品条码" required>
<uni-easyinput disabled :paddingNone="inputPaddingNone" <uni-easyinput disabled :paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder" :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.skus.barCode" placeholder="请输入起售数量" /> v-model="item.skus.barCode" placeholder="请输入商品条码" />
</uni-forms-item> </uni-forms-item>
</view> </view>
</view> </view>
@ -112,18 +124,25 @@
<view class="save-btn-box"> <view class="save-btn-box">
<button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button> <button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button>
<button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow">
<view class="u-flex u-row-center">
<view class="u-m-r-6">批量修改</view>
<up-icon name="edit-pen" :color="color.ColorMain"></up-icon>
</view>
</button>
</view> </view>
</view> </view>
<view class="bottom" ref="bottom"></view> <view class="bottom" ref="bottom"></view>
<pop-fast-edit @update="updateSkuKey" v-model:show="fastEdit.show"></pop-fast-edit>
</view> </view>
</template> </template>
<script setup> <script setup>
import myUploadFile from '@/components/my-components/my-upload-file' import myUploadFile from '@/components/my-components/my-upload-file'
import { import {
formatPrice formatPrice
} from "@/commons/utils/format.js"; } from "@/commons/utils/format.js";
import popFastEdit from "./components/fast-edit.vue"
const refFiles = ref([]); const refFiles = ref([]);
// //
function setRefFile(index) { function setRefFile(index) {
@ -135,10 +154,26 @@
}; };
} }
const fastEdit=reactive({
show:false,
list:[
{text:'会员价',key:'memberPrice',value:''},
{text:'成本价',key:'costPrice',value:''},
{text:'原价',key:'originPrice',value:''},
{text:'起售数量',key:'suit',value:''},
{text:'库存数量',key:'stockNumber',value:''},
{text:'分销金额',key:'firstShared',value:''}
],
sel:''
})
function fastEditShow(){
fastEdit.show=true
}
// //
let option={} let option={}
//number //number
function priceFormat(item, key) { function priceFormat(item, key) {
nextTick(() => { nextTick(() => {
@ -180,6 +215,18 @@
watch watch
} from 'vue'; } from 'vue';
function updateSkuKey(arr){
for(let i in FormData.result){
const sku=FormData.result[i].skus
for(let k in arr){
const item=arr[k]
if(sku.hasOwnProperty(item.key)){
sku[item.key]=item.value
}
}
}
}
const inputPaddingNone = ref(true) const inputPaddingNone = ref(true)
const form = ref(null) const form = ref(null)
@ -353,15 +400,16 @@
getTbProductSpec() getTbProductSpec()
const obj = uni.getStorageSync('guige') const obj = uni.getStorageSync('guige')
if (obj&&JSON.stringify(obj) !== '{}') { if (obj&&JSON.stringify(obj) !== '{}') {
console.log(obj.selectSpec);
option.productId=opt.productId option.productId=opt.productId
Object.assign(FormData, obj) Object.assign(FormData, obj)
for(let i of obj.result){ for(let i of obj.result){
const key=returnSpecSnap(i.names) const key=returnSpecSnap(i.names)
originSpecMap[key]=i originSpecMap[key]=i
} }
console.log(FormData);
nextTick(() => { nextTick(() => {
FormData.result = obj.result FormData.result = obj.result
console.log(FormData.result);
}) })
} }
console.log(opt); console.log(opt);
@ -516,7 +564,7 @@
left: 30rpx; left: 30rpx;
right: 30rpx; right: 30rpx;
bottom: 60rpx; bottom: 60rpx;
z-index: 100;
} }
::v-deep.uni-forms-item { ::v-deep.uni-forms-item {
@ -540,7 +588,12 @@
border-radius: 12rpx; border-radius: 12rpx;
font-size: 28rpx; font-size: 28rpx;
} }
.edit-btn{
background-color: #fff;
color: #333;
border-radius: 12rpx;
font-size: 28rpx;
}
.btn-hover-class { .btn-hover-class {
opacity: .6; opacity: .6;
} }
@ -551,7 +604,18 @@
padding-left: 42rpx; padding-left: 42rpx;
border-radius: 14rpx 14rpx 14rpx 14rpx; border-radius: 14rpx 14rpx 14rpx 14rpx;
} }
.fast-edit{
.item{
color: #333;
border: 1px solid #bbb;
padding: 4rpx 10rpx 8rpx 10rpx;
border-radius: 10rpx;
min-width: 186rpx;
&.active{
color: $my-main-color;
}
}
}
::v-deep .uni-input-placeholder { ::v-deep .uni-input-placeholder {
font-size: 28rpx; font-size: 28rpx;
} }

View File

@ -0,0 +1,157 @@
<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-36">
<view class="u-m-b-24" v-for="(item,index) in list" :key="index">
<view>{{item.text}}</view>
<view class="u-m-t-24">
<up-input v-model="item.value">
<template #suffix>
<up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button>
</template>
</up-input>
</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>
</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
}
})
const arr = [
{
text: '售价',
key: 'salePrice',
value: ''
},
{
text: '会员价',
key: 'memberPrice',
value: ''
},
{
text: '成本价',
key: 'costPrice',
value: ''
},
{
text: '原价',
key: 'originPrice',
value: ''
},
{
text: '起售数量',
key: 'suit',
value: ''
},
{
text: '库存数量',
key: 'stockNumber',
value: ''
},
{
text: '分销金额',
key: 'firstShared',
value: ''
}
]
const list = ref([...arr])
function changeShowRecoders(show) {
recoders.show = show
}
const data = ref(props.item)
const emits = defineEmits(['update:show', 'update','itemClick'])
const form = reactive({
note: ''
})
let popShow = ref(props.show)
function itemClick(item){
console.log(item);
emits('update',[item])
}
watch(() => props.show, (newval) => {
popShow.value = newval
if (newval) {
data.value = props.item
}
})
const isSku = computed(() => {
// return data.value.typeEnum == ''
return false
})
watch(() => popShow.value, (newval) => {
emits('update:show', newval)
})
function close() {
popShow.value = false
list.value=[...arr]
}
function open() {
}
function save() {
emits('update',list.value)
popShow.value = false
}
</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>

View File

@ -16,10 +16,10 @@
报损数量 报损数量
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<up-input v-model="form.number"> <up-input v-model="form.stockNumber" type="number">
<template #suffix> <!-- <template #suffix>
<view>{{data.unitName}}</view> <view>{{data.unitName}}</view>
</template> </template> -->
</up-input> </up-input>
</view> </view>
</view> </view>
@ -28,7 +28,7 @@
<view>备注</view> <view>备注</view>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea> <up-textarea :height="42" v-model="form.remark" placeholder="请输入备注"></up-textarea>
</view> </view>
</view> </view>
<view class="u-m-b-32"> <view class="u-m-b-32">
@ -36,9 +36,7 @@
<view>上传图片</view> <view>上传图片</view>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<scroll-view scroll-y="true" style="max-height: 300rpx;"> <my-up-upload :maxCount="1" :multiple="false" v-model="form.coverImg"></my-up-upload>
<my-up-upload v-model="form.images"></my-up-upload>
</scroll-view>
</view> </view>
</view> </view>
<view class="u-m-t-60"> <view class="u-m-t-60">
@ -67,8 +65,9 @@
returnCategory returnCategory
} from '@/pageProduct/util.js' } from '@/pageProduct/util.js'
import { import {
$tbShopUnit $frmLoss
} from '@/http/yskApi/goods.js' } from '@/http/yskApi/goods.js'
import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({ const props = defineProps({
show: { show: {
type: Boolean, type: Boolean,
@ -88,9 +87,9 @@
const data = ref(props.goods) const data = ref(props.goods)
const emits = defineEmits(['update:show', 'save']) const emits = defineEmits(['update:show', 'save'])
const form = reactive({ const form = reactive({
note: '', remark: '',
number: 1, stockNumber: 1,
images: [] coverImg: []
}) })
let popShow = ref(props.show) let popShow = ref(props.show)
watch(() => props.show, (newval) => { watch(() => props.show, (newval) => {
@ -111,8 +110,21 @@
} }
function save() { async function save() {
console.log(form.images); if (form.stockNumber <= 0) {
return infoBox.showToast('请输入正确的报损数量')
}
if (!form.remark) {
return infoBox.showToast('请输入备注')
}
console.log(form);
const res= await $frmLoss({
...form,
productId:props.goods.id,
coverImg:form.coverImg[0]?form.coverImg[0].serveUrl:''
})
infoBox.showToast('提交成功!')
popShow.value=false
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="control" :style="getComputedStyle()"> <view class="control" :style="getComputedStyle()">
<view class="u-flex control1" v-if="showControl1"> <view class="u-flex control1" v-if="showControl1">
<view class="btn" @click="changeShowControl1">批量管理</view> <!-- <view class="btn" @click="changeShowControl1">批量管理</view> -->
<view class="btn" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view> <view class="btn" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view>
<!-- <view class="color-999 btn u-flex u-row-center" @click="emitToggleCategory"> <!-- <view class="color-999 btn u-flex u-row-center" @click="emitToggleCategory">
<text class="u-m-r-10">{{categoryName||'选择分类'}}</text> <text class="u-m-r-10">{{categoryName||'选择分类'}}</text>
@ -114,8 +114,8 @@
.control { .control {
position: fixed; position: fixed;
left: 30rpx; left: 110rpx;
right: 30rpx; right: 110rpx;
z-index: 100; z-index: 100;
background: #3E3A3A; background: #3E3A3A;
border-radius: 100rpx; border-radius: 100rpx;

View File

@ -21,7 +21,7 @@
</view> </view>
<view class=" u-flex u-row-between u-m-t-30"> <view class=" u-flex u-row-between u-m-t-30">
<view>售罄</view> <view>售罄</view>
<up-switch :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch> <up-switch :activeValue="1" :inactiveValue="0" :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
</view> </view>
</view> </view>
</view> </view>
@ -40,7 +40,9 @@
returnCategory returnCategory
} from '@/pageProduct/util.js' } from '@/pageProduct/util.js'
import { import {
$updateGrounding, $updateProductStatus $updateGrounding,
$updateProductStatus,$updateProductData,
$tbProskuConV2
} from '@/http/yskApi/goods.js' } from '@/http/yskApi/goods.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({ const props = defineProps({
@ -73,7 +75,7 @@
// //
const isGrounding = ref(1) const isGrounding = ref(1)
const data = ref(props.goods) const data = ref(props.goods)
const emits = defineEmits(['update:show', 'save', 'isGroundingChange','isPauseSaleChange']) const emits = defineEmits(['update:show', 'save', 'isGroundingChange', 'isPauseSaleChange'])
const form = reactive({ const form = reactive({
note: '' note: ''
}) })
@ -102,21 +104,30 @@
function save() { function save() {
emits('save') emits('save')
} }
function upDateGoods(par) {
return $updateProductData([{
id: data.value.id,
isSku: 1,
shopId: uni.getStorageSync('shopId'),
...par
}])
}
async function isGroundingChange(e) { async function isGroundingChange(e) {
console.log(e); await upDateGoods({
await $updateGrounding({ key:'grounding',
isGrounding: e ? true : false, value: e
skuId: props.goods.id
}) })
emits('isGroundingChange', e) emits('isGroundingChange', e)
infoBox.showToast('更新成功') infoBox.showToast('更新成功')
} }
async function isPauseSaleChange(e) { async function isPauseSaleChange(e) {
console.log(e); console.log(e);
await $updateProductStatus({ await upDateGoods({
targetId: props.goods.id, key:'pauseSale',
updateKey: "pauseSaleSku", value: e
updateValue: e?1:0
}) })
emits('isPauseSaleChange', e) emits('isPauseSaleChange', e)
infoBox.showToast('更新成功') infoBox.showToast('更新成功')

View File

@ -87,9 +87,10 @@
<my-step :list="recoders.list"></my-step> <my-step :list="recoders.list"></my-step>
</scroll-view> </scroll-view>
<view class="color-999 u-font-24 u-flex u-row-center u-col-center"> <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-flex" @click="changeShowRecoders(false)"> -->
<view class="u-m-r-6">收起记录</view> <view class="u-flex" @click="toRecodes">
<up-icon name="arrow-up" :size="12"></up-icon> <view class="u-m-r-6">全部记录</view>
<up-icon name="arrow-right" :size="12"></up-icon>
</view> </view>
</view> </view>
</template> </template>
@ -117,7 +118,7 @@
returnCategory returnCategory
} from '@/pageProduct/util.js' } from '@/pageProduct/util.js'
import { import {
$tbShopUnit $tbShopUnit,$getProductStockDetail
} from '@/http/yskApi/goods.js' } from '@/http/yskApi/goods.js'
const props = defineProps({ const props = defineProps({
show: { show: {
@ -136,28 +137,14 @@
} }
}) })
function toRecodes(){
}
function changeShowRecoders(show) { function changeShowRecoders(show) {
recoders.show = show recoders.show = show
} }
const recoders = reactive({ const recoders = reactive({
list: [{ list: [],
title: '2024-09-15 112030', show: true,
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 active: 0
}) })
@ -171,8 +158,27 @@
popShow.value = newval popShow.value = newval
if (newval) { if (newval) {
data.value = props.goods data.value = props.goods
getProductStockDetail()
} }
}) })
async function getProductStockDetail(){
const {content}=await $getProductStockDetail({
page:0,
size:2,
productId:props.goods.id,
column:'/api/tbProductStockDetail/stock/count',
shopId:uni.getStorageSync('shopId'),
createdAt:[]
})
console.log(content);
recoders.list=content.map(v=>{
return {
...v,
title:v.createdAt,
content:v.type+':'+Math.abs(v.stockNumber)
}
})
}
const isSku = computed(() => { const isSku = computed(() => {
// return data.value.typeEnum == '' // return data.value.typeEnum == ''
return false return false

View File

@ -37,13 +37,14 @@
custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag> --> custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag> -->
</view> </view>
<view class="u-font-32"> <view class="u-font-32">
<text v-if="data.typeEnum=='单规格'">¥</text>
<text>{{data.lowPrice}}</text> <text>{{data.lowPrice}}</text>
<!-- <text>¥</text> <!-- <text>¥</text>
<text>{{data.lowPrice}}</text> <text>{{data.lowPrice}}</text>
<text v-if="data.typeEnum == '多规格'">~{{data.maxPrice }}</text> --> <text v-if="data.typeEnum == '多规格'">~{{data.maxPrice }}</text> -->
</view> </view>
</view> </view>
<view class="u-m-t-44"> <view class="u-m-t-24">
<template v-if="data.skuList.length>=2"> <template v-if="data.skuList.length>=2">
<view class="u-flex u-flex-wrap w-full gap-10 u-col-top"> <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="u-font-24 info-p-l u-m-t-14">规格</view>
@ -64,7 +65,7 @@
</view> </view>
</template> </template>
<template v-else> <template v-else>
<view style="height: 24rpx;"> <view style="height: 44rpx;">
</view> </view>
</template> </template>
@ -86,11 +87,11 @@
<view class="u-flex"> <view class="u-flex">
<view class="u-flex"> <view class="u-flex">
<view class="u-m-r-18 color-999">售罄</view> <view class="u-m-r-18 color-999">售罄</view>
<my-switch v-model="data.isSellNoneChange" @change="isHotChange"></my-switch> <my-switch v-model="isPauseSale" @change="isPauseSaleChange"></my-switch>
</view> </view>
<view class="u-flex u-m-l-30"> <view class="u-flex u-m-l-30">
<view class="u-m-r-18 color-999">下架产品</view> <view class="u-m-r-18 color-999">{{data.isGrounding?'下架产品':'上架产品' }}</view>
<my-switch v-model="data.isSellNoneChange" @change="isHotChange"></my-switch> <my-switch v-model="isGrounding" @change="isGroundingChange"></my-switch>
</view> </view>
</view> </view>
<view class="u-flex"> <view class="u-flex">
@ -109,17 +110,21 @@
<script setup> <script setup>
import { import {
ref, ref,
watch,
watchEffect watchEffect
} from 'vue'; } from 'vue';
import { import {
$goodsIsHot $goodsIsHot,
$tbProskuConV2,$updateProductData
} from '@/http/yskApi/goods.js' } from '@/http/yskApi/goods.js'
import mySwitch from '@/components/my-components/my-switch.vue' import mySwitch from '@/components/my-components/my-switch.vue'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { import {
ColorMain ColorMain
} from '@/commons/color.js' } from '@/commons/color.js'
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','editStock']) const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update',
'editStock'
])
const props = defineProps({ const props = defineProps({
index: { index: {
type: Number type: Number
@ -127,7 +132,8 @@
data: { data: {
type: Object, type: Object,
default: () => { default: () => {
return {} return {
}
} }
}, },
showChecked: { showChecked: {
@ -142,24 +148,41 @@
function isHotChange(e) { async function upDateGoods(par) {
$goodsIsHot({ const res = await $updateProductData([{
id: props.data.id, id: props.data.id,
isHot: props.data.isHot isSku: 0,
}).then(res => { shopId: uni.getStorageSync('shopId'),
...par
}])
uni.showToast({ uni.showToast({
title: '修改成功', title: '修改成功',
icon: 'none' icon: 'none'
}) })
emits('update')
}
let isPauseSale=ref(props.data.isPauseSale)
let isGrounding=ref(props.data.isGrounding)
watch(() => props.data.isPauseSale, (newval) => {
isPauseSale.value=newval
})
watch(() => props.data.isGrounding, (newval) => {
isGrounding.value=newval
})
function isPauseSaleChange(e) {
upDateGoods({
key: 'pauseSale',
value: e
}) })
} }
let isSellNone = ref(false) function isGroundingChange(e) {
isSellNone.value = props.isSellNone upDateGoods({
key: 'grounding',
function isSellNoneChange() { value: e
console.log(isSellNone.value); })
console.log('isSellNoneChange');
} }
let checked = ref(false) let checked = ref(false)
@ -196,7 +219,8 @@
function guigeClick(guigeIndex) { function guigeClick(guigeIndex) {
emits('guigeClick', props.index, guigeIndex) emits('guigeClick', props.index, guigeIndex)
} }
function editStock(){
function editStock() {
emits('editStock', props.index) emits('editStock', props.index)
} }
//type edittype //type edittype
@ -301,7 +325,7 @@
} }
.skd { .skd {
padding: 14rpx 40rpx 14rpx 20rpx; padding: 20rpx 20rpx 14rpx 20rpx;
background: #F0F2F5; background: #F0F2F5;
border-radius: 4rpx; border-radius: 4rpx;
position: relative; position: relative;

View File

@ -41,7 +41,7 @@
<view class="goods-list u-p-30"> <view class="goods-list u-p-30">
<template v-if="pageData.goodsList.length"> <template v-if="pageData.goodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index"> <view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
<my-goods @changePrice="changePriceShow" @changeClick="goodsChangeClick" <my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" @changeClick="goodsChangeClick"
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow" @editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow"
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel" @radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods> :showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
@ -187,7 +187,9 @@
page: 0, page: 0,
size: 10, size: 10,
categoryId: '', categoryId: '',
name: '' name: '',
isPauseSale:'',
isGrounding:''
}, },
category: '', category: '',
categoryList: [], // categoryList: [], //
@ -198,7 +200,12 @@
watch(() => pageData.query.categoryId, (newval) => { watch(() => pageData.query.categoryId, (newval) => {
getGoodsList() getGoodsList()
}) })
watch(() => pageData.query.isPauseSale, (newval) => {
getGoodsList()
})
watch(() => pageData.query.isGrounding, (newval) => {
getGoodsList()
})
const popup = reactive({ const popup = reactive({
price: { price: {
show: false show: false
@ -362,6 +369,7 @@
} }
function getGoodsList() { function getGoodsList() {
pageData.hasAjax = false
$tbProductV2(pageData.query).then(res => { $tbProductV2(pageData.query).then(res => {
pageData.hasAjax = true pageData.hasAjax = true
console.log(res); console.log(res);
@ -377,9 +385,10 @@
}) })
} }
onShow(() => { onShow(() => {
getGoodsList() // getGoodsList()
}) })
onLoad(() => { onLoad(() => {
getGoodsList()
$tbShopCategory({ $tbShopCategory({
page: 0, page: 0,
size: 200 size: 200
@ -470,14 +479,36 @@
function statesTableClick(index) { function statesTableClick(index) {
pageData.stateCurrent = index
}
pageData.stateCurrent = index
console.log(index);
if(index==0){
pageData.query.isPauseSale=''
pageData.query.isGrounding=''
return
}
if(index==1){
pageData.query.isPauseSale=1
pageData.query.isGrounding=''
return
}
if(index==2){
pageData.query.isPauseSale=''
pageData.query.isGrounding=1
return
}
if(index==3){
pageData.query.isPauseSale=''
pageData.query.isGrounding=0
return
}
}
let test = ref(false) let test = ref(false)
function tabsChange(i) { function tabsChange(i) {
console.log(i); console.log(i);
pageData.showGoodsDetail = i ? true : false pageData.showGoodsDetail = i ? true : false
} }

View File

@ -128,9 +128,12 @@
function diancan() { function diancan() {
const useType=props.status=='using'?props.data.useType:undefined
go.to('PAGES_CREATE_ORDER', { go.to('PAGES_CREATE_ORDER', {
tableId: props.data.tableId, tableId: props.data.tableId,
name: props.data.name name: props.data.name,
maxCapacity: props.data.maxCapacity,
status: props.data.status,
}) })
} }

View File

@ -106,6 +106,7 @@
ref, ref,
reactive, reactive,
computed, computed,
onBeforeUnmount,
watch watch
} from 'vue'; } from 'vue';
const refMoreSheet = ref(null) const refMoreSheet = ref(null)
@ -376,7 +377,12 @@
watch(() => times.active, (newval) => { watch(() => times.active, (newval) => {
setTimer() setTimer()
}) })
onBeforeUnmount(()=>{
console.log('table page onBeforeUnmount');
clearInterval(timer)
})
onHide(() => { onHide(() => {
console.log('table page hide');
clearInterval(timer) clearInterval(timer)
}) })
onShow(opt => { onShow(opt => {

View File

@ -99,6 +99,35 @@
"navigationStyle": "custom" "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", "pageId": "PAGES_USER_SETUP",
"path": "pages/userSetUp/userSetUp", "path": "pages/userSetUp/userSetUp",
@ -965,7 +994,8 @@
"pageId": "PAGES_CREATE_ORDER", "pageId": "PAGES_CREATE_ORDER",
"path": "index/index", "path": "index/index",
"style": { "style": {
"navigationBarTitleText": "代客下单" // "navigationBarTitleText": "代客下单"
"navigationBarTitleText": ""
} }
}, },
{ {
@ -1340,6 +1370,32 @@
} }
] ]
},
{
"root": "pageGoodsGroup",
"pages": [{
"pageId": "PAGES_GOODS_GROUP",
"path": "index/index",
"style": {
"navigationBarTitleText": "分组管理"
}
},
{
"pageId": "PAGES_GOODS_GROUP_EDIT",
"path": "edit-group/edit-group",
"style": {
"navigationBarTitleText": ""
}
},
{
"pageId": "PAGES_GOODS_GROUP_EDIT_GOODS",
"path" : "edit-group-goods/edit-group-goods",
"style" :
{
"navigationBarTitleText" : "管理商品"
}
}
]
} }
], ],
"globalStyle": { "globalStyle": {

View File

@ -44,8 +44,7 @@
$adList $adList
} from '@/http/apiManager.js'; } from '@/http/apiManager.js';
uni.hideTabBar() uni.hideTabBar()
onLoad((options) => { onLoad((options) => {});
});
// //
const navList = [{ const navList = [{
title: '收银', title: '收银',
@ -62,6 +61,11 @@
icon: '/static/indexImg/icon-product-control.svg', icon: '/static/indexImg/icon-product-control.svg',
pageUrl: 'PAGES_PRODUCT', pageUrl: 'PAGES_PRODUCT',
}, },
{
title: '分组管理',
icon: '/static/indexImg/goods-group.svg',
pageUrl: 'PAGES_GOODS_GROUP',
},
{ {
title: '分类管理', title: '分类管理',
icon: '/static/indexImg/icon-category.svg', icon: '/static/indexImg/icon-category.svg',
@ -80,7 +84,7 @@
title: '桌台', title: '桌台',
icon: '/static/indexImg/icon-table.svg', icon: '/static/indexImg/icon-table.svg',
pageUrl: 'PAGES_TABLE' pageUrl: 'PAGES_TABLE'
},{ }, {
title: '排队', title: '排队',
icon: '/static/indexImg/icon-table.svg', icon: '/static/indexImg/icon-table.svg',
pageUrl: 'PAGES_LINE_UP' pageUrl: 'PAGES_LINE_UP'
@ -208,6 +212,11 @@
title: '耗材管理', title: '耗材管理',
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg', icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg',
pageUrl: 'PAGES_SALES_CONSUMABLES' pageUrl: 'PAGES_SALES_CONSUMABLES'
},
{
title: '退出登录',
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg',
pageUrl: 'PAGES_LOGIN'
} }
]; ];

View File

@ -212,9 +212,15 @@
}, },
}) })
// #ifdef H5
vdata.formData.username = '19502966242' vdata.formData.username = '19502966242'
vdata.formData.pwd = '11280923' vdata.formData.pwd = '11280923'
// #endif
// #ifdef MP-WEIXIN
vdata.formData.username = '15699991111'
vdata.formData.pwd = 'qwer1234'
// #endif
const getCode = () => { const getCode = () => {
getCodeImg().then(res => { getCodeImg().then(res => {

View File

@ -24,7 +24,7 @@
<view>就餐类型</view> <view>就餐类型</view>
<view class="u-m-t-24 u-flex "> <view class="u-m-t-24 u-flex ">
<view class="u-flex color-666"> <view class="u-flex color-666">
<up-radio-group v-model="eatTypes.active" placement="row"> <up-radio-group :disabled="option.type=='add'" v-model="eatTypes.active" placement="row">
<up-radio :customStyle="{marginRight: '30px'}" v-for="(item, index) in eatTypes.list" <up-radio :customStyle="{marginRight: '30px'}" v-for="(item, index) in eatTypes.list"
:key="index" :label="item.name" :name="item.value"> :key="index" :label="item.name" :name="item.value">
</up-radio> </up-radio>
@ -75,7 +75,7 @@
</view> </view>
</view> </view>
</template> </template>
<template v-if="$shop.registerType!='restaurant'"> <template v-if="!$shop.isTableFee">
<!-- 不免餐位费 --> <!-- 不免餐位费 -->
<view class="block"> <view class="block">
<view class=" "> <view class=" ">
@ -184,7 +184,9 @@
</view> </view>
<view class="u-flex u-row-right u-m-t-38"> <view class="u-flex u-row-right u-m-t-38">
<template v-if="$shop.registerType=='munchies'">
<view class="color-main" @tap="showModel('editMoney')">修改</view> <view class="color-main" @tap="showModel('editMoney')">修改</view>
</template>
<view class="u-flex price u-m-l-32"> <view class="u-flex price u-m-l-32">
<view class="">实收金额</view> <view class="">实收金额</view>
<view class="font-bold u-font-32">{{formatPrice(allPrice) }}</view> <view class="font-bold u-font-32">{{formatPrice(allPrice) }}</view>
@ -242,6 +244,7 @@
} from '@/commons/utils/format.js'; } from '@/commons/utils/format.js';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import * as Api from '@/http/yskApi/Instead.js' import * as Api from '@/http/yskApi/Instead.js'
import $storageManage from '@/commons/utils/storageManage.js'
import { import {
tbShopInfo tbShopInfo
} from '@/http/yskApi/user.js' } from '@/http/yskApi/user.js'
@ -284,13 +287,15 @@
// //
async function updateChoseCount() { async function updateChoseCount() {
console.log($shop.value); console.log($shop.value);
if($shop.value.registerType!='restaurant'){ if (!$shop.value.isTableFee) {
// //
await Api.$choseCount({ const res = await Api.$choseCount({
masterId: option.masterId, masterId: option.masterId,
tableId: option.tableId, tableId: table.value.tableId,
num: userNumbers.defaultCateIndex, num: userNumbers.defaultCateIndex,
}) })
Object.assign($seatFee, res)
userNumbers.defaultCateIndex = res.totalNumber
} }
} }
@ -310,7 +315,7 @@
} = item } = item
const par = { const par = {
masterId: option.masterId, masterId: option.masterId,
tableId: option.tableId, tableId: table.value.tableId,
productId, productId,
num: number, num: number,
skuId skuId
@ -349,14 +354,18 @@
...table.value ...table.value
}) })
} }
const option = reactive({
masterId: '',
tableId: ""
})
// //
let user = ref(null) let user = ref(null)
// //
function setUser(par) { function setUser(par) {
console.log(option);
const submitPar = { const submitPar = {
masterId: option.masterId, masterId: option.masterId,
tableId: option.tableId, tableId: table.value.tableId,
vipUserId: user.value.id ? user.value.id : '', vipUserId: user.value.id ? user.value.id : '',
type: user.value.id ? 0 : 1 //0 1 type: user.value.id ? 0 : 1 //0 1
} }
@ -392,10 +401,7 @@
}) })
} }
const option = reactive({
masterId: '',
tableId: ""
})
const goods = reactive({ const goods = reactive({
list: [], list: [],
sel: 0 sel: 0
@ -413,9 +419,10 @@
totalAmount: 0, totalAmount: 0,
}) })
const allPrice = computed(() => { const allPrice = computed(() => {
return goods.list.reduce((prve, cur) => { const goodsTotalPrice = goods.list.reduce((prve, cur) => {
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1) return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
}, 0).toFixed(2) }, 0)
return (goodsTotalPrice + $seatFee.totalAmount || 0).toFixed(2)
}) })
function setGoodsItem(key, val) { function setGoodsItem(key, val) {
@ -430,12 +437,18 @@
page: 0, page: 0,
size: 300, size: 300,
masterId: option.masterId, masterId: option.masterId,
tableId: option.tableId tableId: table.value.tableId
}) { }) {
const { const {
records, records,
seatFee seatFee
} = await Api.getCart(par) } = await Api.getCart(par)
if (seatFee && seatFee.useType) {
$storageManage.useType(seatFee.useType)
// uni.setStorageSync('useType',seatFee.useType);
eatTypes.active = seatFee.useType == 'takeout' ? seatFee.useType : seatFee.useType.replace(
/-after|-before/g, '');
}
goods.list = getNowCart(records) goods.list = getNowCart(records)
if (seatFee && seatFee.totalNumber) { if (seatFee && seatFee.totalNumber) {
userNumbers.defaultCateIndex = seatFee.totalNumber || 1 userNumbers.defaultCateIndex = seatFee.totalNumber || 1
@ -445,7 +458,9 @@
console.log(goods.list); console.log(goods.list);
} }
let $shop = ref() let $shop = ref({
registerType: ''
})
// //
async function getTbShopInfo() { async function getTbShopInfo() {
const res = await tbShopInfo() const res = await tbShopInfo()
@ -461,27 +476,46 @@
note: note.value, note: note.value,
postPay: true, postPay: true,
orderId: '', orderId: '',
tableId: option.tableId tableId: table.value.tableId
}) { }) {
updateChoseCount() if (!$shop.value.isTableFee) {
//
await Api.$choseCount({
masterId: option.masterId,
tableId: table.value.tableId,
num: userNumbers.defaultCateIndex,
})
}
// updateChoseCount()
const res = await Api.$createOrder(par) const res = await Api.$createOrder(par)
console.log($shop.value); console.log($shop.value);
if($shop.value.registerType=='munchies'){ console.log(res);
if ($shop.value.registerType == 'munchies') {
// //
return go.to('PAGES_ORDER_DETAIL',{ return go.to('PAGES_CRESATE_ORDER_PAY', {
id:res.id orderId: res.id
}) })
} else {
//
uni.navigateBack({delta:2})
// return go.to('PAGES_ORDER_DETAIL', {
// id: res.id
// })
} }
uni.showToast({ uni.showToast({
title: '提交成功', title: '提交成功',
icon: 'none' icon: 'none'
}) })
setTimeout(() => { // setTimeout(() => {
uni.$emit('orderDetail:update') // uni.$emit('orderDetail:update')
uni.navigateBack({ // uni.navigateBack({
delta: 2 // delta: 2
}) // })
}, 500) // }, 500)
}
function init(){
} }
onLoad((opt) => { onLoad((opt) => {
@ -493,9 +527,10 @@
name: opt.name name: opt.name
} }
} }
init()
getCart() getCart()
getTbShopInfo() getTbShopInfo()
updateChoseCount() // updateChoseCount()
}) })
async function changeUseType() { async function changeUseType() {
@ -512,8 +547,10 @@
useType = `dine-in-${isPayAfter? "after" : "before"}`; useType = `dine-in-${isPayAfter? "after" : "before"}`;
uni.setStorageSync("useType", useType); uni.setStorageSync("useType", useType);
} }
const tableId = useType=='takeout'?undefined: table.value.tableId;
const res = await Api.$changeUseType({ const res = await Api.$changeUseType({
useType, useType,
tableId,
cartIds: goods.list.map((v) => v.id), cartIds: goods.list.map((v) => v.id),
}) })
return res return res

View File

@ -55,7 +55,7 @@
<view></view> <view></view>
<view>{{allPrice}}</view> <view>{{allPrice}}</view>
</view> </view>
<my-button shape="circle" height="80" width="220" @tap="toConfimOrder">去下单</my-button> <my-button shape="circle" height="80" width="220" @tap="toConfimOrder">{{table.type=='add'?'确认加菜':'去下单'}} </my-button>
</view> </view>
</template> </template>

View File

@ -128,6 +128,12 @@
import { import {
getNowCart getNowCart
} from '@/pagesCreateOrder/util.js' } from '@/pagesCreateOrder/util.js'
import {
$returnUseType
} from './util.js'
import {
tbShopInfo
} from '@/http/yskApi/user.js'
const cars = reactive([]) const cars = reactive([])
const data = reactive({ const data = reactive({
scrollTop: 0, //tab scrollTop: 0, //tab
@ -154,6 +160,18 @@
}) })
//
let $shop=ref({})
async function getTbShopInfo() {
const res = await tbShopInfo()
$shop.value = res
const useType=data.table.status=='using'?data.table.useType:$returnUseType(res)
uni.setStorageSync('useType',useType)
console.log(res);
return res
}
function setTabBar(category, goods, cars) { function setTabBar(category, goods, cars) {
@ -247,6 +265,9 @@
} }
// //
function addCart(par) { function addCart(par) {
if(!data.table.tableId){
return infoBox.showToast('请先选择台桌!')
}
const submitPar = { const submitPar = {
masterId: data.masterId, masterId: data.masterId,
tableId: data.table.tableId, tableId: data.table.tableId,
@ -318,18 +339,8 @@
} }
} }
async function init() { async function init() {
getTbShopInfo()
getTableInfo() getTableInfo()
const {
masterId
} = await getMasterId()
data.masterId = masterId
const cartRes = await getCart()
cars.length = 0
const cartArr = getNowCart(cartRes.records)
for (let i in cartArr) {
cars.push(cartArr[i])
}
const categoryRes = await getCategory() const categoryRes = await getCategory()
const category = categoryRes.content.reduce((prve, cur) => { const category = categoryRes.content.reduce((prve, cur) => {
prve.push({ prve.push({
@ -347,6 +358,21 @@
} }
return isShow; return isShow;
}); });
if(!data.table.tableId){
//
setTabBar(category, goods, [])
return
}
const {
masterId
} = await getMasterId()
data.masterId = masterId
const cartRes = await getCart()
cars.length = 0
const cartArr = getNowCart(cartRes.records)
for (let i in cartArr) {
cars.push(cartArr[i])
}
setTabBar(category, goods, cars) setTabBar(category, goods, cars)
@ -849,12 +875,15 @@
onLoad((opt) => { onLoad((opt) => {
console.log(opt) console.log(opt)
Object.assign(data.table, opt) Object.assign(data.table, opt)
if (!opt.tableId) { if(opt.useType){
infoBox.showErrorToast('暂不支持不选择台桌下载,请从桌台点餐') uni.setStorageSync('useType',opt.useType)
return setTimeout(() => {
go.back()
}, 1500)
} }
// if (!opt.tableId) {
// infoBox.showErrorToast('')
// return setTimeout(() => {
// go.back()
// }, 1500)
// }
init() init()
}) })
</script> </script>

View File

@ -1,6 +1,25 @@
//根据店铺信息返回是否是后付款
export function $trturnPayAfter(shop) {
//munchies 先付 restaurant 后付
const payAfter = shop.registerType == "munchies" ? false : true;
return payAfter
}
//根据店铺信息返回就餐类型
export function $returnUseType(shop, useType) {
//是否是后付款
const payAfter = $trturnPayAfter(shop)
let result = "takeout";
if (useType == "takeout") {
result = 'takeout'
} else {
//堂食
result = `dine-in-${payAfter ? "after" : "before"}`;
}
return result
}
//判断商品是否可以下单 //判断商品是否可以下单
export function isCanBuy(goods,isStock) { export function isCanBuy(goods, isStock) {
return goods.isGrounding && goods.isPauseSale == 0 && (isStock?goods.stockNumber > 0:true) ; return goods.isGrounding && goods.isPauseSale == 0 && (isStock ? goods.stockNumber > 0 : true);
} }
@ -47,6 +66,9 @@ function returnReverseVal(val, isReturnString = true) {
return reverseNewval; return reverseNewval;
} }
export default{ export default {
isCanBuy,arrayContainsAll,generateCombinations,returnReverseVal isCanBuy,
arrayContainsAll,
generateCombinations,
returnReverseVal,$returnUseType
} }

View File

@ -64,8 +64,7 @@
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 "> <view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 ">
</view> </view>
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 "> <view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
</view> </view>
@ -84,7 +83,7 @@
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import * as Api from '@/http/yskApi/Instead.js' import * as Api from '@/http/yskApi/Instead.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue' import editDiscount from '/pagesCreateOrder/components/edit-discount.vue'
const pays = reactive({ const pays = reactive({
list: ['扫码收款', '二维码收款'], list: ['扫码收款', '二维码收款'],
selIndex: 0, selIndex: 0,
@ -116,23 +115,33 @@
pays.payTypes.selIndex = i pays.payTypes.selIndex = i
} }
// //
function paySuccess(){ function paySuccess() {
infoBox.showToast('支付成功') infoBox.showToast('支付成功')
setTimeout(() => { setTimeout(() => {
// uni.$emit('orderDetail:update') // uni.$emit('orderDetail:update')
uni.navigateBack({delta:2}) uni.navigateBack({
delta: 2
})
}, 500) }, 500)
} }
async function payOrder() { async function payOrder(code) {
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
await Api.$payOrder({ console.log({
tableId: order.tableId, tableId: order.tableId,
masterId: order.masterId, masterId: order.masterId,
orderId: order.id||order.orderId, orderId: order.id || order.orderId,
payType, payType,
vipUserId: order.userId, vipUserId: order.userId,
discount: 1, discount: 1,
code: '' code: code
});
await Api.$payOrder({
tableId: order.tableId,
masterId: order.masterId,
orderId: order.id || order.orderId,
payType,
vipUserId: order.userId,
code: code
}) })
paySuccess() paySuccess()
} }
@ -148,18 +157,10 @@
const item = pays.payTypes.list[pays.payTypes.selIndex] const item = pays.payTypes.list[pays.payTypes.selIndex]
uni.scanCode({ uni.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
success:function (res) { success: function(res) {
console.log('条码类型:' + res.scanType); console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result); console.log('条码内容:' + res.result);
Api.$payOrder({ payOrder(res.result)
"orderId": order.orderId, // id
"payType": item.payType, //
"discount": order.discount,
"code": res.result
}).then(res=>{
console.log(res);
paySuccess()
})
} }
}); });
} }

View File

@ -2,7 +2,12 @@
<view class="default-box-padding bg-fff border-r-12 u-m-t-20"> <view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="font-bold">附加费</view> <view class="font-bold">附加费</view>
<my-button plain shape="circle" :width="160" :height="56">退菜</my-button> <template v-if="orderInfo.status=='unpaid'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
</template>
<template v-if="orderInfo.status=='closed'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
</template>
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>{{data.name||'餐位费'}}</view> <view>{{data.name||'餐位费'}}</view>
@ -18,6 +23,10 @@
type: Object, type: Object,
default: () => {} default: () => {}
}, },
orderInfo:{
type: Object,
default: () => {}
},
table:{ table:{
type: Object, type: Object,
default: () => {} default: () => {}
@ -27,9 +36,16 @@
const statusMap={ const statusMap={
unpaid:'未支付' unpaid:'未支付'
} }
const emits=defineEmits(['tuicai','tuikuan','printOrder'])
function returnStatus(status){ function returnStatus(status){
return statusMap[status]||'' return statusMap[status]||''
} }
function tuikuan(){
emits('tuikuan',props.data)
}
function tuicai(){
emits('tuicai',props.data)
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -17,15 +17,23 @@
<view class="u-p-l-30 u-flex-1"> <view class="u-p-l-30 u-flex-1">
<view class="u-flex u-row-between u-col-top"> <view class="u-flex u-row-between u-col-top">
<view class="">
<view class="u-flex"> <view class="u-flex">
<view class="tui" v-if="item.status=='return'"> <view class="tui" v-if="item.status=='return'">
已退 已退
</view> </view>
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view> <view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view>
</view> </view>
<view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view>
</view>
<view class="u-text-right"> <view class="u-text-right">
<view>{{item.salePrice||item.price}}</view> <template v-if="item.status=='return'">
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">{{item.salePrice||item.price}}</view> <view >0.00</view>
<view class="line-th color-666 u-font-24">{{item.salePrice||item.price}}</view>
</template>
<template v-else>
<view >{{item.salePrice||item.price}}</view>
</template>
<view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view> <view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view>
</view> </view>
</view> </view>

View File

@ -6,7 +6,7 @@
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>订单类型</view> <view>订单类型</view>
<view>堂食</view> <view>{{returnUseType(data.useType)}}</view>
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>桌位号</view> <view>桌位号</view>
@ -26,7 +26,7 @@
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>下单时间</view> <view>下单时间</view>
<view ><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view> <view><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <view class="u-flex u-row-between u-m-t-20">
<view>订单编号</view> <view>订单编号</view>
@ -46,19 +46,28 @@
type: Object, type: Object,
default: () => {} default: () => {}
}, },
table:{ table: {
type: Object, type: Object,
default: () => {} default: () => {}
}, },
seatFee:{ seatFee: {
type: Object, type: Object,
default: () => {totalNumber:0} default: () => {
totalNumber: 0
}
} }
}) })
function returnStatus(status){ function returnStatus(status) {
const item=orderEnum.status.find(v=>v.key==status) const item = orderEnum.status.find(v => v.key == status)
return item?item.label:'' return item ? item.label : ''
}
function returnUseType(useType) {
if (!useType) {
return ''
}
return useType == "takeout" ? '堂食' : '自取';
} }
</script> </script>

View File

@ -5,9 +5,11 @@
<text class="color-666">桌位号</text> <text class="color-666">桌位号</text>
<text class="font-bold">{{orderDetail.info.tableName}}</text> <text class="font-bold">{{orderDetail.info.tableName}}</text>
</view> </view>
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info" :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount" <goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
@tuicai="onTuiCai"></goods-list> :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount" @tuicai="onTuiCai"></goods-list>
<extra-vue :data="orderDetail.seatFee"></extra-vue> <template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount">
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info" :data="orderDetail.seatFee"></extra-vue>
</template>
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue> <order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
<step-vue></step-vue> <step-vue></step-vue>
<view style="height: 200rpx;"></view> <view style="height: 200rpx;"></view>
@ -51,58 +53,84 @@
onHide onHide
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
import { import {
reactive, ref reactive,
ref
} from 'vue'; } from 'vue';
import OrderDetail from './page.js' import OrderDetail from './page.js'
const tuicai = reactive({ const tuicai = reactive({
show: false, show: false,
isSeatFee:false,
selGoods: {} selGoods: {}
}) })
function onSeatFeeTuicai(seatFee){
tuicai.show = true
tuicai.isSeatFee = seatFee
tuicai.selGoods = seatFee
}
function onSeatFeeTuiKuan(seatFee){
go.to('PAGES_ORDER_TUIKUAN', {
})
}
function onTuiCai(goods, index) { function onTuiCai(goods, index) {
console.log(goods); console.log(goods);
tuicai.show = true tuicai.show = true
tuicai.selGoods = goods 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() { async function tuicaiConfirm() {
console.log(tuicai.selGoods); console.log(tuicai.selGoods);
const res = await Api.$returnCart({ const res = await Api.$returnCart({
cartId:tuicai.selGoods.hasOwnProperty('cartId')? tuicai.selGoods.cartId:tuicai.selGoods.id, cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
tableId: orderDetail.info.tableId, tableId: orderDetail.info.tableId,
}) })
tuicai.selGoods.status = 'return' tuicai.selGoods.status = 'return'
tuicai.show = false tuicai.show = false
} }
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) {
const {id,productId,productSkuId,productName,productSkuName,cartId,num,priceAmount,price}=goods
go.to('PAGES_ORDER_TUIKUAN', {
id,
cartId,
productId,
productSkuId,
productName,
num,
number:0,
productSkuName:productSkuName||'',
priceAmount,price
})
}
const uiPage = new OrderDetail() const uiPage = new OrderDetail()
setTimeout(() => { setTimeout(() => {
uiPage.setVal('user', { uiPage.setVal('user', {
@ -112,8 +140,8 @@
function diancan() { function diancan() {
go.to('PAGES_CREATE_ORDER', { go.to('PAGES_CREATE_ORDER', {
tableId: options.tableId, tableId: options.tableId || orderDetail.info.tableId,
tableName: options.name, name: options.name || orderDetail.info.tableName,
type: 'add' type: 'add'
}) })
} }
@ -138,13 +166,13 @@
const options = reactive({}) const options = reactive({})
async function init() { async function init() {
const res = await orderApi.tbOrderInfoDetail(options.id) const res = await orderApi.tbOrderInfoDetail(options.id)
if(res.detailList.length){ if (res.detailList.length) {
uni.setStorageSync('useType',res.detailList[0].useType) uni.setStorageSync('useType', res.detailList[0].useType)
} }
const masterId = res.masterId const masterId = res.masterId
options.masterId = res.masterId options.masterId = res.masterId
if (res.status == 'unpaid') { // if (res.status == 'unpaid') {
// if (false) { if (false) {
const { const {
records, records,
seatFee seatFee
@ -161,6 +189,7 @@
for (let i in res.detailList) { for (let i in res.detailList) {
const goods = res.detailList[i] const goods = res.detailList[i]
if (goods.productName != '客座费') { if (goods.productName != '客座费') {
console.log(goods);
if (goodsMap.hasOwnProperty(goods.placeNum)) { if (goodsMap.hasOwnProperty(goods.placeNum)) {
goodsMap[goods.placeNum].push(goods) goodsMap[goods.placeNum].push(goods)
} else { } else {
@ -181,7 +210,6 @@
})) }))
console.log(orderDetail.goodsList); console.log(orderDetail.goodsList);
} }
console.log(orderDetail);
orderDetail.info = res orderDetail.info = res
} }
@ -198,14 +226,15 @@
// //
function setUser(par) { function setUser(par) {
const submitPar = { const submitPar = {
masterId: option.masterId, masterId: options.masterId,
tableId: option.tableId, tableId: options.tableId,
vipUserId: user.value.id ? user.value.id : '', vipUserId: user.value.id ? user.value.id : '',
type: user.value.id ? 0 : 1 //0 1 type: user.value.id ? 0 : 1 //0 1
} }
Object.assign(submitPar, par) Object.assign(submitPar, par)
return Api.$setUser(submitPar) return Api.$setUser(submitPar)
} }
function watchChooseuser() { function watchChooseuser() {
uni.$off('choose-user') uni.$off('choose-user')
uni.$on('choose-user', (data) => { uni.$on('choose-user', (data) => {
@ -218,11 +247,11 @@
onShow(() => { onShow(() => {
watchEmit() watchEmit()
watchChooseuser() watchChooseuser()
init()
}) })
onLoad((opt) => { onLoad((opt) => {
Object.assign(options, opt) Object.assign(options, opt)
console.log(options); console.log(options);
init()
}) })
</script> </script>

View File

@ -96,7 +96,8 @@
} }
} }
goodsMapInit() goodsMapInit()
watch(() => props.data.detailList, (newval) => { watch(() => props.data.detailList.length, (newval) => {
goodsNumber.value=0
goodsMapInit() goodsMapInit()
}) })
@ -111,8 +112,10 @@
} }
function sendTypeFilter(t) { function sendTypeFilter(t) {
console.log(t);
if (t) { if (t) {
return orderEnum.sendType.find(item => item.key == t).label; const item=orderEnum.sendType.find(item => item.key == t)
return item?item.label:'';
} else { } else {
return t; return t;
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="list"> <view class="list">
<view v-for="(item,index) in list" :key="index"> <view v-for="(item,index) in list" :key="index">
<order-item @printOrder="print" :data="item" :index="index"></order-item> <order-item @printOrder="print" :key="index" :data="item" :index="index"></order-item>
</view> </view>
<view v-if="hasAjax&&!list.length"> <view v-if="hasAjax&&!list.length">
<my-img-empty tips="亲,你还没有订单哦~"></my-img-empty> <my-img-empty tips="亲,你还没有订单哦~"></my-img-empty>

View File

@ -4,16 +4,18 @@
<view class="search bg-fff u-p-t-32 u-p-l-28 u-p-r-28 u-p-b-32"> <view class="search bg-fff u-p-t-32 u-p-l-28 u-p-r-28 u-p-b-32">
<up-search v-bind="search" v-model="search.val"></up-search> <up-search v-bind="search" v-model="search.val"></up-search>
</view> </view>
<filter-vue v-model:time="pageData.order.query.createdAt"></filter-vue> <filter-vue v-model:time="order.data.query.createdAt"></filter-vue>
</view> </view>
<order-list @printOrder="onPrintOrder" :hasAjax="pageData.order.hasAjax" :list="pageData.order.list"></order-list> <order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list>
<my-pagination :totalElements="pageData.order.totalElements"></my-pagination> <my-pagination @change="pageChange" :totalElements="order.data.total"></my-pagination>
<view style="height: 100rpx;"></view> <view style="height: 100rpx;"></view>
</view> </view>
</template> </template>
<script setup> <script setup>
import {onLoad,onShow,onPullDownRefresh} from '@dcloudio/uni-app'
import * as Api from '@/http/yskApi/order.js' import * as Api from '@/http/yskApi/order.js'
import LIST from '@/commons/class/list.js'
import {$printOrder} from '@/http/yskApi/Instead.js' import {$printOrder} from '@/http/yskApi/Instead.js'
import filterVue from './compoents/filter.vue'; import filterVue from './compoents/filter.vue';
import orderList from './compoents/order-list.vue'; import orderList from './compoents/order-list.vue';
@ -21,6 +23,7 @@
import { import {
reactive, watch reactive, watch
} from 'vue'; } from 'vue';
const search = reactive({ const search = reactive({
val: '', val: '',
placeholder: '搜索单号/昵称/姓名/手机号码/商品名称', placeholder: '搜索单号/昵称/姓名/手机号码/商品名称',
@ -33,11 +36,8 @@
} }
}) })
const pageData = reactive({ const order=new LIST({
order: {
list: [], list: [],
totalElements:0,
hasAjax:false,
query: { query: {
createdAt: [], createdAt: [],
id: "", id: "",
@ -49,20 +49,34 @@
productName: "", productName: "",
status: "" status: ""
} }
}
}) })
watch(()=>pageData.order.query.createdAt,(newval)=>{ function pageChange(e){
order.setVal('page',e)
console.log(e);
console.log(order.data.page);
init()
}
console.log(order.list);
watch(()=>order.data.query.createdAt,(newval)=>{
init() init()
}) })
async function init() { async function init() {
const {content,totalElements}=await Api.tbOrderInfoData(pageData.order.query) const {content,totalElements}=await Api.tbOrderInfoData({...order.data.query,page:order.data.page})
pageData.order.hasAjax=true uni.stopPullDownRefresh()
pageData.order.totalElements=totalElements order.setVal('list',content)
pageData.order.list=content console.log(order.data.list);
console.log(content); order.setVal('total',totalElements)
order.setVal('hasAjax',true)
} }
onPullDownRefresh(()=>{
pageData.order.query.page=0
init() init()
})
onShow(init)
async function printOrder(item){ async function printOrder(item){
try{ try{
console.log(item); console.log(item);

View File

@ -49,21 +49,22 @@
<text>余额</text> <text>余额</text>
<text>0.00</text> <text>0.00</text>
</view> --> </view> -->
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex"> <my-radio @click="changePayType(index)"
:modelValue="index==pays.payTypes.selIndex">
</my-radio> </my-radio>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="u-m-t-60 u-p-b-30"> <view class="u-m-t-60 u-p-b-30">
<my-button @click="payOrder">确认付款</my-button> <my-button @click="payOrderClick">确认付款</my-button>
</view> </view>
</template> </template>
<template v-else> <template v-else>
<view class=""> <view class="">
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view> <view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
<view class="u-flex u-row-center u-m-t-40 "> <view class="u-flex u-row-center u-m-t-40 ">
<up-qrcode :size="140" val="uview-plus"></up-qrcode> <up-qrcode :size="140" :val="payCodeUrl"></up-qrcode>
</view> </view>
</view> </view>
</template> </template>
@ -78,18 +79,20 @@
<view class="font-bold u-font-32 u-text-center"> <view class="font-bold u-font-32 u-text-center">
{{discount.currentPrice?discount.currentPrice: order.amount}}</view> {{discount.currentPrice?discount.currentPrice: order.amount}}</view>
<view class="u-flex u-row-center u-m-t-24"> <view class="u-flex u-row-center u-m-t-24">
<template v-if="order.status=='unpaid'">
<up-loading-icon size="14" text="等待支付"></up-loading-icon> <up-loading-icon size="14" text="等待支付"></up-loading-icon>
</template>
<template v-if="order.status=='closed'">
<view class="u-flex pay-success"> <view class="u-flex pay-success">
<up-icon color="#5CBB6F" name="checkmark-circle-fill"></up-icon> <up-icon color="#5CBB6F" name="checkmark-circle-fill"></up-icon>
<view class="u-m-l-6">支付成功</view> <view class="u-m-l-6">支付成功</view>
</view> </view>
</template>
</view> </view>
</view> </view>
</template> </template>
</view> </view>
</view> </view>
@ -107,7 +110,8 @@
reactive, reactive,
onMounted, onMounted,
watch, watch,
ref ref,
onBeforeUnmount
} from 'vue'; } from 'vue';
import { import {
onLoad onLoad
@ -119,6 +123,12 @@
let payStatus = ref(null) //loading success let payStatus = ref(null) //loading success
let timer = null
function clear() {
clearInterval(timer)
timer = null
}
const pays = reactive({ const pays = reactive({
list: ['扫码收款', '二维码收款'], list: ['扫码收款', '二维码收款'],
@ -129,6 +139,22 @@
} }
}) })
watch(() => pays.selIndex, (newval) => {
clearInterval(timer)
if (newval) {
timer = setInterval(() => {
orderApi.tbOrderInfoDetail(order.orderId).then(res => {
order.status=res.status
if(res.status=='closed'){
paySuccess()
}
})
}, 2000)
} else {
}
})
const models = new Map(); const models = new Map();
function setModel(el) { function setModel(el) {
@ -169,6 +195,15 @@
}) })
}, 500) }, 500)
} }
function payOrderClick(){
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
console.log(payType);
if(payType=='scanCode'||payType=='deposit'){
return saomaPay()
}
payOrder()
}
async function payOrder() { async function payOrder() {
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
await Api.$payOrder({ await Api.$payOrder({
@ -190,6 +225,8 @@
amount: 0 amount: 0
}) })
function saomaPay() { function saomaPay() {
const item = pays.payTypes.list[pays.payTypes.selIndex] const item = pays.payTypes.list[pays.payTypes.selIndex]
uni.scanCode({ uni.scanCode({
@ -223,14 +260,26 @@
return saomaPay('scanCode') return saomaPay('scanCode')
} }
}) })
let payCodeUrl = ref('')
async function init() { async function init() {
const res = await orderApi.tbOrderInfoDetail(order.orderId) const res = await orderApi.tbOrderInfoDetail(order.orderId)
Object.assign(order, res) Object.assign(order, res)
} }
onLoad((opt) => { onLoad((opt) => {
orderApi.$getOrderPayUrl({
orderId: opt.orderId
}).then(res => {
payCodeUrl.value = res
})
console.log(opt);
Object.assign(order, opt) Object.assign(order, opt)
init() init()
}) })
onBeforeUnmount(() => {
clear()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,22 +1,178 @@
<template> <template>
<view class="min-page bg-gray u-p-30">
<view class="bg-fff u-p-24 border-r-12 u-flex u-row-between">
<view>全退</view>
<view> <view>
<my-radio v-model="allTui"></my-radio>
</view>
</view>
<view class="bg-fff border-r-12 list u-m-t-32">
<view class="u-flex u-row-between border-top item u-p-t-32 u-p-b-32"
v-for="(item,index) in orderDetail.goodsList" :key="index">
<view>
<view>{{item.productName}}</view>
<view class="u-m-t-10 color-999 u-font-24">{{item.productSkuName||""}}</view>
<view class="u-m-t-10 color-999 u-font-24">最多可退×{{item.num}}</view>
</view>
<view class="u-flex">
<view class="color-red">{{item.priceAmount}}</view>
<view class="u-flex u-m-l-32 u-col-center">
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
<up-icon @click="changeItem(item,1)" :color="color.ColorMain" :size="20"
name="plus-circle-fill"></up-icon>
</view>
</view>
</view>
</view>
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
<view>支付金额</view>
<view>
{{to2(totalPrice)}}
</view>
</view>
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
<view>退款金额</view>
<view class="color-red">
{{to2(tuikuanPrice)}}
</view>
</view>
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
<view>退回优惠券</view>
<view class="u-font-24 color-999 u-m-t-16">
该订单未使用优惠券
</view>
</view>
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
<view>
<text class="color-red">*</text>
<text>退款原因</text>
</view>
<view class="u-m-t-24 u-flex u-flex-wrap gap-28">
<view class="tag" @click="changeTuiKuanSel(index)" v-for="(item,index) in tuikuan.list" :key="index">
{{item}}
</view>
</view>
<view class="u-m-t-24">
<up-textarea placeholder="选填" v-model="note"></up-textarea>
</view>
</view>
<view style="height: 200rpx;"></view>
<view class="fixed-b">
<up-button text="确认退款" shape="circle" type="primary" size="large" :color="color.ColorMain"></up-button>
</view>
</view> </view>
</template> </template>
<script> <script setup>
export default { import color from '@/commons/color.js';
data() { import * as orderApi from '@/http/yskApi/order.js'
return { import {
onLoad,
onShow,
onHide
} from '@dcloudio/uni-app';
import {
computed,
reactive,
ref,
watch
} from 'vue';
let allTui = ref(false)
let note = ref('')
const tuikuan = reactive({
list: ['点错', '数量点错', '客人要求', '协商退费'],
sel: 0
})
function changeTuiKuanSel(i) {
tuikuan.sel = i
} }
}, const orderDetail = reactive({
methods: { goodsList: [],
info: {},
seatFee: {
totalAmount: 0
}
})
watch(()=>allTui.value,(newval)=>{
orderDetail.goodsList.map(v=>{
v.number=newval?v.num:0
})
})
const totalPrice = computed(() => {
return orderDetail.goodsList.reduce((prve, cur) => {
return prve+cur.priceAmount*1
}, 0)
})
const tuikuanPrice = computed(() => {
return orderDetail.goodsList.reduce((prve, cur) => {
return prve+cur.number*cur.price
}, 0)
})
function to2(n){
return Number(n).toFixed(2)
} }
function changeItem(item, step) {
console.log(item);
let newval = item.number * 1 + step * 1
if (newval <= 0) {
newval = 0
} }
if (newval >= item.num) {
newval = item.num
}
item.number = newval
}
onLoad((opt) => {
if (Array.isArray(opt)) {
orderDetail.goodsList = opt
} else {
orderDetail.goodsList = [opt]
}
console.log(opt);
})
</script> </script>
<style> <style lang="scss" scoped>
.fixed-b {
position: fixed;
left: 110rpx;
right: 110rpx;
bottom: calc(env(safe-area-inset-bottom) + 32rpx);
/* #ifdef H5 */
bottom: 100rpx;
/* #endif */
}
.gap-28 {
gap: 28rpx;
font-size: 24rpx;
}
.list {
padding: 0 24rpx;
}
.list .item:first-child {
border: none;
}
.tag {
padding: 8rpx 16rpx 6rpx 16rpx;
border: 1px solid #E5E5E5;
border-radius: 4rpx;
&.active {
border-color: #E6F0FF;
color: $my-main-color;
}
}
</style> </style>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32"><defs><style>.a{fill:#80bcff;}.b{clip-path:url(#a);}.c{fill:#4c99fe;}</style><clipPath id="a"><rect class="a" width="32" height="32" transform="translate(-15261 9372)"/></clipPath></defs><g class="b" transform="translate(15261 -9372)"><path class="c" d="M23.412,15.668H13.271a1.71,1.71,0,0,1,0-3.385H23.412a1.71,1.71,0,0,1,0,3.385M6.082,20.654a1.647,1.647,0,0,0,1.5,1.781c.034,0,.069,0,.1.006a1.8,1.8,0,0,0,0-3.572,1.647,1.647,0,0,0-1.611,1.683c0,.034,0,.069.005.1m0-6.676A1.649,1.649,0,0,0,7.588,15.76l.1.005a1.71,1.71,0,0,0,1.606-1.788,1.71,1.71,0,0,0-1.605-1.786,1.71,1.71,0,0,0-1.606,1.786m17.325,8.37H13.271a1.71,1.71,0,0,1,0-3.385H23.412a1.71,1.71,0,0,1,0,3.385m6.93,5.453V6.638c0-2.538-2.113-2.352-2.113-2.352H16.312a1.76,1.76,0,0,1-1.1-.38,21.847,21.847,0,0,1-1.438-2.435C12.932-.221,11.834.06,11.834.06H2.622A2.641,2.641,0,0,0,0,2.719V27.613c0,3.1,2.113,2.728,2.113,2.728H28.481c2.2,0,1.86-2.54,1.86-2.54" transform="translate(-15260.509 9372.448)"/></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -20,7 +20,11 @@ H5, 不影响。
* uni-drawer 组件使用的 px :style="{width:drawerWidth+'px'}" 单位 使用时 请将组件内 改为rpx ``<view class="uni-drawer__content" :class="{'uni-drawer--right': rightMode,'uni-drawer--left': !rightMode, 'uni-drawer__content--visible': showDrawer}" :style="{width:drawerWidth+'rpx'}">`` * uni-drawer 组件使用的 px :style="{width:drawerWidth+'px'}" 单位 使用时 请将组件内 改为rpx ``<view class="uni-drawer__content" :class="{'uni-drawer--right': rightMode,'uni-drawer--left': !rightMode, 'uni-drawer__content--visible': showDrawer}" :style="{width:drawerWidth+'rpx'}">``
由于是动态传参 所以无法样式复写 由于是动态传参 所以无法样式复写
### 微信小程序兼容行考虑
* 分包内组件路径为 /分包目录/*/组件名称; 使用@/分包目录/*/组件名称会报错。
* 分包只能使用分包内的图路径或者static目录下 分包使用别的分包下图片会导致图片未找到
* uni tabBar 配置项 请参考 [tabBar配置网址]<https://uniapp.dcloud.net.cn/collocation/pages.html#tabbar> * uni tabBar 配置项 请参考 [tabBar配置网址]<https://uniapp.dcloud.net.cn/collocation/pages.html#tabbar>
*
### 打包注意事项 ### 打包注意事项
* 准备资料: * 准备资料: