From 0a02b924f0e41f294e737329418e3cbd1b2b30b7 Mon Sep 17 00:00:00 2001 From: Junling Bu Date: Sun, 9 Feb 2020 23:17:49 +0800 Subject: [PATCH] =?UTF-8?q?feat[litemall-wx,=20litemall-wx-api]:=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=94=AE=E5=90=8E=E7=94=B3=E8=AF=B7=E3=80=81?= =?UTF-8?q?=E5=94=AE=E5=90=8E=E8=AF=A6=E6=83=85=E5=92=8C=E5=94=AE=E5=90=8E?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../litemall/wx/util/WxResponseCode.java | 3 + .../wx/web/WxAftersaleController.java | 176 +++++++++++++++++ .../litemall/wx/web/WxOrderController.java | 4 +- litemall-wx/app.json | 12 +- litemall-wx/config/api.js | 8 +- .../pages/ucenter/aftersale/aftersale.js | 171 ++++++++++++++++ .../pages/ucenter/aftersale/aftersale.json | 3 + .../pages/ucenter/aftersale/aftersale.wxml | 45 +++++ .../pages/ucenter/aftersale/aftersale.wxss | 103 ++++++++++ .../aftersaleDetail/aftersaleDetail.js | 65 ++++++ .../aftersaleDetail/aftersaleDetail.json | 3 + .../aftersaleDetail/aftersaleDetail.wxml | 42 ++++ .../aftersaleDetail/aftersaleDetail.wxss | 187 ++++++++++++++++++ .../ucenter/aftersaleList/aftersaleList.js | 69 +++++++ .../ucenter/aftersaleList/aftersaleList.json | 3 + .../ucenter/aftersaleList/aftersaleList.wxml | 42 ++++ .../ucenter/aftersaleList/aftersaleList.wxss | 165 ++++++++++++++++ litemall-wx/pages/ucenter/index/index.js | 14 +- .../pages/ucenter/orderDetail/orderDetail.js | 4 + .../ucenter/orderDetail/orderDetail.wxml | 1 + .../ucenter/orderDetail/orderDetail.wxss | 1 + litemall-wx/project.config.json | 38 +++- 22 files changed, 1149 insertions(+), 10 deletions(-) create mode 100644 litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAftersaleController.java create mode 100644 litemall-wx/pages/ucenter/aftersale/aftersale.js create mode 100644 litemall-wx/pages/ucenter/aftersale/aftersale.json create mode 100644 litemall-wx/pages/ucenter/aftersale/aftersale.wxml create mode 100644 litemall-wx/pages/ucenter/aftersale/aftersale.wxss create mode 100644 litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.js create mode 100644 litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.json create mode 100644 litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.wxml create mode 100644 litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.wxss create mode 100644 litemall-wx/pages/ucenter/aftersaleList/aftersaleList.js create mode 100644 litemall-wx/pages/ucenter/aftersaleList/aftersaleList.json create mode 100644 litemall-wx/pages/ucenter/aftersaleList/aftersaleList.wxml create mode 100644 litemall-wx/pages/ucenter/aftersaleList/aftersaleList.wxss diff --git a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/util/WxResponseCode.java b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/util/WxResponseCode.java index bab98d25..0454cac8 100644 --- a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/util/WxResponseCode.java +++ b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/util/WxResponseCode.java @@ -36,5 +36,8 @@ public class WxResponseCode { public static final int COUPON_RECEIVE_FAIL= 741; public static final int COUPON_CODE_INVALID= 742; + public static final int AFTERSALE_UNALLOWED = 750; + public static final int AFTERSALE_INVALID_AMOUNT = 751; + public static final int AFTERSALE_IS_REQUESTED = 752; } diff --git a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAftersaleController.java b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAftersaleController.java new file mode 100644 index 00000000..85408705 --- /dev/null +++ b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAftersaleController.java @@ -0,0 +1,176 @@ +package org.linlinjava.litemall.wx.web; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.linlinjava.litemall.core.util.ResponseUtil; +import org.linlinjava.litemall.core.validator.Order; +import org.linlinjava.litemall.core.validator.Sort; +import org.linlinjava.litemall.db.domain.*; +import org.linlinjava.litemall.db.service.*; +import org.linlinjava.litemall.db.util.AftersaleConstant; +import org.linlinjava.litemall.db.util.OrderUtil; +import org.linlinjava.litemall.wx.annotation.LoginUser; +import org.linlinjava.litemall.wx.util.WxResponseCode; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 售后服务 + * + * 目前只支持订单整体售后,不支持订单商品单个售后 + */ +@RestController +@RequestMapping("/wx/aftersale") +@Validated +public class WxAftersaleController { + private final Log logger = LogFactory.getLog(WxAftersaleController.class); + + @Autowired + private LitemallAftersaleService aftersaleService; + @Autowired + private LitemallOrderService orderService; + @Autowired + private LitemallOrderGoodsService orderGoodsService; + + /** + * 售后列表 + * + * @param userId 用户ID + * @param status 状态类型,如果是空则是全部 + * @param page 分页页数 + * @param limit 分页大小 + * @param sort 排序字段 + * @param order 排序方式 + * @return 售后列表 + */ + @GetMapping("list") + public Object list(@LoginUser Integer userId, + @RequestParam Short status, + @RequestParam(defaultValue = "1") Integer page, + @RequestParam(defaultValue = "10") Integer limit, + @Sort @RequestParam(defaultValue = "add_time") String sort, + @Order @RequestParam(defaultValue = "desc") String order) { + if (userId == null) { + return ResponseUtil.unlogin(); + } + + List aftersaleList = aftersaleService.queryList(userId, status, page, limit, sort, order); + + List> aftersaleVoList = new ArrayList<>(aftersaleList.size()); + for (LitemallAftersale aftersale : aftersaleList) { + List orderGoodsList = orderGoodsService.queryByOid(aftersale.getOrderId()); + + Map aftersaleVo = new HashMap<>(); + aftersaleVo.put("aftersale", aftersale); + aftersaleVo.put("goodsList", orderGoodsList); + + aftersaleVoList.add(aftersaleVo); + } + + return ResponseUtil.okList(aftersaleVoList, aftersaleList); + } + + /** + * 售后详情 + * + * @param id 售后ID + * @return 售后详情 + */ + @GetMapping("detail") + public Object detail(@LoginUser Integer userId, @NotNull Integer id) { + if (userId == null) { + return ResponseUtil.unlogin(); + } + + LitemallAftersale aftersale = aftersaleService.findById(id); + if(id == null){ + return ResponseUtil.badArgumentValue(); + } + if(!userId.equals(aftersale.getUserId())){ + return ResponseUtil.badArgumentValue(); + } + + LitemallOrder order = orderService.findById(aftersale.getOrderId()); + List orderGoodsList = orderGoodsService.queryByOid(order.getId()); + + Map data = new HashMap(); + data.put("aftersale", aftersale); + data.put("order", order); + data.put("orderGoods", orderGoodsList); + return ResponseUtil.ok(data); + } + + /** + * 申请售后 + * + * @param userId 用户ID + * @param aftersale 用户售后信息 + * @return 操作结果 + */ + @PostMapping("submit") + public Object submit(@LoginUser Integer userId, @RequestBody LitemallAftersale aftersale) { + if (userId == null) { + return ResponseUtil.unlogin(); + } + Object error = validate(aftersale); + if (error != null) { + return error; + } + // 进一步验证 + Integer orderId = aftersale.getOrderId(); + if(orderId == null){ + return ResponseUtil.badArgument(); + } + LitemallOrder order = orderService.findById(orderId); + if(order == null){ + return ResponseUtil.badArgumentValue(); + } + if(!order.getUserId().equals(userId)){ + return ResponseUtil.badArgumentValue(); + } + + if(!OrderUtil.isConfirmStatus(order) && !OrderUtil.isAutoConfirmStatus(order)){ + return ResponseUtil.fail(WxResponseCode.AFTERSALE_UNALLOWED, "不支持售后"); + } + BigDecimal amount = order.getActualPrice().subtract(order.getFreightPrice()); + if(aftersale.getAmount().compareTo(amount) > 0){ + return ResponseUtil.fail(WxResponseCode.AFTERSALE_INVALID_AMOUNT, "退款金额不正确"); + } + + if(aftersaleService.countByOrderIdWithoutReject(userId, orderId) > 0){ + return ResponseUtil.fail(WxResponseCode.AFTERSALE_UNALLOWED, "已申请售后"); + } + + aftersale.setStatus(AftersaleConstant.STATUS_REQUEST); + aftersale.setAftersaleSn(aftersaleService.generateAftersaleSn(userId)); + aftersale.setUserId(userId); + aftersaleService.add(aftersale); + + return ResponseUtil.ok(); + } + + private Object validate(LitemallAftersale aftersale) { + Short type = aftersale.getType(); + if (type == null) { + return ResponseUtil.badArgument(); + } + BigDecimal amount = aftersale.getAmount(); + if (amount == null) { + return ResponseUtil.badArgument(); + } + String reason = aftersale.getReason(); + if (StringUtils.isEmpty(reason)) { + return ResponseUtil.badArgument(); + } + return null; + } +} \ No newline at end of file diff --git a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java index c46d2c1a..92fa1d6a 100644 --- a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java +++ b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java @@ -27,9 +27,11 @@ public class WxOrderController { * 订单列表 * * @param userId 用户ID - * @param showType 订单信息 + * @param showType 显示类型,如果是0则是全部订单 * @param page 分页页数 * @param limit 分页大小 + * @param sort 排序字段 + * @param order 排序方式 * @return 订单列表 */ @GetMapping("list") diff --git a/litemall-wx/app.json b/litemall-wx/app.json index 7da09429..ae996af9 100644 --- a/litemall-wx/app.json +++ b/litemall-wx/app.json @@ -37,7 +37,10 @@ "pages/groupon/grouponDetail/grouponDetail", "pages/groupon/grouponList/grouponList", "pages/coupon/coupon", - "pages/help/help" + "pages/help/help", + "pages/ucenter/aftersale/aftersale", + "pages/ucenter/aftersaleList/aftersaleList", + "pages/ucenter/aftersaleDetail/aftersaleDetail" ], "window": { "navigationBarBackgroundColor": "#FFFFFF", @@ -87,6 +90,13 @@ }, "debug": true, "usingComponents": { + "van-cell": "./lib/vant-weapp/cell/index", + "van-cell-group": "./lib/vant-weapp/cell-group/index", + "van-picker": "./lib/vant-weapp/picker/index", + "van-popup": "./lib/vant-weapp/popup/index", + "van-field": "./lib/vant-weapp/field/index", + "van-uploader": "./lib/vant-weapp/uploader/index", + "van-button": "./lib/vant-weapp/button/index", "van-tag": "./lib/vant-weapp/tag/index", "van-icon": "./lib/vant-weapp/icon/index", "van-checkbox": "./lib/vant-weapp/checkbox/index", diff --git a/litemall-wx/config/api.js b/litemall-wx/config/api.js index 93002d12..35ae26a7 100644 --- a/litemall-wx/config/api.js +++ b/litemall-wx/config/api.js @@ -1,8 +1,8 @@ // 以下是业务服务器API地址 // 本机开发时使用 -var WxApiRoot = 'http://localhost:8080/wx/'; +// var WxApiRoot = 'http://localhost:8080/wx/'; // 局域网测试使用 -// var WxApiRoot = 'http://192.168.0.101:8080/wx/'; +var WxApiRoot = 'http://192.168.1.3:8080/wx/'; // 云平台部署时使用 // var WxApiRoot = 'http://122.51.199.160:8080/wx/'; // 云平台上线时使用 @@ -77,6 +77,10 @@ module.exports = { OrderGoods: WxApiRoot + 'order/goods', // 代评价商品信息 OrderComment: WxApiRoot + 'order/comment', // 评价订单商品信息 + AftersaleSubmit: WxApiRoot + 'aftersale/submit', // 提交售后申请 + AftersaleList: WxApiRoot + 'aftersale/list', // 售后列表 + AftersaleDetail: WxApiRoot + 'aftersale/detail', // 售后详情 + FeedbackAdd: WxApiRoot + 'feedback/submit', //添加反馈 FootprintList: WxApiRoot + 'footprint/list', //足迹列表 FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹 diff --git a/litemall-wx/pages/ucenter/aftersale/aftersale.js b/litemall-wx/pages/ucenter/aftersale/aftersale.js new file mode 100644 index 00000000..6f9eaa36 --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersale/aftersale.js @@ -0,0 +1,171 @@ +var util = require('../../../utils/util.js'); +var api = require('../../../config/api.js'); + +Page({ + data: { + orderId: 0, + orderInfo: {}, + orderGoods: [], + aftersale: { + pictures: [] + }, + columns: ['未收货退款', '不退货退款', '退货退款'], + contentLength: 0, + fileList: [] + }, + onLoad: function (options) { + // 页面初始化 options为页面跳转所带来的参数 + this.setData({ + orderId: options.id + }); + this.getOrderDetail(); + }, + getOrderDetail: function () { + wx.showLoading({ + title: '加载中', + }); + + setTimeout(function () { + wx.hideLoading() + }, 2000); + + let that = this; + util.request(api.OrderDetail, { + orderId: that.data.orderId + }).then(function (res) { + if (res.errno === 0) { + console.log(res.data); + that.setData({ + orderInfo: res.data.orderInfo, + orderGoods: res.data.orderGoods, + 'aftersale.orderId': that.data.orderId, + 'aftersale.amount': res.data.orderInfo.actualPrice - res.data.orderInfo.freightPrice + }); + } + + wx.hideLoading(); + }); + }, + deleteImage (event) { + const { fileList = [] } = this.data; + fileList.splice(event.detail.index, 1) + this.setData({ + fileList: fileList + }) + }, + afterRead(event) { + const { file } = event.detail + let that = this + const uploadTask = wx.uploadFile({ + url: api.StorageUpload, + filePath: file.path, + name: 'file', + success: function (res) { + var _res = JSON.parse(res.data); + if (_res.errno === 0) { + var url = _res.data.url + that.data.aftersale.pictures.push(url) + const { fileList = [] } = that.data; + fileList.push({ ...file, url: url }); + that.setData({ + fileList: fileList + }) + } + }, + fail: function (e) { + wx.showModal({ + title: '错误', + content: '上传失败', + showCancel: false + }) + }, + }) + }, + previewImage: function (e) { + wx.previewImage({ + current: e.currentTarget.id, // 当前显示图片的http链接 + urls: this.data.files // 需要预览的图片http链接列表 + }) + }, + contentInput: function (e) { + this.setData({ + contentLength: e.detail.cursor, + 'aftersale.comment': e.detail.value, + }); + }, + onReasonChange: function (e) { + this.setData({ + 'aftersale.reason': e.detail, + }); + }, + showTypePicker: function () { + this.setData({ + showPicker: true, + }); + }, + + onCancel: function () { + this.setData({ + showPicker: false, + }); + }, + onConfirm: function (event) { + this.setData({ + 'aftersale.type': event.detail.index, + 'aftersale.typeDesc': event.detail.value, + showPicker: false, + }); + }, + submit: function () { + let that = this; + if (that.data.aftersale.type == undefined) { + util.showErrorToast('请选择退款类型'); + return false; + } + + if (that.data.reason == '') { + util.showErrorToast('请输入退款原因'); + return false; + } + + wx.showLoading({ + title: '提交中...', + mask: true, + success: function () { + + } + }); + + util.request(api.AftersaleSubmit, that.data.aftersale, 'POST').then(function (res) { + wx.hideLoading(); + + if (res.errno === 0) { + wx.showToast({ + title: '申请售后成功', + icon: 'success', + duration: 2000, + complete: function () { + wx.switchTab({ + url: '/pages/ucenter/index/index' + }); + } + }); + } else { + util.showErrorToast(res.errmsg); + } + + }); + }, + onReady: function () { + // 页面渲染完成 + }, + onShow: function () { + // 页面显示 + }, + onHide: function () { + // 页面隐藏 + }, + onUnload: function () { + // 页面关闭 + } +}) \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersale/aftersale.json b/litemall-wx/pages/ucenter/aftersale/aftersale.json new file mode 100644 index 00000000..4cfefd01 --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersale/aftersale.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "售后" +} \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersale/aftersale.wxml b/litemall-wx/pages/ucenter/aftersale/aftersale.wxml new file mode 100644 index 00000000..20bb87bc --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersale/aftersale.wxml @@ -0,0 +1,45 @@ + + + + 退款商品 + + + + + + + + + {{item.goodsName}} + x{{item.number}} + + {{item.specifications}} + ¥{{item.price}} + + + + + + + + + + + + + + + + + + + + + + + 申请售后 + + + + + \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersale/aftersale.wxss b/litemall-wx/pages/ucenter/aftersale/aftersale.wxss new file mode 100644 index 00000000..2673c47c --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersale/aftersale.wxss @@ -0,0 +1,103 @@ +page { + height: 100%; + width: 100%; + background: #f4f4f4; +} + +.order-goods { + margin-top: 20rpx; + background: #fff; +} + +.order-goods .h { + height: 93.75rpx; + line-height: 93.75rpx; + margin-left: 31.25rpx; + border-bottom: 1px solid #f4f4f4; + padding-right: 31.25rpx; +} + +.order-goods .h .label { + float: left; + font-size: 30rpx; + color: #333; +} + +.order-goods .h .status { + float: right; + font-size: 30rpx; + color: #b4282d; +} + +.order-goods .item { + display: flex; + align-items: center; + height: 192rpx; + margin-left: 31.25rpx; + padding-right: 31.25rpx; + border-bottom: 1px solid #f4f4f4; +} + +.order-goods .item:last-child { + border-bottom: none; +} + +.order-goods .item .img { + height: 145.83rpx; + width: 145.83rpx; + background: #f4f4f4; +} + +.order-goods .item .img image { + height: 145.83rpx; + width: 145.83rpx; +} + +.order-goods .item .info { + flex: 1; + height: 145.83rpx; + margin-left: 20rpx; +} + +.order-goods .item .t { + margin-top: 8rpx; + height: 33rpx; + line-height: 33rpx; + margin-bottom: 10.5rpx; +} + +.order-goods .item .t .name { + display: block; + float: left; + height: 33rpx; + line-height: 33rpx; + color: #333; + font-size: 30rpx; +} + +.order-goods .item .t .number { + display: block; + float: right; + height: 33rpx; + text-align: right; + line-height: 33rpx; + color: #333; + font-size: 30rpx; +} + +.order-goods .item .attr { + height: 29rpx; + line-height: 29rpx; + color: #666; + margin-bottom: 25rpx; + font-size: 25rpx; +} + +.order-goods .item .price { + display: block; + float: left; + height: 30rpx; + line-height: 30rpx; + color: #333; + font-size: 30rpx; +} \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.js b/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.js new file mode 100644 index 00000000..c53484a5 --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.js @@ -0,0 +1,65 @@ +var util = require('../../../utils/util.js'); +var api = require('../../../config/api.js'); + +Page({ + data: { + aftersaleId: 0, + order: {}, + orderGoods: [], + aftersale: {}, + statusColumns: ['已申请', '处理中', '退款成功', '已拒绝'], + typeColumns: ['未收货退款', '不退货退款', '退货退款'], + fileList: [] + }, + onLoad: function (options) { + // 页面初始化 options为页面跳转所带来的参数 + this.setData({ + aftersaleId: options.id + }); + this.getAftersaleDetail(); + }, + getAftersaleDetail: function () { + wx.showLoading({ + title: '加载中', + }); + + setTimeout(function () { + wx.hideLoading() + }, 2000); + + let that = this; + util.request(api.AftersaleDetail, { + id: that.data.aftersaleId + }).then(function (res) { + if (res.errno === 0) { + let _fileList = [] + res.data.aftersale.pictures.forEach(function (v) { + _fileList.push({ + url: v + }) + }); + + that.setData({ + order: res.data.order, + orderGoods: res.data.orderGoods, + aftersale: res.data.aftersale, + fileList: _fileList + }); + } + + wx.hideLoading(); + }); + }, + onReady: function () { + // 页面渲染完成 + }, + onShow: function () { + // 页面显示 + }, + onHide: function () { + // 页面隐藏 + }, + onUnload: function () { + // 页面关闭 + } +}) \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.json b/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.json new file mode 100644 index 00000000..b339c88f --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "售后详情" +} \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.wxml b/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.wxml new file mode 100644 index 00000000..de4e2a8a --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.wxml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + 退款商品 + + + + + + + + + {{item.goodsName}} + x{{item.number}} + + {{item.specifications}} + ¥{{item.price}} + + + + + + + + + + + + \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.wxss b/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.wxss new file mode 100644 index 00000000..0a454a2b --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersaleDetail/aftersaleDetail.wxss @@ -0,0 +1,187 @@ +page { + height: 100%; + width: 100%; + background: #f4f4f4; +} + +.order-goods { + margin-top: 20rpx; + background: #fff; +} + +.order-goods .h { + height: 93.75rpx; + line-height: 93.75rpx; + margin-left: 31.25rpx; + border-bottom: 1px solid #f4f4f4; + padding-right: 31.25rpx; +} + +.order-goods .h .label { + float: left; + font-size: 30rpx; + color: #333; +} + +.order-goods .h .status { + float: right; + font-size: 30rpx; + color: #b4282d; +} + +.order-goods .item { + display: flex; + align-items: center; + height: 192rpx; + margin-left: 31.25rpx; + padding-right: 31.25rpx; + border-bottom: 1px solid #f4f4f4; +} + +.order-goods .item:last-child { + border-bottom: none; +} + +.order-goods .item .img { + height: 145.83rpx; + width: 145.83rpx; + background: #f4f4f4; +} + +.order-goods .item .img image { + height: 145.83rpx; + width: 145.83rpx; +} + +.order-goods .item .info { + flex: 1; + height: 145.83rpx; + margin-left: 20rpx; +} + +.order-goods .item .t { + margin-top: 8rpx; + height: 33rpx; + line-height: 33rpx; + margin-bottom: 10.5rpx; +} + +.order-goods .item .t .name { + display: block; + float: left; + height: 33rpx; + line-height: 33rpx; + color: #333; + font-size: 30rpx; +} + +.order-goods .item .t .number { + display: block; + float: right; + height: 33rpx; + text-align: right; + line-height: 33rpx; + color: #333; + font-size: 30rpx; +} + +.order-goods .item .attr { + height: 29rpx; + line-height: 29rpx; + color: #666; + margin-bottom: 25rpx; + font-size: 25rpx; +} + +.order-goods .item .price { + display: block; + float: left; + height: 30rpx; + line-height: 30rpx; + color: #333; + font-size: 30rpx; +} + + +.fb-body { + width: 100%; + background: #fff; + height: 300rpx; + padding: 30rpx; +} + +.fb-body .content { + width: 100%; + height: 200rpx; + color: #333; +} + +.weui-uploader__files { + width: 100%; +} + +.weui-uploader__file { + float: left; + margin-right: 9px; + margin-bottom: 9px; +} + +.weui-uploader__img { + display: block; + width: 30px; + height: 30px; +} + +.weui-uploader__input-box { + float: left; + position: relative; + margin-right: 9px; + margin-bottom: 9px; + width: 30px; + height: 30px; + border: 1px solid #d9d9d9; +} + +.weui-uploader__input-box:after, .weui-uploader__input-box:before { + content: " "; + position: absolute; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + background-color: #d9d9d9; +} + +.weui-uploader__input-box:before { + width: 2px; + height: 30px; +} + +.weui-uploader__input-box:after { + width: 30px; + height: 2px; +} + +.weui-uploader__input-box:active { + border-color: #999; +} + +.weui-uploader__input-box:active:after, .weui-uploader__input-box:active:before { + background-color: #999; +} + +.weui-uploader__input { + position: absolute; + z-index: 1; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; +} +.fb-body .text-count { + float: right; + color: #666; + font-size: 24rpx; + line-height: 30rpx; +} \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.js b/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.js new file mode 100644 index 00000000..bbc8607c --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.js @@ -0,0 +1,69 @@ +var util = require('../../../utils/util.js'); +var api = require('../../../config/api.js'); + +Page({ + data: { + aftersaleList: [], + showType: 0, + page: 1, + limit: 10, + totalPages: 1 + }, + onLoad: function (options) { + }, + getAftersaleList() { + let that = this; + util.request(api.AftersaleList, { + status: that.data.showType, + page: that.data.page, + limit: that.data.limit + }).then(function (res) { + if (res.errno === 0) { + console.log(res.data); + that.setData({ + aftersaleList: that.data.aftersaleList.concat(res.data.list), + totalPages: res.data.pages + }); + } + }); + }, + onReachBottom() { + if (this.data.totalPages > this.data.page) { + this.setData({ + page: this.data.page + 1 + }); + this.getAftersaleList(); + } else { + wx.showToast({ + title: '没有更多售后了', + icon: 'none', + duration: 2000 + }); + return false; + } + }, + switchTab: function (event) { + let showType = event.currentTarget.dataset.index; + this.setData({ + aftersaleList: [], + showType: showType, + page: 1, + limit: 10, + totalPages: 1 + }); + this.getAftersaleList(); + }, + onReady: function () { + // 页面渲染完成 + }, + onShow: function () { + // 页面显示 + this.getAftersaleList(); + }, + onHide: function () { + // 页面隐藏 + }, + onUnload: function () { + // 页面关闭 + } +}) \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.json b/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.json new file mode 100644 index 00000000..3cd39d6a --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "我的售后" +} \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.wxml b/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.wxml new file mode 100644 index 00000000..1d9d300c --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.wxml @@ -0,0 +1,42 @@ + + + + 申请中 + + + 处理中 + + + 已完成 + + + 已拒绝 + + + + + 还没有呢 + + + + + + + 服务编号:{{item.aftersale.aftersaleSn}} + + + + + + + {{gitem.goodsName}} + {{gitem.number}}件商品 + + + + + 申请退款金额:¥{{item.aftersale.amount}}元 + + + + \ No newline at end of file diff --git a/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.wxss b/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.wxss new file mode 100644 index 00000000..1888ed82 --- /dev/null +++ b/litemall-wx/pages/ucenter/aftersaleList/aftersaleList.wxss @@ -0,0 +1,165 @@ +page { + height: 100%; + width: 100%; + background: #f4f4f4; +} + +.aftersales-switch { + width: 100%; + background: #fff; + height: 84rpx; +} + +.aftersales-switch .item { + display: inline-block; + height: 82rpx; + width: 18%; + padding: 0 15rpx; + text-align: center; +} + +.aftersales-switch .item .txt { + display: inline-block; + height: 82rpx; + padding: 0 20rpx; + line-height: 82rpx; + color: #9a9ba1; + font-size: 30rpx; + width: 170rpx; +} + +.aftersales-switch .item.active .txt { + color: #ab956d; + border-bottom: 4rpx solid #ab956d; +} + +.no-aftersale { + width: 100%; + height: auto; + margin: 0 auto; +} + +.no-aftersale .c { + width: 100%; + height: auto; + margin-top: 400rpx; +} + +.no-aftersale .c text { + margin: 0 auto; + display: block; + width: 258rpx; + height: 29rpx; + line-height: 29rpx; + text-align: center; + font-size: 29rpx; + color: #999; +} + +.aftersales { + height: auto; + width: 100%; + overflow: hidden; +} + +.aftersale { + margin-top: 20rpx; + background: #fff; +} + +.aftersale .h { + height: 83.3rpx; + line-height: 83.3rpx; + margin-left: 31.25rpx; + padding-right: 31.25rpx; + border-bottom: 1px solid #f4f4f4; + font-size: 30rpx; + color: #333; +} + +.aftersale .h .l { + float: left; +} + +.aftersale .h .r { + float: right; + color: #b4282d; + font-size: 24rpx; +} + +.aftersale .goods { + display: flex; + align-items: center; + height: 199rpx; + margin-left: 31.25rpx; +} + +.aftersale .goods .img { + height: 145.83rpx; + width: 145.83rpx; + background: #f4f4f4; +} + +.aftersale .goods .img image { + height: 145.83rpx; + width: 145.83rpx; +} + +.aftersale .goods .info { + height: 145.83rpx; + flex: 1; + padding-left: 20rpx; +} + +.aftersale .goods .name { + margin-top: 30rpx; + display: block; + height: 44rpx; + line-height: 44rpx; + color: #333; + font-size: 30rpx; +} + +.aftersale .goods .number { + display: block; + height: 37rpx; + line-height: 37rpx; + color: #666; + font-size: 25rpx; +} + +.aftersale .goods .status { + width: 105rpx; + color: #b4282d; + font-size: 25rpx; +} + +.aftersale .b { + height: 103rpx; + line-height: 103rpx; + margin-left: 31.25rpx; + padding-right: 31.25rpx; + border-top: 1px solid #f4f4f4; + font-size: 30rpx; + color: #333; +} + +.aftersale .b .l { + float: left; +} + +.aftersale .b .r { + float: right; +} + +.aftersale .b .btn { + margin-top: 19rpx; + height: 64.5rpx; + line-height: 64.5rpx; + text-align: center; + padding: 0 20rpx; + border-radius: 5rpx; + font-size: 28rpx; + color: #fff; + background: #b4282d; +} diff --git a/litemall-wx/pages/ucenter/index/index.js b/litemall-wx/pages/ucenter/index/index.js index dd20700e..cc48dd7a 100644 --- a/litemall-wx/pages/ucenter/index/index.js +++ b/litemall-wx/pages/ucenter/index/index.js @@ -190,11 +190,15 @@ Page({ }); }, goAfterSale: function() { - wx.showToast({ - title: '目前不支持', - icon: 'none', - duration: 2000 - }); + if (this.data.hasLogin) { + wx.navigateTo({ + url: "/pages/ucenter/aftersaleList/aftersaleList" + }); + } else { + wx.navigateTo({ + url: "/pages/auth/login/login" + }); + }; }, aboutUs: function() { wx.navigateTo({ diff --git a/litemall-wx/pages/ucenter/orderDetail/orderDetail.js b/litemall-wx/pages/ucenter/orderDetail/orderDetail.js index acb3964b..0a18ba27 100644 --- a/litemall-wx/pages/ucenter/orderDetail/orderDetail.js +++ b/litemall-wx/pages/ucenter/orderDetail/orderDetail.js @@ -190,6 +190,10 @@ Page({ } }); }, + // “申请售后”点击效果 + aftersaleOrder: function () { + util.redirect('/pages/ucenter/aftersale/aftersale?id=' + this.data.orderId ); + }, onReady: function() { // 页面渲染完成 }, diff --git a/litemall-wx/pages/ucenter/orderDetail/orderDetail.wxml b/litemall-wx/pages/ucenter/orderDetail/orderDetail.wxml index 63839693..f8c04c93 100644 --- a/litemall-wx/pages/ucenter/orderDetail/orderDetail.wxml +++ b/litemall-wx/pages/ucenter/orderDetail/orderDetail.wxml @@ -13,6 +13,7 @@ 确认收货 删除订单 申请退款 + 申请售后 diff --git a/litemall-wx/pages/ucenter/orderDetail/orderDetail.wxss b/litemall-wx/pages/ucenter/orderDetail/orderDetail.wxss index 90aabcd9..766515a5 100644 --- a/litemall-wx/pages/ucenter/orderDetail/orderDetail.wxss +++ b/litemall-wx/pages/ucenter/orderDetail/orderDetail.wxss @@ -186,6 +186,7 @@ page { .order-bottom .address { height: 128rpx; padding-top: 25rpx; + border-top: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4; } diff --git a/litemall-wx/project.config.json b/litemall-wx/project.config.json index 2187f063..67d3b527 100644 --- a/litemall-wx/project.config.json +++ b/litemall-wx/project.config.json @@ -6,7 +6,18 @@ "postcss": true, "minified": true, "newFeature": true, - "uglifyFileName": true + "coverView": true, + "autoAudits": false, + "uglifyFileName": true, + "checkInvalidKey": true, + "checkSiteMap": true, + "uploadWithSourceMap": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "nodeModules": true }, "compileType": "miniprogram", "libVersion": "2.4.0", @@ -30,6 +41,10 @@ "game": { "list": [] }, + "gamePlugin": { + "current": -1, + "list": [] + }, "miniprogram": { "current": 22, "list": [ @@ -274,6 +289,27 @@ "pathName": "pages/groupon/myGroupon/myGroupon", "query": "", "scene": null + }, + { + "id": -1, + "name": "申请售后", + "pathName": "pages/ucenter/aftersale/aftersale", + "query": "id=2", + "scene": null + }, + { + "id": -1, + "name": "售后列表", + "pathName": "pages/ucenter/aftersaleList/aftersaleList", + "query": "", + "scene": null + }, + { + "id": -1, + "name": "售后详情", + "pathName": "pages/ucenter/aftersaleDetail/aftersaleDetail", + "query": "id=1", + "scene": null } ] }