新增营销系统、分销系统、会员功能、门店、提现功能

This commit is contained in:
Shaw
2024-02-08 21:01:37 +08:00
parent 68b3f2dcc3
commit 17c043348a
1398 changed files with 81279 additions and 56269 deletions

View File

@ -1,54 +1,58 @@
<template>
<uv-sticky
bgColor="#fff"
customNavHeight="0"
<uv-sticky
bgColor="#fff"
customNavHeight="0"
>
<uv-navbar
:fixed="false"
:title="title"
@leftClick="goUser"
/>
<uv-tabs
:list="navList"
@click="click"
lineColor="#f56c6c"
:current="actionType"
>
<uv-navbar
:fixed="false"
:title="title"
@leftClick="goUser"
/>
<uv-tabs
:list="navList"
@click="click"
lineColor="#f56c6c"
:current="actionType"
>
</uv-tabs>
</uv-sticky>
</uv-tabs>
</uv-sticky>
<view class="orderList">
<template v-if="!listEmpty">
<order
:data="item"
v-for="(item, index) in dataList"
:key="actionType + '_' + index"
@refresh="handleRefresh"
@pay="openPay"
/>
</template>
<Empty
:iconSrc="emptyOrderIcon"
v-else
>
您还没有相关订单~
</Empty>
<!-- 加载中 -->
<ListLoadLoading v-if="loading" />
<!-- 加载完毕-->
<ListLoadOver v-if="loadend" />
</view>
<view class="orderList">
<template v-if="!listEmpty">
<order
:data="item"
v-for="(item, index) in dataList"
:key="actionType + '_' + index"
@refresh="handleRefresh"
@pay="openPay"
@check-off-code="showCheckOffCode"
/>
</template>
<Empty
:iconSrc="emptyOrderIcon"
v-else
>
您还没有相关订单~
</Empty>
<!-- 加载中 -->
<ListLoadLoading v-if="loading" />
<!-- 加载完毕-->
<ListLoadOver v-if="loadend" />
<!-- 支付弹窗 -->
<PayPopup
ref="payPopupRef"
@confirm="paySuccess"
/>
<ReturnTop :scroll-top="scrollTop" />
<!-- 核销 -->
<CheckOffCode ref="checkOffCodeRef" />
<!-- 返回顶部 -->
<ReturnTop :scroll-top="scrollTop" />
</view>
</template>
<script setup>
import { computed, ref, unref } from 'vue'
import { onLoad, onPageScroll } from '@dcloudio/uni-app'
import { computed, ref } from 'vue'
import { onLoad, onPageScroll, onShow } from '@dcloudio/uni-app'
import { orderList } from '@/api/order'
import { useRouter } from "@/hooks/useRouter";
import ListLoadOver from "@/components/ListLoadOver/index.vue"
@ -57,15 +61,17 @@ import Empty from '@/components/Empty/index.vue'
import { emptyOrderIcon } from "@/utils/images";
import PayPopup from '@/components/PayPopup/index.vue'
import { usePage } from "@/hooks";
import Header from "@/components/Header/index.vue"
import { getProductList } from "@/api/product";
import ReturnTop from "@/components/ReturnTop/index.vue";
import { useScroll } from "@/hooks/useScroll";
import { usePay } from "@/hooks/usePay";
import CheckOffCode from "@/components/order/CheckOffCode.vue";
const {payPopupRef, openPay, paySuccess} = usePay()
const {scrollTop} = useScroll()
const {type, refresh, dataList, loadend, loading, listEmpty} = usePage(orderList)
const {getParams, pushToTab, push} = useRouter()
const {getUrlParams, pushToTab, push} = useRouter()
const actionType = ref(0)
@ -73,6 +79,7 @@ const actionType = ref(0)
const navList = ref([
{name: "全部", value: -1,},
{name: "未支付", value: 0,},
{name: "待成团", value: 5,},
{name: "待发货", value: 1,},
{name: "待收货", value: 2,},
{name: "待评价", value: 3,},
@ -88,14 +95,6 @@ const title = computed(() => {
})
// const handleOrderList = async (option) => {
// orderListData.value = []
// orderListData.value = await orderList(option)
// orderListData.value.forEach(item => {
// item.status = item.paid === 1 && item.status === 0 ? 99 : item.status
// })
// }
const handleRefresh = () => {
// 确认收货
if (actionType.value === 2) {
@ -111,34 +110,43 @@ const click = (data) => {
refresh()
}
// ============================== 支付相关 ===============================
const payPopupRef = ref()
function openPay(orderId) {
unref(payPopupRef).show(orderId)
}
function paySuccess() {
push({url: '/pages/payStatus/index'}, {})
}
function goUser() {
pushToTab({url: '/pages/user/user'}, {})
pushToTab({url: '/root/user/user'}, {})
}
onLoad((options) => {
const params = getParams(options)
// ============================= 核销相关 ==============================
const checkOffCodeRef = ref()
/**
* 打开核销码
* @param writeOffCode 核销码
*/
function showCheckOffCode(writeOffCode) {
checkOffCodeRef.value.open(writeOffCode)
}
onLoad(() => {
const params = getUrlParams()
type.value = params.type
refresh()
if (Number(type.value < 0)) {
actionType.value = 0
return
}
actionType.value = type.value + 1
actionType.value = navList.value.findIndex(item => item.value === params.type)
})
onShow(() => {
refresh()
onPageScroll((e)=>{
})
// 返回该页面的获取数据
// uni.$on('update', function (data) {
// console.log('update')
// //触发更新后
// refresh()
// })
onPageScroll((e) => {
})