增加临时菜页面

This commit is contained in:
YeMingfei666 2024-11-19 14:35:25 +08:00
parent f99fcad9bf
commit 704fee1e2d
2 changed files with 71 additions and 52 deletions

View File

@ -43,17 +43,12 @@
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.name" placeholder="请输入商品名称" />
</uni-forms-item>
<view class="">
<uni-forms-item label="商品描述">
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
type="textarea" v-model="FormData.shortTitle" placeholder="请填写商品简述" />
</uni-forms-item>
</view>
<template v-if="FormData.typeEnum!='group'">
<view class="u-relative">
<uni-forms-item label="所属分类" required showRequired name="categoryId">
<uni-forms-item label="商品分类" required showRequired name="categoryId">
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
placeholder="请选择分类" popup-title="请选择分类" :localdata="pageData.category"
placeholder="请选择商品分类" popup-title="请选择商品分类" :localdata="pageData.category"
v-model="FormData.categoryId">
</uni-data-picker>
</uni-forms-item>
@ -64,18 +59,23 @@
</view>
</template>
<view class="border-top-0">
<uni-forms-item label="单位" required showRequired name="categoryId">
<uni-forms-item label="单位" required showRequired name="units">
<uni-data-picker :clear-icon="false" @change="unitIdChange"
:map="{text:'name',value:'id'}" placeholder="请选择单位" popup-title="请选择单位"
:localdata="pageData.units" v-model="FormData.unitId">
</uni-data-picker>
</uni-forms-item>
</view>
<view class="">
<uni-forms-item label="商品描述">
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
type="textarea" v-model="FormData.shortTitle" placeholder="请填写商品简述" />
</uni-forms-item>
</view>
<template v-if="FormData.typeEnum==='group'">
<view class="border-top-0">
@ -114,7 +114,7 @@
</view>
<template v-if="FormData.typeEnum=='sku' ">
<view class="block border-top-0 u-p-t-32 u-p-b-32">
<view class="u-flex u-row-between " >
<view class="u-flex u-row-between ">
<view class="color-333 font-bold">
<text v-if="!skuList.list.length">选择规格</text>
<text v-else>编辑规格</text>
@ -1475,7 +1475,7 @@
uni.$on('emitspecificationsSave', function(data) {
FormData.specificationsGroup = data
FormData.specId = data.specId
FormData.specsInfoName=data.specsInfoName
FormData.specsInfoName = data.specsInfoName
skuList.list = data.result.map(v => {
return {
...v.skus,

View File

@ -15,7 +15,7 @@
</uni-data-picker>
</view>
</view>
<view class="u-m-t-32 u-flex u-row-right">
<view class="u-flex-1 u-p-r-16">
<my-button type="cancel" plain @tap="resetQuery">重置</my-button>
@ -30,7 +30,8 @@
<view class="u-p-l-30 u-p-r-30">
<view class="u-flex u-row-between no-wrap">
<view>
<my-radio @change="radioAllChange" v-model="goods.allChecked" shape="square" :size="20"></my-radio>
<my-radio @change="radioAllChange" v-model="goods.allChecked" shape="square"
:size="20"></my-radio>
</view>
<view>商品信息</view>
<view>规格</view>
@ -53,16 +54,17 @@
{{ item.lowPrice }}
</view>
<view>
{{ item.realSalesNumber }}/{{ item.stockNumber }}
{{ item.realSalesNumber }}/{{ item.stockNumber }}
</view>
<view>
{{item.categoryName}}
{{item.categoryName}}
</view>
</view>
</view>
</scroll-view>
<view class="u-p-30">
<my-pagination :totalElements="goods.totalElements" :size="goods.query.size" @change="pageChange"></my-pagination>
<my-pagination :totalElements="goods.totalElements" :size="goods.query.size"
@change="pageChange"></my-pagination>
<view class="u-m-t-20 u-flex">
<view class="u-flex-1 u-p-r-16">
<my-button type="cancel" plain @tap="close">取消</my-button>
@ -81,7 +83,7 @@
import myRadio from '@/components/my-components/my-radio';
import myPagination from '@/components/my-components/my-pagination'
import {
$tbProduct
$tbProductV2
} from '@/http/yskApi/goods.js';
import {
reactive,
@ -114,20 +116,20 @@
function open(arr) {
show.value = true
if(arr){
for(let i in goods.list){
if (arr) {
for (let i in goods.list) {
console.log(arr.includes(goods.list[i].id));
goods.list[i].checked=arr.includes(goods.list[i].id)
goods.list[i].checked = arr.includes(goods.list[i].id)
}
}
}
function close() {
show.value = false
}
function resetQuery() {
Object.assign(goods.query, $quey)
@ -137,51 +139,67 @@
return `height:${typeof props.height==='string'?props.height:props.height+'rpx'};`
}
const emits = defineEmits(['update:modelValue','confirm'])
const emits = defineEmits(['update:modelValue', 'confirm'])
const $quey = {
categoryId: '',
name: '',
categoryId: "",
createdAt: [],
id: "",
name: "",
sort: "createdAt,desc",
type: "",
page: 0,
size: 10,
}
const query = reactive({
...$quey
})
const goods=reactive({
list:[],
allChecked:false,
totalElements:0,
query:{
const goods = reactive({
list: [],
allChecked: false,
totalElements: 0,
query: {
...$quey
}
})
function getGoods() {
$tbProduct(goods.query).then(res=>{
goods.list=res.content.map(v=>{
return {...v,checked:false}
$tbProductV2(goods.query).then(res => {
goods.list = res.content.map(v => {
return {
...v,
checked: false
}
})
goods.allChecked=false
goods.totalElements=res.totalElements
goods.allChecked = false
goods.totalElements = res.totalElements
})
}
getGoods()
function pageChange(page){
goods.query.page=page-1
function pageChange(page) {
goods.query.page = page - 1
getGoods()
}
function radioChange(newval){
goods.allChecked=goods.list.filter(v=>v.checked).length!=0
function radioChange(newval) {
goods.allChecked = goods.list.filter(v => v.checked).length != 0
}
function radioAllChange(newval){
goods.list.forEach(i=>{i.checked=newval})
function radioAllChange(newval) {
goods.list.forEach(i => {
i.checked = newval
})
}
function confrim(){
const arr= goods.list.filter(v=>v.checked)
emits('confirm',arr)
function confrim() {
const arr = goods.list.filter(v => v.checked)
emits('confirm', arr)
}
defineExpose({open,close})
defineExpose({
open,
close
})
</script>
<style lang="scss" scoped>
@ -189,7 +207,8 @@
background: rgba(51, 51, 51, 0.5);
z-index: 900;
}
.coverImg{
.coverImg {
width: 60rpx;
height: 60rpx;
border-radius: 10rpx;