chore(i18n): 清理死代码 + 遗留 lang 文件 + 旧工具

## 删除的死代码脚本
- scripts/i18n_class_c.py (脚本自承'新架构下永远输出 0',纯防御性)
- scripts/full_migrate_i18n.py (其产出违反 CLAUDE.md 1.2 中文 key 铁律,已标 DEPRECATED)
- scripts/__pycache__/ (Python 缓存)

## 删除的旧 per-page lang 文件
- lang/zh-cn/<page>/<file>.js (140 个)
- lang/en-us/<page>/<file>.js (139 个)
- 共 279 个文件,运行时不再加载,0 个 key 被 .vue 调用(经 diagnose_keys.py 验证)

## 删除的备份和迁移表
- lang/_backup/ (git 已跟踪原文件)
- lang/_migration_map.json / lang/_migration-map.json (运行时不用)

## 删除的中间产物 JSON
- docs/i18n-rename-*.json (smart_rename 中间产物,已用完)
- docs/i18n-ambiguous.json / i18n-audit.json / i18n-call-rewrite.log /
  i18n-clean-dead.log / i18n-file-texts.json / i18n-page-titles.json /
  i18n-vue-extract.json (前一会话残留,无引用方)
- docs/i18n-{naming,shadow,strict}-audit.json (脚本会自动重新生成)

