新增退货流程

This commit is contained in:
唐明明
2023-08-29 13:53:48 +08:00
parent 308aeeafb5
commit 510cbeb181
17 changed files with 404 additions and 13 deletions

View File

@@ -40,11 +40,24 @@ const submitRefund = (id, data) => req({
data data
}) })
// 取消退货
const refundsCancel = id => req({
url : "mall/refunds/" + id + "/cancel",
method : "POST",
})
// 退货前置
const deliverInit = id => req({
url : "mall/refunds/" + id + "/deliver_init"
})
export default ({ export default ({
list, list,
deliver, deliver,
info, info,
log, log,
refundPreposition, refundPreposition,
submitRefund submitRefund,
refundsCancel,
deliverInit
}) })

View File

@@ -34,7 +34,10 @@
"pages/pay/success/success", "pages/pay/success/success",
"pages/resetPassword/resetPassword", "pages/resetPassword/resetPassword",
"pages/refund/refund", "pages/refund/refund",
"pages/refund/aftersale/aftersale" "pages/refund/aftersale/aftersale",
"pages/refund/info/info",
"pages/refund/deliver/deliver",
"pages/refund/logs/logs"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
@@ -67,6 +70,9 @@
"selectedColor": "#da2b54", "selectedColor": "#da2b54",
"borderStyle": "white" "borderStyle": "white"
}, },
"requiredPrivateInfos": [
"chooseAddress"
],
"style": "v2", "style": "v2",
"sitemapLocation": "sitemap.json" "sitemapLocation": "sitemap.json"
} }

View File

@@ -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 => {})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "退货"
}

View File

@@ -0,0 +1,27 @@
<view class="deliver">
<!-- 寄回地址 -->
<view class="deliver-address">
<view class="deliver-address-title">寄回地址</view>
<view class="deliver-address-flex">
<label>收件人</label>
<view class="deliver-address-val"><text>{{username}}</text>{{mobile}}</view>
</view>
<view class="deliver-address-flex">
<label>收件地址</label>
<view class="deliver-address-val">{{address}}</view>
</view>
<view class="deliver-address-copy" bind:tap="onCopyAddress">复制地址</view>
</view>
<!-- 寄回信息 -->
<view class="deliver-address">
<view class="deliver-address-title">邮寄信息</view>
<form class="deliver-address-form" bindsubmit="onSubmit">
<view class="deliver-address-input">
<label>物流单号</label>
<input name="number" placeholder="输入物流单号" type="number" />
</view>
<button class="deliver-address-btn" size="default" form-type="submit">提交退货</button>
</form>
</view>
</view>

View File

@@ -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; }

44
pages/refund/info/info.js Normal file
View File

@@ -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 => {})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "服务单详情"
}

View File

@@ -0,0 +1,62 @@
<view class="content">
<!-- 服务提醒 -->
<view class="service-content">
<view class="service"> 本次售后服务将由<text> 绚火健康 </text>为您提供服务 </view>
</view>
<!-- 服务单状态 -->
<view class="service-status" wx:if="{{state != null}}">
<view class="service-status-text">{{state.text}}</view>
<view class="service-status-remark">{{state.remark}}</view>
<view class="service-status-btn">
<navigator url="../logs/logs?id={{refund_no}}">售后记录</navigator>
</view>
</view>
<!-- 退款金额 -->
<view class="service-price">
<view class="service-price-title">退款金额</view>
<view class="service-price-flex">
<view class="service-price-refund">原路退款1-3个工作日到账</view>
<view class="service-price-val">¥{{refund_total}}</view>
</view>
</view>
<!-- 订单信息 -->
<view class="service-card" wx:if="{{items.length > 0}}">
<view class="service-goods">
<view class="service-goods-flex" wx:for="{{items}}" wx:key="index">
<image class="service-goods-cover" src="{{item.cover}}" mode="aspectFill"></image>
<view class="service-goods-text">
<view class="service-goods-title">{{item.goods_name}}</view>
<view class="service-goods-num">数量:{{item.qty}}</view>
</view>
</view>
</view>
<view class="service-flexs">
<view class="service-flexs-item">
<label>订单编号</label>
<view class="service-flexs-val">{{source.no}}</view>
</view>
<view class="service-flexs-item">
<label>服务单号</label>
<view class="service-flexs-val">{{refund_no}}</view>
</view>
<view class="service-flexs-item">
<label>申请时间</label>
<view class="service-flexs-val">{{created_at}}</view>
</view>
<view class="service-flexs-item">
<label>服务类型</label>
<view class="service-flexs-val">退款</view>
</view>
<view class="service-flexs-item">
<label>申请原因</label>
<view class="service-flexs-val">{{title}}</view>
</view>
<view class="service-flexs-item">
<label>退款方式</label>
<view class="service-flexs-val">原路退款</view>
</view>
</view>
</view>
</view>

View File

@@ -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; }

32
pages/refund/logs/logs.js Normal file
View File

@@ -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
})
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "售后记录"
}

View File

@@ -0,0 +1,10 @@
<view class="logs">
<view class="logs-item" wx:for="{{logs}}" wx:key="index">
<view class="logs-flex">
<view class="logs-title">{{item.state_text}}</view>
<view class="logs-time">{{item.created_at}}</view>
</view>
<view class="logs-text">{{item.remark || item.title}}</view>
</view>
</view>

View File

@@ -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; }

View File

@@ -13,6 +13,10 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
this.setData({
listsArr: [],
page : { current: 1 }
})
this.getList() this.getList()
}, },
/** /**
@@ -27,9 +31,6 @@ Page({
page : this.data.page.current page : this.data.page.current
}).then(res => { }).then(res => {
let { data, page } = res.data let { data, page } = res.data
console.log(data)
this.setData({ this.setData({
listsArr : page.current == 1 ? data : this.data.listsArr.concat(data), listsArr : page.current == 1 ? data : this.data.listsArr.concat(data),
page : res.data.page, page : res.data.page,
@@ -40,11 +41,57 @@ Page({
}) })
}, },
/** /**
* 申请售后 * 寄回商品
*/ */
onAftersale(){ onDeliver(e){
let { no } = e.currentTarget.dataset
wx.navigateTo({ 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()
}
} }
}) })

View File

@@ -11,14 +11,15 @@
</view> </view>
</view> </view>
<view class="order-state"> <view class="order-state">
{{item.state.text}} <label>{{item.state.text}}</label>
<view class="order-des">{{item.state.remark}}</view> <view class="order-des">{{item.state.remark}}</view>
</view> </view>
<view class="order-btns"> <view class="order-btns">
<view class="item item-cancle" bind:tap="onAftersale">售后详情</view> <view class="item item-cancel" wx:if="{{item.can.user_cancel}}" bind:tap="onCancel" data-no="{{item.refund_no}}">取消售后</view>
<view class="item item-ok" bind:tap="onInfo" data-no="{{item.refund_no}}">售后详情</view>
<view class="item item-ok" wx:if="{{item.can.user_deliver}}" bind:tap="onDeliver" data-no="{{item.refund_no}}">寄回商品</view>
</view> </view>
</view> </view>
<view class="pagesLoding" wx:if="{{lodingStats}}"> <view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}"> <block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中... <image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...

View File

@@ -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-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 { 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; } .pages-hint{ padding-bottom: 10vh; }