Commit cae4f83f by zhangxw

bug修改

1 parent a992d0a3
......@@ -88,7 +88,8 @@ Component({
inputValue: '',
showRemark: false,
showCopyPopup: false, // 复制二次选择
copyObj: {} // 复制 姓名/手机号
copyObj: {}, // 复制 姓名/手机号
remarkType: '' // 备注类型 1备注 2 退款原因
},
lifetimes: {
......@@ -204,6 +205,57 @@ Component({
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) {
let {value} = e.detail
this.setData({
......@@ -232,12 +284,18 @@ Component({
copyData(e) {
const {target, flag} = e.currentTarget.dataset
if (flag == 1) { // 姓名和手机号
return this.setData({
showCopyPopup: true,
copyObj: {
customerName: target.customerName,
customerPhone: target.customerPhone
}
if (target.customerName && target.customerPhone) { // 姓名手机号都有
return this.setData({
showCopyPopup: true,
copyObj: {
customerName: target.customerName,
customerPhone: target.customerPhone
}
})
}
let copyItem = target.customerName || target.customerPhone // 只手机号或姓名
wx.setClipboardData({
data: copyItem
})
}
let copyItem = target.subOrderCode
......@@ -301,37 +359,11 @@ Component({
}
if (target.tailOrderStatus == 1 || target.tailOrderStatus == 4) { // 已支付或退定金状态
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() {
this.setData({
showRemark: false
......
......@@ -86,11 +86,13 @@
<block>{{item['refundRemark']}}</block>
</view>
</view>
<!-- 待支付订单无备注字段 -->
<view class="order refund_text" wx:if="{{item.remark}}">
<view class="order refund_text">
<view class="order-label">备注 </view>
<view class="order-value">
<block>{{item['remark'] || ''}}</block>
<view bindtap="showMask" class="order-value" data-item="{{item}}">
<view wx:if="{{item.remark}}">
<block>{{item['remark']}}</block>
</view>
<view class="placeholder_class" wx:if="{{!item.remark}}">点击添加备注</view>
</view>
</view>
</view>
......@@ -121,13 +123,14 @@
</view>
</view>
<remark-popup wx:if="{{showRemark}}"
title="退款原因"
title="{{remarkType == 1 ? '备注' : '退款备注'}}"
show="{{showRemark}}"
required="{{true}}"
maxlength="100"
maxlength="{{remarkType == 1 ? 30 : 100}}"
value="{{remarkType == 1 ? selectItem.remark : ''}}"
bindcancel="remarkCancel"
bindconfirm="remarkConfirm"
placeholder="请填写内容,最多100个字" />
placeholder="请填写内容,最多{{remarkType == 1 ? 30 : 100}}个字" />
<van-popup show="{{ showCopyPopup }}" bind:close="onCopyPopupClose" round>
<view class="copy_popup_title">复制</view>
......
......@@ -130,12 +130,12 @@ page {
}
.order-box .order-item view:last-child{
width: calc(100% - 200rpx);
color: #1B233D;
color: #1B233D;
}
.order-box .order-item view .placeholder_class{
color: #C8C8C8;
}
.order-box .order-item view remark-text{
.order-box .order-item .remark-text{
text-overflow:ellipsis;
display: -webkit-box;
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!