1
This commit is contained in:
@ -157,14 +157,12 @@ export const createOrder = ({
|
||||
};
|
||||
|
||||
// 创建抖音订单
|
||||
export const createCartOrder = ({
|
||||
product_pic= "",
|
||||
}) => {
|
||||
export const createCartOrder = ({ id }) => {
|
||||
return request({
|
||||
url: CREATE_CART_ORDER,
|
||||
method: "post",
|
||||
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'
|
||||
|
||||
@ -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": {},
|
||||
"ttPlugins": {
|
||||
"dependencies": {
|
||||
"tta5a3d31e3aecfb9b11": {
|
||||
"version": "0.0.51",
|
||||
"isDynamic": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/client/index/index",
|
||||
@ -299,8 +307,7 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情",
|
||||
"usingComponents": {
|
||||
"refund-button": "plugin://myTradePlugin/pay-button",
|
||||
"pay-button-sdk": "plugin://myTradePlugin/pay-button"
|
||||
"pay-button-sdk": "tta5a3d31e3aecfb9b11://pay-button"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -315,7 +322,7 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "商城订单",
|
||||
"usingComponents": {
|
||||
"pay-button-sdk": "plugin://myTradePlugin/pay-button"
|
||||
"pay-button-sdk": "tta5a3d31e3aecfb9b11://pay-button"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -65,32 +65,12 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 待发货 -->
|
||||
<!-- 待预约 -->
|
||||
<template v-if="[SHOP_ORDER_UNSLIVER].includes(data.status)">
|
||||
<view class="order-btns-right">
|
||||
<!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)">
|
||||
联系客服
|
||||
</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-main status-btn" @click.stop="$emit('refund', data)">
|
||||
申请退款
|
||||
</view>
|
||||
<view class="flex-center fs-24 app-fc-white status-btn confirm"
|
||||
@click.stop="jumpToReservation">
|
||||
立即预约
|
||||
@ -155,7 +135,6 @@
|
||||
<script>
|
||||
import PopUpModal from "@/components/PopUpModal.vue";
|
||||
import GoodInfo from "./GoodInfo.vue";
|
||||
import RefundButton from "@/components/RefundButton.vue";
|
||||
import {
|
||||
SHOP_ORDER_STATUS,
|
||||
SHOP_ORDER_UNPAY,
|
||||
@ -202,13 +181,45 @@
|
||||
},
|
||||
components: {
|
||||
GoodInfo,
|
||||
PopUpModal,
|
||||
RefundButton
|
||||
PopUpModal
|
||||
},
|
||||
options: {
|
||||
styleIsolation: "shared",
|
||||
},
|
||||
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() {
|
||||
return SHOP_ORDER_STATUS[this.data.status] || "";
|
||||
},
|
||||
@ -258,18 +269,32 @@
|
||||
this.stopCountDown();
|
||||
},
|
||||
methods: {
|
||||
handleRefund(e) {
|
||||
console.log('退款结果:', e.detail)
|
||||
if (e.detail.status === 'success') {
|
||||
uni.showToast({ title: '退款申请已提交', icon: 'success' })
|
||||
// 退款回调(组件触发)
|
||||
handleRefund(event) {
|
||||
const { status, result, outOrderNo } = event.detail
|
||||
console.log('退款回调:', { status, result, outOrderNo })
|
||||
|
||||
if (status === 'success') {
|
||||
uni.showToast({
|
||||
title: '退款申请已提交',
|
||||
icon: 'success'
|
||||
})
|
||||
this.$emit('refund', this.data)
|
||||
} 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() {
|
||||
|
||||
@ -3,12 +3,24 @@
|
||||
<!-- 商品信息 -->
|
||||
<view class="info-cell goods-info-cell">
|
||||
<template>
|
||||
<view 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-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-row-first">
|
||||
<view class="goods-name">{{ item.item_name || item.product_name }}</view>
|
||||
<text class="goods-price">¥{{ item.product_price || item.goods_price }}</text>
|
||||
<view class="goods-name">{{
|
||||
item.item_name || item.product_name
|
||||
}}</view>
|
||||
<text class="goods-price"
|
||||
>¥{{ item.product_price || item.goods_price }}</text
|
||||
>
|
||||
</view>
|
||||
<view class="goods-row-second">
|
||||
<text class="goods-count">共{{ item.number || 1 }}件</text>
|
||||
@ -23,13 +35,21 @@
|
||||
<text class="pay-label">商品金额</text>
|
||||
<text class="pay-value">¥{{ payPrice }}</text>
|
||||
</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>
|
||||
<view class="flex-row-end">
|
||||
<text class="coupon-price">
|
||||
{{ couponFee ? `- ¥${couponFee}` : "请选择" }}
|
||||
</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 class="flex-row-between pay-info">
|
||||
@ -63,15 +83,16 @@
|
||||
<!-- <view class="cancel-btn" @click="cancelOrder">
|
||||
<text class="cancel-btn-text">取消订单</text>
|
||||
</view> -->
|
||||
<view class="pay-btn" @click="confirmPay">
|
||||
<view class="pay-btn" @click="createOrder">
|
||||
<text class="pay-btn-text">立即支付</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<good-info-modal v-if="showGoodInfoModal" :goods="orderData" @close="showGoodInfoModal = false" />
|
||||
|
||||
<recharge-coupon-modal v-if="showCouponModal" :couponList="usefullCouponList" :price="orderPrice"
|
||||
:showOptBtn="true" @useCoupon="useCoupon" @close="showCouponModal = false" />
|
||||
<good-info-modal
|
||||
v-if="showGoodInfoModal"
|
||||
:goods="orderData"
|
||||
@close="showGoodInfoModal = false"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -82,34 +103,18 @@
|
||||
import DraggableContact from "@/components/DraggableContact.vue";
|
||||
import {
|
||||
getCouponListByOrderPrice,
|
||||
getOwnCouponData
|
||||
getOwnCouponData,
|
||||
} from "../../../api/coupon";
|
||||
import {
|
||||
createCartOrder,
|
||||
createOrder,
|
||||
payOrder
|
||||
} from "../../../api/shop";
|
||||
import {
|
||||
getOrderList
|
||||
} 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";
|
||||
import { createCartOrder, createOrder, payOrder } from "../../../api/shop";
|
||||
import { getOrderList } 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: "快递配送",
|
||||
id: 1,
|
||||
},
|
||||
@ -172,11 +177,7 @@
|
||||
},
|
||||
},
|
||||
onLoad(option) {
|
||||
const {
|
||||
type,
|
||||
petOrderId = "",
|
||||
petOrderAddressId = ""
|
||||
} = option;
|
||||
const { type, petOrderId = "", petOrderAddressId = "" } = option;
|
||||
this.type = type;
|
||||
this.petOrderId = petOrderId;
|
||||
this.petOrderAddressId = petOrderAddressId;
|
||||
@ -193,49 +194,22 @@
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
eventChannel.on("createOrder", (data) => {
|
||||
this.orderData = data?.goodList || [];
|
||||
this.payPrice = (data?.goodList || []).reduce((sum, item) => sum + Number( (item.product_price || item.goods_price ) * item.number || 0), 0);
|
||||
console.log(data,'--=?')
|
||||
this.payPrice = (data?.goodList || []).reduce(
|
||||
(sum, item) =>
|
||||
sum +
|
||||
Number((item.product_price || item.goods_price) * item.number || 0),
|
||||
0
|
||||
);
|
||||
console.log(data, "--=?");
|
||||
const price = this.orderData.reduce(
|
||||
(total, prev) => total + +prev.item_price,
|
||||
0
|
||||
);
|
||||
this.orderPrice = +price.toFixed(2);
|
||||
this.confirmPrice = +(this.orderPrice - this.couponFee).toFixed(2);
|
||||
this.getCouponList();
|
||||
});
|
||||
},
|
||||
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) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!isPrePay) {
|
||||
@ -244,351 +218,56 @@
|
||||
mask: true,
|
||||
});
|
||||
}
|
||||
console.log(this.orderData,'???')
|
||||
createCartOrder({
|
||||
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:'',
|
||||
const params = {
|
||||
id: this.orderData[0].goods_id,
|
||||
};
|
||||
|
||||
})
|
||||
// console.log(this.orderData,'???')
|
||||
createCartOrder(params)
|
||||
.then((res) => {
|
||||
if (isPrePay) {
|
||||
this.confirmPrice = +(res?.info?.pay_price || 0).toFixed(2);
|
||||
this.orderPrice = +(res?.info?.price || 0).toFixed(2);
|
||||
!this.useCouponInfo && this.setDefaultCoupon();
|
||||
} else {
|
||||
this.pay(res?.data)
|
||||
const plugin = tt.requirePlugin("tte57093cd7a7fbf2401");
|
||||
plugin.createOrder({
|
||||
goodsList: [
|
||||
{
|
||||
quantity: 10, // 购买数量 必填
|
||||
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();
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: err || "支付失败",
|
||||
icon: "none",
|
||||
.catch((err) => {});
|
||||
});
|
||||
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();
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -599,7 +278,7 @@
|
||||
height: 100%;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
background: #F7F8FA;
|
||||
background: #f7f8fa;
|
||||
|
||||
.info-cell {
|
||||
background: #fff;
|
||||
@ -643,14 +322,14 @@
|
||||
|
||||
.address-placeholder {
|
||||
font-size: 24rpx;
|
||||
color: #3D3D3D;
|
||||
color: #3d3d3d;
|
||||
padding: 20rpx 0rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.address-name {
|
||||
font-size: 28rpx;
|
||||
color: #3D3D3D;
|
||||
color: #3d3d3d;
|
||||
|
||||
.address-phone {
|
||||
margin-left: 8rpx;
|
||||
@ -691,7 +370,7 @@
|
||||
flex: 1;
|
||||
margin-left: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #3D3D3D;
|
||||
color: #3d3d3d;
|
||||
}
|
||||
}
|
||||
|
||||
@ -704,7 +383,7 @@
|
||||
width: 100%;
|
||||
padding: 24rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 1rpx solid #F5F5F5;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
@ -736,7 +415,7 @@
|
||||
.goods-name {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #3D3D3D;
|
||||
color: #3d3d3d;
|
||||
line-height: 40rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@ -747,7 +426,7 @@
|
||||
.goods-price {
|
||||
flex-shrink: 0;
|
||||
font-size: 28rpx;
|
||||
color: #3D3D3D;
|
||||
color: #3d3d3d;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
@ -813,19 +492,19 @@
|
||||
|
||||
.pay-label {
|
||||
font-size: 24rpx;
|
||||
color: #9B939A;
|
||||
color: #9b939a;
|
||||
}
|
||||
|
||||
.pay-value {
|
||||
font-size: 24rpx;
|
||||
color: #3D3D3D;
|
||||
color: #3d3d3d;
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-row {
|
||||
.coupon-price {
|
||||
font-size: 28rpx;
|
||||
color: #FF19A0;
|
||||
color: #ff19a0;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
@ -836,16 +515,16 @@
|
||||
justify-content: space-between;
|
||||
padding-top: 16rpx;
|
||||
margin-top: 16rpx;
|
||||
border-top: 1rpx solid #E5E5E5;
|
||||
border-top: 1rpx solid #e5e5e5;
|
||||
|
||||
.pay-label {
|
||||
font-size: 28rpx;
|
||||
color: #3D3D3D;
|
||||
color: #3d3d3d;
|
||||
}
|
||||
|
||||
.pay-total {
|
||||
font-size: 28rpx;
|
||||
color: #FF19A0;
|
||||
color: #ff19a0;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
@ -859,7 +538,7 @@
|
||||
padding: 24rpx 0;
|
||||
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1rpx solid #E5E5E5;
|
||||
border-bottom: 1rpx solid #e5e5e5;
|
||||
}
|
||||
|
||||
.payment-left {
|
||||
@ -874,7 +553,7 @@
|
||||
|
||||
.payment-text {
|
||||
font-size: 24rpx;
|
||||
color: #3D3D3D;
|
||||
color: #3d3d3d;
|
||||
}
|
||||
}
|
||||
|
||||
@ -943,7 +622,7 @@
|
||||
flex: 1;
|
||||
height: 92rpx;
|
||||
border-radius: 92rpx;
|
||||
border: 2rpx solid #FF19A0;
|
||||
border: 2rpx solid #ff19a0;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -951,7 +630,7 @@
|
||||
|
||||
.cancel-btn-text {
|
||||
font-size: 30rpx;
|
||||
color: #FF19A0;
|
||||
color: #ff19a0;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
@ -960,7 +639,7 @@
|
||||
flex: 1;
|
||||
height: 92rpx;
|
||||
border-radius: 92rpx;
|
||||
background: #FF19A0;
|
||||
background: #ff19a0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
@ -263,13 +263,20 @@
|
||||
|
||||
<!-- 待发货 -->
|
||||
<template v-if="[SHOP_ORDER_UNSLIVER].includes(orderData.status)">
|
||||
<!-- 使用原来的 RefundButton 组件 -->
|
||||
<!-- 抖音退款组件 -->
|
||||
<view class="refund-btn-wrapper">
|
||||
<refund-button
|
||||
mode="2"
|
||||
order-status="1"
|
||||
:order-id="orderData.order_no"
|
||||
<pay-button-sdk
|
||||
mode=1
|
||||
:order-id="orderData.order_no || orderData.order_id"
|
||||
:order-status="1"
|
||||
:refund-total-amount="Math.round((orderData.actual_price || 0) * 100)"
|
||||
:apply-refund-params="{
|
||||
reasonCode: [410],
|
||||
note: '用户申请退款',
|
||||
applySource: 101,
|
||||
afterSaleType: 3,
|
||||
needRefundPackFee: true
|
||||
}"
|
||||
@refund="handleRefundSuccess"
|
||||
@error="handleRefundError"
|
||||
/>
|
||||
@ -344,7 +351,6 @@
|
||||
import SliverInfo from "./components/SliverInfo.vue";
|
||||
import CallModal from "@/components/petOrder/call-modal.vue";
|
||||
import DraggableContact from "@/components/DraggableContact.vue";
|
||||
import RefundButton from "@/components/RefundButton.vue";
|
||||
import {
|
||||
walletTransaction,
|
||||
cancelPetOrderRefund,
|
||||
@ -391,8 +397,7 @@ import {
|
||||
SuccessModal,
|
||||
SliverInfo,
|
||||
CallModal,
|
||||
DraggableContact,
|
||||
RefundButton
|
||||
DraggableContact
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<view v-for="(data, index) in list" :key="data.order_id" :class="{ left: index % 2 === 0 }"
|
||||
class="flex-column-start news-item">
|
||||
<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"
|
||||
@jumpToDetails="jumpToDetails" />
|
||||
</view>
|
||||
@ -250,7 +250,7 @@ export default {
|
||||
mask: true,
|
||||
});
|
||||
const data = {
|
||||
order_id: this.orderInfo.order_id,
|
||||
id: this.orderInfo.order_id,
|
||||
// business_type:1
|
||||
}
|
||||
|
||||
@ -308,37 +308,58 @@ export default {
|
||||
title: "支付中",
|
||||
mask: true,
|
||||
});
|
||||
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,
|
||||
|
||||
const plugin = tt.requirePlugin('tta5a3d31e3aecfb9b11');
|
||||
plugin.continueToPay({
|
||||
orderId: "orderId", // 内部订单号
|
||||
outOrderNo: "outOrderNo", // 外部订单号 2个订单号必填一个
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
icon: "none",
|
||||
});
|
||||
this.additionalBom = false,
|
||||
this.elasticLayer = false,
|
||||
this.reloadData();
|
||||
const { orderId, outOrderNo } = res;
|
||||
console.log("success res", res);
|
||||
console.log("orderId", orderId, "outOrderNo", outOrderNo);
|
||||
},
|
||||
fail: (err) => {
|
||||
fail: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: err?.msg || "支付失败",
|
||||
icon: "none",
|
||||
});
|
||||
const { orderId, outOrderNo, errNo, errMsg, errLogId } = res;
|
||||
if (errLogId) {
|
||||
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.elasticLayer = true;
|
||||
@ -499,6 +520,16 @@ export default {
|
||||
this.cancelModalContent = "确定要退款吗?";
|
||||
this.orderInfo = data;
|
||||
},
|
||||
// 处理从 OrderItem 传来的退款事件
|
||||
handleRefundFromItem(data) {
|
||||
// 跳转到订单详情页处理退款,因为插件组件只能在页面中使用
|
||||
uni.navigateTo({
|
||||
url: `/pages/client/order/details?id=${data?.order_id}`,
|
||||
events: {
|
||||
refreshData: () => this.reloadData(),
|
||||
},
|
||||
});
|
||||
},
|
||||
// 联系客服按钮点击 - 使用自定义弹窗(与首页在线客服功能一致)
|
||||
handleContactBtnClick() {
|
||||
console.log('[list.vue] handleContactBtnClick called')
|
||||
|
||||
Reference in New Issue
Block a user