新增退货流程

This commit is contained in:
唐明明
2023-08-28 17:51:33 +08:00
parent d9f7a0e1ef
commit 308aeeafb5
24 changed files with 380 additions and 21 deletions

View File

@@ -33,6 +33,9 @@ import idcard from "./interfaces/idcard"
// 身份认证 // 身份认证
import withdraw from "./interfaces/withdraw" import withdraw from "./interfaces/withdraw"
// 售后服务
import refund from "./interfaces/refund"
export default { export default {
auth, auth,
bank, bank,
@@ -43,5 +46,6 @@ export default {
user, user,
pay, pay,
idcard, idcard,
withdraw withdraw,
refund
} }

50
api/interfaces/refund.js Normal file
View File

@@ -0,0 +1,50 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
// 售后服务
const list = data => req({
url : "mall/refunds",
data
})
// 用户退货
const deliver = (refund, data) => req({
url: "mall/refunds/" + refund + "/deliver",
method: "POST",
data
})
// 退货详情
const info = refund => req({
url: "mall/refunds/" + refund
})
// 退货日志
const log = refund => req({
url: "mall/refunds/" + refund + "/logs"
})
// 申请售后前置
const refundPreposition = id => req({
url: "mall/orders/" + id + "/refund"
})
// 提交退货
const submitRefund = (id, data) => req({
url : "mall/orders/" + id + "/refund",
method : "POST",
data
})
export default ({
list,
deliver,
info,
log,
refundPreposition,
submitRefund
})

View File

@@ -32,7 +32,9 @@
"pages/idcard/eSign/eSign", "pages/idcard/eSign/eSign",
"pages/withdraw/withdraw", "pages/withdraw/withdraw",
"pages/pay/success/success", "pages/pay/success/success",
"pages/resetPassword/resetPassword" "pages/resetPassword/resetPassword",
"pages/refund/refund",
"pages/refund/aftersale/aftersale"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",

View File

@@ -44,6 +44,7 @@ Page({
created_at : data.created_at, created_at : data.created_at,
verified : data.verified, verified : data.verified,
need_sign : data.need_sign, need_sign : data.need_sign,
address : data.address
} }
}) })
} }
@@ -84,9 +85,9 @@ Page({
back_card : this.data.back.path, back_card : this.data.back.path,
address address
}).then(res => { }).then(res => {
let { name, id_card, created_at, verified, need_sign } = res.data let { name, id_card, created_at, verified, need_sign, address } = res.data
this.setData({ this.setData({
info : { name, id_card, created_at, verified, need_sign }, info : { name, id_card, created_at, verified, need_sign, address },
procedure : need_sign ? 2 : 3, procedure : need_sign ? 2 : 3,
isSignContract : data.is_sign_contract, isSignContract : data.is_sign_contract,
}) })

View File

@@ -72,6 +72,9 @@ Page({
qty : this.data.goodsQty, qty : this.data.goodsQty,
address_id : this.data.addressId address_id : this.data.addressId
}).then(res => { }).then(res => {
console.log(res)
wx.redirectTo({ wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data)) url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))
}) })

View File

@@ -54,8 +54,13 @@ Page({
* 支付订单 * 支付订单
*/ */
payClick() { payClick() {
let payData = {
order_id : this.data.goodsData.order_id,
order_no : this.data.goodsData.order_no,
order_type : this.data.goodsData.order_type
}
wx.navigateTo({ wx.navigateTo({
url: '/pages/pay/index?order_no=' + this.data.goodsData.order_no + '&total=' + this.data.goodsData.total url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(payData))
}) })
}, },

View File

@@ -1,7 +1,7 @@
<view class="orderData"> <view class="orderData">
<view class="While"> <view class="While">
<view class="orderData-cont-label"> <view class="orderData-cont-label">
<image class="orderData-cont-img" src="https://cdn.shuiganying.com/images/2023/04/04/3b3938e3a883e6b173b4d49a5242666a.png" mode="aspectFill"></image> <image class="orderData-cont-img" src="/static/icons/copy_icon.png" mode="aspectFill"></image>
<view class="orderData-cont-text"> <view class="orderData-cont-text">
<view class="orderData-cont-name">订单编号</view> <view class="orderData-cont-name">订单编号</view>
<view class="orderData-cont-copy"> <view class="orderData-cont-copy">

View File

@@ -215,7 +215,7 @@ page {
} }
.reserve-status { .reserve-status {
color: #ff8100 color: #da2b54
} }
/* 底部菜单 */ /* 底部菜单 */

