增加临时菜页面

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" <uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.name" placeholder="请输入商品名称" /> :inputBorder="inputBorder" v-model="FormData.name" placeholder="请输入商品名称" />
</uni-forms-item> </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'"> <template v-if="FormData.typeEnum!='group'">
<view class="u-relative"> <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'}" <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"> v-model="FormData.categoryId">
</uni-data-picker> </uni-data-picker>
</uni-forms-item> </uni-forms-item>
@ -64,11 +59,8 @@
</view> </view>
</template> </template>
<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="units">
<uni-data-picker :clear-icon="false" @change="unitIdChange" <uni-data-picker :clear-icon="false" @change="unitIdChange"
:map="{text:'name',value:'id'}" placeholder="请选择单位" popup-title="请选择单位" :map="{text:'name',value:'id'}" placeholder="请选择单位" popup-title="请选择单位"
@ -77,6 +69,14 @@
</uni-forms-item> </uni-forms-item>
</view> </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'"> <template v-if="FormData.typeEnum==='group'">
<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">
@ -114,7 +114,7 @@
</view> </view>
<template v-if="FormData.typeEnum=='sku' "> <template v-if="FormData.typeEnum=='sku' ">
<view class="block border-top-0 u-p-t-32 u-p-b-32"> <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"> <view class="color-333 font-bold">
<text v-if="!skuList.list.length">选择规格</text> <text v-if="!skuList.list.length">选择规格</text>
<text v-else>编辑规格</text> <text v-else>编辑规格</text>
@ -1475,7 +1475,7 @@
uni.$on('emitspecificationsSave', function(data) { uni.$on('emitspecificationsSave', function(data) {
FormData.specificationsGroup = data FormData.specificationsGroup = data
FormData.specId = data.specId FormData.specId = data.specId
FormData.specsInfoName=data.specsInfoName FormData.specsInfoName = data.specsInfoName
skuList.list = data.result.map(v => { skuList.list = data.result.map(v => {
return { return {
...v.skus, ...v.skus,

View File

@ -30,7 +30,8 @@
<view class="u-p-l-30 u-p-r-30"> <view class="u-p-l-30 u-p-r-30">
<view class="u-flex u-row-between no-wrap"> <view class="u-flex u-row-between no-wrap">
<view> <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>商品信息</view>
<view>规格</view> <view>规格</view>
@ -62,7 +63,8 @@
</view> </view>
</scroll-view> </scroll-view>
<view class="u-p-30"> <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-m-t-20 u-flex">
<view class="u-flex-1 u-p-r-16"> <view class="u-flex-1 u-p-r-16">
<my-button type="cancel" plain @tap="close">取消</my-button> <my-button type="cancel" plain @tap="close">取消</my-button>
@ -81,7 +83,7 @@
import myRadio from '@/components/my-components/my-radio'; import myRadio from '@/components/my-components/my-radio';
import myPagination from '@/components/my-components/my-pagination' import myPagination from '@/components/my-components/my-pagination'
import { import {
$tbProduct $tbProductV2
} from '@/http/yskApi/goods.js'; } from '@/http/yskApi/goods.js';
import { import {
reactive, reactive,
@ -114,10 +116,10 @@
function open(arr) { function open(arr) {
show.value = true show.value = true
if(arr){ if (arr) {
for(let i in goods.list){ for (let i in goods.list) {
console.log(arr.includes(goods.list[i].id)); 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)
} }
} }
@ -137,51 +139,67 @@
return `height:${typeof props.height==='string'?props.height:props.height+'rpx'};` 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 = { const $quey = {
categoryId: '', categoryId: "",
name: '', createdAt: [],
id: "",
name: "",
sort: "createdAt,desc",
type: "",
page: 0, page: 0,
size: 10, size: 10,
} }
const query = reactive({ const query = reactive({
...$quey ...$quey
}) })
const goods=reactive({ const goods = reactive({
list:[], list: [],
allChecked:false, allChecked: false,
totalElements:0, totalElements: 0,
query:{ query: {
...$quey ...$quey
} }
}) })
function getGoods() { function getGoods() {
$tbProduct(goods.query).then(res=>{ $tbProductV2(goods.query).then(res => {
goods.list=res.content.map(v=>{ goods.list = res.content.map(v => {
return {...v,checked:false} return {
...v,
checked: false
}
}) })
goods.allChecked=false goods.allChecked = false
goods.totalElements=res.totalElements goods.totalElements = res.totalElements
}) })
} }
getGoods() getGoods()
function pageChange(page){ function pageChange(page) {
goods.query.page=page-1 goods.query.page = page - 1
getGoods() 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) function confrim() {
emits('confirm',arr) const arr = goods.list.filter(v => v.checked)
emits('confirm', arr)
} }
defineExpose({open,close}) defineExpose({
open,
close
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -189,7 +207,8 @@
background: rgba(51, 51, 51, 0.5); background: rgba(51, 51, 51, 0.5);
z-index: 900; z-index: 900;
} }
.coverImg{
.coverImg {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
border-radius: 10rpx; border-radius: 10rpx;