Files
lucky_shop/pages_tool/order/refund.vue
ZF sun 783c10fc62 refactor: 统一项目内国际化key的命名空间格式
本次提交对全项目的国际化调用进行了规范化重构:
1. 为中文/英文语言包新增了avatar和gender的别名映射,兼容旧有headImg/sex写法
2. 修正了lang.js中的注释路径错误
3. 将所有页面和组件内的$lang调用从短路径改为带业务模块前缀的完整命名空间路径,例如将$lang('title')改为$lang('article.list.title')
4. 优化了i18n-lazy.js的注释说明,补充了正确的key命名格式示例
5. 统一了分销、订单、会员等模块的国际化key层级,确保所有语言调用路径一致
2026-07-04 09:24:35 +08:00

301 lines
8.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view :style="themeColor">
<view>
<scroll-view scroll-y="true" class="refund-container">
<view class="goods-wrap">
<view class="goods-img">
<image :src="$util.img(refund_data.order_goods_info.sku_image, { size: 'mid' })" @error="refund_data.order_goods_info.sku_image = $util.getDefaultImage().goods" mode="aspectFill" :lazy-load="true" show-menu-by-longpress/>
</view>
<view class="goods-info">
<view class="goods-name">{{ refund_data.order_goods_info.sku_name }}</view>
</view>
</view>
<view class="refund-option" v-show="!refund_type">
<view class="option-item" @click="selectRefundType(1)">
<view>
<text>{{ $lang('order.refund.refundType.refundOnly') }}</text>
<text class="font-size-goods-tag color-tip">{{ $lang('order.refund.refundType.refundOnlyDesc') }}</text>
</view>
<text class="iconfont icon-right"></text>
</view>
<view class="option-item" @click="selectRefundType(2)" v-if="refund_data.refund_type.length == 2">
<view>
<text>{{ $lang('order.refund.refundType.returnRefund') }}</text>
<text class="font-size-goods-tag color-tip">{{ $lang('order.refund.refundType.returnRefundDesc') }}</text>
</view>
<text class="iconfont icon-right"></text>
</view>
</view>
<view v-show="refund_type">
<view class="refund-form">
<view class="item-wrap" @click="openPopup('refundReasonPopup')">
<view class="label">{{ $lang('order.refund.form.refundReason') }}</view>
<view class="cont reason">
<text class="color-tip" v-if="!refund_reason.length">{{ $lang('order.refund.form.pleaseSelect') }}</text>
<text class="color-tip" v-else>{{ refund_reason }}</text>
</view>
<text class="iconfont icon-right"></text>
</view>
<view class="item-wrap">
<view class="label">{{ $lang('order.refund.form.refundAmount') }}</view>
<view class="cont color-base-text">{{ $lang('common.currencySymbol') }}{{ refund_data.refund_money }}</view>
</view>
</view>
<view class="refund-form">
<view class="item-wrap"><view class="label active">{{ $lang('order.refund.form.refundRemark') }}</view></view>
<!-- #ifdef MP-WEIXIN -->
<textarea
v-if="!showText"
class="newText"
:placeholder="$lang('order.refund.form.remarkPlaceholder')"
placeholder-class="color-tip font-size-tag"
:auto-height="true"
v-model="refund_remark"
/>
<!-- #endif -->
<!-- #ifdef H5 -->
<textarea
class="newText"
:placeholder="$lang('order.refund.form.remarkPlaceholder')"
@blur="textBlur()"
placeholder-class="color-tip font-size-tag"
:auto-height="true"
v-model="refund_remark"
/>
<!-- #endif -->
</view>
<!-- <view class="sub-btn color-base-bg" :class="{ 'safe-area': isIphoneX }" @click="submit">{{ $lang('common.submit') }}</view> -->
<view class="sub-btn" :class="{ 'safe-area': isIphoneX }" @click="submit">
<button type="primary">{{ $lang('common.submit') }}</button>
</view>
</view>
<uni-popup ref="refundReasonPopup" type="bottom" @change="change()">
<view class="refund-reason-popup popup">
<view class="popup-header">
<view><text class="tit">{{ $lang('order.refund.reasonPopup.title') }}</text></view>
<view class="align-right" @click="closePopup('refundReasonPopup')"><text class="iconfont icon-close"></text></view>
</view>
<view class="popup-body">
<scroll-view scroll-y="true" class="scroll-view" :class="{ 'safe-area': isIphoneX }">
<view class="reason-list">
<view class="item" v-for="(item, index) in refund_data.refund_reason_type" :key="index" @click="changeReason(item)">
<view class="reason">{{ item }}</view>
<view class="iconfont" :class="refund_reason == item ? 'icon-yuan_checked color-base-text' : 'icon-yuan_checkbox'"></view>
</view>
</view>
</scroll-view>
</view>
<view class="popup-footer" :class="{ 'bottom-safe-area': isIphoneX }">
<view class="confirm-btn color-base-bg" @click="closePopup('refundReasonPopup')">{{ $lang('order.refund.reasonPopup.confirm') }}</view>
</view>
</view>
</uni-popup>
</scroll-view>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</view>
</template>
<script>
export default {
data() {
return {
order_goods_id: '',
refund_type: '',
refund_reason: '',
refund_remark: '',
isIphoneX: false,
refund_data: {
refund_type: [],
order_goods_info: {
sku_image: ''
}
},
isSub: false,
showText: false //是否展示退款说明,解决原生小程序textarea层级过高 popup不能遮挡的问题
};
},
onLoad(option) {
if (option.order_goods_id) this.order_goods_id = option.order_goods_id;
},
onShow() {
this.isIphoneX = this.$util.uniappIsIPhoneX();
if (this.storeToken) {
this.getRefundData();
} else {
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, { back: '/pages_tool/order/refund?order_goods_id=' + this.order_goods_id });
}
},
methods: {
/**
* 显示弹出层
* @param {Object} ref
*/
openPopup(ref) {
this.$refs[ref].open();
},
/**
* 关闭弹出层
* @param {Object} ref
*/
closePopup(ref) {
this.$refs[ref].close();
},
textBlur() {
uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
},
/**
* 选择退款方式
* @param {Object} type
*/
selectRefundType(type) {
this.refund_type = type;
},
getRefundData() {
this.$api.sendRequest({
url: '/api/orderrefund/refundData',
data: {
order_goods_id: this.order_goods_id
},
success: res => {
if (res.code >= 0) {
this.refund_data = res.data;
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
} else {
this.$util.showToast({ title: this.$lang('order.refund.toast.noRefundInfo') });
setTimeout(() => {
this.$util.redirectTo('/pages_order/list');
}, 1000);
}
},
fail: res => {
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
submit() {
if (this.verify()) {
if (this.isSub) return;
this.isSub = true;
// #ifdef MP
this.subscribeMessage(() => {
this.$api.sendRequest({
url: '/api/orderrefund/refund',
data: {
order_goods_ids: this.order_goods_id,
refund_type: this.refund_type,
refund_reason: this.refund_reason,
refund_remark: this.refund_remark
},
success: res => {
this.$util.showToast({ title: res.message });
if (res.code >= 0) {
this.$util.redirectTo('/pages_tool/order/activist', {}, 'redirectTo');
} else {
this.isSub = false;
}
},
fail: res => {
this.isSub = false;
}
});
})
// #endif
// #ifndef MP-WEIXIN
this.$api.sendRequest({
url: '/api/orderrefund/refund',
data: {
order_goods_ids: this.order_goods_id,
refund_type: this.refund_type,
refund_reason: this.refund_reason,
refund_remark: this.refund_remark
},
success: res => {
this.$util.showToast({ title: res.message });
if (res.code >= 0) {
this.$util.redirectTo('/pages_tool/order/activist', {}, 'redirectTo');
} else {
this.isSub = false;
}
},
fail: res => {
this.isSub = false;
}
});
// #endif
}
},
verify() {
if (this.refund_reason == '') {
this.$util.showToast({ title: this.$lang('order.refund.validate.pleaseSelectRefundReason') });
return false;
}
return true;
},
changeReason(refund_reason) {
this.refund_reason = refund_reason;
},
change(e) {
if (e) this.showText = e.show;
},
/**
* 微信订阅消息
*/
subscribeMessage(callback){
this.$api.sendRequest({
url: '/weapp/api/weapp/messagetmplids',
data: {
keywords: 'ORDER_REFUND_AGREE,ORDER_REFUND_REFUSE'
},
success: res => {
if (res.code == 0 && res.data.length) {
uni.requestSubscribeMessage({
tmplIds: res.data,
fail: (res) => {
},
complete: ()=> {
callback();
}
})
} else {
callback();
}
},
fail: res => {
callback();
}
})
}
}
};
</script>
<style lang="scss">
@import './public/css/refund.scss';
</style>
<style scoped>
::v-deep .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
background: none;
max-height: unset !important;
overflow-y: hidden !important;
}
::v-deep .uni-popup__wrapper {
border-radius: 20rpx 20rpx 0 0;
}
::v-deep .uni-popup {
z-index: 8;
}
</style>