1
This commit is contained in:
@ -157,14 +157,12 @@ export const createOrder = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 创建抖音订单
|
// 创建抖音订单
|
||||||
export const createCartOrder = ({
|
export const createCartOrder = ({ id }) => {
|
||||||
product_pic= "",
|
|
||||||
}) => {
|
|
||||||
return request({
|
return request({
|
||||||
url: CREATE_CART_ORDER,
|
url: CREATE_CART_ORDER,
|
||||||
method: "post",
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
orderId
|
id
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -58,7 +58,7 @@ export const CANCEL_PET_ORDER = '/order/pet/cancel'
|
|||||||
|
|
||||||
|
|
||||||
// 取消商城接口
|
// 取消商城接口
|
||||||
export const CANCEL_MALL_ORDER = '/product/order/cancel'
|
export const CANCEL_MALL_ORDER = '/douyin/goods/order/cancel'
|
||||||
|
|
||||||
// 卡包列表接口
|
// 卡包列表接口
|
||||||
export const USER_HolderList = '/membership/instances'
|
export const USER_HolderList = '/membership/instances'
|
||||||
|
|||||||
@ -1,187 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="refund-button-wrapper" :class="{ 'compact-mode': compact }" :style="wrapperStyle">
|
|
||||||
<view class="pay-button-container">
|
|
||||||
<pay-button-sdk
|
|
||||||
:mode="mode"
|
|
||||||
:order-status="orderStatus"
|
|
||||||
:order-id="orderId"
|
|
||||||
:refund-total-amount="refundTotalAmount"
|
|
||||||
@getgoodsinfo="handleGetGoodsInfo"
|
|
||||||
@placeorder="handlePlaceOrder"
|
|
||||||
@pay="handlePay"
|
|
||||||
@refund="handleRefund"
|
|
||||||
@error="handleError"
|
|
||||||
|
|
||||||
>
|
|
||||||
<text class="refund-text">退款</text>
|
|
||||||
</pay-button-sdk>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: "RefundButton",
|
|
||||||
props: {
|
|
||||||
// 模式:1-仅退款,2-退货退款
|
|
||||||
mode: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: '1'
|
|
||||||
},
|
|
||||||
// 订单状态:1-待发货,2-待收货,3-已完成
|
|
||||||
orderStatus: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: '1'
|
|
||||||
},
|
|
||||||
// 订单ID
|
|
||||||
orderId: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
// 退款总金额(单位:分)
|
|
||||||
refundTotalAmount: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
// 是否使用紧凑模式(适合订单列表页)
|
|
||||||
compact: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
wrapperStyle() {
|
|
||||||
if (!this.compact) {
|
|
||||||
return {
|
|
||||||
flex: '1',
|
|
||||||
width: '100%',
|
|
||||||
display: 'flex',
|
|
||||||
height: '48px'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 抖音官方组件生命周期回调 - 获取商品信息
|
|
||||||
handleGetGoodsInfo(e) {
|
|
||||||
console.log('抖音组件获取商品信息回调:', e.detail)
|
|
||||||
// 退款模式下不需要额外处理,直接返回成功即可
|
|
||||||
e.detail.success({
|
|
||||||
// 可根据实际业务补充商品信息
|
|
||||||
amount: this.refundTotalAmount
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 抖音官方组件生命周期回调 - 下单
|
|
||||||
handlePlaceOrder(e) {
|
|
||||||
console.log('抖音组件下单回调:', e.detail)
|
|
||||||
// 退款模式下不需要额外处理,直接返回成功即可
|
|
||||||
e.detail.success({
|
|
||||||
orderId: this.orderId
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 抖音官方组件生命周期回调 - 支付
|
|
||||||
handlePay(e) {
|
|
||||||
console.log('抖音组件支付回调:', e.detail)
|
|
||||||
// 退款模式下不需要额外处理,直接返回成功即可
|
|
||||||
e.detail.success()
|
|
||||||
},
|
|
||||||
|
|
||||||
// 退款成功回调
|
|
||||||
handleRefund(e) {
|
|
||||||
console.log('抖音退款组件退款成功回调:', e.detail)
|
|
||||||
this.$emit('refund', {
|
|
||||||
detail: {
|
|
||||||
status: 'success',
|
|
||||||
data: e.detail
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 错误回调
|
|
||||||
handleError(e) {
|
|
||||||
console.error('抖音退款组件错误回调:', e.detail)
|
|
||||||
this.$emit('error', {
|
|
||||||
detail: {
|
|
||||||
status: 'error',
|
|
||||||
message: e.detail.errMsg || '退款失败'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.refund-button-wrapper {
|
|
||||||
height: 73rpx !important;
|
|
||||||
border-radius: 100px;
|
|
||||||
border: 2rpx solid #FF19A0;
|
|
||||||
color: #FF19A0;
|
|
||||||
background: transparent;
|
|
||||||
display: flex !important;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: 14px;
|
|
||||||
overflow: hidden;
|
|
||||||
flex: 1 !important;
|
|
||||||
width: 100% !important;
|
|
||||||
min-width: 0 !important;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pay-button-container {
|
|
||||||
width: 100% !important;
|
|
||||||
height: 100% !important;
|
|
||||||
display: flex !important;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex: 1 !important;
|
|
||||||
min-width: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refund-button-sdk {
|
|
||||||
width: 100% !important;
|
|
||||||
height: 100% !important;
|
|
||||||
display: flex !important;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
box-sizing: border-box;
|
|
||||||
flex: 1 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 强制设置 pay-button-sdk 内部元素样式
|
|
||||||
::v-deep .pay-button-sdk {
|
|
||||||
width: 100% !important;
|
|
||||||
height: 100% !important;
|
|
||||||
min-width: 100% !important;
|
|
||||||
max-width: 100% !important;
|
|
||||||
flex: 1 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refund-text {
|
|
||||||
color: #FF19A0;
|
|
||||||
font-family: PingFang SC;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refund-button-wrapper.compact-mode {
|
|
||||||
width: 70px;
|
|
||||||
height: 34px;
|
|
||||||
border-radius: 64rpx;
|
|
||||||
border: 1px solid #FF19A0;
|
|
||||||
margin-left: 20rpx;
|
|
||||||
font-size: 24rpx;
|
|
||||||
flex: none;
|
|
||||||
display: flex !important;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compact-mode .refund-text {
|
|
||||||
font-size: 24rpx;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,5 +1,13 @@
|
|||||||
{
|
{
|
||||||
"easycom": {},
|
"easycom": {},
|
||||||
|
"ttPlugins": {
|
||||||
|
"dependencies": {
|
||||||
|
"tta5a3d31e3aecfb9b11": {
|
||||||
|
"version": "0.0.51",
|
||||||
|
"isDynamic": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"path": "pages/client/index/index",
|
"path": "pages/client/index/index",
|
||||||
@ -299,8 +307,7 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "订单详情",
|
"navigationBarTitleText": "订单详情",
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"refund-button": "plugin://myTradePlugin/pay-button",
|
"pay-button-sdk": "tta5a3d31e3aecfb9b11://pay-button"
|
||||||
"pay-button-sdk": "plugin://myTradePlugin/pay-button"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -315,7 +322,7 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "商城订单",
|
"navigationBarTitleText": "商城订单",
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"pay-button-sdk": "plugin://myTradePlugin/pay-button"
|
"pay-button-sdk": "tta5a3d31e3aecfb9b11://pay-button"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -65,32 +65,12 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 待发货 -->
|
<!-- 待预约 -->
|
||||||
<template v-if="[SHOP_ORDER_UNSLIVER].includes(data.status)">
|
<template v-if="[SHOP_ORDER_UNSLIVER].includes(data.status)">
|
||||||
<view class="order-btns-right">
|
<view class="order-btns-right">
|
||||||
<!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)">
|
<view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('refund', data)">
|
||||||
联系客服
|
申请退款
|
||||||
</view> -->
|
</view>
|
||||||
<!-- <view
|
|
||||||
class="flex-center fs-24 app-fc-main status-btn"
|
|
||||||
@click.stop="$emit('afterSale', data)"
|
|
||||||
>
|
|
||||||
申请售后
|
|
||||||
</view> -->
|
|
||||||
<!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('refund', data)">
|
|
||||||
退款
|
|
||||||
</view> -->
|
|
||||||
<refund-button
|
|
||||||
mode="2"
|
|
||||||
order-status="1"
|
|
||||||
:order-id="data.order_no"
|
|
||||||
:refund-total-amount="(data.actual_price || 0) * 100"
|
|
||||||
:compact="true"
|
|
||||||
@refund="handleRefund"
|
|
||||||
@error="handleError"
|
|
||||||
style="width:140rpx;height:68rpx;"
|
|
||||||
|
|
||||||
/>
|
|
||||||
<view class="flex-center fs-24 app-fc-white status-btn confirm"
|
<view class="flex-center fs-24 app-fc-white status-btn confirm"
|
||||||
@click.stop="jumpToReservation">
|
@click.stop="jumpToReservation">
|
||||||
立即预约
|
立即预约
|
||||||
@ -155,7 +135,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import PopUpModal from "@/components/PopUpModal.vue";
|
import PopUpModal from "@/components/PopUpModal.vue";
|
||||||
import GoodInfo from "./GoodInfo.vue";
|
import GoodInfo from "./GoodInfo.vue";
|
||||||
import RefundButton from "@/components/RefundButton.vue";
|
|
||||||
import {
|
import {
|
||||||
SHOP_ORDER_STATUS,
|
SHOP_ORDER_STATUS,
|
||||||
SHOP_ORDER_UNPAY,
|
SHOP_ORDER_UNPAY,
|
||||||
@ -202,13 +181,45 @@
|
|||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
GoodInfo,
|
GoodInfo,
|
||||||
PopUpModal,
|
PopUpModal
|
||||||
RefundButton
|
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
styleIsolation: "shared",
|
styleIsolation: "shared",
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
// 抖音退款组件需要的订单ID
|
||||||
|
orderId() {
|
||||||
|
return this.data.order_id || this.data.order_no || "";
|
||||||
|
},
|
||||||
|
// 抖音退款组件需要的订单状态(1=待核销/待发货,2=已核销/已发货)
|
||||||
|
orderStatusForSDK() {
|
||||||
|
// 根据你的业务状态映射到抖音SDK需要的状态
|
||||||
|
// SHOP_ORDER_UNSLIVER = 待发货 -> 映射为 1
|
||||||
|
if (this.data.status === SHOP_ORDER_UNSLIVER) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// SHOP_ORDER_UNRECEIVE = 待收货 -> 映射为 2
|
||||||
|
if (this.data.status === SHOP_ORDER_UNRECEIVE) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
|
// 订单总金额(单位:分)
|
||||||
|
orderTotalAmount() {
|
||||||
|
const price = this.data.actual_price || 0;
|
||||||
|
// 转换为分
|
||||||
|
return Math.round(parseFloat(price) * 100);
|
||||||
|
},
|
||||||
|
// UniApp 需要传入的退款参数对象
|
||||||
|
refundParams() {
|
||||||
|
return {
|
||||||
|
reasonCode: [410],
|
||||||
|
note: '用户申请退款',
|
||||||
|
applySource: 101,
|
||||||
|
afterSaleType: 3,
|
||||||
|
needRefundPackFee: true
|
||||||
|
}
|
||||||
|
},
|
||||||
orderStatus() {
|
orderStatus() {
|
||||||
return SHOP_ORDER_STATUS[this.data.status] || "";
|
return SHOP_ORDER_STATUS[this.data.status] || "";
|
||||||
},
|
},
|
||||||
@ -258,18 +269,32 @@
|
|||||||
this.stopCountDown();
|
this.stopCountDown();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleRefund(e) {
|
// 退款回调(组件触发)
|
||||||
console.log('退款结果:', e.detail)
|
handleRefund(event) {
|
||||||
if (e.detail.status === 'success') {
|
const { status, result, outOrderNo } = event.detail
|
||||||
uni.showToast({ title: '退款申请已提交', icon: 'success' })
|
console.log('退款回调:', { status, result, outOrderNo })
|
||||||
|
|
||||||
|
if (status === 'success') {
|
||||||
|
uni.showToast({
|
||||||
|
title: '退款申请已提交',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
this.$emit('refund', this.data)
|
this.$emit('refund', this.data)
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: '退款失败', icon: 'none' })
|
uni.showToast({
|
||||||
|
title: result?.errMsg || '退款失败,请稍后重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleError(e) {
|
// 错误处理
|
||||||
console.error('组件错误:', e.detail)
|
handleError(event) {
|
||||||
|
console.error('退款组件报错:', event.detail)
|
||||||
|
uni.showToast({
|
||||||
|
title: '组件加载失败,请稍后重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
startCountDown() {
|
startCountDown() {
|
||||||
|
|||||||
@ -3,12 +3,24 @@
|
|||||||
<!-- 商品信息 -->
|
<!-- 商品信息 -->
|
||||||
<view class="info-cell goods-info-cell">
|
<view class="info-cell goods-info-cell">
|
||||||
<template>
|
<template>
|
||||||
<view class="goods-item" v-for="(item, index) in orderData" :key="index">
|
<view
|
||||||
<image class="goods-img" :src="item.item_pic || item.product_pic " mode="aspectFill" />
|
class="goods-item"
|
||||||
|
v-for="(item, index) in orderData"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="goods-img"
|
||||||
|
:src="item.item_pic || item.product_pic"
|
||||||
|
mode="aspectFill"
|
||||||
|
/>
|
||||||
<view class="goods-content">
|
<view class="goods-content">
|
||||||
<view class="goods-row-first">
|
<view class="goods-row-first">
|
||||||
<view class="goods-name">{{ item.item_name || item.product_name }}</view>
|
<view class="goods-name">{{
|
||||||
<text class="goods-price">¥{{ item.product_price || item.goods_price }}</text>
|
item.item_name || item.product_name
|
||||||
|
}}</view>
|
||||||
|
<text class="goods-price"
|
||||||
|
>¥{{ item.product_price || item.goods_price }}</text
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
<view class="goods-row-second">
|
<view class="goods-row-second">
|
||||||
<text class="goods-count">共{{ item.number || 1 }}件</text>
|
<text class="goods-count">共{{ item.number || 1 }}件</text>
|
||||||
@ -23,13 +35,21 @@
|
|||||||
<text class="pay-label">商品金额</text>
|
<text class="pay-label">商品金额</text>
|
||||||
<text class="pay-value">¥{{ payPrice }}</text>
|
<text class="pay-value">¥{{ payPrice }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="couponList.length" class="flex-row-between pay-info coupon-row" @click="showCouponModal = true">
|
<view
|
||||||
|
v-if="couponList.length"
|
||||||
|
class="flex-row-between pay-info coupon-row"
|
||||||
|
@click="showCouponModal = true"
|
||||||
|
>
|
||||||
<text class="pay-label">优惠券</text>
|
<text class="pay-label">优惠券</text>
|
||||||
<view class="flex-row-end">
|
<view class="flex-row-end">
|
||||||
<text class="coupon-price">
|
<text class="coupon-price">
|
||||||
{{ couponFee ? `- ¥${couponFee}` : "请选择" }}
|
{{ couponFee ? `- ¥${couponFee}` : "请选择" }}
|
||||||
</text>
|
</text>
|
||||||
<image class="arrow-icon" src="@/static/images/arrow_right_black.png" mode="widthFix" />
|
<image
|
||||||
|
class="arrow-icon"
|
||||||
|
src="@/static/images/arrow_right_black.png"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="flex-row-between pay-info">
|
<!-- <view class="flex-row-between pay-info">
|
||||||
@ -63,53 +83,38 @@
|
|||||||
<!-- <view class="cancel-btn" @click="cancelOrder">
|
<!-- <view class="cancel-btn" @click="cancelOrder">
|
||||||
<text class="cancel-btn-text">取消订单</text>
|
<text class="cancel-btn-text">取消订单</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="pay-btn" @click="confirmPay">
|
<view class="pay-btn" @click="createOrder">
|
||||||
<text class="pay-btn-text">立即支付</text>
|
<text class="pay-btn-text">立即支付</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<good-info-modal v-if="showGoodInfoModal" :goods="orderData" @close="showGoodInfoModal = false" />
|
<good-info-modal
|
||||||
|
v-if="showGoodInfoModal"
|
||||||
<recharge-coupon-modal v-if="showCouponModal" :couponList="usefullCouponList" :price="orderPrice"
|
:goods="orderData"
|
||||||
:showOptBtn="true" @useCoupon="useCoupon" @close="showCouponModal = false" />
|
@close="showGoodInfoModal = false"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import SelectModal from "@/components/select-modal.vue";
|
import SelectModal from "@/components/select-modal.vue";
|
||||||
import GoodInfoModal from "./components/GoodInfoModal.vue";
|
import GoodInfoModal from "./components/GoodInfoModal.vue";
|
||||||
import RechargeCouponModal from "@/components/coupon/RechargeCouponModal.vue";
|
import RechargeCouponModal from "@/components/coupon/RechargeCouponModal.vue";
|
||||||
import DraggableContact from "@/components/DraggableContact.vue";
|
import DraggableContact from "@/components/DraggableContact.vue";
|
||||||
import {
|
import {
|
||||||
getCouponListByOrderPrice,
|
getCouponListByOrderPrice,
|
||||||
getOwnCouponData
|
getOwnCouponData,
|
||||||
} from "../../../api/coupon";
|
} from "../../../api/coupon";
|
||||||
import {
|
import { createCartOrder, createOrder, payOrder } from "../../../api/shop";
|
||||||
createCartOrder,
|
import { getOrderList } from "../../../api/order";
|
||||||
createOrder,
|
import { ORDER_STATUS_COMPLETED } from "../../../pageHome/constants/home";
|
||||||
payOrder
|
import { getAddressInfo } from "../../../api/address";
|
||||||
} from "../../../api/shop";
|
import { COUPON_TYPE_GOODS } from "../../../constants/app.business";
|
||||||
import {
|
import { walletTransaction } from "../../../api/login";
|
||||||
getOrderList
|
import { imgPrefix, jumpToWeChat } from "@/utils/common";
|
||||||
} from "../../../api/order";
|
|
||||||
import {
|
|
||||||
ORDER_STATUS_COMPLETED
|
|
||||||
} from "../../../pageHome/constants/home";
|
|
||||||
import {
|
|
||||||
getAddressInfo
|
|
||||||
} from "../../../api/address";
|
|
||||||
import {
|
|
||||||
COUPON_TYPE_GOODS
|
|
||||||
} from '../../../constants/app.business';
|
|
||||||
import {
|
|
||||||
walletTransaction
|
|
||||||
} from "../../../api/login";
|
|
||||||
import {
|
|
||||||
imgPrefix,
|
|
||||||
jumpToWeChat
|
|
||||||
} from "@/utils/common";
|
|
||||||
|
|
||||||
const sliverList = [{
|
const sliverList = [
|
||||||
|
{
|
||||||
name: "快递配送",
|
name: "快递配送",
|
||||||
id: 1,
|
id: 1,
|
||||||
},
|
},
|
||||||
@ -117,9 +122,9 @@
|
|||||||
name: "和服务订单一起随车派送",
|
name: "和服务订单一起随车派送",
|
||||||
id: 2,
|
id: 2,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
SelectModal,
|
SelectModal,
|
||||||
GoodInfoModal,
|
GoodInfoModal,
|
||||||
@ -128,7 +133,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
payPrice:0,
|
payPrice: 0,
|
||||||
type: "",
|
type: "",
|
||||||
orderData: [],
|
orderData: [],
|
||||||
addressInfo: {},
|
addressInfo: {},
|
||||||
@ -172,11 +177,7 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
const {
|
const { type, petOrderId = "", petOrderAddressId = "" } = option;
|
||||||
type,
|
|
||||||
petOrderId = "",
|
|
||||||
petOrderAddressId = ""
|
|
||||||
} = option;
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.petOrderId = petOrderId;
|
this.petOrderId = petOrderId;
|
||||||
this.petOrderAddressId = petOrderAddressId;
|
this.petOrderAddressId = petOrderAddressId;
|
||||||
@ -193,49 +194,22 @@
|
|||||||
const eventChannel = this.getOpenerEventChannel();
|
const eventChannel = this.getOpenerEventChannel();
|
||||||
eventChannel.on("createOrder", (data) => {
|
eventChannel.on("createOrder", (data) => {
|
||||||
this.orderData = data?.goodList || [];
|
this.orderData = data?.goodList || [];
|
||||||
this.payPrice = (data?.goodList || []).reduce((sum, item) => sum + Number( (item.product_price || item.goods_price ) * item.number || 0), 0);
|
this.payPrice = (data?.goodList || []).reduce(
|
||||||
console.log(data,'--=?')
|
(sum, item) =>
|
||||||
|
sum +
|
||||||
|
Number((item.product_price || item.goods_price) * item.number || 0),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
console.log(data, "--=?");
|
||||||
const price = this.orderData.reduce(
|
const price = this.orderData.reduce(
|
||||||
(total, prev) => total + +prev.item_price,
|
(total, prev) => total + +prev.item_price,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
this.orderPrice = +price.toFixed(2);
|
this.orderPrice = +price.toFixed(2);
|
||||||
this.confirmPrice = +(this.orderPrice - this.couponFee).toFixed(2);
|
this.confirmPrice = +(this.orderPrice - this.couponFee).toFixed(2);
|
||||||
this.getCouponList();
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setDefaultCoupon() {
|
|
||||||
let fee = 0;
|
|
||||||
let coupon;
|
|
||||||
this.couponList.map((v) => {
|
|
||||||
if (+v.card_money < this.orderPrice && +v.card_money > fee) {
|
|
||||||
fee = +v.card_money;
|
|
||||||
coupon = {
|
|
||||||
...v
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.useCouponInfo = coupon;
|
|
||||||
if (coupon?.coupon_id) {
|
|
||||||
this.type === "cart" ?
|
|
||||||
this.creatCartOrder(true) :
|
|
||||||
this.createOrder(true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getServiceOrderList() {
|
|
||||||
getOrderList(1, 1, ORDER_STATUS_COMPLETED).then((res) => {
|
|
||||||
this.serviceOrderList = res?.info || [];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getCouponList() {
|
|
||||||
getCouponListByOrderPrice(this.orderPrice, COUPON_TYPE_GOODS).then((res) => {
|
|
||||||
this.couponList = res?.info || [];
|
|
||||||
if (!this.useCouponInfo) {
|
|
||||||
this.setDefaultCoupon();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
createOrder(isPrePay) {
|
createOrder(isPrePay) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!isPrePay) {
|
if (!isPrePay) {
|
||||||
@ -244,362 +218,67 @@
|
|||||||
mask: true,
|
mask: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log(this.orderData,'???')
|
const params = {
|
||||||
createCartOrder({
|
id: this.orderData[0].goods_id,
|
||||||
orderId:this.addressInfo.id
|
};
|
||||||
// product_id:this.orderData[0].price_id,
|
|
||||||
// price_id:this.orderData[0].price_id,
|
|
||||||
// // price_desc:this.orderData[0].product_desc,
|
|
||||||
// product_name:this.orderData[0].goods_name,
|
|
||||||
// // product_pic:this.orderData[0].product_pic,
|
|
||||||
// // number:this.orderData[0].number,
|
|
||||||
// product_price:this.orderData[0].goods_price
|
|
||||||
// type:this.sliverInfo.id,
|
|
||||||
// original_price:this.orderData[0].original_price,
|
|
||||||
// actual_price:this.payPrice + '',
|
|
||||||
// reduction_amount:'0',
|
|
||||||
// pay_amount:this.payPrice +'',
|
|
||||||
// pay_type: Number(this.WeChat) || Number(this.wallet),
|
|
||||||
// address_id:this.addressInfo.id,
|
|
||||||
// address:this.addressInfo.full_address,
|
|
||||||
// name:this.addressInfo.recipient_name,
|
|
||||||
// phone:this.addressInfo.phone,
|
|
||||||
// note:'',
|
|
||||||
|
|
||||||
})
|
// console.log(this.orderData,'???')
|
||||||
|
createCartOrder(params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (isPrePay) {
|
const plugin = tt.requirePlugin("tte57093cd7a7fbf2401");
|
||||||
this.confirmPrice = +(res?.info?.pay_price || 0).toFixed(2);
|
plugin.createOrder({
|
||||||
this.orderPrice = +(res?.info?.price || 0).toFixed(2);
|
goodsList: [
|
||||||
!this.useCouponInfo && this.setDefaultCoupon();
|
{
|
||||||
} else {
|
quantity: 10, // 购买数量 必填
|
||||||
this.pay(res?.data)
|
price: 1, // 商品价格 必填
|
||||||
|
goodsName: "测试商品", // 商品名称 必填
|
||||||
|
goodsPhoto:
|
||||||
|
"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.ibaotu.com%2Fgif%2F19%2F48%2F47%2F76Z888piCd6W.gif%21fwpaa50%2Ffw%2F700&refer=http%3A%2F%2Fpic.ibaotu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1644654365&t=5fc9b5fdad0a16264a9a9c09c14b3af9", // 商品图片链接 必填
|
||||||
|
goodsId: "123", // 商品ID 必填(请务必使用小程序商品)
|
||||||
|
goodsType: 2, // 商品类型 必填
|
||||||
|
goodsLabels: ["不可退"], // 商品标签 非必填
|
||||||
|
dateRule: "", // 使用规则 非必填
|
||||||
|
},
|
||||||
|
],
|
||||||
|
payment: {
|
||||||
|
totalAmount: 10, // 订单总价 必填
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
const { orderId, outOrderNo } = res;
|
||||||
|
console.log("success res", res);
|
||||||
|
console.log("orderId", orderId, "outOrderNo", outOrderNo);
|
||||||
|
this.setData({ orderId, outOrderNo });
|
||||||
|
uni.navigateTo({
|
||||||
|
url:"/pages/client/order/list",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
const { orderId, outOrderNo, errNo, errMsg, errLogId } = res;
|
||||||
|
if (errLogId) {
|
||||||
|
console.log("预下单失败", errNo, errMsg, errLogId);
|
||||||
}
|
}
|
||||||
|
if (orderId || outOrderNo) {
|
||||||
|
console.log("支付失败", errNo, errMsg, orderId, outOrderNo);
|
||||||
|
}
|
||||||
|
console.log(errNo, errMsg);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {});
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: err || "支付失败",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
reject();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// buyService(order) {
|
|
||||||
// uni.showLoading({
|
|
||||||
// title: "处理中",
|
|
||||||
// mask: true,
|
|
||||||
// });
|
|
||||||
// const value = (this.$store.state && this.$store.state.user && this.$store.state.user.userInfo) || {};
|
|
||||||
// const data = {
|
|
||||||
// wallet_id: value.wallet_id,
|
|
||||||
// total_fee: this.payPrice,
|
|
||||||
// type: 4,
|
|
||||||
// order_id: order.order_id,
|
|
||||||
// order_no: order.order_no
|
|
||||||
// }
|
|
||||||
// walletTransaction(data).then((res) => {
|
|
||||||
// if (res.code == 0) {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '支付成功',
|
|
||||||
// icon: 'none'
|
|
||||||
// })
|
|
||||||
// uni.requestSubscribeMessage({
|
|
||||||
// tmplIds: ['QoTeQwj4xw2UQMK5jI67MzAVOo6og76oqZ7BDIJW7cE',
|
|
||||||
// 'GPWlTkaNbi7JqvxltLKuZZMtKedSZfEKlirV7yOUu-0'
|
|
||||||
// ],
|
|
||||||
// success(res) {
|
|
||||||
// uni.hideLoading()
|
|
||||||
// if (res['QoTeQwj4xw2UQMK5jI67MzAVOo6og76oqZ7BDIJW7cE'] === 'accept') {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '订阅成功',
|
|
||||||
// icon: 'success',
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// if (res['GPWlTkaNbi7JqvxltLKuZZMtKedSZfEKlirV7yOUu-0'] === 'accept') {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '订阅成功',
|
|
||||||
// icon: 'success',
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// fail() {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '订阅失败',
|
|
||||||
// icon: 'error',
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
// complete: () => {
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// if (this.petOrderId) {
|
|
||||||
// this.jumpToPetOrder();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// uni.redirectTo({
|
|
||||||
// url: `/pages/client/order/details?id=${order.order_id}`,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// } else if (res.code == 400) {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '支付失败',
|
|
||||||
// icon: 'none'
|
|
||||||
// })
|
|
||||||
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// creatCartOrder(isPrePay) {
|
|
||||||
// return new Promise((resolve, reject) => {
|
|
||||||
// if (!isPrePay) {
|
|
||||||
// if (!this.petOrderId) {
|
|
||||||
// if (!this.addressInfo?.id) {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: "请选择收货地址",
|
|
||||||
// icon: "none",
|
|
||||||
// });
|
|
||||||
// return reject();
|
|
||||||
// }
|
|
||||||
// if (!this.sliverInfo?.id) {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: "请选择配送方式",
|
|
||||||
// icon: "none",
|
|
||||||
// });
|
|
||||||
// return reject();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// uni.showLoading({
|
|
||||||
// title: "处理中",
|
|
||||||
// mask: true,
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// createCartOrder({
|
|
||||||
// type:this.sliverInfo.id,
|
|
||||||
// original_price:this.orderData[0].original_price,
|
|
||||||
// actual_price:this.payPrice + '',
|
|
||||||
// reduction_amount:'0',
|
|
||||||
// pay_amount:this.payPrice + '',
|
|
||||||
// pay_type: Number(this.WeChat) || Number(this.wallet),
|
|
||||||
// address_id:this.addressInfo.id,
|
|
||||||
// address:this.addressInfo.full_address,
|
|
||||||
// name:this.addressInfo.recipient_name,
|
|
||||||
// phone:this.addressInfo.phone,
|
|
||||||
// note:'',
|
|
||||||
// items:this.orderData
|
|
||||||
// })
|
|
||||||
// .then((res) => {
|
|
||||||
// if (isPrePay) {
|
|
||||||
// this.confirmPrice = +(res?.data?.pay_amount || 0).toFixed(2);
|
|
||||||
// this.orderPrice = +(res?.data?.original_price || 0).toFixed(2);
|
|
||||||
// !this.useCouponInfo && this.setDefaultCoupon();
|
|
||||||
// } else {
|
|
||||||
// if (this.WeChat == 1) {
|
|
||||||
// this.pay(res?.data);
|
|
||||||
// } else if (this.wallet == 2) {
|
|
||||||
// this.buyService(res?.data);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return resolve();
|
|
||||||
// })
|
|
||||||
// .catch(() => {
|
|
||||||
// return reject();
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
pay(orderId) {
|
|
||||||
payOrder({
|
|
||||||
type:4,
|
|
||||||
total_fee: Number(this.payPrice),
|
|
||||||
order_id:orderId.order_id,
|
|
||||||
order_no:orderId.order_no
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
tt.pay({
|
|
||||||
orderInfo: {
|
|
||||||
order_id:res.data.orderInfo.order_id,
|
|
||||||
order_token:res.data.orderInfo.order_token,
|
|
||||||
},
|
},
|
||||||
service:5,
|
};
|
||||||
success: (res) => {
|
|
||||||
console.log(res,'--==')
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: "支付成功",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
uni.requestSubscribeMessage({
|
|
||||||
success(res) {
|
|
||||||
uni.hideLoading()
|
|
||||||
},
|
|
||||||
fail() {
|
|
||||||
uni.showToast({
|
|
||||||
title: '订阅失败',
|
|
||||||
icon: 'error',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
complete: () => {
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
if (this.petOrderId) {
|
|
||||||
this.jumpToPetOrder();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.redirectTo({
|
|
||||||
url: `/pages/client/order/details?id=${orderId.order_id}`,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: err?.msg || "支付失败",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
uni.redirectTo({
|
|
||||||
url: `/pages/client/order/details?id=${orderId.order_id}`,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: err || "支付失败",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
uni.redirectTo({
|
|
||||||
url: `/pages/client/order/details?id=${orderId.order_id}`,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
selectOption1(v) {
|
|
||||||
this.WeChat = v
|
|
||||||
this.wallet = ''
|
|
||||||
console.log(this.WeChat)
|
|
||||||
this.selected1 = false;
|
|
||||||
this.selected2 = true;
|
|
||||||
this.selected3 = true;
|
|
||||||
this.selected4 = false;
|
|
||||||
},
|
|
||||||
selectOption2(v) {
|
|
||||||
this.WeChat = ''
|
|
||||||
this.wallet = v
|
|
||||||
console.log(this.wallet)
|
|
||||||
this.selected1 = true;
|
|
||||||
this.selected2 = false;
|
|
||||||
this.selected3 = false;
|
|
||||||
this.selected4 = true;
|
|
||||||
},
|
|
||||||
jumpToPetOrder() {
|
|
||||||
const pages = getCurrentPages();
|
|
||||||
const detailsIndex = pages.findIndex((v) =>
|
|
||||||
v.route === "pageHome/order/order-detail-page"
|
|
||||||
);
|
|
||||||
const listIndex = pages.findIndex((v) =>
|
|
||||||
v.route === "pages/client/index/index"
|
|
||||||
);
|
|
||||||
if (detailsIndex > -1) {
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: pages.length - detailsIndex - 1,
|
|
||||||
});
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (listIndex > -1) {
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: pages.length - listIndex - 1,
|
|
||||||
});
|
|
||||||
return
|
|
||||||
}
|
|
||||||
},
|
|
||||||
jumpToAddress() {
|
|
||||||
if (this.petOrderAddressId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pageHome/selectAddress/index?typeSelect=1&addressId=${
|
|
||||||
this.addressInfo?.address_id || ""
|
|
||||||
}`,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addressChange(addressInfo) {
|
|
||||||
this.addressInfo = addressInfo;
|
|
||||||
console.log(this.addressInfo,'??s')
|
|
||||||
},
|
|
||||||
confirmSliverType() {
|
|
||||||
this.sliverInfo = {
|
|
||||||
...this.selectSliverInfo
|
|
||||||
};
|
|
||||||
this.showSliverModal = false;
|
|
||||||
this.$forceUpdate();
|
|
||||||
},
|
|
||||||
openSliverModal() {
|
|
||||||
this.showSliverModal = true;
|
|
||||||
this.selectSliverInfo = {
|
|
||||||
...this.sliverInfo
|
|
||||||
};
|
|
||||||
this.$forceUpdate();
|
|
||||||
},
|
|
||||||
useCoupon(data) {
|
|
||||||
this.showCouponModal = false;
|
|
||||||
const oldCoupon = {
|
|
||||||
...this.useCouponInfo
|
|
||||||
};
|
|
||||||
if (data.coupon_id) {
|
|
||||||
this.useCouponInfo = {
|
|
||||||
...data
|
|
||||||
};
|
|
||||||
if (this.type === "cart") {
|
|
||||||
this.creatCartOrder(true).catch(() => {
|
|
||||||
this.useCouponInfo = {
|
|
||||||
...oldCoupon
|
|
||||||
};
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.createOrder(true).catch(() => {
|
|
||||||
this.useCouponInfo = {
|
|
||||||
...oldCoupon
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
jumpToWeChat,
|
|
||||||
handleContactBtnClick() {
|
|
||||||
this.jumpToWeChat();
|
|
||||||
},
|
|
||||||
cancelOrder() {
|
|
||||||
uni.showModal({
|
|
||||||
title: "提示",
|
|
||||||
content: "确定要取消订单吗?",
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.navigateBack();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
confirmPay() {
|
|
||||||
this.createOrder()
|
|
||||||
},
|
|
||||||
changeSliverType(item) {
|
|
||||||
this.selectSliverInfo = {
|
|
||||||
...item
|
|
||||||
};
|
|
||||||
this.$forceUpdate();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.order-create-container {
|
.order-create-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: #F7F8FA;
|
background: #f7f8fa;
|
||||||
|
|
||||||
.info-cell {
|
.info-cell {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
@ -643,14 +322,14 @@
|
|||||||
|
|
||||||
.address-placeholder {
|
.address-placeholder {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #3D3D3D;
|
color: #3d3d3d;
|
||||||
padding: 20rpx 0rpx;
|
padding: 20rpx 0rpx;
|
||||||
padding-bottom: 10rpx;
|
padding-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.address-name {
|
.address-name {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #3D3D3D;
|
color: #3d3d3d;
|
||||||
|
|
||||||
.address-phone {
|
.address-phone {
|
||||||
margin-left: 8rpx;
|
margin-left: 8rpx;
|
||||||
@ -691,7 +370,7 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #3D3D3D;
|
color: #3d3d3d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -704,7 +383,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 24rpx 20rpx;
|
padding: 24rpx 20rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-bottom: 1rpx solid #F5F5F5;
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
@ -736,7 +415,7 @@
|
|||||||
.goods-name {
|
.goods-name {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #3D3D3D;
|
color: #3d3d3d;
|
||||||
line-height: 40rpx;
|
line-height: 40rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@ -747,7 +426,7 @@
|
|||||||
.goods-price {
|
.goods-price {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #3D3D3D;
|
color: #3d3d3d;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -813,19 +492,19 @@
|
|||||||
|
|
||||||
.pay-label {
|
.pay-label {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #9B939A;
|
color: #9b939a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pay-value {
|
.pay-value {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #3D3D3D;
|
color: #3d3d3d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.coupon-row {
|
.coupon-row {
|
||||||
.coupon-price {
|
.coupon-price {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #FF19A0;
|
color: #ff19a0;
|
||||||
margin-right: 12rpx;
|
margin-right: 12rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -836,16 +515,16 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding-top: 16rpx;
|
padding-top: 16rpx;
|
||||||
margin-top: 16rpx;
|
margin-top: 16rpx;
|
||||||
border-top: 1rpx solid #E5E5E5;
|
border-top: 1rpx solid #e5e5e5;
|
||||||
|
|
||||||
.pay-label {
|
.pay-label {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #3D3D3D;
|
color: #3d3d3d;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pay-total {
|
.pay-total {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #FF19A0;
|
color: #ff19a0;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -859,7 +538,7 @@
|
|||||||
padding: 24rpx 0;
|
padding: 24rpx 0;
|
||||||
|
|
||||||
&:not(:last-child) {
|
&:not(:last-child) {
|
||||||
border-bottom: 1rpx solid #E5E5E5;
|
border-bottom: 1rpx solid #e5e5e5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.payment-left {
|
.payment-left {
|
||||||
@ -874,7 +553,7 @@
|
|||||||
|
|
||||||
.payment-text {
|
.payment-text {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #3D3D3D;
|
color: #3d3d3d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -943,7 +622,7 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
height: 92rpx;
|
height: 92rpx;
|
||||||
border-radius: 92rpx;
|
border-radius: 92rpx;
|
||||||
border: 2rpx solid #FF19A0;
|
border: 2rpx solid #ff19a0;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -951,7 +630,7 @@
|
|||||||
|
|
||||||
.cancel-btn-text {
|
.cancel-btn-text {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #FF19A0;
|
color: #ff19a0;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -960,7 +639,7 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
height: 92rpx;
|
height: 92rpx;
|
||||||
border-radius: 92rpx;
|
border-radius: 92rpx;
|
||||||
background: #FF19A0;
|
background: #ff19a0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -1002,5 +681,5 @@
|
|||||||
margin: 18rpx auto 10rpx;
|
margin: 18rpx auto 10rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -263,13 +263,20 @@
|
|||||||
|
|
||||||
<!-- 待发货 -->
|
<!-- 待发货 -->
|
||||||
<template v-if="[SHOP_ORDER_UNSLIVER].includes(orderData.status)">
|
<template v-if="[SHOP_ORDER_UNSLIVER].includes(orderData.status)">
|
||||||
<!-- 使用原来的 RefundButton 组件 -->
|
<!-- 抖音退款组件 -->
|
||||||
<view class="refund-btn-wrapper">
|
<view class="refund-btn-wrapper">
|
||||||
<refund-button
|
<pay-button-sdk
|
||||||
mode="2"
|
mode=1
|
||||||
order-status="1"
|
:order-id="orderData.order_no || orderData.order_id"
|
||||||
:order-id="orderData.order_no"
|
:order-status="1"
|
||||||
:refund-total-amount="Math.round((orderData.actual_price || 0) * 100)"
|
:refund-total-amount="Math.round((orderData.actual_price || 0) * 100)"
|
||||||
|
:apply-refund-params="{
|
||||||
|
reasonCode: [410],
|
||||||
|
note: '用户申请退款',
|
||||||
|
applySource: 101,
|
||||||
|
afterSaleType: 3,
|
||||||
|
needRefundPackFee: true
|
||||||
|
}"
|
||||||
@refund="handleRefundSuccess"
|
@refund="handleRefundSuccess"
|
||||||
@error="handleRefundError"
|
@error="handleRefundError"
|
||||||
/>
|
/>
|
||||||
@ -344,7 +351,6 @@
|
|||||||
import SliverInfo from "./components/SliverInfo.vue";
|
import SliverInfo from "./components/SliverInfo.vue";
|
||||||
import CallModal from "@/components/petOrder/call-modal.vue";
|
import CallModal from "@/components/petOrder/call-modal.vue";
|
||||||
import DraggableContact from "@/components/DraggableContact.vue";
|
import DraggableContact from "@/components/DraggableContact.vue";
|
||||||
import RefundButton from "@/components/RefundButton.vue";
|
|
||||||
import {
|
import {
|
||||||
walletTransaction,
|
walletTransaction,
|
||||||
cancelPetOrderRefund,
|
cancelPetOrderRefund,
|
||||||
@ -391,8 +397,7 @@ import {
|
|||||||
SuccessModal,
|
SuccessModal,
|
||||||
SliverInfo,
|
SliverInfo,
|
||||||
CallModal,
|
CallModal,
|
||||||
DraggableContact,
|
DraggableContact
|
||||||
RefundButton
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
<view v-for="(data, index) in list" :key="data.order_id" :class="{ left: index % 2 === 0 }"
|
<view v-for="(data, index) in list" :key="data.order_id" :class="{ left: index % 2 === 0 }"
|
||||||
class="flex-column-start news-item">
|
class="flex-column-start news-item">
|
||||||
<order-item :data="data" @disableScroll="disableScrollAction" @cancelOrder="cancelOrderAction"
|
<order-item :data="data" @disableScroll="disableScrollAction" @cancelOrder="cancelOrderAction"
|
||||||
@refund="refundAction" @concactService="jumpToWeChat" @confirmSliver="confirmSliver" @remindSilver="remindSliver" @pay="pay"
|
@refund="handleRefundFromItem" @concactService="jumpToWeChat" @confirmSliver="confirmSliver" @remindSilver="remindSliver" @pay="pay"
|
||||||
@afterSale="afterSale" @checkSliver="checkSliver" @remark="remark" @remarkDetails="remarkDetails"
|
@afterSale="afterSale" @checkSliver="checkSliver" @remark="remark" @remarkDetails="remarkDetails"
|
||||||
@jumpToDetails="jumpToDetails" />
|
@jumpToDetails="jumpToDetails" />
|
||||||
</view>
|
</view>
|
||||||
@ -250,7 +250,7 @@ export default {
|
|||||||
mask: true,
|
mask: true,
|
||||||
});
|
});
|
||||||
const data = {
|
const data = {
|
||||||
order_id: this.orderInfo.order_id,
|
id: this.orderInfo.order_id,
|
||||||
// business_type:1
|
// business_type:1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,37 +308,58 @@ export default {
|
|||||||
title: "支付中",
|
title: "支付中",
|
||||||
mask: true,
|
mask: true,
|
||||||
});
|
});
|
||||||
payOrder({
|
|
||||||
type: 4,
|
const plugin = tt.requirePlugin('tta5a3d31e3aecfb9b11');
|
||||||
total_fee: Number(data.actual_price),
|
plugin.continueToPay({
|
||||||
order_id: data.order_id,
|
orderId: "orderId", // 内部订单号
|
||||||
order_no: data.order_no
|
outOrderNo: "outOrderNo", // 外部订单号 2个订单号必填一个
|
||||||
}).then((res) => {
|
|
||||||
tt.pay({
|
|
||||||
orderInfo: {
|
|
||||||
order_id:res.data.orderInfo.order_id,
|
|
||||||
order_token:res.data.orderInfo.order_token,
|
|
||||||
},
|
|
||||||
service:5,
|
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
uni.hideLoading();
|
const { orderId, outOrderNo } = res;
|
||||||
uni.showToast({
|
console.log("success res", res);
|
||||||
title: "支付成功",
|
console.log("orderId", orderId, "outOrderNo", outOrderNo);
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
this.additionalBom = false,
|
|
||||||
this.elasticLayer = false,
|
|
||||||
this.reloadData();
|
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (res) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.showToast({
|
const { orderId, outOrderNo, errNo, errMsg, errLogId } = res;
|
||||||
title: err?.msg || "支付失败",
|
if (errLogId) {
|
||||||
icon: "none",
|
console.log("查询订单信息失败", errNo, errMsg, errLogId);
|
||||||
});
|
}
|
||||||
|
if (orderId || outOrderNo) {
|
||||||
|
console.log("支付失败", errNo, errMsg, orderId, outOrderNo);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
// payOrder({
|
||||||
|
// type: 4,
|
||||||
|
// total_fee: Number(data.actual_price),
|
||||||
|
// order_id: data.order_id,
|
||||||
|
// order_no: data.order_no
|
||||||
|
// }).then((res) => {
|
||||||
|
// tt.pay({
|
||||||
|
// orderInfo: {
|
||||||
|
// order_id:res.data.orderInfo.order_id,
|
||||||
|
// order_token:res.data.orderInfo.order_token,
|
||||||
|
// },
|
||||||
|
// service:5,
|
||||||
|
// success: (res) => {
|
||||||
|
// uni.hideLoading();
|
||||||
|
// uni.showToast({
|
||||||
|
// title: "支付成功",
|
||||||
|
// icon: "none",
|
||||||
|
// });
|
||||||
|
// this.additionalBom = false,
|
||||||
|
// this.elasticLayer = false,
|
||||||
|
// this.reloadData();
|
||||||
|
// },
|
||||||
|
// fail: (err) => {
|
||||||
|
// uni.hideLoading();
|
||||||
|
// uni.showToast({
|
||||||
|
// title: err?.msg || "支付失败",
|
||||||
|
// icon: "none",
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
// this.additionalBom = true;
|
// this.additionalBom = true;
|
||||||
// this.elasticLayer = true;
|
// this.elasticLayer = true;
|
||||||
@ -499,6 +520,16 @@ export default {
|
|||||||
this.cancelModalContent = "确定要退款吗?";
|
this.cancelModalContent = "确定要退款吗?";
|
||||||
this.orderInfo = data;
|
this.orderInfo = data;
|
||||||
},
|
},
|
||||||
|
// 处理从 OrderItem 传来的退款事件
|
||||||
|
handleRefundFromItem(data) {
|
||||||
|
// 跳转到订单详情页处理退款,因为插件组件只能在页面中使用
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/client/order/details?id=${data?.order_id}`,
|
||||||
|
events: {
|
||||||
|
refreshData: () => this.reloadData(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
// 联系客服按钮点击 - 使用自定义弹窗(与首页在线客服功能一致)
|
// 联系客服按钮点击 - 使用自定义弹窗(与首页在线客服功能一致)
|
||||||
handleContactBtnClick() {
|
handleContactBtnClick() {
|
||||||
console.log('[list.vue] handleContactBtnClick called')
|
console.log('[list.vue] handleContactBtnClick called')
|
||||||
|
|||||||
Reference in New Issue
Block a user