View File

@@ -60,8 +60,14 @@ Page({
* 支付订单 * 支付订单
*/ */
payClick(e) { payClick(e) {
let { item } = e.currentTarget.dataset
let data = {
order_id : item.order_id,
order_no : item.order_no,
order_type : item.order_type
}
wx.navigateTo({ wx.navigateTo({
url: '/pages/pay/index?order_no=' + e.currentTarget.dataset.order_no + '&total=' + e.currentTarget.dataset.total url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(data))
}) })
}, },
@@ -137,5 +143,14 @@ Page({
// 获取订单列表 // 获取订单列表
this.listInfo(pageNumber); this.listInfo(pageNumber);
} }
},
/**
* 申请售后
*/
signRefund(e){
let { order_no } = e.currentTarget.dataset
wx.navigateTo({
url: "/pages/refund/aftersale/aftersale?id=" + order_no,
})
} }
}) })

View File

@@ -44,8 +44,9 @@
<view class="list-more-go" bindtap="operateMore" data-order_no="{{item.order_no}}" wx:if="{{item.can.cancel}}">更多</view> <view class="list-more-go" bindtap="operateMore" data-order_no="{{item.order_no}}" wx:if="{{item.can.cancel}}">更多</view>
</view> </view>
<view class="list-btn"> <view class="list-btn">
<view class="list-btn-labor" bindtap="payClick" data-order_no="{{item.order_no}}" data-total="{{item.total}}" wx:if="{{item.can.pay}}">立即付款</view> <view class="list-btn-labor" bindtap="payClick" data-item="{{item}}" wx:if="{{item.can.pay}}">立即付款</view>
<view bindtap="signClick" data-order_no="{{item.order_no}}" class="list-btn-labor" wx:if="{{item.can.sign}}">签收订单</view> <view bindtap="signClick" data-order_no="{{item.order_no}}" class="list-btn-labor" wx:if="{{item.can.sign}}">签收订单</view>
<view bindtap="signRefund" data-order_no="{{item.order_no}}" class="list-btn-labor" wx:if="{{item.can.refund}}">申请退货</view>
<navigator hover-class="none" url="./details/details?order_no={{item.order_no}}" class="list-btn-labor grey">查看详情</navigator> <navigator hover-class="none" url="./details/details?order_no={{item.order_no}}" class="list-btn-labor grey">查看详情</navigator>
</view> </view>
</view> </view>

View File

