pull/2/head
张宇 2 years ago
parent 7d6f464545
commit e328d30ad7

@ -11,4 +11,14 @@ export default {
});
},
resourcesList(data) {
return request({
url: "/admin/system/resourcesList",
method: "POST",
data,
});
},
};

@ -38,4 +38,23 @@ export default {
});
},
goodsItem(data) {
return request({
url: "/admin/goods/goodsItem",
method: "POST",
data,
});
},
goodsEdit(data) {
return request({
url: "/admin/goods/goodsEdit",
method: "POST",
data,
});
},
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

@ -252,7 +252,7 @@ export default {
<style lang="scss" scoped>
.t-content {
position: fixed;
position: absolute;
z-index: 999999;
top: 0;
bottom: 0;

@ -0,0 +1,189 @@
<template>
<view class="" style="z-index: 999;">
<wd-popup v-model="show" closable position="left" custom-style="width: 86vw;" @close="handleClose">
<div class="pop myUpload">
<div class="bg-white overflow-hidden h-full" style="background-clip: content-box;">
<view class="bg-gray-100 p-4 flex">
<view class="mr-4">
<wd-button @tap="chooseFile"></wd-button>
</view>
<view>
<wd-button @tap="chooseFile"></wd-button>
</view>
</view>
<div v-if="LArr.length" class="shadow-lg ">
<div class="text px-2 mt-3 font-bold">已选择 ({{ LArr.length }} )</div>
<div class="bg-gray images flex gap-2 overflow-x-auto p-4 pt-2 ">
<view @click="onClickCheck({ url: img })" class=" border-gray-100 border-solid flex rounded-[14px] relative"
v-for="img of LArr">
<wd-img mode="aspectFill" radius="10" :width="100" :height="100" :src="img" />
<view class="absolute bg-white opacity-80 inset-0 flex items-center justify-center border-spacing-1">取消选择
</view>
</view>
</div>
</div>
<div v-else class="shadow-lg ">
<div class="text p-3 font-bold">可选择 ({{ LArr.length }} )</div>
</div>
<view class="overflow-hidden rounded-t-3xl">
<myList ref="myListRef" :apiObj="system.resourcesList" :params="{ ...params, classify_id }">
<template #default="{ list }">
<view class="grid grid-cols-2 gap-4 p-4 overflow-hidden rounded-t-3xl">
<view
class="relative flex flex-col items-center justify-center bg-gray-100 p-4 rounded-md overflow-hidden"
v-for="item of list" v-show="item.type === 1">
<div class="list-item-img" @click="onClickCheck(item)" v-if="item.type === 1"
:style="{ backgroundImage: 'url(' + item.url + ')' }"></div>
<div class="list-item-img" @dblclick="onClickDir(item)" v-if="item.type === 3"
:style="{ backgroundImage: 'url(' + folderPng + ')' }"></div>
<div class="list-item-name">{{ item.name }}</div>
<view @click="onClickCheck(item)"
class="absolute bg-white opacity-80 inset-2 flex items-center justify-center border-spacing-1"
v-if="LArr.includes(item.url)">取消选择</view>
</view>
</view>
</template>
</myList>
</view>
</div>
</div>
</wd-popup>
</view>
</template>
<script setup>
import { ref } from 'vue'
import system from '@/api/modules/system.js'
import myList from "/components/myList/index.vue"
import folderPng from '@/assets/images/folder.png'
import { uploadImage } from '@/utils/request';
const myListRef = ref(null)
const formData = ref({
parent_id: 0,
type: "image",
})
const chooseFile = async () => {
uni.chooseImage({
count: 1, // 9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: async (res) => {
try {
if (!res.tempFilePaths || !res.tempFilePaths.length) {
throw new Error('未选择文件或文件路径无效。');
}
const filePath = res.tempFilePaths[0];
const result = await uploadImage({ filePath, formData: formData.value, name: "image" })
console.log('成功上传图片:', result);
myListRef.value.upData()
//
} catch (error) {
console.error('选择文件或上传图片时出错:', error.message);
//
}
}
});
}
const emit = defineEmits(['update:modelValue']);
const props = defineProps({
modelValue: {
type: String,
default: ""
},
size: {
type: Number,
default: 1
},
})
const LArr = ref([])
const onClickCheck = (row) => {
const index = LArr.value.findIndex(item => item === row.url)
if (index > -1) {
LArr.value.splice(index, 1)
} else {
if (props.size > LArr.value.length) {
LArr.value.unshift(row.url)
} else {
uni.showToast({
title: `已选择 ${LArr.value.length}`,
icon: 'none'
})
console.log(`已选择 ${LArr.value.length}`);
}
}
}
const show = ref(true)
// if (Array.isArray(props.modelValue)) {
// } else {
// }
// defineExpose({
// upData
// })
</script>
<style lang="scss">
.list-item-img {
width: 100%;
height: 80px;
background-position: center center;
background-size: contain;
background-repeat: no-repeat;
}
.list-item-name {
text-align: center;
padding: 5px 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 12px;
width: 100%;
}
.pop {
// position: fixed;
background: rgba(0, 0, 0, 0.256);
background-clip: border-box;
z-index: 9;
overflow: hidden;
inset: 0px;
}
</style>

@ -0,0 +1,216 @@
<template>
<view>
<view v-if="props.modelValue.length" @click="open(true)" class="flex gap-2 overflow-x-auto">
<view class=" border-gray-100 border-solid flex rounded-[14px] relative"
v-for="img of (Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue])" :key="img">
<wd-img mode="aspectFill" radius="10" :width="100" :height="100" :src="img" />
</view>
</view>
<view v-else @click="open(true)" class="flex gap-2 overflow-x-auto">
<view style="width: 100px;height: 100px;"
class=" border-gray-100 border-solid flex rounded-[14px] relative flex-col items-center justify-center">
<wd-icon name="image" size="28px"></wd-icon>
<view class="mt-2 font-bold text-[12px]">请选择</view>
</view>
</view>
<wd-popup :z-index="998" v-model="show" closable position="left" custom-style="width: 86vw;" @close="close(false)">
<view class="pop myUpload">
<view class="bg-white overflow-hidden h-full" style="background-clip: content-box;">
<view class="bg-gray-100 p-4 flex">
<view class="mr-4">
<wd-button type="warning" @tap="chooseFile"></wd-button>
</view>
<view>
<wd-button @tap="ok"></wd-button>
</view>
</view>
<view v-if="LArr.length" class="shadow-lg ">
<view class="text px-2 mt-3 font-bold">已选择 ({{ LArr.length }} )</view>
<view class="bg-gray images flex gap-2 overflow-x-auto p-4 pt-2 ">
<view @click="onClickCheck({ url: img })" class=" border-gray-100 border-solid flex rounded-[14px] relative"
v-for="img of LArr" :key="img">
<wd-img mode="aspectFill" radius="10" :width="100" :height="100" :src="img" />
<view class="absolute bg-white opacity-80 inset-0 flex items-center justify-center border-spacing-1">取消选择
</view>
</view>
</view>
</view>
<view v-else class="shadow-lg ">
<view class="text p-3 font-bold">可选择 ({{ size }} )</view>
</view>
<view class="overflow-hidden rounded-t-3xl">
<myList ref="myListRef" :apiObj="system.resourcesList">
<template #default="{ list }">
<view class="grid grid-cols-2 gap-4 p-4 overflow-hidden rounded-t-3xl">
<view
class="relative flex flex-col items-center justify-center bg-gray-100 p-4 rounded-md overflow-hidden"
v-for="item of list" :key="item.id" v-show="item.type === 1">
<view class="list-item-img" @click="onClickCheck(item)" v-if="item.type === 1"
:style="{ backgroundImage: 'url(' + item.url + ')' }"></view>
<view class="list-item-img" @dblclick="onClickDir(item)" v-if="item.type === 3"
:style="{ backgroundImage: 'url(' + folderPng + ')' }"></view>
<view class="list-item-name">{{ item.name }}</view>
<view @click="onClickCheck(item)"
class="absolute bg-white opacity-80 inset-2 flex items-center justify-center border-spacing-1"
v-if="LArr.includes(item.url)">取消选择</view>
</view>
</view>
</template>
</myList>
</view>
</view>
</view>
</wd-popup>
</view>
</template>
<script setup>
import { ref, computed } from 'vue'
import system from '@/api/modules/system.js'
import myList from "/components/myList/index.vue"
import folderPng from '@/assets/images/folder.png'
import { uploadImage } from '@/utils/request';
const myListRef = ref(null)
const formData = ref({
parent_id: 0,
type: "image",
})
const chooseFile = async () => {
uni.chooseImage({
count: 1, // 9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: async (res) => {
try {
if (!res.tempFilePaths || !res.tempFilePaths.length) {
throw new Error('未选择文件或文件路径无效。');
}
const filePath = res.tempFilePaths[0];
const result = await uploadImage({ filePath, formData: formData.value, name: "image" })
console.log('成功上传图片:', result);
myListRef.value.upData()
//
} catch (error) {
console.error('选择文件或上传图片时出错:', error.message);
//
}
}
});
}
const emit = defineEmits(['update:modelValue']);
const props = defineProps({
modelValue: {
type: String,
default: ""
},
size: {
type: Number,
default: 1
},
})
const LArr = ref([])
const show = ref(false)
const open = (O) => {
show.value = O
if (O) {
myListRef.value.upData()
}
if (props.modelValue) {
if (Array.isArray(props.modelValue)) {
LArr.value = JSON.parse(JSON.stringify(props.modelValue))
} else {
LArr.value = [props.modelValue]
}
}
}
open(false)
const close = () => {
// LArr.value = []
}
const ok = () => {
if (props.size == 1) {
emit("update:modelValue", LArr.value.pop())
} else {
emit("update:modelValue", LArr.value)
}
show.value = false
}
const onClickCheck = (row) => {
const index = LArr.value.findIndex(item => item === row.url)
if (index > -1) {
LArr.value.splice(index, 1)
} else {
if (props.size > LArr.value.length) {
LArr.value.unshift(row.url)
} else {
uni.showToast({
title: `已选择 ${LArr.value.length}`,
icon: 'none'
})
console.log(`已选择 ${LArr.value.length}`);
}
}
}
</script>
<style lang="scss">
.list-item-img {
width: 100%;
height: 80px;
background-position: center center;
background-size: contain;
background-repeat: no-repeat;
}
.list-item-name {
text-align: center;
padding: 5px 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 12px;
width: 100%;
}
.pop {
// position: fixed;
background: rgba(0, 0, 0, 0.256);
background-clip: border-box;
overflow: hidden;
inset: 0px;
}
</style>

