diff --git a/pages.json b/pages.json
index 9dec229..febc8aa 100644
--- a/pages.json
+++ b/pages.json
@@ -163,6 +163,15 @@
"meta": {
"auth": false
}
+ },
+ {
+ "path": "sku",
+ "style": {
+ "navigationBarTitleText": "商品属性"
+ },
+ "meta": {
+ "auth": false
+ }
}
]
},
diff --git a/pages/product/components/item.vue b/pages/product/components/item.vue
new file mode 100644
index 0000000..95aaddb
--- /dev/null
+++ b/pages/product/components/item.vue
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/product/components/propertyList.vue b/pages/product/components/propertyList.vue
new file mode 100644
index 0000000..a251eb7
--- /dev/null
+++ b/pages/product/components/propertyList.vue
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/product/js/config.js b/pages/product/js/config.js
new file mode 100644
index 0000000..3b99d36
--- /dev/null
+++ b/pages/product/js/config.js
@@ -0,0 +1,10 @@
+export const SPEC_TYPE = [
+ {
+ label: '单规格',
+ value: false,
+ },
+ {
+ label: '多规格',
+ value: true,
+ },
+]
diff --git a/pages/product/js/sku.js b/pages/product/js/sku.js
new file mode 100644
index 0000000..55be377
--- /dev/null
+++ b/pages/product/js/sku.js
@@ -0,0 +1,24 @@
+import { ref } from 'vue'
+import { SPEC_TYPE } from './config'
+
+const pickerRef = ref(null)
+
+const propertyList = ref([1, 2])
+
+const propertyListRef = ref(null)
+
+const formData = ref({
+ specType: true,
+ specText: SPEC_TYPE[0].label,
+})
+
+function onRDPickerConfirm(e) {
+ formData.value.specText = SPEC_TYPE[e.value[0]].label
+ formData.value.specType = SPEC_TYPE[e.value[0]].value
+}
+
+function onPropertyConfirm(e) {
+ console.log(e)
+}
+
+export { pickerRef, propertyListRef, formData, onRDPickerConfirm, onPropertyConfirm, propertyList }
diff --git a/pages/product/manageGoods.vue b/pages/product/manageGoods.vue
index 85bd915..e23fd7c 100644
--- a/pages/product/manageGoods.vue
+++ b/pages/product/manageGoods.vue
@@ -1,273 +1,374 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- {{ item.label }}
-
-
-
-
+
+
diff --git a/pages/product/sku.vue b/pages/product/sku.vue
new file mode 100644
index 0000000..3e01895
--- /dev/null
+++ b/pages/product/sku.vue
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/peach/api/trade/goods.js b/peach/api/trade/goods.js
index 212664a..d70dfe2 100644
--- a/peach/api/trade/goods.js
+++ b/peach/api/trade/goods.js
@@ -33,6 +33,15 @@ const GoodsApi = {
data,
})
},
+ // 商品分类
+ getGoodsCategory: (data) => {
+ return request({
+ url: '/product/category/list',
+ method: 'GET',
+ params: data,
+ })
+ },
+ // 商品品牌
}
export default GoodsApi
diff --git a/peach/components/p-picker/p-picker.vue b/peach/components/p-picker/p-picker.vue
new file mode 100644
index 0000000..0cbeb6d
--- /dev/null
+++ b/peach/components/p-picker/p-picker.vue
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/peach/utils/index.js b/peach/utils/index.js
index 2ee2b1b..a272a0f 100644
--- a/peach/utils/index.js
+++ b/peach/utils/index.js
@@ -1,5 +1,61 @@
import dayjs from 'dayjs'
+/**
+ * 构造树型结构数据
+ * @param {*} data 数据源
+ * @param {*} id id字段 默认 'id'
+ * @param {*} parentId 父节点字段 默认 'parentId'
+ * @param {*} children 孩子节点字段 默认 'children'
+ */
+export const handleTree = (data, id, parentId, children) => {
+ if (!Array.isArray(data)) {
+ console.warn('data must be an array')
+ return []
+ }
+ const config = {
+ id: id || 'id',
+ parentId: parentId || 'parentId',
+ childrenList: children || 'children',
+ }
+
+ const childrenListMap = {}
+ const nodeIds = {}
+ const tree = []
+
+ for (const d of data) {
+ const parentId = d[config.parentId]
+ if (childrenListMap[parentId] == null) {
+ childrenListMap[parentId] = []
+ }
+ nodeIds[d[config.id]] = d
+ childrenListMap[parentId].push(d)
+ }
+
+ for (const d of data) {
+ const parentId = d[config.parentId]
+ if (nodeIds[parentId] == null) {
+ tree.push(d)
+ }
+ }
+
+ for (const t of tree) {
+ adaptToChildrenList(t)
+ }
+
+ function adaptToChildrenList(o) {
+ if (childrenListMap[o[config.id]] !== null) {
+ o[config.childrenList] = childrenListMap[o[config.id]]
+ }
+ if (o[config.childrenList]) {
+ for (const c of o[config.childrenList]) {
+ adaptToChildrenList(c)
+ }
+ }
+ }
+
+ return tree
+}
+
export function resetPagination(pagination) {
pagination.list = []
pagination.total = 0