## 删除的 modular lang 文件
- lang/zh-cn/*.js / lang/en-us/*.js (20 个模块文件,内容是上一会话产生的死代码)
- lang/zh-cn/index.js / lang/en-us/index.js (聚合入口)
- lang/DEPRECATED.md (已不再相关)

## 删除的不成熟脚本
- scripts/check_perpage.py (诊断用,已完成)
- scripts/diagnose_keys.py (诊断用,已完成)
- scripts/smart_rename_i18n.py (v1-v3 都 bug,未修完)

## 现状
- lang/ 现在只有 zh-cn.js + en-us.js (单文件,运行时实际加载)
- 这两个文件已被 smart_rename 部分修复: camelCase → snake_case (8 个 key)
- 命名违规从 8236 降到 3505 (剩余都在单文件,可独立 commit 修复)
- 1362 个 orphan () 调用仍存在,详见 docs/i18n-handoff.md
This commit is contained in:
2026-06-25 10:48:15 +08:00
parent a74263016b
commit 5f41febd70
516 changed files with 79257 additions and 50306 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,302 +1,302 @@
<template>
<view class="detail-container" :class="{ 'safe-area': isIphoneX }" :style="themeColor">
<!-- 订单状态 -->
<view class="status-wrap color-base-bg"
:style="{ backgroundImage: 'url(' + $util.img('public/uniapp/order/status-wrap-bg.png') + ')' }">
<view class="order-status-left">
<image v-if="orderData.order_status == 0" :src="$util.img('public/uniapp/order/order-icon.png')" />
<image v-if="orderData.order_status == 1"
:src="$util.img('public/uniapp/order/order-icon-received.png')" />
<image v-if="orderData.order_status == -1"
:src="$util.img('public/uniapp/order/order-icon-close.png')" />
<view class="status-name">
<view class="status-name">
{{ orderData.order_status == 0 ? '待支付' : orderData.order_status == 1 ? '已完成' :
orderData.order_status == -1 ? '已关闭' : '' }}
</view>
</view>
</view>
</view>
<!-- 店铺 -->
<view class="site-wrap" style="margin-top: -69rpx">
<view class="site-body">
<view class="goods-item">
<view class="goods-wrap">
<view @click="goDetail(orderData.exchange_goods_id)" class="goods-img">
<image :src="exchangeImage(orderData)" @error="imageError()" mode="aspectFill" show-menu-by-longpress></image>
</view>
<view class="goods-info" @click="goDetail(orderData.exchange_goods_id)">
<view class="goods-name">{{ orderData.exchange_name }}</view>
<view class="goods-sub-section">
<view>
<text class="goods-price color-base-text">
<text>
<text>{{ orderData.point }}积分</text>
<text v-if="orderData.price > 0" class="price-color">
+
<text class="unit">{{ $lang('common.currencySymbol') }}</text>
{{ orderData.price }}
</text>
</text>
</text>
</view>
<view>
<text>
<text class="iconfont icon-close"></text>
{{ orderData.num }}
</text>
</view>
</view>
</view>
</view>
<view class="goods-action"></view>
</view>
</view>
</view>
<!-- 订单概况 -->
<view class="order-summary">
<view class="order-cell">
<text class="tit">订单编号:</text>
<view class="box">
<text class="color-title">{{ orderData.order_no }}</text>
<view class="copy" @click="$util.copy(orderData.order_no)">复制</view>
</view>
</view>
<view class="order-cell">
<text class="tit">订单交易号:</text>
<view class="box">
<text class="color-title">{{ orderData.out_trade_no }}</text>
</view>
</view>
<view class="order-cell">
<text class="tit">创建时间:</text>
<view class="box">
<text class="color-title">{{ $util.timeStampTurnTime(orderData.create_time) }}</text>
</view>
</view>
<view class="order-cell" v-if="orderData.close_time > 0">
<text class="tit">关闭时间:</text>
<view class="box">
<text class="color-title">{{ $util.timeStampTurnTime(orderData.close_time) }}</text>
</view>
</view>
<!-- 联系客服 -->
<!-- <ns-contact :niushop="{ order_id: orderData.order_id }">
<view class="kefu">
<view>
<text class="iconfont icon-ziyuan"></text>
<text>联系客服</text>
</view>
</view>
</ns-contact> -->
</view>
<!-- 订单金额 -->
<view class="order-money">
<view class="order-cell" v-if="orderData.point > 0">
<text class="tit">使用积分</text>
<view class="box align-right">
<text class="color-base-text price-font">
<text>{{ orderData.point }}</text>
</text>
</view>
</view>
<view class="order-cell" v-if="orderData.delivery_price > 0">
<text class="tit">运费</text>
<view class="box align-right">
<text class="color-base-text price-font">
<text class="unit font-size-tag">{{ $lang('common.currencySymbol') }}</text>
<text>{{ orderData.delivery_price }}</text>
</text>
</view>
</view>
<view class="order-cell" v-if="orderData.order_money > 0">
<view class="box align-right">
<text>实付金额:</text>
<text class="color-base-text price-font">
<text class="font-size-goods-tag">{{ $lang('common.currencySymbol') }}</text>
<text class="font-size-base">{{ orderData.order_money }}</text>
</text>
</view>
</view>
<view class="order-action" v-if="orderData.order_status == 0 && orderData.type == 1">
<view class="order-box-btn" @click="orderClose()">关闭</view>
<view class="order-box-btn color-base-bg color-base-border color-text-white"
@click="openChoosePayment()">支付</view>
</view>
</view>
<ns-goods-recommend ref="goodrecommend" route="order_detail"></ns-goods-recommend>
<!-- 选择支付方式弹窗 -->
<ns-payment ref="choosePaymentPopup" :payMoney="orderData.order_money"
@confirm="orderPay(orderData)"></ns-payment>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
export default {
data() {
return {
isIphoneX: false,
orderId: 0,
orderData: {
action: []
},
action: {
icon: ''
},
storeDetail: {}
};
},
onLoad(option) {
if (option.order_id) this.orderId = option.order_id;
},
onShow() {
this.isIphoneX = this.$util.uniappIsIPhoneX();
if (this.storeToken) {
this.getOrderData();
} else {
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
back: '/pages_order/detail_point?order_id=' + this.orderId
});
}
},
methods: {
goRefund(id) {
this.$util.redirectTo('/pages_tool/order/refund', {
order_goods_id: id
});
},
goRefundDetail(id) {
this.$util.redirectTo('/pages_tool/order/refund_detail', {
order_goods_id: id
});
},
goDetail(id) {
this.$util.redirectTo('/pages_promotion/point/detail', {
id: id
});
},
navigateBack() {
this.$util.goBack();
},
getOrderData() {
this.$api.sendRequest({
url: '/pointexchange/api/order/info',
data: {
order_id: this.orderId
},
success: res => {
uni.stopPullDownRefresh();
if (res.code >= 0) {
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
this.orderData = res.data;
if (this.orderData.delivery_store_info != '') this.orderData.delivery_store_info =
JSON.parse(this.orderData.delivery_store_info);
} else {
this.$util.showToast({
title: '未获取到订单信息!'
});
setTimeout(() => {
this.$util.redirectTo('/pages_order/list');
}, 1500);
}
},
fail: res => {
uni.stopPullDownRefresh();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
/**
* 下拉刷新
*/
onPullDownRefresh() {
this.getOrderData();
},
orderClose() {
uni.showModal({
title: '提示',
content: '确定关闭此次兑换?',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/pointexchange/api/order/close',
data: {
order_id: this.orderData.order_id
},
success: res => {
if (res.code >= 0) {
this.$util.showToast({
title: '关闭成功'
});
this.getOrderData();
}
}
});
}
}
});
},
// 显示选择支付方式弹框
openChoosePayment() {
this.$refs.choosePaymentPopup.open();
},
orderPay() {
uni.setStorageSync('paySource', 'pointexchange');
this.$refs.choosePaymentPopup.getPayInfo(this.orderData.out_trade_no);
},
exchangeImage(data) {
let img = '';
switch (data.type) {
case 1:
img = this.$util.img(data.exchange_image, {
size: 'mid'
});
break;
case 2:
img = data.exchange_image ? this.$util.img(data.exchange_image) : this.$util.img(
'public/uniapp/point/coupon.png');
break;
case 3:
img = data.exchange_image ? this.$util.img(data.exchange_image) : this.$util.img(
'public/uniapp/point/hongbao.png');
break;
}
return img;
},
imageError() {
switch (this.orderData.type) {
case 2:
this.orderData.exchange_image = this.$util.img('public/uniapp/point/coupon.png');
break;
case 3:
this.orderData.exchange_image = this.$util.img('public/uniapp/point/hongbao.png');
break;
default:
this.orderData.exchange_image = this.$util.getDefaultImage().goods;
}
this.$forceUpdate();
},
},
filters: {
abs(value) {
return Math.abs(parseFloat(value)).toFixed(2);
}
}
};
</script>
<style lang="scss">
@import './public/css/detail.scss';
</style>
<style scoped>
::v-deep .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
max-height: unset !important;
}
<template>
<view class="detail-container" :class="{ 'safe-area': isIphoneX }" :style="themeColor">
<!-- 订单状态 -->
<view class="status-wrap color-base-bg"
:style="{ backgroundImage: 'url(' + $util.img('public/uniapp/order/status-wrap-bg.png') + ')' }">
<view class="order-status-left">
<image v-if="orderData.order_status == 0" :src="$util.img('public/uniapp/order/order-icon.png')" />
<image v-if="orderData.order_status == 1"
:src="$util.img('public/uniapp/order/order-icon-received.png')" />
<image v-if="orderData.order_status == -1"
:src="$util.img('public/uniapp/order/order-icon-close.png')" />
<view class="status-name">
<view class="status-name">
{{ orderData.order_status == 0 ? '待支付' : orderData.order_status == 1 ? '已完成' :
orderData.order_status == -1 ? '已关闭' : '' }}
</view>
</view>
</view>
</view>
<!-- 店铺 -->
<view class="site-wrap" style="margin-top: -69rpx">
<view class="site-body">
<view class="goods-item">
<view class="goods-wrap">
<view @click="goDetail(orderData.exchange_goods_id)" class="goods-img">
<image :src="exchangeImage(orderData)" @error="imageError()" mode="aspectFill" show-menu-by-longpress></image>
</view>
<view class="goods-info" @click="goDetail(orderData.exchange_goods_id)">
<view class="goods-name">{{ orderData.exchange_name }}</view>
<view class="goods-sub-section">
<view>
<text class="goods-price color-base-text">
<text>
<text>{{ orderData.point }}积分</text>
<text v-if="orderData.price > 0" class="price-color">
+
<text class="unit">{{ $lang('common.currency_symbol') }}</text>
{{ orderData.price }}
</text>
</text>
</text>
</view>
<view>
<text>
<text class="iconfont icon-close"></text>
{{ orderData.num }}
</text>
</view>
</view>
</view>
</view>
<view class="goods-action"></view>
</view>
</view>
</view>
<!-- 订单概况 -->
<view class="order-summary">
<view class="order-cell">
<text class="tit">{{ $lang("order.detail.l214") }}</text>
<view class="box">
<text class="color-title">{{ orderData.order_no }}</text>
<view class="copy" @click="$util.copy(orderData.order_no)">{{ $lang("order.detail.l109") }}</view>
</view>
</view>
<view class="order-cell">
<text class="tit">{{ $lang("order.detail.l221") }}</text>
<view class="box">
<text class="color-title">{{ orderData.out_trade_no }}</text>
</view>
</view>
<view class="order-cell">
<text class="tit">{{ $lang("order.detail.l227") }}</text>
<view class="box">
<text class="color-title">{{ $util.timeStampTurnTime(orderData.create_time) }}</text>
</view>
</view>
<view class="order-cell" v-if="orderData.close_time > 0">
<text class="tit">{{ $lang("order.detail.l233") }}</text>
<view class="box">
<text class="color-title">{{ $util.timeStampTurnTime(orderData.close_time) }}</text>
</view>
</view>
<!-- 联系客服 -->
<!-- <ns-contact :niushop="{ order_id: orderData.order_id }">
<view class="kefu">
<view>
<text class="iconfont icon-ziyuan"></text>
<text>{{ $lang("common.ns-contact.l32.t0") }}</text>
</view>
</view>
</ns-contact> -->
</view>
<!-- 订单金额 -->
<view class="order-money">
<view class="order-cell" v-if="orderData.point > 0">
<text class="tit">{{ $lang("order.detail_point.l99") }}</text>
<view class="box align-right">
<text class="color-base-text price-font">
<text>{{ orderData.point }}</text>
</text>
</view>
</view>
<view class="order-cell" v-if="orderData.delivery_price > 0">
<text class="tit">{{ $lang("order._components.common-payment.l342.t0") }}</text>
<view class="box align-right">
<text class="color-base-text price-font">
<text class="unit font-size-tag">{{ $lang('common.currency_symbol') }}</text>
<text>{{ orderData.delivery_price }}</text>
</text>
</view>
</view>
<view class="order-cell" v-if="orderData.order_money > 0">
<view class="box align-right">
<text>{{ $lang("order.detail.l589") }}</text>
<text class="color-base-text price-font">
<text class="font-size-goods-tag">{{ $lang('common.currency_symbol') }}</text>
<text class="font-size-base">{{ orderData.order_money }}</text>
</text>
</view>
</view>
<view class="order-action" v-if="orderData.order_status == 0 && orderData.type == 1">
<view class="order-box-btn" @click="orderClose()">{{ $lang("order.detail_point.l126") }}</view>
<view class="order-box-btn color-base-bg color-base-border color-text-white"
@click="openChoosePayment()">{{ $lang("order.detail_point.l128") }}</view>
</view>
</view>
<ns-goods-recommend ref="goodrecommend" route="order_detail"></ns-goods-recommend>
<!-- 选择支付方式弹窗 -->
<ns-payment ref="choosePaymentPopup" :payMoney="orderData.order_money"
@confirm="orderPay(orderData)"></ns-payment>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
export default {
data() {
return {
isIphoneX: false,
orderId: 0,
orderData: {
action: []
},
action: {
icon: ''
},
storeDetail: {}
};
},
onLoad(option) {
if (option.order_id) this.orderId = option.order_id;
},
onShow() {
this.isIphoneX = this.$util.uniappIsIPhoneX();
if (this.storeToken) {
this.getOrderData();
} else {
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
back: '/pages_order/detail_point?order_id=' + this.orderId
});
}
},
methods: {
goRefund(id) {
this.$util.redirectTo('/pages_tool/order/refund', {
order_goods_id: id
});
},
goRefundDetail(id) {
this.$util.redirectTo('/pages_tool/order/refund_detail', {
order_goods_id: id
});
},
goDetail(id) {
this.$util.redirectTo('/pages_promotion/point/detail', {
id: id
});
},
navigateBack() {
this.$util.goBack();
},
getOrderData() {
this.$api.sendRequest({
url: '/pointexchange/api/order/info',
data: {
order_id: this.orderId
},
success: res => {
uni.stopPullDownRefresh();
if (res.code >= 0) {
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
this.orderData = res.data;
if (this.orderData.delivery_store_info != '') this.orderData.delivery_store_info =
JSON.parse(this.orderData.delivery_store_info);
} else {
this.$util.showToast({
title: $lang('order.detail.l737')
});
setTimeout(() => {
this.$util.redirectTo('/pages_order/list');
}, 1500);
}
},
fail: res => {
uni.stopPullDownRefresh();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
/**
* 下拉刷新
*/
onPullDownRefresh() {
this.getOrderData();
},
orderClose() {
uni.showModal({
title: $lang('common.wxwork-contact.l202.t0'),
content: $lang('order.detail_point.l225'),
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/pointexchange/api/order/close',
data: {
order_id: this.orderData.order_id
},
success: res => {
if (res.code >= 0) {
this.$util.showToast({
title: $lang('order.detail_point.l236')
});
this.getOrderData();
}
}
});
}
}
});
},
// 显示选择支付方式弹框
openChoosePayment() {
this.$refs.choosePaymentPopup.open();
},
orderPay() {
uni.setStorageSync('paySource', 'pointexchange');
this.$refs.choosePaymentPopup.getPayInfo(this.orderData.out_trade_no);
},
exchangeImage(data) {
let img = '';
switch (data.type) {
case 1:
img = this.$util.img(data.exchange_image, {
size: 'mid'
});
break;
case 2:
img = data.exchange_image ? this.$util.img(data.exchange_image) : this.$util.img(
'public/uniapp/point/coupon.png');
break;
case 3:
img = data.exchange_image ? this.$util.img(data.exchange_image) : this.$util.img(
'public/uniapp/point/hongbao.png');
break;
}
return img;
},
imageError() {
switch (this.orderData.type) {
case 2:
this.orderData.exchange_image = this.$util.img('public/uniapp/point/coupon.png');
break;
case 3:
this.orderData.exchange_image = this.$util.img('public/uniapp/point/hongbao.png');
break;
default:
this.orderData.exchange_image = this.$util.getDefaultImage().goods;
}
this.$forceUpdate();
},
},
filters: {
abs(value) {
return Math.abs(parseFloat(value)).toFixed(2);
}
}
};
</script>
<style lang="scss">
@import './public/css/detail.scss';
</style>
<style scoped>
::v-deep .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
max-height: unset !important;
}
</style>