@ -1,10 +1,5 @@
<template>
<view class="content">
<wd-button>主要按钮</wd-button>
<wd-button type="success">成功按钮</wd-button>
<wd-button type="info">信息按钮</wd-button>
<wd-button type="warning">警告按钮</wd-button>
<wd-button type="error">危险按钮</wd-button>
</view>
</template>
@ -21,7 +16,6 @@ if (token) {
utils.toUrl("/pages/login/index")
}
</script>
<style>

@ -27,6 +27,16 @@ const model = ref({
const loading = ref(false)
const form = ref(null)
// if (token) {
// const user_info = uni.getStorageSync("user_info");
// if (user_info.type == 1) {
// utils.toUrl("/store/index/index")
// }
// } else {
// utils.toUrl("/pages/login/index")
// }
function handleSubmit() {
loading.value = true
form.value
@ -47,17 +57,25 @@ function handleSubmit() {
title: "登录成功",
});
console.log(res.data.user_info);
if (res.data.user_info.type == 1) {
utils.toUrl("/store/index/index")
} else {
uni.showToast({
title: '登录平台开发中 ···',
icon: 'none'
})
}
loading.value = false
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
loading.value = false
}
loading.value = false
})
}
})
.catch((error) => {

@ -1,7 +1,9 @@
<template>
<view class="skuEdit">
<wd-table :data="skuLibrary" :stripe="false">
<wd-table rowHeight="100" :data="Pdata.use_sku == 0
? skuDefault
: skuLibrary
" :stripe="false">
<wd-table-col prop="name" label="SKU">
<template #value="scope">
@ -45,9 +47,20 @@
</view>
</template>
</wd-table-col>
<wd-table-col prop="major" label="产品图">
<template #value="scope">
<view class="overflow-hidden w-full h-full flex items-center justify-center">
<view class="px-2 pb-1 bg-white flex items-center justify-center mt-4 overflow-hidden">
<myUpload v-model="scope.row.pic_url"></myUpload>
</view>
</view>
</template>
</wd-table-col>
</wd-table>
<view class="bg-gray-100 rounded mb-2">
<view v-show="Pdata.use_sku == 1" class="bg-gray-100 rounded mb-2">
<div class="p-2 bg-white w-full">
<div class="name mb-2 text-xs">规格设置</div>
<view class="flex bg-white px-3 py-1 rounded w-full">
@ -58,7 +71,6 @@
</view>
</div>
<div class="p-2 bg-white">
<div style="display: flex; flex-flow: column; align-items: flex-start;">
<div class="name mb-2 text-xs">规格组</div>
@ -89,17 +101,26 @@
</view>
<wd-toast />
</view>
</template>
<script>
import myUpload from "@/components/myUpload/index.vue"
import { useToast } from '@/uni_modules/wot-design-uni'
const toast = useToast()
export default {
name: "skuEdit",
props: {
Pdata: {
type: Object,
default: () => ({})
},
},
components: {
myUpload
},
data() {
return {
// sku
@ -128,7 +149,16 @@ export default {
// sku
}
},
created() {
this.skuDefault = this.Pdata.skuDefault.length ? this.Pdata.skuDefault : this.skuDefault
this.skuLibrary = this.Pdata.skuLibrary
this.skuGroup = this.Pdata.skuGroup
},
methods: {
successImage($event, index) {
console.log($event, index);
},
/**
* 处理规格数据
*/
@ -217,6 +247,15 @@ export default {
},
//
addSkuGroup() {
if (!this.addGroupData.name) {
uni.showToast({
title: '请填写规格组名称',
icon: 'none'
})
return
}
//
console.log("添加了一个规格组");
this.skuGroup.push(this.addGroupData);
@ -280,7 +319,14 @@ export default {
if (!this.addGouppItemData[index]) {
toast.error('请填写规格名称!')
if (!this.addGroupData.name) {
uni.showToast({
title: '请填写规格名称',
icon: 'none'
})
return
}
return
}

@ -1,36 +1,53 @@
<template>
<view class="content p-2 bg-gray-100">
<view v-if="load" class="content p-2 bg-gray-100">
<wd-toast />
<wd-form ref="form" :model="model">
<wd-cell-group border>
<div class="bg-gray-100">
<div class="bg-gray-100 rounded mb-2">
<div class="bg-white flex flex-col pt-3 pl-3">
<div class="name mb-2 text-xs">缩略图</div>
<wd-upload :limit="1" :file-list="fileList" :action="action" :formData="formData" :header="header"
@success="successImage" name="image" :before-remove="beforeRemove"></wd-upload>
<myUpload v-model="model.pic_url"></myUpload>
</div>
</div>
</div>
<!-- <div class="bg-gray-100">
<div class="bg-gray-100">
<div class="bg-gray-100 rounded mb-2">
<div class="bg-white flex flex-col pt-3 pl-3">
<div class="name mb-2 text-xs">商品主图</div>
<wd-upload :file-list="fileList" :action="action" :formData="formData" :header="header"
@change="handleChange" name="image"></wd-upload>
<myUpload v-model="model.pic_list" :size="4"></myUpload>
</div>
</div>
</div> -->
</div>
<view class="h-2 bg-gray-100"></view>
<view class=" p-3 rounded mb-2">
<div class="name mb-2 text-xs">商品名称</div>
<view class="bg-white px-3 py-1 rounded">
<wd-textarea v-model="model.value" auto-height />
<wd-textarea v-model="model.name" auto-height />
</view>
</view>
<view class="h-2 bg-gray-100"></view>
<view class=" p-3 rounded mb-2">
<div class="name mb-2 text-xs">商品分类</div>
<view class="bg-white px-3 py-1 rounded">
<wd-checkbox-group v-model="model.classify_list">
<view class="flex overflow-auto flex-wrap">
<div class="grid grid-cols-3">
<wd-checkbox style="width: 100%;" shape="button" v-for="cat of classifyList"
:modelValue="JSON.stringify(cat.parentIds)">
{{ cat.name }}
</wd-checkbox>
</div>
</view>
</wd-checkbox-group>
</view>
</view>
@ -40,8 +57,7 @@
<div class="p-2 bg-white">
<div class="name mb-2 text-xs">服务内容</div>
<view class="bg-white px-3 py-1 rounded">
<wd-input type="text" v-model="value" placeholder="例子: 正品保障,极速发货,7天退换货。多个请使用英文逗号“,”分隔"
@change="handleChange" />
<wd-input type="text" v-model="model.server_project" placeholder="例子: 正品保障,极速发货,7天退换货。多个请使用英文逗号“,”分隔" />
</view>
</div>
</view>
@ -51,11 +67,12 @@
<view class=" p-3 rounded mb-2">
<div class="name mb-2 text-xs">商品重量</div>
<view class="bg-white px-3 py-2 rounded flex items-center mb-4">
<wd-input-number v-model="value" @change="handleChange" />
<wd-input-number v-model="model.weight" />
<view class="text-xs from-neutral-300 ml-4">千克</view>
</view>
<wd-picker class="w-full" :columns="freightRules" label="运费模板" v-model="model.freight_id" />
<wd-picker v-if="freightRules.length" class="w-full" :columns="freightRules" label="运费模板"
v-model="model.freight_id" />
</view>
@ -63,18 +80,33 @@
<view class="p-3 rounded mb-2">
<div class="name mb-2 text-xs">商品状态</div>
<view class="bg-white px-3 py-2 rounded flex items-center mb-4">
<wd-switch v-model="model.status" />
<view class="bg-white px-3 py-2 rounded flex items-center">
<wd-switch v-model="model.status" :active-value="1" :inactive-value="0" />
</view>
</view>
<view class="h-2 bg-gray-100"></view>
<view class="p-3 rounded mb-2">
<div class="name mb-2 text-xs">规格</div>
<view class="bg-white px-3 py-2 rounded flex items-center">
<wd-radio-group shape="button" v-model="model.use_sku">
<wd-radio :value="0">单规格</wd-radio>
<wd-radio :value="1">多规格</wd-radio>
</wd-radio-group>
</view>
</view>
<view class="h-2 bg-gray-100"></view>
<skuEdit></skuEdit>
<skuEdit ref="skuEditRef" :skuGroup="skuGroup"
:Pdata="{ skuDefault, skuLibrary, skuGroup, use_sku: model.use_sku }">
</skuEdit>
</wd-cell-group>
<view class="footer mt-4">
<wd-button type="primary" size="large" block>保存</wd-button>
<wd-button @click="saveGoods" type="primary" size="large" block>保存</wd-button>
</view>
</wd-form>
</view>
@ -82,10 +114,15 @@
<script setup>
import { ref } from 'vue'
import system from '@/api/modules/system.js'
import goods from '@/api/store/goods.js'
import { useToast, useMessage } from '@/uni_modules/wot-design-uni'
import goods from '@/api/store/goods.js'
import system from '@/api/modules/system.js'
import skuEdit from "./components/skuEdit.vue"
import myUpload from "@/components/myUpload/index.vue"
import {
onLoad,
onShow
} from "@dcloudio/uni-app";
const fileList = ref([])
@ -94,34 +131,18 @@ const beforeRemove = ({ file, resolve, index }) => {
resolve(true)
}
const action = 'https://saasdemo.byin.vip/admin/system/uploadImage'
const token = uni.getStorageSync("token");
const header = {
Authorization: `Bearer ${token}`
}
const formData = {
parent_id: 0,
type: "image",
}
function successImage(e) {
fileList.value.push({
url: e.file.url
})
}
const model = ref({
classify_list: [], //
name: "", //
keywords: "", //
sort: 1000,
status: 0, //
freight_id: 0, //
freight_id: 99999999, //
weight: 0, //
pic_url: "", //
pic_list: [], //
video: "", //
detail: "", //
detail: "默认", //
use_sku: 0, // 使
sku_list: [], //
is_discount: 0, //
@ -133,35 +154,199 @@ const model = ref({
check_price: 0, //
})
const form = ref()
const load = ref(false)
const skuGroup = ref([])
const skuDefault = ref([])
const skuLibrary = ref([])
const skuEditRef = ref(null)
const freightRules = ref([{
label: "默认",
value: "99999999"
}])
onLoad(async (e) => {
function handleSubmit1() {
form.value
.validate()
.then(({ valid, errors }) => {
if (valid) {
showSuccess({
msg: '校验通过'
const GetfreightRules = () => {
goods.freightRules().then(res => {
freightRules.value = [
...freightRules.value,
...res.data.rows.map(item => {
return {
label: item.name,
value: item.id
}
})
}
]
})
}
GetfreightRules()
if (e.id) {
const res = await goods.goodsItem({
id: e.id
})
model.value = res.data
model.value.pic_list = res.data.pic_list.map(({ pic_url }) => pic_url);
if (!model.value.freight_id) {
model.value.freight_id = 99999999
}
model.value.classify_list = model.value.classify_list.map(item => JSON.stringify(item))
if (res.data.use_sku == 0) {
skuDefault.value = res.data.goods_sku;
} else {
skuLibrary.value = res.data.goods_sku;
}
skuGroup.value = res.data.sku_group ? res.data.sku_group : [];
load.value = true
} else {
load.value = true
}
})
// const form = ref()
const saveGoods = async () => {
//
if (model.value.classify_list.length === 0) {
return uni.showToast({
title: '请选择商品分类!',
icon: 'none'
})
}
//
if (model.value.name.trim() === "") {
return uni.showToast({
title: '请输入商品名称!',
icon: 'none'
})
}
//
// if (model.value.keywords.trim() === "") {
// return uni.showToast({
// title: '!',
// icon: 'none'
// })
// }
//
if (model.value.weight < 0) {
return uni.showToast({
title: '请输入合法的商品重量!',
icon: 'none'
})
}
//
if (String(model.value.pic_url).trim() === "") {
return uni.showToast({
title: '请上传商品缩略图!',
icon: 'none'
})
}
//
if (model.value.pic_list.length === 0) {
return uni.showToast({
title: '请上传商品图片组!',
icon: 'none'
})
}
model.value.sku_group = []
model.value.sku_list = []
model.value.dist_price = Number.parseInt(model.value.dist_price)
if (model.value.use_sku == 1) {
model.value.sku_group = skuEditRef.value.skuGroup;
model.value.sku_list = skuEditRef.value.skuLibrary;
} else {
model.value.sku_list = skuEditRef.value.skuDefault;
}
if (!model.value.sku_list.length) {
uni.showToast({
title: '规格不完整,请调整!',
icon: 'none'
})
.catch((error) => {
console.log(error, 'error')
}
if (!model.value.sku_list.every(item => Boolean(item.price !== "" && item.stock !== "" && item.original_price !== ""))) {
uni.showToast({
title: '规格不完整,请调整!',
icon: 'none'
})
console.log("规格不完整,请调整!");
return
}
let freight_id = model.value.freight_id
if (freight_id = 99999999) {
freight_id = 0
}
const pic_list = model.value.pic_list.map(item => ({
pic_url: item
}))
const classify_list = model.value.classify_list.map(item => JSON.parse(item))
const res = await goods.goodsEdit({ ...model.value, pic_list, freight_id, classify_list });
console.log(res);
if (res.code == 0) {
uni.showToast({
title: '商品信息保存成功!',
icon: 'success'
})
}
}
const freightRules = ref([])
const GetfreightRules = () => {
goods.freightRules().then(res => {
freightRules.value = res.data.rows.map(item => {
return {
label: item.name,
value: item.id
const classifyList = ref([])
const getClassify = () => {
function flattenCategories(categories, parentIds = []) {
let flatCategories = [];
for (const category of categories) {
const categoryWithParents = {
...category,
parentIds: [...parentIds, category.id],
};
flatCategories.push(categoryWithParents);
if (category.children && category.children.length > 0) {
flatCategories = flatCategories.concat(flattenCategories(category.children, [...parentIds, category.id]));
}
})
}
return flatCategories;
}
goods.classify.list().then(res => {
classifyList.value = flattenCategories(res.data)
console.log(classifyList.value);
})
}
GetfreightRules()
getClassify()
</script>
<style lang="scss"></style>

@ -48,7 +48,7 @@
style="margin-right: 8px;">下架</wd-button>
<wd-button @click="changeS(item)" v-if="item.status !== 1" size="small"
style="margin-right: 8px;">上架</wd-button>
<wd-button @click="utils.toUrl('/store/goods/edit')" size="small">编辑</wd-button>
<wd-button @click="utils.toUrl('/store/goods/edit?id=' + item.id)" size="small">编辑</wd-button>
</view>
</template>
</wd-card>
@ -64,9 +64,15 @@
<script setup>
import { ref } from 'vue'
import { useToast } from '@/uni_modules/wot-design-uni'
import goods from '@/api/store/goods.js'
import myList from "/components/myList/index.vue"
import goods from '@/api/store/goods.js'
import utils from '@/utils/utils.js'
import {
onLoad,
onShow
} from "@dcloudio/uni-app";
const toast = useToast()
const classify_id = ref(0)
@ -147,6 +153,10 @@ const getClassify = () => {
})
}
getClassify()
onShow(() => {
search({ value: '' })
})
</script>
<style lang="scss" scoped>

@ -67,7 +67,6 @@
<view>
<span class="mr-2" v-if="item.shop">{{ item.shop.name }}</span>
<span class="mr-2" v-else></span>
<span class="font-bold">({{ status[item.status + 1].content }})</span>
</view>
@ -90,7 +89,6 @@
</view>
</view>
<view class="bg-gray-50 p-2">
<view class="text-[12px]" v-if="item.user">
<view class="mb-1">

@ -1,16 +1,25 @@
## 0.2.32023-12-27
## 0.2版本正式发布支持Form自定义表单校验
> 请注意Input组件有破坏性更新
### [0.2.3](https://github.com/Moonofweisheng/wot-design-uni/compare/v0.2.2...v0.2.3) (2023-12-27)
## 0.2.52023-12-28
## [0.2.5](https://github.com/Moonofweisheng/wot-design-uni/compare/v0.2.4...v0.2.5) (2023-12-28)
### ✏️ Documentation | 文档
### Bug Fixes | Bug 修复
* ✏️ 修复动态表单演示页面标题错误的问题 ([7c65359](https://github.com/Moonofweisheng/wot-design-uni/commit/7c65359c88614ae53c4800d0946d8e09ef547a26))
* 修复 Form 导入FormRules、ErrorMessage时未指定为type的问题 ([c88c84e](https://github.com/Moonofweisheng/wot-design-uni/commit/c88c84e8b71fc2404643a623c28f4953ffe36e71))
* 修复 SwipeAction 组件在H5端导致页面无法上下滚动的问题 ([1f68ce1](https://github.com/Moonofweisheng/wot-design-uni/commit/1f68ce13c8109dd92ca4bf055f66aa8dff24c83d)), closes [#149](https://github.com/Moonofweisheng/wot-design-uni/issues/149)
# 更新日志
### [0.2.5](https://github.com/Moonofweisheng/wot-design-uni/compare/v0.2.4...v0.2.5) (2023-12-28)
### 🐛 Bug Fixes | Bug 修复
* 🐛 修复 Form 导入FormRules、ErrorMessage时未指定为type的问题 ([c88c84e](https://github.com/Moonofweisheng/wot-design-uni/commit/c88c84e8b71fc2404643a623c28f4953ffe36e71))
* 🐛 修复 SwipeAction 组件在H5端导致页面无法上下滚动的问题 ([1f68ce1](https://github.com/Moonofweisheng/wot-design-uni/commit/1f68ce13c8109dd92ca4bf055f66aa8dff24c83d)), closes [#149](https://github.com/Moonofweisheng/wot-design-uni/issues/149)
### [0.2.4](https://github.com/Moonofweisheng/wot-design-uni/compare/v0.2.3...v0.2.4) (2023-12-27)
### [0.2.3](https://github.com/Moonofweisheng/wot-design-uni/compare/v0.2.2...v0.2.3) (2023-12-27)

@ -1,4 +1,4 @@
import { getCurrentInstance, inject, onMounted, onBeforeMount, ref, watch } from 'vue'
import { getCurrentInstance, inject, onBeforeMount, ref, watch } from 'vue'
export function useCell() {
const border = ref<boolean>(false) // 是否展示边框

@ -1,12 +1,12 @@
import {
VNode,
provide,
reactive,
InjectionKey,
getCurrentInstance,
VNodeNormalizedChildren,
ComponentPublicInstance,
ComponentInternalInstance
type VNode,
type InjectionKey,
type VNodeNormalizedChildren,
type ComponentPublicInstance,
type ComponentInternalInstance
} from 'vue'
// 小程序端不支持从vue导出的isVNode方法参考uni-mp-vue的实现

@ -1,4 +1,13 @@
import { ref, inject, computed, onUnmounted, InjectionKey, getCurrentInstance, ComponentPublicInstance, ComponentInternalInstance } from 'vue'
import {
ref,
inject,
computed,
onUnmounted,
type InjectionKey,
getCurrentInstance,
type ComponentPublicInstance,
type ComponentInternalInstance
} from 'vue'
type ParentProvide<T> = T & {
link(child: ComponentInternalInstance): void

@ -117,7 +117,7 @@ import { dayjs } from '../common/dayjs'
import { deepClone, isArray, isEqual, padZero } from '../common/util'
import { getWeekNumber, isRange } from '../wd-calendar-view/utils'
import { useCell } from '../composables/useCell'
import { FORM_KEY, FormItemRule } from '../wd-form/types'
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
import { useParent } from '../composables/useParent'
const defaultDisplayFormat = (value, type) => {

@ -60,7 +60,7 @@ export default {
import { computed } from 'vue'
import { useCell } from '../composables/useCell'
import { useParent } from '../composables/useParent'
import { FORM_KEY, FormItemRule } from '../wd-form/types'
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
interface Props {
title?: string

@ -97,7 +97,7 @@ export default {
import { computed, getCurrentInstance, onMounted, ref, watch } from 'vue'
import { debounce, getRect, getType } from '../common/util'
import { useCell } from '../composables/useCell'
import { FORM_KEY, FormItemRule } from '../wd-form/types'
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
import { useParent } from '../composables/useParent'
const $container = '.wd-col-picker__selected-container'

@ -144,7 +144,7 @@ import { computed, getCurrentInstance, nextTick, onBeforeMount, onMounted, ref,
import { deepClone, getType, isArray, isDef, isEqual, padZero } from '../common/util'
import { useCell } from '../composables/useCell'
import { type DateTimeType, getPickerValue } from '../wd-datetime-picker-view/type'
import { FORM_KEY, FormItemRule } from '../wd-form/types'
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
import { useParent } from '../composables/useParent'
interface Props {
customClass?: string

@ -36,7 +36,7 @@ export default {
import { computed, ref } from 'vue'
import { useParent } from '../composables/useParent'
import WdCell from '../wd-cell/wd-cell.vue'
import { FORM_KEY, FormItemRule } from '../wd-form/types'
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
interface Props {
prop: string

@ -19,7 +19,7 @@ export default {
import { reactive, watch } from 'vue'
import { deepClone, getPropByPath, isDef, isPromise } from '../common/util'
import { useChildren } from '../composables/useChildren'
import { FormRules, FORM_KEY, ErrorMessage, FormItemRule } from './types'
import { type FormRules, FORM_KEY, type ErrorMessage } from './types'
interface Props {
//

@ -88,7 +88,7 @@ export default {
import { computed, onBeforeMount, ref, watch } from 'vue'
import { objToStyle, requestAnimationFrame } from '../common/util'
import { useCell } from '../composables/useCell'
import { FORM_KEY, FormItemRule } from '../wd-form/types'
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
import { useParent } from '../composables/useParent'
interface Props {

@ -1,24 +1,20 @@
<template>
<view
:class="`wd-picker ${disabled ? 'is-disabled' : ''} ${size ? 'is-' + size : ''} ${cell.border.value ? 'is-border' : ''} ${
alignRight ? 'is-align-right' : ''
} ${error ? 'is-error' : ''} ${customClass}`"
>
<view :class="`wd-picker ${disabled ? 'is-disabled' : ''} ${size ? 'is-' + size : ''} ${cell.border.value ? 'is-border' : ''} ${alignRight ? 'is-align-right' : ''
} ${error ? 'is-error' : ''} ${customClass}`">
<!--文案-->
<view class="wd-picker__field" @click="showPopup">
<slot v-if="useDefaultSlot"></slot>
<view v-else class="wd-picker__cell">
<view
v-if="label || useLabelSlot"
<view v-if="label || useLabelSlot"
:class="`wd-picker__label ${customLabelClass} ${isRequired ? 'is-required' : ''}`"
:style="labelWidth ? 'min-width:' + labelWidth + ';max-width:' + labelWidth + ';' : ''"
>
:style="labelWidth ? 'min-width:' + labelWidth + ';max-width:' + labelWidth + ';' : ''">
<template v-if="label">{{ label }}</template>
<slot v-else name="label"></slot>
</view>
<view class="wd-picker__body">
<view class="wd-picker__value-wraper">
<view :class="`wd-picker__value ${ellipsis && 'is-ellipsis'} ${customValueClass} ${showValue ? '' : 'wd-picker__placeholder'}`">
<view
:class="`wd-picker__value ${ellipsis && 'is-ellipsis'} ${customValueClass} ${showValue ? '' : 'wd-picker__placeholder'}`">
{{ showValue ? showValue : placeholder }}
</view>
<wd-icon v-if="!disabled && !readonly" custom-class="wd-picker__arrow" name="arrow-right" />
@ -28,16 +24,8 @@
</view>
</view>
<!--弹出层picker-view 在隐藏时修改值会触发多次change事件从而导致所有列选中第一项因此picker在关闭时不隐藏 -->
<wd-popup
v-model="popupShow"
position="bottom"
:hide-when-close="false"
:close-on-click-modal="closeOnClickModal"
:z-index="zIndex"
:safe-area-inset-bottom="safeAreaInsetBottom"
@close="onCancel"
custom-class="wd-picker__popup"
>
<wd-popup v-model="popupShow" position="bottom" :hide-when-close="false" :close-on-click-modal="closeOnClickModal"
:z-index="zIndex" :safe-area-inset-bottom="safeAreaInsetBottom" @close="onCancel" custom-class="wd-picker__popup">
<view class="wd-picker__wraper">
<!--toolBar-->
<view class="wd-picker__toolbar" @touchmove="noop">
@ -53,21 +41,10 @@
</view>
</view>
<!--pickerView-->
<wd-picker-view
ref="pickerViewWd"
:custom-class="customViewClass"
v-model="pickerValue"
:columns="displayColumns"
:loading="isLoading"
:loading-color="loadingColor"
:columns-height="columnsHeight"
:value-key="valueKey"
:label-key="labelKey"
@change="pickerViewChange"
@pickstart="onPickStart"
@pickend="onPickEnd"
:column-change="columnChange"
/>
<wd-picker-view ref="pickerViewWd" :custom-class="customViewClass" v-model="pickerValue" :columns="displayColumns"
:loading="isLoading" :loading-color="loadingColor" :columns-height="columnsHeight" :value-key="valueKey"
:label-key="labelKey" @change="pickerViewChange" @pickstart="onPickStart" @pickend="onPickEnd"
:column-change="columnChange" />
</view>
</wd-popup>
</view>
@ -89,7 +66,7 @@ import { getCurrentInstance, onBeforeMount, ref, watch, computed, onMounted, nex
import { deepClone, defaultDisplayFormat, getType, isDef } from '../common/util'
import { useCell } from '../composables/useCell'
import { type ColumnItem, formatArray } from '../wd-picker-view/type'
import { FORM_KEY, FormItemRule } from '../wd-form/types'
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
import { useParent } from '../composables/useParent'
interface Props {
@ -229,6 +206,7 @@ watch(
(newValue) => {
pickerValue.value = newValue
// ,
if (isDef(newValue)) {
if (pickerViewWd.value && pickerViewWd.value.getSelects) {
nextTick(() => {
@ -458,7 +436,7 @@ function setShowValue(items) {
const { valueKey, labelKey } = props
showValue.value = (props.displayFormat || defaultDisplayFormat)(items, { valueKey, labelKey })
}
function noop() {}
function noop() { }
function onPickStart() {
isPicking.value = true
}

@ -112,7 +112,7 @@ import { getCurrentInstance, onBeforeMount, ref, watch, nextTick, computed } fro
import { useCell } from '../composables/useCell'
import { getRect, getType, isArray, isDef, requestAnimationFrame } from '../common/util'
import { useParent } from '../composables/useParent'
import { FORM_KEY, FormItemRule } from '../wd-form/types'
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
type SelectPickerType = 'checkbox' | 'radio'

@ -3,9 +3,8 @@
<view
:class="`wd-swipe-action ${customClass}`"
@click.stop="onClick()"
@touchmove="stopPropagation ? nothing : ''"
@touchstart="startDrag"
@touchmove.prevent="onDrag"
@touchmove="onDrag"
@touchend="endDrag"
@touchcancel="endDrag"
>
@ -58,7 +57,6 @@ const props = withDefaults(defineProps<Props>(), {
const queue = inject<Queue | null>(queueKey, null)
const wrapperStyle = ref<string>('')
const stopPropagation = ref<boolean>(false)
// wrapper
const originOffset = ref<number>(0)
@ -131,8 +129,7 @@ function changeState(value: string, old?: string) {
}
})
}
/** 防穿透函数的占位符 **/
function nothing() {}
/**
* @description 获取左/右操作按钮的宽度
* @return {Promise<[Number, Number]>} 左宽度右宽度
@ -202,12 +199,11 @@ function onDrag(event) {
if (props.disabled) return
touch.touchMove(event)
if (touch.direction.value === 'vertical') {
stopPropagation.value = false
return
} else {
stopPropagation.value = true
event.preventDefault()
event.stopPropagation()
}
touching.value = true
@ -238,7 +234,6 @@ function endDrag() {
if (props.disabled) return
// ""
const THRESHOLD = 0.3
stopPropagation.value = false
touching.value = false
getWidths().then(([leftWidth, rightWidth]) => {

@ -78,7 +78,7 @@ export default {
import { computed, onBeforeMount, ref, watch } from 'vue'
import { objToStyle, requestAnimationFrame } from '../common/util'
import { useCell } from '../composables/useCell'
import { FORM_KEY, FormItemRule } from '../wd-form/types'
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
import { useParent } from '../composables/useParent'
type ConfirmType = 'send' | 'search' | 'next' | 'go' | 'done'

@ -491,7 +491,6 @@ async function drawImageOffScreen(
img.crossOrigin = 'anonymous'
img.referrerPolicy = 'no-referrer'
img.referrerPolicy = 'no-referrer'
if (isBase64Image(image)) {
img.src = image
} else {

@ -2,7 +2,7 @@
"id": "wot-design-uni",
"name": "wot-design-uni",
"displayName": "wot-design-uni 基于vue3+Typescript的高颜值组件库",
"version": "0.2.3",
"version": "0.2.5",
"description": "一个基于Vue3+TS开发的uni-app组件库提供60+高质量组件,支持暗黑模式和自定义主题。",
"keywords": [
"wot-design-uni",
@ -12,7 +12,7 @@
"暗黑模式"
],
"main": "index.ts",
"repository":"https://github.com/Moonofweisheng/wot-design-uni.git",
"repository": "https://github.com/Moonofweisheng/wot-design-uni.git",
"engines": {
"HBuilderX": "^3.8.7"
},

@ -139,3 +139,42 @@ export function uploadFile({
});
})
}
const uploadImage = async ({ filePath, formData, name } = {}) => {
return new Promise(async (resolve, reject) => {
try {
const token = uni.getStorageSync("token");
const header = {
Authorization: `Bearer ${token}`
};
const formData = {
parent_id: 0,
type: "image",
};
uni.uploadFile({
url: 'https://saasdemo.byin.vip/admin/system/uploadImage',
filePath: filePath,
name: name || 'file', // 表单中文件字段的名称
formData: formData,
header: header,
success: (uploadFileRes) => {
const result = JSON.parse(uploadFileRes.data);
resolve(result)
}
});
} catch (error) {
reject(error)
}
})
};
export { uploadImage };

Loading…
Cancel
Save