diff --git a/app.wxss b/app.wxss index 7b59f14..fd40e8c 100644 --- a/app.wxss +++ b/app.wxss @@ -118,7 +118,7 @@ swiper-item { padding: var(--page-padding) var(--page-padding) 50rpx; width: 100%; box-sizing: border-box; - z-index: 1; + z-index: 2; } .bottom-btn-green { @@ -139,10 +139,20 @@ swiper-item { .bottom-btn-blue { background-color: var(--btn-blue-color); color: var(--white-color); - font-size: 16px; + font-size: 32rpx; height: 80rpx; line-height: 80rpx; - border-radius: 5px; + border-radius: 5rpx; + text-align: center; +} + +.bottom-btn-gray { + background-color: var(--gray-color-light); + color: var(--text-brown-color); + font-size: 32rpx; + height: 80rpx; + line-height: 80rpx; + border-radius: 5rpx; text-align: center; } diff --git a/net/api/shop.js b/net/api/shop.js index 655736e..1fe387c 100644 --- a/net/api/shop.js +++ b/net/api/shop.js @@ -12,10 +12,13 @@ const apiPath = { delGoods: "/api/goods/remove/{ids}", //删除商品 DELETE updateGoods: "/api/goods/update/{goodsId}", //修改商品 PUT doCheck: "/api/goods/sub-check/{goodsId}", //提交审核 PUT - onGoods: "/api/goods/publish/{goodsId}", //上架商品 PUT - offGoods: "/api/goods/no-publish/{goodsId}", //下架商品 + onGoods: "/api/goods/{publish}/{goodsId}", //上架商品 PUT publish + offGoods: "/api/goods/{publish}/{goodsId}", //下架商品 no-publish + saleGoods: '/api/goods/{publish}/{goodsId}', //上架或下架商品 goodsDics: "/api/data/listbyparentid/{dId}", //商品数据字典 + goodsDicDetail: '/api/data/get/{dId}', //字典详情 areaList: "/api/area/listbyparentid/{pId}", //省市区树结构 + areaDetail: '/api/area/get/{areaId}', //地区详情 saveOrder: '/api/order/save/{goodsId}', //新增订单 confirmOrder: '/api/order/confirm-pay/{orderId}', //确定付款 cancelOrder: '/api/order/save-cancel/{orderId}', //取消订单 @@ -52,7 +55,12 @@ class Shop { dId: id }) } - + //字典详情 + static doGetDicDetail(id) { + return this.requestHandler(apiPath.goodsDicDetail, "GET", null, { + dId: id + }) + } // 新增软件商品 static doSaveGoods(data) { return this.requestHandler(apiPath.saveGoods, "POST", data) @@ -99,12 +107,25 @@ class Shop { goodsId: id }) } + //上架或下架商品 + static doSaleGoods(status, id) { + return this.requestHandler(apiPath.saleGoods, "PUT", null, { + publish: status, + goodsId: id + }) + } //获取地区 static doGetAreaList(id) { return this.requestHandler(apiPath.areaList, "GET", null, { pId: id }) } + //地区详情 + static doGetAreaDetail(id) { + return this.requestHandler(apiPath.areaDetail, "GET", null, { + areaId: id + }) + } //新增订单 static doSaveOrder(id) { return this.requestHandler(apiPath.saveOrder, "POST", null, { diff --git a/pages/shop/publishCopyright/publishCopyright.js b/pages/shop/publishCopyright/publishCopyright.js index 7dadfae..ab09158 100644 --- a/pages/shop/publishCopyright/publishCopyright.js +++ b/pages/shop/publishCopyright/publishCopyright.js @@ -131,23 +131,21 @@ Page({ showType: true }) }, + //选择软著分类 bindChangeRightType(e) { - const selectedIds = new Set(e.detail.value); - const rightTypeMap = new Map(); - this.data.rightType.forEach(item => { - rightTypeMap.set(item.dataId, item); - }); - const selRightType = [...selectedIds].map(id => { - const item = rightTypeMap.get(id); - if (item) { - item.checked = true; + const selectedIds = e.detail.value; + const selectedItems = []; + for (let i = 0; i < this.data.rightType.length; i++) { + const item = this.data.rightType[i]; + item.checked = selectedIds.indexOf(item.dataId) !== -1; + if (item.checked) { + selectedItems.push(item); } - return item; - }).filter(Boolean); + } this.setData({ - selRightType, - rightType: [...this.data.rightType] - }); + rightType: this.data.rightType, + selRightType: selectedItems + }) }, clearRightType() { this.data.rightType.forEach(item => { @@ -445,6 +443,7 @@ Page({ return true; }, buildParams() { + const typeIds = this.data.selRightType.map(item => item.dataId).join(','); const data = { goodsLastTime: this.data.rightStopDate, goodsLeader: this.data.orgName, @@ -457,7 +456,7 @@ Page({ goodsName: this.data.rightName, goodsLocalPhoto: this.data.files[0].fileId, goodsPrice: this.data.rightPrice, - goodsType: this.data.selRightType.dataId + goodsType: typeIds } return data }, diff --git a/pages/shop/publishCopyright/publishCopyright.wxss b/pages/shop/publishCopyright/publishCopyright.wxss index 888beb1..b1797e7 100644 --- a/pages/shop/publishCopyright/publishCopyright.wxss +++ b/pages/shop/publishCopyright/publishCopyright.wxss @@ -108,8 +108,8 @@ color: var(--text-color); } -.select-item-item:nth-of-type(n+2) { - margin-left: 10rpx; +.select-item-item:nth-of-type(n+1) { + margin: 8rpx; } .desc { diff --git a/pages/shop/sellGoodsDetail/sellGoodsDetail.js b/pages/shop/sellGoodsDetail/sellGoodsDetail.js index c33294e..3b5aef4 100644 --- a/pages/shop/sellGoodsDetail/sellGoodsDetail.js +++ b/pages/shop/sellGoodsDetail/sellGoodsDetail.js @@ -1,66 +1,293 @@ -// pages/shop/sellGoodsDetail/sellGoodsDetail.js +// pages/shop/publishCopyright/publishCopyright.js +import Shop from '../../../net/api/shop' +import { + sImgPrefix +} from '../../../net/mainUrl' Page({ - /** - * 页面的初始数据 - */ - data: { + /** + * 页面的初始数据 + */ + data: { + msgHint: '', + msgType: 'info', + msgShow: false, + showType: false, + goodsId: '', + goods: null, + typeNameList: [], + cardTypeName: '', + cityName: '', + leaderType: '' + }, - }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + wx.setNavigationBarTitle({ + title: '详情', + }) + wx.setNavigationBarColor({ + frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000 + backgroundColor: '#FFFFFF', // 传递的颜色值,仅支持十六进制颜色 + animation: { // 可选项 + duration: 500, + timingFunc: 'easeIn' + } + }) + const id = options.id + if (id && id != '') { + this.setData({ + goodsId: id + }) + this.doGetGoodsDetail() + } else { + this.setData({ + msgHint: '数据有误,请稍后重试', + msgType: 'error', + msgShow: true + }) + setTimeout(() => { + wx.navigateBack() + }, 1500); + } + }, + //获取商品详情 + doGetGoodsDetail() { + wx.showLoading({ + title: '加载中...', + }) + const _self = this + Shop.doGetGoodsDetail(this.data.goodsId) + .then(res => { + wx.hideLoading() + if (res && res != null) { + res.goodsLocalPhoto = sImgPrefix + res.goodsLocalPhoto + switch (res.goodsLeaderType) { + case '1': + res.goodsLeaderTypeName = '自然人' + break + case '2': + res.goodsLeaderTypeName = '法人' + break + case '3': + res.goodsLeaderTypeName = '非法人组织或其他' + break + } - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { + _self.setData({ + goods: res + }) + console.log(_self.data.goods) + _self.getDic() + } else { + _self.setData({ + msgHint: '网络错误,请稍后重试', + msgType: 'error', + msgShow: true + }) + setTimeout(() => { + wx.navigateBack() + }, 1800); + } + }) + .catch(err => { + wx.hideLoading() + _self.setData({ + msgHint: err.msg ? err.msg : '网络错误,请稍后重试', + msgType: 'error', + msgShow: true + }) + setTimeout(() => { + wx.navigateBack() + }, 1800); + }) + }, + //获取字典详情 + getDic() { + wx.showLoading({ + title: '加载中...', + }) + const _self = this + //软著分类 goodsType + const sort = Shop.doGetGoodsDic('0b00884a-f7a2-425f-93e5-599fbaad4bde') + //证件类别 goodsLeaderIdcardType + const type = Shop.doGetDicDetail(_self.data.goods.goodsLeaderIdcardType) + //省市 goodsLeaderCity1 goodsLeaderCity2 + const city1 = Shop.doGetAreaDetail(_self.data.goods.goodsLeaderCity1) + const city2 = Shop.doGetAreaDetail(_self.data.goods.goodsLeaderCity2) + const list = [sort, type, city1, city2] + Promise.all(list) + .then(res => { + wx.hideLoading() + if (res && res.length > 0) { + const tempList = [] + res[0].forEach(item => { + if (_self.data.goods.goodsType.indexOf(item.dataId) != -1) { + tempList.push(item) + } + }) + _self.setData({ + typeNameList: tempList, + cardTypeName: res[1].dataName, + cityName: res[2].areaName + '/' + res[3].areaName + }) + } + }) + .catch(err => { + console.log(err) + wx.hideLoading() + }) + }, + doPreImg(e) { + wx.previewImage({ + urls: [e.currentTarget.dataset.value], + }) + }, + backPageRefresh() { + let pages = getCurrentPages(); + let beforePage = pages[pages.length - 2]; + beforePage.setData({ + needRefresh: true + }) + wx.navigateBack() + }, + //提交审核 + doCheck() { + wx.showModal({ + title: '提示', + content: '确定要将该软著商品提交审核吗?', + complete: (res) => { + if (res.confirm) { + this.goCheck() + } + } + }) + }, + //去审核 + goCheck() { + wx.showLoading({ + title: '提交中...', + }) + const _self = this + Shop.doSubCheck(_self.data.goodsId) + .then(res => { + wx.hideLoading() + _self.setData({ + msgHint: '提交成功', + msgType: 'success', + msgShow: true + }) + _self.upPageNeedRefresh() + _self.doGetGoodsDetail() + }) + .catch(err => { + wx.hideLoading() + _self.setData({ + msgHint: err.msg ? err.msg : '网络错误,请稍后重试', + msgType: 'error', + msgShow: true + }) + }) + }, + //去编辑 + doEdit() { - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } + }, + //删除 + doDel() { + wx.showModal({ + title: '警告', + content: '您确定要删除该软著商品吗?', + complete: (res) => { + if (res.confirm) { + this.goDel() + } + } + }) + }, + //删除 + goDel() { + wx.showLoading({ + title: '删除中...', + }) + const _self = this + Shop.doDelGoods(_self.data.goodsId) + .then(res => { + wx.hideLoading() + _self.setData({ + msgHint: '删除成功', + msgType: 'success', + msgShow: true + }) + setTimeout(() => { + _self.backPageRefresh() + }, 1200); + }) + .catch(err => { + wx.hideLoading() + _self.setData({ + msgHint: err.msg ? err.msg : '网络错误,请稍后重试', + msgType: 'error', + msgShow: true + }) + }) + }, + //上架或下架 + doSale() { + var content + var status = 'publish' + if (this.data.goods.goodsStatus == '1') { + //下架 + content = '您确定要下架该软著商品吗?' + status = 'no-publish' + } else if (this.data.goods.goodsStatus == '0') { + //上架 + content = '您确定要上架该软著商品吗?' + status = 'publish' + } + wx.showModal({ + title: '提示', + content: content, + complete: (res) => { + if (res.confirm) { + this.goSale(status) + } + } + }) + }, + //上下架 + goSale(status) { + wx.showLoading({ + title: '操作中...', + }) + const _self = this + Shop.doSaleGoods(status, _self.data.goodsId) + .then(res => { + wx.hideLoading() + _self.setData({ + msgHint: '操作成功', + msgType: 'success', + msgShow: true + }) + _self.upPageNeedRefresh() + _self.doGetGoodsDetail() + }) + .catch(err => { + wx.hideLoading() + _self.setData({ + msgHint: err.msg ? err.msg : '网络错误,请稍后重试', + msgType: 'error', + msgShow: true + }) + }) + }, + upPageNeedRefresh() { + let pages = getCurrentPages(); + let beforePage = pages[pages.length - 2]; + beforePage.setData({ + needRefresh: true + }) + } }) \ No newline at end of file diff --git a/pages/shop/sellGoodsDetail/sellGoodsDetail.json b/pages/shop/sellGoodsDetail/sellGoodsDetail.json index 8835af0..0c8eaa2 100644 --- a/pages/shop/sellGoodsDetail/sellGoodsDetail.json +++ b/pages/shop/sellGoodsDetail/sellGoodsDetail.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": { + "mp-toptips": "weui-miniprogram/toptips/toptips" + } } \ No newline at end of file diff --git a/pages/shop/sellGoodsDetail/sellGoodsDetail.wxml b/pages/shop/sellGoodsDetail/sellGoodsDetail.wxml index 71725de..1ac214d 100644 --- a/pages/shop/sellGoodsDetail/sellGoodsDetail.wxml +++ b/pages/shop/sellGoodsDetail/sellGoodsDetail.wxml @@ -1,2 +1,110 @@ - -pages/shop/sellGoodsDetail/sellGoodsDetail.wxml \ No newline at end of file + + + + + + + + 审核信息 + + + 状态 + + {{tools.goodsStatus(goods.goodsCheckStatus,goods.goodsStatus)}} + + + + 审核信息 + + {{goods.goodsCheckRemark}} + + + + + 软著信息 + + + + 软著名称 + + {{goods.goodsName}} + + + + 软著分类 + + + + + {{item.dataName}} + + + + + + + 售卖价格 + + {{goods.goodsPrice}} + + + + 截止售卖日期 + + {{goods.goodsLastTime}} + + + + 著作权人信息 + + + + 类别 + + {{goods.goodsLeaderTypeName}} + + + + 姓名或机构名称 + + {{goods.goodsLeader}} + + + + 省市 + + {{cityName}} + + + + 联系电话 + + {{goods.goodsLeaderPhone}} + + + + 证件类型 + + {{cardTypeName}} + + + + 证件号码 + + {{goods.goodsLeaderIdcard}} + + + + + + + + 删除 + 编辑 + 提交审核 + {{goods.goodsStatus=='1'?'下架':'上架'}} + + + + + \ No newline at end of file diff --git a/pages/shop/sellGoodsDetail/sellGoodsDetail.wxss b/pages/shop/sellGoodsDetail/sellGoodsDetail.wxss index 2cbced3..d72f070 100644 --- a/pages/shop/sellGoodsDetail/sellGoodsDetail.wxss +++ b/pages/shop/sellGoodsDetail/sellGoodsDetail.wxss @@ -1 +1,213 @@ -/* pages/shop/sellGoodsDetail/sellGoodsDetail.wxss */ \ No newline at end of file +/* pages/shop/publishCopyright/publishCopyright.wxss */ + +.content-box { + border-radius: 20rpx; + margin-top: -30rpx; +} + +.upload-img-box { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + padding: 20rpx; +} + +.content-container { + margin: 0rpx -30rpx 80rpx -30rpx; + background-color: white; + display: flex; + flex-direction: column; + padding: 30rpx; +} + +.info-title { + font-size: 36rpx; + font-weight: bold; + display: flex; + flex-direction: row; + align-items: center; +} + + +.info-title::before { + content: ""; + width: 10rpx; + height: 36rpx; + margin-right: 5rpx; + border-left: 15rpx solid var(--blue-color); + vertical-align: middle; +} + +.section { + margin-bottom: 15rpx; + margin-left: 10rpx; +} + +.item { + display: flex; + flex-direction: column; + margin-bottom: 10rpx; + padding: 20rpx 10rpx; + font-size: 28rpx; +} + +.label { + color: var(--text-color); + font-weight: bold; +} + +.select-content { + margin-top: 15rpx; + display: flex; + height: 70rpx; + flex-direction: row; + border-radius: 5rpx; + background-color: var(--bg-gray-input-color); + padding: 0rpx 10rpx; +} + +.select-content-no-h { + margin-top: 15rpx; + display: flex; + flex-direction: row; + align-items: center; + min-height: 70rpx; + flex-direction: row; + border-radius: 5rpx; + padding: 0rpx 15rpx 10rpx 10rpx; + border-bottom: 1rpx solid var(--divider-color); +} + +.select-content-item { + margin-top: 15rpx; + display: flex; + flex-direction: row; + align-items: center; + height: 70rpx; + flex-direction: row; + border-radius: 5rpx; + padding: 0rpx 15rpx 10rpx 0rpx; + border-bottom: 1rpx solid var(--divider-color); +} + +.select-item-box { + flex: 1; + display: flex; + flex-direction: row; + flex-wrap: wrap; + padding: 5rpx; +} + +.select-item-item { + display: flex; + flex-direction: row; + align-items: center; + background-color: var(--divider-color); + padding: 5rpx 15rpx; + border-radius: 5rpx; + font-size: 24rpx; + color: var(--text-color); +} + +.select-item-item:nth-of-type(n+1) { + margin: 10rpx; +} + +.desc { + flex: 1; + color: #999; + text-align: left; + padding-left: 20rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + padding-right: 10px; + align-items: center; +} + +.select-time { + color: var(--text-color); + flex: 1; + font-size: 28rpx; + text-align: left; +} + +.clear-icon { + width: 20px; + height: 20px; + margin-right: 20rpx; +} + +.value { + flex: 1; + text-align: left; + font-size: 28rpx; +} + + +.value-hint { + color: var(--text-gray-hint-color); +} + +.v-select { + color: var(--text-gray-desc-color); +} + +.v-normal { + color: var(--text-gray-hint-color) +} + +.custom-dialog { + background-color: var(--white-color); +} + +.custom-tips { + margin-top: 80px; +} + +/* 上传图片 */ + +.weui-uploader { + margin-top: 10rpx; + width: 100%; +} + +.weui-uploader__bd { + display: flex; + flex-direction: row; + margin-bottom: 0; +} + +.weui-uploader__hd { + display: none; +} + +.weui-uploader__input-box { + width: 280rpx; + height: 380rpx; + border-radius: 5px; + background-color: transparent; +} + +.weui-uploader__file { + width: 280rpx; + height: 380rpx; + border-radius: 5px; +} + +.weui-uploader__img { + border-radius: 5px; +} + +.weui-uploader__overview { + display: flex; + flex-direction: row; + justify-content: space-between; + width: 65vw; +} + +.weui-uploader__input-box { + border: 1rpx solid var(--bg-bottom-color); + background-color: transparent; +} \ No newline at end of file diff --git a/utils/comm.wxs b/utils/comm.wxs index dd71743..736f86f 100644 --- a/utils/comm.wxs +++ b/utils/comm.wxs @@ -1,7 +1,7 @@ var isEmpty = function (obj) { if (obj == null) return true; if (typeof obj !== 'object') return false; - return JSON.stringify(obj) === '{}'; + return JSON.stringify(obj) == '{}'; }; // 充值1|支出2|提现3|系统扣款4|订单收入5|付款6) var payTypeFontSize = function (type) { @@ -118,7 +118,7 @@ var goodsStatus = function (check, status) { '': '未提交', '0': '审核不通过', '1': '审核中', - '2': status === '1' ? '已上架' : '审核通过(未上架)' + '2': status == '1' ? '已上架' : '审核通过(未上架)' }; return statusMap[check] || '未知状态'; }