[新增退款流程、查看物流]
This commit is contained in:
152
pages/order/refundForm/refundForm.js
Normal file
152
pages/order/refundForm/refundForm.js
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
reasonArr : [],
|
||||
reasonIndex: 0,
|
||||
orderNo : '',
|
||||
albumArr : [], //我的相册
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
console.log(options)
|
||||
this.setData({
|
||||
orderNo: options.order_no
|
||||
})
|
||||
|
||||
// 获取退款原因
|
||||
this.reasonInfo(options.order_no)
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 退款原因
|
||||
*/
|
||||
reasonInfo(order_no) {
|
||||
wx.$api.order.reason(order_no).then(res => {
|
||||
this.setData({
|
||||
reasonArr: res.data.title
|
||||
})
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 选择退款原因
|
||||
*/
|
||||
reasonChange(e) {
|
||||
this.setData({
|
||||
reasonIndex: e.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 上传图片
|
||||
*/
|
||||
addAlbum() {
|
||||
wx.chooseImage({
|
||||
count : 9,
|
||||
success : path => {
|
||||
// 上传图片
|
||||
if (path.tempFilePaths){
|
||||
let pathArr = path.tempFilePaths
|
||||
for (let i = 0; i < pathArr.length; i++){
|
||||
wx.$api.file.uploadImg(pathArr[i], {}).then(res=>{
|
||||
wx.showLoading({
|
||||
title: '上传中',
|
||||
})
|
||||
let albumArr = this.data.albumArr
|
||||
albumArr.push({
|
||||
path: res.path,
|
||||
showpath: res.url
|
||||
})
|
||||
this.setData({
|
||||
albumArr
|
||||
})
|
||||
|
||||
wx.hideLoading()
|
||||
})
|
||||
if (i == pathArr.length - 1) {
|
||||
wx.hideLoading()
|
||||
}
|
||||
}
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: '上传图片失败',
|
||||
icon : 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除图片
|
||||
*/
|
||||
removeAlbum(e){
|
||||
wx.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
let index = e.currentTarget.dataset.index,
|
||||
atalbum = this.data.albumArr
|
||||
wx.showToast({
|
||||
title: '删除成功',
|
||||
icon : 'none'
|
||||
})
|
||||
atalbum.splice(index,1)
|
||||
this.setData({
|
||||
albumArr : atalbum
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 提交表单
|
||||
*/
|
||||
siteform(e) {
|
||||
let paths = []
|
||||
for (let paht of this.data.albumArr){
|
||||
paths.push(paht.path)
|
||||
}
|
||||
let value = e.detail.value
|
||||
let data = {
|
||||
remark : value.remark,
|
||||
title : this.data.reasonIndex,
|
||||
pictures : paths
|
||||
}
|
||||
this.setData({
|
||||
disabled: true
|
||||
})
|
||||
wx.$api.order.refundPost(this.data.orderNo, data).then(() => {
|
||||
wx.showToast({
|
||||
title: '提交成功',
|
||||
icon : 'none'
|
||||
})
|
||||
setTimeout(()=>{
|
||||
wx.redirectTo({
|
||||
url: '/pages/order/refund/refund',
|
||||
})
|
||||
},3000)
|
||||
|
||||
}).catch(() =>{
|
||||
this.setData({
|
||||
disabled: false
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
3
pages/order/refundForm/refundForm.json
Normal file
3
pages/order/refundForm/refundForm.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
34
pages/order/refundForm/refundForm.wxml
Normal file
34
pages/order/refundForm/refundForm.wxml
Normal file
@@ -0,0 +1,34 @@
|
||||
<form bindsubmit="siteform" class="site-form">
|
||||
<view class="site-input">
|
||||
<label>退款原因</label>
|
||||
<picker bindchange="reasonChange" value="{{reasonIndex}}" range="{{reasonArr}}" class="site-input-back">
|
||||
<view class="picker">
|
||||
{{ reasonArr[reasonIndex] }}
|
||||
</view>
|
||||
<image src="/static/icons/orderArrow.png"></image>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>退款说明</label>
|
||||
<textarea placeholder="请输入退款说明" name="remark" rows="10" class="site-input-back"></textarea>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>上传图片</label>
|
||||
<view class="album-list">
|
||||
<view class="album-list-li" wx:for="{{albumArr}}" wx:key="album" wx:for-index="removeIndex">
|
||||
<image class="album-list-img" src="{{item.showpath}}" mode="aspectFill"></image>
|
||||
<view class="album-remove" catchtap="removeAlbum" data-id="{{item.id}}" data-index="{{removeIndex}}">删除
|
||||
</view>
|
||||
</view>
|
||||
<view class="album-list-li">
|
||||
<view class="album-list-li-add" bindtap="addAlbum">
|
||||
<image class="album-list-add-icon" src="/static/imgs/add_img.png"></image>
|
||||
<view>添加</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="site-btn">
|
||||
<button form-type="submit" size="mini" disabled="{{disabled}}">确认提交</button>
|
||||
</view>
|
||||
</form>
|
||||
106
pages/order/refundForm/refundForm.wxss
Normal file
106
pages/order/refundForm/refundForm.wxss
Normal file
@@ -0,0 +1,106 @@
|
||||
page {
|
||||
background-color: #f4f4f6;
|
||||
}
|
||||
|
||||
.site-input {
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.site-input label {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.site-input-back {
|
||||
background-color: #fff;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
margin-top: 30rpx;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.site-input-back image {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
top: 25rpx;
|
||||
}
|
||||
|
||||
.album-list {
|
||||
display: flex;
|
||||
padding: 20rpx 20rpx 20rpx 15rpx;
|
||||
flex-wrap: wrap;
|
||||
background-color: #fff;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 10rpx;
|
||||
|
||||
}
|
||||
|
||||
.album-list-li {
|
||||
position: relative;
|
||||
width: 25%;
|
||||
padding-top: calc(25% - 20rpx);
|
||||
box-sizing: border-box;
|
||||
border: solid 10rpx transparent;
|
||||
}
|
||||
|
||||
.album-list-img,
|
||||
.album-list-li-add {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #f5f5f5;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.album-list-li-add {
|
||||
text-align: center;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-pack: center;
|
||||
color: #666;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.album-list-add-icon {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
}
|
||||
|
||||
.album-remove {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, .5);
|
||||
color: white;
|
||||
font-size: 28rpx;
|
||||
text-align: center;
|
||||
line-height: 50rpx;
|
||||
width: 100%;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.site-btn {
|
||||
padding: 20rpx 30rpx;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
|
||||
.site-btn button[size="mini"] {
|
||||
width: 100%;
|
||||
background: #3b7cff;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
font-size: 30rpx;
|
||||
color: white;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.site-btn button[disabled] {
|
||||
background: #7789ff !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
Reference in New Issue
Block a user