新增套餐推广

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;
bottom: 0;
left: 0;
z-index: 99;
z-index: 999;
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
background-color: #fff;
&.horizontal {

View File

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

View File

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

View File

@@ -1,6 +1,7 @@
import http from '@/http/http.js'
const request = http.request
const ORDER_URL = 'order'
const Market_BaseUrl = 'market'
/**
* 拼团商品-列表
@@ -120,3 +121,157 @@ export function checkout(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>
</view>
<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>
</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>
</u-form-item>
@@ -20,6 +25,7 @@
<view class="switch-wrap">
<view class="top">
<text class="t">商品名称</text>
<text class="t2" @click="toSelectGoodS">导入已有商品</text>
</view>
<view class="info">
<view class="ipt">
@@ -147,9 +153,10 @@
<script setup>
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { filterNumberInput } from '@/utils/index.js';
import { addGbWare, updateGbWareById } from '@/http/api/ware.js';
import { isMainShop } from '@/store/account.js';
const type = ref('add'); // add添加商品 editor编辑商品
const formRef = ref(null);
@@ -283,6 +290,13 @@ const rules = ref({
]
});
// 跳转去选择商品
function toSelectGoodS() {
uni.navigateTo({
url: '/pageMarket/groupGoods/selectGoods'
});
}
const limitBuyNumFalseNum = -10086;
function limitBuyNumSwitchChange(e) {
if (e) {
@@ -347,6 +361,8 @@ function submitHandle() {
if (form.value.wareCommentImgs.length) {
data.wareCommentImgs = form.value.wareCommentImgs.join(',');
} else {
data.wareCommentImgs = '';
}
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) => {
uni.setStorageSync('groupProduct', '');
if (options.type && options.type == 'editor') {
type.value = options.type;
uni.setNavigationBarTitle({
@@ -456,6 +487,10 @@ page {
font-size: 24upx;
color: #666;
}
.t2 {
font-size: 28upx;
color: #3c9cff;
}
}
.info {
padding-top: 16upx;

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">
@@ -31,7 +31,7 @@
<text class="t1">原价{{ item.originalPrice }}</text>
<text class="t1">拼团价{{ item.groupPrice }}</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,7 +41,7 @@
</text>
</view>
</view>
<view class="footer-wrap">
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
<template v-if="!item.onlineStatus">
<view class="btn">
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
@@ -77,6 +77,7 @@
<script setup>
import { onMounted, reactive, ref } from 'vue';
import { getGbWarePage, editOnlineStatus, deleteGbWare } from '@/http/api/ware.js';
const shopInfo = ref('');
const props = defineProps({
top: {
@@ -96,7 +97,7 @@ const queryForm = reactive({
function sheetConfirm(e) {
queryForm.onlineStatusLabel = e.name;
queryForm.onlineStatus = e.value;
getGbWarePageAjax(1);
resetGetList();
}
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 {
const res = await getGbWarePage({
page: page,
page: listData.page,
size: listData.size,
...queryForm
});
@@ -179,24 +186,19 @@ async function getGbWarePageAjax(page = listData.page, isPull = false) {
} catch (error) {
console.log(error);
}
if (isPull) {
setTimeout(() => {
uni.showToast({
title: '刷新成功',
icon: 'none'
});
uni.stopPullDownRefresh();
}, 300);
}
setTimeout(() => {
uni.stopPullDownRefresh();
}, 300);
}
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(1)"
@clear="resetGetList(1)"
></u-input>
</view>
<div class="ipt" @click="dateRef.open()">
@@ -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);
@@ -199,7 +199,7 @@ function tabChange(index) {
statusActive.value = index;
listData.page = 1;
queryForm.status = tabs.value[index].value;
gbOrderPageAjax();
resetGetList();
}
const listData = reactive({
@@ -239,7 +239,7 @@ function refundHandle(item) {
icon: 'none'
});
}, 100);
goodsRecordPageAjax(1);
resetGetList();
}
} catch (error) {
uni.hideLoading();
@@ -281,7 +281,7 @@ async function returnCostConfirmHandle() {
icon: 'none'
});
}, 100);
gbOrderPageAjax(1);
resetGetList();
} catch (error) {
console.log(error);
}
@@ -294,33 +294,40 @@ async function checkoutHandle(item) {
title: '注意',
content: '确认要核销吗?',
success: async (res) => {
try {
uni.showLoading({
title: '核销中...',
mask: true
});
await checkout(item.verifyCode);
setTimeout(() => {
uni.showToast({
title: '已核销',
icon: 'none'
if (res.confirm) {
try {
uni.showLoading({
title: '核销中...',
mask: true
});
}, 100);
item.status = '已核销';
item.verifyTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
} catch (error) {
console.log(error);
await checkout(item.verifyCode);
setTimeout(() => {
uni.showToast({
title: '已核销',
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 {
const res = await gbOrderPage({
page: page,
page: listData.page,
size: listData.size,
...queryForm
});
@@ -345,11 +352,11 @@ async function gbOrderPageAjax(page = listData.page, isPull = false) {
defineExpose({
reachBottom,
gbOrderPageAjax
resetGetList
});
onMounted(() => {
gbOrderPageAjax();
resetGetList();
});
</script>

View File

@@ -32,6 +32,7 @@ import goodsList from './components/goodsList.vue';
import orderList from './components/orderList.vue';
import { upShopConfig } from '@/http/api/ware.js';
import { getShopInfo } from '@/http/api/shop.js';
import { isMainShop } from '@/store/account.js';
const goodsListRef = ref(null);
const orderListRef = ref(null);
@@ -67,7 +68,23 @@ const form = ref({
watch(
() => form.value.onlineStatus,
(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
});
const res = await upShopConfig(form.value);
if (tabsActive.value == 0) {
goodsListRef.value?.resetGetList();
}
} catch (error) {
console.log(error);
}
@@ -89,10 +109,10 @@ async function upShopConfigAjax() {
onPullDownRefresh(() => {
switch (tabsActive.value) {
case 0:
goodsListRef.value?.getGbWarePageAjax(1, true);
goodsListRef.value?.resetGetList();
break;
case 1:
orderListRef.value?.getGbWarePageAjax(1, true);
orderListRef.value?.resetGetList();
break;
default:
break;
@@ -114,20 +134,25 @@ onReachBottom(() => {
});
// 获取配置信息
const loading = ref(true);
async function getShopInfoAjax() {
try {
loading.value = true;
const res = await getShopInfo();
form.value.onlineStatus = res.isGroupBuy;
} catch (error) {
console.log(error);
}
setTimeout(() => {
loading.value = false;
}, 500);
}
// 页面显示
onShow(() => {
switch (tabsActive.value) {
case 0:
goodsListRef.value?.getGbWarePageAjax(1);
goodsListRef.value?.resetGetList();
break;
case 1:
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"
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;
}
}

View File

@@ -31,8 +31,7 @@ import { ref, watch } from 'vue';
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import goodsList from './components/goodsList.vue';
import orderList from './components/orderList.vue';
import { upShopConfig } from '@/http/api/ware.js';
import { getShopInfo } from '@/http/api/shop.js';
import { packageSwitchGet, packageSwitchPut } from '@/http/api/ware.js';
const goodsListRef = ref(null);
const orderListRef = ref(null);
@@ -56,7 +55,7 @@ function tabClickHandle(item, index) {
function toAdd() {
uni.navigateTo({
url: '/pageMarket/groupGoods/addGoods'
url: '/pageMarket/packagePopularize/addGoods'
});
}
@@ -68,7 +67,23 @@ const form = ref({
watch(
() => form.value.onlineStatus,
(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: '保存中...',
mask: true
});
const res = await upShopConfig(form.value);
await packageSwitchPut({ status: form.value.onlineStatus });
if (tabsActive.value == 0) {
goodsListRef.value?.resetGetList();
}
} catch (error) {
console.log(error);
}
@@ -90,10 +108,10 @@ async function upShopConfigAjax() {
onPullDownRefresh(() => {
switch (tabsActive.value) {
case 0:
goodsListRef.value?.getGbWarePageAjax(1, true);
goodsListRef.value?.resetGetList();
break;
case 1:
orderListRef.value?.getGbWarePageAjax(1, true);
orderListRef.value?.gbOrderPageAjax(1, true);
break;
default:
break;
@@ -115,20 +133,25 @@ onReachBottom(() => {
});
// 获取配置信息
const loading = ref(true);
async function getShopInfoAjax() {
try {
const res = await getShopInfo();
form.value.onlineStatus = res.isGroupBuy;
loading.value = true;
const res = await packageSwitchGet();
form.value.onlineStatus = res;
} catch (error) {
console.log(error);
}
setTimeout(() => {
loading.value = false;
}, 500);
}
// 页面显示
onShow(() => {
switch (tabsActive.value) {
case 0:
goodsListRef.value?.getGbWarePageAjax(1);
goodsListRef.value?.resetGetList();
break;
case 1:
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": "添加商品"
}
},
{
"pageId": "PAGES_MARKET_GROUP_GOODS_ADDGOODS",
"path": "groupGoods/selectGoods",
"style": {
"navigationBarTitleText": "选择商品"
}
},
{
"pageId": "PAGES_MARKET_PACKAGE_POPULARIZE_INDEX",
"path": "packagePopularize/index",
@@ -858,6 +865,13 @@
"style": {
"navigationBarTitleText": "添加套餐"
}
},
{
"pageId": "PAGES_MARKET_GROUP_GOODS_PACKAGE",
"path": "packagePopularize/selectGoods",
"style": {
"navigationBarTitleText": "选择商品"
}
}
]
},