This commit is contained in:
2026-03-30 10:14:58 +08:00
parent 2c00299634
commit a98fb14ae7
12 changed files with 364 additions and 91 deletions

5
package-lock.json generated
View File

@ -36,6 +36,7 @@
"moment": "^2.29.3",
"mp-html": "^2.5.2",
"node-sass": "4.14.1",
"regenerator-runtime": "^0.14.1",
"sass": "1.26.2",
"sass-loader": "8.0.2",
"sass-resources-loader": "^2.2.4",
@ -22589,7 +22590,7 @@
},
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
},
"node_modules/regenerator-transform": {
@ -44878,7 +44879,7 @@
},
"regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
},
"regenerator-transform": {

View File

@ -76,6 +76,7 @@
"moment": "^2.29.3",
"mp-html": "^2.5.2",
"node-sass": "4.14.1",
"regenerator-runtime": "^0.14.1",
"sass": "1.26.2",
"sass-loader": "8.0.2",
"sass-resources-loader": "^2.2.4",

View File

@ -156,7 +156,7 @@ export const createOrder = ({
});
};
// 创建购物车订单
// 创建抖音订单
export const createCartOrder = ({
product_pic= "",
}) => {
@ -164,7 +164,7 @@ export const createCartOrder = ({
url: CREATE_CART_ORDER,
method: "post",
data: {
product_pic
orderId
},
});
};

View File

@ -232,8 +232,8 @@ export const DELETE_CART = "/product/cart/delete";
// 创建订单
export const CREATE_ORDER_NEW = "/product/order/create";
// 创建购物车订单
export const CREATE_CART_ORDER = "/product/order/create";
// 创建订单
export const CREATE_CART_ORDER = "/douyin/goods/order/create";
// 订单支付
export const PAY_ORDER_NEW = "/ttpay/jsapi";
// 订单列表

View File

@ -0,0 +1,187 @@
<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>

View File

