新增套餐推广

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

@@ -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;