feat: 优化分销中心、购物车和订单详情页功能
- 在分销中心页面添加导航栏并优化UI显示 - 在购物车页面增加打包费计算和显示 - 在订单详情页优化订单状态显示和导航逻辑
This commit is contained in:
parent
58359af16d
commit
a93999c041
@ -1,10 +1,5 @@
|
||||
<template>
|
||||
<uv-navbar
|
||||
:fixed="false"
|
||||
:title="title"
|
||||
left-arrow
|
||||
@leftClick="$onClickLeft"
|
||||
/>
|
||||
<uv-navbar :fixed="false" :title="title" left-arrow @leftClick="$onClickLeft" />
|
||||
<view class="cart-popup">
|
||||
<view class="top flex justify-between">
|
||||
<text>已点{{ getCartGoodsNumber }}份</text>
|
||||
@ -37,8 +32,22 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="fixed-bottom flex justify-between align-center bg-white ">
|
||||
<view class="mx-2 ont-weight-light">应付:<text class="text-danger">¥{{ getCartGoodsPrice }}</text></view>
|
||||
<view ><uv-button style="background-color: #52ac41;" type="warning" color="#52ac41" :customStyle="customStyle" size="large" text="去结算" @click="toPay"></uv-button></view>
|
||||
<view class="mx-2 ont-weight-light">
|
||||
<view>商品总价: ¥{{ (getCartGoodsPrice - getPackingFee).toFixed(2) }}</view>
|
||||
<view>打包费: ¥{{ getPackingFee.toFixed(2) }}</view>
|
||||
<view>应付: <text class="text-danger">¥{{ getCartGoodsPrice }}</text></view>
|
||||
</view>
|
||||
<view>
|
||||
<uv-button
|
||||
style="background-color: #52ac41;"
|
||||
type="warning"
|
||||
color="#52ac41"
|
||||
:customStyle="customStyle"
|
||||
size="large"
|
||||
text="去结算"
|
||||
@click="toPay">
|
||||
</uv-button>
|
||||
</view>
|
||||
</view>
|
||||
<uv-toast ref="uToast"></uv-toast>
|
||||
</template>
|
||||
@ -50,9 +59,9 @@ import {
|
||||
} from 'vue'
|
||||
import { useMainStore } from '@/store/store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { onLoad,onShow} from '@dcloudio/uni-app'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
const main = useMainStore()
|
||||
const { orderType,address, store,location,isLogin } = storeToRefs(main)
|
||||
const { orderType, address, store, location, isLogin } = storeToRefs(main)
|
||||
const title = ref('购物车')
|
||||
const cart = ref([])
|
||||
const uToast = ref()
|
||||
@ -65,22 +74,32 @@ onShow(() => {
|
||||
cart.value = uni.getStorageSync('cart')
|
||||
})
|
||||
const getCartGoodsNumber = computed(() => { //计算购物车总数
|
||||
if(cart.value.length == 0) {
|
||||
if (cart.value.length == 0) {
|
||||
return 0
|
||||
}
|
||||
return cart.value.reduce((acc, cur) => acc + cur.number, 0)
|
||||
})
|
||||
const getCartGoodsPrice = computed(() =>{ //计算购物车总价
|
||||
if(cart.value.length == 0) {
|
||||
const getCartGoodsPrice = computed(() => {
|
||||
//计算购物车总价(商品价格+打包费)
|
||||
if (cart.value.length == 0) {
|
||||
return 0
|
||||
}
|
||||
let price = cart.value.reduce((acc, cur) => acc + cur.number * cur.price, 0);
|
||||
return parseFloat(price).toFixed(2);
|
||||
let total = cart.value.reduce((acc, cur) => {
|
||||
const itemPrice = cur.price * cur.number;
|
||||
const boxPrice = (cur.boxFee || 0) * cur.number;
|
||||
return acc + itemPrice + boxPrice;
|
||||
}, 0);
|
||||
return parseFloat(total).toFixed(2);
|
||||
})
|
||||
const customStyle = computed(() =>{
|
||||
|
||||
const getPackingFee = computed(() => {
|
||||
// 计算打包费(根据每个商品的boxFee计算)
|
||||
return cart.value.reduce((acc, cur) => acc + cur.number * (cur.boxFee || 0), 0);
|
||||
});
|
||||
const customStyle = computed(() => {
|
||||
return {
|
||||
paddingLeft:'60rpx',
|
||||
paddingRight:'60rpx'
|
||||
paddingLeft: '60rpx',
|
||||
paddingRight: '60rpx'
|
||||
}
|
||||
})
|
||||
const handleCartItemAdd = (index) => {
|
||||
@ -114,8 +133,8 @@ const handleCartClear = () => { //清空购物车
|
||||
}
|
||||
const toPay = () => {
|
||||
|
||||
if(cart.value.length == 0){
|
||||
uToast.value.show({message:'请先去点餐哦',type: 'error'});
|
||||
if (cart.value.length == 0) {
|
||||
uToast.value.show({ message: '请先去点餐哦', type: 'error' });
|
||||
return;
|
||||
}
|
||||
|
||||
@ -126,12 +145,12 @@ const toPay = () => {
|
||||
return
|
||||
} else {
|
||||
if (store.value.status == 0) {
|
||||
uToast.value.show({message:'不在店铺营业时间内',type: 'error'});
|
||||
uToast.value.show({ message: '不在店铺营业时间内', type: 'error' });
|
||||
return;
|
||||
}
|
||||
// 判断当前是否在配送范围内
|
||||
if (orderType.value == 'takeout' && store.value.distance < store.value.far) {
|
||||
uToast.value.show({message:'选中的地址不在配送范围',type: 'error'});
|
||||
uToast.value.show({ message: '选中的地址不在配送范围', type: 'error' });
|
||||
return;
|
||||
}
|
||||
|
||||
@ -159,6 +178,7 @@ const toPay = () => {
|
||||
font-size: 24rpx;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.cart-list {
|
||||
background-color: #ffffff;
|
||||
width: 100%;
|
||||
@ -202,6 +222,7 @@ const toPay = () => {
|
||||
font-size: $font-size-sm;
|
||||
color: $text-color-base;
|
||||
}
|
||||
|
||||
.props {
|
||||
color: $text-color-assist;
|
||||
font-size: 24rpx;
|
||||
@ -243,5 +264,5 @@ const toPay = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -1,12 +1,13 @@
|
||||
<template>
|
||||
<view class="page flex-col">
|
||||
<uv-navbar :fixed="false" title="分销中心" left-arrow @leftClick="$onClickLeft" />
|
||||
<view class="page flex-col" v-if="isDistributor">
|
||||
<!-- 头部导航 -->
|
||||
<view class="flex-col">
|
||||
<view class="flex-row">
|
||||
<!-- <view class="flex-row">
|
||||
<view class="flex-row">
|
||||
<text class="header-title">分销中心</text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-info">
|
||||
@ -17,17 +18,11 @@
|
||||
</view>
|
||||
<view class="flex-row" style="align-items: center">
|
||||
<text class="user-id">ID: {{ userId }}</text>
|
||||
<text class="invite-code" @tap="showInviteCodePopup"
|
||||
>复查邀请码</text
|
||||
>
|
||||
<text class="invite-code" @tap="showInviteCodePopup">邀请码</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="share-btn" @tap="share">
|
||||
<image
|
||||
class="share-icon"
|
||||
src="/static/images/share.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image class="share-icon" src="/static/images/share.png" mode="aspectFill"></image>
|
||||
<text class="share-text">分享</text>
|
||||
</view>
|
||||
</view>
|
||||
@ -60,26 +55,15 @@
|
||||
<!-- 佣金明细 -->
|
||||
<view class="details-list flex-col">
|
||||
<view class="details-title">
|
||||
<text>佣金明细</text>
|
||||
<text style="margin-top: 6rpx; font-size: 22rpx; color: #999999"
|
||||
>佣金将于每月15日结算至您的银行卡账号中</text
|
||||
>
|
||||
<text>佣金明细 </text>
|
||||
<text style="margin-top: 6rpx; font-size: 22rpx; color: #999999">(佣金将于每月15日结算至您的银行卡账号中)</text>
|
||||
</view>
|
||||
|
||||
<!-- 佣金明细列表 -->
|
||||
<view v-if="commissionList.length > 0">
|
||||
<view
|
||||
v-for="(item, index) in commissionList"
|
||||
:key="index"
|
||||
class="detail-item"
|
||||
@tap="addCommission"
|
||||
>
|
||||
<view v-for="(item, index) in commissionList" :key="index" class="detail-item" @tap="addCommission">
|
||||
<view class="detail-left">
|
||||
<image
|
||||
class="user-avatar"
|
||||
:src="item.avatar"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image class="user-avatar" :src="item.avatar" mode="aspectFill"></image>
|
||||
<view class="detail-info">
|
||||
<text class="detail-name">{{ item.name }}</text>
|
||||
<text class="detail-date">下单日期: {{ item.date }}</text>
|
||||
@ -104,28 +88,14 @@
|
||||
</view>
|
||||
|
||||
<!-- 邀请码弹窗 -->
|
||||
<view
|
||||
class="invite-popup-mask"
|
||||
v-if="showInvitePopup"
|
||||
@tap="closeInviteCodePopup"
|
||||
>
|
||||
<view class="invite-popup-mask" v-if="showInvitePopup" @tap="closeInviteCodePopup">
|
||||
<view class="invite-popup-content" @tap.stop>
|
||||
<view class="invite-popup-box">
|
||||
<image
|
||||
class="invite-popup-avatar"
|
||||
:src="userAvatar"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view class="invite-popup-id">会员ID: {{ userId }}</view>
|
||||
<image class="invite-popup-avatar" :src="userAvatar" mode="aspectFill"></image>
|
||||
<view class="invite-popup-id">分销员ID: {{ userId }}</view>
|
||||
<view class="invite-popup-qrcode-container">
|
||||
<uv-qrcode
|
||||
ref="qrcode"
|
||||
canvas-id="qrcode"
|
||||
:value="userId"
|
||||
:size="260"
|
||||
background-color="#FFFFFF"
|
||||
foreground-color="#000000"
|
||||
></uv-qrcode>
|
||||
<uv-qrcode ref="qrcode" canvas-id="qrcode" :value="userId" :size="260" background-color="#FFFFFF"
|
||||
foreground-color="#000000"></uv-qrcode>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -143,6 +113,9 @@ import { getDistributorInfo, getCommissionList } from "@/api/distributor";
|
||||
const main = useMainStore();
|
||||
const { isLogin } = storeToRefs(main);
|
||||
|
||||
//是否是分销商
|
||||
const isDistributor = ref(false);
|
||||
|
||||
// 用户信息
|
||||
const userAvatar = ref("/static/images/avatar.png");
|
||||
const userName = ref("爱喝汤的小力");
|
||||
@ -197,6 +170,7 @@ const getCommissionData = async () => {
|
||||
// 修改getDistributorInfo调用,传入spreadUid参数
|
||||
let data = await getDistributorInfo({ id: spreadUid.value });
|
||||
if (data) {
|
||||
isDistributor.value = true;
|
||||
userName.value = data.name || "爱喝汤的小力";
|
||||
userId.value = data.id || "1234567890";
|
||||
totalCommission.value = data.totalCommission || "0.00";
|
||||
@ -207,8 +181,9 @@ const getCommissionData = async () => {
|
||||
|
||||
//获取分销员的订单明细
|
||||
const getOrderCommissionList = async () => {
|
||||
let data = await getCommissionList({distributorId: userId.value, page: 1, limit: 10 });
|
||||
let data = await getCommissionList({ distributorId: userId.value, page: 1, limit: 10 });
|
||||
if (data) {
|
||||
|
||||
commissionList.value = data.map(item => ({
|
||||
avatar: item.avatar || '/static/images/avatar.png',
|
||||
name: item.realName || '用户',
|
||||
@ -334,7 +309,7 @@ const closeInviteCodePopup = () => {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.invite-popup-qrcode-container >>> .uqrcode {
|
||||
.invite-popup-qrcode-container>>>.uqrcode {
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<uv-navbar
|
||||
:fixed="false"
|
||||
title="填写信息"
|
||||
title="申请成为分销员"
|
||||
left-arrow
|
||||
@leftClick="$onClickLeft"
|
||||
/>
|
||||
@ -20,24 +20,24 @@
|
||||
<view class="form-container" style=" padding: 40rpx 20rpx; border-radius: 20rpx;">
|
||||
<!-- 姓名 -->
|
||||
<view class="form-item" style="">
|
||||
<text class="form-label">姓名</text>
|
||||
<text class="form-label">姓名<text style="color: red;"> *</text></text>
|
||||
<input
|
||||
class="form-input"
|
||||
type="text"
|
||||
v-model="formData.name"
|
||||
placeholder="请输入"
|
||||
placeholder="请输入姓名"
|
||||
placeholder-class="placeholder"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 电话 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">电话</text>
|
||||
<text class="form-label">电话<text style="color: red;"> *</text></text>
|
||||
<input
|
||||
class="form-input"
|
||||
type="number"
|
||||
v-model="formData.phone"
|
||||
placeholder="请输入"
|
||||
placeholder="请输入电话"
|
||||
placeholder-class="placeholder"
|
||||
maxlength="11"
|
||||
/>
|
||||
@ -50,43 +50,43 @@
|
||||
class="form-input"
|
||||
type="text"
|
||||
v-model="formData.workUnit"
|
||||
placeholder="请输入"
|
||||
placeholder="请输入工作单位"
|
||||
placeholder-class="placeholder"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 银行卡号 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">银行卡号</text>
|
||||
<text class="form-label">银行卡号<text style="color: red;"> *</text></text>
|
||||
<input
|
||||
class="form-input"
|
||||
type="number"
|
||||
v-model="formData.bankCardNumber"
|
||||
placeholder="请输入"
|
||||
placeholder="请输入银行卡号(结算佣金时需要)"
|
||||
placeholder-class="placeholder"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 收款人姓名 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">收款人</text>
|
||||
<text class="form-label">开户名<text style="color: red;"> *</text></text>
|
||||
<input
|
||||
class="form-input"
|
||||
type="text"
|
||||
v-model="formData.recipientName"
|
||||
placeholder="请输入"
|
||||
placeholder="请输入开户名(结算佣金时需要)"
|
||||
placeholder-class="placeholder"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 开户行 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">开户行</text>
|
||||
<text class="form-label">开户行<text style="color: red;"> *</text></text>
|
||||
<input
|
||||
class="form-input"
|
||||
type="text"
|
||||
v-model="formData.bankName"
|
||||
placeholder="请输入"
|
||||
placeholder="请输入开户行(结算佣金时需要)"
|
||||
placeholder-class="placeholder"
|
||||
/>
|
||||
</view>
|
||||
|
@ -1,10 +1,5 @@
|
||||
<template>
|
||||
<uv-navbar
|
||||
:fixed="false"
|
||||
title="开票信息管理"
|
||||
left-arrow
|
||||
@leftClick="$onClickLeft"
|
||||
/>
|
||||
<uv-navbar :fixed="false" title="开票信息管理" left-arrow @leftClick="$onClickLeft" />
|
||||
<view class="container">
|
||||
<view class="bg-white invoice-form">
|
||||
<!-- 发票类型选择 -->
|
||||
@ -25,83 +20,48 @@
|
||||
<!-- 企业单位表单 -->
|
||||
<block v-if="invoiceType === 'company'">
|
||||
<view class="form-item">
|
||||
<text class="label">发票抬头</text>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="请输入发票抬头(必填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.invoiceTitle"
|
||||
/>
|
||||
<text class="label">发票抬头<text class="required"> *</text></text>
|
||||
<input type="text" placeholder="请输入发票抬头(必填)" placeholderClass="placeholder" class="input-field"
|
||||
v-model="companyForm.invoiceTitle" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">税号</text>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="请写纳税人识别号(必填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.taxNumber"
|
||||
/>
|
||||
<text class="label">税号<text class="required"> *</text></text>
|
||||
<input type="text" placeholder="请写纳税人识别号(必填)" placeholderClass="placeholder" class="input-field"
|
||||
v-model="companyForm.taxNumber" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">单位地址</text>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="公司地址(选填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.companyAddress"
|
||||
/>
|
||||
<input type="text" placeholder="公司地址(选填)" placeholderClass="placeholder" class="input-field"
|
||||
v-model="companyForm.companyAddress" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">电话号码</text>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="公司电话(选填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.companyPhone"
|
||||
/>
|
||||
<input type="text" placeholder="公司电话(选填)" placeholderClass="placeholder" class="input-field"
|
||||
v-model="companyForm.companyPhone" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">开户银行</text>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="开户银行(选填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.bankName"
|
||||
/>
|
||||
<input type="text" placeholder="开户银行(选填)" placeholderClass="placeholder" class="input-field"
|
||||
v-model="companyForm.bankName" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">银行账户</text>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="银行账户(选填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="companyForm.bankAccount"
|
||||
/>
|
||||
<input type="text" placeholder="银行账户(选填)" placeholderClass="placeholder" class="input-field"
|
||||
v-model="companyForm.bankAccount" />
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 个人/非企业单位表单 -->
|
||||
<block v-else>
|
||||
<view class="form-item">
|
||||
<text class="label">发票抬头<text class="required">*</text></text>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="请输入个人发票抬头(必填)"
|
||||
placeholderClass="placeholder"
|
||||
class="input-field"
|
||||
v-model="personalForm.invoiceTitle"
|
||||
/>
|
||||
<text class="label">发票抬头<text class="required"> *</text></text>
|
||||
<input type="text" placeholder="请输入个人发票抬头(必填)" placeholderClass="placeholder" class="input-field"
|
||||
v-model="personalForm.invoiceTitle" />
|
||||
</view>
|
||||
|
||||
<!-- <view class="form-item">
|
||||
@ -136,7 +96,7 @@ const invoiceType = ref('company')
|
||||
|
||||
// 企业单位表单数据
|
||||
const companyForm = reactive({
|
||||
userId: '123',
|
||||
userId: '',
|
||||
invoiceTitle: '', // 发票抬头
|
||||
taxNumber: '', // 纳税人识别号
|
||||
companyAddress: '', // 单位地址
|
||||
@ -147,7 +107,7 @@ const companyForm = reactive({
|
||||
|
||||
// 个人/非企业单位表单数据
|
||||
const personalForm = reactive({
|
||||
userId: '123',
|
||||
userId: '',
|
||||
invoiceTitle: '', // 个人发票抬头
|
||||
// taxNumber: '' // 个人税号(可能为空)
|
||||
})
|
||||
@ -327,10 +287,24 @@ const getUserInvoice = async (id) => {
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
onLoad((option) => {
|
||||
// 获取用户信息
|
||||
console.log('用户ID:', member.value.id)
|
||||
|
||||
// 接收传入的userId参数
|
||||
if (option.userId) {
|
||||
companyForm.userId = option.userId
|
||||
personalForm.userId = option.userId
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '未获取到用户ID,请重新进入',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
// 获取用户发票信息
|
||||
getUserInvoice(member.value.id)
|
||||
})
|
||||
|
@ -5,29 +5,46 @@
|
||||
left-arrow
|
||||
@leftClick="$onClickLeft"
|
||||
/>
|
||||
<view class="container" style="padding:20rpx;">
|
||||
<view style="padding-bottom: 100rpx;">
|
||||
<view class="container" style="padding: 20rpx">
|
||||
<view style="padding-bottom: 100rpx">
|
||||
<view class="bg-white">
|
||||
<view class="section">
|
||||
<!-- store info begin -->
|
||||
<list-cell :hover="false">
|
||||
<view class="w-100 d-flex align-items-center">
|
||||
<view class="d-flex flex-column w-60">
|
||||
<view class="w-100 font-size-lg text-color-base text-truncate">{{ order.shop.name }}</view>
|
||||
<view
|
||||
class="w-100 font-size-lg text-color-base text-truncate"
|
||||
>{{ order.shop.name }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="d-flex justify-content-end align-items-center w-40">
|
||||
<view class="iconfont-yshop icon-mobile" @click="makePhoneCall(order.shop)" style="font-size: 45rpx;margin-right: 40rpx;"></view>
|
||||
<view class="iconfont-yshop icon-location" @click="openLocation(order.shop)" style="font-size: 45rpx;"></view>
|
||||
<view
|
||||
class="iconfont-yshop icon-mobile"
|
||||
@click="makePhoneCall(order.shop)"
|
||||
style="font-size: 45rpx; margin-right: 40rpx"
|
||||
></view>
|
||||
<view
|
||||
class="iconfont-yshop icon-location"
|
||||
@click="openLocation(order.shop)"
|
||||
style="font-size: 45rpx"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
</list-cell>
|
||||
<!-- store info end -->
|
||||
<list-cell :hover="false" padding="50rpx 30rpx">
|
||||
<view class="w-100 d-flex flex-column">
|
||||
<view v-if="order.paid == 0" class="d-flex align-items-center just-content-center mb-40">
|
||||
<view
|
||||
v-if="order.paid == 0"
|
||||
class="d-flex align-items-center just-content-center mb-40"
|
||||
>
|
||||
<view class="font-size-lg text-color-error">订单未支付</view>
|
||||
</view>
|
||||
<view v-if="order.paid > 0" class="d-flex align-items-center just-content-center">
|
||||
<view
|
||||
v-if="order.paid > 0"
|
||||
class="d-flex align-items-center just-content-center"
|
||||
>
|
||||
<view class="sort-num">{{ order.numberId }}</view>
|
||||
</view>
|
||||
<!-- steps begin -->
|
||||
@ -38,58 +55,124 @@
|
||||
<view class="iconfont-yshop icon-lamp"></view>
|
||||
</view>
|
||||
<view class="steps__img-column-item">
|
||||
<view class="iconfont-yshop icon-daojishi" v-if="{active: order.paid == 1 && order.status == 0}"></view>
|
||||
<view class="iconfont-yshop icon-daojishi unactive" v-else></view>
|
||||
<view
|
||||
class="iconfont-yshop icon-daojishi"
|
||||
v-if="{ active: order.paid == 1 && order.status == 0 }"
|
||||
></view>
|
||||
<view
|
||||
class="iconfont-yshop icon-daojishi unactive"
|
||||
v-else
|
||||
></view>
|
||||
</view>
|
||||
<view class="steps__img-column-item" v-if="order.orderType == 'takeout'">
|
||||
<view class="iconfont-yshop icon-takeout" v-if="order.status == 1"></view>
|
||||
<view class="iconfont-yshop icon-takeout unactive" v-else></view>
|
||||
<view
|
||||
class="steps__img-column-item"
|
||||
v-if="order.orderType == 'takeout'"
|
||||
>
|
||||
<view
|
||||
class="iconfont-yshop icon-takeout"
|
||||
v-if="order.status == 1"
|
||||
></view>
|
||||
<view
|
||||
class="iconfont-yshop icon-takeout unactive"
|
||||
v-else
|
||||
></view>
|
||||
</view>
|
||||
<view class="steps__img-column-item" >
|
||||
<view class="iconfont-yshop icon-doorbell" v-if="order.status >= 2"></view>
|
||||
<view class="iconfont-yshop icon-doorbell unactive" v-else></view>
|
||||
<view class="steps__img-column-item">
|
||||
<view
|
||||
class="iconfont-yshop icon-doorbell"
|
||||
v-if="order.status >= 2"
|
||||
></view>
|
||||
<view
|
||||
class="iconfont-yshop icon-doorbell unactive"
|
||||
v-else
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="steps__text-column">
|
||||
<view class="steps__text-column-item active">
|
||||
<view class="steps__column-item-line bg-transparent"></view>
|
||||
<view
|
||||
class="steps__column-item-line bg-transparent"
|
||||
></view>
|
||||
<view class="steps__text-column-item-text">已下单</view>
|
||||
<view class="steps__column-item-line"></view>
|
||||
</view>
|
||||
<view class="steps__text-column-item activ" :class="{active: order.paid == 1}">
|
||||
<view
|
||||
class="steps__text-column-item activ"
|
||||
:class="{ active: order.paid == 1 }"
|
||||
>
|
||||
<view class="steps__column-item-line"></view>
|
||||
<view class="steps__text-column-item-text">制作中</view>
|
||||
<view class="steps__column-item-line"></view>
|
||||
</view>
|
||||
<view class="steps__text-column-item" :class="{active: order.status == 1}" v-if="order.orderType == 'takeout'">
|
||||
<view
|
||||
class="steps__text-column-item"
|
||||
:class="{ active: order.status == 1 }"
|
||||
v-if="order.orderType == 'takeout'"
|
||||
>
|
||||
<view class="steps__column-item-line"></view>
|
||||
<view class="steps__text-column-item-text">配送中</view>
|
||||
<view class="steps__column-item-line bg-transparent"></view>
|
||||
<view
|
||||
class="steps__column-item-line bg-transparent"
|
||||
></view>
|
||||
</view>
|
||||
<view class="steps__text-column-item" :class="{active: order.status >= 2}">
|
||||
<view
|
||||
class="steps__text-column-item"
|
||||
:class="{ active: order.status >= 2 }"
|
||||
>
|
||||
<view class="steps__column-item-line"></view>
|
||||
<view class="steps__text-column-item-text">
|
||||
{{ order.orderType == 'takeout' ? '已送达' : '请取餐' }}
|
||||
{{ order.orderType == "takeout" ? "已送达" : "请取餐" }}
|
||||
</view>
|
||||
<view class="steps__column-item-line bg-transparent"></view>
|
||||
<view
|
||||
class="steps__column-item-line bg-transparent"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- steps end -->
|
||||
<view v-if="order.status==0 && order.paid > 0" class="d-flex just-content-center align-items-center font-size-base text-color-assist mb-40">
|
||||
您前面还有 <text class="text-color-primary mr-10 ml-10" style="color: #52ac41;">{{order.preNum}}</text> 单待制作
|
||||
<view
|
||||
v-if="order.status == 0 && order.paid > 0"
|
||||
class="d-flex just-content-center align-items-center font-size-base text-color-assist mb-40"
|
||||
>
|
||||
您前面还有
|
||||
<text
|
||||
class="text-color-primary mr-10 ml-10"
|
||||
style="color: #52ac41"
|
||||
>{{ order.preNum }}</text
|
||||
>
|
||||
单待制作
|
||||
</view>
|
||||
<!-- goods begin -->
|
||||
<view class="w-100 d-flex flex-column position-relative mt-30" style="margin-bottom: -40rpx;">
|
||||
<view class="w-100 d-flex align-items-center mb-40" v-for="(good, index) in order.products" :key="index">
|
||||
<view
|
||||
class="w-100 d-flex flex-column position-relative mt-30"
|
||||
style="margin-bottom: -40rpx"
|
||||
>
|
||||
<view
|
||||
class="w-100 d-flex align-items-center mb-40"
|
||||
v-for="(good, index) in order.products"
|
||||
:key="index"
|
||||
>
|
||||
<view class="d-flex flex-column w-60 overflow-hidden">
|
||||
<view class="font-size-lg text-color-base mb-10 text-truncate">{{ good.title }}</view>
|
||||
<view class="font-size-sm text-color-assist text-truncate">{{ good.spec }}</view>
|
||||
<view
|
||||
class="font-size-lg text-color-base mb-10 text-truncate"
|
||||
>{{ good.title }}</view
|
||||
>
|
||||
<view
|
||||
class="font-size-sm text-color-assist text-truncate"
|
||||
>{{ good.spec }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="d-flex w-40 align-items-center justify-content-between pl-30">
|
||||
<view class="font-size-base text-color-base">x{{ good.number }}</view>
|
||||
<view class="font-size-base text-color-base font-weight-bold">¥{{ good.price }}</view>
|
||||
<view
|
||||
class="d-flex w-40 align-items-center justify-content-between pl-30"
|
||||
>
|
||||
<view class="font-size-base text-color-base"
|
||||
>x{{ good.number }}</view
|
||||
>
|
||||
<view
|
||||
class="font-size-base text-color-base font-weight-bold"
|
||||
>¥{{ good.price }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -101,15 +184,34 @@
|
||||
<!-- goods begin -->
|
||||
<list-cell :hover="false" padding="30rpx 30rpx">
|
||||
<view class="w-100 d-flex flex-column position-relative">
|
||||
<view class="w-100 d-flex align-items-center mb-40" v-for="(good, index) in order.cartInfo" :key="index">
|
||||
<image :src="good.image" mode="aspectFill" class="image"></image>
|
||||
<view
|
||||
class="w-100 d-flex align-items-center mb-40"
|
||||
v-for="(good, index) in order.cartInfo"
|
||||
:key="index"
|
||||
>
|
||||
<image
|
||||
:src="good.image"
|
||||
mode="aspectFill"
|
||||
class="image"
|
||||
></image>
|
||||
<view class="d-flex flex-column w-60 overflow-hidden">
|
||||
<view class="font-size-lg text-color-base mb-10 text-truncate">{{ good.title }}</view>
|
||||
<view class="font-size-sm text-color-assist text-truncate">{{ good.spec }}</view>
|
||||
<view
|
||||
class="font-size-lg text-color-base mb-10 text-truncate"
|
||||
>{{ good.title }}</view
|
||||
>
|
||||
<view class="font-size-sm text-color-assist text-truncate">{{
|
||||
good.spec
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="d-flex w-40 align-items-center justify-content-between pl-30">
|
||||
<view class="font-size-base text-color-base">x{{ good.number }}</view>
|
||||
<view class="font-size-base text-color-base font-weight-bold">¥{{ good.price }}</view>
|
||||
<view
|
||||
class="d-flex w-40 align-items-center justify-content-between pl-30"
|
||||
>
|
||||
<view class="font-size-base text-color-base"
|
||||
>x{{ good.number }}</view
|
||||
>
|
||||
<view class="font-size-base text-color-base font-weight-bold"
|
||||
>¥{{ good.price }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -120,7 +222,9 @@
|
||||
<view class="w-100 d-flex flex-column">
|
||||
<view class="pay-cell">
|
||||
<view>支付方式</view>
|
||||
<view class="font-weight-bold">{{ order.statusDto.payType }}</view>
|
||||
<view class="font-weight-bold">{{
|
||||
order.statusDto.payType
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="pay-cell">
|
||||
<view>订单金额</view>
|
||||
@ -148,7 +252,9 @@
|
||||
<view class="w-100 d-flex flex-column">
|
||||
<view class="pay-cell">
|
||||
<view>下单时间</view>
|
||||
<view class="font-weight-bold">{{ formatDateTime(order.createTime )}}</view>
|
||||
<view class="font-weight-bold">{{
|
||||
formatDateTime(order.createTime)
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="pay-cell">
|
||||
<view>下单门店</view>
|
||||
@ -167,26 +273,46 @@
|
||||
<view class="w-100 d-flex flex-column">
|
||||
<view class="pay-cell">
|
||||
<view>享用方式</view>
|
||||
<view class="font-weight-bold">{{order.orderType == 'takein' ? '自取' : '外卖'}}</view>
|
||||
<view class="font-weight-bold">{{
|
||||
order.orderType == "takein" ? "自取" : "外卖"
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="pay-cell">
|
||||
<view>取餐时间</view>
|
||||
<view class="font-weight-bold">{{order.getTime ? formatDateTime(order.getTime) : '立即取餐'}}</view>
|
||||
<view class="font-weight-bold">{{
|
||||
order.getTime ? formatDateTime(order.getTime) : "立即取餐"
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="pay-cell">
|
||||
<view>制作完成时间</view>
|
||||
<view class="font-weight-bold">{{ order.deliveryTime ? formatDateTime(order.deliveryTime) : '无' }}</view>
|
||||
<view class="font-weight-bold">{{
|
||||
order.deliveryTime ? formatDateTime(order.deliveryTime) : "无"
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="pay-cell">
|
||||
<view>备注</view>
|
||||
<view class="font-weight-bold">{{ order.remark ? order.remark : '无' }}</view>
|
||||
<view class="font-weight-bold">{{
|
||||
order.remark ? order.remark : "无"
|
||||
}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</list-cell>
|
||||
<!-- order other info end -->
|
||||
</view>
|
||||
<view class="fixed-bottom flex justify-end bg-white p-2" v-if="order.paid > 0 && order.refundStatus == 0">
|
||||
<view class="mr-1"><uv-button type="success" v-if="order.status < 2" :plain="true" size="small" text="确认收到餐" @click="receive(order)"></uv-button></view>
|
||||
<view
|
||||
class="fixed-bottom flex justify-end bg-white p-2"
|
||||
v-if="order.paid > 0 && order.refundStatus == 0"
|
||||
>
|
||||
<view class="mr-1"
|
||||
><uv-button
|
||||
type="success"
|
||||
v-if="order.status < 2"
|
||||
:plain="true"
|
||||
size="small"
|
||||
text="确认收到餐"
|
||||
@click="receive(order)"
|
||||
></uv-button
|
||||
></view>
|
||||
<!-- <view><uv-button type="warning" :plain="true" size="small" text="申请退款" @click="refund(order)"></uv-button></view> -->
|
||||
</view>
|
||||
</view>
|
||||
@ -194,32 +320,27 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref
|
||||
} from 'vue'
|
||||
import { onLoad} from '@dcloudio/uni-app'
|
||||
import { formatDateTime } from '@/utils/util'
|
||||
import {
|
||||
orderDetail,
|
||||
orderReceive,
|
||||
} from '@/api/order'
|
||||
const title = ref('订单详情')
|
||||
import { ref } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { formatDateTime } from "@/utils/util";
|
||||
import { orderDetail, orderReceive } from "@/api/order";
|
||||
const title = ref("订单详情");
|
||||
const order = ref({
|
||||
shop:{name:''},
|
||||
statusDto:{payType:''}
|
||||
})
|
||||
const numForMading = ref(5)
|
||||
shop: { name: "" },
|
||||
statusDto: { payType: "" },
|
||||
});
|
||||
const numForMading = ref(5);
|
||||
|
||||
onLoad((option) => {
|
||||
detail(option.id);
|
||||
})
|
||||
});
|
||||
|
||||
const detail = async(id) => {
|
||||
const detail = async (id) => {
|
||||
let data = await orderDetail(id);
|
||||
if (data) {
|
||||
order.value = data;
|
||||
}
|
||||
}
|
||||
};
|
||||
const openLocation = () => {
|
||||
let shop = order.value.shop;
|
||||
uni.openLocation({
|
||||
@ -228,46 +349,50 @@ const openLocation = () => {
|
||||
longitude: parseFloat(shop.lng),
|
||||
fail(res) {
|
||||
console.log(res);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
const makePhoneCall = () =>{
|
||||
};
|
||||
const makePhoneCall = () => {
|
||||
let shop = order.value.shop;
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: shop.mobile,
|
||||
fail(res) {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log(res);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 确认收到货
|
||||
const receive = async(order) => {
|
||||
let data = await orderReceive({uni:order.orderId});
|
||||
const receive = async (order) => {
|
||||
let data = await orderReceive({ uni: order.orderId });
|
||||
if (data) {
|
||||
// await getOrders(true)
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/order'
|
||||
})
|
||||
url: "/pages/components/pages/orders/detail?id=" + order.orderId,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
//提交退款
|
||||
const refund = (order) => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/components/pages/orders/refund?orderId=' + order.orderId + '&payPrice=' + order.payPrice + '&totalPrice=' + order.totalPrice
|
||||
})
|
||||
}
|
||||
|
||||
url:
|
||||
"/pages/components/pages/orders/refund?orderId=" +
|
||||
order.orderId +
|
||||
"&payPrice=" +
|
||||
order.payPrice +
|
||||
"&totalPrice=" +
|
||||
order.totalPrice,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.image {
|
||||
.image {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin-right: 30rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.pay-cell {
|
||||
width: 100%;
|
||||
@ -283,33 +408,30 @@ const refund = (order) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* #ifdef H5 */
|
||||
page {
|
||||
page {
|
||||
min-height: 100%;
|
||||
background-color: $bg-color;
|
||||
}
|
||||
/* #endif */
|
||||
.order-box {
|
||||
}
|
||||
/* #endif */
|
||||
.order-box {
|
||||
padding: 20rpx;
|
||||
/* #ifdef H5 */
|
||||
margin-bottom: 100rpx;
|
||||
/* #endif */
|
||||
}
|
||||
}
|
||||
|
||||
.drinks-img {
|
||||
.drinks-img {
|
||||
width: 260rpx;
|
||||
height: 260rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
.tips {
|
||||
margin: 60rpx 0 80rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@mixin arch {
|
||||
@mixin arch {
|
||||
content: "";
|
||||
position: absolute;
|
||||
background-color: $bg-color;
|
||||
@ -318,9 +440,9 @@ const refund = (order) => {
|
||||
bottom: -15rpx;
|
||||
z-index: 10;
|
||||
border-radius: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.section {
|
||||
.section {
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
@ -332,9 +454,9 @@ const refund = (order) => {
|
||||
@include arch;
|
||||
right: -15rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pay-cell {
|
||||
.pay-cell {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -346,16 +468,16 @@ const refund = (order) => {
|
||||
&:nth-last-child(1) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sort-num {
|
||||
.sort-num {
|
||||
font-size: 64rpx;
|
||||
font-weight: bold;
|
||||
color: $text-color-base;
|
||||
line-height: 2;
|
||||
}
|
||||
}
|
||||
|
||||
.steps__img-column {
|
||||
.steps__img-column {
|
||||
display: flex;
|
||||
margin: 30rpx 0;
|
||||
|
||||
@ -373,9 +495,9 @@ const refund = (order) => {
|
||||
color: #919293;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.steps__text-column {
|
||||
.steps__text-column {
|
||||
display: flex;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
@ -397,7 +519,7 @@ const refund = (order) => {
|
||||
}
|
||||
}
|
||||
|
||||
.steps__column-item-line{
|
||||
.steps__column-item-line {
|
||||
flex: 1;
|
||||
height: 2rpx;
|
||||
background-color: #919293;
|
||||
@ -408,11 +530,14 @@ const refund = (order) => {
|
||||
margin: 0 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.icon-lamp, .icon-daojishi, .icon-takeout, .icon-doorbell{
|
||||
}
|
||||
.icon-lamp,
|
||||
.icon-daojishi,
|
||||
.icon-takeout,
|
||||
.icon-doorbell {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
.iconfont-yshop {
|
||||
}
|
||||
.iconfont-yshop {
|
||||
color: #52ac41;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -239,7 +239,7 @@ const serv = (item) => {
|
||||
return;
|
||||
}
|
||||
if (item.pages === "/pages/components/pages/fenxiao/fenxiao") {
|
||||
if (member.value.spreadUid === 0 || member.value.spreadUid === null || member.value.spreadUid === '0') {
|
||||
if (member.value.spreadUid === 0 || member.value.spreadUid === null || member.value.spreadUid === '0' || member.value.spreadUid === "") {
|
||||
uni.navigateTo({
|
||||
url: `/pages/components/pages/fenxiao/fenxiaorequestform?id=${member.value.id}`,
|
||||
});
|
||||
@ -248,6 +248,10 @@ const serv = (item) => {
|
||||
url: `${item.pages}?spreadUid=${member.value.spreadUid}`,
|
||||
});
|
||||
}
|
||||
} else if(item.pages === "/pages/components/pages/invoice/invoice") {
|
||||
uni.navigateTo({
|
||||
url: `/pages/components/pages/invoice/invoice?userId=${member.value.id}`,
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: item.pages,
|
||||
|
@ -128,14 +128,19 @@
|
||||
import { ref, computed } from "vue";
|
||||
import { useMainStore } from "@/store/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { onLoad, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
|
||||
import {
|
||||
onLoad,
|
||||
onPullDownRefresh,
|
||||
onReachBottom,
|
||||
onShow,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { formatDateTime, kmUnit } from "@/utils/util";
|
||||
import { orderGetOrders, orderReceive } from "@/api/order";
|
||||
import { applyInvoice } from "@/api/order";
|
||||
|
||||
// 确保导入payUnify方法
|
||||
import { payUnify } from '@/api/order';
|
||||
import { isWeixin } from '@/utils/util';
|
||||
import { payUnify } from "@/api/order";
|
||||
import { isWeixin } from "@/utils/util";
|
||||
|
||||
const main = useMainStore();
|
||||
const { isLogin } = storeToRefs(main);
|
||||
@ -181,10 +186,15 @@ onLoad(() => {
|
||||
if (!isLogin.value) {
|
||||
uni.navigateTo({ url: "/pages/components/pages/login/login" });
|
||||
}
|
||||
getOrders(false);
|
||||
onShow();
|
||||
});
|
||||
onShow(() => {
|
||||
if (isLogin.value) {
|
||||
getOrders(true); // 每次显示页面时刷新订单数据
|
||||
}
|
||||
});
|
||||
onPullDownRefresh(() => {
|
||||
getOrders(false);
|
||||
getOrders(true);
|
||||
});
|
||||
onReachBottom(() => {
|
||||
getOrders(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user