@ -3,8 +3,8 @@ export default {
appName: "Wagoo",
appShareName: "Wagoo",
appId: "wx00e2dcdc7c02b23a",
// apiBaseUrl: "https://api.wagoo.me/api/v1", // 服务端测试地址
apiBaseUrl: "https://api.wagoo.pet/api/v1", // 服务端生产地址
apiBaseUrl: "https://api.wagoo.me/api/v1", // 服务端测试地址
// apiBaseUrl: "https://api.wagoo.pet/api/v1", // 服务端生产地址
// apiBaseUrl: "http:192.168.30.79", //本地接口
tencentMapKey: "WSBBZ-7OXK4-46QUC-KFB7B-4N3W7-M2BXM",
tencentSecret: "vb7D0PGj7xUvmOLuJz2Jd7ykTMpjiWRJ",

View File

@ -1,29 +1,25 @@
{
"name" : "Wagoo",
"appid" : "__UNI__F0AB43B",
"description" : "init",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
"app-plus" : {
/* 5+App */
"compatible" : {
"ignoreVersion" : true
"name": "Wagoo",
"appid": "tte57093cd7a7fbf2401",
"description": "init",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
"app-plus": {
"compatible": {
"ignoreVersion": true
},
"usingComponents" : true,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
"usingComponents": true,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
"modules" : {},
/* */
"distribute" : {
/* */
"android" : {
/* android */
"permissions" : [
"modules": {},
"distribute": {
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
@ -48,48 +44,61 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
"ios" : {},
/* ios */
"sdkConfigs" : {},
"splashscreen" : {
"useOriginalMsgbox" : true
"ios": {},
"sdkConfigs": {},
"splashscreen": {
"useOriginalMsgbox": true
}
}
},
/* SDK */
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wx00e2dcdc7c02b23a",
"setting" : {
"urlCheck" : false,
"minified" : true,
"postcss" : true,
"es6" : true,
"minifyJS" : true,
"minifyWXML" : true,
"minifyWXSS" : true
"quickapp": {},
"mp-weixin": {
"appid": "wx00e2dcdc7c02b23a",
"setting": {
"urlCheck": false,
"minified": true,
"postcss": true,
"es6": true,
"minifyJS": true,
"minifyWXML": true,
"minifyWXSS": true
},
"usingComponents" : true,
"lazyCodeLoading" : "requiredComponents",
"optimization" : {
"subPackages" : true
"libVersion": "2.0.0",
"usingComponents": true,
"lazyCodeLoading": "requiredComponents",
"optimization": {
"subPackages": true
},
"requiredPrivateInfos" : [],
"permission" : {},
"plugins" : {}
"requiredPrivateInfos": [],
"permission": {}
},
"mp-alipay" : {
"usingComponents" : true
"mp-alipay": {
"usingComponents": true
},
"mp-baidu" : {
"usingComponents" : true
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao" : {
"usingComponents" : true,
"appid" : "tte57093cd7a7fbf2401"
},
"mp-qq" : {
"usingComponents" : true
"mp-toutiao": {
"usingComponents": true,
"appid": "tte57093cd7a7fbf2401",
"libVersion": "2.0.0",
"setting": {
"urlCheck": false,
"minified": true,
"postcss": true,
"es6": true,
"minifyJS": true,
"minifyWXML": true,
"minifyWXSS": true
},
"plugins": {
"myTradePlugin": {
"version": "*",
"provider": "tta5a3d31e3aecfb9b11"
}
}
},
"mp-qq": {
"usingComponents": true
}
}

View File

@ -297,7 +297,11 @@
{
"path": "details",
"style": {
"navigationBarTitleText": "订单详情"
"navigationBarTitleText": "订单详情",
"usingComponents": {
"refund-button": "plugin://myTradePlugin/pay-button",
"pay-button-sdk": "plugin://myTradePlugin/pay-button"
}
}
},
{
@ -309,7 +313,10 @@
{
"path": "list",
"style": {
"navigationBarTitleText": "商城订单"
"navigationBarTitleText": "商城订单",
"usingComponents": {
"pay-button-sdk": "plugin://myTradePlugin/pay-button"
}
}
},
{
@ -527,7 +534,6 @@
{
"path": "coupon-package",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
@ -552,14 +558,12 @@
{
"path": "member-inter",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path": "member-interests",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}

View File

@ -77,10 +77,21 @@
>
申请售后
</view> -->
<view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('refund', data)">
<!-- <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"
</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"
@click.stop="jumpToReservation">
立即预约
</view>
@ -92,6 +103,7 @@
<!-- <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>
@ -143,6 +155,7 @@
<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,
@ -190,6 +203,7 @@
components: {
GoodInfo,
PopUpModal,
RefundButton
},
options: {
styleIsolation: "shared",
@ -244,6 +258,20 @@
this.stopCountDown();
},
methods: {
handleRefund(e) {
console.log('退款结果:', e.detail)
if (e.detail.status === 'success') {
uni.showToast({ title: '退款申请已提交', icon: 'success' })
this.$emit('refund', this.data)
} else {
uni.showToast({ title: '退款失败', icon: 'none' })
}
},
handleError(e) {
console.error('组件错误:', e.detail)
},
startCountDown() {
this.stopCountDown();
if (this.countDownTime > 0) {
@ -394,6 +422,7 @@
.good-info-multi {
padding-top: 20rpx;
}
}
}
</style>

View File

@ -246,6 +246,7 @@
}
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,
@ -581,13 +582,6 @@
});
},
confirmPay() {
if (this.WeChat === undefined && this.wallet === undefined) {
uni.showToast({
title: '请选择支付方式',
icon: "none",
});
return
}
this.createOrder()
},
changeSliverType(item) {

View File

@ -263,8 +263,16 @@
<!-- 待发货 -->
<template v-if="[SHOP_ORDER_UNSLIVER].includes(orderData.status)">
<view class="handle-btn" @click.stop="showCancelModal = true">
<text class="fs-32 btnColor" style="color: #FF19A0;">退款</text>
<!-- 使用原来的 RefundButton 组件 -->
<view class="refund-btn-wrapper">
<refund-button
mode="2"
order-status="1"
:order-id="orderData.order_no"
:refund-total-amount="Math.round((orderData.actual_price || 0) * 100)"
@refund="handleRefundSuccess"
@error="handleRefundError"
/>
</view>
<view class="handle-btn" @click.stop="remindSliver">
<text class="fs-32 btnColor">立即预约</text>
@ -336,6 +344,7 @@
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,
@ -383,6 +392,7 @@ import {
SliverInfo,
CallModal,
DraggableContact,
RefundButton
},
data() {
return {
@ -716,6 +726,19 @@ import {
}
this.jumpToWeChat();
},
// 退款成功回调
handleRefundSuccess(e) {
console.log('退款成功:', e.detail)
uni.showToast({ title: '退款申请已提交', icon: 'success' })
this.getOrderDetail()
},
// 退款错误回调
handleRefundError(e) {
console.error('退款错误:', e.detail)
uni.showToast({ title: e.detail.message || '退款失败', icon: 'none' })
},
formatSecond(seconds) {
const hour = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds - hour * 3600) / 60);
@ -1113,20 +1136,29 @@ import {
box-sizing: border-box;
display: flex;
flex-direction: row;
justify-content: flex-end;
justify-content: space-between;
background-color: #ffffff;
padding-top: 12rpx;
align-items: center;
.refund-btn-wrapper {
flex: 1;
min-width: 0;
width: calc(50% - 12rpx) !important;
height: 48px;
}
.handle-btn {
flex: 1;
min-width: 0;
height: 48px;
border-radius: 100px;
border: 2rpx solid #ff19a0;
display: flex;
align-items: center;
justify-content: center;
margin-left: 24rpx;
flex: 1;
background: transparent;
width: calc(50% - 12rpx) !important;
.btnColor {
color: #ff19a0;
@ -1144,6 +1176,15 @@ import {
color: #fff !important;
}
}
// 确保 RefundButton 组件也能正确平均分配空间
::v-deep .refund-button-wrapper {
margin-left: 0 !important;
width: 100% !important;
height: 100% !important;
flex: 1 !important;
min-width: 0 !important;
}
}
.contact-float-btn {
@ -1203,5 +1244,6 @@ import {
}
}
}
}
</style>

View File

@ -253,7 +253,13 @@ export default {
order_id: this.orderInfo.order_id,
// business_type:1
}
cancelPetOrderMall(data).then((res) => {
// 判断是取消订单还是退款
const apiPromise = this.cancelModalContent.includes('退款')
? cancelPetOrderRefund(data)
: cancelPetOrderMall(data);
apiPromise.then((res) => {
uni.hideLoading();
this.showCancelModal = false;
this.reloadData();