Commit cae4f83f by zhangxw

bug修改

1 parent a992d0a3
...@@ -88,7 +88,8 @@ Component({ ...@@ -88,7 +88,8 @@ Component({
inputValue: '', inputValue: '',
showRemark: false, showRemark: false,
showCopyPopup: false, // 复制二次选择 showCopyPopup: false, // 复制二次选择
copyObj: {} // 复制 姓名/手机号 copyObj: {}, // 复制 姓名/手机号
remarkType: '' // 备注类型 1备注 2 退款原因
}, },
lifetimes: { lifetimes: {
...@@ -204,6 +205,57 @@ Component({ ...@@ -204,6 +205,57 @@ Component({
this.search() this.search()
}, },
showMask(e) {
const { item } = e.currentTarget.dataset || {}
this.setData({
showRemark: true,
remarkType: 1,
selectItem: item
})
},
// 备注确认
remarkConfirm(e) {
let value = e.detail
// 备注类型 remarkType 1备注 2退款原因
const {subOrderCodeCopy, remarkType, list, selectItem} = this.data
if (remarkType == 1) {
if (value) {
wx.showLoading()
api.updateOrderRemark({
orderCode: selectItem?.subOrderCode,
remark: value
}).then(res => {
wx.hideLoading()
let { code } = res
if (code == 0) {
// 将订单项备注值回填 不请求接口刷新页面
list.forEach(val => {
if (val.subOrderCode == selectItem.subOrderCode) {
val.remark = value
}
})
this.setData({list})
}
})
}
} else {
let params = {
orderCode: subOrderCodeCopy,
refundRemark: value
}
wx.showLoading()
api.markAsRefunded(params).then(res => {
wx.hideLoading()
if (res.code == 0) {
wx.$util.showToast('退款成功!')
this.getList()
} else {
wx.$util.showToast(res.message || '接口异常')
}
})
}
},
input(e) { input(e) {
let {value} = e.detail let {value} = e.detail
this.setData({ this.setData({
...@@ -232,12 +284,18 @@ Component({ ...@@ -232,12 +284,18 @@ Component({
copyData(e) { copyData(e) {
const {target, flag} = e.currentTarget.dataset const {target, flag} = e.currentTarget.dataset
if (flag == 1) { // 姓名和手机号 if (flag == 1) { // 姓名和手机号
return this.setData({ if (target.customerName && target.customerPhone) { // 姓名手机号都有
showCopyPopup: true, return this.setData({
copyObj: { showCopyPopup: true,
customerName: target.customerName, copyObj: {
customerPhone: target.customerPhone customerName: target.customerName,
} customerPhone: target.customerPhone
}
})
}
let copyItem = target.customerName || target.customerPhone // 只手机号或姓名
wx.setClipboardData({
data: copyItem
}) })
} }
let copyItem = target.subOrderCode let copyItem = target.subOrderCode
...@@ -301,37 +359,11 @@ Component({ ...@@ -301,37 +359,11 @@ Component({
} }
if (target.tailOrderStatus == 1 || target.tailOrderStatus == 4) { // 已支付或退定金状态 if (target.tailOrderStatus == 1 || target.tailOrderStatus == 4) { // 已支付或退定金状态
this.setData({ this.setData({
showRemark: true showRemark: true,
remarkType: 2
}) })
} }
}, },
// 退款原因确认
remarkConfirm(e) {
let value = e.detail
const {subOrderCodeCopy} = this.data
let params = {
orderCode: subOrderCodeCopy,
refundRemark: value
}
wx.showModal({
title: '温馨提示',
content: '请确定将此订单状态标记为已退款',
complete: (res) => {
if (res.confirm) {
wx.showLoading()
api.markAsRefunded(params).then(res => {
wx.hideLoading()
if (res.code == 0) {
wx.$util.showToast('退款成功!')
this.getList()
} else {
wx.$util.showToast(res.message || '接口异常')
}
})
}
}
})
},
remarkCancel() { remarkCancel() {
this.setData({ this.setData({
showRemark: false showRemark: false
......
...@@ -86,11 +86,13 @@ ...@@ -86,11 +86,13 @@
<block>{{item['refundRemark']}}</block> <block>{{item['refundRemark']}}</block>
</view> </view>
</view> </view>
<!-- 待支付订单无备注字段 --> <view class="order refund_text">
<view class="order refund_text" wx:if="{{item.remark}}">
<view class="order-label">备注 </view> <view class="order-label">备注 </view>
<view class="order-value"> <view bindtap="showMask" class="order-value" data-item="{{item}}">
<block>{{item['remark'] || ''}}</block> <view wx:if="{{item.remark}}">
<block>{{item['remark']}}</block>
</view>
<view class="placeholder_class" wx:if="{{!item.remark}}">点击添加备注</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -121,13 +123,14 @@ ...@@ -121,13 +123,14 @@
</view> </view>
</view> </view>
<remark-popup wx:if="{{showRemark}}" <remark-popup wx:if="{{showRemark}}"
title="退款原因" title="{{remarkType == 1 ? '备注' : '退款备注'}}"
show="{{showRemark}}" show="{{showRemark}}"
required="{{true}}" required="{{true}}"
maxlength="100" maxlength="{{remarkType == 1 ? 30 : 100}}"
value="{{remarkType == 1 ? selectItem.remark : ''}}"
bindcancel="remarkCancel" bindcancel="remarkCancel"
bindconfirm="remarkConfirm" bindconfirm="remarkConfirm"
placeholder="请填写内容,最多100个字" /> placeholder="请填写内容,最多{{remarkType == 1 ? 30 : 100}}个字" />
<van-popup show="{{ showCopyPopup }}" bind:close="onCopyPopupClose" round> <van-popup show="{{ showCopyPopup }}" bind:close="onCopyPopupClose" round>
<view class="copy_popup_title">复制</view> <view class="copy_popup_title">复制</view>
......
...@@ -130,12 +130,12 @@ page { ...@@ -130,12 +130,12 @@ page {
} }
.order-box .order-item view:last-child{ .order-box .order-item view:last-child{
width: calc(100% - 200rpx); width: calc(100% - 200rpx);
color: #1B233D; color: #1B233D;
} }
.order-box .order-item view .placeholder_class{ .order-box .order-item view .placeholder_class{
color: #C8C8C8; color: #C8C8C8;
} }
.order-box .order-item view remark-text{ .order-box .order-item .remark-text{
text-overflow:ellipsis; text-overflow:ellipsis;
display: -webkit-box; display: -webkit-box;
word-break: break-all; word-break: break-all;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!