新增套餐推广

This commit is contained in:
gyq
2025-12-20 09:12:07 +08:00
parent 8826b206df
commit e8e474d971
15 changed files with 1584 additions and 441 deletions

View File

@@ -8,8 +8,8 @@
shape="circle"
clearable
v-model="queryForm.wareName"
@confirm="getGbWarePageAjax(1)"
@clear="getGbWarePageAjax(1)"
@confirm="resetGetList()"
@clear="resetGetList()"
></u-input>
</view>
<div class="ipt" @click="showStatusSheet = true">
@@ -19,19 +19,19 @@
<view class="list">
<view class="item" v-for="item in listData.list" :key="item.id">
<view class="header">
<text class="t1">成团人数{{ item.groupPeopleNum }}</text>
<text class="t1">成团期限小时{{ item.groupTimeoutHour }}</text>
<text class="t1">分享期限小时{{ item.expireHours }}</text>
<text class="t1">可用时段{{ item.useTimes }}</text>
</view>
<view class="goods-info">
<view class="img-wrap">
<image class="img" :src="item.wareImgs.split(',')[0]" mode="aspectFill"></image>
<image class="img" :src="item.images[0]" mode="aspectFill"></image>
</view>
<view class="info">
<text class="t1">{{ item.wareName }}</text>
<text class="t1">原价{{ item.originalPrice }}</text>
<text class="t1">拼团{{ item.groupPrice }}</text>
<text class="t1">{{ item.packageName }}</text>
<text class="t1">原价{{ item.originPrice }}</text>
<text class="t1">{{ item.price }}</text>
</view>
<view class="status">
<view class="status" v-if="item.shopId == shopInfo.id">
<view class="row">
<u-switch v-model="item.onlineStatus" :active-value="1" :inactive-value="0" @change="onlineStatusChange($event, item)"></u-switch>
</view>
@@ -41,20 +41,13 @@
</text>
</view>
</view>
<view class="footer-wrap">
<template v-if="!item.onlineStatus">
<view class="btn">
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
</view>
<view class="btn">
<u-button type="primary" shape="circle" @click="editorHandle(item)">编辑</u-button>
</view>
</template>
<template v-else>
<view class="btn" style="width: 150px">
<u-button shape="circle">下架后编辑/删除</u-button>
</view>
</template>
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
<view class="btn">
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
</view>
<view class="btn">
<u-button type="primary" shape="circle" @click="editorHandle(item)">编辑</u-button>
</view>
</view>
</view>
</view>
@@ -76,7 +69,8 @@
<script setup>
import { onMounted, reactive, ref } from 'vue';
import { getGbWarePage, editOnlineStatus, deleteGbWare } from '@/http/api/ware.js';
import { packageGet, packageOnline, packageDel } from '@/http/api/ware.js';
const shopInfo = ref('');
const props = defineProps({
top: {
@@ -96,7 +90,7 @@ const queryForm = reactive({
function sheetConfirm(e) {
queryForm.onlineStatusLabel = e.name;
queryForm.onlineStatus = e.value;
getGbWarePageAjax(1);
resetGetList();
}
const listData = reactive({
@@ -116,9 +110,9 @@ function reachBottom() {
// 改变状态
async function onlineStatusChange(e, item) {
try {
const res = await editOnlineStatus({
id: item.id,
onlineStatus: item.onlineStatus
const res = await packageOnline({
packageId: item.id,
status: item.onlineStatus
});
} catch (error) {
console.log(error);
@@ -130,7 +124,7 @@ async function onlineStatusChange(e, item) {
async function delHandle(item) {
uni.showModal({
title: '注意',
content: `确定删除${item.wareName}商品吗`,
content: `删除套餐推广所有未支付的订单都将自动取消,是否确定删除?`,
success: async (res) => {
try {
if (res.confirm) {
@@ -138,7 +132,7 @@ async function delHandle(item) {
title: '删除中...',
mask: true
});
const res = await deleteGbWare(item.id);
const res = await packageDel(item.id);
let index = listData.list.findIndex((val) => val.id == item.id);
listData.list.splice(index, 1);
}
@@ -152,16 +146,22 @@ async function delHandle(item) {
// 编辑
function editorHandle(item) {
uni.setStorageSync('groupGoods', item);
uni.setStorageSync('packageGoods', item);
uni.navigateTo({
url: '/pageMarket/groupGoods/addGoods?type=editor'
url: '/pageMarket/packagePopularize/addGoods?type=editor'
});
}
// 重置列表请求
function resetGetList() {
listData.page = 1;
getGbWarePageAjax();
}
// 拼团商品-列表
async function getGbWarePageAjax(page = listData.page, isPull = false) {
try {
const res = await getGbWarePage({
const res = await packageGet({
page: page,
size: listData.size,
...queryForm
@@ -192,11 +192,12 @@ async function getGbWarePageAjax(page = listData.page, isPull = false) {
defineExpose({
reachBottom,
getGbWarePageAjax
resetGetList
});
onMounted(() => {
getGbWarePageAjax();
shopInfo.value = uni.getStorageSync('shopInfo');
resetGetList();
});
</script>

View File

@@ -9,8 +9,8 @@
shape="circle"
clearable
v-model="queryForm.orderNo"
@confirm="gbOrderPageAjax(1)"
@clear="gbOrderPageAjax(1)"
@confirm="resetGetList()"
@clear="resetGetList()"
></u-input>
</view>
<div class="ipt" @click="dateRef.open()">
@@ -28,40 +28,40 @@
<view class="header">
<view class="left">
<text class="t1">订单号{{ item.orderNo }}</text>
<text class="t1">团单号{{ item.groupOrderNo }}</text>
</view>
<view class="status">
<u-tag plain plainFill :type="statusFilter(item.status).type">{{ item.status }}</u-tag>
<u-tag plain plainFill :type="statusFilter(item.status).type">{{ statusFilter(item.status).label }}</u-tag>
</view>
</view>
<view class="user-info">
<text class="t1">用户{{ item.userName }} {{ item.userPhone }}</text>
<text class="t1">用户{{ item.nickname }} {{ item.phone }}</text>
<text class="t2">核销码{{ item.verifyCode }}</text>
</view>
<view class="goods-info">
<image class="img" :src="item.wareJson.wareImgs.split(',')[0]" mode="aspectFill"></image>
<image class="img" :src="item.images[0]" mode="aspectFill"></image>
<view class="info">
<view class="left">
<text class="t1">{{ item.wareJson.wareName }}</text>
<text class="t1">x{{ item.num }}</text>
<text class="t1">{{ item.packageName }}</text>
<text class="t2">{{ item.price }}</text>
</view>
<view class="price">
<text class="t1">{{ item.payAmount }}</text>
<text class="t1">分享人数{{ item.shareNum || 0 }}</text>
<text class="t2">最终支付{{ item.payAmount || 0 }}</text>
</view>
</view>
</view>
<view class="time-wrap">
<text class="t">下单时间{{ item.createTime }}</text>
<text class="t">支付时间{{ item.payTime }}</text>
<text class="t" v-if="item.verifyTime">核销时间{{ item.verifyTime }}</text>
</view>
<view class="footer-wrap">
<view class="btn">
<u-button shape="circle" style="width: 100%" v-if="includesString(item.status, '退款中')" @click="showRefundPopupHandle(item)">审核</u-button>
<u-button shape="circle" style="width: 100%" v-if="item.status == 'refunding'" @click="showRefundPopupHandle(item)">审核</u-button>
</view>
<view class="btn" v-if="includesString(item.status, '待核销') || includesString(item.status, '待成团')">
<view class="btn" v-if="item.status == 'wait_verify'">
<u-button shape="circle" style="width: 100%" @click="refundHandle(item)">退款</u-button>
</view>
<view class="btn" v-if="includesString(item.status, '待核销')">
<view class="btn" v-if="item.status == 'wait_verify'">
<u-button type="primary" shape="circle" style="width: 100%" @click="checkoutHandle(item)">核销</u-button>
</view>
</view>
@@ -104,7 +104,7 @@
import dayjs from 'dayjs';
import { ref, reactive, onMounted } from 'vue';
import { includesString } from '@/utils/index.js';
import { gbOrderPage, agreeRefund, rejectRefund, checkout } from '@/http/api/ware.js';
import { packageOrder, packageConfirmRefund, packageRejectRefund, packageCheckout } from '@/http/api/ware.js';
const dateRef = ref(null);
@@ -128,7 +128,7 @@ function dateConfirmHandle(e) {
queryForm.orderStartTime = e.start;
queryForm.orderEndTime = e.end;
time.value = e.text;
gbOrderPageAjax(1);
resetGetList();
}
const statusActive = ref(0);
@@ -138,47 +138,54 @@ const tabs = ref([
label: '全部'
},
{
value: '待成团',
label: '待成团'
},
{
value: '待核销',
value: 'wait_verify',
label: '待核销'
},
{
value: '已核销',
value: 'finish',
label: '已核销'
},
{
value: '退款中',
value: 'refund',
label: '退款'
}
]);
const statusList = ref([
{
value: '待支付',
type: 'info'
},
{
value: '待核销',
label: '进行中',
value: 'ing',
type: 'warning'
},
{
value: '待成团',
label: '待核销',
value: 'wait_verify',
type: 'warning'
},
{
value: '已核销',
label: '已核销',
value: 'finish',
type: 'success'
},
{
label: '退款中',
value: 'refunding',
type: 'error'
},
{
label: '已退款',
value: 'refund',
type: 'info'
},
{
value: '退款中',
type: 'danger'
label: '已取消',
value: 'cancel',
type: 'info'
},
{
value: '已退款',
type: 'info'
label: '超时',
value: 'timeout',
type: 'error'
}
]);
@@ -197,9 +204,8 @@ function statusFilter(status) {
function tabChange(index) {
statusActive.value = index;
listData.page = 1;
queryForm.status = tabs.value[index].value;
gbOrderPageAjax();
resetGetList();
}
const listData = reactive({
@@ -221,14 +227,14 @@ function reachBottom() {
function refundHandle(item) {
uni.showModal({
title: '注意',
content: `确定要给[${item.userName}/${item.userPhone}]退款吗?`,
content: `确定要给[${item.nickname}/${item.phone}]退款吗?`,
success: async (res) => {
try {
if (res.confirm) {
uni.showLoading({
title: '退款中...'
});
const res = await agreeRefund({
const res = await packageConfirmRefund({
recordId: item.id,
orderNo: item.orderNo,
reason: ''
@@ -239,9 +245,10 @@ function refundHandle(item) {
icon: 'none'
});
}, 100);
goodsRecordPageAjax(1);
resetGetList();
}
} catch (error) {
console.log(error);
uni.hideLoading();
}
}
@@ -269,10 +276,10 @@ async function returnCostConfirmHandle() {
refundLoading.value = true;
if (refundForm.value.type == 1) {
// 同意
await agreeRefund(refundForm.value);
await packageConfirmRefund(refundForm.value);
} else {
// 驳回
await rejectRefund(refundForm.value);
await packageRejectRefund(refundForm.value);
}
showRefundPopup.value = false;
setTimeout(() => {
@@ -281,7 +288,7 @@ async function returnCostConfirmHandle() {
icon: 'none'
});
}, 100);
goodsRecordPageAjax(1);
resetGetList();
} catch (error) {
console.log(error);
}
@@ -299,15 +306,14 @@ async function checkoutHandle(item) {
title: '核销中...',
mask: true
});
await checkout(item.verifyCode);
await packageCheckout({ verifyCode: item.verifyCode });
setTimeout(() => {
uni.showToast({
title: '已核销',
icon: 'none'
});
}, 100);
item.status = '已核销';
item.verifyTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
resetGetList();
} catch (error) {
console.log(error);
}
@@ -316,19 +322,21 @@ async function checkoutHandle(item) {
});
}
// 重置列表请求
function resetGetList() {
listData.page = 1;
gbOrderPageAjax();
}
// 获取拼团商品:订单列表
async function gbOrderPageAjax(page = listData.page, isPull = false) {
async function gbOrderPageAjax() {
try {
const res = await gbOrderPage({
page: page,
const res = await packageOrder({
page: listData.page,
size: listData.size,
...queryForm
});
res.records.forEach((item) => {
item.wareJson = JSON.parse(item.wareJson);
});
if (listData.page == 1) {
listData.list = res.records;
} else {
@@ -345,11 +353,11 @@ async function gbOrderPageAjax(page = listData.page, isPull = false) {
defineExpose({
reachBottom,
gbOrderPageAjax
resetGetList
});
onMounted(() => {
gbOrderPageAjax();
resetGetList();
});
</script>
@@ -426,6 +434,11 @@ onMounted(() => {
color: #999;
font-size: 28upx;
}
.t2 {
color: #333;
font-size: 28upx;
font-weight: bold;
}
}
}
.user-info {
@@ -465,9 +478,15 @@ onMounted(() => {
}
}
.price {
display: flex;
flex-direction: column;
.t1 {
font-size: 32upx;
color: #333;
font-size: 28upx;
color: #666;
}
.t2 {
font-size: 28upx;
color: #ff383c;
font-weight: bold;
}
}