新增套餐推广

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

@@ -71,7 +71,7 @@ const emits = defineEmits(['confirm', 'cancel']);
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 99; z-index: 999;
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px; padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
background-color: #fff; background-color: #fff;
&.horizontal { &.horizontal {

View File

@@ -1,118 +1,110 @@
<template> <template>
<view> <view>
<up-radio-group v-model="useTimeType" placement="row"> <up-radio-group v-model="useTimeType" placement="row" v-if="showType">
<up-radio <up-radio v-for="item in useTimeTypeList" :key="item.value" :value="item.value" :name="item.value" :label="item.label" :customStyle="customStyle"></up-radio>
v-for="item in useTimeTypeList" </up-radio-group>
:key="item.value" <view class="container" v-if="useTimeType == 'custom' || !showType">
:value="item.value" <view class="u-flex u-m-t-30 box">
:name="item.value" <view class="u-flex u-flex-1">
:label="item.label" <view class="item" @click="pirckerShow(startValue, 'startValue')">
:customStyle="customStyle" <text class="u-m-r-12" v-if="!startValue">开始时间</text>
></up-radio> <text class="u-m-r-12" v-else>{{ startValue }}</text>
</up-radio-group> </view>
<view class="container" v-if="useTimeType == 'custom'"> <view class="u-m-l-8 u-m-r-8" style="padding: 0 30rpx"></view>
<view class="u-flex u-m-t-30 box" > <view class="item" @click="pirckerShow(endValue, 'endValue')">
<view class="u-flex u-flex-1"> <text class="u-m-r-12" v-if="!endValue">结束时间</text>
<view class="item" @click="pirckerShow(startValue, 'startValue')"> <text class="u-m-r-12" v-else>{{ endValue }}</text>
<text class="u-m-r-12" v-if="!startValue">开始时间</text> </view>
<text class="u-m-r-12" v-else>{{ startValue }}</text> </view>
</view> <up-icon name="clock"></up-icon>
<view class="u-m-l-8 u-m-r-8" style="padding: 0 30rpx"></view> </view>
<view class="item" @click="pirckerShow(endValue, 'endValue')"> </view>
<text class="u-m-r-12" v-if="!endValue">结束时间</text>
<text class="u-m-r-12" v-else>{{ endValue }}</text>
</view>
</view>
<up-icon name="clock"></up-icon>
</view>
</view>
<up-datetime-picker <up-datetime-picker :show="show" v-model="value1" closeOnClickOverlay @close="close" @cancel="close" @confirm="confirm" mode="time"></up-datetime-picker>
:show="show" </view>
v-model="value1"
closeOnClickOverlay
@close="close"
@cancel="close"
@confirm="confirm"
mode="time"
></up-datetime-picker>
</view>
</template> </template>
<script setup> <script setup>
import { computed, ref } from "vue"; import { computed, ref } from 'vue';
function cancel(){
union.navigateBack() const props = defineProps({
} showType: {
const customStyle = ref({ type: Boolean,
marginRight: "15px", default: true
}
}); });
const useTimeType = defineModel("useTimeType", { function cancel() {
type: String, union.navigateBack();
default: "all", }
const customStyle = ref({
marginRight: '15px'
});
const useTimeType = defineModel('useTimeType', {
type: String,
default: 'all'
}); });
const useTimeTypeList = [ const useTimeTypeList = [
{ {
value: "all", value: 'all',
label: "全时段可用", label: '全时段可用'
}, },
{ {
value: "custom", value: 'custom',
label: "指定时间段可用", label: '指定时间段可用'
}, }
]; ];
import dayjs from "dayjs"; import dayjs from 'dayjs';
const startValue = defineModel("startValue", { const startValue = defineModel('startValue', {
type: String, type: String,
default: "", default: ''
}); });
const endValue = defineModel("endValue", { const endValue = defineModel('endValue', {
type: String, type: String,
default: "", default: ''
}); });
function close() { function close() {
show.value = false; show.value = false;
} }
const value1 = ref(""); const value1 = ref('');
const show = ref(false); const show = ref(false);
const nowKey = ref(""); const nowKey = ref('');
function pirckerShow(date, key) { function pirckerShow(date, key) {
nowKey.value = key; nowKey.value = key;
show.value = true; show.value = true;
value1.value = date || ""; value1.value = date || '';
} }
function confirm(e) { function confirm(e) {
console.log(e); console.log(e);
if (nowKey.value == "startValue") { if (nowKey.value == 'startValue') {
startValue.value = e.value; startValue.value = e.value;
} else if (nowKey.value == "endValue") { } else if (nowKey.value == 'endValue') {
endValue.value = e.value; endValue.value = e.value;
} }
value1.value = e.value; value1.value = e.value;
show.value = false; show.value = false;
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.item { .item {
font-size: 28rpx; font-size: 28rpx;
color: #666; color: #666;
line-height: 48rpx; line-height: 48rpx;
padding: 0 12rpx; padding: 0 12rpx;
display: flex; display: flex;
} }
.box { .box {
border: 2rpx solid #dddfe6; border: 2rpx solid #dddfe6;
padding: 16rpx 30rpx; padding: 16rpx 30rpx;
box-sizing: border-box; box-sizing: border-box;
width: 564rpx; width: 564rpx;
border-radius: 4rpx; border-radius: 4rpx;
overflow: hidden; overflow: hidden;
} }
</style> </style>

View File

@@ -1,63 +1,57 @@
<template> <template>
<view> <view>
<up-checkbox-group v-model="selectedWeek" :options="week"> <up-checkbox-group v-model="selectedWeek" :options="week">
<up-checkbox <up-checkbox :customStyle="customStyle" :shape="shape" v-for="item in week" :key="item.value" :value="item.value" :name="item.value" :label="item.value">
:customStyle="customStyle" {{ item.name }}
:shape="shape" </up-checkbox>
v-for="item in week" </up-checkbox-group>
:key="item.value" </view>
:value="item.value"
:name="item.value"
:label="item.value"
>{{ item.name }}</up-checkbox>
</up-checkbox-group>
</view>
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { ref } from 'vue';
const customStyle={ const customStyle = {
marginRight: '40rpx', marginRight: '40rpx',
marginBottom: '16rpx', marginBottom: '16rpx'
} };
const props = defineProps({ const props = defineProps({
shape: { shape: {
type: String, type: String,
default: 'square' // circle default: 'square' // circle
}, }
}); });
const selectedWeek=defineModel({ const selectedWeek = defineModel({
type: Array, type: Array,
default: () => [], default: () => []
}); });
const week = ref([ const week = ref([
{ {
name: "周一", name: '周一',
value:"周一", value: '周一'
}, },
{ {
name: "周二", name: '周二',
value:"周二", value: '周二'
}, },
{ {
name: "周三", name: '周三',
value:"周三", value: '周三'
}, },
{ {
name: "周四", name: '周四',
value:"周四", value: '周四'
}, },
{ {
name: "周五", name: '周五',
value:"周五", value: '周五'
}, },
{ {
name: "周六", name: '周六',
value:"周六", value: '周六'
}, },
{ {
name: "周日", name: '周日',
value:"周日", value: '周日'
}, }
]); ]);
</script> </script>

View File

@@ -1,6 +1,7 @@
import http from '@/http/http.js' import http from '@/http/http.js'
const request = http.request const request = http.request
const ORDER_URL = 'order' const ORDER_URL = 'order'
const Market_BaseUrl = 'market'
/** /**
* 拼团商品-列表 * 拼团商品-列表
@@ -120,3 +121,157 @@ export function checkout(data) {
data data
}) })
} }
/**
* 套餐推广:添加套餐
* @param {*} data
* @returns
*/
export function packageAddEdit(data) {
return request({
url: `${Market_BaseUrl}/admin/package`,
method: data.id ? 'put' : 'post',
data,
});
}
/**
* 套餐推广:获取套餐列表
* @param {*} data
* @returns
*/
export function packageGet(params) {
return request({
url: `${Market_BaseUrl}/admin/package`,
method: 'get',
params,
});
}
/**
* 套餐推广:获取套餐推广开关
* @param {*} data
* @returns
*/
export function packageSwitchGet() {
return request({
url: `${Market_BaseUrl}/admin/package/switch`,
method: 'get'
});
}
/**
* 套餐推广:修改套餐推广开关
* @param {*} data
* @returns
*/
export function packageSwitchPut(data) {
return request({
url: `${Market_BaseUrl}/admin/package/switch`,
method: 'put',
data
});
}
/**
* 套餐推广:删除套餐
* @param {*} data
* @returns
*/
export function packageDel(id) {
return request({
url: `${Market_BaseUrl}/admin/package/${id}`,
method: 'DELETE'
});
}
/**
* 套餐推广:确认删除套餐
* @param {*} data
* @returns
*/
export function packageSureDel(id) {
return request({
url: `${Market_BaseUrl}/admin/package/sure/${id}`,
method: 'DELETE'
});
}
/**
* 套餐推广:修改套餐推广开关
* @param {*} data
* @returns
*/
export function packageOnline(data) {
return request({
url: `${Market_BaseUrl}/admin/package/online`,
method: 'put',
data
});
}
/**
* 套餐推广:获取套餐推广订单列表
* @param {*} data
* @returns
*/
export function packageOrder(params) {
return request({
url: `${Market_BaseUrl}/admin/package/order`,
method: 'GET',
params
});
}
/**
* 套餐推广:订单统计
* @param {*} data
* @returns
*/
export function packageOrderStat(params) {
return request({
url: `${Market_BaseUrl}/admin/package/order/stat`,
method: 'GET',
params
});
}
/**
* 套餐推广:确认退单
* @param {*} data
* @returns
*/
export function packageConfirmRefund(data) {
return request({
url: `${ORDER_URL}/admin/ppOrder/confirmRefund`,
method: 'post',
data
});
}
/**
* 套餐推广:驳回退单
* @param {*} data
* @returns
*/
export function packageRejectRefund(data) {
return request({
url: `${ORDER_URL}/admin/ppOrder/rejectRefund`,
method: 'post',
data
});
}
/**
* 套餐推广:核销
* @param {*} data
* @returns
*/
export function packageCheckout(data) {
return request({
url: `${ORDER_URL}/admin/ppOrder/checkout`,
method: 'post',
data
});
}

View File

@@ -8,9 +8,14 @@
<text class="t">可用门店</text> <text class="t">可用门店</text>
</view> </view>
<view class="info"> <view class="info">
<view class="ipt"> <view class="ipt" v-if="isMainShop()">
<my-shop-select-w v-model:useType="form.useShopType" v-model:selShops="form.useShops"></my-shop-select-w> <my-shop-select-w v-model:useType="form.useShopType" v-model:selShops="form.useShops"></my-shop-select-w>
</view> </view>
<view class="ipt" v-else>
<u-radio-group v-model="form.useShopType">
<u-radio label="仅本店" name="only"></u-radio>
</u-radio-group>
</view>
</view> </view>
</view> </view>
</u-form-item> </u-form-item>
@@ -20,6 +25,7 @@
<view class="switch-wrap"> <view class="switch-wrap">
<view class="top"> <view class="top">
<text class="t">商品名称</text> <text class="t">商品名称</text>
<text class="t2" @click="toSelectGoodS">导入已有商品</text>
</view> </view>
<view class="info"> <view class="info">
<view class="ipt"> <view class="ipt">
@@ -147,9 +153,10 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app'; import { onLoad, onShow } from '@dcloudio/uni-app';
import { filterNumberInput } from '@/utils/index.js'; import { filterNumberInput } from '@/utils/index.js';
import { addGbWare, updateGbWareById } from '@/http/api/ware.js'; import { addGbWare, updateGbWareById } from '@/http/api/ware.js';
import { isMainShop } from '@/store/account.js';
const type = ref('add'); // add添加商品 editor编辑商品 const type = ref('add'); // add添加商品 editor编辑商品
const formRef = ref(null); const formRef = ref(null);
@@ -283,6 +290,13 @@ const rules = ref({
] ]
}); });
// 跳转去选择商品
function toSelectGoodS() {
uni.navigateTo({
url: '/pageMarket/groupGoods/selectGoods'
});
}
const limitBuyNumFalseNum = -10086; const limitBuyNumFalseNum = -10086;
function limitBuyNumSwitchChange(e) { function limitBuyNumSwitchChange(e) {
if (e) { if (e) {
@@ -347,6 +361,8 @@ function submitHandle() {
if (form.value.wareCommentImgs.length) { if (form.value.wareCommentImgs.length) {
data.wareCommentImgs = form.value.wareCommentImgs.join(','); data.wareCommentImgs = form.value.wareCommentImgs.join(',');
} else {
data.wareCommentImgs = '';
} }
if (form.value.id) { if (form.value.id) {
@@ -406,7 +422,22 @@ function getLocalGoods() {
} }
} }
// 从本地获取已选择的拼团商品
function getLocalGroupProduct() {
let groupGoods = uni.getStorageSync('groupProduct');
if (groupGoods && groupGoods.coverImg) {
form.value.wareName = groupGoods.name;
form.value.wareImgs = [groupGoods.coverImg];
form.value.originalPrice = groupGoods.price;
}
}
onShow(() => {
getLocalGroupProduct();
});
onLoad((options) => { onLoad((options) => {
uni.setStorageSync('groupProduct', '');
if (options.type && options.type == 'editor') { if (options.type && options.type == 'editor') {
type.value = options.type; type.value = options.type;
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
@@ -456,6 +487,10 @@ page {
font-size: 24upx; font-size: 24upx;
color: #666; color: #666;
} }
.t2 {
font-size: 28upx;
color: #3c9cff;
}
} }
.info { .info {
padding-top: 16upx; padding-top: 16upx;

View File

@@ -8,8 +8,8 @@
shape="circle" shape="circle"
clearable clearable
v-model="queryForm.wareName" v-model="queryForm.wareName"
@confirm="getGbWarePageAjax(1)" @confirm="resetGetList()"
@clear="getGbWarePageAjax(1)" @clear="resetGetList()"
></u-input> ></u-input>
</view> </view>
<div class="ipt" @click="showStatusSheet = true"> <div class="ipt" @click="showStatusSheet = true">
@@ -31,7 +31,7 @@
<text class="t1">原价{{ item.originalPrice }}</text> <text class="t1">原价{{ item.originalPrice }}</text>
<text class="t1">拼团价{{ item.groupPrice }}</text> <text class="t1">拼团价{{ item.groupPrice }}</text>
</view> </view>
<view class="status"> <view class="status" v-if="item.shopId == shopInfo.id">
<view class="row"> <view class="row">
<u-switch v-model="item.onlineStatus" :active-value="1" :inactive-value="0" @change="onlineStatusChange($event, item)"></u-switch> <u-switch v-model="item.onlineStatus" :active-value="1" :inactive-value="0" @change="onlineStatusChange($event, item)"></u-switch>
</view> </view>
@@ -41,7 +41,7 @@
</text> </text>
</view> </view>
</view> </view>
<view class="footer-wrap"> <view class="footer-wrap" v-if="item.shopId == shopInfo.id">
<template v-if="!item.onlineStatus"> <template v-if="!item.onlineStatus">
<view class="btn"> <view class="btn">
<u-button shape="circle" @click="delHandle(item)">删除</u-button> <u-button shape="circle" @click="delHandle(item)">删除</u-button>
@@ -77,6 +77,7 @@
<script setup> <script setup>
import { onMounted, reactive, ref } from 'vue'; import { onMounted, reactive, ref } from 'vue';
import { getGbWarePage, editOnlineStatus, deleteGbWare } from '@/http/api/ware.js'; import { getGbWarePage, editOnlineStatus, deleteGbWare } from '@/http/api/ware.js';
const shopInfo = ref('');
const props = defineProps({ const props = defineProps({
top: { top: {
@@ -96,7 +97,7 @@ const queryForm = reactive({
function sheetConfirm(e) { function sheetConfirm(e) {
queryForm.onlineStatusLabel = e.name; queryForm.onlineStatusLabel = e.name;
queryForm.onlineStatus = e.value; queryForm.onlineStatus = e.value;
getGbWarePageAjax(1); resetGetList();
} }
const listData = reactive({ const listData = reactive({
@@ -158,11 +159,17 @@ function editorHandle(item) {
}); });
} }
// 重置列表请求
function resetGetList() {
listData.page = 1;
getGbWarePageAjax();
}
// 拼团商品-列表 // 拼团商品-列表
async function getGbWarePageAjax(page = listData.page, isPull = false) { async function getGbWarePageAjax() {
try { try {
const res = await getGbWarePage({ const res = await getGbWarePage({
page: page, page: listData.page,
size: listData.size, size: listData.size,
...queryForm ...queryForm
}); });
@@ -179,24 +186,19 @@ async function getGbWarePageAjax(page = listData.page, isPull = false) {
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
if (isPull) { setTimeout(() => {
setTimeout(() => { uni.stopPullDownRefresh();
uni.showToast({ }, 300);
title: '刷新成功',
icon: 'none'
});
uni.stopPullDownRefresh();
}, 300);
}
} }
defineExpose({ defineExpose({
reachBottom, reachBottom,
getGbWarePageAjax resetGetList
}); });
onMounted(() => { onMounted(() => {
getGbWarePageAjax(); shopInfo.value = uni.getStorageSync('shopInfo');
resetGetList();
}); });
</script> </script>

View File

@@ -9,8 +9,8 @@
shape="circle" shape="circle"
clearable clearable
v-model="queryForm.orderNo" v-model="queryForm.orderNo"
@confirm="gbOrderPageAjax(1)" @confirm="resetGetList(1)"
@clear="gbOrderPageAjax(1)" @clear="resetGetList(1)"
></u-input> ></u-input>
</view> </view>
<div class="ipt" @click="dateRef.open()"> <div class="ipt" @click="dateRef.open()">
@@ -128,7 +128,7 @@ function dateConfirmHandle(e) {
queryForm.orderStartTime = e.start; queryForm.orderStartTime = e.start;
queryForm.orderEndTime = e.end; queryForm.orderEndTime = e.end;
time.value = e.text; time.value = e.text;
gbOrderPageAjax(1); resetGetList();
} }
const statusActive = ref(0); const statusActive = ref(0);
@@ -199,7 +199,7 @@ function tabChange(index) {
statusActive.value = index; statusActive.value = index;
listData.page = 1; listData.page = 1;
queryForm.status = tabs.value[index].value; queryForm.status = tabs.value[index].value;
gbOrderPageAjax(); resetGetList();
} }
const listData = reactive({ const listData = reactive({
@@ -239,7 +239,7 @@ function refundHandle(item) {
icon: 'none' icon: 'none'
}); });
}, 100); }, 100);
goodsRecordPageAjax(1); resetGetList();
} }
} catch (error) { } catch (error) {
uni.hideLoading(); uni.hideLoading();
@@ -281,7 +281,7 @@ async function returnCostConfirmHandle() {
icon: 'none' icon: 'none'
}); });
}, 100); }, 100);
gbOrderPageAjax(1); resetGetList();
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@@ -294,33 +294,40 @@ async function checkoutHandle(item) {
title: '注意', title: '注意',
content: '确认要核销吗?', content: '确认要核销吗?',
success: async (res) => { success: async (res) => {
try { if (res.confirm) {
uni.showLoading({ try {
title: '核销中...', uni.showLoading({
mask: true title: '核销中...',
}); mask: true
await checkout(item.verifyCode);
setTimeout(() => {
uni.showToast({
title: '已核销',
icon: 'none'
}); });
}, 100); await checkout(item.verifyCode);
item.status = '已核销'; setTimeout(() => {
item.verifyTime = dayjs().format('YYYY-MM-DD HH:mm:ss'); uni.showToast({
} catch (error) { title: '已核销',
console.log(error); icon: 'none'
});
}, 100);
resetGetList();
} catch (error) {
console.log(error);
}
uni.hideLoading();
} }
uni.hideLoading();
} }
}); });
} }
// 重置列表请求
function resetGetList() {
listData.page = 1;
gbOrderPageAjax();
}
// 获取拼团商品:订单列表 // 获取拼团商品:订单列表
async function gbOrderPageAjax(page = listData.page, isPull = false) { async function gbOrderPageAjax() {
try { try {
const res = await gbOrderPage({ const res = await gbOrderPage({
page: page, page: listData.page,
size: listData.size, size: listData.size,
...queryForm ...queryForm
}); });
@@ -345,11 +352,11 @@ async function gbOrderPageAjax(page = listData.page, isPull = false) {
defineExpose({ defineExpose({
reachBottom, reachBottom,
gbOrderPageAjax resetGetList
}); });
onMounted(() => { onMounted(() => {
gbOrderPageAjax(); resetGetList();
}); });
</script> </script>

View File

@@ -32,6 +32,7 @@ import goodsList from './components/goodsList.vue';
import orderList from './components/orderList.vue'; import orderList from './components/orderList.vue';
import { upShopConfig } from '@/http/api/ware.js'; import { upShopConfig } from '@/http/api/ware.js';
import { getShopInfo } from '@/http/api/shop.js'; import { getShopInfo } from '@/http/api/shop.js';
import { isMainShop } from '@/store/account.js';
const goodsListRef = ref(null); const goodsListRef = ref(null);
const orderListRef = ref(null); const orderListRef = ref(null);
@@ -67,7 +68,23 @@ const form = ref({
watch( watch(
() => form.value.onlineStatus, () => form.value.onlineStatus,
(newValue, oldValue) => { (newValue, oldValue) => {
upShopConfigAjax(); if (loading.value == false) {
if (newValue == 0) {
uni.showModal({
title: '注意',
content: '关闭拼团商品所有未支付的订单都将自动取消,是否确定关闭?',
success: (res) => {
if (res.confirm) {
upShopConfigAjax();
} else {
form.value.onlineStatus = 1;
}
}
});
} else {
upShopConfigAjax();
}
}
} }
); );
@@ -79,6 +96,9 @@ async function upShopConfigAjax() {
mask: true mask: true
}); });
const res = await upShopConfig(form.value); const res = await upShopConfig(form.value);
if (tabsActive.value == 0) {
goodsListRef.value?.resetGetList();
}
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@@ -89,10 +109,10 @@ async function upShopConfigAjax() {
onPullDownRefresh(() => { onPullDownRefresh(() => {
switch (tabsActive.value) { switch (tabsActive.value) {
case 0: case 0:
goodsListRef.value?.getGbWarePageAjax(1, true); goodsListRef.value?.resetGetList();
break; break;
case 1: case 1:
orderListRef.value?.getGbWarePageAjax(1, true); orderListRef.value?.resetGetList();
break; break;
default: default:
break; break;
@@ -114,20 +134,25 @@ onReachBottom(() => {
}); });
// 获取配置信息 // 获取配置信息
const loading = ref(true);
async function getShopInfoAjax() { async function getShopInfoAjax() {
try { try {
loading.value = true;
const res = await getShopInfo(); const res = await getShopInfo();
form.value.onlineStatus = res.isGroupBuy; form.value.onlineStatus = res.isGroupBuy;
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
setTimeout(() => {
loading.value = false;
}, 500);
} }
// 页面显示 // 页面显示
onShow(() => { onShow(() => {
switch (tabsActive.value) { switch (tabsActive.value) {
case 0: case 0:
goodsListRef.value?.getGbWarePageAjax(1); goodsListRef.value?.resetGetList();
break; break;
case 1: case 1:
break; break;

View File

@@ -0,0 +1,95 @@
<template>
<view class="list">
<view class="item" v-for="item in list" :key="item.id" @click="selectGoods(item)">
<image class="cover" :src="item.coverImg" mode="aspectFill"></image>
<view class="info">
<text class="name">{{ item.name }}</text>
<text class="price">{{ returnPrice(item.skuList) }}</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { getProductList } from '@/http/api/product.js';
// 商品列表
const list = ref([]);
// 选择商品
function selectGoods(item) {
uni.setStorageSync('groupProduct', {
coverImg: item.coverImg,
name: item.name,
price: returnPrice(item.skuList)
});
uni.navigateBack();
}
// 返回规格最高价
function returnPrice(skuList) {
return Math.max(...skuList.map((item) => item.salePrice));
}
// 获取商品列表
async function getProductListAjax() {
try {
uni.showLoading({
title: '加载中...',
mask: true
});
const res = await getProductList();
list.value = res;
} catch (error) {
console.log(error);
}
uni.hideLoading();
}
onLoad(() => {
getProductListAjax();
});
</script>
<style>
page {
background-color: #f8f8f8;
}
</style>
<style scoped lang="scss">
.list {
padding: 28upx;
.item {
padding: 28upx;
background-color: #fff;
border-radius: 20upx;
display: flex;
&:not(:first-child) {
margin-top: 28upx;
}
.cover {
$size: 120upx;
width: $size;
height: $size;
border-radius: 16upx;
}
.info {
flex: 1;
display: flex;
flex-direction: column;
gap: 12upx;
padding-left: 28upx;
.name {
font-size: 32upx;
color: #333;
}
.price {
font-size: 32upx;
color: red;
}
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@@ -31,8 +31,7 @@ import { ref, watch } from 'vue';
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'; import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import goodsList from './components/goodsList.vue'; import goodsList from './components/goodsList.vue';
import orderList from './components/orderList.vue'; import orderList from './components/orderList.vue';
import { upShopConfig } from '@/http/api/ware.js'; import { packageSwitchGet, packageSwitchPut } from '@/http/api/ware.js';
import { getShopInfo } from '@/http/api/shop.js';
const goodsListRef = ref(null); const goodsListRef = ref(null);
const orderListRef = ref(null); const orderListRef = ref(null);
@@ -56,7 +55,7 @@ function tabClickHandle(item, index) {
function toAdd() { function toAdd() {
uni.navigateTo({ uni.navigateTo({
url: '/pageMarket/groupGoods/addGoods' url: '/pageMarket/packagePopularize/addGoods'
}); });
} }
@@ -68,7 +67,23 @@ const form = ref({
watch( watch(
() => form.value.onlineStatus, () => form.value.onlineStatus,
(newValue, oldValue) => { (newValue, oldValue) => {
upShopConfigAjax(); if (loading.value == false) {
if (newValue == 0) {
uni.showModal({
title: '注意',
content: '关闭套餐推广所有未支付的订单都将自动取消,是否确定关闭?',
success: (res) => {
if (res.confirm) {
upShopConfigAjax();
} else {
form.value.onlineStatus = 1;
}
}
});
} else {
upShopConfigAjax();
}
}
} }
); );
@@ -79,7 +94,10 @@ async function upShopConfigAjax() {
title: '保存中...', title: '保存中...',
mask: true mask: true
}); });
const res = await upShopConfig(form.value); await packageSwitchPut({ status: form.value.onlineStatus });
if (tabsActive.value == 0) {
goodsListRef.value?.resetGetList();
}
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@@ -90,10 +108,10 @@ async function upShopConfigAjax() {
onPullDownRefresh(() => { onPullDownRefresh(() => {
switch (tabsActive.value) { switch (tabsActive.value) {
case 0: case 0:
goodsListRef.value?.getGbWarePageAjax(1, true); goodsListRef.value?.resetGetList();
break; break;
case 1: case 1:
orderListRef.value?.getGbWarePageAjax(1, true); orderListRef.value?.gbOrderPageAjax(1, true);
break; break;
default: default:
break; break;
@@ -115,20 +133,25 @@ onReachBottom(() => {
}); });
// 获取配置信息 // 获取配置信息
const loading = ref(true);
async function getShopInfoAjax() { async function getShopInfoAjax() {
try { try {
const res = await getShopInfo(); loading.value = true;
form.value.onlineStatus = res.isGroupBuy; const res = await packageSwitchGet();
form.value.onlineStatus = res;
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
setTimeout(() => {
loading.value = false;
}, 500);
} }
// 页面显示 // 页面显示
onShow(() => { onShow(() => {
switch (tabsActive.value) { switch (tabsActive.value) {
case 0: case 0:
goodsListRef.value?.getGbWarePageAjax(1); goodsListRef.value?.resetGetList();
break; break;
case 1: case 1:
break; break;

View File

@@ -0,0 +1,95 @@
<template>
<view class="list">
<view class="item" v-for="item in list" :key="item.id" @click="selectGoods(item)">
<image class="cover" :src="item.coverImg" mode="aspectFill"></image>
<view class="info">
<text class="name">{{ item.name }}</text>
<text class="price">{{ returnPrice(item.skuList) }}</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { getProductList } from '@/http/api/product.js';
// 商品列表
const list = ref([]);
// 选择商品
function selectGoods(item) {
uni.setStorageSync('packageSelectGoods', {
coverImg: item.coverImg,
name: item.name,
price: returnPrice(item.skuList)
});
uni.navigateBack();
}
// 返回规格最高价
function returnPrice(skuList) {
return Math.max(...skuList.map((item) => item.salePrice));
}
// 获取商品列表
async function getProductListAjax() {
try {
uni.showLoading({
title: '加载中...',
mask: true
});
const res = await getProductList();
list.value = res;
} catch (error) {
console.log(error);
}
uni.hideLoading();
}
onLoad(() => {
getProductListAjax();
});
</script>
<style>
page {
background-color: #f8f8f8;
}
</style>
<style scoped lang="scss">
.list {
padding: 28upx;
.item {
padding: 28upx;
background-color: #fff;
border-radius: 20upx;
display: flex;
&:not(:first-child) {
margin-top: 28upx;
}
.cover {
$size: 120upx;
width: $size;
height: $size;
border-radius: 16upx;
}
.info {
flex: 1;
display: flex;
flex-direction: column;
gap: 12upx;
padding-left: 28upx;
.name {
font-size: 32upx;
color: #333;
}
.price {
font-size: 32upx;
color: red;
}
}
}
}
</style>

View File

@@ -845,6 +845,13 @@
"navigationBarTitleText": "添加商品" "navigationBarTitleText": "添加商品"
} }
}, },
{
"pageId": "PAGES_MARKET_GROUP_GOODS_ADDGOODS",
"path": "groupGoods/selectGoods",
"style": {
"navigationBarTitleText": "选择商品"
}
},
{ {
"pageId": "PAGES_MARKET_PACKAGE_POPULARIZE_INDEX", "pageId": "PAGES_MARKET_PACKAGE_POPULARIZE_INDEX",
"path": "packagePopularize/index", "path": "packagePopularize/index",
@@ -858,6 +865,13 @@
"style": { "style": {
"navigationBarTitleText": "添加套餐" "navigationBarTitleText": "添加套餐"
} }
},
{
"pageId": "PAGES_MARKET_GROUP_GOODS_PACKAGE",
"path": "packagePopularize/selectGoods",
"style": {
"navigationBarTitleText": "选择商品"
}
} }
] ]
}, },