From 42072a546ee22405cd5a4712201ab70f2518d144 Mon Sep 17 00:00:00 2001
From: sx <2427911852@qq.com>
Date: Fri, 7 Feb 2025 11:24:41 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
jiuyi2/api/shop.js | 34 +++++------
jiuyi2/common/js/config.js | 8 +--
jiuyi2/pages/mine/mine.vue | 16 +++---
jiuyi2/pages/shop/collect.vue | 8 +--
.../components/jy-commodity-foot/index.vue | 4 +-
jiuyi2/pages/shop/store/commodities.vue | 56 +++++++++++++++----
jiuyi2/vite.config.js | 5 +-
7 files changed, 84 insertions(+), 47 deletions(-)
diff --git a/jiuyi2/api/shop.js b/jiuyi2/api/shop.js
index 0622a2ff..8143f839 100644
--- a/jiuyi2/api/shop.js
+++ b/jiuyi2/api/shop.js
@@ -73,13 +73,28 @@ const shop = {
},
/**
- * 商家发布商品
+ * 保存商品信息
* @param {Object} param
*/
- releaseProduct(param) {
+ saveProduct(param) {
return util.request({
- url: `/shopify/`,
+ url: `/shopify/webProduct/uploadProduct`,
method: 'POST',
+ data: param.data,
+ load: true,
+ })
+ },
+
+ /**
+ * 商家商品删除
+ * @param {Object} param
+ */
+ removeProduct(param) {
+ return util.request({
+ url: `/webProduct`,
+ method: 'POST',
+ path: param.path,
+ load: true,
})
},
@@ -180,19 +195,6 @@ const shop = {
})
},
- /**
- * 保存商品信息
- * @param {Object} param
- */
- saveProduct(param) {
- return util.request({
- url: `/shopify/webProduct/uploadProduct`,
- method: 'POST',
- data: param.data,
- load: true,
- })
- },
-
/**
* 商品收藏
* @param {Object} param
diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js
index fde225b9..ef5cddbf 100644
--- a/jiuyi2/common/js/config.js
+++ b/jiuyi2/common/js/config.js
@@ -2,12 +2,12 @@
const config = {
// 接口域名
// #ifdef H5
- // host: 'http://localhost:5173',
- host: 'h5api',
+ host: 'http://localhost:5173',
+ // host: 'h5api',
// #endif
// #ifndef H5
- host: 'http://91f.xyz:8080',
- // host: 'http://192.168.0.110:8080',
+ // host: 'http://91f.xyz:8080',
+ host: 'http://192.168.0.110:8080',
// host: 'http://192.168.0.100:8080',
// #endif
// 支付方式配置
diff --git a/jiuyi2/pages/mine/mine.vue b/jiuyi2/pages/mine/mine.vue
index a1e12a9b..843639d8 100644
--- a/jiuyi2/pages/mine/mine.vue
+++ b/jiuyi2/pages/mine/mine.vue
@@ -150,10 +150,10 @@
历史浏览
-
+
@@ -164,13 +164,13 @@
-
+
入驻商家
-
+
店铺管理
@@ -179,14 +179,14 @@
商品管理
-
+
+
diff --git a/jiuyi2/pages/shop/collect.vue b/jiuyi2/pages/shop/collect.vue
index 1e65e80a..ca3e5523 100644
--- a/jiuyi2/pages/shop/collect.vue
+++ b/jiuyi2/pages/shop/collect.vue
@@ -183,7 +183,7 @@
-
+
完成
管理
@@ -201,7 +201,7 @@
-
+
@@ -235,9 +235,9 @@
-
+
-
+
已选择{{selectList.length}}款
diff --git a/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue b/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue
index 6cc639e3..1ec72dc0 100644
--- a/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue
+++ b/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue
@@ -167,10 +167,10 @@
-
+
diff --git a/jiuyi2/pages/shop/store/commodities.vue b/jiuyi2/pages/shop/store/commodities.vue
index 6cedf741..bb0d9f23 100644
--- a/jiuyi2/pages/shop/store/commodities.vue
+++ b/jiuyi2/pages/shop/store/commodities.vue
@@ -6,7 +6,8 @@
} from 'vue'
import {
onLoad,
- onReachBottom
+ onReachBottom,
+ onPullDownRefresh
} from "@dcloudio/uni-app"
// 顶部导航
@@ -27,7 +28,17 @@
getList()
})
- // 获取更多商品
+ onReachBottom(() => {
+ // 获取更多商品
+ getMoreList()
+ })
+
+ onPullDownRefresh(() => {
+ // 重载商品列表
+ refeshList()
+ })
+
+ // 重载商品列表
function refeshList() {
if (product.list.length >= product.total) return
product.pageNum++
@@ -65,11 +76,11 @@
/**
* 编辑
- * @param {Object} item
+ * @param {Object} item 商品对象
*/
function handleEdit(item) {
uni.navigateTo({
- url: util.setUrl('/pages/release/commodity',{
+ url: util.setUrl('/pages/release/commodity', {
id: item.id
})
})
@@ -77,13 +88,39 @@
/**
* 跳转
- * @param {Object} url 路径
+ * @param {String} url 路径
*/
function link(url) {
uni.navigateTo({
url
})
}
+
+ /**
+ * 删除发布的商品
+ * @param {Object} item 商品对象
+ */
+ function handleRemove(item) {
+ util.alert({
+ content: '确定删除该商品吗?',
+ }).then(res => {
+ if (!res.confirm) return
+ // 删除商品
+ api.shop.removeProduct({
+ path: [item.id]
+ }).then(rs => {
+ if (rs.code === 200) {
+ // 重构商品列表
+ refeshList()
+ return
+ }
+ util.alert({
+ content: rs.msg,
+ showCancel: false,
+ })
+ })
+ })
+ }
@@ -99,8 +136,7 @@
-
+
@@ -121,10 +157,10 @@
diff --git a/jiuyi2/vite.config.js b/jiuyi2/vite.config.js
index af5e56dd..9b1c0bdf 100644
--- a/jiuyi2/vite.config.js
+++ b/jiuyi2/vite.config.js
@@ -3,9 +3,8 @@ import {
} from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
-//
-let target = 'http://91f.xyz:8080'
-// let target = 'http://192.168.0.110:8080'
+// let target = 'http://91f.xyz:8080'
+let target = 'http://192.168.0.110:8080'
// let target = 'http://192.168.0.100:8080'
export default defineConfig({