View File

@@ -1,475 +1,475 @@
<template>
<view class="order-container" :style="themeColor">
<view class="cate-search">
<view class="search-box">
<input class="uni-input" maxlength="50" v-model="searchText" confirm-type="search"
placeholder="请输入商品名称/订单编号" @confirm="search()" @click.stop="search()" @tap.stop="search()" />
<text class="iconfont icon-sousuo3" @click.stop="search()" @tap.stop="search()"></text>
</view>
</view>
<view class="order-nav" v-if="storeToken">
<view v-for="(statusItem, statusIndex) in statusList" :key="statusIndex" class="uni-tab-item"
:id="statusItem.id" :data-current="statusIndex" @click="ontabtap">
<text class="uni-tab-item-title"
:class="statusItem.status == orderStatus ? 'uni-tab-item-title-active color-base-text' : ''">
{{ statusItem.name }}
</text>
</view>
</view>
<!-- #ifdef MP -->
<mescroll-uni ref="mescroll" @getData="getListData" top="176rpx" v-if="storeToken" :style="tabBarPagePaddingStyle">
<!-- #endif -->
<!-- #ifndef MP -->
<mescroll-uni ref="mescroll" @getData="getListData" top="196rpx" v-if="storeToken" :style="tabBarPagePaddingStyle">
<!-- #endif -->
<block slot="list">
<view class="order-list" v-if="orderList.length > 0">
<view class="order-item" v-for="(orderItem, orderIndex) in orderList" :key="orderIndex">
<view class="order-header"
:class="{ waitpay: orderStatus == 'waitpay' && orderItem.order_status == 0 }">
<!-- <view class="iconfont"
:class="$util.inArray(orderItem.order_id, mergePayOrder) == -1 ? 'icon-yuan_checkbox' : 'icon-yuan_checked color-base-text'"
@click="selectOrder(orderItem.order_id, orderItem.pay_money)"
v-if="orderStatus == 'waitpay' && orderItem.order_status == 0"></view> -->
<text class="order-no">订单号:{{ orderItem.order_no }}</text>
<text class="order-type-name">{{ orderItem.order_type_name }}</text>
<text class="status-name">{{ orderItem.order_status_name }}</text>
</view>
<view class="order-body" @click="orderDetail(orderItem)">
<block v-if="orderItem.order_goods.length == 1">
<view class="goods-wrap" v-for="(goodsItem, goodsIndex) in orderItem.order_goods"
:key="goodsIndex">
<view class="goods-img">
<image :src="$util.img(goodsItem.sku_image, { size: 'mid' })"
@error="imageError(orderIndex, goodsIndex)" mode="aspectFill"
:lazy-load="true" show-menu-by-longpress/>
</view>
<view class="goods-info">
<view class="pro-info">
<view class="goods-name" v-if="goodsItem.goods_class == 2">{{
goodsItem.goods_name }}</view>
<view class="goods-name" v-else>{{ goodsItem.sku_name }}</view>
<view class="sku" v-if="goodsItem.sku_spec_format">
<view class="goods-spec">
<block v-for="(x, i) in goodsItem.sku_spec_format" :key="i">
{{ x.spec_value_name }}
{{ i < goodsItem.sku_spec_format.length - 1 ? '; ' : '' }}
</block>
</view>
</view>
</view>
<!-- <view class="goods-sub-section">
<text class="goods-price">
<text class="unit price-style small">{{ $lang('common.currencySymbol') }}</text>
<text class="price-style large">{{ parseFloat(goodsItem.price).toFixed(2).split(".")[0] }}</text>
<text class="unit price-style small">.{{ parseFloat(goodsItem.price).toFixed(2).split(".")[1] }}</text>
</text>
<text class="goods-num">
<text class="iconfont icon-close"></text>
{{ goodsItem.num }}
</text>
</view> -->
<view class="goods-action"><!-- <view class="action-btn">加购物车</view> -->
</view>
</view>
</view>
</block>
<block v-else>
<view class="multi-order-goods">
<scroll-view scroll-x="true" class="scroll-view">
<view class="goods-wrap">
<view class="goods-img"
v-for="(goodsItem, goodsIndex) in orderItem.order_goods"
:key="goodsIndex">
<image :src="$util.img(goodsItem.sku_image, { size: 'mid' })"
@error="imageError(orderIndex, goodsIndex)" mode="aspectFill"
:lazy-load="true" show-menu-by-longpress/>
</view>
</view>
</scroll-view>
<view class="shade">
<image :src="$util.img('public/uniapp/order/order-shade.png')" show-menu-by-longpress></image>
</view>
</view>
</block>
</view>
<view class="order-footer">
<view class="order-base-info">
<view class="total">
<text class="font-size-sub">共{{ orderItem.goods_num }}件商品</text>
<text class="align-right font-size-base">
实付款:
<text class="font-size-base price-font">{{ $lang('common.currencySymbol')
}}{{ orderItem.order_money }}</text>
</text>
</view>
</view>
<view class="order-action" v-if="orderItem.action.length > 0">
<view class="order-time" v-if="orderItem.order_status == 0" id="action-date">
<image :src="$util.img('public/uniapp/order/time.png')" show-menu-by-longpress></image>
剩余时间:
<uni-count-down :day="orderItem.discountTimeMachine.d"
:hour="orderItem.discountTimeMachine.h"
:minute="orderItem.discountTimeMachine.i"
:second="orderItem.discountTimeMachine.s" color="#FF4644"
splitorColor="#FF4644" />
</view>
<view class="order-box-btn"
v-if="evaluateConfig.evaluate_status == 1 && orderItem.is_evaluate == 1"
@click="operation('memberOrderEvaluation', orderItem)">
<text v-if="orderItem.evaluate_status == 0">评价</text>
<text v-else-if="orderItem.evaluate_status == 1">追评</text>
</view>
<view class="order-box-btn"
:class="{ 'color-base-border color-base-bg': operationItem.action == 'orderPay' }"
v-for="(operationItem, operationIndex) in orderItem.action"
:key="operationIndex" @click="operation(operationItem.action, orderItem)">
{{ operationItem.title }}
</view>
</view>
<view class="order-action"
v-else-if="orderItem.action.length == 0 && orderItem.is_evaluate == 1 && evaluateConfig.evaluate_status == 1">
<view class="order-box-btn" v-if="orderItem.is_evaluate == 1"
@click="operation('memberOrderEvaluation', orderItem)">
<text v-if="orderItem.evaluate_status == 0">评价</text>
<text v-else-if="orderItem.evaluate_status == 1">追评</text>
</view>
</view>
<view class="order-action" v-else>
<view class="order-box-btn" @click="orderDetail(orderItem)">查看详情</view>
</view>
</view>
</view>
</view>
<view v-else><ns-empty :isIndex="false" :text="$lang('emptyTips')"></ns-empty></view>
</block>
<!--#ifndef MP -->
</mescroll-uni>
<!--#endif -->
<!-- <view class="order-batch-action" :class="{ 'bottom-safe-area': isIphoneX }" v-if="mergePayOrder.length">
<view class="action-btn color-base-text color-base-border" @click="mergePay()">合并付款</view>
</view> -->
<!-- 选择支付方式弹窗 -->
<ns-payment ref="choosePaymentPopup"></ns-payment>
<ns-payment ref="choosePaymentMergePopup"></ns-payment>
<!-- #ifdef MP -->
</mescroll-uni>
<!-- #endif -->
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
<!-- 底部tabBar -->
<view id="tab-bar">
<diy-bottom-nav></diy-bottom-nav>
</view>
</view>
</template>
<script>
import orderMethod from './public/js/orderMethod.js';
export default {
data() {
return {
scrollInto: '',
orderStatus: 'all',
statusList: [],
orderList: [],
contentText: {},
mergePayOrder: [],
isIphoneX: false,
evaluateConfig: {
evaluate_audit: 1,
evaluate_show: 0,
evaluate_status: 1
},
orderData: {},
payMoney: 0,
payMoneyMerge: 0,
order_id: 0,
searchText: "",
pageText: "",
payConfig: null,
isTradeManaged: false // 检测微信小程序是否已开通发货信息管理服务
};
},
mixins: [orderMethod],
onLoad(option) {
if (option.status) this.orderStatus = option.status;
if (option.order_id) this.order_id = option.order_id;
},
onShow() {
this.isIphoneX = this.$util.uniappIsIPhoneX();
this.getEvaluateConfig();
this.getOrderStatus();
if (this.storeToken) {
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
} else {
this.$nextTick(() => {
this.$refs?.login?.open('/pages_order/list?status=' + this.orderStatus, 'redirectTo');
})
}
},
onUnload() {
if (!this.storeToken && this.$refs.login) this.$refs.login.cancelCompleteInfo();
},
methods: {
ontabtap(e) {
let index = e.target.dataset.current || e.currentTarget.dataset.current;
this.orderStatus = this.statusList[index].status;
if (this.orderStatus == '') this.mergePayOrder = [];
this.$refs.loadingCover.show();
this.$refs.mescroll.refresh();
},
getListData(mescroll) {
this.$api.sendRequest({
url: '/api/order/lists',
data: {
page: mescroll.num,
page_size: mescroll.size,
order_status: this.orderStatus,
order_id: this.order_id,
searchText: this.pageText
},
success: res => {
let newArr = [];
let msg = res.message;
let auto_close = 0
if (res.code == 0 && res.data) {
newArr = res.data.list;
auto_close = res.data.auto_close;
this.payConfig = res.data.pay_config;
this.isTradeManaged = res.data.is_trade_managed;
} else {
this.$util.showToast({
title: msg
});
}
mescroll.endSuccess(newArr.length);
//设置列表数据
if (mescroll.num == 1) {
this.orderList = []; //如果是第一页需手动制空列表
this.order_id = 0
}
this.orderList = this.orderList.concat(newArr); //追加新数据
let date = (Date.parse(new Date())) / 1000
this.orderList.forEach(v => {
v.discountTimeMachine = this.$util.countDown((v.create_time + auto_close) - date);
v.order_goods.forEach(vo => {
if (vo.sku_spec_format) {
try {
vo.sku_spec_format = JSON.parse(vo.sku_spec_format);
} catch (e) {
vo.sku_spec_format = vo.sku_spec_format;
}
} else {
vo.sku_spec_format = [];
}
});
});
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
/**
* 获取订单状态
*/
getOrderStatus() {
this.statusList = [{
status: 'all',
name: '全部',
id: 'status_0'
},
{
status: 'waitpay',
name: '待付款',
id: 'status_1'
},
{
status: 'waitsend',
name: '待发货',
id: 'status_2'
},
{
status: 'waitconfirm',
name: '待收货',
id: 'status_3'
},
{
status: 'waitrate',
name: '已完成',
id: 'status_4'
},
/*{
status: 'wait_use',
name: '待使用',
id: 'status_4'
}*/
];
},
operation(action, orderData) {
let index = this.status;
switch (action) {
case 'orderPay': // 支付
this.orderData = orderData;
this.payMoney = parseFloat(orderData.pay_money);
this.orderPay(orderData);
break;
case 'orderClose': //关闭
this.orderClose(orderData.order_id, () => {
this.$refs.mescroll.refresh();
});
break;
case 'memberTakeDelivery': //收货
this.orderData = orderData;
this.orderData.pay_config = {};
this.orderData.pay_config.mch_id = this.payConfig.mch_id;
this.orderData.is_trade_managed = this.isTradeManaged;
this.orderDelivery(this.orderData, () => {
this.$refs.mescroll.refresh();
});
break;
case 'trace': //查看物流
this.$util.redirectTo('/pages_tool/order/logistics', {
order_id: orderData.order_id
});
break;
case 'memberOrderEvaluation': //评价
this.$util.redirectTo('/pages_tool/order/evaluate', {
order_id: orderData.order_id
});
break;
case 'memberVirtualTakeDelivery':
this.orderData = orderData;
this.orderData.pay_config = {};
this.orderData.pay_config.mch_id = this.payConfig.mch_id;
this.orderData.is_trade_managed = this.isTradeManaged;
this.orderVirtualDelivery(this.orderData, () => {
this.$refs.mescroll.refresh();
});
break;
}
},
orderDetail(data) {
switch (parseInt(data.order_type)) {
case 2:
// 自提订单
this.$util.redirectTo('/pages_order/detail_pickup', {
order_id: data.order_id
});
break;
case 3:
// 本地配送订单
this.$util.redirectTo('/pages_order/detail_local_delivery', {
order_id: data.order_id
});
break;
case 4:
// 虚拟订单
this.$util.redirectTo('/pages_tool/order/detail_virtual', {
order_id: data.order_id
});
break;
default:
this.$util.redirectTo('/pages_order/detail', {
order_id: data.order_id
});
break;
}
},
/**
* 选择订单
* @param {Object} orderId
*/
selectOrder(orderId, pay_money) {
if (this.$util.inArray(orderId, this.mergePayOrder) != -1) {
this.mergePayOrder.splice(this.$util.inArray(orderId, this.mergePayOrder), 1);
this.payMoneyMerge -= parseFloat(pay_money);
} else {
this.payMoneyMerge += parseFloat(pay_money);
this.mergePayOrder.push(orderId);
}
},
/**
* 合并支付
*/
mergePay() {
if (this.mergePayOrder.length) {
this.$api.sendRequest({
url: '/api/order/pay',
data: {
order_ids: this.mergePayOrder.toString()
},
success: res => {
if (res.code >= 0) {
this.$refs.choosePaymentMergePopup.getPayInfo(res.data);
} else {
this.$util.showToast({
title: res.message
});
}
}
});
}
},
imageError(orderIndex, goodsIndex) {
this.orderList[orderIndex].order_goods[goodsIndex].sku_image = this.$util.getDefaultImage().goods;
this.$forceUpdate();
},
getEvaluateConfig() {
this.$api.sendRequest({
url: '/api/goodsevaluate/config',
success: res => {
if (res.code == 0) {
var data = res.data;
this.evaluateConfig = data;
}
}
});
},
search() {
this.pageText = this.searchText;
this.$refs.mescroll.refresh();
}
},
computed: {
mpOrderList() {
if (!this.orderList[this.status]) return;
return this.orderList[this.status].list || [];
}
},
watch: {
storeToken: function (nVal, oVal) {
if (nVal) {
this.$refs.mescroll.refresh();
}
}
}
};
</script>
<style lang="scss">
@import './public/css/list.scss';
</style>
<style lang="scss" scoped>
::v-deep .uni-page {
overflow: hidden;
}
::v-deep .mescroll-upwarp {
padding-bottom: 100rpx;
}
<template>
<view class="order-container" :style="themeColor">
<view class="cate-search">
<view class="search-box">
<input class="uni-input" maxlength="50" v-model="searchText" confirm-type="search"
placeholder=$lang("order.list.l6") @confirm="search()" @click.stop="search()" @tap.stop="search()" />
<text class="iconfont icon-sousuo3" @click.stop="search()" @tap.stop="search()"></text>
</view>
</view>
<view class="order-nav" v-if="storeToken">
<view v-for="(statusItem, statusIndex) in statusList" :key="statusIndex" class="uni-tab-item"
:id="statusItem.id" :data-current="statusIndex" @click="ontabtap">
<text class="uni-tab-item-title"
:class="statusItem.status == orderStatus ? 'uni-tab-item-title-active color-base-text' : ''">
{{ statusItem.name }}
</text>
</view>
</view>
<!-- #ifdef MP -->
<mescroll-uni ref="mescroll" @getData="getListData" top="176rpx" v-if="storeToken" :style="tabBarPagePaddingStyle">
<!-- #endif -->
<!-- #ifndef MP -->
<mescroll-uni ref="mescroll" @getData="getListData" top="196rpx" v-if="storeToken" :style="tabBarPagePaddingStyle">
<!-- #endif -->
<block slot="list">
<view class="order-list" v-if="orderList.length > 0">
<view class="order-item" v-for="(orderItem, orderIndex) in orderList" :key="orderIndex">
<view class="order-header"
:class="{ waitpay: orderStatus == 'waitpay' && orderItem.order_status == 0 }">
<!-- <view class="iconfont"
:class="$util.inArray(orderItem.order_id, mergePayOrder) == -1 ? 'icon-yuan_checkbox' : 'icon-yuan_checked color-base-text'"
@click="selectOrder(orderItem.order_id, orderItem.pay_money)"
v-if="orderStatus == 'waitpay' && orderItem.order_status == 0"></view> -->
<text class="order-no">{ $lang("order.list.l35") } orderItem.order_no }}</text>
<text class="order-type-name">{{ orderItem.order_type_name }}</text>
<text class="status-name">{{ orderItem.order_status_name }}</text>
</view>
<view class="order-body" @click="orderDetail(orderItem)">
<block v-if="orderItem.order_goods.length == 1">
<view class="goods-wrap" v-for="(goodsItem, goodsIndex) in orderItem.order_goods"
:key="goodsIndex">
<view class="goods-img">
<image :src="$util.img(goodsItem.sku_image, { size: 'mid' })"
@error="imageError(orderIndex, goodsIndex)" mode="aspectFill"
:lazy-load="true" show-menu-by-longpress/>
</view>
<view class="goods-info">
<view class="pro-info">
<view class="goods-name" v-if="goodsItem.goods_class == 2">{{
goodsItem.goods_name }}</view>
<view class="goods-name" v-else>{{ goodsItem.sku_name }}</view>
<view class="sku" v-if="goodsItem.sku_spec_format">
<view class="goods-spec">
<block v-for="(x, i) in goodsItem.sku_spec_format" :key="i">
{{ x.spec_value_name }}
{{ i < goodsItem.sku_spec_format.length - 1 ? '; ' : '' }}
</block>
</view>
</view>
</view>
<!-- <view class="goods-sub-section">
<text class="goods-price">
<text class="unit price-style small">{{ $lang('common.currency_symbol') }}</text>
<text class="price-style large">{{ parseFloat(goodsItem.price).toFixed(2).split(".")[0] }}</text>
<text class="unit price-style small">.{{ parseFloat(goodsItem.price).toFixed(2).split(".")[1] }}</text>
</text>
<text class="goods-num">
<text class="iconfont icon-close"></text>
{{ goodsItem.num }}
</text>
</view> -->
<view class="goods-action"><!-- <view class="action-btn">{{ $lang("order.list.l74") }}</view> -->
</view>
</view>
</view>
</block>
<block v-else>
<view class="multi-order-goods">
<scroll-view scroll-x="true" class="scroll-view">
<view class="goods-wrap">
<view class="goods-img"
v-for="(goodsItem, goodsIndex) in orderItem.order_goods"
:key="goodsIndex">
<image :src="$util.img(goodsItem.sku_image, { size: 'mid' })"
@error="imageError(orderIndex, goodsIndex)" mode="aspectFill"
:lazy-load="true" show-menu-by-longpress/>
</view>
</view>
</scroll-view>
<view class="shade">
<image :src="$util.img('public/uniapp/order/order-shade.png')" show-menu-by-longpress></image>
</view>
</view>
</block>
</view>
<view class="order-footer">
<view class="order-base-info">
<view class="total">
<text class="font-size-sub">{ $lang("goods.cart.l8") } orderItem.goods_num }}件商品</text>
<text class="align-right font-size-base">
实付款:
<text class="font-size-base price-font">{{ $lang('common.currency_symbol')
}}{{ orderItem.order_money }}</text>
</text>
</view>
</view>
<view class="order-action" v-if="orderItem.action.length > 0">
<view class="order-time" v-if="orderItem.order_status == 0" id="action-date">
<image :src="$util.img('public/uniapp/order/time.png')" show-menu-by-longpress></image>
剩余时间:
<uni-count-down :day="orderItem.discountTimeMachine.d"
:hour="orderItem.discountTimeMachine.h"
:minute="orderItem.discountTimeMachine.i"
:second="orderItem.discountTimeMachine.s" color="#FF4644"
splitorColor="#FF4644" />
</view>
<view class="order-box-btn"
v-if="evaluateConfig.evaluate_status == 1 && orderItem.is_evaluate == 1"
@click="operation('memberOrderEvaluation', orderItem)">
<text v-if="orderItem.evaluate_status == 0">{{ $lang("order.detail.l601") }}</text>
<text v-else-if="orderItem.evaluate_status == 1">{{ $lang("order.detail.l602") }}</text>
</view>
<view class="order-box-btn"
:class="{ 'color-base-border color-base-bg': operationItem.action == 'orderPay' }"
v-for="(operationItem, operationIndex) in orderItem.action"
:key="operationIndex" @click="operation(operationItem.action, orderItem)">
{{ operationItem.title }}
</view>
</view>
<view class="order-action"
v-else-if="orderItem.action.length == 0 && orderItem.is_evaluate == 1 && evaluateConfig.evaluate_status == 1">
<view class="order-box-btn" v-if="orderItem.is_evaluate == 1"
@click="operation('memberOrderEvaluation', orderItem)">
<text v-if="orderItem.evaluate_status == 0">{{ $lang("order.detail.l601") }}</text>
<text v-else-if="orderItem.evaluate_status == 1">{{ $lang("order.detail.l602") }}</text>
</view>
</view>
<view class="order-action" v-else>
<view class="order-box-btn" @click="orderDetail(orderItem)">{{ $lang("order.list.l141") }}</view>
</view>
</view>
</view>
</view>
<view v-else><ns-empty :isIndex="false" :text="$lang('common.empty.default')"></ns-empty></view>
</block>
<!--#ifndef MP -->
</mescroll-uni>
<!--#endif -->
<!-- <view class="order-batch-action" :class="{ 'bottom-safe-area': isIphoneX }" v-if="mergePayOrder.length">
<view class="action-btn color-base-text color-base-border" @click="mergePay()">{{ $lang("order.list.l152") }}</view>
</view> -->
<!-- 选择支付方式弹窗 -->
<ns-payment ref="choosePaymentPopup"></ns-payment>
<ns-payment ref="choosePaymentMergePopup"></ns-payment>
<!-- #ifdef MP -->
</mescroll-uni>
<!-- #endif -->
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
<!-- 底部tabBar -->
<view id="tab-bar">
<diy-bottom-nav></diy-bottom-nav>
</view>
</view>
</template>
<script>
import orderMethod from './public/js/orderMethod.js';
export default {
data() {
return {
scrollInto: '',
orderStatus: 'all',
statusList: [],
orderList: [],
contentText: {},
mergePayOrder: [],
isIphoneX: false,
evaluateConfig: {
evaluate_audit: 1,
evaluate_show: 0,
evaluate_status: 1
},
orderData: {},
payMoney: 0,
payMoneyMerge: 0,
order_id: 0,
searchText: "",
pageText: "",
payConfig: null,
isTradeManaged: false // 检测微信小程序是否已开通发货信息管理服务
};
},
mixins: [orderMethod],
onLoad(option) {
if (option.status) this.orderStatus = option.status;
if (option.order_id) this.order_id = option.order_id;
},
onShow() {
this.isIphoneX = this.$util.uniappIsIPhoneX();
this.getEvaluateConfig();
this.getOrderStatus();
if (this.storeToken) {
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
} else {
this.$nextTick(() => {
this.$refs?.login?.open('/pages_order/list?status=' + this.orderStatus, 'redirectTo');
})
}
},
onUnload() {
if (!this.storeToken && this.$refs.login) this.$refs.login.cancelCompleteInfo();
},
methods: {
ontabtap(e) {
let index = e.target.dataset.current || e.currentTarget.dataset.current;
this.orderStatus = this.statusList[index].status;
if (this.orderStatus == '') this.mergePayOrder = [];
this.$refs.loadingCover.show();
this.$refs.mescroll.refresh();
},
getListData(mescroll) {
this.$api.sendRequest({
url: '/api/order/lists',
data: {
page: mescroll.num,
page_size: mescroll.size,
order_status: this.orderStatus,
order_id: this.order_id,
searchText: this.pageText
},
success: res => {
let newArr = [];
let msg = res.message;
let auto_close = 0
if (res.code == 0 && res.data) {
newArr = res.data.list;
auto_close = res.data.auto_close;
this.payConfig = res.data.pay_config;
this.isTradeManaged = res.data.is_trade_managed;
} else {
this.$util.showToast({
title: msg
});
}
mescroll.endSuccess(newArr.length);
//设置列表数据
if (mescroll.num == 1) {
this.orderList = []; //如果是第一页需手动制空列表
this.order_id = 0
}
this.orderList = this.orderList.concat(newArr); //追加新数据
let date = (Date.parse(new Date())) / 1000
this.orderList.forEach(v => {
v.discountTimeMachine = this.$util.countDown((v.create_time + auto_close) - date);
v.order_goods.forEach(vo => {
if (vo.sku_spec_format) {
try {
vo.sku_spec_format = JSON.parse(vo.sku_spec_format);
} catch (e) {
vo.sku_spec_format = vo.sku_spec_format;
}
} else {
vo.sku_spec_format = [];
}
});
});
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
/**
* 获取订单状态
*/
getOrderStatus() {
this.statusList = [{
status: 'all',
name: $lang('diy.diy-category-item.l47.t0'),
id: 'status_0'
},
{
status: 'waitpay',
name: $lang('order.list.l297'),
id: 'status_1'
},
{
status: 'waitsend',
name: $lang('order.list.l302'),
id: 'status_2'
},
{
status: 'waitconfirm',
name: $lang('order.list.l307'),
id: 'status_3'
},
{
status: 'waitrate',
name: $lang('order.detail_point.l14'),
id: 'status_4'
},
/*{
status: 'wait_use',
name: $lang('order.list.l317'),
id: 'status_4'
}*/
];
},
operation(action, orderData) {
let index = this.status;
switch (action) {
case 'orderPay': // 支付
this.orderData = orderData;
this.payMoney = parseFloat(orderData.pay_money);
this.orderPay(orderData);
break;
case 'orderClose': //关闭
this.orderClose(orderData.order_id, () => {
this.$refs.mescroll.refresh();
});
break;
case 'memberTakeDelivery': //收货
this.orderData = orderData;
this.orderData.pay_config = {};
this.orderData.pay_config.mch_id = this.payConfig.mch_id;
this.orderData.is_trade_managed = this.isTradeManaged;
this.orderDelivery(this.orderData, () => {
this.$refs.mescroll.refresh();
});
break;
case 'trace': //查看物流
this.$util.redirectTo('/pages_tool/order/logistics', {
order_id: orderData.order_id
});
break;
case 'memberOrderEvaluation': //评价
this.$util.redirectTo('/pages_tool/order/evaluate', {
order_id: orderData.order_id
});
break;
case 'memberVirtualTakeDelivery':
this.orderData = orderData;
this.orderData.pay_config = {};
this.orderData.pay_config.mch_id = this.payConfig.mch_id;
this.orderData.is_trade_managed = this.isTradeManaged;
this.orderVirtualDelivery(this.orderData, () => {
this.$refs.mescroll.refresh();
});
break;
}
},
orderDetail(data) {
switch (parseInt(data.order_type)) {
case 2:
// 自提订单
this.$util.redirectTo('/pages_order/detail_pickup', {
order_id: data.order_id
});
break;
case 3:
// 本地配送订单
this.$util.redirectTo('/pages_order/detail_local_delivery', {
order_id: data.order_id
});
break;
case 4:
// 虚拟订单
this.$util.redirectTo('/pages_tool/order/detail_virtual', {
order_id: data.order_id
});
break;
default:
this.$util.redirectTo('/pages_order/detail', {
order_id: data.order_id
});
break;
}
},
/**
* 选择订单
* @param {Object} orderId
*/
selectOrder(orderId, pay_money) {
if (this.$util.inArray(orderId, this.mergePayOrder) != -1) {
this.mergePayOrder.splice(this.$util.inArray(orderId, this.mergePayOrder), 1);
this.payMoneyMerge -= parseFloat(pay_money);
} else {
this.payMoneyMerge += parseFloat(pay_money);
this.mergePayOrder.push(orderId);
}
},
/**
* 合并支付
*/
mergePay() {
if (this.mergePayOrder.length) {
this.$api.sendRequest({
url: '/api/order/pay',
data: {
order_ids: this.mergePayOrder.toString()
},
success: res => {
if (res.code >= 0) {
this.$refs.choosePaymentMergePopup.getPayInfo(res.data);
} else {
this.$util.showToast({
title: res.message
});
}
}
});
}
},
imageError(orderIndex, goodsIndex) {
this.orderList[orderIndex].order_goods[goodsIndex].sku_image = this.$util.getDefaultImage().goods;
this.$forceUpdate();
},
getEvaluateConfig() {
this.$api.sendRequest({
url: '/api/goodsevaluate/config',
success: res => {
if (res.code == 0) {
var data = res.data;
this.evaluateConfig = data;
}
}
});
},
search() {
this.pageText = this.searchText;
this.$refs.mescroll.refresh();
}
},
computed: {
mpOrderList() {
if (!this.orderList[this.status]) return;
return this.orderList[this.status].list || [];
}
},
watch: {
storeToken: function (nVal, oVal) {
if (nVal) {
this.$refs.mescroll.refresh();
}
}
}
};
</script>
<style lang="scss">
@import './public/css/list.scss';
</style>
<style lang="scss" scoped>
::v-deep .uni-page {
overflow: hidden;
}
::v-deep .mescroll-upwarp {
padding-bottom: 100rpx;
}
</style>

View File

@@ -1,109 +1,109 @@
<template>
<view :style="themeColor">
<common-payment :api="api" create-data-key="orderCreateData" ref="payment"></common-payment>
</view>
</template>
<script>
import commonPayment from './_components/common-payment/common-payment.vue';
export default {
components: {
commonPayment
},
data() {
return {
api: {
payment: '/api/ordercreate/payment',
calculate: '/api/ordercreate/calculate',
create: '/api/ordercreate/create',
}
}
},
provide() {
return {
promotion: this.promotion.bind(this)
}
},
onShow() {
if (this.$refs.payment) this.$refs.payment.pageShow();
},
methods: {
/**
* 处理活动信息 如不需要则定义为空方法
*/
promotion(data){
if (data.promotion && data.promotion.manjian && data.promotion.manjian.length) {
let promotionStr = {title: `满减送`, content: ''}
data.promotion.manjian.forEach((mItem,mIndex)=>{
let promotion = '';
let content = {};
let limit = mItem.type == 0 ? '元' : '件';
if(mItem.rule){
var item = mItem.discount_array.rule;
item.limit = mItem.type == 0 ? parseFloat(item.limit).toFixed(2) : parseInt(item.limit);
// 满减
if (item.discount_money != undefined) {
if (content.manjian == undefined) {
content.manjian = '购买可享受满' + item.limit + limit + '减' + item.discount_money + '元';
} else {
content.manjian += ';满' + item.limit + limit + '减' + item.discount_money + '元';
}
}
// 满送优惠券
if (item.coupon && item.coupon_list) {
let text = '';
item.coupon_list.forEach((couponItem, couponIndex) => {
if (couponItem.type == 'discount') {
if (text == '') text = '送'+ couponItem.give_num +'张' + parseFloat(couponItem.discount) + '折优惠券';
else text += '、送'+ couponItem.give_num +'张' + parseFloat(couponItem.discount) + '折优惠券';
} else {
if (text == '') text = '送'+ couponItem.give_num +'张' + parseFloat(couponItem.money) + '元优惠券';
else text += '、送'+ couponItem.give_num +'张' + parseFloat(couponItem.money) + '元优惠券';
}
})
if (content.mansong == undefined) {
content.mansong = '购物满' + item.limit + limit + text;
} else {
content.mansong += ';' + '满' + item.limit + limit + text;
}
}
// 满送积分
if (item.point) {
let point_text = '可得' + item.point + '积分';
if(content.point_text == undefined) {
content.point_text = '购物满' + item.limit + limit + point_text
}else {
content.point_text += ';' + '满' + item.limit + limit + point_text;
}
}
// 包邮
if (item.free_shipping != undefined) {
if (content.free_shipping == undefined) {
content.free_shipping = '购物满' + item.limit + limit + '包邮';
}
}
}
promotion = Object.values(content).join('\n');
promotionStr.content = promotionStr.content + promotion + '\n';
})
return (promotionStr.content ? promotionStr : null);
}
}
}
};
</script>
<style scoped lang="scss">
::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>
<template>
<view :style="themeColor">
<common-payment :api="api" create-data-key="orderCreateData" ref="payment"></common-payment>
</view>
</template>
<script>
import commonPayment from './_components/common-payment/common-payment.vue';
export default {
components: {
commonPayment
},
data() {
return {
api: {
payment: '/api/ordercreate/payment',
calculate: '/api/ordercreate/calculate',
create: '/api/ordercreate/create',
}
}
},
provide() {
return {
promotion: this.promotion.bind(this)
}
},
onShow() {
if (this.$refs.payment) this.$refs.payment.pageShow();
},
methods: {
/**
* 处理活动信息 如不需要则定义为空方法
*/
promotion(data){
if (data.promotion && data.promotion.manjian && data.promotion.manjian.length) {
let promotionStr = {title: $lang(`order.payment.l37.t0`), content: ''}
data.promotion.manjian.forEach((mItem,mIndex)=>{
let promotion = '';
let content = {};
let limit = mItem.type == 0 ? '元' : $lang('common.ns-goods-sku.ns-goods-sku-index.l150.t0');
if(mItem.rule){
var item = mItem.discount_array.rule;
item.limit = mItem.type == 0 ? parseFloat(item.limit).toFixed(2) : parseInt(item.limit);
// 满减
if (item.discount_money != undefined) {
if (content.manjian == undefined) {
content.manjian = $lang('order.payment.l48') + item.limit + limit + $lang('common.register-reward.l60.t2') + item.discount_money + $lang('common.register-reward.l45.t0');
} else {
content.manjian += $lang('goods.public.js.detail.l379') + item.limit + limit + $lang('common.register-reward.l60.t2') + item.discount_money + $lang('common.register-reward.l45.t0');
}
}
// 满送优惠券
if (item.coupon && item.coupon_list) {
let text = '';
item.coupon_list.forEach((couponItem, couponIndex) => {
if (couponItem.type == 'discount') {
if (text == '') text = '送'+ couponItem.give_num +'张' + parseFloat(couponItem.discount) + '折优惠券';
else text += $lang('goods.public.js.detail.l392')+ couponItem.give_num +$lang('goods.public.js.detail.l392') + parseFloat(couponItem.discount) + $lang('goods.public.js.detail.l392');
} else {
if (text == '') text = '送'+ couponItem.give_num +'张' + parseFloat(couponItem.money) + '元优惠券';
else text += $lang('goods.public.js.detail.l392')+ couponItem.give_num +$lang('goods.public.js.detail.l392') + parseFloat(couponItem.money) + $lang('goods.public.js.detail.l395');
}
})
if (content.mansong == undefined) {
content.mansong = $lang('order.payment.l66') + item.limit + limit + text;
} else {
content.mansong += ';' + $lang('diy.diy-coupon.l32.t0') + item.limit + limit + text;
}
}
// 满送积分
if (item.point) {
let point_text = $lang('order.payment.l73') + item.point + $lang('common.register-reward.l19.t0');
if(content.point_text == undefined) {
content.point_text = $lang('order.payment.l66') + item.limit + limit + point_text
}else {
content.point_text += ';' + $lang('diy.diy-coupon.l32.t0') + item.limit + limit + point_text;
}
}
// 包邮
if (item.free_shipping != undefined) {
if (content.free_shipping == undefined) {
content.free_shipping = $lang('order.payment.l66') + item.limit + limit + $lang('goods.detail.l383');
}
}
}
promotion = Object.values(content).join('\n');
promotionStr.content = promotionStr.content + promotion + '\n';
})
return (promotionStr.content ? promotionStr : null);
}
}
}
};
</script>
<style scoped lang="scss">
::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>

View File

@@ -1,261 +1,261 @@
export default {
methods: {
/**
* 订单支付
* @param {Object} orderData
*/
orderPay(orderData) {
if (orderData.adjust_money == 0) {
this.pay();
} else {
uni.showModal({
title: '提示',
content: '商家已将支付金额调整为' + orderData.pay_money + '元,是否继续支付?',
success: res => {
if (res.confirm) {
this.pay();
}
}
})
}
},
pay() {
this.$api.sendRequest({
url: '/api/order/pay',
data: {
order_ids: this.orderData.order_id
},
success: res => {
if (res.code >= 0) {
this.$refs.choosePaymentPopup.getPayInfo(res.data);
} else {
this.$util.showToast({
title: res.message
});
}
}
})
},
/**
* 关闭订单
* @param order_id
* @param callback
*/
orderClose(order_id, callback) {
uni.showModal({
title: '提示',
content: '您确定要关闭该订单吗?',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/close',
data: {
order_id
},
success: res => {
if (res.code >= 0) {
typeof callback == 'function' && callback();
} else {
this.$util.showToast({
title: '当前订单可能存在拼团,维权等操作,' + res.message +
'不可以关闭哦!',
duration: 2000
})
}
}
})
}
}
})
},
/**
* 订单收货
* @param orderData
* @param callback
*/
orderDelivery(orderData, callback) {
// 如果不在微信小程序中
// #ifndef MP-WEIXIN
uni.showModal({
title: '提示',
content: '您确定已经收到货物了吗?',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/takedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
}
})
// #endif
// #ifdef MP-WEIXIN
// 检测微信小程序是否已开通发货信息管理服务
if (orderData.pay_type == 'wechatpay' && wx.openBusinessView && orderData.is_trade_managed) {
wx.openBusinessView({
businessType: 'weappOrderConfirm',
extraData: {
merchant_id: orderData.pay_config.mch_id,
merchant_trade_no: orderData.out_trade_no
},
success: res => {
if (res.extraData.status == 'success') {
this.$api.sendRequest({
url: '/api/order/takedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
} else {
this.$api.sendRequest({
url: '/api/order/takedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
},
fail: function(res) {
}
})
} else {
uni.showModal({
title: '提示',
content: '您确定已经收到货物了吗?',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/takedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
}
})
}
// #endif
},
/**
* 订单虚拟商品收货
* @param orderData
* @param callback
*/
orderVirtualDelivery(orderData, callback) {
// 如果不在微信小程序中
// #ifndef MP-WEIXIN
uni.showModal({
title: '提示',
content: '您确定要进行收货吗?',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/membervirtualtakedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
},
})
// #endif
// #ifdef MP-WEIXIN
// 检测微信小程序是否已开通发货信息管理服务
if (orderData.pay_type == 'wechatpay' && wx.openBusinessView && orderData.is_trade_managed) {
wx.openBusinessView({
businessType: 'weappOrderConfirm',
extraData: {
merchant_id: orderData.pay_config.mch_id,
merchant_trade_no: orderData.out_trade_no
},
success: res => {
if (res.extraData.status == 'success') {
this.$api.sendRequest({
url: '/api/order/membervirtualtakedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
} else {
this.$api.sendRequest({
url: '/api/order/membervirtualtakedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
},
fail: function(res) {}
})
} else {
uni.showModal({
title: '提示',
content: '您确定要进行收货吗?',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/membervirtualtakedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
},
})
}
// #endif
},
}
export default {
methods: {
/**
* 订单支付
* @param {Object} orderData
*/
orderPay(orderData) {
if (orderData.adjust_money == 0) {
this.pay();
} else {
uni.showModal({
title: $lang('common.wxwork-contact.l202.t0'),
content: $lang('order.public.js.order_method.l13') + orderData.pay_money + $lang('order.public.js.order_method.l13'),
success: res => {
if (res.confirm) {
this.pay();
}
}
})
}
},
pay() {
this.$api.sendRequest({
url: '/api/order/pay',
data: {
order_ids: this.orderData.order_id
},
success: res => {
if (res.code >= 0) {
this.$refs.choosePaymentPopup.getPayInfo(res.data);
} else {
this.$util.showToast({
title: res.message
});
}
}
})
},
/**
* 关闭订单
* @param order_id
* @param callback
*/
orderClose(order_id, callback) {
uni.showModal({
title: $lang('common.wxwork-contact.l202.t0'),
content: $lang('order.public.js.order_method.l47'),
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/close',
data: {
order_id
},
success: res => {
if (res.code >= 0) {
typeof callback == 'function' && callback();
} else {
this.$util.showToast({
title: $lang('order.public.js.order_method.l60') + res.message +
$lang('order.public.js.order_method.l61'),
duration: 2000
})
}
}
})
}
}
})
},
/**
* 订单收货
* @param orderData
* @param callback
*/
orderDelivery(orderData, callback) {
// 如果不在微信小程序中
// #ifndef MP-WEIXIN
uni.showModal({
title: $lang('common.wxwork-contact.l202.t0'),
content: $lang('order.public.js.order_method.l81'),
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/takedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
}
})
// #endif
// #ifdef MP-WEIXIN
// 检测微信小程序是否已开通发货信息管理服务
if (orderData.pay_type == 'wechatpay' && wx.openBusinessView && orderData.is_trade_managed) {
wx.openBusinessView({
businessType: 'weappOrderConfirm',
extraData: {
merchant_id: orderData.pay_config.mch_id,
merchant_trade_no: orderData.out_trade_no
},
success: res => {
if (res.extraData.status == 'success') {
this.$api.sendRequest({
url: '/api/order/takedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
} else {
this.$api.sendRequest({
url: '/api/order/takedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
},
fail: function(res) {
}
})
} else {
uni.showModal({
title: $lang('common.wxwork-contact.l202.t0'),
content: $lang('order.public.js.order_method.l81'),
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/takedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
}
})
}
// #endif
},
/**
* 订单虚拟商品收货
* @param orderData
* @param callback
*/
orderVirtualDelivery(orderData, callback) {
// 如果不在微信小程序中
// #ifndef MP-WEIXIN
uni.showModal({
title: $lang('common.wxwork-contact.l202.t0'),
content: $lang('order.public.js.order_method.l176'),
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/membervirtualtakedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
},
})
// #endif
// #ifdef MP-WEIXIN
// 检测微信小程序是否已开通发货信息管理服务
if (orderData.pay_type == 'wechatpay' && wx.openBusinessView && orderData.is_trade_managed) {
wx.openBusinessView({
businessType: 'weappOrderConfirm',
extraData: {
merchant_id: orderData.pay_config.mch_id,
merchant_trade_no: orderData.out_trade_no
},
success: res => {
if (res.extraData.status == 'success') {
this.$api.sendRequest({
url: '/api/order/membervirtualtakedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
} else {
this.$api.sendRequest({
url: '/api/order/membervirtualtakedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
},
fail: function(res) {}
})
} else {
uni.showModal({
title: $lang('common.wxwork-contact.l202.t0'),
content: $lang('order.public.js.order_method.l176'),
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/order/membervirtualtakedelivery',
data: {
order_id: orderData.order_id
},
success: res => {
this.$util.showToast({
title: res.message
})
typeof callback == 'function' && callback();
}
})
}
},
})
}
// #endif
},
}
}

View File

@@ -1,30 +1,30 @@
export default {
methods: {
/**
* 撤销退款申请
* @param {Object} order_goods_id
* @param {Object} callback
*/
cancleRefund(order_goods_id, callback) {
uni.showModal({
content: '撤销之后本次申请将会关闭,如后续仍有问题可再次发起申请。',
cancelText: '暂不撤销',
cancelColor: '#898989',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/orderrefund/cancel',
data: {
order_goods_id
},
success: res => {
typeof callback == 'function' && callback(res);
}
})
}
}
})
},
}
}
export default {
methods: {
/**
* 撤销退款申请
* @param {Object} order_goods_id
* @param {Object} callback
*/
cancleRefund(order_goods_id, callback) {
uni.showModal({
content: $lang('order.public.js.refund_method.l10'),
cancelText: $lang('order.public.js.refund_method.l11'),
cancelColor: '#898989',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/api/orderrefund/cancel',
data: {
order_goods_id
},
success: res => {
typeof callback == 'function' && callback(res);
}
})
}
}
})
},
}
}