|
|
@@ -45,7 +45,6 @@
|
|
|
<view class="table-cell cell-staff">操作人</view>
|
|
|
<view class="table-cell cell-status">客户姓名</view>
|
|
|
<view class="table-cell cell-amount">金额</view>
|
|
|
- <view class="table-cell cell-give">赠送</view>
|
|
|
</view>
|
|
|
<view v-for="(item, index) in list.data" :key="index" class="table-body">
|
|
|
<view class="table-row table-row-data">
|
|
|
@@ -53,11 +52,19 @@
|
|
|
<view class="table-cell cell-scene">
|
|
|
<view>{{ getChannelLine(item, 0) }}</view>
|
|
|
<view v-if="getChannelLine(item, 1)">{{ getChannelLine(item, 1) }}</view>
|
|
|
+ <view v-if="isRefunded(item)" class="refund-tag">已退款</view>
|
|
|
</view>
|
|
|
<view class="table-cell cell-staff">{{ item.staffName }}</view>
|
|
|
<view class="table-cell cell-status">{{ item.customName }}</view>
|
|
|
- <view class="table-cell cell-amount">{{ item.amount }}</view>
|
|
|
- <view class="table-cell cell-give">{{ item.giveAmount>0 ? parseFloat(item.giveAmount) : '-' }}</view>
|
|
|
+ <view class="table-cell cell-amount">
|
|
|
+ <view class="amount-line">{{ item.amount }}{{ getGiveAmountText(item) }}</view>
|
|
|
+ <view
|
|
|
+ v-if="canRefund(item)"
|
|
|
+ class="refund-btn"
|
|
|
+ :class="{ disabled: refundingId == item.id }"
|
|
|
+ @click.stop="confirmRefund(item)"
|
|
|
+ >退款</view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="table-row table-row-extra" v-if="!$util.isEmpty(item.remark)">
|
|
|
<view class="table-cell cell-extra">
|
|
|
@@ -113,8 +120,9 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
- import { rechargeList } from '@/api/recharge'
|
|
|
+ import { rechargeList, refundRecharge } from '@/api/recharge'
|
|
|
import { getList } from "@/api/member";
|
|
|
+ import { getStaffInfo } from '@/api/shop-admin'
|
|
|
import list from '@/mixins/list'
|
|
|
import AppSearchModule from "@/components/module/app-search";
|
|
|
import DateSelect from "@/components/module/dateSelect";
|
|
|
@@ -152,7 +160,8 @@
|
|
|
channelKey: 'all',
|
|
|
channelOptions: [
|
|
|
{ label: '全部', value: 'all' },
|
|
|
- { label: '系统', value: 'system' },
|
|
|
+ { label: '线上微信', value: 'online_0' },
|
|
|
+ { label: '线上支付宝', value: 'online_1' },
|
|
|
{ label: '线下微信', value: 'pay_0' },
|
|
|
{ label: '线下支付宝', value: 'pay_1' },
|
|
|
{ label: '现金', value: 'pay_4' },
|
|
|
@@ -163,7 +172,9 @@
|
|
|
{ label: '全部金额', value: '' },
|
|
|
{ label: '充值金额', value: '1' },
|
|
|
{ label: '减少金额', value: '0' }
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ hasFinance: 0,
|
|
|
+ refundingId: 0
|
|
|
};
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
@@ -175,6 +186,13 @@
|
|
|
},
|
|
|
methods: {
|
|
|
iconSrc,
|
|
|
+ loadFinancePermission() {
|
|
|
+ getStaffInfo().then(res => {
|
|
|
+ if (res.code == 1 && res.data && res.data.staff) {
|
|
|
+ this.hasFinance = res.data.staff.finance ? 1 : 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
decodeQueryText(text) {
|
|
|
try {
|
|
|
return decodeURIComponent(text || '');
|
|
|
@@ -241,6 +259,7 @@
|
|
|
},
|
|
|
async init(){
|
|
|
this.hydrateQueryFilters();
|
|
|
+ this.loadFinancePermission();
|
|
|
const res = await rechargeList({
|
|
|
page: this.list.page,
|
|
|
customId: this.customId,
|
|
|
@@ -256,7 +275,8 @@
|
|
|
}
|
|
|
let currentList = res.data.list
|
|
|
currentList.forEach(function(item,index,array){
|
|
|
- array[index].amount = parseFloat(item.settleAmount) > 0 ? '-'+parseFloat(item.amount) : '+'+parseFloat(item.amount)
|
|
|
+ const prefix = Number(item.isRefund) === 1 ? '-' : '+';
|
|
|
+ array[index].amount = prefix + parseFloat(item.amount)
|
|
|
});
|
|
|
res.data.list = currentList
|
|
|
this.completes(res)
|
|
|
@@ -266,10 +286,60 @@
|
|
|
},
|
|
|
getChannelLine(item, line) {
|
|
|
if (item.onlinePay == 2) {
|
|
|
- return line === 0 ? '系统' : '';
|
|
|
+ return line === 0 ? '线上' : this.getPayWayName(item.payWay);
|
|
|
}
|
|
|
return line === 0 ? '线下' : this.getPayWayName(item.payWay);
|
|
|
},
|
|
|
+ isRefunded(item) {
|
|
|
+ return Number(item && item.isRefund) === 1;
|
|
|
+ },
|
|
|
+ canRefund(item) {
|
|
|
+ return this.hasFinance == 1
|
|
|
+ && item
|
|
|
+ && Number(item.payStatus) === 1
|
|
|
+ && !this.isRefunded(item)
|
|
|
+ && Number(item.amount) > 0;
|
|
|
+ },
|
|
|
+ // 格式化金额列的赠送补充文案,只有存在正向赠送金额时才跟随主金额展示。
|
|
|
+ getGiveAmountText(item) {
|
|
|
+ const giveAmount = Number(item && item.giveAmount);
|
|
|
+ if (!giveAmount || giveAmount <= 0) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ return '(赠送' + parseFloat(item.giveAmount) + ')';
|
|
|
+ },
|
|
|
+ confirmRefund(item) {
|
|
|
+ const amount = Math.abs(parseFloat(item.amount)) || 0;
|
|
|
+ let content = '确认对该笔充值退款 ¥' + amount + ' ?';
|
|
|
+ if (Number(item.onlinePay) === 2) {
|
|
|
+ content = '此单为线上付款,提交后钱会原路退回给客户,确认退款 ¥' + amount + ' ?';
|
|
|
+ }
|
|
|
+ uni.showModal({
|
|
|
+ title: '确认退款',
|
|
|
+ content,
|
|
|
+ success: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ this.submitRefund(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ submitRefund(item) {
|
|
|
+ if (this.refundingId) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.refundingId = item.id;
|
|
|
+ refundRecharge({ id: item.id }).then(res => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ this.$msg('退款成功');
|
|
|
+ this.resetList();
|
|
|
+ this.init();
|
|
|
+ }
|
|
|
+ this.refundingId = 0;
|
|
|
+ }).catch(() => {
|
|
|
+ this.refundingId = 0;
|
|
|
+ });
|
|
|
+ },
|
|
|
openFilterPanel() {
|
|
|
this.showFilterPanel = true;
|
|
|
},
|
|
|
@@ -577,17 +647,49 @@
|
|
|
}
|
|
|
&.cell-amount {
|
|
|
text-align: right;
|
|
|
- min-width: 100upx;
|
|
|
- flex: 1;
|
|
|
- }
|
|
|
- &.cell-give {
|
|
|
- text-align: right;
|
|
|
- min-width: 80upx;
|
|
|
- padding-right: 32upx;
|
|
|
- flex: 1;
|
|
|
+ min-width: 152upx;
|
|
|
+ padding-right: 18upx;
|
|
|
+ flex: 1.45;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .refund-tag {
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ min-width: 64upx;
|
|
|
+ height: 30upx;
|
|
|
+ margin-top: 6upx;
|
|
|
+ padding: 0 8upx;
|
|
|
+ border-radius: 6upx;
|
|
|
+ background: #fff1f0;
|
|
|
+ color: #e5484d;
|
|
|
+ font-size: 20upx;
|
|
|
+ line-height: 30upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .amount-line {
|
|
|
+ line-height: 34upx;
|
|
|
+ word-break: break-all;
|
|
|
+ }
|
|
|
+ .refund-btn {
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ min-width: 70upx;
|
|
|
+ height: 44upx;
|
|
|
+ margin-top: 8upx;
|
|
|
+ padding: 0 12upx;
|
|
|
+ border-radius: 8upx;
|
|
|
+ background: #e5484d;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 24upx;
|
|
|
+ line-height: 44upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ &.disabled {
|
|
|
+ opacity: 0.55;
|
|
|
+ }
|
|
|
+ }
|
|
|
.filter-overlay {
|
|
|
position: fixed;
|
|
|
top: 0;
|