diff --git a/net/api/shop.js b/net/api/shop.js index cf365ff..655736e 100644 --- a/net/api/shop.js +++ b/net/api/shop.js @@ -2,6 +2,8 @@ import { request } from "../http"; // 公共API +// 0b00884a-f7a2-425f-93e5-599fbaad4bde 软著分类 +// ce3ded65-68ed-4f42-89da-de1b813b8f7e 证件类型 const proName = 'aiShop' const apiPath = { indexList: "/api/goodsonline/listpage", //上架的软著商品列表 GET @@ -12,8 +14,6 @@ const apiPath = { doCheck: "/api/goods/sub-check/{goodsId}", //提交审核 PUT onGoods: "/api/goods/publish/{goodsId}", //上架商品 PUT offGoods: "/api/goods/no-publish/{goodsId}", //下架商品 - // 0b00884a-f7a2-425f-93e5-599fbaad4bde 软著分类 - // ce3ded65-68ed-4f42-89da-de1b813b8f7e 证件类型 goodsDics: "/api/data/listbyparentid/{dId}", //商品数据字典 areaList: "/api/area/listbyparentid/{pId}", //省市区树结构 saveOrder: '/api/order/save/{goodsId}', //新增订单 @@ -21,6 +21,7 @@ const apiPath = { cancelOrder: '/api/order/save-cancel/{orderId}', //取消订单 mineBuyOrder: '/api/order/listpage-buy', //我购买的订单 mineSellOrder: '/api/order/listpage-sell', //我销售的 + mineSellGoods: '/api/goods/listpage', //我售卖的软著 } class Shop { // 通用路径参数替换方法 @@ -130,6 +131,10 @@ class Shop { static doGetMineSellOrder(data) { return this.requestHandler(apiPath.mineSellOrder, "GET", data) } + //我售卖的商品 + static doGetMineSellGoods(data) { + return this.requestHandler(apiPath.mineSellGoods, "GET", data) + } } export default Shop; \ No newline at end of file diff --git a/pages/shop/buyGoods/buyGoods.js b/pages/shop/buyGoods/buyGoods.js index 9e72b78..f3c12d8 100644 --- a/pages/shop/buyGoods/buyGoods.js +++ b/pages/shop/buyGoods/buyGoods.js @@ -43,7 +43,6 @@ Page({ dataId: 'ASC' }], selOwner: '', - isSticky: false, msgType: 'info', msgHint: '', msgShow: false diff --git a/pages/shop/buyGoods/buyGoods.json b/pages/shop/buyGoods/buyGoods.json index 722409e..0d6d47f 100644 --- a/pages/shop/buyGoods/buyGoods.json +++ b/pages/shop/buyGoods/buyGoods.json @@ -1,6 +1,5 @@ { "usingComponents": { - "custom-tabbar": "/components/tabbar/custom-tabbar", "container-loading": "/components/container-loading/container-loading", "mp-loading": "weui-miniprogram/loading/loading", "mp-toptips": "weui-miniprogram/toptips/toptips" diff --git a/pages/shop/buyGoods/buyGoods.wxml b/pages/shop/buyGoods/buyGoods.wxml index 9e0b6be..4525173 100644 --- a/pages/shop/buyGoods/buyGoods.wxml +++ b/pages/shop/buyGoods/buyGoods.wxml @@ -64,32 +64,6 @@ - \ No newline at end of file diff --git a/pages/shop/buyGoods/buyGoods.wxss b/pages/shop/buyGoods/buyGoods.wxss index 40ffc8b..c48d98d 100644 --- a/pages/shop/buyGoods/buyGoods.wxss +++ b/pages/shop/buyGoods/buyGoods.wxss @@ -304,4 +304,5 @@ .content-item-price { color: red; font-size: 28rpx; + font-weight: bold; } \ No newline at end of file diff --git a/pages/shop/goodsDetail/goodsDetail.wxml b/pages/shop/goodsDetail/goodsDetail.wxml index 89f7797..09b7bd3 100644 --- a/pages/shop/goodsDetail/goodsDetail.wxml +++ b/pages/shop/goodsDetail/goodsDetail.wxml @@ -7,6 +7,11 @@ {{goods.goodsName}} + + + {{goods.goodsDescription}} + + 上架:{{goods.goodsStatusTime}} diff --git a/pages/shop/sellGoods/sellGoods.js b/pages/shop/sellGoods/sellGoods.js index 7b9c53a..fb6f218 100644 --- a/pages/shop/sellGoods/sellGoods.js +++ b/pages/shop/sellGoods/sellGoods.js @@ -1,26 +1,51 @@ // pages/shop/sellGoods/sellGoods.js +import Shop from '../../../net/api/shop' +import { + sImgPrefix +} from '../../../net/mainUrl' +const app = getApp() Page({ - /** - * 页面的初始数据 - */ data: { pageData: { page: 1, rows: 10, keywords: '', - startTime: '', - endTime: '', - orderStatus: '' + keywords: '', + goodsLeaderType: '', + goodsGetTime: '', + goodsDevelop: '', + goodsType: '' }, - msgShow: false, - msgHint: '', - msgType: 'error', - loadingState: 'loading', - listRefreshTrig: false, + keywords: '', + priceStart: '', + priceEnd: '', isLoadMore: false, hasMore: true, - goodsList: [] + listLoading: 'loading', + listRefreshTrig: false, + goodsList: [], + imgPrefix: sImgPrefix, + localAssets: app.globalData.localAssets, + imgAssets: app.globalData.imgAssetsUrl, + typeList: [], + selType: '', + ownerList: [{ + dataName: '自然人', + dataId: '1' + }, { + dataName: '法人', + dataId: '2' + }, { + dataName: '非法人组织或其他', + dataId: '3' + }], + selOwner: '', + msgType: 'info', + msgHint: '', + msgShow: false, + isScrolling: false, + scrollTimer: null }, /** @@ -38,6 +63,173 @@ Page({ timingFunc: 'easeIn' } }) + this.doGetDic() + this.doRefreshList() + }, + inputKeywords(e) { + this.setData({ + keywords: e.detail.value + }) + }, + doSearch() { + this.doRefreshList() + }, + //滑动监听 + onScrollListener(e) { + if (this.data.scrollTimer) { + clearTimeout(this.data.scrollTimer); + } + if (!this.data.isScrolling) { + this.setData({ + isScrolling: true + }); + } + const timer = setTimeout(() => { + this.setData({ + isScrolling: false + }); + }, 300); + this.setData({ + scrollTimer: timer + }); }, + bindChooseType(e) { + wx.pageScrollTo({ + scrollTop: 0 + }) + setTimeout(() => { + const item = e.currentTarget.dataset.item; + let newSelType = this.data.selType; + // 先转数组,处理空字符串情况 + const typeArr = newSelType ? newSelType.split(',') : []; + + if (typeArr.includes(item.dataId)) { + // 删除 + const index = typeArr.indexOf(item.dataId); + typeArr.splice(index, 1); + } else { + // 添加 + typeArr.push(item.dataId); + } + + // 转回字符串,自动处理空数组(转成空字符串) + newSelType = typeArr.join(','); + + this.setData({ + selType: newSelType + }); + console.log('选择分类:', this.data.selType); + this.doRefreshList(); + }, 500); + }, + bindChooseOwner(e) { + const item = e.currentTarget.dataset.item + this.setData({ + selOwner: this.data.selOwner == item.dataId ? '' : item.dataId + }) + this.doRefreshList() + }, + doGetDic() { + wx.showLoading({ + title: '加载中...', + }) + const that = this + Shop.doGetGoodsDic('0b00884a-f7a2-425f-93e5-599fbaad4bde') + .then(res => { + wx.hideLoading() + that.setData({ + typeList: res + }) + }) + .catch(err => { + wx.hideLoading() + }) + }, + //刷新 + doRefreshList() { + const _self = this + this.setData({ + goodsList: [], + isLoadMore: false, + hasMore: true, + listRefreshTrig: true, + 'pageData.page': 1, + 'pageData.keywords': _self.data.keywords, + 'pageData.priceOrder': _self.data.selOwner, + 'pageData.priceRangeStart': _self.data.priceStart, + 'pageData.priceRangeEnd': _self.data.priceEnd, + 'pageData.goodsType': _self.data.selType, + }) + _self.getIndexList(true) + }, + //加载更多 + doLoadMore() { + const _self = this + if (_self.data.isLoadMore || !_self.data.hasMore) { + return + } + //判断是否有更多 + _self.setData({ + isLoadMore: true, + 'pageData.page': ++_self.data.pageData.page + }) + _self.getIndexList(false) + }, + //获取列表 + getIndexList(isRefresh) { + const _self = this + _self.setData({ + listLoading: isRefresh ? 'loading' : '' + }) + Shop.doGetMineSellGoods(_self.data.pageData) + .then(res => { + console.log(res) + var status = 'success' + status = res.rows && res.rows.length > 0 ? 'success' : 'empty' + const list = _self.addPrefixToPreviewImgs(res.rows) + _self.setData({ + listLoading: isRefresh ? status : '', + goodsList: _self.data.goodsList.concat(list), + listRefreshTrig: false, + isLoadMore: false, + }) + _self.setData({ + hasMore: _self.data.goodsList.length < res.total + }) + }) + .catch(err => { + console.log(err) + _self.setData({ + listLoading: 'error', + listRefreshTrig: false, + isLoadMore: false, + hasMore: true + }) + }) + }, + //为数据中图片添加前缀 + addPrefixToPreviewImgs(data) { + const prefix = this.data.imgPrefix; + return data.map(item => { + if (item.goodsPhoto && item.goodsPhoto != '') { + item.preImg = prefix + item.goodsPhoto + } + return item; + }); + }, + //详情 + doDetail(e) { + const id = e.currentTarget.dataset.value + wx.navigateTo({ + url: '/pages/shop/goodsDetail/goodsDetail?id=' + id, + animation: 'fade' + }) + }, + //去创建软著商品 + doCreateGoods() { + wx.navigateTo({ + url: '/pages/shop/publishCopyright/publishCopyright', + }) + } }) \ No newline at end of file diff --git a/pages/shop/sellGoods/sellGoods.json b/pages/shop/sellGoods/sellGoods.json index 8835af0..0d6d47f 100644 --- a/pages/shop/sellGoods/sellGoods.json +++ b/pages/shop/sellGoods/sellGoods.json @@ -1,3 +1,7 @@ { - "usingComponents": {} + "usingComponents": { + "container-loading": "/components/container-loading/container-loading", + "mp-loading": "weui-miniprogram/loading/loading", + "mp-toptips": "weui-miniprogram/toptips/toptips" + } } \ No newline at end of file diff --git a/pages/shop/sellGoods/sellGoods.wxml b/pages/shop/sellGoods/sellGoods.wxml index d971837..2f2ae96 100644 --- a/pages/shop/sellGoods/sellGoods.wxml +++ b/pages/shop/sellGoods/sellGoods.wxml @@ -1,2 +1,72 @@ - -pages/shop/sellGoods/sellGoods.wxml \ No newline at end of file + + + + + + + 搜索 + + + + + + 软著分类 + + + + + {{item.dataName}} + + + + + + + 所属者类型 + + + + + {{item.dataName}} + + + + + + + + + + + + + + + + + + + {{item.goodsName}} + + + 截止:{{item.goodsLastTime}} + + 特价 + + + + + + AI喵著 + + + + + + + 发布软著 + + + + + \ No newline at end of file diff --git a/pages/shop/sellGoods/sellGoods.wxss b/pages/shop/sellGoods/sellGoods.wxss index a9e7ebc..99aad2c 100644 --- a/pages/shop/sellGoods/sellGoods.wxss +++ b/pages/shop/sellGoods/sellGoods.wxss @@ -1 +1,337 @@ -/* pages/shop/sellGoods/sellGoods.wxss */ \ No newline at end of file +.page-title-box { + background-color: var(--white-color); + position: fixed; + top: 0; + left: 0; + display: flex; + flex-direction: column; + z-index: 3; + width: 100%; + padding: 10rpx 30rpx; + box-sizing: border-box; + box-shadow: 0 2rpx 4rpx var(--bg-gray-input-color); +} + +.search-container-fixed { + display: flex; + flex-direction: column; + box-sizing: border-box; +} + +.search-box { + background-color: var(--bg-gray-color); + display: flex; + flex-direction: row; + align-items: center; + padding: 15rpx 20rpx; + border-radius: 60rpx; + font-size: 28rpx; +} + +.search-input { + flex: 1; +} + +.divider-20 { + background-color: var(--bg-gray-input-color); + min-height: 20rpx; + margin: 0rpx -30rpx; +} + +.title-box { + position: relative; + margin-top: 60rpx; + padding: 30rpx; +} + +.title-bg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 300rpx; + background-size: cover; +} + +.title-container { + position: relative; +} + +.title-hint-box { + display: flex; + flex-direction: row; + margin-top: 20rpx; +} + +.title-hint-item { + display: flex; + flex-direction: row; + align-items: center; +} + +.title-hint-item:nth-of-type(n+2) { + margin-left: 30rpx; +} + +.title-hint-txt { + margin-left: 8rpx; + font-size: 24rpx; + color: var(--text-gray-desc-color); +} + +.hook { + width: 32rpx; + height: 32rpx; + border-radius: 50%; + background: linear-gradient(0deg, #FFB540 0%, #FF4800 100%); + position: relative; + display: flex; + align-items: center; + justify-content: center; +} + +.hook::after { + content: ""; + display: block; + width: 8rpx; + height: 15rpx; + border: solid white; + border-width: 0 2rpx 2rpx 0; + transform: rotate(45deg); + position: absolute; + top: 6rpx; +} + +.title-func-box { + display: flex; + flex-direction: row; + justify-content: space-between; + margin-top: 30rpx; +} + +.title-func-item { + display: flex; + flex-direction: column; + align-items: center; +} + +.func-img { + width: 120rpx; + height: 120rpx; +} + +.func-txt { + font-size: 28rpx; + color: var(--text-color); + margin-top: 15rpx; +} + +.container-box { + background-color: var(--white-color); + margin: 200rpx -30rpx 0rpx -30rpx; + padding: 30rpx; + min-height: 79vh; +} + +.header { + transition: all 0.3s; +} + +.header.sticky { + position: fixed; + background-color: var(--white-color); + box-sizing: border-box; + padding: 20rpx 30rpx 0rpx 30rpx; + top: 70rpx; + left: 0; + right: 0; + z-index: 100; + box-shadow: 0 2rpx 4rpx var(--bg-gray-input-color); +} + +.condition-box { + display: flex; + flex-direction: column; + padding: 30rpx 0rpx 20rpx 0rpx; +} + +.condition-item { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; +} + +.condition-item-title { + white-space: nowrap; + font-size: 24rpx; +} + +.list-tabs { + display: flex; + flex-direction: row; + flex-wrap: nowrap; +} + +.tab-select { + white-space: nowrap; + line-height: 17px; + border-radius: 5rpx; + background-color: var(--btn-primary-color); + color: var(--text-primary-deep-color); + font-size: 24rpx; + text-align: center; + padding: 5rpx 15rpx; +} + +.tab-normal { + background-color: var(--bg-gray-input-color); + color: var(--text-gray-hint-color); + white-space: nowrap; + line-height: 17px; + border-radius: 5rpx; + font-size: 24rpx; + text-align: center; + padding: 5rpx 15rpx; +} + +.item-margin { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.item-margin:nth-of-type(n+2) { + margin-left: 20rpx; +} + +.content-container { + display: flex; + flex-direction: column; + margin-bottom: 180rpx; + position: relative; +} + +.loading-box { + position: absolute; + top: 50%; + left: 50%; + z-index: 99; + transform: translate(-50%, -50%); +} + +.content-box { + display: flex; + flex-direction: row; + flex-wrap: wrap; +} + +.content-item { + width: 48%; + margin-top: 20rpx; + position: relative; +} + +.content-item:nth-of-type(even) { + margin-left: 20rpx; +} + + +.special-tag { + display: inline-block; + padding: 0rpx 20rpx; + background-color: var(--red-color); + color: #fff; + font-size: 22rpx; + border-bottom-right-radius: 30rpx; + border-top-right-radius: 30rpx; + position: absolute; + top: 0rpx; + left: 0rpx; +} + +.special-tag::before { + content: ''; + position: absolute; + left: 0rpx; + bottom: -15rpx; + border-width: 18rpx 18rpx 0 0rpx; + border-style: solid; + border-color: var(--red-color) transparent transparent transparent; +} + + +.content-item-img-box { + border-radius: 10rpx; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + padding: 20rpx; + background-color: var(--bg-gray-input-color); +} + +.content-item-img { + width: 200rpx; + height: 260rpx; +} + +.content-item-txt { + font-size: 28rpx; + margin-top: 15rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + max-width: 100%; +} + +.content-item-bottom { + display: flex; + flex-direction: row; + justify-content: space-between; +} + +.content-item-time { + font-size: 24rpx; + color: var(--text-gray-hint-color); +} + +.content-item-price { + color: red; + font-size: 28rpx; + font-weight: bold; +} + +.create-box-show, +.create-box-hide { + position: fixed; + bottom: 300rpx; + right: 35rpx; + color: white; + border-radius: 10rpx; + transition: all 0.3s ease; + opacity: 1; + z-index: 100; + height: 200rpx; + width: 200rpx; +} + +.create-box-hide { + opacity: 0; + transform: translate(-50%, 20rpx); + pointer-events: none; +} + +.create-box-bg { + width: 200rpx; + height: 200rpx; +} + +.create-txt { + position: absolute; + color: var(--white-color); + top: 117rpx; + left: 45rpx; + font-size: 28rpx; +} \ No newline at end of file diff --git a/static/images/icon_create_goods_bg.png b/static/images/icon_create_goods_bg.png new file mode 100644 index 0000000..ad4a895 Binary files /dev/null and b/static/images/icon_create_goods_bg.png differ