diff --git a/api/interfaces/refund.js b/api/interfaces/refund.js index 142e0a9..928e63b 100644 --- a/api/interfaces/refund.js +++ b/api/interfaces/refund.js @@ -40,11 +40,24 @@ const submitRefund = (id, data) => req({ data }) +// 取消退货 +const refundsCancel = id => req({ + url : "mall/refunds/" + id + "/cancel", + method : "POST", +}) + +// 退货前置 +const deliverInit = id => req({ + url : "mall/refunds/" + id + "/deliver_init" +}) + export default ({ list, deliver, info, log, refundPreposition, - submitRefund + submitRefund, + refundsCancel, + deliverInit }) \ No newline at end of file diff --git a/app.json b/app.json index caef518..608732b 100644 --- a/app.json +++ b/app.json @@ -34,7 +34,10 @@ "pages/pay/success/success", "pages/resetPassword/resetPassword", "pages/refund/refund", - "pages/refund/aftersale/aftersale" + "pages/refund/aftersale/aftersale", + "pages/refund/info/info", + "pages/refund/deliver/deliver", + "pages/refund/logs/logs" ], "window": { "backgroundTextStyle": "light", @@ -67,6 +70,9 @@ "selectedColor": "#da2b54", "borderStyle": "white" }, + "requiredPrivateInfos": [ + "chooseAddress" + ], "style": "v2", "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/pages/refund/deliver/deliver.js b/pages/refund/deliver/deliver.js new file mode 100644 index 0000000..82babe3 --- /dev/null +++ b/pages/refund/deliver/deliver.js @@ -0,0 +1,76 @@ +Page({ + + /** + * 页面的初始数据 + */ + data: { + refund : '', + address : '', + mobile : '', + username: '', + text : '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + refund: options.no + }) + wx.showLoading({ + title: '加载中...', + mask : true + }) + wx.$api.refund.deliverInit(options.no).then(res => { + let { address, mobile, username } = res.data; + this.setData({ + address, + mobile, + username, + text: '收件人:' + username + '\n手机号码:'+ mobile + '\n收货地址:' + address + }) + wx.hideLoading() + }) + }, + /** + * 复制地址 + */ + onCopyAddress(){ + wx.setClipboardData({ + data: this.data.text + }) + }, + /** + * 提交退货地址 + */ + onSubmit(e){ + let { number } = e.detail.value + if(number == ''){ + wx.showToast({ + title: '请输入快递单号', + icon : 'none', + mask : true + }) + return + } + wx.showLoading({ + title: '提交中...', + mask : true + }) + wx.$api.refund.deliver(this.data.refund, { number }).then(res => { + wx.showModal({ + title : '提示', + content : res.data, + showCancel : false, + confirmColor: '#da2b54', + success : modalRes => { + if(modalRes.confirm){ + wx.navigateBack() + } + } + }) + wx.hideLoading() + }).catch(err => {}) + } +}) \ No newline at end of file diff --git a/pages/refund/deliver/deliver.json b/pages/refund/deliver/deliver.json new file mode 100644 index 0000000..79e4e42 --- /dev/null +++ b/pages/refund/deliver/deliver.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "退货" +} \ No newline at end of file diff --git a/pages/refund/deliver/deliver.wxml b/pages/refund/deliver/deliver.wxml new file mode 100644 index 0000000..0af4c6a --- /dev/null +++ b/pages/refund/deliver/deliver.wxml @@ -0,0 +1,27 @@ + + + + + 寄回地址 + + + {{username}}{{mobile}} + + + + {{address}} + + 复制地址 + + + + 邮寄信息 +
+ + + + + +
+
+
diff --git a/pages/refund/deliver/deliver.wxss b/pages/refund/deliver/deliver.wxss new file mode 100644 index 0000000..f4e9762 --- /dev/null +++ b/pages/refund/deliver/deliver.wxss @@ -0,0 +1,16 @@ + +/* 退货 */ +.deliver{ background: #f7f8f9; min-height: 100vh; padding: 30rpx; box-sizing: border-box; } +.deliver-address{ background: white; border-radius: 20rpx; margin-bottom: 30rpx; padding: 30rpx; } +.deliver-address-title{ font-weight: bold; padding-bottom: 20rpx; font-size: 30rpx; } +.deliver-address-flex{ display: flex; align-items: flex-start; padding: 8rpx 0; font-size: 28rpx; color: #333; } +.deliver-address-flex label{ width: 170rpx; color: gray; } +.deliver-address-val{ width: calc(100% - 170rpx); } +.deliver-address-val text{ margin-right: 10rpx; } +.deliver-address-copy{ margin-top: 20rpx; color: #da2b54; text-align: center; border-top: solid 1rpx #f7f8f9; padding-top: 20rpx; } + +/* 邮寄信息 */ +.deliver-address-input{ display: flex; align-items: center; height: 90rpx; line-height: 90rpx; background: #f7f8f9; border-radius: 20rpx; margin-bottom: 20rpx; padding: 0 30rpx; } +.deliver-address-input label{ width: 170rpx; color: #333; } +.deliver-address-input input{ width: calc(100% - 170rpx); box-sizing: border-box; } +.deliver-address-btn[size="default"]{ width: 100%; height: 90rpx; line-height: 90rpx; border-radius: 45rpx; padding: 0; font-size: 32rpx; background: #da2b54; color: white; margin-top: 40rpx; } diff --git a/pages/refund/info/info.js b/pages/refund/info/info.js new file mode 100644 index 0000000..f932b3f --- /dev/null +++ b/pages/refund/info/info.js @@ -0,0 +1,44 @@ +Page({ + + /** + * 页面的初始数据 + */ + data: { + state : null, + refund_total: '0.00', + refund_no : null, + source : null, + title : null, + created_at : '', + items : [] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.onInfo(options.no) + }, + /** + * 获取服务单详情 + */ + onInfo(no){ + wx.showLoading({ + title: '加载中...', + mask : true + }) + wx.$api.refund.info(no).then(res => { + let { state, refund_total, refund_no, source, title, created_at, items } = res.data; + this.setData({ + state, + refund_total, + refund_no, + source, + title, + created_at, + items + }) + wx.hideLoading() + }).catch(err => {}) + } +}) \ No newline at end of file diff --git a/pages/refund/info/info.json b/pages/refund/info/info.json new file mode 100644 index 0000000..d50ec0d --- /dev/null +++ b/pages/refund/info/info.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "服务单详情" +} \ No newline at end of file diff --git a/pages/refund/info/info.wxml b/pages/refund/info/info.wxml new file mode 100644 index 0000000..caa271d --- /dev/null +++ b/pages/refund/info/info.wxml @@ -0,0 +1,62 @@ + + + + + + 本次售后服务将由 绚火健康 为您提供服务 + + + + {{state.text}} + {{state.remark}} + + 售后记录 + + + + + 退款金额 + + 原路退款(1-3个工作日到账) + ¥{{refund_total}} + + + + + + + + + {{item.goods_name}} + 数量:{{item.qty}} + + + + + + + {{source.no}} + + + + {{refund_no}} + + + + {{created_at}} + + + + 退款 + + + + {{title}} + + + + 原路退款 + + + + diff --git a/pages/refund/info/info.wxss b/pages/refund/info/info.wxss new file mode 100644 index 0000000..98ee995 --- /dev/null +++ b/pages/refund/info/info.wxss @@ -0,0 +1,37 @@ + +.content{ background: #f7f8f9; min-height: 100vh; padding: 30rpx; box-sizing: border-box; } + +/* 售后服务提醒 */ +.service-content { display: flex; flex-direction: row; align-items: center; justify-content: center; } +.service { font-size: 24rpx; padding: 4rpx 20rpx; border-radius: 30rpx; background-color: #f9f9f9; display: inline-block; text-align: center; color: #666; } +.service text{ color: #da2b54; } + +/* 服务单详情 */ +.service-status{ background: white; padding: 50rpx; margin-top: 30rpx; border-radius: 20rpx; } +.service-status-text{ font-weight: bold; text-align: center; font-size: 34rpx; color: #da2b54; } +.service-status-remark{ font-size: 28rpx; color: gray; margin-top: 10rpx; line-height: 40rpx; text-align: center; } +.service-status-btn{ text-align: center; margin-top: 30rpx; text-align: center; } +.service-status-btn navigator{ line-height: 60rpx; background: #da2b54; color: white; width: 200rpx; border-radius: 30rpx; display: inline-block; font-size: 28rpx; } + +/* 退款金额 */ +.service-price{ background: white; padding: 30rpx; border-radius: 20rpx; margin-top: 30rpx; } +.service-price-title{ font-weight: bold; font-size: 30rpx; color: #333; padding-bottom: 10rpx; } +.service-price-flex{ display: flex; justify-content: space-between; font-size: 28rpx; color: gray; line-height: 50rpx; } +.service-price-refund{ width: calc(100% - 200rpx); } +.service-price-val{ font-weight: bold; width: 200rpx; text-align: right; } + +/* 订单产品 */ +.service-goods-flex{ display: flex; align-items: center; justify-content: space-between; } +.service-goods-cover{ width: 128rpx; height: 128rpx; border-radius: 10rpx; } +.service-goods-text{ width: calc(100% - 128rpx); padding-left: 30rpx; box-sizing: border-box; } +.service-goods-title{ font-size: 30rpx; margin-bottom: 10rpx; } +.service-goods-num{ font-size: 28rpx; color: gray; } + +/* 订单信息 */ +.service-card{ background: white; padding: 30rpx; margin-top: 30rpx; border-radius: 20rpx; } +.service-goods{ padding-bottom: 30rpx; } +.service-flexs{ border-top: solid 1rpx #f7f8f9; padding-top: 30rpx; } +.service-flexs-item{ display: flex; align-items: center; justify-content: space-between; font-size: 28rpx; padding: 10rpx 0; line-height: 40rpx; } +.service-flexs-item label{ width: 180rpx; color: gray; } +.service-flexs-val{ width: calc(100% - 180rpx); text-align: right; } + diff --git a/pages/refund/logs/logs.js b/pages/refund/logs/logs.js new file mode 100644 index 0000000..6c24e1a --- /dev/null +++ b/pages/refund/logs/logs.js @@ -0,0 +1,32 @@ +Page({ + + /** + * 页面的初始数据 + */ + data: { + logs: [], + id : '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + id: options.id + }) + this.getLogs() + }, + /** + * 获取列表 + */ + getLogs(){ + wx.$api.refund.log(this.data.id).then(res => { + console.log(res) + let { data } = res; + this.setData({ + logs: data + }) + }) + } +}) \ No newline at end of file diff --git a/pages/refund/logs/logs.json b/pages/refund/logs/logs.json new file mode 100644 index 0000000..076a7d7 --- /dev/null +++ b/pages/refund/logs/logs.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "售后记录" +} \ No newline at end of file diff --git a/pages/refund/logs/logs.wxml b/pages/refund/logs/logs.wxml new file mode 100644 index 0000000..3710e13 --- /dev/null +++ b/pages/refund/logs/logs.wxml @@ -0,0 +1,10 @@ + + + + + {{item.state_text}} + {{item.created_at}} + + {{item.remark || item.title}} + + diff --git a/pages/refund/logs/logs.wxss b/pages/refund/logs/logs.wxss new file mode 100644 index 0000000..7426c04 --- /dev/null +++ b/pages/refund/logs/logs.wxss @@ -0,0 +1,7 @@ + +.logs{ background: #f7f8f9; min-height: 100vh; padding: 10rpx 30rpx 30rpx; box-sizing: border-box; } +.logs-item{ background: white; border-radius: 20rpx; padding: 25rpx 30rpx; margin-top: 20rpx; } +.logs-flex{ display: flex; align-items: center; justify-content: space-between; } +.logs-title{ font-weight: bold; font-size: 28rpx; line-height: 40rpx; } +.logs-time{ font-size: 26rpx; color: gray; line-height: 40rpx; } +.logs-text{ font-size: 28rpx; padding-top: 10rpx; color: gray; } diff --git a/pages/refund/refund.js b/pages/refund/refund.js index 59505a0..68b3740 100644 --- a/pages/refund/refund.js +++ b/pages/refund/refund.js @@ -13,6 +13,10 @@ Page({ * 生命周期函数--监听页面显示 */ onShow() { + this.setData({ + listsArr: [], + page : { current: 1 } + }) this.getList() }, /** @@ -27,9 +31,6 @@ Page({ page : this.data.page.current }).then(res => { let { data, page } = res.data - - console.log(data) - this.setData({ listsArr : page.current == 1 ? data : this.data.listsArr.concat(data), page : res.data.page, @@ -40,11 +41,57 @@ Page({ }) }, /** - * 申请售后 + * 寄回商品 */ - onAftersale(){ + onDeliver(e){ + let { no } = e.currentTarget.dataset wx.navigateTo({ - url: './aftersale/aftersale', + url: "./deliver/deliver?no=" + no, }) + }, + /** + * 取消售后 + */ + onCancel(e){ + let { no } = e.currentTarget.dataset + let index = this.data.listsArr.findIndex(val => val.refund_no == no ) + let atArr = this.data.listsArr + wx.showLoading({ + title: '加载中...', + mask : true + }) + wx.$api.refund.refundsCancel(no).then(res => { + wx.showToast({ + title: res.data, + icon : 'none' + }) + atArr.splice(index, 1) + this.setData({ + listsArr: atArr + }) + }).catch(err => { }) + }, + /** + * 售后信息 + */ + onInfo(e){ + let { no } = e.currentTarget.dataset + wx.navigateTo({ + url: "./info/info?no=" + no, + }) + }, + /** + * 上拉加载 + */ + onReachBottom(){ + this.setData({ + lodingStats: true + }) + let page = this.data.page + if(page.has_more){ + page.current += 1 + this.setData({ page }) + this.getList() + } } }) \ No newline at end of file diff --git a/pages/refund/refund.wxml b/pages/refund/refund.wxml index 901ab80..55bff58 100644 --- a/pages/refund/refund.wxml +++ b/pages/refund/refund.wxml @@ -11,14 +11,15 @@ - {{item.state.text}} + {{item.state.remark}} - 售后详情 + 取消售后 + 售后详情 + 寄回商品 - 加载中... diff --git a/pages/refund/refund.wxss b/pages/refund/refund.wxss index e687e5f..e56d48c 100644 --- a/pages/refund/refund.wxss +++ b/pages/refund/refund.wxss @@ -13,11 +13,12 @@ /* 订单状态 */ .order-state { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; box-sizing: border-box; font-size: 26rpx; background: #f7f8f9; margin: 30rpx 0; padding: 20rpx; border-radius: 10rpx; } -.order-des { padding-left: 20rpx; color: #777; } +.order-state label{ width: 180rpx; } +.order-des { padding-left: 20rpx; color: #777; width: calc(100% - 180rpx); } /* 订单操作 */ .order-btns { border-top: solid 1rpx #f9f9f9; display: flex; justify-content: flex-end; padding-top: 20rpx; } -.order-btns .item{ font-size: 28rpx; margin-left: 20rpx; color: #da2b54; line-height: 60rpx; border: solid 1rpx #da2b54; padding: 0 30rpx; border-radius: 30rpx; } +.order-btns .item{ font-size: 26rpx; margin-left: 20rpx; color: #da2b54; line-height: 56rpx; border: solid 1rpx #da2b54; padding: 0 20rpx; border-radius: 28rpx; } /* 售后服务 */ .pages-hint{ padding-bottom: 10vh; }