@@ -52,7 +52,7 @@ page {
} }
.list-top-status { .list-top-status {
color: #ff8100; color: #da2b54;
} }
.list-goods { .list-goods {
@@ -157,8 +157,8 @@ page {
} }
.list-btn-labor { .list-btn-labor {
border: 2rpx solid #ff8100; border: 2rpx solid #da2b54;
color: #ff8100; color: #da2b54;
border-radius: 80rpx; border-radius: 80rpx;
height: 56rpx; height: 56rpx;
line-height: 56rpx; line-height: 56rpx;

View File

@@ -0,0 +1,82 @@
Page({
/**
* 页面的初始数据
*/
data: {
order : null,
title : [],
imgs : null,
titleVal: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.refund.refundPreposition(options.id).then(res => {
let { title, order } = res.data;
console.log(order)
console.log(title)
this.setData({
title,
order,
titleVal: title[0]
})
wx.hideLoading()
})
},
/**
* 选择退货理由
*/
onRadio(e){
console.log(e.detail.value)
},
/**
* 选择图片上传
*/
onUpd(){
wx.chooseMedia({
count : 1,
mediaType : ['image'],
success : path => {
wx.$api.file.uploadImg(path.tempFiles[0].tempFilePath, {}).then(res => {
this.setData({
imgs: res
})
})
}
})
},
/**
* 提交申请
*/
onSubmit(){
let data = {
title : this.data.titleVal,
pictures : this.data.imgs != null ? this.data.imgs.path : ''
}
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.refund.submitRefund(this.data.order.order_no, data).then(res => {
wx.showModal({
title : '提示',
content : res.data,
showCancel : false,
confirmColor: '#da2b54',
success : modalRes => {
if(modalRes.confirm){
wx.navigateBack()
}
wx.hideLoading()
}
})
})
}
})

View File

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

View File

@@ -0,0 +1,39 @@
<view class="content">
<!-- 服务提醒 -->
<view class="service-content">
<view class="service"> 本次售后服务将由<text> 绚火健康 </text>为您提供服务 </view>
</view>
<!-- 服务产品 -->
<view class="goods">
<view class="goods-item" wx:if="{{order != null}}" wx:for="{{order.items}}" wx:key="index" >
<image src="{{item.sku.cover}}" mode="aspectFill" class="good-img" />
<view class="good-content">
<view class="title">{{item.sku.goods_name}}</view>
<view class="text">金额:{{item.price}}</view>
<view class="text">数量:{{item.qty}}</view>
</view>
</view>
</view>
<!-- 退货理由 -->
<view class="block-title">选择退货理由</view>
<view class="reason">
<radio-group bindchange="onRadio">
<label class="reason-flex" wx:for="{{title}}" wx:key="index">
{{item}} <radio class="reason-radio" value="{{item}}" checked="{{index == 0}}" color="#da2b54"></radio>
</label>
</radio-group>
</view>
<!-- 上传图片 -->
<view class="block-title">退货照片(仅限一张图片)</view>
<view class="imgs">
<view class="imgs-upd" bind:tap="onUpd">
<image class="imgs-cover" src="{{imgs.url}}" mode="aspectFit" wx:if="{{imgs != null}}"></image>
<image class="imgs-add" src="/static/icons/add_gray.png" mode="aspectFill" wx:else></image>
</view>
</view>
<!-- 提交 -->
<view class="button">
<button size="default" bind:tap="onSubmit">提交申请</button>
</view>
</view>

View File

@@ -0,0 +1,34 @@
.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; }
/* 商品信息 */
.goods{ background-color: #fff; padding: 10rpx 30rpx; box-sizing: border-box; border-radius: 20rpx; margin-top: 30rpx; }
.goods-item { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; margin: 20rpx 0; }
.good-img{ width: 128rpx; height: 128rpx; border-radius: 10rpx; }
.good-content{ padding-left: 30rpx; box-sizing: border-box; width: calc(100% - 128rpx); }
.good-content > .title{ font-size: 30rpx; line-height: 48rpx; }
.good-content > .text{ font-size: 26rpx; color: gray; line-height: 40rpx; }
/* 退货标题 */
.block-title{ font-size: 30rpx; padding-top: 30rpx; color: gray; }
/* 退货原因 */
.reason{ background: white; border-radius: 20rpx; margin-top: 30rpx; }
.reason-flex{ display: flex; justify-content: space-between; align-items: center; padding: 0 30rpx; height: 120rpx; font-weight: bold; font-size: 30rpx; border-bottom: solid 1rpx #f7f8f9; }
.reason-radio{ transform: scale(.75); }
.reason-flex:last-child{ border-bottom: none; }
/* 上传退货照片 */
.imgs{ background: white; border-radius: 20rpx; margin-top: 30rpx; padding: 20rpx; display: flex; flex-wrap: wrap; }
.imgs-upd{ background: #f7f8f9; width: calc(25% - 20rpx); padding-top: calc(25% - 20rpx); margin: 10rpx; position: relative; }
.imgs-add{ width: 48rpx; height: 48rpx; opacity: .3; position: absolute; left: 50%; top: 50%; margin-top: -24rpx; margin-left: -24rpx; }
.imgs-cover{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/* 退货 */
.button{ margin-top: 40rpx; }
.button button[size="default"]{ background: #da2b54; color: white; width: 100%; height: 90rpx; font-size: 32rpx; line-height: 90rpx; padding: 0; border-radius: 45rpx; }

50
pages/refund/refund.js Normal file
View File

@@ -0,0 +1,50 @@
Page({
/**
* 页面的初始数据
*/
data: {
listsArr : [], // 订单列表
page : { current: 1 }, // 分页信息
lodingStats : false, // 加载状态
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getList()
},
/**
* 获取列表
*/
getList(){
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.refund.list({
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,
lodingStats : !page.has_more
})
wx.stopPullDownRefresh()
wx.hideLoading()
})
},
/**
* 申请售后
*/
onAftersale(){
wx.navigateTo({
url: './aftersale/aftersale',
})
}
})

4
pages/refund/refund.json Normal file
View File

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

35
pages/refund/refund.wxml Normal file
View File

@@ -0,0 +1,35 @@
<block wx:if="{{listsArr.length > 0}}">
<view class="orders">
<view class="order-item" wx:for="{{listsArr}}" wx:key="arrayIndex">
<view class="order-flex" wx:for="{{item.items}}" wx:key="index" wx:for-item="items">
<image class="order-cover" src="{{items.cover}}" mode="aspectFill"></image>
<view class="order-content">
<view class="order-title nowrap">{{items.goods_name}}</view>
<view class="order-text">金额:<text>{{items.price}}</text></view>
<view class="order-text">数量:{{items.qty}}</view>
</view>
</view>
<view class="order-state">
{{item.state.text}}
<view class="order-des">{{item.state.remark}}</view>
</view>
<view class="order-btns">
<view class="item item-cancle" bind:tap="onAftersale">售后详情</view>
</view>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>没有更多了~</block>
</view>
</view>
</block>
<block wx:else>
<view class="pack-center pages-hint">
<image src="/static/imgs/text_null.png"></image>
<view>暂无可售后服务订单</view>
</view>
</block>

23
pages/refund/refund.wxss Normal file
View File

@@ -0,0 +1,23 @@
/* 售后服务列表 */
.orders{ background: #f7f8f9; min-height: 100vh; padding:10rpx 30rpx 30rpx; box-sizing: border-box; }
.order-item{ background: white; padding: 30rpx; border-radius: 20rpx; margin-top: 20rpx; }
/* 订单数量 */
.order-flex{ display: flex; flex-wrap: wrap; }
.order-cover{ background-color: #f7f8f9; width: 140rpx; height: 140rpx; margin-right: 30rpx; border-radius: 10rpx; }
.order-content{ width: calc(100% - 178rpx); }
.order-title{ font-size: 30rpx; font-weight: bold; line-height: 50rpx; height: 50rpx; }
.order-text{ color: gray; font-size: 28rpx; line-height: 45rpx; }
.order-text text{ color: #da2b54; font-weight: bold; }
/* 订单状态 */
.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-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; }
/* 售后服务 */
.pages-hint{ padding-bottom: 10vh; }

View File

@@ -1,9 +1,12 @@
<view class="linearBack"> <view class="linearBack">
<view class="head" wx:if="{{userLogin}}"> <view class="head" wx:if="{{userLogin}}">
<image class="head-img" src="{{userData.user.avatar ? userData.user.avatar : '/static/imgs/userHead.png'}}" mode="widthFix"></image> <image class="head-img" src="{{userData.user.avatar ? userData.user.avatar : '/static/imgs/userHead.png'}}" mode="aspectFill"></image>
<view class="head-cont"> <view class="head-cont">
<view class="head-name">{{userData.user.nickname}}</view> <view class="head-name">{{userData.user.nickname}}</view>
<view class="head-text">生命可以如此精彩~</view> <view class="head-text">
<image src="{{userData.user.identity.cover || '-'}}" mode="widthFix"></image>
<!-- <text>{{userData.user.identity.cover}}</text> -->
</view>
</view> </view>
<view class="head-edit" bindtap="userNav" data-url="/pages/user/setup/setup">编辑 ></view> <view class="head-edit" bindtap="userNav" data-url="/pages/user/setup/setup">编辑 ></view>
</view> </view>
@@ -63,17 +66,13 @@
<image class="tool-icon" src="/static/imgs/tool_05.png" mode="widthFix"></image> <image class="tool-icon" src="/static/imgs/tool_05.png" mode="widthFix"></image>
<view class="order-label">我的账户</view> <view class="order-label">我的账户</view>
</view> </view>
<!-- <view class="order-item" bindtap="userNav" data-url="/pages/bankCard/index">
<image class="tool-icon" src="/static/imgs/tool_08.png" mode="widthFix"></image>
<view class="order-label">我的银行卡</view>
</view> -->
<view class="order-item" bindtap="userNav" data-url="/pages/user/team/index"> <view class="order-item" bindtap="userNav" data-url="/pages/user/team/index">
<image class="tool-icon" src="/static/imgs/tool_06.png" mode="widthFix"></image> <image class="tool-icon" src="/static/imgs/tool_06.png" mode="widthFix"></image>
<view class="order-label">我的团队</view> <view class="order-label">我的团队</view>
</view> </view>
<view class="order-item" bindtap="userNav" data-url="/pages/user/code/code" data-type="needSign"> <view class="order-item" bindtap="userNav" data-url="/pages/refund/refund">
<image class="tool-icon" src="/static/imgs/tool_07.png" mode="widthFix"></image> <image class="tool-icon" src="/static/imgs/tool_08.png" mode="widthFix"></image>
<view class="order-label">邀请码</view> <view class="order-label">售后记录</view>
</view> </view>
<view class="order-item" bindtap="userNav" data-url="/pages/site/index"> <view class="order-item" bindtap="userNav" data-url="/pages/site/index">
<image class="tool-icon" src="/static/imgs/tool_01.png" mode="widthFix"></image> <image class="tool-icon" src="/static/imgs/tool_01.png" mode="widthFix"></image>
@@ -83,6 +82,10 @@
<image class="tool-icon" src="/static/imgs/tool_02.png" mode="widthFix"></image> <image class="tool-icon" src="/static/imgs/tool_02.png" mode="widthFix"></image>
<view class="order-label">实名认证</view> <view class="order-label">实名认证</view>
</view> </view>
<view class="order-item" bindtap="userNav" data-url="/pages/user/code/code" data-type="needSign">
<image class="tool-icon" src="/static/imgs/tool_07.png" mode="widthFix"></image>
<view class="order-label">邀请码</view>
</view>
<navigator hover-class="none" class="order-item" url="/pages/user/about/about"> <navigator hover-class="none" class="order-item" url="/pages/user/about/about">
<image class="tool-icon" src="/static/imgs/tool_03.png" mode="widthFix"></image> <image class="tool-icon" src="/static/imgs/tool_03.png" mode="widthFix"></image>
<view class="order-label">关于我们</view> <view class="order-label">关于我们</view>

View File

@@ -40,6 +40,10 @@ page {
color: #111111; color: #111111;
} }
.head-text text{ background: #da2b54; color: white; padding: 0 20rpx; border-radius: 30rpx; line-height: 40rpx; display: inline-block; color: white; font-size: 24rpx; }
.head-name image,
.head-text image{ width: 90rpx; height: 34rpx; vertical-align: middle; }
.head-edit { .head-edit {
position: absolute; position: absolute;
right: 0; right: 0;

BIN
static/icons/add_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
static/icons/copy_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB